-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathcomponents.min.js
More file actions
19 lines (19 loc) · 30 KB
/
components.min.js
File metadata and controls
19 lines (19 loc) · 30 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*! bslib 0.10.0 | (c) 2012-2026 RStudio, PBC. | License: MIT + file LICENSE */
"use strict";(()=>{var p=(s,e)=>()=>(s&&(e=s(s=0)),e);var pe=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var Q=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)};var M=(s,e,t)=>(Q(s,e,"read from private field"),t?t.call(s):e.get(s)),x=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)};var D=(s,e,t)=>(Q(s,e,"access private method"),t);var h=(s,e,t)=>new Promise((i,n)=>{var r=a=>{try{d(t.next(a))}catch(u){n(u)}},o=a=>{try{d(t.throw(a))}catch(u){n(u)}},d=a=>a.done?i(a.value):Promise.resolve(a.value).then(r,o);d((t=t.apply(s,e)).next())});function g(s,e){b&&b.inputBindings.register(new s,"bslib."+e)}function k(s,e){window.bslib=window.bslib||{},window.bslib[s]?console.error(`[bslib] Global window.bslib.${s} was already defined, using previous definition.`):window.bslib[s]=e}function N({headline:s="",message:e,status:t="warning"}){document.dispatchEvent(new CustomEvent("shiny:client-message",{detail:{headline:s,message:e,status:t}}))}function I(s,e){return Object.prototype.hasOwnProperty.call(s,e)&&s[e]!==void 0}function ee(s){let e=["a[href]","area[href]","button","details summary","input","iframe","select","textarea",'[contentEditable=""]','[contentEditable="true"]','[contentEditable="TRUE"]',"[tabindex]"],t=[':not([tabindex="-1"])',":not([disabled])"],i=e.map(r=>r+t.join("")),n=s.querySelectorAll(i.join(", "));return Array.from(n)}function v(...s){return h(this,null,function*(){if(!b)throw new Error("This function must be called in a Shiny app.");return b.renderContentAsync?yield b.renderContentAsync.apply(null,s):yield b.renderContent.apply(null,s)})}function te(s,e){return h(this,null,function*(){if(typeof s!="undefined"){if(e.length!==1)throw new Error("labelNode must be of length 1");typeof s=="string"&&(s={html:s,deps:[]}),s.html===""?e.addClass("shiny-label-null"):(yield v(e,s),e.removeClass("shiny-label-null"))}})}var b,m,E=p(()=>{"use strict";b=window.Shiny,m=b?b.InputBinding:class{}});var W,ie=p(()=>{"use strict";E();W=class extends m{find(e){return $(e).find(".accordion.bslib-accordion-input")}getValue(e){let i=this._getItemInfo(e).filter(n=>n.isOpen()).map(n=>n.value);return i.length===0?null:i}subscribe(e,t){$(e).on("shown.bs.collapse.accordionInputBinding hidden.bs.collapse.accordionInputBinding",function(i){t(!0)})}unsubscribe(e){$(e).off(".accordionInputBinding")}receiveMessage(e,t){return h(this,null,function*(){let i=t.method;if(i==="set")this._setItems(e,t);else if(i==="open")this._openItems(e,t);else if(i==="close")this._closeItems(e,t);else if(i==="remove")this._removeItem(e,t);else if(i==="insert")yield this._insertItem(e,t);else if(i==="update")yield this._updateItem(e,t);else throw new Error(`Method not yet implemented: ${i}`)})}_setItems(e,t){let i=this._getItemInfo(e),n=this._getValues(e,i,t.values);i.forEach(r=>{n.indexOf(r.value)>-1?r.show():r.hide()})}_openItems(e,t){let i=this._getItemInfo(e),n=this._getValues(e,i,t.values);i.forEach(r=>{n.indexOf(r.value)>-1&&r.show()})}_closeItems(e,t){let i=this._getItemInfo(e),n=this._getValues(e,i,t.values);i.forEach(r=>{n.indexOf(r.value)>-1&&r.hide()})}_insertItem(e,t){return h(this,null,function*(){let i=this._findItem(e,t.target);i||(i=t.position==="before"?e.firstElementChild:e.lastElementChild);let n=t.panel;if(i?yield v(i,n,t.position==="before"?"beforeBegin":"afterEnd"):yield v(e,n),this._isAutoClosing(e)){let r=$(n.html).attr("data-value");$(e).find(`[data-value="${r}"] .accordion-collapse`).attr("data-bs-parent","#"+e.id)}})}_removeItem(e,t){var r;let i=this._getItemInfo(e).filter(o=>t.target.indexOf(o.value)>-1),n=(r=window.Shiny)==null?void 0:r.unbindAll;i.forEach(o=>{n&&n(o.item),o.item.remove()})}_updateItem(e,t){return h(this,null,function*(){let i=this._findItem(e,t.target);if(!i)throw new Error(`Unable to find an accordion_panel() with a value of ${t.target}`);if(I(t,"value")&&(i.dataset.value=t.value),I(t,"body")){let r=i.querySelector(".accordion-body");yield v(r,t.body)}let n=i.querySelector(".accordion-header");if(I(t,"title")){let r=n.querySelector(".accordion-title");yield v(r,t.title)}if(I(t,"icon")){let r=n.querySelector(".accordion-button > .accordion-icon");yield v(r,t.icon)}})}_getItemInfo(e){return Array.from(e.querySelectorAll(":scope > .accordion-item")).map(i=>this._getSingleItemInfo(i))}_getSingleItemInfo(e){let t=e.querySelector(".accordion-collapse"),i=()=>$(t).hasClass("show");return{item:e,value:e.dataset.value,isOpen:i,show:()=>{i()||$(t).collapse("show")},hide:()=>{i()&&$(t).collapse("hide")}}}_getValues(e,t,i){let n=i!==!0?i:t.map(o=>o.value);return this._isAutoClosing(e)&&(n=n.slice(n.length-1,n.length)),n}_findItem(e,t){return e.querySelector(`[data-value="${t}"]`)}_isAutoClosing(e){return e.classList.contains("autoclose")}};g(W,"accordion")});var H,U=p(()=>{"use strict";H=class{constructor(){this.resizeObserverEntries=[],this.resizeObserver=new ResizeObserver(e=>{let t=new Event("resize");if(window.dispatchEvent(t),!window.Shiny)return;let i=[];for(let n of e)n.target instanceof HTMLElement&&n.target.querySelector(".shiny-bound-output")&&n.target.querySelectorAll(".shiny-bound-output").forEach(r=>{if(i.includes(r))return;let{binding:o,onResize:d}=$(r).data("shinyOutputBinding");if(!o||!o.resize)return;let a=r.shinyResizeObserver;if(a&&a!==this||(a||(r.shinyResizeObserver=this),d(r),i.push(r),!r.classList.contains("shiny-plot-output")))return;let u=r.querySelector('img:not([width="100%"])');u&&u.setAttribute("width","100%")})})}observe(e){this.resizeObserver.observe(e),this.resizeObserverEntries.push(e)}unobserve(e){let t=this.resizeObserverEntries.indexOf(e);t<0||(this.resizeObserver.unobserve(e),this.resizeObserverEntries.splice(t,1))}flush(){this.resizeObserverEntries.forEach(e=>{document.body.contains(e)||this.unobserve(e)})}}});var F,se=p(()=>{"use strict";F=class{constructor(e,t){this.watching=new Set,this.observer=new MutationObserver(i=>{let n=new Set;for(let{type:r,removedNodes:o}of i)if(r==="childList"&&o.length!==0)for(let d of o)d instanceof HTMLElement&&(d.matches(e)&&n.add(d),d.querySelector(e)&&d.querySelectorAll(e).forEach(a=>n.add(a)));if(n.size!==0)for(let r of n)try{t(r)}catch(o){console.error(o)}})}observe(e){let t=this._flush();if(this.watching.has(e)){if(!t)return}else this.watching.add(e);t?this._restartObserver():this.observer.observe(e,{childList:!0,subtree:!0})}unobserve(e){this.watching.has(e)&&(this.watching.delete(e),this._flush(),this._restartObserver())}_restartObserver(){this.observer.disconnect();for(let e of this.watching)this.observer.observe(e,{childList:!0,subtree:!0})}_flush(){let e=!1,t=Array.from(this.watching);for(let i of t)document.body.contains(i)||(this.watching.delete(i),e=!0);return e}}});var l,y,ne=p(()=>{"use strict";E();U();se();l=class{constructor(e){var t;e.removeAttribute(l.attr.ATTR_INIT),(t=e.querySelector(`script[${l.attr.ATTR_INIT}]`))==null||t.remove(),this.card=e,l.instanceMap.set(e,this),l.shinyResizeObserver.observe(this.card),l.cardRemovedObserver.observe(document.body),this._addEventListeners(),this.overlay=this._createOverlay(),this._setShinyInput(),this._exitFullScreenOnEscape=this._exitFullScreenOnEscape.bind(this),this._trapFocusExit=this._trapFocusExit.bind(this)}enterFullScreen(e){var t;e&&e.preventDefault(),this.card.id&&this.overlay.anchor.setAttribute("aria-controls",this.card.id),document.addEventListener("keydown",this._exitFullScreenOnEscape,!1),document.addEventListener("keydown",this._trapFocusExit,!0),this.card.setAttribute(l.attr.ATTR_FULL_SCREEN,"true"),document.body.classList.add(l.attr.CLASS_HAS_FULL_SCREEN),this.card.insertAdjacentElement("beforebegin",this.overlay.container),(!this.card.contains(document.activeElement)||(t=document.activeElement)!=null&&t.classList.contains(l.attr.CLASS_FULL_SCREEN_ENTER))&&(this.card.setAttribute("tabindex","-1"),this.card.focus()),this._emitFullScreenEvent(!0),this._setShinyInput()}exitFullScreen(){document.removeEventListener("keydown",this._exitFullScreenOnEscape,!1),document.removeEventListener("keydown",this._trapFocusExit,!0),this.overlay.container.remove(),this.card.setAttribute(l.attr.ATTR_FULL_SCREEN,"false"),this.card.removeAttribute("tabindex"),document.body.classList.remove(l.attr.CLASS_HAS_FULL_SCREEN),this._emitFullScreenEvent(!1),this._setShinyInput()}_setShinyInput(){if(!this.card.classList.contains(l.attr.CLASS_SHINY_INPUT)||!b)return;if(!b.setInputValue){setTimeout(()=>this._setShinyInput(),0);return}let e=this.card.getAttribute(l.attr.ATTR_FULL_SCREEN);b.setInputValue(this.card.id+"_full_screen",e==="true")}_emitFullScreenEvent(e){let t=new CustomEvent("bslib.card",{bubbles:!0,detail:{fullScreen:e}});this.card.dispatchEvent(t)}_addEventListeners(){let e=this.card.querySelector(`:scope > * > .${l.attr.CLASS_FULL_SCREEN_ENTER}`);e&&e.addEventListener("click",t=>this.enterFullScreen(t))}_exitFullScreenOnEscape(e){if(!(e.target instanceof HTMLElement))return;let t=["select[open]","input[aria-expanded='true']"];e.target.matches(t.join(", "))||e.key==="Escape"&&this.exitFullScreen()}_trapFocusExit(e){if(!(e instanceof KeyboardEvent)||e.key!=="Tab")return;let t=e.target===this.card,i=e.target===this.overlay.anchor,n=this.card.contains(e.target),r=()=>{e.preventDefault(),e.stopImmediatePropagation()};if(!(n||t||i)){r(),this.card.focus();return}let o=ee(this.card).filter(w=>!w.classList.contains(l.attr.CLASS_FULL_SCREEN_ENTER));if(!(o.length>0)){r(),this.overlay.anchor.focus();return}if(t)return;let a=o[o.length-1],u=e.target===a;if(i&&e.shiftKey){r(),a.focus();return}if(u&&!e.shiftKey){r(),this.overlay.anchor.focus();return}}_createOverlay(){let e=document.createElement("div");e.id=l.attr.ID_FULL_SCREEN_OVERLAY,e.onclick=this.exitFullScreen.bind(this);let t=this._createOverlayCloseAnchor();return e.appendChild(t),{container:e,anchor:t}}_createOverlayCloseAnchor(){let e=document.createElement("a");return e.classList.add(l.attr.CLASS_FULL_SCREEN_EXIT),e.tabIndex=0,e.setAttribute("aria-expanded","true"),e.setAttribute("aria-label","Close card"),e.setAttribute("role","button"),e.onclick=t=>{this.exitFullScreen(),t.stopPropagation()},e.onkeydown=t=>{(t.key==="Enter"||t.key===" ")&&this.exitFullScreen()},e.innerHTML=this._overlayCloseHtml(),e}_overlayCloseHtml(){return"Close <svg width='20' height='20' fill='currentColor' class='bi bi-x-lg' viewBox='0 0 16 16'><path d='M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854Z'/></svg>"}static getInstance(e){return l.instanceMap.get(e)}static initializeAllCards(e=!0){if(document.readyState==="loading"){l.onReadyScheduled||(l.onReadyScheduled=!0,document.addEventListener("DOMContentLoaded",()=>{l.initializeAllCards(!1)}));return}e&&l.shinyResizeObserver.flush();let t=`.${l.attr.CLASS_CARD}[${l.attr.ATTR_INIT}]`;if(!document.querySelector(t))return;document.querySelectorAll(t).forEach(n=>new l(n))}},y=l;y.attr={ATTR_INIT:"data-bslib-card-init",CLASS_CARD:"bslib-card",ATTR_FULL_SCREEN:"data-full-screen",CLASS_HAS_FULL_SCREEN:"bslib-has-full-screen",CLASS_FULL_SCREEN_ENTER:"bslib-full-screen-enter",CLASS_FULL_SCREEN_EXIT:"bslib-full-screen-exit",ID_FULL_SCREEN_OVERLAY:"bslib-full-screen-overlay",CLASS_SHINY_INPUT:"bslib-card-input"},y.shinyResizeObserver=new H,y.cardRemovedObserver=new F(`.${l.attr.CLASS_CARD}`,e=>{let t=l.getInstance(e);t&&t.card.getAttribute(l.attr.ATTR_FULL_SCREEN)==="true"&&t.exitFullScreen()}),y.instanceMap=new WeakMap,y.onReadyScheduled=!1;k("Card",y)});function re(s,e){let t=s();return()=>{let i=s();i!==t&&e(),t=i}}var c,f,q,oe=p(()=>{"use strict";E();U();c=class{constructor(e){this.resizeState={isResizing:!1,startX:0,startWidth:0,minWidth:150,maxWidth:()=>window.innerWidth-50,constrainedWidth:e=>Math.max(this.resizeState.minWidth,Math.min(this.resizeState.maxWidth(),e))};this.windowSize="";var n;c.instanceMap.set(e,this),this.layout={container:e,main:e.querySelector(":scope > .main"),sidebar:e.querySelector(":scope > .sidebar"),toggle:e.querySelector(":scope > .collapse-toggle")};let t=this.layout.sidebar.querySelector(":scope > .sidebar-content > .accordion");t&&((n=t==null?void 0:t.parentElement)==null||n.classList.add("has-accordion"),t.classList.add("accordion-flush")),this._initSidebarCounters(),this._initSidebarState(),(this._isCollapsible("desktop")||this._isCollapsible("mobile"))&&this._initEventListeners(),this._initResizeHandle(),c.shinyResizeObserver.observe(this.layout.main),e.removeAttribute("data-bslib-sidebar-init");let i=e.querySelector(":scope > script[data-bslib-sidebar-init]");i&&e.removeChild(i)}get isClosed(){return this.layout.container.classList.contains(c.classes.COLLAPSE)}static getInstance(e){return c.instanceMap.get(e)}_isCollapsible(e="desktop"){let{container:t}=this.layout,i=e==="desktop"?"collapsibleDesktop":"collapsibleMobile",n=t.dataset[i];return n===void 0?!0:n.trim().toLowerCase()!=="false"}static initCollapsibleAll(e=!0){if(document.readyState==="loading"){c.onReadyScheduled||(c.onReadyScheduled=!0,document.addEventListener("DOMContentLoaded",()=>{c.initCollapsibleAll(!1)}));return}let t=`.${c.classes.LAYOUT}[data-bslib-sidebar-init]`;if(!document.querySelector(t))return;e&&c.shinyResizeObserver.flush(),document.querySelectorAll(t).forEach(n=>new c(n))}_initResizeHandle(){if(!this.layout.resizeHandle){let e=this._createResizeHandle();this.layout.container.appendChild(e),this.layout.resizeHandle=e,this._attachResizeEventListeners(e)}this._updateResizeAvailability()}_createResizeHandle(){let e=document.createElement("div");e.className=c.classes.RESIZE_HANDLE,e.setAttribute("role","separator"),e.setAttribute("aria-orientation","vertical"),e.setAttribute("aria-label","Resize sidebar"),e.setAttribute("tabindex","0"),e.setAttribute("aria-keyshortcuts","ArrowLeft ArrowRight Home End"),e.title="Drag to resize sidebar";let t=document.createElement("div");t.className="resize-indicator",e.appendChild(t);let i=document.createElement("div");return i.className="visually-hidden",i.textContent="Use arrow keys to resize the sidebar, Shift for larger steps, Home/End for min/max width.",e.appendChild(i),e}_attachResizeEventListeners(e){e.addEventListener("mousedown",this._onResizeStart.bind(this)),document.addEventListener("mousemove",this._onResizeMove.bind(this)),document.addEventListener("mouseup",this._onResizeEnd.bind(this)),e.addEventListener("touchstart",this._onResizeStart.bind(this),{passive:!1}),document.addEventListener("touchmove",this._onResizeMove.bind(this),{passive:!1}),document.addEventListener("touchend",this._onResizeEnd.bind(this)),e.addEventListener("keydown",this._onResizeKeyDown.bind(this)),window.addEventListener("resize",re(()=>this._getWindowSize(),()=>this._updateResizeAvailability()))}_shouldEnableResize(){let e=this._getWindowSize()==="desktop",t=!this.layout.container.classList.contains(c.classes.TRANSITIONING),i=!this.isClosed;return e&&t&&i}_onResizeStart(e){if(!this._shouldEnableResize())return;e.preventDefault();let t="touches"in e?e.touches[0].clientX:e.clientX;this.resizeState.isResizing=!0,this.resizeState.startX=t,this.resizeState.startWidth=this._getCurrentSidebarWidth(),this.layout.container.style.setProperty("--_transition-duration","0ms"),this.layout.container.classList.add(c.classes.RESIZING),document.documentElement.setAttribute(`data-bslib-${c.classes.RESIZING}`,"true"),this._dispatchResizeEvent("start",this.resizeState.startWidth)}_onResizeMove(e){if(!this.resizeState.isResizing)return;e.preventDefault();let i=("touches"in e?e.touches[0].clientX:e.clientX)-this.resizeState.startX,r=this._isRightSidebar()?this.resizeState.startWidth-i:this.resizeState.startWidth+i,o=this.resizeState.constrainedWidth(r);this._updateSidebarWidth(o),this._dispatchResizeEvent("move",o)}_onResizeEnd(){this.resizeState.isResizing&&(this.resizeState.isResizing=!1,this.layout.container.style.removeProperty("--_transition-duration"),this.layout.container.classList.remove(c.classes.RESIZING),document.documentElement.removeAttribute(`data-bslib-${c.classes.RESIZING}`),c.shinyResizeObserver.flush(),this._dispatchResizeEvent("end",this._getCurrentSidebarWidth()))}_onResizeKeyDown(e){if(!this._shouldEnableResize())return;let t=e.shiftKey?50:10,i=this._getCurrentSidebarWidth();switch(e.key){case"ArrowLeft":i=this._isRightSidebar()?i+t:i-t;break;case"ArrowRight":i=this._isRightSidebar()?i-t:i+t;break;case"Home":i=this.resizeState.minWidth;break;case"End":i=this.resizeState.maxWidth();break;default:return}e.preventDefault(),i=this.resizeState.constrainedWidth(i),this._updateSidebarWidth(i),c.shinyResizeObserver.flush(),this._dispatchResizeEvent("keyboard",i)}_getCurrentSidebarWidth(){return this.layout.sidebar.getBoundingClientRect().width||250}_updateSidebarWidth(e){let{container:t,resizeHandle:i}=this.layout;t.style.setProperty("--_sidebar-width",`${e}px`),i&&(i.setAttribute("aria-valuenow",e.toString()),i.setAttribute("aria-valuemin",this.resizeState.minWidth.toString()),i.setAttribute("aria-valuemax",this.resizeState.maxWidth().toString()))}_isRightSidebar(){return this.layout.container.classList.contains("sidebar-right")}_updateResizeAvailability(){if(!this.layout.resizeHandle)return;let e=this._shouldEnableResize();this.layout.resizeHandle.style.display=e?"":"none",this.layout.resizeHandle.setAttribute("aria-hidden",e?"false":"true"),e?this.layout.resizeHandle.setAttribute("tabindex","0"):this.layout.resizeHandle.removeAttribute("tabindex")}_dispatchResizeEvent(e,t){let i=new CustomEvent("bslib.sidebar.resize",{bubbles:!0,detail:{phase:e,width:t,sidebar:this}});this.layout.sidebar.dispatchEvent(i)}_initEventListeners(){var t;let{toggle:e}=this.layout;e.addEventListener("click",i=>{i.preventDefault(),this.toggle("toggle")}),(t=e.querySelector(".collapse-icon"))==null||t.addEventListener("transitionend",()=>{this._finalizeState()}),!(this._isCollapsible("desktop")&&this._isCollapsible("mobile"))&&window.addEventListener("resize",re(()=>this._getWindowSize(),()=>this._initSidebarState()))}_initSidebarCounters(){let{container:e}=this.layout,t=`.${c.classes.LAYOUT}> .main > .${c.classes.LAYOUT}:not([data-bslib-sidebar-open="always"])`;if(!(e.querySelector(t)===null))return;function n(a){return a=a?a.parentElement:null,a&&a.classList.contains("main")&&(a=a.parentElement),a&&a.classList.contains(c.classes.LAYOUT)?a:null}let r=[e],o=n(e);for(;o;)r.unshift(o),o=n(o);let d={left:0,right:0};r.forEach(function(a){let w=a.classList.contains("sidebar-right")?d.right++:d.left++;a.style.setProperty("--_js-toggle-count-this-side",w.toString()),a.style.setProperty("--_js-toggle-count-max-side",Math.max(d.right,d.left).toString())})}_getWindowSize(){let{container:e}=this.layout;return window.getComputedStyle(e).getPropertyValue("--bslib-sidebar-js-window-size").trim()}_initialToggleState(){var n,r;let{container:e}=this.layout,t=this.windowSize==="desktop"?"openDesktop":"openMobile",i=(r=(n=e.dataset[t])==null?void 0:n.trim())==null?void 0:r.toLowerCase();return i===void 0||["open","always"].includes(i)?"open":["close","closed"].includes(i)?"close":"open"}_initSidebarState(){this.windowSize=this._getWindowSize();let e=this._initialToggleState();this.toggle(e,!0)}toggle(e,t=!1){typeof e=="undefined"?e="toggle":e==="closed"&&(e="close");let{container:i,sidebar:n}=this.layout,r=this.isClosed;if(["open","close","toggle"].indexOf(e)===-1)throw new Error(`Unknown method ${e}`);if(e==="toggle"&&(e=r?"open":"close"),r&&e==="close"||!r&&e==="open"){t&&this._finalizeState();return}e==="open"&&(n.hidden=!1),i.classList.toggle(c.classes.TRANSITIONING,!t),i.classList.toggle(c.classes.COLLAPSE),t&&this._finalizeState()}_finalizeState(){let{container:e,sidebar:t,toggle:i}=this.layout;e.classList.remove(c.classes.TRANSITIONING),t.hidden=this.isClosed,i.setAttribute("aria-expanded",this.isClosed?"false":"true"),this._updateResizeAvailability();let n=new CustomEvent("bslib.sidebar",{bubbles:!0,detail:{open:!this.isClosed}});t.dispatchEvent(n),$(t).trigger("toggleCollapse.sidebarInputBinding"),$(t).trigger(this.isClosed?"hidden":"shown")}},f=c;f.shinyResizeObserver=new H,f.classes={LAYOUT:"bslib-sidebar-layout",COLLAPSE:"sidebar-collapsed",TRANSITIONING:"transitioning",RESIZE_HANDLE:"bslib-sidebar-resize-handle",RESIZING:"sidebar-resizing"},f.onReadyScheduled=!1,f.instanceMap=new WeakMap;q=class extends m{find(e){return $(e).find(`.${f.classes.LAYOUT} > .bslib-sidebar-input`)}getValue(e){let t=f.getInstance(e.parentElement);return t?!t.isClosed:!1}setValue(e,t){let i=t?"open":"close";this.receiveMessage(e,{method:i})}subscribe(e,t){$(e).on("toggleCollapse.sidebarInputBinding",function(i){t(!0)})}unsubscribe(e){$(e).off(".sidebarInputBinding")}receiveMessage(e,t){let i=f.getInstance(e.parentElement);i&&i.toggle(t.method)}};g(q,"sidebar");k("Sidebar",f)});var _,C,R,K,V,ae=p(()=>{"use strict";E();V=class extends m{constructor(){super(...arguments);x(this,R);x(this,_,new WeakMap);x(this,C,new WeakMap)}find(t){return $(t).find(".bslib-task-button")}getValue(t){var i;return{value:(i=M(this,_).get(t))!=null?i:0,autoReset:t.hasAttribute("data-auto-reset")}}getType(){return"bslib.taskbutton"}subscribe(t,i){M(this,C).has(t)&&this.unsubscribe(t);let n=()=>{var r;M(this,_).set(t,((r=M(this,_).get(t))!=null?r:0)+1),i(!0),D(this,R,K).call(this,t,"busy")};M(this,C).set(t,n),t.addEventListener("click",n)}unsubscribe(t){let i=M(this,C).get(t);i&&t.removeEventListener("click",i)}receiveMessage(n,r){return h(this,arguments,function*(t,{state:i}){D(this,R,K).call(this,t,i)})}};_=new WeakMap,C=new WeakMap,R=new WeakSet,K=function(t,i){t.disabled=i==="busy";let n=t.querySelector("bslib-switch-inline");n&&(n.case=i)};g(V,"task-button")});function de(s){let e=P(s),t=!s.value;e.classList.toggle("disabled",t),e.setAttribute("aria-disabled",t.toString()),t?e.setAttribute("tabindex","-1"):e.removeAttribute("tabindex")}function G(s){s.scrollHeight!==0&&(s.style.height="auto",s.style.height=s.scrollHeight+"px")}function me(s){if(!s.hasAttribute("data-needs-modifier"))return;let e=P(s);if(!e.querySelector(`.${L.submitKey}`))return;let t=navigator.userAgent.indexOf("Mac")!==-1;e.querySelectorAll(`.${L.submitKey}`).forEach(r=>{let o=t?"\u2318":"Ctrl";r.textContent=`${o} \u23CE`});let i=t?"Command":"Ctrl";e.title=e.title.replace("Press Enter",`Press ${i}+Enter`);let n=e.getAttribute("aria-label");n&&e.setAttribute("aria-label",n.replace("Press Enter",`Press ${i}+Enter`))}function P(s){var t;let e=(t=s.parentElement)==null?void 0:t.querySelector(`.${L.button}`);if(e instanceof HTMLButtonElement)return e;throw new Error("Expected input_submit_textarea()'s container to have a button with class of 'bslib-submit-textarea-btn'")}function fe(s){let e=s.selectionStart,t=s.selectionEnd;s.value=s.value.substring(0,e)+`
`+s.value.substring(t),s.selectionStart=s.selectionEnd=e+1,s.dispatchEvent(new Event("input",{bubbles:!0}))}var S,L,le,X,ce=p(()=>{"use strict";E();S="textSubmitInputBinding",L={input:"bslib-input-submit-textarea",container:"bslib-submit-textarea-container",button:"bslib-submit-textarea-btn",submitKey:"bslib-submit-key"},le=new IntersectionObserver(s=>{s.forEach(e=>{e.isIntersecting&&G(e.target)})}),X=class extends m{find(e){return $(e).find(`.${L.input} textarea`)}initialize(e){de(e),G(e),me(e)}getValue(e){return $(e).data("val")}setValue(e,t){e.value=t}subscribe(e,t){function i(){$(e).data("val",e.value),e.value="",e.dispatchEvent(new Event("input",{bubbles:!0})),t("event")}let n=P(e);n.classList.contains("shiny-bound-input")?$(n).on(`shiny:inputchanged.${S}`,i):$(n).on(`click.${S}`,i),$(e).on(`input.${S}`,function(){de(e),G(e)}),$(e).on(`keydown.${S}`,function(o){if(o.key!=="Enter")return;if(!e.value){o.preventDefault();return}if(o.shiftKey)return;if(o.altKey){o.preventDefault(),fe(e);return}let d=e.hasAttribute("data-needs-modifier");if(!d){o.preventDefault(),n.click();return}let a=o.ctrlKey||o.metaKey;if(d&&a){o.preventDefault(),n.click();return}});let r=e.closest(`.${L.container}`);$(r).on(`click.${S}`,o=>{o.target.classList.contains(L.container)&&e.focus()}),le.observe(e)}unsubscribe(e){$(e).off(`.${S}`);let t=e.nextElementSibling;$(t).off(`.${S}`);let i=e.closest(`.${L.container}`);$(i).off(`.${S}`),le.unobserve(e)}receiveMessage(e,t){return h(this,null,function*(){let i=e.value;if(t.value!==void 0&&(e.value=t.value,e.dispatchEvent(new Event("input",{bubbles:!0}))),t.placeholder!==void 0&&(e.placeholder=t.placeholder),t.label!==void 0){let n=$(e).closest(`.${L.input}`).find("label");yield te(t.label,n)}t.submit&&(P(e).click(),e.value=i),t.focus&&e.focus()})}};g(X,"submit-text-area")});function B(s){if(window.Shiny)for(let[e,t]of Object.entries(s))window.Shiny.addCustomMessageHandler(e,t)}var j=p(()=>{"use strict"});function Ee(s){return h(this,null,function*(){var O,Z;let{html:e,deps:t,autohide:i,duration:n,position:r,id:o}=s;if(!window.bootstrap||!window.bootstrap.Toast){N({headline:"Bootstrap 5 Required",message:"Toast notifications require Bootstrap 5.",status:"error"});return}let d=document.getElementById(o);if(d){let T=z.get(d);T&&(T.hide(),z.delete(d)),(Z=(O=window==null?void 0:window.Shiny)==null?void 0:O.unbindAll)==null||Z.call(O,d),d.remove()}let a=ge.getOrCreateToaster(r);yield v(a,{html:e,deps:t},"beforeEnd");let u=document.getElementById(o);if(!u){N({headline:"Toast Creation Failed",message:`Failed to create toast with id "${o}".`,status:"error"});return}let w=new Y(u,{autohide:i,duration:n});z.set(u,w),w.show(),u.addEventListener("hidden.bs.toast",()=>{var T,J;(J=(T=window==null?void 0:window.Shiny)==null?void 0:T.unbindAll)==null||J.call(T,u),u.remove(),z.delete(u),a.children.length===0&&a.remove()})})}function ye(s){let{id:e}=s,t=document.getElementById(e);if(!t){N({headline:"Toast Not Found",message:`No toast with id "${e}" was found.`,status:"warning"});return}let i=z.get(t);i&&i.hide()}var ve,A,ge,Y,z,ue=p(()=>{"use strict";j();E();ve=window.bootstrap?window.bootstrap.Toast:class{},A=class{constructor(){this.containers=new Map}getOrCreateToaster(e){let t=this.containers.get(e);return(!t||!document.body.contains(t))&&(t=A._createToaster(e),document.body.appendChild(t),this.containers.set(e,t)),t}static _createToaster(e){let t=document.createElement("div");return t.className="toast-container position-fixed p-1 p-md-2",t.setAttribute("data-bslib-toast-container",e),t.classList.add(...A._positionClasses(e)),t}static _positionClasses(e){return{"top-left":["top-0","start-0"],"top-center":["top-0","start-50","translate-middle-x"],"top-right":["top-0","end-0"],"middle-left":["top-50","start-0","translate-middle-y"],"middle-center":["top-50","start-50","translate-middle"],"middle-right":["top-50","end-0","translate-middle-y"],"bottom-left":["bottom-0","start-0"],"bottom-center":["bottom-0","start-50","translate-middle-x"],"bottom-right":["bottom-0","end-0"]}[e]}},ge=new A,Y=class{constructor(e,t){this.progressBar=null;this.timeStart=0;this.timeRemaining=0;this.hideTimeoutId=null;this.isPaused=!1;this.isPointerOver=!1;this.hasFocus=!1;this.element=e,this.timeRemaining=t.duration||5e3;let i={animation:!0,autohide:!1};this.bsToast=new ve(e,i),t.autohide&&(this._addProgressBar(),this._setupInteractionPause())}show(){this.bsToast.show()}hide(){this.hideTimeoutId!==null&&(clearTimeout(this.hideTimeoutId),this.hideTimeoutId=null),this.bsToast.hide()}_addProgressBar(){this.progressBar=document.createElement("div"),this.progressBar.className="bslib-toast-progress-bar",this.progressBar.style.cssText=`
animation: bslib-toast-progress ${this.timeRemaining}ms linear forwards;
animation-play-state: running;
`;let e=this.element.querySelector(".toast-header");e?e.insertBefore(this.progressBar,e.firstChild):this.element.insertBefore(this.progressBar,this.element.firstChild)}_setupInteractionPause(){this.timeStart=Date.now(),this._startHideTimeout(this.timeRemaining),this.element.addEventListener("pointerenter",()=>this._handlePointerEnter()),this.element.addEventListener("pointerleave",()=>this._handlePointerLeave()),this.element.addEventListener("focusin",()=>this._handleFocusIn()),this.element.addEventListener("focusout",()=>this._handleFocusOut())}_handlePointerEnter(){this.isPointerOver=!0,this._pause()}_handlePointerLeave(){this.isPointerOver=!1,this.hasFocus||this._resume()}_handleFocusIn(){this.hasFocus=!0,this._pause()}_handleFocusOut(){this.hasFocus=!1,this.isPointerOver||this._resume()}_pause(){if(this.isPaused)return;this.isPaused=!0;let e=Date.now()-this.timeStart;this.timeRemaining=Math.max(100,this.timeRemaining-e),this.hideTimeoutId!==null&&clearTimeout(this.hideTimeoutId),this.progressBar&&(this.progressBar.style.animationPlayState="paused")}_resume(){this.isPaused&&(this.isPaused=!1,this.timeStart=Date.now(),this._startHideTimeout(this.timeRemaining),this.progressBar&&(this.progressBar.style.animationPlayState="running"))}_startHideTimeout(e){this.hideTimeoutId!==null&&clearTimeout(this.hideTimeoutId),this.hideTimeoutId=window.setTimeout(()=>{this.bsToast.hide()},e)}},z=new WeakMap;B({"bslib.show-toast":Ee,"bslib.hide-toast":ye})});var Le=pe(be=>{ie();ne();oe();ae();ce();ue();E();j();var Se={"bslib.toggle-input-binary":s=>h(be,null,function*(){let e=document.getElementById(s.id);e||console.warn("[bslib.toggle-input-binary] No element found",s);let t=$(e).data("shiny-input-binding");if(!(t instanceof m)){console.warn("[bslib.toggle-input-binary] No input binding found",s);return}let i=s.value;typeof i=="undefined"&&(i=!t.getValue(e)),yield t.receiveMessage(e,{value:i})})};window.Shiny&&B(Se);function he(){let s=document.createElement("div");s.innerHTML=`
<svg aria-hidden="true" focusable="false" style="width:0;height:0;position:absolute;">
<!-- ref: https://fvsch.com/svg-gradient-fill -->
<linearGradient id='bslib---icon-gradient' x1='0' y1='0' x2='1.6' y2='2.4'>
<stop offset='0%' stop-color='var(--bslib-icon-gradient-0, #007bc2)' />
<stop offset='14.29%' stop-color='var(--bslib-icon-gradient-1, #0770c9)' />
<stop offset='28.57%' stop-color='var(--bslib-icon-gradient-2, #0d63da)' />
<stop offset='42.86%' stop-color='var(--bslib-icon-gradient-3, #2b4af9)' />
<stop offset='57.14%' stop-color='var(--bslib-icon-gradient-4, #5e29f7)' />
<stop offset='71.43%' stop-color='var(--bslib-icon-gradient-5, #7217d7)' />
<stop offset='100%' stop-color='var(--bslib-icon-gradient-6, #74149c)' />
</linearGradient>
</svg>`,document.body.appendChild(s.children[0])}document.readyState==="complete"?he():document.addEventListener("DOMContentLoaded",he)});Le();})();
//# sourceMappingURL=components.min.js.map