-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
193 lines (179 loc) · 7.94 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Panel Application</title>
<style>
html, body {
box-sizing: border-box;
height: 100%;
margin: 0;
padding: 0;
}
</style>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" type="text/css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" type="text/css" />
<style type="text/css">
:host(.pn-loading),
.pn-loading {
overflow: hidden;
}
:host(.pn-loading):before,
.pn-loading:before {
position: absolute;
height: 100%;
width: 100%;
content: '';
z-index: 1000;
background-color: rgb(255, 255, 255, 0.5);
border-color: lightgray;
background-repeat: no-repeat;
background-position: center;
background-size: auto 50%;
border-width: 1px;
cursor: progress;
}
:host(.pn-loading) .pn-loading-msg,
.pn-loading .pn-loading-msg {
position: absolute;
top: 72%;
font-size: 2em;
color: black;
width: 100%;
text-align: center;
}
:host(.pn-loading).arc:before, .pn-loading.arc:before {
background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHN0eWxlPSJtYXJnaW46IGF1dG87IGJhY2tncm91bmQ6IG5vbmU7IGRpc3BsYXk6IGJsb2NrOyBzaGFwZS1yZW5kZXJpbmc6IGF1dG87IiB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQiPiAgPGNpcmNsZSBjeD0iNTAiIGN5PSI1MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjYzNjM2MzIiBzdHJva2Utd2lkdGg9IjEwIiByPSIzNSIgc3Ryb2tlLWRhc2hhcnJheT0iMTY0LjkzMzYxNDMxMzQ2NDE1IDU2Ljk3Nzg3MTQzNzgyMTM4Ij4gICAgPGFuaW1hdGVUcmFuc2Zvcm0gYXR0cmlidXRlTmFtZT0idHJhbnNmb3JtIiB0eXBlPSJyb3RhdGUiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiBkdXI9IjFzIiB2YWx1ZXM9IjAgNTAgNTA7MzYwIDUwIDUwIiBrZXlUaW1lcz0iMDsxIj48L2FuaW1hdGVUcmFuc2Zvcm0+ICA8L2NpcmNsZT48L3N2Zz4=");
background-size: auto calc(min(50%, 400px));
}
</style><script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-3.1.1.min.js"></script>
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-gl-3.1.1.min.js"></script>
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-3.1.1.min.js"></script>
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-tables-3.1.1.min.js"></script>
<script type="text/javascript" src="https://cdn.holoviz.org/panel/1.0.2/dist/bundled/[email protected]/dist/material-components-web.min.js"></script>
<script type="text/javascript" src="https://cdn.holoviz.org/panel/1.0.2/dist/panel.min.js"></script>
<script type="text/javascript">
Bokeh.set_log_level("info");
</script> </head>
<body class="pn-loading arc">
<div id="ad8e81bf-7efe-40dd-ba95-2a9ae73c6abe" data-root-id="p1069" style="display: contents;"></div>
<div id="f631bc8c-afaf-40fe-a192-ee4c5e21550c" data-root-id="p1177" style="display: contents;"></div>
<div id="e87bcd81-dc5d-439a-8f9d-d6de755eb29d" data-root-id="p1191" style="display: contents;"></div>
<script type="text/javascript">
const pyodideWorker = new Worker("./main_db.js");
pyodideWorker.busy = false
pyodideWorker.queue = []
function send_change(jsdoc, event) {
if (event.setter_id != null && event.setter_id == 'py') {
return
} else if (pyodideWorker.busy && event.model && event.attr) {
let events = []
for (const old_event of pyodideWorker.queue) {
if (!(old_event.model === event.model && old_event.attr === event.attr)) {
events.push(old_event)
}
}
events.push(event)
pyodideWorker.queue = events
return
}
const patch = jsdoc.create_json_patch([event])
pyodideWorker.busy = true
pyodideWorker.postMessage({type: 'patch', patch: patch})
}
pyodideWorker.onmessage = async (event) => {
const msg = event.data
const body = document.getElementsByTagName('body')[0]
const loading_msgs = document.getElementsByClassName('pn-loading-msg')
if (msg.type === 'idle') {
if (pyodideWorker.queue.length) {
const patch = pyodideWorker.jsdoc.create_json_patch_string(pyodideWorker.queue)
pyodideWorker.busy = true
pyodideWorker.queue = []
pyodideWorker.postMessage({type: 'patch', patch: patch})
} else {
pyodideWorker.busy = false
}
} else if (msg.type === 'status') {
let loading_msg
if (loading_msgs.length) {
loading_msg = loading_msgs[0]
} else if (body.classList.contains('pn-loading')) {
loading_msg = document.createElement('div')
loading_msg.classList.add('pn-loading-msg')
body.appendChild(loading_msg)
}
if (loading_msg != null) {
loading_msg.innerHTML = msg.msg
}
} else if (msg.type === 'render') {
const docs_json = JSON.parse(msg.docs_json)
const render_items = JSON.parse(msg.render_items)
const root_ids = JSON.parse(msg.root_ids)
// Remap roots in message to element IDs
const root_els = document.querySelectorAll('[data-root-id]')
const data_roots = []
for (const el of root_els) {
el.innerHTML = ''
data_roots.push([el.getAttribute('data-root-id'), el.id])
}
data_roots.sort((a, b) => a[0]<b[0] ? -1: 1)
const roots = {}
for (let i=0; i<data_roots.length; i++) {
roots[root_ids[i]] = data_roots[i][1]
}
render_items[0]['roots'] = roots
render_items[0]['root_ids'] = root_ids
// Embed content
const [views] = await Bokeh.embed.embed_items(docs_json, render_items)
// Remove loading spinner and message
body.classList.remove("pn-loading", "arc")
for (const loading_msg of loading_msgs) {
loading_msg.remove()
}
// Setup bi-directional syncing
pyodideWorker.jsdoc = jsdoc = [...views.roots.values()][0].model.document
jsdoc.on_change(send_change.bind(null, jsdoc), false)
pyodideWorker.postMessage({'type': 'rendered'})
pyodideWorker.postMessage({'type': 'location', location: JSON.stringify(window.location)})
} else if (msg.type === 'patch') {
pyodideWorker.jsdoc.apply_json_patch(msg.patch, msg.buffers, setter_id='py')
}
};
</script>
<script type="text/javascript">
(function() {
const fn = function() {
Bokeh.safely(function() {
(function(root) {
function embed_document(root) {
const docs_json = document.getElementById('p1221').textContent;
const render_items = [{"docid":"b86d5642-f0ff-4439-92e4-90e3b4f33219","roots":{"p1069":"ad8e81bf-7efe-40dd-ba95-2a9ae73c6abe","p1177":"f631bc8c-afaf-40fe-a192-ee4c5e21550c","p1191":"e87bcd81-dc5d-439a-8f9d-d6de755eb29d"},"root_ids":["p1069","p1177","p1191"]}];
root.Bokeh.embed.embed_items(docs_json, render_items);
}
if (root.Bokeh !== undefined) {
embed_document(root);
} else {
let attempts = 0;
const timer = setInterval(function(root) {
if (root.Bokeh !== undefined) {
clearInterval(timer);
embed_document(root);
} else {
attempts++;
if (attempts > 100) {
clearInterval(timer);
console.log("Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing");
}
}
}, 10, root)
}
})(window);
});
};
if (document.readyState != "loading") fn();
else document.addEventListener("DOMContentLoaded", fn);
})();
</script>
</body>
</html>