-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathshiny.min.js
462 lines (403 loc) · 124 KB
/
shiny.min.js
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
/*! shiny 1.10.0.9000 | (c) 2012-2025 Posit Software, PBC. | License: GPL-3 | file LICENSE */
"use strict";(()=>{var Dr=Object.create;var Oi=Object.defineProperty;var Pr=Object.getOwnPropertyDescriptor;var Br=Object.getOwnPropertyNames;var Lr=Object.getPrototypeOf,_r=Object.prototype.hasOwnProperty;var Ar=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var Rr=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Br(e))!_r.call(i,s)&&s!==t&&Oi(i,s,{get:()=>e[s],enumerable:!(n=Pr(e,s))||n.enumerable});return i};var M=(i,e,t)=>(t=i!=null?Dr(Lr(i)):{},Rr(e||!i||!i.__esModule?Oi(t,"default",{value:i,enumerable:!0}):t,i));var Or=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)};var Re=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)};var F=(i,e,t)=>(Or(i,e,"access private method"),t);var S=Ar((Ro,Vi)=>{Vi.exports=window.jQuery});var Ft=M(S());var zi=!1,Ni=!1,Ui=-1;function jn(i){zi=i}function Qi(i){Ni=i}function Ji(i){Ui=i}function Fi(){return zi}function Oe(){return Ni}function ji(){return Ui}var W;function qi(i){W=i}function Vr(){let i=W.indexOf("MSIE ");if(Oe()&&i>0)return parseInt(W.substring(i+5,W.indexOf(".",i)),10);if(W.indexOf("Trident/")>0){let t=W.indexOf("rv:");return parseInt(W.substring(t+3,W.indexOf(".",t)),10)}return-1}function Xi(){/\bQt\//.test(W)?((0,Ft.default)(document.documentElement).addClass("qt"),jn(!0)):jn(!1),/\bQt/.test(W)&&/\bMacintosh/.test(W)&&(0,Ft.default)(document.documentElement).addClass("qtmac"),/\bQt\/5/.test(W)&&/Linux/.test(W)&&(0,Ft.default)(document.documentElement).addClass("qt5"),Qi(/MSIE|Trident|Edge/.test(W)),Ji(Vr())}var Wi=M(S());function Gi(){(0,Wi.default)(document).on("submit","form:not([action])",function(i){i.preventDefault()})}var Ki=M(S());function Yi(){let i=window.history.pushState;window.history.pushState=function(...e){let t=i.apply(this,e);return(0,Ki.default)(document).trigger("pushstate"),t}}var H=M(S());var pt=M(S());function qn(){return window.devicePixelRatio}function ie(i,e){return Object.prototype.hasOwnProperty.call(i,e)}function w(i,e){return Object.prototype.hasOwnProperty.call(i,e)&&i[e]!==void 0}function j(i,e){return i===void 0?e:i}function es(i){let e={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return i.replace(/[&<>'"/]/g,function(t){return e[t]})}function jt(){return Math.floor(4294967296+Math.random()*64424509440).toString(16)}function Ve(i){if(!(!i||!i.toLowerCase))switch(i.toLowerCase()){case"true":return!0;case"false":return!1;default:return}}function pe(i,e){let t;if("currentStyle"in i)t=i.currentStyle[e];else{let n=document?.defaultView?.getComputedStyle(i,null);n&&(t=n.getPropertyValue(e))}return t}function Zi(i,e){let t=i.toString();for(;t.length<e;)t="0"+t;return t}function Wn(i,e=1){if(e<1)throw"Significant digits must be at least 1.";return parseFloat(i.toPrecision(e))}function ts(i){let e=new Date(i);return e.toString()==="Invalid Date"&&(e=new Date(i.replace(/-/g,"/"))),e}function le(i){return i instanceof Date?i.getUTCFullYear()+"-"+Zi(i.getUTCMonth()+1,2)+"-"+Zi(i.getUTCDate(),2):null}function ns(i,e){let t={};return function(){let n=i.getBoundingClientRect(),s={w:n.width,h:n.height};s.w===0&&s.h===0||s.w===t.w&&s.h===t.h||(t=s,e(s.w,s.h))}}function Gn(){return qn()?Math.round(qn()*100)/100:1}function Kn(i){let e=i.getBoundingClientRect(),t=i.currentCSSZoom||1;return{width:e.width/t,height:e.height/t}}function is(i){let e=i.replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\b]/g,"\\b"),t;try{t=new Function(`with (this) {
try {
return (${i});
} catch (e) {
console.error('Error evaluating expression: ${e}');
throw e;
}
}`)}catch(n){throw console.error("Error parsing expression: "+i),n}return function(n){return t.call(n)}}function mt(i){return i==null?[]:Array.isArray(i)?i:[i]}function ss(i,e){function t(n,s){let o=0,a=0,r=[];for(;o<n.length&&a<s.length;)e(n[o],s[a])<=0?r.push(n[o++]):r.push(s[a++]);for(;o<n.length;)r.push(n[o++]);for(;a<s.length;)r.push(s[a++]);return r}i=i.slice(0);for(let n=1;n<i.length;n*=2)for(let s=0;s<i.length;s+=n*2){let o=i.slice(s,s+n),a=i.slice(s+n,s+n*2),r=t(o,a),l=[s,r.length];Array.prototype.push.apply(l,r),Array.prototype.splice.apply(i,l)}return i}function E(i){return typeof i>"u"?i:i.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g,"\\$1")}function ue(i,e){let t={};return Object.keys(i).forEach(n=>{t[n]=e(i[n],n,i)}),t}function rs(i){return typeof i=="number"&&isNaN(i)}function Xn(i,e){if(pt.default.type(i)==="object"&&pt.default.type(e)==="object"){let t=i,n=e;if(Object.keys(t).length!==Object.keys(n).length)return!1;for(let s in t)if(!ie(n,s)||!Xn(t[s],n[s]))return!1;return!0}else if(pt.default.type(i)==="array"&&pt.default.type(e)==="array"){let t=i,n=e;if(t.length!==n.length)return!1;for(let s=0;s<t.length;s++)if(!Xn(t[s],n[s]))return!1;return!0}else return i===e}function Yn(...i){if(i.length<2)throw new Error("equal requires at least two arguments.");for(let e=0;e<i.length-1;e++)if(!Xn(i[e],i[e+1]))return!1;return!0}var os=function(i,e,t){function n(a){return(a+"").replace(/-/,".").replace(/(\.0)+[^.]*$/,"").split(".")}function s(a,r){let l=n(a),u=n(r),d=Math.min(l.length,u.length),c;for(let p=0;p<d;p++)if(c=parseInt(l[p],10)-parseInt(u[p],10),c!==0)return c;return l.length-u.length}let o=s(i,t);if(e==="==")return o===0;if(e===">=")return o>=0;if(e===">")return o>0;if(e==="<=")return o<=0;if(e==="<")return o<0;throw`Unknown operator: ${e}`};function q(i,e){if(typeof i>"u")return;if(e.length!==1)throw new Error("labelNode must be of length 1");Array.isArray(i)&&i.length===0?e.addClass("shiny-label-null"):(e.text(i),e.removeClass("shiny-label-null"))}function ft(i){let e=document.createElement("a");e.href="/";let t=document.createElement("div");t.style.setProperty("position","absolute","important"),t.style.setProperty("top","-1000px","important"),t.style.setProperty("left","0","important"),t.style.setProperty("width","30px","important"),t.style.setProperty("height","10px","important"),t.appendChild(e),i.appendChild(t);let n=window.getComputedStyle(e).getPropertyValue("color");return i.removeChild(t),n}function Zn(){return!window.bootstrap}var rt=class{constructor(){this.bindings=[];this.bindingNames={}}register(e,t,n=0){let s={binding:e,priority:n};this.bindings.unshift(s),t&&(this.bindingNames[t]=s,e.name=t)}setPriority(e,t){let n=this.bindingNames[e];if(!n)throw"Tried to set priority on unknown binding "+e;n.priority=t||0}getPriority(e){let t=this.bindingNames[e];return t?t.priority:!1}getBindings(){return ss(this.bindings,function(e,t){return t.priority-e.priority})}};var P=class{find(e){throw"Not implemented"}getId(e){return e.getAttribute("data-input-id")||e.id}getType(e){return null}getValue(e){throw"Not implemented"}subscribe(e,t){}unsubscribe(e){}receiveMessage(e,t){throw"Not implemented"}getState(e){throw"Not implemented"}getRatePolicy(e){return null}initialize(e){}dispose(e){}};var me=M(S());var qt=class extends P{find(e){return(0,me.default)(e).find(".action-button")}getValue(e){return(0,me.default)(e).data("val")||0}setValue(e,t){(0,me.default)(e).data("val",t)}getType(e){return"shiny.action"}subscribe(e,t){(0,me.default)(e).on("click.actionButtonInputBinding",function(){let n=(0,me.default)(this),s=n.data("val")||0;n.data("val",s+1),t(!1)})}getState(e){return{value:this.getValue(e)}}receiveMessage(e,t){let n=(0,me.default)(e);if(w(t,"label")||w(t,"icon")){let s=n.text(),o="";if(n.find("i[class]").length>0){let a=n.find("i[class]")[0];a===n.children()[0]&&(o=(0,me.default)(a).prop("outerHTML"))}w(t,"label")&&(s=t.label),w(t,"icon")&&(o=Array.isArray(t.icon)?"":t.icon??""),n.html(o+" "+s)}w(t,"disabled")&&(t.disabled?n.attr("disabled",""):n.attr("disabled",null))}unsubscribe(e){(0,me.default)(e).off(".actionButtonInputBinding")}};(0,me.default)(document).on("click","a.action-button",function(i){i.preventDefault()});var ze=M(S());var Xt=class extends P{find(e){return(0,ze.default)(e).find('input[type="checkbox"]')}getValue(e){return e.checked}setValue(e,t){e.checked=t}subscribe(e,t){(0,ze.default)(e).on("change.checkboxInputBinding",function(){t(!0)})}unsubscribe(e){(0,ze.default)(e).off(".checkboxInputBinding")}getState(e){return{label:(0,ze.default)(e).parent().find("span").text(),value:e.checked}}receiveMessage(e,t){w(t,"value")&&(e.checked=t.value),w(t,"label")&&(0,ze.default)(e).parent().find("span").text(t.label),(0,ze.default)(e).trigger("change")}};var Z=M(S());function as(i){return(0,Z.default)(i).find('label[for="'+E(i.id)+'"]')}function zr(i){let e=i.parentNode;return e.tagName==="LABEL"?(0,Z.default)(e).find("span").text().trim():null}var Wt=class extends P{find(e){return(0,Z.default)(e).find(".shiny-input-checkboxgroup")}getValue(e){let t=(0,Z.default)('input:checkbox[name="'+E(e.id)+'"]:checked'),n=new Array(t.length);for(let s=0;s<t.length;s++)n[s]=t[s].value;return n}setValue(e,t){if(t=t??[],(0,Z.default)('input:checkbox[name="'+E(e.id)+'"]').prop("checked",!1),t instanceof Array)for(let n=0;n<t.length;n++)(0,Z.default)('input:checkbox[name="'+E(e.id)+'"][value="'+E(t[n])+'"]').prop("checked",!0);else(0,Z.default)('input:checkbox[name="'+E(e.id)+'"][value="'+E(t)+'"]').prop("checked",!0)}getState(e){let t=(0,Z.default)('input:checkbox[name="'+E(e.id)+'"]'),n=new Array(t.length);for(let s=0;s<n.length;s++)n[s]={value:t[s].value,label:zr(t[s])};return{label:as(e).text(),value:this.getValue(e),options:n}}receiveMessage(e,t){let n=(0,Z.default)(e);w(t,"options")&&(n.find("div.shiny-options-group").remove(),n.find("label.checkbox").remove(),n.append(t.options)),w(t,"value")&&this.setValue(e,t.value),q(t.label,as(e)),(0,Z.default)(e).trigger("change")}subscribe(e,t){(0,Z.default)(e).on("change.checkboxGroupInputBinding",function(){t(!1)})}unsubscribe(e){(0,Z.default)(e).off(".checkboxGroupInputBinding")}};var R=M(S());var ht=class extends P{find(e){return(0,R.default)(e).find(".shiny-date-input")}getType(e){return"shiny.date"}subscribe(e,t){(0,R.default)(e).on("changeDate.dateInputBinding change.dateInputBinding",function(){t(!1)})}unsubscribe(e){(0,R.default)(e).off(".dateInputBinding")}getRatePolicy(){return{policy:"debounce",delay:250}}setValue(e,t){throw"not implemented"}initialize(e){let t=(0,R.default)(e).find("input"),n=t.data("initial-date");n==null&&(n=this._floorDateTime(this._dateAsUTC(new Date))),this.setValue(e,n),t.data("min-date")!==void 0&&this._setMin(t[0],t.data("min-date")),t.data("max-date")!==void 0&&this._setMax(t[0],t.data("max-date"))}_getLabelNode(e){return(0,R.default)(e).find('label[for="'+E(e.id)+'"]')}_formatToString(e){let t="",n;for(n=0;n<e.parts.length;n++)t+=e.separators[n]+e.parts[n];return t+=e.separators[n],t}_setMin(e,t){if(t===null){(0,R.default)(e).bsDatepicker("setStartDate",null);return}let n=this._newDate(t);if(n===null||(t=n,isNaN(t.valueOf())))return;let s=(0,R.default)(e).bsDatepicker("getUTCDate");(0,R.default)(e).bsDatepicker("setStartDate",this._utcDateAsLocal(t)),t&&s&&t.getTime()>s.getTime()?(0,R.default)(e).bsDatepicker("clearDates"):(0,R.default)(e).bsDatepicker("setUTCDate",s)}_setMax(e,t){if(t===null){(0,R.default)(e).bsDatepicker("setEndDate",null);return}let n=this._newDate(t);if(n===null||(t=n,isNaN(t.valueOf())))return;let s=(0,R.default)(e).bsDatepicker("getUTCDate");(0,R.default)(e).bsDatepicker("setEndDate",this._utcDateAsLocal(t)),t&&s&&t.getTime()<s.getTime()?(0,R.default)(e).bsDatepicker("clearDates"):(0,R.default)(e).bsDatepicker("setUTCDate",s)}_newDate(e){if(e instanceof Date)return e;if(!e)return null;let t=ts(e);return isNaN(t.valueOf())?null:t}_floorDateTime(e){return e=new Date(e.getTime()),e.setUTCHours(0,0,0,0),e}_dateAsUTC(e){return new Date(e.getTime()-e.getTimezoneOffset()*6e4)}_utcDateAsLocal(e){return new Date(e.getTime()+e.getTimezoneOffset()*6e4)}},Gt=class extends ht{getValue(e){let t=(0,R.default)(e).find("input").bsDatepicker("getUTCDate");return le(t)}setValue(e,t){if(t===null){(0,R.default)(e).find("input").val("").bsDatepicker("update");return}let n=this._newDate(t);n!==null&&(isNaN(n.valueOf())||(0,R.default)(e).find("input").bsDatepicker("setUTCDate",n))}getState(e){let n=(0,R.default)(e).find("input"),s=n.data("datepicker").startDate,o=n.data("datepicker").endDate;s=s===-1/0?null:le(s),o=o===1/0?null:le(o);let a=n.data("datepicker").startViewMode;return a===2?a="decade":a===1?a="year":a===0&&(a="month"),{label:this._getLabelNode(e).text(),value:this.getValue(e),valueString:n.val(),min:s,max:o,language:n.data("datepicker").language,weekstart:n.data("datepicker").weekStart,format:this._formatToString(n.data("datepicker").format),startview:a}}receiveMessage(e,t){let n=(0,R.default)(e).find("input");q(t.label,this._getLabelNode(e)),w(t,"min")&&this._setMin(n[0],t.min),w(t,"max")&&this._setMax(n[0],t.max),w(t,"value")&&this.setValue(e,t.value),(0,R.default)(e).trigger("change")}};var fe=M(S());function ls(i){return(0,fe.default)(i).find('label[for="'+E(i.id)+'"]')}var Kt=class extends ht{find(e){return(0,fe.default)(e).find(".shiny-date-range-input")}getValue(e){let t=(0,fe.default)(e).find("input"),n=t.eq(0).bsDatepicker("getUTCDate"),s=t.eq(1).bsDatepicker("getUTCDate");return[le(n),le(s)]}setValue(e,t){if(!(t instanceof Object))return;let n=(0,fe.default)(e).find("input");if(t.start!==void 0)if(t.start===null)n.eq(0).val("").bsDatepicker("update");else{let s=this._newDate(t.start);n.eq(0).bsDatepicker("setUTCDate",s)}if(t.end!==void 0)if(t.end===null)n.eq(1).val("").bsDatepicker("update");else{let s=this._newDate(t.end);n.eq(1).bsDatepicker("setUTCDate",s)}}getState(e){let n=(0,fe.default)(e).find("input"),s=n.eq(0),o=n.eq(1),a=s.bsDatepicker("getStartDate"),r=s.bsDatepicker("getEndDate"),l=a===-1/0?null:le(a),u=r===1/0?null:le(r),d=s.data("datepicker").startView;return d===2?d="decade":d===1?d="year":d===0&&(d="month"),{label:ls(e).text(),value:this.getValue(e),valueString:[s.val(),o.val()],min:l,max:u,weekstart:s.data("datepicker").weekStart,format:this._formatToString(s.data("datepicker").format),language:s.data("datepicker").language,startview:d}}receiveMessage(e,t){let n=(0,fe.default)(e),s=n.find("input"),o=s.eq(0),a=s.eq(1);q(t.label,ls(e)),w(t,"min")&&(this._setMin(o[0],t.min),this._setMin(a[0],t.min)),w(t,"max")&&(this._setMax(o[0],t.max),this._setMax(a[0],t.max)),w(t,"value")&&this.setValue(e,t.value),n.trigger("change")}initialize(e){let n=(0,fe.default)(e).find("input"),s=n.eq(0),o=n.eq(1),a=s.data("initial-date"),r=o.data("initial-date");a==null&&(a=this._dateAsUTC(new Date)),r==null&&(r=this._dateAsUTC(new Date)),this.setValue(e,{start:a,end:r}),this._setMin(s[0],s.data("min-date")),this._setMin(o[0],s.data("min-date")),this._setMax(s[0],o.data("max-date")),this._setMax(o[0],o.data("max-date"))}subscribe(e,t){(0,fe.default)(e).on("changeDate.dateRangeInputBinding change.dateRangeInputBinding",function(){t(!1)})}unsubscribe(e){(0,fe.default)(e).off(".dateRangeInputBinding")}};var X=M(S());var ge=M(S());var ei=M(S());function us(i,e,t,n,s,o){let a=ei.default.Event("shiny:inputchanged");return a.name=i,a.value=e,a.binding=t,a.el=n,a.inputType=s,(0,ei.default)(o).trigger(a),a}var ti;function ds(i){ti=i}function be(){if(typeof ti>"u")throw"Shiny has not finish initialization yet. Please wait for the 'shiny-initialized' event.";return ti}function he(i,e,t){be().setInputValue(i,e,t)}function Ne(){return be().shinyapp}function cs(i){be().user=i}function ps(i){be().forgetLastInputValue(i)}async function Ue(i){await be().bindAll(i)}function G(i,e=!1){be().unbindAll(i,e)}function gt(i){be().initializeInputs(i)}async function ms(i,e){await Ne().bindOutput(i,e)}function fs(i,e){return Ne().unbindOutput(i,e)}function hs(){return be().oncustommessage}var gs;function ys(){return gs}function bs(i){gs=i}function vs(){return be().createSocket}var ni=class{constructor(e,t=!0){this.fileIndex=-1;this.aborted=!1;this.completed=!1;this.files=Array.from(e),t&&this.$run()}onBegin(e,t){setTimeout(t,0)}onFile(e,t){setTimeout(t,0)}onComplete(){}onAbort(){}abort(){this.completed||this.aborted||(this.aborted=!0,this.onAbort())}$getRun(){let e=!1;return()=>{e||(e=!0,this.$run())}}$run(){if(this.aborted||this.completed)return;if(this.fileIndex<0){this.fileIndex=0,this.onBegin(this.files,this.$getRun());return}if(this.fileIndex===this.files.length){this.completed=!0,this.onComplete();return}let e=this.files[this.fileIndex++];this.onFile(e,this.$getRun())}},yt=class extends ni{constructor(t,n,s,o){super(s,!1);this.shinyapp=t,this.id=n,this.el=o,this.$run()}makeRequest(t,n,s,o,a){this.shinyapp.makeRequest(t,n,s,o,a)}onBegin(t,n){this.$setError(null),this.$setActive(!0),this.$setVisible(!0),this.onProgress(null,0),this.totalBytes=0,this.progressBytes=0,ge.default.each(t,(o,a)=>{this.totalBytes+=a.size});let s=ge.default.map(t,function(o){return{name:o.name,size:o.size,type:o.type}});this.makeRequest("uploadInit",[s],o=>{this.jobId=o.jobId,this.uploadUrl=o.uploadUrl,n()},o=>{this.onError(o)},void 0)}onFile(t,n){this.onProgress(t,0),ge.default.ajax(this.uploadUrl,{type:"POST",cache:!1,xhr:()=>{if(typeof ge.default.ajaxSettings.xhr!="function")throw"jQuery's XHR is not a function";let s=ge.default.ajaxSettings.xhr();return s.upload&&(s.upload.onprogress=o=>{o.lengthComputable&&this.onProgress(t,(this.progressBytes+o.loaded)/this.totalBytes)}),s},data:t,contentType:"application/octet-stream",processData:!1,success:()=>{this.progressBytes+=t.size,n()},error:(s,o,a)=>{this.onError(s.responseText||o)}})}onComplete(){let t=ge.default.map(this.files,function(s,o){return{name:s.name,size:s.size,type:s.type}}),n=us(this.id,t,ys(),this.el,"shiny.fileupload",document);this.makeRequest("uploadEnd",[this.jobId,this.id],()=>{this.$setActive(!1),this.onProgress(null,1),this.$bar().text("Upload complete"),(0,ge.default)(n.el).val("")},s=>{this.onError(s)},void 0),this.$bar().text("Finishing upload")}onError(t){this.$setError(t||""),this.$setActive(!1)}onAbort(){this.$setVisible(!1)}onProgress(t,n){this.$bar().width(Math.round(n*100)+"%"),this.$bar().text(t?t.name:"")}$container(){return(0,ge.default)("#"+E(this.id)+"_progress.shiny-file-input-progress")}$bar(){return(0,ge.default)("#"+E(this.id)+"_progress.shiny-file-input-progress .progress-bar")}$setVisible(t){this.$container().css("visibility",t?"visible":"hidden")}$setError(t){this.$bar().toggleClass("progress-bar-danger",t!==null),t!==null&&(this.onProgress(null,1),this.$bar().text(t))}$setActive(t){this.$container().toggleClass("active",!!t)}};var Yt="shiny-file-input-active",Zt="shiny-file-input-over";function bt(i){return(0,X.default)(i).closest("div.input-group")}function ws(i){let e=(0,X.default)(i),t=0;return e.on({"dragenter.draghover":n=>{t++===0&&e.trigger("draghover:enter",n)},"dragleave.draghover":n=>{--t===0&&e.trigger("draghover:leave",n),t<0&&console.error("draghover childCounter is negative somehow")},"dragover.draghover":n=>{n.preventDefault()},"drop.draghover":n=>{t=0,e.trigger("draghover:drop",n),n.preventDefault()}}),e}function xs(i){return(0,X.default)(i).off(".draghover")}function Nr(){let i=(0,X.default)("html");ws(i).on({"draghover:enter.draghover":()=>{bt(ve).addClass(Yt)},"draghover:leave.draghover":()=>{bt(ve).removeClass(Yt)},"draghover:drop.draghover":()=>{bt(ve).removeClass(Zt).removeClass(Yt)}})}function Ur(){let i=(0,X.default)("html");i.off(".draghover"),xs(i)}function Qr(i){let e=document.createElement("input");e.type="file";try{e.files=i}catch{return!1}return!0}function Jr(i,e){let t=i.originalEvent?.dataTransfer?.files,n=(0,X.default)(e);t==null?console.log("Dropping files is not supported on this browser. (no FileList)"):Qr(t)?(n.val(""),e.files=t,n.trigger("change")):(n.val(""),Fr(e,t))}function Is(i,e){let t=i.closest("div.input-group").find("input[type=text]");e.length===1?t.val(e[0].name):t.val(e.length+" files")}function Ts(i){let e=i.data("currentUploader");e&&e.abort(),i.removeAttr("data-restore")}function Fr(i,e){let t=(0,X.default)(i);Ts(t),Is(t,e),t.data("currentUploader",new yt(Ne(),ii(i),e,i))}function jr(i){let e=(0,X.default)(i.target);Ts(e);let t=i.target.files,n=ii(i.target);t.length!==0&&(Is(e,t),e.data("currentUploader",new yt(Ne(),n,t,i.target)))}var ve=(0,X.default)();function ii(i){return P.prototype.getId.call(this,i)||i.name}var en=class extends P{find(e){return(0,X.default)(e).find('input[type="file"]')}getId(e){return ii(e)}getValue(e){let t=(0,X.default)(e).attr("data-restore");if(t){let n=JSON.parse(t),s=(0,X.default)(e).closest("div.input-group").find("input[type=text]");n.name.length===1?s.val(n.name[0]):s.val(n.name.length+" files");let o=(0,X.default)(e).closest("div.form-group").find(".progress"),a=o.find(".progress-bar");return o.removeClass("active"),a.width("100%"),a.css("visibility","visible"),n}else return null}setValue(e,t){}getType(e){return"shiny.file"}subscribe(e,t){(0,X.default)(e).on("change.fileInputBinding",jr),ve.length===0&&Nr(),ve=ve.add(e);let n=bt(e);ws(n).on({"draghover:enter.draghover":s=>{n.addClass(Zt)},"draghover:leave.draghover":s=>{n.removeClass(Zt),s.stopPropagation()},"draghover:drop.draghover":(s,o)=>{Jr(o,e)}})}unsubscribe(e){let t=(0,X.default)(e),n=bt(e);n.removeClass(Zt).removeClass(Yt),xs(n),t.off(".fileInputBinding"),n.off(".draghover"),ve=ve.not(e),ve.length===0&&Ur()}};var vt=M(S());var ot=M(S());function Es(i){return(0,ot.default)(i).parent().find('label[for="'+E(i.id)+'"]')}var Qe=class extends P{find(e){return(0,ot.default)(e).find('input[type="text"], input[type="search"], input[type="url"], input[type="email"]').not('input[type="text"][id$="-selectized"]')}getId(e){return super.getId(e)||e.name}getValue(e){throw"not implemented"}setValue(e,t){throw"not implemented"}subscribe(e,t){let n=(0,ot.default)(e),s=n.data("update-on")||"change";s==="change"?n.on("keyup.textInputBinding input.textInputBinding",function(){t(!0)}):s==="blur"&&(n.on("blur.textInputBinding",function(){t(!1)}),n.on("keydown.textInputBinding",function(o){o.key==="Enter"&&(n.is("textarea")&&!(o.ctrlKey||o.metaKey)||t(!1))})),n.on("change.textInputBinding",function(){s==="blur"&&n.is(":focus")||t(!1)})}unsubscribe(e){(0,ot.default)(e).off(".textInputBinding")}receiveMessage(e,t){throw"not implemented"}getState(e){throw"not implemented"}getRatePolicy(e){return{policy:"debounce",delay:250}}},$e=class extends Qe{setValue(e,t){e.value=t}getValue(e){return e.value}getState(e){return{label:Es(e).text(),value:e.value,placeholder:e.placeholder}}receiveMessage(e,t){w(t,"value")&&this.setValue(e,t.value),q(t.label,Es(e)),w(t,"placeholder")&&(e.placeholder=t.placeholder),(0,ot.default)(e).trigger("change")}};function Ss(i){return(0,vt.default)(i).parent().find('label[for="'+E(i.id)+'"]')}var tn=class extends Qe{find(e){return(0,vt.default)(e).find('input[type="number"]')}getValue(e){let t=(0,vt.default)(e).val();if(typeof t=="string"&&/^\s*$/.test(t))return null;let n=Number(t);return isNaN(n)?t:n}setValue(e,t){e.value=""+t}getType(e){return"shiny.number"}receiveMessage(e,t){w(t,"value")&&(e.value=t.value??""),w(t,"min")&&(e.min=t.min??""),w(t,"max")&&(e.max=t.max??""),w(t,"step")&&(e.step=t.step??""),q(t.label,Ss(e)),(0,vt.default)(e).trigger("change")}getState(e){return{label:Ss(e).text(),value:this.getValue(e),min:Number(e.min),max:Number(e.max),step:Number(e.step)}}};var Ms=M(S());var nn=class extends $e{find(e){return(0,Ms.default)(e).find('input[type="password"]')}getType(e){return"shiny.password"}};var se=M(S());function $s(i){return(0,se.default)(i).parent().find('label[for="'+E(i.id)+'"]')}function qr(i){let e=i.parentNode;return e.tagName==="LABEL"?(0,se.default)(e).find("span").text().trim():null}var sn=class extends P{find(e){return(0,se.default)(e).find(".shiny-input-radiogroup")}getValue(e){let t=(0,se.default)('input:radio[name="'+E(e.id)+'"]:checked');return t.length===0?null:t.val()}setValue(e,t){Array.isArray(t)&&t.length===0?(0,se.default)('input:radio[name="'+E(e.id)+'"]').prop("checked",!1):(0,se.default)('input:radio[name="'+E(e.id)+'"][value="'+E(t)+'"]').prop("checked",!0)}getState(e){let t=(0,se.default)('input:radio[name="'+E(e.id)+'"]'),n=new Array(t.length);for(let s=0;s<n.length;s++)n[s]={value:t[s].value,label:qr(t[s])};return{label:$s(e).text(),value:this.getValue(e),options:n}}receiveMessage(e,t){let n=(0,se.default)(e);w(t,"options")&&(n.find("div.shiny-options-group").remove(),n.find("label.radio").remove(),n.append(t.options)),w(t,"value")&&this.setValue(e,t.value),q(t.label,$s(e)),(0,se.default)(e).trigger("change")}subscribe(e,t){(0,se.default)(e).on("change.radioInputBinding",function(){t(!1)})}unsubscribe(e){(0,se.default)(e).off(".radioInputBinding")}};var O=M(S());var Je=eval;function Cs(i){let e=E(i.id);return si(i)&&(e+="-selectized"),(0,O.default)(i).parent().parent().find('label[for="'+e+'"]')}function si(i){return(0,O.default)(i).parent().find('script[data-for="'+E(i.id)+'"]').length>0}var rn=class extends P{find(e){return(0,O.default)(e).find("select")}getType(e){let t=(0,O.default)(e);return t.hasClass("symbol")?t.attr("multiple")==="multiple"?"shiny.symbolList":"shiny.symbol":null}getId(e){return P.prototype.getId.call(this,e)||e.name}getValue(e){return si(e)?this._selectize(e)?.getValue():(0,O.default)(e).val()}setValue(e,t){si(e)?this._selectize(e)?.setValue(t):(0,O.default)(e).val(t)}getState(e){let t=new Array(e.length);for(let n=0;n<e.length;n++)t[n]={value:e[n].value,label:e[n].label};return{label:Cs(e),value:this.getValue(e),options:t}}receiveMessage(e,t){let n=(0,O.default)(e);if(w(t,"options")&&(this._selectize(e)?.destroy(),n.empty().append(t.options),this._selectize(e)),w(t,"config")&&(n.parent().find('script[data-for="'+E(e.id)+'"]').replaceWith(t.config),this._selectize(e,!0)),w(t,"url")){let s=this._selectize(e);s.clear(),s.clearOptions();let o=!1;s.settings.load=function(a,r){let l=s.settings;O.default.ajax({url:t.url,data:{query:a,field:JSON.stringify([l.searchField]),value:l.valueField,conju:l.searchConjunction,maxop:l.maxOptions},type:"GET",error:function(){r()},success:function(u){O.default.each(u,function(d,c){let p=c[l.optgroupField||"optgroup"],f={};f[l.optgroupLabelField||"label"]=p,f[l.optgroupValueField||"value"]=p,s.addOptionGroup(p,f)}),r(u),o||(w(t,"value")?s.setValue(t.value):l.maxItems===1&&s.setValue(u[0].value)),o=!0}})},s.load(function(a){s.settings.load.apply(s,["",a])})}else w(t,"value")&&this.setValue(e,t.value);q(t.label,Cs(e)),(0,O.default)(e).trigger("change")}subscribe(e,t){(0,O.default)(e).on("change.selectInputBinding",()=>{e.nonempty&&this.getValue(e)===""||t(!1)})}unsubscribe(e){(0,O.default)(e).off(".selectInputBinding")}initialize(e){this._selectize(e)}_selectize(e,t=!1){if(!O.default.fn.selectize)return;let n=(0,O.default)(e),s=n.parent().find('script[data-for="'+E(e.id)+'"]');if(s.length===0)return;let o=O.default.extend({labelField:"label",valueField:"value",searchField:["label"]},JSON.parse(s.html()));typeof s.data("nonempty")<"u"?(e.nonempty=!0,o=O.default.extend(o,{onItemRemove:function(r){this.getValue()===""&&(0,O.default)("select#"+E(e.id)).empty().append((0,O.default)("<option/>",{value:r,selected:!0})).trigger("change")},onDropdownClose:function(){this.getValue()===""&&this.setValue((0,O.default)("select#"+E(e.id)).val())}})):e.nonempty=!1,s.data("eval")instanceof Array&&O.default.each(s.data("eval"),function(r,l){o[l]=Je("("+o[l]+")")});let a=n.selectize(o)[0].selectize;if(t){let r=O.default.extend(a.settings,o);a.destroy(),a=n.selectize(r)[0].selectize}return a}};var z=M(S());function on(i){i.$cache&&i.$cache.input?i.$cache.input.trigger("change"):console.log("Couldn't force ion slider to update")}function ks(i,e,t){let n,s;return i==="date"?(n=window.strftime.utc(),s=function(o){return n(e,new Date(o))}):i==="datetime"?(t?n=window.strftime.timezone(t):n=window.strftime,s=function(o){return n(e,new Date(o))}):s=function(o){return Wr(o,this.prettify_separator)},s}function Xr(i){return(0,z.default)(i).parent().find('label[for="'+E(i.id)+'"]')}function ri(i){return(0,z.default)(i).data("ionRangeSlider").options.type==="double"?2:1}var an=class extends Qe{find(e){return z.default.fn.ionRangeSlider?(0,z.default)(e).find("input.js-range-slider"):(0,z.default)()}getType(e){let t=(0,z.default)(e).data("data-type");return t==="date"?"shiny.date":t==="datetime"?"shiny.datetime":null}getValue(e){let t=(0,z.default)(e),n=(0,z.default)(e).data("ionRangeSlider").result,s,o=t.data("data-type");return o==="date"?s=function(a){return le(new Date(Number(a)))}:o==="datetime"?s=function(a){return Number(a)/1e3}:s=function(a){return Number(a)},ri(e)===2?[s(n.from),s(n.to)]:s(n.from)}setValue(e,t){let n=(0,z.default)(e),s=n.data("ionRangeSlider");n.data("immediate",!0);try{ri(e)===2&&t instanceof Array?s.update({from:t[0],to:t[1]}):s.update({from:t}),on(s)}finally{n.data("immediate",!1)}}subscribe(e,t){(0,z.default)(e).on("change.sliderInputBinding",function(){t(!(0,z.default)(e).data("immediate")&&!(0,z.default)(e).data("animating"))})}unsubscribe(e){(0,z.default)(e).off(".sliderInputBinding")}receiveMessage(e,t){let n=(0,z.default)(e),s=n.data("ionRangeSlider"),o={};if(w(t,"value"))if(ri(e)===2&&t.value instanceof Array)o.from=t.value[0],o.to=t.value[1];else{if(Array.isArray(t.value))throw"Slider requires two values to update with an array, but message value was "+["an empty array.","a single-value array.","an array with more than two values."][Math.min(t.value.length,2)];o.from=t.value}let a=["min","max","step"];for(let c=0;c<a.length;c++){let p=a[c];w(t,p)&&(o[p]=t[p])}q(t.label,Xr(e));let r=["data-type","time-format","timezone"];for(let c=0;c<r.length;c++){let p=r[c];w(t,p)&&n.data(p,t[p])}let l=n.data("data-type"),u=n.data("time-format"),d=n.data("timezone");o.prettify=ks(l,u,d),n.data("immediate",!0);try{s.update(o),on(s)}finally{n.data("immediate",!1)}}getRatePolicy(e){return{policy:"debounce",delay:250}}getState(e){}initialize(e){let t=(0,z.default)(e),n=t.data("data-type"),s=t.data("time-format"),o=t.data("timezone"),a={prettify:ks(n,s,o)};t.ionRangeSlider(a)}};function Wr(i,e=",",t="."){let n=i.toString().split(".");return n[0]=n[0].replace(/(\d{1,3}(?=(?:\d\d\d)+(?!\d)))/g,"$1"+e),n.length===1?n[0]:n.length===2?n[0]+t+n[1]:""}(0,z.default)(document).on("click",".slider-animate-button",function(i){i.preventDefault();let e=(0,z.default)(this),t=(0,z.default)("#"+E(e.attr("data-target-id"))),n="Play",s="Pause",o=e.attr("data-loop")!==void 0&&!/^\s*false\s*$/i.test(e.attr("data-loop")),a=e.attr("data-interval");if(isNaN(a)?a=1500:a=Number(a),t.data("animTimer"))clearTimeout(t.data("animTimer")),t.removeData("animTimer"),e.attr("title",n),e.removeClass("playing"),t.removeData("animating");else{let r;if(t.hasClass("jslider")){let l=t.slider();l.canStepNext()||l.resetToStart(),r=setInterval(function(){o&&!l.canStepNext()?l.resetToStart():(l.stepNext(),!o&&!l.canStepNext()&&e.click())},a)}else{let l=t.data("ionRangeSlider"),u=function(){return l.options.type==="double"?l.result.to<l.result.max:l.result.from<l.result.max},d=function(){let p={from:l.result.min};l.options.type==="double"&&(p.to=p.from+(l.result.to-l.result.from)),l.update(p),on(l)},c=function(){let p={from:Math.min(l.result.max,l.result.from+l.options.step)};l.options.type==="double"&&(p.to=Math.min(l.result.max,l.result.to+l.options.step)),l.update(p),on(l)};u()||d(),r=setInterval(function(){o&&!u()?d():(c(),!o&&!u()&&e.click())},a)}t.data("animTimer",r),e.attr("title",s),e.addClass("playing"),t.data("animating",!0)}});var re=M(S());function Hs(i){return i.attr("data-value")||i.text()}var ln=class extends P{find(e){return(0,re.default)(e).find("ul.nav.shiny-tab-input")}getValue(e){let t=Zn()?(0,re.default)(e).find("li:not(.dropdown).active > a"):(0,re.default)(e).find(".nav-link:not(.dropdown-toggle).active, .dropdown-menu .dropdown-item.active");return t.length===1?Hs(t):null}setValue(e,t){let n=!1;t&&(Zn()?(0,re.default)(e).find("li:not(.dropdown) > a"):(0,re.default)(e).find(".nav-link:not(.dropdown-toggle), .dropdown-menu .dropdown-item")).each(function(){if(Hs((0,re.default)(this))===t)return(0,re.default)(this).tab("show"),n=!0,!1}),n||(0,re.default)(e).trigger("change")}getState(e){return{value:this.getValue(e)}}receiveMessage(e,t){w(t,"value")&&this.setValue(e,t.value),(0,re.default)(e).trigger("change")}subscribe(e,t){(0,re.default)(e).on("change shown.bootstrapTabInputBinding shown.bs.tab.bootstrapTabInputBinding",function(){t(!1)})}unsubscribe(e){(0,re.default)(e).off(".bootstrapTabInputBinding")}};var Ds=M(S());var un=class extends $e{find(e){return(0,Ds.default)(e).find("textarea")}};function Ps(){let i=new rt;i.register(new $e,"shiny.textInput"),i.register(new un,"shiny.textareaInput"),i.register(new nn,"shiny.passwordInput"),i.register(new tn,"shiny.numberInput"),i.register(new Xt,"shiny.checkboxInput"),i.register(new Wt,"shiny.checkboxGroupInput"),i.register(new sn,"shiny.radioInput"),i.register(new an,"shiny.sliderInput"),i.register(new Gt,"shiny.dateInput"),i.register(new Kt,"shiny.dateRangeInput"),i.register(new rn,"shiny.selectInput"),i.register(new qt,"shiny.actionButtonInput"),i.register(new ln,"shiny.bootstrapTabInput");let e=new en;return i.register(e,"shiny.fileInputBinding"),{inputBindings:i,fileInputBinding:e}}var ye=M(S());var ee=class{constructor(e,t,n){this.target=e,this.func=t,this.delayMs=n,this.timerId=null,this.args=null}normalCall(...e){this.$clearTimer(),this.args=e,this.timerId=setTimeout(()=>{this.timerId!==null&&(this.$clearTimer(),this.$invoke())},this.delayMs)}immediateCall(...e){this.$clearTimer(),this.args=e,this.$invoke()}isPending(){return this.timerId!==null}$clearTimer(){this.timerId!==null&&(clearTimeout(this.timerId),this.timerId=null)}$invoke(){this.args&&this.args.length>0?this.func.apply(this.target,this.args):this.func.apply(this.target),this.args=null}};function Ce(i,e){let t=null;return function n(...s){t!==null&&(clearTimeout(t),t=null),t=setTimeout(()=>{t!==null&&(t=null,e.apply(n,s))},i)}}var wt=class{constructor(e,t){this.target=e,this.func=t}normalCall(...e){this.func.apply(this.target,e)}immediateCall(...e){this.func.apply(this.target,e)}};var ke=class{constructor(e,t,n){this.target=e,this.func=t,this.delayMs=n,this.timerId=null,this.args=null}normalCall(...e){this.args=e,this.timerId===null&&this.$invoke()}immediateCall(...e){this.$clearTimer(),this.args=e,this.$invoke()}isPending(){return this.args!==null}$clearTimer(){this.timerId!==null&&(clearTimeout(this.timerId),this.timerId=null)}$invoke(){this.args!==null&&(this.func.apply(this.target,this.args),this.args=null,this.timerId=setTimeout(()=>{this.timerId!==null&&(this.$clearTimer(),this.isPending()&&this.$invoke())},this.delayMs))}};var Fe=M(S());var N=class{find(e){throw"Not implemented"}renderValue(e,t){throw"Not implemented"}getId(e){return e.getAttribute("data-input-id")||e.id}async onValueChange(e,t){this.clearError(e),await this.renderValue(e,t)}onValueError(e,t){this.renderError(e,t)}renderError(e,t){if(this.clearError(e),t.message===""){(0,Fe.default)(e).empty();return}let n="shiny-output-error";t.type!==null&&(n=n+" "+Fe.default.map(mt(t.type),function(s){return n+"-"+s}).join(" ")),(0,Fe.default)(e).addClass(n).text(t.message)}clearError(e){(0,Fe.default)(e).attr("class",function(t,n){return n.replace(/(^|\s)shiny-output-error\S*/g,"")})}showProgress(e,t){let n="recalculating";t?(0,Fe.default)(e).addClass(n):(0,Fe.default)(e).removeClass(n)}};var dn=class extends N{find(e){return(0,ye.default)(e).find(".shiny-datatable-output")}onValueError(e,t){G(e),this.renderError(e,t)}renderValue(e,t){let n=(0,ye.default)(e).empty();if(!t||!t.colnames)return;let s=ye.default.makeArray(t.colnames),o=ye.default.map(s,function(c){return"<th>"+c+"</th>"}).join("");o="<thead><tr>"+o+"</tr></thead>";let a="";(t.options?.searching??!0)&&(a=ye.default.map(s,function(c){return'<th><input type="text" placeholder="'+es(c.replace(/(<([^>]+)>)/gi,""))+'" /></th>'}).join(""),a="<tfoot>"+a+"</tfoot>");let r='<table class="table table-striped table-hover">'+o+a+"</table>";n.append(r),t.evalOptions&&ye.default.each(t.evalOptions,function(c,p){t.options[p]=Je("("+t.options[p]+")")});let l=t.options?.search?.caseInsensitive!==!1,u=(0,ye.default)(e).children("table").DataTable(ye.default.extend({processing:!0,serverSide:!0,order:[],orderClasses:!1,pageLength:25,ajax:{url:t.action,type:"POST",data:function(c){c.search||(c.search={}),c.search.caseInsensitive=l,c.escape=t.escape}}},t.options));if(typeof t.callback=="string"){let c=Je("("+t.callback+")");typeof c=="function"&&c(u)}n.find("label input").first().unbind("keyup").keyup(Ce(t.searchDelay,function(){u.search(this.value).draw()}));let d=n.find("tfoot input");d.length>0&&(ye.default.each(u.settings()[0].aoColumns,function(c,p){p.bSearchable||d.eq(c).hide()}),d.keyup(Ce(t.searchDelay,function(){u.column(d.index(this)).search(this.value).draw()}))),n.parents(".tab-content").css("overflow","visible")}};var xt=M(S());var cn=class extends N{find(e){return(0,xt.default)(e).find("a.shiny-download-link")}renderValue(e,t){e.setAttribute("href",t),e.classList.remove("disabled"),e.removeAttribute("aria-disabled"),e.removeAttribute("tabindex")}showProgress(e,t){}};(0,xt.default)(document).on("click.shinyDownloadLink","a.shiny-download-link",function(i){let e=xt.default.Event("shiny:filedownload");e.name=this.id,e.href=this.href,(0,xt.default)(document).trigger(e)});var Us=M(S());var te=M(S());var oi=class{setImageSend(e,t){let n=new ee(null,t,0);return this.regular=function(){n.normalCall()},e.lastChanceCallback.push(function(){n.isPending()&&n.immediateCall()}),this.transitioned=Ce(200,this.regular),n}},de=new oi;var we=M(S()),Gr=/<!--(SHINY.SINGLETON\[([\w]+)\])-->([\s\S]*?)<!--\/\1-->/,Kr=/<head(?:\s[^>]*)?>([\s\S]*?)<\/head>/,pn={};function ai(i,e,t){let n=eo(i);switch(Zr(n.head),Yr(n.singletons),t.toLowerCase()){case"replace":(0,we.default)(e).html(n.html);break;case"beforebegin":(0,we.default)(e).before(n.html);break;case"afterbegin":(0,we.default)(e).prepend(n.html);break;case"beforeend":(0,we.default)(e).append(n.html);break;case"afterend":(0,we.default)(e).after(n.html);break;default:throw new Error("Unknown where position: "+t)}return n}function Yr(i){we.default.extend(pn,i)}function Bs(i){if(typeof i=="string")pn[i]=!0;else if(i instanceof Array)for(let e=0;e<i.length;e++)pn[i[e]]=!0}function Zr(i){if(i.length>0){let e=(0,we.default)("<div>"+i+"</div>").get(0),t=(0,we.default)("head");for(;e.hasChildNodes();)t.append(e.firstChild)}}function eo(i){let e={},t,n=function(a,r,l,u){return pn[l]||e[l]?"":(e[l]=!0,u)};for(;t=i.replace(Gr,n),i.length!==t.length;)i=t;let s=[],o=function(a,r){return s.push(r),""};for(;t=i.replace(Kr,o),i.length!==t.length;)i=t;return{html:i,head:s.join(`
`),singletons:e}}async function oe(i,e,t="replace"){t==="replace"&&G(i);let n="",s=[];e===null?n="":typeof e=="string"?n=e:typeof e=="object"&&(n=e.html,s=e.deps||[]),await Tt(n,i,s,t);let o=i;if(t==="replace")gt(i),await Ue(i);else{let a=(0,te.default)(i).parent();if(a.length>0&&(o=a,t==="beforeBegin"||t==="afterEnd")){let r=a.parent();r.length>0&&(o=r)}gt(o),await Ue(o)}}function Ls(i,e,t="replace"){t==="replace"&&G(i);let n="",s=[];e===null?n="":typeof e=="string"?n=e:typeof e=="object"&&(n=e.html,s=e.deps||[]),li(n,i,s,t);let o=i;if(t==="replace")return gt(i),Ue(i);{let a=(0,te.default)(i).parent();if(a.length>0&&(o=a,t==="beforeBegin"||t==="afterEnd")){let r=a.parent();r.length>0&&(o=r)}return gt(o),Ue(o)}}async function Tt(i,e,t,n="replace"){return await je(t),ai(i,e,n)}function li(i,e,t,n="replace"){return ui(t),ai(i,e,n)}async function je(i){if(i)for(let e of i)await io(e)}function ui(i){if(i)for(let e of i)so(e)}var It={};function mn(i,e){It[i]=e}function _s(i){if(!i.restyle)return!1;let e=Object.keys(It),t=e.indexOf(i.name);return t===-1?!1:It[e[t]]===i.version}function As(i){let e=(0,te.default)("head").first(),t=function(o,a){let r=new XMLHttpRequest;r.open("GET",o),r.onload=function(){let l="shiny_restyle_"+o.split("?restyle")[0].replace(/\W/g,"_"),u=e.find("style#"+l),d=(0,te.default)("<style>").attr("id",l).html(r.responseText);e.append(d),u.remove(),s(a),de.transitioned()},r.send()},n=function(o){if(!o)return null;for(let a=0;a<document.styleSheets.length;a++){let r=document.styleSheets[a];if(typeof r.href=="string"&&r.href.indexOf(o)>-1)return r}return null},s=function(o){!o||(o.disabled=!0,Oe()&&(o.cssText=""),o.ownerNode instanceof Element&&(0,te.default)(o.ownerNode).remove())};i.map(o=>{let a=(0,te.default)(o),r=n(a.attr("href")),l=a.attr("href")+"?restyle="+new Date().getTime();Oe()?t(l,r):(a.attr("href",l),a.attr("onload",()=>{let u=(0,te.default)("<div>").css("transition","0.1s all").css("position","absolute").css("top","-1000px").css("left","0");u.one("transitionend",()=>{u.remove(),s(r),de.transitioned()}),(0,te.default)(document.body).append(u);let d="#"+Math.floor(Math.random()*16777215).toString(16);setTimeout(()=>u.css("color",d),10)}),e.append(o))})}function di(i){return i.stylesheet.map(e=>{w(e,"rel")||(e.rel="stylesheet"),w(e,"type")||(e.type="text/css");let t=document.createElement("link");return Object.entries(e).forEach(function([n,s]){n==="href"&&(s=encodeURI(s)),t.setAttribute(n,s||"")}),t})}function Rs(i,e){let t=di(i);t.length!==0&&e.append(t)}function to(i,e){i.script.forEach(t=>{let n=document.createElement("script");Object.entries(t).forEach(function([s,o]){s==="src"&&(o=encodeURI(o)),n.setAttribute(s,o||"")}),e.append(n)})}async function no(i){let e=[];i.script.forEach(t=>{let n=document.createElement("script");w(t,"async")||(n.async=!1),Object.entries(t).forEach(function([o,a]){o==="src"&&(a=encodeURI(a)),n.setAttribute(o,a||"")});let s=new Promise((o,a)=>{n.onload=r=>{o(null)},n.onerror=r=>{a(r)}});e.push(s),document.head.append(n)}),await Promise.allSettled(e)}function Os(i,e){i.meta.forEach(t=>{let n=document.createElement("meta");for(let[s,o]of Object.entries(t))n.setAttribute(s,o);e.append(n)})}function Vs(i,e){i.attachment.forEach(t=>{let n=(0,te.default)("<link rel='attachment'>").attr("id",i.name+"-"+t.key+"-attachment").attr("href",encodeURI(t.href));e.append(n)})}function zs(i,e){if(i.head){let t=(0,te.default)("<head></head>");t.html(i.head),e.append(t.children())}}async function io(i){let e=Ns(i);if(_s(e))return As(di(e)),!0;if(w(It,e.name))return!1;mn(e.name,e.version);let t=(0,te.default)("head").first();return Os(e,t),Rs(e,t),await no(e),Vs(e,t),zs(e,t),!0}function so(i){let e=Ns(i);if(_s(e))return As(di(e)),!0;if(w(It,e.name))return!1;mn(e.name,e.version);let t=(0,te.default)("head").first();return Os(e,t),Rs(e,t),to(e,t),Vs(e,t),zs(e,t),!0}function Ns(i){let e=i.src?.href,t={name:i.name,version:i.version,restyle:i.restyle,meta:[],stylesheet:[],script:[],attachment:[],head:i.head};i.meta&&(Array.isArray(i.meta)?t.meta=i.meta:t.meta=Object.entries(i.meta).map(function([s,o]){return{name:s,content:o}})),t.stylesheet=mt(i.stylesheet).map(s=>(typeof s=="string"&&(s={href:s}),e&&(s.href=e+"/"+s.href),s)),t.script=mt(i.script).map(s=>(typeof s=="string"&&(s={src:s}),e&&(s.src=e+"/"+s.src),s));let n=i.attachment;return n||(n=[]),typeof n=="string"&&(n=[n]),Array.isArray(n)?n=n.map((o,a)=>typeof o=="string"?{key:(a+1).toString(),href:o}:o):n=Object.entries(n).map(function([s,o]){return{key:s,href:o}}),t.attachment=n.map(s=>(e&&(s.href=e+"/"+s.href),s)),t}var fn=class extends N{find(e){return(0,Us.default)(e).find(".shiny-html-output")}onValueError(e,t){G(e),this.renderError(e,t)}async renderValue(e,t){await oe(e,t)}};var Pe=M(S());var js=M(S());var Fs=M(S());function Qs(i,e,t,n,s,o=!0){o=o||!0;let a=(s-n)/(t-e),l=(i-e)*a+n;if(o){let u=Math.max(s,n),d=Math.min(s,n);l>u?l=u:l<d&&(l=d)}return l}function Js(i,e,t,n,s){return{scale:function(o,a){return s&&(o=Math.log(o)/Math.log(s)),Qs(o,i,e,t,n,a)},scaleInv:function(o,a){let r=Qs(o,t,n,i,e,a);return s&&(r=Math.pow(s,r)),r}}}function ro(i){let e=i,t=e.domain,n=e.range,s=e.log&&e.log.x?e.log.x:null,o=e.log&&e.log.y?e.log.y:null,a=Js(t.left,t.right,n.left,n.right,s),r=Js(t.bottom,t.top,n.bottom,n.top,o);function l(d,c){return ue(d,(p,f)=>{let v=f.substring(0,1);return v==="x"?a.scale(p,c):v==="y"?r.scale(p,c):null})}e.scaleDataToImg=l;function u(d,c){return ue(d,(p,f)=>{let v=f.substring(0,1);return v==="x"?a.scaleInv(p,c):v==="y"?r.scaleInv(p,c):null})}return e.scaleImgToData=u,e.clipImg=function(d){let c={x:d.x,y:d.y},p=e.range;return d.x>p.right?c.x=p.right:d.x<p.left&&(c.x=p.left),d.y>p.bottom?c.y=p.bottom:d.y<p.top&&(c.y=p.top),c},e}function ci(i){return i.map(e=>ro(e))}function oo(i){let e=i[0].getBoundingClientRect();return{x:e.width/i.outerWidth(),y:e.height/i.outerHeight()}}function pi(i){let e=i.offset(),t=oo(i),n={left:parseInt(i.css("border-left-width"))+parseInt(i.css("padding-left")),top:parseInt(i.css("border-top-width"))+parseInt(i.css("padding-top"))};return{x:e.left+t.x*n.left,y:e.top+t.y*n.top}}function ao(i){let e={x:i.width()/i.outerWidth(),y:i.height()/i.outerHeight()},t=i[0].getBoundingClientRect();return{x:e.x*t.width,y:e.y*t.height}}function mi(i,e){let t=i.find("img"),n=t[0];if(e.panels.length===0){let r={top:0,left:0,right:n.naturalWidth-1,bottom:n.naturalHeight-1};e.panels[0]={domain:r,range:r,mapping:{}}}let s=e;s.dims.height=s.dims.height||n.naturalHeight,s.dims.width=s.dims.width||n.naturalWidth,s.panels=ci(e.panels),s.mouseOffsetCss=function(r){let l=pi(t);return{x:r.pageX-l.x,y:r.pageY-l.y}};function o(r){let l=s.imgToCssScalingRatio();return ue(r,(d,c)=>{let p=c.substring(0,1);return p==="x"?r[c]/l.x:p==="y"?r[c]/l.y:null})}s.scaleCssToImg=o;function a(r){let l=s.imgToCssScalingRatio();return ue(r,(d,c)=>{let p=c.substring(0,1);return p==="x"?r[c]*l.x:p==="y"?r[c]*l.y:null})}return s.scaleImgToCss=a,s.imgToCssScalingRatio=function(){let r=ao(t);return{x:r.x/s.dims.width,y:r.y/s.dims.height}},s.cssToImgScalingRatio=function(){let r=s.imgToCssScalingRatio();return{x:1/r.x,y:1/r.y}},s.getPanelCss=function(r,l=0){let u=s.scaleCssToImg(r),d=u.x,c=u.y,p=s.cssToImgScalingRatio(),f={x:l*p.x,y:l*p.y},v=[],$=[],C;for(C=0;C<s.panels.length;C++){let I=s.panels[C].range;if(d<=I.right+f.x&&d>=I.left-f.x&&c<=I.bottom+f.y&&c>=I.top-f.y){v.push(s.panels[C]);let L=0,J=0;d>I.right&&d<=I.right+f.x?L=d-I.right:d<I.left&&d>=I.left-f.x&&(L=d-I.left),c>I.bottom&&c<=I.bottom+f.y?J=c-I.bottom:c<I.top&&c>=I.top-f.y&&(J=c-I.top),$.push(Math.sqrt(Math.pow(L,2)+Math.pow(J,2)))}}if(v.length){let I=Math.min.apply(null,$);for(C=0;C<v.length;C++)if($[C]===I)return v[C]}return null},s.isInPanelCss=function(r,l=0){return!!s.getPanelCss(r,l)},s.mouseCoordinateSender=function(r,l=!0,u=!1){return function(d){if(d===null){he(r,null);return}let c=s.mouseOffsetCss(d);if(!s.isInPanelCss(c)){if(u){he(r,null);return}if(l)return;let C={coords_css:c,coords_img:s.scaleCssToImg(c)};he(r,C,{priority:"event"});return}let p=s.getPanelCss(c),f=s.scaleCssToImg(c),v=p.scaleImgToData(f),$={x:v?.x,y:v?.y,coords_css:c,coords_img:f,img_css_ratio:s.cssToImgScalingRatio()};Fs.default.extend($,p.panel_vars),$.mapping=p.mapping,$.domain=p.domain,$.range=p.range,$.log=p.log,he(r,$,{priority:"event"})}},s}function at(i,e){return{xmin:Math.min(i.x,e.x),xmax:Math.max(i.x,e.x),ymin:Math.min(i.y,e.y),ymax:Math.max(i.y,e.y)}}function He(i,e,t){i instanceof Array||(i=[i]);let n=Math.max.apply(null,i),s=Math.min.apply(null,i),o=0;n>t?o=t-n:s<e&&(o=e-s);let a=[];for(let r=0;r<i.length;r++)a[r]=i[r]+o;return a}function fi(i,e,t,n){let o=i[0],a=null,r={},l=t.scaleCssToImg,u=t.scaleImgToCss;d();function d(){r.brushing=!1,r.dragging=!1,r.resizing=!1,r.down={x:NaN,y:NaN},r.up={x:NaN,y:NaN},r.resizeSides={left:!1,right:!1,top:!1,bottom:!1},r.boundsCss={xmin:NaN,xmax:NaN,ymin:NaN,ymax:NaN},r.boundsData={xmin:NaN,xmax:NaN,ymin:NaN,ymax:NaN},r.panel=null,r.changeStartBounds={xmin:NaN,xmax:NaN,ymin:NaN,ymax:NaN},a&&a.remove()}function c(){return i.find("#"+o.id+"_brush").length>0}function p(){let y=i.find("#"+o.id+"_brush");if(y.length===0)return;let x=y.data("bounds-data"),D=y.data("panel");if(!(!x||!D)){for(let k=0;k<t.panels.length;k++){let ne=t.panels[k];if(Yn(D.mapping,ne.mapping)&&Yn(D.panel_vars,ne.panel_vars)){r.panel=t.panels[k];break}}if(r.panel===null){y.remove();return}a=y,L(x),T()}}function f(){let y=L();Object.values(y).some(rs)||(L(y),T())}function v(y){let x=r.boundsCss;return y.x<=x.xmax&&y.x>=x.xmin&&y.y<=x.ymax&&y.y>=x.ymin}function $(y){let x=C(y);return x.left||x.right||x.top||x.bottom}function C(y){let x=r.boundsCss,D={xmin:x.xmin-10,xmax:x.xmax+10,ymin:x.ymin-10,ymax:x.ymax+10},k={left:!1,right:!1,top:!1,bottom:!1};return(e.brushDirection==="xy"||e.brushDirection==="x")&&y.y<=D.ymax&&y.y>=D.ymin&&(y.x<x.xmin&&y.x>=D.xmin?k.left=!0:y.x>x.xmax&&y.x<=D.xmax&&(k.right=!0)),(e.brushDirection==="xy"||e.brushDirection==="y")&&y.x<=D.xmax&&y.x>=D.xmin&&(y.y<x.ymin&&y.y>=D.ymin?k.top=!0:y.y>x.ymax&&y.y<=D.ymax&&(k.bottom=!0)),k}function I(y){if(y===void 0)return{...r.boundsCss};let x={x:y.xmin,y:y.ymin},D={x:y.xmax,y:y.ymax},k=r.panel,ne=k.range;e.brushClip&&(x=u(k.clipImg(l(x))),D=u(k.clipImg(l(D)))),e.brushDirection==="xy"||(e.brushDirection==="x"?(x.y=u({y:ne.top}).y,D.y=u({y:ne.bottom}).y):e.brushDirection==="y"&&(x.x=u({x:ne.left}).x,D.x=u({x:ne.right}).x)),r.boundsCss={xmin:x.x,xmax:D.x,ymin:x.y,ymax:D.y};let Ae=k.scaleImgToData(l(x)),K=k.scaleImgToData(l(D));r.boundsData=at(Ae,K),r.boundsData=ue(r.boundsData,st=>Wn(st,14)),a.data("bounds-data",r.boundsData),a.data("panel",r.panel)}function L(y){if(typeof y>"u")return{...r.boundsData};let x=u(r.panel.scaleDataToImg(y));x=ue(x,D=>Wn(D,13)),I({xmin:Math.min(x.xmin,x.xmax),xmax:Math.max(x.xmin,x.xmax),ymin:Math.min(x.ymin,x.ymax),ymax:Math.max(x.ymin,x.ymax)})}function J(){return r.panel}function h(){a&&a.remove(),a=(0,js.default)(document.createElement("div")).attr("id",o.id+"_brush").css({"background-color":e.brushFill,opacity:e.brushOpacity,"pointer-events":"none",position:"absolute"}).hide();let y="1px solid "+e.brushStroke;e.brushDirection==="xy"?a.css({border:y}):e.brushDirection==="x"?a.css({"border-left":y,"border-right":y}):e.brushDirection==="y"&&a.css({"border-top":y,"border-bottom":y}),i.append(a),a.offset({x:0,y:0}).width(0).outerHeight(0)}function T(){let y=pi(i.find("img")),x=r.boundsCss;a.offset({top:y.y+x.ymin,left:y.x+x.xmin}).outerWidth(x.xmax-x.xmin+1).outerHeight(x.ymax-x.ymin+1)}function _(y){if(y===void 0)return r.down;r.down=y}function Me(y){if(y===void 0)return r.up;r.up=y}function nt(){return r.brushing}function it(){r.brushing=!0,h(),r.panel=t.getPanelCss(r.down,n),I(at(r.down,r.down)),T()}function Qn(y){I(at(r.down,y)),a.show(),T()}function Jn(){r.brushing=!1,I(at(r.down,r.up))}function Fn(){return r.dragging}function m(){r.dragging=!0,r.changeStartBounds={...r.boundsCss}}function g(y){let x=y.x-r.down.x,D=y.y-r.down.y,k=r.changeStartBounds,ne={xmin:k.xmin+x,xmax:k.xmax+x,ymin:k.ymin+D,ymax:k.ymax+D};if(e.brushClip){let K=r.panel.range,st=l(ne),Qt=[st.xmin,st.xmax],Jt=[st.ymin,st.ymax];Qt=He(Qt,K.left,K.right),Jt=He(Jt,K.top,K.bottom),ne=u({xmin:Qt[0],xmax:Qt[1],ymin:Jt[0],ymax:Jt[1]})}I(ne),T()}function B(){r.dragging=!1}function V(){return r.resizing}function Y(){r.resizing=!0,r.changeStartBounds={...r.boundsCss},r.resizeSides=C(r.down)}function ae(y){let x={x:y.x-r.down.x,y:y.y-r.down.y},D=l(x),k=l(r.changeStartBounds),Ae=r.panel.range;if(r.resizeSides.left){let K=He(k.xmin+D.x,Ae.left,k.xmax)[0];k.xmin=K}else if(r.resizeSides.right){let K=He(k.xmax+D.x,k.xmin,Ae.right)[0];k.xmax=K}if(r.resizeSides.top){let K=He(k.ymin+D.y,Ae.top,k.ymax)[0];k.ymin=K}else if(r.resizeSides.bottom){let K=He(k.ymax+D.y,k.ymin,Ae.bottom)[0];k.ymax=K}I(u(k)),T()}function ce(){r.resizing=!1}return{reset:d,hasOldBrush:c,importOldBrush:p,isInsideBrush:v,isInResizeArea:$,whichResizeSides:C,onResize:f,boundsCss:I,boundsData:L,getPanel:J,down:_,up:Me,isBrushing:nt,startBrushing:it,brushTo:Qn,stopBrushing:Jn,isDragging:Fn,startDragging:m,dragTo:g,stopDragging:B,isResizing:V,startResizing:Y,resizeTo:ae,stopResizing:ce}}var qs=M(S());function hi(i,e,t){let n,s=null;function o(d,c){let p=qs.default.Event(d,{which:c.which,pageX:c.pageX,pageY:c.pageY});i.trigger(p)}function a(){s&&(o("mousedown2",s),s=null)}function r(d){s=d,n=window.setTimeout(function(){a()},t)}function l(d){if(d.which===1){if(!e){o("mousedown2",d);return}s===null?r(d):(clearTimeout(n),s&&Math.abs(s.pageX-d.pageX)>2||Math.abs(s.pageY-d.pageY)>2?(a(),r(d)):(s=null,o("dblclick2",d)))}}function u(d){d.which=1,o("dblclick2",d)}return{mousedown:l,dblclickIE8:u}}var De=M(S());function hn(i,e,t){let n=t.mouseCoordinateSender(i,e);return n(null),{mousedown:function(s){s.which===1&&n(s)},onResetImg:function(){n(null)},onResize:null}}function gi(i,e,t,n,s,o){let a=o.mouseCoordinateSender(i,n,s),r;t==="throttle"?r=new ke(null,a,e):r=new ee(null,a,e),r.immediateCall(null);let l;return s?l=function(){r.normalCall(null)}:l=function(){},{mousemove:function(u){r.normalCall(u)},mouseout:l,onResetImg:function(){r.immediateCall(null)},onResize:null}}function yi(i,e,t,n,s){let a=fi(e,t,n,20);e.on("shiny-internal:brushed.image_output",function(h,T){T.brushId===i&&T.outputId!==s&&(e.data("mostRecentBrush",!1),a.reset())});function r(h){e.removeClass("crosshair grabbable grabbing ns-resize ew-resize nesw-resize nwse-resize"),h&&e.addClass(h)}function l(){let h=a.boundsData();if(isNaN(h.xmin)){he(i,null),qe.find(document.documentElement).trigger("shiny-internal:brushed",{brushId:i,outputId:null});return}let T=a.getPanel();De.default.extend(h,T.panel_vars),h.coords_css=a.boundsCss(),h.coords_img=n.scaleCssToImg(h.coords_css),h.img_css_ratio=n.cssToImgScalingRatio(),h.mapping=T.mapping,h.domain=T.domain,h.range=T.range,h.log=T.log,h.direction=t.brushDirection,h.brushId=i,h.outputId=s,he(i,h),e.data("mostRecentBrush",!0),qe.find(document.documentElement).trigger("shiny-internal:brushed",h)}let u;t.brushDelayType==="throttle"?u=new ke(null,l,t.brushDelay):u=new ee(null,l,t.brushDelay),a.hasOldBrush()||u.immediateCall();function d(h){if(a.isBrushing()||a.isDragging()||a.isResizing()||h.which!==1)return;let T=n.mouseOffsetCss(h);if(!(t.brushClip&&!n.isInPanelCss(T,20)))if(a.up({x:NaN,y:NaN}),a.down(T),a.isInResizeArea(T))a.startResizing(T),(0,De.default)(document).on("mousemove.image_brush",v).on("mouseup.image_brush",I);else if(a.isInsideBrush(T))a.startDragging(T),r("grabbing"),(0,De.default)(document).on("mousemove.image_brush",f).on("mouseup.image_brush",C);else{let _=n.getPanelCss(T,20);a.startBrushing(_.clipImg(n.scaleCssToImg(T))),(0,De.default)(document).on("mousemove.image_brush",p).on("mouseup.image_brush",$)}}function c(h){let T=n.mouseOffsetCss(h);if(!(a.isBrushing()||a.isDragging()||a.isResizing()))if(a.isInResizeArea(T)){let _=a.whichResizeSides(T);_.left&&_.top||_.right&&_.bottom?r("nwse-resize"):_.left&&_.bottom||_.right&&_.top?r("nesw-resize"):_.left||_.right?r("ew-resize"):(_.top||_.bottom)&&r("ns-resize")}else a.isInsideBrush(T)?r("grabbable"):n.isInPanelCss(T,20)?r("crosshair"):r(null)}function p(h){a.brushTo(n.mouseOffsetCss(h)),u.normalCall()}function f(h){a.dragTo(n.mouseOffsetCss(h)),u.normalCall()}function v(h){a.resizeTo(n.mouseOffsetCss(h)),u.normalCall()}function $(h){if(h.which===1){if((0,De.default)(document).off("mousemove.image_brush").off("mouseup.image_brush"),a.up(n.mouseOffsetCss(h)),a.stopBrushing(),r("crosshair"),a.down().x===a.up().x&&a.down().y===a.up().y){a.reset(),u.immediateCall();return}u.isPending()&&u.immediateCall()}}function C(h){h.which===1&&((0,De.default)(document).off("mousemove.image_brush").off("mouseup.image_brush"),a.up(n.mouseOffsetCss(h)),a.stopDragging(),r("grabbable"),u.isPending()&&u.immediateCall())}function I(h){h.which===1&&((0,De.default)(document).off("mousemove.image_brush").off("mouseup.image_brush"),a.up(n.mouseOffsetCss(h)),a.stopResizing(),u.isPending()&&u.immediateCall())}function L(){t.brushResetOnNew&&e.data("mostRecentBrush")&&(a.reset(),u.immediateCall())}t.brushResetOnNew||e.data("mostRecentBrush")&&(a.importOldBrush(),u.immediateCall());function J(){a.onResize(),u.immediateCall()}return{mousedown:d,mousemove:c,onResetImg:L,onResize:J}}function lt(i,e){e.css("-webkit-user-drag","none"),e.off("dragstart.image_output"),e.on("dragstart.image_output",function(){return!1}),i.off("selectstart.image_output"),i.on("selectstart.image_output",function(){return!1})}var bi=class extends N{find(e){return(0,Pe.default)(e).find(".shiny-image-output, .shiny-plot-output")}renderValue(e,t){let n=this.getId(e),s=(0,Pe.default)(e),o,a=s.find("img");if(a.length===0?(o=document.createElement("img"),s.append(o),a=(0,Pe.default)(o)):(o=a[0],a.trigger("reset")),!t){s.empty();return}let r={clickId:s.data("click-id"),clickClip:j(Ve(s.data("click-clip")),!0),dblclickId:s.data("dblclick-id"),dblclickClip:j(Ve(s.data("dblclick-clip")),!0),dblclickDelay:j(s.data("dblclick-delay"),400),hoverId:s.data("hover-id"),hoverClip:j(Ve(s.data("hover-clip")),!0),hoverDelayType:j(s.data("hover-delay-type"),"debounce"),hoverDelay:j(s.data("hover-delay"),300),hoverNullOutside:j(Ve(s.data("hover-null-outside")),!1),brushId:s.data("brush-id"),brushClip:j(Ve(s.data("brush-clip")),!0),brushDelayType:j(s.data("brush-delay-type"),"debounce"),brushDelay:j(s.data("brush-delay"),300),brushFill:j(s.data("brush-fill"),"#666"),brushStroke:j(s.data("brush-stroke"),"#000"),brushOpacity:j(s.data("brush-opacity"),.3),brushDirection:j(s.data("brush-direction"),"xy"),brushResetOnNew:j(Ve(s.data("brush-reset-on-new")),!1),coordmap:t.coordmap};r.brushFill==="auto"&&(r.brushFill=ft(s[0])),r.brushStroke==="auto"&&(r.brushStroke=pe(s[0],"color")),Pe.default.each(t,function(l,u){u===null||l==="coordmap"||(l==="src"&&u===o.getAttribute("src")&&o.removeAttribute("src"),o.setAttribute(l,u))});for(let l=0;l<o.attributes.length;l++){let u=o.attributes[l];u.specified&&!ie(t,u.name)&&o.removeAttribute(u.name)}r.coordmap||(r.coordmap={panels:[],dims:{height:null,width:null}}),s.off(".image_output"),a.off(".image_output"),a.off("load.shiny_image_interaction"),a.one("load.shiny_image_interaction",function(){let l=r.coordmap=mi(s,r.coordmap),u=hi(s,r.dblclickId,r.dblclickDelay);if(s.on("mousedown.image_output",u.mousedown),Oe()&&ji()===8&&s.on("dblclick.image_output",u.dblclickIE8),r.clickId){lt(s,a);let d=hn(r.clickId,r.clickClip,l);s.on("mousedown2.image_output",d.mousedown),s.on("resize.image_output",d.onResize),a.on("reset.image_output",d.onResetImg)}if(r.dblclickId){lt(s,a);let d=hn(r.dblclickId,r.clickClip,l);s.on("dblclick2.image_output",d.mousedown),s.on("resize.image_output",d.onResize),a.on("reset.image_output",d.onResetImg)}if(r.hoverId){lt(s,a);let d=gi(r.hoverId,r.hoverDelay,r.hoverDelayType,r.hoverClip,r.hoverNullOutside,l);s.on("mousemove.image_output",d.mousemove),s.on("mouseout.image_output",d.mouseout),s.on("resize.image_output",d.onResize),a.on("reset.image_output",d.onResetImg)}if(r.brushId){lt(s,a);let d=yi(r.brushId,s,r,l,n);s.on("mousedown.image_output",d.mousedown),s.on("mousemove.image_output",d.mousemove),s.on("resize.image_output",d.onResize),a.on("reset.image_output",d.onResetImg)}(r.clickId||r.dblclickId||r.hoverId||r.brushId)&&s.addClass("crosshair"),t.error&&console.log("Error on server extracting coordmap: "+t.error)})}renderError(e,t){(0,Pe.default)(e).find("img").trigger("reset"),N.prototype.renderError.call(this,e,t)}clearError(e){(0,Pe.default)(e).contents().filter(function(){return!(this instanceof HTMLElement&&(this.tagName==="IMG"||this.id===e.id+"_brush"))}).remove(),N.prototype.clearError.call(this,e)}resize(e,t,n){(0,Pe.default)(e).find("img").trigger("resize")}},qe=new bi;var vi=M(S());var gn=class extends N{find(e){return(0,vi.default)(e).find(".shiny-text-output")}renderValue(e,t){(0,vi.default)(e).text(t)}};function Xs(){let i=new rt;return i.register(new gn,"shiny.textOutput"),i.register(new cn,"shiny.downloadLink"),i.register(new dn,"shiny.datatableOutput"),i.register(new fn,"shiny.htmlOutput"),i.register(qe,"shiny.imageOutput"),{outputBindings:i}}var yn=globalThis,bn=yn.ShadowRoot&&(yn.ShadyCSS===void 0||yn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,wi=Symbol(),Ws=new WeakMap,Et=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==wi)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(bn&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Ws.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Ws.set(t,e))}return e}toString(){return this.cssText}},Gs=i=>new Et(typeof i=="string"?i:i+"",void 0,wi),St=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((n,s,o)=>n+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+i[o+1],i[0]);return new Et(t,i,wi)},xi=(i,e)=>{if(bn)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),s=yn.litNonce;s!==void 0&&n.setAttribute("nonce",s),n.textContent=t.cssText,i.appendChild(n)}},vn=bn?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Gs(t)})(i):i;var{is:lo,defineProperty:uo,getOwnPropertyDescriptor:co,getOwnPropertyNames:po,getOwnPropertySymbols:mo,getPrototypeOf:fo}=Object,wn=globalThis,Ks=wn.trustedTypes,ho=Ks?Ks.emptyScript:"",go=wn.reactiveElementPolyfillSupport,Mt=(i,e)=>i,Ii={toAttribute(i,e){switch(e){case Boolean:i=i?ho:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},Zs=(i,e)=>!lo(i,e),Ys={attribute:!0,type:String,converter:Ii,reflect:!1,hasChanged:Zs};Symbol.metadata??=Symbol("metadata"),wn.litPropertyMetadata??=new WeakMap;var xe=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ys){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),s=this.getPropertyDescriptor(e,n,t);s!==void 0&&uo(this.prototype,e,s)}}static getPropertyDescriptor(e,t,n){let{get:s,set:o}=co(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get(){return s?.call(this)},set(a){let r=s?.call(this);o.call(this,a),this.requestUpdate(e,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ys}static _$Ei(){if(this.hasOwnProperty(Mt("elementProperties")))return;let e=fo(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Mt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Mt("properties"))){let t=this.properties,n=[...po(t),...mo(t)];for(let s of n)this.createProperty(s,t[s])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,s]of t)this.elementProperties.set(n,s)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let s=this._$Eu(t,n);s!==void 0&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let s of n)t.unshift(vn(s))}else e!==void 0&&t.push(vn(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$Eg=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$ES??=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$ES?.splice(this._$ES.indexOf(e)>>>0,1)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return xi(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$ES?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$ES?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t){let n=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,n);if(s!==void 0&&n.reflect===!0){let o=(n.converter?.toAttribute!==void 0?n.converter:Ii).toAttribute(t,n.type);this._$Em=e,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(e,t){let n=this.constructor,s=n._$Eh.get(e);if(s!==void 0&&this._$Em!==s){let o=n.getPropertyOptions(s),a=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:Ii;this._$Em=s,this[s]=a.fromAttribute(t,o.type),this._$Em=null}}requestUpdate(e,t,n,s=!1,o){if(e!==void 0){if(n??=this.constructor.getPropertyOptions(e),!(n.hasChanged??Zs)(s?o:this[e],t))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(e,t,n){this._$AL.has(e)||this._$AL.set(e,t),n.reflect===!0&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this._$Ep){for(let[s,o]of this._$Ep)this[s]=o;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[s,o]of n)o.wrapped!==!0||this._$AL.has(s)||this[s]===void 0||this.C(s,this[s],o)}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$ES?.forEach(n=>n.hostUpdate?.()),this.update(t)):this._$ET()}catch(n){throw e=!1,this._$ET(),n}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$ES?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach(t=>this._$EO(t,this[t])),this._$ET()}updated(e){}firstUpdated(e){}};xe.elementStyles=[],xe.shadowRootOptions={mode:"open"},xe[Mt("elementProperties")]=new Map,xe[Mt("finalized")]=new Map,go?.({ReactiveElement:xe}),(wn.reactiveElementVersions??=[]).push("2.0.0");var ki=globalThis,xn=ki.trustedTypes,er=xn?xn.createPolicy("lit-html",{createHTML:i=>i}):void 0,or="$lit$",Be=`lit$${(Math.random()+"").slice(9)}$`,ar="?"+Be,yo=`<${ar}>`,Ge=document,Ct=()=>Ge.createComment(""),kt=i=>i===null||typeof i!="object"&&typeof i!="function",lr=Array.isArray,bo=i=>lr(i)||typeof i?.[Symbol.iterator]=="function",Ti=`[
\f\r]`,$t=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,tr=/-->/g,nr=/>/g,Xe=RegExp(`>|${Ti}(?:([^\\s"'>=/]+)(${Ti}*=${Ti}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),ir=/'/g,sr=/"/g,ur=/^(?:script|style|textarea|title)$/i,dr=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),Hi=dr(1),Vu=dr(2),Ke=Symbol.for("lit-noChange"),U=Symbol.for("lit-nothing"),rr=new WeakMap,We=Ge.createTreeWalker(Ge,129);function cr(i,e){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return er!==void 0?er.createHTML(e):e}var vo=(i,e)=>{let t=i.length-1,n=[],s,o=e===2?"<svg>":"",a=$t;for(let r=0;r<t;r++){let l=i[r],u,d,c=-1,p=0;for(;p<l.length&&(a.lastIndex=p,d=a.exec(l),d!==null);)p=a.lastIndex,a===$t?d[1]==="!--"?a=tr:d[1]!==void 0?a=nr:d[2]!==void 0?(ur.test(d[2])&&(s=RegExp("</"+d[2],"g")),a=Xe):d[3]!==void 0&&(a=Xe):a===Xe?d[0]===">"?(a=s??$t,c=-1):d[1]===void 0?c=-2:(c=a.lastIndex-d[2].length,u=d[1],a=d[3]===void 0?Xe:d[3]==='"'?sr:ir):a===sr||a===ir?a=Xe:a===tr||a===nr?a=$t:(a=Xe,s=void 0);let f=a===Xe&&i[r+1].startsWith("/>")?" ":"";o+=a===$t?l+yo:c>=0?(n.push(u),l.slice(0,c)+or+l.slice(c)+Be+f):l+Be+(c===-2?r:f)}return[cr(i,o+(i[t]||"<?>")+(e===2?"</svg>":"")),n]},Ye=class{constructor({strings:e,_$litType$:t},n){let s;this.parts=[];let o=0,a=0,r=e.length-1,l=this.parts,[u,d]=vo(e,t);if(this.el=Ye.createElement(u,n),We.currentNode=this.el.content,t===2){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(s=We.nextNode())!==null&&l.length<r;){if(s.nodeType===1){if(s.hasAttributes())for(let c of s.getAttributeNames())if(c.endsWith(or)){let p=d[a++],f=s.getAttribute(c).split(Be),v=/([.?@])?(.*)/.exec(p);l.push({type:1,index:o,name:v[2],strings:f,ctor:v[1]==="."?Si:v[1]==="?"?Mi:v[1]==="@"?$i:dt}),s.removeAttribute(c)}else c.startsWith(Be)&&(l.push({type:6,index:o}),s.removeAttribute(c));if(ur.test(s.tagName)){let c=s.textContent.split(Be),p=c.length-1;if(p>0){s.textContent=xn?xn.emptyScript:"";for(let f=0;f<p;f++)s.append(c[f],Ct()),We.nextNode(),l.push({type:2,index:++o});s.append(c[p],Ct())}}}else if(s.nodeType===8)if(s.data===ar)l.push({type:2,index:o});else{let c=-1;for(;(c=s.data.indexOf(Be,c+1))!==-1;)l.push({type:7,index:o}),c+=Be.length-1}o++}}static createElement(e,t){let n=Ge.createElement("template");return n.innerHTML=e,n}};function ut(i,e,t=i,n){if(e===Ke)return e;let s=n!==void 0?t._$Co?.[n]:t._$Cl,o=kt(e)?void 0:e._$litDirective$;return s?.constructor!==o&&(s?._$AO?.(!1),o===void 0?s=void 0:(s=new o(i),s._$AT(i,t,n)),n!==void 0?(t._$Co??=[])[n]=s:t._$Cl=s),s!==void 0&&(e=ut(i,s._$AS(i,e.values),s,n)),e}var Ei=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,s=(e?.creationScope??Ge).importNode(t,!0);We.currentNode=s;let o=We.nextNode(),a=0,r=0,l=n[0];for(;l!==void 0;){if(a===l.index){let u;l.type===2?u=new Ze(o,o.nextSibling,this,e):l.type===1?u=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(u=new Ci(o,this,e)),this._$AV.push(u),l=n[++r]}a!==l?.index&&(o=We.nextNode(),a++)}return We.currentNode=Ge,s}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},Ze=class{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,s){this.type=2,this._$AH=U,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=ut(this,e,t),kt(e)?e===U||e==null||e===""?(this._$AH!==U&&this._$AR(),this._$AH=U):e!==this._$AH&&e!==Ke&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):bo(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==U&&kt(this._$AH)?this._$AA.nextSibling.data=e:this.$(Ge.createTextNode(e)),this._$AH=e}g(e){let{values:t,_$litType$:n}=e,s=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=Ye.createElement(cr(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===s)this._$AH.p(t);else{let o=new Ei(s,this),a=o.u(this.options);o.p(t),this.$(a),this._$AH=o}}_$AC(e){let t=rr.get(e.strings);return t===void 0&&rr.set(e.strings,t=new Ye(e)),t}T(e){lr(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,s=0;for(let o of e)s===t.length?t.push(n=new Ze(this.k(Ct()),this.k(Ct()),this,this.options)):n=t[s],n._$AI(o),s++;s<t.length&&(this._$AR(n&&n._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){let n=e.nextSibling;e.remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},dt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,s,o){this.type=1,this._$AH=U,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=U}_$AI(e,t=this,n,s){let o=this.strings,a=!1;if(o===void 0)e=ut(this,e,t,0),a=!kt(e)||e!==this._$AH&&e!==Ke,a&&(this._$AH=e);else{let r=e,l,u;for(e=o[0],l=0;l<o.length-1;l++)u=ut(this,r[n+l],t,l),u===Ke&&(u=this._$AH[l]),a||=!kt(u)||u!==this._$AH[l],u===U?e=U:e!==U&&(e+=(u??"")+o[l+1]),this._$AH[l]=u}a&&!s&&this.j(e)}j(e){e===U?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Si=class extends dt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===U?void 0:e}},Mi=class extends dt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==U)}},$i=class extends dt{constructor(e,t,n,s,o){super(e,t,n,s,o),this.type=5}_$AI(e,t=this){if((e=ut(this,e,t,0)??U)===Ke)return;let n=this._$AH,s=e===U&&n!==U||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,o=e!==U&&(n===U||s);s&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Ci=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){ut(this,e)}};var wo=ki.litHtmlPolyfillSupport;wo?.(Ye,Ze),(ki.litHtmlVersions??=[]).push("3.0.0");var pr=(i,e,t)=>{let n=t?.renderBefore??e,s=n._$litPart$;if(s===void 0){let o=t?.renderBefore??null;n._$litPart$=s=new Ze(e.insertBefore(Ct(),o),o,void 0,t??{})}return s._$AI(i),s};var Ie=class extends xe{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=pr(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Ke}};Ie._$litElement$=!0,Ie["finalized"]=!0,globalThis.litElementHydrateSupport?.({LitElement:Ie});var xo=globalThis.litElementPolyfillSupport;xo?.({LitElement:Ie});(globalThis.litElementVersions??=[]).push("4.0.0");var In=class extends Error{constructor({headline:t,message:n}){super(n);this.name="ShinyClientError",this.headline=t}};var mr=St`
button {
background-color: transparent;
outline: none;
border-style: none;
padding: var(--space-3);
border-radius: var(--space-1);
font-size: var(--font-lg);
background-color: inherit;
display: block;
}
button > svg {
display: block;
}
`,Di=class extends Ie{toggleCollapsed(){this.classList.toggle("collapsed"),this.querySelector(".toggle-button")?.blur()}handleDismissAll(){this.classList.add("leaving"),this.addEventListener("animationend",()=>{this.remove()})}static createClientMessageElement({headline:e,message:t}){let n=document.createElement("shiny-error-message");return n.setAttribute("headline",e||""),n.setAttribute("message",t),n}appendConsoleMessage({headline:e,message:t}){let n=this.shadowRoot?.querySelector("slot.content");if(n){let s=a=>{let r=a.getAttribute("headline")||"",l=a.getAttribute("message")||"";return`${r}::${l}`},o=`${e}::${t}`;for(let a of n.assignedElements())if(a.tagName.toLowerCase()==="shiny-error-message"&&s(a)===o)return}this.appendChild(Di.createClientMessageElement({headline:e,message:t}))}render(){return Hi` <div class="header">
<span class="title"> Shiny Client Errors </span>
<button
class="close-button"
@click=${this.handleDismissAll}
title="Dismiss all console messages and close console"
>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
height="1em"
width="1em"
stroke="currentColor"
class="close-icon"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M6 18L18 6M6 6l12 12"
/>
</svg>
Dismiss all
</button>
<button class="toggle-button" @click=${this.toggleCollapsed}>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
height="1em"
width="1em"
stroke="currentColor"
class="toggle-icon"
>
<path
class="collapse"
stroke-linecap="round"
stroke-linejoin="round"
d="M4.5 19.5l15-15m0 0H8.25m11.25 0v11.25"
/>
</svg>
</button>
</div>
<slot class="content"></slot>`}},Tn=Di;Tn.styles=[St`
:host {
/* We declare hard pixel values here to avoid body font size changes
messing up the size of the console. This was an issue with bslib setting
the body font-size at 16px relative to base shiny's 14px. */
--font-md: 14px;
--font-lg: 16px;
--font-xl: 18px;
/* These are all taken from open-props */
--space-1: 6px;
--space-2: calc(var(--space-1) * 2);
--space-3: calc(var(--space-1) * 3);
--space-4: calc(var(--space-1) * 4);
--space-8: calc(var(--space-1) * 8);
--red-2: #ffc9c9;
--red-6: #fa5252;
--red-7: #f03e3e;
--red-8: #e03131;
--red-10: #b02525;
--red-11: #962020;
--red-12: #7d1a1a;
--gray-1: #f8f9fa;
--gray-2: #e9ecef;
--gray-3: #dee2e6;
--gray-4: #ced4da;
--gray-6: #868e96;
--gray-8: #6c757d;
--green-8: #51cf66;
--shadow-color: 220 3% 15%;
--shadow-strength: 1%;
--shadow-3: 0 -1px 3px 0 hsl(var(--shadow-color) /
calc(var(--shadow-strength) + 2%)),
0 1px 2px -5px hsl(var(--shadow-color) /
calc(var(--shadow-strength) + 2%)),
0 2px 5px -5px hsl(var(--shadow-color) /
calc(var(--shadow-strength) + 4%)),
0 4px 12px -5px hsl(var(--shadow-color) /
calc(var(--shadow-strength) + 5%)),
0 12px 15px -5px hsl(var(--shadow-color) /
calc(var(--shadow-strength) + 7%));
--ring-shadow: 0 0 0 1px var(--gray-2);
/* How fast should the message pop in and out of the screen? */
--animation-speed: 500ms;
/* Taken from open-props */
--ease-3: cubic-bezier(0.25, 0, 0.3, 1);
--animation-slide-in-left: slide-in-left var(--animation-speed)
var(--ease-3);
--animation-slide-out-left: slide-out-left var(--animation-speed)
var(--ease-3);
--modal-bg-color: white;
position: fixed;
top: var(--space-1);
right: var(--space-1);
z-index: 1000;
display: flex;
flex-direction: column;
background-color: var(--modal-bg-color);
border-radius: var(--space-1);
animation: var(--animation-slide-in-left);
box-shadow: var(--shadow-3), var(--ring-shadow);
/* Dont let the error console burst out of the viewport */
max-height: calc(100vh - 2 * var(--space-1));
}
@keyframes slide-in-left {
from {
transform: translateX(100%);
}
}
@keyframes slide-out-left {
to {
transform: translateX(100%);
}
}
:host(.leaving) {
animation: var(--animation-slide-out-left);
}
.header {
display: flex;
justify-content: flex-end;
align-items: flex-start;
gap: var(--space-2);
}
.title {
font-size: var(--font-xl);
margin-right: auto;
padding: var(--space-3);
line-height: 1;
font-weight: 600;
color: var(--red-12);
}
${mr}
button:hover {
background-color: var(--gray-2);
}
.toggle-button {
width: fit-content;
border: none;
aspect-ratio: 1;
border-color: var(--gray-4);
}
.close-button {
display: flex;
align-items: center;
color: var(--red-11);
}
.close-button > svg {
margin-right: 3px;
}
.toggle-button:focus {
outline: 1px solid black;
}
.toggle-icon {
transition: transform var(--animation-speed) ease-in-out;
}
:host(.collapsed) .toggle-icon {
transform: scaleX(-1) scaleY(-1);
}
:host(.collapsed) .close-button {
display: none;
}
.content {
display: block;
padding-inline: var(--space-4);
padding-block-start: 0;
padding-block-end: var(--space-4);
max-height: 100%;
overflow: auto;
}
:host(.collapsed) .content {
display: none;
}
`];customElements.define("shiny-error-console",Tn);var Ht=class extends Ie{constructor(){super(...arguments);this.headline="";this.message=""}async copyErrorToClipboard(){await navigator.clipboard.writeText(this.message),this.classList.add("copy-success"),setTimeout(()=>{this.classList.remove("copy-success")},1e3)}render(){return Hi`
<div class="container">
<div class="decoration-container">
<div class="vertical-line"></div>
<div class="dot"></div>
</div>
<div class="contents">
<h3>${this.headline}</h3>
<pre class="error-message">${this.message}</pre>
</div>
<div class="actions">
<button
class="copy-button"
@click=${this.copyErrorToClipboard}
title="Copy error to clipboard"
>
<div class="copy-button-inner">
<svg
class="front"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
height="1em"
width="1em"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M15.666 3.888A2.25 2.25 0 0013.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 01-.75.75H9a.75.75 0 01-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 01-2.25 2.25H6.75A2.25 2.25 0 014.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 011.927-.184"
/>
</svg>
<svg
class="back"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
height="1em"
width="1em"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
/>
</svg>
</div>
</button>
</div>
</div>
`}};Ht.properties={headline:{},message:{}},Ht.styles=[St`
:host {
color: var(--red-11);
display: block;
font-size: var(--font-md);
position: relative;
--icon-size: var(--font-lg)
/* Reset box sizing */
box-sizing: border-box;
}
.container {
display: flex;
gap: var(--space-2);
}
.contents {
width: 40ch;
display: flex;
flex-direction: column;
gap: var(--space-1);
padding-block-start: 0;
padding-block-end: var(--space-3);
overflow: auto;
}
:host(:last-of-type) .contents {
padding-block-end: var(--space-1);
}
.contents > h3 {
font-size: 1em;
font-weight: 500;
color: var(--red-12);
}
.contents > * {
margin-block: 0;
}
.error-message {
font-family: "Courier New", Courier, monospace;
white-space: pre-wrap;
}
.decoration-container {
flex-shrink: 0;
position: relative;
--line-w: 2px;
--dot-size: 11px;
}
:host(:hover) .decoration-container {
--scale: 1.25;
}
.vertical-line {
margin-inline: auto;
width: var(--line-w);
height: 100%;
background-color: var(--red-10);
}
:host(:first-of-type) .vertical-line {
height: calc(100% - var(--dot-size));
margin-top: var(--dot-size);
}
.dot {
position: absolute;
width: var(--dot-size);
height: var(--dot-size);
top: calc(-1px + var(--dot-size) / 2);
left: calc(50% - var(--dot-size) / 2);
border-radius: 100%;
transform: scale(var(--scale, 1));
color: var(--red-6);
background-color: var(--red-10);
}
.actions {
transform: scaleX(0);
transition: transform calc(var(--animation-speed) / 2) ease-in-out;
display: flex;
justify-content: center;
flex-direction: column;
}
/* Delay transition on mouseout so the buttons don't jump away if the user
overshoots them with their mouse */
:host(:not(:hover)) .actions {
transition-delay: 0.15s;
}
:host(:hover) .actions {
transform: scaleX(1);
}
${mr}
.copy-button {
padding: 0;
width: var(--space-8);
height: var(--space-8);
position: relative;
--pad: var(--space-2);
}
.copy-button-inner {
position: relative;
width: 100%;
height: 100%;
border-radius: inherit;
transition: transform 0.5s;
transform-style: preserve-3d;
}
/* Animate flipping to the other side when the .copy-success class is
added to the host */
:host(.copy-success) .copy-button-inner {
transform: rotateY(180deg);
}
/* Position the front and back side */
.copy-button .front,
.copy-button .back {
--side: calc(100% - 2 * var(--pad));
position: absolute;
inset: var(--pad);
height: var(--side);
width: var(--side);
-webkit-backface-visibility: hidden; /* Safari */
backface-visibility: hidden;
}
.copy-button:hover .copy-button-inner {
background-color: var(--gray-2);
}
/* Style the back side */
.copy-button .back {
--pad: var(--space-1);
color: var(--green-8);
transform: rotateY(180deg);
}
`];customElements.define("shiny-error-message",Ht);function fr({headline:i="",message:e,status:t="warning"}){let n=`[shiny] ${i}${i?" - ":""}${e}`;switch(t){case"error":console.error(n);break;case"warning":console.warn(n);break;default:console.log(n);break}if(!ct.inDevMode())return;let s=document.querySelector("shiny-error-console");s||(s=document.createElement("shiny-error-console"),document.body.appendChild(s)),s.appendConsoleMessage({headline:i,message:e})}function Sn(i){let e=null,t="Error on client while running Shiny app";typeof i=="string"?e=i:i instanceof In?(e=i.message,t=i.headline):i instanceof Error?e=i.message:e="Unknown error",fr({headline:t,message:e,status:"error"})}var En=class extends CustomEvent{constructor(e){super("shiny:client-message",{detail:e,bubbles:!0,cancelable:!0})}};window.addEventListener("shiny:client-message",i=>{if(!(i instanceof CustomEvent))throw new Error("[shiny] shiny:client-message expected a CustomEvent");let{headline:e,message:t,status:n}=i.detail;if(!t)throw new Error("[shiny] shiny:client-message expected a `message` property in `event.detail`.");fr({headline:e,message:t,status:n})});function Mn(i){he(i,null),qe.find(document.documentElement).trigger("shiny-internal:brushed",{brushId:i,outputId:null})}var Dt=class{constructor(e){this.pendingData={};this.reentrant=!1;this.sendIsEnqueued=!1;this.lastChanceCallback=[];this.shinyapp=e}setInput(e,t,n){this.pendingData[e]=t,this.reentrant||(n.priority==="event"?this._sendNow():this.sendIsEnqueued||this.shinyapp.taskQueue.enqueue(()=>{this.sendIsEnqueued=!1,this._sendNow()}))}_sendNow(){this.reentrant&&console.trace("Unexpected reentrancy in InputBatchSender!"),this.reentrant=!0;try{this.lastChanceCallback.forEach(t=>t());let e=this.pendingData;this.pendingData={},this.shinyapp.sendInput(e)}finally{this.reentrant=!1}}};var Pt=class{constructor(e){this.pendingInput={};this.target=e}setInput(e,t,n){/^\./.test(e)?this.target.setInput(e,t,n):this.pendingInput[e]={value:t,opts:n}}submit(){for(let e in this.pendingInput)if(w(this.pendingInput,e)){let{value:t,opts:n}=this.pendingInput[e];this.target.setInput(e,t,n)}}};var Pi=M(S());function Le(i){let e=i.split(":");return{name:e[0],inputType:e.length>1?e[1]:""}}var Bt=class{constructor(e){this.target=e}setInput(e,t,n){let s=Pi.default.Event("shiny:inputchanged"),o=Le(e);if(s.name=o.name,s.inputType=o.inputType,s.value=t,s.binding=n.binding||null,s.el=n.el||null,s.priority=n.priority,(0,Pi.default)(n.el||window.document).trigger(s),!s.isDefaultPrevented()){let a=s.name;s.inputType!==""&&(a+=":"+s.inputType),this.target.setInput(a,s.value,{priority:n.priority})}}};var Lt=class{constructor(e,t={}){this.lastSentValues={};this.target=e,this.reset(t)}setInput(e,t,n){let{name:s,inputType:o}=Le(e),a=JSON.stringify(t);n.priority!=="event"&&this.lastSentValues[s]&&this.lastSentValues[s].jsonValue===a&&this.lastSentValues[s].inputType===o||(this.lastSentValues[s]={jsonValue:a,inputType:o},this.target.setInput(e,t,n))}reset(e={}){let t={};for(let n in e)if(w(e,n)){let{name:s,inputType:o}=Le(n);t[s]={jsonValue:JSON.stringify(e[n]),inputType:o}}this.lastSentValues=t}forget(e){delete this.lastSentValues[e]}};var _t=class{constructor(e){this.inputRatePolicies={};this.target=e}setInput(e,t,n){let{name:s}=Le(e);this._ensureInit(s),n.priority!=="deferred"?this.inputRatePolicies[s].immediateCall(e,t,n):this.inputRatePolicies[s].normalCall(e,t,n)}setRatePolicy(e,t,n){let{name:s}=Le(e);t==="direct"?this.inputRatePolicies[s]=new wt(this,this._doSetInput):t==="debounce"?this.inputRatePolicies[s]=new ee(this,this._doSetInput,n):t==="throttle"&&(this.inputRatePolicies[s]=new ke(this,this._doSetInput,n))}_ensureInit(e){e in this.inputRatePolicies||this.setRatePolicy(e,"direct")}_doSetInput(e,t,n){this.target.setInput(e,t,n)}};function Bi(i){let e={priority:"immediate",...i};switch(e.priority){case"deferred":case"immediate":case"event":break;default:throw new Error("Unexpected input value mode: '"+e.priority+"'")}return e}var At=class{constructor(e){this.target=e}setInput(e,t,n={}){if(!e)throw"Can't set input with empty name.";let s=Bi(n);this.target.setInput(e,t,s)}};function Io(){let i,e;return{promise:new Promise((n,s)=>{i=n,e=s}),resolve:i,reject:e}}function hr(){let{promise:i,resolve:e}=Io(),t=!1;return{promise:i,resolve(n){t=!0,e(n)},then:i.then.bind(i),catch:i.catch.bind(i),finally:i.finally.bind(i),[Symbol.toStringTag]:"InitStatus",resolved(){return t}}}var Q=M(S());var $n=class{constructor(e,t){this.el=e,this.binding=t,t.resize&&(this.onResize=ns(e,function(n,s){t.resize(e,n,s)}))}getId(){return this.binding.getId(this.el)}async onValueChange(e){await this.binding.onValueChange(this.el,e)}onValueError(e){this.binding.onValueError(this.el,e)}showProgress(e){this.binding.showProgress(this.el,e)}onResize(){}};function gr(i){return Boolean(i&&i.jquery)}function To(i,e,t,n){let s=e.getId(t);if(s){let o=e.getValue(t),a=e.getType(t);a&&(s=s+":"+a),i.setInput(s,o,{priority:n,binding:e,el:t})}}var Rt=(()=>{let i=new Map;function e(s){if(!gr(s)&&!(s instanceof HTMLElement))return;let o=new Map,a=new Set;if(i.forEach(($,C)=>{let I={input:0,output:0};$.forEach(L=>I[L]+=1),!(I.input+I.output<2)&&(o.set(C,I),I.input>1&&a.add("input"),I.output>1&&a.add("output"),I.input>=1&&I.output>=1&&a.add("shared"))}),o.size===0)return;let r=Array.from(o.entries()).map(([$,C])=>{let I=[yr(C.input,"input"),yr(C.output,"output")].filter(L=>L!=="").join(" and ");return`- "${$}": ${I}`}).join(`
`),l="Duplicate",u="input/output";a.has("input")&&a.has("output")||(a.has("input")?u="input":a.has("output")?u="output":a.has("shared")&&(l="Shared"));let d=o.size==1?"ID was":"IDs were",c=`${l} ${u} ${d} found`,p=`The following ${d} used for more than one ${a.has("shared")?"input/output":u}:
${r}`,f=new En({headline:c,message:p});((gr(s)?s.get(0):s)||window).dispatchEvent(f)}function t(s,o){let a=i.get(s);a?a.push(o):i.set(s,[o])}function n(s,o){let a=i.get(s);if(a){let r=a.indexOf(o);r>-1&&a.splice(r,1)}a?.length===0&&i.delete(s)}return{addBinding:t,removeBinding:n,checkValidity:e}})();function yr(i,e){return i===0?"":i===1?`${i} ${e}`:`${i} ${e}s`}function Eo(i,e=document.documentElement){let{inputs:t,inputsRate:n,inputBindings:s}=i,o=s.getBindings(),a={};for(let r=0;r<o.length;r++){let l=o[r].binding,u=l.find(e)||[];for(let d=0;d<u.length;d++){let c=u[d];if(c.hasAttribute("data-shiny-no-bind-input"))continue;let p=l.getId(c);if(!p||(0,Q.default)(c).hasClass("shiny-bound-input"))continue;let f=l.getType(c),v=f?p+":"+f:p;a[v]={value:l.getValue(c),opts:{immediate:!0,binding:l,el:c}};let $=function(){let I=l,L=c;return function(J){To(t,I,L,typeof J!="boolean"?J:J?"deferred":"immediate")}}();l.subscribe(c,$),(0,Q.default)(c).data("shiny-input-binding",l),(0,Q.default)(c).addClass("shiny-bound-input");let C=l.getRatePolicy(c);C!==null&&n.setRatePolicy(v,C.policy,C.delay),Rt.addBinding(p,"input"),(0,Q.default)(c).trigger({type:"shiny:bound",binding:l,bindingType:"input"})}}return a}async function So({sendOutputHiddenState:i,maybeAddThemeObserver:e,outputBindings:t},n=document.documentElement){let s=(0,Q.default)(n),o=t.getBindings();for(let a=0;a<o.length;a++){let r=o[a].binding,l=r.find(s)||[];for(let u=0;u<l.length;u++){let d=l[u],c=r.getId(d);if(!c||!Q.default.contains(document.documentElement,d))continue;let p=(0,Q.default)(d);if(p.hasClass("shiny-bound-output"))continue;e(d);let f=new $n(d,r);await ms(c,f),p.data("shiny-output-binding",f),p.addClass("shiny-bound-output"),p.attr("aria-live")||p.attr("aria-live","polite"),ct.shinyapp?.$outputProgress.isRecalculating(c)&&f.showProgress(!0),Rt.addBinding(c,"output"),p.trigger({type:"shiny:bound",binding:r,bindingType:"output"})}}setTimeout(de.regular,0),setTimeout(i,0)}function Mo(i=document.documentElement,e=!1){let t=(0,Q.default)(i).find(".shiny-bound-input").toArray();e&&(0,Q.default)(i).hasClass("shiny-bound-input")&&t.push(i);for(let n=0;n<t.length;n++){let s=t[n],o=(0,Q.default)(s).data("shiny-input-binding");if(!o)continue;let a=o.getId(s);(0,Q.default)(s).removeClass("shiny-bound-input"),Rt.removeBinding(a,"input"),o.unsubscribe(s),(0,Q.default)(s).trigger({type:"shiny:unbound",binding:o,bindingType:"input"})}}function $o({sendOutputHiddenState:i},e=document.documentElement,t=!1){let n=(0,Q.default)(e).find(".shiny-bound-output").toArray();t&&(0,Q.default)(e).hasClass("shiny-bound-output")&&n.push(e);for(let s=0;s<n.length;s++){let o=(0,Q.default)(n[s]),a=o.data("shiny-output-binding");if(!a)continue;let r=a.binding.getId(n[s]);fs(r,a),Rt.removeBinding(r,"output"),o.removeClass("shiny-bound-output"),o.removeData("shiny-output-binding"),o.trigger({type:"shiny:unbound",binding:a.binding,bindingType:"output"})}setTimeout(de.regular,0),setTimeout(i,0)}async function Li(i,e){await So(i,e);let t=Eo(i,e);return Rt.checkValidity(e),t}function br(i,e,t=!1){Mo(e,t),$o(i,e,t)}async function vr(i,e){let t=await Li(i,e),n=i.inputs;Q.default.each(t,function(s,o){n.setInput(s,o.value,o.opts)}),i.initDeferredIframes()}var _e=M(S());async function Cn({html:i="",deps:e=[]}={}){await je(e),(0,_e.default)(".modal-backdrop").remove();let t=(0,_e.default)("#shiny-modal-wrapper");t.length===0&&(t=(0,_e.default)('<div id="shiny-modal-wrapper"></div>'),(0,_e.default)(document.body).append(t),t.on("hidden.bs.modal",function(n){n.target===(0,_e.default)("#shiny-modal")[0]&&(G(t),t.remove())})),t.on("keydown.shinymodal",function(n){(0,_e.default)("#shiny-modal").data("keyboard")!==!1&&n.keyCode===27&&(n.stopPropagation(),n.preventDefault())}),await oe(t,{html:i})}function kn(){let i=(0,_e.default)("#shiny-modal-wrapper");i.off("keydown.shinymodal");let e=i.find(".modal");e.length>0?(e.on("shown.bs.modal",()=>e.modal("hide")),e.modal("hide")):(G(i),i.remove())}var Ot=M(S());var Co=250;async function Te({html:i="",action:e="",deps:t=[],duration:n=5e3,id:s=null,closeButton:o=!0,type:a=null}={}){s||(s=jt()),await je(t),Ho();let r=Vt(s);r?.length===0&&(r=Do(s));let l=r,u=`<div class="shiny-notification-content-text">${i}</div><div class="shiny-notification-content-action">${e}</div>`,d=l.find(".shiny-notification-content");await oe(d,{html:u});let c=l?.attr("class");if(c){let f=c.split(/\s+/).filter(v=>v.match(/^shiny-notification-/)).join(" ");l.removeClass(f)}a&&a!=="default"&&l.addClass("shiny-notification-"+a);let p=l.find(".shiny-notification-close");return o&&p.length===0?l.append('<div class="shiny-notification-close">×</div>'):!o&&p.length!==0&&p.remove(),n?Po(s,n):wr(s),s}function Ee(i){Vt(i)?.fadeOut(Co,function(){G(this),(0,Ot.default)(this).remove(),ko().length===0&&zt().remove()})}function Vt(i){return i?zt().find("#shiny-notification-"+E(i)):null}function ko(){return zt().find(".shiny-notification").map(function(){return this.id.replace(/shiny-notification-/,"")}).get()}function zt(){return(0,Ot.default)("#shiny-notification-panel")}function Ho(){let i=zt();return i.length>0||(0,Ot.default)(document.body).append('<div id="shiny-notification-panel">'),i}function Do(i){let e=Vt(i);return e?.length===0&&(e=(0,Ot.default)(`<div id="shiny-notification-${i}" class="shiny-notification"><div class="shiny-notification-close">×</div><div class="shiny-notification-content"></div></div>`),e.find(".shiny-notification-close").on("click",t=>{t.preventDefault(),t.stopPropagation(),Ee(i)}),zt().append(e)),e}function Po(i,e){wr(i);let t=setTimeout(function(){Ee(i)},e);Vt(i)?.data("removalCallback",t)}function wr(i){let t=Vt(i)?.data("removalCallback");t&&clearTimeout(t)}var _i=M(S());function xr(i){let e=(0,_i.default)("#shiny-reconnect-time");if(e.length===0)return;let t=Math.floor((i-new Date().getTime())/1e3);t>0?e.text(" in "+t+"s"):e.text("..."),setTimeout(function(){xr(i)},1e3)}async function Hn(i){let e=new Date().getTime()+i;if((0,_i.default)("#shiny-reconnect-text").length>0)return;await Te({id:"reconnect",html:'<span id="shiny-reconnect-text">Attempting to reconnect</span><span id="shiny-reconnect-time"></span>',action:'<a id="shiny-reconnect-now" href="#" onclick="Shiny.shinyapp.reconnect();">Try now</a>',duration:null,closeButton:!1,type:"warning"}),xr(e)}function Dn(){Ee("reconnect")}var b=M(S());var Pn=class{constructor(){this.$promises=[];this.$resolvers=[]}_add(){let e=new Promise(t=>{this.$resolvers.push(t)});this.$promises.push(e)}enqueue(e){this.$resolvers.length||this._add(),this.$resolvers.shift()(e)}async dequeue(){return this.$promises.length||this._add(),this.$promises.shift()}isEmpty(){return!this.$promises.length}isBlocked(){return!!this.$resolvers.length}get length(){return this.$promises.length-this.$resolvers.length}};var Ln,Ir,_n,Tr,An,Er,Ut,Ai,tt,Nt,Se,et,Bn=class{constructor(){Re(this,Ln);Re(this,_n);Re(this,An);Re(this,Ut);Re(this,tt);Re(this,Se);this.outputStates=new Map;this.changedOutputs=new Map}takeChanges(){let e=this.changedOutputs;return this.changedOutputs=new Map,e}isRecalculating(e){let t=F(this,tt,Nt).call(this,e);return["initial","running","idle","persistent","invalidated"].includes(t)}updateStateFromMessage(e){Bo(e)&&F(this,Ln,Ir).call(this,e),Lo(e)&&F(this,_n,Tr).call(this,e),_o(e)&&F(this,An,Er).call(this,e)}};Ln=new WeakSet,Ir=function(e){let{name:t,status:n}=e.recalculating,s=F(this,tt,Nt).call(this,t);if(n==="recalculating")switch(s){case"initial":case"invalidated":F(this,Se,et).call(this,t,"running");break;default:throw new Error(`Shiny server sent a message that the output '${t}' is recalculating,
but the output is in an unexpected state of: '${s}'.`)}if(n==="recalculated")switch(s){case"running":F(this,Se,et).call(this,t,"idle");break;default:throw new Error(`Shiny server sent a message that the output '${t}' has been recalculated,
but the output is in an unexpected state of: '${s}'.`)}},_n=new WeakSet,Tr=function(e){for(let t in e.values)F(this,Ut,Ai).call(this,t,"value");for(let t in e.errors)F(this,Ut,Ai).call(this,t,"error");for(let[t,n]of this.outputStates)switch(n){case"idle":F(this,Se,et).call(this,t,"cancel");break;case"value":case"error":case"cancel":case"persistent":case"invalidated":break;default:throw new Error(`Shiny server sent a flush message, and after processing the values and errors,
the output '${t}' has an unexpected ending state of: '${n}'.`)}},An=new WeakSet,Er=function(e){let{id:t,persistent:n}=e.progress.message,s=F(this,tt,Nt).call(this,t);if(n)switch(s){case"running":F(this,Se,et).call(this,t,"persistent");break;default:throw new Error(`Shiny server has sent a 'persistent progress' message for ${t},
but the output is in an unexpected state of: ${s}`)}else switch(s){case"value":case"error":case"cancel":case"persistent":case"idle":F(this,Se,et).call(this,t,"invalidated");break;default:throw new Error(`Shiny server has sent a progress message for ${t},
but the output is in an unexpected state of: ${s}`)}},Ut=new WeakSet,Ai=function(e,t){let n=F(this,tt,Nt).call(this,e);switch(n){case"idle":F(this,Se,et).call(this,e,t);break;default:throw new Error(`Shiny server has sent a ${t} for the output '${e}',
but the output is in an unexpected state of: '${n}'.`)}},tt=new WeakSet,Nt=function(e){return this.outputStates.get(e)??"initial"},Se=new WeakSet,et=function(e,t){let n=this.isRecalculating(e);this.outputStates.set(e,t);let s=this.isRecalculating(e);n!==s&&this.changedOutputs.set(e,s)};function Bo(i){return i.recalculating!==void 0}function Lo(i){let e=i;return e.values!==void 0&&e.errors!==void 0}function _o(i){let e=i;return e.progress!==void 0&&e.progress.type==="binding"}var Sr=[],Ri={},Rn=[],On={};function A(i,e){if(Ri[i])throw'handler for message of type "'+i+'" already added.';if(typeof e!="function")throw"handler must be a function.";if(e.length!==1)throw"handler must be a function that takes one argument.";Sr.push(i),Ri[i]=e}function Mr(i,e){if(On[i]){let t=Rn.indexOf(i);t!==-1&&(Rn.splice(t,1),delete On[i])}if(typeof e!="function")throw"handler must be a function.";if(e.length!==1)throw"handler must be a function that takes one argument.";Rn.push(i),On[i]=e}var Vn=class{constructor(){this.$socket=null;this.taskQueue=new Pn;this.config=null;this.$inputValues={};this.$initialInput=null;this.$bindings={};this.$outputProgress=new Bn;this.$values={};this.$errors={};this.$conditionals={};this.$pendingMessages=[];this.$activeRequests={};this.$nextRequestId=0;this.$allowReconnect=!1;this.scheduledReconnect=void 0;this.reconnectDelay=function(){let e=0,t=[1500,1500,2500,2500,5500,5500,10500];return{next:function(){let n=e;return n>=t.length&&(n=t.length-1),e++,t[n]},reset:function(){e=0}}}();this.progressHandlers={binding:function(e){let t=e.id,n=this.$bindings[t];n&&(0,b.default)(n.el).trigger({type:"shiny:outputinvalidated",binding:n,name:t}),this._updateProgress()},open:async function(e){if(e.style==="notification")await Te({html:`<div id="shiny-progress-${e.id}" class="shiny-progress-notification"><div class="progress active" style="display: none;"><div class="progress-bar"></div></div><div class="progress-text"><span class="progress-message">message</span> <span class="progress-detail"></span></div></div>`,id:e.id,duration:null});else if(e.style==="old"){let t=(0,b.default)(".shiny-progress-container");t.length===0&&(t=(0,b.default)('<div class="shiny-progress-container"></div>'),(0,b.default)(document.body).append(t));let n=(0,b.default)(".shiny-progress.open").length,s=(0,b.default)('<div class="shiny-progress open"><div class="progress active"><div class="progress-bar bar"></div></div><div class="progress-text"><span class="progress-message">message</span><span class="progress-detail"></span></div></div>');s.attr("id",e.id),t.append(s);let o=s.find(".progress");if(o){o.css("top",n*o.height()+"px");let a=s.find(".progress-text");a.css("top",3*o.height()+n*a.outerHeight()+"px"),s.hide()}}},update:function(e){if(e.style==="notification"){let t=(0,b.default)("#shiny-progress-"+e.id);if(t.length===0)return;typeof e.message<"u"&&t.find(".progress-message").text(e.message),typeof e.detail<"u"&&t.find(".progress-detail").text(e.detail),typeof e.value<"u"&&e.value!==null&&(t.find(".progress").show(),t.find(".progress-bar").width(e.value*100+"%"))}else if(e.style==="old"){let t=(0,b.default)("#"+e.id+".shiny-progress");typeof e.message<"u"&&t.find(".progress-message").text(e.message),typeof e.detail<"u"&&t.find(".progress-detail").text(e.detail),typeof e.value<"u"&&e.value!==null&&(t.find(".progress").show(),t.find(".bar").width(e.value*100+"%")),t.fadeIn()}},close:function(e){if(e.style==="notification")Ee(e.id);else if(e.style==="old"){let t=(0,b.default)("#"+e.id+".shiny-progress");t.removeClass("open"),t.fadeOut({complete:function(){t.remove(),(0,b.default)(".shiny-progress").length===0&&(0,b.default)(".shiny-progress-container").remove()}})}}};this._init()}connect(e){if(this.$socket)throw"Connect was already called on this application object";this.$socket=this.createSocket(),this.$initialInput=e,b.default.extend(this.$inputValues,e),this.$updateConditionals()}isConnected(){return!!this.$socket}reconnect(){if(clearTimeout(this.scheduledReconnect),this.isConnected())throw"Attempted to reconnect, but already connected.";this.$socket=this.createSocket(),this.$initialInput=b.default.extend({},this.$inputValues),this.$updateConditionals()}createSocket(){let t=(vs()||(()=>{let s="ws:";window.location.protocol==="https:"&&(s="wss:");let o=window.location.pathname;/^([$#!&-;=?-[\]_a-z~]|%[0-9a-fA-F]{2})+$/.test(o)||(o=encodeURI(o),Fi()&&(o=encodeURI(o))),/\/$/.test(o)||(o+="/"),o+="websocket/";let a=new WebSocket(s+"//"+window.location.host+o);return a.binaryType="arraybuffer",a}))(),n=!1;return t.onopen=()=>{for(n=!0,(0,b.default)(document).trigger({type:"shiny:connected",socket:t}),this.onConnected(),t.send(JSON.stringify({method:"init",data:this.$initialInput}));this.$pendingMessages.length;){let s=this.$pendingMessages.shift();t.send(s)}this.startActionQueueLoop()},t.onmessage=s=>{this.taskQueue.enqueue(async()=>await this.dispatchMessage(s.data))},t.onclose=s=>{let o=s.code===1012;n&&((0,b.default)(document).trigger({type:"shiny:disconnected",socket:t}),this.$notifyDisconnected()),this.onDisconnected(o),this.$removeSocket()},t}async startActionQueueLoop(){for(;;)try{await(await this.taskQueue.dequeue())()}catch(e){Sn(e),console.error(e)}}sendInput(e){let t=JSON.stringify({method:"update",data:e});this.$sendMsg(t),b.default.extend(this.$inputValues,e),this.$updateConditionals()}$notifyDisconnected(){window.parent&&window.parent.postMessage("disconnected","*")}$removeSocket(){this.$socket=null}$scheduleReconnect(e){this.scheduledReconnect=window.setTimeout(()=>{this.reconnect()},e)}onDisconnected(e=!1){if((0,b.default)("#shiny-disconnected-overlay").length===0&&(0,b.default)(document.body).append('<div id="shiny-disconnected-overlay"></div>'),(0,b.default)("#shiny-disconnected-overlay").toggleClass("reloading",e),this.$allowReconnect===!0&&this.$socket.allowReconnect===!0||this.$allowReconnect==="force"){let t=this.reconnectDelay.next();Hn(t),this.$scheduleReconnect(t)}}onConnected(){(0,b.default)("#shiny-disconnected-overlay").remove(),Dn(),this.reconnectDelay.reset()}makeRequest(e,t,n,s,o){let a=this.$nextRequestId;for(;this.$activeRequests[a];)a=(a+1)%1e9;this.$nextRequestId=a+1,this.$activeRequests[a]={onSuccess:n,onError:s};let r=JSON.stringify({method:e,args:t,tag:a});if(o){let l=function(p){let f=new ArrayBuffer(4);return new DataView(f).setUint32(0,p,!0),f},u=[];u.push(l(16908802));let d=new Blob([r]);u.push(l(d.size)),u.push(d);for(let p=0;p<o.length;p++){let f=o[p];u.push(l(f.byteLength||f.size||0)),u.push(f)}r=new Blob(u)}this.$sendMsg(r)}$sendMsg(e){this.$socket&&this.$socket.readyState?this.$socket.send(e):this.$pendingMessages.push(e)}receiveError(e,t){if(this.$errors[e]===t)return;this.$errors[e]=t,delete this.$values[e];let n=this.$bindings[e],s=b.default.Event("shiny:error");s.name=e,s.error=t,s.binding=n,(0,b.default)(n?n.el:document).trigger(s),!s.isDefaultPrevented()&&n&&n.onValueError&&n.onValueError(s.error)}async receiveOutput(e,t){let n=this.$bindings[e],s=b.default.Event("shiny:value");if(s.name=e,s.value=t,s.binding=n,this.$values[e]===t){(0,b.default)(n?n.el:document).trigger(s);return}return this.$values[e]=t,delete this.$errors[e],(0,b.default)(n?n.el:document).trigger(s),!s.isDefaultPrevented()&&n&&await n.onValueChange(s.value),t}async bindOutput(e,t){if(!e)throw new Error("Can't bind an element with no ID");return this.$bindings[e]=t,this.$values[e]!==void 0?await t.onValueChange(this.$values[e]):this.$errors[e]!==void 0&&t.onValueError(this.$errors[e]),t}unbindOutput(e,t){return this.$bindings[e]===t?(delete this.$bindings[e],!0):!1}_narrowScopeComponent(e,t){return Object.keys(e).filter(n=>n.indexOf(t)===0).map(n=>({[n.substring(t.length)]:e[n]})).reduce((n,s)=>b.default.extend(n,s),{})}_narrowScope(e,t){return t?{input:this._narrowScopeComponent(e.input,t),output:this._narrowScopeComponent(e.output,t)}:e}$updateConditionals(){(0,b.default)(document).trigger({type:"shiny:conditional"});let e={};for(let s in this.$inputValues)if(ie(this.$inputValues,s)){let o=s.replace(/:.*/,"");e[o]=this.$inputValues[s]}let t={input:e,output:this.$values},n=(0,b.default)(document).find("[data-display-if]");for(let s=0;s<n.length;s++){let o=(0,b.default)(n[s]),a=o.data("data-display-if-func");if(!a){let c=o.attr("data-display-if");a=is(c),o.data("data-display-if-func",a)}let r=o.attr("data-ns-prefix"),l=this._narrowScope(t,r),u=Boolean(a(l)),d=o.css("display")!=="none";u!==d&&(u?(o.trigger("show"),o.show(),o.trigger("shown")):(o.trigger("hide"),o.hide(),o.trigger("hidden")))}}async dispatchMessage(e){let t={};if(typeof e=="string")t=JSON.parse(e);else{let s=new DataView(e,0,1).getUint8(0),o=new DataView(e,1,s),a=[];for(let l=0;l<s;l++)a.push(String.fromCharCode(o.getUint8(l)));let r=a.join("");e=e.slice(s+1),t.custom={},t.custom[r]=e}let n=b.default.Event("shiny:message");n.message=t,(0,b.default)(document).trigger(n),!n.isDefaultPrevented()&&(this.$outputProgress.updateStateFromMessage(n.message),await this._sendMessagesToHandlers(n.message,Ri,Sr),this.$updateConditionals())}async _sendMessagesToHandlers(e,t,n){for(let s=0;s<n.length;s++){let o=n[s];ie(e,o)&&await t[o].call(this,e[o])}}_updateProgress(){let e=this.$outputProgress.takeChanges();for(let[t,n]of e.entries())ie(this.$bindings,t)&&this.$bindings[t].showProgress(n)}_init(){A("values",async r=>{this._updateProgress();for(let l in r)ie(r,l)&&await this.receiveOutput(l,r[l])}),A("errors",r=>{for(let l in r)ie(r,l)&&this.receiveError(l,r[l])}),A("inputMessages",async r=>{for(let l=0;l<r.length;l++){let u=(0,b.default)(".shiny-bound-input#"+E(r[l].id)),d=u.data("shiny-input-binding");if(u.length>0){u.attr("aria-live")||u.attr("aria-live","polite");let c=u[0],p=b.default.Event("shiny:updateinput");if(p.message=r[l].message,p.binding=d,(0,b.default)(c).trigger(p),!p.isDefaultPrevented())try{await d.receiveMessage(c,p.message)}catch(f){console.error("[shiny] Error in inputBinding.receiveMessage()",{error:f,binding:d,message:p.message})}}}}),A("javascript",r=>{Je(r)}),A("console",r=>{for(let l=0;l<r.length;l++)console.log&&console.log(r[l])}),A("progress",async r=>{if(r.type&&r.message){let l=await this.progressHandlers[r.type];l&&l.call(this,r.message)}}),A("notification",async r=>{if(r.type==="show")await Te(r.message);else if(r.type==="remove")Ee(r.message);else throw"Unkown notification type: "+r.type}),A("modal",async r=>{if(r.type==="show")await Cn(r.message);else if(r.type==="remove")kn();else throw"Unkown modal type: "+r.type}),A("response",r=>{let l=r.tag,u=this.$activeRequests[l];u&&(delete this.$activeRequests[l],"value"in r?u.onSuccess(r.value):u.onError(r.error))}),A("allowReconnect",r=>{switch(r){case!0:case!1:case"force":this.$allowReconnect=r;break;default:throw"Invalid value for allowReconnect: "+r}}),A("custom",async r=>{let l=hs();l&&await l(r),await this._sendMessagesToHandlers(r,On,Rn)}),A("config",r=>{this.config={workerId:r.workerId,sessionId:r.sessionId},r.user&&cs(r.user),(0,b.default)(document).trigger("shiny:sessioninitialized")}),A("busy",r=>{r==="busy"?((0,b.default)(document.documentElement).addClass("shiny-busy"),(0,b.default)(document).trigger("shiny:busy")):r==="idle"&&((0,b.default)(document.documentElement).removeClass("shiny-busy"),(0,b.default)(document).trigger("shiny:idle"))}),A("recalculating",r=>{if(ie(r,"name")&&ie(r,"status")){let l=this.$bindings[r.name];l?(0,b.default)(l.el).trigger("shiny:"+r.status):(0,b.default)().trigger("shiny:"+r.status)}}),A("reload",r=>{window.location.reload()}),A("shiny-insert-ui",async r=>{let l=(0,b.default)(r.selector);if(l.length===0)console.warn('The selector you chose ("'+r.selector+'") could not be found in the DOM.'),await Tt(r.content.html,(0,b.default)([]),r.content.deps);else for(let u of l)if(await oe(u,r.content,r.where),r.multiple===!1)break}),A("shiny-remove-ui",r=>{(0,b.default)(r.selector).each(function(u,d){return G(d,!0),(0,b.default)(d).remove(),r.multiple===!1?!1:void 0})}),A("frozen",r=>{for(let l=0;l<r.ids.length;l++)ps(r.ids[l])});function e(r){let l=(0,b.default)("#"+E(r));if(l.length===0)throw"There is no tabsetPanel (or navbarPage or navlistPanel) with id equal to '"+r+"'";return l}function t(r){let l=r.attr("data-tabsetid");return(0,b.default)("div.tab-content[data-tabsetid='"+E(l)+"']")}function n(r,l,u){let d="[data-value='"+E(u)+"']",c=r.find("a"+d),p=c.parent();if(p.length===0)throw"There is no tabPanel (or navbarMenu) with value (or menuName) equal to '"+u+"'";let f=[],v=[];if(c.attr("data-toggle")==="dropdown"){let $=c.find("+ ul.dropdown-menu"),C=$.attr("data-tabsetid");$.find("a[data-toggle='tab']").parent("li").each(function(h,T){f.push((0,b.default)(T))});let L="div.tab-pane[id^='tab-"+E(C)+"']";l.find(L).each(function(h,T){v.push((0,b.default)(T))})}else v.push(l.find("div"+d));return{$liTag:p,$liTags:f,$divTags:v}}A("shiny-insert-tab",async r=>{let l=e(r.inputId),u=l,d=t(u),c=l.attr("data-tabsetid"),p=(0,b.default)("<div>");await oe(p,r.liTag,"afterBegin");let f=(0,b.default)(p).find("> li"),v=f.find("> a"),$=null;r.target!==null&&($=n(u,d,r.target).$liTag);let C=J();if(C!==null){if(v.attr("data-toggle")==="dropdown")throw"Cannot insert a navbarMenu inside another one";u=C.$tabset,c=C.id,f.removeClass("nav-item").find(".nav-link").removeClass("nav-link").addClass("dropdown-item")}let I="";if(v.attr("data-toggle")==="tab"){let h=L(u,c),T="tab-"+c+"-"+h;f.find("> a").attr("href","#"+T),I=T}r.position==="before"?$?$.before(f):u.prepend(f):r.position==="after"&&($?$.after(f):u.append(f)),await Ue($?.parent()||u),await oe(d[0],r.divTag,"beforeEnd"),I&&d.find('[id="tab-tsid-id"]').attr("id",I),r.select&&f.find("a").tab("show");function L(h,T){let _=[0];return h.find("> li").each(function(){let Me=(0,b.default)(this).find("> a[data-toggle='tab']");if(Me.length>0){let it=Me.attr("href").replace(/.*(?=#[^\s]+$)/,"").replace("#tab-"+T+"-","");_.push(Number(it))}}),Math.max.apply(null,_)+1}function J(){if(r.menuName!==null){let h=(0,b.default)("a.dropdown-toggle[data-value='"+E(r.menuName)+"']");if(h.length===0)throw"There is no navbarMenu with menuName equal to '"+r.menuName+"'";let T=h.find("+ ul.dropdown-menu"),_=T.attr("data-tabsetid");return{$tabset:T,id:_}}else if(r.target!==null&&$!==null){let h=$.parent("ul");if(h.hasClass("dropdown-menu")){let T=h.attr("data-tabsetid");return{$tabset:h,id:T}}}return null}});function s(r){let l=r.data("shiny-input-binding");if(!l.getValue(r)){let u=o(r),d=b.default.Event("shiny:updateinput");d.binding=l,r.trigger(d),l.setValue(r[0],u)}}function o(r){return r.find("li:visible a[data-toggle='tab']").first().attr("data-value")||null}function a(r,l,u=!1){b.default.each(r,function(d,c){d==="$liTag"?l(c):d==="$divTags"?b.default.each(c,function(p,f){l(f)}):u&&d==="$liTags"&&b.default.each(c,function(p,f){l(f)})})}A("shiny-remove-tab",r=>{let l=e(r.inputId),u=t(l),d=n(l,u,r.target);a(d,c),s(l);function c(p){G(p,!0),p.remove()}}),A("shiny-change-tab-visibility",r=>{let l=e(r.inputId),u=t(l),d=n(l,u,r.target);a(d,c,!0),s(l);function c(p){r.type==="show"?p.css("display",""):r.type==="hide"&&(p.hide(),p.removeClass("active"))}}),A("updateQueryString",r=>{if(r.mode==="replace"){window.history.replaceState(null,null,r.queryString);return}let l=null;if(r.queryString.charAt(0)==="#")l="hash";else if(r.queryString.charAt(0)==="?")l="query";else throw"The 'query' string must start with either '?' (to update the query string) or with '#' (to update the hash).";let u=window.location.pathname,d=window.location.search,c=window.location.hash,p=u;l==="query"?p+=r.queryString:p+=d+r.queryString,window.history.pushState(null,null,p),r.queryString.indexOf("#")!==-1&&(l="hash"),window.location.hash!==c&&(l="hash"),l==="hash"&&(0,b.default)(document).trigger("hashchange")}),A("resetBrush",r=>{Mn(r.brushId)})}getTestSnapshotBaseUrl({fullUrl:e=!0}={}){let t=window.location,n="";return e&&(n=t.origin+t.pathname.replace(/\/[^/]*$/,"")),n+="/session/"+encodeURIComponent(this.config.sessionId)+"/dataobj/shinytest?w="+encodeURIComponent(this.config.workerId)+"&nonce="+jt(),n}};var zn=class{constructor(){this.version="1.10.0.9000";let{inputBindings:e,fileInputBinding:t}=Ps(),{outputBindings:n}=Xs();bs(t),this.$escape=E,this.compareVersion=os,this.inputBindings=e,this.InputBinding=P,this.outputBindings=n,this.OutputBinding=N,this.resetBrush=Mn,this.notifications={show:Te,remove:Ee},this.modal={show:Cn,remove:kn},this.addCustomMessageHandler=Mr,this.showReconnectDialog=Hn,this.hideReconnectDialog=Dn,this.renderDependenciesAsync=je,this.renderDependencies=ui,this.renderContentAsync=oe,this.renderContent=Ls,this.renderHtmlAsync=Tt,this.renderHtml=li,this.initializedPromise=hr(),(0,H.default)(()=>{setTimeout(async()=>{try{await this.initialize()}catch(s){throw Sn(s),s}},1)})}inDevMode(){return"__SHINY_DEV_MODE__"in window?Boolean(window.__SHINY_DEV_MODE__):!1}async initialize(){ds(this),this.shinyapp=new Vn;let e=this.shinyapp;this.progressHandlers=e.progressHandlers;let t=new Dt(e),n=new Lt(t),s=new Bt(n),o=new _t(s),a=new Pt(s),r;(0,H.default)('input[type="submit"], button[type="submit"]').length>0?(r=a,(0,H.default)('input[type="submit"], button[type="submit"]').each(function(){(0,H.default)(this).click(function(m){m.preventDefault(),a.submit()})})):r=o;let l=new At(r);this.setInputValue=this.onInputChange=function(m,g,B={}){let V=Bi(B);l.setInput(m,g,V)},this.forgetLastInputValue=function(m){n.forget(m)};let u=this.inputBindings,d=this.outputBindings;function c(){return{inputs:l,inputsRate:o,sendOutputHiddenState:nt,maybeAddThemeObserver:I,inputBindings:u,outputBindings:d,initDeferredIframes:$r}}this.bindAll=async function(m){await vr(c(),m)},this.unbindAll=function(m,g=!1){br(c(),m,g)};function p(m=document.documentElement){let g=u.getBindings();for(let B=0;B<g.length;B++){let V=g[B].binding,Y=V.find(m);if(Y)for(let ae=0;ae<Y.length;ae++){let ce=(0,H.default)(Y[ae]);ce.data("_shiny_initialized")||(ce.data("_shiny_initialized",!0),V.initialize(Y[ae]))}}}this.initializeInputs=p;function f(m){let B=(0,H.default)(m).data("shiny-output-binding");return B?B.getId():null}p(document.documentElement);let v=ue(await Li(c(),document.documentElement),m=>m.value);(0,H.default)(".shiny-image-output, .shiny-plot-output, .shiny-report-size").each(function(){let m=f(this),g=Kn(this);(g.width!==0||g.height!==0)&&(v[".clientdata_output_"+m+"_width"]=g.width,v[".clientdata_output_"+m+"_height"]=g.height)});function $(m){if(!m)return null;let g=pe(m,"background-color");if(!g)return g;let B=g.match(/^rgba\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/);if(g==="transparent"||B&&parseFloat(B[4])===0){let V=pe(m,"background-image");return V&&V!=="none"?null:$(m.parentElement)}return g}function C(m){let g=pe(m,"font-family"),B=pe(m,"font-size");return{families:g?.replace(/"/g,"").split(", "),size:B}}(0,H.default)(".shiny-image-output, .shiny-plot-output, .shiny-report-theme").each(function(){let m=this,g=f(m);v[".clientdata_output_"+g+"_bg"]=$(m),v[".clientdata_output_"+g+"_fg"]=pe(m,"color"),v[".clientdata_output_"+g+"_accent"]=ft(m),v[".clientdata_output_"+g+"_font"]=C(m),I(m)});function I(m){if(!window.MutationObserver)return;let g=m.classList;if(!(g.contains("shiny-image-output")||g.contains("shiny-plot-output")||g.contains("shiny-report-theme")))return;let V=(0,H.default)(m);if(V.data("shiny-theme-observer"))return;let Y=new ee(null,()=>L(m),100),ae=new MutationObserver(()=>Y.normalCall()),ce={attributes:!0,attributeFilter:["style","class"]};ae.observe(m,ce),V.data("shiny-theme-observer",ae)}function L(m){if(m.classList.contains("shiny-output-error"))return;let g=f(m);l.setInput(".clientdata_output_"+g+"_bg",$(m)),l.setInput(".clientdata_output_"+g+"_fg",pe(m,"color")),l.setInput(".clientdata_output_"+g+"_accent",ft(m)),l.setInput(".clientdata_output_"+g+"_font",C(m))}function J(){(0,H.default)(".shiny-image-output, .shiny-plot-output, .shiny-report-size").each(function(){let m=f(this),g=Kn(this);(g.width!==0||g.height!==0)&&(l.setInput(".clientdata_output_"+m+"_width",g.width),l.setInput(".clientdata_output_"+m+"_height",g.height))}),(0,H.default)(".shiny-image-output, .shiny-plot-output, .shiny-report-theme").each(function(){L(this)}),(0,H.default)(".shiny-bound-output").each(function(){let m=(0,H.default)(this),g=m.data("shiny-output-binding");m.trigger({type:"shiny:visualchange",visible:!h(this),binding:g}),g.onResize()})}de.setImageSend(t,J);function h(m){return m===null||m.offsetWidth!==0||m.offsetHeight!==0?!1:pe(m,"display")==="none"?!0:h(m.parentNode)}let T={};(0,H.default)(".shiny-bound-output").each(function(){let m=f(this);h(this)?v[".clientdata_output_"+m+"_hidden"]=!0:(T[m]=!0,v[".clientdata_output_"+m+"_hidden"]=!1)});function _(){let m={};(0,H.default)(".shiny-bound-output").each(function(){let g=f(this);delete T[g];let B=h(this),V={type:"shiny:visualchange",visible:!B};B?l.setInput(".clientdata_output_"+g+"_hidden",!0):(m[g]=!0,l.setInput(".clientdata_output_"+g+"_hidden",!1));let Y=(0,H.default)(this);V.binding=Y.data("shiny-output-binding"),Y.trigger(V)});for(let g in T)w(T,g)&&l.setInput(".clientdata_output_"+g+"_hidden",!0);T=m}let Me=new ee(null,_,0);function nt(){Me.normalCall()}t.lastChanceCallback.push(function(){Me.isPending()&&Me.immediateCall()});function it(m,g,...B){let V=m.split(".");return function(Y){let ae=Y.namespace?.split(".")??[];for(let ce=0;ce<V.length;ce++)if(ae.indexOf(V[ce])===-1)return;g.apply(this,[V,g,...B])}}(0,H.default)(window).resize(Ce(500,de.regular));let Qn=["modal","dropdown","tab","tooltip","popover","collapse"];H.default.each(Qn,function(m,g){(0,H.default)(document.body).on("shown.bs."+g+".sendImageSize","*",it("bs",de.regular)),(0,H.default)(document.body).on("shown.bs."+g+".sendOutputHiddenState hidden.bs."+g+".sendOutputHiddenState","*",it("bs",nt))}),(0,H.default)(document.body).on("shown.sendImageSize","*",de.regular),(0,H.default)(document.body).on("shown.sendOutputHiddenState hidden.sendOutputHiddenState","*",nt),v[".clientdata_pixelratio"]=Gn(),(0,H.default)(window).resize(function(){l.setInput(".clientdata_pixelratio",Gn())}),v[".clientdata_url_protocol"]=window.location.protocol,v[".clientdata_url_hostname"]=window.location.hostname,v[".clientdata_url_port"]=window.location.port,v[".clientdata_url_pathname"]=window.location.pathname,v[".clientdata_url_search"]=window.location.search,(0,H.default)(window).on("pushstate",function(m){l.setInput(".clientdata_url_search",window.location.search)}),(0,H.default)(window).on("popstate",function(m){l.setInput(".clientdata_url_search",window.location.search)}),v[".clientdata_url_hash_initial"]=window.location.hash,v[".clientdata_url_hash"]=window.location.hash,(0,H.default)(window).on("hashchange",function(m){l.setInput(".clientdata_url_hash",window.location.hash)});let Jn=v[".clientdata_singletons"]=(0,H.default)('script[type="application/shiny-singletons"]').text();Bs(Jn.split(/,/));let Fn=(0,H.default)('script[type="application/html-dependencies"]').text();H.default.each(Fn.split(/;/),function(m,g){let B=/\s*^(.+)\[(.+)\]\s*$/.exec(g);B&&mn(B[1],B[2])}),n.reset(v),e.connect(v),(0,H.default)(document).one("shiny:connected",()=>{$r()}),(0,H.default)(document).one("shiny:sessioninitialized",()=>{this.initializedPromise.resolve()})}};function $r(){!window.Shiny||!window.Shiny.shinyapp||!window.Shiny.shinyapp.isConnected()||(0,H.default)(".shiny-frame-deferred").each(function(i,e){let t=(0,H.default)(e);t.removeClass("shiny-frame-deferred"),t.attr("src",t.attr("data-deferred-src")),t.attr("data-deferred-src",null)})}function Cr(){return window.navigator.userAgent}var Un=M(S());function Nn(){return Ne().config}function kr(){(0,Un.default)(document).on("keydown",function(i){if(i.which!==114||!i.ctrlKey&&!i.metaKey||i.shiftKey||i.altKey)return;let e="reactlog?w="+window.escape(Nn().workerId)+"&s="+window.escape(Nn().sessionId);window.open(e),i.preventDefault()}),(0,Un.default)(document).on("keydown",function(i){if(!(i.which===115&&(i.ctrlKey||i.metaKey)&&!i.shiftKey&&!i.altKey||i.which===114&&(i.ctrlKey||i.metaKey)&&i.shiftKey&&!i.altKey))return;let e="reactlog/mark?w="+window.escape(Nn().workerId)+"&s="+window.escape(Nn().sessionId);Un.default.get(e,function(t){if(t!=="marked")return;Te({html:'<span id="shiny-reactlog-mark-text">Marked time point in reactlog</span>',closeButton:!0})}).fail(function(){window.open(e)}),i.preventDefault()})}var ct;function Hr(){if(window.Shiny)throw new Error("Trying to create window.Shiny, but it already exists!");ct=window.Shiny=new zn,qi(Cr()),Xi(),Yi(),Gi(),kr()}Hr();})();
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* @license
* Copyright 2022 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
//# sourceMappingURL=shiny.min.js.map