streamlit-nightly 1.38.1.dev20240915__py2.py3-none-any.whl → 1.38.1.dev20240916__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- streamlit/commands/navigation.py +1 -1
- streamlit/elements/arrow.py +1 -1
- streamlit/elements/vega_charts.py +1 -1
- streamlit/navigation/page.py +1 -1
- streamlit/runtime/fragment.py +1 -3
- streamlit/runtime/pages_manager.py +19 -50
- streamlit/runtime/scriptrunner/script_runner.py +0 -1
- streamlit/runtime/scriptrunner_utils/script_run_context.py +27 -3
- streamlit/static/asset-manifest.json +3 -3
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/7591.b3928443.chunk.js +2 -0
- streamlit/static/static/js/7591.b3928443.chunk.js.LICENSE.txt +1 -0
- streamlit/static/static/js/{main.8721af5a.js → main.50e02474.js} +2 -2
- {streamlit_nightly-1.38.1.dev20240915.dist-info → streamlit_nightly-1.38.1.dev20240916.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.38.1.dev20240915.dist-info → streamlit_nightly-1.38.1.dev20240916.dist-info}/RECORD +20 -20
- {streamlit_nightly-1.38.1.dev20240915.dist-info → streamlit_nightly-1.38.1.dev20240916.dist-info}/WHEEL +1 -1
- streamlit/static/static/js/7591.116b650a.chunk.js +0 -2
- streamlit/static/static/js/7591.116b650a.chunk.js.LICENSE.txt +0 -1
- /streamlit/static/static/js/{main.8721af5a.js.LICENSE.txt → main.50e02474.js.LICENSE.txt} +0 -0
- {streamlit_nightly-1.38.1.dev20240915.data → streamlit_nightly-1.38.1.dev20240916.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.38.1.dev20240915.dist-info → streamlit_nightly-1.38.1.dev20240916.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.38.1.dev20240915.dist-info → streamlit_nightly-1.38.1.dev20240916.dist-info}/top_level.txt +0 -0
streamlit/commands/navigation.py
CHANGED
@@ -256,7 +256,7 @@ def navigation(
|
|
256
256
|
page_to_return._can_be_called = True
|
257
257
|
msg.navigation.page_script_hash = page_to_return._script_hash
|
258
258
|
# Set the current page script hash to the page that is going to be executed
|
259
|
-
ctx.
|
259
|
+
ctx.set_mpa_v2_page(page_to_return._script_hash)
|
260
260
|
|
261
261
|
# This will either navigation or yield if the page is not found
|
262
262
|
ctx.enqueue(msg)
|
streamlit/elements/arrow.py
CHANGED
@@ -578,7 +578,7 @@ class ArrowMixin:
|
|
578
578
|
selection_mode=selection_mode,
|
579
579
|
is_selection_activated=is_selection_activated,
|
580
580
|
form_id=proto.form_id,
|
581
|
-
page=ctx.
|
581
|
+
page=ctx.active_script_hash if ctx else None,
|
582
582
|
)
|
583
583
|
|
584
584
|
serde = DataframeSelectionSerde()
|
@@ -1906,7 +1906,7 @@ class VegaChartsMixin:
|
|
1906
1906
|
use_container_width=use_container_width,
|
1907
1907
|
selection_mode=parsed_selection_modes,
|
1908
1908
|
form_id=vega_lite_proto.form_id,
|
1909
|
-
page=ctx.
|
1909
|
+
page=ctx.active_script_hash if ctx else None,
|
1910
1910
|
)
|
1911
1911
|
|
1912
1912
|
serde = VegaLiteStateSerde(parsed_selection_modes)
|
streamlit/navigation/page.py
CHANGED
streamlit/runtime/fragment.py
CHANGED
@@ -222,9 +222,7 @@ def _fragment(
|
|
222
222
|
# This ensures that elements (especially widgets) are tied
|
223
223
|
# to a consistent active script hash
|
224
224
|
active_hash_context = (
|
225
|
-
ctx.
|
226
|
-
initialized_active_script_hash
|
227
|
-
)
|
225
|
+
ctx.run_with_active_hash(initialized_active_script_hash)
|
228
226
|
if initialized_active_script_hash != ctx.active_script_hash
|
229
227
|
else contextlib.nullcontext()
|
230
228
|
)
|
@@ -14,7 +14,6 @@
|
|
14
14
|
|
15
15
|
from __future__ import annotations
|
16
16
|
|
17
|
-
import contextlib
|
18
17
|
import os
|
19
18
|
import threading
|
20
19
|
from pathlib import Path
|
@@ -74,15 +73,9 @@ class PagesStrategyV1:
|
|
74
73
|
if setup_watcher:
|
75
74
|
PagesStrategyV1.watch_pages_dir(pages_manager)
|
76
75
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
return self.pages_manager.current_page_hash
|
81
|
-
|
82
|
-
def set_active_script_hash(self, _page_hash: PageHash):
|
83
|
-
# Intentionally do nothing as MPA v1 active_script_hash does not
|
84
|
-
# differentiate the active_script_hash and the page_script_hash
|
85
|
-
pass
|
76
|
+
@property
|
77
|
+
def initial_active_script_hash(self) -> PageHash:
|
78
|
+
return self.pages_manager.current_page_script_hash
|
86
79
|
|
87
80
|
def get_initial_active_script(
|
88
81
|
self, page_script_hash: PageHash, page_name: PageName
|
@@ -147,15 +140,8 @@ class PagesStrategyV2:
|
|
147
140
|
|
148
141
|
def __init__(self, pages_manager: PagesManager, **kwargs):
|
149
142
|
self.pages_manager = pages_manager
|
150
|
-
self._active_script_hash: PageHash = self.pages_manager.main_script_hash
|
151
143
|
self._pages: dict[PageHash, PageInfo] | None = None
|
152
144
|
|
153
|
-
def get_active_script_hash(self) -> PageHash:
|
154
|
-
return self._active_script_hash
|
155
|
-
|
156
|
-
def set_active_script_hash(self, page_hash: PageHash):
|
157
|
-
self._active_script_hash = page_hash
|
158
|
-
|
159
145
|
def get_initial_active_script(
|
160
146
|
self, page_script_hash: PageHash, page_name: PageName
|
161
147
|
) -> PageInfo:
|
@@ -166,6 +152,10 @@ class PagesStrategyV2:
|
|
166
152
|
or self.pages_manager.main_script_hash, # Default Hash
|
167
153
|
}
|
168
154
|
|
155
|
+
@property
|
156
|
+
def initial_active_script_hash(self) -> PageHash:
|
157
|
+
return self.pages_manager.main_script_hash
|
158
|
+
|
169
159
|
def get_page_script(self, fallback_page_hash: PageHash) -> PageInfo | None:
|
170
160
|
if self._pages is None:
|
171
161
|
return None
|
@@ -243,15 +233,11 @@ class PagesManager:
|
|
243
233
|
):
|
244
234
|
self._main_script_path = main_script_path
|
245
235
|
self._main_script_hash: PageHash = calc_md5(main_script_path)
|
246
|
-
self._current_page_hash: PageHash = self._main_script_hash
|
247
236
|
self.pages_strategy = PagesManager.DefaultStrategy(self, **kwargs)
|
248
237
|
self._script_cache = script_cache
|
249
238
|
self._intended_page_script_hash: PageHash | None = None
|
250
239
|
self._intended_page_name: PageName | None = None
|
251
|
-
|
252
|
-
@property
|
253
|
-
def current_page_hash(self) -> PageHash:
|
254
|
-
return self._current_page_hash
|
240
|
+
self._current_page_script_hash: PageHash = ""
|
255
241
|
|
256
242
|
@property
|
257
243
|
def main_script_path(self) -> ScriptPath:
|
@@ -261,6 +247,10 @@ class PagesManager:
|
|
261
247
|
def main_script_hash(self) -> PageHash:
|
262
248
|
return self._main_script_hash
|
263
249
|
|
250
|
+
@property
|
251
|
+
def current_page_script_hash(self) -> PageHash:
|
252
|
+
return self._current_page_script_hash
|
253
|
+
|
264
254
|
@property
|
265
255
|
def intended_page_name(self) -> PageName | None:
|
266
256
|
return self._intended_page_name
|
@@ -269,34 +259,23 @@ class PagesManager:
|
|
269
259
|
def intended_page_script_hash(self) -> PageHash | None:
|
270
260
|
return self._intended_page_script_hash
|
271
261
|
|
262
|
+
@property
|
263
|
+
def initial_active_script_hash(self) -> PageHash:
|
264
|
+
return self.pages_strategy.initial_active_script_hash
|
265
|
+
|
272
266
|
@property
|
273
267
|
def mpa_version(self) -> int:
|
274
268
|
return 2 if isinstance(self.pages_strategy, PagesStrategyV2) else 1
|
275
269
|
|
270
|
+
def set_current_page_script_hash(self, page_script_hash: PageHash) -> None:
|
271
|
+
self._current_page_script_hash = page_script_hash
|
272
|
+
|
276
273
|
def get_main_page(self) -> PageInfo:
|
277
274
|
return {
|
278
275
|
"script_path": self._main_script_path,
|
279
276
|
"page_script_hash": self._main_script_hash,
|
280
277
|
}
|
281
278
|
|
282
|
-
def get_current_page_script_hash(self) -> PageHash:
|
283
|
-
"""Gets the script hash of the associated page of a script."""
|
284
|
-
return self._current_page_hash
|
285
|
-
|
286
|
-
def set_current_page_script_hash(self, page_hash: PageHash) -> None:
|
287
|
-
self._current_page_hash = page_hash
|
288
|
-
|
289
|
-
def get_active_script_hash(self) -> PageHash:
|
290
|
-
"""Gets the script hash of the currently executing script."""
|
291
|
-
return self.pages_strategy.get_active_script_hash()
|
292
|
-
|
293
|
-
def set_active_script_hash(self, page_hash: PageHash):
|
294
|
-
return self.pages_strategy.set_active_script_hash(page_hash)
|
295
|
-
|
296
|
-
def reset_active_script_hash(self):
|
297
|
-
# This will only apply to the V2 strategy as V1 ignores the concept
|
298
|
-
self.set_active_script_hash(self.main_script_hash)
|
299
|
-
|
300
279
|
def set_script_intent(
|
301
280
|
self, page_script_hash: PageHash, page_name: PageName
|
302
281
|
) -> None:
|
@@ -310,16 +289,6 @@ class PagesManager:
|
|
310
289
|
page_script_hash, page_name
|
311
290
|
)
|
312
291
|
|
313
|
-
@contextlib.contextmanager
|
314
|
-
def run_with_active_hash(self, page_hash: PageHash):
|
315
|
-
original_page_hash = self.get_active_script_hash()
|
316
|
-
self.set_active_script_hash(page_hash)
|
317
|
-
try:
|
318
|
-
yield
|
319
|
-
finally:
|
320
|
-
# in the event of any exception, ensure we set the active hash back
|
321
|
-
self.set_active_script_hash(original_page_hash)
|
322
|
-
|
323
292
|
def get_pages(self) -> dict[PageHash, PageInfo]:
|
324
293
|
return self.pages_strategy.get_pages()
|
325
294
|
|
@@ -15,10 +15,18 @@
|
|
15
15
|
from __future__ import annotations
|
16
16
|
|
17
17
|
import collections
|
18
|
+
import contextlib
|
18
19
|
import contextvars
|
19
20
|
import threading
|
20
21
|
from dataclasses import dataclass, field
|
21
|
-
from typing import
|
22
|
+
from typing import (
|
23
|
+
TYPE_CHECKING,
|
24
|
+
Callable,
|
25
|
+
Counter,
|
26
|
+
Dict,
|
27
|
+
Final,
|
28
|
+
Union,
|
29
|
+
)
|
22
30
|
from urllib import parse
|
23
31
|
|
24
32
|
from typing_extensions import TypeAlias
|
@@ -90,6 +98,7 @@ class ScriptRunContext:
|
|
90
98
|
current_fragment_id: str | None = None
|
91
99
|
fragment_ids_this_run: list[str] | None = None
|
92
100
|
new_fragment_ids: set[str] = field(default_factory=set)
|
101
|
+
_active_script_hash: str = ""
|
93
102
|
# we allow only one dialog to be open at the same time
|
94
103
|
has_dialog_opened: bool = False
|
95
104
|
|
@@ -99,11 +108,25 @@ class ScriptRunContext:
|
|
99
108
|
|
100
109
|
@property
|
101
110
|
def page_script_hash(self):
|
102
|
-
return self.pages_manager.
|
111
|
+
return self.pages_manager.current_page_script_hash
|
103
112
|
|
104
113
|
@property
|
105
114
|
def active_script_hash(self):
|
106
|
-
return self.
|
115
|
+
return self._active_script_hash
|
116
|
+
|
117
|
+
@contextlib.contextmanager
|
118
|
+
def run_with_active_hash(self, page_hash: str):
|
119
|
+
original_page_hash = self._active_script_hash
|
120
|
+
self._active_script_hash = page_hash
|
121
|
+
try:
|
122
|
+
yield
|
123
|
+
finally:
|
124
|
+
# in the event of any exception, ensure we set the active hash back
|
125
|
+
self._active_script_hash = original_page_hash
|
126
|
+
|
127
|
+
def set_mpa_v2_page(self, page_script_hash: str):
|
128
|
+
self._active_script_hash = self.pages_manager.main_script_hash
|
129
|
+
self.pages_manager.set_current_page_script_hash(page_script_hash)
|
107
130
|
|
108
131
|
def reset(
|
109
132
|
self,
|
@@ -117,6 +140,7 @@ class ScriptRunContext:
|
|
117
140
|
self.form_ids_this_run = set()
|
118
141
|
self.query_string = query_string
|
119
142
|
self.pages_manager.set_current_page_script_hash(page_script_hash)
|
143
|
+
self._active_script_hash = self.pages_manager.initial_active_script_hash
|
120
144
|
# Permit set_page_config when the ScriptRunContext is reused on a rerun
|
121
145
|
self._set_page_config_allowed = True
|
122
146
|
self._has_script_started = False
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"files": {
|
3
3
|
"main.css": "./static/css/main.5513bd04.css",
|
4
|
-
"main.js": "./static/js/main.
|
4
|
+
"main.js": "./static/js/main.50e02474.js",
|
5
5
|
"static/js/6679.265ca09c.chunk.js": "./static/js/6679.265ca09c.chunk.js",
|
6
6
|
"static/js/9464.7e9a3c0a.chunk.js": "./static/js/9464.7e9a3c0a.chunk.js",
|
7
7
|
"static/js/9077.e0a8db2a.chunk.js": "./static/js/9077.e0a8db2a.chunk.js",
|
@@ -62,7 +62,7 @@
|
|
62
62
|
"static/js/797.36f1bf7d.chunk.js": "./static/js/797.36f1bf7d.chunk.js",
|
63
63
|
"static/js/6198.956025ac.chunk.js": "./static/js/6198.956025ac.chunk.js",
|
64
64
|
"static/js/1674.86aea8e0.chunk.js": "./static/js/1674.86aea8e0.chunk.js",
|
65
|
-
"static/js/7591.
|
65
|
+
"static/js/7591.b3928443.chunk.js": "./static/js/7591.b3928443.chunk.js",
|
66
66
|
"static/media/MaterialSymbols-Rounded.woff2": "./static/media/MaterialSymbols-Rounded.ec07649f7a20048d5730.woff2",
|
67
67
|
"static/media/fireworks.gif": "./static/media/fireworks.0906f02ea43f1018a6d2.gif",
|
68
68
|
"static/media/flake-2.png": "./static/media/flake-2.e3f07d06933dd0e84c24.png",
|
@@ -153,6 +153,6 @@
|
|
153
153
|
},
|
154
154
|
"entrypoints": [
|
155
155
|
"static/css/main.5513bd04.css",
|
156
|
-
"static/js/main.
|
156
|
+
"static/js/main.50e02474.js"
|
157
157
|
]
|
158
158
|
}
|
streamlit/static/index.html
CHANGED
@@ -1 +1 @@
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><link rel="shortcut icon" href="./favicon.png"/><link rel="preload" href="./static/media/SourceSansPro-Regular.0d69e5ff5e92ac64a0c9.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-SemiBold.abed79cd0df1827e18cf.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-Bold.118dea98980e20a81ced.woff2" as="font" type="font/woff2" crossorigin><title>Streamlit</title><script>window.prerenderReady=!1</script><script defer="defer" src="./static/js/main.
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><link rel="shortcut icon" href="./favicon.png"/><link rel="preload" href="./static/media/SourceSansPro-Regular.0d69e5ff5e92ac64a0c9.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-SemiBold.abed79cd0df1827e18cf.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-Bold.118dea98980e20a81ced.woff2" as="font" type="font/woff2" crossorigin><title>Streamlit</title><script>window.prerenderReady=!1</script><script defer="defer" src="./static/js/main.50e02474.js"></script><link href="./static/css/main.5513bd04.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
@@ -0,0 +1,2 @@
|
|
1
|
+
/*! For license information please see 7591.b3928443.chunk.js.LICENSE.txt */
|
2
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[7591],{17591:(e,t,n)=>{n.d(t,{A:()=>ie});const{entries:o,setPrototypeOf:r,isFrozen:i,getPrototypeOf:a,getOwnPropertyDescriptor:l}=Object;let{freeze:c,seal:s,create:u}=Object,{apply:m,construct:p}="undefined"!==typeof Reflect&&Reflect;c||(c=function(e){return e}),s||(s=function(e){return e}),m||(m=function(e,t,n){return e.apply(t,n)}),p||(p=function(e,t){return new e(...t)});const f=w(Array.prototype.forEach),d=w(Array.prototype.pop),h=w(Array.prototype.push),g=w(String.prototype.toLowerCase),T=w(String.prototype.toString),y=w(String.prototype.match),E=w(String.prototype.replace),_=w(String.prototype.indexOf),A=w(String.prototype.trim),N=w(Object.prototype.hasOwnProperty),b=w(RegExp.prototype.test),S=(R=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return p(R,t)});var R;function w(e){return function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return m(e,t,o)}}function C(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:g;r&&r(e,null);let o=t.length;for(;o--;){let r=t[o];if("string"===typeof r){const e=n(r);e!==r&&(i(t)||(t[o]=e),r=e)}e[r]=!0}return e}function L(e){for(let t=0;t<e.length;t++){N(e,t)||(e[t]=null)}return e}function v(e){const t=u(null);for(const[n,r]of o(e)){N(e,n)&&(Array.isArray(r)?t[n]=L(r):r&&"object"===typeof r&&r.constructor===Object?t[n]=v(r):t[n]=r)}return t}function D(e,t){for(;null!==e;){const n=l(e,t);if(n){if(n.get)return w(n.get);if("function"===typeof n.value)return w(n.value)}e=a(e)}return function(){return null}}const k=c(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),O=c(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),x=c(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),I=c(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),M=c(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),U=c(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),P=c(["#text"]),F=c(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),H=c(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),z=c(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),B=c(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),W=s(/\{\{[\w\W]*|[\w\W]*\}\}/gm),G=s(/<%[\w\W]*|[\w\W]*%>/gm),Y=s(/\${[\w\W]*}/gm),j=s(/^data-[\-\w.\u00B7-\uFFFF]/),X=s(/^aria-[\-\w]+$/),q=s(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),$=s(/^(?:\w+script|data):/i),K=s(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),V=s(/^html$/i),Z=s(/^[a-z][.\w]*(-[.\w]+)+$/i);var J=Object.freeze({__proto__:null,MUSTACHE_EXPR:W,ERB_EXPR:G,TMPLIT_EXPR:Y,DATA_ATTR:j,ARIA_ATTR:X,IS_ALLOWED_URI:q,IS_SCRIPT_OR_DATA:$,ATTR_WHITESPACE:K,DOCTYPE_NAME:V,CUSTOM_ELEMENT:Z});const Q=1,ee=3,te=7,ne=8,oe=9,re=function(){return"undefined"===typeof window?null:window};var ie=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:re();const n=t=>e(t);if(n.version="3.1.6",n.removed=[],!t||!t.document||t.document.nodeType!==oe)return n.isSupported=!1,n;let{document:r}=t;const i=r,a=i.currentScript,{DocumentFragment:l,HTMLTemplateElement:s,Node:m,Element:p,NodeFilter:R,NamedNodeMap:w=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:L,DOMParser:W,trustedTypes:G}=t,Y=p.prototype,j=D(Y,"cloneNode"),X=D(Y,"remove"),$=D(Y,"nextSibling"),K=D(Y,"childNodes"),Z=D(Y,"parentNode");if("function"===typeof s){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let ie,ae="";const{implementation:le,createNodeIterator:ce,createDocumentFragment:se,getElementsByTagName:ue}=r,{importNode:me}=i;let pe={};n.isSupported="function"===typeof o&&"function"===typeof Z&&le&&void 0!==le.createHTMLDocument;const{MUSTACHE_EXPR:fe,ERB_EXPR:de,TMPLIT_EXPR:he,DATA_ATTR:ge,ARIA_ATTR:Te,IS_SCRIPT_OR_DATA:ye,ATTR_WHITESPACE:Ee,CUSTOM_ELEMENT:_e}=J;let{IS_ALLOWED_URI:Ae}=J,Ne=null;const be=C({},[...k,...O,...x,...M,...P]);let Se=null;const Re=C({},[...F,...H,...z,...B]);let we=Object.seal(u(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ce=null,Le=null,ve=!0,De=!0,ke=!1,Oe=!0,xe=!1,Ie=!0,Me=!1,Ue=!1,Pe=!1,Fe=!1,He=!1,ze=!1,Be=!0,We=!1,Ge=!0,Ye=!1,je={},Xe=null;const qe=C({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let $e=null;const Ke=C({},["audio","video","img","source","image","track"]);let Ve=null;const Ze=C({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Je="http://www.w3.org/1998/Math/MathML",Qe="http://www.w3.org/2000/svg",et="http://www.w3.org/1999/xhtml";let tt=et,nt=!1,ot=null;const rt=C({},[Je,Qe,et],T);let it=null;const at=["application/xhtml+xml","text/html"];let lt=null,ct=null;const st=r.createElement("form"),ut=function(e){return e instanceof RegExp||e instanceof Function},mt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!ct||ct!==e){if(e&&"object"===typeof e||(e={}),e=v(e),it=-1===at.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,lt="application/xhtml+xml"===it?T:g,Ne=N(e,"ALLOWED_TAGS")?C({},e.ALLOWED_TAGS,lt):be,Se=N(e,"ALLOWED_ATTR")?C({},e.ALLOWED_ATTR,lt):Re,ot=N(e,"ALLOWED_NAMESPACES")?C({},e.ALLOWED_NAMESPACES,T):rt,Ve=N(e,"ADD_URI_SAFE_ATTR")?C(v(Ze),e.ADD_URI_SAFE_ATTR,lt):Ze,$e=N(e,"ADD_DATA_URI_TAGS")?C(v(Ke),e.ADD_DATA_URI_TAGS,lt):Ke,Xe=N(e,"FORBID_CONTENTS")?C({},e.FORBID_CONTENTS,lt):qe,Ce=N(e,"FORBID_TAGS")?C({},e.FORBID_TAGS,lt):{},Le=N(e,"FORBID_ATTR")?C({},e.FORBID_ATTR,lt):{},je=!!N(e,"USE_PROFILES")&&e.USE_PROFILES,ve=!1!==e.ALLOW_ARIA_ATTR,De=!1!==e.ALLOW_DATA_ATTR,ke=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Oe=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,xe=e.SAFE_FOR_TEMPLATES||!1,Ie=!1!==e.SAFE_FOR_XML,Me=e.WHOLE_DOCUMENT||!1,Fe=e.RETURN_DOM||!1,He=e.RETURN_DOM_FRAGMENT||!1,ze=e.RETURN_TRUSTED_TYPE||!1,Pe=e.FORCE_BODY||!1,Be=!1!==e.SANITIZE_DOM,We=e.SANITIZE_NAMED_PROPS||!1,Ge=!1!==e.KEEP_CONTENT,Ye=e.IN_PLACE||!1,Ae=e.ALLOWED_URI_REGEXP||q,tt=e.NAMESPACE||et,we=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&ut(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(we.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&ut(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(we.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"===typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(we.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),xe&&(De=!1),He&&(Fe=!0),je&&(Ne=C({},P),Se=[],!0===je.html&&(C(Ne,k),C(Se,F)),!0===je.svg&&(C(Ne,O),C(Se,H),C(Se,B)),!0===je.svgFilters&&(C(Ne,x),C(Se,H),C(Se,B)),!0===je.mathMl&&(C(Ne,M),C(Se,z),C(Se,B))),e.ADD_TAGS&&(Ne===be&&(Ne=v(Ne)),C(Ne,e.ADD_TAGS,lt)),e.ADD_ATTR&&(Se===Re&&(Se=v(Se)),C(Se,e.ADD_ATTR,lt)),e.ADD_URI_SAFE_ATTR&&C(Ve,e.ADD_URI_SAFE_ATTR,lt),e.FORBID_CONTENTS&&(Xe===qe&&(Xe=v(Xe)),C(Xe,e.FORBID_CONTENTS,lt)),Ge&&(Ne["#text"]=!0),Me&&C(Ne,["html","head","body"]),Ne.table&&(C(Ne,["tbody"]),delete Ce.tbody),e.TRUSTED_TYPES_POLICY){if("function"!==typeof e.TRUSTED_TYPES_POLICY.createHTML)throw S('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!==typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw S('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');ie=e.TRUSTED_TYPES_POLICY,ae=ie.createHTML("")}else void 0===ie&&(ie=function(e,t){if("object"!==typeof e||"function"!==typeof e.createPolicy)return null;let n=null;const o="data-tt-policy-suffix";t&&t.hasAttribute(o)&&(n=t.getAttribute(o));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(i){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(G,a)),null!==ie&&"string"===typeof ae&&(ae=ie.createHTML(""));c&&c(e),ct=e}},pt=C({},["mi","mo","mn","ms","mtext"]),ft=C({},["foreignobject","annotation-xml"]),dt=C({},["title","style","font","a","script"]),ht=C({},[...O,...x,...I]),gt=C({},[...M,...U]),Tt=function(e){h(n.removed,{element:e});try{Z(e).removeChild(e)}catch(t){X(e)}},yt=function(e,t){try{h(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(o){h(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!Se[e])if(Fe||He)try{Tt(t)}catch(o){}else try{t.setAttribute(e,"")}catch(o){}},Et=function(e){let t=null,n=null;if(Pe)e="<remove></remove>"+e;else{const t=y(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===it&&tt===et&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=ie?ie.createHTML(e):e;if(tt===et)try{t=(new W).parseFromString(o,it)}catch(a){}if(!t||!t.documentElement){t=le.createDocument(tt,"template",null);try{t.documentElement.innerHTML=nt?ae:o}catch(a){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(r.createTextNode(n),i.childNodes[0]||null),tt===et?ue.call(t,Me?"html":"body")[0]:Me?t.documentElement:i},_t=function(e){return ce.call(e.ownerDocument||e,e,R.SHOW_ELEMENT|R.SHOW_COMMENT|R.SHOW_TEXT|R.SHOW_PROCESSING_INSTRUCTION|R.SHOW_CDATA_SECTION,null)},At=function(e){return e instanceof L&&("string"!==typeof e.nodeName||"string"!==typeof e.textContent||"function"!==typeof e.removeChild||!(e.attributes instanceof w)||"function"!==typeof e.removeAttribute||"function"!==typeof e.setAttribute||"string"!==typeof e.namespaceURI||"function"!==typeof e.insertBefore||"function"!==typeof e.hasChildNodes)},Nt=function(e){return"function"===typeof m&&e instanceof m},bt=function(e,t,o){pe[e]&&f(pe[e],(e=>{e.call(n,t,o,ct)}))},St=function(e){let t=null;if(bt("beforeSanitizeElements",e,null),At(e))return Tt(e),!0;const o=lt(e.nodeName);if(bt("uponSanitizeElement",e,{tagName:o,allowedTags:Ne}),e.hasChildNodes()&&!Nt(e.firstElementChild)&&b(/<[/\w]/g,e.innerHTML)&&b(/<[/\w]/g,e.textContent))return Tt(e),!0;if(e.nodeType===te)return Tt(e),!0;if(Ie&&e.nodeType===ne&&b(/<[/\w]/g,e.data))return Tt(e),!0;if(!Ne[o]||Ce[o]){if(!Ce[o]&&wt(o)){if(we.tagNameCheck instanceof RegExp&&b(we.tagNameCheck,o))return!1;if(we.tagNameCheck instanceof Function&&we.tagNameCheck(o))return!1}if(Ge&&!Xe[o]){const t=Z(e)||e.parentNode,n=K(e)||e.childNodes;if(n&&t){for(let o=n.length-1;o>=0;--o){const r=j(n[o],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,$(e))}}}return Tt(e),!0}return e instanceof p&&!function(e){let t=Z(e);t&&t.tagName||(t={namespaceURI:tt,tagName:"template"});const n=g(e.tagName),o=g(t.tagName);return!!ot[e.namespaceURI]&&(e.namespaceURI===Qe?t.namespaceURI===et?"svg"===n:t.namespaceURI===Je?"svg"===n&&("annotation-xml"===o||pt[o]):Boolean(ht[n]):e.namespaceURI===Je?t.namespaceURI===et?"math"===n:t.namespaceURI===Qe?"math"===n&&ft[o]:Boolean(gt[n]):e.namespaceURI===et?!(t.namespaceURI===Qe&&!ft[o])&&!(t.namespaceURI===Je&&!pt[o])&&!gt[n]&&(dt[n]||!ht[n]):!("application/xhtml+xml"!==it||!ot[e.namespaceURI]))}(e)?(Tt(e),!0):"noscript"!==o&&"noembed"!==o&&"noframes"!==o||!b(/<\/no(script|embed|frames)/i,e.innerHTML)?(xe&&e.nodeType===ee&&(t=e.textContent,f([fe,de,he],(e=>{t=E(t,e," ")})),e.textContent!==t&&(h(n.removed,{element:e.cloneNode()}),e.textContent=t)),bt("afterSanitizeElements",e,null),!1):(Tt(e),!0)},Rt=function(e,t,n){if(Be&&("id"===t||"name"===t)&&(n in r||n in st))return!1;if(De&&!Le[t]&&b(ge,t));else if(ve&&b(Te,t));else if(!Se[t]||Le[t]){if(!(wt(e)&&(we.tagNameCheck instanceof RegExp&&b(we.tagNameCheck,e)||we.tagNameCheck instanceof Function&&we.tagNameCheck(e))&&(we.attributeNameCheck instanceof RegExp&&b(we.attributeNameCheck,t)||we.attributeNameCheck instanceof Function&&we.attributeNameCheck(t))||"is"===t&&we.allowCustomizedBuiltInElements&&(we.tagNameCheck instanceof RegExp&&b(we.tagNameCheck,n)||we.tagNameCheck instanceof Function&&we.tagNameCheck(n))))return!1}else if(Ve[t]);else if(b(Ae,E(n,Ee,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==_(n,"data:")||!$e[e]){if(ke&&!b(ye,E(n,Ee,"")));else if(n)return!1}else;return!0},wt=function(e){return"annotation-xml"!==e&&y(e,_e)},Ct=function(e){bt("beforeSanitizeAttributes",e,null);const{attributes:t}=e;if(!t)return;const o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Se};let r=t.length;for(;r--;){const a=t[r],{name:l,namespaceURI:c,value:s}=a,u=lt(l);let m="value"===l?s:A(s);if(o.attrName=u,o.attrValue=m,o.keepAttr=!0,o.forceKeepAttr=void 0,bt("uponSanitizeAttribute",e,o),m=o.attrValue,Ie&&b(/((--!?|])>)|<\/(style|title)/i,m)){yt(l,e);continue}if(o.forceKeepAttr)continue;if(yt(l,e),!o.keepAttr)continue;if(!Oe&&b(/\/>/i,m)){yt(l,e);continue}xe&&f([fe,de,he],(e=>{m=E(m,e," ")}));const p=lt(e.nodeName);if(Rt(p,u,m)){if(!We||"id"!==u&&"name"!==u||(yt(l,e),m="user-content-"+m),ie&&"object"===typeof G&&"function"===typeof G.getAttributeType)if(c);else switch(G.getAttributeType(p,u)){case"TrustedHTML":m=ie.createHTML(m);break;case"TrustedScriptURL":m=ie.createScriptURL(m)}try{c?e.setAttributeNS(c,l,m):e.setAttribute(l,m),At(e)?Tt(e):d(n.removed)}catch(i){}}}bt("afterSanitizeAttributes",e,null)},Lt=function e(t){let n=null;const o=_t(t);for(bt("beforeSanitizeShadowDOM",t,null);n=o.nextNode();)bt("uponSanitizeShadowNode",n,null),St(n)||(n.content instanceof l&&e(n.content),Ct(n));bt("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=null,r=null,a=null,c=null;if(nt=!e,nt&&(e="\x3c!--\x3e"),"string"!==typeof e&&!Nt(e)){if("function"!==typeof e.toString)throw S("toString is not a function");if("string"!==typeof(e=e.toString()))throw S("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Ue||mt(t),n.removed=[],"string"===typeof e&&(Ye=!1),Ye){if(e.nodeName){const t=lt(e.nodeName);if(!Ne[t]||Ce[t])throw S("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof m)o=Et("\x3c!----\x3e"),r=o.ownerDocument.importNode(e,!0),r.nodeType===Q&&"BODY"===r.nodeName||"HTML"===r.nodeName?o=r:o.appendChild(r);else{if(!Fe&&!xe&&!Me&&-1===e.indexOf("<"))return ie&&ze?ie.createHTML(e):e;if(o=Et(e),!o)return Fe?null:ze?ae:""}o&&Pe&&Tt(o.firstChild);const s=_t(Ye?e:o);for(;a=s.nextNode();)St(a)||(a.content instanceof l&&Lt(a.content),Ct(a));if(Ye)return e;if(Fe){if(He)for(c=se.call(o.ownerDocument);o.firstChild;)c.appendChild(o.firstChild);else c=o;return(Se.shadowroot||Se.shadowrootmode)&&(c=me.call(i,c,!0)),c}let u=Me?o.outerHTML:o.innerHTML;return Me&&Ne["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&b(V,o.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+o.ownerDocument.doctype.name+">\n"+u),xe&&f([fe,de,he],(e=>{u=E(u,e," ")})),ie&&ze?ie.createHTML(u):u},n.setConfig=function(){mt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Ue=!0},n.clearConfig=function(){ct=null,Ue=!1},n.isValidAttribute=function(e,t,n){ct||mt({});const o=lt(e),r=lt(t);return Rt(o,r,n)},n.addHook=function(e,t){"function"===typeof t&&(pe[e]=pe[e]||[],h(pe[e],t))},n.removeHook=function(e){if(pe[e])return d(pe[e])},n.removeHooks=function(e){pe[e]&&(pe[e]=[])},n.removeAllHooks=function(){pe={}},n}()}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
/*! @license DOMPurify 3.1.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.6/LICENSE */
|