diff --git a/NAMESPACE b/NAMESPACE
index c1df12c6..aefd7010 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -29,9 +29,9 @@ S3method(server_output,block)
S3method(server_output,ggiraph_block)
S3method(server_output,plot_block)
S3method(uiCode,block)
-S3method(uiOutput,block)
-S3method(uiOutput,ggiraph_block)
-S3method(uiOutput,plot_block)
+S3method(uiOutputBlock,block)
+S3method(uiOutputBlock,ggiraph_block)
+S3method(uiOutputBlock,plot_block)
S3method(ui_input,hidden_field)
S3method(ui_input,list_field)
S3method(ui_input,numeric_field)
@@ -127,7 +127,7 @@ export(string_field)
export(summarize_block)
export(switch_field)
export(uiCode)
-export(uiOutput)
+export(uiOutputBlock)
export(ui_input)
export(ui_update)
export(update_field)
diff --git a/R/field.R b/R/field.R
index 372007e9..7a271ab2 100644
--- a/R/field.R
+++ b/R/field.R
@@ -355,7 +355,7 @@ validate_field.list_field <- function(x) {
sub <- value(x, "sub_fields")
if (!is.list(val) || length(val) != length(sub) ||
- !setequal(names(val), names(sub))) {
+ !setequal(names(val), names(sub))) {
value(x) <- lst_xtr(sub, "value")
}
diff --git a/R/server.R b/R/server.R
index e3f63a54..3c81a58e 100644
--- a/R/server.R
+++ b/R/server.R
@@ -53,6 +53,14 @@ generate_server.data_block <- function(x, id, ...) {
output$res <- server_output(x, out_dat, output)
output$code <- server_code(x, blk, output)
+ output$nrow <- renderText({
+ prettyNum(nrow(out_dat()), big.mark = ",")
+ })
+
+ output$ncol <- renderText({
+ prettyNum(ncol(out_dat()), big.mark = ",")
+ })
+
# Cleanup module inputs (UI and server side)
# and observer
observeEvent(input$remove,
@@ -117,6 +125,14 @@ generate_server.transform_block <- function(x, in_dat, id, ...) {
output$res <- server_output(x, out_dat, output)
output$code <- server_code(x, blk, output)
+ output$nrow <- renderText({
+ prettyNum(nrow(out_dat()), big.mark = ",")
+ })
+
+ output$ncol <- renderText({
+ prettyNum(ncol(out_dat()), big.mark = ",")
+ })
+
# Cleanup module inputs (UI and server side)
# and observer
observeEvent(input$remove, {
@@ -167,6 +183,14 @@ generate_server.plot_block <- function(x, in_dat, id, ...) {
output$plot <- server_output(x, out_dat, output)
output$code <- server_code(x, blk, output)
+ output$nrow <- renderText({
+ prettyNum(nrow(out_dat()), big.mark = ",")
+ })
+
+ output$ncol <- renderText({
+ prettyNum(ncol(out_dat()), big.mark = ",")
+ })
+
# Cleanup module inputs (UI and server side)
# and observer
observeEvent(input$remove, {
diff --git a/R/ui.R b/R/ui.R
index 25042615..224cf43d 100644
--- a/R/ui.R
+++ b/R/ui.R
@@ -29,7 +29,7 @@ generate_ui.block <- function(x, id, ..., .hidden = TRUE) {
code_id <- ns("codeCollapse")
output_id <- ns("outputCollapse")
- header <- block_title(x, code_id, output_id, ns)
+ header <- block_title(x, code_id, output_id, ns, .hidden)
block_class <- "block"
if (.hidden) {
@@ -51,9 +51,9 @@ generate_ui.block <- function(x, id, ..., .hidden = TRUE) {
class = "card shadow-sm p-2 mb-2 border",
shiny::div(
class = "card-body p-1",
+ header,
div(
class = sprintf("block-inputs %s", inputs_hidden),
- header,
layout(fields)
),
div(
@@ -62,9 +62,9 @@ generate_ui.block <- function(x, id, ..., .hidden = TRUE) {
uiCode(x, ns)
),
div(
- class = "collapse block-output",
+ class = sprintf("%s block-output", inputs_hidden),
id = output_id,
- uiOutput(x, ns)
+ uiOutputBlock(x, ns)
)
)
)
@@ -136,21 +136,38 @@ generate_ui.stack <- function(x, id = NULL, ...) {
}
#' @importFrom shiny tags div
-block_title <- function(block, code_id, output_id, ns) {
+block_title <- function(block, code_id, output_id, ns, .hidden) {
+ hidden_class <- ""
+ if (.hidden) {
+ hidden_class <- "d-none"
+ }
+
title <- class(block)[1] |>
(\(.) gsub("_.*$", "", .))() |>
tools::toTitleCase()
div(
- class = "card-title",
+ class = sprintf("m-0 card-title block-title %s", hidden_class),
div(
class = "d-flex",
- if (not_null(title)) {
- div(
- class = "flex-grow-1",
- shiny::p(title, class = "fw-bold")
+ div(
+ class = "flex-grow-1",
+ shiny::p(
+ title,
+ class = "fw-bold"
)
- },
+ ),
+ div(
+ class = "flex-grow-1",
+ span(
+ class = "block-feedback text-muted",
+ span(textOutput(ns("nrow"), inline = TRUE), class = "fw-bold"),
+ "rows |",
+ class = "block-feedback text-muted",
+ span(textOutput(ns("ncol"), inline = TRUE), class = "fw-bold"),
+ "cols"
+ )
+ ),
div(
class = "flex-shrink-1",
actionLink(
@@ -168,10 +185,7 @@ block_title <- function(block, code_id, output_id, ns) {
),
tags$a(
class = "text-decoration-none block-output-toggle",
- `data-bs-toggle` = "collapse",
href = sprintf("#%s", output_id),
- `aria-expanded` = "false",
- `aria-controls` = output_id,
iconOutput()
)
)
@@ -452,25 +466,25 @@ custom_verbatim_output <- function(id) {
#' @param ns Output namespace
#' @rdname generate_ui
#' @export
-uiOutput <- function(x, ns) {
- UseMethod("uiOutput", x)
+uiOutputBlock <- function(x, ns) {
+ UseMethod("uiOutputBlock", x)
}
#' @rdname generate_ui
#' @export
-uiOutput.block <- function(x, ns) {
+uiOutputBlock.block <- function(x, ns) {
DT::dataTableOutput(ns("res"))
}
#' @rdname generate_ui
#' @export
-uiOutput.plot_block <- function(x, ns) {
+uiOutputBlock.plot_block <- function(x, ns) {
shiny::plotOutput(ns("plot"))
}
#' @rdname generate_ui
#' @export
-uiOutput.ggiraph_block <- function(x, ns) {
+uiOutputBlock.ggiraph_block <- function(x, ns) {
ggiraph::girafeOutput(ns("plot"))
}
diff --git a/inst/assets/index.js b/inst/assets/index.js
index 3ec42ebf..0d7983e6 100644
--- a/inst/assets/index.js
+++ b/inst/assets/index.js
@@ -1 +1 @@
-(()=>{var e={390:e=>{function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach((t=>{const i=e[t],s=typeof i;"object"!==s&&"function"!==s||Object.isFrozen(i)||n(i)})),e}class t{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function i(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function s(e,...n){const t=Object.create(null);for(const n in e)t[n]=e[n];return n.forEach((function(e){for(const n in e)t[n]=e[n]})),t}const o=e=>!!e.scope;class r{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=i(e)}openNode(e){if(!o(e))return;const n=((e,{prefix:n})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const t=e.split(".");return[`${n}${t.shift()}`,...t.map(((e,n)=>`${e}${"_".repeat(n+1)}`))].join(" ")}return`${n}${e}`})(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){o(e)&&(this.buffer+="")}value(){return this.buffer}span(e){this.buffer+=``}}const a=(e={})=>{const n={children:[]};return Object.assign(n,e),n};class c{constructor(){this.rootNode=a(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const n=a({scope:e});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){return"string"==typeof n?e.addText(n):n.children&&(e.openNode(n),n.children.forEach((n=>this._walk(e,n))),e.closeNode(n)),e}static _collapse(e){"string"!=typeof e&&e.children&&(e.children.every((e=>"string"==typeof e))?e.children=[e.children.join("")]:e.children.forEach((e=>{c._collapse(e)})))}}class l extends c{constructor(e){super(),this.options=e}addText(e){""!==e&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,n){const t=e.root;n&&(t.scope=`language:${n}`),this.add(t)}toHTML(){return new r(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function g(e){return e?"string"==typeof e?e:e.source:null}function u(e){return f("(?=",e,")")}function d(e){return f("(?:",e,")*")}function h(e){return f("(?:",e,")?")}function f(...e){return e.map((e=>g(e))).join("")}function p(...e){const n=function(e){const n=e[e.length-1];return"object"==typeof n&&n.constructor===Object?(e.splice(e.length-1,1),n):{}}(e);return"("+(n.capture?"":"?:")+e.map((e=>g(e))).join("|")+")"}function b(e){return new RegExp(e.toString()+"|").exec("").length-1}const m=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function E(e,{joinWith:n}){let t=0;return e.map((e=>{t+=1;const n=t;let i=g(e),s="";for(;i.length>0;){const e=m.exec(i);if(!e){s+=i;break}s+=i.substring(0,e.index),i=i.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?s+="\\"+String(Number(e[1])+n):(s+=e[0],"("===e[0]&&t++)}return s})).map((e=>`(${e})`)).join(n)}const x="[a-zA-Z]\\w*",_="[a-zA-Z_]\\w*",w="\\b\\d+(\\.\\d+)?",y="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",v="\\b(0b[01]+)",k={begin:"\\\\[\\s\\S]",relevance:0},A={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[k]},N={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[k]},S=function(e,n,t={}){const i=s({scope:"comment",begin:e,end:n,contains:[]},t);i.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const o=p("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return i.contains.push({begin:f(/[ ]+/,"(",o,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),i},M=S("//","$"),O=S("/\\*","\\*/"),R=S("#","$"),T={scope:"number",begin:w,relevance:0},I={scope:"number",begin:y,relevance:0},j={scope:"number",begin:v,relevance:0},$={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[k,{begin:/\[/,end:/\]/,relevance:0,contains:[k]}]},L={scope:"title",begin:x,relevance:0},B={scope:"title",begin:_,relevance:0},C={begin:"\\.\\s*"+_,relevance:0};var D=Object.freeze({__proto__:null,APOS_STRING_MODE:A,BACKSLASH_ESCAPE:k,BINARY_NUMBER_MODE:j,BINARY_NUMBER_RE:v,COMMENT:S,C_BLOCK_COMMENT_MODE:O,C_LINE_COMMENT_MODE:M,C_NUMBER_MODE:I,C_NUMBER_RE:y,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{n.data._beginMatch!==e[1]&&n.ignoreMatch()}})},HASH_COMMENT_MODE:R,IDENT_RE:x,MATCH_NOTHING_RE:/\b\B/,METHOD_GUARD:C,NUMBER_MODE:T,NUMBER_RE:w,PHRASAL_WORDS_MODE:{begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},QUOTE_STRING_MODE:N,REGEXP_MODE:$,RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",SHEBANG:(e={})=>{const n=/^#![ ]*\//;return e.binary&&(e.begin=f(n,/.*\b/,e.binary,/\b.*/)),s({scope:"meta",begin:n,end:/$/,relevance:0,"on:begin":(e,n)=>{0!==e.index&&n.ignoreMatch()}},e)},TITLE_MODE:L,UNDERSCORE_IDENT_RE:_,UNDERSCORE_TITLE_MODE:B});function H(e,n){"."===e.input[e.index-1]&&n.ignoreMatch()}function P(e,n){void 0!==e.className&&(e.scope=e.className,delete e.className)}function z(e,n){n&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=H,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,void 0===e.relevance&&(e.relevance=0))}function U(e,n){Array.isArray(e.illegal)&&(e.illegal=p(...e.illegal))}function G(e,n){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function Z(e,n){void 0===e.relevance&&(e.relevance=1)}const F=(e,n)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const t=Object.assign({},e);Object.keys(e).forEach((n=>{delete e[n]})),e.keywords=t.keywords,e.begin=f(t.beforeMatch,u(t.begin)),e.starts={relevance:0,contains:[Object.assign(t,{endsParent:!0})]},e.relevance=0,delete t.beforeMatch},W=["of","and","for","in","not","or","if","then","parent","list","value"],X="keyword";function K(e,n,t=X){const i=Object.create(null);return"string"==typeof e?s(t,e.split(" ")):Array.isArray(e)?s(t,e):Object.keys(e).forEach((function(t){Object.assign(i,K(e[t],n,t))})),i;function s(e,t){n&&(t=t.map((e=>e.toLowerCase()))),t.forEach((function(n){const t=n.split("|");i[t[0]]=[e,q(t[0],t[1])]}))}}function q(e,n){return n?Number(n):function(e){return W.includes(e.toLowerCase())}(e)?0:1}const V={},J=e=>{console.error(e)},Y=(e,...n)=>{console.log(`WARN: ${e}`,...n)},Q=(e,n)=>{V[`${e}/${n}`]||(console.log(`Deprecated as of ${e}. ${n}`),V[`${e}/${n}`]=!0)},ee=new Error;function ne(e,n,{key:t}){let i=0;const s=e[t],o={},r={};for(let e=1;e<=n.length;e++)r[e+i]=s[e],o[e+i]=!0,i+=b(n[e-1]);e[t]=r,e[t]._emit=o,e[t]._multi=!0}function te(e){!function(e){e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope,delete e.scope)}(e),"string"==typeof e.beginScope&&(e.beginScope={_wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope}),function(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw J("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ee;if("object"!=typeof e.beginScope||null===e.beginScope)throw J("beginScope must be object"),ee;ne(e,e.begin,{key:"beginScope"}),e.begin=E(e.begin,{joinWith:""})}}(e),function(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw J("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ee;if("object"!=typeof e.endScope||null===e.endScope)throw J("endScope must be object"),ee;ne(e,e.end,{key:"endScope"}),e.end=E(e.end,{joinWith:""})}}(e)}function ie(e){function n(n,t){return new RegExp(g(n),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(t?"g":""))}class t{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,n){n.position=this.position++,this.matchIndexes[this.matchAt]=n,this.regexes.push([n,e]),this.matchAt+=b(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null);const e=this.regexes.map((e=>e[1]));this.matcherRe=n(E(e,{joinWith:"|"}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;const n=this.matcherRe.exec(e);if(!n)return null;const t=n.findIndex(((e,n)=>n>0&&void 0!==e)),i=this.matchIndexes[t];return n.splice(0,t),Object.assign(n,i)}}class i{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];const n=new t;return this.rules.slice(e).forEach((([e,t])=>n.addRule(e,t))),n.compile(),this.multiRegexes[e]=n,n}resumingScanAtSamePosition(){return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,n){this.rules.push([e,n]),"begin"===n.type&&this.count++}exec(e){const n=this.getMatcher(this.regexIndex);n.lastIndex=this.lastIndex;let t=n.exec(e);if(this.resumingScanAtSamePosition())if(t&&t.index===this.lastIndex);else{const n=this.getMatcher(0);n.lastIndex=this.lastIndex+1,t=n.exec(e)}return t&&(this.regexIndex+=t.position+1,this.regexIndex===this.count&&this.considerAll()),t}}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=s(e.classNameAliases||{}),function t(o,r){const a=o;if(o.isCompiled)return a;[P,G,te,F].forEach((e=>e(o,r))),e.compilerExtensions.forEach((e=>e(o,r))),o.__beforeBegin=null,[z,U,Z].forEach((e=>e(o,r))),o.isCompiled=!0;let c=null;return"object"==typeof o.keywords&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),c=o.keywords.$pattern,delete o.keywords.$pattern),c=c||/\w+/,o.keywords&&(o.keywords=K(o.keywords,e.case_insensitive)),a.keywordPatternRe=n(c,!0),r&&(o.begin||(o.begin=/\B|\b/),a.beginRe=n(a.begin),o.end||o.endsWithParent||(o.end=/\B|\b/),o.end&&(a.endRe=n(a.end)),a.terminatorEnd=g(a.end)||"",o.endsWithParent&&r.terminatorEnd&&(a.terminatorEnd+=(o.end?"|":"")+r.terminatorEnd)),o.illegal&&(a.illegalRe=n(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map((function(e){return function(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((function(n){return s(e,{variants:null},n)}))),e.cachedVariants?e.cachedVariants:se(e)?s(e,{starts:e.starts?s(e.starts):null}):Object.isFrozen(e)?s(e):e}("self"===e?o:e)}))),o.contains.forEach((function(e){t(e,a)})),o.starts&&t(o.starts,r),a.matcher=function(e){const n=new i;return e.contains.forEach((e=>n.addRule(e.begin,{rule:e,type:"begin"}))),e.terminatorEnd&&n.addRule(e.terminatorEnd,{type:"end"}),e.illegal&&n.addRule(e.illegal,{type:"illegal"}),n}(a),a}(e)}function se(e){return!!e&&(e.endsWithParent||se(e.starts))}class oe extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}}const re=i,ae=s,ce=Symbol("nomatch"),le=function(e){const i=Object.create(null),s=Object.create(null),o=[];let r=!0;const a="Could not find the language '{}', did you forget to load/include a language module?",c={disableAutodetect:!0,name:"Plain text",contains:[]};let g={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:l};function b(e){return g.noHighlightRe.test(e)}function m(e,n,t){let i="",s="";"object"==typeof n?(i=e,t=n.ignoreIllegals,s=n.language):(Q("10.7.0","highlight(lang, code, ...args) has been deprecated."),Q("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),s=e,i=n),void 0===t&&(t=!0);const o={code:i,language:s};N("before:highlight",o);const r=o.result?o.result:E(o.language,o.code,t);return r.code=o.code,N("after:highlight",r),r}function E(e,n,s,o){const c=Object.create(null);function l(){if(!N.keywords)return void M.addText(O);let e=0;N.keywordPatternRe.lastIndex=0;let n=N.keywordPatternRe.exec(O),t="";for(;n;){t+=O.substring(e,n.index);const s=y.case_insensitive?n[0].toLowerCase():n[0],o=(i=s,N.keywords[i]);if(o){const[e,i]=o;if(M.addText(t),t="",c[s]=(c[s]||0)+1,c[s]<=7&&(R+=i),e.startsWith("_"))t+=n[0];else{const t=y.classNameAliases[e]||e;d(n[0],t)}}else t+=n[0];e=N.keywordPatternRe.lastIndex,n=N.keywordPatternRe.exec(O)}var i;t+=O.substring(e),M.addText(t)}function u(){null!=N.subLanguage?function(){if(""===O)return;let e=null;if("string"==typeof N.subLanguage){if(!i[N.subLanguage])return void M.addText(O);e=E(N.subLanguage,O,!0,S[N.subLanguage]),S[N.subLanguage]=e._top}else e=x(O,N.subLanguage.length?N.subLanguage:null);N.relevance>0&&(R+=e.relevance),M.__addSublanguage(e._emitter,e.language)}():l(),O=""}function d(e,n){""!==e&&(M.startScope(n),M.addText(e),M.endScope())}function h(e,n){let t=1;const i=n.length-1;for(;t<=i;){if(!e._emit[t]){t++;continue}const i=y.classNameAliases[e[t]]||e[t],s=n[t];i?d(s,i):(O=s,l(),O=""),t++}}function f(e,n){return e.scope&&"string"==typeof e.scope&&M.openNode(y.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(d(O,y.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),O=""):e.beginScope._multi&&(h(e.beginScope,n),O="")),N=Object.create(e,{parent:{value:N}}),N}function p(e,n,i){let s=function(e,n){const t=e&&e.exec(n);return t&&0===t.index}(e.endRe,i);if(s){if(e["on:end"]){const i=new t(e);e["on:end"](n,i),i.isMatchIgnored&&(s=!1)}if(s){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return p(e.parent,n,i)}function b(e){return 0===N.matcher.regexIndex?(O+=e[0],1):(j=!0,0)}function m(e){const t=e[0],i=n.substring(e.index),s=p(N,e,i);if(!s)return ce;const o=N;N.endScope&&N.endScope._wrap?(u(),d(t,N.endScope._wrap)):N.endScope&&N.endScope._multi?(u(),h(N.endScope,e)):o.skip?O+=t:(o.returnEnd||o.excludeEnd||(O+=t),u(),o.excludeEnd&&(O=t));do{N.scope&&M.closeNode(),N.skip||N.subLanguage||(R+=N.relevance),N=N.parent}while(N!==s.parent);return s.starts&&f(s.starts,e),o.returnEnd?0:t.length}let _={};function w(i,o){const a=o&&o[0];if(O+=i,null==a)return u(),0;if("begin"===_.type&&"end"===o.type&&_.index===o.index&&""===a){if(O+=n.slice(o.index,o.index+1),!r){const n=new Error(`0 width match regex (${e})`);throw n.languageName=e,n.badRule=_.rule,n}return 1}if(_=o,"begin"===o.type)return function(e){const n=e[0],i=e.rule,s=new t(i),o=[i.__beforeBegin,i["on:begin"]];for(const t of o)if(t&&(t(e,s),s.isMatchIgnored))return b(n);return i.skip?O+=n:(i.excludeBegin&&(O+=n),u(),i.returnBegin||i.excludeBegin||(O=n)),f(i,e),i.returnBegin?0:n.length}(o);if("illegal"===o.type&&!s){const e=new Error('Illegal lexeme "'+a+'" for mode "'+(N.scope||"")+'"');throw e.mode=N,e}if("end"===o.type){const e=m(o);if(e!==ce)return e}if("illegal"===o.type&&""===a)return 1;if(I>1e5&&I>3*o.index)throw new Error("potential infinite loop, way more iterations than matches");return O+=a,a.length}const y=v(e);if(!y)throw J(a.replace("{}",e)),new Error('Unknown language: "'+e+'"');const k=ie(y);let A="",N=o||k;const S={},M=new g.__emitter(g);!function(){const e=[];for(let n=N;n!==y;n=n.parent)n.scope&&e.unshift(n.scope);e.forEach((e=>M.openNode(e)))}();let O="",R=0,T=0,I=0,j=!1;try{if(y.__emitTokens)y.__emitTokens(n,M);else{for(N.matcher.considerAll();;){I++,j?j=!1:N.matcher.considerAll(),N.matcher.lastIndex=T;const e=N.matcher.exec(n);if(!e)break;const t=w(n.substring(T,e.index),e);T=e.index+t}w(n.substring(T))}return M.finalize(),A=M.toHTML(),{language:e,value:A,relevance:R,illegal:!1,_emitter:M,_top:N}}catch(t){if(t.message&&t.message.includes("Illegal"))return{language:e,value:re(n),illegal:!0,relevance:0,_illegalBy:{message:t.message,index:T,context:n.slice(T-100,T+100),mode:t.mode,resultSoFar:A},_emitter:M};if(r)return{language:e,value:re(n),illegal:!1,relevance:0,errorRaised:t,_emitter:M,_top:N};throw t}}function x(e,n){n=n||g.languages||Object.keys(i);const t=function(e){const n={value:re(e),illegal:!1,relevance:0,_top:c,_emitter:new g.__emitter(g)};return n._emitter.addText(e),n}(e),s=n.filter(v).filter(A).map((n=>E(n,e,!1)));s.unshift(t);const o=s.sort(((e,n)=>{if(e.relevance!==n.relevance)return n.relevance-e.relevance;if(e.language&&n.language){if(v(e.language).supersetOf===n.language)return 1;if(v(n.language).supersetOf===e.language)return-1}return 0})),[r,a]=o,l=r;return l.secondBest=a,l}function _(e){let n=null;const t=function(e){let n=e.className+" ";n+=e.parentNode?e.parentNode.className:"";const t=g.languageDetectRe.exec(n);if(t){const n=v(t[1]);return n||(Y(a.replace("{}",t[1])),Y("Falling back to no-highlight mode for this block.",e)),n?t[1]:"no-highlight"}return n.split(/\s+/).find((e=>b(e)||v(e)))}(e);if(b(t))return;if(N("before:highlightElement",{el:e,language:t}),e.dataset.highlighted)return void console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);if(e.children.length>0&&(g.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(e)),g.throwUnescapedHTML))throw new oe("One of your code blocks includes unescaped HTML.",e.innerHTML);n=e;const i=n.textContent,o=t?m(i,{language:t,ignoreIllegals:!0}):x(i);e.innerHTML=o.value,e.dataset.highlighted="yes",function(e,n,t){const i=n&&s[n]||t;e.classList.add("hljs"),e.classList.add(`language-${i}`)}(e,t,o.language),e.result={language:o.language,re:o.relevance,relevance:o.relevance},o.secondBest&&(e.secondBest={language:o.secondBest.language,relevance:o.secondBest.relevance}),N("after:highlightElement",{el:e,result:o,text:i})}let w=!1;function y(){"loading"!==document.readyState?document.querySelectorAll(g.cssSelector).forEach(_):w=!0}function v(e){return e=(e||"").toLowerCase(),i[e]||i[s[e]]}function k(e,{languageName:n}){"string"==typeof e&&(e=[e]),e.forEach((e=>{s[e.toLowerCase()]=n}))}function A(e){const n=v(e);return n&&!n.disableAutodetect}function N(e,n){const t=e;o.forEach((function(e){e[t]&&e[t](n)}))}"undefined"!=typeof window&&window.addEventListener&&window.addEventListener("DOMContentLoaded",(function(){w&&y()}),!1),Object.assign(e,{highlight:m,highlightAuto:x,highlightAll:y,highlightElement:_,highlightBlock:function(e){return Q("10.7.0","highlightBlock will be removed entirely in v12.0"),Q("10.7.0","Please use highlightElement now."),_(e)},configure:function(e){g=ae(g,e)},initHighlighting:()=>{y(),Q("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")},initHighlightingOnLoad:function(){y(),Q("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")},registerLanguage:function(n,t){let s=null;try{s=t(e)}catch(e){if(J("Language definition for '{}' could not be registered.".replace("{}",n)),!r)throw e;J(e),s=c}s.name||(s.name=n),i[n]=s,s.rawDefinition=t.bind(null,e),s.aliases&&k(s.aliases,{languageName:n})},unregisterLanguage:function(e){delete i[e];for(const n of Object.keys(s))s[n]===e&&delete s[n]},listLanguages:function(){return Object.keys(i)},getLanguage:v,registerAliases:k,autoDetection:A,inherit:ae,addPlugin:function(e){!function(e){e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=n=>{e["before:highlightBlock"](Object.assign({block:n.el},n))}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=n=>{e["after:highlightBlock"](Object.assign({block:n.el},n))})}(e),o.push(e)},removePlugin:function(e){const n=o.indexOf(e);-1!==n&&o.splice(n,1)}}),e.debugMode=function(){r=!1},e.safeMode=function(){r=!0},e.versionString="11.9.0",e.regex={concat:f,lookahead:u,either:p,optional:h,anyNumberOfTimes:d};for(const e in D)"object"==typeof D[e]&&n(D[e]);return Object.assign(e,D),e},ge=le({});ge.newInstance=()=>le({}),e.exports=ge,ge.HighlightJS=ge,ge.default=ge}},n={};function t(i){var s=n[i];if(void 0!==s)return s.exports;var o=n[i]={exports:{}};return e[i](o,o.exports,t),o.exports}(()=>{"use strict";Shiny;const e=t(390);e.registerLanguage("r",(function(e){const n=e.regex,t=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,i=n.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),s=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,o=n.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:t,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:n.lookahead(n.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:t},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[s,i]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,i]},{scope:{1:"punctuation",2:"number"},match:[o,i]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,i]}]},{scope:{3:"operator"},match:[t,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:s},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:o},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}})),$((()=>{$(document).on("shiny:value",(n=>{n.name.match(/-code$/)&&($(`#${n.name}`).addClass("language-r"),setTimeout((()=>{e.highlightElement(document.getElementById(n.name))}),250))}))}));const n=e=>{const n=$(e).find(".block").last();n.removeClass("d-none");const t=n.find(".block-output");bootstrap.Collapse.getOrCreateInstance(t,{toggle:!1}).show(),$(t).trigger("shown")},i=()=>{$(".block-copy-code").each(((e,n)=>{$(n).off("click"),$(n).on("click",(e=>{var n;n=$(e.target).closest("div").find("pre"),navigator.clipboard.writeText($(n).text())}))})),$(".stack-copy-code").each(((e,n)=>{$(n).off("click"),$(n).on("click",(e=>{const n=$(e.target).closest(".stack").find("pre");let t=[];n.each(((e,n)=>{t.push($(n).text())})),t=t.join(" |>\n"),navigator.clipboard.writeText(t)}))}))};Shiny.addCustomMessageHandler("blockr-bind-stack",(e=>{const t=`#${e.stack}`;setTimeout((()=>{(e=>{$(e).find(".stack-remove").each(((e,n)=>{"true"!=n.getAttribute("listener")&&$(n).on("click",(e=>{const n=$(e.target).closest(".stack"),t=n.closest(".masonry-item");n.remove(),0!==t.length&&t.remove()}))}))})(t),(e=>{(e=>{const n=$(e).find(".stack-edit-toggle");n[0].getAttribute("listener")||$(n).on("click",(e=>{const n=$(e.target).closest(".stack").find(".block");$(e.currentTarget).toggleClass("etidable");const t=$(e.currentTarget).hasClass("etidable");n.each(((e,i)=>{const s=$(i);return t?(s.removeClass("d-none"),s.find(".block-inputs").removeClass("d-none"),s.find(".block-inputs").trigger("shown"),void(e==n.length-1&&(s.find(".block-output").addClass("show"),s.find(".block-output").removeClass("d-none"),s.find(".block-output").trigger("shown")))):(s.find(".block-inputs").addClass("d-none"),s.find(".block-inputs").trigger("hidden"),e==n.length-1?(s.removeClass("d-none"),s.find(".block-output").addClass("show"),s.find(".block-output").removeClass("d-none"),void s.find(".block-output").trigger("shown")):void s.addClass("d-none"))}))}))})(e),(e=>{$(e).each(((e,t)=>{n(t)}))})(e)})(t),i()}),750)})),Shiny.addCustomMessageHandler("blockr-add-block",(e=>{const t=`#${e.stack}`;setTimeout((()=>{n(t),i()}),500)}))})()})();
\ No newline at end of file
+(()=>{var e={390:e=>{function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach((t=>{const i=e[t],o=typeof i;"object"!==o&&"function"!==o||Object.isFrozen(i)||n(i)})),e}class t{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function i(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function o(e,...n){const t=Object.create(null);for(const n in e)t[n]=e[n];return n.forEach((function(e){for(const n in e)t[n]=e[n]})),t}const s=e=>!!e.scope;class r{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=i(e)}openNode(e){if(!s(e))return;const n=((e,{prefix:n})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const t=e.split(".");return[`${n}${t.shift()}`,...t.map(((e,n)=>`${e}${"_".repeat(n+1)}`))].join(" ")}return`${n}${e}`})(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){s(e)&&(this.buffer+="")}value(){return this.buffer}span(e){this.buffer+=``}}const a=(e={})=>{const n={children:[]};return Object.assign(n,e),n};class c{constructor(){this.rootNode=a(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const n=a({scope:e});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){return"string"==typeof n?e.addText(n):n.children&&(e.openNode(n),n.children.forEach((n=>this._walk(e,n))),e.closeNode(n)),e}static _collapse(e){"string"!=typeof e&&e.children&&(e.children.every((e=>"string"==typeof e))?e.children=[e.children.join("")]:e.children.forEach((e=>{c._collapse(e)})))}}class l extends c{constructor(e){super(),this.options=e}addText(e){""!==e&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,n){const t=e.root;n&&(t.scope=`language:${n}`),this.add(t)}toHTML(){return new r(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function u(e){return e?"string"==typeof e?e:e.source:null}function d(e){return f("(?=",e,")")}function g(e){return f("(?:",e,")*")}function h(e){return f("(?:",e,")?")}function f(...e){return e.map((e=>u(e))).join("")}function p(...e){const n=function(e){const n=e[e.length-1];return"object"==typeof n&&n.constructor===Object?(e.splice(e.length-1,1),n):{}}(e);return"("+(n.capture?"":"?:")+e.map((e=>u(e))).join("|")+")"}function b(e){return new RegExp(e.toString()+"|").exec("").length-1}const m=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function E(e,{joinWith:n}){let t=0;return e.map((e=>{t+=1;const n=t;let i=u(e),o="";for(;i.length>0;){const e=m.exec(i);if(!e){o+=i;break}o+=i.substring(0,e.index),i=i.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?o+="\\"+String(Number(e[1])+n):(o+=e[0],"("===e[0]&&t++)}return o})).map((e=>`(${e})`)).join(n)}const x="[a-zA-Z]\\w*",_="[a-zA-Z_]\\w*",w="\\b\\d+(\\.\\d+)?",k="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",y="\\b(0b[01]+)",v={begin:"\\\\[\\s\\S]",relevance:0},A={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[v]},N={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[v]},S=function(e,n,t={}){const i=o({scope:"comment",begin:e,end:n,contains:[]},t);i.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const s=p("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return i.contains.push({begin:f(/[ ]+/,"(",s,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),i},M=S("//","$"),O=S("/\\*","\\*/"),R=S("#","$"),T={scope:"number",begin:w,relevance:0},$={scope:"number",begin:k,relevance:0},I={scope:"number",begin:y,relevance:0},j={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[v,{begin:/\[/,end:/\]/,relevance:0,contains:[v]}]},C={scope:"title",begin:x,relevance:0},L={scope:"title",begin:_,relevance:0},B={begin:"\\.\\s*"+_,relevance:0};var D=Object.freeze({__proto__:null,APOS_STRING_MODE:A,BACKSLASH_ESCAPE:v,BINARY_NUMBER_MODE:I,BINARY_NUMBER_RE:y,COMMENT:S,C_BLOCK_COMMENT_MODE:O,C_LINE_COMMENT_MODE:M,C_NUMBER_MODE:$,C_NUMBER_RE:k,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{n.data._beginMatch!==e[1]&&n.ignoreMatch()}})},HASH_COMMENT_MODE:R,IDENT_RE:x,MATCH_NOTHING_RE:/\b\B/,METHOD_GUARD:B,NUMBER_MODE:T,NUMBER_RE:w,PHRASAL_WORDS_MODE:{begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},QUOTE_STRING_MODE:N,REGEXP_MODE:j,RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",SHEBANG:(e={})=>{const n=/^#![ ]*\//;return e.binary&&(e.begin=f(n,/.*\b/,e.binary,/\b.*/)),o({scope:"meta",begin:n,end:/$/,relevance:0,"on:begin":(e,n)=>{0!==e.index&&n.ignoreMatch()}},e)},TITLE_MODE:C,UNDERSCORE_IDENT_RE:_,UNDERSCORE_TITLE_MODE:L});function H(e,n){"."===e.input[e.index-1]&&n.ignoreMatch()}function P(e,n){void 0!==e.className&&(e.scope=e.className,delete e.className)}function z(e,n){n&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=H,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,void 0===e.relevance&&(e.relevance=0))}function U(e,n){Array.isArray(e.illegal)&&(e.illegal=p(...e.illegal))}function G(e,n){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function Z(e,n){void 0===e.relevance&&(e.relevance=1)}const F=(e,n)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const t=Object.assign({},e);Object.keys(e).forEach((n=>{delete e[n]})),e.keywords=t.keywords,e.begin=f(t.beforeMatch,d(t.begin)),e.starts={relevance:0,contains:[Object.assign(t,{endsParent:!0})]},e.relevance=0,delete t.beforeMatch},W=["of","and","for","in","not","or","if","then","parent","list","value"],X="keyword";function K(e,n,t=X){const i=Object.create(null);return"string"==typeof e?o(t,e.split(" ")):Array.isArray(e)?o(t,e):Object.keys(e).forEach((function(t){Object.assign(i,K(e[t],n,t))})),i;function o(e,t){n&&(t=t.map((e=>e.toLowerCase()))),t.forEach((function(n){const t=n.split("|");i[t[0]]=[e,q(t[0],t[1])]}))}}function q(e,n){return n?Number(n):function(e){return W.includes(e.toLowerCase())}(e)?0:1}const V={},J=e=>{console.error(e)},Y=(e,...n)=>{console.log(`WARN: ${e}`,...n)},Q=(e,n)=>{V[`${e}/${n}`]||(console.log(`Deprecated as of ${e}. ${n}`),V[`${e}/${n}`]=!0)},ee=new Error;function ne(e,n,{key:t}){let i=0;const o=e[t],s={},r={};for(let e=1;e<=n.length;e++)r[e+i]=o[e],s[e+i]=!0,i+=b(n[e-1]);e[t]=r,e[t]._emit=s,e[t]._multi=!0}function te(e){!function(e){e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope,delete e.scope)}(e),"string"==typeof e.beginScope&&(e.beginScope={_wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope}),function(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw J("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ee;if("object"!=typeof e.beginScope||null===e.beginScope)throw J("beginScope must be object"),ee;ne(e,e.begin,{key:"beginScope"}),e.begin=E(e.begin,{joinWith:""})}}(e),function(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw J("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ee;if("object"!=typeof e.endScope||null===e.endScope)throw J("endScope must be object"),ee;ne(e,e.end,{key:"endScope"}),e.end=E(e.end,{joinWith:""})}}(e)}function ie(e){function n(n,t){return new RegExp(u(n),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(t?"g":""))}class t{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,n){n.position=this.position++,this.matchIndexes[this.matchAt]=n,this.regexes.push([n,e]),this.matchAt+=b(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null);const e=this.regexes.map((e=>e[1]));this.matcherRe=n(E(e,{joinWith:"|"}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;const n=this.matcherRe.exec(e);if(!n)return null;const t=n.findIndex(((e,n)=>n>0&&void 0!==e)),i=this.matchIndexes[t];return n.splice(0,t),Object.assign(n,i)}}class i{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];const n=new t;return this.rules.slice(e).forEach((([e,t])=>n.addRule(e,t))),n.compile(),this.multiRegexes[e]=n,n}resumingScanAtSamePosition(){return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,n){this.rules.push([e,n]),"begin"===n.type&&this.count++}exec(e){const n=this.getMatcher(this.regexIndex);n.lastIndex=this.lastIndex;let t=n.exec(e);if(this.resumingScanAtSamePosition())if(t&&t.index===this.lastIndex);else{const n=this.getMatcher(0);n.lastIndex=this.lastIndex+1,t=n.exec(e)}return t&&(this.regexIndex+=t.position+1,this.regexIndex===this.count&&this.considerAll()),t}}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=o(e.classNameAliases||{}),function t(s,r){const a=s;if(s.isCompiled)return a;[P,G,te,F].forEach((e=>e(s,r))),e.compilerExtensions.forEach((e=>e(s,r))),s.__beforeBegin=null,[z,U,Z].forEach((e=>e(s,r))),s.isCompiled=!0;let c=null;return"object"==typeof s.keywords&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),c=s.keywords.$pattern,delete s.keywords.$pattern),c=c||/\w+/,s.keywords&&(s.keywords=K(s.keywords,e.case_insensitive)),a.keywordPatternRe=n(c,!0),r&&(s.begin||(s.begin=/\B|\b/),a.beginRe=n(a.begin),s.end||s.endsWithParent||(s.end=/\B|\b/),s.end&&(a.endRe=n(a.end)),a.terminatorEnd=u(a.end)||"",s.endsWithParent&&r.terminatorEnd&&(a.terminatorEnd+=(s.end?"|":"")+r.terminatorEnd)),s.illegal&&(a.illegalRe=n(s.illegal)),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map((function(e){return function(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((function(n){return o(e,{variants:null},n)}))),e.cachedVariants?e.cachedVariants:oe(e)?o(e,{starts:e.starts?o(e.starts):null}):Object.isFrozen(e)?o(e):e}("self"===e?s:e)}))),s.contains.forEach((function(e){t(e,a)})),s.starts&&t(s.starts,r),a.matcher=function(e){const n=new i;return e.contains.forEach((e=>n.addRule(e.begin,{rule:e,type:"begin"}))),e.terminatorEnd&&n.addRule(e.terminatorEnd,{type:"end"}),e.illegal&&n.addRule(e.illegal,{type:"illegal"}),n}(a),a}(e)}function oe(e){return!!e&&(e.endsWithParent||oe(e.starts))}class se extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}}const re=i,ae=o,ce=Symbol("nomatch"),le=function(e){const i=Object.create(null),o=Object.create(null),s=[];let r=!0;const a="Could not find the language '{}', did you forget to load/include a language module?",c={disableAutodetect:!0,name:"Plain text",contains:[]};let u={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:l};function b(e){return u.noHighlightRe.test(e)}function m(e,n,t){let i="",o="";"object"==typeof n?(i=e,t=n.ignoreIllegals,o=n.language):(Q("10.7.0","highlight(lang, code, ...args) has been deprecated."),Q("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),o=e,i=n),void 0===t&&(t=!0);const s={code:i,language:o};N("before:highlight",s);const r=s.result?s.result:E(s.language,s.code,t);return r.code=s.code,N("after:highlight",r),r}function E(e,n,o,s){const c=Object.create(null);function l(){if(!N.keywords)return void M.addText(O);let e=0;N.keywordPatternRe.lastIndex=0;let n=N.keywordPatternRe.exec(O),t="";for(;n;){t+=O.substring(e,n.index);const o=k.case_insensitive?n[0].toLowerCase():n[0],s=(i=o,N.keywords[i]);if(s){const[e,i]=s;if(M.addText(t),t="",c[o]=(c[o]||0)+1,c[o]<=7&&(R+=i),e.startsWith("_"))t+=n[0];else{const t=k.classNameAliases[e]||e;g(n[0],t)}}else t+=n[0];e=N.keywordPatternRe.lastIndex,n=N.keywordPatternRe.exec(O)}var i;t+=O.substring(e),M.addText(t)}function d(){null!=N.subLanguage?function(){if(""===O)return;let e=null;if("string"==typeof N.subLanguage){if(!i[N.subLanguage])return void M.addText(O);e=E(N.subLanguage,O,!0,S[N.subLanguage]),S[N.subLanguage]=e._top}else e=x(O,N.subLanguage.length?N.subLanguage:null);N.relevance>0&&(R+=e.relevance),M.__addSublanguage(e._emitter,e.language)}():l(),O=""}function g(e,n){""!==e&&(M.startScope(n),M.addText(e),M.endScope())}function h(e,n){let t=1;const i=n.length-1;for(;t<=i;){if(!e._emit[t]){t++;continue}const i=k.classNameAliases[e[t]]||e[t],o=n[t];i?g(o,i):(O=o,l(),O=""),t++}}function f(e,n){return e.scope&&"string"==typeof e.scope&&M.openNode(k.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(g(O,k.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),O=""):e.beginScope._multi&&(h(e.beginScope,n),O="")),N=Object.create(e,{parent:{value:N}}),N}function p(e,n,i){let o=function(e,n){const t=e&&e.exec(n);return t&&0===t.index}(e.endRe,i);if(o){if(e["on:end"]){const i=new t(e);e["on:end"](n,i),i.isMatchIgnored&&(o=!1)}if(o){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return p(e.parent,n,i)}function b(e){return 0===N.matcher.regexIndex?(O+=e[0],1):(I=!0,0)}function m(e){const t=e[0],i=n.substring(e.index),o=p(N,e,i);if(!o)return ce;const s=N;N.endScope&&N.endScope._wrap?(d(),g(t,N.endScope._wrap)):N.endScope&&N.endScope._multi?(d(),h(N.endScope,e)):s.skip?O+=t:(s.returnEnd||s.excludeEnd||(O+=t),d(),s.excludeEnd&&(O=t));do{N.scope&&M.closeNode(),N.skip||N.subLanguage||(R+=N.relevance),N=N.parent}while(N!==o.parent);return o.starts&&f(o.starts,e),s.returnEnd?0:t.length}let _={};function w(i,s){const a=s&&s[0];if(O+=i,null==a)return d(),0;if("begin"===_.type&&"end"===s.type&&_.index===s.index&&""===a){if(O+=n.slice(s.index,s.index+1),!r){const n=new Error(`0 width match regex (${e})`);throw n.languageName=e,n.badRule=_.rule,n}return 1}if(_=s,"begin"===s.type)return function(e){const n=e[0],i=e.rule,o=new t(i),s=[i.__beforeBegin,i["on:begin"]];for(const t of s)if(t&&(t(e,o),o.isMatchIgnored))return b(n);return i.skip?O+=n:(i.excludeBegin&&(O+=n),d(),i.returnBegin||i.excludeBegin||(O=n)),f(i,e),i.returnBegin?0:n.length}(s);if("illegal"===s.type&&!o){const e=new Error('Illegal lexeme "'+a+'" for mode "'+(N.scope||"")+'"');throw e.mode=N,e}if("end"===s.type){const e=m(s);if(e!==ce)return e}if("illegal"===s.type&&""===a)return 1;if($>1e5&&$>3*s.index)throw new Error("potential infinite loop, way more iterations than matches");return O+=a,a.length}const k=y(e);if(!k)throw J(a.replace("{}",e)),new Error('Unknown language: "'+e+'"');const v=ie(k);let A="",N=s||v;const S={},M=new u.__emitter(u);!function(){const e=[];for(let n=N;n!==k;n=n.parent)n.scope&&e.unshift(n.scope);e.forEach((e=>M.openNode(e)))}();let O="",R=0,T=0,$=0,I=!1;try{if(k.__emitTokens)k.__emitTokens(n,M);else{for(N.matcher.considerAll();;){$++,I?I=!1:N.matcher.considerAll(),N.matcher.lastIndex=T;const e=N.matcher.exec(n);if(!e)break;const t=w(n.substring(T,e.index),e);T=e.index+t}w(n.substring(T))}return M.finalize(),A=M.toHTML(),{language:e,value:A,relevance:R,illegal:!1,_emitter:M,_top:N}}catch(t){if(t.message&&t.message.includes("Illegal"))return{language:e,value:re(n),illegal:!0,relevance:0,_illegalBy:{message:t.message,index:T,context:n.slice(T-100,T+100),mode:t.mode,resultSoFar:A},_emitter:M};if(r)return{language:e,value:re(n),illegal:!1,relevance:0,errorRaised:t,_emitter:M,_top:N};throw t}}function x(e,n){n=n||u.languages||Object.keys(i);const t=function(e){const n={value:re(e),illegal:!1,relevance:0,_top:c,_emitter:new u.__emitter(u)};return n._emitter.addText(e),n}(e),o=n.filter(y).filter(A).map((n=>E(n,e,!1)));o.unshift(t);const s=o.sort(((e,n)=>{if(e.relevance!==n.relevance)return n.relevance-e.relevance;if(e.language&&n.language){if(y(e.language).supersetOf===n.language)return 1;if(y(n.language).supersetOf===e.language)return-1}return 0})),[r,a]=s,l=r;return l.secondBest=a,l}function _(e){let n=null;const t=function(e){let n=e.className+" ";n+=e.parentNode?e.parentNode.className:"";const t=u.languageDetectRe.exec(n);if(t){const n=y(t[1]);return n||(Y(a.replace("{}",t[1])),Y("Falling back to no-highlight mode for this block.",e)),n?t[1]:"no-highlight"}return n.split(/\s+/).find((e=>b(e)||y(e)))}(e);if(b(t))return;if(N("before:highlightElement",{el:e,language:t}),e.dataset.highlighted)return void console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);if(e.children.length>0&&(u.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(e)),u.throwUnescapedHTML))throw new se("One of your code blocks includes unescaped HTML.",e.innerHTML);n=e;const i=n.textContent,s=t?m(i,{language:t,ignoreIllegals:!0}):x(i);e.innerHTML=s.value,e.dataset.highlighted="yes",function(e,n,t){const i=n&&o[n]||t;e.classList.add("hljs"),e.classList.add(`language-${i}`)}(e,t,s.language),e.result={language:s.language,re:s.relevance,relevance:s.relevance},s.secondBest&&(e.secondBest={language:s.secondBest.language,relevance:s.secondBest.relevance}),N("after:highlightElement",{el:e,result:s,text:i})}let w=!1;function k(){"loading"!==document.readyState?document.querySelectorAll(u.cssSelector).forEach(_):w=!0}function y(e){return e=(e||"").toLowerCase(),i[e]||i[o[e]]}function v(e,{languageName:n}){"string"==typeof e&&(e=[e]),e.forEach((e=>{o[e.toLowerCase()]=n}))}function A(e){const n=y(e);return n&&!n.disableAutodetect}function N(e,n){const t=e;s.forEach((function(e){e[t]&&e[t](n)}))}"undefined"!=typeof window&&window.addEventListener&&window.addEventListener("DOMContentLoaded",(function(){w&&k()}),!1),Object.assign(e,{highlight:m,highlightAuto:x,highlightAll:k,highlightElement:_,highlightBlock:function(e){return Q("10.7.0","highlightBlock will be removed entirely in v12.0"),Q("10.7.0","Please use highlightElement now."),_(e)},configure:function(e){u=ae(u,e)},initHighlighting:()=>{k(),Q("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")},initHighlightingOnLoad:function(){k(),Q("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")},registerLanguage:function(n,t){let o=null;try{o=t(e)}catch(e){if(J("Language definition for '{}' could not be registered.".replace("{}",n)),!r)throw e;J(e),o=c}o.name||(o.name=n),i[n]=o,o.rawDefinition=t.bind(null,e),o.aliases&&v(o.aliases,{languageName:n})},unregisterLanguage:function(e){delete i[e];for(const n of Object.keys(o))o[n]===e&&delete o[n]},listLanguages:function(){return Object.keys(i)},getLanguage:y,registerAliases:v,autoDetection:A,inherit:ae,addPlugin:function(e){!function(e){e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=n=>{e["before:highlightBlock"](Object.assign({block:n.el},n))}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=n=>{e["after:highlightBlock"](Object.assign({block:n.el},n))})}(e),s.push(e)},removePlugin:function(e){const n=s.indexOf(e);-1!==n&&s.splice(n,1)}}),e.debugMode=function(){r=!1},e.safeMode=function(){r=!0},e.versionString="11.9.0",e.regex={concat:f,lookahead:d,either:p,optional:h,anyNumberOfTimes:g};for(const e in D)"object"==typeof D[e]&&n(D[e]);return Object.assign(e,D),e},ue=le({});ue.newInstance=()=>le({}),e.exports=ue,ue.HighlightJS=ue,ue.default=ue}},n={};function t(i){var o=n[i];if(void 0!==o)return o.exports;var s=n[i]={exports:{}};return e[i](s,s.exports,t),s.exports}(()=>{"use strict";Shiny;const e=t(390);e.registerLanguage("r",(function(e){const n=e.regex,t=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,i=n.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),o=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,s=n.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:t,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:n.lookahead(n.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:t},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[o,i]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,i]},{scope:{1:"punctuation",2:"number"},match:[s,i]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,i]}]},{scope:{3:"operator"},match:[t,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:o},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:s},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}})),$((()=>{$(document).on("shiny:value",(n=>{n.name.match(/-code$/)&&($(`#${n.name}`).addClass("language-r"),setTimeout((()=>{e.highlightElement(document.getElementById(n.name))}),250))}))}));const n=e=>{$(e).find(".block-output-toggle").each(((e,n)=>{$(n).hasClass("block-bound")||($(n).addClass("block-bound"),$(n).on("click",(e=>{const n=$(e.target).closest(".block"),t=n.find(".block-output").is(":visible"),i=n.find(".block-input").is(":visible");t||i?(n.find(".block-inputs").addClass("d-none"),n.find(".block-output").addClass("d-none")):(n.find(".block-inputs").removeClass("d-none"),n.find(".block-output").removeClass("d-none"));let o="shown";n.find(".block-output").hasClass("d-none")&&(o="hidden"),n.find(".block-inputs").trigger(o),n.find(".block-output").trigger(o)})))}))},i=()=>{$(".block-copy-code").each(((e,n)=>{$(n).off("click"),$(n).on("click",(e=>{var n;n=$(e.target).closest("div").find("pre"),navigator.clipboard.writeText($(n).text())}))})),$(".stack-copy-code").each(((e,n)=>{$(n).off("click"),$(n).on("click",(e=>{const n=$(e.target).closest(".stack").find("pre");let t=[];n.each(((e,n)=>{t.push($(n).text())})),t=t.join(" |>\n"),navigator.clipboard.writeText(t)}))}))};Shiny.addCustomMessageHandler("blockr-bind-stack",(e=>{const t=`#${e.stack}`;setTimeout((()=>{(e=>{$(e).find(".stack-remove").each(((e,n)=>{"true"!=n.getAttribute("listener")&&$(n).on("click",(e=>{const n=$(e.target).closest(".stack"),t=n.closest(".masonry-item");n.remove(),0!==t.length&&t.remove()}))}))})(t),(e=>{(e=>{const n=$(e).find(".stack-edit-toggle");$(n).hasClass("block-bound")||($(n).addClass("block-bound"),$(n).on("click",(e=>{const n=$(e.target).closest(".stack").find(".block");$(e.currentTarget).toggleClass("etidable");const t=$(e.currentTarget).hasClass("etidable");n.each(((e,i)=>{const o=$(i);return t?(o.removeClass("d-none"),o.find(".block-title").removeClass("d-none"),void(e==n.length-1&&(o.find(".block-output").addClass("show"),o.find(".block-output").removeClass("d-none"),o.find(".block-output").trigger("shown")))):(o.find(".block-title").addClass("d-none"),e==n.length-1?(o.removeClass("d-none"),o.find(".block-output").addClass("show"),o.find(".block-output").removeClass("d-none"),void o.find(".block-output").trigger("shown")):void o.addClass("d-none"))}))})))})(e),(e=>{$(e).each(((e,n)=>{(e=>{const n=$(e).find(".block").last();n.removeClass("d-none");const t=n.find(".block-output");n.find(".block-title").addClass("d-none"),t.removeClass("d-none"),t.trigger("shown")})(n)}))})(e),n(e)})(t),i()}),750)})),Shiny.addCustomMessageHandler("blockr-add-block",(e=>{const t=`#${e.stack}`;setTimeout((()=>{i(),n(t)}),500)}))})()})();
\ No newline at end of file
diff --git a/inst/assets/style.min.css b/inst/assets/style.min.css
index 0fdd0bd1..8f713c75 100644
--- a/inst/assets/style.min.css
+++ b/inst/assets/style.min.css
@@ -1 +1 @@
-html .hidden{display:none}html .shown{display:block}html .block-code-output{max-height:10rem;overflow-y:auto}html .block{overflow-y:auto}html .block .block-output{overflow-y:hidden}html .block pre{border-radius:0}html .block .block-output-toggle{color:var(--bs-gray)}html .block .block-output-toggle:hover{color:var(--bs-success)}html .block .block-code-toggle{color:var(--bs-gray)}html .block .block-code-toggle:hover{color:var(--bs-info)}html .block .block-remove{color:var(--bs-gray)}html .block .block-remove:hover{color:var(--bs-danger)}html .block .block-remove,html .block .block-output-toggle,html .block .block-edit-toggle,html .block .block-code-toggle{opacity:0}html .block:hover .block-remove,html .block:hover .block-output-toggle,html .block:hover .block-edit-toggle,html .block:hover .block-code-toggle{opacity:1}html .stack-code-output{max-height:10rem;overflow:auto}html .stack .stack-edit-toggle{color:var(--bs-gray);cursor:pointer}html .stack .stack-edit-toggle:hover{color:var(--bs-primary)}html .stack .stack-copy-code{color:var(--bs-gray);cursor:pointer}html .stack .stack-copy-code:hover{color:var(--bs-info)}html .stack .stack-remove{color:var(--bs-gray)}html .stack .stack-remove:hover{color:var(--bs-danger)}html .stack .stack-remove,html .stack .stack-copy-code,html .stack .stack-edit-toggle{opacity:0}html .stack:hover .stack-remove,html .stack:hover .stack-copy-code,html .stack:hover .stack-edit-toggle{opacity:1}
+html .hidden{display:none}html .shown{display:block}html .block-code-output{max-height:10rem;overflow-y:auto}html .block{overflow-y:auto}html .block .block-output{overflow-y:hidden}html .block pre{border-radius:0}html .block .block-output-toggle{color:var(--bs-gray)}html .block .block-output-toggle:hover{color:var(--bs-success)}html .block .block-code-toggle{color:var(--bs-gray)}html .block .block-code-toggle:hover{color:var(--bs-info)}html .block .block-remove{color:var(--bs-gray)}html .block .block-remove:hover{color:var(--bs-danger)}html .block .block-feedback{font-size:.8rem}html .block .block-remove,html .block .block-output-toggle,html .block .block-edit-toggle,html .block .block-code-toggle{opacity:0}html .block:hover .block-remove,html .block:hover .block-output-toggle,html .block:hover .block-edit-toggle,html .block:hover .block-code-toggle{opacity:1}html .stack-code-output{max-height:10rem;overflow:auto}html .stack .stack-edit-toggle{color:var(--bs-gray);cursor:pointer}html .stack .stack-edit-toggle:hover{color:var(--bs-primary)}html .stack .stack-copy-code{color:var(--bs-gray);cursor:pointer}html .stack .stack-copy-code:hover{color:var(--bs-info)}html .stack .stack-remove{color:var(--bs-gray)}html .stack .stack-remove:hover{color:var(--bs-danger)}html .stack .stack-remove,html .stack .stack-copy-code,html .stack .stack-edit-toggle{opacity:0}html .stack:hover .stack-remove,html .stack:hover .stack-copy-code,html .stack:hover .stack-edit-toggle{opacity:1}
diff --git a/man/generate_ui.Rd b/man/generate_ui.Rd
index 2caccf60..059fbc4d 100644
--- a/man/generate_ui.Rd
+++ b/man/generate_ui.Rd
@@ -32,10 +32,10 @@
\alias{ui_update.numeric_field}
\alias{ui_update.hidden_field}
\alias{ui_update.list_field}
-\alias{uiOutput}
-\alias{uiOutput.block}
-\alias{uiOutput.plot_block}
-\alias{uiOutput.ggiraph_block}
+\alias{uiOutputBlock}
+\alias{uiOutputBlock.block}
+\alias{uiOutputBlock.plot_block}
+\alias{uiOutputBlock.ggiraph_block}
\alias{uiCode}
\alias{uiCode.block}
\title{UI}
@@ -102,13 +102,13 @@ ui_update(x, session, id, name)
\method{ui_update}{list_field}(x, session, id, name)
-uiOutput(x, ns)
+uiOutputBlock(x, ns)
-\method{uiOutput}{block}(x, ns)
+\method{uiOutputBlock}{block}(x, ns)
-\method{uiOutput}{plot_block}(x, ns)
+\method{uiOutputBlock}{plot_block}(x, ns)
-\method{uiOutput}{ggiraph_block}(x, ns)
+\method{uiOutputBlock}{ggiraph_block}(x, ns)
uiCode(x, ns)
diff --git a/scss/_block.scss b/scss/_block.scss
index 13ebad4e..2907829e 100644
--- a/scss/_block.scss
+++ b/scss/_block.scss
@@ -37,6 +37,10 @@ html {
}
}
+ .block-feedback {
+ font-size: .8rem;
+ }
+
.block-remove,
.block-output-toggle,
.block-edit-toggle,
diff --git a/srcjs/collapse.js b/srcjs/collapse.js
index 768e149f..d0a48fb1 100644
--- a/srcjs/collapse.js
+++ b/srcjs/collapse.js
@@ -1,16 +1,54 @@
export const collapse = (stack) => {
editor(stack);
showLastOutputs(stack);
+ toggleOutputInput(stack);
+};
+
+export const toggleOutputInput = (stack) => {
+ $(stack).find(".block-output-toggle").each((_index, btn) => {
+ // already has a listener
+ if ($(btn).hasClass("block-bound")) {
+ return;
+ }
+
+ $(btn).addClass("block-bound");
+
+ $(btn).on("click", (event) => {
+ const $block = $(event.target).closest(".block");
+
+ const outputVisible = $block.find(".block-output").is(":visible");
+ const inputVisible = $block.find(".block-input").is(":visible");
+
+ const toggle = outputVisible || inputVisible;
+
+ if (toggle) {
+ $block.find(".block-inputs").addClass("d-none");
+ $block.find(".block-output").addClass("d-none");
+ } else {
+ $block.find(".block-inputs").removeClass("d-none");
+ $block.find(".block-output").removeClass("d-none");
+ }
+
+ let ev = "shown";
+ if ($block.find(".block-output").hasClass("d-none")) {
+ ev = "hidden";
+ }
+
+ $block.find(".block-inputs").trigger(ev);
+ $block.find(".block-output").trigger(ev);
+ });
+ });
};
const editor = (stack) => {
const editBtn = $(stack).find(".stack-edit-toggle");
// already has a listener
- if (editBtn[0].getAttribute("listener")) {
+ if ($(editBtn).hasClass("block-bound")) {
return;
}
+ $(editBtn).addClass("block-bound");
$(editBtn).on("click", (event) => {
const $stack = $(event.target).closest(".stack");
const $blocks = $stack.find(".block");
@@ -23,8 +61,7 @@ const editor = (stack) => {
if (editable) {
$block.removeClass("d-none");
- $block.find(".block-inputs").removeClass("d-none");
- $block.find(".block-inputs").trigger("shown");
+ $block.find(".block-title").removeClass("d-none");
if (index == ($blocks.length - 1)) {
$block.find(".block-output").addClass("show");
@@ -34,9 +71,7 @@ const editor = (stack) => {
return;
}
- $block.find(".block-inputs").addClass("d-none");
- $block.find(".block-inputs").trigger("hidden");
-
+ $block.find(".block-title").addClass("d-none");
if (index == ($blocks.length - 1)) {
$block.removeClass("d-none");
@@ -55,10 +90,12 @@ export const showLastOutput = (el) => {
const $block = $(el).find(".block").last();
$block.removeClass("d-none");
- const lastOutput = $block.find(".block-output");
+ const $lastOutput = $block.find(".block-output");
+ const $lastTitle = $block.find(".block-title");
- bootstrap.Collapse.getOrCreateInstance(lastOutput, { toggle: false }).show();
- $(lastOutput).trigger("shown");
+ $lastTitle.addClass("d-none");
+ $lastOutput.removeClass("d-none");
+ $lastOutput.trigger("shown");
};
const showLastOutputs = (stack) => {
diff --git a/srcjs/shiny.js b/srcjs/shiny.js
index ea54c8db..7a87f006 100644
--- a/srcjs/shiny.js
+++ b/srcjs/shiny.js
@@ -1,4 +1,4 @@
-import { collapse, showLastOutput } from "./collapse.js";
+import { collapse, toggleOutputInput } from "./collapse.js";
import { remove } from "./remove-stack.js";
import { copyCode } from "./copy.js";
@@ -16,7 +16,7 @@ Shiny.addCustomMessageHandler("blockr-add-block", (msg) => {
// TODO remove this
// be event based/async instead of timeout
setTimeout(() => {
- showLastOutput(stack);
copyCode();
+ toggleOutputInput(stack);
}, 500);
});
diff --git a/test.R b/test.R
index 3a72f356..37e4cc70 100644
--- a/test.R
+++ b/test.R
@@ -4,7 +4,7 @@ library(shiny)
stack <- new_stack(
demo_data_block,
- demo_join_block
+ select_block
)
ui <- fluidPage(