@teipublisher/pb-components 1.40.2 → 1.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/demo/pb-code-editor.html +12 -9
- package/dist/{iron-form-f540b15b.js → iron-form-9e72ac45.js} +1 -1
- package/dist/jinn-codemirror-c1a4b755.js +1 -0
- package/dist/{paper-checkbox-f6a70487.js → paper-checkbox-102e3b43.js} +120 -120
- package/dist/pb-code-editor.js +22 -0
- package/dist/pb-components-bundle.js +234 -234
- package/dist/pb-edit-app.js +33 -33
- package/dist/pb-elements.json +61 -16
- package/dist/pb-i18n-6ad23bcf.js +1 -0
- package/dist/pb-message-0fb0b538.js +911 -0
- package/dist/pb-odd-editor.js +110 -82
- package/package.json +4 -5
- package/pb-elements.json +61 -16
- package/src/pb-code-editor.js +51 -663
- package/src/pb-components.js +0 -1
- package/src/pb-odd-model-editor.js +33 -23
- package/src/pb-odd-parameter-editor.js +17 -9
- package/src/pb-odd-rendition-editor.js +19 -9
- package/css/codemirror/3024-day.css +0 -41
- package/css/codemirror/3024-night.css +0 -39
- package/css/codemirror/abbott.css +0 -268
- package/css/codemirror/abcdef.css +0 -32
- package/css/codemirror/ambiance-mobile.css +0 -5
- package/css/codemirror/ambiance.css +0 -74
- package/css/codemirror/ayu-dark.css +0 -44
- package/css/codemirror/ayu-mirage.css +0 -45
- package/css/codemirror/base16-dark.css +0 -40
- package/css/codemirror/base16-light.css +0 -38
- package/css/codemirror/bespin.css +0 -34
- package/css/codemirror/blackboard.css +0 -32
- package/css/codemirror/cobalt.css +0 -25
- package/css/codemirror/colorforth.css +0 -33
- package/css/codemirror/darcula.css +0 -53
- package/css/codemirror/dracula.css +0 -40
- package/css/codemirror/duotone-dark.css +0 -35
- package/css/codemirror/duotone-light.css +0 -36
- package/css/codemirror/eclipse.css +0 -23
- package/css/codemirror/elegant.css +0 -13
- package/css/codemirror/erlang-dark.css +0 -34
- package/css/codemirror/gruvbox-dark.css +0 -39
- package/css/codemirror/hopscotch.css +0 -34
- package/css/codemirror/icecoder.css +0 -43
- package/css/codemirror/idea.css +0 -42
- package/css/codemirror/isotope.css +0 -34
- package/css/codemirror/juejin.css +0 -30
- package/css/codemirror/lesser-dark.css +0 -47
- package/css/codemirror/liquibyte.css +0 -95
- package/css/codemirror/lucario.css +0 -37
- package/css/codemirror/material-darker.css +0 -135
- package/css/codemirror/material-ocean.css +0 -141
- package/css/codemirror/material-palenight.css +0 -141
- package/css/codemirror/material.css +0 -141
- package/css/codemirror/mbo.css +0 -37
- package/css/codemirror/mdn-like.css +0 -46
- package/css/codemirror/midnight.css +0 -39
- package/css/codemirror/monokai.css +0 -41
- package/css/codemirror/moxer.css +0 -143
- package/css/codemirror/neat.css +0 -12
- package/css/codemirror/neo.css +0 -43
- package/css/codemirror/night.css +0 -27
- package/css/codemirror/nord.css +0 -42
- package/css/codemirror/oceanic-next.css +0 -46
- package/css/codemirror/panda-syntax.css +0 -85
- package/css/codemirror/paraiso-dark.css +0 -38
- package/css/codemirror/paraiso-light.css +0 -38
- package/css/codemirror/pastel-on-dark.css +0 -52
- package/css/codemirror/railscasts.css +0 -34
- package/css/codemirror/rubyblue.css +0 -25
- package/css/codemirror/seti.css +0 -44
- package/css/codemirror/shadowfox.css +0 -52
- package/css/codemirror/solarized.css +0 -168
- package/css/codemirror/ssms.css +0 -16
- package/css/codemirror/the-matrix.css +0 -30
- package/css/codemirror/tomorrow-night-bright.css +0 -35
- package/css/codemirror/tomorrow-night-eighties.css +0 -38
- package/css/codemirror/ttcn.css +0 -64
- package/css/codemirror/twilight.css +0 -32
- package/css/codemirror/vibrant-ink.css +0 -34
- package/css/codemirror/xq-dark.css +0 -53
- package/css/codemirror/xq-light.css +0 -43
- package/css/codemirror/yeti.css +0 -44
- package/css/codemirror/yonce.css +0 -59
- package/css/codemirror/zenburn.css +0 -37
- package/dist/pb-message-1a0c0c52.js +0 -1360
- package/lib/codemirror/addon/display/placeholder.js +0 -70
- package/lib/codemirror/addon/edit/matchbrackets.js +0 -152
- package/lib/codemirror/addon/lint/lint.js +0 -282
- package/lib/codemirror/mode/css/css.js +0 -855
- package/lib/codemirror/mode/stex/stex.js +0 -249
- package/lib/codemirror/mode/xml/xml.js +0 -404
- package/lib/codemirror/mode/xquery/xquery.js +0 -434
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./polymer-hack.js";import{d as t,P as e,h as n,a as r,
|
|
1
|
+
import"./polymer-hack.js";import{d as t,P as e,h as n,a as r,I as o,b as s,c as a,e as l,f as c,g as h,i as d,j as p,D as u,k as g,l as f,G as m,m as v,n as b,r as y,N as _,o as w,p as x,q as k,s as A,t as z}from"./paper-checkbox-102e3b43.js";import{u as S,p as C,P as E,E as M,T as L}from"./pb-message-0fb0b538.js";import{L as T,g as H,h as O,c as V,r as I,p as R,a as P,b as D,m as N}from"./pb-mixin-15ff531f.js";import{t as F,i as B,g as j}from"./pb-i18n-6ad23bcf.js";import"./es-global-bridge-6abe3a88.js";import"./iron-form-9e72ac45.js";
|
|
2
2
|
/**
|
|
3
3
|
@license
|
|
4
4
|
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
|
|
@@ -390,10 +390,10 @@ const X=n`
|
|
|
390
390
|
* @author Lea Verou <https://lea.verou.me>
|
|
391
391
|
* @namespace
|
|
392
392
|
* @public
|
|
393
|
-
*/"undefined"!=typeof module&&module.exports&&(module.exports=K),"undefined"!=typeof global&&(global.Prism=K),K.languages.markup={comment:/<!--[\s\S]*?-->/,prolog:/<\?[\s\S]+?\?>/,doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/,name:/[^\s<>'"]+/}},cdata:/<!\[CDATA\[[\s\S]*?\]\]>/i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},K.languages.markup.tag.inside["attr-value"].inside.entity=K.languages.markup.entity,K.languages.markup.doctype.inside["internal-subset"].inside=K.languages.markup,K.hooks.add("wrap",(function(t){"entity"===t.type&&(t.attributes.title=t.content.replace(/&/,"&"))})),Object.defineProperty(K.languages.markup.tag,"addInlined",{value:function(t,e){var i={};i["language-"+e]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:K.languages[e]},i.cdata=/^<!\[CDATA\[|\]\]>$/i;var n={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:i}};n["language-"+e]={pattern:/[\s\S]+/,inside:K.languages[e]};var r={};r[t]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,(function(){return t})),"i"),lookbehind:!0,greedy:!0,inside:n},K.languages.insertBefore("markup","cdata",r)}}),Object.defineProperty(K.languages.markup.tag,"addAttribute",{value:function(t,e){K.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[e,"language-"+e],inside:K.languages[e]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),K.languages.html=K.languages.markup,K.languages.mathml=K.languages.markup,K.languages.svg=K.languages.markup,K.languages.xml=K.languages.extend("markup",{}),K.languages.ssml=K.languages.xml,K.languages.atom=K.languages.xml,K.languages.rss=K.languages.xml,function(t){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var i=t.languages.markup;i&&(i.tag.addInlined("style","css"),i.tag.addAttribute("style","css"))}(K),K.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},K.languages.javascript=K.languages.extend("clike",{"class-name":[K.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:prototype|constructor))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:/\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),K.languages.javascript["class-name"][0].pattern=/(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/,K.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:K.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:K.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:K.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:K.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:K.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),K.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:K.languages.javascript}},string:/[\s\S]+/}}}),K.languages.markup&&(K.languages.markup.tag.addInlined("script","javascript"),K.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),K.languages.js=K.languages.javascript,function(){if(void 0!==K&&"undefined"!=typeof document){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var t="Loading…",e=function(t,e){return"✖ Error "+t+" while fetching file: "+e},i="✖ Error: File does not exist or is empty",n={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},r="data-src-status",o="loading",s="loaded",a="failed",l="pre[data-src]:not(["+r+'="'+s+'"]):not(['+r+'="'+o+'"])',c=/\blang(?:uage)?-([\w-]+)\b/i;K.hooks.add("before-highlightall",(function(t){t.selector+=", "+l})),K.hooks.add("before-sanity-check",(function(c){var h=c.element;if(h.matches(l)){c.code="",h.setAttribute(r,o);var p=h.appendChild(document.createElement("CODE"));p.textContent=t;var u=h.getAttribute("data-src"),g=c.language;if("none"===g){var f=(/\.(\w+)$/.exec(u)||[,"none"])[1];g=n[f]||f}d(p,g),d(h,g);var m=K.plugins.autoloader;m&&m.loadLanguages(g);var v=new XMLHttpRequest;v.open("GET",u,!0),v.onreadystatechange=function(){4==v.readyState&&(v.status<400&&v.responseText?(h.setAttribute(r,s),p.textContent=v.responseText,K.highlightElement(p)):(h.setAttribute(r,a),v.status>=400?p.textContent=e(v.status,v.statusText):p.textContent=i))},v.send(null)}})),K.plugins.fileHighlight={highlight:function(t){for(var e,i=(t||document).querySelectorAll(l),n=0;e=i[n++];)K.highlightElement(e)}};var h=!1;K.fileHighlight=function(){h||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),h=!0),K.plugins.fileHighlight.highlight.apply(this,arguments)}}function d(t,e){var i=t.className;i=i.replace(c," ")+" language-"+e,t.className=i.replace(/\s+/g," ").trim()}}(),function(t){t.languages.xquery=t.languages.extend("markup",{"xquery-comment":{pattern:/\(:[\s\S]*?:\)/,greedy:!0,alias:"comment"},string:{pattern:/(["'])(?:\1\1|(?!\1)[\s\S])*\1/,greedy:!0},extension:{pattern:/\(#.+?#\)/,alias:"symbol"},variable:/\$[-\w:]+/,axis:{pattern:/(^|[^-])(?:ancestor(?:-or-self)?|attribute|child|descendant(?:-or-self)?|following(?:-sibling)?|parent|preceding(?:-sibling)?|self)(?=::)/,lookbehind:!0,alias:"operator"},"keyword-operator":{pattern:/(^|[^:-])\b(?:and|castable as|div|eq|except|ge|gt|idiv|instance of|intersect|is|le|lt|mod|ne|or|union)\b(?=$|[^:-])/,lookbehind:!0,alias:"operator"},keyword:{pattern:/(^|[^:-])\b(?:as|ascending|at|base-uri|boundary-space|case|cast as|collation|construction|copy-namespaces|declare|default|descending|else|empty (?:greatest|least)|encoding|every|external|for|function|if|import|in|inherit|lax|let|map|module|namespace|no-inherit|no-preserve|option|order(?: by|ed|ing)?|preserve|return|satisfies|schema|some|stable|strict|strip|then|to|treat as|typeswitch|unordered|validate|variable|version|where|xquery)\b(?=$|[^:-])/,lookbehind:!0},function:/[\w-]+(?::[\w-]+)*(?=\s*\()/,"xquery-element":{pattern:/(element\s+)[\w-]+(?::[\w-]+)*/,lookbehind:!0,alias:"tag"},"xquery-attribute":{pattern:/(attribute\s+)[\w-]+(?::[\w-]+)*/,lookbehind:!0,alias:"attr-name"},builtin:{pattern:/(^|[^:-])\b(?:attribute|comment|document|element|processing-instruction|text|xs:(?:anyAtomicType|anyType|anyURI|base64Binary|boolean|byte|date|dateTime|dayTimeDuration|decimal|double|duration|ENTITIES|ENTITY|float|gDay|gMonth|gMonthDay|gYear|gYearMonth|hexBinary|ID|IDREFS?|int|integer|language|long|Name|NCName|negativeInteger|NMTOKENS?|nonNegativeInteger|nonPositiveInteger|normalizedString|NOTATION|positiveInteger|QName|short|string|time|token|unsigned(?:Byte|Int|Long|Short)|untyped(?:Atomic)?|yearMonthDuration))\b(?=$|[^:-])/,lookbehind:!0},number:/\b\d+(?:\.\d+)?(?:E[+-]?\d+)?/,operator:[/[+*=?|@]|\.\.?|:=|!=|<[=<]?|>[=>]?/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}],punctuation:/[[\](){},;:/]/}),t.languages.xquery.tag.pattern=/<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|\{(?!\{)(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])+\}|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,t.languages.xquery.tag.inside["attr-value"].pattern=/=(?:("|')(?:\\[\s\S]|\{(?!\{)(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])+\}|(?!\1)[^\\])*\1|[^\s'">=]+)/i,t.languages.xquery.tag.inside["attr-value"].inside.punctuation=/^="|"$/,t.languages.xquery.tag.inside["attr-value"].inside.expression={pattern:/\{(?!\{)(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])+\}/,inside:t.languages.xquery,alias:"language-xquery"};var e=function(t){return"string"==typeof t?t:"string"==typeof t.content?t.content:t.content.map(e).join("")},i=function(n){for(var r=[],o=0;o<n.length;o++){var s=n[o],a=!1;if("string"!=typeof s&&("tag"===s.type&&s.content[0]&&"tag"===s.content[0].type?"</"===s.content[0].content[0].content?r.length>0&&r[r.length-1].tagName===e(s.content[0].content[1])&&r.pop():"/>"===s.content[s.content.length-1].content||r.push({tagName:e(s.content[0].content[1]),openedBraces:0}):!(r.length>0&&"punctuation"===s.type&&"{"===s.content)||n[o+1]&&"punctuation"===n[o+1].type&&"{"===n[o+1].content||n[o-1]&&"plain-text"===n[o-1].type&&"{"===n[o-1].content?r.length>0&&r[r.length-1].openedBraces>0&&"punctuation"===s.type&&"}"===s.content?r[r.length-1].openedBraces--:"comment"!==s.type&&(a=!0):r[r.length-1].openedBraces++),(a||"string"==typeof s)&&r.length>0&&0===r[r.length-1].openedBraces){var l=e(s);o<n.length-1&&("string"==typeof n[o+1]||"plain-text"===n[o+1].type)&&(l+=e(n[o+1]),n.splice(o+1,1)),o>0&&("string"==typeof n[o-1]||"plain-text"===n[o-1].type)&&(l=e(n[o-1])+l,n.splice(o-1,1),o--),/^\s+$/.test(l)?n[o]=l:n[o]=new t.Token("plain-text",l,null,l)}s.content&&"string"!=typeof s.content&&i(s.content)}};t.hooks.add("after-tokenize",(function(t){"xquery"===t.language&&i(t.tokens)}))}(Prism),function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document){var t=Object.assign||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t};e.prototype={setDefaults:function(e){this.defaults=t(this.defaults,e)},normalize:function(e,n){for(var r in n=t(this.defaults,n)){var o=i(r);"normalize"!==r&&"setDefaults"!==o&&n[r]&&this[o]&&(e=this[o].call(this,e,n[r]))}return e},leftTrim:function(t){return t.replace(/^\s+/,"")},rightTrim:function(t){return t.replace(/\s+$/,"")},tabsToSpaces:function(t,e){return e=0|e||4,t.replace(/\t/g,new Array(++e).join(" "))},spacesToTabs:function(t,e){return e=0|e||4,t.replace(RegExp(" {"+e+"}","g"),"\t")},removeTrailing:function(t){return t.replace(/\s*?$/gm,"")},removeInitialLineFeed:function(t){return t.replace(/^(?:\r?\n|\r)/,"")},removeIndent:function(t){var e=t.match(/^[^\S\n\r]*(?=\S)/gm);return e&&e[0].length?(e.sort((function(t,e){return t.length-e.length})),e[0].length?t.replace(RegExp("^"+e[0],"gm"),""):t):t},indent:function(t,e){return t.replace(/^[^\S\n\r]*(?=\S)/gm,new Array(++e).join("\t")+"$&")},breakLines:function(t,e){e=!0===e?80:0|e||80;for(var i=t.split("\n"),r=0;r<i.length;++r)if(!(n(i[r])<=e)){for(var o=i[r].split(/(\s+)/g),s=0,a=0;a<o.length;++a){var l=n(o[a]);(s+=l)>e&&(o[a]="\n"+o[a],s=l)}i[r]=o.join("")}return i.join("\n")}},"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof Prism&&(Prism.plugins.NormalizeWhitespace=new e({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),Prism.hooks.add("before-sanity-check",(function(t){var e=Prism.plugins.NormalizeWhitespace;if((!t.settings||!1!==t.settings["whitespace-normalization"])&&Prism.util.isActive(t.element,"whitespace-normalization",!0))if(t.element&&t.element.parentNode||!t.code){var i=t.element.parentNode;if(t.code&&i&&"pre"===i.nodeName.toLowerCase()){for(var n=i.childNodes,r="",o="",s=!1,a=0;a<n.length;++a){var l=n[a];l==t.element?s=!0:"#text"===l.nodeName&&(s?o+=l.nodeValue:r+=l.nodeValue,i.removeChild(l),--a)}if(t.element.children.length&&Prism.plugins.KeepMarkup){var c=r+t.element.innerHTML+o;t.element.innerHTML=e.normalize(c,t.settings),t.code=t.element.textContent}else t.code=r+t.code+o,t.code=e.normalize(t.code,t.settings)}}else t.code=e.normalize(t.code,t.settings)})))}function e(e){this.defaults=t({},e)}function i(t){return t.replace(/-(\w)/g,(function(t,e){return e.toUpperCase()}))}function n(t){for(var e=0,i=0;i<t.length;++i)t.charCodeAt(i)=="\t".charCodeAt(0)&&(e+=3);return t.length+e}}(),function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document){var t="line-numbers",e=/\n(?!$)/g,i=Prism.plugins.lineNumbers={getLine:function(e,i){if("PRE"===e.tagName&&e.classList.contains(t)){var n=e.querySelector(".line-numbers-rows");if(n){var r=parseInt(e.getAttribute("data-start"),10)||1,o=r+(n.children.length-1);i<r&&(i=r),i>o&&(i=o);var s=i-r;return n.children[s]}}},resize:function(t){r([t])},assumeViewportIndependence:!0},n=void 0;window.addEventListener("resize",(function(){i.assumeViewportIndependence&&n===window.innerWidth||(n=window.innerWidth,r(Array.prototype.slice.call(document.querySelectorAll("pre."+t))))})),Prism.hooks.add("complete",(function(i){if(i.code){var n=i.element,o=n.parentNode;if(o&&/pre/i.test(o.nodeName)&&!n.querySelector(".line-numbers-rows")&&Prism.util.isActive(n,t)){n.classList.remove(t),o.classList.add(t);var s,a=i.code.match(e),l=a?a.length+1:1,c=new Array(l+1).join("<span></span>");(s=document.createElement("span")).setAttribute("aria-hidden","true"),s.className="line-numbers-rows",s.innerHTML=c,o.hasAttribute("data-start")&&(o.style.counterReset="linenumber "+(parseInt(o.getAttribute("data-start"),10)-1)),i.element.appendChild(s),r([o]),Prism.hooks.run("line-numbers",i)}}})),Prism.hooks.add("line-numbers",(function(t){t.plugins=t.plugins||{},t.plugins.lineNumbers=!0}))}function r(t){if(0!=(t=t.filter((function(t){var e=o(t)["white-space"];return"pre-wrap"===e||"pre-line"===e}))).length){var i=t.map((function(t){var i=t.querySelector("code"),n=t.querySelector(".line-numbers-rows");if(i&&n){var r=t.querySelector(".line-numbers-sizer"),o=i.textContent.split(e);r||((r=document.createElement("span")).className="line-numbers-sizer",i.appendChild(r)),r.innerHTML="0",r.style.display="block";var s=r.getBoundingClientRect().height;return r.innerHTML="",{element:t,lines:o,lineHeights:[],oneLinerHeight:s,sizer:r}}})).filter(Boolean);i.forEach((function(t){var e=t.sizer,i=t.lines,n=t.lineHeights,r=t.oneLinerHeight;n[i.length-1]=void 0,i.forEach((function(t,i){if(t&&t.length>1){var o=e.appendChild(document.createElement("span"));o.style.display="block",o.textContent=t}else n[i]=r}))})),i.forEach((function(t){for(var e=t.sizer,i=t.lineHeights,n=0,r=0;r<i.length;r++)void 0===i[r]&&(i[r]=e.children[n++].getBoundingClientRect().height)})),i.forEach((function(t){var e=t.sizer,i=t.element.querySelector(".line-numbers-rows");e.style.display="none",e.innerHTML="",t.lineHeights.forEach((function(t,e){i.children[e].style.height=t+"px"}))}))}}function o(t){return t?window.getComputedStyle?getComputedStyle(t):t.currentStyle||null:null}}();const Q=new Map;function Z(t){const e="default"===t?"prism.css":`prism-${t}.css`;if(Q.has(e))return console.log("Using cached theme: %s",e),Q.get(e);const i=new Promise(i=>{const n=D("../css/prismjs/")+e;console.log("<pb-code-highlight> loading theme %s from %s",t,n),fetch(n).then(t=>t.text()).catch(()=>i("")).then(t=>{i(R`<style>${t}</style>`)})});return Q.set(e,i),i}class J extends V{static get properties(){return{language:{type:String},code:{type:String},theme:{type:String},lineNumbers:{type:Boolean,attribute:"line-numbers"},_themeStyles:{type:String}}}constructor(){super(),this.language="xml",this.theme="default",this.lineNumbers=!1,this._themeStyles=null}connectedCallback(){super.connectedCallback();let t=this.getAttribute("theme");null===t&&(t=I(this,"--pb-code-highlight-theme","default"),this.setAttribute("theme",t))}firstUpdated(){if(super.firstUpdated(),!this.code){const t=this.querySelector("template");this.code=t?Prism.plugins.NormalizeWhitespace.normalize(t.innerHTML):Prism.plugins.NormalizeWhitespace.normalize(this.textContent)}}attributeChangedCallback(t,e,i){switch(super.attributeChangedCallback(t,e,i),t){case"theme":Z(i).then(t=>{this._themeStyles=t})}}updated(t){super.updated(t),t.has("code")&&this.highlight()}highlight(){Prism.highlightAllUnder(this.shadowRoot)}render(){return this.code?R`
|
|
393
|
+
*/"undefined"!=typeof module&&module.exports&&(module.exports=K),"undefined"!=typeof global&&(global.Prism=K),K.languages.markup={comment:/<!--[\s\S]*?-->/,prolog:/<\?[\s\S]+?\?>/,doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/,name:/[^\s<>'"]+/}},cdata:/<!\[CDATA\[[\s\S]*?\]\]>/i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},K.languages.markup.tag.inside["attr-value"].inside.entity=K.languages.markup.entity,K.languages.markup.doctype.inside["internal-subset"].inside=K.languages.markup,K.hooks.add("wrap",(function(t){"entity"===t.type&&(t.attributes.title=t.content.replace(/&/,"&"))})),Object.defineProperty(K.languages.markup.tag,"addInlined",{value:function(t,e){var i={};i["language-"+e]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:K.languages[e]},i.cdata=/^<!\[CDATA\[|\]\]>$/i;var n={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:i}};n["language-"+e]={pattern:/[\s\S]+/,inside:K.languages[e]};var r={};r[t]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,(function(){return t})),"i"),lookbehind:!0,greedy:!0,inside:n},K.languages.insertBefore("markup","cdata",r)}}),Object.defineProperty(K.languages.markup.tag,"addAttribute",{value:function(t,e){K.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[e,"language-"+e],inside:K.languages[e]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),K.languages.html=K.languages.markup,K.languages.mathml=K.languages.markup,K.languages.svg=K.languages.markup,K.languages.xml=K.languages.extend("markup",{}),K.languages.ssml=K.languages.xml,K.languages.atom=K.languages.xml,K.languages.rss=K.languages.xml,function(t){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var i=t.languages.markup;i&&(i.tag.addInlined("style","css"),i.tag.addAttribute("style","css"))}(K),K.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},K.languages.javascript=K.languages.extend("clike",{"class-name":[K.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:prototype|constructor))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:/\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),K.languages.javascript["class-name"][0].pattern=/(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/,K.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:K.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:K.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:K.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:K.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:K.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),K.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:K.languages.javascript}},string:/[\s\S]+/}}}),K.languages.markup&&(K.languages.markup.tag.addInlined("script","javascript"),K.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),K.languages.js=K.languages.javascript,function(){if(void 0!==K&&"undefined"!=typeof document){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var t="Loading…",e=function(t,e){return"✖ Error "+t+" while fetching file: "+e},i="✖ Error: File does not exist or is empty",n={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},r="data-src-status",o="loading",s="loaded",a="failed",l="pre[data-src]:not(["+r+'="'+s+'"]):not(['+r+'="'+o+'"])',c=/\blang(?:uage)?-([\w-]+)\b/i;K.hooks.add("before-highlightall",(function(t){t.selector+=", "+l})),K.hooks.add("before-sanity-check",(function(c){var h=c.element;if(h.matches(l)){c.code="",h.setAttribute(r,o);var p=h.appendChild(document.createElement("CODE"));p.textContent=t;var u=h.getAttribute("data-src"),g=c.language;if("none"===g){var f=(/\.(\w+)$/.exec(u)||[,"none"])[1];g=n[f]||f}d(p,g),d(h,g);var m=K.plugins.autoloader;m&&m.loadLanguages(g);var v=new XMLHttpRequest;v.open("GET",u,!0),v.onreadystatechange=function(){4==v.readyState&&(v.status<400&&v.responseText?(h.setAttribute(r,s),p.textContent=v.responseText,K.highlightElement(p)):(h.setAttribute(r,a),v.status>=400?p.textContent=e(v.status,v.statusText):p.textContent=i))},v.send(null)}})),K.plugins.fileHighlight={highlight:function(t){for(var e,i=(t||document).querySelectorAll(l),n=0;e=i[n++];)K.highlightElement(e)}};var h=!1;K.fileHighlight=function(){h||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),h=!0),K.plugins.fileHighlight.highlight.apply(this,arguments)}}function d(t,e){var i=t.className;i=i.replace(c," ")+" language-"+e,t.className=i.replace(/\s+/g," ").trim()}}(),function(t){t.languages.xquery=t.languages.extend("markup",{"xquery-comment":{pattern:/\(:[\s\S]*?:\)/,greedy:!0,alias:"comment"},string:{pattern:/(["'])(?:\1\1|(?!\1)[\s\S])*\1/,greedy:!0},extension:{pattern:/\(#.+?#\)/,alias:"symbol"},variable:/\$[-\w:]+/,axis:{pattern:/(^|[^-])(?:ancestor(?:-or-self)?|attribute|child|descendant(?:-or-self)?|following(?:-sibling)?|parent|preceding(?:-sibling)?|self)(?=::)/,lookbehind:!0,alias:"operator"},"keyword-operator":{pattern:/(^|[^:-])\b(?:and|castable as|div|eq|except|ge|gt|idiv|instance of|intersect|is|le|lt|mod|ne|or|union)\b(?=$|[^:-])/,lookbehind:!0,alias:"operator"},keyword:{pattern:/(^|[^:-])\b(?:as|ascending|at|base-uri|boundary-space|case|cast as|collation|construction|copy-namespaces|declare|default|descending|else|empty (?:greatest|least)|encoding|every|external|for|function|if|import|in|inherit|lax|let|map|module|namespace|no-inherit|no-preserve|option|order(?: by|ed|ing)?|preserve|return|satisfies|schema|some|stable|strict|strip|then|to|treat as|typeswitch|unordered|validate|variable|version|where|xquery)\b(?=$|[^:-])/,lookbehind:!0},function:/[\w-]+(?::[\w-]+)*(?=\s*\()/,"xquery-element":{pattern:/(element\s+)[\w-]+(?::[\w-]+)*/,lookbehind:!0,alias:"tag"},"xquery-attribute":{pattern:/(attribute\s+)[\w-]+(?::[\w-]+)*/,lookbehind:!0,alias:"attr-name"},builtin:{pattern:/(^|[^:-])\b(?:attribute|comment|document|element|processing-instruction|text|xs:(?:anyAtomicType|anyType|anyURI|base64Binary|boolean|byte|date|dateTime|dayTimeDuration|decimal|double|duration|ENTITIES|ENTITY|float|gDay|gMonth|gMonthDay|gYear|gYearMonth|hexBinary|ID|IDREFS?|int|integer|language|long|Name|NCName|negativeInteger|NMTOKENS?|nonNegativeInteger|nonPositiveInteger|normalizedString|NOTATION|positiveInteger|QName|short|string|time|token|unsigned(?:Byte|Int|Long|Short)|untyped(?:Atomic)?|yearMonthDuration))\b(?=$|[^:-])/,lookbehind:!0},number:/\b\d+(?:\.\d+)?(?:E[+-]?\d+)?/,operator:[/[+*=?|@]|\.\.?|:=|!=|<[=<]?|>[=>]?/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}],punctuation:/[[\](){},;:/]/}),t.languages.xquery.tag.pattern=/<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|\{(?!\{)(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])+\}|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,t.languages.xquery.tag.inside["attr-value"].pattern=/=(?:("|')(?:\\[\s\S]|\{(?!\{)(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])+\}|(?!\1)[^\\])*\1|[^\s'">=]+)/i,t.languages.xquery.tag.inside["attr-value"].inside.punctuation=/^="|"$/,t.languages.xquery.tag.inside["attr-value"].inside.expression={pattern:/\{(?!\{)(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])+\}/,inside:t.languages.xquery,alias:"language-xquery"};var e=function(t){return"string"==typeof t?t:"string"==typeof t.content?t.content:t.content.map(e).join("")},i=function(n){for(var r=[],o=0;o<n.length;o++){var s=n[o],a=!1;if("string"!=typeof s&&("tag"===s.type&&s.content[0]&&"tag"===s.content[0].type?"</"===s.content[0].content[0].content?r.length>0&&r[r.length-1].tagName===e(s.content[0].content[1])&&r.pop():"/>"===s.content[s.content.length-1].content||r.push({tagName:e(s.content[0].content[1]),openedBraces:0}):!(r.length>0&&"punctuation"===s.type&&"{"===s.content)||n[o+1]&&"punctuation"===n[o+1].type&&"{"===n[o+1].content||n[o-1]&&"plain-text"===n[o-1].type&&"{"===n[o-1].content?r.length>0&&r[r.length-1].openedBraces>0&&"punctuation"===s.type&&"}"===s.content?r[r.length-1].openedBraces--:"comment"!==s.type&&(a=!0):r[r.length-1].openedBraces++),(a||"string"==typeof s)&&r.length>0&&0===r[r.length-1].openedBraces){var l=e(s);o<n.length-1&&("string"==typeof n[o+1]||"plain-text"===n[o+1].type)&&(l+=e(n[o+1]),n.splice(o+1,1)),o>0&&("string"==typeof n[o-1]||"plain-text"===n[o-1].type)&&(l=e(n[o-1])+l,n.splice(o-1,1),o--),/^\s+$/.test(l)?n[o]=l:n[o]=new t.Token("plain-text",l,null,l)}s.content&&"string"!=typeof s.content&&i(s.content)}};t.hooks.add("after-tokenize",(function(t){"xquery"===t.language&&i(t.tokens)}))}(Prism),function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document){var t=Object.assign||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t};e.prototype={setDefaults:function(e){this.defaults=t(this.defaults,e)},normalize:function(e,n){for(var r in n=t(this.defaults,n)){var o=i(r);"normalize"!==r&&"setDefaults"!==o&&n[r]&&this[o]&&(e=this[o].call(this,e,n[r]))}return e},leftTrim:function(t){return t.replace(/^\s+/,"")},rightTrim:function(t){return t.replace(/\s+$/,"")},tabsToSpaces:function(t,e){return e=0|e||4,t.replace(/\t/g,new Array(++e).join(" "))},spacesToTabs:function(t,e){return e=0|e||4,t.replace(RegExp(" {"+e+"}","g"),"\t")},removeTrailing:function(t){return t.replace(/\s*?$/gm,"")},removeInitialLineFeed:function(t){return t.replace(/^(?:\r?\n|\r)/,"")},removeIndent:function(t){var e=t.match(/^[^\S\n\r]*(?=\S)/gm);return e&&e[0].length?(e.sort((function(t,e){return t.length-e.length})),e[0].length?t.replace(RegExp("^"+e[0],"gm"),""):t):t},indent:function(t,e){return t.replace(/^[^\S\n\r]*(?=\S)/gm,new Array(++e).join("\t")+"$&")},breakLines:function(t,e){e=!0===e?80:0|e||80;for(var i=t.split("\n"),r=0;r<i.length;++r)if(!(n(i[r])<=e)){for(var o=i[r].split(/(\s+)/g),s=0,a=0;a<o.length;++a){var l=n(o[a]);(s+=l)>e&&(o[a]="\n"+o[a],s=l)}i[r]=o.join("")}return i.join("\n")}},"undefined"!=typeof module&&module.exports&&(module.exports=e),"undefined"!=typeof Prism&&(Prism.plugins.NormalizeWhitespace=new e({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),Prism.hooks.add("before-sanity-check",(function(t){var e=Prism.plugins.NormalizeWhitespace;if((!t.settings||!1!==t.settings["whitespace-normalization"])&&Prism.util.isActive(t.element,"whitespace-normalization",!0))if(t.element&&t.element.parentNode||!t.code){var i=t.element.parentNode;if(t.code&&i&&"pre"===i.nodeName.toLowerCase()){for(var n=i.childNodes,r="",o="",s=!1,a=0;a<n.length;++a){var l=n[a];l==t.element?s=!0:"#text"===l.nodeName&&(s?o+=l.nodeValue:r+=l.nodeValue,i.removeChild(l),--a)}if(t.element.children.length&&Prism.plugins.KeepMarkup){var c=r+t.element.innerHTML+o;t.element.innerHTML=e.normalize(c,t.settings),t.code=t.element.textContent}else t.code=r+t.code+o,t.code=e.normalize(t.code,t.settings)}}else t.code=e.normalize(t.code,t.settings)})))}function e(e){this.defaults=t({},e)}function i(t){return t.replace(/-(\w)/g,(function(t,e){return e.toUpperCase()}))}function n(t){for(var e=0,i=0;i<t.length;++i)t.charCodeAt(i)=="\t".charCodeAt(0)&&(e+=3);return t.length+e}}(),function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document){var t="line-numbers",e=/\n(?!$)/g,i=Prism.plugins.lineNumbers={getLine:function(e,i){if("PRE"===e.tagName&&e.classList.contains(t)){var n=e.querySelector(".line-numbers-rows");if(n){var r=parseInt(e.getAttribute("data-start"),10)||1,o=r+(n.children.length-1);i<r&&(i=r),i>o&&(i=o);var s=i-r;return n.children[s]}}},resize:function(t){r([t])},assumeViewportIndependence:!0},n=void 0;window.addEventListener("resize",(function(){i.assumeViewportIndependence&&n===window.innerWidth||(n=window.innerWidth,r(Array.prototype.slice.call(document.querySelectorAll("pre."+t))))})),Prism.hooks.add("complete",(function(i){if(i.code){var n=i.element,o=n.parentNode;if(o&&/pre/i.test(o.nodeName)&&!n.querySelector(".line-numbers-rows")&&Prism.util.isActive(n,t)){n.classList.remove(t),o.classList.add(t);var s,a=i.code.match(e),l=a?a.length+1:1,c=new Array(l+1).join("<span></span>");(s=document.createElement("span")).setAttribute("aria-hidden","true"),s.className="line-numbers-rows",s.innerHTML=c,o.hasAttribute("data-start")&&(o.style.counterReset="linenumber "+(parseInt(o.getAttribute("data-start"),10)-1)),i.element.appendChild(s),r([o]),Prism.hooks.run("line-numbers",i)}}})),Prism.hooks.add("line-numbers",(function(t){t.plugins=t.plugins||{},t.plugins.lineNumbers=!0}))}function r(t){if(0!=(t=t.filter((function(t){var e=o(t)["white-space"];return"pre-wrap"===e||"pre-line"===e}))).length){var i=t.map((function(t){var i=t.querySelector("code"),n=t.querySelector(".line-numbers-rows");if(i&&n){var r=t.querySelector(".line-numbers-sizer"),o=i.textContent.split(e);r||((r=document.createElement("span")).className="line-numbers-sizer",i.appendChild(r)),r.innerHTML="0",r.style.display="block";var s=r.getBoundingClientRect().height;return r.innerHTML="",{element:t,lines:o,lineHeights:[],oneLinerHeight:s,sizer:r}}})).filter(Boolean);i.forEach((function(t){var e=t.sizer,i=t.lines,n=t.lineHeights,r=t.oneLinerHeight;n[i.length-1]=void 0,i.forEach((function(t,i){if(t&&t.length>1){var o=e.appendChild(document.createElement("span"));o.style.display="block",o.textContent=t}else n[i]=r}))})),i.forEach((function(t){for(var e=t.sizer,i=t.lineHeights,n=0,r=0;r<i.length;r++)void 0===i[r]&&(i[r]=e.children[n++].getBoundingClientRect().height)})),i.forEach((function(t){var e=t.sizer,i=t.element.querySelector(".line-numbers-rows");e.style.display="none",e.innerHTML="",t.lineHeights.forEach((function(t,e){i.children[e].style.height=t+"px"}))}))}}function o(t){return t?window.getComputedStyle?getComputedStyle(t):t.currentStyle||null:null}}();const Q=new Map;function Z(t){const e="default"===t?"prism.css":`prism-${t}.css`;if(Q.has(e))return console.log("Using cached theme: %s",e),Q.get(e);const i=new Promise(i=>{const n=I("../css/prismjs/")+e;console.log("<pb-code-highlight> loading theme %s from %s",t,n),fetch(n).then(t=>t.text()).catch(()=>i("")).then(t=>{i(O`<style>${t}</style>`)})});return Q.set(e,i),i}class J extends T{static get properties(){return{language:{type:String},code:{type:String},theme:{type:String},lineNumbers:{type:Boolean,attribute:"line-numbers"},_themeStyles:{type:String}}}constructor(){super(),this.language="xml",this.theme="default",this.lineNumbers=!1,this._themeStyles=null}connectedCallback(){super.connectedCallback();let t=this.getAttribute("theme");null===t&&(t=H(this,"--pb-code-highlight-theme","default"),this.setAttribute("theme",t))}firstUpdated(){if(super.firstUpdated(),!this.code){const t=this.querySelector("template");this.code=t?Prism.plugins.NormalizeWhitespace.normalize(t.innerHTML):Prism.plugins.NormalizeWhitespace.normalize(this.textContent)}}attributeChangedCallback(t,e,i){switch(super.attributeChangedCallback(t,e,i),t){case"theme":Z(i).then(t=>{this._themeStyles=t})}}updated(t){super.updated(t),t.has("code")&&this.highlight()}highlight(){Prism.highlightAllUnder(this.shadowRoot)}render(){return this.code?O`
|
|
394
394
|
${this._themeStyles}
|
|
395
395
|
<pre class="${this.lineNumbers?"line-numbers":""} language-${this.language}"><code>${this.code}</code></pre>
|
|
396
|
-
`:
|
|
396
|
+
`:O`<pre class="line-numbers"><code><code></pre>`}static get styles(){return V`
|
|
397
397
|
:host {
|
|
398
398
|
display: block;
|
|
399
399
|
}
|
|
@@ -445,18 +445,18 @@ const X=n`
|
|
|
445
445
|
padding-right: 0.8em;
|
|
446
446
|
text-align: right;
|
|
447
447
|
}
|
|
448
|
-
`}}customElements.define("pb-code-highlight",J);const tt="https://teipublisher.com/exist/apps/tei-publisher";class et extends
|
|
448
|
+
`}}customElements.define("pb-code-highlight",J);const tt="https://teipublisher.com/exist/apps/tei-publisher";class et extends T{static get properties(){return{title:{type:String},code:{type:String},_editorLoaded:{type:Boolean},_showCodeLabel:{type:String},_editCodeLabel:{type:String}}}constructor(){super(),this.title="TEI Publisher Webcomponents Example",this.code="Loading ...",this._showCodeLabel="demo.showCode.show"}connectedCallback(){super.connectedCallback();const t=this.querySelector("template");this.code=et.removeIndent(t.innerHTML),this.code=this.code.replace(/\s*<style[\s\S]*>[\s\S]*?<\/style>\s*/g,"");const e=document.importNode(t.content,!0);this.appendChild(e)}render(){let t=this.code.replace(/(endpoint="[^"]+")/,`endpoint="${tt}"`);t=et.indent(t,2);const e=this.querySelector("style");let i="";e&&(i=e.innerText);const n="\n@import url('https://fonts.googleapis.com/css?family=Oswald|Roboto&display=swap');\n\nbody {\n margin: 10px 20px;\n font-size: 16px;\n font-family: 'Roboto', 'Noto', sans - serif;\n line-height: 1.42857;\n font-weight: 300;\n color: #333333;\n\n --paper-tooltip-delay-in: 200;\n}\n\n"+et.removeIndent(i),r=`\n<html>\n <head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <meta http-equiv="X-UA-Compatible" content="ie=edge">\n\n <title>${this.title}</title>\n <script src="https://unpkg.com/@webcomponents/webcomponentsjs@2.4.3/webcomponents-loader.js"><\/script>\n <script type="module" src="https://unpkg.com/@teipublisher/pb-components@latest/dist/pb-components-bundle.js"><\/script>\n <script type="module" src="https://unpkg.com/@teipublisher/pb-components@latest/dist/pb-leaflet-map.js"><\/script>\n </head>\n\n <body>\n ${t}\n </body>\n</html>`,o={title:this.title,html:r,html_pre_processor:"none",css:n,css_starter:"normalize",template:!1,editors:110};return O`
|
|
449
449
|
<div class="snippet"><slot></slot></div>
|
|
450
450
|
<pb-code-highlight id="source" theme="coy" language="html" line-numbers .code="${this.code}"></pb-code-highlight>
|
|
451
451
|
<div id="container"></div>
|
|
452
452
|
<div class="buttons">
|
|
453
|
-
<button class="pretty-button" @click="${this._showCode}">${
|
|
453
|
+
<button class="pretty-button" @click="${this._showCode}">${F(this._showCodeLabel)}</button>
|
|
454
454
|
<form action="https://codepen.io/pen/define" method="POST" target="_blank">
|
|
455
|
-
<input type="hidden" name="data" .value="${JSON.stringify(
|
|
456
|
-
<button class="pretty-button" type="submit">${
|
|
455
|
+
<input type="hidden" name="data" .value="${JSON.stringify(o)}">
|
|
456
|
+
<button class="pretty-button" type="submit">${F("demo.editCode.show")}</button>
|
|
457
457
|
</form>
|
|
458
458
|
</div>
|
|
459
|
-
`}_showCode(){const t=this.shadowRoot.getElementById("source");t.classList.contains("open")?(t.classList.remove("open"),this._showCodeLabel="demo.showCode.show"):(t.classList.add("open"),this._showCodeLabel="demo.showCode.hide")}static removeIndent(t){const e=t.match(/^[^\S]*(?=\S)/gm);return e&&e[0].length?(e.sort((t,e)=>t.length-e.length),e[0].length?t.replace(RegExp("^"+e[0],"gm"),""):t):t}static indent(t,e){return t.replace(/^[^\S\n\r]*(?=\S)/gm,new Array(++e).join("\t")+"$&")}static get styles(){return
|
|
459
|
+
`}_showCode(){const t=this.shadowRoot.getElementById("source");t.classList.contains("open")?(t.classList.remove("open"),this._showCodeLabel="demo.showCode.show"):(t.classList.add("open"),this._showCodeLabel="demo.showCode.hide")}static removeIndent(t){const e=t.match(/^[^\S]*(?=\S)/gm);return e&&e[0].length?(e.sort((t,e)=>t.length-e.length),e[0].length?t.replace(RegExp("^"+e[0],"gm"),""):t):t}static indent(t,e){return t.replace(/^[^\S\n\r]*(?=\S)/gm,new Array(++e).join("\t")+"$&")}static get styles(){return V`
|
|
460
460
|
:host {
|
|
461
461
|
display: block;
|
|
462
462
|
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);
|
|
@@ -507,7 +507,7 @@ const X=n`
|
|
|
507
507
|
border-color: #999;
|
|
508
508
|
color: #999;
|
|
509
509
|
}
|
|
510
|
-
`}}customElements.define("pb-demo-snippet",et);class it{static subscribe(t,e,i,n=!1){e&&!Array.isArray(e)&&(e=[e]);const r=document.addEventListener(t,t=>{(e||t.detail&&t.detail.key)&&!(e&&t.detail&&t.detail.key&&e.indexOf(t.detail.key)>-1)||i&&i(t,r)},{once:n})}static subscribeOnce(t,e=null){return e&&!Array.isArray(e)&&(e=[e]),new Promise(i=>{document.addEventListener(t,t=>{(e||t.detail&&t.detail.key)&&!(e&&t.detail&&t.detail.key&&e.indexOf(t.detail.key)>-1)||i(t)},{once:!0})})}static emit(t,e=null,i=null){const n=i||{};e&&(n.key=e);const r=new CustomEvent(t,{detail:n});document.dispatchEvent(r)}}window.pbEvents||(window.pbEvents=it);const nt="1.40.2";class rt extends V{static get properties(){return Object.assign({version:{type:String,reflect:!0}},super.properties)}constructor(){super(),this.version=nt}connectedCallback(){if(super.connectedCallback(),!this.version){const t=D("../package.json");fetch(t).then(t=>t.json()).then(t=>{this.version=t.version})}}render(){return R`<span>${this.version?this.version:"unknown"}</span>`}createRenderRoot(){return this}}customElements.define("pb-version",rt);var ot="top",st="bottom",at="right",lt="left",ct="auto",ht=[ot,st,at,lt],dt="start",pt="end",ut="clippingParents",gt="viewport",ft="popper",mt="reference",vt=ht.reduce((function(t,e){return t.concat([e+"-"+dt,e+"-"+pt])}),[]),bt=[].concat(ht,[ct]).reduce((function(t,e){return t.concat([e,e+"-"+dt,e+"-"+pt])}),[]),yt=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function _t(t){return t?(t.nodeName||"").toLowerCase():null}function wt(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function xt(t){return t instanceof wt(t).Element||t instanceof Element}function kt(t){return t instanceof wt(t).HTMLElement||t instanceof HTMLElement}function At(t){return"undefined"!=typeof ShadowRoot&&(t instanceof wt(t).ShadowRoot||t instanceof ShadowRoot)}function zt(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var i=e.styles[t]||{},n=e.attributes[t]||{},r=e.elements[t];kt(r)&&_t(r)&&(Object.assign(r.style,i),Object.keys(n).forEach((function(t){var e=n[t];!1===e?r.removeAttribute(t):r.setAttribute(t,!0===e?"":e)})))}))}function St(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow),function(){Object.keys(e.elements).forEach((function(t){var n=e.elements[t],r=e.attributes[t]||{},o=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:i[t]).reduce((function(t,e){return t[e]="",t}),{});kt(n)&&_t(n)&&(Object.assign(n.style,o),Object.keys(r).forEach((function(t){n.removeAttribute(t)})))}))}}var Ct={name:"applyStyles",enabled:!0,phase:"write",fn:zt,effect:St,requires:["computeStyles"]};function Et(t){return t.split("-")[0]}function Mt(t){var e=t.getBoundingClientRect();return{width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left,x:e.left,y:e.top}}function Lt(t){var e=Mt(t),i=t.offsetWidth,n=t.offsetHeight;return Math.abs(e.width-i)<=1&&(i=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:t.offsetLeft,y:t.offsetTop,width:i,height:n}}function Tt(t,e){var i=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(i&&At(i)){var n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function Ht(t){return wt(t).getComputedStyle(t)}function Ot(t){return["table","td","th"].indexOf(_t(t))>=0}function $t(t){return((xt(t)?t.ownerDocument:t.document)||window.document).documentElement}function Vt(t){return"html"===_t(t)?t:t.assignedSlot||t.parentNode||(At(t)?t.host:null)||$t(t)}function It(t){return kt(t)&&"fixed"!==Ht(t).position?t.offsetParent:null}function Rt(t){var e=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&kt(t)&&"fixed"===Ht(t).position)return null;for(var i=Vt(t);kt(i)&&["html","body"].indexOf(_t(i))<0;){var n=Ht(i);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||e&&"filter"===n.willChange||e&&n.filter&&"none"!==n.filter)return i;i=i.parentNode}return null}function Pt(t){for(var e=wt(t),i=It(t);i&&Ot(i)&&"static"===Ht(i).position;)i=It(i);return i&&("html"===_t(i)||"body"===_t(i)&&"static"===Ht(i).position)?e:i||Rt(t)||e}function Dt(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}var Nt=Math.max,Ft=Math.min,Bt=Math.round;function jt(t,e,i){return Nt(t,Ft(e,i))}function qt(){return{top:0,right:0,bottom:0,left:0}}function Ut(t){return Object.assign({},qt(),t)}function Wt(t,e){return e.reduce((function(e,i){return e[i]=t,e}),{})}var Yt=function(t,e){return Ut("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:Wt(t,ht))};function Gt(t){var e,i=t.state,n=t.name,r=t.options,o=i.elements.arrow,s=i.modifiersData.popperOffsets,a=Et(i.placement),l=Dt(a),c=[lt,at].indexOf(a)>=0?"height":"width";if(o&&s){var h=Yt(r.padding,i),d=Lt(o),p="y"===l?ot:lt,u="y"===l?st:at,g=i.rects.reference[c]+i.rects.reference[l]-s[l]-i.rects.popper[c],f=s[l]-i.rects.reference[l],m=Pt(o),v=m?"y"===l?m.clientHeight||0:m.clientWidth||0:0,b=g/2-f/2,y=h[p],_=v-d[c]-h[u],w=v/2-d[c]/2+b,x=jt(y,w,_),k=l;i.modifiersData[n]=((e={})[k]=x,e.centerOffset=x-w,e)}}function Xt(t){var e=t.state,i=t.options.element,n=void 0===i?"[data-popper-arrow]":i;null!=n&&("string"!=typeof n||(n=e.elements.popper.querySelector(n)))&&Tt(e.elements.popper,n)&&(e.elements.arrow=n)}var Kt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Qt(t){var e=t.x,i=t.y,n=window.devicePixelRatio||1;return{x:Bt(Bt(e*n)/n)||0,y:Bt(Bt(i*n)/n)||0}}function Zt(t){var e,i=t.popper,n=t.popperRect,r=t.placement,o=t.offsets,s=t.position,a=t.gpuAcceleration,l=t.adaptive,c=t.roundOffsets,h=!0===c?Qt(o):"function"==typeof c?c(o):o,d=h.x,p=void 0===d?0:d,u=h.y,g=void 0===u?0:u,f=o.hasOwnProperty("x"),m=o.hasOwnProperty("y"),v=lt,b=ot,y=window;if(l){var _=Pt(i),w="clientHeight",x="clientWidth";_===wt(i)&&"static"!==Ht(_=$t(i)).position&&(w="scrollHeight",x="scrollWidth"),_=_,r===ot&&(b=st,g-=_[w]-n.height,g*=a?1:-1),r===lt&&(v=at,p-=_[x]-n.width,p*=a?1:-1)}var k,A=Object.assign({position:s},l&&Kt);return a?Object.assign({},A,((k={})[b]=m?"0":"",k[v]=f?"0":"",k.transform=(y.devicePixelRatio||1)<2?"translate("+p+"px, "+g+"px)":"translate3d("+p+"px, "+g+"px, 0)",k)):Object.assign({},A,((e={})[b]=m?g+"px":"",e[v]=f?p+"px":"",e.transform="",e))}function Jt(t){var e=t.state,i=t.options,n=i.gpuAcceleration,r=void 0===n||n,o=i.adaptive,s=void 0===o||o,a=i.roundOffsets,l=void 0===a||a,c={placement:Et(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,Zt(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:l})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,Zt(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}var te={passive:!0};function ee(t){var e=t.state,i=t.instance,n=t.options,r=n.scroll,o=void 0===r||r,s=n.resize,a=void 0===s||s,l=wt(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&c.forEach((function(t){t.addEventListener("scroll",i.update,te)})),a&&l.addEventListener("resize",i.update,te),function(){o&&c.forEach((function(t){t.removeEventListener("scroll",i.update,te)})),a&&l.removeEventListener("resize",i.update,te)}}var ie={left:"right",right:"left",bottom:"top",top:"bottom"};function ne(t){return t.replace(/left|right|bottom|top/g,(function(t){return ie[t]}))}var re={start:"end",end:"start"};function oe(t){return t.replace(/start|end/g,(function(t){return re[t]}))}function se(t){var e=wt(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function ae(t){return Mt($t(t)).left+se(t).scrollLeft}function le(t){var e=wt(t),i=$t(t),n=e.visualViewport,r=i.clientWidth,o=i.clientHeight,s=0,a=0;return n&&(r=n.width,o=n.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(s=n.offsetLeft,a=n.offsetTop)),{width:r,height:o,x:s+ae(t),y:a}}function ce(t){var e,i=$t(t),n=se(t),r=null==(e=t.ownerDocument)?void 0:e.body,o=Nt(i.scrollWidth,i.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),s=Nt(i.scrollHeight,i.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-n.scrollLeft+ae(t),l=-n.scrollTop;return"rtl"===Ht(r||i).direction&&(a+=Nt(i.clientWidth,r?r.clientWidth:0)-o),{width:o,height:s,x:a,y:l}}function he(t){var e=Ht(t),i=e.overflow,n=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(i+r+n)}function de(t){return["html","body","#document"].indexOf(_t(t))>=0?t.ownerDocument.body:kt(t)&&he(t)?t:de(Vt(t))}function pe(t,e){var i;void 0===e&&(e=[]);var n=de(t),r=n===(null==(i=t.ownerDocument)?void 0:i.body),o=wt(n),s=r?[o].concat(o.visualViewport||[],he(n)?n:[]):n,a=e.concat(s);return r?a:a.concat(pe(Vt(s)))}function ue(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function ge(t){var e=Mt(t);return e.top=e.top+t.clientTop,e.left=e.left+t.clientLeft,e.bottom=e.top+t.clientHeight,e.right=e.left+t.clientWidth,e.width=t.clientWidth,e.height=t.clientHeight,e.x=e.left,e.y=e.top,e}function fe(t,e){return e===gt?ue(le(t)):kt(e)?ge(e):ue(ce($t(t)))}function me(t){var e=pe(Vt(t)),i=["absolute","fixed"].indexOf(Ht(t).position)>=0&&kt(t)?Pt(t):t;return xt(i)?e.filter((function(t){return xt(t)&&Tt(t,i)&&"body"!==_t(t)})):[]}function ve(t,e,i){var n="clippingParents"===e?me(t):[].concat(e),r=[].concat(n,[i]),o=r[0],s=r.reduce((function(e,i){var n=fe(t,i);return e.top=Nt(n.top,e.top),e.right=Ft(n.right,e.right),e.bottom=Ft(n.bottom,e.bottom),e.left=Nt(n.left,e.left),e}),fe(t,o));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function be(t){return t.split("-")[1]}function ye(t){var e,i=t.reference,n=t.element,r=t.placement,o=r?Et(r):null,s=r?be(r):null,a=i.x+i.width/2-n.width/2,l=i.y+i.height/2-n.height/2;switch(o){case ot:e={x:a,y:i.y-n.height};break;case st:e={x:a,y:i.y+i.height};break;case at:e={x:i.x+i.width,y:l};break;case lt:e={x:i.x-n.width,y:l};break;default:e={x:i.x,y:i.y}}var c=o?Dt(o):null;if(null!=c){var h="y"===c?"height":"width";switch(s){case dt:e[c]=e[c]-(i[h]/2-n[h]/2);break;case pt:e[c]=e[c]+(i[h]/2-n[h]/2)}}return e}function _e(t,e){void 0===e&&(e={});var i=e,n=i.placement,r=void 0===n?t.placement:n,o=i.boundary,s=void 0===o?ut:o,a=i.rootBoundary,l=void 0===a?gt:a,c=i.elementContext,h=void 0===c?ft:c,d=i.altBoundary,p=void 0!==d&&d,u=i.padding,g=void 0===u?0:u,f=Ut("number"!=typeof g?g:Wt(g,ht)),m=h===ft?mt:ft,v=t.elements.reference,b=t.rects.popper,y=t.elements[p?m:h],_=ve(xt(y)?y:y.contextElement||$t(t.elements.popper),s,l),w=Mt(v),x=ye({reference:w,element:b,strategy:"absolute",placement:r}),k=ue(Object.assign({},b,x)),A=h===ft?k:w,z={top:_.top-A.top+f.top,bottom:A.bottom-_.bottom+f.bottom,left:_.left-A.left+f.left,right:A.right-_.right+f.right},S=t.modifiersData.offset;if(h===ft&&S){var C=S[r];Object.keys(z).forEach((function(t){var e=[at,st].indexOf(t)>=0?1:-1,i=[ot,st].indexOf(t)>=0?"y":"x";z[t]+=C[i]*e}))}return z}function we(t,e){void 0===e&&(e={});var i=e,n=i.placement,r=i.boundary,o=i.rootBoundary,s=i.padding,a=i.flipVariations,l=i.allowedAutoPlacements,c=void 0===l?bt:l,h=be(n),d=h?a?vt:vt.filter((function(t){return be(t)===h})):ht,p=d.filter((function(t){return c.indexOf(t)>=0}));0===p.length&&(p=d);var u=p.reduce((function(e,i){return e[i]=_e(t,{placement:i,boundary:r,rootBoundary:o,padding:s})[Et(i)],e}),{});return Object.keys(u).sort((function(t,e){return u[t]-u[e]}))}function xe(t){if(Et(t)===ct)return[];var e=ne(t);return[oe(t),e,oe(e)]}function ke(t){var e=t.state,i=t.options,n=t.name;if(!e.modifiersData[n]._skip){for(var r=i.mainAxis,o=void 0===r||r,s=i.altAxis,a=void 0===s||s,l=i.fallbackPlacements,c=i.padding,h=i.boundary,d=i.rootBoundary,p=i.altBoundary,u=i.flipVariations,g=void 0===u||u,f=i.allowedAutoPlacements,m=e.options.placement,v=Et(m),b=l||(v===m||!g?[ne(m)]:xe(m)),y=[m].concat(b).reduce((function(t,i){return t.concat(Et(i)===ct?we(e,{placement:i,boundary:h,rootBoundary:d,padding:c,flipVariations:g,allowedAutoPlacements:f}):i)}),[]),_=e.rects.reference,w=e.rects.popper,x=new Map,k=!0,A=y[0],z=0;z<y.length;z++){var S=y[z],C=Et(S),E=be(S)===dt,M=[ot,st].indexOf(C)>=0,L=M?"width":"height",T=_e(e,{placement:S,boundary:h,rootBoundary:d,altBoundary:p,padding:c}),H=M?E?at:lt:E?st:ot;_[L]>w[L]&&(H=ne(H));var O=ne(H),$=[];if(o&&$.push(T[C]<=0),a&&$.push(T[H]<=0,T[O]<=0),$.every((function(t){return t}))){A=S,k=!1;break}x.set(S,$)}if(k)for(var V=function(t){var e=y.find((function(e){var i=x.get(e);if(i)return i.slice(0,t).every((function(t){return t}))}));if(e)return A=e,"break"},I=g?3:1;I>0;I--){if("break"===V(I))break}e.placement!==A&&(e.modifiersData[n]._skip=!0,e.placement=A,e.reset=!0)}}function Ae(t,e,i){return void 0===i&&(i={x:0,y:0}),{top:t.top-e.height-i.y,right:t.right-e.width+i.x,bottom:t.bottom-e.height+i.y,left:t.left-e.width-i.x}}function ze(t){return[ot,at,st,lt].some((function(e){return t[e]>=0}))}function Se(t){var e=t.state,i=t.name,n=e.rects.reference,r=e.rects.popper,o=e.modifiersData.preventOverflow,s=_e(e,{elementContext:"reference"}),a=_e(e,{altBoundary:!0}),l=Ae(s,n),c=Ae(a,r,o),h=ze(l),d=ze(c);e.modifiersData[i]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:h,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":d})}function Ce(t,e,i){var n=Et(t),r=[lt,ot].indexOf(n)>=0?-1:1,o="function"==typeof i?i(Object.assign({},e,{placement:t})):i,s=o[0],a=o[1];return s=s||0,a=(a||0)*r,[lt,at].indexOf(n)>=0?{x:a,y:s}:{x:s,y:a}}function Ee(t){var e=t.state,i=t.options,n=t.name,r=i.offset,o=void 0===r?[0,0]:r,s=bt.reduce((function(t,i){return t[i]=Ce(i,e.rects,o),t}),{}),a=s[e.placement],l=a.x,c=a.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[n]=s}function Me(t){var e=t.state,i=t.name;e.modifiersData[i]=ye({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}function Le(t){return"x"===t?"y":"x"}function Te(t){var e=t.state,i=t.options,n=t.name,r=i.mainAxis,o=void 0===r||r,s=i.altAxis,a=void 0!==s&&s,l=i.boundary,c=i.rootBoundary,h=i.altBoundary,d=i.padding,p=i.tether,u=void 0===p||p,g=i.tetherOffset,f=void 0===g?0:g,m=_e(e,{boundary:l,rootBoundary:c,padding:d,altBoundary:h}),v=Et(e.placement),b=be(e.placement),y=!b,_=Dt(v),w=Le(_),x=e.modifiersData.popperOffsets,k=e.rects.reference,A=e.rects.popper,z="function"==typeof f?f(Object.assign({},e.rects,{placement:e.placement})):f,S={x:0,y:0};if(x){if(o||a){var C="y"===_?ot:lt,E="y"===_?st:at,M="y"===_?"height":"width",L=x[_],T=x[_]+m[C],H=x[_]-m[E],O=u?-A[M]/2:0,$=b===dt?k[M]:A[M],V=b===dt?-A[M]:-k[M],I=e.elements.arrow,R=u&&I?Lt(I):{width:0,height:0},P=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:qt(),D=P[C],N=P[E],F=jt(0,k[M],R[M]),B=y?k[M]/2-O-F-D-z:$-F-D-z,j=y?-k[M]/2+O+F+N+z:V+F+N+z,q=e.elements.arrow&&Pt(e.elements.arrow),U=q?"y"===_?q.clientTop||0:q.clientLeft||0:0,W=e.modifiersData.offset?e.modifiersData.offset[e.placement][_]:0,Y=x[_]+B-W-U,G=x[_]+j-W;if(o){var X=jt(u?Ft(T,Y):T,L,u?Nt(H,G):H);x[_]=X,S[_]=X-L}if(a){var K="x"===_?ot:lt,Q="x"===_?st:at,Z=x[w],J=Z+m[K],tt=Z-m[Q],et=jt(u?Ft(J,Y):J,Z,u?Nt(tt,G):tt);x[w]=et,S[w]=et-Z}}e.modifiersData[n]=S}}function He(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function Oe(t){return t!==wt(t)&&kt(t)?He(t):se(t)}function $e(t,e,i){void 0===i&&(i=!1);var n=$t(e),r=Mt(t),o=kt(e),s={scrollLeft:0,scrollTop:0},a={x:0,y:0};return(o||!o&&!i)&&(("body"!==_t(e)||he(n))&&(s=Oe(e)),kt(e)?((a=Mt(e)).x+=e.clientLeft,a.y+=e.clientTop):n&&(a.x=ae(n))),{x:r.left+s.scrollLeft-a.x,y:r.top+s.scrollTop-a.y,width:r.width,height:r.height}}function Ve(t){var e=new Map,i=new Set,n=[];function r(t){i.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!i.has(t)){var n=e.get(t);n&&r(n)}})),n.push(t)}return t.forEach((function(t){e.set(t.name,t)})),t.forEach((function(t){i.has(t.name)||r(t)})),n}function Ie(t){var e=Ve(t);return yt.reduce((function(t,i){return t.concat(e.filter((function(t){return t.phase===i})))}),[])}function Re(t){var e;return function(){return e||(e=new Promise((function(i){Promise.resolve().then((function(){e=void 0,i(t())}))}))),e}}function Pe(t){var e=t.reduce((function(t,e){var i=t[e.name];return t[e.name]=i?Object.assign({},i,e,{options:Object.assign({},i.options,e.options),data:Object.assign({},i.data,e.data)}):e,t}),{});return Object.keys(e).map((function(t){return e[t]}))}var De={placement:"bottom",modifiers:[],strategy:"absolute"};function Ne(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return!e.some((function(t){return!(t&&"function"==typeof t.getBoundingClientRect)}))}function Fe(t){void 0===t&&(t={});var e=t,i=e.defaultModifiers,n=void 0===i?[]:i,r=e.defaultOptions,o=void 0===r?De:r;return function(t,e,i){void 0===i&&(i=o);var r={placement:"bottom",orderedModifiers:[],options:Object.assign({},De,o),modifiersData:{},elements:{reference:t,popper:e},attributes:{},styles:{}},s=[],a=!1,l={state:r,setOptions:function(i){h(),r.options=Object.assign({},o,r.options,i),r.scrollParents={reference:xt(t)?pe(t):t.contextElement?pe(t.contextElement):[],popper:pe(e)};var s=Ie(Pe([].concat(n,r.options.modifiers)));return r.orderedModifiers=s.filter((function(t){return t.enabled})),c(),l.update()},forceUpdate:function(){if(!a){var t=r.elements,e=t.reference,i=t.popper;if(Ne(e,i)){r.rects={reference:$e(e,Pt(i),"fixed"===r.options.strategy),popper:Lt(i)},r.reset=!1,r.placement=r.options.placement,r.orderedModifiers.forEach((function(t){return r.modifiersData[t.name]=Object.assign({},t.data)}));for(var n=0;n<r.orderedModifiers.length;n++)if(!0!==r.reset){var o=r.orderedModifiers[n],s=o.fn,c=o.options,h=void 0===c?{}:c,d=o.name;"function"==typeof s&&(r=s({state:r,options:h,name:d,instance:l})||r)}else r.reset=!1,n=-1}}},update:Re((function(){return new Promise((function(t){l.forceUpdate(),t(r)}))})),destroy:function(){h(),a=!0}};if(!Ne(t,e))return l;function c(){r.orderedModifiers.forEach((function(t){var e=t.name,i=t.options,n=void 0===i?{}:i,o=t.effect;if("function"==typeof o){var a=o({state:r,name:e,instance:l,options:n}),c=function(){};s.push(a||c)}}))}function h(){s.forEach((function(t){return t()})),s=[]}return l.setOptions(i).then((function(t){!a&&i.onFirstUpdate&&i.onFirstUpdate(t)})),l}}var Be=Fe({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:ee,data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:Me,data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Jt,data:{}},Ct,{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Ee},{name:"flip",enabled:!0,phase:"main",fn:ke,requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:Te,requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:Gt,effect:Xt,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Se}]}),je="tippy-box",qe="tippy-content",Ue="tippy-backdrop",We="tippy-arrow",Ye="tippy-svg-arrow",Ge={passive:!0,capture:!0};function Xe(t,e,i){if(Array.isArray(t)){var n=t[e];return null==n?Array.isArray(i)?i[e]:i:n}return t}function Ke(t,e){var i={}.toString.call(t);return 0===i.indexOf("[object")&&i.indexOf(e+"]")>-1}function Qe(t,e){return"function"==typeof t?t.apply(void 0,e):t}function Ze(t,e){return 0===e?t:function(n){clearTimeout(i),i=setTimeout((function(){t(n)}),e)};var i}function Je(t){return t.split(/\s+/).filter(Boolean)}function ti(t){return[].concat(t)}function ei(t,e){-1===t.indexOf(e)&&t.push(e)}function ii(t){return t.filter((function(e,i){return t.indexOf(e)===i}))}function ni(t){return t.split("-")[0]}function ri(t){return[].slice.call(t)}function oi(t){return Object.keys(t).reduce((function(e,i){return void 0!==t[i]&&(e[i]=t[i]),e}),{})}function si(){return document.createElement("div")}function ai(t){return["Element","Fragment"].some((function(e){return Ke(t,e)}))}function li(t){return Ke(t,"NodeList")}function ci(t){return Ke(t,"MouseEvent")}function hi(t){return!(!t||!t._tippy||t._tippy.reference!==t)}function di(t){return ai(t)?[t]:li(t)?ri(t):Array.isArray(t)?t:ri(document.querySelectorAll(t))}function pi(t,e){t.forEach((function(t){t&&(t.style.transitionDuration=e+"ms")}))}function ui(t,e){t.forEach((function(t){t&&t.setAttribute("data-state",e)}))}function gi(t){var e,i=ti(t)[0];return(null==i||null==(e=i.ownerDocument)?void 0:e.body)?i.ownerDocument:document}function fi(t,e){var i=e.clientX,n=e.clientY;return t.every((function(t){var e=t.popperRect,r=t.popperState,o=t.props.interactiveBorder,s=ni(r.placement),a=r.modifiersData.offset;if(!a)return!0;var l="bottom"===s?a.top.y:0,c="top"===s?a.bottom.y:0,h="right"===s?a.left.x:0,d="left"===s?a.right.x:0,p=e.top-n+l>o,u=n-e.bottom-c>o,g=e.left-i+h>o,f=i-e.right-d>o;return p||u||g||f}))}function mi(t,e,i){var n=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach((function(e){t[n](e,i)}))}var vi={isTouch:!1},bi=0;function yi(){vi.isTouch||(vi.isTouch=!0,window.performance&&document.addEventListener("mousemove",_i))}function _i(){var t=performance.now();t-bi<20&&(vi.isTouch=!1,document.removeEventListener("mousemove",_i)),bi=t}function wi(){var t=document.activeElement;if(hi(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function xi(){document.addEventListener("touchstart",yi,Ge),window.addEventListener("blur",wi)}var ki="undefined"!=typeof window&&"undefined"!=typeof document?navigator.userAgent:"",Ai=/MSIE |Trident\//.test(ki),zi={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},Si={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Ci=Object.assign({appendTo:function(){return document.body},aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},zi,{},Si),Ei=Object.keys(Ci),Mi=function(t){Object.keys(t).forEach((function(e){Ci[e]=t[e]}))};function Li(t){var e=(t.plugins||[]).reduce((function(e,i){var n=i.name,r=i.defaultValue;return n&&(e[n]=void 0!==t[n]?t[n]:r),e}),{});return Object.assign({},t,{},e)}function Ti(t,e){return(e?Object.keys(Li(Object.assign({},Ci,{plugins:e}))):Ei).reduce((function(e,i){var n=(t.getAttribute("data-tippy-"+i)||"").trim();if(!n)return e;if("content"===i)e[i]=n;else try{e[i]=JSON.parse(n)}catch(t){e[i]=n}return e}),{})}function Hi(t,e){var i=Object.assign({},e,{content:Qe(e.content,[t])},e.ignoreAttributes?{}:Ti(t,e.plugins));return i.aria=Object.assign({},Ci.aria,{},i.aria),i.aria={expanded:"auto"===i.aria.expanded?e.interactive:i.aria.expanded,content:"auto"===i.aria.content?e.interactive?null:"describedby":i.aria.content},i}var Oi=function(){return"innerHTML"};function $i(t,e){t[Oi()]=e}function Vi(t){var e=si();return!0===t?e.className=We:(e.className=Ye,ai(t)?e.appendChild(t):$i(e,t)),e}function Ii(t,e){ai(e.content)?($i(t,""),t.appendChild(e.content)):"function"!=typeof e.content&&(e.allowHTML?$i(t,e.content):t.textContent=e.content)}function Ri(t){var e=t.firstElementChild,i=ri(e.children);return{box:e,content:i.find((function(t){return t.classList.contains(qe)})),arrow:i.find((function(t){return t.classList.contains(We)||t.classList.contains(Ye)})),backdrop:i.find((function(t){return t.classList.contains(Ue)}))}}function Pi(t){var e=si(),i=si();i.className=je,i.setAttribute("data-state","hidden"),i.setAttribute("tabindex","-1");var n=si();function r(i,n){var r=Ri(e),o=r.box,s=r.content,a=r.arrow;n.theme?o.setAttribute("data-theme",n.theme):o.removeAttribute("data-theme"),"string"==typeof n.animation?o.setAttribute("data-animation",n.animation):o.removeAttribute("data-animation"),n.inertia?o.setAttribute("data-inertia",""):o.removeAttribute("data-inertia"),o.style.maxWidth="number"==typeof n.maxWidth?n.maxWidth+"px":n.maxWidth,n.role?o.setAttribute("role",n.role):o.removeAttribute("role"),i.content===n.content&&i.allowHTML===n.allowHTML||Ii(s,t.props),n.arrow?a?i.arrow!==n.arrow&&(o.removeChild(a),o.appendChild(Vi(n.arrow))):o.appendChild(Vi(n.arrow)):a&&o.removeChild(a)}return n.className=qe,n.setAttribute("data-state","hidden"),Ii(n,t.props),e.appendChild(i),i.appendChild(n),r(t.props,t.props),{popper:e,onUpdate:r}}Pi.$$tippy=!0;var Di=1,Ni=[],Fi=[];function Bi(t,e){var i,n,r,o,s,a,l,c=Hi(t,Object.assign({},Ci,{},Li(oi(e)))),h=!1,d=!1,p=!1,u=!1,g=[],f=Ze(K,c.interactiveDebounce),m=Di++,v=null,b=ii(c.plugins),y={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},_={id:m,reference:t,popper:si(),popperInstance:v,props:c,state:y,plugins:b,clearDelayTimeouts:lt,setProps:ct,setContent:ht,show:dt,hide:pt,hideWithInteractivity:ut,enable:st,disable:at,unmount:gt,destroy:ft};if(!c.render)return _;var w=c.render(_),x=w.popper,k=w.onUpdate;x.setAttribute("data-tippy-root",""),x.id="tippy-"+_.id,_.popper=x,t._tippy=_,x._tippy=_;var A=b.map((function(t){return t.fn(_)})),z=t.hasAttribute("aria-expanded");return Y(),I(),O(),$("onCreate",[_]),c.showOnCreate&&rt(),x.addEventListener("mouseenter",(function(){_.props.interactive&&_.state.isVisible&&_.clearDelayTimeouts()})),x.addEventListener("mouseleave",(function(t){_.props.interactive&&_.props.trigger.indexOf("mouseenter")>=0&&(L().addEventListener("mousemove",f),f(t))})),_;function S(){var t=_.props.touch;return Array.isArray(t)?t:[t,0]}function C(){return"hold"===S()[0]}function E(){var t;return!!(null==(t=_.props.render)?void 0:t.$$tippy)}function M(){return l||t}function L(){var t=M().parentNode;return t?gi(t):document}function T(){return Ri(x)}function H(t){return _.state.isMounted&&!_.state.isVisible||vi.isTouch||o&&"focus"===o.type?0:Xe(_.props.delay,t?0:1,Ci.delay)}function O(){x.style.pointerEvents=_.props.interactive&&_.state.isVisible?"":"none",x.style.zIndex=""+_.props.zIndex}function $(t,e,i){var n;(void 0===i&&(i=!0),A.forEach((function(i){i[t]&&i[t].apply(void 0,e)})),i)&&(n=_.props)[t].apply(n,e)}function V(){var e=_.props.aria;if(e.content){var i="aria-"+e.content,n=x.id;ti(_.props.triggerTarget||t).forEach((function(t){var e=t.getAttribute(i);if(_.state.isVisible)t.setAttribute(i,e?e+" "+n:n);else{var r=e&&e.replace(n,"").trim();r?t.setAttribute(i,r):t.removeAttribute(i)}}))}}function I(){!z&&_.props.aria.expanded&&ti(_.props.triggerTarget||t).forEach((function(t){_.props.interactive?t.setAttribute("aria-expanded",_.state.isVisible&&t===M()?"true":"false"):t.removeAttribute("aria-expanded")}))}function R(){L().removeEventListener("mousemove",f),Ni=Ni.filter((function(t){return t!==f}))}function P(t){if(!(vi.isTouch&&(p||"mousedown"===t.type)||_.props.interactive&&x.contains(t.target))){if(M().contains(t.target)){if(vi.isTouch)return;if(_.state.isVisible&&_.props.trigger.indexOf("click")>=0)return}else $("onClickOutside",[_,t]);!0===_.props.hideOnClick&&(_.clearDelayTimeouts(),_.hide(),d=!0,setTimeout((function(){d=!1})),_.state.isMounted||B())}}function D(){p=!0}function N(){p=!1}function F(){var t=L();t.addEventListener("mousedown",P,!0),t.addEventListener("touchend",P,Ge),t.addEventListener("touchstart",N,Ge),t.addEventListener("touchmove",D,Ge)}function B(){var t=L();t.removeEventListener("mousedown",P,!0),t.removeEventListener("touchend",P,Ge),t.removeEventListener("touchstart",N,Ge),t.removeEventListener("touchmove",D,Ge)}function j(t,e){U(t,(function(){!_.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&e()}))}function q(t,e){U(t,e)}function U(t,e){var i=T().box;function n(t){t.target===i&&(mi(i,"remove",n),e())}if(0===t)return e();mi(i,"remove",s),mi(i,"add",n),s=n}function W(e,i,n){void 0===n&&(n=!1),ti(_.props.triggerTarget||t).forEach((function(t){t.addEventListener(e,i,n),g.push({node:t,eventType:e,handler:i,options:n})}))}function Y(){C()&&(W("touchstart",X,{passive:!0}),W("touchend",Q,{passive:!0})),Je(_.props.trigger).forEach((function(t){if("manual"!==t)switch(W(t,X),t){case"mouseenter":W("mouseleave",Q);break;case"focus":W(Ai?"focusout":"blur",Z);break;case"focusin":W("focusout",Z)}}))}function G(){g.forEach((function(t){var e=t.node,i=t.eventType,n=t.handler,r=t.options;e.removeEventListener(i,n,r)})),g=[]}function X(t){var e,i=!1;if(_.state.isEnabled&&!J(t)&&!d){var n="focus"===(null==(e=o)?void 0:e.type);o=t,l=t.currentTarget,I(),!_.state.isVisible&&ci(t)&&Ni.forEach((function(e){return e(t)})),"click"===t.type&&(_.props.trigger.indexOf("mouseenter")<0||h)&&!1!==_.props.hideOnClick&&_.state.isVisible?i=!0:rt(t),"click"===t.type&&(h=!i),i&&!n&&ot(t)}}function K(t){var e=t.target,i=M().contains(e)||x.contains(e);"mousemove"===t.type&&i||fi(nt().concat(x).map((function(t){var e,i=null==(e=t._tippy.popperInstance)?void 0:e.state;return i?{popperRect:t.getBoundingClientRect(),popperState:i,props:c}:null})).filter(Boolean),t)&&(R(),ot(t))}function Q(t){J(t)||_.props.trigger.indexOf("click")>=0&&h||(_.props.interactive?_.hideWithInteractivity(t):ot(t))}function Z(t){_.props.trigger.indexOf("focusin")<0&&t.target!==M()||_.props.interactive&&t.relatedTarget&&x.contains(t.relatedTarget)||ot(t)}function J(t){return!!vi.isTouch&&C()!==t.type.indexOf("touch")>=0}function tt(){et();var e=_.props,i=e.popperOptions,n=e.placement,r=e.offset,o=e.getReferenceClientRect,s=e.moveTransition,l=E()?Ri(x).arrow:null,c=o?{getBoundingClientRect:o,contextElement:o.contextElement||M()}:t,h=[{name:"offset",options:{offset:r}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!s}},{name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(t){var e=t.state;if(E()){var i=T().box;["placement","reference-hidden","escaped"].forEach((function(t){"placement"===t?i.setAttribute("data-placement",e.placement):e.attributes.popper["data-popper-"+t]?i.setAttribute("data-"+t,""):i.removeAttribute("data-"+t)})),e.attributes.popper={}}}}];E()&&l&&h.push({name:"arrow",options:{element:l,padding:3}}),h.push.apply(h,(null==i?void 0:i.modifiers)||[]),_.popperInstance=Be(c,x,Object.assign({},i,{placement:n,onFirstUpdate:a,modifiers:h}))}function et(){_.popperInstance&&(_.popperInstance.destroy(),_.popperInstance=null)}function it(){var t,e=_.props.appendTo,i=M();(t=_.props.interactive&&e===Ci.appendTo||"parent"===e?i.parentNode:Qe(e,[i])).contains(x)||t.appendChild(x),tt()}function nt(){return ri(x.querySelectorAll("[data-tippy-root]"))}function rt(t){_.clearDelayTimeouts(),t&&$("onTrigger",[_,t]),F();var e=H(!0),n=S(),r=n[0],o=n[1];vi.isTouch&&"hold"===r&&o&&(e=o),e?i=setTimeout((function(){_.show()}),e):_.show()}function ot(t){if(_.clearDelayTimeouts(),$("onUntrigger",[_,t]),_.state.isVisible){if(!(_.props.trigger.indexOf("mouseenter")>=0&&_.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(t.type)>=0&&h)){var e=H(!1);e?n=setTimeout((function(){_.state.isVisible&&_.hide()}),e):r=requestAnimationFrame((function(){_.hide()}))}}else B()}function st(){_.state.isEnabled=!0}function at(){_.hide(),_.state.isEnabled=!1}function lt(){clearTimeout(i),clearTimeout(n),cancelAnimationFrame(r)}function ct(e){if(!_.state.isDestroyed){$("onBeforeUpdate",[_,e]),G();var i=_.props,n=Hi(t,Object.assign({},_.props,{},e,{ignoreAttributes:!0}));_.props=n,Y(),i.interactiveDebounce!==n.interactiveDebounce&&(R(),f=Ze(K,n.interactiveDebounce)),i.triggerTarget&&!n.triggerTarget?ti(i.triggerTarget).forEach((function(t){t.removeAttribute("aria-expanded")})):n.triggerTarget&&t.removeAttribute("aria-expanded"),I(),O(),k&&k(i,n),_.popperInstance&&(tt(),nt().forEach((function(t){requestAnimationFrame(t._tippy.popperInstance.forceUpdate)}))),$("onAfterUpdate",[_,e])}}function ht(t){_.setProps({content:t})}function dt(){var t=_.state.isVisible,e=_.state.isDestroyed,i=!_.state.isEnabled,n=vi.isTouch&&!_.props.touch,r=Xe(_.props.duration,0,Ci.duration);if(!(t||e||i||n||M().hasAttribute("disabled")||($("onShow",[_],!1),!1===_.props.onShow(_)))){if(_.state.isVisible=!0,E()&&(x.style.visibility="visible"),O(),F(),_.state.isMounted||(x.style.transition="none"),E()){var o=T();pi([o.box,o.content],0)}a=function(){var t;if(_.state.isVisible&&!u){if(u=!0,x.offsetHeight,x.style.transition=_.props.moveTransition,E()&&_.props.animation){var e=T(),i=e.box,n=e.content;pi([i,n],r),ui([i,n],"visible")}V(),I(),ei(Fi,_),null==(t=_.popperInstance)||t.forceUpdate(),_.state.isMounted=!0,$("onMount",[_]),_.props.animation&&E()&&q(r,(function(){_.state.isShown=!0,$("onShown",[_])}))}},it()}}function pt(){var t=!_.state.isVisible,e=_.state.isDestroyed,i=!_.state.isEnabled,n=Xe(_.props.duration,1,Ci.duration);if(!(t||e||i)&&($("onHide",[_],!1),!1!==_.props.onHide(_))){if(_.state.isVisible=!1,_.state.isShown=!1,u=!1,h=!1,E()&&(x.style.visibility="hidden"),R(),B(),O(),E()){var r=T(),o=r.box,s=r.content;_.props.animation&&(pi([o,s],n),ui([o,s],"hidden"))}V(),I(),_.props.animation?E()&&j(n,_.unmount):_.unmount()}}function ut(t){L().addEventListener("mousemove",f),ei(Ni,f),f(t)}function gt(){_.state.isVisible&&_.hide(),_.state.isMounted&&(et(),nt().forEach((function(t){t._tippy.unmount()})),x.parentNode&&x.parentNode.removeChild(x),Fi=Fi.filter((function(t){return t!==_})),_.state.isMounted=!1,$("onHidden",[_]))}function ft(){_.state.isDestroyed||(_.clearDelayTimeouts(),_.unmount(),G(),delete t._tippy,_.state.isDestroyed=!0,$("onDestroy",[_]))}}function ji(t,e){void 0===e&&(e={});var i=Ci.plugins.concat(e.plugins||[]);xi();var n=Object.assign({},e,{plugins:i}),r=di(t).reduce((function(t,e){var i=e&&Bi(e,n);return i&&t.push(i),t}),[]);return ai(t)?r[0]:r}ji.defaultProps=Ci,ji.setDefaultProps=Mi,ji.currentInput=vi;Object.assign({},Ct,{effect:function(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow)}});function qi(t){return t.replace(/(?:^\w|[A-Z]|\b\w)/g,(t,e)=>0==+t?"":0===e?t.toLowerCase():t.toUpperCase()).replace("-","")}ji.setDefaultProps({render:Pi});const Ui='\n .tippy-box[data-animation=fade][data-state=hidden] {\n opacity: 0\n }\n\n .tippy-iOS {\n cursor: pointer!important;\n -webkit-tap-highlight-color: transparent\n }\n\n [data-tippy-root] {\n max-width: calc(100vw - 10px)\n }\n\n .tippy-box {\n position: relative;\n background-color: #333;\n color: #fff;\n border-radius: 4px;\n font-size: var(--pb-popover-font-size, var(--pb-base-font-size, 14px));\n line-height: var(--pb-popover-line-height, var(--pb-base-line-height, 1.4));\n text-align: left;\n font-style: normal;\n font-weight: normal;\n outline: 0;\n transition-property: transform, visibility, opacity\n }\n\n .tippy-box[data-placement^=top]>.tippy-arrow {\n bottom: 0\n }\n\n .tippy-box[data-placement^=top]>.tippy-arrow:before {\n bottom: -7px;\n left: 0;\n border-width: 8px 8px 0;\n border-top-color: initial;\n transform-origin: center top\n }\n\n .tippy-box[data-placement^=bottom]>.tippy-arrow {\n top: 0\n }\n\n .tippy-box[data-placement^=bottom]>.tippy-arrow:before {\n top: -7px;\n left: 0;\n border-width: 0 8px 8px;\n border-bottom-color: initial;\n transform-origin: center bottom\n }\n\n .tippy-box[data-placement^=left]>.tippy-arrow {\n right: 0\n }\n\n .tippy-box[data-placement^=left]>.tippy-arrow:before {\n border-width: 8px 0 8px 8px;\n border-left-color: initial;\n right: -7px;\n transform-origin: center left\n }\n\n .tippy-box[data-placement^=right]>.tippy-arrow {\n left: 0\n }\n\n .tippy-box[data-placement^=right]>.tippy-arrow:before {\n left: -7px;\n border-width: 8px 8px 8px 0;\n border-right-color: initial;\n transform-origin: center right\n }\n\n .tippy-box[data-inertia][data-state=visible] {\n transition-timing-function: cubic-bezier(.54, 1.5, .38, 1.11)\n }\n\n .tippy-arrow {\n width: 16px;\n height: 16px;\n color: #333\n }\n\n .tippy-arrow:before {\n content: "";\n position: absolute;\n border-color: transparent;\n border-style: solid\n }\n\n .tippy-content {\n position: relative;\n padding: 5px 9px;\n z-index: 1;\n overflow: auto;\n max-height: var(--pb-popover-max-height, calc(100vh - 60px));\n min-height: var(--pb-popover-min-height, auto);\n max-width: var(--pb-popover-max-width, auto);\n min-width: var(--pb-popover-min-width, auto);\n color: var(--pb-popover-color);\n }\n',Wi='\n .tippy-box[data-theme~=light-border] {\n background-color: #fff;\n background-clip: padding-box;\n border: 1px solid rgba(0, 8, 16, .15);\n color: #333;\n box-shadow: 0 4px 14px -2px rgba(0, 8, 16, .08)\n }\n\n .tippy-box[data-theme~=light-border]>.tippy-backdrop {\n background-color: #fff\n }\n\n .tippy-box[data-theme~=light-border]>.tippy-arrow:after, .tippy-box[data-theme~=light-border]>.tippy-svg-arrow:after {\n content: "";\n position: absolute;\n z-index: -1\n }\n\n .tippy-box[data-theme~=light-border]>.tippy-arrow:after {\n border-color: transparent;\n border-style: solid\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=top]>.tippy-arrow:before {\n border-top-color: #fff\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=top]>.tippy-arrow:after {\n border-top-color: rgba(0, 8, 16, .2);\n border-width: 7px 7px 0;\n top: 17px;\n left: 1px\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=top]>.tippy-svg-arrow>svg {\n top: 16px\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=top]>.tippy-svg-arrow:after {\n top: 17px\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=bottom]>.tippy-arrow:before {\n border-bottom-color: #fff;\n bottom: 16px\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=bottom]>.tippy-arrow:after {\n border-bottom-color: rgba(0, 8, 16, .2);\n border-width: 0 7px 7px;\n bottom: 17px;\n left: 1px\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=bottom]>.tippy-svg-arrow>svg {\n bottom: 16px\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=bottom]>.tippy-svg-arrow:after {\n bottom: 17px\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=left]>.tippy-arrow:before {\n border-left-color: #fff\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=left]>.tippy-arrow:after {\n border-left-color: rgba(0, 8, 16, .2);\n border-width: 7px 0 7px 7px;\n left: 17px;\n top: 1px\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=left]>.tippy-svg-arrow>svg {\n left: 11px\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=left]>.tippy-svg-arrow:after {\n left: 12px\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=right]>.tippy-arrow:before {\n border-right-color: #fff;\n right: 16px\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=right]>.tippy-arrow:after {\n border-width: 7px 7px 7px 0;\n right: 17px;\n top: 1px;\n border-right-color: rgba(0, 8, 16, .2)\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=right]>.tippy-svg-arrow>svg {\n right: 11px\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=right]>.tippy-svg-arrow:after {\n right: 12px\n }\n\n .tippy-box[data-theme~=light-border]>.tippy-svg-arrow {\n fill: #fff\n }\n\n .tippy-box[data-theme~=light-border]>.tippy-svg-arrow:after {\n background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMCA2czEuNzk2LS4wMTMgNC42Ny0zLjYxNUM1Ljg1MS45IDYuOTMuMDA2IDggMGMxLjA3LS4wMDYgMi4xNDguODg3IDMuMzQzIDIuMzg1QzE0LjIzMyA2LjAwNSAxNiA2IDE2IDZIMHoiIGZpbGw9InJnYmEoMCwgOCwgMTYsIDAuMikiLz48L3N2Zz4=);\n background-size: 16px 6px;\n width: 16px;\n height: 6px\n }\n',Yi="\n .tippy-box[data-theme~=light] {\n color: #26323d;\n box-shadow: 0 0 20px 4px rgba(154, 161, 177, .15), 0 4px 80px -8px rgba(36, 40, 47, .25), 0 4px 4px -2px rgba(91, 94, 105, .15);\n background-color: #fff\n }\n\n .tippy-box[data-theme~=light][data-placement^=top]>.tippy-arrow:before {\n border-top-color: #fff\n }\n\n .tippy-box[data-theme~=light][data-placement^=bottom]>.tippy-arrow:before {\n border-bottom-color: #fff\n }\n\n .tippy-box[data-theme~=light][data-placement^=left]>.tippy-arrow:before {\n border-left-color: #fff\n }\n\n .tippy-box[data-theme~=light][data-placement^=right]>.tippy-arrow:before {\n border-right-color: #fff\n }\n\n .tippy-box[data-theme~=light]>.tippy-backdrop {\n background-color: #fff\n }\n\n .tippy-box[data-theme~=light]>.tippy-svg-arrow {\n fill: #fff\n }",Gi="\n .tippy-box[data-theme~=material] {\n background-color: #505355;\n font-weight: 600\n }\n\n .tippy-box[data-theme~=material][data-placement^=top]>.tippy-arrow:before {\n border-top-color: #505355\n }\n\n .tippy-box[data-theme~=material][data-placement^=bottom]>.tippy-arrow:before {\n border-bottom-color: #505355\n }\n\n .tippy-box[data-theme~=material][data-placement^=left]>.tippy-arrow:before {\n border-left-color: #505355\n }\n\n .tippy-box[data-theme~=material][data-placement^=right]>.tippy-arrow:before {\n border-right-color: #505355\n }\n\n .tippy-box[data-theme~=material]>.tippy-backdrop {\n background-color: #505355\n }\n\n .tippy-box[data-theme~=material]>.tippy-svg-arrow {\n fill: #505355\n }\n",Xi="\n .tippy-box[data-theme~=translucent] {\n background-color: rgba(0, 0, 0, .7)\n }\n\n .tippy-box[data-theme~=translucent]>.tippy-arrow {\n width: 14px;\n height: 14px\n }\n\n .tippy-box[data-theme~=translucent][data-placement^=top]>.tippy-arrow:before {\n border-width: 7px 7px 0;\n border-top-color: rgba(0, 0, 0, .7)\n }\n\n .tippy-box[data-theme~=translucent][data-placement^=bottom]>.tippy-arrow:before {\n border-width: 0 7px 7px;\n border-bottom-color: rgba(0, 0, 0, .7)\n }\n\n .tippy-box[data-theme~=translucent][data-placement^=left]>.tippy-arrow:before {\n border-width: 7px 0 7px 7px;\n border-left-color: rgba(0, 0, 0, .7)\n }\n\n .tippy-box[data-theme~=translucent][data-placement^=right]>.tippy-arrow:before {\n border-width: 7px 7px 7px 0;\n border-right-color: rgba(0, 0, 0, .7)\n }\n\n .tippy-box[data-theme~=translucent]>.tippy-backdrop {\n background-color: rgba(0, 0, 0, .7)\n }\n\n .tippy-box[data-theme~=translucent]>.tippy-svg-arrow {\n fill: rgba(0, 0, 0, .7)\n }\n";var Ki=Object.freeze({__proto__:null,camelize:qi,base:Ui,lightBorder:Wi,light:Yi,material:Gi,translucent:Xi});function Qi(t,e,i){if(!t.querySelector("#pb-popover-"+e)){const n=t.nodeType===Node.DOCUMENT_NODE?document.head:t;console.log("Loading tippy styles for theme %s into %o",e,n);const r=document.createElement("style");r.type="text/css",r.id="pb-popover-"+e,r.innerHTML=i,n.appendChild(r)}}function Zi(t,e){if(Qi(t,"base",Ui),e&&"none"!==e){const i=qi(e),n=Ki[i];n&&Qi(t,i,n)}}class Ji extends(N(V)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{for:{type:String},theme:{type:String},placement:{type:String},fallbackPlacement:{type:String,attribute:"fallback-placement"},persistent:{type:Boolean},trigger:{type:String},popupClass:{type:String,attribute:"popup-class"},remote:{type:String}})}constructor(){super(),this.persistent=!1,this.trigger=null,this.for=null,this.theme=null,this.placement=null,this.fallbackPlacement=null,this.popupClass=null,this._tippy=null,this._content=null}render(){return this.for?R`<div class="hidden"><slot></slot></div>`:R`<span id="link" part="trigger" class="${this.persistent?"persistent":""}"><slot name="default"><slot></slot></slot></span><span class="hidden"><slot name="alternate"></slot></span>`}disconnectedCallback(){super.disconnectedCallback(),this._tippy&&this._tippy.destroy(),this._observer&&this._observer.disconnect()}_checkCSSProperties(){this.theme||"none"===this.theme||(this.theme=I(this,"--pb-popover-theme","none")),this.placement||(this.placement=I(this,"--pb-popover-placement","auto")),this.fallbackPlacement||(this.fallbackPlacement=I(this,"--pb-popover-fallback-placement",null)),this.persistent||(this.persistent=I(this,"--pb-popover-persistent",!1)),this.trigger||(this.trigger=I(this,"--pb-popover-trigger",null))}_injectStyles(){this._checkCSSProperties(),Zi(this.getRootNode(),this.theme)}_getContent(){if(this._content)return this._content;const t=this._getSlot();if(t){const e=document.createElement("div");return t.assignedNodes().forEach(t=>{e.appendChild(t.content?t.content.cloneNode(!0):t.cloneNode(!0))}),this._content=e,e}return null}_getSlot(){return this.for?this.shadowRoot.querySelector("slot"):this.shadowRoot.querySelector("[name=alternate]")}_registerMutationObserver(){const t=this._getSlot();this._observer=new MutationObserver(()=>{this.alternate=this._getContent(),console.log("alternate changed"),this.emitTo("pb-popover-changed",this.alternate)}),this._observer.observe(this,{subtree:!0,childList:!0,characterData:!0}),t&&t.assignedNodes().forEach(t=>{this._observer.observe(t.content?t.content:t,{subtree:!0,childList:!0,characterData:!0})})}get alternate(){return this._getContent()}set alternate(t){this._content=t,this._tippy&&this._tippy.setContent(this._content)}command(t,e){"disable"===t&&(this.disabled=e,this._tippy&&(e?this._tippy.disable():this._tippy.enable()))}firstUpdated(){super.firstUpdated(),this._injectStyles(),this._registerMutationObserver(),this.trigger||(this.trigger=this.persistent?"click":"mouseenter");const t=this.getRootNode();let e;if(this.for?(e=t.getElementById(this.for),e||console.error("<pb-popover> target element %s not found",this.for)):e=this.shadowRoot.getElementById("link"),e){const i={allowHTML:!0,appendTo:t.nodeType===Node.DOCUMENT_NODE?document.body:t,placement:this.placement,interactive:!0,ignoreAttributes:!0,boundary:"viewport",maxWidth:"none",touch:"hold",hideOnClick:!1,trigger:this.trigger};if(this.persistent&&(i.onClickOutside=(t,e)=>{t.hideWithInteractivity(e)}),this.theme&&"none"!==this.theme&&(i.theme=this.theme),this.fallbackPlacement){const t=this.fallbackPlacement.split(" ");i.popperOptions={modifiers:[{name:"flip",options:{fallbackPlacements:t}}]}}this.popupClass&&(i.onCreate=t=>{t.popper.classList.add(this.popupClass)}),i.onShow=t=>{this.remote?this._loadRemoteContent():t.setContent(this._getContent()),this.emitTo("pb-popover-show",{source:this})},this._tippy=ji(e,i)}}_loadRemoteContent(){const t=this.toAbsoluteURL(this.remote);fetch(t,{method:"GET",mode:"cors",credentials:"same-origin"}).then(t=>t.text()).then(t=>{this.alternate=t}).catch(t=>{console.error("<pb-popover> Error retrieving remote content: %o",t)})}static get styles(){return[P`
|
|
510
|
+
`}}customElements.define("pb-demo-snippet",et);class it{static subscribe(t,e,i,n=!1){e&&!Array.isArray(e)&&(e=[e]);const r=document.addEventListener(t,t=>{(e||t.detail&&t.detail.key)&&!(e&&t.detail&&t.detail.key&&e.indexOf(t.detail.key)>-1)||i&&i(t,r)},{once:n})}static subscribeOnce(t,e=null){return e&&!Array.isArray(e)&&(e=[e]),new Promise(i=>{document.addEventListener(t,t=>{(e||t.detail&&t.detail.key)&&!(e&&t.detail&&t.detail.key&&e.indexOf(t.detail.key)>-1)||i(t)},{once:!0})})}static emit(t,e=null,i=null){const n=i||{};e&&(n.key=e);const r=new CustomEvent(t,{detail:n});document.dispatchEvent(r)}}window.pbEvents||(window.pbEvents=it);const nt="1.41.0";class rt extends T{static get properties(){return Object.assign({version:{type:String,reflect:!0}},super.properties)}constructor(){super(),this.version=nt}connectedCallback(){if(super.connectedCallback(),!this.version){const t=I("../package.json");fetch(t).then(t=>t.json()).then(t=>{this.version=t.version})}}render(){return O`<span>${this.version?this.version:"unknown"}</span>`}createRenderRoot(){return this}}customElements.define("pb-version",rt);var ot="top",st="bottom",at="right",lt="left",ct="auto",ht=[ot,st,at,lt],dt="start",pt="end",ut="clippingParents",gt="viewport",ft="popper",mt="reference",vt=ht.reduce((function(t,e){return t.concat([e+"-"+dt,e+"-"+pt])}),[]),bt=[].concat(ht,[ct]).reduce((function(t,e){return t.concat([e,e+"-"+dt,e+"-"+pt])}),[]),yt=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function _t(t){return t?(t.nodeName||"").toLowerCase():null}function wt(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function xt(t){return t instanceof wt(t).Element||t instanceof Element}function kt(t){return t instanceof wt(t).HTMLElement||t instanceof HTMLElement}function At(t){return"undefined"!=typeof ShadowRoot&&(t instanceof wt(t).ShadowRoot||t instanceof ShadowRoot)}function zt(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var i=e.styles[t]||{},n=e.attributes[t]||{},r=e.elements[t];kt(r)&&_t(r)&&(Object.assign(r.style,i),Object.keys(n).forEach((function(t){var e=n[t];!1===e?r.removeAttribute(t):r.setAttribute(t,!0===e?"":e)})))}))}function St(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow),function(){Object.keys(e.elements).forEach((function(t){var n=e.elements[t],r=e.attributes[t]||{},o=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:i[t]).reduce((function(t,e){return t[e]="",t}),{});kt(n)&&_t(n)&&(Object.assign(n.style,o),Object.keys(r).forEach((function(t){n.removeAttribute(t)})))}))}}var Ct={name:"applyStyles",enabled:!0,phase:"write",fn:zt,effect:St,requires:["computeStyles"]};function Et(t){return t.split("-")[0]}function Mt(t){var e=t.getBoundingClientRect();return{width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left,x:e.left,y:e.top}}function Lt(t){var e=Mt(t),i=t.offsetWidth,n=t.offsetHeight;return Math.abs(e.width-i)<=1&&(i=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:t.offsetLeft,y:t.offsetTop,width:i,height:n}}function Tt(t,e){var i=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(i&&At(i)){var n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function Ht(t){return wt(t).getComputedStyle(t)}function Ot(t){return["table","td","th"].indexOf(_t(t))>=0}function $t(t){return((xt(t)?t.ownerDocument:t.document)||window.document).documentElement}function Vt(t){return"html"===_t(t)?t:t.assignedSlot||t.parentNode||(At(t)?t.host:null)||$t(t)}function It(t){return kt(t)&&"fixed"!==Ht(t).position?t.offsetParent:null}function Rt(t){var e=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&kt(t)&&"fixed"===Ht(t).position)return null;for(var i=Vt(t);kt(i)&&["html","body"].indexOf(_t(i))<0;){var n=Ht(i);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||e&&"filter"===n.willChange||e&&n.filter&&"none"!==n.filter)return i;i=i.parentNode}return null}function Pt(t){for(var e=wt(t),i=It(t);i&&Ot(i)&&"static"===Ht(i).position;)i=It(i);return i&&("html"===_t(i)||"body"===_t(i)&&"static"===Ht(i).position)?e:i||Rt(t)||e}function Dt(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}var Nt=Math.max,Ft=Math.min,Bt=Math.round;function jt(t,e,i){return Nt(t,Ft(e,i))}function qt(){return{top:0,right:0,bottom:0,left:0}}function Ut(t){return Object.assign({},qt(),t)}function Wt(t,e){return e.reduce((function(e,i){return e[i]=t,e}),{})}var Yt=function(t,e){return Ut("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:Wt(t,ht))};function Gt(t){var e,i=t.state,n=t.name,r=t.options,o=i.elements.arrow,s=i.modifiersData.popperOffsets,a=Et(i.placement),l=Dt(a),c=[lt,at].indexOf(a)>=0?"height":"width";if(o&&s){var h=Yt(r.padding,i),d=Lt(o),p="y"===l?ot:lt,u="y"===l?st:at,g=i.rects.reference[c]+i.rects.reference[l]-s[l]-i.rects.popper[c],f=s[l]-i.rects.reference[l],m=Pt(o),v=m?"y"===l?m.clientHeight||0:m.clientWidth||0:0,b=g/2-f/2,y=h[p],_=v-d[c]-h[u],w=v/2-d[c]/2+b,x=jt(y,w,_),k=l;i.modifiersData[n]=((e={})[k]=x,e.centerOffset=x-w,e)}}function Xt(t){var e=t.state,i=t.options.element,n=void 0===i?"[data-popper-arrow]":i;null!=n&&("string"!=typeof n||(n=e.elements.popper.querySelector(n)))&&Tt(e.elements.popper,n)&&(e.elements.arrow=n)}var Kt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Qt(t){var e=t.x,i=t.y,n=window.devicePixelRatio||1;return{x:Bt(Bt(e*n)/n)||0,y:Bt(Bt(i*n)/n)||0}}function Zt(t){var e,i=t.popper,n=t.popperRect,r=t.placement,o=t.offsets,s=t.position,a=t.gpuAcceleration,l=t.adaptive,c=t.roundOffsets,h=!0===c?Qt(o):"function"==typeof c?c(o):o,d=h.x,p=void 0===d?0:d,u=h.y,g=void 0===u?0:u,f=o.hasOwnProperty("x"),m=o.hasOwnProperty("y"),v=lt,b=ot,y=window;if(l){var _=Pt(i),w="clientHeight",x="clientWidth";_===wt(i)&&"static"!==Ht(_=$t(i)).position&&(w="scrollHeight",x="scrollWidth"),_=_,r===ot&&(b=st,g-=_[w]-n.height,g*=a?1:-1),r===lt&&(v=at,p-=_[x]-n.width,p*=a?1:-1)}var k,A=Object.assign({position:s},l&&Kt);return a?Object.assign({},A,((k={})[b]=m?"0":"",k[v]=f?"0":"",k.transform=(y.devicePixelRatio||1)<2?"translate("+p+"px, "+g+"px)":"translate3d("+p+"px, "+g+"px, 0)",k)):Object.assign({},A,((e={})[b]=m?g+"px":"",e[v]=f?p+"px":"",e.transform="",e))}function Jt(t){var e=t.state,i=t.options,n=i.gpuAcceleration,r=void 0===n||n,o=i.adaptive,s=void 0===o||o,a=i.roundOffsets,l=void 0===a||a,c={placement:Et(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,Zt(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:l})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,Zt(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}var te={passive:!0};function ee(t){var e=t.state,i=t.instance,n=t.options,r=n.scroll,o=void 0===r||r,s=n.resize,a=void 0===s||s,l=wt(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&c.forEach((function(t){t.addEventListener("scroll",i.update,te)})),a&&l.addEventListener("resize",i.update,te),function(){o&&c.forEach((function(t){t.removeEventListener("scroll",i.update,te)})),a&&l.removeEventListener("resize",i.update,te)}}var ie={left:"right",right:"left",bottom:"top",top:"bottom"};function ne(t){return t.replace(/left|right|bottom|top/g,(function(t){return ie[t]}))}var re={start:"end",end:"start"};function oe(t){return t.replace(/start|end/g,(function(t){return re[t]}))}function se(t){var e=wt(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function ae(t){return Mt($t(t)).left+se(t).scrollLeft}function le(t){var e=wt(t),i=$t(t),n=e.visualViewport,r=i.clientWidth,o=i.clientHeight,s=0,a=0;return n&&(r=n.width,o=n.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(s=n.offsetLeft,a=n.offsetTop)),{width:r,height:o,x:s+ae(t),y:a}}function ce(t){var e,i=$t(t),n=se(t),r=null==(e=t.ownerDocument)?void 0:e.body,o=Nt(i.scrollWidth,i.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),s=Nt(i.scrollHeight,i.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-n.scrollLeft+ae(t),l=-n.scrollTop;return"rtl"===Ht(r||i).direction&&(a+=Nt(i.clientWidth,r?r.clientWidth:0)-o),{width:o,height:s,x:a,y:l}}function he(t){var e=Ht(t),i=e.overflow,n=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(i+r+n)}function de(t){return["html","body","#document"].indexOf(_t(t))>=0?t.ownerDocument.body:kt(t)&&he(t)?t:de(Vt(t))}function pe(t,e){var i;void 0===e&&(e=[]);var n=de(t),r=n===(null==(i=t.ownerDocument)?void 0:i.body),o=wt(n),s=r?[o].concat(o.visualViewport||[],he(n)?n:[]):n,a=e.concat(s);return r?a:a.concat(pe(Vt(s)))}function ue(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function ge(t){var e=Mt(t);return e.top=e.top+t.clientTop,e.left=e.left+t.clientLeft,e.bottom=e.top+t.clientHeight,e.right=e.left+t.clientWidth,e.width=t.clientWidth,e.height=t.clientHeight,e.x=e.left,e.y=e.top,e}function fe(t,e){return e===gt?ue(le(t)):kt(e)?ge(e):ue(ce($t(t)))}function me(t){var e=pe(Vt(t)),i=["absolute","fixed"].indexOf(Ht(t).position)>=0&&kt(t)?Pt(t):t;return xt(i)?e.filter((function(t){return xt(t)&&Tt(t,i)&&"body"!==_t(t)})):[]}function ve(t,e,i){var n="clippingParents"===e?me(t):[].concat(e),r=[].concat(n,[i]),o=r[0],s=r.reduce((function(e,i){var n=fe(t,i);return e.top=Nt(n.top,e.top),e.right=Ft(n.right,e.right),e.bottom=Ft(n.bottom,e.bottom),e.left=Nt(n.left,e.left),e}),fe(t,o));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function be(t){return t.split("-")[1]}function ye(t){var e,i=t.reference,n=t.element,r=t.placement,o=r?Et(r):null,s=r?be(r):null,a=i.x+i.width/2-n.width/2,l=i.y+i.height/2-n.height/2;switch(o){case ot:e={x:a,y:i.y-n.height};break;case st:e={x:a,y:i.y+i.height};break;case at:e={x:i.x+i.width,y:l};break;case lt:e={x:i.x-n.width,y:l};break;default:e={x:i.x,y:i.y}}var c=o?Dt(o):null;if(null!=c){var h="y"===c?"height":"width";switch(s){case dt:e[c]=e[c]-(i[h]/2-n[h]/2);break;case pt:e[c]=e[c]+(i[h]/2-n[h]/2)}}return e}function _e(t,e){void 0===e&&(e={});var i=e,n=i.placement,r=void 0===n?t.placement:n,o=i.boundary,s=void 0===o?ut:o,a=i.rootBoundary,l=void 0===a?gt:a,c=i.elementContext,h=void 0===c?ft:c,d=i.altBoundary,p=void 0!==d&&d,u=i.padding,g=void 0===u?0:u,f=Ut("number"!=typeof g?g:Wt(g,ht)),m=h===ft?mt:ft,v=t.elements.reference,b=t.rects.popper,y=t.elements[p?m:h],_=ve(xt(y)?y:y.contextElement||$t(t.elements.popper),s,l),w=Mt(v),x=ye({reference:w,element:b,strategy:"absolute",placement:r}),k=ue(Object.assign({},b,x)),A=h===ft?k:w,z={top:_.top-A.top+f.top,bottom:A.bottom-_.bottom+f.bottom,left:_.left-A.left+f.left,right:A.right-_.right+f.right},S=t.modifiersData.offset;if(h===ft&&S){var C=S[r];Object.keys(z).forEach((function(t){var e=[at,st].indexOf(t)>=0?1:-1,i=[ot,st].indexOf(t)>=0?"y":"x";z[t]+=C[i]*e}))}return z}function we(t,e){void 0===e&&(e={});var i=e,n=i.placement,r=i.boundary,o=i.rootBoundary,s=i.padding,a=i.flipVariations,l=i.allowedAutoPlacements,c=void 0===l?bt:l,h=be(n),d=h?a?vt:vt.filter((function(t){return be(t)===h})):ht,p=d.filter((function(t){return c.indexOf(t)>=0}));0===p.length&&(p=d);var u=p.reduce((function(e,i){return e[i]=_e(t,{placement:i,boundary:r,rootBoundary:o,padding:s})[Et(i)],e}),{});return Object.keys(u).sort((function(t,e){return u[t]-u[e]}))}function xe(t){if(Et(t)===ct)return[];var e=ne(t);return[oe(t),e,oe(e)]}function ke(t){var e=t.state,i=t.options,n=t.name;if(!e.modifiersData[n]._skip){for(var r=i.mainAxis,o=void 0===r||r,s=i.altAxis,a=void 0===s||s,l=i.fallbackPlacements,c=i.padding,h=i.boundary,d=i.rootBoundary,p=i.altBoundary,u=i.flipVariations,g=void 0===u||u,f=i.allowedAutoPlacements,m=e.options.placement,v=Et(m),b=l||(v===m||!g?[ne(m)]:xe(m)),y=[m].concat(b).reduce((function(t,i){return t.concat(Et(i)===ct?we(e,{placement:i,boundary:h,rootBoundary:d,padding:c,flipVariations:g,allowedAutoPlacements:f}):i)}),[]),_=e.rects.reference,w=e.rects.popper,x=new Map,k=!0,A=y[0],z=0;z<y.length;z++){var S=y[z],C=Et(S),E=be(S)===dt,M=[ot,st].indexOf(C)>=0,L=M?"width":"height",T=_e(e,{placement:S,boundary:h,rootBoundary:d,altBoundary:p,padding:c}),H=M?E?at:lt:E?st:ot;_[L]>w[L]&&(H=ne(H));var O=ne(H),$=[];if(o&&$.push(T[C]<=0),a&&$.push(T[H]<=0,T[O]<=0),$.every((function(t){return t}))){A=S,k=!1;break}x.set(S,$)}if(k)for(var V=function(t){var e=y.find((function(e){var i=x.get(e);if(i)return i.slice(0,t).every((function(t){return t}))}));if(e)return A=e,"break"},I=g?3:1;I>0;I--){if("break"===V(I))break}e.placement!==A&&(e.modifiersData[n]._skip=!0,e.placement=A,e.reset=!0)}}function Ae(t,e,i){return void 0===i&&(i={x:0,y:0}),{top:t.top-e.height-i.y,right:t.right-e.width+i.x,bottom:t.bottom-e.height+i.y,left:t.left-e.width-i.x}}function ze(t){return[ot,at,st,lt].some((function(e){return t[e]>=0}))}function Se(t){var e=t.state,i=t.name,n=e.rects.reference,r=e.rects.popper,o=e.modifiersData.preventOverflow,s=_e(e,{elementContext:"reference"}),a=_e(e,{altBoundary:!0}),l=Ae(s,n),c=Ae(a,r,o),h=ze(l),d=ze(c);e.modifiersData[i]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:h,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":d})}function Ce(t,e,i){var n=Et(t),r=[lt,ot].indexOf(n)>=0?-1:1,o="function"==typeof i?i(Object.assign({},e,{placement:t})):i,s=o[0],a=o[1];return s=s||0,a=(a||0)*r,[lt,at].indexOf(n)>=0?{x:a,y:s}:{x:s,y:a}}function Ee(t){var e=t.state,i=t.options,n=t.name,r=i.offset,o=void 0===r?[0,0]:r,s=bt.reduce((function(t,i){return t[i]=Ce(i,e.rects,o),t}),{}),a=s[e.placement],l=a.x,c=a.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[n]=s}function Me(t){var e=t.state,i=t.name;e.modifiersData[i]=ye({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}function Le(t){return"x"===t?"y":"x"}function Te(t){var e=t.state,i=t.options,n=t.name,r=i.mainAxis,o=void 0===r||r,s=i.altAxis,a=void 0!==s&&s,l=i.boundary,c=i.rootBoundary,h=i.altBoundary,d=i.padding,p=i.tether,u=void 0===p||p,g=i.tetherOffset,f=void 0===g?0:g,m=_e(e,{boundary:l,rootBoundary:c,padding:d,altBoundary:h}),v=Et(e.placement),b=be(e.placement),y=!b,_=Dt(v),w=Le(_),x=e.modifiersData.popperOffsets,k=e.rects.reference,A=e.rects.popper,z="function"==typeof f?f(Object.assign({},e.rects,{placement:e.placement})):f,S={x:0,y:0};if(x){if(o||a){var C="y"===_?ot:lt,E="y"===_?st:at,M="y"===_?"height":"width",L=x[_],T=x[_]+m[C],H=x[_]-m[E],O=u?-A[M]/2:0,$=b===dt?k[M]:A[M],V=b===dt?-A[M]:-k[M],I=e.elements.arrow,R=u&&I?Lt(I):{width:0,height:0},P=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:qt(),D=P[C],N=P[E],F=jt(0,k[M],R[M]),B=y?k[M]/2-O-F-D-z:$-F-D-z,j=y?-k[M]/2+O+F+N+z:V+F+N+z,q=e.elements.arrow&&Pt(e.elements.arrow),U=q?"y"===_?q.clientTop||0:q.clientLeft||0:0,W=e.modifiersData.offset?e.modifiersData.offset[e.placement][_]:0,Y=x[_]+B-W-U,G=x[_]+j-W;if(o){var X=jt(u?Ft(T,Y):T,L,u?Nt(H,G):H);x[_]=X,S[_]=X-L}if(a){var K="x"===_?ot:lt,Q="x"===_?st:at,Z=x[w],J=Z+m[K],tt=Z-m[Q],et=jt(u?Ft(J,Y):J,Z,u?Nt(tt,G):tt);x[w]=et,S[w]=et-Z}}e.modifiersData[n]=S}}function He(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function Oe(t){return t!==wt(t)&&kt(t)?He(t):se(t)}function $e(t,e,i){void 0===i&&(i=!1);var n=$t(e),r=Mt(t),o=kt(e),s={scrollLeft:0,scrollTop:0},a={x:0,y:0};return(o||!o&&!i)&&(("body"!==_t(e)||he(n))&&(s=Oe(e)),kt(e)?((a=Mt(e)).x+=e.clientLeft,a.y+=e.clientTop):n&&(a.x=ae(n))),{x:r.left+s.scrollLeft-a.x,y:r.top+s.scrollTop-a.y,width:r.width,height:r.height}}function Ve(t){var e=new Map,i=new Set,n=[];function r(t){i.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!i.has(t)){var n=e.get(t);n&&r(n)}})),n.push(t)}return t.forEach((function(t){e.set(t.name,t)})),t.forEach((function(t){i.has(t.name)||r(t)})),n}function Ie(t){var e=Ve(t);return yt.reduce((function(t,i){return t.concat(e.filter((function(t){return t.phase===i})))}),[])}function Re(t){var e;return function(){return e||(e=new Promise((function(i){Promise.resolve().then((function(){e=void 0,i(t())}))}))),e}}function Pe(t){var e=t.reduce((function(t,e){var i=t[e.name];return t[e.name]=i?Object.assign({},i,e,{options:Object.assign({},i.options,e.options),data:Object.assign({},i.data,e.data)}):e,t}),{});return Object.keys(e).map((function(t){return e[t]}))}var De={placement:"bottom",modifiers:[],strategy:"absolute"};function Ne(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return!e.some((function(t){return!(t&&"function"==typeof t.getBoundingClientRect)}))}function Fe(t){void 0===t&&(t={});var e=t,i=e.defaultModifiers,n=void 0===i?[]:i,r=e.defaultOptions,o=void 0===r?De:r;return function(t,e,i){void 0===i&&(i=o);var r={placement:"bottom",orderedModifiers:[],options:Object.assign({},De,o),modifiersData:{},elements:{reference:t,popper:e},attributes:{},styles:{}},s=[],a=!1,l={state:r,setOptions:function(i){h(),r.options=Object.assign({},o,r.options,i),r.scrollParents={reference:xt(t)?pe(t):t.contextElement?pe(t.contextElement):[],popper:pe(e)};var s=Ie(Pe([].concat(n,r.options.modifiers)));return r.orderedModifiers=s.filter((function(t){return t.enabled})),c(),l.update()},forceUpdate:function(){if(!a){var t=r.elements,e=t.reference,i=t.popper;if(Ne(e,i)){r.rects={reference:$e(e,Pt(i),"fixed"===r.options.strategy),popper:Lt(i)},r.reset=!1,r.placement=r.options.placement,r.orderedModifiers.forEach((function(t){return r.modifiersData[t.name]=Object.assign({},t.data)}));for(var n=0;n<r.orderedModifiers.length;n++)if(!0!==r.reset){var o=r.orderedModifiers[n],s=o.fn,c=o.options,h=void 0===c?{}:c,d=o.name;"function"==typeof s&&(r=s({state:r,options:h,name:d,instance:l})||r)}else r.reset=!1,n=-1}}},update:Re((function(){return new Promise((function(t){l.forceUpdate(),t(r)}))})),destroy:function(){h(),a=!0}};if(!Ne(t,e))return l;function c(){r.orderedModifiers.forEach((function(t){var e=t.name,i=t.options,n=void 0===i?{}:i,o=t.effect;if("function"==typeof o){var a=o({state:r,name:e,instance:l,options:n}),c=function(){};s.push(a||c)}}))}function h(){s.forEach((function(t){return t()})),s=[]}return l.setOptions(i).then((function(t){!a&&i.onFirstUpdate&&i.onFirstUpdate(t)})),l}}var Be=Fe({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:ee,data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:Me,data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Jt,data:{}},Ct,{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Ee},{name:"flip",enabled:!0,phase:"main",fn:ke,requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:Te,requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:Gt,effect:Xt,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Se}]}),je="tippy-box",qe="tippy-content",Ue="tippy-backdrop",We="tippy-arrow",Ye="tippy-svg-arrow",Ge={passive:!0,capture:!0};function Xe(t,e,i){if(Array.isArray(t)){var n=t[e];return null==n?Array.isArray(i)?i[e]:i:n}return t}function Ke(t,e){var i={}.toString.call(t);return 0===i.indexOf("[object")&&i.indexOf(e+"]")>-1}function Qe(t,e){return"function"==typeof t?t.apply(void 0,e):t}function Ze(t,e){return 0===e?t:function(n){clearTimeout(i),i=setTimeout((function(){t(n)}),e)};var i}function Je(t){return t.split(/\s+/).filter(Boolean)}function ti(t){return[].concat(t)}function ei(t,e){-1===t.indexOf(e)&&t.push(e)}function ii(t){return t.filter((function(e,i){return t.indexOf(e)===i}))}function ni(t){return t.split("-")[0]}function ri(t){return[].slice.call(t)}function oi(t){return Object.keys(t).reduce((function(e,i){return void 0!==t[i]&&(e[i]=t[i]),e}),{})}function si(){return document.createElement("div")}function ai(t){return["Element","Fragment"].some((function(e){return Ke(t,e)}))}function li(t){return Ke(t,"NodeList")}function ci(t){return Ke(t,"MouseEvent")}function hi(t){return!(!t||!t._tippy||t._tippy.reference!==t)}function di(t){return ai(t)?[t]:li(t)?ri(t):Array.isArray(t)?t:ri(document.querySelectorAll(t))}function pi(t,e){t.forEach((function(t){t&&(t.style.transitionDuration=e+"ms")}))}function ui(t,e){t.forEach((function(t){t&&t.setAttribute("data-state",e)}))}function gi(t){var e,i=ti(t)[0];return(null==i||null==(e=i.ownerDocument)?void 0:e.body)?i.ownerDocument:document}function fi(t,e){var i=e.clientX,n=e.clientY;return t.every((function(t){var e=t.popperRect,r=t.popperState,o=t.props.interactiveBorder,s=ni(r.placement),a=r.modifiersData.offset;if(!a)return!0;var l="bottom"===s?a.top.y:0,c="top"===s?a.bottom.y:0,h="right"===s?a.left.x:0,d="left"===s?a.right.x:0,p=e.top-n+l>o,u=n-e.bottom-c>o,g=e.left-i+h>o,f=i-e.right-d>o;return p||u||g||f}))}function mi(t,e,i){var n=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach((function(e){t[n](e,i)}))}var vi={isTouch:!1},bi=0;function yi(){vi.isTouch||(vi.isTouch=!0,window.performance&&document.addEventListener("mousemove",_i))}function _i(){var t=performance.now();t-bi<20&&(vi.isTouch=!1,document.removeEventListener("mousemove",_i)),bi=t}function wi(){var t=document.activeElement;if(hi(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function xi(){document.addEventListener("touchstart",yi,Ge),window.addEventListener("blur",wi)}var ki="undefined"!=typeof window&&"undefined"!=typeof document?navigator.userAgent:"",Ai=/MSIE |Trident\//.test(ki),zi={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},Si={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Ci=Object.assign({appendTo:function(){return document.body},aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},zi,{},Si),Ei=Object.keys(Ci),Mi=function(t){Object.keys(t).forEach((function(e){Ci[e]=t[e]}))};function Li(t){var e=(t.plugins||[]).reduce((function(e,i){var n=i.name,r=i.defaultValue;return n&&(e[n]=void 0!==t[n]?t[n]:r),e}),{});return Object.assign({},t,{},e)}function Ti(t,e){return(e?Object.keys(Li(Object.assign({},Ci,{plugins:e}))):Ei).reduce((function(e,i){var n=(t.getAttribute("data-tippy-"+i)||"").trim();if(!n)return e;if("content"===i)e[i]=n;else try{e[i]=JSON.parse(n)}catch(t){e[i]=n}return e}),{})}function Hi(t,e){var i=Object.assign({},e,{content:Qe(e.content,[t])},e.ignoreAttributes?{}:Ti(t,e.plugins));return i.aria=Object.assign({},Ci.aria,{},i.aria),i.aria={expanded:"auto"===i.aria.expanded?e.interactive:i.aria.expanded,content:"auto"===i.aria.content?e.interactive?null:"describedby":i.aria.content},i}var Oi=function(){return"innerHTML"};function $i(t,e){t[Oi()]=e}function Vi(t){var e=si();return!0===t?e.className=We:(e.className=Ye,ai(t)?e.appendChild(t):$i(e,t)),e}function Ii(t,e){ai(e.content)?($i(t,""),t.appendChild(e.content)):"function"!=typeof e.content&&(e.allowHTML?$i(t,e.content):t.textContent=e.content)}function Ri(t){var e=t.firstElementChild,i=ri(e.children);return{box:e,content:i.find((function(t){return t.classList.contains(qe)})),arrow:i.find((function(t){return t.classList.contains(We)||t.classList.contains(Ye)})),backdrop:i.find((function(t){return t.classList.contains(Ue)}))}}function Pi(t){var e=si(),i=si();i.className=je,i.setAttribute("data-state","hidden"),i.setAttribute("tabindex","-1");var n=si();function r(i,n){var r=Ri(e),o=r.box,s=r.content,a=r.arrow;n.theme?o.setAttribute("data-theme",n.theme):o.removeAttribute("data-theme"),"string"==typeof n.animation?o.setAttribute("data-animation",n.animation):o.removeAttribute("data-animation"),n.inertia?o.setAttribute("data-inertia",""):o.removeAttribute("data-inertia"),o.style.maxWidth="number"==typeof n.maxWidth?n.maxWidth+"px":n.maxWidth,n.role?o.setAttribute("role",n.role):o.removeAttribute("role"),i.content===n.content&&i.allowHTML===n.allowHTML||Ii(s,t.props),n.arrow?a?i.arrow!==n.arrow&&(o.removeChild(a),o.appendChild(Vi(n.arrow))):o.appendChild(Vi(n.arrow)):a&&o.removeChild(a)}return n.className=qe,n.setAttribute("data-state","hidden"),Ii(n,t.props),e.appendChild(i),i.appendChild(n),r(t.props,t.props),{popper:e,onUpdate:r}}Pi.$$tippy=!0;var Di=1,Ni=[],Fi=[];function Bi(t,e){var i,n,r,o,s,a,l,c=Hi(t,Object.assign({},Ci,{},Li(oi(e)))),h=!1,d=!1,p=!1,u=!1,g=[],f=Ze(K,c.interactiveDebounce),m=Di++,v=null,b=ii(c.plugins),y={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},_={id:m,reference:t,popper:si(),popperInstance:v,props:c,state:y,plugins:b,clearDelayTimeouts:lt,setProps:ct,setContent:ht,show:dt,hide:pt,hideWithInteractivity:ut,enable:st,disable:at,unmount:gt,destroy:ft};if(!c.render)return _;var w=c.render(_),x=w.popper,k=w.onUpdate;x.setAttribute("data-tippy-root",""),x.id="tippy-"+_.id,_.popper=x,t._tippy=_,x._tippy=_;var A=b.map((function(t){return t.fn(_)})),z=t.hasAttribute("aria-expanded");return Y(),I(),O(),$("onCreate",[_]),c.showOnCreate&&rt(),x.addEventListener("mouseenter",(function(){_.props.interactive&&_.state.isVisible&&_.clearDelayTimeouts()})),x.addEventListener("mouseleave",(function(t){_.props.interactive&&_.props.trigger.indexOf("mouseenter")>=0&&(L().addEventListener("mousemove",f),f(t))})),_;function S(){var t=_.props.touch;return Array.isArray(t)?t:[t,0]}function C(){return"hold"===S()[0]}function E(){var t;return!!(null==(t=_.props.render)?void 0:t.$$tippy)}function M(){return l||t}function L(){var t=M().parentNode;return t?gi(t):document}function T(){return Ri(x)}function H(t){return _.state.isMounted&&!_.state.isVisible||vi.isTouch||o&&"focus"===o.type?0:Xe(_.props.delay,t?0:1,Ci.delay)}function O(){x.style.pointerEvents=_.props.interactive&&_.state.isVisible?"":"none",x.style.zIndex=""+_.props.zIndex}function $(t,e,i){var n;(void 0===i&&(i=!0),A.forEach((function(i){i[t]&&i[t].apply(void 0,e)})),i)&&(n=_.props)[t].apply(n,e)}function V(){var e=_.props.aria;if(e.content){var i="aria-"+e.content,n=x.id;ti(_.props.triggerTarget||t).forEach((function(t){var e=t.getAttribute(i);if(_.state.isVisible)t.setAttribute(i,e?e+" "+n:n);else{var r=e&&e.replace(n,"").trim();r?t.setAttribute(i,r):t.removeAttribute(i)}}))}}function I(){!z&&_.props.aria.expanded&&ti(_.props.triggerTarget||t).forEach((function(t){_.props.interactive?t.setAttribute("aria-expanded",_.state.isVisible&&t===M()?"true":"false"):t.removeAttribute("aria-expanded")}))}function R(){L().removeEventListener("mousemove",f),Ni=Ni.filter((function(t){return t!==f}))}function P(t){if(!(vi.isTouch&&(p||"mousedown"===t.type)||_.props.interactive&&x.contains(t.target))){if(M().contains(t.target)){if(vi.isTouch)return;if(_.state.isVisible&&_.props.trigger.indexOf("click")>=0)return}else $("onClickOutside",[_,t]);!0===_.props.hideOnClick&&(_.clearDelayTimeouts(),_.hide(),d=!0,setTimeout((function(){d=!1})),_.state.isMounted||B())}}function D(){p=!0}function N(){p=!1}function F(){var t=L();t.addEventListener("mousedown",P,!0),t.addEventListener("touchend",P,Ge),t.addEventListener("touchstart",N,Ge),t.addEventListener("touchmove",D,Ge)}function B(){var t=L();t.removeEventListener("mousedown",P,!0),t.removeEventListener("touchend",P,Ge),t.removeEventListener("touchstart",N,Ge),t.removeEventListener("touchmove",D,Ge)}function j(t,e){U(t,(function(){!_.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&e()}))}function q(t,e){U(t,e)}function U(t,e){var i=T().box;function n(t){t.target===i&&(mi(i,"remove",n),e())}if(0===t)return e();mi(i,"remove",s),mi(i,"add",n),s=n}function W(e,i,n){void 0===n&&(n=!1),ti(_.props.triggerTarget||t).forEach((function(t){t.addEventListener(e,i,n),g.push({node:t,eventType:e,handler:i,options:n})}))}function Y(){C()&&(W("touchstart",X,{passive:!0}),W("touchend",Q,{passive:!0})),Je(_.props.trigger).forEach((function(t){if("manual"!==t)switch(W(t,X),t){case"mouseenter":W("mouseleave",Q);break;case"focus":W(Ai?"focusout":"blur",Z);break;case"focusin":W("focusout",Z)}}))}function G(){g.forEach((function(t){var e=t.node,i=t.eventType,n=t.handler,r=t.options;e.removeEventListener(i,n,r)})),g=[]}function X(t){var e,i=!1;if(_.state.isEnabled&&!J(t)&&!d){var n="focus"===(null==(e=o)?void 0:e.type);o=t,l=t.currentTarget,I(),!_.state.isVisible&&ci(t)&&Ni.forEach((function(e){return e(t)})),"click"===t.type&&(_.props.trigger.indexOf("mouseenter")<0||h)&&!1!==_.props.hideOnClick&&_.state.isVisible?i=!0:rt(t),"click"===t.type&&(h=!i),i&&!n&&ot(t)}}function K(t){var e=t.target,i=M().contains(e)||x.contains(e);"mousemove"===t.type&&i||fi(nt().concat(x).map((function(t){var e,i=null==(e=t._tippy.popperInstance)?void 0:e.state;return i?{popperRect:t.getBoundingClientRect(),popperState:i,props:c}:null})).filter(Boolean),t)&&(R(),ot(t))}function Q(t){J(t)||_.props.trigger.indexOf("click")>=0&&h||(_.props.interactive?_.hideWithInteractivity(t):ot(t))}function Z(t){_.props.trigger.indexOf("focusin")<0&&t.target!==M()||_.props.interactive&&t.relatedTarget&&x.contains(t.relatedTarget)||ot(t)}function J(t){return!!vi.isTouch&&C()!==t.type.indexOf("touch")>=0}function tt(){et();var e=_.props,i=e.popperOptions,n=e.placement,r=e.offset,o=e.getReferenceClientRect,s=e.moveTransition,l=E()?Ri(x).arrow:null,c=o?{getBoundingClientRect:o,contextElement:o.contextElement||M()}:t,h=[{name:"offset",options:{offset:r}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!s}},{name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(t){var e=t.state;if(E()){var i=T().box;["placement","reference-hidden","escaped"].forEach((function(t){"placement"===t?i.setAttribute("data-placement",e.placement):e.attributes.popper["data-popper-"+t]?i.setAttribute("data-"+t,""):i.removeAttribute("data-"+t)})),e.attributes.popper={}}}}];E()&&l&&h.push({name:"arrow",options:{element:l,padding:3}}),h.push.apply(h,(null==i?void 0:i.modifiers)||[]),_.popperInstance=Be(c,x,Object.assign({},i,{placement:n,onFirstUpdate:a,modifiers:h}))}function et(){_.popperInstance&&(_.popperInstance.destroy(),_.popperInstance=null)}function it(){var t,e=_.props.appendTo,i=M();(t=_.props.interactive&&e===Ci.appendTo||"parent"===e?i.parentNode:Qe(e,[i])).contains(x)||t.appendChild(x),tt()}function nt(){return ri(x.querySelectorAll("[data-tippy-root]"))}function rt(t){_.clearDelayTimeouts(),t&&$("onTrigger",[_,t]),F();var e=H(!0),n=S(),r=n[0],o=n[1];vi.isTouch&&"hold"===r&&o&&(e=o),e?i=setTimeout((function(){_.show()}),e):_.show()}function ot(t){if(_.clearDelayTimeouts(),$("onUntrigger",[_,t]),_.state.isVisible){if(!(_.props.trigger.indexOf("mouseenter")>=0&&_.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(t.type)>=0&&h)){var e=H(!1);e?n=setTimeout((function(){_.state.isVisible&&_.hide()}),e):r=requestAnimationFrame((function(){_.hide()}))}}else B()}function st(){_.state.isEnabled=!0}function at(){_.hide(),_.state.isEnabled=!1}function lt(){clearTimeout(i),clearTimeout(n),cancelAnimationFrame(r)}function ct(e){if(!_.state.isDestroyed){$("onBeforeUpdate",[_,e]),G();var i=_.props,n=Hi(t,Object.assign({},_.props,{},e,{ignoreAttributes:!0}));_.props=n,Y(),i.interactiveDebounce!==n.interactiveDebounce&&(R(),f=Ze(K,n.interactiveDebounce)),i.triggerTarget&&!n.triggerTarget?ti(i.triggerTarget).forEach((function(t){t.removeAttribute("aria-expanded")})):n.triggerTarget&&t.removeAttribute("aria-expanded"),I(),O(),k&&k(i,n),_.popperInstance&&(tt(),nt().forEach((function(t){requestAnimationFrame(t._tippy.popperInstance.forceUpdate)}))),$("onAfterUpdate",[_,e])}}function ht(t){_.setProps({content:t})}function dt(){var t=_.state.isVisible,e=_.state.isDestroyed,i=!_.state.isEnabled,n=vi.isTouch&&!_.props.touch,r=Xe(_.props.duration,0,Ci.duration);if(!(t||e||i||n||M().hasAttribute("disabled")||($("onShow",[_],!1),!1===_.props.onShow(_)))){if(_.state.isVisible=!0,E()&&(x.style.visibility="visible"),O(),F(),_.state.isMounted||(x.style.transition="none"),E()){var o=T();pi([o.box,o.content],0)}a=function(){var t;if(_.state.isVisible&&!u){if(u=!0,x.offsetHeight,x.style.transition=_.props.moveTransition,E()&&_.props.animation){var e=T(),i=e.box,n=e.content;pi([i,n],r),ui([i,n],"visible")}V(),I(),ei(Fi,_),null==(t=_.popperInstance)||t.forceUpdate(),_.state.isMounted=!0,$("onMount",[_]),_.props.animation&&E()&&q(r,(function(){_.state.isShown=!0,$("onShown",[_])}))}},it()}}function pt(){var t=!_.state.isVisible,e=_.state.isDestroyed,i=!_.state.isEnabled,n=Xe(_.props.duration,1,Ci.duration);if(!(t||e||i)&&($("onHide",[_],!1),!1!==_.props.onHide(_))){if(_.state.isVisible=!1,_.state.isShown=!1,u=!1,h=!1,E()&&(x.style.visibility="hidden"),R(),B(),O(),E()){var r=T(),o=r.box,s=r.content;_.props.animation&&(pi([o,s],n),ui([o,s],"hidden"))}V(),I(),_.props.animation?E()&&j(n,_.unmount):_.unmount()}}function ut(t){L().addEventListener("mousemove",f),ei(Ni,f),f(t)}function gt(){_.state.isVisible&&_.hide(),_.state.isMounted&&(et(),nt().forEach((function(t){t._tippy.unmount()})),x.parentNode&&x.parentNode.removeChild(x),Fi=Fi.filter((function(t){return t!==_})),_.state.isMounted=!1,$("onHidden",[_]))}function ft(){_.state.isDestroyed||(_.clearDelayTimeouts(),_.unmount(),G(),delete t._tippy,_.state.isDestroyed=!0,$("onDestroy",[_]))}}function ji(t,e){void 0===e&&(e={});var i=Ci.plugins.concat(e.plugins||[]);xi();var n=Object.assign({},e,{plugins:i}),r=di(t).reduce((function(t,e){var i=e&&Bi(e,n);return i&&t.push(i),t}),[]);return ai(t)?r[0]:r}ji.defaultProps=Ci,ji.setDefaultProps=Mi,ji.currentInput=vi;Object.assign({},Ct,{effect:function(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow)}});function qi(t){return t.replace(/(?:^\w|[A-Z]|\b\w)/g,(t,e)=>0==+t?"":0===e?t.toLowerCase():t.toUpperCase()).replace("-","")}ji.setDefaultProps({render:Pi});const Ui='\n .tippy-box[data-animation=fade][data-state=hidden] {\n opacity: 0\n }\n\n .tippy-iOS {\n cursor: pointer!important;\n -webkit-tap-highlight-color: transparent\n }\n\n [data-tippy-root] {\n max-width: calc(100vw - 10px)\n }\n\n .tippy-box {\n position: relative;\n background-color: #333;\n color: #fff;\n border-radius: 4px;\n font-size: var(--pb-popover-font-size, var(--pb-base-font-size, 14px));\n line-height: var(--pb-popover-line-height, var(--pb-base-line-height, 1.4));\n text-align: left;\n font-style: normal;\n font-weight: normal;\n outline: 0;\n transition-property: transform, visibility, opacity\n }\n\n .tippy-box[data-placement^=top]>.tippy-arrow {\n bottom: 0\n }\n\n .tippy-box[data-placement^=top]>.tippy-arrow:before {\n bottom: -7px;\n left: 0;\n border-width: 8px 8px 0;\n border-top-color: initial;\n transform-origin: center top\n }\n\n .tippy-box[data-placement^=bottom]>.tippy-arrow {\n top: 0\n }\n\n .tippy-box[data-placement^=bottom]>.tippy-arrow:before {\n top: -7px;\n left: 0;\n border-width: 0 8px 8px;\n border-bottom-color: initial;\n transform-origin: center bottom\n }\n\n .tippy-box[data-placement^=left]>.tippy-arrow {\n right: 0\n }\n\n .tippy-box[data-placement^=left]>.tippy-arrow:before {\n border-width: 8px 0 8px 8px;\n border-left-color: initial;\n right: -7px;\n transform-origin: center left\n }\n\n .tippy-box[data-placement^=right]>.tippy-arrow {\n left: 0\n }\n\n .tippy-box[data-placement^=right]>.tippy-arrow:before {\n left: -7px;\n border-width: 8px 8px 8px 0;\n border-right-color: initial;\n transform-origin: center right\n }\n\n .tippy-box[data-inertia][data-state=visible] {\n transition-timing-function: cubic-bezier(.54, 1.5, .38, 1.11)\n }\n\n .tippy-arrow {\n width: 16px;\n height: 16px;\n color: #333\n }\n\n .tippy-arrow:before {\n content: "";\n position: absolute;\n border-color: transparent;\n border-style: solid\n }\n\n .tippy-content {\n position: relative;\n padding: 5px 9px;\n z-index: 1;\n overflow: auto;\n max-height: var(--pb-popover-max-height, calc(100vh - 60px));\n min-height: var(--pb-popover-min-height, auto);\n max-width: var(--pb-popover-max-width, auto);\n min-width: var(--pb-popover-min-width, auto);\n color: var(--pb-popover-color);\n }\n',Wi='\n .tippy-box[data-theme~=light-border] {\n background-color: #fff;\n background-clip: padding-box;\n border: 1px solid rgba(0, 8, 16, .15);\n color: #333;\n box-shadow: 0 4px 14px -2px rgba(0, 8, 16, .08)\n }\n\n .tippy-box[data-theme~=light-border]>.tippy-backdrop {\n background-color: #fff\n }\n\n .tippy-box[data-theme~=light-border]>.tippy-arrow:after, .tippy-box[data-theme~=light-border]>.tippy-svg-arrow:after {\n content: "";\n position: absolute;\n z-index: -1\n }\n\n .tippy-box[data-theme~=light-border]>.tippy-arrow:after {\n border-color: transparent;\n border-style: solid\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=top]>.tippy-arrow:before {\n border-top-color: #fff\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=top]>.tippy-arrow:after {\n border-top-color: rgba(0, 8, 16, .2);\n border-width: 7px 7px 0;\n top: 17px;\n left: 1px\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=top]>.tippy-svg-arrow>svg {\n top: 16px\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=top]>.tippy-svg-arrow:after {\n top: 17px\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=bottom]>.tippy-arrow:before {\n border-bottom-color: #fff;\n bottom: 16px\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=bottom]>.tippy-arrow:after {\n border-bottom-color: rgba(0, 8, 16, .2);\n border-width: 0 7px 7px;\n bottom: 17px;\n left: 1px\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=bottom]>.tippy-svg-arrow>svg {\n bottom: 16px\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=bottom]>.tippy-svg-arrow:after {\n bottom: 17px\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=left]>.tippy-arrow:before {\n border-left-color: #fff\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=left]>.tippy-arrow:after {\n border-left-color: rgba(0, 8, 16, .2);\n border-width: 7px 0 7px 7px;\n left: 17px;\n top: 1px\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=left]>.tippy-svg-arrow>svg {\n left: 11px\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=left]>.tippy-svg-arrow:after {\n left: 12px\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=right]>.tippy-arrow:before {\n border-right-color: #fff;\n right: 16px\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=right]>.tippy-arrow:after {\n border-width: 7px 7px 7px 0;\n right: 17px;\n top: 1px;\n border-right-color: rgba(0, 8, 16, .2)\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=right]>.tippy-svg-arrow>svg {\n right: 11px\n }\n\n .tippy-box[data-theme~=light-border][data-placement^=right]>.tippy-svg-arrow:after {\n right: 12px\n }\n\n .tippy-box[data-theme~=light-border]>.tippy-svg-arrow {\n fill: #fff\n }\n\n .tippy-box[data-theme~=light-border]>.tippy-svg-arrow:after {\n background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMCA2czEuNzk2LS4wMTMgNC42Ny0zLjYxNUM1Ljg1MS45IDYuOTMuMDA2IDggMGMxLjA3LS4wMDYgMi4xNDguODg3IDMuMzQzIDIuMzg1QzE0LjIzMyA2LjAwNSAxNiA2IDE2IDZIMHoiIGZpbGw9InJnYmEoMCwgOCwgMTYsIDAuMikiLz48L3N2Zz4=);\n background-size: 16px 6px;\n width: 16px;\n height: 6px\n }\n',Yi="\n .tippy-box[data-theme~=light] {\n color: #26323d;\n box-shadow: 0 0 20px 4px rgba(154, 161, 177, .15), 0 4px 80px -8px rgba(36, 40, 47, .25), 0 4px 4px -2px rgba(91, 94, 105, .15);\n background-color: #fff\n }\n\n .tippy-box[data-theme~=light][data-placement^=top]>.tippy-arrow:before {\n border-top-color: #fff\n }\n\n .tippy-box[data-theme~=light][data-placement^=bottom]>.tippy-arrow:before {\n border-bottom-color: #fff\n }\n\n .tippy-box[data-theme~=light][data-placement^=left]>.tippy-arrow:before {\n border-left-color: #fff\n }\n\n .tippy-box[data-theme~=light][data-placement^=right]>.tippy-arrow:before {\n border-right-color: #fff\n }\n\n .tippy-box[data-theme~=light]>.tippy-backdrop {\n background-color: #fff\n }\n\n .tippy-box[data-theme~=light]>.tippy-svg-arrow {\n fill: #fff\n }",Gi="\n .tippy-box[data-theme~=material] {\n background-color: #505355;\n font-weight: 600\n }\n\n .tippy-box[data-theme~=material][data-placement^=top]>.tippy-arrow:before {\n border-top-color: #505355\n }\n\n .tippy-box[data-theme~=material][data-placement^=bottom]>.tippy-arrow:before {\n border-bottom-color: #505355\n }\n\n .tippy-box[data-theme~=material][data-placement^=left]>.tippy-arrow:before {\n border-left-color: #505355\n }\n\n .tippy-box[data-theme~=material][data-placement^=right]>.tippy-arrow:before {\n border-right-color: #505355\n }\n\n .tippy-box[data-theme~=material]>.tippy-backdrop {\n background-color: #505355\n }\n\n .tippy-box[data-theme~=material]>.tippy-svg-arrow {\n fill: #505355\n }\n",Xi="\n .tippy-box[data-theme~=translucent] {\n background-color: rgba(0, 0, 0, .7)\n }\n\n .tippy-box[data-theme~=translucent]>.tippy-arrow {\n width: 14px;\n height: 14px\n }\n\n .tippy-box[data-theme~=translucent][data-placement^=top]>.tippy-arrow:before {\n border-width: 7px 7px 0;\n border-top-color: rgba(0, 0, 0, .7)\n }\n\n .tippy-box[data-theme~=translucent][data-placement^=bottom]>.tippy-arrow:before {\n border-width: 0 7px 7px;\n border-bottom-color: rgba(0, 0, 0, .7)\n }\n\n .tippy-box[data-theme~=translucent][data-placement^=left]>.tippy-arrow:before {\n border-width: 7px 0 7px 7px;\n border-left-color: rgba(0, 0, 0, .7)\n }\n\n .tippy-box[data-theme~=translucent][data-placement^=right]>.tippy-arrow:before {\n border-width: 7px 7px 7px 0;\n border-right-color: rgba(0, 0, 0, .7)\n }\n\n .tippy-box[data-theme~=translucent]>.tippy-backdrop {\n background-color: rgba(0, 0, 0, .7)\n }\n\n .tippy-box[data-theme~=translucent]>.tippy-svg-arrow {\n fill: rgba(0, 0, 0, .7)\n }\n";var Ki=Object.freeze({__proto__:null,camelize:qi,base:Ui,lightBorder:Wi,light:Yi,material:Gi,translucent:Xi});function Qi(t,e,i){if(!t.querySelector("#pb-popover-"+e)){const n=t.nodeType===Node.DOCUMENT_NODE?document.head:t;console.log("Loading tippy styles for theme %s into %o",e,n);const r=document.createElement("style");r.type="text/css",r.id="pb-popover-"+e,r.innerHTML=i,n.appendChild(r)}}function Zi(t,e){if(Qi(t,"base",Ui),e&&"none"!==e){const i=qi(e),n=Ki[i];n&&Qi(t,i,n)}}class Ji extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{for:{type:String},theme:{type:String},placement:{type:String},fallbackPlacement:{type:String,attribute:"fallback-placement"},persistent:{type:Boolean},trigger:{type:String},popupClass:{type:String,attribute:"popup-class"},remote:{type:String}})}constructor(){super(),this.persistent=!1,this.trigger=null,this.for=null,this.theme=null,this.placement=null,this.fallbackPlacement=null,this.popupClass=null,this._tippy=null,this._content=null}render(){return this.for?O`<div class="hidden"><slot></slot></div>`:O`<span id="link" part="trigger" class="${this.persistent?"persistent":""}"><slot name="default"><slot></slot></slot></span><span class="hidden"><slot name="alternate"></slot></span>`}disconnectedCallback(){super.disconnectedCallback(),this._tippy&&this._tippy.destroy(),this._observer&&this._observer.disconnect()}_checkCSSProperties(){this.theme||"none"===this.theme||(this.theme=H(this,"--pb-popover-theme","none")),this.placement||(this.placement=H(this,"--pb-popover-placement","auto")),this.fallbackPlacement||(this.fallbackPlacement=H(this,"--pb-popover-fallback-placement",null)),this.persistent||(this.persistent=H(this,"--pb-popover-persistent",!1)),this.trigger||(this.trigger=H(this,"--pb-popover-trigger",null))}_injectStyles(){this._checkCSSProperties(),Zi(this.getRootNode(),this.theme)}_getContent(){if(this._content)return this._content;const t=this._getSlot();if(t){const e=document.createElement("div");return t.assignedNodes().forEach(t=>{e.appendChild(t.content?t.content.cloneNode(!0):t.cloneNode(!0))}),this._content=e,e}return null}_getSlot(){return this.for?this.shadowRoot.querySelector("slot"):this.shadowRoot.querySelector("[name=alternate]")}_registerMutationObserver(){const t=this._getSlot();this._observer=new MutationObserver(()=>{this.alternate=this._getContent(),console.log("alternate changed"),this.emitTo("pb-popover-changed",this.alternate)}),this._observer.observe(this,{subtree:!0,childList:!0,characterData:!0}),t&&t.assignedNodes().forEach(t=>{this._observer.observe(t.content?t.content:t,{subtree:!0,childList:!0,characterData:!0})})}get alternate(){return this._getContent()}set alternate(t){this._content=t,this._tippy&&this._tippy.setContent(this._content)}command(t,e){"disable"===t&&(this.disabled=e,this._tippy&&(e?this._tippy.disable():this._tippy.enable()))}firstUpdated(){super.firstUpdated(),this._injectStyles(),this._registerMutationObserver(),this.trigger||(this.trigger=this.persistent?"click":"mouseenter");const t=this.getRootNode();let e;if(this.for?(e=t.getElementById(this.for),e||console.error("<pb-popover> target element %s not found",this.for)):e=this.shadowRoot.getElementById("link"),e){const i={allowHTML:!0,appendTo:t.nodeType===Node.DOCUMENT_NODE?document.body:t,placement:this.placement,interactive:!0,ignoreAttributes:!0,boundary:"viewport",maxWidth:"none",touch:"hold",hideOnClick:!1,trigger:this.trigger};if(this.persistent&&(i.onClickOutside=(t,e)=>{t.hideWithInteractivity(e)}),this.theme&&"none"!==this.theme&&(i.theme=this.theme),this.fallbackPlacement){const t=this.fallbackPlacement.split(" ");i.popperOptions={modifiers:[{name:"flip",options:{fallbackPlacements:t}}]}}this.popupClass&&(i.onCreate=t=>{t.popper.classList.add(this.popupClass)}),i.onShow=t=>{this.remote?this._loadRemoteContent():t.setContent(this._getContent()),this.emitTo("pb-popover-show",{source:this})},this._tippy=ji(e,i)}}_loadRemoteContent(){const t=this.toAbsoluteURL(this.remote);fetch(t,{method:"GET",mode:"cors",credentials:"same-origin"}).then(t=>t.text()).then(t=>{this.alternate=t}).catch(t=>{console.error("<pb-popover> Error retrieving remote content: %o",t)})}static get styles(){return[V`
|
|
511
511
|
:host {
|
|
512
512
|
display: inline;
|
|
513
513
|
}
|
|
@@ -525,7 +525,7 @@ const X=n`
|
|
|
525
525
|
#link.persistent {
|
|
526
526
|
cursor: pointer;
|
|
527
527
|
}
|
|
528
|
-
`]}}customElements.define("pb-popover",Ji);class tn extends(
|
|
528
|
+
`]}}customElements.define("pb-popover",Ji);class tn extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{key:{type:String},duration:{type:Number},scroll:{type:Boolean},highlightSelf:{type:Boolean,attribute:"highlight-self"},_className:{type:String}})}constructor(){super(),this.key=null,this.duration=0,this.scroll=!1,this.highlightSelf=!1,this._className="highlight-off"}connectedCallback(){super.connectedCallback(),this.subscribeTo("pb-highlight-on",this._highlightOn.bind(this)),this.subscribeTo("pb-highlight-off",this._highlightOff.bind(this))}command(t,e){super.command(t,e),this.disabled&&(this._className="highlight-off")}_mouseOver(){this.emitTo("pb-highlight-off",{source:this}),this.highlightSelf&&this._highlightOn({detail:{id:this.key}}),this.emitTo("pb-highlight-on",{id:this.key,source:this,scroll:this.scroll})}render(){return this.disabled?O`<slot></slot>`:O`<span id="content" class="${this._className}" @mouseover="${this._mouseOver}"><slot></slot></span>`}static get styles(){return V`
|
|
529
529
|
:host {
|
|
530
530
|
display: inline;
|
|
531
531
|
}
|
|
@@ -555,7 +555,7 @@ const X=n`
|
|
|
555
555
|
.highlight-off {
|
|
556
556
|
background-color: inherit;
|
|
557
557
|
}
|
|
558
|
-
`}_highlightOn(t){t.detail.source!=this&&t.detail.id===this.key&&(this._className="highlight-on",t.detail.scroll&&this.scrollIntoView({behaviour:"smooth"}),this.duration>0&&setTimeout(function(){this._className="highlight-off"}.bind(this),this.duration))}_highlightOff(t){t.detail.source!=this&&(this._className="highlight-off")}}customElements.define("pb-highlight",tn);class en extends(
|
|
558
|
+
`}_highlightOn(t){t.detail.source!=this&&t.detail.id===this.key&&(this._className="highlight-on",t.detail.scroll&&this.scrollIntoView({behaviour:"smooth"}),this.duration>0&&setTimeout(function(){this._className="highlight-off"}.bind(this),this.duration))}_highlightOff(t){t.detail.source!=this&&(this._className="highlight-off")}}customElements.define("pb-highlight",tn);class en extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{xmlId:{type:String,attribute:"xml-id"},nodeId:{type:String,attribute:"node-id",reflect:!0},hash:{type:String,reflect:!0},path:{type:String},odd:{type:String},history:{type:Boolean}})}constructor(){super(),this.history=!0}connectedCallback(){super.connectedCallback(),this._id=this.nodeId,this.subscribeTo("pb-visible",t=>{if(this.nodeId){const[e,i]=t.detail.data.split(/\s*,\s*/);this.nodeId!==e||this.hash&&this.hash!==i?this.classList.remove("active"):(this.classList.add("active"),this.scrollIntoView({block:"nearest"}),this.dispatchEvent(new CustomEvent("pb-collapse-open",{composed:!0,bubbles:!0})))}}),this._content=this.innerHTML}render(){return O`<a href="#" @click="${this._onClick}">${S(this._content)}</a>`}createRenderRoot(){return this}_onClick(t){t.preventDefault();const e={position:null};this.xmlId?(e.id=this.xmlId,this.history&&this.setParameter("id",this.xmlId)):this.nodeId&&(e.position=this.nodeId,this.history&&this.setParameter("root",this.nodeId)),this.path&&(e.path=this.path,this.history&&this.setPath(this.path)),this.odd&&(e.odd=this.odd,this.history&&this.setParameter("odd",this.odd)),this.hash?(e.hash=this.hash,this.history&&(this.getUrl().hash=this.hash)):this.history&&(this.getUrl().hash=""),this.pushHistory("link click"),this.emitTo("pb-refresh",e)}}customElements.define("pb-link",en);class nn extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{facs:{type:String},coordinates:{type:Array},trigger:{type:String},emitOnLoad:{type:Boolean,attribute:"emit-on-load"}})}constructor(){super(),this.trigger="mouseover"}connectedCallback(){super.connectedCallback()}firstUpdated(){const t=this.shadowRoot.querySelector("a");switch(this.trigger){case"click":t.addEventListener("click",this._linkListener.bind(this));break;default:t.addEventListener("mouseover",this._linkListener.bind(this))}this.emitOnLoad&&this._trigger()}render(){return O`<a href="#"><slot></slot></a>`}static get styles(){return V`
|
|
559
559
|
:host {
|
|
560
560
|
}
|
|
561
561
|
|
|
@@ -563,7 +563,7 @@ const X=n`
|
|
|
563
563
|
text-decoration: none;
|
|
564
564
|
color: inherit;
|
|
565
565
|
}
|
|
566
|
-
`}_linkListener(t){t.preventDefault(),this._trigger()}_trigger(){console.log("<facs-link> %s %o",this.facs,this.coordinates),this.emitTo("pb-show-annotation",{file:this.facs,coordinates:this.coordinates})}}function rn(t,e){return window.ESGlobalBridge.requestAvailability(),new Promise(i=>{window.ESGlobalBridge.instance.load(t,e),window.addEventListener(`es-bridge-${t}-loaded`,()=>i(),{once:!0})})}function on(t,e){let i=t.getRootNode();if(i.nodeType===Node.DOCUMENT_NODE)i=i.head;else{const t=document.querySelector("style#"+e.id);t&&t.parentNode.removeChild(t);const i=e.innerHTML.match(/@font-face[^{]+{.*?}/gs);if(i){const t=document.createElement("style");t.id=e.id,t.appendChild(document.createTextNode(i.join("\n"))),document.head.appendChild(t)}}const n=i.querySelector("#"+e.id);n&&n.parentNode.removeChild(n),i.appendChild(e)}function sn(t,e){e.forEach(t=>{if(t.hasChildNodes()){const e=t.hasAttribute("display")||!1,i=t.querySelector("math"),n=window.MathJax.getMetricsFor(t.parentNode,e);let r,o;n.display=e,i?(o=i.outerHTML,r=window.MathJax.mathml2chtml(o,n)):(window.MathJax.texReset(),o=t.innerHTML,r=window.MathJax.tex2chtml(o,n)),t.innerHTML="",t.appendChild(r),t.setAttribute("loaded","loaded"),t.setAttribute("source",o)}}),on(t,window.MathJax.chtmlStylesheet())}function an(t){const e=t.querySelectorAll("pb-formula");if(console.log(`<pb-formula> Found ${e.length} elements to typeset ...`),e.length>0){if(window.MathJax)return void sn(t,e);const i=t.querySelector("pb-formula[menu]");window.MathJax={startup:{typeset:!1,pageReady:()=>sn(t,e)},options:{enableMenu:null!==i}},rn("MathJax","https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js")}}customElements.define("pb-facs-link",nn);class ln extends
|
|
566
|
+
`}_linkListener(t){t.preventDefault(),this._trigger()}_trigger(){console.log("<facs-link> %s %o",this.facs,this.coordinates),this.emitTo("pb-show-annotation",{file:this.facs,coordinates:this.coordinates})}}function rn(t,e){return window.ESGlobalBridge.requestAvailability(),new Promise(i=>{window.ESGlobalBridge.instance.load(t,e),window.addEventListener(`es-bridge-${t}-loaded`,()=>i(),{once:!0})})}function on(t,e){let i=t.getRootNode();if(i.nodeType===Node.DOCUMENT_NODE)i=i.head;else{const t=document.querySelector("style#"+e.id);t&&t.parentNode.removeChild(t);const i=e.innerHTML.match(/@font-face[^{]+{.*?}/gs);if(i){const t=document.createElement("style");t.id=e.id,t.appendChild(document.createTextNode(i.join("\n"))),document.head.appendChild(t)}}const n=i.querySelector("#"+e.id);n&&n.parentNode.removeChild(n),i.appendChild(e)}function sn(t,e){e.forEach(t=>{if(t.hasChildNodes()){const e=t.hasAttribute("display")||!1,i=t.querySelector("math"),n=window.MathJax.getMetricsFor(t.parentNode,e);let r,o;n.display=e,i?(o=i.outerHTML,r=window.MathJax.mathml2chtml(o,n)):(window.MathJax.texReset(),o=t.innerHTML,r=window.MathJax.tex2chtml(o,n)),t.innerHTML="",t.appendChild(r),t.setAttribute("loaded","loaded"),t.setAttribute("source",o)}}),on(t,window.MathJax.chtmlStylesheet())}function an(t){const e=t.querySelectorAll("pb-formula");if(console.log(`<pb-formula> Found ${e.length} elements to typeset ...`),e.length>0){if(window.MathJax)return void sn(t,e);const i=t.querySelector("pb-formula[menu]");window.MathJax={startup:{typeset:!1,pageReady:()=>sn(t,e)},options:{enableMenu:null!==i}},rn("MathJax","https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js")}}customElements.define("pb-facs-link",nn);class ln extends T{static get properties(){return Object.assign({display:{type:Boolean},menu:{type:Boolean},loaded:{type:Boolean},source:{type:String}},super.properties)}constructor(){super(),this.display=!1}attributeChangedCallback(t,e,i){switch(super.attributeChangedCallback(t,e,i),t){case"loaded":this.loaded=!0;break;case"source":this.source=i}}render(){return this.hasChildNodes()?this.loaded?O`<div id="content" class="${this.display?"block":""}"><slot></slot></div>`:O`<span class="loading">${F("dialogs.loading")}</span>`:null}static get styles(){return V`
|
|
567
567
|
:host {
|
|
568
568
|
display: inline-block;
|
|
569
569
|
}
|
|
@@ -573,7 +573,7 @@ const X=n`
|
|
|
573
573
|
.loading {
|
|
574
574
|
color: #808080;
|
|
575
575
|
}
|
|
576
|
-
`}}customElements.define("pb-formula",ln);class cn extends(
|
|
576
|
+
`}}customElements.define("pb-formula",ln);class cn extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{url:{type:String},expand:{type:Boolean},src:{type:String},container:{type:String},auto:{type:Boolean},loadOnce:{type:Boolean},fixLinks:{type:Boolean,attribute:"fix-links"},start:{type:Number},useLanguage:{type:Boolean,attribute:"use-language"},noCredentials:{type:Boolean,attribute:"no-credentials"},history:{type:Boolean},event:{type:String},userParams:{type:Object},silent:{type:Boolean}})}constructor(){super(),this.auto=!1,this.loadOnce=!1,this.history=!1,this.event="pb-load",this.loaded=!1,this.language=null,this.noCredentials=!0,this.silent=!1}connectedCallback(){super.connectedCallback(),this.subscribeTo(this.event,t=>{if(this.history&&t.detail&&t.detail.params){const e=t.detail.params.start;e&&(this.setParameter("start",e),this.pushHistory("pagination",{start:e}))}cn.waitOnce("pb-page-ready",()=>{this.load(t)})}),this.history&&window.addEventListener("popstate",t=>{t.preventDefault(),t.state&&t.state.start&&t.state.start!==this.start&&(this.start=t.state.start,this.load())}),this.subscribeTo("pb-toggle",t=>{this.toggleFeature(t)}),this.subscribeTo("pb-i18n-update",t=>{const e=this.language&&this.language!==t.detail.language;this.language=t.detail.language,this.useLanguage&&e&&this.load()},[]),this.signalReady()}firstUpdated(){this.auto?(this.start=this.getParameter("start",this.start),cn.waitOnce("pb-page-ready",t=>{t&&t.language&&(this.language=t.language),this.wait(()=>this.load())})):cn.waitOnce("pb-page-ready",t=>{t&&t.language&&(this.language=t.language)})}attributeChangedCallback(t,e,i){if(super.attributeChangedCallback(t,e,i),e&&e!==i)switch(t){case"url":case"userParams":case"start":this.auto&&this.loader&&cn.waitOnce("pb-page-ready",()=>{this.wait(()=>this.load())})}}render(){return O`
|
|
577
577
|
<slot></slot>
|
|
578
578
|
<iron-ajax
|
|
579
579
|
id="loadContent"
|
|
@@ -584,19 +584,19 @@ const X=n`
|
|
|
584
584
|
@response="${this._handleContent}"
|
|
585
585
|
@error="${this._handleError}"></iron-ajax>
|
|
586
586
|
<paper-dialog id="errorDialog">
|
|
587
|
-
<h2>${
|
|
587
|
+
<h2>${F("dialogs.error")}</h2>
|
|
588
588
|
<paper-dialog-scrollable></paper-dialog-scrollable>
|
|
589
589
|
<div class="buttons">
|
|
590
590
|
<paper-button dialog-confirm="dialog-confirm" autofocus="autofocus">
|
|
591
|
-
${
|
|
591
|
+
${F("dialogs.close")}
|
|
592
592
|
</paper-button>
|
|
593
593
|
</div>
|
|
594
594
|
</paper-dialog>
|
|
595
|
-
`}static get styles(){return
|
|
595
|
+
`}static get styles(){return V`
|
|
596
596
|
:host {
|
|
597
597
|
display: block;
|
|
598
598
|
}
|
|
599
|
-
`}toggleFeature(t){this.userParams=t.detail.properties,console.log("<pb-load> toggle feature %o",this.userParams),"refresh"===t.detail.action&&this.load()}getURL(t){let e=this.url;return this.expand&&(e=e.replace(/{([^})]+)}/g,(e,i)=>{if(!t[i])return"";const n=encodeURIComponent(t[i]||i);return delete t[i],n})),this.toAbsoluteURL(e)}load(t){if(!this.url)return;if(this.loadOnce&&this.loaded)return;this.emitTo("pb-start-update");let e={};t&&(t instanceof Event?t.detail&&t.detail.params&&(e=t.detail.params):e=t);const i=this.getDocument();i&&(e.doc=i.path),this.start&&!e.start&&(e.start=this.start),this.language&&(e.language=this.language),e=this.prepareParameters(e);const n=this.getURL(e);console.log("<pb-load> Loading %s with parameters %o",n,e);const r=this.shadowRoot.getElementById("loadContent");r.params=e,r.url=n,r.generateRequest(),this.loadOnce&&(this.loaded=!0)}prepareParameters(t){return this.userParams?Object.assign(t,this.userParams):t}_handleContent(t){const e=this.shadowRoot.getElementById("loadContent").lastResponse;if(this.container)this.style.display="none",document.querySelectorAll(this.container).forEach(i=>{i.innerHTML=e,this._parseHeaders(t.detail.xhr,i),this._fixLinks(i),this._onLoad(i)});else{this.style.display="",this._clearContent();const i=document.createElement("div");i.innerHTML=e,this._parseHeaders(t.detail.xhr,i),i.slot="",this.appendChild(i),this._fixLinks(i),this._onLoad(i)}this.emitTo("pb-end-update")}_clearContent(){const t=this.shadowRoot.querySelector("slot:not([name])");t&&t.assignedNodes().forEach(t=>t.parentNode.removeChild(t))}_handleError(){this.emitTo("pb-end-update");const t=this.shadowRoot.getElementById("loadContent"),{response:e}=t.lastError;if(this.silent)return void console.error("Request failed: %s",e?e.description:"");let i;i=e?e.description:'<pb-i18n key="dialogs.serverError"></pb-i18n>';const n=this.shadowRoot.getElementById("errorDialog");n.querySelector("paper-dialog-scrollable").innerHTML=`<p><pb-i18n key="dialogs.serverError"></pb-i18n>: ${i} </p>`,n.open()}_parseHeaders(t,e){function i(i,n){const r=e.querySelector(`[data-pagination-${i}]`);return r?r.getAttribute("data-pagination-"+i):n?0:t.getResponseHeader("pb-"+i)}const n=i("total",this.noCredentials),r=i("start",this.noCredentials);this.start!==r&&(this.start=parseInt(r)),this.emitTo("pb-results-received",{count:n?parseInt(n,10):0,start:this.start,params:this.shadowRoot.getElementById("loadContent").params})}_fixLinks(t){an(t),this.fixLinks&&(t.querySelectorAll("img").forEach(t=>{const e=t.getAttribute("src"),i=new URL(e,this.getEndpoint()+"/");t.src=i}),t.querySelectorAll("a").forEach(t=>{const e=t.getAttribute("href"),i=new URL(e,this.getEndpoint()+"/");t.href=i}))}_onLoad(t){}}customElements.define("pb-load",cn);class hn extends cn{static get properties(){return Object.assign(Object.assign({},super.properties),{},{sortBy:{type:String,attribute:"sort-by"},sortOptions:{type:Array,attribute:"sort-options"},sortLabel:{type:String},filter:{type:String},filterBy:{type:String,attribute:"filter-by"},filterOptions:{type:Array,attribute:"filter-options"},filterByLabel:{type:String},filterPlaceholderLabel:{type:String},collection:{type:String},facets:{type:Object},login:{type:String},group:{type:String},subforms:{type:String},static:{type:Boolean},_file:{type:String},_selected:{type:Array},_allowModification:{type:Boolean},_suggestions:{type:Array}})}constructor(){super(),this.sortOptions=[],this.sortLabel="browse.sort",this.sortBy="default",this.filter="",this.filterOptions=[{label:"Title",value:"title"}],this.filterByLabel="browse.filter",this.filterPlaceholderLabel="browse.filterPlaceholder",this.filterBy="title",this._allowModification=!1,this._suggestions=[],this.static=!1}connectedCallback(){super.connectedCallback();const t=this.getParameter("sort");t&&(this.sortBy=t);const e=this.getParameter("filter");e&&(this.filter=e,this.filterBy=this.getParameter("filterBy",this.filterBy)),this.facets=this.getParametersMatching(/^facet-.*$/),this.collection=this.getParameter("collection"),this.subscribeTo("pb-search-resubmit",this._facets.bind(this)),this.subscribeTo("pb-login",t=>{t.detail.userChanged&&this._facets(t)},[]),document.addEventListener("pb-i18n-update",()=>{const t=this.shadowRoot.getElementById("sort-list");let e=t.selected;t.selected=void 0,t.selected=e;const i=this.shadowRoot.getElementById("filter-list");e=i.selected,i.selected=void 0,i.selected=e})}firstUpdated(){if(hn.waitOnce("pb-page-ready",t=>{const e=this.shadowRoot.getElementById("autocompleteLoader");
|
|
599
|
+
`}toggleFeature(t){this.userParams=t.detail.properties,console.log("<pb-load> toggle feature %o",this.userParams),"refresh"===t.detail.action&&this.load()}getURL(t){let e=this.url;return this.expand&&(e=e.replace(/{([^})]+)}/g,(e,i)=>{if(!t[i])return"";const n=encodeURIComponent(t[i]||i);return delete t[i],n})),this.toAbsoluteURL(e)}load(t){if(!this.url)return;if(this.loadOnce&&this.loaded)return;this.emitTo("pb-start-update");let e={};t&&(t instanceof Event?t.detail&&t.detail.params&&(e=t.detail.params):e=t);const i=this.getDocument();i&&(e.doc=i.path),this.start&&!e.start&&(e.start=this.start),this.language&&(e.language=this.language),e=this.prepareParameters(e);const n=this.getURL(e);console.log("<pb-load> Loading %s with parameters %o",n,e);const r=this.shadowRoot.getElementById("loadContent");r.params=e,r.url=n,r.generateRequest(),this.loadOnce&&(this.loaded=!0)}prepareParameters(t){return this.userParams?Object.assign(t,this.userParams):t}_handleContent(t){const e=this.shadowRoot.getElementById("loadContent").lastResponse;if(this.container)this.style.display="none",document.querySelectorAll(this.container).forEach(i=>{i.innerHTML=e,this._parseHeaders(t.detail.xhr,i),this._fixLinks(i),this._onLoad(i)});else{this.style.display="",this._clearContent();const i=document.createElement("div");i.innerHTML=e,this._parseHeaders(t.detail.xhr,i),i.slot="",this.appendChild(i),this._fixLinks(i),this._onLoad(i)}this.emitTo("pb-end-update")}_clearContent(){const t=this.shadowRoot.querySelector("slot:not([name])");t&&t.assignedNodes().forEach(t=>t.parentNode.removeChild(t))}_handleError(){this.emitTo("pb-end-update");const t=this.shadowRoot.getElementById("loadContent"),{response:e}=t.lastError;if(this.silent)return void console.error("Request failed: %s",e?e.description:"");let i;i=e?e.description:'<pb-i18n key="dialogs.serverError"></pb-i18n>';const n=this.shadowRoot.getElementById("errorDialog");n.querySelector("paper-dialog-scrollable").innerHTML=`<p><pb-i18n key="dialogs.serverError"></pb-i18n>: ${i} </p>`,n.open()}_parseHeaders(t,e){function i(i,n){const r=e.querySelector(`[data-pagination-${i}]`);return r?r.getAttribute("data-pagination-"+i):n?0:t.getResponseHeader("pb-"+i)}const n=i("total",this.noCredentials),r=i("start",this.noCredentials);this.start!==r&&(this.start=parseInt(r)),this.emitTo("pb-results-received",{count:n?parseInt(n,10):0,start:this.start,params:this.shadowRoot.getElementById("loadContent").params})}_fixLinks(t){an(t),this.fixLinks&&(t.querySelectorAll("img").forEach(t=>{const e=t.getAttribute("src"),i=new URL(e,this.getEndpoint()+"/");t.src=i}),t.querySelectorAll("a").forEach(t=>{const e=t.getAttribute("href"),i=new URL(e,this.getEndpoint()+"/");t.href=i}))}_onLoad(t){}}customElements.define("pb-load",cn);class hn extends cn{static get properties(){return Object.assign(Object.assign({},super.properties),{},{sortBy:{type:String,attribute:"sort-by"},sortOptions:{type:Array,attribute:"sort-options"},sortLabel:{type:String},filter:{type:String},filterBy:{type:String,attribute:"filter-by"},filterOptions:{type:Array,attribute:"filter-options"},filterByLabel:{type:String},filterPlaceholderLabel:{type:String},collection:{type:String},facets:{type:Object},login:{type:String},group:{type:String},subforms:{type:String},static:{type:Boolean},_file:{type:String},_selected:{type:Array},_allowModification:{type:Boolean},_suggestions:{type:Array}})}constructor(){super(),this.sortOptions=[],this.sortLabel="browse.sort",this.sortBy="default",this.filter="",this.filterOptions=[{label:"Title",value:"title"}],this.filterByLabel="browse.filter",this.filterPlaceholderLabel="browse.filterPlaceholder",this.filterBy="title",this._allowModification=!1,this._suggestions=[],this.static=!1}connectedCallback(){super.connectedCallback();const t=this.getParameter("sort");t&&(this.sortBy=t);const e=this.getParameter("filter");e&&(this.filter=e,this.filterBy=this.getParameter("filterBy",this.filterBy)),this.facets=this.getParametersMatching(/^facet-.*$/),this.collection=this.getParameter("collection"),this.subscribeTo("pb-search-resubmit",this._facets.bind(this)),this.subscribeTo("pb-login",t=>{t.detail.userChanged&&this._facets(t)},[]),document.addEventListener("pb-i18n-update",()=>{const t=this.shadowRoot.getElementById("sort-list");let e=t.selected;t.selected=void 0,t.selected=e;const i=this.shadowRoot.getElementById("filter-list");e=i.selected,i.selected=void 0,i.selected=e})}firstUpdated(){if(hn.waitOnce("pb-page-ready",t=>{const e=this.shadowRoot.getElementById("autocompleteLoader");P(t.apiVersion,"1.0.0")>=0?(e.url=t.endpoint+"/api/search/autocomplete",this.url||(this.url="api/collection")):(e.url=t.endpoint+"/modules/autocomplete.xql",this.url||(this.url="collection/"))}),this.shadowRoot.getElementById("autocomplete").addEventListener("autocomplete-change",this._autocomplete.bind(this)),this.login){const t=document.getElementById(this.login);t?(this.subscribeTo("pb-login",t=>{this._allowModification=this._loggedIn(t.detail.user,t.detail.group)},[]),this._allowModification=t.loggedIn&&this._loggedIn(t.user,t.groups)):console.error("<pb-browse-docs> connected pb-login element not found!")}this.shadowRoot.getElementById("sort-list").addEventListener("selected-item-changed",this._sort.bind(this)),this.shadowRoot.getElementById("delete").addEventListener("click",this._handleDelete.bind(this)),super.firstUpdated()}render(){return O`
|
|
600
600
|
<custom-style>
|
|
601
601
|
<style>
|
|
602
602
|
:host {
|
|
@@ -611,18 +611,18 @@ const X=n`
|
|
|
611
611
|
</custom-style>
|
|
612
612
|
<slot name="header"></slot>
|
|
613
613
|
<div class="toolbar">
|
|
614
|
-
<paper-dropdown-menu id="sort" label="${
|
|
614
|
+
<paper-dropdown-menu id="sort" label="${F(this.sortLabel)}" part="sort-dropdown">
|
|
615
615
|
<paper-listbox id="sort-list" selected="${this.sortBy}" slot="dropdown-content" class="dropdown-content" attr-for-selected="value">
|
|
616
|
-
${this.sortOptions.map(t=>
|
|
616
|
+
${this.sortOptions.map(t=>O`<paper-item value="${t.value}">${F(t.label)}</paper-item>`)}
|
|
617
617
|
</paper-listbox>
|
|
618
618
|
</paper-dropdown-menu>
|
|
619
619
|
<div>
|
|
620
|
-
<paper-dropdown-menu id="filterSelect" label="${
|
|
620
|
+
<paper-dropdown-menu id="filterSelect" label="${F(this.filterByLabel)}" part="filter-dropdown">
|
|
621
621
|
<paper-listbox id="filter-list" selected="${this.filterBy}" slot="dropdown-content" class="dropdown-content" attr-for-selected="value" @selected-item-changed="${this._filterChanged}">
|
|
622
|
-
${this.filterOptions.map(t=>
|
|
622
|
+
${this.filterOptions.map(t=>O`<paper-item value="${t.value}">${F(t.label)}</paper-item>`)}
|
|
623
623
|
</paper-listbox>
|
|
624
624
|
</paper-dropdown-menu>
|
|
625
|
-
<paper-input id="filterString" type="search" name="filter" label="${
|
|
625
|
+
<paper-input id="filterString" type="search" name="filter" label="${F(this.filterPlaceholderLabel)}" value="${this.filter}"
|
|
626
626
|
@keyup="${this._handleEnter}" part="filter-input">
|
|
627
627
|
<iron-icon icon="search" @click="${this._filter}" slot="prefix"></iron-icon>
|
|
628
628
|
</paper-input>
|
|
@@ -631,9 +631,9 @@ const X=n`
|
|
|
631
631
|
</div>
|
|
632
632
|
<div class="toolbar">
|
|
633
633
|
<slot name="toolbar"></slot>
|
|
634
|
-
<paper-button id="delete" part="delete-button" title="${
|
|
634
|
+
<paper-button id="delete" part="delete-button" title="${F("browse.delete")}" class="${this._canModify(this._allowModification)}">
|
|
635
635
|
<iron-icon icon="delete"></iron-icon>
|
|
636
|
-
<span class="label">${
|
|
636
|
+
<span class="label">${F("browse.delete")}</span>
|
|
637
637
|
</paper-button>
|
|
638
638
|
</div>
|
|
639
639
|
<slot></slot>
|
|
@@ -656,25 +656,25 @@ const X=n`
|
|
|
656
656
|
@response="${this._updateSuggestions}"></iron-ajax>
|
|
657
657
|
|
|
658
658
|
<paper-dialog id="deleteDialog">
|
|
659
|
-
<h2>${
|
|
659
|
+
<h2>${F("browse.delete")}</h2>
|
|
660
660
|
<paper-dialog-scrollable>
|
|
661
|
-
<p>${
|
|
661
|
+
<p>${F("browse.confirmDeletion",{count:this._selected?this._selected.length:0})}</p>
|
|
662
662
|
</paper-dialog-scrollable>
|
|
663
663
|
<div class="buttons">
|
|
664
|
-
<paper-button dialog-confirm="dialog-confirm" autofocus @click="${this._confirmDelete}">${
|
|
665
|
-
<paper-button dialog-confirm="dialog-cancel">${
|
|
664
|
+
<paper-button dialog-confirm="dialog-confirm" autofocus @click="${this._confirmDelete}">${F("dialogs.yes")}</paper-button>
|
|
665
|
+
<paper-button dialog-confirm="dialog-cancel">${F("dialogs.no")}</paper-button>
|
|
666
666
|
</div>
|
|
667
667
|
</paper-dialog>
|
|
668
668
|
<paper-dialog id="errorDialog">
|
|
669
|
-
<h2>${
|
|
669
|
+
<h2>${F("dialogs.error")}</h2>
|
|
670
670
|
<paper-dialog-scrollable></paper-dialog-scrollable>
|
|
671
671
|
<div class="buttons">
|
|
672
672
|
<paper-button dialog-confirm="dialog-confirm" autofocus="autofocus">
|
|
673
|
-
${
|
|
673
|
+
${F("dialogs.close")}
|
|
674
674
|
</paper-button>
|
|
675
675
|
</div>
|
|
676
676
|
</paper-dialog>
|
|
677
|
-
`}static get styles(){return
|
|
677
|
+
`}static get styles(){return V`
|
|
678
678
|
:host {
|
|
679
679
|
display: block;
|
|
680
680
|
--paper-input-container-color: var(--pb-search-label-color, var(--paper-grey-500, #303030));
|
|
@@ -704,26 +704,26 @@ const X=n`
|
|
|
704
704
|
.hidden {
|
|
705
705
|
display: none;
|
|
706
706
|
}
|
|
707
|
-
`}getURL(t){if(this.static)return`collections/${this.collection?this.collection+"/":""}${t.start||"1"}.html`;const e=super.getURL(t);return this.collection?`${e}/${this.collection}`:e}prepareParameters(t){return(t=this._paramsFromSubforms(t)).sort=this.sortBy,this.filter&&(t.filter=this.filter,t.browse=this.filterBy),this.facets&&(t=Object.assign(t,this.facets)),t}_paramsFromSubforms(t){return this.subforms&&document.querySelectorAll(this.subforms).forEach(e=>{e.serializeForm&&Object.assign(t,e.serializeForm())}),t}getSelected(){const t=[];return this.container?document.querySelectorAll(this.container).forEach(e=>e.querySelectorAll(".document-select paper-checkbox[checked]").forEach(e=>{t.push(e.value)})):this.querySelectorAll(".document-select paper-checkbox[checked]").forEach(e=>{t.push(e.value)}),t}_filter(){const t=this.shadowRoot.getElementById("filterString").value,e=this.shadowRoot.getElementById("filter-list").selected;void 0!==t&&(console.log("<pb-browse-docs> Filter by %s",t),this.filter=t,this.setParameter("filter",t),this.setParameter("filterBy",e),this.pushHistory("filter docs"),this.load())}_filterChanged(){const t=this.shadowRoot.getElementById("filter-list").selected;t&&t!==this.filterBy&&(console.log("<pb-browse-docs> Filtering on %s",t),this.filterBy=t)}_sort(){const t=this.shadowRoot.getElementById("sort-list").selected;t&&t!==this.sortBy&&(console.log("<pb-browse-docs> Sorting by %s",t),this.sortBy=t,this.setParameter("sort",t),this.pushHistory("sort docs"),this.load())}_facets(t){if(t.detail&&t.detail.params){this.clearParametersMatching(/^(all-|facet-).*/);for(let e in t.detail.params)this.setParameter(e,t.detail.params[e]);this.facets=t.detail.params,this.start=1,this.pushHistory("facets")}this.load()}_onLoad(t){window.scrollTo(0,0);const e=t.querySelector("[data-root]"),i=e&&e.getAttribute("data-root"),n=e&&e.classList.contains("writable");this.emitTo("pb-collection",{writable:n,collection:i}),document.querySelectorAll("[can-write]").forEach(t=>{t.disabled=!n}),t.querySelectorAll("[data-collection]").forEach(t=>{t.addEventListener("click",e=>{e.preventDefault(),this.collection=t.getAttribute("data-collection"),this.start=1,this.setParameter("collection",this.collection),this.pushHistory("browse collection"),console.log("<pb-browse-docs> loading collection %s",this.collection),this.load()})})}_handleDelete(t,e){const i=this.shadowRoot.getElementById("deleteDialog"),n=this.getSelected();n.length>0&&(this._selected=n,i.open())}_confirmDelete(){if(!this._file&&!this._selected)return;let t;t=this._selected?this._selected:[this._file],console.log("<pb-browse-docs> Deleting %o",this._file);const e={action:"delete","docs[]":t};this._file=null,this._selected=null,this.load(e)}_loggedIn(t,e){return null!=t&&(!this.group||!!e&&e.indexOf(this.group)>-1)}_canModify(t){return t?"":"hidden"}_autocomplete(t){const e=this.shadowRoot.getElementById("autocompleteLoader");e.params={query:t.detail.option.text,field:this.filterBy},e.generateRequest()}_updateSuggestions(){const t=this.shadowRoot.getElementById("autocomplete"),e=this.shadowRoot.getElementById("autocompleteLoader");t.suggestions(e.lastResponse)}_handleEnter(t){13==t.keyCode&&this._filter()}}customElements.define("pb-browse-docs",hn);class dn extends(
|
|
707
|
+
`}getURL(t){if(this.static)return`collections/${this.collection?this.collection+"/":""}${t.start||"1"}.html`;const e=super.getURL(t);return this.collection?`${e}/${this.collection}`:e}prepareParameters(t){return(t=this._paramsFromSubforms(t)).sort=this.sortBy,this.filter&&(t.filter=this.filter,t.browse=this.filterBy),this.facets&&(t=Object.assign(t,this.facets)),t}_paramsFromSubforms(t){return this.subforms&&document.querySelectorAll(this.subforms).forEach(e=>{e.serializeForm&&Object.assign(t,e.serializeForm())}),t}getSelected(){const t=[];return this.container?document.querySelectorAll(this.container).forEach(e=>e.querySelectorAll(".document-select paper-checkbox[checked]").forEach(e=>{t.push(e.value)})):this.querySelectorAll(".document-select paper-checkbox[checked]").forEach(e=>{t.push(e.value)}),t}_filter(){const t=this.shadowRoot.getElementById("filterString").value,e=this.shadowRoot.getElementById("filter-list").selected;void 0!==t&&(console.log("<pb-browse-docs> Filter by %s",t),this.filter=t,this.setParameter("filter",t),this.setParameter("filterBy",e),this.pushHistory("filter docs"),this.load())}_filterChanged(){const t=this.shadowRoot.getElementById("filter-list").selected;t&&t!==this.filterBy&&(console.log("<pb-browse-docs> Filtering on %s",t),this.filterBy=t)}_sort(){const t=this.shadowRoot.getElementById("sort-list").selected;t&&t!==this.sortBy&&(console.log("<pb-browse-docs> Sorting by %s",t),this.sortBy=t,this.setParameter("sort",t),this.pushHistory("sort docs"),this.load())}_facets(t){if(t.detail&&t.detail.params){this.clearParametersMatching(/^(all-|facet-).*/);for(let e in t.detail.params)this.setParameter(e,t.detail.params[e]);this.facets=t.detail.params,this.start=1,this.pushHistory("facets")}this.load()}_onLoad(t){window.scrollTo(0,0);const e=t.querySelector("[data-root]"),i=e&&e.getAttribute("data-root"),n=e&&e.classList.contains("writable");this.emitTo("pb-collection",{writable:n,collection:i}),document.querySelectorAll("[can-write]").forEach(t=>{t.disabled=!n}),t.querySelectorAll("[data-collection]").forEach(t=>{t.addEventListener("click",e=>{e.preventDefault(),this.collection=t.getAttribute("data-collection"),this.start=1,this.setParameter("collection",this.collection),this.pushHistory("browse collection"),console.log("<pb-browse-docs> loading collection %s",this.collection),this.load()})})}_handleDelete(t,e){const i=this.shadowRoot.getElementById("deleteDialog"),n=this.getSelected();n.length>0&&(this._selected=n,i.open())}_confirmDelete(){if(!this._file&&!this._selected)return;let t;t=this._selected?this._selected:[this._file],console.log("<pb-browse-docs> Deleting %o",this._file);const e={action:"delete","docs[]":t};this._file=null,this._selected=null,this.load(e)}_loggedIn(t,e){return null!=t&&(!this.group||!!e&&e.indexOf(this.group)>-1)}_canModify(t){return t?"":"hidden"}_autocomplete(t){const e=this.shadowRoot.getElementById("autocompleteLoader");e.params={query:t.detail.option.text,field:this.filterBy},e.generateRequest()}_updateSuggestions(){const t=this.shadowRoot.getElementById("autocomplete"),e=this.shadowRoot.getElementById("autocompleteLoader");t.suggestions(e.lastResponse)}_handleEnter(t){13==t.keyCode&&this._filter()}}customElements.define("pb-browse-docs",hn);class dn extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{path:{type:String,reflect:!0},rootPath:{type:String,attribute:"root-path"},odd:{type:String,reflect:!0},view:{type:String,reflect:!0},sourceView:{type:String,attribute:"source-view"}})}constructor(){super(),this.path="",this.rootPath=""}connectedCallback(){super.connectedCallback()}attributeChangedCallback(t,e,i){super.attributeChangedCallback(t,e,i),e&&(console.log("<pb-document> Emit update event"),this.emitTo("pb-document",this))}getFileName(){return this.path.replace(/^.*?([^\/]+)$/,"$1")}getFullPath(){return this.rootPath+"/"+this.path}}customElements.define("pb-document",dn);class pn extends(C(R(T))){static get properties(){return Object.assign(Object.assign({},super.properties),{},{direction:{type:String},keyboard:{type:String}})}constructor(){super(),this.direction="forward",this.disabled=!0}connectedCallback(){super.connectedCallback(),this.keyboard&&(this.hotkeys={next:this.keyboard}),this.subscribeTo("pb-update",this._update.bind(this)),this.registerHotkey("next",()=>this.emitTo("pb-navigate",{direction:this.direction})),this.signalReady()}_update(t){"forward"===this.direction?t.detail.data.next?this.disabled=!1:this.disabled=!0:t.detail.data.previous?this.disabled=!1:this.disabled=!0}_handleClick(){this.emitTo("pb-navigate",{direction:this.direction})}render(){return O`
|
|
708
708
|
<a id="button" @click="${this._handleClick}"><slot></slot></a>
|
|
709
|
-
`}static get styles(){return
|
|
709
|
+
`}static get styles(){return V`
|
|
710
710
|
:host {
|
|
711
711
|
display: inline;
|
|
712
712
|
}
|
|
713
713
|
:host([disabled]) {
|
|
714
714
|
display: none;
|
|
715
715
|
}
|
|
716
|
-
`}}function un(t){return(un="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function gn(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function fn(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?Object(arguments[e]):{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter((function(t){return Object.getOwnPropertyDescriptor(i,t).enumerable})))),n.forEach((function(e){gn(t,e,i[e])}))}return t}function mn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function vn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function bn(t,e,i){return e&&vn(t.prototype,e),i&&vn(t,i),t}function yn(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _n(t,e){return!e||"object"!==un(e)&&"function"!=typeof e?yn(t):e}function wn(t){return(wn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function xn(t,e){return(xn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function kn(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&xn(t,e)}customElements.define("pb-navigation",pn);var An={type:"logger",log:function(t){this.output("log",t)},warn:function(t){this.output("warn",t)},error:function(t){this.output("error",t)},output:function(t,e){console&&console[t]&&console[t].apply(console,e)}},zn=new(function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};mn(this,t),this.init(e,i)}return bn(t,[{key:"init",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=e.prefix||"i18next:",this.logger=t||An,this.options=e,this.debug=e.debug}},{key:"setDebug",value:function(t){this.debug=t}},{key:"log",value:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this.forward(e,"log","",!0)}},{key:"warn",value:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this.forward(e,"warn","",!0)}},{key:"error",value:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this.forward(e,"error","")}},{key:"deprecate",value:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(t,e,i,n){return n&&!this.debug?null:("string"==typeof t[0]&&(t[0]="".concat(i).concat(this.prefix," ").concat(t[0])),this.logger[e](t))}},{key:"create",value:function(e){return new t(this.logger,fn({},{prefix:"".concat(this.prefix,":").concat(e,":")},this.options))}}]),t}()),Sn=function(){function t(){mn(this,t),this.observers={}}return bn(t,[{key:"on",value:function(t,e){var i=this;return t.split(" ").forEach((function(t){i.observers[t]=i.observers[t]||[],i.observers[t].push(e)})),this}},{key:"off",value:function(t,e){this.observers[t]&&(e?this.observers[t]=this.observers[t].filter((function(t){return t!==e})):delete this.observers[t])}},{key:"emit",value:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];this.observers[t]&&[].concat(this.observers[t]).forEach((function(t){t.apply(void 0,i)}));this.observers["*"]&&[].concat(this.observers["*"]).forEach((function(e){e.apply(e,[t].concat(i))}))}}]),t}();function Cn(){var t,e,i=new Promise((function(i,n){t=i,e=n}));return i.resolve=t,i.reject=e,i}function En(t){return null==t?"":""+t}function Mn(t,e,i){t.forEach((function(t){e[t]&&(i[t]=e[t])}))}function Ln(t,e,i){function n(t){return t&&t.indexOf("###")>-1?t.replace(/###/g,"."):t}function r(){return!t||"string"==typeof t}for(var o="string"!=typeof e?[].concat(e):e.split(".");o.length>1;){if(r())return{};var s=n(o.shift());!t[s]&&i&&(t[s]=new i),t=t[s]}return r()?{}:{obj:t,k:n(o.shift())}}function Tn(t,e,i){var n=Ln(t,e,Object);n.obj[n.k]=i}function Hn(t,e,i,n){var r=Ln(t,e,Object),o=r.obj,s=r.k;o[s]=o[s]||[],n&&(o[s]=o[s].concat(i)),n||o[s].push(i)}function On(t,e){var i=Ln(t,e),n=i.obj,r=i.k;if(n)return n[r]}function $n(t,e,i){var n=On(t,i);return void 0!==n?n:On(e,i)}function Vn(t,e,i){for(var n in e)"__proto__"!==n&&(n in t?"string"==typeof t[n]||t[n]instanceof String||"string"==typeof e[n]||e[n]instanceof String?i&&(t[n]=e[n]):Vn(t[n],e[n],i):t[n]=e[n]);return t}function In(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var Rn={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function Pn(t){return"string"==typeof t?t.replace(/[&<>"'\/]/g,(function(t){return Rn[t]})):t}var Dn="undefined"!=typeof window&&window.navigator&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,Nn=function(t){function e(t){var i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return mn(this,e),i=_n(this,wn(e).call(this)),Dn&&Sn.call(yn(i)),i.data=t||{},i.options=n,void 0===i.options.keySeparator&&(i.options.keySeparator="."),i}return kn(e,Sn),bn(e,[{key:"addNamespaces",value:function(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}},{key:"removeNamespaces",value:function(t){var e=this.options.ns.indexOf(t);e>-1&&this.options.ns.splice(e,1)}},{key:"getResource",value:function(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,o=[t,e];return i&&"string"!=typeof i&&(o=o.concat(i)),i&&"string"==typeof i&&(o=o.concat(r?i.split(r):i)),t.indexOf(".")>-1&&(o=t.split(".")),On(this.data,o)}},{key:"addResource",value:function(t,e,i,n){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},o=this.options.keySeparator;void 0===o&&(o=".");var s=[t,e];i&&(s=s.concat(o?i.split(o):i)),t.indexOf(".")>-1&&(n=e,e=(s=t.split("."))[1]),this.addNamespaces(e),Tn(this.data,s,n),r.silent||this.emit("added",t,e,i,n)}},{key:"addResources",value:function(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var r in i)"string"!=typeof i[r]&&"[object Array]"!==Object.prototype.toString.apply(i[r])||this.addResource(t,e,r,i[r],{silent:!0});n.silent||this.emit("added",t,e,i)}},{key:"addResourceBundle",value:function(t,e,i,n,r){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},s=[t,e];t.indexOf(".")>-1&&(n=i,i=e,e=(s=t.split("."))[1]),this.addNamespaces(e);var a=On(this.data,s)||{};n?Vn(a,i,r):a=fn({},a,i),Tn(this.data,s,a),o.silent||this.emit("added",t,e,i)}},{key:"removeResourceBundle",value:function(t,e){this.hasResourceBundle(t,e)&&delete this.data[t][e],this.removeNamespaces(e),this.emit("removed",t,e)}},{key:"hasResourceBundle",value:function(t,e){return void 0!==this.getResource(t,e)}},{key:"getResourceBundle",value:function(t,e){return e||(e=this.options.defaultNS),"v1"===this.options.compatibilityAPI?fn({},{},this.getResource(t,e)):this.getResource(t,e)}},{key:"getDataByLanguage",value:function(t){return this.data[t]}},{key:"toJSON",value:function(){return this.data}}]),e}(),Fn={processors:{},addPostProcessor:function(t){this.processors[t.name]=t},handle:function(t,e,i,n,r){var o=this;return t.forEach((function(t){o.processors[t]&&(e=o.processors[t].process(e,i,n,r))})),e}},Bn={},jn=function(t){function e(t){var i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return mn(this,e),i=_n(this,wn(e).call(this)),Dn&&Sn.call(yn(i)),Mn(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,yn(i)),i.options=n,void 0===i.options.keySeparator&&(i.options.keySeparator="."),i.logger=zn.create("translator"),i}return kn(e,Sn),bn(e,[{key:"changeLanguage",value:function(t){t&&(this.language=t)}},{key:"exists",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}},i=this.resolve(t,e);return i&&void 0!==i.res}},{key:"extractFromKey",value:function(t,e){var i=void 0!==e.nsSeparator?e.nsSeparator:this.options.nsSeparator;void 0===i&&(i=":");var n=void 0!==e.keySeparator?e.keySeparator:this.options.keySeparator,r=e.ns||this.options.defaultNS;if(i&&t.indexOf(i)>-1){var o=t.match(this.interpolator.nestingRegexp);if(o&&o.length>0)return{key:t,namespaces:r};var s=t.split(i);(i!==n||i===n&&this.options.ns.indexOf(s[0])>-1)&&(r=s.shift()),t=s.join(n)}return"string"==typeof r&&(r=[r]),{key:t,namespaces:r}}},{key:"translate",value:function(t,e,i){var n=this;if("object"!==un(e)&&this.options.overloadTranslationOptionHandler&&(e=this.options.overloadTranslationOptionHandler(arguments)),e||(e={}),null==t)return"";Array.isArray(t)||(t=[String(t)]);var r=void 0!==e.keySeparator?e.keySeparator:this.options.keySeparator,o=this.extractFromKey(t[t.length-1],e),s=o.key,a=o.namespaces,l=a[a.length-1],c=e.lng||this.language,h=e.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(c&&"cimode"===c.toLowerCase()){if(h){var d=e.nsSeparator||this.options.nsSeparator;return l+d+s}return s}var p=this.resolve(t,e),u=p&&p.res,g=p&&p.usedKey||s,f=p&&p.exactUsedKey||s,m=Object.prototype.toString.apply(u),v=["[object Number]","[object Function]","[object RegExp]"],b=void 0!==e.joinArrays?e.joinArrays:this.options.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject;if(y&&u&&("string"!=typeof u&&"boolean"!=typeof u&&"number"!=typeof u)&&v.indexOf(m)<0&&("string"!=typeof b||"[object Array]"!==m)){if(!e.returnObjects&&!this.options.returnObjects)return this.logger.warn("accessing an object - but returnObjects options is not enabled!"),this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,u,e):"key '".concat(s," (").concat(this.language,")' returned an object instead of string.");if(r){var _="[object Array]"===m,w=_?[]:{},x=_?f:g;for(var k in u)if(Object.prototype.hasOwnProperty.call(u,k)){var A="".concat(x).concat(r).concat(k);w[k]=this.translate(A,fn({},e,{joinArrays:!1,ns:a})),w[k]===A&&(w[k]=u[k])}u=w}}else if(y&&"string"==typeof b&&"[object Array]"===m)(u=u.join(b))&&(u=this.extendTranslation(u,t,e,i));else{var z=!1,S=!1;if(!this.isValidLookup(u)&&void 0!==e.defaultValue){if(z=!0,void 0!==e.count){var C=this.pluralResolver.getSuffix(c,e.count);u=e["defaultValue".concat(C)]}u||(u=e.defaultValue)}this.isValidLookup(u)||(S=!0,u=s);var E=e.defaultValue&&e.defaultValue!==u&&this.options.updateMissing;if(S||z||E){if(this.logger.log(E?"updateKey":"missingKey",c,l,s,E?e.defaultValue:u),r){var M=this.resolve(s,fn({},e,{keySeparator:!1}));M&&M.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var L=[],T=this.languageUtils.getFallbackCodes(this.options.fallbackLng,e.lng||this.language);if("fallback"===this.options.saveMissingTo&&T&&T[0])for(var H=0;H<T.length;H++)L.push(T[H]);else"all"===this.options.saveMissingTo?L=this.languageUtils.toResolveHierarchy(e.lng||this.language):L.push(e.lng||this.language);var O=function(t,i){n.options.missingKeyHandler?n.options.missingKeyHandler(t,l,i,E?e.defaultValue:u,E,e):n.backendConnector&&n.backendConnector.saveMissing&&n.backendConnector.saveMissing(t,l,i,E?e.defaultValue:u,E,e),n.emit("missingKey",t,l,i,u)};if(this.options.saveMissing){var $=void 0!==e.count&&"string"!=typeof e.count;this.options.saveMissingPlurals&&$?L.forEach((function(t){n.pluralResolver.getPluralFormsOfKey(t,s).forEach((function(e){return O([t],e)}))})):O(L,s)}}u=this.extendTranslation(u,t,e,p,i),S&&u===s&&this.options.appendNamespaceToMissingKey&&(u="".concat(l,":").concat(s)),S&&this.options.parseMissingKeyHandler&&(u=this.options.parseMissingKeyHandler(u))}return u}},{key:"extendTranslation",value:function(t,e,i,n,r){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,i,n.usedLng,n.usedNS,n.usedKey,{resolved:n});else if(!i.skipInterpolation){i.interpolation&&this.interpolator.init(fn({},i,{interpolation:fn({},this.options.interpolation,i.interpolation)}));var s,a=i.interpolation&&i.interpolation.skipOnVariables||this.options.interpolation.skipOnVariables;if(a){var l=t.match(this.interpolator.nestingRegexp);s=l&&l.length}var c=i.replace&&"string"!=typeof i.replace?i.replace:i;if(this.options.interpolation.defaultVariables&&(c=fn({},this.options.interpolation.defaultVariables,c)),t=this.interpolator.interpolate(t,c,i.lng||this.language,i),a){var h=t.match(this.interpolator.nestingRegexp);s<(h&&h.length)&&(i.nest=!1)}!1!==i.nest&&(t=this.interpolator.nest(t,(function(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return r&&r[0]===i[0]?(o.logger.warn("It seems you are nesting recursively key: ".concat(i[0]," in key: ").concat(e[0])),null):o.translate.apply(o,i.concat([e]))}),i)),i.interpolation&&this.interpolator.reset()}var d=i.postProcess||this.options.postProcess,p="string"==typeof d?[d]:d;return null!=t&&p&&p.length&&!1!==i.applyPostProcessor&&(t=Fn.handle(p,t,e,this.options&&this.options.postProcessPassResolved?fn({i18nResolved:n},i):i,this)),t}},{key:"resolve",value:function(t){var e,i,n,r,o,s=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof t&&(t=[t]),t.forEach((function(t){if(!s.isValidLookup(e)){var l=s.extractFromKey(t,a),c=l.key;i=c;var h=l.namespaces;s.options.fallbackNS&&(h=h.concat(s.options.fallbackNS));var d=void 0!==a.count&&"string"!=typeof a.count,p=void 0!==a.context&&"string"==typeof a.context&&""!==a.context,u=a.lngs?a.lngs:s.languageUtils.toResolveHierarchy(a.lng||s.language,a.fallbackLng);h.forEach((function(t){s.isValidLookup(e)||(o=t,!Bn["".concat(u[0],"-").concat(t)]&&s.utils&&s.utils.hasLoadedNamespace&&!s.utils.hasLoadedNamespace(o)&&(Bn["".concat(u[0],"-").concat(t)]=!0,s.logger.warn('key "'.concat(i,'" for languages "').concat(u.join(", "),'" won\'t get resolved as namespace "').concat(o,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),u.forEach((function(i){if(!s.isValidLookup(e)){r=i;var o,l,h=c,u=[h];if(s.i18nFormat&&s.i18nFormat.addLookupKeys)s.i18nFormat.addLookupKeys(u,c,i,t,a);else d&&(o=s.pluralResolver.getSuffix(i,a.count)),d&&p&&u.push(h+o),p&&u.push(h+="".concat(s.options.contextSeparator).concat(a.context)),d&&u.push(h+=o);for(;l=u.pop();)s.isValidLookup(e)||(n=l,e=s.getResource(i,t,l,a))}})))}))}})),{res:e,usedKey:i,exactUsedKey:n,usedLng:r,usedNS:o}}},{key:"isValidLookup",value:function(t){return!(void 0===t||!this.options.returnNull&&null===t||!this.options.returnEmptyString&&""===t)}},{key:"getResource",value:function(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,e,i,n):this.resourceStore.getResource(t,e,i,n)}}]),e}();function qn(t){return t.charAt(0).toUpperCase()+t.slice(1)}var Un=function(){function t(e){mn(this,t),this.options=e,this.whitelist=this.options.supportedLngs||!1,this.supportedLngs=this.options.supportedLngs||!1,this.logger=zn.create("languageUtils")}return bn(t,[{key:"getScriptPartFromCode",value:function(t){if(!t||t.indexOf("-")<0)return null;var e=t.split("-");return 2===e.length?null:(e.pop(),"x"===e[e.length-1].toLowerCase()?null:this.formatLanguageCode(e.join("-")))}},{key:"getLanguagePartFromCode",value:function(t){if(!t||t.indexOf("-")<0)return t;var e=t.split("-");return this.formatLanguageCode(e[0])}},{key:"formatLanguageCode",value:function(t){if("string"==typeof t&&t.indexOf("-")>-1){var e=["hans","hant","latn","cyrl","cans","mong","arab"],i=t.split("-");return this.options.lowerCaseLng?i=i.map((function(t){return t.toLowerCase()})):2===i.length?(i[0]=i[0].toLowerCase(),i[1]=i[1].toUpperCase(),e.indexOf(i[1].toLowerCase())>-1&&(i[1]=qn(i[1].toLowerCase()))):3===i.length&&(i[0]=i[0].toLowerCase(),2===i[1].length&&(i[1]=i[1].toUpperCase()),"sgn"!==i[0]&&2===i[2].length&&(i[2]=i[2].toUpperCase()),e.indexOf(i[1].toLowerCase())>-1&&(i[1]=qn(i[1].toLowerCase())),e.indexOf(i[2].toLowerCase())>-1&&(i[2]=qn(i[2].toLowerCase()))),i.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}},{key:"isWhitelisted",value:function(t){return this.logger.deprecate("languageUtils.isWhitelisted",'function "isWhitelisted" will be renamed to "isSupportedCode" in the next major - please make sure to rename it\'s usage asap.'),this.isSupportedCode(t)}},{key:"isSupportedCode",value:function(t){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}},{key:"getBestMatchFromCodes",value:function(t){var e,i=this;return t?(t.forEach((function(t){if(!e){var n=i.formatLanguageCode(t);i.options.supportedLngs&&!i.isSupportedCode(n)||(e=n)}})),!e&&this.options.supportedLngs&&t.forEach((function(t){if(!e){var n=i.getLanguagePartFromCode(t);if(i.isSupportedCode(n))return e=n;e=i.options.supportedLngs.find((function(t){if(0===t.indexOf(n))return t}))}})),e||(e=this.getFallbackCodes(this.options.fallbackLng)[0]),e):null}},{key:"getFallbackCodes",value:function(t,e){if(!t)return[];if("function"==typeof t&&(t=t(e)),"string"==typeof t&&(t=[t]),"[object Array]"===Object.prototype.toString.apply(t))return t;if(!e)return t.default||[];var i=t[e];return i||(i=t[this.getScriptPartFromCode(e)]),i||(i=t[this.formatLanguageCode(e)]),i||(i=t[this.getLanguagePartFromCode(e)]),i||(i=t.default),i||[]}},{key:"toResolveHierarchy",value:function(t,e){var i=this,n=this.getFallbackCodes(e||this.options.fallbackLng||[],t),r=[],o=function(t){t&&(i.isSupportedCode(t)?r.push(t):i.logger.warn("rejecting language code not found in supportedLngs: ".concat(t)))};return"string"==typeof t&&t.indexOf("-")>-1?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(t)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(t)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(t))):"string"==typeof t&&o(this.formatLanguageCode(t)),n.forEach((function(t){r.indexOf(t)<0&&o(i.formatLanguageCode(t))})),r}}]),t}(),Wn=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","kk","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Yn={1:function(t){return Number(t>1)},2:function(t){return Number(1!=t)},3:function(t){return 0},4:function(t){return Number(t%10==1&&t%100!=11?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2)},5:function(t){return Number(0==t?0:1==t?1:2==t?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5)},6:function(t){return Number(1==t?0:t>=2&&t<=4?1:2)},7:function(t){return Number(1==t?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2)},8:function(t){return Number(1==t?0:2==t?1:8!=t&&11!=t?2:3)},9:function(t){return Number(t>=2)},10:function(t){return Number(1==t?0:2==t?1:t<7?2:t<11?3:4)},11:function(t){return Number(1==t||11==t?0:2==t||12==t?1:t>2&&t<20?2:3)},12:function(t){return Number(t%10!=1||t%100==11)},13:function(t){return Number(0!==t)},14:function(t){return Number(1==t?0:2==t?1:3==t?2:3)},15:function(t){return Number(t%10==1&&t%100!=11?0:t%10>=2&&(t%100<10||t%100>=20)?1:2)},16:function(t){return Number(t%10==1&&t%100!=11?0:0!==t?1:2)},17:function(t){return Number(1==t||t%10==1&&t%100!=11?0:1)},18:function(t){return Number(0==t?0:1==t?1:2)},19:function(t){return Number(1==t?0:0==t||t%100>1&&t%100<11?1:t%100>10&&t%100<20?2:3)},20:function(t){return Number(1==t?0:0==t||t%100>0&&t%100<20?1:2)},21:function(t){return Number(t%100==1?1:t%100==2?2:t%100==3||t%100==4?3:0)},22:function(t){return Number(1==t?0:2==t?1:(t<0||t>10)&&t%10==0?2:3)}};function Gn(){var t={};return Wn.forEach((function(e){e.lngs.forEach((function(i){t[i]={numbers:e.nr,plurals:Yn[e.fc]}}))})),t}var Xn=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};mn(this,t),this.languageUtils=e,this.options=i,this.logger=zn.create("pluralResolver"),this.rules=Gn()}return bn(t,[{key:"addRule",value:function(t,e){this.rules[t]=e}},{key:"getRule",value:function(t){return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}},{key:"needsPlural",value:function(t){var e=this.getRule(t);return e&&e.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(t,e){var i=this,n=[],r=this.getRule(t);return r?(r.numbers.forEach((function(r){var o=i.getSuffix(t,r);n.push("".concat(e).concat(o))})),n):n}},{key:"getSuffix",value:function(t,e){var i=this,n=this.getRule(t);if(n){var r=n.noAbs?n.plurals(e):n.plurals(Math.abs(e)),o=n.numbers[r];this.options.simplifyPluralSuffix&&2===n.numbers.length&&1===n.numbers[0]&&(2===o?o="plural":1===o&&(o=""));var s=function(){return i.options.prepend&&o.toString()?i.options.prepend+o.toString():o.toString()};return"v1"===this.options.compatibilityJSON?1===o?"":"number"==typeof o?"_plural_".concat(o.toString()):s():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===n.numbers.length&&1===n.numbers[0]?s():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}return this.logger.warn("no plural rule found for: ".concat(t)),""}}]),t}(),Kn=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};mn(this,t),this.logger=zn.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||function(t){return t},this.init(e)}return bn(t,[{key:"init",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});var e=t.interpolation;this.escape=void 0!==e.escape?e.escape:Pn,this.escapeValue=void 0===e.escapeValue||e.escapeValue,this.useRawValueToEscape=void 0!==e.useRawValueToEscape&&e.useRawValueToEscape,this.prefix=e.prefix?In(e.prefix):e.prefixEscaped||"{{",this.suffix=e.suffix?In(e.suffix):e.suffixEscaped||"}}",this.formatSeparator=e.formatSeparator?e.formatSeparator:e.formatSeparator||",",this.unescapePrefix=e.unescapeSuffix?"":e.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":e.unescapeSuffix||"",this.nestingPrefix=e.nestingPrefix?In(e.nestingPrefix):e.nestingPrefixEscaped||In("$t("),this.nestingSuffix=e.nestingSuffix?In(e.nestingSuffix):e.nestingSuffixEscaped||In(")"),this.nestingOptionsSeparator=e.nestingOptionsSeparator?e.nestingOptionsSeparator:e.nestingOptionsSeparator||",",this.maxReplaces=e.maxReplaces?e.maxReplaces:1e3,this.alwaysFormat=void 0!==e.alwaysFormat&&e.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var t="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(t,"g");var e="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(e,"g");var i="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(i,"g")}},{key:"interpolate",value:function(t,e,i,n){var r,o,s,a=this,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function c(t){return t.replace(/\$/g,"$$$$")}var h=function(t){if(t.indexOf(a.formatSeparator)<0){var r=$n(e,l,t);return a.alwaysFormat?a.format(r,void 0,i):r}var o=t.split(a.formatSeparator),s=o.shift().trim(),c=o.join(a.formatSeparator).trim();return a.format($n(e,l,s),c,i,n)};this.resetRegExp();var d=n&&n.missingInterpolationHandler||this.options.missingInterpolationHandler,p=n&&n.interpolation&&n.interpolation.skipOnVariables||this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(t){return c(t)}},{regex:this.regexp,safeValue:function(t){return a.escapeValue?c(a.escape(t)):c(t)}}].forEach((function(e){for(s=0;r=e.regex.exec(t);){if(void 0===(o=h(r[1].trim())))if("function"==typeof d){var i=d(t,r,n);o="string"==typeof i?i:""}else{if(p){o=r[0];continue}a.logger.warn("missed to pass in variable ".concat(r[1]," for interpolating ").concat(t)),o=""}else"string"==typeof o||a.useRawValueToEscape||(o=En(o));if(t=t.replace(r[0],e.safeValue(o)),e.regex.lastIndex=0,++s>=a.maxReplaces)break}})),t}},{key:"nest",value:function(t,e){var i,n,r=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=fn({},o);function a(t,e){var i=this.nestingOptionsSeparator;if(t.indexOf(i)<0)return t;var n=t.split(new RegExp("".concat(i,"[ ]*{"))),r="{".concat(n[1]);t=n[0],r=(r=this.interpolate(r,s)).replace(/'/g,'"');try{s=JSON.parse(r),e&&(s=fn({},e,s))}catch(e){return this.logger.warn("failed parsing options string in nesting for key ".concat(t),e),"".concat(t).concat(i).concat(r)}return delete s.defaultValue,t}for(s.applyPostProcessor=!1,delete s.defaultValue;i=this.nestingRegexp.exec(t);){var l=[],c=!1;if(i[0].includes(this.formatSeparator)&&!/{.*}/.test(i[1])){var h=i[1].split(this.formatSeparator).map((function(t){return t.trim()}));i[1]=h.shift(),l=h,c=!0}if((n=e(a.call(this,i[1].trim(),s),s))&&i[0]===t&&"string"!=typeof n)return n;"string"!=typeof n&&(n=En(n)),n||(this.logger.warn("missed to resolve ".concat(i[1]," for nesting ").concat(t)),n=""),c&&(n=l.reduce((function(t,e){return r.format(t,e,o.lng,o)}),n.trim())),t=t.replace(i[0],n),this.regexp.lastIndex=0}return t}}]),t}();function Qn(t,e){for(var i=t.indexOf(e);-1!==i;)t.splice(i,1),i=t.indexOf(e)}var Zn=function(t){function e(t,i,n){var r,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return mn(this,e),r=_n(this,wn(e).call(this)),Dn&&Sn.call(yn(r)),r.backend=t,r.store=i,r.services=n,r.languageUtils=n.languageUtils,r.options=o,r.logger=zn.create("backendConnector"),r.state={},r.queue=[],r.backend&&r.backend.init&&r.backend.init(n,o.backend,o),r}return kn(e,Sn),bn(e,[{key:"queueLoad",value:function(t,e,i,n){var r=this,o=[],s=[],a=[],l=[];return t.forEach((function(t){var n=!0;e.forEach((function(e){var a="".concat(t,"|").concat(e);!i.reload&&r.store.hasResourceBundle(t,e)?r.state[a]=2:r.state[a]<0||(1===r.state[a]?s.indexOf(a)<0&&s.push(a):(r.state[a]=1,n=!1,s.indexOf(a)<0&&s.push(a),o.indexOf(a)<0&&o.push(a),l.indexOf(e)<0&&l.push(e)))})),n||a.push(t)})),(o.length||s.length)&&this.queue.push({pending:s,loaded:{},errors:[],callback:n}),{toLoad:o,pending:s,toLoadLanguages:a,toLoadNamespaces:l}}},{key:"loaded",value:function(t,e,i){var n=t.split("|"),r=n[0],o=n[1];e&&this.emit("failedLoading",r,o,e),i&&this.store.addResourceBundle(r,o,i),this.state[t]=e?-1:2;var s={};this.queue.forEach((function(i){Hn(i.loaded,[r],o),Qn(i.pending,t),e&&i.errors.push(e),0!==i.pending.length||i.done||(Object.keys(i.loaded).forEach((function(t){s[t]||(s[t]=[]),i.loaded[t].length&&i.loaded[t].forEach((function(e){s[t].indexOf(e)<0&&s[t].push(e)}))})),i.done=!0,i.errors.length?i.callback(i.errors):i.callback())})),this.emit("loaded",s),this.queue=this.queue.filter((function(t){return!t.done}))}},{key:"read",value:function(t,e,i){var n=this,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:350,s=arguments.length>5?arguments[5]:void 0;return t.length?this.backend[i](t,e,(function(a,l){a&&l&&r<5?setTimeout((function(){n.read.call(n,t,e,i,r+1,2*o,s)}),o):s(a,l)})):s(null,{})}},{key:"prepareLoading",value:function(t,e){var i=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();"string"==typeof t&&(t=this.languageUtils.toResolveHierarchy(t)),"string"==typeof e&&(e=[e]);var o=this.queueLoad(t,e,n,r);if(!o.toLoad.length)return o.pending.length||r(),null;o.toLoad.forEach((function(t){i.loadOne(t)}))}},{key:"load",value:function(t,e,i){this.prepareLoading(t,e,{},i)}},{key:"reload",value:function(t,e,i){this.prepareLoading(t,e,{reload:!0},i)}},{key:"loadOne",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=t.split("|"),r=n[0],o=n[1];this.read(r,o,"read",void 0,void 0,(function(n,s){n&&e.logger.warn("".concat(i,"loading namespace ").concat(o," for language ").concat(r," failed"),n),!n&&s&&e.logger.log("".concat(i,"loaded namespace ").concat(o," for language ").concat(r),s),e.loaded(t,n,s)}))}},{key:"saveMissing",value:function(t,e,i,n,r){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(e)?this.logger.warn('did not save key "'.concat(i,'" as the namespace "').concat(e,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"):null!=i&&""!==i&&(this.backend&&this.backend.create&&this.backend.create(t,e,i,n,null,fn({},o,{isUpdate:r})),t&&t[0]&&this.store.addResource(t[0],e,i,n))}}]),e}();function Jn(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,whitelist:!1,nonExplicitWhitelist:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(t){var e={};if("object"===un(t[1])&&(e=t[1]),"string"==typeof t[1]&&(e.defaultValue=t[1]),"string"==typeof t[2]&&(e.tDescription=t[2]),"object"===un(t[2])||"object"===un(t[3])){var i=t[3]||t[2];Object.keys(i).forEach((function(t){e[t]=i[t]}))}return e},interpolation:{escapeValue:!0,format:function(t,e,i,n){return t},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!1}}}function tr(t){return"string"==typeof t.ns&&(t.ns=[t.ns]),"string"==typeof t.fallbackLng&&(t.fallbackLng=[t.fallbackLng]),"string"==typeof t.fallbackNS&&(t.fallbackNS=[t.fallbackNS]),t.whitelist&&(t.whitelist&&t.whitelist.indexOf("cimode")<0&&(t.whitelist=t.whitelist.concat(["cimode"])),t.supportedLngs=t.whitelist),t.nonExplicitWhitelist&&(t.nonExplicitSupportedLngs=t.nonExplicitWhitelist),t.supportedLngs&&t.supportedLngs.indexOf("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t}function er(){}var ir=new(function(t){function e(){var t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(mn(this,e),t=_n(this,wn(e).call(this)),Dn&&Sn.call(yn(t)),t.options=tr(i),t.services={},t.logger=zn,t.modules={external:[]},n&&!t.isInitialized&&!i.isClone){if(!t.options.initImmediate)return t.init(i,n),_n(t,yn(t));setTimeout((function(){t.init(i,n)}),0)}return t}return kn(e,Sn),bn(e,[{key:"init",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;function n(t){return t?"function"==typeof t?new t:t:null}if("function"==typeof e&&(i=e,e={}),e.whitelist&&!e.supportedLngs&&this.logger.deprecate("whitelist",'option "whitelist" will be renamed to "supportedLngs" in the next major - please make sure to rename this option asap.'),e.nonExplicitWhitelist&&!e.nonExplicitSupportedLngs&&this.logger.deprecate("whitelist",'options "nonExplicitWhitelist" will be renamed to "nonExplicitSupportedLngs" in the next major - please make sure to rename this option asap.'),this.options=fn({},Jn(),this.options,tr(e)),this.format=this.options.interpolation.format,i||(i=er),!this.options.isClone){this.modules.logger?zn.init(n(this.modules.logger),this.options):zn.init(null,this.options);var r=new Un(this.options);this.store=new Nn(this.options.resources,this.options);var o=this.services;o.logger=zn,o.resourceStore=this.store,o.languageUtils=r,o.pluralResolver=new Xn(r,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),o.interpolator=new Kn(this.options),o.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},o.backendConnector=new Zn(n(this.modules.backend),o.resourceStore,o,this.options),o.backendConnector.on("*",(function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];t.emit.apply(t,[e].concat(n))})),this.modules.languageDetector&&(o.languageDetector=n(this.modules.languageDetector),o.languageDetector.init(o,this.options.detection,this.options)),this.modules.i18nFormat&&(o.i18nFormat=n(this.modules.i18nFormat),o.i18nFormat.init&&o.i18nFormat.init(this)),this.translator=new jn(this.services,this.options),this.translator.on("*",(function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];t.emit.apply(t,[e].concat(n))})),this.modules.external.forEach((function(e){e.init&&e.init(t)}))}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach((function(e){t[e]=function(){var i;return(i=t.store)[e].apply(i,arguments)}})),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((function(e){t[e]=function(){var i;return(i=t.store)[e].apply(i,arguments),t}}));var s=Cn(),a=function(){t.changeLanguage(t.options.lng,(function(e,n){t.isInitialized=!0,t.options.isClone||t.logger.log("initialized",t.options),t.emit("initialized",t.options),s.resolve(n),i(e,n)}))};return this.options.resources||!this.options.initImmediate?a():setTimeout(a,0),s}},{key:"loadResources",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:er,n="string"==typeof t?t:this.language;if("function"==typeof t&&(i=t),!this.options.resources||this.options.partialBundledLanguages){if(n&&"cimode"===n.toLowerCase())return i();var r=[],o=function(t){t&&e.services.languageUtils.toResolveHierarchy(t).forEach((function(t){r.indexOf(t)<0&&r.push(t)}))};if(n)o(n);else this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((function(t){return o(t)}));this.options.preload&&this.options.preload.forEach((function(t){return o(t)})),this.services.backendConnector.load(r,this.options.ns,i)}else i(null)}},{key:"reloadResources",value:function(t,e,i){var n=Cn();return t||(t=this.languages),e||(e=this.options.ns),i||(i=er),this.services.backendConnector.reload(t,e,(function(t){n.resolve(),i(t)})),n}},{key:"use",value:function(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===t.type&&(this.modules.backend=t),("logger"===t.type||t.log&&t.warn&&t.error)&&(this.modules.logger=t),"languageDetector"===t.type&&(this.modules.languageDetector=t),"i18nFormat"===t.type&&(this.modules.i18nFormat=t),"postProcessor"===t.type&&Fn.addPostProcessor(t),"3rdParty"===t.type&&this.modules.external.push(t),this}},{key:"changeLanguage",value:function(t,e){var i=this;this.isLanguageChangingTo=t;var n=Cn();this.emit("languageChanging",t);var r=function(t,r){r?(i.language=r,i.languages=i.services.languageUtils.toResolveHierarchy(r),i.translator.changeLanguage(r),i.isLanguageChangingTo=void 0,i.emit("languageChanged",r),i.logger.log("languageChanged",r)):i.isLanguageChangingTo=void 0,n.resolve((function(){return i.t.apply(i,arguments)})),e&&e(t,(function(){return i.t.apply(i,arguments)}))},o=function(t){var e="string"==typeof t?t:i.services.languageUtils.getBestMatchFromCodes(t);e&&(i.language||(i.language=e,i.languages=i.services.languageUtils.toResolveHierarchy(e)),i.translator.language||i.translator.changeLanguage(e),i.services.languageDetector&&i.services.languageDetector.cacheUserLanguage(e)),i.loadResources(e,(function(t){r(t,e)}))};return t||!this.services.languageDetector||this.services.languageDetector.async?!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(o):o(t):o(this.services.languageDetector.detect()),n}},{key:"getFixedT",value:function(t,e){var i=this,n=function t(e,n){var r;if("object"!==un(n)){for(var o=arguments.length,s=new Array(o>2?o-2:0),a=2;a<o;a++)s[a-2]=arguments[a];r=i.options.overloadTranslationOptionHandler([e,n].concat(s))}else r=fn({},n);return r.lng=r.lng||t.lng,r.lngs=r.lngs||t.lngs,r.ns=r.ns||t.ns,i.t(e,r)};return"string"==typeof t?n.lng=t:n.lngs=t,n.ns=e,n}},{key:"t",value:function(){var t;return this.translator&&(t=this.translator).translate.apply(t,arguments)}},{key:"exists",value:function(){var t;return this.translator&&(t=this.translator).exists.apply(t,arguments)}},{key:"setDefaultNamespace",value:function(t){this.options.defaultNS=t}},{key:"hasLoadedNamespace",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var n=this.languages[0],r=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;var s=function(t,i){var n=e.services.backendConnector.state["".concat(t,"|").concat(i)];return-1===n||2===n};if(i.precheck){var a=i.precheck(this,s);if(void 0!==a)return a}return!!this.hasResourceBundle(n,t)||(!this.services.backendConnector.backend||!(!s(n,t)||r&&!s(o,t)))}},{key:"loadNamespaces",value:function(t,e){var i=this,n=Cn();return this.options.ns?("string"==typeof t&&(t=[t]),t.forEach((function(t){i.options.ns.indexOf(t)<0&&i.options.ns.push(t)})),this.loadResources((function(t){n.resolve(),e&&e(t)})),n):(e&&e(),Promise.resolve())}},{key:"loadLanguages",value:function(t,e){var i=Cn();"string"==typeof t&&(t=[t]);var n=this.options.preload||[],r=t.filter((function(t){return n.indexOf(t)<0}));return r.length?(this.options.preload=n.concat(r),this.loadResources((function(t){i.resolve(),e&&e(t)})),i):(e&&e(),Promise.resolve())}},{key:"dir",value:function(t){return t||(t=this.languages&&this.languages.length>0?this.languages[0]:this.language),t?["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam"].indexOf(this.services.languageUtils.getLanguagePartFromCode(t))>=0?"rtl":"ltr":"rtl"}},{key:"createInstance",value:function(){return new e(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}},{key:"cloneInstance",value:function(){var t=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:er,r=fn({},this.options,i,{isClone:!0}),o=new e(r);return["store","services","language"].forEach((function(e){o[e]=t[e]})),o.services=fn({},this.services),o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o.translator=new jn(o.services,o.options),o.translator.on("*",(function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];o.emit.apply(o,[t].concat(i))})),o.init(r,n),o.translator.options=o.options,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}}]),e}());function nr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function rr(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function or(t,e,i){return e&&rr(t.prototype,e),i&&rr(t,i),t}var sr=[],ar=sr.forEach,lr=sr.slice;function cr(t){return ar.call(lr.call(arguments,1),(function(e){if(e)for(var i in e)void 0===t[i]&&(t[i]=e[i])})),t}var hr=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,dr=function(t,e,i){var n=i||{};n.path=n.path||"/";var r=t+"="+encodeURIComponent(e);if(n.maxAge>0){var o=n.maxAge-0;if(isNaN(o))throw new Error("maxAge should be a Number");r+="; Max-Age="+Math.floor(o)}if(n.domain){if(!hr.test(n.domain))throw new TypeError("option domain is invalid");r+="; Domain="+n.domain}if(n.path){if(!hr.test(n.path))throw new TypeError("option path is invalid");r+="; Path="+n.path}if(n.expires){if("function"!=typeof n.expires.toUTCString)throw new TypeError("option expires is invalid");r+="; Expires="+n.expires.toUTCString()}if(n.httpOnly&&(r+="; HttpOnly"),n.secure&&(r+="; Secure"),n.sameSite)switch("string"==typeof n.sameSite?n.sameSite.toLowerCase():n.sameSite){case!0:r+="; SameSite=Strict";break;case"lax":r+="; SameSite=Lax";break;case"strict":r+="; SameSite=Strict";break;case"none":r+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return r},pr={create:function(t,e,i,n){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{path:"/",sameSite:"strict"};i&&(r.expires=new Date,r.expires.setTime(r.expires.getTime()+60*i*1e3)),n&&(r.domain=n),document.cookie=dr(t,encodeURIComponent(e),r)},read:function(t){for(var e=t+"=",i=document.cookie.split(";"),n=0;n<i.length;n++){for(var r=i[n];" "===r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(e))return r.substring(e.length,r.length)}return null},remove:function(t){this.create(t,"",-1)}},ur={name:"cookie",lookup:function(t){var e;if(t.lookupCookie&&"undefined"!=typeof document){var i=pr.read(t.lookupCookie);i&&(e=i)}return e},cacheUserLanguage:function(t,e){e.lookupCookie&&"undefined"!=typeof document&&pr.create(e.lookupCookie,t,e.cookieMinutes,e.cookieDomain,e.cookieOptions)}},gr={name:"querystring",lookup:function(t){var e;if("undefined"!=typeof window)for(var i=window.location.search.substring(1).split("&"),n=0;n<i.length;n++){var r=i[n].indexOf("=");if(r>0)i[n].substring(0,r)===t.lookupQuerystring&&(e=i[n].substring(r+1))}return e}},fr=null,mr=function(){if(null!==fr)return fr;try{fr="undefined"!==window&&null!==window.localStorage;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch(t){fr=!1}return fr},vr={name:"localStorage",lookup:function(t){var e;if(t.lookupLocalStorage&&mr()){var i=window.localStorage.getItem(t.lookupLocalStorage);i&&(e=i)}return e},cacheUserLanguage:function(t,e){e.lookupLocalStorage&&mr()&&window.localStorage.setItem(e.lookupLocalStorage,t)}},br=null,yr=function(){if(null!==br)return br;try{br="undefined"!==window&&null!==window.sessionStorage;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch(t){br=!1}return br},_r={name:"sessionStorage",lookup:function(t){var e;if(t.lookupSessionStorage&&yr()){var i=window.sessionStorage.getItem(t.lookupSessionStorage);i&&(e=i)}return e},cacheUserLanguage:function(t,e){e.lookupSessionStorage&&yr()&&window.sessionStorage.setItem(e.lookupSessionStorage,t)}},wr={name:"navigator",lookup:function(t){var e=[];if("undefined"!=typeof navigator){if(navigator.languages)for(var i=0;i<navigator.languages.length;i++)e.push(navigator.languages[i]);navigator.userLanguage&&e.push(navigator.userLanguage),navigator.language&&e.push(navigator.language)}return e.length>0?e:void 0}},xr={name:"htmlTag",lookup:function(t){var e,i=t.htmlTag||("undefined"!=typeof document?document.documentElement:null);return i&&"function"==typeof i.getAttribute&&(e=i.getAttribute("lang")),e}},kr={name:"path",lookup:function(t){var e;if("undefined"!=typeof window){var i=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(i instanceof Array)if("number"==typeof t.lookupFromPathIndex){if("string"!=typeof i[t.lookupFromPathIndex])return;e=i[t.lookupFromPathIndex].replace("/","")}else e=i[0].replace("/","")}return e}},Ar={name:"subdomain",lookup:function(t){var e;if("undefined"!=typeof window){var i=window.location.href.match(/(?:http[s]*\:\/\/)*(.*?)\.(?=[^\/]*\..{2,5})/gi);i instanceof Array&&(e="number"==typeof t.lookupFromSubdomainIndex?i[t.lookupFromSubdomainIndex].replace("http://","").replace("https://","").replace(".",""):i[0].replace("http://","").replace("https://","").replace(".",""))}return e}};function zr(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var Sr=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};nr(this,t),this.type="languageDetector",this.detectors={},this.init(e,i)}return or(t,[{key:"init",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.services=t,this.options=cr(e,this.options||{},zr()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(ur),this.addDetector(gr),this.addDetector(vr),this.addDetector(_r),this.addDetector(wr),this.addDetector(xr),this.addDetector(kr),this.addDetector(Ar)}},{key:"addDetector",value:function(t){this.detectors[t.name]=t}},{key:"detect",value:function(t){var e=this;t||(t=this.options.order);var i=[];return t.forEach((function(t){if(e.detectors[t]){var n=e.detectors[t].lookup(e.options);n&&"string"==typeof n&&(n=[n]),n&&(i=i.concat(n))}})),this.services.languageUtils.getBestMatchFromCodes?i:i.length>0?i[0]:null}},{key:"cacheUserLanguage",value:function(t,e){var i=this;e||(e=this.options.caches),e&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||e.forEach((function(e){i.detectors[e]&&i.detectors[e].cacheUserLanguage(t,i.options)})))}}]),t}();Sr.type="languageDetector";var Cr=[],Er=Cr.forEach,Mr=Cr.slice;function Lr(t){return Er.call(Mr.call(arguments,1),(function(e){if(e)for(var i in e)void 0===t[i]&&(t[i]=e[i])})),t}function Tr(t,e){if(e&&"object"===un(e)){var i="",n=encodeURIComponent;for(var r in e)i+="&"+n(r)+"="+n(e[r]);if(!i)return t;t=t+(-1!==t.indexOf("?")?"&":"?")+i.slice(1)}return t}function Hr(t,e,i,n,r){n&&"object"===un(n)&&(r||(n._t=new Date),n=Tr("",n).slice(1)),e.queryStringParams&&(t=Tr(t,e.queryStringParams));try{var o;(o=XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("MSXML2.XMLHTTP.3.0")).open(n?"POST":"GET",t,1),e.crossDomain||o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.withCredentials=!!e.withCredentials,n&&o.setRequestHeader("Content-type","application/x-www-form-urlencoded"),o.overrideMimeType&&o.overrideMimeType("application/json");var s=e.customHeaders;if(s="function"==typeof s?s():s)for(var a in s)o.setRequestHeader(a,s[a]);o.onreadystatechange=function(){o.readyState>3&&i&&i(o.responseText,o)},o.send(n)}catch(t){console&&console.log(t)}}function Or(){return{loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"/locales/add/{{lng}}/{{ns}}",allowMultiLoading:!1,parse:JSON.parse,parsePayload:function(t,e,i){return gn({},e,i||"")},crossDomain:!1,ajax:Hr}}var $r=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};mn(this,t),this.init(e,i),this.type="backend"}return bn(t,[{key:"init",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.services=t,this.options=Lr(e,this.options||{},Or())}},{key:"readMulti",value:function(t,e,i){var n=this.options.loadPath;"function"==typeof this.options.loadPath&&(n=this.options.loadPath(t,e));var r=this.services.interpolator.interpolate(n,{lng:t.join("+"),ns:e.join("+")});this.loadUrl(r,i)}},{key:"read",value:function(t,e,i){var n=this.options.loadPath;"function"==typeof this.options.loadPath&&(n=this.options.loadPath([t],[e]));var r=this.services.interpolator.interpolate(n,{lng:t,ns:e});this.loadUrl(r,i)}},{key:"loadUrl",value:function(t,e){var i=this;this.options.ajax(t,this.options,(function(n,r){if(r.status>=500&&r.status<600)return e("failed loading "+t,!0);if(r.status>=400&&r.status<500)return e("failed loading "+t,!1);var o,s;try{o=i.options.parse(n,t)}catch(e){s="failed parsing "+t+" to json"}if(s)return e(s,!1);e(null,o)}))}},{key:"create",value:function(t,e,i,n){var r=this;"string"==typeof t&&(t=[t]);var o=this.options.parsePayload(e,i,n);t.forEach((function(t){var i=r.services.interpolator.interpolate(r.options.addPath,{lng:t,ns:e});r.options.ajax(i,r.options,(function(t,e){}),o)}))}}]),t}();function Vr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ir(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Rr(t,e,i){return e&&Ir(t.prototype,e),i&&Ir(t,i),t}$r.type="backend";var Pr=[],Dr=Pr.forEach,Nr=Pr.slice;function Fr(t){return Dr.call(Nr.call(arguments,1),(function(e){if(e)for(var i in e)void 0===t[i]&&(t[i]=e[i])})),t}function Br(t){return t?"function"==typeof t?new t:t:null}function jr(){return{}}var qr=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Vr(this,t),this.backends=[],this.type="backend",this.init(e,i)}return Rr(t,[{key:"init",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;this.services=t,this.options=Fr(i,this.options||{},jr()),this.options.backends&&this.options.backends.forEach((function(i,r){e.backends[r]=e.backends[r]||Br(i),e.backends[r].init(t,e.options.backendOptions[r],n)}))}},{key:"read",value:function(t,e,i){var n=this,r=this.backends.length,o=function o(a){if(a>=r)return i(new Error("non of the backend loaded data;",!0));var l=n.backends[a];l.read?l.read(t,e,(function(t,e){!t&&e&&Object.keys(e).length>-1?(i(null,e,a),s(a-1,e)):o(a+1)})):o(a+1)},s=function i(r,o){if(!(r<0)){var s=n.backends[r];s.save?(s.save(t,e,o),i(r-1,o)):i(r-1,o)}};o(0)}},{key:"create",value:function(t,e,i,n){this.backends.forEach((function(r){r.create&&r.create(t,e,i,n)}))}}]),t}();let Ur;qr.type="backend";class Wr extends(N(V)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{appRoot:{type:String,attribute:"app-root"},template:{type:String},endpoint:{type:String,reflect:!0},apiVersion:{type:String,attribute:"api-version",reflect:!0},locales:{type:String},localeFallbackNs:{type:String,attribute:"locale-fallback-ns"},language:{type:String},requireLanguage:{type:Boolean,attribute:"require-language"},unresolved:{type:Boolean,reflect:!0}})}constructor(){super(),this.unresolved=!0,this.endpoint=".",this.apiVersion=void 0,this.requireLanguage=!1,this._localeFallbacks=[],this._i18nInstance=null,Ur?this.disabled=!0:(Ur=this,B())}set localeFallbackNs(t){t.split(/\s+/).forEach(t=>this._localeFallbacks.push(t))}disconnectedCallback(){super.disconnectedCallback(),this._i18nInstance=null,Ur===this&&(Ur=null)}async connectedCallback(){if(super.connectedCallback(),this.disabled)return;this.endpoint=this.endpoint.replace(/\/+$/,""),this.locales&&-1===this._localeFallbacks.indexOf("app")&&this._localeFallbacks.push("app"),this._localeFallbacks.push("common");const t=this.getParameter("_target");t&&(this.endpoint=t);const e=this.getParameter("_api");if(e&&(this.apiVersion=e),!this.apiVersion){const t=await fetch(this.endpoint+"/login").then(t=>t.ok?null:fetch(this.endpoint+"/api/version").then(t=>t.json())).catch(t=>{if(404===t.response.status)return fetch(this.endpoint+"/api/version").then(t=>t.json())});t?(this.apiVersion=t.api,console.log(`<pb-page> Server reports API version ${this.apiVersion} with app ${t.app.name}/${t.app.version} running on ${t.engine.name}/${t.engine.version}`)):(console.log("<pb-page> No API version reported by server, assuming 0.9.0"),this.apiVersion="0.9.0")}this.requireLanguage?this._i18nInstance&&this.signalReady("pb-page-ready",{endpoint:this.endpoint,apiVersion:this.apiVersion,template:this.template,language:this._i18nInstance.language}):this.signalReady("pb-page-ready",{endpoint:this.endpoint,template:this.template,apiVersion:this.apiVersion})}firstUpdated(){if(super.firstUpdated(),this.disabled)return;this.shadowRoot.querySelector("slot").addEventListener("slotchange",()=>{const t=new CustomEvent("pb-page-loaded",{bubbles:!0,composed:!0});this.dispatchEvent(t)},{once:!0});const t=D("../i18n/")+"{{ns}}/{{lng}}.json";console.log("<pb-page> Loading locales. common: %s; additional: %s; namespaces: %o",t,this.locales,this._localeFallbacks);const e=this.locales?[$r,$r]:[$r],i=[{loadPath:t,crossDomain:!0}];this.locales&&i.unshift({loadPath:this.locales,crossDomain:!0});const n={fallbackLng:"en",defaultNS:"common",ns:["common"],debug:!1,load:"languageOnly",detection:{lookupQuerystring:"lang"},backend:{backends:e,backendOptions:i}};if(this.language&&(n.lng=this.language),this._localeFallbacks.length>0){const t=this._localeFallbacks.slice();n.defaultNS=t[0],n.fallbackNS=t.slice(1),n.ns=t}console.log("<pb-page> i18next options: %o",n),this._i18nInstance=ir.createInstance(),this._i18nInstance.use(Sr).use(qr),this._i18nInstance.init(n).then(t=>{s(t),this._updateI18n(t),this.signalReady("pb-i18n-update",{t:t,language:this._i18nInstance.language}),this.requireLanguage&&this.apiVersion&&this.signalReady("pb-page-ready",{endpoint:this.endpoint,apiVersion:this.apiVersion,template:this.template,language:this._i18nInstance.language})}),this.subscribeTo("pb-i18n-language",t=>{const{language:e}=t.detail;this._i18nInstance.changeLanguage(e).then(t=>{this._updateI18n(t),this.emitTo("pb-i18n-update",{t:t,language:this._i18nInstance.language},[])},[])}),this.subscribeTo("pb-toggle",this._toggleFeatures.bind(this)),this.unresolved=!1,console.log("<pb-page> endpoint: %s; trigger window resize",this.endpoint),this.querySelectorAll("app-header").forEach(t=>t._notifyLayoutChanged()),an(this)}_updateI18n(t){this.querySelectorAll("[data-i18n]").forEach(e=>{const i=e.getAttribute("data-i18n"),n=/(?:\[([^\]]+)\])?([^;]+)/g;let r=n.exec(i);for(;r;){const o=t(r[2]);r[1]?e.setAttribute(r[1],o):e.innerHTML=o,r=n.exec(i)}})}_toggleFeatures(t){t.detail.selectors&&t.detail.selectors.forEach(t=>{this.querySelectorAll(t.selector).forEach(e=>{const i=t.command||"toggle";e.command&&e.command(i,t.state),t.state?e.classList.add(i):e.classList.remove(i)})})}render(){return R`<slot></slot>`}static get styles(){return P`
|
|
716
|
+
`}}function un(t){return(un="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function gn(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function fn(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?Object(arguments[e]):{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter((function(t){return Object.getOwnPropertyDescriptor(i,t).enumerable})))),n.forEach((function(e){gn(t,e,i[e])}))}return t}function mn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function vn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function bn(t,e,i){return e&&vn(t.prototype,e),i&&vn(t,i),t}function yn(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _n(t,e){return!e||"object"!==un(e)&&"function"!=typeof e?yn(t):e}function wn(t){return(wn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function xn(t,e){return(xn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function kn(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&xn(t,e)}customElements.define("pb-navigation",pn);var An={type:"logger",log:function(t){this.output("log",t)},warn:function(t){this.output("warn",t)},error:function(t){this.output("error",t)},output:function(t,e){console&&console[t]&&console[t].apply(console,e)}},zn=new(function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};mn(this,t),this.init(e,i)}return bn(t,[{key:"init",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=e.prefix||"i18next:",this.logger=t||An,this.options=e,this.debug=e.debug}},{key:"setDebug",value:function(t){this.debug=t}},{key:"log",value:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this.forward(e,"log","",!0)}},{key:"warn",value:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this.forward(e,"warn","",!0)}},{key:"error",value:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this.forward(e,"error","")}},{key:"deprecate",value:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(t,e,i,n){return n&&!this.debug?null:("string"==typeof t[0]&&(t[0]="".concat(i).concat(this.prefix," ").concat(t[0])),this.logger[e](t))}},{key:"create",value:function(e){return new t(this.logger,fn({},{prefix:"".concat(this.prefix,":").concat(e,":")},this.options))}}]),t}()),Sn=function(){function t(){mn(this,t),this.observers={}}return bn(t,[{key:"on",value:function(t,e){var i=this;return t.split(" ").forEach((function(t){i.observers[t]=i.observers[t]||[],i.observers[t].push(e)})),this}},{key:"off",value:function(t,e){this.observers[t]&&(e?this.observers[t]=this.observers[t].filter((function(t){return t!==e})):delete this.observers[t])}},{key:"emit",value:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];this.observers[t]&&[].concat(this.observers[t]).forEach((function(t){t.apply(void 0,i)}));this.observers["*"]&&[].concat(this.observers["*"]).forEach((function(e){e.apply(e,[t].concat(i))}))}}]),t}();function Cn(){var t,e,i=new Promise((function(i,n){t=i,e=n}));return i.resolve=t,i.reject=e,i}function En(t){return null==t?"":""+t}function Mn(t,e,i){t.forEach((function(t){e[t]&&(i[t]=e[t])}))}function Ln(t,e,i){function n(t){return t&&t.indexOf("###")>-1?t.replace(/###/g,"."):t}function r(){return!t||"string"==typeof t}for(var o="string"!=typeof e?[].concat(e):e.split(".");o.length>1;){if(r())return{};var s=n(o.shift());!t[s]&&i&&(t[s]=new i),t=t[s]}return r()?{}:{obj:t,k:n(o.shift())}}function Tn(t,e,i){var n=Ln(t,e,Object);n.obj[n.k]=i}function Hn(t,e,i,n){var r=Ln(t,e,Object),o=r.obj,s=r.k;o[s]=o[s]||[],n&&(o[s]=o[s].concat(i)),n||o[s].push(i)}function On(t,e){var i=Ln(t,e),n=i.obj,r=i.k;if(n)return n[r]}function $n(t,e,i){var n=On(t,i);return void 0!==n?n:On(e,i)}function Vn(t,e,i){for(var n in e)"__proto__"!==n&&(n in t?"string"==typeof t[n]||t[n]instanceof String||"string"==typeof e[n]||e[n]instanceof String?i&&(t[n]=e[n]):Vn(t[n],e[n],i):t[n]=e[n]);return t}function In(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var Rn={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function Pn(t){return"string"==typeof t?t.replace(/[&<>"'\/]/g,(function(t){return Rn[t]})):t}var Dn="undefined"!=typeof window&&window.navigator&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,Nn=function(t){function e(t){var i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return mn(this,e),i=_n(this,wn(e).call(this)),Dn&&Sn.call(yn(i)),i.data=t||{},i.options=n,void 0===i.options.keySeparator&&(i.options.keySeparator="."),i}return kn(e,Sn),bn(e,[{key:"addNamespaces",value:function(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}},{key:"removeNamespaces",value:function(t){var e=this.options.ns.indexOf(t);e>-1&&this.options.ns.splice(e,1)}},{key:"getResource",value:function(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,o=[t,e];return i&&"string"!=typeof i&&(o=o.concat(i)),i&&"string"==typeof i&&(o=o.concat(r?i.split(r):i)),t.indexOf(".")>-1&&(o=t.split(".")),On(this.data,o)}},{key:"addResource",value:function(t,e,i,n){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},o=this.options.keySeparator;void 0===o&&(o=".");var s=[t,e];i&&(s=s.concat(o?i.split(o):i)),t.indexOf(".")>-1&&(n=e,e=(s=t.split("."))[1]),this.addNamespaces(e),Tn(this.data,s,n),r.silent||this.emit("added",t,e,i,n)}},{key:"addResources",value:function(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var r in i)"string"!=typeof i[r]&&"[object Array]"!==Object.prototype.toString.apply(i[r])||this.addResource(t,e,r,i[r],{silent:!0});n.silent||this.emit("added",t,e,i)}},{key:"addResourceBundle",value:function(t,e,i,n,r){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},s=[t,e];t.indexOf(".")>-1&&(n=i,i=e,e=(s=t.split("."))[1]),this.addNamespaces(e);var a=On(this.data,s)||{};n?Vn(a,i,r):a=fn({},a,i),Tn(this.data,s,a),o.silent||this.emit("added",t,e,i)}},{key:"removeResourceBundle",value:function(t,e){this.hasResourceBundle(t,e)&&delete this.data[t][e],this.removeNamespaces(e),this.emit("removed",t,e)}},{key:"hasResourceBundle",value:function(t,e){return void 0!==this.getResource(t,e)}},{key:"getResourceBundle",value:function(t,e){return e||(e=this.options.defaultNS),"v1"===this.options.compatibilityAPI?fn({},{},this.getResource(t,e)):this.getResource(t,e)}},{key:"getDataByLanguage",value:function(t){return this.data[t]}},{key:"toJSON",value:function(){return this.data}}]),e}(),Fn={processors:{},addPostProcessor:function(t){this.processors[t.name]=t},handle:function(t,e,i,n,r){var o=this;return t.forEach((function(t){o.processors[t]&&(e=o.processors[t].process(e,i,n,r))})),e}},Bn={},jn=function(t){function e(t){var i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return mn(this,e),i=_n(this,wn(e).call(this)),Dn&&Sn.call(yn(i)),Mn(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,yn(i)),i.options=n,void 0===i.options.keySeparator&&(i.options.keySeparator="."),i.logger=zn.create("translator"),i}return kn(e,Sn),bn(e,[{key:"changeLanguage",value:function(t){t&&(this.language=t)}},{key:"exists",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}},i=this.resolve(t,e);return i&&void 0!==i.res}},{key:"extractFromKey",value:function(t,e){var i=void 0!==e.nsSeparator?e.nsSeparator:this.options.nsSeparator;void 0===i&&(i=":");var n=void 0!==e.keySeparator?e.keySeparator:this.options.keySeparator,r=e.ns||this.options.defaultNS;if(i&&t.indexOf(i)>-1){var o=t.match(this.interpolator.nestingRegexp);if(o&&o.length>0)return{key:t,namespaces:r};var s=t.split(i);(i!==n||i===n&&this.options.ns.indexOf(s[0])>-1)&&(r=s.shift()),t=s.join(n)}return"string"==typeof r&&(r=[r]),{key:t,namespaces:r}}},{key:"translate",value:function(t,e,i){var n=this;if("object"!==un(e)&&this.options.overloadTranslationOptionHandler&&(e=this.options.overloadTranslationOptionHandler(arguments)),e||(e={}),null==t)return"";Array.isArray(t)||(t=[String(t)]);var r=void 0!==e.keySeparator?e.keySeparator:this.options.keySeparator,o=this.extractFromKey(t[t.length-1],e),s=o.key,a=o.namespaces,l=a[a.length-1],c=e.lng||this.language,h=e.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(c&&"cimode"===c.toLowerCase()){if(h){var d=e.nsSeparator||this.options.nsSeparator;return l+d+s}return s}var p=this.resolve(t,e),u=p&&p.res,g=p&&p.usedKey||s,f=p&&p.exactUsedKey||s,m=Object.prototype.toString.apply(u),v=["[object Number]","[object Function]","[object RegExp]"],b=void 0!==e.joinArrays?e.joinArrays:this.options.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject;if(y&&u&&("string"!=typeof u&&"boolean"!=typeof u&&"number"!=typeof u)&&v.indexOf(m)<0&&("string"!=typeof b||"[object Array]"!==m)){if(!e.returnObjects&&!this.options.returnObjects)return this.logger.warn("accessing an object - but returnObjects options is not enabled!"),this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,u,e):"key '".concat(s," (").concat(this.language,")' returned an object instead of string.");if(r){var _="[object Array]"===m,w=_?[]:{},x=_?f:g;for(var k in u)if(Object.prototype.hasOwnProperty.call(u,k)){var A="".concat(x).concat(r).concat(k);w[k]=this.translate(A,fn({},e,{joinArrays:!1,ns:a})),w[k]===A&&(w[k]=u[k])}u=w}}else if(y&&"string"==typeof b&&"[object Array]"===m)(u=u.join(b))&&(u=this.extendTranslation(u,t,e,i));else{var z=!1,S=!1;if(!this.isValidLookup(u)&&void 0!==e.defaultValue){if(z=!0,void 0!==e.count){var C=this.pluralResolver.getSuffix(c,e.count);u=e["defaultValue".concat(C)]}u||(u=e.defaultValue)}this.isValidLookup(u)||(S=!0,u=s);var E=e.defaultValue&&e.defaultValue!==u&&this.options.updateMissing;if(S||z||E){if(this.logger.log(E?"updateKey":"missingKey",c,l,s,E?e.defaultValue:u),r){var M=this.resolve(s,fn({},e,{keySeparator:!1}));M&&M.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var L=[],T=this.languageUtils.getFallbackCodes(this.options.fallbackLng,e.lng||this.language);if("fallback"===this.options.saveMissingTo&&T&&T[0])for(var H=0;H<T.length;H++)L.push(T[H]);else"all"===this.options.saveMissingTo?L=this.languageUtils.toResolveHierarchy(e.lng||this.language):L.push(e.lng||this.language);var O=function(t,i){n.options.missingKeyHandler?n.options.missingKeyHandler(t,l,i,E?e.defaultValue:u,E,e):n.backendConnector&&n.backendConnector.saveMissing&&n.backendConnector.saveMissing(t,l,i,E?e.defaultValue:u,E,e),n.emit("missingKey",t,l,i,u)};if(this.options.saveMissing){var $=void 0!==e.count&&"string"!=typeof e.count;this.options.saveMissingPlurals&&$?L.forEach((function(t){n.pluralResolver.getPluralFormsOfKey(t,s).forEach((function(e){return O([t],e)}))})):O(L,s)}}u=this.extendTranslation(u,t,e,p,i),S&&u===s&&this.options.appendNamespaceToMissingKey&&(u="".concat(l,":").concat(s)),S&&this.options.parseMissingKeyHandler&&(u=this.options.parseMissingKeyHandler(u))}return u}},{key:"extendTranslation",value:function(t,e,i,n,r){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,i,n.usedLng,n.usedNS,n.usedKey,{resolved:n});else if(!i.skipInterpolation){i.interpolation&&this.interpolator.init(fn({},i,{interpolation:fn({},this.options.interpolation,i.interpolation)}));var s,a=i.interpolation&&i.interpolation.skipOnVariables||this.options.interpolation.skipOnVariables;if(a){var l=t.match(this.interpolator.nestingRegexp);s=l&&l.length}var c=i.replace&&"string"!=typeof i.replace?i.replace:i;if(this.options.interpolation.defaultVariables&&(c=fn({},this.options.interpolation.defaultVariables,c)),t=this.interpolator.interpolate(t,c,i.lng||this.language,i),a){var h=t.match(this.interpolator.nestingRegexp);s<(h&&h.length)&&(i.nest=!1)}!1!==i.nest&&(t=this.interpolator.nest(t,(function(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return r&&r[0]===i[0]?(o.logger.warn("It seems you are nesting recursively key: ".concat(i[0]," in key: ").concat(e[0])),null):o.translate.apply(o,i.concat([e]))}),i)),i.interpolation&&this.interpolator.reset()}var d=i.postProcess||this.options.postProcess,p="string"==typeof d?[d]:d;return null!=t&&p&&p.length&&!1!==i.applyPostProcessor&&(t=Fn.handle(p,t,e,this.options&&this.options.postProcessPassResolved?fn({i18nResolved:n},i):i,this)),t}},{key:"resolve",value:function(t){var e,i,n,r,o,s=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof t&&(t=[t]),t.forEach((function(t){if(!s.isValidLookup(e)){var l=s.extractFromKey(t,a),c=l.key;i=c;var h=l.namespaces;s.options.fallbackNS&&(h=h.concat(s.options.fallbackNS));var d=void 0!==a.count&&"string"!=typeof a.count,p=void 0!==a.context&&"string"==typeof a.context&&""!==a.context,u=a.lngs?a.lngs:s.languageUtils.toResolveHierarchy(a.lng||s.language,a.fallbackLng);h.forEach((function(t){s.isValidLookup(e)||(o=t,!Bn["".concat(u[0],"-").concat(t)]&&s.utils&&s.utils.hasLoadedNamespace&&!s.utils.hasLoadedNamespace(o)&&(Bn["".concat(u[0],"-").concat(t)]=!0,s.logger.warn('key "'.concat(i,'" for languages "').concat(u.join(", "),'" won\'t get resolved as namespace "').concat(o,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),u.forEach((function(i){if(!s.isValidLookup(e)){r=i;var o,l,h=c,u=[h];if(s.i18nFormat&&s.i18nFormat.addLookupKeys)s.i18nFormat.addLookupKeys(u,c,i,t,a);else d&&(o=s.pluralResolver.getSuffix(i,a.count)),d&&p&&u.push(h+o),p&&u.push(h+="".concat(s.options.contextSeparator).concat(a.context)),d&&u.push(h+=o);for(;l=u.pop();)s.isValidLookup(e)||(n=l,e=s.getResource(i,t,l,a))}})))}))}})),{res:e,usedKey:i,exactUsedKey:n,usedLng:r,usedNS:o}}},{key:"isValidLookup",value:function(t){return!(void 0===t||!this.options.returnNull&&null===t||!this.options.returnEmptyString&&""===t)}},{key:"getResource",value:function(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,e,i,n):this.resourceStore.getResource(t,e,i,n)}}]),e}();function qn(t){return t.charAt(0).toUpperCase()+t.slice(1)}var Un=function(){function t(e){mn(this,t),this.options=e,this.whitelist=this.options.supportedLngs||!1,this.supportedLngs=this.options.supportedLngs||!1,this.logger=zn.create("languageUtils")}return bn(t,[{key:"getScriptPartFromCode",value:function(t){if(!t||t.indexOf("-")<0)return null;var e=t.split("-");return 2===e.length?null:(e.pop(),"x"===e[e.length-1].toLowerCase()?null:this.formatLanguageCode(e.join("-")))}},{key:"getLanguagePartFromCode",value:function(t){if(!t||t.indexOf("-")<0)return t;var e=t.split("-");return this.formatLanguageCode(e[0])}},{key:"formatLanguageCode",value:function(t){if("string"==typeof t&&t.indexOf("-")>-1){var e=["hans","hant","latn","cyrl","cans","mong","arab"],i=t.split("-");return this.options.lowerCaseLng?i=i.map((function(t){return t.toLowerCase()})):2===i.length?(i[0]=i[0].toLowerCase(),i[1]=i[1].toUpperCase(),e.indexOf(i[1].toLowerCase())>-1&&(i[1]=qn(i[1].toLowerCase()))):3===i.length&&(i[0]=i[0].toLowerCase(),2===i[1].length&&(i[1]=i[1].toUpperCase()),"sgn"!==i[0]&&2===i[2].length&&(i[2]=i[2].toUpperCase()),e.indexOf(i[1].toLowerCase())>-1&&(i[1]=qn(i[1].toLowerCase())),e.indexOf(i[2].toLowerCase())>-1&&(i[2]=qn(i[2].toLowerCase()))),i.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}},{key:"isWhitelisted",value:function(t){return this.logger.deprecate("languageUtils.isWhitelisted",'function "isWhitelisted" will be renamed to "isSupportedCode" in the next major - please make sure to rename it\'s usage asap.'),this.isSupportedCode(t)}},{key:"isSupportedCode",value:function(t){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}},{key:"getBestMatchFromCodes",value:function(t){var e,i=this;return t?(t.forEach((function(t){if(!e){var n=i.formatLanguageCode(t);i.options.supportedLngs&&!i.isSupportedCode(n)||(e=n)}})),!e&&this.options.supportedLngs&&t.forEach((function(t){if(!e){var n=i.getLanguagePartFromCode(t);if(i.isSupportedCode(n))return e=n;e=i.options.supportedLngs.find((function(t){if(0===t.indexOf(n))return t}))}})),e||(e=this.getFallbackCodes(this.options.fallbackLng)[0]),e):null}},{key:"getFallbackCodes",value:function(t,e){if(!t)return[];if("function"==typeof t&&(t=t(e)),"string"==typeof t&&(t=[t]),"[object Array]"===Object.prototype.toString.apply(t))return t;if(!e)return t.default||[];var i=t[e];return i||(i=t[this.getScriptPartFromCode(e)]),i||(i=t[this.formatLanguageCode(e)]),i||(i=t[this.getLanguagePartFromCode(e)]),i||(i=t.default),i||[]}},{key:"toResolveHierarchy",value:function(t,e){var i=this,n=this.getFallbackCodes(e||this.options.fallbackLng||[],t),r=[],o=function(t){t&&(i.isSupportedCode(t)?r.push(t):i.logger.warn("rejecting language code not found in supportedLngs: ".concat(t)))};return"string"==typeof t&&t.indexOf("-")>-1?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(t)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(t)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(t))):"string"==typeof t&&o(this.formatLanguageCode(t)),n.forEach((function(t){r.indexOf(t)<0&&o(i.formatLanguageCode(t))})),r}}]),t}(),Wn=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","kk","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Yn={1:function(t){return Number(t>1)},2:function(t){return Number(1!=t)},3:function(t){return 0},4:function(t){return Number(t%10==1&&t%100!=11?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2)},5:function(t){return Number(0==t?0:1==t?1:2==t?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5)},6:function(t){return Number(1==t?0:t>=2&&t<=4?1:2)},7:function(t){return Number(1==t?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2)},8:function(t){return Number(1==t?0:2==t?1:8!=t&&11!=t?2:3)},9:function(t){return Number(t>=2)},10:function(t){return Number(1==t?0:2==t?1:t<7?2:t<11?3:4)},11:function(t){return Number(1==t||11==t?0:2==t||12==t?1:t>2&&t<20?2:3)},12:function(t){return Number(t%10!=1||t%100==11)},13:function(t){return Number(0!==t)},14:function(t){return Number(1==t?0:2==t?1:3==t?2:3)},15:function(t){return Number(t%10==1&&t%100!=11?0:t%10>=2&&(t%100<10||t%100>=20)?1:2)},16:function(t){return Number(t%10==1&&t%100!=11?0:0!==t?1:2)},17:function(t){return Number(1==t||t%10==1&&t%100!=11?0:1)},18:function(t){return Number(0==t?0:1==t?1:2)},19:function(t){return Number(1==t?0:0==t||t%100>1&&t%100<11?1:t%100>10&&t%100<20?2:3)},20:function(t){return Number(1==t?0:0==t||t%100>0&&t%100<20?1:2)},21:function(t){return Number(t%100==1?1:t%100==2?2:t%100==3||t%100==4?3:0)},22:function(t){return Number(1==t?0:2==t?1:(t<0||t>10)&&t%10==0?2:3)}};function Gn(){var t={};return Wn.forEach((function(e){e.lngs.forEach((function(i){t[i]={numbers:e.nr,plurals:Yn[e.fc]}}))})),t}var Xn=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};mn(this,t),this.languageUtils=e,this.options=i,this.logger=zn.create("pluralResolver"),this.rules=Gn()}return bn(t,[{key:"addRule",value:function(t,e){this.rules[t]=e}},{key:"getRule",value:function(t){return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}},{key:"needsPlural",value:function(t){var e=this.getRule(t);return e&&e.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(t,e){var i=this,n=[],r=this.getRule(t);return r?(r.numbers.forEach((function(r){var o=i.getSuffix(t,r);n.push("".concat(e).concat(o))})),n):n}},{key:"getSuffix",value:function(t,e){var i=this,n=this.getRule(t);if(n){var r=n.noAbs?n.plurals(e):n.plurals(Math.abs(e)),o=n.numbers[r];this.options.simplifyPluralSuffix&&2===n.numbers.length&&1===n.numbers[0]&&(2===o?o="plural":1===o&&(o=""));var s=function(){return i.options.prepend&&o.toString()?i.options.prepend+o.toString():o.toString()};return"v1"===this.options.compatibilityJSON?1===o?"":"number"==typeof o?"_plural_".concat(o.toString()):s():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===n.numbers.length&&1===n.numbers[0]?s():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}return this.logger.warn("no plural rule found for: ".concat(t)),""}}]),t}(),Kn=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};mn(this,t),this.logger=zn.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||function(t){return t},this.init(e)}return bn(t,[{key:"init",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});var e=t.interpolation;this.escape=void 0!==e.escape?e.escape:Pn,this.escapeValue=void 0===e.escapeValue||e.escapeValue,this.useRawValueToEscape=void 0!==e.useRawValueToEscape&&e.useRawValueToEscape,this.prefix=e.prefix?In(e.prefix):e.prefixEscaped||"{{",this.suffix=e.suffix?In(e.suffix):e.suffixEscaped||"}}",this.formatSeparator=e.formatSeparator?e.formatSeparator:e.formatSeparator||",",this.unescapePrefix=e.unescapeSuffix?"":e.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":e.unescapeSuffix||"",this.nestingPrefix=e.nestingPrefix?In(e.nestingPrefix):e.nestingPrefixEscaped||In("$t("),this.nestingSuffix=e.nestingSuffix?In(e.nestingSuffix):e.nestingSuffixEscaped||In(")"),this.nestingOptionsSeparator=e.nestingOptionsSeparator?e.nestingOptionsSeparator:e.nestingOptionsSeparator||",",this.maxReplaces=e.maxReplaces?e.maxReplaces:1e3,this.alwaysFormat=void 0!==e.alwaysFormat&&e.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var t="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(t,"g");var e="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(e,"g");var i="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(i,"g")}},{key:"interpolate",value:function(t,e,i,n){var r,o,s,a=this,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function c(t){return t.replace(/\$/g,"$$$$")}var h=function(t){if(t.indexOf(a.formatSeparator)<0){var r=$n(e,l,t);return a.alwaysFormat?a.format(r,void 0,i):r}var o=t.split(a.formatSeparator),s=o.shift().trim(),c=o.join(a.formatSeparator).trim();return a.format($n(e,l,s),c,i,n)};this.resetRegExp();var d=n&&n.missingInterpolationHandler||this.options.missingInterpolationHandler,p=n&&n.interpolation&&n.interpolation.skipOnVariables||this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(t){return c(t)}},{regex:this.regexp,safeValue:function(t){return a.escapeValue?c(a.escape(t)):c(t)}}].forEach((function(e){for(s=0;r=e.regex.exec(t);){if(void 0===(o=h(r[1].trim())))if("function"==typeof d){var i=d(t,r,n);o="string"==typeof i?i:""}else{if(p){o=r[0];continue}a.logger.warn("missed to pass in variable ".concat(r[1]," for interpolating ").concat(t)),o=""}else"string"==typeof o||a.useRawValueToEscape||(o=En(o));if(t=t.replace(r[0],e.safeValue(o)),e.regex.lastIndex=0,++s>=a.maxReplaces)break}})),t}},{key:"nest",value:function(t,e){var i,n,r=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=fn({},o);function a(t,e){var i=this.nestingOptionsSeparator;if(t.indexOf(i)<0)return t;var n=t.split(new RegExp("".concat(i,"[ ]*{"))),r="{".concat(n[1]);t=n[0],r=(r=this.interpolate(r,s)).replace(/'/g,'"');try{s=JSON.parse(r),e&&(s=fn({},e,s))}catch(e){return this.logger.warn("failed parsing options string in nesting for key ".concat(t),e),"".concat(t).concat(i).concat(r)}return delete s.defaultValue,t}for(s.applyPostProcessor=!1,delete s.defaultValue;i=this.nestingRegexp.exec(t);){var l=[],c=!1;if(i[0].includes(this.formatSeparator)&&!/{.*}/.test(i[1])){var h=i[1].split(this.formatSeparator).map((function(t){return t.trim()}));i[1]=h.shift(),l=h,c=!0}if((n=e(a.call(this,i[1].trim(),s),s))&&i[0]===t&&"string"!=typeof n)return n;"string"!=typeof n&&(n=En(n)),n||(this.logger.warn("missed to resolve ".concat(i[1]," for nesting ").concat(t)),n=""),c&&(n=l.reduce((function(t,e){return r.format(t,e,o.lng,o)}),n.trim())),t=t.replace(i[0],n),this.regexp.lastIndex=0}return t}}]),t}();function Qn(t,e){for(var i=t.indexOf(e);-1!==i;)t.splice(i,1),i=t.indexOf(e)}var Zn=function(t){function e(t,i,n){var r,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return mn(this,e),r=_n(this,wn(e).call(this)),Dn&&Sn.call(yn(r)),r.backend=t,r.store=i,r.services=n,r.languageUtils=n.languageUtils,r.options=o,r.logger=zn.create("backendConnector"),r.state={},r.queue=[],r.backend&&r.backend.init&&r.backend.init(n,o.backend,o),r}return kn(e,Sn),bn(e,[{key:"queueLoad",value:function(t,e,i,n){var r=this,o=[],s=[],a=[],l=[];return t.forEach((function(t){var n=!0;e.forEach((function(e){var a="".concat(t,"|").concat(e);!i.reload&&r.store.hasResourceBundle(t,e)?r.state[a]=2:r.state[a]<0||(1===r.state[a]?s.indexOf(a)<0&&s.push(a):(r.state[a]=1,n=!1,s.indexOf(a)<0&&s.push(a),o.indexOf(a)<0&&o.push(a),l.indexOf(e)<0&&l.push(e)))})),n||a.push(t)})),(o.length||s.length)&&this.queue.push({pending:s,loaded:{},errors:[],callback:n}),{toLoad:o,pending:s,toLoadLanguages:a,toLoadNamespaces:l}}},{key:"loaded",value:function(t,e,i){var n=t.split("|"),r=n[0],o=n[1];e&&this.emit("failedLoading",r,o,e),i&&this.store.addResourceBundle(r,o,i),this.state[t]=e?-1:2;var s={};this.queue.forEach((function(i){Hn(i.loaded,[r],o),Qn(i.pending,t),e&&i.errors.push(e),0!==i.pending.length||i.done||(Object.keys(i.loaded).forEach((function(t){s[t]||(s[t]=[]),i.loaded[t].length&&i.loaded[t].forEach((function(e){s[t].indexOf(e)<0&&s[t].push(e)}))})),i.done=!0,i.errors.length?i.callback(i.errors):i.callback())})),this.emit("loaded",s),this.queue=this.queue.filter((function(t){return!t.done}))}},{key:"read",value:function(t,e,i){var n=this,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:350,s=arguments.length>5?arguments[5]:void 0;return t.length?this.backend[i](t,e,(function(a,l){a&&l&&r<5?setTimeout((function(){n.read.call(n,t,e,i,r+1,2*o,s)}),o):s(a,l)})):s(null,{})}},{key:"prepareLoading",value:function(t,e){var i=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();"string"==typeof t&&(t=this.languageUtils.toResolveHierarchy(t)),"string"==typeof e&&(e=[e]);var o=this.queueLoad(t,e,n,r);if(!o.toLoad.length)return o.pending.length||r(),null;o.toLoad.forEach((function(t){i.loadOne(t)}))}},{key:"load",value:function(t,e,i){this.prepareLoading(t,e,{},i)}},{key:"reload",value:function(t,e,i){this.prepareLoading(t,e,{reload:!0},i)}},{key:"loadOne",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=t.split("|"),r=n[0],o=n[1];this.read(r,o,"read",void 0,void 0,(function(n,s){n&&e.logger.warn("".concat(i,"loading namespace ").concat(o," for language ").concat(r," failed"),n),!n&&s&&e.logger.log("".concat(i,"loaded namespace ").concat(o," for language ").concat(r),s),e.loaded(t,n,s)}))}},{key:"saveMissing",value:function(t,e,i,n,r){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(e)?this.logger.warn('did not save key "'.concat(i,'" as the namespace "').concat(e,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"):null!=i&&""!==i&&(this.backend&&this.backend.create&&this.backend.create(t,e,i,n,null,fn({},o,{isUpdate:r})),t&&t[0]&&this.store.addResource(t[0],e,i,n))}}]),e}();function Jn(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,whitelist:!1,nonExplicitWhitelist:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(t){var e={};if("object"===un(t[1])&&(e=t[1]),"string"==typeof t[1]&&(e.defaultValue=t[1]),"string"==typeof t[2]&&(e.tDescription=t[2]),"object"===un(t[2])||"object"===un(t[3])){var i=t[3]||t[2];Object.keys(i).forEach((function(t){e[t]=i[t]}))}return e},interpolation:{escapeValue:!0,format:function(t,e,i,n){return t},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!1}}}function tr(t){return"string"==typeof t.ns&&(t.ns=[t.ns]),"string"==typeof t.fallbackLng&&(t.fallbackLng=[t.fallbackLng]),"string"==typeof t.fallbackNS&&(t.fallbackNS=[t.fallbackNS]),t.whitelist&&(t.whitelist&&t.whitelist.indexOf("cimode")<0&&(t.whitelist=t.whitelist.concat(["cimode"])),t.supportedLngs=t.whitelist),t.nonExplicitWhitelist&&(t.nonExplicitSupportedLngs=t.nonExplicitWhitelist),t.supportedLngs&&t.supportedLngs.indexOf("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t}function er(){}var ir=new(function(t){function e(){var t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(mn(this,e),t=_n(this,wn(e).call(this)),Dn&&Sn.call(yn(t)),t.options=tr(i),t.services={},t.logger=zn,t.modules={external:[]},n&&!t.isInitialized&&!i.isClone){if(!t.options.initImmediate)return t.init(i,n),_n(t,yn(t));setTimeout((function(){t.init(i,n)}),0)}return t}return kn(e,Sn),bn(e,[{key:"init",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;function n(t){return t?"function"==typeof t?new t:t:null}if("function"==typeof e&&(i=e,e={}),e.whitelist&&!e.supportedLngs&&this.logger.deprecate("whitelist",'option "whitelist" will be renamed to "supportedLngs" in the next major - please make sure to rename this option asap.'),e.nonExplicitWhitelist&&!e.nonExplicitSupportedLngs&&this.logger.deprecate("whitelist",'options "nonExplicitWhitelist" will be renamed to "nonExplicitSupportedLngs" in the next major - please make sure to rename this option asap.'),this.options=fn({},Jn(),this.options,tr(e)),this.format=this.options.interpolation.format,i||(i=er),!this.options.isClone){this.modules.logger?zn.init(n(this.modules.logger),this.options):zn.init(null,this.options);var r=new Un(this.options);this.store=new Nn(this.options.resources,this.options);var o=this.services;o.logger=zn,o.resourceStore=this.store,o.languageUtils=r,o.pluralResolver=new Xn(r,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),o.interpolator=new Kn(this.options),o.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},o.backendConnector=new Zn(n(this.modules.backend),o.resourceStore,o,this.options),o.backendConnector.on("*",(function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];t.emit.apply(t,[e].concat(n))})),this.modules.languageDetector&&(o.languageDetector=n(this.modules.languageDetector),o.languageDetector.init(o,this.options.detection,this.options)),this.modules.i18nFormat&&(o.i18nFormat=n(this.modules.i18nFormat),o.i18nFormat.init&&o.i18nFormat.init(this)),this.translator=new jn(this.services,this.options),this.translator.on("*",(function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];t.emit.apply(t,[e].concat(n))})),this.modules.external.forEach((function(e){e.init&&e.init(t)}))}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach((function(e){t[e]=function(){var i;return(i=t.store)[e].apply(i,arguments)}})),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((function(e){t[e]=function(){var i;return(i=t.store)[e].apply(i,arguments),t}}));var s=Cn(),a=function(){t.changeLanguage(t.options.lng,(function(e,n){t.isInitialized=!0,t.options.isClone||t.logger.log("initialized",t.options),t.emit("initialized",t.options),s.resolve(n),i(e,n)}))};return this.options.resources||!this.options.initImmediate?a():setTimeout(a,0),s}},{key:"loadResources",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:er,n="string"==typeof t?t:this.language;if("function"==typeof t&&(i=t),!this.options.resources||this.options.partialBundledLanguages){if(n&&"cimode"===n.toLowerCase())return i();var r=[],o=function(t){t&&e.services.languageUtils.toResolveHierarchy(t).forEach((function(t){r.indexOf(t)<0&&r.push(t)}))};if(n)o(n);else this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((function(t){return o(t)}));this.options.preload&&this.options.preload.forEach((function(t){return o(t)})),this.services.backendConnector.load(r,this.options.ns,i)}else i(null)}},{key:"reloadResources",value:function(t,e,i){var n=Cn();return t||(t=this.languages),e||(e=this.options.ns),i||(i=er),this.services.backendConnector.reload(t,e,(function(t){n.resolve(),i(t)})),n}},{key:"use",value:function(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===t.type&&(this.modules.backend=t),("logger"===t.type||t.log&&t.warn&&t.error)&&(this.modules.logger=t),"languageDetector"===t.type&&(this.modules.languageDetector=t),"i18nFormat"===t.type&&(this.modules.i18nFormat=t),"postProcessor"===t.type&&Fn.addPostProcessor(t),"3rdParty"===t.type&&this.modules.external.push(t),this}},{key:"changeLanguage",value:function(t,e){var i=this;this.isLanguageChangingTo=t;var n=Cn();this.emit("languageChanging",t);var r=function(t,r){r?(i.language=r,i.languages=i.services.languageUtils.toResolveHierarchy(r),i.translator.changeLanguage(r),i.isLanguageChangingTo=void 0,i.emit("languageChanged",r),i.logger.log("languageChanged",r)):i.isLanguageChangingTo=void 0,n.resolve((function(){return i.t.apply(i,arguments)})),e&&e(t,(function(){return i.t.apply(i,arguments)}))},o=function(t){var e="string"==typeof t?t:i.services.languageUtils.getBestMatchFromCodes(t);e&&(i.language||(i.language=e,i.languages=i.services.languageUtils.toResolveHierarchy(e)),i.translator.language||i.translator.changeLanguage(e),i.services.languageDetector&&i.services.languageDetector.cacheUserLanguage(e)),i.loadResources(e,(function(t){r(t,e)}))};return t||!this.services.languageDetector||this.services.languageDetector.async?!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(o):o(t):o(this.services.languageDetector.detect()),n}},{key:"getFixedT",value:function(t,e){var i=this,n=function t(e,n){var r;if("object"!==un(n)){for(var o=arguments.length,s=new Array(o>2?o-2:0),a=2;a<o;a++)s[a-2]=arguments[a];r=i.options.overloadTranslationOptionHandler([e,n].concat(s))}else r=fn({},n);return r.lng=r.lng||t.lng,r.lngs=r.lngs||t.lngs,r.ns=r.ns||t.ns,i.t(e,r)};return"string"==typeof t?n.lng=t:n.lngs=t,n.ns=e,n}},{key:"t",value:function(){var t;return this.translator&&(t=this.translator).translate.apply(t,arguments)}},{key:"exists",value:function(){var t;return this.translator&&(t=this.translator).exists.apply(t,arguments)}},{key:"setDefaultNamespace",value:function(t){this.options.defaultNS=t}},{key:"hasLoadedNamespace",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var n=this.languages[0],r=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;var s=function(t,i){var n=e.services.backendConnector.state["".concat(t,"|").concat(i)];return-1===n||2===n};if(i.precheck){var a=i.precheck(this,s);if(void 0!==a)return a}return!!this.hasResourceBundle(n,t)||(!this.services.backendConnector.backend||!(!s(n,t)||r&&!s(o,t)))}},{key:"loadNamespaces",value:function(t,e){var i=this,n=Cn();return this.options.ns?("string"==typeof t&&(t=[t]),t.forEach((function(t){i.options.ns.indexOf(t)<0&&i.options.ns.push(t)})),this.loadResources((function(t){n.resolve(),e&&e(t)})),n):(e&&e(),Promise.resolve())}},{key:"loadLanguages",value:function(t,e){var i=Cn();"string"==typeof t&&(t=[t]);var n=this.options.preload||[],r=t.filter((function(t){return n.indexOf(t)<0}));return r.length?(this.options.preload=n.concat(r),this.loadResources((function(t){i.resolve(),e&&e(t)})),i):(e&&e(),Promise.resolve())}},{key:"dir",value:function(t){return t||(t=this.languages&&this.languages.length>0?this.languages[0]:this.language),t?["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam"].indexOf(this.services.languageUtils.getLanguagePartFromCode(t))>=0?"rtl":"ltr":"rtl"}},{key:"createInstance",value:function(){return new e(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}},{key:"cloneInstance",value:function(){var t=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:er,r=fn({},this.options,i,{isClone:!0}),o=new e(r);return["store","services","language"].forEach((function(e){o[e]=t[e]})),o.services=fn({},this.services),o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o.translator=new jn(o.services,o.options),o.translator.on("*",(function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];o.emit.apply(o,[t].concat(i))})),o.init(r,n),o.translator.options=o.options,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}}]),e}());function nr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function rr(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function or(t,e,i){return e&&rr(t.prototype,e),i&&rr(t,i),t}var sr=[],ar=sr.forEach,lr=sr.slice;function cr(t){return ar.call(lr.call(arguments,1),(function(e){if(e)for(var i in e)void 0===t[i]&&(t[i]=e[i])})),t}var hr=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,dr=function(t,e,i){var n=i||{};n.path=n.path||"/";var r=t+"="+encodeURIComponent(e);if(n.maxAge>0){var o=n.maxAge-0;if(isNaN(o))throw new Error("maxAge should be a Number");r+="; Max-Age="+Math.floor(o)}if(n.domain){if(!hr.test(n.domain))throw new TypeError("option domain is invalid");r+="; Domain="+n.domain}if(n.path){if(!hr.test(n.path))throw new TypeError("option path is invalid");r+="; Path="+n.path}if(n.expires){if("function"!=typeof n.expires.toUTCString)throw new TypeError("option expires is invalid");r+="; Expires="+n.expires.toUTCString()}if(n.httpOnly&&(r+="; HttpOnly"),n.secure&&(r+="; Secure"),n.sameSite)switch("string"==typeof n.sameSite?n.sameSite.toLowerCase():n.sameSite){case!0:r+="; SameSite=Strict";break;case"lax":r+="; SameSite=Lax";break;case"strict":r+="; SameSite=Strict";break;case"none":r+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return r},pr={create:function(t,e,i,n){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{path:"/",sameSite:"strict"};i&&(r.expires=new Date,r.expires.setTime(r.expires.getTime()+60*i*1e3)),n&&(r.domain=n),document.cookie=dr(t,encodeURIComponent(e),r)},read:function(t){for(var e=t+"=",i=document.cookie.split(";"),n=0;n<i.length;n++){for(var r=i[n];" "===r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(e))return r.substring(e.length,r.length)}return null},remove:function(t){this.create(t,"",-1)}},ur={name:"cookie",lookup:function(t){var e;if(t.lookupCookie&&"undefined"!=typeof document){var i=pr.read(t.lookupCookie);i&&(e=i)}return e},cacheUserLanguage:function(t,e){e.lookupCookie&&"undefined"!=typeof document&&pr.create(e.lookupCookie,t,e.cookieMinutes,e.cookieDomain,e.cookieOptions)}},gr={name:"querystring",lookup:function(t){var e;if("undefined"!=typeof window)for(var i=window.location.search.substring(1).split("&"),n=0;n<i.length;n++){var r=i[n].indexOf("=");if(r>0)i[n].substring(0,r)===t.lookupQuerystring&&(e=i[n].substring(r+1))}return e}},fr=null,mr=function(){if(null!==fr)return fr;try{fr="undefined"!==window&&null!==window.localStorage;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch(t){fr=!1}return fr},vr={name:"localStorage",lookup:function(t){var e;if(t.lookupLocalStorage&&mr()){var i=window.localStorage.getItem(t.lookupLocalStorage);i&&(e=i)}return e},cacheUserLanguage:function(t,e){e.lookupLocalStorage&&mr()&&window.localStorage.setItem(e.lookupLocalStorage,t)}},br=null,yr=function(){if(null!==br)return br;try{br="undefined"!==window&&null!==window.sessionStorage;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch(t){br=!1}return br},_r={name:"sessionStorage",lookup:function(t){var e;if(t.lookupSessionStorage&&yr()){var i=window.sessionStorage.getItem(t.lookupSessionStorage);i&&(e=i)}return e},cacheUserLanguage:function(t,e){e.lookupSessionStorage&&yr()&&window.sessionStorage.setItem(e.lookupSessionStorage,t)}},wr={name:"navigator",lookup:function(t){var e=[];if("undefined"!=typeof navigator){if(navigator.languages)for(var i=0;i<navigator.languages.length;i++)e.push(navigator.languages[i]);navigator.userLanguage&&e.push(navigator.userLanguage),navigator.language&&e.push(navigator.language)}return e.length>0?e:void 0}},xr={name:"htmlTag",lookup:function(t){var e,i=t.htmlTag||("undefined"!=typeof document?document.documentElement:null);return i&&"function"==typeof i.getAttribute&&(e=i.getAttribute("lang")),e}},kr={name:"path",lookup:function(t){var e;if("undefined"!=typeof window){var i=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(i instanceof Array)if("number"==typeof t.lookupFromPathIndex){if("string"!=typeof i[t.lookupFromPathIndex])return;e=i[t.lookupFromPathIndex].replace("/","")}else e=i[0].replace("/","")}return e}},Ar={name:"subdomain",lookup:function(t){var e;if("undefined"!=typeof window){var i=window.location.href.match(/(?:http[s]*\:\/\/)*(.*?)\.(?=[^\/]*\..{2,5})/gi);i instanceof Array&&(e="number"==typeof t.lookupFromSubdomainIndex?i[t.lookupFromSubdomainIndex].replace("http://","").replace("https://","").replace(".",""):i[0].replace("http://","").replace("https://","").replace(".",""))}return e}};function zr(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var Sr=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};nr(this,t),this.type="languageDetector",this.detectors={},this.init(e,i)}return or(t,[{key:"init",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.services=t,this.options=cr(e,this.options||{},zr()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(ur),this.addDetector(gr),this.addDetector(vr),this.addDetector(_r),this.addDetector(wr),this.addDetector(xr),this.addDetector(kr),this.addDetector(Ar)}},{key:"addDetector",value:function(t){this.detectors[t.name]=t}},{key:"detect",value:function(t){var e=this;t||(t=this.options.order);var i=[];return t.forEach((function(t){if(e.detectors[t]){var n=e.detectors[t].lookup(e.options);n&&"string"==typeof n&&(n=[n]),n&&(i=i.concat(n))}})),this.services.languageUtils.getBestMatchFromCodes?i:i.length>0?i[0]:null}},{key:"cacheUserLanguage",value:function(t,e){var i=this;e||(e=this.options.caches),e&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||e.forEach((function(e){i.detectors[e]&&i.detectors[e].cacheUserLanguage(t,i.options)})))}}]),t}();Sr.type="languageDetector";var Cr=[],Er=Cr.forEach,Mr=Cr.slice;function Lr(t){return Er.call(Mr.call(arguments,1),(function(e){if(e)for(var i in e)void 0===t[i]&&(t[i]=e[i])})),t}function Tr(t,e){if(e&&"object"===un(e)){var i="",n=encodeURIComponent;for(var r in e)i+="&"+n(r)+"="+n(e[r]);if(!i)return t;t=t+(-1!==t.indexOf("?")?"&":"?")+i.slice(1)}return t}function Hr(t,e,i,n,r){n&&"object"===un(n)&&(r||(n._t=new Date),n=Tr("",n).slice(1)),e.queryStringParams&&(t=Tr(t,e.queryStringParams));try{var o;(o=XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("MSXML2.XMLHTTP.3.0")).open(n?"POST":"GET",t,1),e.crossDomain||o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.withCredentials=!!e.withCredentials,n&&o.setRequestHeader("Content-type","application/x-www-form-urlencoded"),o.overrideMimeType&&o.overrideMimeType("application/json");var s=e.customHeaders;if(s="function"==typeof s?s():s)for(var a in s)o.setRequestHeader(a,s[a]);o.onreadystatechange=function(){o.readyState>3&&i&&i(o.responseText,o)},o.send(n)}catch(t){console&&console.log(t)}}function Or(){return{loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"/locales/add/{{lng}}/{{ns}}",allowMultiLoading:!1,parse:JSON.parse,parsePayload:function(t,e,i){return gn({},e,i||"")},crossDomain:!1,ajax:Hr}}var $r=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};mn(this,t),this.init(e,i),this.type="backend"}return bn(t,[{key:"init",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.services=t,this.options=Lr(e,this.options||{},Or())}},{key:"readMulti",value:function(t,e,i){var n=this.options.loadPath;"function"==typeof this.options.loadPath&&(n=this.options.loadPath(t,e));var r=this.services.interpolator.interpolate(n,{lng:t.join("+"),ns:e.join("+")});this.loadUrl(r,i)}},{key:"read",value:function(t,e,i){var n=this.options.loadPath;"function"==typeof this.options.loadPath&&(n=this.options.loadPath([t],[e]));var r=this.services.interpolator.interpolate(n,{lng:t,ns:e});this.loadUrl(r,i)}},{key:"loadUrl",value:function(t,e){var i=this;this.options.ajax(t,this.options,(function(n,r){if(r.status>=500&&r.status<600)return e("failed loading "+t,!0);if(r.status>=400&&r.status<500)return e("failed loading "+t,!1);var o,s;try{o=i.options.parse(n,t)}catch(e){s="failed parsing "+t+" to json"}if(s)return e(s,!1);e(null,o)}))}},{key:"create",value:function(t,e,i,n){var r=this;"string"==typeof t&&(t=[t]);var o=this.options.parsePayload(e,i,n);t.forEach((function(t){var i=r.services.interpolator.interpolate(r.options.addPath,{lng:t,ns:e});r.options.ajax(i,r.options,(function(t,e){}),o)}))}}]),t}();function Vr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ir(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Rr(t,e,i){return e&&Ir(t.prototype,e),i&&Ir(t,i),t}$r.type="backend";var Pr=[],Dr=Pr.forEach,Nr=Pr.slice;function Fr(t){return Dr.call(Nr.call(arguments,1),(function(e){if(e)for(var i in e)void 0===t[i]&&(t[i]=e[i])})),t}function Br(t){return t?"function"==typeof t?new t:t:null}function jr(){return{}}var qr=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Vr(this,t),this.backends=[],this.type="backend",this.init(e,i)}return Rr(t,[{key:"init",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;this.services=t,this.options=Fr(i,this.options||{},jr()),this.options.backends&&this.options.backends.forEach((function(i,r){e.backends[r]=e.backends[r]||Br(i),e.backends[r].init(t,e.options.backendOptions[r],n)}))}},{key:"read",value:function(t,e,i){var n=this,r=this.backends.length,o=function o(a){if(a>=r)return i(new Error("non of the backend loaded data;",!0));var l=n.backends[a];l.read?l.read(t,e,(function(t,e){!t&&e&&Object.keys(e).length>-1?(i(null,e,a),s(a-1,e)):o(a+1)})):o(a+1)},s=function i(r,o){if(!(r<0)){var s=n.backends[r];s.save?(s.save(t,e,o),i(r-1,o)):i(r-1,o)}};o(0)}},{key:"create",value:function(t,e,i,n){this.backends.forEach((function(r){r.create&&r.create(t,e,i,n)}))}}]),t}();let Ur;qr.type="backend";class Wr extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{appRoot:{type:String,attribute:"app-root"},template:{type:String},endpoint:{type:String,reflect:!0},apiVersion:{type:String,attribute:"api-version",reflect:!0},locales:{type:String},localeFallbackNs:{type:String,attribute:"locale-fallback-ns"},language:{type:String},requireLanguage:{type:Boolean,attribute:"require-language"},unresolved:{type:Boolean,reflect:!0}})}constructor(){super(),this.unresolved=!0,this.endpoint=".",this.apiVersion=void 0,this.requireLanguage=!1,this._localeFallbacks=[],this._i18nInstance=null,Ur?this.disabled=!0:(Ur=this,D())}set localeFallbackNs(t){t.split(/\s+/).forEach(t=>this._localeFallbacks.push(t))}disconnectedCallback(){super.disconnectedCallback(),this._i18nInstance=null,Ur===this&&(Ur=null)}async connectedCallback(){if(super.connectedCallback(),this.disabled)return;this.endpoint=this.endpoint.replace(/\/+$/,""),this.locales&&-1===this._localeFallbacks.indexOf("app")&&this._localeFallbacks.push("app"),this._localeFallbacks.push("common");const t=this.getParameter("_target");t&&(this.endpoint=t);const e=this.getParameter("_api");if(e&&(this.apiVersion=e),!this.apiVersion){const t=await fetch(this.endpoint+"/login").then(t=>t.ok?null:fetch(this.endpoint+"/api/version").then(t=>t.json())).catch(t=>{if(404===t.response.status)return fetch(this.endpoint+"/api/version").then(t=>t.json())});t?(this.apiVersion=t.api,console.log(`<pb-page> Server reports API version ${this.apiVersion} with app ${t.app.name}/${t.app.version} running on ${t.engine.name}/${t.engine.version}`)):(console.log("<pb-page> No API version reported by server, assuming 0.9.0"),this.apiVersion="0.9.0")}this.requireLanguage?this._i18nInstance&&this.signalReady("pb-page-ready",{endpoint:this.endpoint,apiVersion:this.apiVersion,template:this.template,language:this._i18nInstance.language}):this.signalReady("pb-page-ready",{endpoint:this.endpoint,template:this.template,apiVersion:this.apiVersion})}firstUpdated(){if(super.firstUpdated(),this.disabled)return;this.shadowRoot.querySelector("slot").addEventListener("slotchange",()=>{const t=new CustomEvent("pb-page-loaded",{bubbles:!0,composed:!0});this.dispatchEvent(t)},{once:!0});const t=I("../i18n/")+"{{ns}}/{{lng}}.json";console.log("<pb-page> Loading locales. common: %s; additional: %s; namespaces: %o",t,this.locales,this._localeFallbacks);const e=this.locales?[$r,$r]:[$r],i=[{loadPath:t,crossDomain:!0}];this.locales&&i.unshift({loadPath:this.locales,crossDomain:!0});const n={fallbackLng:"en",defaultNS:"common",ns:["common"],debug:!1,load:"languageOnly",detection:{lookupQuerystring:"lang"},backend:{backends:e,backendOptions:i}};if(this.language&&(n.lng=this.language),this._localeFallbacks.length>0){const t=this._localeFallbacks.slice();n.defaultNS=t[0],n.fallbackNS=t.slice(1),n.ns=t}console.log("<pb-page> i18next options: %o",n),this._i18nInstance=ir.createInstance(),this._i18nInstance.use(Sr).use(qr),this._i18nInstance.init(n).then(t=>{B(t),this._updateI18n(t),this.signalReady("pb-i18n-update",{t:t,language:this._i18nInstance.language}),this.requireLanguage&&this.apiVersion&&this.signalReady("pb-page-ready",{endpoint:this.endpoint,apiVersion:this.apiVersion,template:this.template,language:this._i18nInstance.language})}),this.subscribeTo("pb-i18n-language",t=>{const{language:e}=t.detail;this._i18nInstance.changeLanguage(e).then(t=>{this._updateI18n(t),this.emitTo("pb-i18n-update",{t:t,language:this._i18nInstance.language},[])},[])}),this.subscribeTo("pb-toggle",this._toggleFeatures.bind(this)),this.unresolved=!1,console.log("<pb-page> endpoint: %s; trigger window resize",this.endpoint),this.querySelectorAll("app-header").forEach(t=>t._notifyLayoutChanged()),an(this)}_updateI18n(t){this.querySelectorAll("[data-i18n]").forEach(e=>{const i=e.getAttribute("data-i18n"),n=/(?:\[([^\]]+)\])?([^;]+)/g;let r=n.exec(i);for(;r;){const o=t(r[2]);r[1]?e.setAttribute(r[1],o):e.innerHTML=o,r=n.exec(i)}})}_toggleFeatures(t){t.detail.selectors&&t.detail.selectors.forEach(t=>{this.querySelectorAll(t.selector).forEach(e=>{const i=t.command||"toggle";e.command&&e.command(i,t.state),t.state?e.classList.add(i):e.classList.remove(i)})})}render(){return O`<slot></slot>`}static get styles(){return V`
|
|
717
717
|
:host {
|
|
718
718
|
display: block;
|
|
719
719
|
}
|
|
720
|
-
`}}customElements.define("pb-page",Wr);class Yr extends(
|
|
720
|
+
`}}customElements.define("pb-page",Wr);class Yr extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{total:{type:Number,reflect:!0},start:{type:Number,reflect:!0},perPage:{type:Number,attribute:"per-page"},foundLabel:{type:String,attribute:"found-label"},page:{type:Number},pageCount:{type:Number,attribute:"page-count"},range:{type:Number},pages:{type:Array}})}constructor(){super(),this.total=0,this.start=1,this.perPage=10,this.page=1,this.pageCount=10,this.range=5,this.pages=[],this.foundLabel="browse.items"}connectedCallback(){super.connectedCallback(),this.subscribeTo("pb-results-received",this._refresh.bind(this))}render(){return O`
|
|
721
721
|
<span @click="${this._handleFirst}"><iron-icon icon="first-page"></iron-icon></span>
|
|
722
|
-
${this.pages.map((t,e)=>
|
|
722
|
+
${this.pages.map((t,e)=>O`<span class="${t.class}" @click="${()=>this._handleClick(t,e)}">${t.label}</span>`)}
|
|
723
723
|
<span @click="${this._handleLast}"><iron-icon icon="last-page"></iron-icon></span>
|
|
724
724
|
|
|
725
|
-
<span class="found">${
|
|
726
|
-
`}static get styles(){return
|
|
725
|
+
<span class="found">${F(this.foundLabel,{count:this.total})}</span>
|
|
726
|
+
`}static get styles(){return V`
|
|
727
727
|
:host([total="0"]) {
|
|
728
728
|
display: none;
|
|
729
729
|
}
|
|
@@ -932,9 +932,9 @@ e({_template:n`
|
|
|
932
932
|
<div id="secondaryProgress" hidden\$="[[_hideSecondaryProgress(secondaryRatio)]]"></div>
|
|
933
933
|
<div id="primaryProgress"></div>
|
|
934
934
|
</div>
|
|
935
|
-
`,is:"paper-progress",behaviors:[{properties:{value:{type:Number,value:0,notify:!0,reflectToAttribute:!0},min:{type:Number,value:0,notify:!0},max:{type:Number,value:100,notify:!0},step:{type:Number,value:1,notify:!0},ratio:{type:Number,value:0,readOnly:!0,notify:!0}},observers:["_update(value, min, max, step)"],_calcRatio:function(t){return(this._clampValue(t)-this.min)/(this.max-this.min)},_clampValue:function(t){return Math.min(this.max,Math.max(this.min,this._calcStep(t)))},_calcStep:function(t){if(t=parseFloat(t),!this.step)return t;var e=Math.round((t-this.min)/this.step);return this.step<1?e/(1/this.step)+this.min:e*this.step+this.min},_validateValue:function(){var t=this._clampValue(this.value);return this.value=this.oldValue=isNaN(t)?this.oldValue:t,this.value!==t},_update:function(){this._validateValue(),this._setRatio(100*this._calcRatio(this.value))}}],properties:{secondaryProgress:{type:Number,value:0},secondaryRatio:{type:Number,value:0,readOnly:!0},indeterminate:{type:Boolean,value:!1,observer:"_toggleIndeterminate"},disabled:{type:Boolean,value:!1,reflectToAttribute:!0,observer:"_disabledChanged"}},observers:["_progressChanged(secondaryProgress, value, min, max, indeterminate)"],hostAttributes:{role:"progressbar"},_toggleIndeterminate:function(t){this.toggleClass("indeterminate",t,this.$.primaryProgress)},_transformProgress:function(t,e){var i="scaleX("+e/100+")";t.style.transform=t.style.webkitTransform=i},_mainRatioChanged:function(t){this._transformProgress(this.$.primaryProgress,t)},_progressChanged:function(t,e,i,n,r){t=this._clampValue(t),e=this._clampValue(e);var o=100*this._calcRatio(t),s=100*this._calcRatio(e);this._setSecondaryRatio(o),this._transformProgress(this.$.secondaryProgress,o),this._transformProgress(this.$.primaryProgress,s),this.secondaryProgress=t,r?this.removeAttribute("aria-valuenow"):this.setAttribute("aria-valuenow",e),this.setAttribute("aria-valuemin",i),this.setAttribute("aria-valuemax",n)},_disabledChanged:function(t){this.setAttribute("aria-disabled",t?"true":"false")},_hideSecondaryProgress:function(t){return 0===t}});class Gr extends(
|
|
935
|
+
`,is:"paper-progress",behaviors:[{properties:{value:{type:Number,value:0,notify:!0,reflectToAttribute:!0},min:{type:Number,value:0,notify:!0},max:{type:Number,value:100,notify:!0},step:{type:Number,value:1,notify:!0},ratio:{type:Number,value:0,readOnly:!0,notify:!0}},observers:["_update(value, min, max, step)"],_calcRatio:function(t){return(this._clampValue(t)-this.min)/(this.max-this.min)},_clampValue:function(t){return Math.min(this.max,Math.max(this.min,this._calcStep(t)))},_calcStep:function(t){if(t=parseFloat(t),!this.step)return t;var e=Math.round((t-this.min)/this.step);return this.step<1?e/(1/this.step)+this.min:e*this.step+this.min},_validateValue:function(){var t=this._clampValue(this.value);return this.value=this.oldValue=isNaN(t)?this.oldValue:t,this.value!==t},_update:function(){this._validateValue(),this._setRatio(100*this._calcRatio(this.value))}}],properties:{secondaryProgress:{type:Number,value:0},secondaryRatio:{type:Number,value:0,readOnly:!0},indeterminate:{type:Boolean,value:!1,observer:"_toggleIndeterminate"},disabled:{type:Boolean,value:!1,reflectToAttribute:!0,observer:"_disabledChanged"}},observers:["_progressChanged(secondaryProgress, value, min, max, indeterminate)"],hostAttributes:{role:"progressbar"},_toggleIndeterminate:function(t){this.toggleClass("indeterminate",t,this.$.primaryProgress)},_transformProgress:function(t,e){var i="scaleX("+e/100+")";t.style.transform=t.style.webkitTransform=i},_mainRatioChanged:function(t){this._transformProgress(this.$.primaryProgress,t)},_progressChanged:function(t,e,i,n,r){t=this._clampValue(t),e=this._clampValue(e);var o=100*this._calcRatio(t),s=100*this._calcRatio(e);this._setSecondaryRatio(o),this._transformProgress(this.$.secondaryProgress,o),this._transformProgress(this.$.primaryProgress,s),this.secondaryProgress=t,r?this.removeAttribute("aria-valuenow"):this.setAttribute("aria-valuenow",e),this.setAttribute("aria-valuemin",i),this.setAttribute("aria-valuemax",n)},_disabledChanged:function(t){this.setAttribute("aria-disabled",t?"true":"false")},_hideSecondaryProgress:function(t){return 0===t}});class Gr extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{_disabled:{type:Boolean}})}constructor(){super(),this._disabled=!0}connectedCallback(){super.connectedCallback(),this.subscribeTo("pb-start-update",this._startUpdate.bind(this)),this.subscribeTo("pb-end-update",this._endUpdate.bind(this))}render(){return this.style.visibility=this._disabled?"hidden":"visible",O`
|
|
936
936
|
<paper-progress id="progress" indeterminate ?disabled="${this._disabled}"></paper-progress>
|
|
937
|
-
`}static get styles(){return
|
|
937
|
+
`}static get styles(){return V`
|
|
938
938
|
:host {
|
|
939
939
|
display: block;
|
|
940
940
|
visibility: hidden;
|
|
@@ -943,7 +943,7 @@ e({_template:n`
|
|
|
943
943
|
paper-progress {
|
|
944
944
|
width: 100%;
|
|
945
945
|
}
|
|
946
|
-
`}_startUpdate(){this._disabled=!1}_endUpdate(){this._disabled=!0}}customElements.define("pb-progress",Gr);class Xr extends(
|
|
946
|
+
`}_startUpdate(){this._disabled=!1}_endUpdate(){this._disabled=!0}}customElements.define("pb-progress",Gr);class Xr extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{action:{type:String},value:{type:String},placeHolder:{type:String,attribute:"place-holder"},redirect:{type:Boolean},currentDoc:{type:String,attribute:"current-doc"},submitOnLoad:{type:Boolean,attribute:"submit-on-load"},subforms:{type:String},disableAutocomplete:{type:Boolean,attribute:"disable-autocomplete"}})}constructor(){super(),this.value="",this.redirect=!1,this.submitOnLoad=!1,this.placeHolder="search.placeholder",this.disableAutocomplete=!1}connectedCallback(){super.connectedCallback(),this.subscribeTo("pb-search-resubmit",this._doSearch.bind(this))}firstUpdated(){if(!this.disableAutocomplete){this.shadowRoot.getElementById("autocomplete").addEventListener("autocomplete-change",this._autocomplete.bind(this))}if(this.shadowRoot.getElementById("ironform").addEventListener("iron-form-response",t=>t.detail.completes.then(t=>this.emitTo("pb-search",t.parseResponse()))),Xr.waitOnce("pb-page-ready",t=>{const e=this.shadowRoot.getElementById("autocompleteLoader");this.minApiVersion("1.0.0")?e.url=t.endpoint+"/api/search/autocomplete":e.url=t.endpoint+"/modules/autocomplete.xql"}),this.submitOnLoad){const t=this.getParameters();this.emitTo("pb-load",{url:this.action,params:t})}this.addEventListener("click",t=>{const e=t.target.closest("[slot]");e&&("searchButton"===e.slot&&this._doSearch(),"resetButton"===e.slot&&this._reset())})}render(){return O`
|
|
947
947
|
<custom-style>
|
|
948
948
|
<style>
|
|
949
949
|
:host {
|
|
@@ -959,7 +959,7 @@ e({_template:n`
|
|
|
959
959
|
<iron-form id="ironform" allow-redirect="${this.redirect}">
|
|
960
960
|
<form id="searchPageForm" method="get" action="${this.action}" accept="text/html">
|
|
961
961
|
<slot name="beforeInput"></slot>
|
|
962
|
-
<paper-input id="search" type="search" name="query" @keyup="${this._handleEnter}" label="${
|
|
962
|
+
<paper-input id="search" type="search" name="query" @keyup="${this._handleEnter}" label="${F(this.placeHolder)}"
|
|
963
963
|
value="${this.value}" always-float-label>
|
|
964
964
|
<iron-icon icon="search" @click="${this._doSearch}" slot="prefix"></iron-icon>
|
|
965
965
|
</paper-input>
|
|
@@ -978,7 +978,7 @@ e({_template:n`
|
|
|
978
978
|
method="get"
|
|
979
979
|
with-credentials
|
|
980
980
|
@response="${this._updateSuggestions}"></iron-ajax>
|
|
981
|
-
`}static get styles(){return
|
|
981
|
+
`}static get styles(){return V`
|
|
982
982
|
:host {
|
|
983
983
|
--paper-input-container-color: var(--pb-search-label-color, var(--paper-grey-500, #303030));
|
|
984
984
|
--paper-input-container-input-color: var(--pb-search-input-color, var(--pb-color-primary, #000000));
|
|
@@ -991,7 +991,7 @@ e({_template:n`
|
|
|
991
991
|
.buttons{
|
|
992
992
|
margin-top:1rem;
|
|
993
993
|
}
|
|
994
|
-
`}_doSearch(){let t=this.shadowRoot.getElementById("ironform").serializeForm();t=this._paramsFromSubforms(t),this.redirect?window.location.href=`${this.action}?${new URLSearchParams(t)}`:(this.setParameters(t),this.pushHistory("search"),t.start=1,this.emitTo("pb-load",{url:this.action,params:t}))}_paramsFromSubforms(t){return this.subforms&&document.querySelectorAll(this.subforms).forEach(e=>{e.serializeForm&&Object.assign(t,e.serializeForm())}),t}_handleEnter(t){13===t.keyCode&&this._doSearch()}_doSubmit(){this.shadowRoot.getElementById("ironform").submit()}_reset(){this.shadowRoot.getElementById("ironform").reset()}_autocomplete(t){const e=this.shadowRoot.getElementById("ironform").serializeForm(),i=this.shadowRoot.getElementById("autocompleteLoader");i.params=e,i.generateRequest()}_updateSuggestions(){const t=this.shadowRoot.getElementById("autocomplete"),e=this.shadowRoot.getElementById("autocompleteLoader");e.lastResponse&&t.suggestions(e.lastResponse)}}customElements.define("pb-search",Xr);class Kr extends(
|
|
994
|
+
`}_doSearch(){let t=this.shadowRoot.getElementById("ironform").serializeForm();t=this._paramsFromSubforms(t),this.redirect?window.location.href=`${this.action}?${new URLSearchParams(t)}`:(this.setParameters(t),this.pushHistory("search"),t.start=1,this.emitTo("pb-load",{url:this.action,params:t}))}_paramsFromSubforms(t){return this.subforms&&document.querySelectorAll(this.subforms).forEach(e=>{e.serializeForm&&Object.assign(t,e.serializeForm())}),t}_handleEnter(t){13===t.keyCode&&this._doSearch()}_doSubmit(){this.shadowRoot.getElementById("ironform").submit()}_reset(){this.shadowRoot.getElementById("ironform").reset()}_autocomplete(t){const e=this.shadowRoot.getElementById("ironform").serializeForm(),i=this.shadowRoot.getElementById("autocompleteLoader");i.params=e,i.generateRequest()}_updateSuggestions(){const t=this.shadowRoot.getElementById("autocomplete"),e=this.shadowRoot.getElementById("autocompleteLoader");e.lastResponse&&t.suggestions(e.lastResponse)}}customElements.define("pb-search",Xr);class Kr extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{name:{type:String},selector:{type:String},action:{type:String},on:{type:String},off:{type:String},default:{type:String},propertiesOn:{type:Object,attribute:"properties-on"},propertiesOff:{type:Object,attribute:"properties-off"},checked:{type:Boolean},initFromView:{type:Boolean,attribute:"init-from-view"}})}constructor(){super(),this.default="on",this.action="toggle",this.propertiesOn={},this.propertiesOff={},this.initFromView=!1}render(){return O`
|
|
995
995
|
<paper-checkbox id="checkbox" @change="${this._changed}" .checked="${this.checked}" .disabled="${this.disabled}"><slot></slot></paper-checkbox>
|
|
996
996
|
`}connectedCallback(){if(super.connectedCallback(),this.initFromView){const t=this.subscribeTo("pb-update",e=>{"infiniteScroll"===this.name?this.checked=e.detail.infiniteScroll===this.propertiesOn[this.name]:"view"!==this.name&&"odd"!==this.name&&"xpath"!==this.name||(this.checked=e.detail.data[this.name]===this.propertiesOn[this.name]),t.forEach(t=>document.removeEventListener("pb-update",t))});this.waitForChannel(()=>{const t={selectors:[{selector:this.selector,command:this.action,state:this.checked}],properties:{},action:"init"};this.emitTo("pb-toggle",t),this.signalReady()})}else{const t=this.getParameter(this.name);this.checked=void 0!==t?"on"===t:"on"===this.default,this.waitForChannel(()=>{const t={selectors:[{selector:this.selector,command:this.action,state:this.checked}],properties:this.checked?this.propertiesOn:this.propertiesOff,action:"init"};this.emitTo("pb-toggle",t),this.signalReady()})}}attributeChangedCallback(t,e,i){switch(super.attributeChangedCallback(t,e,i),t){case"on":this.propertiesOn[this.name]=i;break;case"off":this.propertiesOff[this.name]=i}}_changed(){this.checked=this.shadowRoot.getElementById("checkbox").checked,this.name&&(this.setParameter(this.name,this.checked?"on":"off"),this.pushHistory("toggle feature "+this.name));const t={selectors:[{selector:this.selector,command:this.action,state:this.checked}],properties:this.checked?this.propertiesOn:this.propertiesOff,action:"refresh"};this.emitTo("pb-toggle",t)}}customElements.define("pb-toggle-feature",Kr),
|
|
997
997
|
/**
|
|
@@ -1073,13 +1073,13 @@ e({_template:n`
|
|
|
1073
1073
|
<slot name="item-icon"></slot>
|
|
1074
1074
|
</div>
|
|
1075
1075
|
<slot></slot>
|
|
1076
|
-
`,is:"paper-icon-item",behaviors:[
|
|
1077
|
-
<paper-dropdown-menu id="menu" label="${
|
|
1076
|
+
`,is:"paper-icon-item",behaviors:[E]});class Qr extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{name:{type:String},label:{type:String},selected:{type:Number},items:{type:Array}})}constructor(){super(),this.initializing=!0,this.items=[],this.label="document.selectFeature"}connectedCallback(){super.connectedCallback();const t=this.getParameter(this.name);void 0!==t?this.selected=parseInt(t,10):this.items.length>0&&(this.selected=0),this.waitForChannel(()=>{this.selected&&this.selected<this.items.length&&this._emit("init",this.selected),this.initializing=!1,this.signalReady()})}firstUpdated(){super.firstUpdated(),this.shadowRoot.getElementById("menu").addEventListener("selected-item-changed",this._selectionChanged.bind(this))}_selectionChanged(){const t=this.shadowRoot.getElementById("list").selected;this.setParameter(this.name,t),this.pushHistory("toggle feature "+this.name),console.log("<pb-select-feature> Setting features: %o",this.items[t]),this._emit("refresh",t)}_emit(t,e){const i=this.items[e],n={properties:i.properties||{},selectors:i.selectors,action:t};this.emitTo("pb-toggle",n)}render(){return O`
|
|
1077
|
+
<paper-dropdown-menu id="menu" label="${F(this.label)}" .disabled="${this.disabled}">
|
|
1078
1078
|
<paper-listbox id="list" slot="dropdown-content" selected="${this.selected}">
|
|
1079
|
-
${this.items.map(t=>
|
|
1079
|
+
${this.items.map(t=>O`<paper-item>${t.name}</paper-item>`)}
|
|
1080
1080
|
</paper-listbox>
|
|
1081
1081
|
</paper-dropdown-menu>
|
|
1082
|
-
`}static get styles(){return
|
|
1082
|
+
`}static get styles(){return V`
|
|
1083
1083
|
:host {
|
|
1084
1084
|
display: block;
|
|
1085
1085
|
}
|
|
@@ -1089,7 +1089,7 @@ e({_template:n`
|
|
|
1089
1089
|
min-width: inherit;
|
|
1090
1090
|
max-width: inherit;
|
|
1091
1091
|
}
|
|
1092
|
-
`}}customElements.define("pb-select-feature",Qr);var Zr={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},Jr={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},to=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],eo={CSS:{},springs:{}};function io(t,e,i){return Math.min(Math.max(t,e),i)}function no(t,e){return t.indexOf(e)>-1}function ro(t,e){return t.apply(null,e)}var oo={arr:function(t){return Array.isArray(t)},obj:function(t){return no(Object.prototype.toString.call(t),"Object")},pth:function(t){return oo.obj(t)&&t.hasOwnProperty("totalLength")},svg:function(t){return t instanceof SVGElement},inp:function(t){return t instanceof HTMLInputElement},dom:function(t){return t.nodeType||oo.svg(t)},str:function(t){return"string"==typeof t},fnc:function(t){return"function"==typeof t},und:function(t){return void 0===t},nil:function(t){return oo.und(t)||null===t},hex:function(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)},rgb:function(t){return/^rgb/.test(t)},hsl:function(t){return/^hsl/.test(t)},col:function(t){return oo.hex(t)||oo.rgb(t)||oo.hsl(t)},key:function(t){return!Zr.hasOwnProperty(t)&&!Jr.hasOwnProperty(t)&&"targets"!==t&&"keyframes"!==t}};function so(t){var e=/\(([^)]+)\)/.exec(t);return e?e[1].split(",").map((function(t){return parseFloat(t)})):[]}function ao(t,e){var i=so(t),n=io(oo.und(i[0])?1:i[0],.1,100),r=io(oo.und(i[1])?100:i[1],.1,100),o=io(oo.und(i[2])?10:i[2],.1,100),s=io(oo.und(i[3])?0:i[3],.1,100),a=Math.sqrt(r/n),l=o/(2*Math.sqrt(r*n)),c=l<1?a*Math.sqrt(1-l*l):0,h=1,d=l<1?(l*a-s)/c:-s+a;function p(t){var i=e?e*t/1e3:t;return i=l<1?Math.exp(-i*l*a)*(h*Math.cos(c*i)+d*Math.sin(c*i)):(h+d*i)*Math.exp(-i*a),0===t||1===t?t:1-i}function u(){var e=eo.springs[t];if(e)return e;for(var i=1/6,n=0,r=0;;)if(1===p(n+=i)){if(++r>=16)break}else r=0;var o=n*i*1e3;return eo.springs[t]=o,o}return e?p:u}function lo(t){return void 0===t&&(t=10),function(e){return Math.ceil(io(e,1e-6,1)*t)*(1/t)}}var co,ho,po=function(){var t=11,e=1/(t-1);function i(t,e){return 1-3*e+3*t}function n(t,e){return 3*e-6*t}function r(t){return 3*t}function o(t,e,o){return((i(e,o)*t+n(e,o))*t+r(e))*t}function s(t,e,o){return 3*i(e,o)*t*t+2*n(e,o)*t+r(e)}function a(t,e,i,n,r){var s,a,l=0;do{(s=o(a=e+(i-e)/2,n,r)-t)>0?i=a:e=a}while(Math.abs(s)>1e-7&&++l<10);return a}function l(t,e,i,n){for(var r=0;r<4;++r){var a=s(e,i,n);if(0===a)return e;e-=(o(e,i,n)-t)/a}return e}function c(i,n,r,c){if(0<=i&&i<=1&&0<=r&&r<=1){var h=new Float32Array(t);if(i!==n||r!==c)for(var d=0;d<t;++d)h[d]=o(d*e,i,r);return function(t){return i===n&&r===c||0===t||1===t?t:o(p(t),n,c)}}function p(n){for(var o=0,c=1,d=t-1;c!==d&&h[c]<=n;++c)o+=e;--c;var p=o+(n-h[c])/(h[c+1]-h[c])*e,u=s(p,i,r);return u>=.001?l(n,p,i,r):0===u?p:a(n,o,o+e,i,r)}}return c}(),uo=(co={linear:function(){return function(t){return t}}},ho={Sine:function(){return function(t){return 1-Math.cos(t*Math.PI/2)}},Circ:function(){return function(t){return 1-Math.sqrt(1-t*t)}},Back:function(){return function(t){return t*t*(3*t-2)}},Bounce:function(){return function(t){for(var e,i=4;t<((e=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}},Elastic:function(t,e){void 0===t&&(t=1),void 0===e&&(e=.5);var i=io(t,1,10),n=io(e,.1,2);return function(t){return 0===t||1===t?t:-i*Math.pow(2,10*(t-1))*Math.sin((t-1-n/(2*Math.PI)*Math.asin(1/i))*(2*Math.PI)/n)}}},["Quad","Cubic","Quart","Quint","Expo"].forEach((function(t,e){ho[t]=function(){return function(t){return Math.pow(t,e+2)}}})),Object.keys(ho).forEach((function(t){var e=ho[t];co["easeIn"+t]=e,co["easeOut"+t]=function(t,i){return function(n){return 1-e(t,i)(1-n)}},co["easeInOut"+t]=function(t,i){return function(n){return n<.5?e(t,i)(2*n)/2:1-e(t,i)(-2*n+2)/2}},co["easeOutIn"+t]=function(t,i){return function(n){return n<.5?(1-e(t,i)(1-2*n))/2:(e(t,i)(2*n-1)+1)/2}}})),co);function go(t,e){if(oo.fnc(t))return t;var i=t.split("(")[0],n=uo[i],r=so(t);switch(i){case"spring":return ao(t,e);case"cubicBezier":return ro(po,r);case"steps":return ro(lo,r);default:return ro(n,r)}}function fo(t){try{return document.querySelectorAll(t)}catch(t){return}}function mo(t,e){for(var i=t.length,n=arguments.length>=2?arguments[1]:void 0,r=[],o=0;o<i;o++)if(o in t){var s=t[o];e.call(n,s,o,t)&&r.push(s)}return r}function vo(t){return t.reduce((function(t,e){return t.concat(oo.arr(e)?vo(e):e)}),[])}function bo(t){return oo.arr(t)?t:(oo.str(t)&&(t=fo(t)||t),t instanceof NodeList||t instanceof HTMLCollection?[].slice.call(t):[t])}function yo(t,e){return t.some((function(t){return t===e}))}function _o(t){var e={};for(var i in t)e[i]=t[i];return e}function wo(t,e){var i=_o(t);for(var n in t)i[n]=e.hasOwnProperty(n)?e[n]:t[n];return i}function xo(t,e){var i=_o(t);for(var n in e)i[n]=oo.und(t[n])?e[n]:t[n];return i}function ko(t){var e=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(t);return e?"rgba("+e[1]+",1)":t}function Ao(t){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,i=t.replace(e,(function(t,e,i,n){return e+e+i+i+n+n})),n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i);return"rgba("+parseInt(n[1],16)+","+parseInt(n[2],16)+","+parseInt(n[3],16)+",1)"}function zo(t){var e,i,n,r=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(t),o=parseInt(r[1],10)/360,s=parseInt(r[2],10)/100,a=parseInt(r[3],10)/100,l=r[4]||1;function c(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}if(0==s)e=i=n=a;else{var h=a<.5?a*(1+s):a+s-a*s,d=2*a-h;e=c(d,h,o+1/3),i=c(d,h,o),n=c(d,h,o-1/3)}return"rgba("+255*e+","+255*i+","+255*n+","+l+")"}function So(t){return oo.rgb(t)?ko(t):oo.hex(t)?Ao(t):oo.hsl(t)?zo(t):void 0}function Co(t){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(t);if(e)return e[1]}function Eo(t){return no(t,"translate")||"perspective"===t?"px":no(t,"rotate")||no(t,"skew")?"deg":void 0}function Mo(t,e){return oo.fnc(t)?t(e.target,e.id,e.total):t}function Lo(t,e){return t.getAttribute(e)}function To(t,e,i){if(yo([i,"deg","rad","turn"],Co(e)))return e;var n=eo.CSS[e+i];if(!oo.und(n))return n;var r=100,o=document.createElement(t.tagName),s=t.parentNode&&t.parentNode!==document?t.parentNode:document.body;s.appendChild(o),o.style.position="absolute",o.style.width=r+i;var a=r/o.offsetWidth;s.removeChild(o);var l=a*parseFloat(e);return eo.CSS[e+i]=l,l}function Ho(t,e,i){if(e in t.style){var n=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=t.style[e]||getComputedStyle(t).getPropertyValue(n)||"0";return i?To(t,r,i):r}}function Oo(t,e){return oo.dom(t)&&!oo.inp(t)&&(!oo.nil(Lo(t,e))||oo.svg(t)&&t[e])?"attribute":oo.dom(t)&&yo(to,e)?"transform":oo.dom(t)&&"transform"!==e&&Ho(t,e)?"css":null!=t[e]?"object":void 0}function $o(t){if(oo.dom(t)){for(var e,i=t.style.transform||"",n=/(\w+)\(([^)]*)\)/g,r=new Map;e=n.exec(i);)r.set(e[1],e[2]);return r}}function Vo(t,e,i,n){var r=no(e,"scale")?1:0+Eo(e),o=$o(t).get(e)||r;return i&&(i.transforms.list.set(e,o),i.transforms.last=e),n?To(t,o,n):o}function Io(t,e,i,n){switch(Oo(t,e)){case"transform":return Vo(t,e,n,i);case"css":return Ho(t,e,i);case"attribute":return Lo(t,e);default:return t[e]||0}}function Ro(t,e){var i=/^(\*=|\+=|-=)/.exec(t);if(!i)return t;var n=Co(t)||0,r=parseFloat(e),o=parseFloat(t.replace(i[0],""));switch(i[0][0]){case"+":return r+o+n;case"-":return r-o+n;case"*":return r*o+n}}function Po(t,e){if(oo.col(t))return So(t);if(/\s/g.test(t))return t;var i=Co(t),n=i?t.substr(0,t.length-i.length):t;return e?n+e:n}function Do(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function No(t){return 2*Math.PI*Lo(t,"r")}function Fo(t){return 2*Lo(t,"width")+2*Lo(t,"height")}function Bo(t){return Do({x:Lo(t,"x1"),y:Lo(t,"y1")},{x:Lo(t,"x2"),y:Lo(t,"y2")})}function jo(t){for(var e,i=t.points,n=0,r=0;r<i.numberOfItems;r++){var o=i.getItem(r);r>0&&(n+=Do(e,o)),e=o}return n}function qo(t){var e=t.points;return jo(t)+Do(e.getItem(e.numberOfItems-1),e.getItem(0))}function Uo(t){if(t.getTotalLength)return t.getTotalLength();switch(t.tagName.toLowerCase()){case"circle":return No(t);case"rect":return Fo(t);case"line":return Bo(t);case"polyline":return jo(t);case"polygon":return qo(t)}}function Wo(t){var e=Uo(t);return t.setAttribute("stroke-dasharray",e),e}function Yo(t){for(var e=t.parentNode;oo.svg(e)&&oo.svg(e.parentNode);)e=e.parentNode;return e}function Go(t,e){var i=e||{},n=i.el||Yo(t),r=n.getBoundingClientRect(),o=Lo(n,"viewBox"),s=r.width,a=r.height,l=i.viewBox||(o?o.split(" "):[0,0,s,a]);return{el:n,viewBox:l,x:l[0]/1,y:l[1]/1,w:s,h:a,vW:l[2],vH:l[3]}}function Xo(t,e){var i=oo.str(t)?fo(t)[0]:t,n=e||100;return function(t){return{property:t,el:i,svg:Go(i),totalLength:Uo(i)*(n/100)}}}function Ko(t,e,i){function n(i){void 0===i&&(i=0);var n=e+i>=1?e+i:0;return t.el.getPointAtLength(n)}var r=Go(t.el,t.svg),o=n(),s=n(-1),a=n(1),l=i?1:r.w/r.vW,c=i?1:r.h/r.vH;switch(t.property){case"x":return(o.x-r.x)*l;case"y":return(o.y-r.y)*c;case"angle":return 180*Math.atan2(a.y-s.y,a.x-s.x)/Math.PI}}function Qo(t,e){var i=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,n=Po(oo.pth(t)?t.totalLength:t,e)+"";return{original:n,numbers:n.match(i)?n.match(i).map(Number):[0],strings:oo.str(t)||e?n.split(i):[]}}function Zo(t){return mo(t?vo(oo.arr(t)?t.map(bo):bo(t)):[],(function(t,e,i){return i.indexOf(t)===e}))}function Jo(t){var e=Zo(t);return e.map((function(t,i){return{target:t,id:i,total:e.length,transforms:{list:$o(t)}}}))}function ts(t,e){var i=_o(e);if(/^spring/.test(i.easing)&&(i.duration=ao(i.easing)),oo.arr(t)){var n=t.length;2===n&&!oo.obj(t[0])?t={value:t}:oo.fnc(e.duration)||(i.duration=e.duration/n)}var r=oo.arr(t)?t:[t];return r.map((function(t,i){var n=oo.obj(t)&&!oo.pth(t)?t:{value:t};return oo.und(n.delay)&&(n.delay=i?0:e.delay),oo.und(n.endDelay)&&(n.endDelay=i===r.length-1?e.endDelay:0),n})).map((function(t){return xo(t,i)}))}function es(t){for(var e=mo(vo(t.map((function(t){return Object.keys(t)}))),(function(t){return oo.key(t)})).reduce((function(t,e){return t.indexOf(e)<0&&t.push(e),t}),[]),i={},n=function(n){var r=e[n];i[r]=t.map((function(t){var e={};for(var i in t)oo.key(i)?i==r&&(e.value=t[i]):e[i]=t[i];return e}))},r=0;r<e.length;r++)n(r);return i}function is(t,e){var i=[],n=e.keyframes;for(var r in n&&(e=xo(es(n),e)),e)oo.key(r)&&i.push({name:r,tweens:ts(e[r],t)});return i}function ns(t,e){var i={};for(var n in t){var r=Mo(t[n],e);oo.arr(r)&&1===(r=r.map((function(t){return Mo(t,e)}))).length&&(r=r[0]),i[n]=r}return i.duration=parseFloat(i.duration),i.delay=parseFloat(i.delay),i}function rs(t,e){var i;return t.tweens.map((function(n){var r=ns(n,e),o=r.value,s=oo.arr(o)?o[1]:o,a=Co(s),l=Io(e.target,t.name,a,e),c=i?i.to.original:l,h=oo.arr(o)?o[0]:c,d=Co(h)||Co(l),p=a||d;return oo.und(s)&&(s=c),r.from=Qo(h,p),r.to=Qo(Ro(s,h),p),r.start=i?i.end:0,r.end=r.start+r.delay+r.duration+r.endDelay,r.easing=go(r.easing,r.duration),r.isPath=oo.pth(o),r.isPathTargetInsideSVG=r.isPath&&oo.svg(e.target),r.isColor=oo.col(r.from.original),r.isColor&&(r.round=1),i=r,r}))}var os={css:function(t,e,i){return t.style[e]=i},attribute:function(t,e,i){return t.setAttribute(e,i)},object:function(t,e,i){return t[e]=i},transform:function(t,e,i,n,r){if(n.list.set(e,i),e===n.last||r){var o="";n.list.forEach((function(t,e){o+=e+"("+t+") "})),t.style.transform=o}}};function ss(t,e){Jo(t).forEach((function(t){for(var i in e){var n=Mo(e[i],t),r=t.target,o=Co(n),s=Io(r,i,o,t),a=Ro(Po(n,o||Co(s)),s),l=Oo(r,i);os[l](r,i,a,t.transforms,!0)}}))}function as(t,e){var i=Oo(t.target,e.name);if(i){var n=rs(e,t),r=n[n.length-1];return{type:i,property:e.name,animatable:t,tweens:n,duration:r.end,delay:n[0].delay,endDelay:r.endDelay}}}function ls(t,e){return mo(vo(t.map((function(t){return e.map((function(e){return as(t,e)}))}))),(function(t){return!oo.und(t)}))}function cs(t,e){var i=t.length,n=function(t){return t.timelineOffset?t.timelineOffset:0},r={};return r.duration=i?Math.max.apply(Math,t.map((function(t){return n(t)+t.duration}))):e.duration,r.delay=i?Math.min.apply(Math,t.map((function(t){return n(t)+t.delay}))):e.delay,r.endDelay=i?r.duration-Math.max.apply(Math,t.map((function(t){return n(t)+t.duration-t.endDelay}))):e.endDelay,r}var hs=0;function ds(t){var e=wo(Zr,t),i=wo(Jr,t),n=is(i,t),r=Jo(t.targets),o=ls(r,n),s=cs(o,i),a=hs;return hs++,xo(e,{id:a,children:[],animatables:r,animations:o,duration:s.duration,delay:s.delay,endDelay:s.endDelay})}var ps=[],us=function(){var t;function e(){t||gs()&&fs.suspendWhenDocumentHidden||!(ps.length>0)||(t=requestAnimationFrame(i))}function i(e){for(var n=ps.length,r=0;r<n;){var o=ps[r];o.paused?(ps.splice(r,1),n--):(o.tick(e),r++)}t=r>0?requestAnimationFrame(i):void 0}function n(){fs.suspendWhenDocumentHidden&&(gs()?t=cancelAnimationFrame(t):(ps.forEach((function(t){return t._onDocumentVisibility()})),us()))}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",n),e}();function gs(){return!!document&&document.hidden}function fs(t){void 0===t&&(t={});var e,i=0,n=0,r=0,o=0,s=null;function a(t){var e=window.Promise&&new Promise((function(t){return s=t}));return t.finished=e,e}var l=ds(t);a(l);function c(){var t=l.direction;"alternate"!==t&&(l.direction="normal"!==t?"normal":"reverse"),l.reversed=!l.reversed,e.forEach((function(t){return t.reversed=l.reversed}))}function h(t){return l.reversed?l.duration-t:t}function d(){i=0,n=h(l.currentTime)*(1/fs.speed)}function p(t,e){e&&e.seek(t-e.timelineOffset)}function u(t){if(l.reversePlayback)for(var i=o;i--;)p(t,e[i]);else for(var n=0;n<o;n++)p(t,e[n])}function g(t){for(var e=0,i=l.animations,n=i.length;e<n;){var r=i[e],o=r.animatable,s=r.tweens,a=s.length-1,c=s[a];a&&(c=mo(s,(function(e){return t<e.end}))[0]||c);for(var h=io(t-c.start-c.delay,0,c.duration)/c.duration,d=isNaN(h)?1:c.easing(h),p=c.to.strings,u=c.round,g=[],f=c.to.numbers.length,m=void 0,v=0;v<f;v++){var b=void 0,y=c.to.numbers[v],_=c.from.numbers[v]||0;b=c.isPath?Ko(c.value,d*y,c.isPathTargetInsideSVG):_+d*(y-_),u&&(c.isColor&&v>2||(b=Math.round(b*u)/u)),g.push(b)}var w=p.length;if(w){m=p[0];for(var x=0;x<w;x++){p[x];var k=p[x+1],A=g[x];isNaN(A)||(m+=k?A+k:A+" ")}}else m=g[0];os[r.type](o.target,r.property,m,o.transforms),r.currentValue=m,e++}}function f(t){l[t]&&!l.passThrough&&l[t](l)}function m(){l.remaining&&!0!==l.remaining&&l.remaining--}function v(t){var o=l.duration,d=l.delay,p=o-l.endDelay,v=h(t);l.progress=io(v/o*100,0,100),l.reversePlayback=v<l.currentTime,e&&u(v),!l.began&&l.currentTime>0&&(l.began=!0,f("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,f("loopBegin")),v<=d&&0!==l.currentTime&&g(0),(v>=p&&l.currentTime!==o||!o)&&g(o),v>d&&v<p?(l.changeBegan||(l.changeBegan=!0,l.changeCompleted=!1,f("changeBegin")),f("change"),g(v)):l.changeBegan&&(l.changeCompleted=!0,l.changeBegan=!1,f("changeComplete")),l.currentTime=io(v,0,o),l.began&&f("update"),t>=o&&(n=0,m(),l.remaining?(i=r,f("loopComplete"),l.loopBegan=!1,"alternate"===l.direction&&c()):(l.paused=!0,l.completed||(l.completed=!0,f("loopComplete"),f("complete"),!l.passThrough&&"Promise"in window&&(s(),a(l)))))}return l.reset=function(){var t=l.direction;l.passThrough=!1,l.currentTime=0,l.progress=0,l.paused=!0,l.began=!1,l.loopBegan=!1,l.changeBegan=!1,l.completed=!1,l.changeCompleted=!1,l.reversePlayback=!1,l.reversed="reverse"===t,l.remaining=l.loop,e=l.children;for(var i=o=e.length;i--;)l.children[i].reset();(l.reversed&&!0!==l.loop||"alternate"===t&&1===l.loop)&&l.remaining++,g(l.reversed?l.duration:0)},l._onDocumentVisibility=d,l.set=function(t,e){return ss(t,e),l},l.tick=function(t){r=t,i||(i=r),v((r+(n-i))*fs.speed)},l.seek=function(t){v(h(t))},l.pause=function(){l.paused=!0,d()},l.play=function(){l.paused&&(l.completed&&l.reset(),l.paused=!1,ps.push(l),d(),us())},l.reverse=function(){c(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.remove=function(t){vs(Zo(t),l)},l.reset(),l.autoplay&&l.play(),l}function ms(t,e){for(var i=e.length;i--;)yo(t,e[i].animatable.target)&&e.splice(i,1)}function vs(t,e){var i=e.animations,n=e.children;ms(t,i);for(var r=n.length;r--;){var o=n[r],s=o.animations;ms(t,s),s.length||o.children.length||n.splice(r,1)}i.length||n.length||e.pause()}function bs(t){for(var e=Zo(t),i=ps.length;i--;){vs(e,ps[i])}}function ys(t,e){void 0===e&&(e={});var i=e.direction||"normal",n=e.easing?go(e.easing):null,r=e.grid,o=e.axis,s=e.from||0,a="first"===s,l="center"===s,c="last"===s,h=oo.arr(t),d=h?parseFloat(t[0]):parseFloat(t),p=h?parseFloat(t[1]):0,u=Co(h?t[1]:t)||0,g=e.start||0+(h?d:0),f=[],m=0;return function(t,e,v){if(a&&(s=0),l&&(s=(v-1)/2),c&&(s=v-1),!f.length){for(var b=0;b<v;b++){if(r){var y=l?(r[0]-1)/2:s%r[0],_=l?(r[1]-1)/2:Math.floor(s/r[0]),w=y-b%r[0],x=_-Math.floor(b/r[0]),k=Math.sqrt(w*w+x*x);"x"===o&&(k=-w),"y"===o&&(k=-x),f.push(k)}else f.push(Math.abs(s-b));m=Math.max.apply(Math,f)}n&&(f=f.map((function(t){return n(t/m)*m}))),"reverse"===i&&(f=f.map((function(t){return o?t<0?-1*t:-t:Math.abs(m-t)})))}return g+(h?(p-d)/m:d)*(Math.round(100*f[e])/100)+u}}function _s(t){void 0===t&&(t={});var e=fs(t);return e.duration=0,e.add=function(i,n){var r=ps.indexOf(e),o=e.children;function s(t){t.passThrough=!0}r>-1&&ps.splice(r,1);for(var a=0;a<o.length;a++)s(o[a]);var l=xo(i,wo(Jr,t));l.targets=l.targets||t.targets;var c=e.duration;l.autoplay=!1,l.direction=e.direction,l.timelineOffset=oo.und(n)?c:Ro(n,c),s(e),e.seek(l.timelineOffset);var h=fs(l);s(h),o.push(h);var d=cs(o,t);return e.delay=d.delay,e.endDelay=d.endDelay,e.duration=d.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e}fs.version="3.2.1",fs.speed=1,fs.suspendWhenDocumentHidden=!0,fs.running=ps,fs.remove=bs,fs.get=Io,fs.set=ss,fs.convertPx=To,fs.path=Xo,fs.setDashoffset=Wo,fs.stagger=ys,fs.timeline=_s,fs.easing=go,fs.penner=uo,fs.random=function(t,e){return Math.floor(Math.random()*(e-t+1))+t};class ws extends(N(V)){static get properties(){return Object.assign({src:{type:String},odd:{type:String,reflect:!0},view:{type:String,reflect:!0},nodeId:{type:String,reflect:!0,attribute:"node-id"},xmlId:{type:Array,reflect:!0,attribute:"xml-id"},xpath:{type:String,reflect:!0},map:{type:String},onUpdate:{type:Boolean,attribute:"on-update"},notFound:{type:String,attribute:"not-found"},url:{type:String},static:{type:String},appendFootnotes:{type:Boolean,attribute:"append-footnotes"},suppressHighlight:{type:Boolean,attribute:"suppress-highlight",reflect:!0},columnSeparator:{type:String,attribute:"column-separator"},direction:{type:String},loadCss:{type:String,attribute:"load-css"},fixLinks:{type:Boolean,attribute:"fix-links"},useLanguage:{type:Boolean,attribute:"use-language"},animation:{type:Boolean},infiniteScroll:{type:Boolean,attribute:"infinite-scroll"},infiniteScrollMax:{type:Number,attribute:"infinite-scroll-max"},waitFor:{type:String,attribute:"wait-for"},disableHistory:{type:Boolean,attribute:"disable-history"},beforeUpdate:{type:String,attribute:"before-update-event"},noScroll:{type:Boolean,attribute:"no-scroll"},_features:{type:Object},_content:{type:Node,attribute:!1},_column1:{type:Node,attribute:!1},_column2:{type:Node,attribute:!1},_footnotes:{type:Node,attribute:!1},_style:{type:Node,attribute:!1}},super.properties)}constructor(){super(),this.src=null,this.url=null,this.onUpdate=!1,this.appendFootnotes=!1,this.notFound="the server did not return any content",this.animation=!1,this.direction="ltr",this.suppressHighlight=!1,this.highlight=!1,this.infiniteScrollMax=10,this.disableHistory=!1,this.beforeUpdate=null,this.noScroll=!1,this._features={},this._selector=new Map,this._chunks=[],this._scrollTarget=null,this.static=null}attributeChangedCallback(t,e,i){switch(super.attributeChangedCallback(t,e,i),t){case"src":this._updateSource(i,e)}}connectedCallback(){if(super.connectedCallback(),this.infiniteScroll&&(this.columnSeparator=null,this.animation=!1,this._content=document.createElement("div"),this._content.className="infinite-content"),!this.disableHistory){const t=this.getParameter("id");t&&!this.xmlId&&(this.xmlId=t);const e=this.getParameter("action");e&&"search"===e&&(this.highlight=!0);const i=this.getParameter("root");"single"===this.view?this.nodeId=null:i&&!this.nodeId&&(this.nodeId=i)}this.waitFor||(this.waitFor="pb-toggle-feature,pb-select-feature,pb-navigation"),this.subscribeTo("pb-navigate",t=>{t.detail.source&&t.detail.source===this||this.navigate(t.detail.direction)}),this.subscribeTo("pb-refresh",this._refresh.bind(this)),this.subscribeTo("pb-toggle",t=>{this.toggleFeature(t)}),this.subscribeTo("pb-zoom",t=>{this.zoom(t.detail.direction)}),this.subscribeTo("pb-i18n-update",t=>{const e=this._features.language&&this._features.language!==t.detail.language;this._features.language=t.detail.language,this.useLanguage&&e&&this._refresh()},[]),this.signalReady(),this.onUpdate&&this.subscribeTo("pb-update",this._refresh.bind(this))}disconnectedCallback(){super.disconnectedCallback(),this._scrollObserver&&this._scrollObserver.disconnect()}firstUpdated(){super.firstUpdated(),this.enableScrollbar(!0),this.infiniteScroll&&(this._topObserver=this.shadowRoot.getElementById("top-observer"),this._bottomObserver=this.shadowRoot.getElementById("bottom-observer"),this._bottomObserver.style.display="none",this._topObserver.style.display="none",this._scrollObserver=new IntersectionObserver(t=>{this._content&&t.forEach(t=>{if(t.isIntersecting)if("bottom-observer"===t.target.id){const t=this._content.lastElementChild;if(t){const e=t.getAttribute("data-next");e&&!this._content.querySelector(`[data-root="${e}"]`)&&(console.log("<pb-view> Loading next page: %s",e),this._checkChunks("forward"),this._load(e,"forward"))}}else{const t=this._content.firstElementChild;if(t){const e=t.getAttribute("data-previous");e&&!this._content.querySelector(`[data-root="${e}"]`)&&(this._checkChunks("backward"),this._load(e,"backward"))}}})})),this.onUpdate||ws.waitOnce("pb-page-ready",t=>{t&&t.language&&(this._features.language=t.language),this.wait(()=>this._refresh())})}getOdd(){return this.odd||this.getDocument().odd||"teipublisher"}getView(){return this.view||this.getDocument().view||"single"}forceUpdate(){this._load(this.nodeId)}animate(){this.animation&&("forward"===this.lastDirection?fs({targets:this.shadowRoot.getElementById("view"),opacity:[0,1],translateX:[1e3,0],duration:300,easing:"linear"}):fs({targets:this.shadowRoot.getElementById("view"),opacity:[0,1],translateX:[-1e3,0],duration:300,easing:"linear"}))}enableScrollbar(t){t?this.classList.add("noscroll"):this.classList.remove("noscroll")}_refresh(t){if(t&&t.detail){if(t.detail.hash&&!this.noScroll&&!(t.detail.id||t.detail.path||t.detail.odd||t.detail.view||t.detail.position)){this._scrollTarget=t.detail.hash;const e=this.shadowRoot.getElementById(this._scrollTarget);return void(e&&setTimeout(()=>e.scrollIntoView({block:"nearest"})))}if(t.detail.path){this.getDocument().path=t.detail.path}t.detail.id&&(this.xmlId=t.detail.id),this.odd=t.detail.odd||this.odd,void 0!==t.detail.columnSeparator&&(this.columnSeparator=t.detail.columnSeparator),this.view=t.detail.view||this.view,t.detail.xpath&&(this.xpath=t.detail.xpath,this.nodeId=null),null===t.detail.position?this.nodeId=null:this.nodeId=t.detail.position||this.nodeId,this.noScroll||(this._scrollTarget=t.detail.hash)}this._updateStyles(),this.infiniteScroll&&this._clear(),this._load(this.nodeId)}_load(t,e){if(!this.getDocument().path)return void console.log("No path");if(this._loading)return;this._loading=!0;const i=this.getParameters(t);e&&(i._dir=e),this._doLoad(i)}_doLoad(t){this.emitTo("pb-start-update",t),console.log("<pb-view> Loading view with params %o",t),this.infiniteScroll||this._clear(),this._scrollObserver&&(this._bottomObserver&&this._scrollObserver.unobserve(this._bottomObserver),this._topObserver&&this._scrollObserver.unobserve(this._topObserver));const e=this.shadowRoot.getElementById("loadContent");null!==this.static?this._staticUrl(t).then(t=>{e.url=t,e.generateRequest()}):(this.url||(this.minApiVersion("1.0.0")?this.url="api/parts":this.url="modules/lib/components.xql"),this.minApiVersion("1.0.0")?e.url=`${this.getEndpoint()}/${this.url}/${encodeURIComponent(this.getDocument().path)}/json`:e.url=`${this.getEndpoint()}/${this.url}`,e.params=t,e.generateRequest())}async _staticUrl(t){function e(e){const i=[];return e.sort().forEach(e=>{t.hasOwnProperty(e)&&i.push(`${e}=${t[e]}`)}),i.join("&")}const i=await fetch("index.json").then(t=>t.json()),n=["odd","view","xpath","map"];this.querySelectorAll("pb-param").forEach(t=>n.push("user."+t.getAttribute("name")));let r=t.id?e([...n,"id"]):e([...n,"root"]),o=i[r];return o||(r=e(n),o=i[r]),console.log("<pb-view> Static lookup %s: %s",r,o),""+o}_clear(){this.infiniteScroll?(this._content=document.createElement("div"),this._content.className="infinite-content"):this._content=null,this._column1=null,this._column2=null,this._footnotes=null,this._chunks=[]}_handleError(){this._clear();const t=this.shadowRoot.getElementById("loadContent");let e;const{response:i}=t.lastError;e=i?i.description:'<pb-i18n key="dialogs.serverError"></pb-i18n>';const n=`\n <p>${this.notFound}</p>\n <p><pb-i18n key="dialogs.serverError"></pb-i18n>: ${e} </p>\n `;this._replaceContent({content:n}),this.emitTo("pb-end-update")}_handleContent(){const t=this.shadowRoot.getElementById("loadContent"),e=t.lastResponse;if(e){if(e.error)return this.notFound&&(this._content=this.notFound),void this.emitTo("pb-end-update",null);this._replaceContent(e,t.params._dir),this.animate(),this._scrollTarget&&this.updateComplete.then(()=>{const t=this.shadowRoot.getElementById(this._scrollTarget)||this.shadowRoot.querySelector(`[node-id="${this._scrollTarget}"]`);t&&window.requestAnimationFrame(()=>setTimeout(()=>{t.scrollIntoView({block:"nearest"})},400)),this._scrollTarget=null}),this.next=e.next,this.nextId=e.nextId,this.previous=e.previous,this.previousId=e.previousId,this.nodeId=e.root,this.switchView=e.switchView,this.disableHistory||!this.xmlId||this.map||(this.setParameter("id",this.xmlId),this.pushHistory("Navigate to xml:id")),this.xmlId=null,this.updateComplete.then(()=>{const i=this.shadowRoot.getElementById("view");this._applyToggles(i),this._fixLinks(i),an(i);const n={data:e,root:i,params:t.params,id:this.xmlId,position:this.nodeId};this.emitTo("pb-update",n),this._scroll()}),this.emitTo("pb-end-update",null)}else console.error("<pb-view> No response received")}_replaceContent(t,e){const i=document.createDocumentFragment(),n=document.createElement("div");i.appendChild(n),n.innerHTML=t.content,this.beforeUpdate?this.emitTo(this.beforeUpdate,{data:t,root:n,render:i=>{this._doReplaceContent(i,t,e)}}):this._doReplaceContent(n,t,e)}_doReplaceContent(t,e,i){if(this.columnSeparator)this._replaceColumns(t),this._loading=!1;else if(this.infiniteScroll){let n;switch(t.className="scroll-fragment",t.setAttribute("data-root",e.root),e.next&&t.setAttribute("data-next",e.next),e.previous&&t.setAttribute("data-previous",e.previous),i){case"backward":n=this._content.firstElementChild,this._chunks.unshift(t),this.updateComplete.then(()=>{n.scrollIntoView(!0),this._loading=!1,this._checkVisibility(),this._scrollObserver.observe(this._bottomObserver),this._scrollObserver.observe(this._topObserver)}),this._content.insertBefore(t,n);break;default:this.updateComplete.then(()=>{this._loading=!1,this._checkVisibility(),this._scrollObserver.observe(this._bottomObserver),this._scrollObserver.observe(this._topObserver)}),this._chunks.push(t),this._content.appendChild(t)}}else this._content=t,this._loading=!1;if(this.appendFootnotes){const t=document.createElement("div");e.footnotes&&(t.innerHTML=e.footnotes),this._footnotes=t}return this._initFootnotes(this._footnotes),t}_checkVisibility(){const t=this._chunks[this._chunks.length-1].hasAttribute("data-next");this._bottomObserver.style.display=t?"":"none";const e=this._chunks[0].hasAttribute("data-previous");this._topObserver.style.display=e?"":"none"}_replaceColumns(t){let e;if(this.columnSeparator){const i=t.querySelectorAll(this.columnSeparator);i.length>1&&(e=i[i.length-1])}if(e){const i=this._getFragmentBefore(t,e),n=this._getFragmentAfter(t,e);"ltr"===this.direction?(this._column1=i,this._column2=n):(this._column2=i,this._column1=n)}else this._content=t}_scroll(){if(this.noScroll)return;const{hash:t}=this.getUrl();if(t){const e=this.shadowRoot.getElementById(t.substring(1));console.log("hash target: %o",e),e&&window.requestAnimationFrame(()=>setTimeout(()=>{e.scrollIntoView({block:"nearest"})},400))}}_scrollToElement(t,e){const i=this.shadowRoot.getElementById(e.hash.substring(1));i&&(t.preventDefault(),console.log("<pb-view> Scrolling to element %s",i.id),i.scrollIntoView({block:"center",inline:"nearest"}))}_updateStyles(){const t=[];let e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),null!==this.static?e.setAttribute("href",`${this.static}/css/${this.getOdd()}.css`):e.setAttribute("href",`${this.getEndpoint()}/transform/${this.getOdd()}.css`),t.push(e),this.loadCss&&(e=document.createElement("link"),e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),e.setAttribute("href",this.toAbsoluteURL(this.loadCss)),t.push(e)),this._style=t}_fixLinks(t){if(this.fixLinks){const e=this.getDocument(),i=this.toAbsoluteURL(e.path);t.querySelectorAll("img").forEach(t=>{const e=t.getAttribute("src"),n=new URL(e,i);t.src=n}),t.querySelectorAll("a").forEach(t=>{const e=t.getAttribute("href");if(e===t.hash)t.addEventListener("click",e=>this._scrollToElement(e,t));else{const n=new URL(e,i);t.href=n}})}else t.querySelectorAll("a").forEach(t=>{t.getAttribute("href")===t.hash&&t.addEventListener("click",e=>this._scrollToElement(e,t))})}_initFootnotes(t){t&&t.querySelectorAll(".note, .fn-back").forEach(t=>{t.addEventListener("click",e=>{e.preventDefault();const i=this.shadowRoot.getElementById("content").querySelector(t.hash);i&&i.scrollIntoView()})})}_getParameters(){const t=[];this.querySelectorAll("pb-param").forEach((function(e){t["user."+e.getAttribute("name")]=e.getAttribute("value")}));for(const[e,i]of Object.entries(this._features))t["user."+e]=i;return t}getParameters(t){t=t||this.nodeId;const e=this.getDocument(),i=this._getParameters();return this.minApiVersion("1.0.0")||(i.doc=e.path),i.odd=this.getOdd()+".odd",i.view=this.getView(),t&&(i.root=t),this.xpath&&(i.xpath=this.xpath),this.xmlId&&(i.id=this.xmlId),!this.suppressHighlight&&this.highlight&&(i.highlight="yes"),this.map&&(i.map=this.map),i}_applyToggles(t){0!==this._selector.size&&this._selector.forEach((e,i)=>{t.querySelectorAll(i).forEach(t=>{const i=e.command||"toggle";t.command&&t.command(i,e.state),e.state?t.classList.add(i):t.classList.remove(i)})})}goto(t){this._load(t)}gotoId(t){this.xmlId=t,this._load()}navigate(t){this.lastDirection=t,"backward"===t?this.previous&&(this.disableHistory||this.map||(this.previousId?this.setParameter("id",this.previousId):this.setParameter("root",this.previous),this.pushHistory("Navigate backward")),this._load(this.previous,t)):this.next&&(this.disableHistory||this.map||(this.nextId?this.setParameter("id",this.nextId):this.setParameter("root",this.next),this.pushHistory("Navigate forward")),this._load(this.next,t))}_checkChunks(t){if(this.infiniteScroll&&0!==this.infiniteScrollMax){if(this._chunks.length===this.infiniteScrollMax)switch(t){case"forward":this._content.removeChild(this._chunks.shift());break;default:this._content.removeChild(this._chunks.pop())}this.emitTo("pb-navigate",{direction:t,source:this})}}zoom(t){const e=this.shadowRoot.getElementById("view"),i=window.getComputedStyle(e).getPropertyValue("font-size"),n=parseInt(i.replace(/^(\d+)px/,"$1"));e.style.fontSize="in"===t?n+1+"px":n-1+"px"}toggleFeature(t){const e=()=>{const t=this.shadowRoot.getElementById("view");this._applyToggles(t)},i=t.detail.properties;for(const[t,e]of Object.entries(i))switch(t){case"odd":case"view":case"columnSeparator":case"xpath":case"nodeId":break;default:this._features[t]=e}i&&(i.odd&&(this.odd=i.odd),i.view&&(this.view=i.view,"single"===this.view?this.nodeId=null:this.nodeId=this.switchView),i.xpath&&(this.xpath=i.xpath),i.hasOwnProperty("columnSeparator")&&(this.columnSeparator=i.columnSeparator)),t.detail.selectors&&t.detail.selectors.forEach(t=>{this._selector.set(t.selector,{state:t.state,command:t.command||"toggle"})}),"refresh"===t.detail.action&&(Object.keys(i).length>0?(this._updateStyles(),this._load()):e())}_getFragmentBefore(t,e){const i=document.createRange();return i.setStartBefore(t),i.setEndBefore(e),i.cloneContents()}_getFragmentAfter(t,e){const i=document.createRange();return i.setStartBefore(e),i.setEndAfter(t),i.cloneContents()}_updateSource(t,e){void 0!==e&&t!==e&&(this.xpath=null,this.odd=null,this.xmlId=null,this.nodeId=null)}static get styles(){return P`
|
|
1092
|
+
`}}customElements.define("pb-select-feature",Qr);var Zr={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},Jr={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},to=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],eo={CSS:{},springs:{}};function io(t,e,i){return Math.min(Math.max(t,e),i)}function no(t,e){return t.indexOf(e)>-1}function ro(t,e){return t.apply(null,e)}var oo={arr:function(t){return Array.isArray(t)},obj:function(t){return no(Object.prototype.toString.call(t),"Object")},pth:function(t){return oo.obj(t)&&t.hasOwnProperty("totalLength")},svg:function(t){return t instanceof SVGElement},inp:function(t){return t instanceof HTMLInputElement},dom:function(t){return t.nodeType||oo.svg(t)},str:function(t){return"string"==typeof t},fnc:function(t){return"function"==typeof t},und:function(t){return void 0===t},nil:function(t){return oo.und(t)||null===t},hex:function(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)},rgb:function(t){return/^rgb/.test(t)},hsl:function(t){return/^hsl/.test(t)},col:function(t){return oo.hex(t)||oo.rgb(t)||oo.hsl(t)},key:function(t){return!Zr.hasOwnProperty(t)&&!Jr.hasOwnProperty(t)&&"targets"!==t&&"keyframes"!==t}};function so(t){var e=/\(([^)]+)\)/.exec(t);return e?e[1].split(",").map((function(t){return parseFloat(t)})):[]}function ao(t,e){var i=so(t),n=io(oo.und(i[0])?1:i[0],.1,100),r=io(oo.und(i[1])?100:i[1],.1,100),o=io(oo.und(i[2])?10:i[2],.1,100),s=io(oo.und(i[3])?0:i[3],.1,100),a=Math.sqrt(r/n),l=o/(2*Math.sqrt(r*n)),c=l<1?a*Math.sqrt(1-l*l):0,h=1,d=l<1?(l*a-s)/c:-s+a;function p(t){var i=e?e*t/1e3:t;return i=l<1?Math.exp(-i*l*a)*(h*Math.cos(c*i)+d*Math.sin(c*i)):(h+d*i)*Math.exp(-i*a),0===t||1===t?t:1-i}function u(){var e=eo.springs[t];if(e)return e;for(var i=1/6,n=0,r=0;;)if(1===p(n+=i)){if(++r>=16)break}else r=0;var o=n*i*1e3;return eo.springs[t]=o,o}return e?p:u}function lo(t){return void 0===t&&(t=10),function(e){return Math.ceil(io(e,1e-6,1)*t)*(1/t)}}var co,ho,po=function(){var t=11,e=1/(t-1);function i(t,e){return 1-3*e+3*t}function n(t,e){return 3*e-6*t}function r(t){return 3*t}function o(t,e,o){return((i(e,o)*t+n(e,o))*t+r(e))*t}function s(t,e,o){return 3*i(e,o)*t*t+2*n(e,o)*t+r(e)}function a(t,e,i,n,r){var s,a,l=0;do{(s=o(a=e+(i-e)/2,n,r)-t)>0?i=a:e=a}while(Math.abs(s)>1e-7&&++l<10);return a}function l(t,e,i,n){for(var r=0;r<4;++r){var a=s(e,i,n);if(0===a)return e;e-=(o(e,i,n)-t)/a}return e}function c(i,n,r,c){if(0<=i&&i<=1&&0<=r&&r<=1){var h=new Float32Array(t);if(i!==n||r!==c)for(var d=0;d<t;++d)h[d]=o(d*e,i,r);return function(t){return i===n&&r===c||0===t||1===t?t:o(p(t),n,c)}}function p(n){for(var o=0,c=1,d=t-1;c!==d&&h[c]<=n;++c)o+=e;--c;var p=o+(n-h[c])/(h[c+1]-h[c])*e,u=s(p,i,r);return u>=.001?l(n,p,i,r):0===u?p:a(n,o,o+e,i,r)}}return c}(),uo=(co={linear:function(){return function(t){return t}}},ho={Sine:function(){return function(t){return 1-Math.cos(t*Math.PI/2)}},Circ:function(){return function(t){return 1-Math.sqrt(1-t*t)}},Back:function(){return function(t){return t*t*(3*t-2)}},Bounce:function(){return function(t){for(var e,i=4;t<((e=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}},Elastic:function(t,e){void 0===t&&(t=1),void 0===e&&(e=.5);var i=io(t,1,10),n=io(e,.1,2);return function(t){return 0===t||1===t?t:-i*Math.pow(2,10*(t-1))*Math.sin((t-1-n/(2*Math.PI)*Math.asin(1/i))*(2*Math.PI)/n)}}},["Quad","Cubic","Quart","Quint","Expo"].forEach((function(t,e){ho[t]=function(){return function(t){return Math.pow(t,e+2)}}})),Object.keys(ho).forEach((function(t){var e=ho[t];co["easeIn"+t]=e,co["easeOut"+t]=function(t,i){return function(n){return 1-e(t,i)(1-n)}},co["easeInOut"+t]=function(t,i){return function(n){return n<.5?e(t,i)(2*n)/2:1-e(t,i)(-2*n+2)/2}},co["easeOutIn"+t]=function(t,i){return function(n){return n<.5?(1-e(t,i)(1-2*n))/2:(e(t,i)(2*n-1)+1)/2}}})),co);function go(t,e){if(oo.fnc(t))return t;var i=t.split("(")[0],n=uo[i],r=so(t);switch(i){case"spring":return ao(t,e);case"cubicBezier":return ro(po,r);case"steps":return ro(lo,r);default:return ro(n,r)}}function fo(t){try{return document.querySelectorAll(t)}catch(t){return}}function mo(t,e){for(var i=t.length,n=arguments.length>=2?arguments[1]:void 0,r=[],o=0;o<i;o++)if(o in t){var s=t[o];e.call(n,s,o,t)&&r.push(s)}return r}function vo(t){return t.reduce((function(t,e){return t.concat(oo.arr(e)?vo(e):e)}),[])}function bo(t){return oo.arr(t)?t:(oo.str(t)&&(t=fo(t)||t),t instanceof NodeList||t instanceof HTMLCollection?[].slice.call(t):[t])}function yo(t,e){return t.some((function(t){return t===e}))}function _o(t){var e={};for(var i in t)e[i]=t[i];return e}function wo(t,e){var i=_o(t);for(var n in t)i[n]=e.hasOwnProperty(n)?e[n]:t[n];return i}function xo(t,e){var i=_o(t);for(var n in e)i[n]=oo.und(t[n])?e[n]:t[n];return i}function ko(t){var e=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(t);return e?"rgba("+e[1]+",1)":t}function Ao(t){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,i=t.replace(e,(function(t,e,i,n){return e+e+i+i+n+n})),n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i);return"rgba("+parseInt(n[1],16)+","+parseInt(n[2],16)+","+parseInt(n[3],16)+",1)"}function zo(t){var e,i,n,r=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(t),o=parseInt(r[1],10)/360,s=parseInt(r[2],10)/100,a=parseInt(r[3],10)/100,l=r[4]||1;function c(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}if(0==s)e=i=n=a;else{var h=a<.5?a*(1+s):a+s-a*s,d=2*a-h;e=c(d,h,o+1/3),i=c(d,h,o),n=c(d,h,o-1/3)}return"rgba("+255*e+","+255*i+","+255*n+","+l+")"}function So(t){return oo.rgb(t)?ko(t):oo.hex(t)?Ao(t):oo.hsl(t)?zo(t):void 0}function Co(t){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(t);if(e)return e[1]}function Eo(t){return no(t,"translate")||"perspective"===t?"px":no(t,"rotate")||no(t,"skew")?"deg":void 0}function Mo(t,e){return oo.fnc(t)?t(e.target,e.id,e.total):t}function Lo(t,e){return t.getAttribute(e)}function To(t,e,i){if(yo([i,"deg","rad","turn"],Co(e)))return e;var n=eo.CSS[e+i];if(!oo.und(n))return n;var r=100,o=document.createElement(t.tagName),s=t.parentNode&&t.parentNode!==document?t.parentNode:document.body;s.appendChild(o),o.style.position="absolute",o.style.width=r+i;var a=r/o.offsetWidth;s.removeChild(o);var l=a*parseFloat(e);return eo.CSS[e+i]=l,l}function Ho(t,e,i){if(e in t.style){var n=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=t.style[e]||getComputedStyle(t).getPropertyValue(n)||"0";return i?To(t,r,i):r}}function Oo(t,e){return oo.dom(t)&&!oo.inp(t)&&(!oo.nil(Lo(t,e))||oo.svg(t)&&t[e])?"attribute":oo.dom(t)&&yo(to,e)?"transform":oo.dom(t)&&"transform"!==e&&Ho(t,e)?"css":null!=t[e]?"object":void 0}function $o(t){if(oo.dom(t)){for(var e,i=t.style.transform||"",n=/(\w+)\(([^)]*)\)/g,r=new Map;e=n.exec(i);)r.set(e[1],e[2]);return r}}function Vo(t,e,i,n){var r=no(e,"scale")?1:0+Eo(e),o=$o(t).get(e)||r;return i&&(i.transforms.list.set(e,o),i.transforms.last=e),n?To(t,o,n):o}function Io(t,e,i,n){switch(Oo(t,e)){case"transform":return Vo(t,e,n,i);case"css":return Ho(t,e,i);case"attribute":return Lo(t,e);default:return t[e]||0}}function Ro(t,e){var i=/^(\*=|\+=|-=)/.exec(t);if(!i)return t;var n=Co(t)||0,r=parseFloat(e),o=parseFloat(t.replace(i[0],""));switch(i[0][0]){case"+":return r+o+n;case"-":return r-o+n;case"*":return r*o+n}}function Po(t,e){if(oo.col(t))return So(t);if(/\s/g.test(t))return t;var i=Co(t),n=i?t.substr(0,t.length-i.length):t;return e?n+e:n}function Do(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function No(t){return 2*Math.PI*Lo(t,"r")}function Fo(t){return 2*Lo(t,"width")+2*Lo(t,"height")}function Bo(t){return Do({x:Lo(t,"x1"),y:Lo(t,"y1")},{x:Lo(t,"x2"),y:Lo(t,"y2")})}function jo(t){for(var e,i=t.points,n=0,r=0;r<i.numberOfItems;r++){var o=i.getItem(r);r>0&&(n+=Do(e,o)),e=o}return n}function qo(t){var e=t.points;return jo(t)+Do(e.getItem(e.numberOfItems-1),e.getItem(0))}function Uo(t){if(t.getTotalLength)return t.getTotalLength();switch(t.tagName.toLowerCase()){case"circle":return No(t);case"rect":return Fo(t);case"line":return Bo(t);case"polyline":return jo(t);case"polygon":return qo(t)}}function Wo(t){var e=Uo(t);return t.setAttribute("stroke-dasharray",e),e}function Yo(t){for(var e=t.parentNode;oo.svg(e)&&oo.svg(e.parentNode);)e=e.parentNode;return e}function Go(t,e){var i=e||{},n=i.el||Yo(t),r=n.getBoundingClientRect(),o=Lo(n,"viewBox"),s=r.width,a=r.height,l=i.viewBox||(o?o.split(" "):[0,0,s,a]);return{el:n,viewBox:l,x:l[0]/1,y:l[1]/1,w:s,h:a,vW:l[2],vH:l[3]}}function Xo(t,e){var i=oo.str(t)?fo(t)[0]:t,n=e||100;return function(t){return{property:t,el:i,svg:Go(i),totalLength:Uo(i)*(n/100)}}}function Ko(t,e,i){function n(i){void 0===i&&(i=0);var n=e+i>=1?e+i:0;return t.el.getPointAtLength(n)}var r=Go(t.el,t.svg),o=n(),s=n(-1),a=n(1),l=i?1:r.w/r.vW,c=i?1:r.h/r.vH;switch(t.property){case"x":return(o.x-r.x)*l;case"y":return(o.y-r.y)*c;case"angle":return 180*Math.atan2(a.y-s.y,a.x-s.x)/Math.PI}}function Qo(t,e){var i=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,n=Po(oo.pth(t)?t.totalLength:t,e)+"";return{original:n,numbers:n.match(i)?n.match(i).map(Number):[0],strings:oo.str(t)||e?n.split(i):[]}}function Zo(t){return mo(t?vo(oo.arr(t)?t.map(bo):bo(t)):[],(function(t,e,i){return i.indexOf(t)===e}))}function Jo(t){var e=Zo(t);return e.map((function(t,i){return{target:t,id:i,total:e.length,transforms:{list:$o(t)}}}))}function ts(t,e){var i=_o(e);if(/^spring/.test(i.easing)&&(i.duration=ao(i.easing)),oo.arr(t)){var n=t.length;2===n&&!oo.obj(t[0])?t={value:t}:oo.fnc(e.duration)||(i.duration=e.duration/n)}var r=oo.arr(t)?t:[t];return r.map((function(t,i){var n=oo.obj(t)&&!oo.pth(t)?t:{value:t};return oo.und(n.delay)&&(n.delay=i?0:e.delay),oo.und(n.endDelay)&&(n.endDelay=i===r.length-1?e.endDelay:0),n})).map((function(t){return xo(t,i)}))}function es(t){for(var e=mo(vo(t.map((function(t){return Object.keys(t)}))),(function(t){return oo.key(t)})).reduce((function(t,e){return t.indexOf(e)<0&&t.push(e),t}),[]),i={},n=function(n){var r=e[n];i[r]=t.map((function(t){var e={};for(var i in t)oo.key(i)?i==r&&(e.value=t[i]):e[i]=t[i];return e}))},r=0;r<e.length;r++)n(r);return i}function is(t,e){var i=[],n=e.keyframes;for(var r in n&&(e=xo(es(n),e)),e)oo.key(r)&&i.push({name:r,tweens:ts(e[r],t)});return i}function ns(t,e){var i={};for(var n in t){var r=Mo(t[n],e);oo.arr(r)&&1===(r=r.map((function(t){return Mo(t,e)}))).length&&(r=r[0]),i[n]=r}return i.duration=parseFloat(i.duration),i.delay=parseFloat(i.delay),i}function rs(t,e){var i;return t.tweens.map((function(n){var r=ns(n,e),o=r.value,s=oo.arr(o)?o[1]:o,a=Co(s),l=Io(e.target,t.name,a,e),c=i?i.to.original:l,h=oo.arr(o)?o[0]:c,d=Co(h)||Co(l),p=a||d;return oo.und(s)&&(s=c),r.from=Qo(h,p),r.to=Qo(Ro(s,h),p),r.start=i?i.end:0,r.end=r.start+r.delay+r.duration+r.endDelay,r.easing=go(r.easing,r.duration),r.isPath=oo.pth(o),r.isPathTargetInsideSVG=r.isPath&&oo.svg(e.target),r.isColor=oo.col(r.from.original),r.isColor&&(r.round=1),i=r,r}))}var os={css:function(t,e,i){return t.style[e]=i},attribute:function(t,e,i){return t.setAttribute(e,i)},object:function(t,e,i){return t[e]=i},transform:function(t,e,i,n,r){if(n.list.set(e,i),e===n.last||r){var o="";n.list.forEach((function(t,e){o+=e+"("+t+") "})),t.style.transform=o}}};function ss(t,e){Jo(t).forEach((function(t){for(var i in e){var n=Mo(e[i],t),r=t.target,o=Co(n),s=Io(r,i,o,t),a=Ro(Po(n,o||Co(s)),s),l=Oo(r,i);os[l](r,i,a,t.transforms,!0)}}))}function as(t,e){var i=Oo(t.target,e.name);if(i){var n=rs(e,t),r=n[n.length-1];return{type:i,property:e.name,animatable:t,tweens:n,duration:r.end,delay:n[0].delay,endDelay:r.endDelay}}}function ls(t,e){return mo(vo(t.map((function(t){return e.map((function(e){return as(t,e)}))}))),(function(t){return!oo.und(t)}))}function cs(t,e){var i=t.length,n=function(t){return t.timelineOffset?t.timelineOffset:0},r={};return r.duration=i?Math.max.apply(Math,t.map((function(t){return n(t)+t.duration}))):e.duration,r.delay=i?Math.min.apply(Math,t.map((function(t){return n(t)+t.delay}))):e.delay,r.endDelay=i?r.duration-Math.max.apply(Math,t.map((function(t){return n(t)+t.duration-t.endDelay}))):e.endDelay,r}var hs=0;function ds(t){var e=wo(Zr,t),i=wo(Jr,t),n=is(i,t),r=Jo(t.targets),o=ls(r,n),s=cs(o,i),a=hs;return hs++,xo(e,{id:a,children:[],animatables:r,animations:o,duration:s.duration,delay:s.delay,endDelay:s.endDelay})}var ps=[],us=function(){var t;function e(){t||gs()&&fs.suspendWhenDocumentHidden||!(ps.length>0)||(t=requestAnimationFrame(i))}function i(e){for(var n=ps.length,r=0;r<n;){var o=ps[r];o.paused?(ps.splice(r,1),n--):(o.tick(e),r++)}t=r>0?requestAnimationFrame(i):void 0}function n(){fs.suspendWhenDocumentHidden&&(gs()?t=cancelAnimationFrame(t):(ps.forEach((function(t){return t._onDocumentVisibility()})),us()))}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",n),e}();function gs(){return!!document&&document.hidden}function fs(t){void 0===t&&(t={});var e,i=0,n=0,r=0,o=0,s=null;function a(t){var e=window.Promise&&new Promise((function(t){return s=t}));return t.finished=e,e}var l=ds(t);a(l);function c(){var t=l.direction;"alternate"!==t&&(l.direction="normal"!==t?"normal":"reverse"),l.reversed=!l.reversed,e.forEach((function(t){return t.reversed=l.reversed}))}function h(t){return l.reversed?l.duration-t:t}function d(){i=0,n=h(l.currentTime)*(1/fs.speed)}function p(t,e){e&&e.seek(t-e.timelineOffset)}function u(t){if(l.reversePlayback)for(var i=o;i--;)p(t,e[i]);else for(var n=0;n<o;n++)p(t,e[n])}function g(t){for(var e=0,i=l.animations,n=i.length;e<n;){var r=i[e],o=r.animatable,s=r.tweens,a=s.length-1,c=s[a];a&&(c=mo(s,(function(e){return t<e.end}))[0]||c);for(var h=io(t-c.start-c.delay,0,c.duration)/c.duration,d=isNaN(h)?1:c.easing(h),p=c.to.strings,u=c.round,g=[],f=c.to.numbers.length,m=void 0,v=0;v<f;v++){var b=void 0,y=c.to.numbers[v],_=c.from.numbers[v]||0;b=c.isPath?Ko(c.value,d*y,c.isPathTargetInsideSVG):_+d*(y-_),u&&(c.isColor&&v>2||(b=Math.round(b*u)/u)),g.push(b)}var w=p.length;if(w){m=p[0];for(var x=0;x<w;x++){p[x];var k=p[x+1],A=g[x];isNaN(A)||(m+=k?A+k:A+" ")}}else m=g[0];os[r.type](o.target,r.property,m,o.transforms),r.currentValue=m,e++}}function f(t){l[t]&&!l.passThrough&&l[t](l)}function m(){l.remaining&&!0!==l.remaining&&l.remaining--}function v(t){var o=l.duration,d=l.delay,p=o-l.endDelay,v=h(t);l.progress=io(v/o*100,0,100),l.reversePlayback=v<l.currentTime,e&&u(v),!l.began&&l.currentTime>0&&(l.began=!0,f("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,f("loopBegin")),v<=d&&0!==l.currentTime&&g(0),(v>=p&&l.currentTime!==o||!o)&&g(o),v>d&&v<p?(l.changeBegan||(l.changeBegan=!0,l.changeCompleted=!1,f("changeBegin")),f("change"),g(v)):l.changeBegan&&(l.changeCompleted=!0,l.changeBegan=!1,f("changeComplete")),l.currentTime=io(v,0,o),l.began&&f("update"),t>=o&&(n=0,m(),l.remaining?(i=r,f("loopComplete"),l.loopBegan=!1,"alternate"===l.direction&&c()):(l.paused=!0,l.completed||(l.completed=!0,f("loopComplete"),f("complete"),!l.passThrough&&"Promise"in window&&(s(),a(l)))))}return l.reset=function(){var t=l.direction;l.passThrough=!1,l.currentTime=0,l.progress=0,l.paused=!0,l.began=!1,l.loopBegan=!1,l.changeBegan=!1,l.completed=!1,l.changeCompleted=!1,l.reversePlayback=!1,l.reversed="reverse"===t,l.remaining=l.loop,e=l.children;for(var i=o=e.length;i--;)l.children[i].reset();(l.reversed&&!0!==l.loop||"alternate"===t&&1===l.loop)&&l.remaining++,g(l.reversed?l.duration:0)},l._onDocumentVisibility=d,l.set=function(t,e){return ss(t,e),l},l.tick=function(t){r=t,i||(i=r),v((r+(n-i))*fs.speed)},l.seek=function(t){v(h(t))},l.pause=function(){l.paused=!0,d()},l.play=function(){l.paused&&(l.completed&&l.reset(),l.paused=!1,ps.push(l),d(),us())},l.reverse=function(){c(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.remove=function(t){vs(Zo(t),l)},l.reset(),l.autoplay&&l.play(),l}function ms(t,e){for(var i=e.length;i--;)yo(t,e[i].animatable.target)&&e.splice(i,1)}function vs(t,e){var i=e.animations,n=e.children;ms(t,i);for(var r=n.length;r--;){var o=n[r],s=o.animations;ms(t,s),s.length||o.children.length||n.splice(r,1)}i.length||n.length||e.pause()}function bs(t){for(var e=Zo(t),i=ps.length;i--;){vs(e,ps[i])}}function ys(t,e){void 0===e&&(e={});var i=e.direction||"normal",n=e.easing?go(e.easing):null,r=e.grid,o=e.axis,s=e.from||0,a="first"===s,l="center"===s,c="last"===s,h=oo.arr(t),d=h?parseFloat(t[0]):parseFloat(t),p=h?parseFloat(t[1]):0,u=Co(h?t[1]:t)||0,g=e.start||0+(h?d:0),f=[],m=0;return function(t,e,v){if(a&&(s=0),l&&(s=(v-1)/2),c&&(s=v-1),!f.length){for(var b=0;b<v;b++){if(r){var y=l?(r[0]-1)/2:s%r[0],_=l?(r[1]-1)/2:Math.floor(s/r[0]),w=y-b%r[0],x=_-Math.floor(b/r[0]),k=Math.sqrt(w*w+x*x);"x"===o&&(k=-w),"y"===o&&(k=-x),f.push(k)}else f.push(Math.abs(s-b));m=Math.max.apply(Math,f)}n&&(f=f.map((function(t){return n(t/m)*m}))),"reverse"===i&&(f=f.map((function(t){return o?t<0?-1*t:-t:Math.abs(m-t)})))}return g+(h?(p-d)/m:d)*(Math.round(100*f[e])/100)+u}}function _s(t){void 0===t&&(t={});var e=fs(t);return e.duration=0,e.add=function(i,n){var r=ps.indexOf(e),o=e.children;function s(t){t.passThrough=!0}r>-1&&ps.splice(r,1);for(var a=0;a<o.length;a++)s(o[a]);var l=xo(i,wo(Jr,t));l.targets=l.targets||t.targets;var c=e.duration;l.autoplay=!1,l.direction=e.direction,l.timelineOffset=oo.und(n)?c:Ro(n,c),s(e),e.seek(l.timelineOffset);var h=fs(l);s(h),o.push(h);var d=cs(o,t);return e.delay=d.delay,e.endDelay=d.endDelay,e.duration=d.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e}fs.version="3.2.1",fs.speed=1,fs.suspendWhenDocumentHidden=!0,fs.running=ps,fs.remove=bs,fs.get=Io,fs.set=ss,fs.convertPx=To,fs.path=Xo,fs.setDashoffset=Wo,fs.stagger=ys,fs.timeline=_s,fs.easing=go,fs.penner=uo,fs.random=function(t,e){return Math.floor(Math.random()*(e-t+1))+t};class ws extends(R(T)){static get properties(){return Object.assign({src:{type:String},odd:{type:String,reflect:!0},view:{type:String,reflect:!0},nodeId:{type:String,reflect:!0,attribute:"node-id"},xmlId:{type:Array,reflect:!0,attribute:"xml-id"},xpath:{type:String,reflect:!0},map:{type:String},onUpdate:{type:Boolean,attribute:"on-update"},notFound:{type:String,attribute:"not-found"},url:{type:String},static:{type:String},appendFootnotes:{type:Boolean,attribute:"append-footnotes"},suppressHighlight:{type:Boolean,attribute:"suppress-highlight",reflect:!0},columnSeparator:{type:String,attribute:"column-separator"},direction:{type:String},loadCss:{type:String,attribute:"load-css"},fixLinks:{type:Boolean,attribute:"fix-links"},useLanguage:{type:Boolean,attribute:"use-language"},animation:{type:Boolean},infiniteScroll:{type:Boolean,attribute:"infinite-scroll"},infiniteScrollMax:{type:Number,attribute:"infinite-scroll-max"},waitFor:{type:String,attribute:"wait-for"},disableHistory:{type:Boolean,attribute:"disable-history"},beforeUpdate:{type:String,attribute:"before-update-event"},noScroll:{type:Boolean,attribute:"no-scroll"},_features:{type:Object},_content:{type:Node,attribute:!1},_column1:{type:Node,attribute:!1},_column2:{type:Node,attribute:!1},_footnotes:{type:Node,attribute:!1},_style:{type:Node,attribute:!1}},super.properties)}constructor(){super(),this.src=null,this.url=null,this.onUpdate=!1,this.appendFootnotes=!1,this.notFound="the server did not return any content",this.animation=!1,this.direction="ltr",this.suppressHighlight=!1,this.highlight=!1,this.infiniteScrollMax=10,this.disableHistory=!1,this.beforeUpdate=null,this.noScroll=!1,this._features={},this._selector=new Map,this._chunks=[],this._scrollTarget=null,this.static=null}attributeChangedCallback(t,e,i){switch(super.attributeChangedCallback(t,e,i),t){case"src":this._updateSource(i,e)}}connectedCallback(){if(super.connectedCallback(),this.infiniteScroll&&(this.columnSeparator=null,this.animation=!1,this._content=document.createElement("div"),this._content.className="infinite-content"),!this.disableHistory){const t=this.getParameter("id");t&&!this.xmlId&&(this.xmlId=t);const e=this.getParameter("action");e&&"search"===e&&(this.highlight=!0);const i=this.getParameter("root");"single"===this.view?this.nodeId=null:i&&!this.nodeId&&(this.nodeId=i)}this.waitFor||(this.waitFor="pb-toggle-feature,pb-select-feature,pb-navigation"),this.subscribeTo("pb-navigate",t=>{t.detail.source&&t.detail.source===this||this.navigate(t.detail.direction)}),this.subscribeTo("pb-refresh",this._refresh.bind(this)),this.subscribeTo("pb-toggle",t=>{this.toggleFeature(t)}),this.subscribeTo("pb-zoom",t=>{this.zoom(t.detail.direction)}),this.subscribeTo("pb-i18n-update",t=>{const e=this._features.language&&this._features.language!==t.detail.language;this._features.language=t.detail.language,this.useLanguage&&e&&this._refresh()},[]),this.signalReady(),this.onUpdate&&this.subscribeTo("pb-update",this._refresh.bind(this))}disconnectedCallback(){super.disconnectedCallback(),this._scrollObserver&&this._scrollObserver.disconnect()}firstUpdated(){super.firstUpdated(),this.enableScrollbar(!0),this.infiniteScroll&&(this._topObserver=this.shadowRoot.getElementById("top-observer"),this._bottomObserver=this.shadowRoot.getElementById("bottom-observer"),this._bottomObserver.style.display="none",this._topObserver.style.display="none",this._scrollObserver=new IntersectionObserver(t=>{this._content&&t.forEach(t=>{if(t.isIntersecting)if("bottom-observer"===t.target.id){const t=this._content.lastElementChild;if(t){const e=t.getAttribute("data-next");e&&!this._content.querySelector(`[data-root="${e}"]`)&&(console.log("<pb-view> Loading next page: %s",e),this._checkChunks("forward"),this._load(e,"forward"))}}else{const t=this._content.firstElementChild;if(t){const e=t.getAttribute("data-previous");e&&!this._content.querySelector(`[data-root="${e}"]`)&&(this._checkChunks("backward"),this._load(e,"backward"))}}})})),this.onUpdate||ws.waitOnce("pb-page-ready",t=>{t&&t.language&&(this._features.language=t.language),this.wait(()=>this._refresh())})}getOdd(){return this.odd||this.getDocument().odd||"teipublisher"}getView(){return this.view||this.getDocument().view||"single"}forceUpdate(){this._load(this.nodeId)}animate(){this.animation&&("forward"===this.lastDirection?fs({targets:this.shadowRoot.getElementById("view"),opacity:[0,1],translateX:[1e3,0],duration:300,easing:"linear"}):fs({targets:this.shadowRoot.getElementById("view"),opacity:[0,1],translateX:[-1e3,0],duration:300,easing:"linear"}))}enableScrollbar(t){t?this.classList.add("noscroll"):this.classList.remove("noscroll")}_refresh(t){if(t&&t.detail){if(t.detail.hash&&!this.noScroll&&!(t.detail.id||t.detail.path||t.detail.odd||t.detail.view||t.detail.position)){this._scrollTarget=t.detail.hash;const e=this.shadowRoot.getElementById(this._scrollTarget);return void(e&&setTimeout(()=>e.scrollIntoView({block:"nearest"})))}if(t.detail.path){this.getDocument().path=t.detail.path}t.detail.id&&(this.xmlId=t.detail.id),this.odd=t.detail.odd||this.odd,void 0!==t.detail.columnSeparator&&(this.columnSeparator=t.detail.columnSeparator),this.view=t.detail.view||this.view,t.detail.xpath&&(this.xpath=t.detail.xpath,this.nodeId=null),null===t.detail.position?this.nodeId=null:this.nodeId=t.detail.position||this.nodeId,this.noScroll||(this._scrollTarget=t.detail.hash)}this._updateStyles(),this.infiniteScroll&&this._clear(),this._load(this.nodeId)}_load(t,e){if(!this.getDocument().path)return void console.log("No path");if(this._loading)return;this._loading=!0;const i=this.getParameters(t);e&&(i._dir=e),this._doLoad(i)}_doLoad(t){this.emitTo("pb-start-update",t),console.log("<pb-view> Loading view with params %o",t),this.infiniteScroll||this._clear(),this._scrollObserver&&(this._bottomObserver&&this._scrollObserver.unobserve(this._bottomObserver),this._topObserver&&this._scrollObserver.unobserve(this._topObserver));const e=this.shadowRoot.getElementById("loadContent");null!==this.static?this._staticUrl(t).then(t=>{e.url=t,e.generateRequest()}):(this.url||(this.minApiVersion("1.0.0")?this.url="api/parts":this.url="modules/lib/components.xql"),this.minApiVersion("1.0.0")?e.url=`${this.getEndpoint()}/${this.url}/${encodeURIComponent(this.getDocument().path)}/json`:e.url=`${this.getEndpoint()}/${this.url}`,e.params=t,e.generateRequest())}async _staticUrl(t){function e(e){const i=[];return e.sort().forEach(e=>{t.hasOwnProperty(e)&&i.push(`${e}=${t[e]}`)}),i.join("&")}const i=await fetch("index.json").then(t=>t.json()),n=["odd","view","xpath","map"];this.querySelectorAll("pb-param").forEach(t=>n.push("user."+t.getAttribute("name")));let r=t.id?e([...n,"id"]):e([...n,"root"]),o=i[r];return o||(r=e(n),o=i[r]),console.log("<pb-view> Static lookup %s: %s",r,o),""+o}_clear(){this.infiniteScroll?(this._content=document.createElement("div"),this._content.className="infinite-content"):this._content=null,this._column1=null,this._column2=null,this._footnotes=null,this._chunks=[]}_handleError(){this._clear();const t=this.shadowRoot.getElementById("loadContent");let e;const{response:i}=t.lastError;e=i?i.description:'<pb-i18n key="dialogs.serverError"></pb-i18n>';const n=`\n <p>${this.notFound}</p>\n <p><pb-i18n key="dialogs.serverError"></pb-i18n>: ${e} </p>\n `;this._replaceContent({content:n}),this.emitTo("pb-end-update")}_handleContent(){const t=this.shadowRoot.getElementById("loadContent"),e=t.lastResponse;if(e){if(e.error)return this.notFound&&(this._content=this.notFound),void this.emitTo("pb-end-update",null);this._replaceContent(e,t.params._dir),this.animate(),this._scrollTarget&&this.updateComplete.then(()=>{const t=this.shadowRoot.getElementById(this._scrollTarget)||this.shadowRoot.querySelector(`[node-id="${this._scrollTarget}"]`);t&&window.requestAnimationFrame(()=>setTimeout(()=>{t.scrollIntoView({block:"nearest"})},400)),this._scrollTarget=null}),this.next=e.next,this.nextId=e.nextId,this.previous=e.previous,this.previousId=e.previousId,this.nodeId=e.root,this.switchView=e.switchView,this.disableHistory||!this.xmlId||this.map||(this.setParameter("id",this.xmlId),this.pushHistory("Navigate to xml:id")),this.xmlId=null,this.updateComplete.then(()=>{const i=this.shadowRoot.getElementById("view");this._applyToggles(i),this._fixLinks(i),an(i);const n={data:e,root:i,params:t.params,id:this.xmlId,position:this.nodeId};this.emitTo("pb-update",n),this._scroll()}),this.emitTo("pb-end-update",null)}else console.error("<pb-view> No response received")}_replaceContent(t,e){const i=document.createDocumentFragment(),n=document.createElement("div");i.appendChild(n),n.innerHTML=t.content,this.beforeUpdate?this.emitTo(this.beforeUpdate,{data:t,root:n,render:i=>{this._doReplaceContent(i,t,e)}}):this._doReplaceContent(n,t,e)}_doReplaceContent(t,e,i){if(this.columnSeparator)this._replaceColumns(t),this._loading=!1;else if(this.infiniteScroll){let n;switch(t.className="scroll-fragment",t.setAttribute("data-root",e.root),e.next&&t.setAttribute("data-next",e.next),e.previous&&t.setAttribute("data-previous",e.previous),i){case"backward":n=this._content.firstElementChild,this._chunks.unshift(t),this.updateComplete.then(()=>{n.scrollIntoView(!0),this._loading=!1,this._checkVisibility(),this._scrollObserver.observe(this._bottomObserver),this._scrollObserver.observe(this._topObserver)}),this._content.insertBefore(t,n);break;default:this.updateComplete.then(()=>{this._loading=!1,this._checkVisibility(),this._scrollObserver.observe(this._bottomObserver),this._scrollObserver.observe(this._topObserver)}),this._chunks.push(t),this._content.appendChild(t)}}else this._content=t,this._loading=!1;if(this.appendFootnotes){const t=document.createElement("div");e.footnotes&&(t.innerHTML=e.footnotes),this._footnotes=t}return this._initFootnotes(this._footnotes),t}_checkVisibility(){const t=this._chunks[this._chunks.length-1].hasAttribute("data-next");this._bottomObserver.style.display=t?"":"none";const e=this._chunks[0].hasAttribute("data-previous");this._topObserver.style.display=e?"":"none"}_replaceColumns(t){let e;if(this.columnSeparator){const i=t.querySelectorAll(this.columnSeparator);i.length>1&&(e=i[i.length-1])}if(e){const i=this._getFragmentBefore(t,e),n=this._getFragmentAfter(t,e);"ltr"===this.direction?(this._column1=i,this._column2=n):(this._column2=i,this._column1=n)}else this._content=t}_scroll(){if(this.noScroll)return;const{hash:t}=this.getUrl();if(t){const e=this.shadowRoot.getElementById(t.substring(1));console.log("hash target: %o",e),e&&window.requestAnimationFrame(()=>setTimeout(()=>{e.scrollIntoView({block:"nearest"})},400))}}_scrollToElement(t,e){const i=this.shadowRoot.getElementById(e.hash.substring(1));i&&(t.preventDefault(),console.log("<pb-view> Scrolling to element %s",i.id),i.scrollIntoView({block:"center",inline:"nearest"}))}_updateStyles(){const t=[];let e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),null!==this.static?e.setAttribute("href",`${this.static}/css/${this.getOdd()}.css`):e.setAttribute("href",`${this.getEndpoint()}/transform/${this.getOdd()}.css`),t.push(e),this.loadCss&&(e=document.createElement("link"),e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),e.setAttribute("href",this.toAbsoluteURL(this.loadCss)),t.push(e)),this._style=t}_fixLinks(t){if(this.fixLinks){const e=this.getDocument(),i=this.toAbsoluteURL(e.path);t.querySelectorAll("img").forEach(t=>{const e=t.getAttribute("src"),n=new URL(e,i);t.src=n}),t.querySelectorAll("a").forEach(t=>{const e=t.getAttribute("href");if(e===t.hash)t.addEventListener("click",e=>this._scrollToElement(e,t));else{const n=new URL(e,i);t.href=n}})}else t.querySelectorAll("a").forEach(t=>{t.getAttribute("href")===t.hash&&t.addEventListener("click",e=>this._scrollToElement(e,t))})}_initFootnotes(t){t&&t.querySelectorAll(".note, .fn-back").forEach(t=>{t.addEventListener("click",e=>{e.preventDefault();const i=this.shadowRoot.getElementById("content").querySelector(t.hash);i&&i.scrollIntoView()})})}_getParameters(){const t=[];this.querySelectorAll("pb-param").forEach((function(e){t["user."+e.getAttribute("name")]=e.getAttribute("value")}));for(const[e,i]of Object.entries(this._features))t["user."+e]=i;return t}getParameters(t){t=t||this.nodeId;const e=this.getDocument(),i=this._getParameters();return this.minApiVersion("1.0.0")||(i.doc=e.path),i.odd=this.getOdd()+".odd",i.view=this.getView(),t&&(i.root=t),this.xpath&&(i.xpath=this.xpath),this.xmlId&&(i.id=this.xmlId),!this.suppressHighlight&&this.highlight&&(i.highlight="yes"),this.map&&(i.map=this.map),i}_applyToggles(t){0!==this._selector.size&&this._selector.forEach((e,i)=>{t.querySelectorAll(i).forEach(t=>{const i=e.command||"toggle";t.command&&t.command(i,e.state),e.state?t.classList.add(i):t.classList.remove(i)})})}goto(t){this._load(t)}gotoId(t){this.xmlId=t,this._load()}navigate(t){this.lastDirection=t,"backward"===t?this.previous&&(this.disableHistory||this.map||(this.previousId?this.setParameter("id",this.previousId):this.setParameter("root",this.previous),this.pushHistory("Navigate backward")),this._load(this.previous,t)):this.next&&(this.disableHistory||this.map||(this.nextId?this.setParameter("id",this.nextId):this.setParameter("root",this.next),this.pushHistory("Navigate forward")),this._load(this.next,t))}_checkChunks(t){if(this.infiniteScroll&&0!==this.infiniteScrollMax){if(this._chunks.length===this.infiniteScrollMax)switch(t){case"forward":this._content.removeChild(this._chunks.shift());break;default:this._content.removeChild(this._chunks.pop())}this.emitTo("pb-navigate",{direction:t,source:this})}}zoom(t){const e=this.shadowRoot.getElementById("view"),i=window.getComputedStyle(e).getPropertyValue("font-size"),n=parseInt(i.replace(/^(\d+)px/,"$1"));e.style.fontSize="in"===t?n+1+"px":n-1+"px"}toggleFeature(t){const e=()=>{const t=this.shadowRoot.getElementById("view");this._applyToggles(t)},i=t.detail.properties;for(const[t,e]of Object.entries(i))switch(t){case"odd":case"view":case"columnSeparator":case"xpath":case"nodeId":break;default:this._features[t]=e}i&&(i.odd&&(this.odd=i.odd),i.view&&(this.view=i.view,"single"===this.view?this.nodeId=null:this.nodeId=this.switchView),i.xpath&&(this.xpath=i.xpath),i.hasOwnProperty("columnSeparator")&&(this.columnSeparator=i.columnSeparator)),t.detail.selectors&&t.detail.selectors.forEach(t=>{this._selector.set(t.selector,{state:t.state,command:t.command||"toggle"})}),"refresh"===t.detail.action&&(Object.keys(i).length>0?(this._updateStyles(),this._load()):e())}_getFragmentBefore(t,e){const i=document.createRange();return i.setStartBefore(t),i.setEndBefore(e),i.cloneContents()}_getFragmentAfter(t,e){const i=document.createRange();return i.setStartBefore(e),i.setEndAfter(t),i.cloneContents()}_updateSource(t,e){void 0!==e&&t!==e&&(this.xpath=null,this.odd=null,this.xmlId=null,this.nodeId=null)}static get styles(){return V`
|
|
1093
1093
|
:host {
|
|
1094
1094
|
display: block;
|
|
1095
1095
|
background: transparent;
|
|
@@ -1196,24 +1196,24 @@ e({_template:n`
|
|
|
1196
1196
|
0% {opacity:0;}
|
|
1197
1197
|
100% {opacity:1;}
|
|
1198
1198
|
}
|
|
1199
|
-
`}render(){return[
|
|
1199
|
+
`}render(){return[O`
|
|
1200
1200
|
<div id="view" part="content">
|
|
1201
1201
|
${this._style}
|
|
1202
|
-
${this.infiniteScroll?
|
|
1202
|
+
${this.infiniteScroll?O`<div id="top-observer" class="observer"></div>`:null}
|
|
1203
1203
|
<div class="columns">
|
|
1204
1204
|
<div id="column1">${this._column1}</div>
|
|
1205
1205
|
<div id="column2">${this._column2}</div>
|
|
1206
1206
|
</div>
|
|
1207
1207
|
<div id="content">${this._content}</div>
|
|
1208
|
-
${this.infiniteScroll?
|
|
1208
|
+
${this.infiniteScroll?O`<div id="bottom-observer" class="observer"></div>`:null}
|
|
1209
1209
|
<div id="footnotes" part="footnotes">${this._footnotes}</div>
|
|
1210
1210
|
</div>
|
|
1211
1211
|
<paper-dialog id="errorDialog">
|
|
1212
|
-
<h2>${
|
|
1212
|
+
<h2>${F("dialogs.error")}</h2>
|
|
1213
1213
|
<paper-dialog-scrollable></paper-dialog-scrollable>
|
|
1214
1214
|
<div class="buttons">
|
|
1215
1215
|
<paper-button dialog-confirm="dialog-confirm" autofocus="autofocus">
|
|
1216
|
-
${
|
|
1216
|
+
${F("dialogs.close")}
|
|
1217
1217
|
</paper-button>
|
|
1218
1218
|
</div>
|
|
1219
1219
|
</paper-dialog>
|
|
@@ -1225,7 +1225,7 @@ e({_template:n`
|
|
|
1225
1225
|
with-credentials
|
|
1226
1226
|
@response="${this._handleContent}"
|
|
1227
1227
|
@error="${this._handleError}"></iron-ajax>
|
|
1228
|
-
`]}}customElements.define("pb-view",ws);const xs=[0,100],ks=[0,100],As=t=>`${1===t.length?"0":""}${t}`,zs=(t,e,i)=>Math.max(Math.min(t,i),e),Ss=(t,e)=>Math.floor(Math.random()*(e-t+1))+t,Cs=t=>{const e=t.length;let i=0;for(let n=0;n<e;n++)i=(i<<5)-i+t.charCodeAt(n),i&=i;return i},Es=(t,e)=>"number"==typeof e?e:t%Math.abs(e[1]-e[0])+e[0],Ms=(t,e)=>"number"==typeof t?zs(Math.abs(t),...e):1===t.length||t[0]===t[1]?zs(Math.abs(t[0]),...e):[Math.abs(zs(t[0],...e)),zs(Math.abs(t[1]),...e)],Ls=(t,e,i)=>(i<0?i+=1:i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t),Ts=(t,e,i)=>{let n,r,o;if(t/=360,i/=100,0===(e/=100))n=r=o=i;else{const s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;n=Ls(a,s,t+1/3),r=Ls(a,s,t),o=Ls(a,s,t-1/3)}return[Math.round(255*n),Math.round(255*r),Math.round(255*o)]},Hs=(t,e,i,n)=>(299*t+587*e+114*i)/1e3>=n,Os=(t,e,i)=>`hsl(${t}, ${e}%, ${i}%)`,$s=(t,e,i,n)=>{switch(n){case"rgb":return`rgb(${t}, ${e}, ${i})`;case"hex":default:return`#${As(t.toString(16))}${As(e.toString(16))}${As(i.toString(16))}`}},Vs=(t,{format:e="hex",saturation:i=[50,55],lightness:n=[50,60],differencePoint:r=130}={})=>{const o=Math.abs(Cs(String(t))),s=Es(o,[0,360]),a=Es(o,Ms(i,xs)),l=Es(o,Ms(n,ks)),[c,h,d]=Ts(s,a,l);return{color:"hsl"===e?Os(s,a,l):$s(c,h,d,e),isLight:Hs(c,h,d,r)}};function Is(t,e){let i=t;for(;i.parentNode!==e;)i=i.parentElement;return i}function Rs(t){let e=t;e.nodeType===Node.TEXT_NODE&&(e=e.parentNode);const i=e.getAttribute("href");return i&&/^#fn_.*$/.test(i)}function Ps(t,e,i){const n=document.createTreeWalker(t);for(n.currentNode=e;n.previousNode();){const t=n.currentNode;t.nodeType===Node.ELEMENT_NODE||Rs(t)||(i+=t.textContent.length)}return i}function Ds(t,e,i="start"){if(t.nodeType===Node.ELEMENT_NODE){const n=t.closest("[data-tei]");if(0===e)return{parent:n.getAttribute("data-tei"),offset:0};const r=n.childNodes[e];return{parent:n.getAttribute("data-tei"),offset:"end"===i?Ps(n,r,0)-1:Ps(n,r,0)}}const n=t.parentNode.closest("[data-tei]");if(n)return{parent:n.getAttribute("data-tei"),offset:Ps(n,t,e)};console.error("No container with data-tei found for %o",t.parentNode)}function Ns(t,e){let i=0,n=t.parentNode;for(;n&&n!==t.getRootNode();)n.classList.contains(e)&&(i+=1),n=n.parentNode;return i}function Fs(t,e){const i=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);return i.currentNode=e,i.nextNode()?i.currentNode:e}function Bs(t,e){let i=e;const n=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(;n.nextNode();)if(!Rs(n.currentNode)&&n.currentNode.textContent.length>0){if(i-n.currentNode.textContent.length<=0)return[n.currentNode,i];i-=n.currentNode.textContent.length}return null}function js(t,e,i,n=3){let r=e-1,o=0;for(;r>=0;){if(/[\p{P}\s]/.test(t.charAt(r))){for(;r>1&&/[\p{P}\s]/.test(t.charAt(r-1));)r-=1;if(o+=1,o===n)break}r-=1}let s=i+1;for(o=0;s<t.length;){if(/[\p{P}\s]/.test(t.charAt(s))){for(;s<t.length-1&&/[\p{P}\s]/.test(t.charAt(s+1));)s+=1;if(o+=1,o===n)break}s+=1}return`... ${t.substring(r,e)}<mark>${t.substring(e,i)}</mark>${t.substring(i,s+1)} ...`}function qs(t){let e=t.parentElement;e.textContent.length<40&&(e=e.parentNode);const i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let n=0,r=0;const o=[];for(;i.nextNode();)i.currentNode===t&&(r=n),n+=i.currentNode.textContent.length,o.push(i.currentNode.textContent);return[o.join(""),r]}function Us(t){const e={};return Object.keys(t.properties).forEach(i=>{const n=t.properties[i];n&&n.length>0&&(e[i]=n)}),Object.assign(t,{properties:e})}Vs.random=({format:t="hex",saturation:e=[50,55],lightness:i=[50,60],differencePoint:n=130}={})=>{e=Ms(e,xs),i=Ms(i,ks);const r=Ss(0,360),o="number"==typeof e?e:Ss(...e),s="number"==typeof i?i:Ss(...i),[a,l,c]=Ts(r,o,s);return{color:"hsl"===t?Os(r,o,s):$s(a,l,c,t),isLight:Hs(a,l,c,n)}};class Ws extends ws{static get properties(){return Object.assign({key:{type:String},keyMap:{type:Object,attribute:"key-map"},caseSensitive:{type:Boolean}},super.properties)}constructor(){super(),this.key="ref",this.keyMap={},this.caseSensitive=!1,this._ranges=[],this._rangesMap=new Map,this._history=[]}connectedCallback(){super.connectedCallback();let t=!1;this._inHandler=!1,this._pendingCallback=null;const e=(t=10)=>{this._pendingCallback=setTimeout(()=>{this._selectionChanged()},t)};this._eventHandler=i=>{if("selectionchange"===i.type&&this._inHandler)return;if("mousedown"===i.type&&(t=!0),"mouseup"===i.type&&(t=!1),t)return;this._cancelPendingCallback();const n="mouseup"===i.type?10:100;e(n)},document.addEventListener("selectionchange",this._eventHandler.bind(this)),this.shadowRoot.addEventListener("mousedown",this._eventHandler.bind(this)),this.shadowRoot.addEventListener("mouseup",this._eventHandler.bind(this)),this.subscribeTo("pb-add-annotation",t=>this.addAnnotation(t.detail)),this.subscribeTo("pb-edit-annotation",this._editAnnotation.bind(this)),this.subscribeTo("pb-refresh",()=>{this._ranges=[],this._rangesMap.clear(),this._currentSelection=null,this._clearMarkers(),this.emitTo("pb-annotations-changed",{ranges:this._ranges,refresh:!0})}),this._resizeHandler()}get annotations(){return this._ranges}set annotations(t){this._ranges=t,this.updateAnnotations(!0),this._initAnnotationColors(),this._annotationStyles()}saveHistory(){this._history.push(JSON.stringify(this._ranges)),this.emitTo("pb-annotations-history",this._history)}getHistory(){return this._history}popHistory(){if(0===this._history.length)return void console.warn("<pb-view-annotate> history is empty");this._scrollTop=this.scrollTop;const t=this._history.pop();this._clearMarkers(),this._ranges=JSON.parse(t),this._rangesMap.clear(),this._refresh(),this.emitTo("pb-annotations-changed",{ranges:this._ranges}),this.emitTo("pb-annotations-history",this._history)}clearHistory(t){this._history=t||[]}firstUpdated(){super.firstUpdated(),this.enableScrollbar(!1),Zi(this.shadowRoot,"light-border")}render(){return[...super.render(),R`<div id="marker-layer"></div>`]}zoom(t){super.zoom(t),window.requestAnimationFrame(()=>this.refreshMarkers())}getKey(t){return this.keyMap[t]||this.key}_resizeHandler(){let t=null;const e=()=>{t=setTimeout(()=>{t=null,this.refreshMarkers()},200)};window.addEventListener("resize",()=>{t||this._clearMarkers(),t&&clearTimeout(t),e()})}_refresh(t){super._refresh(t),t&&t.detail&&t.detail.preserveScroll&&(this._scrollTop=this.scrollTop)}_handleContent(){super._handleContent(),this.updateComplete.then(()=>setTimeout(()=>{this._initAnnotationColors(),this._annotationStyles(),this.updateAnnotations(),this._markIncompleteAnnotations(),this._scrollTop&&(this.scrollTop=this._scrollTop,this._scrollTop=void 0)},300))}_updateAnnotation(t,e=!1,i=!1){const n=this.shadowRoot.getElementById("view"),r=Array.from(n.querySelectorAll(`[data-tei="${t.context}"]`)).filter(t=>null===t.closest("pb-popover")&&"footnote"!==t.getAttribute("rel"))[0];if(!r)return null;const o=document.createRange(),s=Bs(r,t.start),a=Bs(r,t.end);if(!s||!a)return console.error("<pb-view-annotate> Invalid range for %o",r),null;if(console.log("<pb-view-annotate> Range before adjust: %o %o",s,a),s[1]===s[0].textContent.length){const t=Fs(r,s[0]);t===a[0]?(o.setStart(t,0),s[0]=t,s[1]=0):o.setStartBefore(s[0].nextSibling||t)}else s[0]!==a[0]&&0===s[1]?o.setStartBefore(Is(s[0],r)):o.setStart(s[0],s[1]);s[0]!==a[0]&&a[0].textContent.length-1===a[1]?o.setEndAfter(Is(a[0],r)):o.setEnd(a[0],a[1]),console.log("<pb-view-annotate> Range: %o",o);const l=document.createElement("span"),c=""===t.properties[this.getKey(t.type)]?"incomplete":"";l.className=`annotation annotation-${t.type} ${t.type} ${c}`,l.dataset.type=t.type,l.dataset.annotation=JSON.stringify(t.properties);try{o.surroundContents(l)}catch(t){if(e)return null;throw new Error("An error occurred. The annotation may not be displayed. You should consider saving and reloading the document.")}return this._rangesMap.set(l,t),i||this.refreshMarkers(),l}updateAnnotations(t=!1){this._ranges.forEach(e=>{let i;switch(e.type){case"delete":i=this.shadowRoot.querySelector(`[data-tei="${e.node}"]`),i?this._deleteAnnotation(i):console.error("Annotation %s not found",e.context);break;case"modify":i=this.shadowRoot.querySelector(`[data-tei="${e.node}"]`),i.dataset.annotation=JSON.stringify(e.properties);break;default:this._updateAnnotation(e,t,!0)}}),window.requestAnimationFrame(()=>this.refreshMarkers())}_getSelection(){return this.shadowRoot.getSelection?this.shadowRoot.getSelection():window.getSelection()}_selectionChanged(){const t=this._getSelection(),e=this._selectedRange(t);if(e){let i=!1;const n=e.commonAncestorContainer;if(n.nodeType===Node.ELEMENT_NODE){if(e.startContainer.parentElement!==n){const t=Is(e.startContainer,n);e.setStartBefore(t),i=!0}if(e.endContainer.parentElement!==n){const t=Is(e.endContainer,n);e.setEndAfter(t),i=!0}}this._currentSelection=e,console.log("<pb-view-annotate> selection: %o",e),i&&(this._inHandler=!0,setTimeout(()=>{t.removeAllRanges(),t.addRange(e),this.inHandler=!1},100)),this.emitTo("pb-selection-changed",{hasContent:!0,range:e})}else this.emitTo("pb-selection-changed",{hasContent:!1})}updateAnnotation(t,e=!1){t=Us(t);const i=this._updateAnnotation(t,e);return i&&(this._ranges.push(t),this.emitTo("pb-annotations-changed",{type:t.type,text:t.text,ranges:this._ranges})),i}addAnnotation(t){const e=t.range||this._currentSelection,i=Ds(e.startContainer,e.startOffset),n=Ds(e.endContainer,e.endOffset,"end"),r={context:i.parent,start:i.offset,end:n.offset,text:e.cloneContents().textContent};return t.type&&(r.type=t.type),t.properties&&(r.properties=t.properties),console.log("<pb-view-annotate> range adjusted: %o",r),this._ranges.push(Us(r)),this.emitTo("pb-annotations-changed",{type:r.type,text:r.text,ranges:this._ranges}),this._checkAnnotationColor(r.type),this._updateAnnotation(r)}deleteAnnotation(t){if(t.dataset.tei){const e=this._ranges.findIndex(e=>"modify"===e.type&&e.node===t.dataset.tei);e>-1&&this._ranges.splice(e,1);const i=t.parentNode.closest("[data-tei]"),n={type:"delete",node:t.dataset.tei,context:i.dataset.tei};this._ranges.push(n)}else{const e=this._rangesMap.get(t);this._rangesMap.delete(t);const i=this._ranges.indexOf(e);console.log("<pb-view-annotate> deleting annotation %o",e),this._ranges.splice(i,1)}this._deleteAnnotation(t)}_deleteAnnotation(t){const e=document.createRange();for(let i=0;i<t.childNodes.length;i++){const n=t.childNodes[i].cloneNode(!0);t.parentNode.insertBefore(n,t),0===i&&e.setStartBefore(n),i===t.childNodes.length-1&&e.setEndAfter(n)}t.parentNode.removeChild(t),this.emitTo("pb-annotations-changed",{ranges:this._ranges}),window.requestAnimationFrame(()=>this.refreshMarkers());const i=this._getSelection();i.removeAllRanges(),i.addRange(e)}editAnnotation(t,e){if("edit"===t.dataset.type){let i=this._rangesMap.get(t);i?(i.properties=e,i=Us(i),this.emitTo("pb-annotations-changed",{ranges:this._ranges})):console.error("no range found for edit span %o",t)}else if(t.dataset.tei){const i=t.closest("[data-tei]");let n=this._ranges.find(e=>"modify"===e.type&&e.node===t.dataset.tei);n||(n={type:"modify",node:t.dataset.tei,context:i.dataset.tei},this._ranges.push(n)),n.properties=e,n=Us(n),this.emitTo("pb-annotations-changed",{ranges:this._ranges})}const i=JSON.parse(t.dataset.annotation),n=Object.assign(i||{},e);t.dataset.annotation=JSON.stringify(n),""!==n[this.getKey(t.dataset.type)]&&t.classList.remove("incomplete")}_editAnnotation(t){this.editAnnotation(t.detail.target,t.detail.properties)}_selectedRange(t){if(!t||0===t.rangeCount)return null;if(t.anchorNode.getRootNode()!==this.shadowRoot)return null;const e=t.getRangeAt(0);return e.collapsed?null:e}_cancelPendingCallback(){this._pendingCallback&&(clearTimeout(this._pendingCallback),this._pendingCallback=null)}_createTooltip(t){if(t._tippy||!t.dataset.annotation)return;const e=document.createElement("div");e.className="annotation-popup";const i=document.createElement("div");i.className="info",e.appendChild(i);const n=document.createElement("div");n.className="toolbar";const r=document.createElement("span");if(r.className="annotation-type",n.appendChild(r),t.dataset.annotation){const e=document.createElement("paper-icon-button");e.setAttribute("icon","icons:create"),e.setAttribute("title",a("annotations.edit")),e.addEventListener("click",()=>{const e=JSON.parse(t.dataset.annotation);this.emitTo("pb-annotation-edit",Object.assign({},{target:t,type:t.dataset.type,properties:e}))}),n.appendChild(e)}const o=document.createElement("paper-icon-button");o.setAttribute("icon","icons:delete"),o.setAttribute("title",a("annotations.delete")),o.addEventListener("click",()=>{this.saveHistory(),this.deleteAnnotation(t)}),n.appendChild(o),e.appendChild(n);const s=this.shadowRoot.getElementById("view");ji(t,{content:e,allowHTML:!0,interactive:!0,appendTo:s.nodeType===Node.DOCUMENT_NODE?document.body:s,theme:"light-border",hideOnClick:!1,maxWidth:"auto",trigger:"click",placement:"left",popperOptions:{modifiers:[{name:"flip",options:{fallbackPlacements:["right","top","bottom"]}}]},onTrigger:(e,n)=>{n.preventDefault(),n.stopPropagation();const o=t.dataset.type,s=JSON.parse(t.dataset.annotation)||{},l=this._annotationColors.get(o);if(r.innerHTML=o,r.style.backgroundColor=`var(--pb-annotation-${o})`,r.style.color=`var(${l&&l.isLight?"--pb-color-primary":"--pb-color-inverse"})`,s[this.getKey(o)])this.emitTo("pb-annotation-detail",{type:o,id:s[this.getKey(o)],container:i,span:t});else{i.innerHTML="";const t=Object.keys(s);if(0===t.length){const t=document.createElement("p");t.innerHTML=a("annotations.no-properties"),i.appendChild(t)}else{const e=document.createElement("table");t.forEach(t=>{const i=document.createElement("tr"),n=document.createElement("td");n.innerHTML=t,i.appendChild(n);const r=document.createElement("td");r.innerHTML=JSON.stringify(s[t],null,2),i.appendChild(r),e.appendChild(i)}),i.appendChild(e)}}},onClickOutside:(t,e)=>{t.hideWithInteractivity(e)}})}_showMarker(t,e,i,n=0){const r=t.getClientRects(),o=t.dataset.type;for(let t=0;t<r.length;t++){const s=r[t],a=document.createElement("div");a.className="marker annotation-"+o,a.style.position="absolute",a.style.left=s.left-i.left+"px",a.style.top=s.top-i.top+s.height+"px",a.style.marginTop=n+"px",a.style.width=s.width+"px",a.style.height="3px",a.style.backgroundColor=`var(--pb-annotation-${o})`,a.part="annotation",e.appendChild(a)}this._createTooltip(t)}_clearMarkers(){this.shadowRoot.getElementById("marker-layer").innerHTML=""}refreshMarkers(){const t=this.shadowRoot.getElementById("view"),e=t.getBoundingClientRect(),i=this.shadowRoot.getElementById("marker-layer");i.style.display="none",this._clearMarkers(),t.querySelectorAll(".annotation").forEach(t=>{t._tippy&&t._tippy.destroy(),this._showMarker(t,i,e,5*Ns(t,"annotation"))}),i.style.display="block"}search(t,e){function i(t){let e=t.replace(/[/.?+*\\]/g,t=>"\\"+t).replace(/[\s\n\t]+/g,"\\s+");return/^\w/.test(e)&&(e="\\b"+e),/\w$/.test(e)&&(e+="\\b"),e}function n(t){return t.nodeType===Node.TEXT_NODE?NodeFilter.FILTER_ACCEPT:t.classList.contains("annotation-popup")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_SKIP}n.acceptNode=n;const r=[];if(!e||0===e.length)return r;const o=e.filter(t=>t&&t.length>0).map(t=>i(t)).join("|");console.log(`<pb-view-annotate> Searching content for ${o}...`);const s=new RegExp(o,this.caseSensitive?"g":"gi"),a=document.createTreeWalker(this.shadowRoot.getElementById("view"),NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT,n);for(;a.nextNode();){let e=a.currentNode;const i=Array.from(e.textContent.matchAll(s));for(const n of i){const i=n.index+n[0].length;let o=!1,s=null;const a=e.parentNode.dataset.annotation,l=e.parentNode.dataset.type;if(a&&l){const e=JSON.parse(a)||{};o=l===t,s=e[this.getKey(t)]}const c=Ds(e,n.index),h=Ds(e,i,"end"),[d,p]=qs(e),u={annotated:o,context:c.parent,start:c.offset,end:h.offset,textNode:e,kwic:js(d,p+n.index,p+i)};u[this.getKey(t)]=s,r.push(u)}}return r}scrollTo(t){const e=this.shadowRoot.getElementById("view"),i=document.createRange();if(t.annotated)i.selectNode(t.textNode);else{const n=Array.from(e.querySelectorAll(`[data-tei="${t.context}"]`)).filter(t=>null===t.closest("pb-popover")&&"footnote"!==t.getAttribute("rel"))[0],r=Bs(n,t.start),o=Bs(n,t.end);i.setStart(r[0],r[1]),i.setEnd(o[0],o[1])}const n=e.getBoundingClientRect(),r=i.getBoundingClientRect();let o=e.querySelector("[part=highlight]");o||(o=document.createElement("div"),o.part="highlight",o.style.position="absolute",e.appendChild(o)),o.style.left=r.left-n.left-4+"px",o.style.top=r.top-n.top-4+"px",o.style.width=r.width+4+"px",o.style.height=r.height+"px",i.startContainer.parentNode.scrollIntoView(!0)}hideMarker(){const t=this.shadowRoot.getElementById("view").querySelector("[part=highlight]");t&&(t.style.top="-1000px")}_markIncompleteAnnotations(){this.shadowRoot.getElementById("view").querySelectorAll(".annotation.authority").forEach(t=>{if(t.dataset.type){const e=JSON.parse(t.dataset.annotation),i=this.getKey(t.dataset.type);e[i]&&0!==e[i].length||t.classList.add("incomplete")}})}_initAnnotationColors(){this._annotationColors=new Map;const t=new Set;this.shadowRoot.getElementById("view").querySelectorAll(".annotation").forEach(e=>{e.dataset.type&&t.add(e.dataset.type)}),t.forEach(t=>{this._annotationColors.set(t,Vs("annotation-"+t.repeat(4),{saturation:70,lightness:[30,60]}))}),this.emitTo("pb-annotation-colors",{colors:this._annotationColors})}_checkAnnotationColor(t){this._annotationColors.has(t)||(this._annotationColors.set(t,Vs("annotation-"+t.repeat(4),{saturation:70,lightness:[30,60]})),this._annotationStyles(),this.emitTo("pb-annotation-colors",{colors:this._annotationColors}))}_annotationStyles(){const t=this.shadowRoot.getElementById("view");let e=t.querySelector("_annotation-styles");e&&e.parentNode.removeChild(e);const i=[],n=[];this._annotationColors.forEach((t,e)=>{i.push(`--pb-annotation-${e}: ${t.color};`),i.push(`--pb-annotation-${e}-border: 2px solid var(--pb-annotation-${e});`),n.push(`\n .annotation-${e}::after {\n background-color: var(--pb-annotation-${e});\n border-color: var(--pb-annotation-${e});\n color: var(${t.isLight?"--pb-color-primary":"--pb-color-inverse"});\n }\n .annotation-${e}.incomplete::after {\n background: repeating-linear-gradient(\n 315deg,\n var(--pb-annotation-${e}),\n var(--pb-annotation-${e}) 5px,\n var(${t.isLight?"--pb-annotation-stripes-light":"--pb-annotation-stripes-dark"}) 5px,\n var(${t.isLight?"--pb-annotation-stripes-light":"--pb-annotation-stripes-dark"}) 10px\n );\n color: var(${t.isLight?"--pb-color-primary":"--pb-color-inverse"});\n }\n `)});const r=`\n :host {\n ${i.join("\n")}\n }\n\n ${n.join("\n")}\n `;e=document.createElement("style"),e.className="_annotation-styles",e.innerHTML=r,t.insertBefore(e,t.firstChild)}static get styles(){return[super.styles,P`
|
|
1228
|
+
`]}}customElements.define("pb-view",ws);const xs=[0,100],ks=[0,100],As=t=>`${1===t.length?"0":""}${t}`,zs=(t,e,i)=>Math.max(Math.min(t,i),e),Ss=(t,e)=>Math.floor(Math.random()*(e-t+1))+t,Cs=t=>{const e=t.length;let i=0;for(let n=0;n<e;n++)i=(i<<5)-i+t.charCodeAt(n),i&=i;return i},Es=(t,e)=>"number"==typeof e?e:t%Math.abs(e[1]-e[0])+e[0],Ms=(t,e)=>"number"==typeof t?zs(Math.abs(t),...e):1===t.length||t[0]===t[1]?zs(Math.abs(t[0]),...e):[Math.abs(zs(t[0],...e)),zs(Math.abs(t[1]),...e)],Ls=(t,e,i)=>(i<0?i+=1:i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t),Ts=(t,e,i)=>{let n,r,o;if(t/=360,i/=100,0===(e/=100))n=r=o=i;else{const s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;n=Ls(a,s,t+1/3),r=Ls(a,s,t),o=Ls(a,s,t-1/3)}return[Math.round(255*n),Math.round(255*r),Math.round(255*o)]},Hs=(t,e,i,n)=>(299*t+587*e+114*i)/1e3>=n,Os=(t,e,i)=>`hsl(${t}, ${e}%, ${i}%)`,$s=(t,e,i,n)=>{switch(n){case"rgb":return`rgb(${t}, ${e}, ${i})`;case"hex":default:return`#${As(t.toString(16))}${As(e.toString(16))}${As(i.toString(16))}`}},Vs=(t,{format:e="hex",saturation:i=[50,55],lightness:n=[50,60],differencePoint:r=130}={})=>{const o=Math.abs(Cs(String(t))),s=Es(o,[0,360]),a=Es(o,Ms(i,xs)),l=Es(o,Ms(n,ks)),[c,h,d]=Ts(s,a,l);return{color:"hsl"===e?Os(s,a,l):$s(c,h,d,e),isLight:Hs(c,h,d,r)}};function Is(t,e){let i=t;for(;i.parentNode!==e;)i=i.parentElement;return i}function Rs(t){let e=t;e.nodeType===Node.TEXT_NODE&&(e=e.parentNode);const i=e.getAttribute("href");return i&&/^#fn_.*$/.test(i)}function Ps(t,e,i){const n=document.createTreeWalker(t);for(n.currentNode=e;n.previousNode();){const t=n.currentNode;t.nodeType===Node.ELEMENT_NODE||Rs(t)||(i+=t.textContent.length)}return i}function Ds(t,e,i="start"){if(t.nodeType===Node.ELEMENT_NODE){const n=t.closest("[data-tei]");if(0===e)return{parent:n.getAttribute("data-tei"),offset:0};const r=n.childNodes[e];return{parent:n.getAttribute("data-tei"),offset:"end"===i?Ps(n,r,0)-1:Ps(n,r,0)}}const n=t.parentNode.closest("[data-tei]");if(n)return{parent:n.getAttribute("data-tei"),offset:Ps(n,t,e)};console.error("No container with data-tei found for %o",t.parentNode)}function Ns(t,e){let i=0,n=t.parentNode;for(;n&&n!==t.getRootNode();)n.classList.contains(e)&&(i+=1),n=n.parentNode;return i}function Fs(t,e){const i=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);return i.currentNode=e,i.nextNode()?i.currentNode:e}function Bs(t,e){let i=e;const n=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(;n.nextNode();)if(!Rs(n.currentNode)&&n.currentNode.textContent.length>0){if(i-n.currentNode.textContent.length<=0)return[n.currentNode,i];i-=n.currentNode.textContent.length}return null}function js(t,e,i,n=3){let r=e-1,o=0;for(;r>=0;){if(/[\p{P}\s]/.test(t.charAt(r))){for(;r>1&&/[\p{P}\s]/.test(t.charAt(r-1));)r-=1;if(o+=1,o===n)break}r-=1}let s=i+1;for(o=0;s<t.length;){if(/[\p{P}\s]/.test(t.charAt(s))){for(;s<t.length-1&&/[\p{P}\s]/.test(t.charAt(s+1));)s+=1;if(o+=1,o===n)break}s+=1}return`... ${t.substring(r,e)}<mark>${t.substring(e,i)}</mark>${t.substring(i,s+1)} ...`}function qs(t){let e=t.parentElement;e.textContent.length<40&&(e=e.parentNode);const i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let n=0,r=0;const o=[];for(;i.nextNode();)i.currentNode===t&&(r=n),n+=i.currentNode.textContent.length,o.push(i.currentNode.textContent);return[o.join(""),r]}function Us(t){const e={};return Object.keys(t.properties).forEach(i=>{const n=t.properties[i];n&&n.length>0&&(e[i]=n)}),Object.assign(t,{properties:e})}Vs.random=({format:t="hex",saturation:e=[50,55],lightness:i=[50,60],differencePoint:n=130}={})=>{e=Ms(e,xs),i=Ms(i,ks);const r=Ss(0,360),o="number"==typeof e?e:Ss(...e),s="number"==typeof i?i:Ss(...i),[a,l,c]=Ts(r,o,s);return{color:"hsl"===t?Os(r,o,s):$s(a,l,c,t),isLight:Hs(a,l,c,n)}};class Ws extends ws{static get properties(){return Object.assign({key:{type:String},keyMap:{type:Object,attribute:"key-map"},caseSensitive:{type:Boolean}},super.properties)}constructor(){super(),this.key="ref",this.keyMap={},this.caseSensitive=!1,this._ranges=[],this._rangesMap=new Map,this._history=[]}connectedCallback(){super.connectedCallback();let t=!1;this._inHandler=!1,this._pendingCallback=null;const e=(t=10)=>{this._pendingCallback=setTimeout(()=>{this._selectionChanged()},t)};this._eventHandler=i=>{if("selectionchange"===i.type&&this._inHandler)return;if("mousedown"===i.type&&(t=!0),"mouseup"===i.type&&(t=!1),t)return;this._cancelPendingCallback();const n="mouseup"===i.type?10:100;e(n)},document.addEventListener("selectionchange",this._eventHandler.bind(this)),this.shadowRoot.addEventListener("mousedown",this._eventHandler.bind(this)),this.shadowRoot.addEventListener("mouseup",this._eventHandler.bind(this)),this.subscribeTo("pb-add-annotation",t=>this.addAnnotation(t.detail)),this.subscribeTo("pb-edit-annotation",this._editAnnotation.bind(this)),this.subscribeTo("pb-refresh",()=>{this._ranges=[],this._rangesMap.clear(),this._currentSelection=null,this._clearMarkers(),this.emitTo("pb-annotations-changed",{ranges:this._ranges,refresh:!0})}),this._resizeHandler()}get annotations(){return this._ranges}set annotations(t){this._ranges=t,this.updateAnnotations(!0),this._initAnnotationColors(),this._annotationStyles()}saveHistory(){this._history.push(JSON.stringify(this._ranges)),this.emitTo("pb-annotations-history",this._history)}getHistory(){return this._history}popHistory(){if(0===this._history.length)return void console.warn("<pb-view-annotate> history is empty");this._scrollTop=this.scrollTop;const t=this._history.pop();this._clearMarkers(),this._ranges=JSON.parse(t),this._rangesMap.clear(),this._refresh(),this.emitTo("pb-annotations-changed",{ranges:this._ranges}),this.emitTo("pb-annotations-history",this._history)}clearHistory(t){this._history=t||[]}firstUpdated(){super.firstUpdated(),this.enableScrollbar(!1),Zi(this.shadowRoot,"light-border")}render(){return[...super.render(),O`<div id="marker-layer"></div>`]}zoom(t){super.zoom(t),window.requestAnimationFrame(()=>this.refreshMarkers())}getKey(t){return this.keyMap[t]||this.key}_resizeHandler(){let t=null;const e=()=>{t=setTimeout(()=>{t=null,this.refreshMarkers()},200)};window.addEventListener("resize",()=>{t||this._clearMarkers(),t&&clearTimeout(t),e()})}_refresh(t){super._refresh(t),t&&t.detail&&t.detail.preserveScroll&&(this._scrollTop=this.scrollTop)}_handleContent(){super._handleContent(),this.updateComplete.then(()=>setTimeout(()=>{this._initAnnotationColors(),this._annotationStyles(),this.updateAnnotations(),this._markIncompleteAnnotations(),this._scrollTop&&(this.scrollTop=this._scrollTop,this._scrollTop=void 0)},300))}_updateAnnotation(t,e=!1,i=!1){const n=this.shadowRoot.getElementById("view"),r=Array.from(n.querySelectorAll(`[data-tei="${t.context}"]`)).filter(t=>null===t.closest("pb-popover")&&"footnote"!==t.getAttribute("rel"))[0];if(!r)return null;const o=document.createRange(),s=Bs(r,t.start),a=Bs(r,t.end);if(!s||!a)return console.error("<pb-view-annotate> Invalid range for %o",r),null;if(console.log("<pb-view-annotate> Range before adjust: %o %o",s,a),s[1]===s[0].textContent.length){const t=Fs(r,s[0]);t===a[0]?(o.setStart(t,0),s[0]=t,s[1]=0):o.setStartBefore(s[0].nextSibling||t)}else s[0]!==a[0]&&0===s[1]?o.setStartBefore(Is(s[0],r)):o.setStart(s[0],s[1]);s[0]!==a[0]&&a[0].textContent.length-1===a[1]?o.setEndAfter(Is(a[0],r)):o.setEnd(a[0],a[1]),console.log("<pb-view-annotate> Range: %o",o);const l=document.createElement("span"),c=""===t.properties[this.getKey(t.type)]?"incomplete":"";l.className=`annotation annotation-${t.type} ${t.type} ${c}`,l.dataset.type=t.type,l.dataset.annotation=JSON.stringify(t.properties);try{o.surroundContents(l)}catch(t){if(e)return null;throw new Error("An error occurred. The annotation may not be displayed. You should consider saving and reloading the document.")}return this._rangesMap.set(l,t),i||this.refreshMarkers(),l}updateAnnotations(t=!1){this._ranges.forEach(e=>{let i;switch(e.type){case"delete":i=this.shadowRoot.querySelector(`[data-tei="${e.node}"]`),i?this._deleteAnnotation(i):console.error("Annotation %s not found",e.context);break;case"modify":i=this.shadowRoot.querySelector(`[data-tei="${e.node}"]`),i.dataset.annotation=JSON.stringify(e.properties);break;default:this._updateAnnotation(e,t,!0)}}),window.requestAnimationFrame(()=>this.refreshMarkers())}_getSelection(){return this.shadowRoot.getSelection?this.shadowRoot.getSelection():window.getSelection()}_selectionChanged(){const t=this._getSelection(),e=this._selectedRange(t);if(e){let i=!1;const n=e.commonAncestorContainer;if(n.nodeType===Node.ELEMENT_NODE){if(e.startContainer.parentElement!==n){const t=Is(e.startContainer,n);e.setStartBefore(t),i=!0}if(e.endContainer.parentElement!==n){const t=Is(e.endContainer,n);e.setEndAfter(t),i=!0}}this._currentSelection=e,console.log("<pb-view-annotate> selection: %o",e),i&&(this._inHandler=!0,setTimeout(()=>{t.removeAllRanges(),t.addRange(e),this.inHandler=!1},100)),this.emitTo("pb-selection-changed",{hasContent:!0,range:e})}else this.emitTo("pb-selection-changed",{hasContent:!1})}updateAnnotation(t,e=!1){t=Us(t);const i=this._updateAnnotation(t,e);return i&&(this._ranges.push(t),this.emitTo("pb-annotations-changed",{type:t.type,text:t.text,ranges:this._ranges})),i}addAnnotation(t){const e=t.range||this._currentSelection,i=Ds(e.startContainer,e.startOffset),n=Ds(e.endContainer,e.endOffset,"end"),r={context:i.parent,start:i.offset,end:n.offset,text:e.cloneContents().textContent};return t.type&&(r.type=t.type),t.properties&&(r.properties=t.properties),console.log("<pb-view-annotate> range adjusted: %o",r),this._ranges.push(Us(r)),this.emitTo("pb-annotations-changed",{type:r.type,text:r.text,ranges:this._ranges}),this._checkAnnotationColor(r.type),this._updateAnnotation(r)}deleteAnnotation(t){if(t.dataset.tei){const e=this._ranges.findIndex(e=>"modify"===e.type&&e.node===t.dataset.tei);e>-1&&this._ranges.splice(e,1);const i=t.parentNode.closest("[data-tei]"),n={type:"delete",node:t.dataset.tei,context:i.dataset.tei};this._ranges.push(n)}else{const e=this._rangesMap.get(t);this._rangesMap.delete(t);const i=this._ranges.indexOf(e);console.log("<pb-view-annotate> deleting annotation %o",e),this._ranges.splice(i,1)}this._deleteAnnotation(t)}_deleteAnnotation(t){const e=document.createRange();for(let i=0;i<t.childNodes.length;i++){const n=t.childNodes[i].cloneNode(!0);t.parentNode.insertBefore(n,t),0===i&&e.setStartBefore(n),i===t.childNodes.length-1&&e.setEndAfter(n)}t.parentNode.removeChild(t),this.emitTo("pb-annotations-changed",{ranges:this._ranges}),window.requestAnimationFrame(()=>this.refreshMarkers());const i=this._getSelection();i.removeAllRanges(),i.addRange(e)}editAnnotation(t,e){if("edit"===t.dataset.type){let i=this._rangesMap.get(t);i?(i.properties=e,i=Us(i),this.emitTo("pb-annotations-changed",{ranges:this._ranges})):console.error("no range found for edit span %o",t)}else if(t.dataset.tei){const i=t.closest("[data-tei]");let n=this._ranges.find(e=>"modify"===e.type&&e.node===t.dataset.tei);n||(n={type:"modify",node:t.dataset.tei,context:i.dataset.tei},this._ranges.push(n)),n.properties=e,n=Us(n),this.emitTo("pb-annotations-changed",{ranges:this._ranges})}const i=JSON.parse(t.dataset.annotation),n=Object.assign(i||{},e);t.dataset.annotation=JSON.stringify(n),""!==n[this.getKey(t.dataset.type)]&&t.classList.remove("incomplete")}_editAnnotation(t){this.editAnnotation(t.detail.target,t.detail.properties)}_selectedRange(t){if(!t||0===t.rangeCount)return null;if(t.anchorNode.getRootNode()!==this.shadowRoot)return null;const e=t.getRangeAt(0);return e.collapsed?null:e}_cancelPendingCallback(){this._pendingCallback&&(clearTimeout(this._pendingCallback),this._pendingCallback=null)}_createTooltip(t){if(t._tippy||!t.dataset.annotation)return;const e=document.createElement("div");e.className="annotation-popup";const i=document.createElement("div");i.className="info",e.appendChild(i);const n=document.createElement("div");n.className="toolbar";const r=document.createElement("span");if(r.className="annotation-type",n.appendChild(r),t.dataset.annotation){const e=document.createElement("paper-icon-button");e.setAttribute("icon","icons:create"),e.setAttribute("title",j("annotations.edit")),e.addEventListener("click",()=>{const e=JSON.parse(t.dataset.annotation);this.emitTo("pb-annotation-edit",Object.assign({},{target:t,type:t.dataset.type,properties:e}))}),n.appendChild(e)}const o=document.createElement("paper-icon-button");o.setAttribute("icon","icons:delete"),o.setAttribute("title",j("annotations.delete")),o.addEventListener("click",()=>{this.saveHistory(),this.deleteAnnotation(t)}),n.appendChild(o),e.appendChild(n);const s=this.shadowRoot.getElementById("view");ji(t,{content:e,allowHTML:!0,interactive:!0,appendTo:s.nodeType===Node.DOCUMENT_NODE?document.body:s,theme:"light-border",hideOnClick:!1,maxWidth:"auto",trigger:"click",placement:"left",popperOptions:{modifiers:[{name:"flip",options:{fallbackPlacements:["right","top","bottom"]}}]},onTrigger:(e,n)=>{n.preventDefault(),n.stopPropagation();const o=t.dataset.type,s=JSON.parse(t.dataset.annotation)||{},a=this._annotationColors.get(o);if(r.innerHTML=o,r.style.backgroundColor=`var(--pb-annotation-${o})`,r.style.color=`var(${a&&a.isLight?"--pb-color-primary":"--pb-color-inverse"})`,s[this.getKey(o)])this.emitTo("pb-annotation-detail",{type:o,id:s[this.getKey(o)],container:i,span:t});else{i.innerHTML="";const t=Object.keys(s);if(0===t.length){const t=document.createElement("p");t.innerHTML=j("annotations.no-properties"),i.appendChild(t)}else{const e=document.createElement("table");t.forEach(t=>{const i=document.createElement("tr"),n=document.createElement("td");n.innerHTML=t,i.appendChild(n);const r=document.createElement("td");r.innerHTML=JSON.stringify(s[t],null,2),i.appendChild(r),e.appendChild(i)}),i.appendChild(e)}}},onClickOutside:(t,e)=>{t.hideWithInteractivity(e)}})}_showMarker(t,e,i,n=0){const r=t.getClientRects(),o=t.dataset.type;for(let t=0;t<r.length;t++){const s=r[t],a=document.createElement("div");a.className="marker annotation-"+o,a.style.position="absolute",a.style.left=s.left-i.left+"px",a.style.top=s.top-i.top+s.height+"px",a.style.marginTop=n+"px",a.style.width=s.width+"px",a.style.height="3px",a.style.backgroundColor=`var(--pb-annotation-${o})`,a.part="annotation",e.appendChild(a)}this._createTooltip(t)}_clearMarkers(){this.shadowRoot.getElementById("marker-layer").innerHTML=""}refreshMarkers(){const t=this.shadowRoot.getElementById("view"),e=t.getBoundingClientRect(),i=this.shadowRoot.getElementById("marker-layer");i.style.display="none",this._clearMarkers(),t.querySelectorAll(".annotation").forEach(t=>{t._tippy&&t._tippy.destroy(),this._showMarker(t,i,e,5*Ns(t,"annotation"))}),i.style.display="block"}search(t,e){function i(t){let e=t.replace(/[/.?+*\\]/g,t=>"\\"+t).replace(/[\s\n\t]+/g,"\\s+");return/^\w/.test(e)&&(e="\\b"+e),/\w$/.test(e)&&(e+="\\b"),e}function n(t){return t.nodeType===Node.TEXT_NODE?NodeFilter.FILTER_ACCEPT:t.classList.contains("annotation-popup")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_SKIP}n.acceptNode=n;const r=[];if(!e||0===e.length)return r;const o=e.filter(t=>t&&t.length>0).map(t=>i(t)).join("|");console.log(`<pb-view-annotate> Searching content for ${o}...`);const s=new RegExp(o,this.caseSensitive?"g":"gi"),a=document.createTreeWalker(this.shadowRoot.getElementById("view"),NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT,n);for(;a.nextNode();){let e=a.currentNode;const i=Array.from(e.textContent.matchAll(s));for(const n of i){const i=n.index+n[0].length;let o=!1,s=null;const a=e.parentNode.dataset.annotation,l=e.parentNode.dataset.type;if(a&&l){const e=JSON.parse(a)||{};o=l===t,s=e[this.getKey(t)]}const c=Ds(e,n.index),h=Ds(e,i,"end"),[d,p]=qs(e),u={annotated:o,context:c.parent,start:c.offset,end:h.offset,textNode:e,kwic:js(d,p+n.index,p+i)};u[this.getKey(t)]=s,r.push(u)}}return r}scrollTo(t){const e=this.shadowRoot.getElementById("view"),i=document.createRange();if(t.annotated)i.selectNode(t.textNode);else{const n=Array.from(e.querySelectorAll(`[data-tei="${t.context}"]`)).filter(t=>null===t.closest("pb-popover")&&"footnote"!==t.getAttribute("rel"))[0],r=Bs(n,t.start),o=Bs(n,t.end);i.setStart(r[0],r[1]),i.setEnd(o[0],o[1])}const n=e.getBoundingClientRect(),r=i.getBoundingClientRect();let o=e.querySelector("[part=highlight]");o||(o=document.createElement("div"),o.part="highlight",o.style.position="absolute",e.appendChild(o)),o.style.left=r.left-n.left-4+"px",o.style.top=r.top-n.top-4+"px",o.style.width=r.width+4+"px",o.style.height=r.height+"px",i.startContainer.parentNode.scrollIntoView(!0)}hideMarker(){const t=this.shadowRoot.getElementById("view").querySelector("[part=highlight]");t&&(t.style.top="-1000px")}_markIncompleteAnnotations(){this.shadowRoot.getElementById("view").querySelectorAll(".annotation.authority").forEach(t=>{if(t.dataset.type){const e=JSON.parse(t.dataset.annotation),i=this.getKey(t.dataset.type);e[i]&&0!==e[i].length||t.classList.add("incomplete")}})}_initAnnotationColors(){this._annotationColors=new Map;const t=new Set;this.shadowRoot.getElementById("view").querySelectorAll(".annotation").forEach(e=>{e.dataset.type&&t.add(e.dataset.type)}),t.forEach(t=>{this._annotationColors.set(t,Vs("annotation-"+t.repeat(4),{saturation:70,lightness:[30,60]}))}),this.emitTo("pb-annotation-colors",{colors:this._annotationColors})}_checkAnnotationColor(t){this._annotationColors.has(t)||(this._annotationColors.set(t,Vs("annotation-"+t.repeat(4),{saturation:70,lightness:[30,60]})),this._annotationStyles(),this.emitTo("pb-annotation-colors",{colors:this._annotationColors}))}_annotationStyles(){const t=this.shadowRoot.getElementById("view");let e=t.querySelector("_annotation-styles");e&&e.parentNode.removeChild(e);const i=[],n=[];this._annotationColors.forEach((t,e)=>{i.push(`--pb-annotation-${e}: ${t.color};`),i.push(`--pb-annotation-${e}-border: 2px solid var(--pb-annotation-${e});`),n.push(`\n .annotation-${e}::after {\n background-color: var(--pb-annotation-${e});\n border-color: var(--pb-annotation-${e});\n color: var(${t.isLight?"--pb-color-primary":"--pb-color-inverse"});\n }\n .annotation-${e}.incomplete::after {\n background: repeating-linear-gradient(\n 315deg,\n var(--pb-annotation-${e}),\n var(--pb-annotation-${e}) 5px,\n var(${t.isLight?"--pb-annotation-stripes-light":"--pb-annotation-stripes-dark"}) 5px,\n var(${t.isLight?"--pb-annotation-stripes-light":"--pb-annotation-stripes-dark"}) 10px\n );\n color: var(${t.isLight?"--pb-color-primary":"--pb-color-inverse"});\n }\n `)});const r=`\n :host {\n ${i.join("\n")}\n }\n\n ${n.join("\n")}\n `;e=document.createElement("style"),e.className="_annotation-styles",e.innerHTML=r,t.insertBefore(e,t.firstChild)}static get styles(){return[super.styles,V`
|
|
1229
1229
|
.annotation-type {
|
|
1230
1230
|
display: inline-block;
|
|
1231
1231
|
text-align: right;
|
|
@@ -1269,11 +1269,11 @@ e({_template:n`
|
|
|
1269
1269
|
[part=highlight] {
|
|
1270
1270
|
border: 3px solid rgb(255, 174, 0);
|
|
1271
1271
|
border-radius: 8px;
|
|
1272
|
-
}`]}}customElements.define("pb-view-annotate",Ws);class Ys extends(
|
|
1272
|
+
}`]}}customElements.define("pb-view-annotate",Ws);class Ys extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{icon:{type:String},direction:{type:String}})}constructor(){super(),this.icon="icons:zoom-in",this.direction="in"}connectedCallback(){super.connectedCallback()}_handleClick(){this.emitTo("pb-zoom",{direction:this.direction})}render(){return O`
|
|
1273
1273
|
<paper-icon-button icon="${this.icon}" @click="${this._handleClick}"></paper-icon-button>
|
|
1274
|
-
`}}customElements.define("pb-zoom",Ys);class Gs extends(
|
|
1274
|
+
`}}customElements.define("pb-zoom",Ys);class Gs extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{toggle:{type:String},opened:{type:Boolean,reflect:!0},maxWidth:{type:String,attribute:"max-width"},position:{type:String,reflect:!0}})}constructor(){super(),this.opened=!1,this.position="left"}connectedCallback(){super.connectedCallback();const t=this.toggle?document.getElementById(this.toggle):null;t&&t.addEventListener("click",this._toggle.bind(this)),document.body.addEventListener("click",()=>{this.opened&&(this.opened=!1)}),this.addEventListener("click",t=>t.stopPropagation()),this.subscribeTo("pb-refresh",this._close.bind(this))}firstUpdated(){this.maxWidth?(void 0!==window.visualViewport?window.visualViewport.addEventListener("resize",()=>{this._handleResize()}):window.addEventListener("resize",()=>{this._handleResize()}),this._handleResize()):this.classList.add("overlay")}_handleResize(){const t=document.getElementById(this.toggle),e=`(max-width: ${this.maxWidth})`;window.matchMedia(e).matches?(console.log("<pb-drawer> entering overlay mode"),this.classList.add("overlay"),t&&(t.style.display="")):(console.log("<pb-drawer> leaving overlay mode"),this.classList.remove("overlay"),t&&(t.style.display="none"))}_toggle(t){t&&(t.preventDefault(),t.stopPropagation()),this.opened?this.opened=!1:(this.opened=!0,this.emitTo("pb-load"))}_close(){this.opened=!1}render(){return O`
|
|
1275
1275
|
<div part="content"><slot></slot></div>
|
|
1276
|
-
`}static get styles(){return
|
|
1276
|
+
`}static get styles(){return V`
|
|
1277
1277
|
:host {
|
|
1278
1278
|
display: block;
|
|
1279
1279
|
}
|
|
@@ -1307,13 +1307,13 @@ e({_template:n`
|
|
|
1307
1307
|
div {
|
|
1308
1308
|
padding: 10px;
|
|
1309
1309
|
}
|
|
1310
|
-
`}}customElements.define("pb-drawer",Gs);class Xs extends
|
|
1311
|
-
${this.match?
|
|
1312
|
-
`}static get styles(){return
|
|
1310
|
+
`}}customElements.define("pb-drawer",Gs);class Xs extends T{static get properties(){return Object.assign(Object.assign({},super.properties),{},{query:{type:String},match:{type:Boolean,reflect:!0}})}constructor(){super(),this.query="(max-width:460px)",this.match=!1}firstUpdated(){void 0!==window.visualViewport?window.visualViewport.addEventListener("resize",()=>{this._handleResize()}):window.addEventListener("resize",()=>{this._handleResize()}),this._handleResize()}_handleResize(){let{query:t}=this;/\(.*\)$/.test(t)||(t=`(${t})`),window.matchMedia(t).matches?!1===this.match&&(this.dispatchEvent(new CustomEvent("changed",{detail:{value:!0},composed:!0,bubbles:!0})),this.match=!0):!0===this.match&&(this.dispatchEvent(new CustomEvent("changed",{detail:{value:!1},composed:!0,bubbles:!0})),this.match=!1)}render(){return O`
|
|
1311
|
+
${this.match?O`<slot></slot>`:null}
|
|
1312
|
+
`}static get styles(){return V`
|
|
1313
1313
|
:host {
|
|
1314
1314
|
display: inherit;
|
|
1315
1315
|
}
|
|
1316
|
-
`}}customElements.define("pb-media-query",Xs);class Ks extends cn{firstUpdated(){this.shadowRoot.getElementById("ironform").addEventListener("iron-form-presubmit",t=>{t.preventDefault(),this._submit()}),this.addEventListener("click",t=>{"searchButtonTop"===t.target.slot&&this.submit(),"searchButtonBottom"===t.target.slot&&this.submit(),"resetButton"===t.target.slot&&this._reset()}),this._submissionHandlers()}render(){return
|
|
1316
|
+
`}}customElements.define("pb-media-query",Xs);class Ks extends cn{firstUpdated(){this.shadowRoot.getElementById("ironform").addEventListener("iron-form-presubmit",t=>{t.preventDefault(),this._submit()}),this.addEventListener("click",t=>{"searchButtonTop"===t.target.slot&&this.submit(),"searchButtonBottom"===t.target.slot&&this.submit(),"resetButton"===t.target.slot&&this._reset()}),this._submissionHandlers()}render(){return O`
|
|
1317
1317
|
<iron-form id="ironform">
|
|
1318
1318
|
<form action="" accept="text/html" method="GET">
|
|
1319
1319
|
<slot name="searchButtonTop"></slot>
|
|
@@ -1340,7 +1340,7 @@ e({_template:n`
|
|
|
1340
1340
|
</paper-button>
|
|
1341
1341
|
</div>
|
|
1342
1342
|
</paper-dialog>
|
|
1343
|
-
`}static get styles(){return
|
|
1343
|
+
`}static get styles(){return V`
|
|
1344
1344
|
:host {
|
|
1345
1345
|
display: block;
|
|
1346
1346
|
}
|
|
@@ -1352,9 +1352,9 @@ e({_template:n`
|
|
|
1352
1352
|
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
|
1353
1353
|
* Released under the MIT license
|
|
1354
1354
|
*/
|
|
1355
|
-
function(t){var e;if("function"==typeof define&&define.amd&&(define(t),e=!0),"object"==typeof exports&&(module.exports=t(),e=!0),!e){var i=window.Cookies,n=window.Cookies=t();n.noConflict=function(){return window.Cookies=i,n}}}((function(){function t(){for(var t=0,e={};t<arguments.length;t++){var i=arguments[t];for(var n in i)e[n]=i[n]}return e}function e(t){return t.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}function i(n){function r(){}function o(e,i,o){if("undefined"!=typeof document){"number"==typeof(o=t({path:"/"},r.defaults,o)).expires&&(o.expires=new Date(1*new Date+864e5*o.expires)),o.expires=o.expires?o.expires.toUTCString():"";try{var s=JSON.stringify(i);/^[\{\[]/.test(s)&&(i=s)}catch(t){}i=n.write?n.write(i,e):encodeURIComponent(String(i)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),e=encodeURIComponent(String(e)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var a="";for(var l in o)o[l]&&(a+="; "+l,!0!==o[l]&&(a+="="+o[l].split(";")[0]));return document.cookie=e+"="+i+a}}function s(t,i){if("undefined"!=typeof document){for(var r={},o=document.cookie?document.cookie.split("; "):[],s=0;s<o.length;s++){var a=o[s].split("="),l=a.slice(1).join("=");i||'"'!==l.charAt(0)||(l=l.slice(1,-1));try{var c=e(a[0]);if(l=(n.read||n)(l,c)||e(l),i)try{l=JSON.parse(l)}catch(t){}if(r[c]=l,t===c)break}catch(t){}}return t?r[t]:r}}return r.set=o,r.get=function(t){return s(t,!1)},r.getJSON=function(t){return s(t,!0)},r.remove=function(e,i){o(e,"",t(i,{expires:-1}))},r.defaults={},r.withConverter=i,r}return i((function(){}))}));class Qs extends(
|
|
1355
|
+
function(t){var e;if("function"==typeof define&&define.amd&&(define(t),e=!0),"object"==typeof exports&&(module.exports=t(),e=!0),!e){var i=window.Cookies,n=window.Cookies=t();n.noConflict=function(){return window.Cookies=i,n}}}((function(){function t(){for(var t=0,e={};t<arguments.length;t++){var i=arguments[t];for(var n in i)e[n]=i[n]}return e}function e(t){return t.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}function i(n){function r(){}function o(e,i,o){if("undefined"!=typeof document){"number"==typeof(o=t({path:"/"},r.defaults,o)).expires&&(o.expires=new Date(1*new Date+864e5*o.expires)),o.expires=o.expires?o.expires.toUTCString():"";try{var s=JSON.stringify(i);/^[\{\[]/.test(s)&&(i=s)}catch(t){}i=n.write?n.write(i,e):encodeURIComponent(String(i)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),e=encodeURIComponent(String(e)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var a="";for(var l in o)o[l]&&(a+="; "+l,!0!==o[l]&&(a+="="+o[l].split(";")[0]));return document.cookie=e+"="+i+a}}function s(t,i){if("undefined"!=typeof document){for(var r={},o=document.cookie?document.cookie.split("; "):[],s=0;s<o.length;s++){var a=o[s].split("="),l=a.slice(1).join("=");i||'"'!==l.charAt(0)||(l=l.slice(1,-1));try{var c=e(a[0]);if(l=(n.read||n)(l,c)||e(l),i)try{l=JSON.parse(l)}catch(t){}if(r[c]=l,t===c)break}catch(t){}}return t?r[t]:r}}return r.set=o,r.get=function(t){return s(t,!1)},r.getJSON=function(t){return s(t,!0)},r.remove=function(e,i){o(e,"",t(i,{expires:-1}))},r.defaults={},r.withConverter=i,r}return i((function(){}))}));class Qs extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{src:{type:String},url:{type:String},type:{type:String},odd:{type:String},dialog:{type:String},title:{type:String},source:{type:Boolean},params:{type:String},_target:{type:String,reflect:!0},_href:{type:String,reflect:!0},_token:{type:String}})}constructor(){super(),this.source=!1,this._target="_self",this.type=""}firstUpdated(){this.src&&this.subscribeTo("pb-document",t=>{t.detail.id===this.src&&(this.odd=t.detail.odd)}),this.subscribeTo("pb-refresh",t=>{t.detail.odd&&(this.odd=t.detail.odd,this._href=this._computeURL())}),Qs.waitOnce("pb-page-ready",()=>{this._target=this._computeTarget(),this._href=this._computeURL()})}attributeChangedCallback(t,e,i){if(super.attributeChangedCallback(t,e,i),e)switch(t){case"source":this._target=this._computeTarget();break;case"src":case"type":case"file":case"odd":case"params":case"url":this._href=this._computeURL()}}render(){return O`
|
|
1356
1356
|
<a id="button" @click="${this._handleClick}" title="${this.title}" target="${this._target}" href="${this._href}"><slot></slot></a>
|
|
1357
|
-
`}static get styles(){return
|
|
1357
|
+
`}static get styles(){return V`
|
|
1358
1358
|
:host {
|
|
1359
1359
|
display: inline-block;
|
|
1360
1360
|
}
|
|
@@ -1363,27 +1363,27 @@ function(t){var e;if("function"==typeof define&&define.amd&&(define(t),e=!0),"ob
|
|
|
1363
1363
|
text-decoration: var(--pb-download-text-decoration, none);
|
|
1364
1364
|
color: var(--pb-download-color);
|
|
1365
1365
|
}
|
|
1366
|
-
`}_computeTarget(){return this.source?"_blank":"_self"}_computeURL(){let t;this._token=797*(new Date).getTime();const e=this.getDocument();if(e)if(this.url)t=`${this.toAbsoluteURL(this.url)}?odd=${this.odd?this.odd:e.odd}.odd`;else{const i=this.getEndpoint()+"/";t=this.lessThanApiVersion("1.0.0")?`${e.getFileName()}${this.type?"."+this.type:""}?odd=${this.odd?this.odd:e.odd}.odd&cache=no&token=${this._token}`:`${i}api/document/${encodeURIComponent(e.path)}/${this.type||"html"}?odd=${this.odd?this.odd:e.odd}.odd&token=${this._token}`}else t=/^(?:[a-z]+:)?\/\//i.test(this.url)?this.url:`${this.getEndpoint()}/${this.url}`,t=this.lessThanApiVersion("1.0.0")?`${t}${this.type?"."+this.type:""}?odd=${this.odd}&cache=no&token='${this._token}`:`${t}/${this.type}?odd=${this.odd}&token='${this._token}`;return this.params&&(t+="&"+this.params),this.source&&(t+="&source=true"),t}_handleClick(t){if(this.dialog){const t=document.getElementById(this.dialog);t.open();const e=this._token,i=window.setInterval(()=>{Cookies.get("simple.token")===e&&(window.clearInterval(i),Cookies.remove("simple.token"),t.close())})}"_self"===this._target&&(t.preventDefault(),window.location=this._href)}}customElements.define("pb-download",Qs);class Zs extends(
|
|
1366
|
+
`}_computeTarget(){return this.source?"_blank":"_self"}_computeURL(){let t;this._token=797*(new Date).getTime();const e=this.getDocument();if(e)if(this.url)t=`${this.toAbsoluteURL(this.url)}?odd=${this.odd?this.odd:e.odd}.odd`;else{const i=this.getEndpoint()+"/";t=this.lessThanApiVersion("1.0.0")?`${e.getFileName()}${this.type?"."+this.type:""}?odd=${this.odd?this.odd:e.odd}.odd&cache=no&token=${this._token}`:`${i}api/document/${encodeURIComponent(e.path)}/${this.type||"html"}?odd=${this.odd?this.odd:e.odd}.odd&token=${this._token}`}else t=/^(?:[a-z]+:)?\/\//i.test(this.url)?this.url:`${this.getEndpoint()}/${this.url}`,t=this.lessThanApiVersion("1.0.0")?`${t}${this.type?"."+this.type:""}?odd=${this.odd}&cache=no&token='${this._token}`:`${t}/${this.type}?odd=${this.odd}&token='${this._token}`;return this.params&&(t+="&"+this.params),this.source&&(t+="&source=true"),t}_handleClick(t){if(this.dialog){const t=document.getElementById(this.dialog);t.open();const e=this._token,i=window.setInterval(()=>{Cookies.get("simple.token")===e&&(window.clearInterval(i),Cookies.remove("simple.token"),t.close())})}"_self"===this._target&&(t.preventDefault(),window.location=this._href)}}customElements.define("pb-download",Qs);class Zs extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{loggedIn:{type:Boolean,attribute:"logged-in",reflect:!0},user:{type:String},password:{type:String},group:{type:String},groups:{type:Array},auto:{type:Boolean},loginLabel:{type:String,reflect:!0,attribute:"login-label"},logoutLabel:{type:String,reflect:!0,attribute:"logout-label"},loginIcon:{type:String,attribute:"login-icon"},logoutIcon:{type:String,attribute:"logout-icon"},_invalid:{type:Boolean},_hasFocus:{type:Boolean}})}constructor(){super(),this.loggedIn=!1,this.loginLabel="login.login",this.logoutLabel="login.as",this.user="",this.groups=[],this.loginIcon="account-circle",this.logoutIcon="supervisor-account",this._hasFocus=!0}firstUpdated(){super.firstUpdated(),this._checkLogin=this.shadowRoot.getElementById("checkLogin"),this._loginDialog=this.shadowRoot.getElementById("loginDialog"),window.addEventListener("blur",()=>{this._hasFocus=!1}),window.addEventListener("focus",()=>{this._hasFocus||(this._hasFocus=!0,this._checkLogin.body=null,this._checkLogin.generateRequest())}),Zs.waitOnce("pb-page-ready",t=>{N(t.apiVersion,"1.0.0")?this._checkLogin.url=t.endpoint+"/api/login/":this._checkLogin.url=t.endpoint+"/login",this._checkLogin.body={user:this.user,password:this.password},this._checkLogin.generateRequest()})}render(){return O`
|
|
1367
1367
|
<a href="#" @click="${this._show}" title="${this.user}">
|
|
1368
|
-
${this.loggedIn?
|
|
1368
|
+
${this.loggedIn?O`<iron-icon icon="${this.logoutIcon}"></iron-icon> <span class="label">${F(this.logoutLabel,{user:this.user})}</span>`:O`<iron-icon icon="${this.loginIcon}"></iron-icon> <span class="label">${F(this.loginLabel)}</span>`}
|
|
1369
1369
|
</a>
|
|
1370
1370
|
|
|
1371
1371
|
<paper-dialog id="loginDialog">
|
|
1372
|
-
<h2>${
|
|
1372
|
+
<h2>${F("login.login")}</h2>
|
|
1373
1373
|
<paper-dialog-scrollable>
|
|
1374
1374
|
<form action="login">
|
|
1375
|
-
<paper-input id="user" name="user" label="${
|
|
1376
|
-
<paper-input id="password" name="password" label="${
|
|
1375
|
+
<paper-input id="user" name="user" label="${F("login.user")}" value="${this.user}" autofocus></paper-input>
|
|
1376
|
+
<paper-input id="password" name="password" label="${F("login.password")}" type="password"></paper-input>
|
|
1377
1377
|
<input id="logout" type="hidden" name="logout"></input>
|
|
1378
1378
|
</form>
|
|
1379
1379
|
<slot name="information"></slot>
|
|
1380
|
-
${this._invalid?
|
|
1381
|
-
<p id="message" part="message-invalid">${
|
|
1380
|
+
${this._invalid?O`
|
|
1381
|
+
<p id="message" part="message-invalid">${F("login.invalid")}<span part="group-invalid">${this.group?O` (${F("login.requiredGroup",{group:this.group})})`:null}</span>.
|
|
1382
1382
|
</p>
|
|
1383
1383
|
`:null}
|
|
1384
1384
|
</paper-dialog-scrollable>
|
|
1385
1385
|
<div class="buttons">
|
|
1386
|
-
<paper-button autofocus @click="${this._confirmLogin}">${
|
|
1386
|
+
<paper-button autofocus @click="${this._confirmLogin}">${F(this.loginLabel)}</paper-button>
|
|
1387
1387
|
</div>
|
|
1388
1388
|
</paper-dialog>
|
|
1389
1389
|
|
|
@@ -1391,7 +1391,7 @@ function(t){var e;if("function"==typeof define&&define.amd&&(define(t),e=!0),"ob
|
|
|
1391
1391
|
handle-as="json" @response="${this._handleResponse}" @error="${this._handleError}"
|
|
1392
1392
|
method="post"
|
|
1393
1393
|
content-type="application/x-www-form-urlencoded"></iron-ajax>
|
|
1394
|
-
`}static get styles(){return
|
|
1394
|
+
`}static get styles(){return V`
|
|
1395
1395
|
:host {
|
|
1396
1396
|
display: block;
|
|
1397
1397
|
}
|
|
@@ -1423,7 +1423,7 @@ function(t){var e;if("function"==typeof define&&define.amd&&(define(t),e=!0),"ob
|
|
|
1423
1423
|
#message {
|
|
1424
1424
|
color: var(--paper-red-800);
|
|
1425
1425
|
}
|
|
1426
|
-
`}_show(t){t.preventDefault(),this.loggedIn?(this._checkLogin.body={logout:this.user},this._checkLogin.generateRequest()):this._loginDialog.open()}_confirmLogin(){this.user=this.shadowRoot.getElementById("user").value,this.password=this.shadowRoot.getElementById("password").value,this._checkLogin.body={user:this.user,password:this.password},this._checkLogin.generateRequest()}_handleResponse(){const t=this._checkLogin.lastResponse;t.user&&this._checkGroup(t)?(t.userChanged=!this.loggedIn||this.user!==t.user,this.loggedIn=!0,this.user=t.user,this.groups=t.groups,this._invalid=!1,this._loginDialog.close()):(t.userChanged=this.loggedIn,this.loggedIn=!1,this.password=null,this._loginDialog.opened?this._invalid=!0:this.auto&&this._loginDialog.open()),this.emitTo("pb-login",t)}_handleError(){const t={userChanged:this.loggedIn,user:null};this.loggedIn=!1,this.password=null,this._loginDialog.opened?this._invalid=!0:this.auto&&this._loginDialog.open(),this.emitTo("pb-login",t)}_checkGroup(t){return!this.group||t.groups&&t.groups.indexOf(this.group)>-1}}customElements.define("pb-login",Zs);class Js extends(
|
|
1426
|
+
`}_show(t){t.preventDefault(),this.loggedIn?(this._checkLogin.body={logout:this.user},this._checkLogin.generateRequest()):this._loginDialog.open()}_confirmLogin(){this.user=this.shadowRoot.getElementById("user").value,this.password=this.shadowRoot.getElementById("password").value,this._checkLogin.body={user:this.user,password:this.password},this._checkLogin.generateRequest()}_handleResponse(){const t=this._checkLogin.lastResponse;t.user&&this._checkGroup(t)?(t.userChanged=!this.loggedIn||this.user!==t.user,this.loggedIn=!0,this.user=t.user,this.groups=t.groups,this._invalid=!1,this._loginDialog.close()):(t.userChanged=this.loggedIn,this.loggedIn=!1,this.password=null,this._loginDialog.opened?this._invalid=!0:this.auto&&this._loginDialog.open()),this.emitTo("pb-login",t)}_handleError(){const t={userChanged:this.loggedIn,user:null};this.loggedIn=!1,this.password=null,this._loginDialog.opened?this._invalid=!0:this.auto&&this._loginDialog.open(),this.emitTo("pb-login",t)}_checkGroup(t){return!this.group||t.groups&&t.groups.indexOf(this.group)>-1}}customElements.define("pb-login",Zs);class Js extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{url:{type:String},title:{type:String},method:{type:String},event:{type:String},_message:{type:String}})}constructor(){super(),this.method="get"}connectedCallback(){super.connectedCallback(),this.subscribeTo("pb-update",this._onUpdate.bind(this))}render(){return O`
|
|
1427
1427
|
<a id="button" @click="${this._handleClick}" title="${this.title}"><slot></slot></a>
|
|
1428
1428
|
<iron-ajax
|
|
1429
1429
|
id="loadContent"
|
|
@@ -1434,38 +1434,38 @@ function(t){var e;if("function"==typeof define&&define.amd&&(define(t),e=!0),"ob
|
|
|
1434
1434
|
@error="${this._handleError}"
|
|
1435
1435
|
@response="${this._handleResponse}"></iron-ajax>
|
|
1436
1436
|
${this.dialogTemplate}
|
|
1437
|
-
`}get dialogTemplate(){return
|
|
1437
|
+
`}get dialogTemplate(){return O`
|
|
1438
1438
|
<paper-dialog id="messageDialog">
|
|
1439
1439
|
<h2><slot name="title">Action</slot></h2>
|
|
1440
|
-
<paper-dialog-scrollable>${
|
|
1440
|
+
<paper-dialog-scrollable>${S(this._message)}</paper-dialog-scrollable>
|
|
1441
1441
|
<div class="buttons">
|
|
1442
1442
|
<paper-button dialog-confirm="dialog-confirm" autofocus="autofocus">
|
|
1443
|
-
${
|
|
1443
|
+
${F("dialogs.close")}
|
|
1444
1444
|
</paper-button>
|
|
1445
1445
|
</div>
|
|
1446
1446
|
</paper-dialog>
|
|
1447
|
-
`}static get styles(){return
|
|
1447
|
+
`}static get styles(){return V`
|
|
1448
1448
|
:host {
|
|
1449
1449
|
display: block;
|
|
1450
1450
|
}
|
|
1451
1451
|
slot[name="title"] {
|
|
1452
1452
|
margin: 0;
|
|
1453
1453
|
}
|
|
1454
|
-
`}_handleClick(t){t.preventDefault(),this.trigger()}trigger(){this.shadowRoot.getElementById("loadContent").url=`${this.getEndpoint()}/${this.url}`,this.emitTo("pb-start-update"),this.shadowRoot.getElementById("loadContent").generateRequest()}_handleResponse(){const t=this.shadowRoot.getElementById("loadContent").lastResponse;this._message=t;this.shadowRoot.getElementById("messageDialog").open(),this.emitTo("pb-end-update"),this.event&&this.emitTo(this.event)}_handleError(){const t=this.shadowRoot.getElementById("loadContent").lastError.response,e=(new DOMParser).parseFromString(t,"application/xml").querySelector("message");this._message=e?e.textContent:t;this.shadowRoot.getElementById("messageDialog").open(),this.emitTo("pb-end-update")}_onUpdate(t){this.shadowRoot.getElementById("loadContent").params=t.detail.params}}customElements.define("pb-ajax",Js);class ta extends(
|
|
1455
|
-
${this.nolabel?
|
|
1454
|
+
`}_handleClick(t){t.preventDefault(),this.trigger()}trigger(){this.shadowRoot.getElementById("loadContent").url=`${this.getEndpoint()}/${this.url}`,this.emitTo("pb-start-update"),this.shadowRoot.getElementById("loadContent").generateRequest()}_handleResponse(){const t=this.shadowRoot.getElementById("loadContent").lastResponse;this._message=t;this.shadowRoot.getElementById("messageDialog").open(),this.emitTo("pb-end-update"),this.event&&this.emitTo(this.event)}_handleError(){const t=this.shadowRoot.getElementById("loadContent").lastError.response,e=(new DOMParser).parseFromString(t,"application/xml").querySelector("message");this._message=e?e.textContent:t;this.shadowRoot.getElementById("messageDialog").open(),this.emitTo("pb-end-update")}_onUpdate(t){this.shadowRoot.getElementById("loadContent").params=t.detail.params}}customElements.define("pb-ajax",Js);class ta extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{label:{type:String},selected:{type:String},nolabel:{type:Boolean}})}constructor(){super(),this.label="language"}connectedCallback(){super.connectedCallback(),this.subscribeTo("pb-i18n-update",t=>{this.selected=t.detail.language.replace(/^([^-]+).*$/,"$1")},[]),ta.waitOnce("pb-i18n-update",t=>{this.selected=t.language.replace(/^([^-]+).*$/,"$1")})}render(){return O`
|
|
1455
|
+
${this.nolabel?O`
|
|
1456
1456
|
<paper-dropdown-menu>
|
|
1457
1457
|
<paper-listbox id="menu" slot="dropdown-content" class="dropdown-content" selected="${this.selected}"
|
|
1458
1458
|
attr-for-selected="value" @selected-item-changed="${this._changed}">
|
|
1459
1459
|
<slot></slot>
|
|
1460
1460
|
</paper-listbox>
|
|
1461
|
-
</paper-dropdown-menu>`:
|
|
1462
|
-
<paper-dropdown-menu label="${
|
|
1461
|
+
</paper-dropdown-menu>`:O`
|
|
1462
|
+
<paper-dropdown-menu label="${F(this.label)}">
|
|
1463
1463
|
<paper-listbox id="menu" slot="dropdown-content" class="dropdown-content" selected="${this.selected}"
|
|
1464
1464
|
attr-for-selected="value" @selected-item-changed="${this._changed}">
|
|
1465
1465
|
<slot></slot>
|
|
1466
1466
|
</paper-listbox>
|
|
1467
1467
|
</paper-dropdown-menu>`}
|
|
1468
|
-
`}static get styles(){return
|
|
1468
|
+
`}static get styles(){return V`
|
|
1469
1469
|
:host {
|
|
1470
1470
|
display: block;
|
|
1471
1471
|
--paper-input-container-input-color: var(--pb-lang-input-color, black);
|
|
@@ -1560,7 +1560,7 @@ e({_template:n`
|
|
|
1560
1560
|
<div class="tab-content">
|
|
1561
1561
|
<slot></slot>
|
|
1562
1562
|
</div>
|
|
1563
|
-
`,is:"paper-tab",behaviors:[
|
|
1563
|
+
`,is:"paper-tab",behaviors:[o,s,a],properties:{link:{type:Boolean,value:!1,reflectToAttribute:!0}},hostAttributes:{role:"tab"},listeners:{down:"_updateNoink",tap:"_onTap"},attached:function(){this._updateNoink()},get _parentNoink(){var e=t(this).parentNode;return!!e&&!!e.noink},_updateNoink:function(){this.noink=!!this.noink||!!this._parentNoink},_onTap:function(t){if(this.link){var e=this.queryEffectiveChildren("a");if(!e)return;if(t.target===e)return;e.click()}}});
|
|
1564
1564
|
/**
|
|
1565
1565
|
@license
|
|
1566
1566
|
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
@@ -1697,7 +1697,7 @@ e({_template:n`
|
|
|
1697
1697
|
</div>
|
|
1698
1698
|
|
|
1699
1699
|
<paper-icon-button icon="paper-tabs:chevron-right" class$="[[_computeScrollButtonClass(_rightHidden, scrollable, hideScrollButtons)]]" on-up="_onScrollButtonUp" on-down="_onRightScrollButtonDown" tabindex="-1"></paper-icon-button>
|
|
1700
|
-
`,is:"paper-tabs",behaviors:[
|
|
1700
|
+
`,is:"paper-tabs",behaviors:[c,[l,{hostAttributes:{role:"menubar"},keyBindings:{left:"_onLeftKey",right:"_onRightKey"},_onUpKey:function(t){this.focusedItem.click(),t.detail.keyboardEvent.preventDefault()},_onDownKey:function(t){this.focusedItem.click(),t.detail.keyboardEvent.preventDefault()},get _isRTL(){return"rtl"===window.getComputedStyle(this).direction},_onLeftKey:function(t){this._isRTL?this._focusNext():this._focusPrevious(),t.detail.keyboardEvent.preventDefault()},_onRightKey:function(t){this._isRTL?this._focusPrevious():this._focusNext(),t.detail.keyboardEvent.preventDefault()},_onKeydown:function(t){this.keyboardEventMatchesKeys(t,"up down left right esc")||this._focusWithKeyboardEvent(t)}}]],properties:{noink:{type:Boolean,value:!1,observer:"_noinkChanged"},noBar:{type:Boolean,value:!1},noSlide:{type:Boolean,value:!1},scrollable:{type:Boolean,value:!1},fitContainer:{type:Boolean,value:!1},disableDrag:{type:Boolean,value:!1},hideScrollButtons:{type:Boolean,value:!1},alignBottom:{type:Boolean,value:!1},selectable:{type:String,value:"paper-tab"},autoselect:{type:Boolean,value:!1},autoselectDelay:{type:Number,value:0},_step:{type:Number,value:10},_holdDelay:{type:Number,value:1},_leftHidden:{type:Boolean,value:!1},_rightHidden:{type:Boolean,value:!1},_previousTab:{type:Object}},hostAttributes:{role:"tablist"},listeners:{"iron-resize":"_onTabSizingChanged","iron-items-changed":"_onTabSizingChanged","iron-select":"_onIronSelect","iron-deselect":"_onIronDeselect"},keyBindings:{"left:keyup right:keyup":"_onArrowKeyup"},created:function(){this._holdJob=null,this._pendingActivationItem=void 0,this._pendingActivationTimeout=void 0,this._bindDelayedActivationHandler=this._delayedActivationHandler.bind(this),this.addEventListener("blur",this._onBlurCapture.bind(this),!0)},ready:function(){this.setScrollDirection("y",this.$.tabsContainer)},detached:function(){this._cancelPendingActivation()},_noinkChanged:function(e){t(this).querySelectorAll("paper-tab").forEach(e?this._setNoinkAttribute:this._removeNoinkAttribute)},_setNoinkAttribute:function(t){t.setAttribute("noink","")},_removeNoinkAttribute:function(t){t.removeAttribute("noink")},_computeScrollButtonClass:function(t,e,i){return!e||i?"hidden":t?"not-visible":""},_computeTabsContentClass:function(t,e){return t?"scrollable"+(e?" fit-container":""):" fit-container"},_computeSelectionBarClass:function(t,e){return t?"hidden":e?"align-bottom":""},_onTabSizingChanged:function(){this.debounce("_onTabSizingChanged",(function(){this._scroll(),this._tabChanged(this.selectedItem)}),10)},_onIronSelect:function(t){this._tabChanged(t.detail.item,this._previousTab),this._previousTab=t.detail.item,this.cancelDebouncer("tab-changed")},_onIronDeselect:function(t){this.debounce("tab-changed",(function(){this._tabChanged(null,this._previousTab),this._previousTab=null}),1)},_activateHandler:function(){this._cancelPendingActivation(),h._activateHandler.apply(this,arguments)},_scheduleActivation:function(t,e){this._pendingActivationItem=t,this._pendingActivationTimeout=this.async(this._bindDelayedActivationHandler,e)},_delayedActivationHandler:function(){var t=this._pendingActivationItem;this._pendingActivationItem=void 0,this._pendingActivationTimeout=void 0,t.fire(this.activateEvent,null,{bubbles:!0,cancelable:!0})},_cancelPendingActivation:function(){void 0!==this._pendingActivationTimeout&&(this.cancelAsync(this._pendingActivationTimeout),this._pendingActivationItem=void 0,this._pendingActivationTimeout=void 0)},_onArrowKeyup:function(t){this.autoselect&&this._scheduleActivation(this.focusedItem,this.autoselectDelay)},_onBlurCapture:function(t){t.target===this._pendingActivationItem&&this._cancelPendingActivation()},get _tabContainerScrollSize(){return Math.max(0,this.$.tabsContainer.scrollWidth-this.$.tabsContainer.offsetWidth)},_scroll:function(t,e){if(this.scrollable){var i=e&&-e.ddx||0;this._affectScroll(i)}},_down:function(t){this.async((function(){this._defaultFocusAsync&&(this.cancelAsync(this._defaultFocusAsync),this._defaultFocusAsync=null)}),1)},_affectScroll:function(t){this.$.tabsContainer.scrollLeft+=t;var e=this.$.tabsContainer.scrollLeft;this._leftHidden=0===e,this._rightHidden=e===this._tabContainerScrollSize},_onLeftScrollButtonDown:function(){this._scrollToLeft(),this._holdJob=setInterval(this._scrollToLeft.bind(this),this._holdDelay)},_onRightScrollButtonDown:function(){this._scrollToRight(),this._holdJob=setInterval(this._scrollToRight.bind(this),this._holdDelay)},_onScrollButtonUp:function(){clearInterval(this._holdJob),this._holdJob=null},_scrollToLeft:function(){this._affectScroll(-this._step)},_scrollToRight:function(){this._affectScroll(this._step)},_tabChanged:function(t,e){if(!t)return this.$.selectionBar.classList.remove("expand"),this.$.selectionBar.classList.remove("contract"),void this._positionBar(0,0);var i=this.$.tabsContent.getBoundingClientRect(),n=i.width,r=t.getBoundingClientRect(),o=r.left-i.left;if(this._pos={width:this._calcPercent(r.width,n),left:this._calcPercent(o,n)},this.noSlide||null==e)return this.$.selectionBar.classList.remove("expand"),this.$.selectionBar.classList.remove("contract"),void this._positionBar(this._pos.width,this._pos.left);var s=e.getBoundingClientRect(),a=this.items.indexOf(e),l=this.items.indexOf(t),c=5;this.$.selectionBar.classList.add("expand");var h=a<l;this._isRTL&&(h=!h),h?this._positionBar(this._calcPercent(r.left+r.width-s.left,n)-c,this._left):this._positionBar(this._calcPercent(s.left+s.width-r.left,n)-c,this._calcPercent(o,n)+c),this.scrollable&&this._scrollToSelectedIfNeeded(r.width,o)},_scrollToSelectedIfNeeded:function(t,e){var i=e-this.$.tabsContainer.scrollLeft;(i<0||(i+=t-this.$.tabsContainer.offsetWidth)>0)&&(this.$.tabsContainer.scrollLeft+=i)},_calcPercent:function(t,e){return 100*t/e},_positionBar:function(t,e){t=t||0,e=e||0,this._width=t,this._left=e,this.transform("translateX("+e+"%) scaleX("+t/100+")",this.$.selectionBar)},_onBarTransitionEnd:function(t){var e=this.$.selectionBar.classList;e.contains("expand")?(e.remove("expand"),e.add("contract"),this._positionBar(this._pos.width,this._pos.left)):e.contains("contract")&&e.remove("contract")}}),
|
|
1701
1701
|
/**
|
|
1702
1702
|
@license
|
|
1703
1703
|
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
@@ -1720,14 +1720,14 @@ e({_template:n`
|
|
|
1720
1720
|
</style>
|
|
1721
1721
|
|
|
1722
1722
|
<slot></slot>
|
|
1723
|
-
`,is:"iron-pages",behaviors:[
|
|
1723
|
+
`,is:"iron-pages",behaviors:[c,d],properties:{activateEvent:{type:String,value:null}},observers:["_selectedPageChanged(selected)"],_selectedPageChanged:function(t,e){this.async(this.notifyResize)}});class ia extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{selected:{type:Number,reflect:!0},_initial:{type:Number}})}constructor(){super(),this._initial=this.getParameter("tab",0),this.selected=this._initial}_switchTab(t){this.selected=t.detail.value,this.setParameter("tab",this.selected),this.pushHistory("browse",{tab:this.selected})}render(){return O`
|
|
1724
1724
|
<paper-tabs id="tabs" selected="${this._initial}" @selected-changed="${this._switchTab}">
|
|
1725
1725
|
<slot name="tab"></slot>
|
|
1726
1726
|
</paper-tabs>
|
|
1727
1727
|
<iron-pages part="pages" selected="${this.selected}">
|
|
1728
1728
|
<slot name="page"></slot>
|
|
1729
1729
|
</iron-pages>
|
|
1730
|
-
`}static get styles(){return
|
|
1730
|
+
`}static get styles(){return V`
|
|
1731
1731
|
:host {
|
|
1732
1732
|
display: block;
|
|
1733
1733
|
}
|
|
@@ -1857,7 +1857,7 @@ e({_template:n`
|
|
|
1857
1857
|
<div id="contentContainer" opened\$="[[opened]]" persistent\$="[[persistent]]" position\$="[[position]]" swipe-open\$="[[swipeOpen]]">
|
|
1858
1858
|
<slot></slot>
|
|
1859
1859
|
</div>
|
|
1860
|
-
`,is:"app-drawer",properties:{opened:{type:Boolean,value:!1,notify:!0,reflectToAttribute:!0},persistent:{type:Boolean,value:!1,reflectToAttribute:!0},transitionDuration:{type:Number,value:200},align:{type:String,value:"left"},position:{type:String,readOnly:!0,reflectToAttribute:!0},swipeOpen:{type:Boolean,value:!1,reflectToAttribute:!0},noFocusTrap:{type:Boolean,value:!1},disableSwipe:{type:Boolean,value:!1}},observers:["resetLayout(position, isAttached)","_resetPosition(align, isAttached)","_styleTransitionDuration(transitionDuration)","_openedPersistentChanged(opened, persistent)"],_translateOffset:0,_trackDetails:null,_drawerState:0,_boundEscKeydownHandler:null,_firstTabStop:null,_lastTabStop:null,attached:function(){
|
|
1860
|
+
`,is:"app-drawer",properties:{opened:{type:Boolean,value:!1,notify:!0,reflectToAttribute:!0},persistent:{type:Boolean,value:!1,reflectToAttribute:!0},transitionDuration:{type:Number,value:200},align:{type:String,value:"left"},position:{type:String,readOnly:!0,reflectToAttribute:!0},swipeOpen:{type:Boolean,value:!1,reflectToAttribute:!0},noFocusTrap:{type:Boolean,value:!1},disableSwipe:{type:Boolean,value:!1}},observers:["resetLayout(position, isAttached)","_resetPosition(align, isAttached)","_styleTransitionDuration(transitionDuration)","_openedPersistentChanged(opened, persistent)"],_translateOffset:0,_trackDetails:null,_drawerState:0,_boundEscKeydownHandler:null,_firstTabStop:null,_lastTabStop:null,attached:function(){p(this,(function(){this._boundEscKeydownHandler=this._escKeydownHandler.bind(this),this.addEventListener("keydown",this._tabKeydownHandler.bind(this)),this.listen(this,"track","_track"),this.setScrollDirection("y")})),this.fire("app-reset-layout")},detached:function(){document.removeEventListener("keydown",this._boundEscKeydownHandler)},open:function(){this.opened=!0},close:function(){this.opened=!1},toggle:function(){this.opened=!this.opened},getWidth:function(){return this._savedWidth||this.$.contentContainer.offsetWidth},_isRTL:function(){return"rtl"===window.getComputedStyle(this).direction},_resetPosition:function(){switch(this.align){case"start":return void this._setPosition(this._isRTL()?"right":"left");case"end":return void this._setPosition(this._isRTL()?"left":"right")}this._setPosition(this.align)},_escKeydownHandler:function(t){var e=27;t.keyCode===e&&(t.preventDefault(),this.close())},_track:function(t){if(!this.persistent&&!this.disableSwipe)switch(t.preventDefault(),t.detail.state){case"start":this._trackStart(t);break;case"track":this._trackMove(t);break;case"end":this._trackEnd(t)}},_trackStart:function(t){this._drawerState=this._DRAWER_STATE.TRACKING;var e=this.$.contentContainer.getBoundingClientRect();this._savedWidth=e.width,"left"===this.position?this._translateOffset=e.left:this._translateOffset=e.right-window.innerWidth,this._trackDetails=[],this._styleTransitionDuration(0),this.style.visibility="visible"},_trackMove:function(t){this._translateDrawer(t.detail.dx+this._translateOffset),this._trackDetails.push({dx:t.detail.dx,timeStamp:Date.now()})},_trackEnd:function(t){var e=t.detail.dx+this._translateOffset,i=this.getWidth(),n="left"===this.position?e>=0||e<=-i:e<=0||e>=i;if(!n){var r=this._trackDetails;if(this._trackDetails=null,this._flingDrawer(t,r),this._drawerState===this._DRAWER_STATE.FLINGING)return}var o=i/2;t.detail.dx<-o?this.opened="right"===this.position:t.detail.dx>o&&(this.opened="left"===this.position),n?this.debounce("_resetDrawerState",this._resetDrawerState):this.debounce("_resetDrawerState",this._resetDrawerState,this.transitionDuration),this._styleTransitionDuration(this.transitionDuration),this._resetDrawerTranslate(),this.style.visibility=""},_calculateVelocity:function(t,e){for(var i,n=Date.now(),r=n-100,o=0,s=e.length-1;o<=s;){var a=o+s>>1,l=e[a];l.timeStamp>=r?(i=l,s=a-1):o=a+1}return i?(t.detail.dx-i.dx)/(n-i.timeStamp||1):0},_flingDrawer:function(t,e){var i=this._calculateVelocity(t,e);if(!(Math.abs(i)<this._MIN_FLING_THRESHOLD)){this._drawerState=this._DRAWER_STATE.FLINGING;var n,r=t.detail.dx+this._translateOffset,o=this.getWidth(),s="left"===this.position,a=i>0;n=!a&&s?-(r+o):a&&!s?o-r:-r,a?(i=Math.max(i,this._MIN_TRANSITION_VELOCITY),this.opened="left"===this.position):(i=Math.min(i,-this._MIN_TRANSITION_VELOCITY),this.opened="right"===this.position);var l=this._FLING_INITIAL_SLOPE*n/i;this._styleTransitionDuration(l),this._styleTransitionTimingFunction(this._FLING_TIMING_FUNCTION),this._resetDrawerTranslate(),this.debounce("_resetDrawerState",this._resetDrawerState,l)}},_styleTransitionDuration:function(t){this.style.transitionDuration=t+"ms",this.$.contentContainer.style.transitionDuration=t+"ms",this.$.scrim.style.transitionDuration=t+"ms"},_styleTransitionTimingFunction:function(t){this.$.contentContainer.style.transitionTimingFunction=t,this.$.scrim.style.transitionTimingFunction=t},_translateDrawer:function(t){var e=this.getWidth();"left"===this.position?(t=Math.max(-e,Math.min(t,0)),this.$.scrim.style.opacity=1+t/e):(t=Math.max(0,Math.min(t,e)),this.$.scrim.style.opacity=1-t/e),this.translate3d(t+"px","0","0",this.$.contentContainer)},_resetDrawerTranslate:function(){this.$.scrim.style.opacity="",this.transform("",this.$.contentContainer)},_resetDrawerState:function(){var t=this._drawerState;t===this._DRAWER_STATE.FLINGING&&(this._styleTransitionDuration(this.transitionDuration),this._styleTransitionTimingFunction(""),this.style.visibility=""),this._savedWidth=null,this.opened?this._drawerState=this.persistent?this._DRAWER_STATE.OPENED_PERSISTENT:this._DRAWER_STATE.OPENED:this._drawerState=this._DRAWER_STATE.CLOSED,t!==this._drawerState&&(this._drawerState===this._DRAWER_STATE.OPENED?(this._setKeyboardFocusTrap(),document.addEventListener("keydown",this._boundEscKeydownHandler),document.body.style.overflow="hidden"):(document.removeEventListener("keydown",this._boundEscKeydownHandler),document.body.style.overflow=""),t!==this._DRAWER_STATE.INIT&&this.fire("app-drawer-transitioned"))},resetLayout:function(){this.fire("app-reset-layout")},_setKeyboardFocusTrap:function(){if(!this.noFocusTrap){var e=['a[href]:not([tabindex="-1"])','area[href]:not([tabindex="-1"])','input:not([disabled]):not([tabindex="-1"])','select:not([disabled]):not([tabindex="-1"])','textarea:not([disabled]):not([tabindex="-1"])','button:not([disabled]):not([tabindex="-1"])','iframe:not([tabindex="-1"])','[tabindex]:not([tabindex="-1"])','[contentEditable=true]:not([tabindex="-1"])'].join(","),i=t(this).querySelectorAll(e);i.length>0?(this._firstTabStop=i[0],this._lastTabStop=i[i.length-1]):(this._firstTabStop=null,this._lastTabStop=null);var n=this.getAttribute("tabindex");n&&parseInt(n,10)>-1?this.focus():this._firstTabStop&&this._firstTabStop.focus()}},_tabKeydownHandler:function(e){if(!this.noFocusTrap){var i=9;this._drawerState===this._DRAWER_STATE.OPENED&&e.keyCode===i&&(e.shiftKey?this._firstTabStop&&t(e).localTarget===this._firstTabStop&&(e.preventDefault(),this._lastTabStop.focus()):this._lastTabStop&&t(e).localTarget===this._lastTabStop&&(e.preventDefault(),this._firstTabStop.focus()))}},_openedPersistentChanged:function(t,e){this.toggleClass("visible",t&&!e,this.$.scrim),this.debounce("_resetDrawerState",this._resetDrawerState,this.transitionDuration)},_MIN_FLING_THRESHOLD:.2,_MIN_TRANSITION_VELOCITY:1.2,_FLING_TIMING_FUNCTION:"cubic-bezier(0.667, 1, 0.667, 1)",_FLING_INITIAL_SLOPE:1.5,_DRAWER_STATE:{INIT:0,OPENED:1,OPENED_PERSISTENT:2,CLOSED:3,TRACKING:4,FLINGING:5}}),
|
|
1861
1861
|
/**
|
|
1862
1862
|
@license
|
|
1863
1863
|
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
@@ -1879,7 +1879,7 @@ found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
|
1879
1879
|
part of the polymer project is also subject to an additional IP rights grant
|
|
1880
1880
|
found at http://polymer.github.io/PATENTS.txt
|
|
1881
1881
|
*/
|
|
1882
|
-
const na=[
|
|
1882
|
+
const na=[c,{listeners:{"app-reset-layout":"_appResetLayoutHandler","iron-resize":"resetLayout"},attached:function(){this.fire("app-reset-layout")},_appResetLayoutHandler:function(e){t(e).path[0]!==this&&(this.resetLayout(),e.stopPropagation())},_updateLayoutStates:function(){console.error("unimplemented")},resetLayout:function(){var t=this._updateLayoutStates.bind(this);this._layoutDebouncer=u.debounce(this._layoutDebouncer,g,t),f(this._layoutDebouncer),this._notifyDescendantResize()},_notifyLayoutChanged:function(){var t=this;requestAnimationFrame((function(){t.fire("app-reset-layout")}))},_notifyDescendantResize:function(){this.isAttached&&this._interestedResizables.forEach((function(t){this.resizerShouldNotify(t)&&this._notifyDescendant(t)}),this)}}];
|
|
1883
1883
|
/**
|
|
1884
1884
|
@license
|
|
1885
1885
|
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
@@ -1933,7 +1933,7 @@ found at http://polymer.github.io/PATENTS.txt
|
|
|
1933
1933
|
</div>
|
|
1934
1934
|
|
|
1935
1935
|
<iron-media-query query="[[_computeMediaQuery(forceNarrow, responsiveWidth)]]" on-query-matches-changed="_onQueryMatchesChanged"></iron-media-query>
|
|
1936
|
-
`,is:"app-drawer-layout",behaviors:[na],properties:{forceNarrow:{type:Boolean,value:!1},responsiveWidth:{type:String,value:"640px"},narrow:{type:Boolean,reflectToAttribute:!0,readOnly:!0,notify:!0},openedWhenNarrow:{type:Boolean,value:!1},_drawerPosition:{type:String}},listeners:{click:"_clickHandler"},observers:["_narrowChanged(narrow)"],get drawer(){return t(this.$.drawerSlot).getDistributedNodes()[0]},attached:function(){var t=this.drawer;t&&t.setAttribute("no-transition","")},_clickHandler:function(e){var i=t(e).localTarget;if(i&&i.hasAttribute("drawer-toggle")){var n=this.drawer;n&&!n.persistent&&n.toggle()}},_updateLayoutStates:function(){var t=this.drawer;this.isAttached&&t&&(this._drawerPosition=this.narrow?null:t.position,this._drawerNeedsReset&&(this.narrow?(t.opened=this.openedWhenNarrow,t.persistent=!1):t.opened=t.persistent=!0,t.hasAttribute("no-transition")&&
|
|
1936
|
+
`,is:"app-drawer-layout",behaviors:[na],properties:{forceNarrow:{type:Boolean,value:!1},responsiveWidth:{type:String,value:"640px"},narrow:{type:Boolean,reflectToAttribute:!0,readOnly:!0,notify:!0},openedWhenNarrow:{type:Boolean,value:!1},_drawerPosition:{type:String}},listeners:{click:"_clickHandler"},observers:["_narrowChanged(narrow)"],get drawer(){return t(this.$.drawerSlot).getDistributedNodes()[0]},attached:function(){var t=this.drawer;t&&t.setAttribute("no-transition","")},_clickHandler:function(e){var i=t(e).localTarget;if(i&&i.hasAttribute("drawer-toggle")){var n=this.drawer;n&&!n.persistent&&n.toggle()}},_updateLayoutStates:function(){var t=this.drawer;this.isAttached&&t&&(this._drawerPosition=this.narrow?null:t.position,this._drawerNeedsReset&&(this.narrow?(t.opened=this.openedWhenNarrow,t.persistent=!1):t.opened=t.persistent=!0,t.hasAttribute("no-transition")&&p(this,(function(){t.removeAttribute("no-transition")})),this._drawerNeedsReset=!1))},_narrowChanged:function(){this._drawerNeedsReset=!0,this.resetLayout()},_onQueryMatchesChanged:function(t){this._setNarrow(t.detail.value)},_computeMediaQuery:function(t,e){return t?"(min-width: 0px)":"(max-width: "+e+")"}});
|
|
1937
1937
|
/**
|
|
1938
1938
|
@license
|
|
1939
1939
|
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
|
|
@@ -2235,18 +2235,18 @@ e({_template:n`
|
|
|
2235
2235
|
<div id="contentContainer">
|
|
2236
2236
|
<slot></slot>
|
|
2237
2237
|
</div>
|
|
2238
|
-
`,is:"app-box",behaviors:[Y,
|
|
2238
|
+
`,is:"app-box",behaviors:[Y,c],listeners:{"iron-resize":"_resizeHandler"},_progress:0,attached:function(){this.resetLayout()},_debounceRaf:function(t){var e=this;this._raf&&window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame((function(){e._raf=null,t.call(e)}))},resetLayout:function(){this._debounceRaf((function(){if(0!==this.offsetWidth||0!==this.offsetHeight){var t=this._clampedScrollTop,e=this.disabled;this.disabled=!0,this._elementTop=this._getElementTop(),this._elementHeight=this.offsetHeight,this._cachedScrollTargetHeight=this._scrollTargetHeight,this._setUpEffect(),this._updateScrollState(t),this.disabled=e}}))},_getElementTop:function(){for(var t=this,e=0;t&&t!==this.scrollTarget;)e+=t.offsetTop,t=t.offsetParent;return e},_updateScrollState:function(t){if(this.isOnScreen()){var e=this._elementTop-t;this._progress=1-(e+this._elementHeight)/this._cachedScrollTargetHeight,this._runEffects(this._progress,t)}},isOnScreen:function(){return this._elementTop<this._scrollTop+this._cachedScrollTargetHeight&&this._elementTop+this._elementHeight>this._scrollTop},_resizeHandler:function(){this.resetLayout()},_getDOMRef:function(t){return"background"===t?this.$.background:"backgroundFrontLayer"===t?this.$.backgroundFrontLayer:void 0},getScrollState:function(){return{progress:this._progress}}});class oa extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{active:{type:Number,reflect:!0},label:{type:String},panels:{type:Array,reflect:!0}})}constructor(){super(),this.active=0,this.label="View",this.panels=null}connectedCallback(){if(super.connectedCallback(),!this.panels){const t=[];this.querySelectorAll("template").forEach(e=>t.push(e.title)),this.panels=t}this._show()}render(){return O`
|
|
2239
2239
|
<app-toolbar>
|
|
2240
2240
|
<paper-dropdown-menu id="menu" label="${this.label}">
|
|
2241
2241
|
<paper-listbox id="panels" slot="dropdown-content" class="dropdown-content"
|
|
2242
2242
|
selected="${this.active}" @selected-item-changed="${this._update}">
|
|
2243
|
-
${this.panels.map(t=>
|
|
2243
|
+
${this.panels.map(t=>O`<paper-item>${t}</paper-item>`)}
|
|
2244
2244
|
</paper-listbox>
|
|
2245
2245
|
</paper-dropdown-menu>
|
|
2246
2246
|
<slot name="toolbar"></slot>
|
|
2247
2247
|
</app-toolbar>
|
|
2248
2248
|
<slot></slot>
|
|
2249
|
-
`}static get styles(){return
|
|
2249
|
+
`}static get styles(){return V`
|
|
2250
2250
|
:host {
|
|
2251
2251
|
display: block;
|
|
2252
2252
|
}
|
|
@@ -2264,22 +2264,22 @@ e({_template:n`
|
|
|
2264
2264
|
app-toolbar {
|
|
2265
2265
|
font-size: 75%;
|
|
2266
2266
|
}
|
|
2267
|
-
`}_update(){const t=this.shadowRoot.getElementById("panels").selected;this.active!==t&&(this.active=t,this._show())}_show(){const t=this.querySelectorAll("template");this.active>=t.length&&(this.active=t.length-1),console.log("<pb-panel> showing panel %s",this.active),this.querySelectorAll("._pb_panel").forEach(t=>t.style.display="none");const e=this.querySelector("._pb_panel"+this.active);if(e)e.style.display="";else{const e=t[this.active],i=document.importNode(e.content,!0),n=document.createElement("div");n.className="_pb_panel _pb_panel"+this.active,n.appendChild(i),this.appendChild(n),this.emitTo("pb-panel",{panel:this,active:this.active})}}refresh(){this.emitTo("pb-refresh",null)}}customElements.define("pb-panel",oa);class sa extends(
|
|
2267
|
+
`}_update(){const t=this.shadowRoot.getElementById("panels").selected;this.active!==t&&(this.active=t,this._show())}_show(){const t=this.querySelectorAll("template");this.active>=t.length&&(this.active=t.length-1),console.log("<pb-panel> showing panel %s",this.active),this.querySelectorAll("._pb_panel").forEach(t=>t.style.display="none");const e=this.querySelector("._pb_panel"+this.active);if(e)e.style.display="";else{const e=t[this.active],i=document.importNode(e.content,!0),n=document.createElement("div");n.className="_pb_panel _pb_panel"+this.active,n.appendChild(i),this.appendChild(n),this.emitTo("pb-panel",{panel:this,active:this.active})}}refresh(){this.emitTo("pb-refresh",null)}}customElements.define("pb-panel",oa);class sa extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{panels:{type:Array},direction:{type:String},_columns:{type:Number},animated:{type:String},animation:{type:Boolean}})}constructor(){super(),this.direction="ltr",this.animated="pb-view",this.animation=!1}connectedCallback(){super.connectedCallback(),this.subscribeTo("pb-panel",t=>{const e=Array.from(this.querySelectorAll("._grid_panel")).indexOf(t.detail.panel);e>-1&&(console.log("<pb-grid> Updating panel %d to show %s",e,t.detail.active),this.panels["rtl"===this.direction?this.panels.length-e-1:e]=t.detail.active,localStorage.setItem("pb-grid.panels",this.panels.join(".")),this.setParameter("panels",this.panels.join(".")),this.pushHistory("added panel"))});const t=this.getParameter("panels");if(t)this.panels=t.split(".").map(t=>parseInt(t)),localStorage.setItem("pb-grid.panels",this.panels.join("."));else{const t=localStorage.getItem("pb-grid.panels");t&&(this.panels=t.split(".").map(t=>parseInt(t)))}this._columns=this.panels.length,this.template=this.querySelector("template")}firstUpdated(){this.panels.forEach(t=>this._insertPanel(t)),this._animate(),this._update()}_animate(){if(this.animation&&"anime"in window){const t=document.querySelectorAll(this.animated),e=anime.timeline({easing:"linear",duration:400});e.add({targets:t,opacity:{value:[0,.6],duration:200,delay:100,easing:"linear"},translateX:[2e3,0],duration:400,delay:anime.stagger(100,{start:100})}),e.add({targets:t,opacity:[.6,1],duration:200,delay:anime.stagger(50)}),e.play()}}addPanel(t){if(!t)if(this.panels.length>0){t=this.panels.reduce((function(t,e){return Math.max(t,e)}))+1}else t=0;this._columns++,this.panels.push(t),localStorage.setItem("pb-grid.panels",this.panels.join(".")),this.setParameter("panels",this.panels.join(".")),this.pushHistory("added panel"),this._insertPanel(t),this._update(),this.emitTo("pb-refresh",null)}removePanel(t){const e=Array.from(this.querySelectorAll("._grid_panel")).indexOf(t);console.log("<pb-grid> Removing panel %d",e),this.panels.splice("rtl"===this.direction?this.panels.length-e-1:e,1),this.setParameter("panels",this.panels.join(".")),localStorage.setItem("pb-grid.panels",this.panels.join(".")),this.pushHistory("removed panel"),t.parentNode.removeChild(t),this._columns--,this._update()}_insertPanel(t){const e=document.importNode(this.template.content.firstElementChild,!0);e.setAttribute("active",t),"ltr"===this.direction||0===this.querySelectorAll("._grid_panel").length?this.appendChild(e):this.insertBefore(e,this.firstElementChild),e.classList.add("_grid_panel")}_update(){const t=[];Array.from(this.children).forEach(e=>{if(e instanceof HTMLTemplateElement)return;const i=window.getComputedStyle(e).getPropertyValue("max-width");i&&"none"!==i?t.push(i):t.push("1fr")}),this.style.setProperty("--pb-computed-column-widths",t.join(" "))}render(){return O`<slot></slot>`}static get styles(){return V`
|
|
2268
2268
|
:host {
|
|
2269
2269
|
display: grid;
|
|
2270
2270
|
grid-template-columns: var(--pb-grid-column-widths, var(--pb-computed-column-widths));
|
|
2271
2271
|
grid-column-gap: var(--pb-grid-column-gap, 20px);
|
|
2272
2272
|
justify-content: space-between;
|
|
2273
2273
|
}
|
|
2274
|
-
`}}customElements.define("pb-grid",sa);class aa extends(
|
|
2274
|
+
`}}customElements.define("pb-grid",sa);class aa extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{action:{type:String},grid:{type:String},initial:{type:Number}})}constructor(){super(),this.action="add",this.initial=0}connectedCallback(){super.connectedCallback()}render(){return O`
|
|
2275
2275
|
<a @click="${this._click}"><slot></slot></a>
|
|
2276
|
-
`}static get styles(){return
|
|
2276
|
+
`}static get styles(){return V`
|
|
2277
2277
|
:host {
|
|
2278
2278
|
display: block;
|
|
2279
2279
|
}
|
|
2280
|
-
`}_click(){const t=document.querySelector(this.grid);if(!t||!t.addPanel)return console.error("<pb-grid-action> grid not found: %s",this.grid);"add"===this.action?t.addPanel(this.initial):t.removePanel(this.parentNode)}}customElements.define("pb-grid-action",aa);class la extends(
|
|
2281
|
-
${this.show&&!this.disabled?
|
|
2282
|
-
`}static get styles(){return
|
|
2280
|
+
`}_click(){const t=document.querySelector(this.grid);if(!t||!t.addPanel)return console.error("<pb-grid-action> grid not found: %s",this.grid);"add"===this.action?t.addPanel(this.initial):t.removePanel(this.parentNode)}}customElements.define("pb-grid-action",aa);class la extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{login:{type:String},show:{type:Boolean,reflect:!0},group:{type:String}})}constructor(){super(),this.show=!1}firstUpdated(){this.shadowRoot.querySelector("slot[name=fallback]").assignedNodes().length>0&&(console.log(this),this.classList.add("fallback"));const t=document.getElementById(this.login);t?(this.subscribeTo("pb-login",t=>{this.show=this._loggedIn(t.detail.user,t.detail.groups)},[]),this.show=t.loggedIn&&this._loggedIn(t.user,t.groups)):console.error("<pb-restricted> connected pb-login element not found!")}render(){return O`
|
|
2281
|
+
${this.show&&!this.disabled?O`<slot></slot>`:O`<slot name="fallback"></slot>`}
|
|
2282
|
+
`}static get styles(){return V`
|
|
2283
2283
|
:host {
|
|
2284
2284
|
display: none;
|
|
2285
2285
|
}
|
|
@@ -2287,24 +2287,24 @@ e({_template:n`
|
|
|
2287
2287
|
:host(.fallback), :host([show]) {
|
|
2288
2288
|
display: block;
|
|
2289
2289
|
}
|
|
2290
|
-
`}_loggedIn(t,e){return null!=t&&(!this.group||!!e&&e.indexOf(this.group)>-1)}}customElements.define("pb-restricted",la);class ca extends(
|
|
2290
|
+
`}_loggedIn(t,e){return null!=t&&(!this.group||!!e&&e.indexOf(this.group)>-1)}}customElements.define("pb-restricted",la);class ca extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{odds:{type:Array},target:{type:String},_valid:{type:Boolean},_current:{type:String}})}constructor(){super(),this.odds=[]}connectedCallback(){super.connectedCallback(),this.subscribeTo("pb-login",()=>this._refresh(),[]),this.subscribeTo("pb-refresh-odds",t=>{this._refresh();const e=this.shadowRoot.getElementById("regenerate"),i=t.detail.odds.map(t=>"odd="+t).join("&");this.minApiVersion("1.0.0")?e.url="api/odd?"+i:e.url="modules/lib/regenerate.xql?"+i,e.trigger()})}firstUpdated(){super.firstUpdated(),this._loader=this.shadowRoot.getElementById("load"),ca.waitOnce("pb-page-ready",t=>{P(t.apiVersion,"1.0.0")<0?this._loader.url=t.endpoint+"/modules/lib/components-odd.xql":this._loader.url=t.endpoint+"/api/odd",this._refresh()})}_refresh(t){this.emitTo("pb-start-update"),this._loader.params=t,this._loader.generateRequest()}_update(){this.emitTo("pb-end-update"),this.odds=this._loader.lastResponse}_selectODD(t){const e=t.model.itemsIndex;this.odds.forEach((t,i)=>{i!==e&&t.current&&(this.set("odds."+i+".current",!1),this.set("odds."+e+".current",!0))});const i={odd:t.model.item.name+".odd"};console.log("<pb-manage-odds> selected ODD: %o",i),this.emitTo("pb-load",{params:i})}_createODD(){const t=this.shadowRoot.querySelector('paper-input[name="new_odd"]').value,e=this.shadowRoot.querySelector('paper-input[name="title"]').value;if(console.log("<pb-manage-odds> create ODD: %s, %s",t,e),this.lessThanApiVersion("1.0.0"))this._refresh({new_odd:t,title:e});else{const i=this.shadowRoot.getElementById("create");i.url=`${this.getEndpoint()}/api/odd/${t}`,i.params={title:e},this.emitTo("pb-start-update"),i.generateRequest()}}_created(t){this.emitTo("pb-end-update"),201===t.detail.status?this._refresh():console.log("<pb-manage-odds> unexpected response for create odd: %o",t.detail)}_createByExample(){const t={new_odd:this.shadowRoot.querySelector('paper-input[name="new_odd"]').value,title:this.shadowRoot.querySelector('paper-input[name="title"]').value},e=document.getElementById(this.target);e||e.getSelected||console.error("<pb-manage-odds> target %s not found",this.target);const i=e.getSelected();document.querySelectorAll(".document-select paper-checkbox[checked]").forEach(t=>{i.push(t.value)}),console.log("<pb-manage-odds> create ODD by example: %o",i),t.byExample=i,this._refresh(t)}_delete(t){this._current=t,this.shadowRoot.getElementById("deleteDialog").open()}_confirmDelete(){if(this._current){if(console.log("<pb-manage-odds> deleting ODD: %s",this._current),this.lessThanApiVersion("1.0.0"))this._refresh({delete:this._current});else{this.emitTo("pb-start-update");const t=this.shadowRoot.getElementById("delete");t.url=`${this.getEndpoint()}/api/odd/${this._current}`,t.generateRequest()}this._current=null}else console.error("<pb-manage-odds> no file marked for deletion")}_deleted(){const t=this.shadowRoot.getElementById("delete").lastError;410===t.status?this._refresh():(console.error("<pb-manage-odds> failed to delete odd: %d %o",t.status,t.response),this.emitTo("pb-end-update"))}_validate(){const t=this.shadowRoot.getElementById("ironform").validate();this.shadowRoot.getElementById("createBtn").disabled=!t,this.shadowRoot.getElementById("createByEx").disabled=!t}render(){if(!this.odds)return null;const t=this.lessThanApiVersion("1.0.0")?"modules/lib/regenerate.xql":"api/odd";return O`
|
|
2291
2291
|
<pb-restricted login="login">
|
|
2292
|
-
<pb-ajax id="regenerateAll" url="${t}" method="post" title="${
|
|
2292
|
+
<pb-ajax id="regenerateAll" url="${t}" method="post" title="${F("odd.manage.regenerate-all")}"
|
|
2293
2293
|
emit="${this.emit?this.emit:""}" .emitConfig="${this.emitConfig}">
|
|
2294
|
-
<h3 slot="title">${
|
|
2295
|
-
<a href="#">${
|
|
2294
|
+
<h3 slot="title">${F("odd.manage.regenerate-all")}</h3>
|
|
2295
|
+
<a href="#">${F("odd.manage.regenerate-all")}</a>
|
|
2296
2296
|
</pb-ajax>
|
|
2297
2297
|
</pb-restricted>
|
|
2298
|
-
${this.odds.map(e=>
|
|
2298
|
+
${this.odds.map(e=>O`
|
|
2299
2299
|
<div class="odd">
|
|
2300
2300
|
<a href="odd-editor.html?odd=${e.name}.odd" target="_blank">${e.label}</a>
|
|
2301
2301
|
<!-- TODO this toolbar should only appear once per ODD files papercard -->
|
|
2302
2302
|
<app-toolbar>
|
|
2303
|
-
${e.canWrite?
|
|
2303
|
+
${e.canWrite?O`
|
|
2304
2304
|
<pb-restricted login="login">
|
|
2305
2305
|
<pb-ajax url="${t}?odd=${e.name}.odd" method="post"
|
|
2306
2306
|
emit="${this.emit?this.emit:""}" .emitConfig="${this.emitConfig}">
|
|
2307
|
-
<h2 slot="title">${
|
|
2307
|
+
<h2 slot="title">${F("menu.admin.recompile")}</h2>
|
|
2308
2308
|
<paper-icon-button title="Regenerate ODD" icon="update"></paper-icon-button>
|
|
2309
2309
|
</pb-ajax>
|
|
2310
2310
|
<paper-icon-button title="Delete ODD" icon="delete" @click="${()=>this._delete(e.name+".odd")}"></paper-icon-button>
|
|
@@ -2319,16 +2319,16 @@ e({_template:n`
|
|
|
2319
2319
|
`)}
|
|
2320
2320
|
<pb-restricted login="login">
|
|
2321
2321
|
<form action="" method="GET">
|
|
2322
|
-
<paper-input name="new_odd" label="${
|
|
2323
|
-
error-message="${
|
|
2324
|
-
<paper-input name="title" label="${
|
|
2325
|
-
error-message="${
|
|
2322
|
+
<paper-input name="new_odd" label="${F("odd.manage.filename")}" required auto-validate pattern="[a-zA-Z0-9-_]+"
|
|
2323
|
+
error-message="${F("odd.manage.filename-error")}"></paper-input>
|
|
2324
|
+
<paper-input name="title" label="${F("odd.manage.title")}" auto-validate required minlength="1"
|
|
2325
|
+
error-message="${F("odd.manage.title-error")}"></paper-input>
|
|
2326
2326
|
<paper-button id="createBtn" @click="${this._createODD}">
|
|
2327
|
-
<iron-icon icon="create"></iron-icon>${
|
|
2327
|
+
<iron-icon icon="create"></iron-icon>${F("odd.manage.create")}
|
|
2328
2328
|
</paper-button>
|
|
2329
2329
|
<!--paper-button id="createByEx" @click="${this._createByExample}">
|
|
2330
2330
|
<iron-icon icon="build"></iron-icon>
|
|
2331
|
-
${
|
|
2331
|
+
${F("odd.manage.create-from-example")}
|
|
2332
2332
|
</paper-button-->
|
|
2333
2333
|
</form>
|
|
2334
2334
|
</pb-restricted>
|
|
@@ -2344,20 +2344,20 @@ e({_template:n`
|
|
|
2344
2344
|
<iron-ajax id="delete" method="delete" with-credentials @error="${this._deleted}"></iron-ajax>
|
|
2345
2345
|
<iron-ajax id="create" method="post" with-credentials @response="${this._created}" @error="${this._created}"></iron-ajax>
|
|
2346
2346
|
<paper-dialog id="deleteDialog">
|
|
2347
|
-
<h2>${
|
|
2347
|
+
<h2>${F("browse.delete")}</h2>
|
|
2348
2348
|
<paper-dialog-scrollable>
|
|
2349
|
-
<p>${
|
|
2349
|
+
<p>${F("odd.manage.delete",{file:this.file})}</p>
|
|
2350
2350
|
</paper-dialog-scrollable>
|
|
2351
2351
|
<div class="buttons">
|
|
2352
2352
|
<paper-button dialog-confirm="dialog-confirm" autofocus @click="${this._confirmDelete}">
|
|
2353
|
-
${
|
|
2353
|
+
${F("dialogs.yes")}
|
|
2354
2354
|
</paper-button>
|
|
2355
2355
|
<paper-button dialog-confirm="dialog-cancel">
|
|
2356
|
-
${
|
|
2356
|
+
${F("dialogs.no")}
|
|
2357
2357
|
</paper-button>
|
|
2358
2358
|
</div>
|
|
2359
2359
|
</paper-dialog>
|
|
2360
|
-
`}static get styles(){return
|
|
2360
|
+
`}static get styles(){return V`
|
|
2361
2361
|
:host {
|
|
2362
2362
|
display: block;
|
|
2363
2363
|
}
|
|
@@ -2695,7 +2695,7 @@ let pa=!1;window.addEventListener("keydown",()=>{pa=!0},{capture:!0}),window.add
|
|
|
2695
2695
|
@license
|
|
2696
2696
|
Copyright (c) 2017 Vaadin Ltd.
|
|
2697
2697
|
This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
2698
|
-
*/;class fa extends(
|
|
2698
|
+
*/;class fa extends(M(ga(L(m(v))))){static get template(){return n`
|
|
2699
2699
|
<style>
|
|
2700
2700
|
:host {
|
|
2701
2701
|
display: inline-block;
|
|
@@ -2763,7 +2763,7 @@ This program is available under Apache License Version 2.0, available at https:/
|
|
|
2763
2763
|
</div>
|
|
2764
2764
|
</div>
|
|
2765
2765
|
<button id="button" type="button"></button>
|
|
2766
|
-
`}static get is(){return"vaadin-button"}static get version(){return"2.4.0"}ready(){super.ready(),this.setAttribute("role","button"),this.$.button.setAttribute("role","presentation"),this._addActiveListeners(),window.ShadyDOM&&window.ShadyDOM.flush()}disconnectedCallback(){super.disconnectedCallback(),this.hasAttribute("active")&&this.removeAttribute("active")}_addActiveListeners(){
|
|
2766
|
+
`}static get is(){return"vaadin-button"}static get version(){return"2.4.0"}ready(){super.ready(),this.setAttribute("role","button"),this.$.button.setAttribute("role","presentation"),this._addActiveListeners(),window.ShadyDOM&&window.ShadyDOM.flush()}disconnectedCallback(){super.disconnectedCallback(),this.hasAttribute("active")&&this.removeAttribute("active")}_addActiveListeners(){b(this,"down",()=>!this.disabled&&this.setAttribute("active","")),b(this,"up",()=>this.removeAttribute("active")),this.addEventListener("keydown",t=>!this.disabled&&[13,32].indexOf(t.keyCode)>=0&&this.setAttribute("active","")),this.addEventListener("keyup",()=>this.removeAttribute("active")),this.addEventListener("blur",()=>this.removeAttribute("active"))}get focusElement(){return this.$.button}}customElements.define(fa.is,fa);const ma=n`<dom-module id="lumo-progress-bar" theme-for="vaadin-progress-bar">
|
|
2767
2767
|
<template>
|
|
2768
2768
|
<style>
|
|
2769
2769
|
:host {
|
|
@@ -2977,7 +2977,7 @@ const va=t=>class extends t{static get properties(){return{value:{type:Number,ob
|
|
|
2977
2977
|
@license
|
|
2978
2978
|
Copyright (c) 2017 Vaadin Ltd.
|
|
2979
2979
|
This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
2980
|
-
*/;class ba extends(
|
|
2980
|
+
*/;class ba extends(M(L(va(v)))){static get template(){return n`
|
|
2981
2981
|
<style>
|
|
2982
2982
|
:host {
|
|
2983
2983
|
display: block;
|
|
@@ -3184,7 +3184,7 @@ This program is available under Apache License Version 2.0, available at https:/
|
|
|
3184
3184
|
Copyright (c) 2017 Vaadin Ltd.
|
|
3185
3185
|
This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
3186
3186
|
*/
|
|
3187
|
-
class wa extends(
|
|
3187
|
+
class wa extends(L(v)){static get template(){return n`
|
|
3188
3188
|
<style>
|
|
3189
3189
|
:host {
|
|
3190
3190
|
display: block;
|
|
@@ -3221,7 +3221,7 @@ class wa extends(O(_)){static get template(){return n`
|
|
|
3221
3221
|
Copyright (c) 2017 Vaadin Ltd.
|
|
3222
3222
|
This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
3223
3223
|
*/
|
|
3224
|
-
class xa extends(
|
|
3224
|
+
class xa extends(M(L(v))){static get template(){return n`
|
|
3225
3225
|
<style>
|
|
3226
3226
|
:host {
|
|
3227
3227
|
display: block;
|
|
@@ -3263,18 +3263,18 @@ class xa extends(H(O(_))){static get template(){return n`
|
|
|
3263
3263
|
</slot>
|
|
3264
3264
|
<slot></slot>
|
|
3265
3265
|
<input type="file" id="fileInput" on-change="_onFileInputChange" hidden="" accept\$="{{accept}}" multiple\$="[[_isMultiple(maxFiles)]]" capture\$="[[capture]]">
|
|
3266
|
-
`}static get is(){return"vaadin-upload"}static get version(){return"4.4.2"}static get properties(){return{nodrop:{type:Boolean,reflectToAttribute:!0,value:function(){try{return!!document.createEvent("TouchEvent")}catch(t){return!1}}},target:{type:String,value:""},method:{type:String,value:"POST"},headers:{type:Object,value:{}},timeout:{type:Number,value:0},_dragover:{type:Boolean,value:!1,observer:"_dragoverChanged"},files:{type:Array,notify:!0,value:function(){return[]}},maxFiles:{type:Number,value:1/0},maxFilesReached:{type:Boolean,value:!1,notify:!0,readOnly:!0,computed:"_maxFilesAdded(maxFiles, files.length)"},accept:{type:String,value:""},maxFileSize:{type:Number,value:1/0},_dragoverValid:{type:Boolean,value:!1,observer:"_dragoverValidChanged"},formDataName:{type:String,value:"file"},noAuto:{type:Boolean,value:!1},withCredentials:{type:Boolean,value:!1},capture:String,i18n:{type:Object,value:function(){return{dropFiles:{one:"Drop file here",many:"Drop files here"},addFiles:{one:"Upload File...",many:"Upload Files..."},cancel:"Cancel",error:{tooManyFiles:"Too Many Files.",fileIsTooBig:"File is Too Big.",incorrectFileType:"Incorrect File Type."},uploading:{status:{connecting:"Connecting...",stalled:"Stalled.",processing:"Processing File...",held:"Queued"},remainingTime:{prefix:"remaining time: ",unknown:"unknown remaining time"},error:{serverUnavailable:"Server Unavailable",unexpectedServerError:"Unexpected Server Error",forbidden:"Forbidden"}},units:{size:["B","kB","MB","GB","TB","PB","EB","ZB","YB"]}}}}}}ready(){super.ready(),this.addEventListener("dragover",this._onDragover.bind(this)),this.addEventListener("dragleave",this._onDragleave.bind(this)),this.addEventListener("drop",this._onDrop.bind(this)),this.addEventListener("file-retry",this._onFileRetry.bind(this)),this.addEventListener("file-abort",this._onFileAbort.bind(this)),this.addEventListener("file-remove",this._onFileRemove.bind(this)),this.addEventListener("file-start",this._onFileStart.bind(this))}_formatSize(t){if("function"==typeof this.i18n.formatSize)return this.i18n.formatSize(t);const e=this.i18n.units.sizeBase||1e3,i=~~(Math.log(t)/Math.log(e)),n=Math.max(0,Math.min(3,i-1));return parseFloat((t/Math.pow(e,i)).toFixed(n))+" "+this.i18n.units.size[i]}_splitTimeByUnits(t){const e=[60,60,24,1/0],i=[0];for(var n=0;n<e.length&&t>0;n++)i[n]=t%e[n],t=Math.floor(t/e[n]);return i}_formatTime(t,e){if("function"==typeof this.i18n.formatTime)return this.i18n.formatTime(t,e);for(;e.length<3;)e.push(0);return e.reverse().map(t=>(t<10?"0":"")+t).join(":")}_formatFileProgress(t){return t.totalStr+": "+t.progress+"% ("+(t.loaded>0?this.i18n.uploading.remainingTime.prefix+t.remainingStr:this.i18n.uploading.remainingTime.unknown)+")"}_maxFilesAdded(t,e){return t>=0&&e>=t}_onDragover(t){t.preventDefault(),this.nodrop||this._dragover||(this._dragoverValid=!this.maxFilesReached,this._dragover=!0),t.dataTransfer.dropEffect=!this._dragoverValid||this.nodrop?"none":"copy"}_onDragleave(t){t.preventDefault(),this._dragover&&!this.nodrop&&(this._dragover=this._dragoverValid=!1)}_onDrop(t){this.nodrop||(t.preventDefault(),this._dragover=this._dragoverValid=!1,this._addFiles(t.dataTransfer.files))}_createXhr(){return new XMLHttpRequest}_configureXhr(t){if("string"==typeof this.headers)try{this.headers=JSON.parse(this.headers)}catch(t){this.headers=void 0}for(var e in this.headers)t.setRequestHeader(e,this.headers[e]);this.timeout&&(t.timeout=this.timeout),t.withCredentials=this.withCredentials}_setStatus(t,e,i,n){t.elapsed=n,t.elapsedStr=this._formatTime(t.elapsed,this._splitTimeByUnits(t.elapsed)),t.remaining=Math.ceil(n*(e/i-1)),t.remainingStr=this._formatTime(t.remaining,this._splitTimeByUnits(t.remaining)),t.speed=~~(e/n/1024),t.totalStr=this._formatSize(e),t.loadedStr=this._formatSize(i),t.status=this._formatFileProgress(t)}uploadFiles(t){t&&!Array.isArray(t)&&(t=[t]),t=(t=t||this.files).filter(t=>!t.complete),Array.prototype.forEach.call(t,this._uploadFile.bind(this))}_uploadFile(t){if(t.uploading)return;const e=Date.now(),i=t.xhr=this._createXhr();let n,r;i.upload.onprogress=o=>{clearTimeout(n),r=Date.now();const s=(r-e)/1e3,a=o.loaded,l=o.total,c=~~(a/l*100);t.loaded=a,t.progress=c,t.indeterminate=a<=0||a>=l,t.error?t.indeterminate=t.status=void 0:t.abort||(c<100?(this._setStatus(t,l,a,s),n=setTimeout(()=>{t.status=this.i18n.uploading.status.stalled,this._notifyFileChanges(t)},2e3)):(t.loadedStr=t.totalStr,t.status=this.i18n.uploading.status.processing)),this._notifyFileChanges(t),this.dispatchEvent(new CustomEvent("upload-progress",{detail:{file:t,xhr:i}}))},i.onreadystatechange=()=>{if(4==i.readyState){if(clearTimeout(n),t.indeterminate=t.uploading=!1,t.abort)return void this._notifyFileChanges(t);t.status="";if(!this.dispatchEvent(new CustomEvent("upload-response",{detail:{file:t,xhr:i},cancelable:!0})))return;0===i.status?t.error=this.i18n.uploading.error.serverUnavailable:i.status>=500?t.error=this.i18n.uploading.error.unexpectedServerError:i.status>=400&&(t.error=this.i18n.uploading.error.forbidden),t.complete=!t.error,this.dispatchEvent(new CustomEvent("upload-"+(t.error?"error":"success"),{detail:{file:t,xhr:i}})),this._notifyFileChanges(t)}};const o=new FormData;t.uploadTarget=t.uploadTarget||this.target||"",t.formDataName=this.formDataName;if(!this.dispatchEvent(new CustomEvent("upload-before",{detail:{file:t,xhr:i},cancelable:!0})))return;o.append(t.formDataName,t,t.name),i.open(this.method,t.uploadTarget,!0),this._configureXhr(i),t.status=this.i18n.uploading.status.connecting,t.uploading=t.indeterminate=!0,t.complete=t.abort=t.error=t.held=!1,i.upload.onloadstart=()=>{this.dispatchEvent(new CustomEvent("upload-start",{detail:{file:t,xhr:i}})),this._notifyFileChanges(t)};this.dispatchEvent(new CustomEvent("upload-request",{detail:{file:t,xhr:i,formData:o},cancelable:!0}))&&i.send(o)}_retryFileUpload(t){this.dispatchEvent(new CustomEvent("upload-retry",{detail:{file:t,xhr:t.xhr},cancelable:!0}))&&this._uploadFile(t)}_abortFileUpload(t){this.dispatchEvent(new CustomEvent("upload-abort",{detail:{file:t,xhr:t.xhr},cancelable:!0}))&&(t.abort=!0,t.xhr&&t.xhr.abort(),this._notifyFileChanges(t))}_notifyFileChanges(t){var e="files."+this.files.indexOf(t)+".";for(var i in t)t.hasOwnProperty(i)&&this.notifyPath(e+i,t[i])}_addFiles(t){Array.prototype.forEach.call(t,this._addFile.bind(this))}_addFile(t){if(this.maxFilesReached)return void this.dispatchEvent(new CustomEvent("file-reject",{detail:{file:t,error:this.i18n.error.tooManyFiles}}));if(this.maxFileSize>=0&&t.size>this.maxFileSize)return void this.dispatchEvent(new CustomEvent("file-reject",{detail:{file:t,error:this.i18n.error.fileIsTooBig}}));const e=t.name.match(/\.[^\.]*$|$/)[0],i=new RegExp("^("+this.accept.replace(/[, ]+/g,"|").replace(/\/\*/g,"/.*")+")$","i");!this.accept||i.test(t.type)||i.test(e)?(t.loaded=0,t.held=!0,t.status=this.i18n.uploading.status.held,this.unshift("files",t),this.noAuto||this._uploadFile(t)):this.dispatchEvent(new CustomEvent("file-reject",{detail:{file:t,error:this.i18n.error.incorrectFileType}}))}_removeFile(t){this.files.indexOf(t)>-1&&this.splice("files",this.files.indexOf(t),1)}_onAddFilesTouchEnd(t){t.preventDefault(),this.__resetMouseCanceller(),this._onAddFilesClick()}__resetMouseCanceller(){
|
|
3266
|
+
`}static get is(){return"vaadin-upload"}static get version(){return"4.4.2"}static get properties(){return{nodrop:{type:Boolean,reflectToAttribute:!0,value:function(){try{return!!document.createEvent("TouchEvent")}catch(t){return!1}}},target:{type:String,value:""},method:{type:String,value:"POST"},headers:{type:Object,value:{}},timeout:{type:Number,value:0},_dragover:{type:Boolean,value:!1,observer:"_dragoverChanged"},files:{type:Array,notify:!0,value:function(){return[]}},maxFiles:{type:Number,value:1/0},maxFilesReached:{type:Boolean,value:!1,notify:!0,readOnly:!0,computed:"_maxFilesAdded(maxFiles, files.length)"},accept:{type:String,value:""},maxFileSize:{type:Number,value:1/0},_dragoverValid:{type:Boolean,value:!1,observer:"_dragoverValidChanged"},formDataName:{type:String,value:"file"},noAuto:{type:Boolean,value:!1},withCredentials:{type:Boolean,value:!1},capture:String,i18n:{type:Object,value:function(){return{dropFiles:{one:"Drop file here",many:"Drop files here"},addFiles:{one:"Upload File...",many:"Upload Files..."},cancel:"Cancel",error:{tooManyFiles:"Too Many Files.",fileIsTooBig:"File is Too Big.",incorrectFileType:"Incorrect File Type."},uploading:{status:{connecting:"Connecting...",stalled:"Stalled.",processing:"Processing File...",held:"Queued"},remainingTime:{prefix:"remaining time: ",unknown:"unknown remaining time"},error:{serverUnavailable:"Server Unavailable",unexpectedServerError:"Unexpected Server Error",forbidden:"Forbidden"}},units:{size:["B","kB","MB","GB","TB","PB","EB","ZB","YB"]}}}}}}ready(){super.ready(),this.addEventListener("dragover",this._onDragover.bind(this)),this.addEventListener("dragleave",this._onDragleave.bind(this)),this.addEventListener("drop",this._onDrop.bind(this)),this.addEventListener("file-retry",this._onFileRetry.bind(this)),this.addEventListener("file-abort",this._onFileAbort.bind(this)),this.addEventListener("file-remove",this._onFileRemove.bind(this)),this.addEventListener("file-start",this._onFileStart.bind(this))}_formatSize(t){if("function"==typeof this.i18n.formatSize)return this.i18n.formatSize(t);const e=this.i18n.units.sizeBase||1e3,i=~~(Math.log(t)/Math.log(e)),n=Math.max(0,Math.min(3,i-1));return parseFloat((t/Math.pow(e,i)).toFixed(n))+" "+this.i18n.units.size[i]}_splitTimeByUnits(t){const e=[60,60,24,1/0],i=[0];for(var n=0;n<e.length&&t>0;n++)i[n]=t%e[n],t=Math.floor(t/e[n]);return i}_formatTime(t,e){if("function"==typeof this.i18n.formatTime)return this.i18n.formatTime(t,e);for(;e.length<3;)e.push(0);return e.reverse().map(t=>(t<10?"0":"")+t).join(":")}_formatFileProgress(t){return t.totalStr+": "+t.progress+"% ("+(t.loaded>0?this.i18n.uploading.remainingTime.prefix+t.remainingStr:this.i18n.uploading.remainingTime.unknown)+")"}_maxFilesAdded(t,e){return t>=0&&e>=t}_onDragover(t){t.preventDefault(),this.nodrop||this._dragover||(this._dragoverValid=!this.maxFilesReached,this._dragover=!0),t.dataTransfer.dropEffect=!this._dragoverValid||this.nodrop?"none":"copy"}_onDragleave(t){t.preventDefault(),this._dragover&&!this.nodrop&&(this._dragover=this._dragoverValid=!1)}_onDrop(t){this.nodrop||(t.preventDefault(),this._dragover=this._dragoverValid=!1,this._addFiles(t.dataTransfer.files))}_createXhr(){return new XMLHttpRequest}_configureXhr(t){if("string"==typeof this.headers)try{this.headers=JSON.parse(this.headers)}catch(t){this.headers=void 0}for(var e in this.headers)t.setRequestHeader(e,this.headers[e]);this.timeout&&(t.timeout=this.timeout),t.withCredentials=this.withCredentials}_setStatus(t,e,i,n){t.elapsed=n,t.elapsedStr=this._formatTime(t.elapsed,this._splitTimeByUnits(t.elapsed)),t.remaining=Math.ceil(n*(e/i-1)),t.remainingStr=this._formatTime(t.remaining,this._splitTimeByUnits(t.remaining)),t.speed=~~(e/n/1024),t.totalStr=this._formatSize(e),t.loadedStr=this._formatSize(i),t.status=this._formatFileProgress(t)}uploadFiles(t){t&&!Array.isArray(t)&&(t=[t]),t=(t=t||this.files).filter(t=>!t.complete),Array.prototype.forEach.call(t,this._uploadFile.bind(this))}_uploadFile(t){if(t.uploading)return;const e=Date.now(),i=t.xhr=this._createXhr();let n,r;i.upload.onprogress=o=>{clearTimeout(n),r=Date.now();const s=(r-e)/1e3,a=o.loaded,l=o.total,c=~~(a/l*100);t.loaded=a,t.progress=c,t.indeterminate=a<=0||a>=l,t.error?t.indeterminate=t.status=void 0:t.abort||(c<100?(this._setStatus(t,l,a,s),n=setTimeout(()=>{t.status=this.i18n.uploading.status.stalled,this._notifyFileChanges(t)},2e3)):(t.loadedStr=t.totalStr,t.status=this.i18n.uploading.status.processing)),this._notifyFileChanges(t),this.dispatchEvent(new CustomEvent("upload-progress",{detail:{file:t,xhr:i}}))},i.onreadystatechange=()=>{if(4==i.readyState){if(clearTimeout(n),t.indeterminate=t.uploading=!1,t.abort)return void this._notifyFileChanges(t);t.status="";if(!this.dispatchEvent(new CustomEvent("upload-response",{detail:{file:t,xhr:i},cancelable:!0})))return;0===i.status?t.error=this.i18n.uploading.error.serverUnavailable:i.status>=500?t.error=this.i18n.uploading.error.unexpectedServerError:i.status>=400&&(t.error=this.i18n.uploading.error.forbidden),t.complete=!t.error,this.dispatchEvent(new CustomEvent("upload-"+(t.error?"error":"success"),{detail:{file:t,xhr:i}})),this._notifyFileChanges(t)}};const o=new FormData;t.uploadTarget=t.uploadTarget||this.target||"",t.formDataName=this.formDataName;if(!this.dispatchEvent(new CustomEvent("upload-before",{detail:{file:t,xhr:i},cancelable:!0})))return;o.append(t.formDataName,t,t.name),i.open(this.method,t.uploadTarget,!0),this._configureXhr(i),t.status=this.i18n.uploading.status.connecting,t.uploading=t.indeterminate=!0,t.complete=t.abort=t.error=t.held=!1,i.upload.onloadstart=()=>{this.dispatchEvent(new CustomEvent("upload-start",{detail:{file:t,xhr:i}})),this._notifyFileChanges(t)};this.dispatchEvent(new CustomEvent("upload-request",{detail:{file:t,xhr:i,formData:o},cancelable:!0}))&&i.send(o)}_retryFileUpload(t){this.dispatchEvent(new CustomEvent("upload-retry",{detail:{file:t,xhr:t.xhr},cancelable:!0}))&&this._uploadFile(t)}_abortFileUpload(t){this.dispatchEvent(new CustomEvent("upload-abort",{detail:{file:t,xhr:t.xhr},cancelable:!0}))&&(t.abort=!0,t.xhr&&t.xhr.abort(),this._notifyFileChanges(t))}_notifyFileChanges(t){var e="files."+this.files.indexOf(t)+".";for(var i in t)t.hasOwnProperty(i)&&this.notifyPath(e+i,t[i])}_addFiles(t){Array.prototype.forEach.call(t,this._addFile.bind(this))}_addFile(t){if(this.maxFilesReached)return void this.dispatchEvent(new CustomEvent("file-reject",{detail:{file:t,error:this.i18n.error.tooManyFiles}}));if(this.maxFileSize>=0&&t.size>this.maxFileSize)return void this.dispatchEvent(new CustomEvent("file-reject",{detail:{file:t,error:this.i18n.error.fileIsTooBig}}));const e=t.name.match(/\.[^\.]*$|$/)[0],i=new RegExp("^("+this.accept.replace(/[, ]+/g,"|").replace(/\/\*/g,"/.*")+")$","i");!this.accept||i.test(t.type)||i.test(e)?(t.loaded=0,t.held=!0,t.status=this.i18n.uploading.status.held,this.unshift("files",t),this.noAuto||this._uploadFile(t)):this.dispatchEvent(new CustomEvent("file-reject",{detail:{file:t,error:this.i18n.error.incorrectFileType}}))}_removeFile(t){this.files.indexOf(t)>-1&&this.splice("files",this.files.indexOf(t),1)}_onAddFilesTouchEnd(t){t.preventDefault(),this.__resetMouseCanceller(),this._onAddFilesClick()}__resetMouseCanceller(){y()}_onAddFilesClick(){this.maxFilesReached||(this.$.fileInput.value="",this.$.fileInput.click())}_onFileInputChange(t){this._addFiles(t.target.files)}_onFileStart(t){this._uploadFile(t.detail.file)}_onFileRetry(t){this._retryFileUpload(t.detail.file)}_onFileAbort(t){this._abortFileUpload(t.detail.file)}_onFileRemove(t){this._removeFile(t.detail.file)}_dragoverChanged(t){t?this.setAttribute("dragover",t):this.removeAttribute("dragover")}_dragoverValidChanged(t){t?this.setAttribute("dragover-valid",t):this.removeAttribute("dragover-valid")}_i18nPlural(t,e){return 1==t?e.one:e.many}_isMultiple(t){return 1!=t}}customElements.define(xa.is,xa);class ka extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{target:{type:String},accept:{type:String},_files:{type:Object}})}constructor(){super(),this._files=new Map}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this.subscribeTo("pb-collection",t=>{this.target=t.detail.collection})}firstUpdated(){super.firstUpdated();const t=this.shadowRoot.getElementById("uploader");t.addEventListener("upload-before",e=>{this.emitTo("pb-start-update");const{file:i}=e.detail;this._files.set(i.name,i),this.requestUpdate(),this.minApiVersion("1.0.0")&&this.target&&(i.uploadTarget=`${t.target}${encodeURIComponent(this.target)}`)}),t.addEventListener("upload-request",t=>{this.target&&this.lessThanApiVersion("1.0.0")&&t.detail.formData.append("root",this.target)}),t.addEventListener("upload-error",t=>{this.emitTo("pb-end-update"),t.detail.file.error=t.detail.xhr.responseText,this.requestUpdate()}),t.addEventListener("upload-success",()=>{let e=!0;const i=[];t.files.forEach(t=>{t.complete||t.error||t.aborted?/^.*\.odd$/.test(t.name)&&i.push(t.name):e=!1,this.requestUpdate()}),e&&(this.emitTo("pb-end-update"),this.emitTo("pb-load"),i.length>0&&this.emitTo("pb-refresh-odds",{odds:i}))}),ka.waitOnce("pb-page-ready",()=>{this.minApiVersion("1.0.0")?t.target=this.getEndpoint()+"/api/upload/":t.target=this.getEndpoint()+"/modules/lib/upload.xql"})}render(){const t=H(this,"--pb-upload-button-icon","icons:file-upload"),e=H(this,"--pb-upload-drop-icon",null);return O`
|
|
3267
3267
|
<vaadin-upload id="uploader" accept="${this.accept}" method="post" tabindex="-1" form-data-name="files[]"
|
|
3268
3268
|
with-credentials>
|
|
3269
|
-
${e?
|
|
3270
|
-
<span slot="drop-label">${
|
|
3269
|
+
${e?O`<iron-icon slot="drop-label-icon" icon="${e}"></iron-icon>`:O`<span slot="drop-label-icon"></span>`}
|
|
3270
|
+
<span slot="drop-label">${F("upload.drop",{accept:this.accept})}</span>
|
|
3271
3271
|
<paper-button id="uploadBtn" slot="add-button">
|
|
3272
|
-
${t?
|
|
3273
|
-
${
|
|
3272
|
+
${t?O`<iron-icon icon="${t}"></iron-icon>`:null}
|
|
3273
|
+
${F("upload.upload")}
|
|
3274
3274
|
</paper-button>
|
|
3275
3275
|
<div slot="file-list">
|
|
3276
3276
|
<ul>
|
|
3277
|
-
${this._files.size>0?
|
|
3277
|
+
${this._files.size>0?O`
|
|
3278
3278
|
<li class="close">
|
|
3279
3279
|
<paper-icon-button icon="icons:clear" @click="${this.clearList}"></paper-icon-button>
|
|
3280
3280
|
</li>`:""}
|
|
@@ -3282,14 +3282,14 @@ class xa extends(H(O(_))){static get template(){return n`
|
|
|
3282
3282
|
</ul>
|
|
3283
3283
|
</div>
|
|
3284
3284
|
</vaadin-upload>
|
|
3285
|
-
`}renderFiles(){const t=[];for(const e of this._files.values()){let i="icons:hourglass-empty";e.complete?i="icons:check":(e.error||e.aborted)&&(i="icons:error-outline");const n=/.docx/.test(e.name)?e.name+".xml":e.name;let r;r=this.target?`${this.target}/${n}`:n,t.push(
|
|
3285
|
+
`}renderFiles(){const t=[];for(const e of this._files.values()){let i="icons:hourglass-empty";e.complete?i="icons:check":(e.error||e.aborted)&&(i="icons:error-outline");const n=/.docx/.test(e.name)?e.name+".xml":e.name;let r;r=this.target?`${this.target}/${n}`:n,t.push(O`
|
|
3286
3286
|
<li>
|
|
3287
3287
|
<iron-icon icon="${i}"></iron-icon>
|
|
3288
|
-
${e.error?e.name:
|
|
3288
|
+
${e.error?e.name:O`<a href="${r}">${e.name}</a>`}
|
|
3289
3289
|
</li>
|
|
3290
|
-
`),e.error&&t.push(
|
|
3290
|
+
`),e.error&&t.push(O`
|
|
3291
3291
|
<li class="error" part="error">${JSON.parse(e.error).description}</li>
|
|
3292
|
-
`)}return t}clearList(){this._files.clear(),this.requestUpdate()}static get styles(){return
|
|
3292
|
+
`)}return t}clearList(){this._files.clear(),this.requestUpdate()}static get styles(){return V`
|
|
3293
3293
|
ul {
|
|
3294
3294
|
list-style: none;
|
|
3295
3295
|
margin: 0;
|
|
@@ -3344,7 +3344,7 @@ e({_template:n`
|
|
|
3344
3344
|
</style>
|
|
3345
3345
|
|
|
3346
3346
|
<slot id="content"></slot>
|
|
3347
|
-
`,is:"neon-animated-pages",behaviors:[
|
|
3347
|
+
`,is:"neon-animated-pages",behaviors:[c,d,_],properties:{activateEvent:{type:String,value:""},animateInitialSelection:{type:Boolean,value:!1}},listeners:{"iron-select":"_onIronSelect","neon-animation-finish":"_onNeonAnimationFinish"},_onIronSelect:function(t){var e=t.detail.item;if(!(this.items.indexOf(e)<0)){var i=this._valueToItem(this._prevSelected)||!1;this._prevSelected=this.selected,i||this.animateInitialSelection?(this.animationConfig=[],this.entryAnimation?this.animationConfig.push({name:this.entryAnimation,node:e}):e.getAnimationConfig&&this.animationConfig.push({animatable:e,type:"entry"}),i&&(i.classList.contains("neon-animating")&&(this._squelchNextFinishEvent=!0,this.cancelAnimation(),this._completeSelectedChanged(),this._squelchNextFinishEvent=!1),this.exitAnimation?this.animationConfig.push({name:this.exitAnimation,node:i}):i.getAnimationConfig&&this.animationConfig.push({animatable:i,type:"exit"}),i.classList.add("neon-animating")),e.classList.add("neon-animating"),this.animationConfig.length>=1?this.isAttached?this.playAnimation(void 0,{fromPage:i,toPage:e}):this.async((function(){this.playAnimation(void 0,{fromPage:null,toPage:e})})):this._completeSelectedChanged(i,e)):this._completeSelectedChanged()}},_completeSelectedChanged:function(e,i){if(i&&i.classList.remove("neon-animating"),e&&e.classList.remove("neon-animating"),!i||!e)for(var n,r=t(this.$.content).getDistributedNodes(),o=0;n=r[o];o++)n.classList&&n.classList.remove("neon-animating");this.async(this._notifyPageResize)},_onNeonAnimationFinish:function(t){this._squelchNextFinishEvent?this._squelchNextFinishEvent=!1:this._completeSelectedChanged(t.detail.fromPage,t.detail.toPage)},_notifyPageResize:function(){var t=this.selectedItem||this._valueToItem(this.selected);this.resizerShouldNotify=function(e){return e==t},this.notifyResize()}}),
|
|
3348
3348
|
/**
|
|
3349
3349
|
@license
|
|
3350
3350
|
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
@@ -3363,7 +3363,7 @@ e({_template:n`
|
|
|
3363
3363
|
</style>
|
|
3364
3364
|
|
|
3365
3365
|
<slot></slot>
|
|
3366
|
-
`,is:"neon-animatable",behaviors:[
|
|
3366
|
+
`,is:"neon-animatable",behaviors:[w,c]}),
|
|
3367
3367
|
/**
|
|
3368
3368
|
@license
|
|
3369
3369
|
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
@@ -3374,7 +3374,7 @@ found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
|
3374
3374
|
part of the polymer project is also subject to an additional IP rights grant
|
|
3375
3375
|
found at http://polymer.github.io/PATENTS.txt
|
|
3376
3376
|
*/
|
|
3377
|
-
e({is:"cascaded-animation",behaviors:[
|
|
3377
|
+
e({is:"cascaded-animation",behaviors:[x],configure:function(t){this._animations=[];var e=t.nodes,i=[],n=t.nodeDelay||50;t.timing=t.timing||{},t.timing.delay=t.timing.delay||0;for(var r,o,s=t.timing.delay,a=0;o=e[a];a++){t.timing.delay+=n,t.node=o;var l=document.createElement(t.animation);if(!l.isNeonAnimation){console.warn(this.is+":",t.animation,"not found!"),r=!0;break}var c=l.configure(t);this._animations.push(l),i.push(c)}if(t.timing.delay=s,t.node=null,!r)return this._effect=new GroupEffect(i),this._effect},complete:function(){for(var t,e=0;t=this._animations[e];e++)t.complete(t.config)}});
|
|
3378
3378
|
/**
|
|
3379
3379
|
@license
|
|
3380
3380
|
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
@@ -3385,7 +3385,7 @@ found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
|
3385
3385
|
part of the polymer project is also subject to an additional IP rights grant
|
|
3386
3386
|
found at http://polymer.github.io/PATENTS.txt
|
|
3387
3387
|
*/
|
|
3388
|
-
const Aa=[
|
|
3388
|
+
const Aa=[x,{properties:{sharedElements:{type:Object}},findSharedElements:function(t){var e=t.fromPage,i=t.toPage;if(!e||!i)return console.warn(this.is+":",e?"toPage":"fromPage","is undefined!"),null;if(!e.sharedElements||!i.sharedElements)return console.warn(this.is+":","sharedElements are undefined for",e.sharedElements?i:e),null;var n=e.sharedElements[t.id],r=i.sharedElements[t.id];return n&&r?(this.sharedElements={from:n,to:r},this.sharedElements):(console.warn(this.is+":","sharedElement with id",t.id,"not found in",n?i:e),null)}}];
|
|
3389
3389
|
/**
|
|
3390
3390
|
@license
|
|
3391
3391
|
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
@@ -3407,7 +3407,7 @@ found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
|
3407
3407
|
part of the polymer project is also subject to an additional IP rights grant
|
|
3408
3408
|
found at http://polymer.github.io/PATENTS.txt
|
|
3409
3409
|
*/
|
|
3410
|
-
e({is:"opaque-animation",behaviors:[
|
|
3410
|
+
e({is:"opaque-animation",behaviors:[x],configure:function(t){var e=t.node;return this._effect=new KeyframeEffect(e,[{opacity:"1"},{opacity:"1"}],this.timingFromConfig(t)),e.style.opacity="0",this._effect},complete:function(t){t.node.style.opacity=""}}),
|
|
3411
3411
|
/**
|
|
3412
3412
|
@license
|
|
3413
3413
|
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
@@ -3440,7 +3440,7 @@ found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
|
3440
3440
|
part of the polymer project is also subject to an additional IP rights grant
|
|
3441
3441
|
found at http://polymer.github.io/PATENTS.txt
|
|
3442
3442
|
*/
|
|
3443
|
-
e({is:"scale-down-animation",behaviors:[
|
|
3443
|
+
e({is:"scale-down-animation",behaviors:[x],configure:function(t){var e=t.node,i="scale(0, 0)";return"x"===t.axis?i="scale(0, 1)":"y"===t.axis&&(i="scale(1, 0)"),this._effect=new KeyframeEffect(e,[{transform:"scale(1,1)"},{transform:i}],this.timingFromConfig(t)),t.transformOrigin&&this.setPrefixedProperty(e,"transformOrigin",t.transformOrigin),this._effect}}),
|
|
3444
3444
|
/**
|
|
3445
3445
|
@license
|
|
3446
3446
|
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
@@ -3451,7 +3451,7 @@ found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
|
3451
3451
|
part of the polymer project is also subject to an additional IP rights grant
|
|
3452
3452
|
found at http://polymer.github.io/PATENTS.txt
|
|
3453
3453
|
*/
|
|
3454
|
-
e({is:"scale-up-animation",behaviors:[
|
|
3454
|
+
e({is:"scale-up-animation",behaviors:[x],configure:function(t){var e=t.node,i="scale(0)";return"x"===t.axis?i="scale(0, 1)":"y"===t.axis&&(i="scale(1, 0)"),this._effect=new KeyframeEffect(e,[{transform:i},{transform:"scale(1, 1)"}],this.timingFromConfig(t)),t.transformOrigin&&this.setPrefixedProperty(e,"transformOrigin",t.transformOrigin),this._effect}}),
|
|
3455
3455
|
/**
|
|
3456
3456
|
@license
|
|
3457
3457
|
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
@@ -3462,7 +3462,7 @@ found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
|
3462
3462
|
part of the polymer project is also subject to an additional IP rights grant
|
|
3463
3463
|
found at http://polymer.github.io/PATENTS.txt
|
|
3464
3464
|
*/
|
|
3465
|
-
e({is:"slide-from-left-animation",behaviors:[
|
|
3465
|
+
e({is:"slide-from-left-animation",behaviors:[x],configure:function(t){var e=t.node;return this._effect=new KeyframeEffect(e,[{transform:"translateX(-100%)"},{transform:"none"}],this.timingFromConfig(t)),t.transformOrigin?this.setPrefixedProperty(e,"transformOrigin",t.transformOrigin):this.setPrefixedProperty(e,"transformOrigin","0 50%"),this._effect}}),
|
|
3466
3466
|
/**
|
|
3467
3467
|
@license
|
|
3468
3468
|
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
@@ -3473,7 +3473,7 @@ found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
|
3473
3473
|
part of the polymer project is also subject to an additional IP rights grant
|
|
3474
3474
|
found at http://polymer.github.io/PATENTS.txt
|
|
3475
3475
|
*/
|
|
3476
|
-
e({is:"slide-from-right-animation",behaviors:[
|
|
3476
|
+
e({is:"slide-from-right-animation",behaviors:[x],configure:function(t){var e=t.node;return this._effect=new KeyframeEffect(e,[{transform:"translateX(100%)"},{transform:"none"}],this.timingFromConfig(t)),t.transformOrigin?this.setPrefixedProperty(e,"transformOrigin",t.transformOrigin):this.setPrefixedProperty(e,"transformOrigin","0 50%"),this._effect}}),
|
|
3477
3477
|
/**
|
|
3478
3478
|
@license
|
|
3479
3479
|
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
@@ -3484,7 +3484,7 @@ found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
|
3484
3484
|
part of the polymer project is also subject to an additional IP rights grant
|
|
3485
3485
|
found at http://polymer.github.io/PATENTS.txt
|
|
3486
3486
|
*/
|
|
3487
|
-
e({is:"slide-from-top-animation",behaviors:[
|
|
3487
|
+
e({is:"slide-from-top-animation",behaviors:[x],configure:function(t){var e=t.node;return this._effect=new KeyframeEffect(e,[{transform:"translateY(-100%)"},{transform:"translateY(0%)"}],this.timingFromConfig(t)),t.transformOrigin?this.setPrefixedProperty(e,"transformOrigin",t.transformOrigin):this.setPrefixedProperty(e,"transformOrigin","50% 0"),this._effect}}),
|
|
3488
3488
|
/**
|
|
3489
3489
|
@license
|
|
3490
3490
|
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
@@ -3495,7 +3495,7 @@ found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
|
3495
3495
|
part of the polymer project is also subject to an additional IP rights grant
|
|
3496
3496
|
found at http://polymer.github.io/PATENTS.txt
|
|
3497
3497
|
*/
|
|
3498
|
-
e({is:"slide-from-bottom-animation",behaviors:[
|
|
3498
|
+
e({is:"slide-from-bottom-animation",behaviors:[x],configure:function(t){var e=t.node;return this._effect=new KeyframeEffect(e,[{transform:"translateY(100%)"},{transform:"translateY(0)"}],this.timingFromConfig(t)),t.transformOrigin?this.setPrefixedProperty(e,"transformOrigin",t.transformOrigin):this.setPrefixedProperty(e,"transformOrigin","50% 0"),this._effect}}),
|
|
3499
3499
|
/**
|
|
3500
3500
|
@license
|
|
3501
3501
|
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
@@ -3506,7 +3506,7 @@ found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
|
3506
3506
|
part of the polymer project is also subject to an additional IP rights grant
|
|
3507
3507
|
found at http://polymer.github.io/PATENTS.txt
|
|
3508
3508
|
*/
|
|
3509
|
-
e({is:"slide-left-animation",behaviors:[
|
|
3509
|
+
e({is:"slide-left-animation",behaviors:[x],configure:function(t){var e=t.node;return this._effect=new KeyframeEffect(e,[{transform:"none"},{transform:"translateX(-100%)"}],this.timingFromConfig(t)),t.transformOrigin?this.setPrefixedProperty(e,"transformOrigin",t.transformOrigin):this.setPrefixedProperty(e,"transformOrigin","0 50%"),this._effect}}),
|
|
3510
3510
|
/**
|
|
3511
3511
|
@license
|
|
3512
3512
|
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
@@ -3517,7 +3517,7 @@ found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
|
3517
3517
|
part of the polymer project is also subject to an additional IP rights grant
|
|
3518
3518
|
found at http://polymer.github.io/PATENTS.txt
|
|
3519
3519
|
*/
|
|
3520
|
-
e({is:"slide-right-animation",behaviors:[
|
|
3520
|
+
e({is:"slide-right-animation",behaviors:[x],configure:function(t){var e=t.node;return this._effect=new KeyframeEffect(e,[{transform:"none"},{transform:"translateX(100%)"}],this.timingFromConfig(t)),t.transformOrigin?this.setPrefixedProperty(e,"transformOrigin",t.transformOrigin):this.setPrefixedProperty(e,"transformOrigin","0 50%"),this._effect}}),
|
|
3521
3521
|
/**
|
|
3522
3522
|
@license
|
|
3523
3523
|
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
@@ -3528,7 +3528,7 @@ found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
|
3528
3528
|
part of the polymer project is also subject to an additional IP rights grant
|
|
3529
3529
|
found at http://polymer.github.io/PATENTS.txt
|
|
3530
3530
|
*/
|
|
3531
|
-
e({is:"slide-up-animation",behaviors:[
|
|
3531
|
+
e({is:"slide-up-animation",behaviors:[x],configure:function(t){var e=t.node;return this._effect=new KeyframeEffect(e,[{transform:"translate(0)"},{transform:"translateY(-100%)"}],this.timingFromConfig(t)),t.transformOrigin?this.setPrefixedProperty(e,"transformOrigin",t.transformOrigin):this.setPrefixedProperty(e,"transformOrigin","50% 0"),this._effect}}),
|
|
3532
3532
|
/**
|
|
3533
3533
|
@license
|
|
3534
3534
|
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
@@ -3539,7 +3539,7 @@ found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
|
3539
3539
|
part of the polymer project is also subject to an additional IP rights grant
|
|
3540
3540
|
found at http://polymer.github.io/PATENTS.txt
|
|
3541
3541
|
*/
|
|
3542
|
-
e({is:"slide-down-animation",behaviors:[
|
|
3542
|
+
e({is:"slide-down-animation",behaviors:[x],configure:function(t){var e=t.node;return this._effect=new KeyframeEffect(e,[{transform:"translateY(0%)"},{transform:"translateY(100%)"}],this.timingFromConfig(t)),t.transformOrigin?this.setPrefixedProperty(e,"transformOrigin",t.transformOrigin):this.setPrefixedProperty(e,"transformOrigin","50% 0"),this._effect}}),
|
|
3543
3543
|
/**
|
|
3544
3544
|
@license
|
|
3545
3545
|
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
@@ -3550,11 +3550,11 @@ found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
|
3550
3550
|
part of the polymer project is also subject to an additional IP rights grant
|
|
3551
3551
|
found at http://polymer.github.io/PATENTS.txt
|
|
3552
3552
|
*/
|
|
3553
|
-
e({is:"transform-animation",behaviors:[
|
|
3554
|
-
<paper-dropdown-menu id="menu" label="${
|
|
3553
|
+
e({is:"transform-animation",behaviors:[x],configure:function(t){var e=t.node,i=t.transformFrom||"none",n=t.transformTo||"none";return this._effect=new KeyframeEffect(e,[{transform:i},{transform:n}],this.timingFromConfig(t)),t.transformOrigin&&this.setPrefixedProperty(e,"transformOrigin",t.transformOrigin),this._effect}});class za extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{label:{type:String},odds:{type:Array},name:{type:String},odd:{type:String,notify:!0}})}constructor(){super(),this.label="document.selectODD",this.odds=[]}connectedCallback(){super.connectedCallback(),this.subscribeTo("pb-update",this._onTargetUpdate.bind(this))}firstUpdated(){super.firstUpdated(),za.waitOnce("pb-page-ready",()=>{this._refresh()})}render(){return O`
|
|
3554
|
+
<paper-dropdown-menu id="menu" label="${F(this.label)}" name="${this.name}">
|
|
3555
3555
|
<paper-listbox id="odds" slot="dropdown-content" class="dropdown-content" selected="${this.odd}"
|
|
3556
3556
|
attr-for-selected="value" @selected-item-changed="${this._selected}">
|
|
3557
|
-
${this.odds.map(t=>
|
|
3557
|
+
${this.odds.map(t=>O`<paper-item value="${t.name}">${t.label}</paper-item>`)}
|
|
3558
3558
|
</paper-listbox>
|
|
3559
3559
|
</paper-dropdown-menu>
|
|
3560
3560
|
|
|
@@ -3565,7 +3565,7 @@ e({is:"transform-animation",behaviors:[z],configure:function(t){var e=t.node,i=t
|
|
|
3565
3565
|
method="get"
|
|
3566
3566
|
with-credentials
|
|
3567
3567
|
@response="${this._update}"></iron-ajax>
|
|
3568
|
-
`}static get styles(){return
|
|
3568
|
+
`}static get styles(){return V`
|
|
3569
3569
|
:host {
|
|
3570
3570
|
display: block;
|
|
3571
3571
|
}
|
|
@@ -3574,19 +3574,19 @@ e({is:"transform-animation",behaviors:[z],configure:function(t){var e=t.node,i=t
|
|
|
3574
3574
|
--paper-listbox-background-color: white;
|
|
3575
3575
|
width: 100%;
|
|
3576
3576
|
}
|
|
3577
|
-
`}_selected(){const t=this.shadowRoot.getElementById("odds").selected;if(t===this.odd)return;this.odd=t,console.log("<pb-select-odd> Switching to ODD %s",this.odd);const e=this.getDocument();e&&(e.odd=this.odd),this.setParameter("odd",this.odd+".odd"),this.pushHistory("changed odd",{odd:this.odd}),this.emitTo("pb-refresh",{odd:this.odd})}_refresh(){const t=this.shadowRoot.getElementById("load");this.minApiVersion("1.0.0")?t.url=this.getEndpoint()+"/api/odd":t.url=this.getEndpoint()+"/modules/lib/components-list-odds.xql",t.params={odd:this.odd},t.generateRequest()}_update(){const t=this.shadowRoot.getElementById("load");this.odds=t.lastResponse}_onTargetUpdate(t){let e=t.detail.data.odd;e&&(e=e.replace(/^(.*?)\.[^\.]+$/,"$1")),e!==this.odd&&console.log("<pb-select-odd> Set current ODD from %s to %s",this.odd,e),this.odd=e}}customElements.define("pb-select-odd",za);class Sa extends(
|
|
3578
|
-
<paper-dropdown-menu id="menu" label="${
|
|
3577
|
+
`}_selected(){const t=this.shadowRoot.getElementById("odds").selected;if(t===this.odd)return;this.odd=t,console.log("<pb-select-odd> Switching to ODD %s",this.odd);const e=this.getDocument();e&&(e.odd=this.odd),this.setParameter("odd",this.odd+".odd"),this.pushHistory("changed odd",{odd:this.odd}),this.emitTo("pb-refresh",{odd:this.odd})}_refresh(){const t=this.shadowRoot.getElementById("load");this.minApiVersion("1.0.0")?t.url=this.getEndpoint()+"/api/odd":t.url=this.getEndpoint()+"/modules/lib/components-list-odds.xql",t.params={odd:this.odd},t.generateRequest()}_update(){const t=this.shadowRoot.getElementById("load");this.odds=t.lastResponse}_onTargetUpdate(t){let e=t.detail.data.odd;e&&(e=e.replace(/^(.*?)\.[^\.]+$/,"$1")),e!==this.odd&&console.log("<pb-select-odd> Set current ODD from %s to %s",this.odd,e),this.odd=e}}customElements.define("pb-select-odd",za);class Sa extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{label:{type:String},template:{type:String},_templates:{type:Array}})}constructor(){super(),this.label="document.selectTemplate",this._templates=[]}firstUpdated(){Sa.waitOnce("pb-page-ready",t=>{this.template=t.template;const e=this.shadowRoot.getElementById("getTemplates");this.minApiVersion("1.0.0")?e.url=t.endpoint+"/api/templates":e.url=t.endpoint+"/modules/lib/components-list-templates.xql",e.generateRequest()})}render(){return O`
|
|
3578
|
+
<paper-dropdown-menu id="menu" label="${F(this.label)}" name="${this.name}">
|
|
3579
3579
|
<paper-listbox id="templates" slot="dropdown-content" class="dropdown-content"
|
|
3580
3580
|
selected="${this.template}" attr-for-selected="value"
|
|
3581
3581
|
@selected-item-changed="${this._selected}">
|
|
3582
|
-
${this._templates.map(t=>
|
|
3582
|
+
${this._templates.map(t=>O`<paper-item value="${t.name}">${t.title}</paper-item>`)}
|
|
3583
3583
|
</paper-listbox>
|
|
3584
3584
|
</paper-dropdown-menu>
|
|
3585
3585
|
|
|
3586
3586
|
<iron-ajax id="getTemplates" with-credentials
|
|
3587
3587
|
handle-as="json" @response="${this._handleTemplatesResponse}"
|
|
3588
3588
|
method="GET"></iron-ajax>
|
|
3589
|
-
`}static get styles(){return
|
|
3589
|
+
`}static get styles(){return V`
|
|
3590
3590
|
:host {
|
|
3591
3591
|
display: block;
|
|
3592
3592
|
}
|
|
@@ -3594,7 +3594,7 @@ e({is:"transform-animation",behaviors:[z],configure:function(t){var e=t.node,i=t
|
|
|
3594
3594
|
--paper-listbox-background-color: white;
|
|
3595
3595
|
width: 100%;
|
|
3596
3596
|
}
|
|
3597
|
-
`}_selected(){const t=this.shadowRoot.getElementById("templates").selected;t!==this.template&&(this.setParameter("template",t),window.location=this.getUrl().toString())}_handleTemplatesResponse(){const t=this.shadowRoot.getElementById("getTemplates");this._templates=t.lastResponse}}customElements.define("pb-select-template",Sa);class Ca extends tn{static get properties(){return Object.assign(Object.assign({},super.properties),{},{longitude:{type:Number},latitude:{type:Number},label:{type:String},event:{type:String},zoom:{type:Number},auto:{type:Boolean}})}constructor(){super(),this.event="mouseover",this.auto=!1,this.zoom=null}connectedCallback(){super.connectedCallback(),this.event&&this.addEventListener(this.event,()=>this.emitTo("pb-geolocation",{coordinates:{latitude:this.latitude,longitude:this.longitude},label:this.label,zoom:this.zoom,popup:this.popup,element:this,event:this.event})),this.auto&&this.waitForChannel(()=>{this.emitTo("pb-geolocation",{coordinates:{latitude:this.latitude,longitude:this.longitude},label:this.label,popup:this.popup,fitBounds:!0,element:this})})}render(){return
|
|
3597
|
+
`}_selected(){const t=this.shadowRoot.getElementById("templates").selected;t!==this.template&&(this.setParameter("template",t),window.location=this.getUrl().toString())}_handleTemplatesResponse(){const t=this.shadowRoot.getElementById("getTemplates");this._templates=t.lastResponse}}customElements.define("pb-select-template",Sa);class Ca extends tn{static get properties(){return Object.assign(Object.assign({},super.properties),{},{longitude:{type:Number},latitude:{type:Number},label:{type:String},event:{type:String},zoom:{type:Number},auto:{type:Boolean}})}constructor(){super(),this.event="mouseover",this.auto=!1,this.zoom=null}connectedCallback(){super.connectedCallback(),this.event&&this.addEventListener(this.event,()=>this.emitTo("pb-geolocation",{coordinates:{latitude:this.latitude,longitude:this.longitude},label:this.label,zoom:this.zoom,popup:this.popup,element:this,event:this.event})),this.auto&&this.waitForChannel(()=>{this.emitTo("pb-geolocation",{coordinates:{latitude:this.latitude,longitude:this.longitude},label:this.label,popup:this.popup,fitBounds:!0,element:this})})}render(){return O`<span id="content"><slot></slot></span>`}get popup(){const t=this.querySelector("template");if(t){const e=document.createElement("div");return e.appendChild(t.content.cloneNode(!0)),e}return null}static get styles(){return V`
|
|
3598
3598
|
:host {
|
|
3599
3599
|
display: inline;
|
|
3600
3600
|
cursor: pointer;
|
|
@@ -3629,14 +3629,14 @@ e({is:"transform-animation",behaviors:[z],configure:function(t){var e=t.node,i=t
|
|
|
3629
3629
|
.highlight-off {
|
|
3630
3630
|
background-color: inherit;
|
|
3631
3631
|
}
|
|
3632
|
-
`}}customElements.define("pb-geolocation",Ca);class Ea extends(
|
|
3632
|
+
`}}customElements.define("pb-geolocation",Ca);class Ea extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{initial:{type:Number},_instances:{type:Array}})}constructor(){super(),this.initial=1,this._instances=[]}connectedCallback(){super.connectedCallback(),this.template=this.querySelector("template");const t=this.getParameters();if(this._computeInitial(t),0===this._instances.length)for(let e=0;e<this.initial;e++)this._add(t)}_computeInitial(t){const e=Object.keys(t).filter(t=>/\[\d+\]$/.test(t)).sort();if(e.length>0){const t=e[e.length-1].replace(/^.*\[(\d+)\]$/,"$1");this.initial=parseInt(t,10)}}setData(t){this._instances=[],this._computeInitial(t);for(let e=0;e<this.initial;e++)this._add(t);this.requestUpdate()}add(){this._add(),this.requestUpdate()}_add(t){const e=this._instances.length+1,i=document.importNode(this.template.content,!0),n=document.createElement("div");n.appendChild(i),n.querySelectorAll("[name]").forEach(i=>{const n=`${i.name}[${e}]`;t&&t[n]&&("checkbox"===i.type||"radio"===i.type?i.checked=t[n]===i.value:i.value=t[n]),i.name=n}),this._instances.push(n)}_renumber(){this._instances.forEach((t,e)=>{t.querySelectorAll("[name]").forEach(t=>{const i=t.name.replace(/^(.*)\[\d+\]$/,"$1");t.name=`${i}[${e+1}]`})})}delete(t){this._instances.splice(t,1),this._renumber(),this.requestUpdate()}render(){return O`
|
|
3633
3633
|
<div class="instances">${this._instances.map(this.renderInstance.bind(this))}</div>
|
|
3634
3634
|
<paper-icon-button icon="add" @click="${this.add}"></paper-icon-button>
|
|
3635
|
-
`}renderInstance(t,e){return
|
|
3635
|
+
`}renderInstance(t,e){return O`
|
|
3636
3636
|
<div class="instance">
|
|
3637
3637
|
${t}
|
|
3638
3638
|
<paper-icon-button icon="delete" @click="${()=>this.delete(e)}"></paper-icon-button>
|
|
3639
|
-
</div>`}createRenderRoot(){return this}}customElements.define("pb-repeat",Ea);class Ma extends(
|
|
3639
|
+
</div>`}createRenderRoot(){return this}}customElements.define("pb-repeat",Ea);class Ma extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{url:{type:String}})}constructor(){super(),this._pan=null}connectedCallback(){super.connectedCallback()}firstUpdated(){super.firstUpdated(),window.ESGlobalBridge.requestAvailability(),window.ESGlobalBridge.instance.load("svg-pan-zoom","https://cdn.jsdelivr.net/npm/svg-pan-zoom@3.6.1/dist/svg-pan-zoom.min.js"),window.addEventListener("es-bridge-svg-pan-zoom-loaded",this._onSvgPanZoomLoaded.bind(this),{once:!0}),this.container=this.shadowRoot.getElementById("image"),this.subscribeTo("pb-show-annotation",t=>{console.log("<pb-svg> loading %s",t.detail.file),this.url=t.detail.file,this.load()})}_onSvgPanZoomLoaded(){this.load()}load(){this._pan&&(this._pan.destroy(),this._pan=null,this.container.innerHTML=""),this.url&&fetch(this.url).then(t=>t.text()).then(t=>{const e=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;this.container.appendChild(e),this._pan=window.svgPanZoom(e,{controlIconsEnabled:!0,fit:!0,center:!0})})}render(){return O`<div id="image"></div>`}static get styles(){return V`
|
|
3640
3640
|
:host {
|
|
3641
3641
|
display: block;
|
|
3642
3642
|
}
|
|
@@ -3645,12 +3645,12 @@ e({is:"transform-animation",behaviors:[z],configure:function(t){var e=t.node,i=t
|
|
|
3645
3645
|
height: var(--pb-svg-height, 100%);
|
|
3646
3646
|
width: var(--pb-svg-width, 100%);
|
|
3647
3647
|
}
|
|
3648
|
-
`}}customElements.define("pb-svg",Ma);class La extends(
|
|
3648
|
+
`}}customElements.define("pb-svg",Ma);class La extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{src:{type:String},showNavigationControl:{type:Boolean,attribute:"show-navigation-control"},showNavigator:{type:Boolean,attribute:"show-navigator"},showHomeControl:{type:Boolean,attribute:"show-home-control"},showFullPageControl:{type:Boolean,attribute:"show-full-page-control"},defaultZoomLevel:{type:Number,attribute:"default-zoom-level"},showRotationControl:{type:Boolean,attribute:"show-rotation-control"},constrainDuringPan:{type:Boolean,attribute:"contrain-during-pan"},visibilityRatio:{type:Number,attribute:"visibility-ratio"},referenceStrip:{type:Boolean,attribute:"reference-strip"},referenceStripSizeRatio:{type:Number,attribute:"reference-strip-size-ratio"},type:{type:String},baseUri:{type:String,attribute:"base-uri"},prefixUrl:{type:String,attribute:"prefix-url"},facsimiles:{type:Array},loaded:{type:Boolean,reflect:!0}})}constructor(){super(),this._facsimiles=[],this.baseUri="",this.type="iiif",this.visibilityRatio=1,this.defaultZoomLevel=0,this.showHomeControl=!1,this.showNavigator=!1,this.showNavigationControl=!1,this.showFullPageControl=!1,this.showRotationControl=!1,this.constrainDuringPan=!1,this.referenceStrip=!1,this.referenceStripSizeRatio=.2,this.src="",this.prefixUrl="../images/openseadragon/",this.loaded=!1}set facsimiles(t){this._facsimiles=t||[],this.loaded=this._facsimiles.length>0,this.emitTo("pb-facsimile-status",{status:"loading"})}connectedCallback(){super.connectedCallback(),this.subscribeTo("pb-start-update",this._clearAll.bind(this)),this.subscribeTo("pb-update",this._fragmentUpdateListener.bind(this)),this.subscribeTo("pb-show-annotation",this._showAnnotationListener.bind(this))}firstUpdated(){window.ESGlobalBridge.requestAvailability();const t=I("../lib/openseadragon.min.js");window.ESGlobalBridge.instance.load("openseadragon",t),window.addEventListener("es-bridge-openseadragon-loaded",this._initOpenSeadragon.bind(this),{once:!0})}render(){return O`
|
|
3649
3649
|
<slot name="before"></slot>
|
|
3650
3650
|
<!-- Openseadragon -->
|
|
3651
3651
|
<div id="viewer" part="image"></div>
|
|
3652
3652
|
<slot name="after"></slot>
|
|
3653
|
-
`}static get styles(){return
|
|
3653
|
+
`}static get styles(){return V`
|
|
3654
3654
|
:host {
|
|
3655
3655
|
display: flex;
|
|
3656
3656
|
flex-direction: column;
|
|
@@ -3668,18 +3668,18 @@ e({is:"transform-animation",behaviors:[z],configure:function(t){var e=t.node,i=t
|
|
|
3668
3668
|
max-height: var(--pb-facsimile-height, auto);
|
|
3669
3669
|
width: 100%;
|
|
3670
3670
|
}
|
|
3671
|
-
`}_initOpenSeadragon(){const t=
|
|
3672
|
-
<paper-dropdown-menu id="menu" label="${
|
|
3671
|
+
`}_initOpenSeadragon(){const t=I(this.prefixUrl+(this.prefixUrl.endsWith("/")?"":"/")),e={element:this.shadowRoot.getElementById("viewer"),prefixUrl:t,preserveViewport:!0,sequenceMode:!0,showZoomControl:!0,showHomeControl:this.showHomeControl,showFullPageControl:this.showFullPageControl,showNavigator:this.showNavigator,showNavigationControl:this.showNavigationControl,showRotationControl:this.showRotationControl,autoHideControls:!1,visibilityRatio:1,minZoomLevel:1,defaultZoomLevel:this.defaultZoomLevel,constrainDuringPan:!0};this.referenceStrip&&(e.showReferenceStrip=!0,e.referenceStripSizeRatio=this.referenceStripSizeRatio),this.viewer=OpenSeadragon(e),this.viewer.addHandler("open",()=>{this.resetZoom(),this.emitTo("pb-facsimile-status",{status:"loaded"})}),this.viewer.addHandler("open-failed",t=>{console.error("<pb-facsimile> open failed: %s",t.message),this.loaded=!1,this.emitTo("pb-facsimile-status",{status:"fail"})}),this._facsimileObserver(),this.signalReady()}_facsimileObserver(){if(!this.viewer)return;if(0===this._facsimiles.length)return this.viewer.close();const t=this._facsimiles.map(t=>"iiif"===this.type?`${this.baseUri}${t}/info.json`:{tileSource:{type:"image",url:`${this.baseUri}${t}`,buildPyramid:!1}});this.viewer.open(t),this.viewer.goToPage(0)}_clearAll(){this.viewer&&(this.resetZoom(),this.viewer.clearOverlays(),this.facsimiles=[])}_fragmentUpdateListener(t){this.facsimiles=this._getFacsimilesFromData(t.detail.root),this._facsimileObserver()}_getFacsimilesFromData(t){const e=[];return t.querySelectorAll("pb-facs-link").forEach(t=>{t.facs&&e.push(t.facs)}),console.log("<pb-facsimile> _getFacsimilesFromData",e),e}_showAnnotationListener(t){if(!this.viewer)return;const e="runtime-overlay";if(this.viewer.removeOverlay(this.overlay),!t.detail.file||0===t.detail.file)return console.error("file missing",t.detail);if(t.detail.coordinates&&(!t.detail.coordinates[0]||4!==t.detail.coordinates.length))return console.error("coords incomplete or missing",t.detail);const i=this._pageIndexByUrl(t.detail.file);if(i<0)return console.error("page not found",t.detail);if(this.viewer.currentPage()!==i&&this.viewer.goToPage(i),t.detail.coordinates){const[i,n,r,o]=t.detail.coordinates,s=this.viewer.viewport.viewportToImageRectangle(this.viewer.viewport.getBounds(!0));s.containsPoint(new OpenSeadragon.Point(i,n))||this.viewer.viewport.fitBoundsWithConstraints(this.viewer.viewport.imageToViewportRectangle(i,n,s.width,s.height));const a=this.overlay=document.createElement("div");a.id=e;const l=this.viewer.viewport.imageToViewportRectangle(i,n,r,o);this.viewer.addOverlay({element:a,location:l})}}_pageIndexByUrl(t){return this._facsimiles.indexOf(t)}resetZoom(){this.viewer&&this.viewer.viewport.goHome()}}customElements.define("pb-facsimile",La);class Ta extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{endpoint:{type:String},label:{type:String},endpoints:{type:Array},auto:{type:Boolean}})}constructor(){super(),this.endpoints=[],this.label="dts.endpoint"}connectedCallback(){super.connectedCallback(),this.endpoint=this.getParameter("endpoint")}updated(t){if(super.updated(),t.has("endpoints")){!this.shadowRoot.getElementById("endpoints").selectedItem&&this.auto&&this.endpoints.length>0&&(this.endpoint=this.endpoints[0].url)}}render(){return O`
|
|
3672
|
+
<paper-dropdown-menu id="menu" label="${F(this.label)}">
|
|
3673
3673
|
<paper-listbox id="endpoints" slot="dropdown-content" class="dropdown-content" selected="${this.endpoint}" attr-for-selected="value"
|
|
3674
3674
|
@selected-item-changed="${this._selected}">
|
|
3675
|
-
${this.endpoints.map(t=>
|
|
3675
|
+
${this.endpoints.map(t=>O`<paper-item value="${t.url?t.url:""}">${t.title}</paper-item>`)}
|
|
3676
3676
|
</paper-listbox>
|
|
3677
3677
|
</paper-dropdown-menu>
|
|
3678
|
-
`}static get styles(){return
|
|
3678
|
+
`}static get styles(){return V`
|
|
3679
3679
|
:host {
|
|
3680
3680
|
display: block;
|
|
3681
3681
|
}
|
|
3682
|
-
`}_selected(){const t=this.shadowRoot.getElementById("endpoints").selectedItem;if(!t)return;const e=t.getAttribute("value");if(!e)return;const i=this.endpoints.find(t=>t.url===e);this.setParameter("endpoint",i.url),this.pushHistory("dts-endpoint"),console.log("<dts-select-endpoint> Setting endpoint to %s",e),this.emitTo("dts-endpoint",{endpoint:i.url,collection:i.collection,reload:!this.endpoint}),this.endpoint=i.url}}customElements.define("dts-select-endpoint",Ta);class Ha extends(
|
|
3682
|
+
`}_selected(){const t=this.shadowRoot.getElementById("endpoints").selectedItem;if(!t)return;const e=t.getAttribute("value");if(!e)return;const i=this.endpoints.find(t=>t.url===e);this.setParameter("endpoint",i.url),this.pushHistory("dts-endpoint"),console.log("<dts-select-endpoint> Setting endpoint to %s",e),this.emitTo("dts-endpoint",{endpoint:i.url,collection:i.collection,reload:!this.endpoint}),this.endpoint=i.url}}customElements.define("dts-select-endpoint",Ta);class Ha extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{baseUri:{type:String},data:{type:Object},collection:{type:String},page:{type:Number},perPage:{type:Number},_collectionEndpoint:{type:String}})}constructor(){super(),this._parentCollections=[],this.collection="default"}connectedCallback(){super.connectedCallback(),this.collection=this.getParameter("id"),this.page=this.getParameter("page"),this.subscribeTo("dts-endpoint",t=>{this._setEndpoint(t.detail.endpoint,t.detail.collection,t.detail.reload)}),this.subscribeTo("pb-load",t=>{this.page=t.detail.params.page,console.log("<dts-client> Loading page %d",this.page),this._update()})}firstUpdated(){super.firstUpdated(),this.queryAPI=this.shadowRoot.getElementById("queryAPI"),this.documentsAPI=this.shadowRoot.getElementById("documentsAPI"),this.signalReady()}_setEndpoint(t,e,i){i||(this.page=null),this.collection=e,this._configureEndpoint(t),this.baseUri=t}_configureEndpoint(t){t&&(console.log("<dts-client> initializing connection to endpoint %s",t),this.emitTo("pb-start-update"),this.queryAPI.url=t,this.queryAPI.generateRequest())}_navigate(t,e,i=!0){t.preventDefault(),i&&this._parentCollections.push(this.collection),this.collection=e&&"object"==typeof e?e["@id"]:e,this.page=null,console.log("<dts-client> navigating to collection %s",this.collection),this._update()}_navigateUp(t){0!==this._parentCollections.length&&this._navigate(t,this._parentCollections.pop(),!1)}_preview(t,e){t.preventDefault(),this.emitTo("pb-start-update");const i=e["dts:passage"]||e["dts:download"],n=new URL(i,this.baseUri).toString();console.log("<dts-client> downloading %s",n),this.lessThanApiVersion("1.0.0")?(this.documentsAPI.url=this.getEndpoint()+"/modules/lib/dts.xql",this.documentsAPI.params={preview:n,id:e["@id"]}):(this.documentsAPI.url=this.getEndpoint()+"/api/dts/import",this.documentsAPI.params={uri:n,temp:!0}),this.documentsAPI.generateRequest()}_download(t,e){this.emitTo("pb-start-update");const i=e["dts:passage"]||e["dts:download"],n=new URL(i,this.baseUri).toString();console.log("<dts-client> importing %s",n),this.lessThanApiVersion("1.0.0")?(this.documentsAPI.url=this.getEndpoint()+"/modules/lib/dts.xql",this.documentsAPI.params={import:n,id:e["@id"]}):(this.documentsAPI.url=this.getEndpoint()+"/api/dts/import",this.documentsAPI.params={uri:n,temp:!1}),this.documentsAPI.generateRequest()}_update(){this.emitTo("pb-start-update");const t={};this.collection&&(t.id=this.collection,this.setParameter("id",this.collection)),this.page&&(t.page=this.page+1,this.setParameter("page",this.page)),this.pushHistory("dts-client-navigate"),this.queryAPI.params=t,this.queryAPI.url=this._collectionEndpoint,this.queryAPI.generateRequest()}_handleResponse(){const t=this.queryAPI.lastResponse;"EntryPoint"===t["@type"]?(this._collectionEndpoint=new URL(t.collections,this.baseUri).toString(),console.log("<dts-client> configured collection endpoint: %s",this._collectionEndpoint),this._update()):(this.data=t,console.log("<dts-client> received collection data: %o",t),!this.page&&t.totalItems>t.member.length&&(this.perPage=t.member.length),this.emitTo("pb-results-received",{start:this.page&&this.page>0?this.page*this.perPage+1:1,count:t.totalItems})),this.emitTo("pb-end-update")}_handlePreview(){const t=this.documentsAPI.lastResponse;this.emitTo("pb-end-update");const e=new URL(t.path,window.location.href);window.location=e}_handleError(t){this.emitTo("pb-end-update");const e=t.target.lastError.response,i=(new DOMParser).parseFromString(e,"application/xml").querySelector("message"),n=document.getElementById("errorDialog"),r=n.querySelector("paper-dialog-scrollable");r.innerHTML=i?i.textContent:t.detail.error.message,n.open()}static _getCreator(t){const e=t["dts:dublincore"];return e?e["dc:creator"]:null}static _getLicense(t){const e=t["dts:dublincore"];return e?e["dc:license"]:null}render(){return O`
|
|
3683
3683
|
<slot name="toolbar"></slot>
|
|
3684
3684
|
${this.baseUri?this._renderClient():""}
|
|
3685
3685
|
|
|
@@ -3697,17 +3697,17 @@ e({is:"transform-animation",behaviors:[z],configure:function(t){var e=t.node,i=t
|
|
|
3697
3697
|
method="get"
|
|
3698
3698
|
@response="${this._handlePreview}"
|
|
3699
3699
|
@error="${this._handleError}"></iron-ajax>
|
|
3700
|
-
`}_renderClient(){return
|
|
3700
|
+
`}_renderClient(){return O`
|
|
3701
3701
|
<div class="uri">${this.baseUri}</div>
|
|
3702
3702
|
<h3 part="collection-title">${this.data?this.data.title:"Loading ..."}</h3>
|
|
3703
3703
|
<slot name="pagination"></slot>
|
|
3704
|
-
${this._parentCollections.length>0||this.collection?
|
|
3704
|
+
${this._parentCollections.length>0||this.collection?O`
|
|
3705
3705
|
<paper-button part="parent-link" @click="${this._navigateUp}">
|
|
3706
3706
|
<iron-icon icon="icons:arrow-upward"></iron-icon>
|
|
3707
|
-
${
|
|
3707
|
+
${F("browse.up")}
|
|
3708
3708
|
</paper-button>`:null}
|
|
3709
3709
|
${this.data?this._renderMembers():""}
|
|
3710
|
-
`}_renderMembers(){const t=[];return this.data.member.forEach(e=>{t.push(
|
|
3710
|
+
`}_renderMembers(){const t=[];return this.data.member.forEach(e=>{t.push(O`<div class="member">${this._renderMember(e)}</div>`)}),t}_renderMember(t){if("Collection"==t["@type"])return O`
|
|
3711
3711
|
<iron-icon icon="icons:folder-open"></iron-icon>
|
|
3712
3712
|
<div class="details">
|
|
3713
3713
|
<a href="#" @click="${e=>this._navigate(e,t)}" part="link">
|
|
@@ -3716,7 +3716,7 @@ e({is:"transform-animation",behaviors:[z],configure:function(t){var e=t.node,i=t
|
|
|
3716
3716
|
</h4>
|
|
3717
3717
|
</a>
|
|
3718
3718
|
</div>
|
|
3719
|
-
`;const e=Ha._getLicense(t);return
|
|
3719
|
+
`;const e=Ha._getLicense(t);return O`
|
|
3720
3720
|
<iron-icon icon="icons:code"></iron-icon>
|
|
3721
3721
|
<div class="details">
|
|
3722
3722
|
<div>
|
|
@@ -3726,13 +3726,13 @@ e({is:"transform-animation",behaviors:[z],configure:function(t){var e=t.node,i=t
|
|
|
3726
3726
|
</h4>
|
|
3727
3727
|
</a>
|
|
3728
3728
|
<p part="creator" class="creator">${Ha._getCreator(t)}</p>
|
|
3729
|
-
${e?
|
|
3729
|
+
${e?O`<p part="license" class="license"><a href="${e}">${F("dts.licence")}</a></p>`:""}
|
|
3730
3730
|
</div>
|
|
3731
|
-
<iron-icon title="${
|
|
3731
|
+
<iron-icon title="${F("dts.import")}" icon="icons:file-download"
|
|
3732
3732
|
@click="${e=>this._download(e,t)}">
|
|
3733
3733
|
</iron-icon>
|
|
3734
3734
|
</div>
|
|
3735
|
-
`}static get styles(){return
|
|
3735
|
+
`}static get styles(){return V`
|
|
3736
3736
|
:host {
|
|
3737
3737
|
display: block;
|
|
3738
3738
|
}
|
|
@@ -3770,12 +3770,12 @@ e({is:"transform-animation",behaviors:[z],configure:function(t){var e=t.node,i=t
|
|
|
3770
3770
|
color: #f6a622;
|
|
3771
3771
|
font-size: 85%;
|
|
3772
3772
|
}
|
|
3773
|
-
`}}customElements.define("dts-client",Ha);class Oa extends
|
|
3773
|
+
`}}customElements.define("dts-client",Ha);class Oa extends T{static get properties(){return Object.assign(Object.assign({},super.properties),{},{user:{type:String},hash:{type:String},height:{type:Number},theme:{type:String},preview:{type:Boolean},editable:{type:Boolean}})}constructor(){super(),this.height=256,this.theme="light"}render(){let t=`height=${this.height}&theme-id=${this.theme}&default-tab=html,result`;this.editable&&(t+="&editable=true");const e=`https://codepen.io/${this.user}/embed/${this.preview?"preview/":""}${this.hash}?${t}`;return O`
|
|
3774
3774
|
<iframe height="${this.height}" scrolling="no" title="${this.labe}l"
|
|
3775
3775
|
src="${e}" frameborder="no" allowtransparency="true" allowfullscreen>
|
|
3776
3776
|
Loading codepen ...
|
|
3777
3777
|
</iframe>
|
|
3778
|
-
`}static get styles(){return
|
|
3778
|
+
`}static get styles(){return V`
|
|
3779
3779
|
:host {
|
|
3780
3780
|
display: block;
|
|
3781
3781
|
}
|
|
@@ -3783,7 +3783,7 @@ e({is:"transform-animation",behaviors:[z],configure:function(t){var e=t.node,i=t
|
|
|
3783
3783
|
iframe {
|
|
3784
3784
|
width: 100%;
|
|
3785
3785
|
}
|
|
3786
|
-
`}}customElements.define("pb-codepen",Oa),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).marked=e()}(void 0,(function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function e(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}function i(t,e){if(t){if("string"==typeof t)return n(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?n(t,e):void 0}}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function r(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=i(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=t[Symbol.iterator]()).next.bind(n)}function o(t){var e={exports:{}};return t(e,e.exports),e.exports}var s=o((function(t){function e(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function i(e){t.exports.defaults=e}t.exports={defaults:e(),getDefaults:e,changeDefaults:i}})),a=/[&<>"']/,l=/[&<>"']/g,c=/[<>"']|&(?!#?\w+;)/,h=/[<>"']|&(?!#?\w+;)/g,d={"&":"&","<":"<",">":">",'"':""","'":"'"},p=function(t){return d[t]};function u(t,e){if(e){if(a.test(t))return t.replace(l,p)}else if(c.test(t))return t.replace(h,p);return t}var g=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function f(t){return t.replace(g,(function(t,e){return"colon"===(e=e.toLowerCase())?":":"#"===e.charAt(0)?"x"===e.charAt(1)?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):""}))}var m=/(^|[^\[])\^/g;function v(t,e){t=t.source||t,e=e||"";var i={replace:function(e,n){return n=(n=n.source||n).replace(m,"$1"),t=t.replace(e,n),i},getRegex:function(){return new RegExp(t,e)}};return i}var b=/[^\w:]/g,y=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function _(t,e,i){if(t){var n;try{n=decodeURIComponent(f(i)).replace(b,"").toLowerCase()}catch(t){return null}if(0===n.indexOf("javascript:")||0===n.indexOf("vbscript:")||0===n.indexOf("data:"))return null}e&&!y.test(i)&&(i=z(e,i));try{i=encodeURI(i).replace(/%25/g,"%")}catch(t){return null}return i}var w={},x=/^[^:]+:\/*[^/]*$/,k=/^([^:]+:)[\s\S]*$/,A=/^([^:]+:\/*[^/]*)[\s\S]*$/;function z(t,e){w[" "+t]||(x.test(t)?w[" "+t]=t+"/":w[" "+t]=E(t,"/",!0));var i=-1===(t=w[" "+t]).indexOf(":");return"//"===e.substring(0,2)?i?e:t.replace(k,"$1")+e:"/"===e.charAt(0)?i?e:t.replace(A,"$1")+e:t+e}function S(t){for(var e,i,n=1;n<arguments.length;n++)for(i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}function C(t,e){var i=t.replace(/\|/g,(function(t,e,i){for(var n=!1,r=e;--r>=0&&"\\"===i[r];)n=!n;return n?"|":" |"})).split(/ \|/),n=0;if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;n<i.length;n++)i[n]=i[n].trim().replace(/\\\|/g,"|");return i}function E(t,e,i){var n=t.length;if(0===n)return"";for(var r=0;r<n;){var o=t.charAt(n-r-1);if(o!==e||i){if(o===e||!i)break;r++}else r++}return t.substr(0,n-r)}function M(t,e){if(-1===t.indexOf(e[1]))return-1;for(var i=t.length,n=0,r=0;r<i;r++)if("\\"===t[r])r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&--n<0)return r;return-1}function L(t){t&&t.sanitize&&!t.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function T(t,e){if(e<1)return"";for(var i="";e>1;)1&e&&(i+=t),e>>=1,t+=t;return i+t}var H={escape:u,unescape:f,edit:v,cleanUrl:_,resolveUrl:z,noopTest:{exec:function(){}},merge:S,splitCells:C,rtrim:E,findClosingBracket:M,checkSanitizeDeprecation:L,repeatString:T},O=s.defaults,$=H.rtrim,V=H.splitCells,I=H.escape,R=H.findClosingBracket;function P(t,e,i){var n=e.href,r=e.title?I(e.title):null,o=t[1].replace(/\\([\[\]])/g,"$1");return"!"!==t[0].charAt(0)?{type:"link",raw:i,href:n,title:r,text:o}:{type:"image",raw:i,href:n,title:r,text:I(o)}}function D(t,e){var i=t.match(/^(\s+)(?:```)/);if(null===i)return e;var n=i[1];return e.split("\n").map((function(t){var e=t.match(/^\s+/);return null===e?t:e[0].length>=n.length?t.slice(n.length):t})).join("\n")}var N=function(){function t(t){this.options=t||O}var e=t.prototype;return e.space=function(t){var e=this.rules.block.newline.exec(t);if(e)return e[0].length>1?{type:"space",raw:e[0]}:{raw:"\n"}},e.code=function(t,e){var i=this.rules.block.code.exec(t);if(i){var n=e[e.length-1];if(n&&"paragraph"===n.type)return{raw:i[0],text:i[0].trimRight()};var r=i[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:i[0],codeBlockStyle:"indented",text:this.options.pedantic?r:$(r,"\n")}}},e.fences=function(t){var e=this.rules.block.fences.exec(t);if(e){var i=e[0],n=D(i,e[3]||"");return{type:"code",raw:i,lang:e[2]?e[2].trim():e[2],text:n}}},e.heading=function(t){var e=this.rules.block.heading.exec(t);if(e){var i=e[2].trim();if(/#$/.test(i)){var n=$(i,"#");this.options.pedantic?i=n.trim():n&&!/ $/.test(n)||(i=n.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:i}}},e.nptable=function(t){var e=this.rules.block.nptable.exec(t);if(e){var i={type:"table",header:V(e[1].replace(/^ *| *\| *$/g,"")),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:e[3]?e[3].replace(/\n$/,"").split("\n"):[],raw:e[0]};if(i.header.length===i.align.length){var n,r=i.align.length;for(n=0;n<r;n++)/^ *-+: *$/.test(i.align[n])?i.align[n]="right":/^ *:-+: *$/.test(i.align[n])?i.align[n]="center":/^ *:-+ *$/.test(i.align[n])?i.align[n]="left":i.align[n]=null;for(r=i.cells.length,n=0;n<r;n++)i.cells[n]=V(i.cells[n],i.header.length);return i}}},e.hr=function(t){var e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:e[0]}},e.blockquote=function(t){var e=this.rules.block.blockquote.exec(t);if(e){var i=e[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:e[0],text:i}}},e.list=function(t){var e=this.rules.block.list.exec(t);if(e){var i,n,r,o,s,a,l,c,h=e[0],d=e[2],p=d.length>1,u={type:"list",raw:h,ordered:p,start:p?+d.slice(0,-1):"",loose:!1,items:[]},g=e[0].match(this.rules.block.item),f=!1,m=g.length;r=this.rules.block.listItemStart.exec(g[0]);for(var v=0;v<m;v++){if(h=i=g[v],v!==m-1){if(o=this.rules.block.listItemStart.exec(g[v+1]),this.options.pedantic?o[1].length>r[1].length:o[1].length>r[0].length||o[1].length>3){g.splice(v,2,g[v]+"\n"+g[v+1]),v--,m--;continue}(!this.options.pedantic||this.options.smartLists?o[2][o[2].length-1]!==d[d.length-1]:p===(1===o[2].length))&&(s=g.slice(v+1).join("\n"),u.raw=u.raw.substring(0,u.raw.length-s.length),v=m-1),r=o}n=i.length,~(i=i.replace(/^ *([*+-]|\d+[.)]) ?/,"")).indexOf("\n ")&&(n-=i.length,i=this.options.pedantic?i.replace(/^ {1,4}/gm,""):i.replace(new RegExp("^ {1,"+n+"}","gm"),"")),a=f||/\n\n(?!\s*$)/.test(i),v!==m-1&&(f="\n"===i.charAt(i.length-1),a||(a=f)),a&&(u.loose=!0),this.options.gfm&&(c=void 0,(l=/^\[[ xX]\] /.test(i))&&(c=" "!==i[1],i=i.replace(/^\[[ xX]\] +/,""))),u.items.push({type:"list_item",raw:h,task:l,checked:c,loose:a,text:i})}return u}},e.html=function(t){var e=this.rules.block.html.exec(t);if(e)return{type:this.options.sanitize?"paragraph":"html",raw:e[0],pre:!this.options.sanitizer&&("pre"===e[1]||"script"===e[1]||"style"===e[1]),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):I(e[0]):e[0]}},e.def=function(t){var e=this.rules.block.def.exec(t);if(e)return e[3]&&(e[3]=e[3].substring(1,e[3].length-1)),{tag:e[1].toLowerCase().replace(/\s+/g," "),raw:e[0],href:e[2],title:e[3]}},e.table=function(t){var e=this.rules.block.table.exec(t);if(e){var i={type:"table",header:V(e[1].replace(/^ *| *\| *$/g,"")),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:e[3]?e[3].replace(/\n$/,"").split("\n"):[]};if(i.header.length===i.align.length){i.raw=e[0];var n,r=i.align.length;for(n=0;n<r;n++)/^ *-+: *$/.test(i.align[n])?i.align[n]="right":/^ *:-+: *$/.test(i.align[n])?i.align[n]="center":/^ *:-+ *$/.test(i.align[n])?i.align[n]="left":i.align[n]=null;for(r=i.cells.length,n=0;n<r;n++)i.cells[n]=V(i.cells[n].replace(/^ *\| *| *\| *$/g,""),i.header.length);return i}}},e.lheading=function(t){var e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:"="===e[2].charAt(0)?1:2,text:e[1]}},e.paragraph=function(t){var e=this.rules.block.paragraph.exec(t);if(e)return{type:"paragraph",raw:e[0],text:"\n"===e[1].charAt(e[1].length-1)?e[1].slice(0,-1):e[1]}},e.text=function(t,e){var i=this.rules.block.text.exec(t);if(i){var n=e[e.length-1];return n&&"text"===n.type?{raw:i[0],text:i[0]}:{type:"text",raw:i[0],text:i[0]}}},e.escape=function(t){var e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:I(e[1])}},e.tag=function(t,e,i){var n=this.rules.inline.tag.exec(t);if(n)return!e&&/^<a /i.test(n[0])?e=!0:e&&/^<\/a>/i.test(n[0])&&(e=!1),!i&&/^<(pre|code|kbd|script)(\s|>)/i.test(n[0])?i=!0:i&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(n[0])&&(i=!1),{type:this.options.sanitize?"text":"html",raw:n[0],inLink:e,inRawBlock:i,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):I(n[0]):n[0]}},e.link=function(t){var e=this.rules.inline.link.exec(t);if(e){var i=e[2].trim();if(!this.options.pedantic&&/^</.test(i)){if(!/>$/.test(i))return;var n=$(i.slice(0,-1),"\\");if((i.length-n.length)%2==0)return}else{var r=R(e[2],"()");if(r>-1){var o=(0===e[0].indexOf("!")?5:4)+e[1].length+r;e[2]=e[2].substring(0,r),e[0]=e[0].substring(0,o).trim(),e[3]=""}}var s=e[2],a="";if(this.options.pedantic){var l=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(s);l&&(s=l[1],a=l[3])}else a=e[3]?e[3].slice(1,-1):"";return s=s.trim(),/^</.test(s)&&(s=this.options.pedantic&&!/>$/.test(i)?s.slice(1):s.slice(1,-1)),P(e,{href:s?s.replace(this.rules.inline._escapes,"$1"):s,title:a?a.replace(this.rules.inline._escapes,"$1"):a},e[0])}},e.reflink=function(t,e){var i;if((i=this.rules.inline.reflink.exec(t))||(i=this.rules.inline.nolink.exec(t))){var n=(i[2]||i[1]).replace(/\s+/g," ");if(!(n=e[n.toLowerCase()])||!n.href){var r=i[0].charAt(0);return{type:"text",raw:r,text:r}}return P(i,n,i[0])}},e.strong=function(t,e,i){void 0===i&&(i="");var n=this.rules.inline.strong.start.exec(t);if(n&&(!n[1]||n[1]&&(""===i||this.rules.inline.punctuation.exec(i)))){e=e.slice(-1*t.length);var r,o="**"===n[0]?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;for(o.lastIndex=0;null!=(n=o.exec(e));)if(r=this.rules.inline.strong.middle.exec(e.slice(0,n.index+3)))return{type:"strong",raw:t.slice(0,r[0].length),text:t.slice(2,r[0].length-2)}}},e.em=function(t,e,i){void 0===i&&(i="");var n=this.rules.inline.em.start.exec(t);if(n&&(!n[1]||n[1]&&(""===i||this.rules.inline.punctuation.exec(i)))){e=e.slice(-1*t.length);var r,o="*"===n[0]?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;for(o.lastIndex=0;null!=(n=o.exec(e));)if(r=this.rules.inline.em.middle.exec(e.slice(0,n.index+2)))return{type:"em",raw:t.slice(0,r[0].length),text:t.slice(1,r[0].length-1)}}},e.codespan=function(t){var e=this.rules.inline.code.exec(t);if(e){var i=e[2].replace(/\n/g," "),n=/[^ ]/.test(i),r=/^ /.test(i)&&/ $/.test(i);return n&&r&&(i=i.substring(1,i.length-1)),i=I(i,!0),{type:"codespan",raw:e[0],text:i}}},e.br=function(t){var e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}},e.del=function(t){var e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2]}},e.autolink=function(t,e){var i,n,r=this.rules.inline.autolink.exec(t);if(r)return n="@"===r[2]?"mailto:"+(i=I(this.options.mangle?e(r[1]):r[1])):i=I(r[1]),{type:"link",raw:r[0],text:i,href:n,tokens:[{type:"text",raw:i,text:i}]}},e.url=function(t,e){var i;if(i=this.rules.inline.url.exec(t)){var n,r;if("@"===i[2])r="mailto:"+(n=I(this.options.mangle?e(i[0]):i[0]));else{var o;do{o=i[0],i[0]=this.rules.inline._backpedal.exec(i[0])[0]}while(o!==i[0]);n=I(i[0]),r="www."===i[1]?"http://"+n:n}return{type:"link",raw:i[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}},e.inlineText=function(t,e,i){var n,r=this.rules.inline.text.exec(t);if(r)return n=e?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(r[0]):I(r[0]):r[0]:I(this.options.smartypants?i(r[0]):r[0]),{type:"text",raw:r[0],text:n}},t}(),F=H.noopTest,B=H.edit,j=H.merge,q={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?! {0,3}bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:F,table:F,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};q.def=B(q.def).replace("label",q._label).replace("title",q._title).getRegex(),q.bullet=/(?:[*+-]|\d{1,9}[.)])/,q.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,q.item=B(q.item,"gm").replace(/bull/g,q.bullet).getRegex(),q.listItemStart=B(/^( *)(bull)/).replace("bull",q.bullet).getRegex(),q.list=B(q.list).replace(/bull/g,q.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+q.def.source+")").getRegex(),q._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",q._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,q.html=B(q.html,"i").replace("comment",q._comment).replace("tag",q._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),q.paragraph=B(q._paragraph).replace("hr",q.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",q._tag).getRegex(),q.blockquote=B(q.blockquote).replace("paragraph",q.paragraph).getRegex(),q.normal=j({},q),q.gfm=j({},q.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n {0,3}([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n {0,3}\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),q.gfm.nptable=B(q.gfm.nptable).replace("hr",q.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",q._tag).getRegex(),q.gfm.table=B(q.gfm.table).replace("hr",q.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",q._tag).getRegex(),q.pedantic=j({},q.normal,{html:B("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",q._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:F,paragraph:B(q.normal._paragraph).replace("hr",q.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",q.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var U={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:F,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation_\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation*\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation_\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation*\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:F,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\s*punctuation])/,_punctuation:"!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~"};U.punctuation=B(U.punctuation).replace(/punctuation/g,U._punctuation).getRegex(),U._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",U._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",U._comment=B(q._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),U.em.start=B(U.em.start).replace(/punctuation/g,U._punctuation).getRegex(),U.em.middle=B(U.em.middle).replace(/punctuation/g,U._punctuation).replace(/overlapSkip/g,U._overlapSkip).getRegex(),U.em.endAst=B(U.em.endAst,"g").replace(/punctuation/g,U._punctuation).getRegex(),U.em.endUnd=B(U.em.endUnd,"g").replace(/punctuation/g,U._punctuation).getRegex(),U.strong.start=B(U.strong.start).replace(/punctuation/g,U._punctuation).getRegex(),U.strong.middle=B(U.strong.middle).replace(/punctuation/g,U._punctuation).replace(/overlapSkip/g,U._overlapSkip).getRegex(),U.strong.endAst=B(U.strong.endAst,"g").replace(/punctuation/g,U._punctuation).getRegex(),U.strong.endUnd=B(U.strong.endUnd,"g").replace(/punctuation/g,U._punctuation).getRegex(),U.blockSkip=B(U._blockSkip,"g").getRegex(),U.overlapSkip=B(U._overlapSkip,"g").getRegex(),U._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,U._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,U._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,U.autolink=B(U.autolink).replace("scheme",U._scheme).replace("email",U._email).getRegex(),U._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,U.tag=B(U.tag).replace("comment",U._comment).replace("attribute",U._attribute).getRegex(),U._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,U._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,U._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,U.link=B(U.link).replace("label",U._label).replace("href",U._href).replace("title",U._title).getRegex(),U.reflink=B(U.reflink).replace("label",U._label).getRegex(),U.reflinkSearch=B(U.reflinkSearch,"g").replace("reflink",U.reflink).replace("nolink",U.nolink).getRegex(),U.normal=j({},U),U.pedantic=j({},U.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:B(/^!?\[(label)\]\((.*?)\)/).replace("label",U._label).getRegex(),reflink:B(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",U._label).getRegex()}),U.gfm=j({},U.normal,{escape:B(U.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),U.gfm.url=B(U.gfm.url,"i").replace("email",U.gfm._extended_email).getRegex(),U.breaks=j({},U.gfm,{br:B(U.br).replace("{2,}","*").getRegex(),text:B(U.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var W={block:q,inline:U},Y=s.defaults,G=W.block,X=W.inline,K=H.repeatString;function Q(t){return t.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}function Z(t){var e,i,n="",r=t.length;for(e=0;e<r;e++)i=t.charCodeAt(e),Math.random()>.5&&(i="x"+i.toString(16)),n+="&#"+i+";";return n}var J=function(){function t(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Y,this.options.tokenizer=this.options.tokenizer||new N,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var e={block:G.normal,inline:X.normal};this.options.pedantic?(e.block=G.pedantic,e.inline=X.pedantic):this.options.gfm&&(e.block=G.gfm,this.options.breaks?e.inline=X.breaks:e.inline=X.gfm),this.tokenizer.rules=e}t.lex=function(e,i){return new t(i).lex(e)},t.lexInline=function(e,i){return new t(i).inlineTokens(e)};var i=t.prototype;return i.lex=function(t){return t=t.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(t,this.tokens,!0),this.inline(this.tokens),this.tokens},i.blockTokens=function(t,e,i){var n,r,o,s;for(void 0===e&&(e=[]),void 0===i&&(i=!0),this.options.pedantic&&(t=t.replace(/^ +$/gm,""));t;)if(n=this.tokenizer.space(t))t=t.substring(n.raw.length),n.type&&e.push(n);else if(n=this.tokenizer.code(t,e))t=t.substring(n.raw.length),n.type?e.push(n):((s=e[e.length-1]).raw+="\n"+n.raw,s.text+="\n"+n.text);else if(n=this.tokenizer.fences(t))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.heading(t))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.nptable(t))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.hr(t))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.blockquote(t))t=t.substring(n.raw.length),n.tokens=this.blockTokens(n.text,[],i),e.push(n);else if(n=this.tokenizer.list(t)){for(t=t.substring(n.raw.length),o=n.items.length,r=0;r<o;r++)n.items[r].tokens=this.blockTokens(n.items[r].text,[],!1);e.push(n)}else if(n=this.tokenizer.html(t))t=t.substring(n.raw.length),e.push(n);else if(i&&(n=this.tokenizer.def(t)))t=t.substring(n.raw.length),this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});else if(n=this.tokenizer.table(t))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.lheading(t))t=t.substring(n.raw.length),e.push(n);else if(i&&(n=this.tokenizer.paragraph(t)))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.text(t,e))t=t.substring(n.raw.length),n.type?e.push(n):((s=e[e.length-1]).raw+="\n"+n.raw,s.text+="\n"+n.text);else if(t){var a="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(a);break}throw new Error(a)}return e},i.inline=function(t){var e,i,n,r,o,s,a=t.length;for(e=0;e<a;e++)switch((s=t[e]).type){case"paragraph":case"text":case"heading":s.tokens=[],this.inlineTokens(s.text,s.tokens);break;case"table":for(s.tokens={header:[],cells:[]},r=s.header.length,i=0;i<r;i++)s.tokens.header[i]=[],this.inlineTokens(s.header[i],s.tokens.header[i]);for(r=s.cells.length,i=0;i<r;i++)for(o=s.cells[i],s.tokens.cells[i]=[],n=0;n<o.length;n++)s.tokens.cells[i][n]=[],this.inlineTokens(o[n],s.tokens.cells[i][n]);break;case"blockquote":this.inline(s.tokens);break;case"list":for(r=s.items.length,i=0;i<r;i++)this.inline(s.items[i].tokens)}return t},i.inlineTokens=function(t,e,i,n){var r;void 0===e&&(e=[]),void 0===i&&(i=!1),void 0===n&&(n=!1);var o,s,a,l=t;if(this.tokens.links){var c=Object.keys(this.tokens.links);if(c.length>0)for(;null!=(o=this.tokenizer.rules.inline.reflinkSearch.exec(l));)c.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,o.index)+"["+K("a",o[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(o=this.tokenizer.rules.inline.blockSkip.exec(l));)l=l.slice(0,o.index)+"["+K("a",o[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;t;)if(s||(a=""),s=!1,r=this.tokenizer.escape(t))t=t.substring(r.raw.length),e.push(r);else if(r=this.tokenizer.tag(t,i,n))t=t.substring(r.raw.length),i=r.inLink,n=r.inRawBlock,e.push(r);else if(r=this.tokenizer.link(t))t=t.substring(r.raw.length),"link"===r.type&&(r.tokens=this.inlineTokens(r.text,[],!0,n)),e.push(r);else if(r=this.tokenizer.reflink(t,this.tokens.links))t=t.substring(r.raw.length),"link"===r.type&&(r.tokens=this.inlineTokens(r.text,[],!0,n)),e.push(r);else if(r=this.tokenizer.strong(t,l,a))t=t.substring(r.raw.length),r.tokens=this.inlineTokens(r.text,[],i,n),e.push(r);else if(r=this.tokenizer.em(t,l,a))t=t.substring(r.raw.length),r.tokens=this.inlineTokens(r.text,[],i,n),e.push(r);else if(r=this.tokenizer.codespan(t))t=t.substring(r.raw.length),e.push(r);else if(r=this.tokenizer.br(t))t=t.substring(r.raw.length),e.push(r);else if(r=this.tokenizer.del(t))t=t.substring(r.raw.length),r.tokens=this.inlineTokens(r.text,[],i,n),e.push(r);else if(r=this.tokenizer.autolink(t,Z))t=t.substring(r.raw.length),e.push(r);else if(i||!(r=this.tokenizer.url(t,Z))){if(r=this.tokenizer.inlineText(t,n,Q))t=t.substring(r.raw.length),a=r.raw.slice(-1),s=!0,e.push(r);else if(t){var h="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(h);break}throw new Error(h)}}else t=t.substring(r.raw.length),e.push(r);return e},e(t,null,[{key:"rules",get:function(){return{block:G,inline:X}}}]),t}(),tt=s.defaults,et=H.cleanUrl,it=H.escape,nt=function(){function t(t){this.options=t||tt}var e=t.prototype;return e.code=function(t,e,i){var n=(e||"").match(/\S*/)[0];if(this.options.highlight){var r=this.options.highlight(t,n);null!=r&&r!==t&&(i=!0,t=r)}return t=t.replace(/\n$/,"")+"\n",n?'<pre><code class="'+this.options.langPrefix+it(n,!0)+'">'+(i?t:it(t,!0))+"</code></pre>\n":"<pre><code>"+(i?t:it(t,!0))+"</code></pre>\n"},e.blockquote=function(t){return"<blockquote>\n"+t+"</blockquote>\n"},e.html=function(t){return t},e.heading=function(t,e,i,n){return this.options.headerIds?"<h"+e+' id="'+this.options.headerPrefix+n.slug(i)+'">'+t+"</h"+e+">\n":"<h"+e+">"+t+"</h"+e+">\n"},e.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},e.list=function(t,e,i){var n=e?"ol":"ul";return"<"+n+(e&&1!==i?' start="'+i+'"':"")+">\n"+t+"</"+n+">\n"},e.listitem=function(t){return"<li>"+t+"</li>\n"},e.checkbox=function(t){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},e.paragraph=function(t){return"<p>"+t+"</p>\n"},e.table=function(t,e){return e&&(e="<tbody>"+e+"</tbody>"),"<table>\n<thead>\n"+t+"</thead>\n"+e+"</table>\n"},e.tablerow=function(t){return"<tr>\n"+t+"</tr>\n"},e.tablecell=function(t,e){var i=e.header?"th":"td";return(e.align?"<"+i+' align="'+e.align+'">':"<"+i+">")+t+"</"+i+">\n"},e.strong=function(t){return"<strong>"+t+"</strong>"},e.em=function(t){return"<em>"+t+"</em>"},e.codespan=function(t){return"<code>"+t+"</code>"},e.br=function(){return this.options.xhtml?"<br/>":"<br>"},e.del=function(t){return"<del>"+t+"</del>"},e.link=function(t,e,i){if(null===(t=et(this.options.sanitize,this.options.baseUrl,t)))return i;var n='<a href="'+it(t)+'"';return e&&(n+=' title="'+e+'"'),n+=">"+i+"</a>"},e.image=function(t,e,i){if(null===(t=et(this.options.sanitize,this.options.baseUrl,t)))return i;var n='<img src="'+t+'" alt="'+i+'"';return e&&(n+=' title="'+e+'"'),n+=this.options.xhtml?"/>":">"},e.text=function(t){return t},t}(),rt=function(){function t(){}var e=t.prototype;return e.strong=function(t){return t},e.em=function(t){return t},e.codespan=function(t){return t},e.del=function(t){return t},e.html=function(t){return t},e.text=function(t){return t},e.link=function(t,e,i){return""+i},e.image=function(t,e,i){return""+i},e.br=function(){return""},t}(),ot=function(){function t(){this.seen={}}var e=t.prototype;return e.serialize=function(t){return t.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},e.getNextSafeSlug=function(t,e){var i=t,n=0;if(this.seen.hasOwnProperty(i)){n=this.seen[t];do{i=t+"-"+ ++n}while(this.seen.hasOwnProperty(i))}return e||(this.seen[t]=n,this.seen[i]=0),i},e.slug=function(t,e){void 0===e&&(e={});var i=this.serialize(t);return this.getNextSafeSlug(i,e.dryrun)},t}(),st=s.defaults,at=H.unescape,lt=function(){function t(t){this.options=t||st,this.options.renderer=this.options.renderer||new nt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new rt,this.slugger=new ot}t.parse=function(e,i){return new t(i).parse(e)},t.parseInline=function(e,i){return new t(i).parseInline(e)};var e=t.prototype;return e.parse=function(t,e){void 0===e&&(e=!0);var i,n,r,o,s,a,l,c,h,d,p,u,g,f,m,v,b,y,_="",w=t.length;for(i=0;i<w;i++)switch((d=t[i]).type){case"space":continue;case"hr":_+=this.renderer.hr();continue;case"heading":_+=this.renderer.heading(this.parseInline(d.tokens),d.depth,at(this.parseInline(d.tokens,this.textRenderer)),this.slugger);continue;case"code":_+=this.renderer.code(d.text,d.lang,d.escaped);continue;case"table":for(c="",l="",o=d.header.length,n=0;n<o;n++)l+=this.renderer.tablecell(this.parseInline(d.tokens.header[n]),{header:!0,align:d.align[n]});for(c+=this.renderer.tablerow(l),h="",o=d.cells.length,n=0;n<o;n++){for(l="",s=(a=d.tokens.cells[n]).length,r=0;r<s;r++)l+=this.renderer.tablecell(this.parseInline(a[r]),{header:!1,align:d.align[r]});h+=this.renderer.tablerow(l)}_+=this.renderer.table(c,h);continue;case"blockquote":h=this.parse(d.tokens),_+=this.renderer.blockquote(h);continue;case"list":for(p=d.ordered,u=d.start,g=d.loose,o=d.items.length,h="",n=0;n<o;n++)v=(m=d.items[n]).checked,b=m.task,f="",m.task&&(y=this.renderer.checkbox(v),g?m.tokens.length>0&&"text"===m.tokens[0].type?(m.tokens[0].text=y+" "+m.tokens[0].text,m.tokens[0].tokens&&m.tokens[0].tokens.length>0&&"text"===m.tokens[0].tokens[0].type&&(m.tokens[0].tokens[0].text=y+" "+m.tokens[0].tokens[0].text)):m.tokens.unshift({type:"text",text:y}):f+=y),f+=this.parse(m.tokens,g),h+=this.renderer.listitem(f,b,v);_+=this.renderer.list(h,p,u);continue;case"html":_+=this.renderer.html(d.text);continue;case"paragraph":_+=this.renderer.paragraph(this.parseInline(d.tokens));continue;case"text":for(h=d.tokens?this.parseInline(d.tokens):d.text;i+1<w&&"text"===t[i+1].type;)h+="\n"+((d=t[++i]).tokens?this.parseInline(d.tokens):d.text);_+=e?this.renderer.paragraph(h):h;continue;default:var x='Token with "'+d.type+'" type was not found.';if(this.options.silent)return void console.error(x);throw new Error(x)}return _},e.parseInline=function(t,e){e=e||this.renderer;var i,n,r="",o=t.length;for(i=0;i<o;i++)switch((n=t[i]).type){case"escape":r+=e.text(n.text);break;case"html":r+=e.html(n.text);break;case"link":r+=e.link(n.href,n.title,this.parseInline(n.tokens,e));break;case"image":r+=e.image(n.href,n.title,n.text);break;case"strong":r+=e.strong(this.parseInline(n.tokens,e));break;case"em":r+=e.em(this.parseInline(n.tokens,e));break;case"codespan":r+=e.codespan(n.text);break;case"br":r+=e.br();break;case"del":r+=e.del(this.parseInline(n.tokens,e));break;case"text":r+=e.text(n.text);break;default:var s='Token with "'+n.type+'" type was not found.';if(this.options.silent)return void console.error(s);throw new Error(s)}return r},t}(),ct=H.merge,ht=H.checkSanitizeDeprecation,dt=H.escape,pt=s.getDefaults,ut=s.changeDefaults,gt=s.defaults;function ft(t,e,i){if(null==t)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof t)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected");if("function"==typeof e&&(i=e,e=null),e=ct({},ft.defaults,e||{}),ht(e),i){var n,r=e.highlight;try{n=J.lex(t,e)}catch(t){return i(t)}var o=function(t){var o;if(!t)try{o=lt.parse(n,e)}catch(e){t=e}return e.highlight=r,t?i(t):i(null,o)};if(!r||r.length<3)return o();if(delete e.highlight,!n.length)return o();var s=0;return ft.walkTokens(n,(function(t){"code"===t.type&&(s++,setTimeout((function(){r(t.text,t.lang,(function(e,i){if(e)return o(e);null!=i&&i!==t.text&&(t.text=i,t.escaped=!0),0===--s&&o()}))}),0))})),void(0===s&&o())}try{var a=J.lex(t,e);return e.walkTokens&&ft.walkTokens(a,e.walkTokens),lt.parse(a,e)}catch(t){if(t.message+="\nPlease report this to https://github.com/markedjs/marked.",e.silent)return"<p>An error occurred:</p><pre>"+dt(t.message+"",!0)+"</pre>";throw t}}return ft.options=ft.setOptions=function(t){return ct(ft.defaults,t),ut(ft.defaults),ft},ft.getDefaults=pt,ft.defaults=gt,ft.use=function(t){var e=ct({},t);if(t.renderer&&function(){var i=ft.defaults.renderer||new nt,n=function(e){var n=i[e];i[e]=function(){for(var r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];var a=t.renderer[e].apply(i,o);return!1===a&&(a=n.apply(i,o)),a}};for(var r in t.renderer)n(r);e.renderer=i}(),t.tokenizer&&function(){var i=ft.defaults.tokenizer||new N,n=function(e){var n=i[e];i[e]=function(){for(var r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];var a=t.tokenizer[e].apply(i,o);return!1===a&&(a=n.apply(i,o)),a}};for(var r in t.tokenizer)n(r);e.tokenizer=i}(),t.walkTokens){var i=ft.defaults.walkTokens;e.walkTokens=function(e){t.walkTokens(e),i&&i(e)}}ft.setOptions(e)},ft.walkTokens=function(t,e){for(var i,n=r(t);!(i=n()).done;){var o=i.value;switch(e(o),o.type){case"table":for(var s,a=r(o.tokens.header);!(s=a()).done;){var l=s.value;ft.walkTokens(l,e)}for(var c,h=r(o.tokens.cells);!(c=h()).done;)for(var d,p=r(c.value);!(d=p()).done;){var u=d.value;ft.walkTokens(u,e)}break;case"list":ft.walkTokens(o.items,e);break;default:o.tokens&&ft.walkTokens(o.tokens,e)}}},ft.parseInline=function(t,e){if(null==t)throw new Error("marked.parseInline(): input parameter is undefined or null");if("string"!=typeof t)throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected");e=ct({},ft.defaults,e||{}),ht(e);try{var i=J.lexInline(t,e);return e.walkTokens&&ft.walkTokens(i,e.walkTokens),lt.parseInline(i,e)}catch(t){if(t.message+="\nPlease report this to https://github.com/markedjs/marked.",e.silent)return"<p>An error occurred:</p><pre>"+dt(t.message+"",!0)+"</pre>";throw t}},ft.Parser=lt,ft.parser=lt.parse,ft.Renderer=nt,ft.TextRenderer=rt,ft.Lexer=J,ft.lexer=J.lex,ft.Tokenizer=N,ft.Slugger=ot,ft.parse=ft,ft}));const $a=new window.marked.Renderer;function Va(t){const e=t.match(/^[^\S]*(?=\S)/gm);return e&&e[0].length?(e.sort((t,e)=>t.length-e.length),e[0].length?t.replace(RegExp("^"+e[0],"gm"),""):t):t}$a.code=function(t,e,i){return`<pb-code-highlight language="${e}" line-numbers>\n <template>${t}</template>\n </pb-code-highlight>`},window.marked.setOptions({renderer:$a});class Ia extends(N(V)){static get properties(){return Object.assign({content:{type:String},url:{type:String}},super.properties)}constructor(){super(),this._url=null}set url(t){this._url=t,Ia.waitOnce("pb-page-ready",t=>{this._load(t.endpoint)})}connectedCallback(){if(super.connectedCallback(),this.style.display="block",!this.content){const t=document.createElement("div");for(let e=0;e<this.childNodes.length;e++){const i=this.childNodes[e];t.appendChild(document.importNode(i.content||i,!0))}this.content=Va(t.innerHTML)}this.subscribeTo("pb-zoom",t=>{this.zoom(t.detail.direction)})}_load(t){const e=this.toAbsoluteURL(this._url,t);fetch(e,{credentials:"same-origin"}).then(t=>t.text()).catch(()=>(console.error("<pb-markdown> failed to load content from %s",e.toString()),Promise.resolve(this.content))).then(t=>{this.content=t})}createRenderRoot(){return this}render(){return this.content?R`<div>${M(window.marked(this.content))}</div>`:null}zoom(t){const e=window.getComputedStyle(this).getPropertyValue("font-size"),i=parseInt(e.replace(/^(\d+)px/,"$1"));this.style.fontSize="in"===t?i+1+"px":i-1+"px"}}customElements.define("pb-markdown",Ia);const Ra=new IntersectionObserver(t=>{t.forEach(t=>{if(t.isIntersecting){const e=t.target;e.emitTo("pb-visible",{data:e.data})}})});class Pa extends(N(V)){static get properties(){return Object.assign({data:{type:String}},super.properties)}disconnectedCallback(){super.disconnectedCallback(),Ra&&Ra.unobserve(this)}firstUpdated(){Ra.observe(this)}render(){return R`<slot></slot>`}static get styles(){return P`
|
|
3786
|
+
`}}customElements.define("pb-codepen",Oa),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).marked=e()}(void 0,(function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function e(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}function i(t,e){if(t){if("string"==typeof t)return n(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?n(t,e):void 0}}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function r(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=i(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=t[Symbol.iterator]()).next.bind(n)}function o(t){var e={exports:{}};return t(e,e.exports),e.exports}var s=o((function(t){function e(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function i(e){t.exports.defaults=e}t.exports={defaults:e(),getDefaults:e,changeDefaults:i}})),a=/[&<>"']/,l=/[&<>"']/g,c=/[<>"']|&(?!#?\w+;)/,h=/[<>"']|&(?!#?\w+;)/g,d={"&":"&","<":"<",">":">",'"':""","'":"'"},p=function(t){return d[t]};function u(t,e){if(e){if(a.test(t))return t.replace(l,p)}else if(c.test(t))return t.replace(h,p);return t}var g=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function f(t){return t.replace(g,(function(t,e){return"colon"===(e=e.toLowerCase())?":":"#"===e.charAt(0)?"x"===e.charAt(1)?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):""}))}var m=/(^|[^\[])\^/g;function v(t,e){t=t.source||t,e=e||"";var i={replace:function(e,n){return n=(n=n.source||n).replace(m,"$1"),t=t.replace(e,n),i},getRegex:function(){return new RegExp(t,e)}};return i}var b=/[^\w:]/g,y=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function _(t,e,i){if(t){var n;try{n=decodeURIComponent(f(i)).replace(b,"").toLowerCase()}catch(t){return null}if(0===n.indexOf("javascript:")||0===n.indexOf("vbscript:")||0===n.indexOf("data:"))return null}e&&!y.test(i)&&(i=z(e,i));try{i=encodeURI(i).replace(/%25/g,"%")}catch(t){return null}return i}var w={},x=/^[^:]+:\/*[^/]*$/,k=/^([^:]+:)[\s\S]*$/,A=/^([^:]+:\/*[^/]*)[\s\S]*$/;function z(t,e){w[" "+t]||(x.test(t)?w[" "+t]=t+"/":w[" "+t]=E(t,"/",!0));var i=-1===(t=w[" "+t]).indexOf(":");return"//"===e.substring(0,2)?i?e:t.replace(k,"$1")+e:"/"===e.charAt(0)?i?e:t.replace(A,"$1")+e:t+e}function S(t){for(var e,i,n=1;n<arguments.length;n++)for(i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}function C(t,e){var i=t.replace(/\|/g,(function(t,e,i){for(var n=!1,r=e;--r>=0&&"\\"===i[r];)n=!n;return n?"|":" |"})).split(/ \|/),n=0;if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;n<i.length;n++)i[n]=i[n].trim().replace(/\\\|/g,"|");return i}function E(t,e,i){var n=t.length;if(0===n)return"";for(var r=0;r<n;){var o=t.charAt(n-r-1);if(o!==e||i){if(o===e||!i)break;r++}else r++}return t.substr(0,n-r)}function M(t,e){if(-1===t.indexOf(e[1]))return-1;for(var i=t.length,n=0,r=0;r<i;r++)if("\\"===t[r])r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&--n<0)return r;return-1}function L(t){t&&t.sanitize&&!t.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function T(t,e){if(e<1)return"";for(var i="";e>1;)1&e&&(i+=t),e>>=1,t+=t;return i+t}var H={escape:u,unescape:f,edit:v,cleanUrl:_,resolveUrl:z,noopTest:{exec:function(){}},merge:S,splitCells:C,rtrim:E,findClosingBracket:M,checkSanitizeDeprecation:L,repeatString:T},O=s.defaults,$=H.rtrim,V=H.splitCells,I=H.escape,R=H.findClosingBracket;function P(t,e,i){var n=e.href,r=e.title?I(e.title):null,o=t[1].replace(/\\([\[\]])/g,"$1");return"!"!==t[0].charAt(0)?{type:"link",raw:i,href:n,title:r,text:o}:{type:"image",raw:i,href:n,title:r,text:I(o)}}function D(t,e){var i=t.match(/^(\s+)(?:```)/);if(null===i)return e;var n=i[1];return e.split("\n").map((function(t){var e=t.match(/^\s+/);return null===e?t:e[0].length>=n.length?t.slice(n.length):t})).join("\n")}var N=function(){function t(t){this.options=t||O}var e=t.prototype;return e.space=function(t){var e=this.rules.block.newline.exec(t);if(e)return e[0].length>1?{type:"space",raw:e[0]}:{raw:"\n"}},e.code=function(t,e){var i=this.rules.block.code.exec(t);if(i){var n=e[e.length-1];if(n&&"paragraph"===n.type)return{raw:i[0],text:i[0].trimRight()};var r=i[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:i[0],codeBlockStyle:"indented",text:this.options.pedantic?r:$(r,"\n")}}},e.fences=function(t){var e=this.rules.block.fences.exec(t);if(e){var i=e[0],n=D(i,e[3]||"");return{type:"code",raw:i,lang:e[2]?e[2].trim():e[2],text:n}}},e.heading=function(t){var e=this.rules.block.heading.exec(t);if(e){var i=e[2].trim();if(/#$/.test(i)){var n=$(i,"#");this.options.pedantic?i=n.trim():n&&!/ $/.test(n)||(i=n.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:i}}},e.nptable=function(t){var e=this.rules.block.nptable.exec(t);if(e){var i={type:"table",header:V(e[1].replace(/^ *| *\| *$/g,"")),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:e[3]?e[3].replace(/\n$/,"").split("\n"):[],raw:e[0]};if(i.header.length===i.align.length){var n,r=i.align.length;for(n=0;n<r;n++)/^ *-+: *$/.test(i.align[n])?i.align[n]="right":/^ *:-+: *$/.test(i.align[n])?i.align[n]="center":/^ *:-+ *$/.test(i.align[n])?i.align[n]="left":i.align[n]=null;for(r=i.cells.length,n=0;n<r;n++)i.cells[n]=V(i.cells[n],i.header.length);return i}}},e.hr=function(t){var e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:e[0]}},e.blockquote=function(t){var e=this.rules.block.blockquote.exec(t);if(e){var i=e[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:e[0],text:i}}},e.list=function(t){var e=this.rules.block.list.exec(t);if(e){var i,n,r,o,s,a,l,c,h=e[0],d=e[2],p=d.length>1,u={type:"list",raw:h,ordered:p,start:p?+d.slice(0,-1):"",loose:!1,items:[]},g=e[0].match(this.rules.block.item),f=!1,m=g.length;r=this.rules.block.listItemStart.exec(g[0]);for(var v=0;v<m;v++){if(h=i=g[v],v!==m-1){if(o=this.rules.block.listItemStart.exec(g[v+1]),this.options.pedantic?o[1].length>r[1].length:o[1].length>r[0].length||o[1].length>3){g.splice(v,2,g[v]+"\n"+g[v+1]),v--,m--;continue}(!this.options.pedantic||this.options.smartLists?o[2][o[2].length-1]!==d[d.length-1]:p===(1===o[2].length))&&(s=g.slice(v+1).join("\n"),u.raw=u.raw.substring(0,u.raw.length-s.length),v=m-1),r=o}n=i.length,~(i=i.replace(/^ *([*+-]|\d+[.)]) ?/,"")).indexOf("\n ")&&(n-=i.length,i=this.options.pedantic?i.replace(/^ {1,4}/gm,""):i.replace(new RegExp("^ {1,"+n+"}","gm"),"")),a=f||/\n\n(?!\s*$)/.test(i),v!==m-1&&(f="\n"===i.charAt(i.length-1),a||(a=f)),a&&(u.loose=!0),this.options.gfm&&(c=void 0,(l=/^\[[ xX]\] /.test(i))&&(c=" "!==i[1],i=i.replace(/^\[[ xX]\] +/,""))),u.items.push({type:"list_item",raw:h,task:l,checked:c,loose:a,text:i})}return u}},e.html=function(t){var e=this.rules.block.html.exec(t);if(e)return{type:this.options.sanitize?"paragraph":"html",raw:e[0],pre:!this.options.sanitizer&&("pre"===e[1]||"script"===e[1]||"style"===e[1]),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):I(e[0]):e[0]}},e.def=function(t){var e=this.rules.block.def.exec(t);if(e)return e[3]&&(e[3]=e[3].substring(1,e[3].length-1)),{tag:e[1].toLowerCase().replace(/\s+/g," "),raw:e[0],href:e[2],title:e[3]}},e.table=function(t){var e=this.rules.block.table.exec(t);if(e){var i={type:"table",header:V(e[1].replace(/^ *| *\| *$/g,"")),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:e[3]?e[3].replace(/\n$/,"").split("\n"):[]};if(i.header.length===i.align.length){i.raw=e[0];var n,r=i.align.length;for(n=0;n<r;n++)/^ *-+: *$/.test(i.align[n])?i.align[n]="right":/^ *:-+: *$/.test(i.align[n])?i.align[n]="center":/^ *:-+ *$/.test(i.align[n])?i.align[n]="left":i.align[n]=null;for(r=i.cells.length,n=0;n<r;n++)i.cells[n]=V(i.cells[n].replace(/^ *\| *| *\| *$/g,""),i.header.length);return i}}},e.lheading=function(t){var e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:"="===e[2].charAt(0)?1:2,text:e[1]}},e.paragraph=function(t){var e=this.rules.block.paragraph.exec(t);if(e)return{type:"paragraph",raw:e[0],text:"\n"===e[1].charAt(e[1].length-1)?e[1].slice(0,-1):e[1]}},e.text=function(t,e){var i=this.rules.block.text.exec(t);if(i){var n=e[e.length-1];return n&&"text"===n.type?{raw:i[0],text:i[0]}:{type:"text",raw:i[0],text:i[0]}}},e.escape=function(t){var e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:I(e[1])}},e.tag=function(t,e,i){var n=this.rules.inline.tag.exec(t);if(n)return!e&&/^<a /i.test(n[0])?e=!0:e&&/^<\/a>/i.test(n[0])&&(e=!1),!i&&/^<(pre|code|kbd|script)(\s|>)/i.test(n[0])?i=!0:i&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(n[0])&&(i=!1),{type:this.options.sanitize?"text":"html",raw:n[0],inLink:e,inRawBlock:i,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):I(n[0]):n[0]}},e.link=function(t){var e=this.rules.inline.link.exec(t);if(e){var i=e[2].trim();if(!this.options.pedantic&&/^</.test(i)){if(!/>$/.test(i))return;var n=$(i.slice(0,-1),"\\");if((i.length-n.length)%2==0)return}else{var r=R(e[2],"()");if(r>-1){var o=(0===e[0].indexOf("!")?5:4)+e[1].length+r;e[2]=e[2].substring(0,r),e[0]=e[0].substring(0,o).trim(),e[3]=""}}var s=e[2],a="";if(this.options.pedantic){var l=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(s);l&&(s=l[1],a=l[3])}else a=e[3]?e[3].slice(1,-1):"";return s=s.trim(),/^</.test(s)&&(s=this.options.pedantic&&!/>$/.test(i)?s.slice(1):s.slice(1,-1)),P(e,{href:s?s.replace(this.rules.inline._escapes,"$1"):s,title:a?a.replace(this.rules.inline._escapes,"$1"):a},e[0])}},e.reflink=function(t,e){var i;if((i=this.rules.inline.reflink.exec(t))||(i=this.rules.inline.nolink.exec(t))){var n=(i[2]||i[1]).replace(/\s+/g," ");if(!(n=e[n.toLowerCase()])||!n.href){var r=i[0].charAt(0);return{type:"text",raw:r,text:r}}return P(i,n,i[0])}},e.strong=function(t,e,i){void 0===i&&(i="");var n=this.rules.inline.strong.start.exec(t);if(n&&(!n[1]||n[1]&&(""===i||this.rules.inline.punctuation.exec(i)))){e=e.slice(-1*t.length);var r,o="**"===n[0]?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;for(o.lastIndex=0;null!=(n=o.exec(e));)if(r=this.rules.inline.strong.middle.exec(e.slice(0,n.index+3)))return{type:"strong",raw:t.slice(0,r[0].length),text:t.slice(2,r[0].length-2)}}},e.em=function(t,e,i){void 0===i&&(i="");var n=this.rules.inline.em.start.exec(t);if(n&&(!n[1]||n[1]&&(""===i||this.rules.inline.punctuation.exec(i)))){e=e.slice(-1*t.length);var r,o="*"===n[0]?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;for(o.lastIndex=0;null!=(n=o.exec(e));)if(r=this.rules.inline.em.middle.exec(e.slice(0,n.index+2)))return{type:"em",raw:t.slice(0,r[0].length),text:t.slice(1,r[0].length-1)}}},e.codespan=function(t){var e=this.rules.inline.code.exec(t);if(e){var i=e[2].replace(/\n/g," "),n=/[^ ]/.test(i),r=/^ /.test(i)&&/ $/.test(i);return n&&r&&(i=i.substring(1,i.length-1)),i=I(i,!0),{type:"codespan",raw:e[0],text:i}}},e.br=function(t){var e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}},e.del=function(t){var e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2]}},e.autolink=function(t,e){var i,n,r=this.rules.inline.autolink.exec(t);if(r)return n="@"===r[2]?"mailto:"+(i=I(this.options.mangle?e(r[1]):r[1])):i=I(r[1]),{type:"link",raw:r[0],text:i,href:n,tokens:[{type:"text",raw:i,text:i}]}},e.url=function(t,e){var i;if(i=this.rules.inline.url.exec(t)){var n,r;if("@"===i[2])r="mailto:"+(n=I(this.options.mangle?e(i[0]):i[0]));else{var o;do{o=i[0],i[0]=this.rules.inline._backpedal.exec(i[0])[0]}while(o!==i[0]);n=I(i[0]),r="www."===i[1]?"http://"+n:n}return{type:"link",raw:i[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}},e.inlineText=function(t,e,i){var n,r=this.rules.inline.text.exec(t);if(r)return n=e?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(r[0]):I(r[0]):r[0]:I(this.options.smartypants?i(r[0]):r[0]),{type:"text",raw:r[0],text:n}},t}(),F=H.noopTest,B=H.edit,j=H.merge,q={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?! {0,3}bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:F,table:F,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};q.def=B(q.def).replace("label",q._label).replace("title",q._title).getRegex(),q.bullet=/(?:[*+-]|\d{1,9}[.)])/,q.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,q.item=B(q.item,"gm").replace(/bull/g,q.bullet).getRegex(),q.listItemStart=B(/^( *)(bull)/).replace("bull",q.bullet).getRegex(),q.list=B(q.list).replace(/bull/g,q.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+q.def.source+")").getRegex(),q._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",q._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,q.html=B(q.html,"i").replace("comment",q._comment).replace("tag",q._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),q.paragraph=B(q._paragraph).replace("hr",q.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",q._tag).getRegex(),q.blockquote=B(q.blockquote).replace("paragraph",q.paragraph).getRegex(),q.normal=j({},q),q.gfm=j({},q.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n {0,3}([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n {0,3}\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),q.gfm.nptable=B(q.gfm.nptable).replace("hr",q.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",q._tag).getRegex(),q.gfm.table=B(q.gfm.table).replace("hr",q.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",q._tag).getRegex(),q.pedantic=j({},q.normal,{html:B("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",q._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:F,paragraph:B(q.normal._paragraph).replace("hr",q.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",q.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var U={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:F,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation_\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation*\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation_\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation*\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:F,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\s*punctuation])/,_punctuation:"!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~"};U.punctuation=B(U.punctuation).replace(/punctuation/g,U._punctuation).getRegex(),U._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",U._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",U._comment=B(q._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),U.em.start=B(U.em.start).replace(/punctuation/g,U._punctuation).getRegex(),U.em.middle=B(U.em.middle).replace(/punctuation/g,U._punctuation).replace(/overlapSkip/g,U._overlapSkip).getRegex(),U.em.endAst=B(U.em.endAst,"g").replace(/punctuation/g,U._punctuation).getRegex(),U.em.endUnd=B(U.em.endUnd,"g").replace(/punctuation/g,U._punctuation).getRegex(),U.strong.start=B(U.strong.start).replace(/punctuation/g,U._punctuation).getRegex(),U.strong.middle=B(U.strong.middle).replace(/punctuation/g,U._punctuation).replace(/overlapSkip/g,U._overlapSkip).getRegex(),U.strong.endAst=B(U.strong.endAst,"g").replace(/punctuation/g,U._punctuation).getRegex(),U.strong.endUnd=B(U.strong.endUnd,"g").replace(/punctuation/g,U._punctuation).getRegex(),U.blockSkip=B(U._blockSkip,"g").getRegex(),U.overlapSkip=B(U._overlapSkip,"g").getRegex(),U._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,U._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,U._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,U.autolink=B(U.autolink).replace("scheme",U._scheme).replace("email",U._email).getRegex(),U._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,U.tag=B(U.tag).replace("comment",U._comment).replace("attribute",U._attribute).getRegex(),U._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,U._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,U._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,U.link=B(U.link).replace("label",U._label).replace("href",U._href).replace("title",U._title).getRegex(),U.reflink=B(U.reflink).replace("label",U._label).getRegex(),U.reflinkSearch=B(U.reflinkSearch,"g").replace("reflink",U.reflink).replace("nolink",U.nolink).getRegex(),U.normal=j({},U),U.pedantic=j({},U.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:B(/^!?\[(label)\]\((.*?)\)/).replace("label",U._label).getRegex(),reflink:B(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",U._label).getRegex()}),U.gfm=j({},U.normal,{escape:B(U.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),U.gfm.url=B(U.gfm.url,"i").replace("email",U.gfm._extended_email).getRegex(),U.breaks=j({},U.gfm,{br:B(U.br).replace("{2,}","*").getRegex(),text:B(U.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var W={block:q,inline:U},Y=s.defaults,G=W.block,X=W.inline,K=H.repeatString;function Q(t){return t.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}function Z(t){var e,i,n="",r=t.length;for(e=0;e<r;e++)i=t.charCodeAt(e),Math.random()>.5&&(i="x"+i.toString(16)),n+="&#"+i+";";return n}var J=function(){function t(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Y,this.options.tokenizer=this.options.tokenizer||new N,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var e={block:G.normal,inline:X.normal};this.options.pedantic?(e.block=G.pedantic,e.inline=X.pedantic):this.options.gfm&&(e.block=G.gfm,this.options.breaks?e.inline=X.breaks:e.inline=X.gfm),this.tokenizer.rules=e}t.lex=function(e,i){return new t(i).lex(e)},t.lexInline=function(e,i){return new t(i).inlineTokens(e)};var i=t.prototype;return i.lex=function(t){return t=t.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(t,this.tokens,!0),this.inline(this.tokens),this.tokens},i.blockTokens=function(t,e,i){var n,r,o,s;for(void 0===e&&(e=[]),void 0===i&&(i=!0),this.options.pedantic&&(t=t.replace(/^ +$/gm,""));t;)if(n=this.tokenizer.space(t))t=t.substring(n.raw.length),n.type&&e.push(n);else if(n=this.tokenizer.code(t,e))t=t.substring(n.raw.length),n.type?e.push(n):((s=e[e.length-1]).raw+="\n"+n.raw,s.text+="\n"+n.text);else if(n=this.tokenizer.fences(t))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.heading(t))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.nptable(t))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.hr(t))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.blockquote(t))t=t.substring(n.raw.length),n.tokens=this.blockTokens(n.text,[],i),e.push(n);else if(n=this.tokenizer.list(t)){for(t=t.substring(n.raw.length),o=n.items.length,r=0;r<o;r++)n.items[r].tokens=this.blockTokens(n.items[r].text,[],!1);e.push(n)}else if(n=this.tokenizer.html(t))t=t.substring(n.raw.length),e.push(n);else if(i&&(n=this.tokenizer.def(t)))t=t.substring(n.raw.length),this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});else if(n=this.tokenizer.table(t))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.lheading(t))t=t.substring(n.raw.length),e.push(n);else if(i&&(n=this.tokenizer.paragraph(t)))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.text(t,e))t=t.substring(n.raw.length),n.type?e.push(n):((s=e[e.length-1]).raw+="\n"+n.raw,s.text+="\n"+n.text);else if(t){var a="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(a);break}throw new Error(a)}return e},i.inline=function(t){var e,i,n,r,o,s,a=t.length;for(e=0;e<a;e++)switch((s=t[e]).type){case"paragraph":case"text":case"heading":s.tokens=[],this.inlineTokens(s.text,s.tokens);break;case"table":for(s.tokens={header:[],cells:[]},r=s.header.length,i=0;i<r;i++)s.tokens.header[i]=[],this.inlineTokens(s.header[i],s.tokens.header[i]);for(r=s.cells.length,i=0;i<r;i++)for(o=s.cells[i],s.tokens.cells[i]=[],n=0;n<o.length;n++)s.tokens.cells[i][n]=[],this.inlineTokens(o[n],s.tokens.cells[i][n]);break;case"blockquote":this.inline(s.tokens);break;case"list":for(r=s.items.length,i=0;i<r;i++)this.inline(s.items[i].tokens)}return t},i.inlineTokens=function(t,e,i,n){var r;void 0===e&&(e=[]),void 0===i&&(i=!1),void 0===n&&(n=!1);var o,s,a,l=t;if(this.tokens.links){var c=Object.keys(this.tokens.links);if(c.length>0)for(;null!=(o=this.tokenizer.rules.inline.reflinkSearch.exec(l));)c.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,o.index)+"["+K("a",o[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(o=this.tokenizer.rules.inline.blockSkip.exec(l));)l=l.slice(0,o.index)+"["+K("a",o[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;t;)if(s||(a=""),s=!1,r=this.tokenizer.escape(t))t=t.substring(r.raw.length),e.push(r);else if(r=this.tokenizer.tag(t,i,n))t=t.substring(r.raw.length),i=r.inLink,n=r.inRawBlock,e.push(r);else if(r=this.tokenizer.link(t))t=t.substring(r.raw.length),"link"===r.type&&(r.tokens=this.inlineTokens(r.text,[],!0,n)),e.push(r);else if(r=this.tokenizer.reflink(t,this.tokens.links))t=t.substring(r.raw.length),"link"===r.type&&(r.tokens=this.inlineTokens(r.text,[],!0,n)),e.push(r);else if(r=this.tokenizer.strong(t,l,a))t=t.substring(r.raw.length),r.tokens=this.inlineTokens(r.text,[],i,n),e.push(r);else if(r=this.tokenizer.em(t,l,a))t=t.substring(r.raw.length),r.tokens=this.inlineTokens(r.text,[],i,n),e.push(r);else if(r=this.tokenizer.codespan(t))t=t.substring(r.raw.length),e.push(r);else if(r=this.tokenizer.br(t))t=t.substring(r.raw.length),e.push(r);else if(r=this.tokenizer.del(t))t=t.substring(r.raw.length),r.tokens=this.inlineTokens(r.text,[],i,n),e.push(r);else if(r=this.tokenizer.autolink(t,Z))t=t.substring(r.raw.length),e.push(r);else if(i||!(r=this.tokenizer.url(t,Z))){if(r=this.tokenizer.inlineText(t,n,Q))t=t.substring(r.raw.length),a=r.raw.slice(-1),s=!0,e.push(r);else if(t){var h="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(h);break}throw new Error(h)}}else t=t.substring(r.raw.length),e.push(r);return e},e(t,null,[{key:"rules",get:function(){return{block:G,inline:X}}}]),t}(),tt=s.defaults,et=H.cleanUrl,it=H.escape,nt=function(){function t(t){this.options=t||tt}var e=t.prototype;return e.code=function(t,e,i){var n=(e||"").match(/\S*/)[0];if(this.options.highlight){var r=this.options.highlight(t,n);null!=r&&r!==t&&(i=!0,t=r)}return t=t.replace(/\n$/,"")+"\n",n?'<pre><code class="'+this.options.langPrefix+it(n,!0)+'">'+(i?t:it(t,!0))+"</code></pre>\n":"<pre><code>"+(i?t:it(t,!0))+"</code></pre>\n"},e.blockquote=function(t){return"<blockquote>\n"+t+"</blockquote>\n"},e.html=function(t){return t},e.heading=function(t,e,i,n){return this.options.headerIds?"<h"+e+' id="'+this.options.headerPrefix+n.slug(i)+'">'+t+"</h"+e+">\n":"<h"+e+">"+t+"</h"+e+">\n"},e.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},e.list=function(t,e,i){var n=e?"ol":"ul";return"<"+n+(e&&1!==i?' start="'+i+'"':"")+">\n"+t+"</"+n+">\n"},e.listitem=function(t){return"<li>"+t+"</li>\n"},e.checkbox=function(t){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},e.paragraph=function(t){return"<p>"+t+"</p>\n"},e.table=function(t,e){return e&&(e="<tbody>"+e+"</tbody>"),"<table>\n<thead>\n"+t+"</thead>\n"+e+"</table>\n"},e.tablerow=function(t){return"<tr>\n"+t+"</tr>\n"},e.tablecell=function(t,e){var i=e.header?"th":"td";return(e.align?"<"+i+' align="'+e.align+'">':"<"+i+">")+t+"</"+i+">\n"},e.strong=function(t){return"<strong>"+t+"</strong>"},e.em=function(t){return"<em>"+t+"</em>"},e.codespan=function(t){return"<code>"+t+"</code>"},e.br=function(){return this.options.xhtml?"<br/>":"<br>"},e.del=function(t){return"<del>"+t+"</del>"},e.link=function(t,e,i){if(null===(t=et(this.options.sanitize,this.options.baseUrl,t)))return i;var n='<a href="'+it(t)+'"';return e&&(n+=' title="'+e+'"'),n+=">"+i+"</a>"},e.image=function(t,e,i){if(null===(t=et(this.options.sanitize,this.options.baseUrl,t)))return i;var n='<img src="'+t+'" alt="'+i+'"';return e&&(n+=' title="'+e+'"'),n+=this.options.xhtml?"/>":">"},e.text=function(t){return t},t}(),rt=function(){function t(){}var e=t.prototype;return e.strong=function(t){return t},e.em=function(t){return t},e.codespan=function(t){return t},e.del=function(t){return t},e.html=function(t){return t},e.text=function(t){return t},e.link=function(t,e,i){return""+i},e.image=function(t,e,i){return""+i},e.br=function(){return""},t}(),ot=function(){function t(){this.seen={}}var e=t.prototype;return e.serialize=function(t){return t.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},e.getNextSafeSlug=function(t,e){var i=t,n=0;if(this.seen.hasOwnProperty(i)){n=this.seen[t];do{i=t+"-"+ ++n}while(this.seen.hasOwnProperty(i))}return e||(this.seen[t]=n,this.seen[i]=0),i},e.slug=function(t,e){void 0===e&&(e={});var i=this.serialize(t);return this.getNextSafeSlug(i,e.dryrun)},t}(),st=s.defaults,at=H.unescape,lt=function(){function t(t){this.options=t||st,this.options.renderer=this.options.renderer||new nt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new rt,this.slugger=new ot}t.parse=function(e,i){return new t(i).parse(e)},t.parseInline=function(e,i){return new t(i).parseInline(e)};var e=t.prototype;return e.parse=function(t,e){void 0===e&&(e=!0);var i,n,r,o,s,a,l,c,h,d,p,u,g,f,m,v,b,y,_="",w=t.length;for(i=0;i<w;i++)switch((d=t[i]).type){case"space":continue;case"hr":_+=this.renderer.hr();continue;case"heading":_+=this.renderer.heading(this.parseInline(d.tokens),d.depth,at(this.parseInline(d.tokens,this.textRenderer)),this.slugger);continue;case"code":_+=this.renderer.code(d.text,d.lang,d.escaped);continue;case"table":for(c="",l="",o=d.header.length,n=0;n<o;n++)l+=this.renderer.tablecell(this.parseInline(d.tokens.header[n]),{header:!0,align:d.align[n]});for(c+=this.renderer.tablerow(l),h="",o=d.cells.length,n=0;n<o;n++){for(l="",s=(a=d.tokens.cells[n]).length,r=0;r<s;r++)l+=this.renderer.tablecell(this.parseInline(a[r]),{header:!1,align:d.align[r]});h+=this.renderer.tablerow(l)}_+=this.renderer.table(c,h);continue;case"blockquote":h=this.parse(d.tokens),_+=this.renderer.blockquote(h);continue;case"list":for(p=d.ordered,u=d.start,g=d.loose,o=d.items.length,h="",n=0;n<o;n++)v=(m=d.items[n]).checked,b=m.task,f="",m.task&&(y=this.renderer.checkbox(v),g?m.tokens.length>0&&"text"===m.tokens[0].type?(m.tokens[0].text=y+" "+m.tokens[0].text,m.tokens[0].tokens&&m.tokens[0].tokens.length>0&&"text"===m.tokens[0].tokens[0].type&&(m.tokens[0].tokens[0].text=y+" "+m.tokens[0].tokens[0].text)):m.tokens.unshift({type:"text",text:y}):f+=y),f+=this.parse(m.tokens,g),h+=this.renderer.listitem(f,b,v);_+=this.renderer.list(h,p,u);continue;case"html":_+=this.renderer.html(d.text);continue;case"paragraph":_+=this.renderer.paragraph(this.parseInline(d.tokens));continue;case"text":for(h=d.tokens?this.parseInline(d.tokens):d.text;i+1<w&&"text"===t[i+1].type;)h+="\n"+((d=t[++i]).tokens?this.parseInline(d.tokens):d.text);_+=e?this.renderer.paragraph(h):h;continue;default:var x='Token with "'+d.type+'" type was not found.';if(this.options.silent)return void console.error(x);throw new Error(x)}return _},e.parseInline=function(t,e){e=e||this.renderer;var i,n,r="",o=t.length;for(i=0;i<o;i++)switch((n=t[i]).type){case"escape":r+=e.text(n.text);break;case"html":r+=e.html(n.text);break;case"link":r+=e.link(n.href,n.title,this.parseInline(n.tokens,e));break;case"image":r+=e.image(n.href,n.title,n.text);break;case"strong":r+=e.strong(this.parseInline(n.tokens,e));break;case"em":r+=e.em(this.parseInline(n.tokens,e));break;case"codespan":r+=e.codespan(n.text);break;case"br":r+=e.br();break;case"del":r+=e.del(this.parseInline(n.tokens,e));break;case"text":r+=e.text(n.text);break;default:var s='Token with "'+n.type+'" type was not found.';if(this.options.silent)return void console.error(s);throw new Error(s)}return r},t}(),ct=H.merge,ht=H.checkSanitizeDeprecation,dt=H.escape,pt=s.getDefaults,ut=s.changeDefaults,gt=s.defaults;function ft(t,e,i){if(null==t)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof t)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected");if("function"==typeof e&&(i=e,e=null),e=ct({},ft.defaults,e||{}),ht(e),i){var n,r=e.highlight;try{n=J.lex(t,e)}catch(t){return i(t)}var o=function(t){var o;if(!t)try{o=lt.parse(n,e)}catch(e){t=e}return e.highlight=r,t?i(t):i(null,o)};if(!r||r.length<3)return o();if(delete e.highlight,!n.length)return o();var s=0;return ft.walkTokens(n,(function(t){"code"===t.type&&(s++,setTimeout((function(){r(t.text,t.lang,(function(e,i){if(e)return o(e);null!=i&&i!==t.text&&(t.text=i,t.escaped=!0),0===--s&&o()}))}),0))})),void(0===s&&o())}try{var a=J.lex(t,e);return e.walkTokens&&ft.walkTokens(a,e.walkTokens),lt.parse(a,e)}catch(t){if(t.message+="\nPlease report this to https://github.com/markedjs/marked.",e.silent)return"<p>An error occurred:</p><pre>"+dt(t.message+"",!0)+"</pre>";throw t}}return ft.options=ft.setOptions=function(t){return ct(ft.defaults,t),ut(ft.defaults),ft},ft.getDefaults=pt,ft.defaults=gt,ft.use=function(t){var e=ct({},t);if(t.renderer&&function(){var i=ft.defaults.renderer||new nt,n=function(e){var n=i[e];i[e]=function(){for(var r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];var a=t.renderer[e].apply(i,o);return!1===a&&(a=n.apply(i,o)),a}};for(var r in t.renderer)n(r);e.renderer=i}(),t.tokenizer&&function(){var i=ft.defaults.tokenizer||new N,n=function(e){var n=i[e];i[e]=function(){for(var r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];var a=t.tokenizer[e].apply(i,o);return!1===a&&(a=n.apply(i,o)),a}};for(var r in t.tokenizer)n(r);e.tokenizer=i}(),t.walkTokens){var i=ft.defaults.walkTokens;e.walkTokens=function(e){t.walkTokens(e),i&&i(e)}}ft.setOptions(e)},ft.walkTokens=function(t,e){for(var i,n=r(t);!(i=n()).done;){var o=i.value;switch(e(o),o.type){case"table":for(var s,a=r(o.tokens.header);!(s=a()).done;){var l=s.value;ft.walkTokens(l,e)}for(var c,h=r(o.tokens.cells);!(c=h()).done;)for(var d,p=r(c.value);!(d=p()).done;){var u=d.value;ft.walkTokens(u,e)}break;case"list":ft.walkTokens(o.items,e);break;default:o.tokens&&ft.walkTokens(o.tokens,e)}}},ft.parseInline=function(t,e){if(null==t)throw new Error("marked.parseInline(): input parameter is undefined or null");if("string"!=typeof t)throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected");e=ct({},ft.defaults,e||{}),ht(e);try{var i=J.lexInline(t,e);return e.walkTokens&&ft.walkTokens(i,e.walkTokens),lt.parseInline(i,e)}catch(t){if(t.message+="\nPlease report this to https://github.com/markedjs/marked.",e.silent)return"<p>An error occurred:</p><pre>"+dt(t.message+"",!0)+"</pre>";throw t}},ft.Parser=lt,ft.parser=lt.parse,ft.Renderer=nt,ft.TextRenderer=rt,ft.Lexer=J,ft.lexer=J.lex,ft.Tokenizer=N,ft.Slugger=ot,ft.parse=ft,ft}));const $a=new window.marked.Renderer;function Va(t){const e=t.match(/^[^\S]*(?=\S)/gm);return e&&e[0].length?(e.sort((t,e)=>t.length-e.length),e[0].length?t.replace(RegExp("^"+e[0],"gm"),""):t):t}$a.code=function(t,e,i){return`<pb-code-highlight language="${e}" line-numbers>\n <template>${t}</template>\n </pb-code-highlight>`},window.marked.setOptions({renderer:$a});class Ia extends(R(T)){static get properties(){return Object.assign({content:{type:String},url:{type:String}},super.properties)}constructor(){super(),this._url=null}set url(t){this._url=t,Ia.waitOnce("pb-page-ready",t=>{this._load(t.endpoint)})}connectedCallback(){if(super.connectedCallback(),this.style.display="block",!this.content){const t=document.createElement("div");for(let e=0;e<this.childNodes.length;e++){const i=this.childNodes[e];t.appendChild(document.importNode(i.content||i,!0))}this.content=Va(t.innerHTML)}this.subscribeTo("pb-zoom",t=>{this.zoom(t.detail.direction)})}_load(t){const e=this.toAbsoluteURL(this._url,t);fetch(e,{credentials:"same-origin"}).then(t=>t.text()).catch(()=>(console.error("<pb-markdown> failed to load content from %s",e.toString()),Promise.resolve(this.content))).then(t=>{this.content=t})}createRenderRoot(){return this}render(){return this.content?O`<div>${S(window.marked(this.content))}</div>`:null}zoom(t){const e=window.getComputedStyle(this).getPropertyValue("font-size"),i=parseInt(e.replace(/^(\d+)px/,"$1"));this.style.fontSize="in"===t?i+1+"px":i-1+"px"}}customElements.define("pb-markdown",Ia);const Ra=new IntersectionObserver(t=>{t.forEach(t=>{if(t.isIntersecting){const e=t.target;e.emitTo("pb-visible",{data:e.data})}})});class Pa extends(R(T)){static get properties(){return Object.assign({data:{type:String}},super.properties)}disconnectedCallback(){super.disconnectedCallback(),Ra&&Ra.unobserve(this)}firstUpdated(){Ra.observe(this)}render(){return O`<slot></slot>`}static get styles(){return V`
|
|
3787
3787
|
:host {
|
|
3788
3788
|
display: inline;
|
|
3789
3789
|
}
|
|
@@ -3881,7 +3881,7 @@ const Da=n`<iron-iconset-svg name="av" size="24">
|
|
|
3881
3881
|
<g id="web"><path d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-5 14H4v-4h11v4zm0-5H4V9h11v4zm5 5h-4V9h4v9z"></path></g>
|
|
3882
3882
|
<g id="web-asset"><path d="M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.89-2-2-2zm0 14H5V8h14v10z"></path></g>
|
|
3883
3883
|
</defs></svg>
|
|
3884
|
-
</iron-iconset-svg>`;function Na(t,e){return window.ESGlobalBridge.requestAvailability(),new Promise(i=>{window.ESGlobalBridge.instance.load(t,e),window.addEventListener(`es-bridge-${t}-loaded`,()=>i(),{once:!0})})}document.head.appendChild(Da.content);class Fa extends(
|
|
3884
|
+
</iron-iconset-svg>`;function Na(t,e){return window.ESGlobalBridge.requestAvailability(),new Promise(i=>{window.ESGlobalBridge.instance.load(t,e),window.addEventListener(`es-bridge-${t}-loaded`,()=>i(),{once:!0})})}document.head.appendChild(Da.content);class Fa extends(R(T)){static get properties(){return Object.assign({url:{type:String},player:{type:Boolean},header:{type:String},footer:{type:String},breaks:{type:String},appXPath:{type:String,attribute:"app-xpath"},choiceXPath:{type:String,attribute:"choice-xpath"},mdivXPath:{type:String,attribute:"mdiv-xpath"},substXPath:{type:String,attribute:"subst-xpath"},_svg:{type:String}},super.properties)}constructor(){super(),this._data=null,this._svg=null,this._pages=0,this._page=0,this._midiPlayer=null,this._verovio=null,this.footer="auto",this.header="auto",this.breaks="auto",this.appXPath=null,this.choiceXPath=null,this.mdivXPath=null,this.substXPath=null,this._options=[]}connectedCallback(){super.connectedCallback(),this.querySelectorAll("pb-option").forEach(t=>{this._options.push({name:t.getAttribute("name"),on:t.getAttribute("on"),off:t.getAttribute("off"),label:t.innerHTML})})}firstUpdated(){super.firstUpdated(),this.player&&Na("midiPlayer","https://cdn.jsdelivr.net/npm/web-midi-player@latest/index.js").then(()=>{const{"web-midi-player":{default:t}}=window;this._midiPlayer=new t}),Na("verovio","https://www.verovio.org/javascript/latest/verovio-toolkit.js").then(()=>{this._verovio=new window.verovio.toolkit,Fa.waitOnce("pb-page-ready",()=>{this.load()})})}update(t){super.update(t),t.get("url")?this.load():(t.has("appXPath")||t.has("choiceXPath")||t.has("mdivXPath")||t.has("substXPath"))&&this._verovio&&(this._verovio.setOptions(this._getOptions()),this._verovio.loadData(this._data),this.showPage())}load(){const t=this.toAbsoluteURL(this.url);fetch(t).then(t=>t.text()).then(async t=>{this._data=t,this._verovio.setOptions(this._getOptions()),this._verovio.loadData(this._data),this._pages=this._verovio.getPageCount(),this._page=1,console.log("<pb-mei> Loaded %d pages",this._pages),this.showPage()})}showPage(){this._svg=this._verovio.renderToSVG(this._page,{})}async play(){const t=this.shadowRoot.getElementById("play");if(t.active)if(t.icon="av:stop",this._midiPaused)this._midiPaused=!1,this._midiPlayer.resume();else{this._verovio.loadData(this._data);const t=this._verovio.renderToMIDI(),e=window.atob(t),i=e.length,n=new Uint8Array(new ArrayBuffer(i));for(let t=0;t<i;t+=1)n[t]=e.charCodeAt(t);this._midiPlayer.play({arrayBuffer:n})}else this._midiPlayer.stop(),t.icon="av:play-arrow"}pause(){const t=this.shadowRoot.getElementById("play");t.active&&(this._midiPaused=this._midiPlayer.pause(),this._midiPaused&&(t.icon="av:play-arrow",t.active=!1))}render(){return O`
|
|
3885
3885
|
<div id="toolbar">
|
|
3886
3886
|
<div class="${1===this._pages?"hidden":""}">
|
|
3887
3887
|
<paper-icon-button id="pageLeft" icon="icons:chevron-left" @click="${this._previousPage}"
|
|
@@ -3892,13 +3892,13 @@ const Da=n`<iron-iconset-svg name="av" size="24">
|
|
|
3892
3892
|
${this._renderPlayer()}
|
|
3893
3893
|
<div>${this._renderOptions()}</div>
|
|
3894
3894
|
</div>
|
|
3895
|
-
${this._svg?
|
|
3896
|
-
`}_renderPlayer(){return this.player?
|
|
3895
|
+
${this._svg?O`<div id="output">${S(this._svg)}</div>`:O`<div id="output">${F("dialogs.loading")}</div>`}
|
|
3896
|
+
`}_renderPlayer(){return this.player?O`
|
|
3897
3897
|
<div id="player">
|
|
3898
3898
|
<paper-icon-button id="play" icon="av:play-arrow" toggles @click="${this.play}"></paper-icon-button>
|
|
3899
3899
|
<paper-icon-button icon="av:pause" @click="${this.pause}"></paper-icon-button>
|
|
3900
3900
|
</div>
|
|
3901
|
-
`:null}_renderOptions(){return this._options.map(t=>
|
|
3901
|
+
`:null}_renderOptions(){return this._options.map(t=>O`<paper-checkbox @change="${e=>this._setOption(t,e.target.checked)}">${t.label}</paper-checkbox>`)}_setOption(t,e){let i;i=e?t.on&&t.on.length>0?t.on:null:t.off&&t.off.length>0?t.off:null,this[t.name]=i}_nextPage(t){t.preventDefault(),this._page<this._pages&&(this._page+=1,this.showPage())}_previousPage(t){t.preventDefault(),this._page>1&&(this._page-=1,this.showPage())}_getOptions(){const t={svgViewBox:!0,adjustPageHeight:!0,footer:this.footer,header:this.header,breaks:this.breaks,appXPathQuery:[this.appXPath],substXPathQuery:[this.substXPath],choiceXPathQuery:[this.choiceXPath]};return this.mdivXPath&&(t.mdivXPathQuery=this.mdivXPath),t}static get styles(){return V`
|
|
3902
3902
|
:host {
|
|
3903
3903
|
display: grid;
|
|
3904
3904
|
grid-template-rows: auto 1fr;
|
|
@@ -3925,7 +3925,7 @@ const Da=n`<iron-iconset-svg name="av" size="24">
|
|
|
3925
3925
|
.hidden {
|
|
3926
3926
|
display: none;
|
|
3927
3927
|
}
|
|
3928
|
-
`}}function Ba(t,e){const i=[];return t.forEach(t=>{let n,r;if("object"==typeof t?(n=t.text,r=t.value):(n=t.toString(),r=n),n.toLowerCase().indexOf(e)>-1){const t={};t.text=n,t.value=r,i.push(t)}}),i}customElements.define("pb-mei",Fa);class ja extends(
|
|
3928
|
+
`}}function Ba(t,e){const i=[];return t.forEach(t=>{let n,r;if("object"==typeof t?(n=t.text,r=t.value):(n=t.toString(),r=n),n.toLowerCase().indexOf(e)>-1){const t={};t.text=n,t.value=r,i.push(t)}}),i}customElements.define("pb-mei",Fa);class ja extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{name:{type:String},value:{type:String},placeholder:{type:String,attribute:"placeholder"},source:{type:String},preload:{type:Boolean},suggestions:{type:Array},substring:{type:Boolean},icon:{type:String}})}constructor(){super(),this.placeholder="search.placeholder",this.suggestions=[],this.lastSelected=null,this.preload=!1,this.substring=!1,this._hiddenInput=null,this._initialized=!1}connectedCallback(){super.connectedCallback()}firstUpdated(){this.closest("iron-form,pb-search,pb-custom-form")||(this._hiddenInput=document.createElement("input"),this._hiddenInput.type="hidden",this._hiddenInput.name=this.name,this.appendChild(this._hiddenInput));const t=this.shadowRoot.getElementById("autocomplete");if(t.addEventListener("autocomplete-change",this._autocomplete.bind(this)),this.preload&&this.source)this.substring&&(t.queryFn=Ba),ja.waitOnce("pb-page-ready",()=>{this._sendRequest()});else if(this.value)if(this.source)ja.waitOnce("pb-page-ready",()=>{this._sendRequest(this.value)});else{const t=this.shadowRoot.getElementById("search"),e=this.suggestions.find(t=>t.text?t.value===this.value:t===this.value);e&&(t.value=e.text||e,this._hiddenInput&&(this._hiddenInput.value=e.value||e)),this._hiddenInput&&(this._hiddenInput.value=this.value)}}render(){return O`
|
|
3929
3929
|
<custom-style>
|
|
3930
3930
|
<style>
|
|
3931
3931
|
:host {
|
|
@@ -3939,9 +3939,9 @@ const Da=n`<iron-iconset-svg name="av" size="24">
|
|
|
3939
3939
|
</style>
|
|
3940
3940
|
</custom-style>
|
|
3941
3941
|
<slot></slot>
|
|
3942
|
-
<paper-input id="search" type="search" name="query" @keyup="${this._setInput}" label="${
|
|
3942
|
+
<paper-input id="search" type="search" name="query" @keyup="${this._setInput}" label="${F(this.placeholder)}"
|
|
3943
3943
|
always-float-label>
|
|
3944
|
-
${this.icon?
|
|
3944
|
+
${this.icon?O`<iron-icon icon="${this.icon}" slot="prefix"></iron-icon>`:null}
|
|
3945
3945
|
</paper-input>
|
|
3946
3946
|
<paper-autocomplete-suggestions id="autocomplete" for="search" .source="${this.suggestions}" ?remote-source="${!this.preload&&this.source}"
|
|
3947
3947
|
@autocomplete-selected="${this._autocompleteSelected}"></paper-autocomplete-suggestions>
|
|
@@ -3955,7 +3955,7 @@ const Da=n`<iron-iconset-svg name="av" size="24">
|
|
|
3955
3955
|
@response="${this._updateSuggestions}"></iron-ajax>
|
|
3956
3956
|
|
|
3957
3957
|
|
|
3958
|
-
`}static get styles(){return
|
|
3958
|
+
`}static get styles(){return V`
|
|
3959
3959
|
:host {
|
|
3960
3960
|
--paper-input-container-color: var(--pb-search-label-color, var(--paper-grey-500, #303030));
|
|
3961
3961
|
--paper-input-container-input-color: var(--pb-search-input-color, var(--pb-color-primary, #000000));
|
|
@@ -3980,32 +3980,32 @@ found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
|
3980
3980
|
part of the polymer project is also subject to an additional IP rights grant
|
|
3981
3981
|
found at http://polymer.github.io/PATENTS.txt
|
|
3982
3982
|
*/
|
|
3983
|
-
const qa=e({is:"iron-label",listeners:{tap:"_tapHandler"},properties:{for:{type:String,value:"",reflectToAttribute:!0,observer:"_forChanged"},_forElement:Object},attached:function(){this._forChanged()},ready:function(){this._generateLabelId()},_generateLabelId:function(){if(!this.id){var e="iron-label-"+qa._labelNumber++;t(this).setAttribute("id",e)}},_findTarget:function(){if(this.for){var e=t(this).getOwnerRoot();return t(e).querySelector("#"+this.for)}var i=t(this).querySelector("[iron-label-target]");return i||(i=t(this).firstElementChild),i},_tapHandler:function(e){this._forElement&&(t(e).localTarget!==this._forElement&&(this._forElement.focus(),this._forElement.click()))},_applyLabelledBy:function(){this._forElement&&t(this._forElement).setAttribute("aria-labelledby",this.id)},_forChanged:function(){this._forElement&&t(this._forElement).removeAttribute("aria-labelledby"),this._forElement=this._findTarget(),this._applyLabelledBy()}});qa._labelNumber=0;class Ua extends(
|
|
3983
|
+
const qa=e({is:"iron-label",listeners:{tap:"_tapHandler"},properties:{for:{type:String,value:"",reflectToAttribute:!0,observer:"_forChanged"},_forElement:Object},attached:function(){this._forChanged()},ready:function(){this._generateLabelId()},_generateLabelId:function(){if(!this.id){var e="iron-label-"+qa._labelNumber++;t(this).setAttribute("id",e)}},_findTarget:function(){if(this.for){var e=t(this).getOwnerRoot();return t(e).querySelector("#"+this.for)}var i=t(this).querySelector("[iron-label-target]");return i||(i=t(this).firstElementChild),i},_tapHandler:function(e){this._forElement&&(t(e).localTarget!==this._forElement&&(this._forElement.focus(),this._forElement.click()))},_applyLabelledBy:function(){this._forElement&&t(this._forElement).setAttribute("aria-labelledby",this.id)},_forChanged:function(){this._forElement&&t(this._forElement).removeAttribute("aria-labelledby"),this._forElement=this._findTarget(),this._applyLabelledBy()}});qa._labelNumber=0;class Ua extends(R(T)){static get properties(){return Object.assign({label:{type:String},value:{type:String,reflect:!0},values:{type:Array,reflect:!0},name:{type:String},source:{type:String},multi:{type:Boolean},_items:{type:Array},_selected:{type:Array}},super.properties)}constructor(){super(),this.value=null,this.values=[],this._items=[],this._selected=[],this._inIronForm=!1}connectedCallback(){super.connectedCallback(),this.subscribeTo("pb-i18n-update",this._refresh.bind(this)),this.multi&&(0===this.values.length&&this.value&&(this.values=[this.value]),this.value=void 0)}firstUpdated(){super.firstUpdated(),this._inIronForm=this.closest("iron-form, pb-search,pb-custom-form");const t=this.shadowRoot.querySelector('[name="subform"]');t&&t.assignedNodes().forEach(t=>{this.name&&t.addEventListener("change",this._loadRemote.bind(this));t.querySelectorAll("[name]").forEach(t=>{t.addEventListener("change",this._loadRemote.bind(this))})}),Ua.waitOnce("pb-page-ready",()=>{this._loadRemote()})}_refresh(){const t=this.shadowRoot.getElementById("list");t&&setTimeout(()=>{const e=t.selected;t.selected=void 0,t.selected=e})}_clear(t){const e=this.shadowRoot.querySelector(t);e&&e.assignedNodes().forEach(t=>{t.parentNode.removeChild(t)})}_loadRemote(){if(this.source){let t=this.toAbsoluteURL(this.source);t=t.indexOf("?")>-1?`${t}&${this._getParameters()}`:`${t}?${this._getParameters()}`,console.log("<pb-select> loading items from %s",t),fetch(t,{method:"GET",mode:"cors",credentials:"same-origin"}).then(t=>t.json()).then(t=>{this._clear("slot:not([name])");const e=[];t.forEach(t=>{e.push({label:t.text,value:t.value})}),console.log("<pb-select> loaded %d items",e.length),this._items=e}).catch(()=>{console.error("<pb-select> request to %s failed",t)})}}_getParameters(){const t=this.shadowRoot.querySelector('[name="subform"]'),e=[];return t&&t.assignedNodes().forEach(t=>{t.querySelectorAll("[name]").forEach(t=>{e.push(`${t.name}=${encodeURIComponent(t.value)}`)})}),e.join("&")}render(){return this.multi?O`
|
|
3984
3984
|
<slot name="subform"></slot>
|
|
3985
|
-
<iron-label for="list" part="label">${
|
|
3986
|
-
${this.multi?
|
|
3985
|
+
<iron-label for="list" part="label">${F(this.label)}</iron-label>
|
|
3986
|
+
${this.multi?O`<paper-listbox id="list" slot="dropdown-content" class="dropdown-content"
|
|
3987
3987
|
.selectedValues="${this.values}" multi
|
|
3988
3988
|
attr-for-selected="value" @iron-select="${this._changed}" @iron-deselect="${this._changed}">
|
|
3989
3989
|
<slot></slot>
|
|
3990
|
-
${this._items.map(t=>
|
|
3991
|
-
</paper-listbox>`:
|
|
3990
|
+
${this._items.map(t=>O`<paper-item value="${t.value}">${t.label}</paper-item>`)}
|
|
3991
|
+
</paper-listbox>`:O`<paper-listbox id="list" slot="dropdown-content" class="dropdown-content"
|
|
3992
3992
|
.selected="${this.value}"
|
|
3993
3993
|
attr-for-selected="value" @iron-select="${this._changed}" @iron-deselect="${this._changed}">
|
|
3994
3994
|
<slot></slot>
|
|
3995
|
-
${this._items.map(t=>
|
|
3995
|
+
${this._items.map(t=>O`<paper-item value="${t.value}">${t.label}</paper-item>`)}
|
|
3996
3996
|
</paper-listbox>`}
|
|
3997
3997
|
<slot name="output"></slot>
|
|
3998
|
-
`:
|
|
3998
|
+
`:O`
|
|
3999
3999
|
<slot name="subform"></slot>
|
|
4000
|
-
<paper-dropdown-menu label="${
|
|
4000
|
+
<paper-dropdown-menu label="${F(this.label)}">
|
|
4001
4001
|
<paper-listbox id="list" slot="dropdown-content" class="dropdown-content" .selected="${this.value}"
|
|
4002
4002
|
attr-for-selected="value" @iron-select="${this._changed}">
|
|
4003
4003
|
<slot></slot>
|
|
4004
|
-
${this._items.map(t=>
|
|
4004
|
+
${this._items.map(t=>O`<paper-item value="${t.value}">${t.label}</paper-item>`)}
|
|
4005
4005
|
</paper-listbox>
|
|
4006
4006
|
</paper-dropdown-menu>
|
|
4007
4007
|
<slot name="output"></slot>
|
|
4008
|
-
`}_changed(){const t=this.shadowRoot.getElementById("list"),e=Array.of(this._selected);if(this.multi?(this._selected=t.selectedValues,this.values=this._selected):(this._selected=[t.selected],this.value=t.selected),this._selected.length!==e.length||!this._selected.every((t,i)=>t===e[i])){if(!this._inIronForm||this.multi){this._clear('[name="output"]');(this.multi?this.values:[this.value]).forEach(t=>{const e=document.createElement("input");e.type="hidden",e.name=this.name,e.value=t,e.slot="output",this.appendChild(e)})}this.dispatchEvent(new CustomEvent("change"))}}static get styles(){return
|
|
4008
|
+
`}_changed(){const t=this.shadowRoot.getElementById("list"),e=Array.of(this._selected);if(this.multi?(this._selected=t.selectedValues,this.values=this._selected):(this._selected=[t.selected],this.value=t.selected),this._selected.length!==e.length||!this._selected.every((t,i)=>t===e[i])){if(!this._inIronForm||this.multi){this._clear('[name="output"]');(this.multi?this.values:[this.value]).forEach(t=>{const e=document.createElement("input");e.type="hidden",e.name=this.name,e.value=t,e.slot="output",this.appendChild(e)})}this.dispatchEvent(new CustomEvent("change"))}}static get styles(){return V`
|
|
4009
4009
|
:host {
|
|
4010
4010
|
display: flex;
|
|
4011
4011
|
flex-direction: column;
|
|
@@ -4023,14 +4023,14 @@ const qa=e({is:"iron-label",listeners:{tap:"_tapHandler"},properties:{for:{type:
|
|
|
4023
4023
|
paper-listbox{
|
|
4024
4024
|
overflow:auto;
|
|
4025
4025
|
}
|
|
4026
|
-
`}}customElements.define("pb-select",Ua);class Wa extends(
|
|
4027
|
-
<h3>${
|
|
4026
|
+
`}}customElements.define("pb-select",Ua);class Wa extends(R(T)){static get properties(){return Object.assign({label:{type:String}},super.properties)}constructor(){super(),this.label="clipboard.label"}render(){return O`
|
|
4027
|
+
<h3>${F(this.label)}</h3>
|
|
4028
4028
|
<div>
|
|
4029
4029
|
<slot></slot>
|
|
4030
4030
|
<paper-icon-button icon="icons:content-copy" @click="${this._copy}"
|
|
4031
|
-
title="${
|
|
4031
|
+
title="${F("clipboard.copy")}"></paper-icon-button>
|
|
4032
4032
|
</div>
|
|
4033
|
-
`}_copy(){const t=this.shadowRoot.querySelector("slot"),e=document.createElement("div");t.assignedNodes().forEach(t=>{e.appendChild(document.importNode(t,!0))}),navigator.clipboard.writeText(e.innerText)}static get styles(){return
|
|
4033
|
+
`}_copy(){const t=this.shadowRoot.querySelector("slot"),e=document.createElement("div");t.assignedNodes().forEach(t=>{e.appendChild(document.importNode(t,!0))}),navigator.clipboard.writeText(e.innerText)}static get styles(){return V`
|
|
4034
4034
|
:host {
|
|
4035
4035
|
display: block;
|
|
4036
4036
|
}
|
|
@@ -4045,10 +4045,10 @@ const qa=e({is:"iron-label",listeners:{tap:"_tapHandler"},properties:{for:{type:
|
|
|
4045
4045
|
align-items: center;
|
|
4046
4046
|
padding: 0 16px;
|
|
4047
4047
|
}
|
|
4048
|
-
`}}customElements.define("pb-clipboard",Wa);class Ya{constructor(t){this._prefix=t.getAttribute("prefix"),this._config={name:t.getAttribute("name"),properties:{}},this._register=this._config.name}get register(){return this._register}get name(){return this._register}set name(t){this._register=t}query(t){throw new Error("Method query not implemented")}info(t,e){return e.innerHTML="not implemented",Promise.resolve()}select(t){}async getRecord(t){return Promise.reject()}}class Ga extends Ya{async query(t){const e=t.replace(/[^\w\s]+/g,""),i=[],n="https://api.metagrid.ch/search?query="+encodeURIComponent(e);return new Promise(t=>{fetch(n).then(t=>t.json()).then(e=>{e.resources.forEach(t=>{const e=`${t.metadata.last_name}, ${t.metadata.first_name} `,n={register:this._register,id:`${t.provider.slug}-${t.identifier}`,label:e,details:`${t.metadata.birth_date} - ${t.metadata.death_date}`,link:t.link.uri,provider:t.provider.slug};i.push(n)}),t({totalItems:e.meta.total,items:i})})})}info(t,e){const i=t.indexOf("-"),n=t.substring(0,i);return new Promise(i=>{this.getRecord(t).then(t=>{const r=`\n <h3 class="label">\n <a href="https://${t.link.uri}" target="_blank">\n ${t.metadata.last_name}, ${t.metadata.first_name}\n </a>\n </h3>\n <p>${t.metadata.birth_date} - ${t.metadata.death_date}</p>\n `;e.innerHTML=r,i({id:`${n}-${t.identifier}`,strings:[`${t.metadata.first_name} ${t.metadata.last_name}`]})})})}async getRecord(t){const e=t.indexOf("-"),i=t.substring(0,e),n=t.substring(e+1);return fetch(`https://api.metagrid.ch/search?slug=${i}&query=${n}`).then(t=>t.json()).then(t=>{const e=t.resources[0],i=Object.assign({},e);return i.name=`${e.metadata.first_name} ${e.metadata.last_name}`,i.links=["https://"+e.link.uri],e.metadata.birth_date&&e.metadata.birth_date.length>0&&(i.birth=e.metadata.birth_date),e.metadata.death_date&&e.metadata.death_date.length>0&&(i.death=e.metadata.death_date),i}).catch(t=>Promise.reject(t))}}class Xa extends Ya{constructor(t){super(t),this.user=t.getAttribute("user")}async query(t){const e=[];return new Promise(i=>{fetch(`https://secure.geonames.org/searchJSON?formatted=true&q=${encodeURIComponent(t)}&maxRows=100&&username=${this.user}&style=full`).then(t=>t.json()).then(t=>{t.geonames.forEach(t=>{const i={register:this._register,id:this._prefix?`${this._prefix}-${t.geonameId}`:t.geonameId,label:t.toponymName,details:`${t.fcodeName} - ${t.adminName1}, ${t.countryName}`,link:"https://www.geonames.org/"+t.geonameId,strings:[t.toponymName],provider:"geonames.org"};e.push(i)}),i({totalItems:t.totalResultsCount,items:e})})})}info(t,e){return t?new Promise((i,n)=>{this.getRecord(t).then(t=>{if(t.status)return void n(t.status.message);const r=`\n <h3 class="label">\n <a href="${t.link}" target="_blank">${t.name}</a>\n </h3>\n <p class="fcode">${t.note} - ${t.region}, ${t.country}</p>\n `;e.innerHTML=r,i({id:this._prefix?`${this._prefix}-${t.geonameId}`:t.geonameId,strings:[t.name]})}).catch(()=>n())}):Promise.resolve({})}async getRecord(t){const e=this._prefix?t.substring(this._prefix.length+1):t;return fetch(`https://secure.geonames.org/getJSON?geonameId=${encodeURIComponent(e)}&username=${this.user}`).then(t=>t.ok?t.json():Promise.reject(t.status)).then(t=>{const e=Object.assign({},t);return e.name=t.toponymName,e.country=t.countryName,e.region=t.adminName1,e.note=t.fcodeName,e.links=["https://www.geonames.org/"+t.geonameId,"https://"+t.wikipediaURL],e}).catch(()=>Promise.reject())}}function Ka(t="",e){return t.replace(/\${([^}]+)}/g,(t,i)=>{let n;return e[i]&&(n=e[i]),n||""})}function Qa(t,e){const i=t.querySelector(e);if(i instanceof HTMLTemplateElement){const t=document.createElement("div");return t.appendChild(i.content.cloneNode(!0)),t.innerHTML}return""}class Za extends Ya{constructor(t){super(t),this.apiKey=t.getAttribute("api-key"),this.baseKey=t.getAttribute("base"),this.table=t.getAttribute("table"),this.view=t.getAttribute("view"),this.filterExpr=t.getAttribute("filter"),this.labelExpr=t.getAttribute("label");const e=t.getAttribute("fields");this.fields=e?e.split(/\s*,\s*/):["ID"];const i=t.getAttribute("tokenize");this.tokenize=i?i.split(/\s*,\s*/):[this.fields[0]],this.tokenizeChars=t.getAttribute("tokenize-regex")||"\\W",this.infoExpr=Qa(t,".info"),this.detailExpr=Qa(t,".detail"),this._init()}_init(){window.ESGlobalBridge.requestAvailability();const t=D("https://unpkg.com/airtable@0.11.1/build/airtable.browser.js");window.ESGlobalBridge.instance.load("airtable",t),window.addEventListener("es-bridge-airtable-loaded",this._initAirtable.bind(this),{once:!0})}_initAirtable(){const t=require("airtable");this.base=new t({apiKey:this.apiKey}).base(this.baseKey)}async query(t){t=t.toLowerCase();const e=[],i=this.filterExpr?Ka(this.filterExpr,{key:t}):null,n={fields:this.fields,maxRecords:100};return this.view&&(n.view=this.view),i&&(n.filterByFormula=i),new Promise((t,i)=>{this.base(this.table).select(n).firstPage((n,r)=>{if(n)return console.error(n),void i(n);r.forEach(t=>{const i={};this.fields.forEach(e=>{i[e]=t.get(e)});const n={register:this._register,id:t.id,label:Ka(this.labelExpr,i),details:Ka(this.detailExpr,i),provider:"airtable"};e.push(n)}),t({totalItems:3,items:e})})})}info(t,e){return new Promise((i,n)=>{const r={fields:this.fields,filterByFormula:`RECORD_ID()='${t}'`};this.base(this.table).select(r).firstPage((r,o)=>{if(r){switch(r.statusCode){case 404:n(`No record found for ${t} in table ${this.table}`);break;default:n(`${r.statusCode}: ${r.message}`)}return}const s=o[0];if(0===Object.keys(s.fields).length)return void console.warn("Retrieved an empty record for %s from table %s",t,this.table);let a=[];const l={};this.fields.forEach(t=>{const e=s.get(t);e&&(l[t]=e,a.push(e))});const c=new RegExp(this.tokenizeChars);this.tokenize.forEach(t=>{a=a.concat(l[t].split(c))}),a=a.filter(t=>!/^\d+$/.test(t)),a.sort((t,e)=>e.length-t.length),console.log(a),e.innerHTML=Ka(this.infoExpr,l),i({id:s.id,strings:a})})})}}function Ja(t){let e="";t.professionOrOccupation&&t.professionOrOccupation.length>0&&(e=t.professionOrOccupation.map(t=>t.label).join(", ")),t.biographicalOrHistoricalInformation&&(e=`${e}; ${t.biographicalOrHistoricalInformation.join(", ")}`);const i=[];return t.dateOfBirth&&t.dateOfBirth.length>0&&i.push(t.dateOfBirth[0]),t.dateOfDeath&&t.dateOfDeath.length>0&&(i.push(" - "),i.push(t.dateOfDeath[0])),i.length>0?`${i.join("")}${e?"; "+e:""}`:e}class tl extends Ya{query(t){const e=[];let i;switch(this._register){case"place":i="PlaceOrGeographicName";break;case"term":i="SubjectHeading";break;case"organization":i="CorporateBody";break;default:i="Person"}return new Promise(n=>{fetch(`https://lobid.org/gnd/search?q=${encodeURIComponent(t)}&filter=%2B%28type%3A${i}%29&format=json&size=100`).then(t=>t.json()).then(t=>{t.member.forEach(t=>{const i={register:this._register,id:this._prefix?`${this._prefix}-${t.gndIdentifier}`:t.gndIdentifier,label:t.preferredName,link:t.id,details:Ja(t),strings:[t.preferredName].concat(t.variantName),provider:"GND"};e.push(i)}),n({totalItems:t.totalItems,items:e})})})}async getRecord(t){const e=this._prefix?t.substring(this._prefix.length+1):t;return fetch(`https://lobid.org/gnd/${e}.json`).then(t=>t.ok?t.json():Promise.reject()).then(t=>{const e=Object.assign({},t);return e.name=t.preferredName,e.link=t.id,t.dateOfBirth&&t.dateOfBirth.length>0&&(e.birth=t.dateOfBirth[0]),t.dateOfDeath&&t.dateOfDeath.length>0&&(e.death=t.dateOfDeath[0]),t.biographicalOrHistoricalInformation&&(e.note=t.biographicalOrHistoricalInformation.join("; ")),t.professionOrOccupation&&t.professionOrOccupation.length>0&&(e.profession=t.professionOrOccupation.map(t=>t.label)),e}).catch(()=>Promise.reject())}info(t,e){return t?new Promise((i,n)=>{this.getRecord(t).then(t=>{let n;t.type.indexOf("SubjectHeading")>-1?n=this.infoSubject(t):t.type.indexOf("AuthorityResource")>-1&&(n=this.infoPerson(t));const r=`\n <h3 class="label">\n <a href="https://${t.id}" target="_blank"> ${t.preferredName} </a>\n </h3>\n ${n}\n `;e.innerHTML=r,i({id:this._prefix?`${this._prefix}-${t.gndIdentifier}`:t.gndIdentifier,strings:[t.preferredName].concat(t.variantName)})}).catch(()=>n())}):Promise.resolve()}infoPerson(t){const e=t.professionOrOccuption?t.professionOrOccupation.map(t=>t.label):[];return`<p>${t.dateOfBirth} - ${t.dateOfDeath}</p>\n <p>${e.join(" ")}</p>`}infoSubject(t){if(t.broaderTermGeneral){return`<p>${t.broaderTermGeneral.map(t=>t.label).join(", ")}</p>`}return""}}class el extends Ya{constructor(t){super(t),this._api=t.getAttribute("api"),this._limit=t.getAttribute("limit")||999999}async query(t){const e=[],i=this.getRegister(),n=`https://meta.karl-barth.ch/api/${i}?${"bibls"===i?"biblsearch":"search"}=${encodeURIComponent(t)}&perPage=${this._limit}`,r=this.getLabelField();return new Promise(t=>{fetch(n).then(t=>t.json()).then(n=>{n.data.forEach(t=>{if("organization"===this._register&&"organisation"!==t.authority_type||"person"===this._register&&"person"!==t.authority_type)return;const n={register:this._register,id:this._prefix?`${this._prefix}:${t["full-id"]}`:t["full-id"],label:"string"==typeof r?t[r]:r(t),details:""+t["full-id"],link:`https://meta.karl-barth.ch/${i}/${t.id}`,strings:["string"==typeof r?t[r]:r(t)],provider:"KBGA"};e.push(n)}),t({totalItems:n.meta.total,items:e})})})}info(t,e){if(!t)return Promise.resolve({});const i=this.getLabelField();return new Promise(n=>{this.getRecord(t).then(t=>{const r=t.data.death?"† "+t.data.death:"",o=t.data.birth?`<p>* ${t.data.birth} ${r}</p>`:"",s=t.data.note_bio?`<p>${t.data.note_bio}</p>`:"",a=`\n <h3 class="label"><a href="https://${t.wikipediaURL}" target="_blank">${"string"==typeof i?t.data[i]:i(t.data)}</a></h3>\n ${o}\n ${s}\n `;e.innerHTML=a,n({id:t.data["full-id"],strings:["string"==typeof i?t.data[i]:i(t.data)]})})})}async getRecord(t){const e=t.replace(/^.*-([^-]+)$/,"$1");return fetch(`https://meta.karl-barth.ch/api/${this.getRegister()}/${e}`).then(t=>t.json()).then(t=>{const e=Object.assign({},t);switch(e.name=t.data[this.getLabelField()],this._register){case"place":e.country=t.data.country,e.location=t.data.location.coordinates,e.links=t.data.links.map(t=>t.url);break;case"person":e.birth=t.data.birth,e.death=t.data.death,e.note=t.data.note_bio,e.links=["https://"+t.wikipediaURL]}return e}).catch(t=>Promise.reject(t))}getLabelField(){let t;switch(this._register){case"place":t="placeName_full";break;case"term":t="fullLabel";break;case"abbreviation":t="label";break;case"bibl":t="asHtml";break;default:t="persName_full"}return t}getRegister(){if(this._api)return this._api;let t;switch(this._register){case"person":case"organization":t="actors";break;case"place":t="places";break;case"term":t="terms";break;case"abbreviation":t="abbreviations";break;case"bibl":t="bibls";break;default:t=this._register}return t}}class il extends Ya{constructor(t){super(t),this._api=t.getAttribute("api"),this._limit=t.getAttribute("limit")||999999}async query(t){const e=[],i=this.getRegister(),n=`https://archives.georgfischer.com/api/${i}?search=${encodeURIComponent(t)}&perPage=${this._limit}`,r=this.getLabelField();return new Promise(t=>{fetch(n).then(t=>t.json()).then(n=>{n.data?(n.data.forEach(t=>{if("organization"===this._register&&"Person"===t.authority_type||"person"===this._register&&"Person"!==t.authority_type)return;const n={register:this._register,id:this._prefix?`${this._prefix}-${t.id}`:t.id,label:t[r],details:""+t.id,link:`https://archives.georgfischer.com/api/${i}/${t.id}`,strings:[t[r]],provider:"GF"};e.push(n)}),t({totalItems:n.meta.total,items:e})):t({totalItems:0,items:[]})}).catch(t=>Promise.reject(t))})}info(t,e){if(!t)return Promise.resolve({});const i=this._prefix?t.substring(this._prefix.length+1):t,n=this.getLabelField();return new Promise(t=>{this.getRecord(i).then(i=>{const r=i.data.death?"† "+i.data.death:"",o=i.data.birth?`<p>* ${i.data.birth} ${r}</p>`:"",s=i.data.note_bio?`<p>${i.data.note_bio}</p>`:"",a=`\n <h3 class="label"><a href="https://${i.wikipediaURL}" target="_blank">${i.data[n]}</a></h3>\n ${o}\n ${s}\n `;e.innerHTML=a,t({id:this._prefix?`${this._prefix}-${i.data.id}`:i.data.id,strings:[i.data[n]]})})})}async getRecord(t){const e=t.replace(/^.*-([^-]+)$/,"$1"),i=`https://archives.georgfischer.com/api/${this.getRegister()}/${e}`;return fetch(i).then(t=>t.json()).then(t=>{const e=Object.assign({},t);switch(e.name=t.data[this.getLabelField()],this._register){case"place":e.country=t.data.country,e.location=t.data.location.coordinates,e.links=t.data.links.map(t=>t.url);break;case"person":e.birth=t.data.birth,e.death=t.data.death,e.note=t.data.note_bio,e.links=["https://"+t.wikipediaURL]}return e}).catch(t=>Promise.reject(t))}getLabelField(){let t;switch(this._register){case"term":t="label";break;default:t="fullname"}return t}getRegister(){if(this._api)return this._api;let t;switch(this._register){case"person":case"organization":t="actors";break;case"place":t="places";break;case"term":t="keywords";break;case"abbreviation":t="abbreviations";break;default:t=this._register}return t}}async function nl(t){const e=await fetch(t);return await e.json()}class rl extends Ya{constructor(t){super(t),this.endpoint=t.getAttribute("endpoint"),this.debug=t.getAttribute("debug"),nl(this.endpoint).then(t=>{this.ORConfig=t,this.debug&&console.log("OpenReconcile connector for register '%s' at endpoint <%s>. Using config: %o",this._register,this.endpoint,this.ORConfig)})}async query(t){const e=[],i={q1:{query:t}};return new Promise(t=>{fetch(this.endpoint,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},body:"queries=".concat(JSON.stringify(i))}).then(t=>t.json()).then(i=>{i.q1.result.forEach(t=>{this.ORConfig.view?this.view=this.ORConfig.view.url.replace("{{id}}",t.id):this.view=t.id,t.description?this.description=t.description:t.type?this.description=t.type.map(t=>t.name.toString()).join(", "):this.description="";const i={register:this._register,id:this._prefix?`${this._prefix}-${t.id}`:t.id,label:t.name,link:this.view,details:this.description,provider:"OpenReconcile"};e.push(i)}),this.debug&&console.log("OpenReconcile results: %o",e),t({totalItems:i.q1.result.length,items:e})})})}info(t,e){return t?this.ORConfig.preview?new Promise((i,n)=>{const r=this._prefix?t.substring(this._prefix.length+1):t,o=this.ORConfig.preview.url.replace("{{id}}",encodeURIComponent(r));fetch(o).then(t=>t.text()).then(t=>{e.innerHTML=t,i({id:this._prefix?`${this._prefix}-${r}`:r})}).catch(()=>n())}):(e.innerHTML="no 'preview' information in endpoint's manifest",Promise.resolve()):Promise.resolve({})}}class ol extends Ya{constructor(t,e){super(e),this._endpoint=t,this._connectors=sl(t,e),this._connectors.forEach(t=>{t.name=this.name}),console.log("custom connector: endpoint: %s; using authorities: %o",this._endpoint,this._connectors)}async query(t){return new Promise(e=>{fetch(`${this._endpoint}/api/register/search/${this._register}?query=${encodeURIComponent(t)}`).then(t=>t.json()).then(async i=>{let n=[];const r=new Set;i.forEach(t=>{n.push({register:this._register,id:t.id,label:t.label,link:t.link,details:t.details,provider:"local"}),r.add(t.id)});let o=i.length;for(const e of this._connectors){const i=await e.query(t);n=n.concat(i.items.filter(t=>!r.has(t.id))),o+=i.totalItems}e({totalItems:o,items:n})})})}info(t,e){if(!t)return Promise.resolve({});const i=t;return new Promise((n,r)=>{fetch(`${this._endpoint}/api/register/${this._register}/${encodeURIComponent(i)}`).then(async i=>{if(i.ok){const t=await i.json();return e.innerHTML=t.details,void n({id:t.id,strings:t.strings})}if(404===i.status)for(const i of this._connectors)try{const r=await i.info(t,e);r&&n(r)}catch(t){}r()})})}async select(t){let e;for(const i of this._connectors)if(e=await i.getRecord(t.id),e)break;return e?fetch(`${this._endpoint}/api/register/${this._register}/${encodeURIComponent(t.id)}`,{method:"POST",mode:"cors",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(t=>t.json()):Promise.reject("No record found for ID "+t.id)}}function sl(t,e){const i=[];return e.querySelectorAll(":scope > pb-authority").forEach(e=>{let n;switch(e.getAttribute("connector")){case"GND":n=new tl(e);break;case"GeoNames":n=new Xa(e);break;case"Airtable":n=new Za(e);break;case"KBGA":n=new el(e);break;case"GF":n=new il(e);break;case"ReconciliationService":n=new rl(e);break;case"Custom":n=new ol(t,e);break;default:n=new Ga(e)}i.push(n)}),i}class al extends(N(V)){static get properties(){return Object.assign({query:{type:String,reflect:!0},sortByLabel:{type:Boolean,attribute:"sort-by-label"},stopwords:{type:String},_results:{type:Array}},super.properties)}constructor(){super(),this.query="",this.type=null,this.sortByLabel=!1,this._results=[],this._authorities={}}connectedCallback(){super.connectedCallback(),this._stopwordSet=new Set,this.stopwords&&this.stopwords.split(/\s*,\s*/).forEach(t=>this._stopwordSet.add(t.toLowerCase())),this.subscribeTo("pb-authority-lookup",t=>{this.query=t.detail.query,this.type=t.detail.type,this._results=[],this._query()}),al.waitOnce("pb-page-ready",()=>{sl(this.getEndpoint(),this).forEach(t=>{this._authorities[t.register]=t})}),console.log("<pb-authority-lookup> Registered authorities: %o",this._authorities)}render(){return R`
|
|
4048
|
+
`}}customElements.define("pb-clipboard",Wa);class Ya{constructor(t){this._prefix=t.getAttribute("prefix"),this._config={name:t.getAttribute("name"),properties:{}},this._register=this._config.name}get register(){return this._register}get name(){return this._register}set name(t){this._register=t}query(t){throw new Error("Method query not implemented")}info(t,e){return e.innerHTML="not implemented",Promise.resolve()}select(t){}async getRecord(t){return Promise.reject()}}class Ga extends Ya{async query(t){const e=t.replace(/[^\w\s]+/g,""),i=[],n="https://api.metagrid.ch/search?query="+encodeURIComponent(e);return new Promise(t=>{fetch(n).then(t=>t.json()).then(e=>{e.resources.forEach(t=>{const e=`${t.metadata.last_name}, ${t.metadata.first_name} `,n={register:this._register,id:`${t.provider.slug}-${t.identifier}`,label:e,details:`${t.metadata.birth_date} - ${t.metadata.death_date}`,link:t.link.uri,provider:t.provider.slug};i.push(n)}),t({totalItems:e.meta.total,items:i})})})}info(t,e){const i=t.indexOf("-"),n=t.substring(0,i);return new Promise(i=>{this.getRecord(t).then(t=>{const r=`\n <h3 class="label">\n <a href="https://${t.link.uri}" target="_blank">\n ${t.metadata.last_name}, ${t.metadata.first_name}\n </a>\n </h3>\n <p>${t.metadata.birth_date} - ${t.metadata.death_date}</p>\n `;e.innerHTML=r,i({id:`${n}-${t.identifier}`,strings:[`${t.metadata.first_name} ${t.metadata.last_name}`]})})})}async getRecord(t){const e=t.indexOf("-"),i=t.substring(0,e),n=t.substring(e+1);return fetch(`https://api.metagrid.ch/search?slug=${i}&query=${n}`).then(t=>t.json()).then(t=>{const e=t.resources[0],i=Object.assign({},e);return i.name=`${e.metadata.first_name} ${e.metadata.last_name}`,i.links=["https://"+e.link.uri],e.metadata.birth_date&&e.metadata.birth_date.length>0&&(i.birth=e.metadata.birth_date),e.metadata.death_date&&e.metadata.death_date.length>0&&(i.death=e.metadata.death_date),i}).catch(t=>Promise.reject(t))}}class Xa extends Ya{constructor(t){super(t),this.user=t.getAttribute("user")}async query(t){const e=[];return new Promise(i=>{fetch(`https://secure.geonames.org/searchJSON?formatted=true&q=${encodeURIComponent(t)}&maxRows=100&&username=${this.user}&style=full`).then(t=>t.json()).then(t=>{t.geonames.forEach(t=>{const i={register:this._register,id:this._prefix?`${this._prefix}-${t.geonameId}`:t.geonameId,label:t.toponymName,details:`${t.fcodeName} - ${t.adminName1}, ${t.countryName}`,link:"https://www.geonames.org/"+t.geonameId,strings:[t.toponymName],provider:"geonames.org"};e.push(i)}),i({totalItems:t.totalResultsCount,items:e})})})}info(t,e){return t?new Promise((i,n)=>{this.getRecord(t).then(t=>{if(t.status)return void n(t.status.message);const r=`\n <h3 class="label">\n <a href="${t.link}" target="_blank">${t.name}</a>\n </h3>\n <p class="fcode">${t.note} - ${t.region}, ${t.country}</p>\n `;e.innerHTML=r,i({id:this._prefix?`${this._prefix}-${t.geonameId}`:t.geonameId,strings:[t.name]})}).catch(()=>n())}):Promise.resolve({})}async getRecord(t){const e=this._prefix?t.substring(this._prefix.length+1):t;return fetch(`https://secure.geonames.org/getJSON?geonameId=${encodeURIComponent(e)}&username=${this.user}`).then(t=>t.ok?t.json():Promise.reject(t.status)).then(t=>{const e=Object.assign({},t);return e.name=t.toponymName,e.country=t.countryName,e.region=t.adminName1,e.note=t.fcodeName,e.links=["https://www.geonames.org/"+t.geonameId,"https://"+t.wikipediaURL],e}).catch(()=>Promise.reject())}}function Ka(t="",e){return t.replace(/\${([^}]+)}/g,(t,i)=>{let n;return e[i]&&(n=e[i]),n||""})}function Qa(t,e){const i=t.querySelector(e);if(i instanceof HTMLTemplateElement){const t=document.createElement("div");return t.appendChild(i.content.cloneNode(!0)),t.innerHTML}return""}class Za extends Ya{constructor(t){super(t),this.apiKey=t.getAttribute("api-key"),this.baseKey=t.getAttribute("base"),this.table=t.getAttribute("table"),this.view=t.getAttribute("view"),this.filterExpr=t.getAttribute("filter"),this.labelExpr=t.getAttribute("label");const e=t.getAttribute("fields");this.fields=e?e.split(/\s*,\s*/):["ID"];const i=t.getAttribute("tokenize");this.tokenize=i?i.split(/\s*,\s*/):[this.fields[0]],this.tokenizeChars=t.getAttribute("tokenize-regex")||"\\W",this.infoExpr=Qa(t,".info"),this.detailExpr=Qa(t,".detail"),this._init()}_init(){window.ESGlobalBridge.requestAvailability();const t=I("https://unpkg.com/airtable@0.11.1/build/airtable.browser.js");window.ESGlobalBridge.instance.load("airtable",t),window.addEventListener("es-bridge-airtable-loaded",this._initAirtable.bind(this),{once:!0})}_initAirtable(){const t=require("airtable");this.base=new t({apiKey:this.apiKey}).base(this.baseKey)}async query(t){t=t.toLowerCase();const e=[],i=this.filterExpr?Ka(this.filterExpr,{key:t}):null,n={fields:this.fields,maxRecords:100};return this.view&&(n.view=this.view),i&&(n.filterByFormula=i),new Promise((t,i)=>{this.base(this.table).select(n).firstPage((n,r)=>{if(n)return console.error(n),void i(n);r.forEach(t=>{const i={};this.fields.forEach(e=>{i[e]=t.get(e)});const n={register:this._register,id:t.id,label:Ka(this.labelExpr,i),details:Ka(this.detailExpr,i),provider:"airtable"};e.push(n)}),t({totalItems:3,items:e})})})}info(t,e){return new Promise((i,n)=>{const r={fields:this.fields,filterByFormula:`RECORD_ID()='${t}'`};this.base(this.table).select(r).firstPage((r,o)=>{if(r){switch(r.statusCode){case 404:n(`No record found for ${t} in table ${this.table}`);break;default:n(`${r.statusCode}: ${r.message}`)}return}const s=o[0];if(0===Object.keys(s.fields).length)return void console.warn("Retrieved an empty record for %s from table %s",t,this.table);let a=[];const l={};this.fields.forEach(t=>{const e=s.get(t);e&&(l[t]=e,a.push(e))});const c=new RegExp(this.tokenizeChars);this.tokenize.forEach(t=>{a=a.concat(l[t].split(c))}),a=a.filter(t=>!/^\d+$/.test(t)),a.sort((t,e)=>e.length-t.length),console.log(a),e.innerHTML=Ka(this.infoExpr,l),i({id:s.id,strings:a})})})}}function Ja(t){let e="";t.professionOrOccupation&&t.professionOrOccupation.length>0&&(e=t.professionOrOccupation.map(t=>t.label).join(", ")),t.biographicalOrHistoricalInformation&&(e=`${e}; ${t.biographicalOrHistoricalInformation.join(", ")}`);const i=[];return t.dateOfBirth&&t.dateOfBirth.length>0&&i.push(t.dateOfBirth[0]),t.dateOfDeath&&t.dateOfDeath.length>0&&(i.push(" - "),i.push(t.dateOfDeath[0])),i.length>0?`${i.join("")}${e?"; "+e:""}`:e}class tl extends Ya{query(t){const e=[];let i;switch(this._register){case"place":i="PlaceOrGeographicName";break;case"term":i="SubjectHeading";break;case"organization":i="CorporateBody";break;default:i="Person"}return new Promise(n=>{fetch(`https://lobid.org/gnd/search?q=${encodeURIComponent(t)}&filter=%2B%28type%3A${i}%29&format=json&size=100`).then(t=>t.json()).then(t=>{t.member.forEach(t=>{const i={register:this._register,id:this._prefix?`${this._prefix}-${t.gndIdentifier}`:t.gndIdentifier,label:t.preferredName,link:t.id,details:Ja(t),strings:[t.preferredName].concat(t.variantName),provider:"GND"};e.push(i)}),n({totalItems:t.totalItems,items:e})})})}async getRecord(t){const e=this._prefix?t.substring(this._prefix.length+1):t;return fetch(`https://lobid.org/gnd/${e}.json`).then(t=>t.ok?t.json():Promise.reject()).then(t=>{const e=Object.assign({},t);return e.name=t.preferredName,e.link=t.id,t.dateOfBirth&&t.dateOfBirth.length>0&&(e.birth=t.dateOfBirth[0]),t.dateOfDeath&&t.dateOfDeath.length>0&&(e.death=t.dateOfDeath[0]),t.biographicalOrHistoricalInformation&&(e.note=t.biographicalOrHistoricalInformation.join("; ")),t.professionOrOccupation&&t.professionOrOccupation.length>0&&(e.profession=t.professionOrOccupation.map(t=>t.label)),e}).catch(()=>Promise.reject())}info(t,e){return t?new Promise((i,n)=>{this.getRecord(t).then(t=>{let n;t.type.indexOf("SubjectHeading")>-1?n=this.infoSubject(t):t.type.indexOf("AuthorityResource")>-1&&(n=this.infoPerson(t));const r=`\n <h3 class="label">\n <a href="https://${t.id}" target="_blank"> ${t.preferredName} </a>\n </h3>\n ${n}\n `;e.innerHTML=r,i({id:this._prefix?`${this._prefix}-${t.gndIdentifier}`:t.gndIdentifier,strings:[t.preferredName].concat(t.variantName)})}).catch(()=>n())}):Promise.resolve()}infoPerson(t){const e=t.professionOrOccuption?t.professionOrOccupation.map(t=>t.label):[];return`<p>${t.dateOfBirth} - ${t.dateOfDeath}</p>\n <p>${e.join(" ")}</p>`}infoSubject(t){if(t.broaderTermGeneral){return`<p>${t.broaderTermGeneral.map(t=>t.label).join(", ")}</p>`}return""}}class el extends Ya{constructor(t){super(t),this._api=t.getAttribute("api"),this._limit=t.getAttribute("limit")||999999}async query(t){const e=[],i=this.getRegister(),n=`https://meta.karl-barth.ch/api/${i}?${"bibls"===i?"biblsearch":"search"}=${encodeURIComponent(t)}&perPage=${this._limit}`,r=this.getLabelField();return new Promise(t=>{fetch(n).then(t=>t.json()).then(n=>{n.data.forEach(t=>{if("organization"===this._register&&"organisation"!==t.authority_type||"person"===this._register&&"person"!==t.authority_type)return;const n={register:this._register,id:this._prefix?`${this._prefix}:${t["full-id"]}`:t["full-id"],label:"string"==typeof r?t[r]:r(t),details:""+t["full-id"],link:`https://meta.karl-barth.ch/${i}/${t.id}`,strings:["string"==typeof r?t[r]:r(t)],provider:"KBGA"};e.push(n)}),t({totalItems:n.meta.total,items:e})})})}info(t,e){if(!t)return Promise.resolve({});const i=this.getLabelField();return new Promise(n=>{this.getRecord(t).then(t=>{const r=t.data.death?"† "+t.data.death:"",o=t.data.birth?`<p>* ${t.data.birth} ${r}</p>`:"",s=t.data.note_bio?`<p>${t.data.note_bio}</p>`:"",a=`\n <h3 class="label"><a href="https://${t.wikipediaURL}" target="_blank">${"string"==typeof i?t.data[i]:i(t.data)}</a></h3>\n ${o}\n ${s}\n `;e.innerHTML=a,n({id:t.data["full-id"],strings:["string"==typeof i?t.data[i]:i(t.data)]})})})}async getRecord(t){const e=t.replace(/^.*-([^-]+)$/,"$1");return fetch(`https://meta.karl-barth.ch/api/${this.getRegister()}/${e}`).then(t=>t.json()).then(t=>{const e=Object.assign({},t);switch(e.name=t.data[this.getLabelField()],this._register){case"place":e.country=t.data.country,e.location=t.data.location.coordinates,e.links=t.data.links.map(t=>t.url);break;case"person":e.birth=t.data.birth,e.death=t.data.death,e.note=t.data.note_bio,e.links=["https://"+t.wikipediaURL]}return e}).catch(t=>Promise.reject(t))}getLabelField(){let t;switch(this._register){case"place":t="placeName_full";break;case"term":t="fullLabel";break;case"abbreviation":t="label";break;case"bibl":t="asHtml";break;default:t="persName_full"}return t}getRegister(){if(this._api)return this._api;let t;switch(this._register){case"person":case"organization":t="actors";break;case"place":t="places";break;case"term":t="terms";break;case"abbreviation":t="abbreviations";break;case"bibl":t="bibls";break;default:t=this._register}return t}}class il extends Ya{constructor(t){super(t),this._api=t.getAttribute("api"),this._limit=t.getAttribute("limit")||999999}async query(t){const e=[],i=this.getRegister(),n=`https://archives.georgfischer.com/api/${i}?search=${encodeURIComponent(t)}&perPage=${this._limit}`,r=this.getLabelField();return new Promise(t=>{fetch(n).then(t=>t.json()).then(n=>{n.data?(n.data.forEach(t=>{if("organization"===this._register&&"Person"===t.authority_type||"person"===this._register&&"Person"!==t.authority_type)return;const n={register:this._register,id:this._prefix?`${this._prefix}-${t.id}`:t.id,label:t[r],details:""+t.id,link:`https://archives.georgfischer.com/api/${i}/${t.id}`,strings:[t[r]],provider:"GF"};e.push(n)}),t({totalItems:n.meta.total,items:e})):t({totalItems:0,items:[]})}).catch(t=>Promise.reject(t))})}info(t,e){if(!t)return Promise.resolve({});const i=this._prefix?t.substring(this._prefix.length+1):t,n=this.getLabelField();return new Promise(t=>{this.getRecord(i).then(i=>{const r=i.data.death?"† "+i.data.death:"",o=i.data.birth?`<p>* ${i.data.birth} ${r}</p>`:"",s=i.data.note_bio?`<p>${i.data.note_bio}</p>`:"",a=`\n <h3 class="label"><a href="https://${i.wikipediaURL}" target="_blank">${i.data[n]}</a></h3>\n ${o}\n ${s}\n `;e.innerHTML=a,t({id:this._prefix?`${this._prefix}-${i.data.id}`:i.data.id,strings:[i.data[n]]})})})}async getRecord(t){const e=t.replace(/^.*-([^-]+)$/,"$1"),i=`https://archives.georgfischer.com/api/${this.getRegister()}/${e}`;return fetch(i).then(t=>t.json()).then(t=>{const e=Object.assign({},t);switch(e.name=t.data[this.getLabelField()],this._register){case"place":e.country=t.data.country,e.location=t.data.location.coordinates,e.links=t.data.links.map(t=>t.url);break;case"person":e.birth=t.data.birth,e.death=t.data.death,e.note=t.data.note_bio,e.links=["https://"+t.wikipediaURL]}return e}).catch(t=>Promise.reject(t))}getLabelField(){let t;switch(this._register){case"term":t="label";break;default:t="fullname"}return t}getRegister(){if(this._api)return this._api;let t;switch(this._register){case"person":case"organization":t="actors";break;case"place":t="places";break;case"term":t="keywords";break;case"abbreviation":t="abbreviations";break;default:t=this._register}return t}}async function nl(t){const e=await fetch(t);return await e.json()}class rl extends Ya{constructor(t){super(t),this.endpoint=t.getAttribute("endpoint"),this.debug=t.getAttribute("debug"),nl(this.endpoint).then(t=>{this.ORConfig=t,this.debug&&console.log("OpenReconcile connector for register '%s' at endpoint <%s>. Using config: %o",this._register,this.endpoint,this.ORConfig)})}async query(t){const e=[],i={q1:{query:t}};return new Promise(t=>{fetch(this.endpoint,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},body:"queries=".concat(JSON.stringify(i))}).then(t=>t.json()).then(i=>{i.q1.result.forEach(t=>{this.ORConfig.view?this.view=this.ORConfig.view.url.replace("{{id}}",t.id):this.view=t.id,t.description?this.description=t.description:t.type?this.description=t.type.map(t=>t.name.toString()).join(", "):this.description="";const i={register:this._register,id:this._prefix?`${this._prefix}-${t.id}`:t.id,label:t.name,link:this.view,details:this.description,provider:"OpenReconcile"};e.push(i)}),this.debug&&console.log("OpenReconcile results: %o",e),t({totalItems:i.q1.result.length,items:e})})})}info(t,e){return t?this.ORConfig.preview?new Promise((i,n)=>{const r=this._prefix?t.substring(this._prefix.length+1):t,o=this.ORConfig.preview.url.replace("{{id}}",encodeURIComponent(r));fetch(o).then(t=>t.text()).then(t=>{e.innerHTML=t,i({id:this._prefix?`${this._prefix}-${r}`:r})}).catch(()=>n())}):(e.innerHTML="no 'preview' information in endpoint's manifest",Promise.resolve()):Promise.resolve({})}}class ol extends Ya{constructor(t,e){super(e),this._endpoint=t,this._connectors=sl(t,e),this._connectors.forEach(t=>{t.name=this.name}),console.log("custom connector: endpoint: %s; using authorities: %o",this._endpoint,this._connectors)}async query(t){return new Promise(e=>{fetch(`${this._endpoint}/api/register/search/${this._register}?query=${encodeURIComponent(t)}`).then(t=>t.json()).then(async i=>{let n=[];const r=new Set;i.forEach(t=>{n.push({register:this._register,id:t.id,label:t.label,link:t.link,details:t.details,provider:"local"}),r.add(t.id)});let o=i.length;for(const e of this._connectors){const i=await e.query(t);n=n.concat(i.items.filter(t=>!r.has(t.id))),o+=i.totalItems}e({totalItems:o,items:n})})})}info(t,e){if(!t)return Promise.resolve({});const i=t;return new Promise((n,r)=>{fetch(`${this._endpoint}/api/register/${this._register}/${encodeURIComponent(i)}`).then(async i=>{if(i.ok){const t=await i.json();return e.innerHTML=t.details,void n({id:t.id,strings:t.strings})}if(404===i.status)for(const i of this._connectors)try{const r=await i.info(t,e);r&&n(r)}catch(t){}r()})})}async select(t){let e;for(const i of this._connectors)if(e=await i.getRecord(t.id),e)break;return e?fetch(`${this._endpoint}/api/register/${this._register}/${encodeURIComponent(t.id)}`,{method:"POST",mode:"cors",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(t=>t.json()):Promise.reject("No record found for ID "+t.id)}}function sl(t,e){const i=[];return e.querySelectorAll(":scope > pb-authority").forEach(e=>{let n;switch(e.getAttribute("connector")){case"GND":n=new tl(e);break;case"GeoNames":n=new Xa(e);break;case"Airtable":n=new Za(e);break;case"KBGA":n=new el(e);break;case"GF":n=new il(e);break;case"ReconciliationService":n=new rl(e);break;case"Custom":n=new ol(t,e);break;default:n=new Ga(e)}i.push(n)}),i}class al extends(R(T)){static get properties(){return Object.assign({query:{type:String,reflect:!0},sortByLabel:{type:Boolean,attribute:"sort-by-label"},stopwords:{type:String},_results:{type:Array}},super.properties)}constructor(){super(),this.query="",this.type=null,this.sortByLabel=!1,this._results=[],this._authorities={}}connectedCallback(){super.connectedCallback(),this._stopwordSet=new Set,this.stopwords&&this.stopwords.split(/\s*,\s*/).forEach(t=>this._stopwordSet.add(t.toLowerCase())),this.subscribeTo("pb-authority-lookup",t=>{this.query=t.detail.query,this.type=t.detail.type,this._results=[],this._query()}),al.waitOnce("pb-page-ready",()=>{sl(this.getEndpoint(),this).forEach(t=>{this._authorities[t.register]=t})}),console.log("<pb-authority-lookup> Registered authorities: %o",this._authorities)}render(){return O`
|
|
4049
4049
|
<paper-input
|
|
4050
4050
|
id="query"
|
|
4051
|
-
label="${
|
|
4051
|
+
label="${F("Search for")}"
|
|
4052
4052
|
always-float-label
|
|
4053
4053
|
value="${this.query}"
|
|
4054
4054
|
@change="${this._queryChanged}"
|
|
@@ -4060,7 +4060,7 @@ const qa=e({is:"iron-label",listeners:{tap:"_tapHandler"},properties:{for:{type:
|
|
|
4060
4060
|
${this._results.map(t=>this._formatItem(t))}
|
|
4061
4061
|
</table>
|
|
4062
4062
|
</div>
|
|
4063
|
-
`}async lookup(t,e,i){if(!e||""===e)return console.log("<pb-authority-lookup> Key is empty"),i.innerHTML="",Promise.resolve();const n=this._authorities[t];console.log("<pb-authority-lookup> Retrieving info for %s from %s",e,t);let r=await n.info(e,i);return r.strings&&(r=Object.assign(r,{strings:r.strings.filter(t=>t&&!this._stopwordSet.has(t.toLowerCase()))})),r}_formatItem(t){return
|
|
4063
|
+
`}async lookup(t,e,i){if(!e||""===e)return console.log("<pb-authority-lookup> Key is empty"),i.innerHTML="",Promise.resolve();const n=this._authorities[t];console.log("<pb-authority-lookup> Retrieving info for %s from %s",e,t);let r=await n.info(e,i);return r.strings&&(r=Object.assign(r,{strings:r.strings.filter(t=>t&&!this._stopwordSet.has(t.toLowerCase()))})),r}_formatItem(t){return O`
|
|
4064
4064
|
<tr>
|
|
4065
4065
|
<td>
|
|
4066
4066
|
<paper-icon-button
|
|
@@ -4070,15 +4070,15 @@ const qa=e({is:"iron-label",listeners:{tap:"_tapHandler"},properties:{for:{type:
|
|
|
4070
4070
|
</td>
|
|
4071
4071
|
<td>
|
|
4072
4072
|
<div>
|
|
4073
|
-
${t.link?
|
|
4073
|
+
${t.link?O`<a target="_blank" href="${t.link}">${S(t.label)}</a>`:O`${S(t.label)}`}
|
|
4074
4074
|
</div>
|
|
4075
|
-
${t.details?
|
|
4075
|
+
${t.details?O`<div class="details" part="details">${t.details}</div>`:null}
|
|
4076
4076
|
</td>
|
|
4077
|
-
<td>${t.occurrences>0?
|
|
4078
|
-
<td>${t.provider?
|
|
4077
|
+
<td>${t.occurrences>0?O`<span class="occurrences" part="occurrences">${t.occurrences}</span>`:null}</td>
|
|
4078
|
+
<td>${t.provider?O`<div><span class="source" part="source">${t.provider}</span></div>`:null}</td>
|
|
4079
4079
|
<td><span class="register" part="register">${t.register}</span></td>
|
|
4080
4080
|
</tr>
|
|
4081
|
-
`}_select(t){const e=this._authorities[t.register];e&&e.select(t);const i={strings:t.strings,properties:{ref:t.id}};this.emitTo("pb-authority-select",i)}_queryChanged(){this._results=[],this.query=this.shadowRoot.getElementById("query").value,this._query()}_query(){this.emitTo("pb-start-update"),this._authorities[this.type].query(this.query).then(t=>{this._occurrences(t.items).then(t=>{this._results=t}),this.emitTo("pb-end-update"),this.shadowRoot.getElementById("query").focus()})}_occurrences(t){const e=new FormData;return e.append("register",this.type),t.forEach(t=>{e.append("id",t.id)}),new Promise(i=>{fetch(this.getEndpoint()+"/api/annotations/occurrences",{method:"POST",body:e}).then(t=>{if(t.ok)return t.json()}).then(e=>{t.forEach(t=>{e[t.id]?t.occurrences=e[t.id]:t.occurrences=0}),t.sort((t,e)=>{const i=e.occurrences-t.occurrences;return 0===i?"local"===t.provider&&"local"!==e.provider?-1:"local"===e.provider&&"local"!==t.provider?1:this.sortByLabel?t.label.localeCompare(e.label):0:i}),i(t)})})}static get styles(){return
|
|
4081
|
+
`}_select(t){const e=this._authorities[t.register];e&&e.select(t);const i={strings:t.strings,properties:{ref:t.id}};this.emitTo("pb-authority-select",i)}_queryChanged(){this._results=[],this.query=this.shadowRoot.getElementById("query").value,this._query()}_query(){this.emitTo("pb-start-update"),this._authorities[this.type].query(this.query).then(t=>{this._occurrences(t.items).then(t=>{this._results=t}),this.emitTo("pb-end-update"),this.shadowRoot.getElementById("query").focus()})}_occurrences(t){const e=new FormData;return e.append("register",this.type),t.forEach(t=>{e.append("id",t.id)}),new Promise(i=>{fetch(this.getEndpoint()+"/api/annotations/occurrences",{method:"POST",body:e}).then(t=>{if(t.ok)return t.json()}).then(e=>{t.forEach(t=>{e[t.id]?t.occurrences=e[t.id]:t.occurrences=0}),t.sort((t,e)=>{const i=e.occurrences-t.occurrences;return 0===i?"local"===t.provider&&"local"!==e.provider?-1:"local"===e.provider&&"local"!==t.provider?1:this.sortByLabel?t.label.localeCompare(e.label):0:i}),i(t)})})}static get styles(){return V`
|
|
4082
4082
|
:host {
|
|
4083
4083
|
display: flex;
|
|
4084
4084
|
flex-direction: column;
|
|
@@ -4120,7 +4120,7 @@ const qa=e({is:"iron-label",listeners:{tap:"_tapHandler"},properties:{for:{type:
|
|
|
4120
4120
|
.occurrences {
|
|
4121
4121
|
background-color: var(--pb-color-focus);
|
|
4122
4122
|
}
|
|
4123
|
-
`}}customElements.define("pb-authority-lookup",al);class ll extends(
|
|
4123
|
+
`}}customElements.define("pb-authority-lookup",al);class ll extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{data:{type:Object},documents:{type:Array},doc:{type:String},perPage:{type:Number,attribute:"per-page"},pattern:{type:String},first:{type:Number},sort:{type:String},target:{type:String,attribute:"target"}})}constructor(){super(),this.data={documents:[]},this.documents=[],this.first=1,this.doc=null,this.sort=null}static get styles(){return V`
|
|
4124
4124
|
:host {
|
|
4125
4125
|
display: block;
|
|
4126
4126
|
max-width:100%;
|
|
@@ -4180,7 +4180,7 @@ const qa=e({is:"iron-label",listeners:{tap:"_tapHandler"},properties:{for:{type:
|
|
|
4180
4180
|
display:inline-block;
|
|
4181
4181
|
}
|
|
4182
4182
|
|
|
4183
|
-
`}connectedCallback(){super.connectedCallback(),this.subscribeTo("pb-load",t=>{this.first=Number(t.detail.params.start),this.load()}),this.subscribeTo("force-load",t=>{this.load(),this.requestUpdate()}),this.subscribeTo("pb-results-received",t=>{this.data=t.detail.data,this.documents=this.data.documents,this._animate()})}render(){return
|
|
4183
|
+
`}connectedCallback(){super.connectedCallback(),this.subscribeTo("pb-load",t=>{this.first=Number(t.detail.params.start),this.load()}),this.subscribeTo("force-load",t=>{this.load(),this.requestUpdate()}),this.subscribeTo("pb-results-received",t=>{this.data=t.detail.data,this.documents=this.data.documents,this._animate()})}render(){return O`
|
|
4184
4184
|
<pb-paginate part="paginator" per-page="${this.perPage}" range="5"></pb-paginate>
|
|
4185
4185
|
<table>
|
|
4186
4186
|
<tr class="t-head">
|
|
@@ -4190,7 +4190,7 @@ const qa=e({is:"iron-label",listeners:{tap:"_tapHandler"},properties:{for:{type:
|
|
|
4190
4190
|
<th class="right">after</th>
|
|
4191
4191
|
<th class="hit-count">hits</th>
|
|
4192
4192
|
</tr>
|
|
4193
|
-
${this.documents.map(t=>
|
|
4193
|
+
${this.documents.map(t=>O`
|
|
4194
4194
|
<tr>
|
|
4195
4195
|
<td colspan="4" class="docName">
|
|
4196
4196
|
<a href="${this.target}/${t.id}.xml?pattern=${this.pattern}&page=${t.matches[0].page[0]}"
|
|
@@ -4200,7 +4200,7 @@ const qa=e({is:"iron-label",listeners:{tap:"_tapHandler"},properties:{for:{type:
|
|
|
4200
4200
|
<span class="hit-count">${t.hits}</span>
|
|
4201
4201
|
</td>
|
|
4202
4202
|
</tr>
|
|
4203
|
-
${t.matches.map(e=>
|
|
4203
|
+
${t.matches.map(e=>O`
|
|
4204
4204
|
<tr>
|
|
4205
4205
|
<td class="left" colspan="2">${e.left}</td>
|
|
4206
4206
|
<td class="hit">
|
|
@@ -4212,14 +4212,14 @@ const qa=e({is:"iron-label",listeners:{tap:"_tapHandler"},properties:{for:{type:
|
|
|
4212
4212
|
`)}
|
|
4213
4213
|
`)}
|
|
4214
4214
|
</table>
|
|
4215
|
-
`}async load(){if(!this.getEndpoint())return;if(!this.pattern)return;let t=`${this.getEndpoint()}/api/blacklab/search?pattern=${this.pattern}&start=${this.first}&per-page=${this.perPage}`;this.doc&&(t+="&doc="+this.doc),this.sort&&(t+="&sort="+this.sort),await fetch(t,{method:"GET",mode:"cors",credentials:"same-origin"}).then(t=>t.json()).then(t=>{this.data=t,localStorage.setItem("pb-kwic-results",JSON.stringify(this.data)),this.emitTo("pb-results-received",{count:t.docs?parseInt(t.docs,10):0,start:t.start,params:t.params,data:t},[])}).catch(t=>{alert("Error retrieving remote content: "+t)})}_animate(){fs({targets:this.shadowRoot.querySelector("table"),opacity:[0,1],duration:200,delay:200,easing:"linear"})}}customElements.define("pb-blacklab-results",ll);class cl extends(
|
|
4216
|
-
${0!==this.hits.length?
|
|
4215
|
+
`}async load(){if(!this.getEndpoint())return;if(!this.pattern)return;let t=`${this.getEndpoint()}/api/blacklab/search?pattern=${this.pattern}&start=${this.first}&per-page=${this.perPage}`;this.doc&&(t+="&doc="+this.doc),this.sort&&(t+="&sort="+this.sort),await fetch(t,{method:"GET",mode:"cors",credentials:"same-origin"}).then(t=>t.json()).then(t=>{this.data=t,localStorage.setItem("pb-kwic-results",JSON.stringify(this.data)),this.emitTo("pb-results-received",{count:t.docs?parseInt(t.docs,10):0,start:t.start,params:t.params,data:t},[])}).catch(t=>{alert("Error retrieving remote content: "+t)})}_animate(){fs({targets:this.shadowRoot.querySelector("table"),opacity:[0,1],duration:200,delay:200,easing:"linear"})}}customElements.define("pb-blacklab-results",ll);class cl extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{current:{type:Number},view:{type:String},pattern:{type:String},match:{type:String},docid:{type:String},hits:{type:Array},kwicData:{type:Object},matchParam:{type:String},pageId:{type:String},perDocument:{type:Number,attribute:"per-document"}})}connectedCallback(){super.connectedCallback(),this.current=1,this.perDocument=100,this.hits=[],this.kwicData={},cl.waitOnce("pb-page-ready",()=>{this.viewElement=document.getElementById(this.view),this.viewElement?this.shadow=this.viewElement.shadowRoot:console.error(`${this}: view element with id ${this.view} does not exist`)}),this.subscribeTo("pb-update",()=>{this._loadDocResults()}),this.subscribeTo("pb-refresh",t=>{this.dynMatch=t.detail.match})}render(){return O`
|
|
4216
|
+
${0!==this.hits.length?O`
|
|
4217
4217
|
<section class="kwic-display">
|
|
4218
4218
|
<paper-icon-button icon="icons:arrow-back" @click="${this._handlePrev}" ?disabled="${1===this.current}"></paper-icon-button>
|
|
4219
4219
|
<span class="current">${this.current}</span> / <span class="counter">${this.count}</span>
|
|
4220
4220
|
<paper-icon-button icon="icons:arrow-forward" @click="${this._handleNext}" ?disabled="${this.current===this.hits.length}"></paper-icon-button>
|
|
4221
4221
|
</section>`:""}
|
|
4222
|
-
`}async _loadDocResults(){if(!this.getEndpoint())return;const t=new URLSearchParams(window.location.search);this.pattern=t.get("pattern"),this.dynMatch?this.matchParam=this.dynMatch:this.matchParam=t.get("match"),this.pageId=t.get("id"),this.docId=t.get("doc");const e=`${this.getEndpoint()}/api/blacklab/doc?pattern=${this.pattern}&doc=${this.docId}&per-document=${this.perDocument}&format=json`;await fetch(e,{method:"GET",mode:"cors",credentials:"same-origin"}).then(t=>t.json()).then(t=>{this.kwicData=t}).then(()=>{this._markAllMatches(),this._showMatch(this.matchParam)}).catch(t=>{console.error("Error retrieving remote content: ",t)})}_markAllMatches(){const t=this.kwicData.documents;if(this.count=this.kwicData.hits,this.hits=t[Object.keys(t)[0]].hits,Array.isArray(this.hits))this.hits.forEach(t=>{const e=t.match.words[0],i=t.match.words[1];this._addMarkerClasses(e,i)});else{const t=this.hits.match.words[0],e=this.hits.match.words[1];this._addMarkerClasses(t,e)}this.requestUpdate()}_showMatch(t){const e=this._getMatchObject(t);this._navigateToMatch(e)}_getMatchObject(t){if(!t)return Array.isArray(this.hits)?this.hits[this.current-1]:this.hits;if(Array.isArray(this.hits)){const e=this.hits.find(e=>e.match.words[0]===t);return this.current=this.hits.findIndex(t=>t===e)+1,e}return this.current=1,this.hits}_navigateToMatch(t){const e=t.page[0],i=t.match.words[0],n=`${this._endpoint}/${this.docId}.xml?doc=${this.docId}&pattern=${this.pattern}&match=${t.match.words[0]}&id=${e}`;this.pageId!==e?this.emitTo("pb-refresh",{id:e,match:i}):(this._highlight(t),window.history.replaceState({},"",n))}_highlight(t){this._resetCurrentMarker();const e=t.match.words[0],i=t.match.words[1],n=this.shadow.querySelector("#"+e);n&&n.parentNode.classList.add("kwic-current");const r=this.shadow.querySelector("#"+i);r&&r.parentNode.classList.add("kwic-current"),n.scrollIntoView({block:"center",inline:"nearest"})}_resetCurrentMarker(){const t=this.shadow.querySelectorAll(".kwic-current");Array.from(t).forEach(t=>{t.classList.remove("kwic-current")})}_addMarkerClasses(t,e){const i=this.shadow.querySelector("#"+t);if(!i)return;i.parentNode.classList.add("kwic-start");const n=this.shadow.getElementById(e);n?n.parentNode.classList.add("kwic-end"):i.classList.add("kwic-end")}_handlePrev(){this.current-=1;const t=this.hits[this.current-1];this._navigateToMatch(t)}_handleNext(){const t=this.hits[this.current];this._navigateToMatch(t),this.current+=1}static get styles(){return
|
|
4222
|
+
`}async _loadDocResults(){if(!this.getEndpoint())return;const t=new URLSearchParams(window.location.search);this.pattern=t.get("pattern"),this.dynMatch?this.matchParam=this.dynMatch:this.matchParam=t.get("match"),this.pageId=t.get("id"),this.docId=t.get("doc");const e=`${this.getEndpoint()}/api/blacklab/doc?pattern=${this.pattern}&doc=${this.docId}&per-document=${this.perDocument}&format=json`;await fetch(e,{method:"GET",mode:"cors",credentials:"same-origin"}).then(t=>t.json()).then(t=>{this.kwicData=t}).then(()=>{this._markAllMatches(),this._showMatch(this.matchParam)}).catch(t=>{console.error("Error retrieving remote content: ",t)})}_markAllMatches(){const t=this.kwicData.documents;if(this.count=this.kwicData.hits,this.hits=t[Object.keys(t)[0]].hits,Array.isArray(this.hits))this.hits.forEach(t=>{const e=t.match.words[0],i=t.match.words[1];this._addMarkerClasses(e,i)});else{const t=this.hits.match.words[0],e=this.hits.match.words[1];this._addMarkerClasses(t,e)}this.requestUpdate()}_showMatch(t){const e=this._getMatchObject(t);this._navigateToMatch(e)}_getMatchObject(t){if(!t)return Array.isArray(this.hits)?this.hits[this.current-1]:this.hits;if(Array.isArray(this.hits)){const e=this.hits.find(e=>e.match.words[0]===t);return this.current=this.hits.findIndex(t=>t===e)+1,e}return this.current=1,this.hits}_navigateToMatch(t){const e=t.page[0],i=t.match.words[0],n=`${this._endpoint}/${this.docId}.xml?doc=${this.docId}&pattern=${this.pattern}&match=${t.match.words[0]}&id=${e}`;this.pageId!==e?this.emitTo("pb-refresh",{id:e,match:i}):(this._highlight(t),window.history.replaceState({},"",n))}_highlight(t){this._resetCurrentMarker();const e=t.match.words[0],i=t.match.words[1],n=this.shadow.querySelector("#"+e);n&&n.parentNode.classList.add("kwic-current");const r=this.shadow.querySelector("#"+i);r&&r.parentNode.classList.add("kwic-current"),n.scrollIntoView({block:"center",inline:"nearest"})}_resetCurrentMarker(){const t=this.shadow.querySelectorAll(".kwic-current");Array.from(t).forEach(t=>{t.classList.remove("kwic-current")})}_addMarkerClasses(t,e){const i=this.shadow.querySelector("#"+t);if(!i)return;i.parentNode.classList.add("kwic-start");const n=this.shadow.getElementById(e);n?n.parentNode.classList.add("kwic-end"):i.classList.add("kwic-end")}_handlePrev(){this.current-=1;const t=this.hits[this.current-1];this._navigateToMatch(t)}_handleNext(){const t=this.hits[this.current];this._navigateToMatch(t),this.current+=1}static get styles(){return V`
|
|
4223
4223
|
:host {
|
|
4224
4224
|
display: block;
|
|
4225
4225
|
}
|
|
@@ -4227,9 +4227,9 @@ const qa=e({is:"iron-label",listeners:{tap:"_tapHandler"},properties:{for:{type:
|
|
|
4227
4227
|
padding:0 0.5rem;
|
|
4228
4228
|
}
|
|
4229
4229
|
|
|
4230
|
-
`}}function hl(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function dl(t,e,i){return e&&hl(t.prototype,e),i&&hl(t,i),t}function pl(){return(pl=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t}).apply(this,arguments)}function ul(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,gl(t,e)}function gl(t,e){return(gl=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function fl(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ml(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function vl(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return ml(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?ml(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}customElements.define("pb-blacklab-highlight",cl);var bl,yl,_l,wl,xl,kl,Al={},zl=[],Sl=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function Cl(t,e){for(var i in e)t[i]=e[i];return t}function El(t){var e=t.parentNode;e&&e.removeChild(t)}function Ml(t,e,i){var n,r,o,s=arguments,a={};for(o in e)"key"==o?n=e[o]:"ref"==o?r=e[o]:a[o]=e[o];if(arguments.length>3)for(i=[i],o=3;o<arguments.length;o++)i.push(s[o]);if(null!=i&&(a.children=i),"function"==typeof t&&null!=t.defaultProps)for(o in t.defaultProps)void 0===a[o]&&(a[o]=t.defaultProps[o]);return Ll(t,a,n,r,null)}function Ll(t,e,i,n,r){var o={type:t,props:e,key:i,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++bl.__v:r};return null!=bl.vnode&&bl.vnode(o),o}function Tl(t){return t.children}function Hl(t,e){this.props=t,this.context=e}function Ol(t,e){if(null==e)return t.__?Ol(t.__,t.__.__k.indexOf(t)+1):null;for(var i;e<t.__k.length;e++)if(null!=(i=t.__k[e])&&null!=i.__e)return i.__e;return"function"==typeof t.type?Ol(t):null}function $l(t){var e,i;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if(null!=(i=t.__k[e])&&null!=i.__e){t.__e=t.__c.base=i.__e;break}return $l(t)}}function Vl(t){(!t.__d&&(t.__d=!0)&&_l.push(t)&&!Il.__r++||xl!==bl.debounceRendering)&&((xl=bl.debounceRendering)||wl)(Il)}function Il(){for(var t;Il.__r=_l.length;)t=_l.sort((function(t,e){return t.__v.__b-e.__v.__b})),_l=[],t.some((function(t){var e,i,n,r,o,s;t.__d&&(o=(r=(e=t).__v).__e,(s=e.__P)&&(i=[],(n=Cl({},r)).__v=r.__v+1,ql(s,r,n,e.__n,void 0!==s.ownerSVGElement,null!=r.__h?[o]:null,i,null==o?Ol(r):o,r.__h),Ul(i,r),r.__e!=o&&$l(r)))}))}function Rl(t,e,i,n,r,o,s,a,l,c){var h,d,p,u,g,f,m,v=n&&n.__k||zl,b=v.length;for(i.__k=[],h=0;h<e.length;h++)if(null!=(u=i.__k[h]=null==(u=e[h])||"boolean"==typeof u?null:"string"==typeof u||"number"==typeof u||"bigint"==typeof u?Ll(null,u,null,null,u):Array.isArray(u)?Ll(Tl,{children:u},null,null,null):u.__b>0?Ll(u.type,u.props,u.key,null,u.__v):u)){if(u.__=i,u.__b=i.__b+1,null===(p=v[h])||p&&u.key==p.key&&u.type===p.type)v[h]=void 0;else for(d=0;d<b;d++){if((p=v[d])&&u.key==p.key&&u.type===p.type){v[d]=void 0;break}p=null}ql(t,u,p=p||Al,r,o,s,a,l,c),g=u.__e,(d=u.ref)&&p.ref!=d&&(m||(m=[]),p.ref&&m.push(p.ref,null,u),m.push(d,u.__c||g,u)),null!=g?(null==f&&(f=g),"function"==typeof u.type&&null!=u.__k&&u.__k===p.__k?u.__d=l=Pl(u,l,t):l=Dl(t,u,p,v,g,l),c||"option"!==i.type?"function"==typeof i.type&&(i.__d=l):t.value=""):l&&p.__e==l&&l.parentNode!=t&&(l=Ol(p))}for(i.__e=f,h=b;h--;)null!=v[h]&&("function"==typeof i.type&&null!=v[h].__e&&v[h].__e==i.__d&&(i.__d=Ol(n,h+1)),Yl(v[h],v[h]));if(m)for(h=0;h<m.length;h++)Wl(m[h],m[++h],m[++h])}function Pl(t,e,i){var n,r;for(n=0;n<t.__k.length;n++)(r=t.__k[n])&&(r.__=t,e="function"==typeof r.type?Pl(r,e,i):Dl(i,r,r,t.__k,r.__e,e));return e}function Dl(t,e,i,n,r,o){var s,a,l;if(void 0!==e.__d)s=e.__d,e.__d=void 0;else if(null==i||r!=o||null==r.parentNode)t:if(null==o||o.parentNode!==t)t.appendChild(r),s=null;else{for(a=o,l=0;(a=a.nextSibling)&&l<n.length;l+=2)if(a==r)break t;t.insertBefore(r,o),s=o}return void 0!==s?s:r.nextSibling}function Nl(t,e,i){"-"===e[0]?t.setProperty(e,i):t[e]=null==i?"":"number"!=typeof i||Sl.test(e)?i:i+"px"}function Fl(t,e,i,n,r){var o;t:if("style"===e)if("string"==typeof i)t.style.cssText=i;else{if("string"==typeof n&&(t.style.cssText=n=""),n)for(e in n)i&&e in i||Nl(t.style,e,"");if(i)for(e in i)n&&i[e]===n[e]||Nl(t.style,e,i[e])}else if("o"===e[0]&&"n"===e[1])o=e!==(e=e.replace(/Capture$/,"")),e=e.toLowerCase()in t?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=i,i?n||t.addEventListener(e,o?jl:Bl,o):t.removeEventListener(e,o?jl:Bl,o);else if("dangerouslySetInnerHTML"!==e){if(r)e=e.replace(/xlink[H:h]/,"h").replace(/sName$/,"s");else if("href"!==e&&"list"!==e&&"form"!==e&&"tabIndex"!==e&&"download"!==e&&e in t)try{t[e]=null==i?"":i;break t}catch(t){}"function"==typeof i||(null!=i&&(!1!==i||"a"===e[0]&&"r"===e[1])?t.setAttribute(e,i):t.removeAttribute(e))}}function Bl(t){this.l[t.type+!1](bl.event?bl.event(t):t)}function jl(t){this.l[t.type+!0](bl.event?bl.event(t):t)}function ql(t,e,i,n,r,o,s,a,l){var c,h,d,p,u,g,f,m,v,b,y,_=e.type;if(void 0!==e.constructor)return null;null!=i.__h&&(l=i.__h,a=e.__e=i.__e,e.__h=null,o=[a]),(c=bl.__b)&&c(e);try{t:if("function"==typeof _){if(m=e.props,v=(c=_.contextType)&&n[c.__c],b=c?v?v.props.value:c.__:n,i.__c?f=(h=e.__c=i.__c).__=h.__E:("prototype"in _&&_.prototype.render?e.__c=h=new _(m,b):(e.__c=h=new Hl(m,b),h.constructor=_,h.render=Gl),v&&v.sub(h),h.props=m,h.state||(h.state={}),h.context=b,h.__n=n,d=h.__d=!0,h.__h=[]),null==h.__s&&(h.__s=h.state),null!=_.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=Cl({},h.__s)),Cl(h.__s,_.getDerivedStateFromProps(m,h.__s))),p=h.props,u=h.state,d)null==_.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(null==_.getDerivedStateFromProps&&m!==p&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(m,b),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(m,h.__s,b)||e.__v===i.__v){h.props=m,h.state=h.__s,e.__v!==i.__v&&(h.__d=!1),h.__v=e,e.__e=i.__e,e.__k=i.__k,e.__k.forEach((function(t){t&&(t.__=e)})),h.__h.length&&s.push(h);break t}null!=h.componentWillUpdate&&h.componentWillUpdate(m,h.__s,b),null!=h.componentDidUpdate&&h.__h.push((function(){h.componentDidUpdate(p,u,g)}))}h.context=b,h.props=m,h.state=h.__s,(c=bl.__r)&&c(e),h.__d=!1,h.__v=e,h.__P=t,c=h.render(h.props,h.state,h.context),h.state=h.__s,null!=h.getChildContext&&(n=Cl(Cl({},n),h.getChildContext())),d||null==h.getSnapshotBeforeUpdate||(g=h.getSnapshotBeforeUpdate(p,u)),y=null!=c&&c.type===Tl&&null==c.key?c.props.children:c,Rl(t,Array.isArray(y)?y:[y],e,i,n,r,o,s,a,l),h.base=e.__e,e.__h=null,h.__h.length&&s.push(h),f&&(h.__E=h.__=null),h.__e=!1}else null==o&&e.__v===i.__v?(e.__k=i.__k,e.__e=i.__e):e.__e=function(t,e,i,n,r,o,s,a){var l,c,h,d,p=i.props,u=e.props,g=e.type,f=0;if("svg"===g&&(r=!0),null!=o)for(;f<o.length;f++)if((l=o[f])&&(l===t||(g?l.localName==g:3==l.nodeType))){t=l,o[f]=null;break}if(null==t){if(null===g)return document.createTextNode(u);t=r?document.createElementNS("http://www.w3.org/2000/svg",g):document.createElement(g,u.is&&u),o=null,a=!1}if(null===g)p===u||a&&t.data===u||(t.data=u);else{if(o=o&&zl.slice.call(t.childNodes),c=(p=i.props||Al).dangerouslySetInnerHTML,h=u.dangerouslySetInnerHTML,!a){if(null!=o)for(p={},d=0;d<t.attributes.length;d++)p[t.attributes[d].name]=t.attributes[d].value;(h||c)&&(h&&(c&&h.__html==c.__html||h.__html===t.innerHTML)||(t.innerHTML=h&&h.__html||""))}if(function(t,e,i,n,r){var o;for(o in i)"children"===o||"key"===o||o in e||Fl(t,o,null,i[o],n);for(o in e)r&&"function"!=typeof e[o]||"children"===o||"key"===o||"value"===o||"checked"===o||i[o]===e[o]||Fl(t,o,e[o],i[o],n)}(t,u,p,r,a),h)e.__k=[];else if(f=e.props.children,Rl(t,Array.isArray(f)?f:[f],e,i,n,r&&"foreignObject"!==g,o,s,t.firstChild,a),null!=o)for(f=o.length;f--;)null!=o[f]&&El(o[f]);a||("value"in u&&void 0!==(f=u.value)&&(f!==t.value||"progress"===g&&!f)&&Fl(t,"value",f,p.value,!1),"checked"in u&&void 0!==(f=u.checked)&&f!==t.checked&&Fl(t,"checked",f,p.checked,!1))}return t}(i.__e,e,i,n,r,o,s,l);(c=bl.diffed)&&c(e)}catch(t){e.__v=null,(l||null!=o)&&(e.__e=a,e.__h=!!l,o[o.indexOf(a)]=null),bl.__e(t,e,i)}}function Ul(t,e){bl.__c&&bl.__c(e,t),t.some((function(e){try{t=e.__h,e.__h=[],t.some((function(t){t.call(e)}))}catch(t){bl.__e(t,e.__v)}}))}function Wl(t,e,i){try{"function"==typeof t?t(e):t.current=e}catch(t){bl.__e(t,i)}}function Yl(t,e,i){var n,r,o;if(bl.unmount&&bl.unmount(t),(n=t.ref)&&(n.current&&n.current!==t.__e||Wl(n,null,e)),i||"function"==typeof t.type||(i=null!=(r=t.__e)),t.__e=t.__d=void 0,null!=(n=t.__c)){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(t){bl.__e(t,e)}n.base=n.__P=null}if(n=t.__k)for(o=0;o<n.length;o++)n[o]&&Yl(n[o],e,i);null!=r&&El(r)}function Gl(t,e,i){return this.constructor(t,i)}function Xl(t,e,i){var n,r,o;bl.__&&bl.__(t,e),r=(n="function"==typeof i)?null:i&&i.__k||e.__k,o=[],ql(e,t=(!n&&i||e).__k=Ml(Tl,null,[t]),r||Al,Al,void 0!==e.ownerSVGElement,!n&&i?[i]:r?null:e.firstChild?zl.slice.call(e.childNodes):null,o,!n&&i?i:r?r.__e:e.firstChild,n),Ul(o,t)}function Kl(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}))}bl={__e:function(t,e){for(var i,n,r;e=e.__;)if((i=e.__c)&&!i.__)try{if((n=i.constructor)&&null!=n.getDerivedStateFromError&&(i.setState(n.getDerivedStateFromError(t)),r=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(t),r=i.__d),r)return i.__E=i}catch(e){t=e}throw t},__v:0},yl=function(t){return null!=t&&void 0===t.constructor},Hl.prototype.setState=function(t,e){var i;i=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=Cl({},this.state),"function"==typeof t&&(t=t(Cl({},i),this.props)),t&&Cl(i,t),null!=t&&this.__v&&(e&&this.__h.push(e),Vl(this))},Hl.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Vl(this))},Hl.prototype.render=Tl,_l=[],wl="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Il.__r=0,kl=0;var Ql=function(){function t(t){this._id=void 0,this._id=t||Kl()}return dl(t,[{key:"id",get:function(){return this._id}}]),t}(),Zl={search:{placeholder:"Type a keyword..."},sort:{sortAsc:"Sort column ascending",sortDesc:"Sort column descending"},pagination:{previous:"Previous",next:"Next",navigate:function(t,e){return"Page "+t+" of "+e},page:function(t){return"Page "+t},showing:"Showing",of:"of",to:"to",results:"results"},loading:"Loading...",noRecordsFound:"No matching records found",error:"An error happened while fetching the data"},Jl=function(){function t(t){this._language=void 0,this._defaultLanguage=void 0,this._language=t,this._defaultLanguage=Zl}var e=t.prototype;return e.getString=function(t,e){if(!e||!t)return null;var i=t.split("."),n=i[0];if(e[n]){var r=e[n];return"string"==typeof r?function(){return r}:"function"==typeof r?r:this.getString(i.slice(1).join("."),r)}return null},e.translate=function(t){var e;return(e=this.getString(t,this._language)||this.getString(t,this._defaultLanguage))?e.apply(void 0,[].slice.call(arguments,1)):t},t}(),tc=function(t){function e(e,i){var n,r;return(n=t.call(this,e,i)||this).config=void 0,n._=void 0,n.config=function(t){if(!t)return null;var e=Object.keys(t);return e.length?t[e[0]].props.value:null}(i),n.config&&(n._=(r=n.config.translator,function(t){return r.translate.apply(r,[t].concat([].slice.call(arguments,1)))})),n}return ul(e,t),e}(Hl),ec=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e.prototype.render=function(){return Ml(this.props.parentElement,{dangerouslySetInnerHTML:{__html:this.props.content}})},e}(tc);function ic(t,e){return Ml(ec,{content:t,parentElement:e})}ec.defaultProps={parentElement:"span"};var nc,rc=function(t){function e(e){var i;return(i=t.call(this)||this).data=void 0,i.update(e),i}ul(e,t);var i=e.prototype;return i.cast=function(t){return t instanceof HTMLElement?ic(t.outerHTML):t},i.update=function(t){return this.data=this.cast(t),this},e}(Ql),oc=function(t){function e(e){var i;return(i=t.call(this)||this)._cells=void 0,i.cells=e||[],i}ul(e,t);var i=e.prototype;return i.cell=function(t){return this._cells[t]},i.toArray=function(){return this.cells.map((function(t){return t.data}))},e.fromCells=function(t){return new e(t.map((function(t){return new rc(t.data)})))},dl(e,[{key:"cells",get:function(){return this._cells},set:function(t){this._cells=t}},{key:"length",get:function(){return this.cells.length}}]),e}(Ql),sc=function(t){function e(e){var i;return(i=t.call(this)||this)._rows=void 0,i._length=void 0,i.rows=e instanceof Array?e:e instanceof oc?[e]:[],i}return ul(e,t),e.prototype.toArray=function(){return this.rows.map((function(t){return t.toArray()}))},e.fromRows=function(t){return new e(t.map((function(t){return oc.fromCells(t.cells)})))},e.fromArray=function(t){return new e((t=function(t){return!t[0]||t[0]instanceof Array?t:[t]}(t)).map((function(t){return new oc(t.map((function(t){return new rc(t)})))})))},dl(e,[{key:"rows",get:function(){return this._rows},set:function(t){this._rows=t}},{key:"length",get:function(){return this._length||this.rows.length},set:function(t){this._length=t}}]),e}(Ql),ac=function(){function t(){this.callbacks=void 0}var e=t.prototype;return e.init=function(t){this.callbacks||(this.callbacks={}),t&&!this.callbacks[t]&&(this.callbacks[t]=[])},e.on=function(t,e){return this.init(t),this.callbacks[t].push(e),this},e.off=function(t,e){var i=t;return this.init(),this.callbacks[i]&&0!==this.callbacks[i].length?(this.callbacks[i]=this.callbacks[i].filter((function(t){return t!=e})),this):this},e.emit=function(t){var e=arguments,i=t;return this.init(i),this.callbacks[i].length>0&&(this.callbacks[i].forEach((function(t){return t.apply(void 0,[].slice.call(e,1))})),!0)},t}();!function(t){t[t.Initiator=0]="Initiator",t[t.ServerFilter=1]="ServerFilter",t[t.ServerSort=2]="ServerSort",t[t.ServerLimit=3]="ServerLimit",t[t.Extractor=4]="Extractor",t[t.Transformer=5]="Transformer",t[t.Filter=6]="Filter",t[t.Sort=7]="Sort",t[t.Limit=8]="Limit"}(nc||(nc={}));var lc=function(t){function e(e){var i;return(i=t.call(this)||this).id=void 0,i._props=void 0,i._props={},i.id=Kl(),e&&i.setProps(e),i}ul(e,t);var i=e.prototype;return i.process=function(){var t=[].slice.call(arguments);this.validateProps instanceof Function&&this.validateProps.apply(this,t),this.emit.apply(this,["beforeProcess"].concat(t));var e=this._process.apply(this,t);return this.emit.apply(this,["afterProcess"].concat(t)),e},i.setProps=function(t){return Object.assign(this._props,t),this.emit("propsUpdated",this),this},dl(e,[{key:"props",get:function(){return this._props}}]),e}(ac),cc=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e.prototype._process=function(t){return this.props.keyword?(e=String(this.props.keyword).trim(),i=this.props.columns,n=this.props.ignoreHiddenColumns,r=t,o=this.props.selector,e=e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),new sc(r.rows.filter((function(t,r){return t.cells.some((function(t,s){if(!t)return!1;if(n&&i&&i[s]&&"object"==typeof i[s]&&i[s].hidden)return!1;var a="";if("function"==typeof o)a=o(t.data,r,s);else if("object"==typeof t.data){var l=t.data;l&&l.props&&l.props.content&&(a=l.props.content)}else a=String(t.data);return new RegExp(e,"gi").test(a)}))})))):t;var e,i,n,r,o},dl(e,[{key:"type",get:function(){return nc.Filter}}]),e}(lc);function hc(){return""+"gridjs"+[].slice.call(arguments).reduce((function(t,e){return t+"-"+e}),"")}function dc(){return[].slice.call(arguments).filter((function(t){return t})).reduce((function(t,e){return(t||"")+" "+e}),"").trim()||null}var pc,uc=function(t){function e(e){var i;return(i=t.call(this)||this)._state=void 0,i.dispatcher=void 0,i.dispatcher=e,i._state=i.getInitialState(),e.register(i._handle.bind(fl(i))),i}ul(e,t);var i=e.prototype;return i._handle=function(t){this.handle(t.type,t.payload)},i.setState=function(t){var e=this._state;this._state=t,this.emit("updated",t,e)},dl(e,[{key:"state",get:function(){return this._state}}]),e}(ac),gc=function(t){function e(){return t.apply(this,arguments)||this}ul(e,t);var i=e.prototype;return i.getInitialState=function(){return{keyword:null}},i.handle=function(t,e){"SEARCH_KEYWORD"===t&&this.search(e.keyword)},i.search=function(t){this.setState({keyword:t})},e}(uc),fc=function(){function t(t){this.dispatcher=void 0,this.dispatcher=t}return t.prototype.dispatch=function(t,e){this.dispatcher.dispatch({type:t,payload:e})},t}(),mc=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e.prototype.search=function(t){this.dispatch("SEARCH_KEYWORD",{keyword:t})},e}(fc),vc=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e.prototype._process=function(t){if(!this.props.keyword)return t;var e={};return this.props.url&&(e.url=this.props.url(t.url,this.props.keyword)),this.props.body&&(e.body=this.props.body(t.body,this.props.keyword)),pl({},t,e)},dl(e,[{key:"type",get:function(){return nc.ServerFilter}}]),e}(lc),bc=new(function(){function t(){}var e=t.prototype;return e.format=function(t,e){return"[Grid.js] ["+e.toUpperCase()+"]: "+t},e.error=function(t,e){void 0===e&&(e=!1);var i=this.format(t,"error");if(e)throw Error(i);console.error(i)},e.warn=function(t){console.warn(this.format(t,"warn"))},e.info=function(t){console.info(this.format(t,"info"))},t}()),yc=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e}(tc);!function(t){t[t.Header=0]="Header",t[t.Footer=1]="Footer",t[t.Cell=2]="Cell"}(pc||(pc={}));var _c=function(){function t(){this.plugins=void 0,this.plugins=[]}var e=t.prototype;return e.get=function(t){var e=this.plugins.filter((function(e){return e.id===t}));return e.length>0?e[0]:null},e.add=function(t){return t.id?null!==this.get(t.id)?(bc.error("Duplicate plugin ID: "+t.id),this):(this.plugins.push(t),this):(bc.error("Plugin ID cannot be empty"),this)},e.remove=function(t){return this.plugins.splice(this.plugins.indexOf(this.get(t)),1),this},e.list=function(t){return(null!=t||null!=t?this.plugins.filter((function(e){return e.position===t})):this.plugins).sort((function(t,e){return t.order-e.order}))},t}(),wc=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e.prototype.render=function(){var t=this;if(this.props.pluginId){var e=this.config.plugin.get(this.props.pluginId);return e?Ml(Tl,{},Ml(e.component,pl({plugin:e},e.props,this.props.props))):null}return void 0!==this.props.position?Ml(Tl,{},this.config.plugin.list(this.props.position).map((function(e){return Ml(e.component,pl({plugin:e},e.props,t.props.props))}))):null},e}(tc),xc=function(t){function e(e,i){var n;(n=t.call(this,e,i)||this).searchProcessor=void 0,n.actions=void 0,n.store=void 0,n.storeUpdatedFn=void 0,n.actions=new mc(n.config.dispatcher),n.store=new gc(n.config.dispatcher);var r,o=e.keyword;return e.enabled&&(o&&n.actions.search(o),n.storeUpdatedFn=n.storeUpdated.bind(fl(n)),n.store.on("updated",n.storeUpdatedFn),r=e.server?new vc({keyword:e.keyword,url:e.server.url,body:e.server.body}):new cc({keyword:e.keyword,columns:n.config.header&&n.config.header.columns,ignoreHiddenColumns:e.ignoreHiddenColumns||void 0===e.ignoreHiddenColumns,selector:e.selector}),n.searchProcessor=r,n.config.pipeline.register(r)),n}ul(e,t);var i=e.prototype;return i.componentWillUnmount=function(){this.config.pipeline.unregister(this.searchProcessor),this.store.off("updated",this.storeUpdatedFn)},i.storeUpdated=function(t){this.searchProcessor.setProps({keyword:t.keyword})},i.onChange=function(t){this.actions.search(t.target.value)},i.render=function(){if(!this.props.enabled)return null;var t,e,i,n=this.onChange.bind(this);return this.searchProcessor instanceof vc&&(t=n,e=this.props.debounceTimeout,n=function(){var n=arguments;return new Promise((function(r){i&&clearTimeout(i),i=setTimeout((function(){return r(t.apply(void 0,[].slice.call(n)))}),e)}))}),Ml("div",{className:hc(dc("search",this.config.className.search))},Ml("input",{type:"search",placeholder:this._("search.placeholder"),"aria-label":this._("search.placeholder"),onInput:n,className:dc(hc("input"),hc("search","input")),value:this.store.state.keyword}))},e}(yc);xc.defaultProps={debounceTimeout:250};var kc=function(t){function e(){return t.apply(this,arguments)||this}ul(e,t);var i=e.prototype;return i.validateProps=function(){if(isNaN(Number(this.props.limit))||isNaN(Number(this.props.page)))throw Error("Invalid parameters passed")},i._process=function(t){var e=this.props.page;return new sc(t.rows.slice(e*this.props.limit,(e+1)*this.props.limit))},dl(e,[{key:"type",get:function(){return nc.Limit}}]),e}(lc),Ac=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e.prototype._process=function(t){var e={};return this.props.url&&(e.url=this.props.url(t.url,this.props.page,this.props.limit)),this.props.body&&(e.body=this.props.body(t.body,this.props.page,this.props.limit)),pl({},t,e)},dl(e,[{key:"type",get:function(){return nc.ServerLimit}}]),e}(lc),zc=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this).processor=void 0,n.onUpdateFn=void 0,n.setTotalFromTabularFn=void 0,n.state={limit:e.limit,page:e.page||0,total:0},n}ul(e,t);var i=e.prototype;return i.componentWillMount=function(){var t,e=this;this.props.enabled&&(this.setTotalFromTabularFn=this.setTotalFromTabular.bind(this),this.props.server?(t=new Ac({limit:this.state.limit,page:this.state.page,url:this.props.server.url,body:this.props.server.body}),this.config.pipeline.on("afterProcess",this.setTotalFromTabularFn)):(t=new kc({limit:this.state.limit,page:this.state.page})).on("beforeProcess",this.setTotalFromTabularFn),this.processor=t,this.config.pipeline.register(t),this.config.pipeline.on("error",(function(){e.setState({total:0,page:0})})))},i.setTotalFromTabular=function(t){this.setTotal(t.length)},i.onUpdate=function(t){this.props.resetPageOnUpdate&&t!==this.processor&&this.setPage(0)},i.componentDidMount=function(){this.onUpdateFn=this.onUpdate.bind(this),this.config.pipeline.on("updated",this.onUpdateFn)},i.componentWillUnmount=function(){this.config.pipeline.unregister(this.processor),this.config.pipeline.off("updated",this.onUpdateFn)},i.setPage=function(t){if(t>=this.pages||t<0||t===this.state.page)return null;this.setState({page:t}),this.processor.setProps({page:t})},i.setTotal=function(t){this.setState({total:t})},i.renderPages=function(){var t=this;if(this.props.buttonsCount<=0)return null;var e=Math.min(this.pages,this.props.buttonsCount),i=Math.min(this.state.page,Math.floor(e/2));return this.state.page+Math.floor(e/2)>=this.pages&&(i=e-(this.pages-this.state.page)),Ml(Tl,null,this.pages>e&&this.state.page-i>0&&Ml(Tl,null,Ml("button",{tabIndex:0,role:"button",onClick:this.setPage.bind(this,0),title:this._("pagination.firstPage"),"aria-label":this._("pagination.firstPage"),className:this.config.className.paginationButton},this._("1")),Ml("button",{tabIndex:-1,className:dc(hc("spread"),this.config.className.paginationButton)},"...")),Array.from(Array(e).keys()).map((function(e){return t.state.page+(e-i)})).map((function(e){return Ml("button",{tabIndex:0,role:"button",onClick:t.setPage.bind(t,e),className:dc(t.state.page===e?dc(hc("currentPage"),t.config.className.paginationButtonCurrent):null,t.config.className.paginationButton),title:t._("pagination.page",e+1),"aria-label":t._("pagination.page",e+1)},t._(""+(e+1)))})),this.pages>e&&this.pages>this.state.page+i+1&&Ml(Tl,null,Ml("button",{tabIndex:-1,className:dc(hc("spread"),this.config.className.paginationButton)},"..."),Ml("button",{tabIndex:0,role:"button",onClick:this.setPage.bind(this,this.pages-1),title:this._("pagination.page",this.pages),"aria-label":this._("pagination.page",this.pages),className:this.config.className.paginationButton},this._(""+this.pages))))},i.renderSummary=function(){return Ml(Tl,null,this.props.summary&&this.state.total>0&&Ml("div",{role:"status","aria-live":"polite",className:dc(hc("summary"),this.config.className.paginationSummary),title:this._("pagination.navigate",this.state.page+1,this.pages)},this._("pagination.showing")," ",Ml("b",null,this._(""+(this.state.page*this.state.limit+1)))," ",this._("pagination.to")," ",Ml("b",null,this._(""+Math.min((this.state.page+1)*this.state.limit,this.state.total)))," ",this._("pagination.of")," ",Ml("b",null,this._(""+this.state.total))," ",this._("pagination.results")))},i.render=function(){return this.props.enabled?Ml("div",{className:dc(hc("pagination"),this.config.className.pagination)},this.renderSummary(),Ml("div",{className:hc("pages")},this.props.prevButton&&Ml("button",{tabIndex:0,role:"button",disabled:0===this.state.page,onClick:this.setPage.bind(this,this.state.page-1),title:this._("pagination.previous"),"aria-label":this._("pagination.previous"),className:dc(this.config.className.paginationButton,this.config.className.paginationButtonPrev)},this._("pagination.previous")),this.renderPages(),this.props.nextButton&&Ml("button",{tabIndex:0,role:"button",disabled:this.pages===this.state.page+1||0===this.pages,onClick:this.setPage.bind(this,this.state.page+1),title:this._("pagination.next"),"aria-label":this._("pagination.next"),className:dc(this.config.className.paginationButton,this.config.className.paginationButtonNext)},this._("pagination.next")))):null},dl(e,[{key:"pages",get:function(){return Math.ceil(this.state.total/this.state.limit)}}]),e}(yc);function Sc(t,e){return"string"==typeof t?t.indexOf("%")>-1?e/100*parseInt(t,10):parseInt(t,10):t}function Cc(t){return t?Math.floor(t)+"px":""}zc.defaultProps={summary:!0,nextButton:!0,prevButton:!0,buttonsCount:3,limit:10,resetPageOnUpdate:!0};var Ec=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this).tableElement=void 0,n.tableClassName=void 0,n.tableStyle=void 0,n.tableElement=n.props.tableRef.current.base.cloneNode(!0),n.tableElement.style.position="absolute",n.tableElement.style.width="100%",n.tableElement.style.zIndex="-2147483640",n.tableElement.style.visibility="hidden",n.tableClassName=n.tableElement.className,n.tableStyle=n.tableElement.style.cssText,n}ul(e,t);var i=e.prototype;return i.widths=function(){this.tableElement.className=this.tableClassName+" "+hc("shadowTable"),this.tableElement.style.tableLayout="auto",this.tableElement.style.width="auto",this.tableElement.style.padding="0",this.tableElement.style.margin="0",this.tableElement.style.border="none",this.tableElement.style.outline="none";var t=Array.from(this.base.parentNode.querySelectorAll("thead th")).reduce((function(t,e){var i;return e.style.width=e.clientWidth+"px",pl(((i={})[e.getAttribute("data-column-id")]={minWidth:e.clientWidth},i),t)}),{});return this.tableElement.className=this.tableClassName,this.tableElement.style.cssText=this.tableStyle,this.tableElement.style.tableLayout="auto",Array.from(this.base.parentNode.querySelectorAll("thead th")).reduce((function(t,e){return t[e.getAttribute("data-column-id")].width=e.clientWidth,t}),t)},i.render=function(){var t=this;return this.props.tableRef.current?Ml("div",{ref:function(e){e&&e.appendChild(t.tableElement)}}):null},e}(tc);function Mc(t){if(!t)return"";var e=t.split(" ");return 1===e.length&&/([a-z][A-Z])+/g.test(t)?t:e.map((function(t,e){return 0==e?t.toLowerCase():t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()})).join("")}var Lc=function(t){function e(){var e;return(e=t.call(this)||this)._columns=void 0,e._columns=[],e}ul(e,t);var i=e.prototype;return i.adjustWidth=function(t){var i=t.container,n=t.tableRef,r=t.tempRef,o=t.tempRef||!0;if(!i)return this;var s=i.clientWidth,a={current:null},l={};if(n.current&&o){var c=Ml(Ec,{tableRef:n});c.ref=a,Xl(c,r.current),l=a.current.widths()}for(var h,d=vl(e.tabularFormat(this.columns).reduce((function(t,e){return t.concat(e)}),[]));!(h=d()).done;){var p=h.value;p.columns&&p.columns.length>0||(!p.width&&o?p.id in l&&(p.width=Cc(l[p.id].width),p.minWidth=Cc(l[p.id].minWidth)):p.width=Cc(Sc(p.width,s)))}return n.current&&o&&Xl(null,r.current),this},i.setSort=function(t,e){for(var i,n=vl(e||this.columns||[]);!(i=n()).done;){var r=i.value;r.columns&&r.columns.length>0&&(r.sort={enabled:!1}),void 0===r.sort&&t.sort&&(r.sort={enabled:!0}),r.sort?"object"==typeof r.sort&&(r.sort=pl({enabled:!0},r.sort)):r.sort={enabled:!1},r.columns&&this.setSort(t,r.columns)}},i.setFixedHeader=function(t,e){for(var i,n=vl(e||this.columns||[]);!(i=n()).done;){var r=i.value;void 0===r.fixedHeader&&(r.fixedHeader=t.fixedHeader),r.columns&&this.setFixedHeader(t,r.columns)}},i.setResizable=function(t,e){for(var i,n=vl(e||this.columns||[]);!(i=n()).done;){var r=i.value;void 0===r.resizable&&(r.resizable=t.resizable),r.columns&&this.setResizable(t,r.columns)}},i.setID=function(t){for(var e,i=vl(t||this.columns||[]);!(e=i()).done;){var n=e.value;n.id||"string"!=typeof n.name||(n.id=Mc(n.name)),n.id||bc.error('Could not find a valid ID for one of the columns. Make sure a valid "id" is set for all columns.'),n.columns&&this.setID(n.columns)}},i.populatePlugins=function(t,e){for(var i,n=vl(e);!(i=n()).done;){var r=i.value;void 0!==r.plugin&&t.plugin.add(pl({id:r.id,props:{}},r.plugin,{position:pc.Cell}))}},e.fromColumns=function(t){for(var i,n=new e,r=vl(t);!(i=r()).done;){var o=i.value;if("string"==typeof o||yl(o))n.columns.push({name:o});else if("object"==typeof o){var s=o;s.columns&&(s.columns=e.fromColumns(s.columns).columns),"object"==typeof s.plugin&&void 0===s.data&&(s.data=null),n.columns.push(o)}}return n},e.fromUserConfig=function(t){var i=new e;return t.from?i.columns=e.fromHTMLTable(t.from).columns:t.columns?i.columns=e.fromColumns(t.columns).columns:!t.data||"object"!=typeof t.data[0]||t.data[0]instanceof Array||(i.columns=Object.keys(t.data[0]).map((function(t){return{name:t}}))),i.columns.length?(i.setID(),i.setSort(t),i.setFixedHeader(t),i.setResizable(t),i.populatePlugins(t,i.columns),i):null},e.fromHTMLTable=function(t){for(var i,n=new e,r=vl(t.querySelector("thead").querySelectorAll("th"));!(i=r()).done;){var o=i.value;n.columns.push({name:o.innerHTML,width:o.width})}return n},e.tabularFormat=function(t){var e=[],i=t||[],n=[];if(i&&i.length){e.push(i);for(var r,o=vl(i);!(r=o()).done;){var s=r.value;s.columns&&s.columns.length&&(n=n.concat(s.columns))}n.length&&(e=e.concat(this.tabularFormat(n)))}return e},e.leafColumns=function(t){var e=[],i=t||[];if(i&&i.length)for(var n,r=vl(i);!(n=r()).done;){var o=n.value;o.columns&&0!==o.columns.length||e.push(o),o.columns&&(e=e.concat(this.leafColumns(o.columns)))}return e},e.maximumDepth=function(t){return this.tabularFormat([t]).length-1},dl(e,[{key:"columns",get:function(){return this._columns},set:function(t){this._columns=t}},{key:"visibleColumns",get:function(){return this._columns.filter((function(t){return!t.hidden}))}}]),e}(Ql),Tc=function(){function t(){this._callbacks=void 0,this._isDispatching=void 0,this._isHandled=void 0,this._isPending=void 0,this._lastID=void 0,this._pendingPayload=void 0,this._callbacks={},this._isDispatching=!1,this._isHandled={},this._isPending={},this._lastID=1}var e=t.prototype;return e.register=function(t){var e="ID_"+this._lastID++;return this._callbacks[e]=t,e},e.unregister=function(t){if(!this._callbacks[t])throw Error("Dispatcher.unregister(...): "+t+" does not map to a registered callback.");delete this._callbacks[t]},e.waitFor=function(t){if(!this._isDispatching)throw Error("Dispatcher.waitFor(...): Must be invoked while dispatching.");for(var e=0;e<t.length;e++){var i=t[e];if(this._isPending[i]){if(!this._isHandled[i])throw Error("Dispatcher.waitFor(...): Circular dependency detected while ' +\n 'waiting for "+i+".")}else{if(!this._callbacks[i])throw Error("Dispatcher.waitFor(...): "+i+" does not map to a registered callback.");this._invokeCallback(i)}}},e.dispatch=function(t){if(this._isDispatching)throw Error("Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.");this._startDispatching(t);try{for(var e in this._callbacks)this._isPending[e]||this._invokeCallback(e)}finally{this._stopDispatching()}},e.isDispatching=function(){return this._isDispatching},e._invokeCallback=function(t){this._isPending[t]=!0,this._callbacks[t](this._pendingPayload),this._isHandled[t]=!0},e._startDispatching=function(t){for(var e in this._callbacks)this._isPending[e]=!1,this._isHandled[e]=!1;this._pendingPayload=t,this._isDispatching=!0},e._stopDispatching=function(){delete this._pendingPayload,this._isDispatching=!1},t}(),Hc=function(){},Oc=function(t){function e(e){var i;return(i=t.call(this)||this).data=void 0,i.set(e),i}ul(e,t);var i=e.prototype;return i.get=function(){try{return Promise.resolve(this.data()).then((function(t){return{data:t,total:t.length}}))}catch(t){return Promise.reject(t)}},i.set=function(t){return t instanceof Array?this.data=function(){return t}:t instanceof Function&&(this.data=t),this},e}(Hc),$c=function(t){function e(e){var i;return(i=t.call(this)||this).options=void 0,i.options=e,i}ul(e,t);var i=e.prototype;return i.handler=function(t){return"function"==typeof this.options.handle?this.options.handle(t):t.ok?t.json():(bc.error("Could not fetch data: "+t.status+" - "+t.statusText,!0),null)},i.get=function(t){var e=pl({},this.options,t);return"function"==typeof e.data?e.data(e):fetch(e.url,e).then(this.handler.bind(this)).then((function(t){return{data:e.then(t),total:"function"==typeof e.total?e.total(t):void 0}}))},e}(Hc),Vc=function(){function t(){}return t.createFromUserConfig=function(t){var e=null;return t.data&&(e=new Oc(t.data)),t.from&&(e=new Oc(this.tableElementToArray(t.from)),t.from.style.display="none"),t.server&&(e=new $c(t.server)),e||bc.error("Could not determine the storage type",!0),e},t.tableElementToArray=function(t){for(var e,i,n=[],r=vl(t.querySelector("tbody").querySelectorAll("tr"));!(e=r()).done;){for(var o,s=[],a=vl(e.value.querySelectorAll("td"));!(o=a()).done;){var l=o.value;1===l.childNodes.length&&l.childNodes[0].nodeType===Node.TEXT_NODE?s.push((i=l.innerHTML,(new DOMParser).parseFromString(i,"text/html").documentElement.textContent)):s.push(ic(l.innerHTML))}n.push(s)}return n},t}(),Ic="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function Rc(t,e,i){if(!t.s){if(i instanceof Pc){if(!i.s)return void(i.o=Rc.bind(null,t,e));1&e&&(e=i.s),i=i.v}if(i&&i.then)return void i.then(Rc.bind(null,t,e),Rc.bind(null,t,2));t.s=e,t.v=i;var n=t.o;n&&n(t)}}var Pc=function(){function t(){}return t.prototype.then=function(e,i){var n=new t,r=this.s;if(r){var o=1&r?e:i;if(o){try{Rc(n,1,o(this.v))}catch(t){Rc(n,2,t)}return n}return this}return this.o=function(t){try{var r=t.v;1&t.s?Rc(n,1,e?e(r):r):i?Rc(n,1,i(r)):Rc(n,2,r)}catch(t){Rc(n,2,t)}},n},t}();function Dc(t){return t instanceof Pc&&1&t.s}var Nc,Fc=function(t){function e(e){var i;return(i=t.call(this)||this)._steps=new Map,i.cache=new Map,i.lastProcessorIndexUpdated=-1,e&&e.forEach((function(t){return i.register(t)})),i}ul(e,t);var i=e.prototype;return i.clearCache=function(){this.cache=new Map,this.lastProcessorIndexUpdated=-1},i.register=function(t,e){if(void 0===e&&(e=null),null===t.type)throw Error("Processor type is not defined");t.on("propsUpdated",this.processorPropsUpdated.bind(this)),this.addProcessorByPriority(t,e),this.afterRegistered(t)},i.unregister=function(t){if(t){var e=this._steps.get(t.type);e&&e.length&&(this._steps.set(t.type,e.filter((function(e){return e!=t}))),this.emit("updated",t))}},i.addProcessorByPriority=function(t,e){var i=this._steps.get(t.type);if(!i){var n=[];this._steps.set(t.type,n),i=n}if(null===e||e<0)i.push(t);else if(i[e]){var r=i.slice(0,e-1),o=i.slice(e+1);this._steps.set(t.type,r.concat(t).concat(o))}else i[e]=t},i.getStepsByType=function(t){return this.steps.filter((function(e){return e.type===t}))},i.getSortedProcessorTypes=function(){return Object.keys(nc).filter((function(t){return!isNaN(Number(t))})).map((function(t){return Number(t)}))},i.process=function(t){try{var e=this,i=function(t){return e.lastProcessorIndexUpdated=r.length,e.emit("afterProcess",o),o},n=e.lastProcessorIndexUpdated,r=e.steps,o=t,s=function(t,i){try{var s=function(t,e,i){if("function"==typeof t[Ic]){var n,r,o,s=t[Ic]();if(function t(i){try{for(;!(n=s.next()).done;)if((i=e(n.value))&&i.then){if(!Dc(i))return void i.then(t,o||(o=Rc.bind(null,r=new Pc,2)));i=i.v}r?Rc(r,1,i):r=i}catch(t){Rc(r||(r=new Pc),2,t)}}(),s.return){var a=function(t){try{n.done||s.return()}catch(t){}return t};if(r&&r.then)return r.then(a,(function(t){throw a(t)}));a()}return r}if(!("length"in t))throw new TypeError("Object is not iterable");for(var l=[],c=0;c<t.length;c++)l.push(t[c]);return function(t,e,i){var n,r,o=-1;return function i(s){try{for(;++o<t.length;)if((s=e(o))&&s.then){if(!Dc(s))return void s.then(i,r||(r=Rc.bind(null,n=new Pc,2)));s=s.v}n?Rc(n,1,s):n=s}catch(t){Rc(n||(n=new Pc),2,t)}}(),n}(l,(function(t){return e(l[t])}))}(r,(function(t){var i=e.findProcessorIndexByID(t.id),r=function(){if(i>=n)return Promise.resolve(t.process(o)).then((function(i){e.cache.set(t.id,o=i)}));o=e.cache.get(t.id)}();if(r&&r.then)return r.then((function(){}))}))}catch(t){return i(t)}return s&&s.then?s.then(void 0,i):s}(0,(function(t){throw bc.error(t),e.emit("error",o),t}));return Promise.resolve(s&&s.then?s.then(i):i())}catch(t){return Promise.reject(t)}},i.findProcessorIndexByID=function(t){return this.steps.findIndex((function(e){return e.id==t}))},i.setLastProcessorIndex=function(t){var e=this.findProcessorIndexByID(t.id);this.lastProcessorIndexUpdated>e&&(this.lastProcessorIndexUpdated=e)},i.processorPropsUpdated=function(t){this.setLastProcessorIndex(t),this.emit("propsUpdated"),this.emit("updated",t)},i.afterRegistered=function(t){this.setLastProcessorIndex(t),this.emit("afterRegister"),this.emit("updated",t)},dl(e,[{key:"steps",get:function(){for(var t,e=[],i=vl(this.getSortedProcessorTypes());!(t=i()).done;){var n=this._steps.get(t.value);n&&n.length&&(e=e.concat(n))}return e.filter((function(t){return t}))}}]),e}(ac),Bc=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e.prototype._process=function(t){try{return Promise.resolve(this.props.storage.get(t))}catch(t){return Promise.reject(t)}},dl(e,[{key:"type",get:function(){return nc.Extractor}}]),e}(lc),jc=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e.prototype._process=function(t){var e=sc.fromArray(t.data);return e.length=t.total,e},dl(e,[{key:"type",get:function(){return nc.Transformer}}]),e}(lc),qc=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e.prototype._process=function(){return Object.entries(this.props.serverStorageOptions).filter((function(t){return"function"!=typeof t[1]})).reduce((function(t,e){var i;return pl({},t,((i={})[e[0]]=e[1],i))}),{})},dl(e,[{key:"type",get:function(){return nc.Initiator}}]),e}(lc),Uc=function(t){function e(){return t.apply(this,arguments)||this}ul(e,t);var i=e.prototype;return i.castData=function(t){if(!t||!t.length)return[];if(!this.props.header||!this.props.header.columns)return t;var e=Lc.leafColumns(this.props.header.columns);return t[0]instanceof Array?t.map((function(t){var i=0;return e.map((function(e,n){return void 0!==e.data?(i++,"function"==typeof e.data?e.data(t):e.data):t[n-i]}))})):"object"!=typeof t[0]||t[0]instanceof Array?[]:t.map((function(t){return e.map((function(e,i){return void 0!==e.data?"function"==typeof e.data?e.data(t):e.data:e.id?t[e.id]:(bc.error("Could not find the correct cell for column at position "+i+".\n Make sure either 'id' or 'selector' is defined for all columns."),null)}))}))},i._process=function(t){return{data:this.castData(t.data),total:t.total}},dl(e,[{key:"type",get:function(){return nc.Transformer}}]),e}(lc),Wc=function(){function t(){}return t.createFromConfig=function(t){var e=new Fc;return t.storage instanceof $c&&e.register(new qc({serverStorageOptions:t.server})),e.register(new Bc({storage:t.storage})),e.register(new Uc({header:t.header})),e.register(new jc),e},t}(),Yc=function(){function t(e){this._userConfig=void 0,Object.assign(this,pl({},t.defaultConfig(),e)),this._userConfig={}}var e=t.prototype;return e.assign=function(t){for(var e=0,i=Object.keys(t);e<i.length;e++){var n=i[e];"_userConfig"!==n&&(this[n]=t[n])}return this},e.update=function(e){return e?(this._userConfig=pl({},this._userConfig,e),this.assign(t.fromUserConfig(this._userConfig)),this):this},t.defaultConfig=function(){return{plugin:new _c,dispatcher:new Tc,tableRef:{current:null},tempRef:{current:null},width:"100%",height:"auto",autoWidth:!0,style:{},className:{}}},t.fromUserConfig=function(e){var i=new t(e);return i._userConfig=e,"boolean"==typeof e.sort&&e.sort&&i.assign({sort:{multiColumn:!0}}),i.assign({header:Lc.fromUserConfig(i)}),i.assign({storage:Vc.createFromUserConfig(e)}),i.assign({pipeline:Wc.createFromConfig(i)}),i.assign({translator:new Jl(e.language)}),i.plugin.add({id:"search",position:pc.Header,component:xc,props:pl({enabled:!0===e.search||e.search instanceof Object},e.search)}),i.plugin.add({id:"pagination",position:pc.Footer,component:zc,props:pl({enabled:!0===e.pagination||e.pagination instanceof Object},e.pagination)}),e.plugins&&e.plugins.forEach((function(t){return i.plugin.add(t)})),i},t}();!function(t){t[t.Init=0]="Init",t[t.Loading=1]="Loading",t[t.Loaded=2]="Loaded",t[t.Rendered=3]="Rendered",t[t.Error=4]="Error"}(Nc||(Nc={}));var Gc,Xc,Kc=function(t){function e(){return t.apply(this,arguments)||this}ul(e,t);var i=e.prototype;return i.content=function(){return this.props.column&&"function"==typeof this.props.column.formatter?this.props.column.formatter(this.props.cell.data,this.props.row,this.props.column):this.props.column&&this.props.column.plugin?Ml(wc,{pluginId:this.props.column.id,props:{column:this.props.column,cell:this.props.cell,row:this.props.row}}):this.props.cell.data},i.handleClick=function(t){this.props.messageCell||this.config.eventEmitter.emit("cellClick",t,this.props.cell,this.props.column,this.props.row)},i.getCustomAttributes=function(t){return t?"function"==typeof t.attributes?t.attributes(this.props.cell.data,this.props.row,this.props.column):t.attributes:{}},i.render=function(){return Ml("td",pl({role:this.props.role,colSpan:this.props.colSpan,"data-column-id":this.props.column&&this.props.column.id,className:dc(hc("td"),this.props.className,this.config.className.td),style:pl({},this.props.style,this.config.style.td),onClick:this.handleClick.bind(this)},this.getCustomAttributes(this.props.column)),this.content())},e}(tc),Qc=function(t){function e(){return t.apply(this,arguments)||this}ul(e,t);var i=e.prototype;return i.getColumn=function(t){if(this.props.header){var e=Lc.leafColumns(this.props.header.columns);if(e)return e[t]}return null},i.handleClick=function(t){this.props.messageRow||this.config.eventEmitter.emit("rowClick",t,this.props.row)},i.getChildren=function(){var t=this;return this.props.children?this.props.children:Ml(Tl,null,this.props.row.cells.map((function(e,i){var n=t.getColumn(i);return n&&n.hidden?null:Ml(Kc,{key:e.id,cell:e,row:t.props.row,column:n})})))},i.render=function(){return Ml("tr",{className:dc(hc("tr"),this.config.className.tr),onClick:this.handleClick.bind(this)},this.getChildren())},e}(tc),Zc=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e.prototype.render=function(){return Ml(Qc,{messageRow:!0},Ml(Kc,{role:"alert",colSpan:this.props.colSpan,messageCell:!0,cell:new rc(this.props.message),className:dc(hc("message"),this.props.className?this.props.className:null)}))},e}(tc),Jc=function(t){function e(){return t.apply(this,arguments)||this}ul(e,t);var i=e.prototype;return i.headerLength=function(){return this.props.header?this.props.header.visibleColumns.length:0},i.render=function(){var t=this;return Ml("tbody",{className:dc(hc("tbody"),this.config.className.tbody)},this.props.data&&this.props.data.rows.map((function(e){return Ml(Qc,{key:e.id,row:e,header:t.props.header})})),this.props.status===Nc.Loading&&(!this.props.data||0===this.props.data.length)&&Ml(Zc,{message:this._("loading"),colSpan:this.headerLength(),className:dc(hc("loading"),this.config.className.loading)}),this.props.status===Nc.Rendered&&this.props.data&&0===this.props.data.length&&Ml(Zc,{message:this._("noRecordsFound"),colSpan:this.headerLength(),className:dc(hc("notfound"),this.config.className.notfound)}),this.props.status===Nc.Error&&Ml(Zc,{message:this._("error"),colSpan:this.headerLength(),className:dc(hc("error"),this.config.className.error)}))},e}(tc),th=function(t){function e(){return t.apply(this,arguments)||this}ul(e,t);var i=e.prototype;return i.validateProps=function(){for(var t,e=vl(this.props.columns);!(t=e()).done;){var i=t.value;void 0===i.direction&&(i.direction=1),1!==i.direction&&-1!==i.direction&&bc.error("Invalid sort direction "+i.direction)}},i.compare=function(t,e){return t>e?1:t<e?-1:0},i.compareWrapper=function(t,e){for(var i,n=0,r=vl(this.props.columns);!(i=r()).done;){var o=i.value;if(0!==n)break;var s=t.cells[o.index].data,a=e.cells[o.index].data;n|="function"==typeof o.compare?o.compare(s,a)*o.direction:this.compare(s,a)*o.direction}return n},i._process=function(t){var e=[].concat(t.rows);e.sort(this.compareWrapper.bind(this));var i=new sc(e);return i.length=t.length,i},dl(e,[{key:"type",get:function(){return nc.Sort}}]),e}(lc),eh=function(t){function e(){return t.apply(this,arguments)||this}ul(e,t);var i=e.prototype;return i.getInitialState=function(){return[]},i.handle=function(t,e){"SORT_COLUMN"===t?this.sortColumn(e.index,e.direction,e.multi,e.compare):"SORT_COLUMN_TOGGLE"===t&&this.sortToggle(e.index,e.multi,e.compare)},i.sortToggle=function(t,e,i){var n=[].concat(this.state).find((function(e){return e.index===t}));this.sortColumn(t,n&&1===n.direction?-1:1,e,i)},i.sortColumn=function(t,e,i,n){var r=[].concat(this.state),o=r.length,s=r.find((function(e){return e.index===t})),a=!1,l=!1,c=!1,h=!1;if(void 0!==s?i?-1===s.direction?c=!0:h=!0:1===o?h=!0:o>1&&(l=!0,a=!0):0===o?a=!0:o>0&&!i?(a=!0,l=!0):o>0&&i&&(a=!0),l&&(r=[]),a)r.push({index:t,direction:e,compare:n});else if(h){var d=r.indexOf(s);r[d].direction=e}else if(c){var p=r.indexOf(s);r.splice(p,1)}this.setState(r)},e}(uc),ih=function(t){function e(){return t.apply(this,arguments)||this}ul(e,t);var i=e.prototype;return i.sortColumn=function(t,e,i,n){this.dispatch("SORT_COLUMN",{index:t,direction:e,multi:i,compare:n})},i.sortToggle=function(t,e,i){this.dispatch("SORT_COLUMN_TOGGLE",{index:t,multi:e,compare:i})},e}(fc),nh=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e.prototype._process=function(t){var e={};return this.props.url&&(e.url=this.props.url(t.url,this.props.columns)),this.props.body&&(e.body=this.props.body(t.body,this.props.columns)),pl({},t,e)},dl(e,[{key:"type",get:function(){return nc.ServerSort}}]),e}(lc),rh=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this).sortProcessor=void 0,n.actions=void 0,n.store=void 0,n.updateStateFn=void 0,n.updateSortProcessorFn=void 0,n.actions=new ih(n.config.dispatcher),n.store=new eh(n.config.dispatcher),e.enabled&&(n.sortProcessor=n.getOrCreateSortProcessor(),n.updateStateFn=n.updateState.bind(fl(n)),n.store.on("updated",n.updateStateFn),n.state={direction:0}),n}ul(e,t);var i=e.prototype;return i.componentWillUnmount=function(){this.config.pipeline.unregister(this.sortProcessor),this.store.off("updated",this.updateStateFn),this.updateSortProcessorFn&&this.store.off("updated",this.updateSortProcessorFn)},i.updateState=function(){var t=this,e=this.store.state.find((function(e){return e.index===t.props.index}));this.setState(e?{direction:e.direction}:{direction:0})},i.updateSortProcessor=function(t){this.sortProcessor.setProps({columns:t})},i.getOrCreateSortProcessor=function(){var t=nc.Sort;this.config.sort&&"object"==typeof this.config.sort.server&&(t=nc.ServerSort);var e,i=this.config.pipeline.getStepsByType(t);return i.length>0?e=i[0]:(this.updateSortProcessorFn=this.updateSortProcessor.bind(this),this.store.on("updated",this.updateSortProcessorFn),e=t===nc.ServerSort?new nh(pl({columns:this.store.state},this.config.sort.server)):new th({columns:this.store.state}),this.config.pipeline.register(e)),e},i.changeDirection=function(t){t.preventDefault(),t.stopPropagation(),this.actions.sortToggle(this.props.index,!0===t.shiftKey&&this.config.sort.multiColumn,this.props.compare)},i.render=function(){if(!this.props.enabled)return null;var t=this.state.direction,e="neutral";return 1===t?e="asc":-1===t&&(e="desc"),Ml("button",{tabIndex:-1,"aria-label":this._("sort.sort"+(1===t?"Desc":"Asc")),title:this._("sort.sort"+(1===t?"Desc":"Asc")),className:dc(hc("sort"),hc("sort",e),this.config.className.sort),onClick:this.changeDirection.bind(this)})},e}(tc),oh=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).moveFn=void 0,e.upFn=void 0,e}ul(e,t);var i=e.prototype;return i.getPageX=function(t){return t instanceof MouseEvent?Math.floor(t.pageX):Math.floor(t.changedTouches[0].pageX)},i.start=function(t){var e,i,n,r,o;t.stopPropagation(),this.setState({offsetStart:parseInt(this.props.thRef.current.style.width,10)-this.getPageX(t)}),this.upFn=this.end.bind(this),this.moveFn=(e=this.move.bind(this),void 0===(i=10)&&(i=100),function(){var t=[].slice.call(arguments);n?(clearTimeout(r),r=setTimeout((function(){Date.now()-o>=i&&(e.apply(void 0,t),o=Date.now())}),Math.max(i-(Date.now()-o),0))):(e.apply(void 0,t),o=Date.now(),n=!0)}),document.addEventListener("mouseup",this.upFn),document.addEventListener("touchend",this.upFn),document.addEventListener("mousemove",this.moveFn),document.addEventListener("touchmove",this.moveFn)},i.move=function(t){t.stopPropagation();var e=this.props.thRef.current;this.state.offsetStart+this.getPageX(t)>=parseInt(e.style.minWidth,10)&&(e.style.width=this.state.offsetStart+this.getPageX(t)+"px")},i.end=function(t){t.stopPropagation(),document.removeEventListener("mouseup",this.upFn),document.removeEventListener("mousemove",this.moveFn),document.removeEventListener("touchmove",this.moveFn),document.removeEventListener("touchend",this.upFn)},i.render=function(){return Ml("div",{className:dc(hc("th"),hc("resizable")),onMouseDown:this.start.bind(this),onTouchStart:this.start.bind(this),onClick:function(t){return t.stopPropagation()}})},e}(tc),sh=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this).sortRef={current:null},n.thRef={current:null},n.state={style:{}},n}ul(e,t);var i=e.prototype;return i.isSortable=function(){return this.props.column.sort.enabled},i.isResizable=function(){return this.props.column.resizable},i.onClick=function(t){t.stopPropagation(),this.isSortable()&&this.sortRef.current.changeDirection(t)},i.keyDown=function(t){this.isSortable()&&13===t.which&&this.onClick(t)},i.componentDidMount=function(){var t=this;setTimeout((function(){if(t.props.column.fixedHeader&&t.thRef.current){var e=t.thRef.current.offsetTop;"number"==typeof e&&t.setState({style:{top:e}})}}),0)},i.content=function(){return void 0!==this.props.column.name?this.props.column.name:void 0!==this.props.column.plugin?Ml(wc,{pluginId:this.props.column.plugin.id,props:{column:this.props.column}}):null},i.getCustomAttributes=function(){var t=this.props.column;return t?"function"==typeof t.attributes?t.attributes(null,null,this.props.column):t.attributes:{}},i.render=function(){var t={};return this.isSortable()&&(t.tabIndex=0),Ml("th",pl({ref:this.thRef,"data-column-id":this.props.column&&this.props.column.id,className:dc(hc("th"),this.isSortable()?hc("th","sort"):null,this.props.column.fixedHeader?hc("th","fixed"):null,this.config.className.th),onClick:this.onClick.bind(this),style:pl({},this.config.style.th,{minWidth:this.props.column.minWidth,width:this.props.column.width},this.state.style,this.props.style),onKeyDown:this.keyDown.bind(this),rowSpan:this.props.rowSpan>1?this.props.rowSpan:void 0,colSpan:this.props.colSpan>1?this.props.colSpan:void 0},this.getCustomAttributes(),t),Ml("div",{className:hc("th","content")},this.content()),this.isSortable()&&Ml(rh,pl({ref:this.sortRef,index:this.props.index},this.props.column.sort)),this.isResizable()&&this.props.index<this.config.header.visibleColumns.length-1&&Ml(oh,{column:this.props.column,thRef:this.thRef}))},e}(tc),ah=function(t){function e(){return t.apply(this,arguments)||this}ul(e,t);var i=e.prototype;return i.renderColumn=function(t,e,i,n){var r=function(t,e,i){var n=Lc.maximumDepth(t),r=i-e;return{rowSpan:Math.floor(r-n-n/r),colSpan:t.columns&&t.columns.length||1}}(t,e,n);return Ml(sh,{column:t,index:i,colSpan:r.colSpan,rowSpan:r.rowSpan})},i.renderRow=function(t,e,i){var n=this,r=Lc.leafColumns(this.props.header.columns);return Ml(Qc,null,t.map((function(t){return t.hidden?null:n.renderColumn(t,e,r.indexOf(t),i)})))},i.renderRows=function(){var t=this,e=Lc.tabularFormat(this.props.header.columns);return e.map((function(i,n){return t.renderRow(i,n,e.length)}))},i.render=function(){return this.props.header?Ml("thead",{key:this.props.header.id,className:dc(hc("thead"),this.config.className.thead)},this.renderRows()):null},e}(tc),lh=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e.prototype.render=function(){return Ml("table",{role:"grid",className:dc(hc("table"),this.config.className.table),style:pl({},this.config.style.table,{height:this.props.height})},Ml(ah,{header:this.props.header}),Ml(Jc,{data:this.props.data,status:this.props.status,header:this.props.header}))},e}(tc),ch=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this).headerRef={current:null},n.state={isActive:!0},n}ul(e,t);var i=e.prototype;return i.componentDidMount=function(){0===this.headerRef.current.children.length&&this.setState({isActive:!1})},i.render=function(){return this.state.isActive?Ml("div",{ref:this.headerRef,className:dc(hc("head"),this.config.className.header),style:pl({},this.config.style.header)},Ml(wc,{position:pc.Header})):null},e}(tc),hh=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this).footerRef={current:null},n.state={isActive:!0},n}ul(e,t);var i=e.prototype;return i.componentDidMount=function(){0===this.footerRef.current.children.length&&this.setState({isActive:!1})},i.render=function(){return this.state.isActive?Ml("div",{ref:this.footerRef,className:dc(hc("footer"),this.config.className.footer),style:pl({},this.config.style.footer)},Ml(wc,{position:pc.Footer})):null},e}(tc),dh=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this).configContext=void 0,n.processPipelineFn=void 0,n.configContext=function(t,e){var i={__c:e="__cC"+kl++,__:null,Consumer:function(t,e){return t.children(e)},Provider:function(t){var i,n;return this.getChildContext||(i=[],(n={})[e]=this,this.getChildContext=function(){return n},this.shouldComponentUpdate=function(t){this.props.value!==t.value&&i.some(Vl)},this.sub=function(t){i.push(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){i.splice(i.indexOf(t),1),e&&e.call(t)}}),t.children}};return i.Provider.__=i.Consumer.contextType=i}(),n.state={status:Nc.Loading,header:e.header,data:null},n}ul(e,t);var i=e.prototype;return i.processPipeline=function(){try{var t=this;t.props.config.eventEmitter.emit("beforeLoad"),t.setState({status:Nc.Loading});var e=function(e,i){try{var n=Promise.resolve(t.props.pipeline.process()).then((function(e){t.setState({data:e,status:Nc.Loaded}),t.props.config.eventEmitter.emit("load",e)}))}catch(t){return i(t)}return n&&n.then?n.then(void 0,i):n}(0,(function(e){bc.error(e),t.setState({status:Nc.Error,data:null})}));return Promise.resolve(e&&e.then?e.then((function(){})):void 0)}catch(t){return Promise.reject(t)}},i.componentDidMount=function(){try{var t=this,e=t.props.config;return Promise.resolve(t.processPipeline()).then((function(){e.header&&t.state.data&&t.state.data.length&&t.setState({header:e.header.adjustWidth(e)}),t.processPipelineFn=t.processPipeline.bind(t),t.props.pipeline.on("updated",t.processPipelineFn)}))}catch(t){return Promise.reject(t)}},i.componentWillUnmount=function(){this.props.pipeline.off("updated",this.processPipelineFn)},i.componentDidUpdate=function(t,e){e.status!=Nc.Rendered&&this.state.status==Nc.Loaded&&(this.setState({status:Nc.Rendered}),this.props.config.eventEmitter.emit("ready"))},i.render=function(){return Ml(this.configContext.Provider,{value:this.props.config},Ml("div",{role:"complementary",className:dc("gridjs",hc("container"),this.state.status===Nc.Loading?hc("loading"):null,this.props.config.className.container),style:pl({},this.props.config.style.container,{width:this.props.width})},this.state.status===Nc.Loading&&Ml("div",{className:hc("loading-bar")}),Ml(ch,null),Ml("div",{className:hc("wrapper"),style:{height:this.props.height}},Ml(lh,{ref:this.props.config.tableRef,data:this.state.data,header:this.state.header,width:this.props.width,height:this.props.height,status:this.state.status})),Ml(hh,null),Ml("div",{ref:this.props.config.tempRef,id:"gridjs-temp",className:hc("temp")})))},e}(tc),ph=function(t){function e(e){var i;return(i=t.call(this)||this).config=void 0,i.plugin=void 0,i.config=new Yc({instance:fl(i),eventEmitter:fl(i)}).update(e),i.plugin=i.config.plugin,i}ul(e,t);var i=e.prototype;return i.updateConfig=function(t){return this.config.update(t),this},i.createElement=function(){return Ml(dh,{config:this.config,pipeline:this.config.pipeline,header:this.config.header,width:this.config.width,height:this.config.height})},i.forceRender=function(){return this.config&&this.config.container||bc.error("Container is empty. Make sure you call render() before forceRender()",!0),this.config.pipeline.clearCache(),Xl(null,this.config.container),Xl(this.createElement(),this.config.container),this},i.render=function(t){return t||bc.error("Container element cannot be null",!0),t.childNodes.length>0?(bc.error("The container element "+t+" is not empty. Make sure the container is empty and call render() again"),this):(this.config.container=t,Xl(this.createElement(),t),this)},e}(ac),uh=[],gh=bl.__b,fh=bl.__r,mh=bl.diffed,vh=bl.__c,bh=bl.unmount;function yh(){uh.forEach((function(t){if(t.__P)try{t.__H.__h.forEach(xh),t.__H.__h.forEach(kh),t.__H.__h=[]}catch(e){t.__H.__h=[],bl.__e(e,t.__v)}})),uh=[]}bl.__b=function(t){Gc=null,gh&&gh(t)},bl.__r=function(t){fh&&fh(t),0;var e=(Gc=t.__c).__H;e&&(e.__h.forEach(xh),e.__h.forEach(kh),e.__h=[])},bl.diffed=function(t){mh&&mh(t);var e=t.__c;e&&e.__H&&e.__H.__h.length&&(1!==uh.push(e)&&Xc===bl.requestAnimationFrame||((Xc=bl.requestAnimationFrame)||function(t){var e,i=function(){clearTimeout(n),wh&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(i,100);wh&&(e=requestAnimationFrame(i))})(yh)),Gc=void 0},bl.__c=function(t,e){e.some((function(t){try{t.__h.forEach(xh),t.__h=t.__h.filter((function(t){return!t.__||kh(t)}))}catch(i){e.some((function(t){t.__h&&(t.__h=[])})),e=[],bl.__e(i,t.__v)}})),vh&&vh(t,e)},bl.unmount=function(t){bh&&bh(t);var e=t.__c;if(e&&e.__H)try{e.__H.__.forEach(xh)}catch(t){bl.__e(t,e.__v)}};var _h,wh="function"==typeof requestAnimationFrame;function xh(t){var e=Gc;"function"==typeof t.__c&&t.__c(),Gc=e}function kh(t){var e=Gc;t.__c=t.__(),Gc=e}class Ah extends V{static get properties(){return Object.assign({label:{type:String},property:{type:String},sort:{type:Boolean},width:{type:String}},super.properties)}constructor(){super(),this.label="no-label",this.property=null,this.sort=!1,this.width=null}connectedCallback(){super.connectedCallback()}data(){const t={name:this.label,sort:{enabled:this.sort},formatter:t=>ic(t)};return this.property&&(t.id=this.property),this.width&&(t.width=this.width),t}}customElements.define("pb-table-column",Ah);class zh extends(N(V)){static get properties(){return Object.assign({source:{type:String},cssPath:{type:String,attribute:"css-path"},resizable:{type:Boolean},perPage:{type:Number,attribute:"per-page"},height:{type:String},search:{type:Boolean},_params:{type:Object}},super.properties)}constructor(){super(),this.cssPath="../css/gridjs",this._params={},this.resizable=!1,this.search=!1,this.perPage=10,this.height=null,this.fixedHeader=!1}connectedCallback(){if(super.connectedCallback(),this.subscribeTo("pb-search-resubmit",t=>{this._params=Object.assign({},t.detail.params),this._submit()}),window.addEventListener("popstate",t=>{this._params=t.state,this._submit()}),!this.height){const t=getComputedStyle(this).getPropertyValue("--pb-table-grid-height");this.height=t||"auto"}}firstUpdated(){const t=this.shadowRoot.getElementById("table"),e=this.querySelectorAll("pb-table-column"),i=[];e.forEach(t=>i.push(t.data())),zh.waitOnce("pb-page-ready",()=>{this._params=this.getParameters();const e=this.toAbsoluteURL(this.source),n={height:this.height,fixedHeader:!0,columns:i,resizable:this.resizable,server:{url:e,then:t=>t.results,total:t=>t.count},sort:{multiColumn:!1,enabled:!0,server:{url:(t,e)=>{if(!e.length)return t;const n=e[0];return`${t}${t.indexOf("?")>-1?"&":"?"}order=${i[n.index].id}&dir=${1===n.direction?"asc":"desc"}`}}},pagination:{enabled:!0,limit:this.perPage,server:{url:(t,e,i)=>{const n=this.shadowRoot.getElementById("form");return n&&Object.assign(this._params,n.serializeForm()),this._params.limit=i,this._params.start=e*i+1,this.setParameters(this._params),this.pushHistory("grid",this._params),`${t}${t.indexOf("?")>-1?"&":"?"}${new URLSearchParams(this._params).toString()}`}}}};this.grid=new ph(n),this.grid.on("load",()=>{this.emitTo("pb-results-received",{params:this._params})}),this.grid.render(t)})}_submit(){this.grid.forceRender()}render(){const t=D(this.cssPath);return R`
|
|
4230
|
+
`}}function hl(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function dl(t,e,i){return e&&hl(t.prototype,e),i&&hl(t,i),t}function pl(){return(pl=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t}).apply(this,arguments)}function ul(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,gl(t,e)}function gl(t,e){return(gl=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function fl(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ml(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function vl(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return ml(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?ml(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}customElements.define("pb-blacklab-highlight",cl);var bl,yl,_l,wl,xl,kl,Al={},zl=[],Sl=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function Cl(t,e){for(var i in e)t[i]=e[i];return t}function El(t){var e=t.parentNode;e&&e.removeChild(t)}function Ml(t,e,i){var n,r,o,s=arguments,a={};for(o in e)"key"==o?n=e[o]:"ref"==o?r=e[o]:a[o]=e[o];if(arguments.length>3)for(i=[i],o=3;o<arguments.length;o++)i.push(s[o]);if(null!=i&&(a.children=i),"function"==typeof t&&null!=t.defaultProps)for(o in t.defaultProps)void 0===a[o]&&(a[o]=t.defaultProps[o]);return Ll(t,a,n,r,null)}function Ll(t,e,i,n,r){var o={type:t,props:e,key:i,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++bl.__v:r};return null!=bl.vnode&&bl.vnode(o),o}function Tl(t){return t.children}function Hl(t,e){this.props=t,this.context=e}function Ol(t,e){if(null==e)return t.__?Ol(t.__,t.__.__k.indexOf(t)+1):null;for(var i;e<t.__k.length;e++)if(null!=(i=t.__k[e])&&null!=i.__e)return i.__e;return"function"==typeof t.type?Ol(t):null}function $l(t){var e,i;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if(null!=(i=t.__k[e])&&null!=i.__e){t.__e=t.__c.base=i.__e;break}return $l(t)}}function Vl(t){(!t.__d&&(t.__d=!0)&&_l.push(t)&&!Il.__r++||xl!==bl.debounceRendering)&&((xl=bl.debounceRendering)||wl)(Il)}function Il(){for(var t;Il.__r=_l.length;)t=_l.sort((function(t,e){return t.__v.__b-e.__v.__b})),_l=[],t.some((function(t){var e,i,n,r,o,s;t.__d&&(o=(r=(e=t).__v).__e,(s=e.__P)&&(i=[],(n=Cl({},r)).__v=r.__v+1,ql(s,r,n,e.__n,void 0!==s.ownerSVGElement,null!=r.__h?[o]:null,i,null==o?Ol(r):o,r.__h),Ul(i,r),r.__e!=o&&$l(r)))}))}function Rl(t,e,i,n,r,o,s,a,l,c){var h,d,p,u,g,f,m,v=n&&n.__k||zl,b=v.length;for(i.__k=[],h=0;h<e.length;h++)if(null!=(u=i.__k[h]=null==(u=e[h])||"boolean"==typeof u?null:"string"==typeof u||"number"==typeof u||"bigint"==typeof u?Ll(null,u,null,null,u):Array.isArray(u)?Ll(Tl,{children:u},null,null,null):u.__b>0?Ll(u.type,u.props,u.key,null,u.__v):u)){if(u.__=i,u.__b=i.__b+1,null===(p=v[h])||p&&u.key==p.key&&u.type===p.type)v[h]=void 0;else for(d=0;d<b;d++){if((p=v[d])&&u.key==p.key&&u.type===p.type){v[d]=void 0;break}p=null}ql(t,u,p=p||Al,r,o,s,a,l,c),g=u.__e,(d=u.ref)&&p.ref!=d&&(m||(m=[]),p.ref&&m.push(p.ref,null,u),m.push(d,u.__c||g,u)),null!=g?(null==f&&(f=g),"function"==typeof u.type&&null!=u.__k&&u.__k===p.__k?u.__d=l=Pl(u,l,t):l=Dl(t,u,p,v,g,l),c||"option"!==i.type?"function"==typeof i.type&&(i.__d=l):t.value=""):l&&p.__e==l&&l.parentNode!=t&&(l=Ol(p))}for(i.__e=f,h=b;h--;)null!=v[h]&&("function"==typeof i.type&&null!=v[h].__e&&v[h].__e==i.__d&&(i.__d=Ol(n,h+1)),Yl(v[h],v[h]));if(m)for(h=0;h<m.length;h++)Wl(m[h],m[++h],m[++h])}function Pl(t,e,i){var n,r;for(n=0;n<t.__k.length;n++)(r=t.__k[n])&&(r.__=t,e="function"==typeof r.type?Pl(r,e,i):Dl(i,r,r,t.__k,r.__e,e));return e}function Dl(t,e,i,n,r,o){var s,a,l;if(void 0!==e.__d)s=e.__d,e.__d=void 0;else if(null==i||r!=o||null==r.parentNode)t:if(null==o||o.parentNode!==t)t.appendChild(r),s=null;else{for(a=o,l=0;(a=a.nextSibling)&&l<n.length;l+=2)if(a==r)break t;t.insertBefore(r,o),s=o}return void 0!==s?s:r.nextSibling}function Nl(t,e,i){"-"===e[0]?t.setProperty(e,i):t[e]=null==i?"":"number"!=typeof i||Sl.test(e)?i:i+"px"}function Fl(t,e,i,n,r){var o;t:if("style"===e)if("string"==typeof i)t.style.cssText=i;else{if("string"==typeof n&&(t.style.cssText=n=""),n)for(e in n)i&&e in i||Nl(t.style,e,"");if(i)for(e in i)n&&i[e]===n[e]||Nl(t.style,e,i[e])}else if("o"===e[0]&&"n"===e[1])o=e!==(e=e.replace(/Capture$/,"")),e=e.toLowerCase()in t?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=i,i?n||t.addEventListener(e,o?jl:Bl,o):t.removeEventListener(e,o?jl:Bl,o);else if("dangerouslySetInnerHTML"!==e){if(r)e=e.replace(/xlink[H:h]/,"h").replace(/sName$/,"s");else if("href"!==e&&"list"!==e&&"form"!==e&&"tabIndex"!==e&&"download"!==e&&e in t)try{t[e]=null==i?"":i;break t}catch(t){}"function"==typeof i||(null!=i&&(!1!==i||"a"===e[0]&&"r"===e[1])?t.setAttribute(e,i):t.removeAttribute(e))}}function Bl(t){this.l[t.type+!1](bl.event?bl.event(t):t)}function jl(t){this.l[t.type+!0](bl.event?bl.event(t):t)}function ql(t,e,i,n,r,o,s,a,l){var c,h,d,p,u,g,f,m,v,b,y,_=e.type;if(void 0!==e.constructor)return null;null!=i.__h&&(l=i.__h,a=e.__e=i.__e,e.__h=null,o=[a]),(c=bl.__b)&&c(e);try{t:if("function"==typeof _){if(m=e.props,v=(c=_.contextType)&&n[c.__c],b=c?v?v.props.value:c.__:n,i.__c?f=(h=e.__c=i.__c).__=h.__E:("prototype"in _&&_.prototype.render?e.__c=h=new _(m,b):(e.__c=h=new Hl(m,b),h.constructor=_,h.render=Gl),v&&v.sub(h),h.props=m,h.state||(h.state={}),h.context=b,h.__n=n,d=h.__d=!0,h.__h=[]),null==h.__s&&(h.__s=h.state),null!=_.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=Cl({},h.__s)),Cl(h.__s,_.getDerivedStateFromProps(m,h.__s))),p=h.props,u=h.state,d)null==_.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(null==_.getDerivedStateFromProps&&m!==p&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(m,b),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(m,h.__s,b)||e.__v===i.__v){h.props=m,h.state=h.__s,e.__v!==i.__v&&(h.__d=!1),h.__v=e,e.__e=i.__e,e.__k=i.__k,e.__k.forEach((function(t){t&&(t.__=e)})),h.__h.length&&s.push(h);break t}null!=h.componentWillUpdate&&h.componentWillUpdate(m,h.__s,b),null!=h.componentDidUpdate&&h.__h.push((function(){h.componentDidUpdate(p,u,g)}))}h.context=b,h.props=m,h.state=h.__s,(c=bl.__r)&&c(e),h.__d=!1,h.__v=e,h.__P=t,c=h.render(h.props,h.state,h.context),h.state=h.__s,null!=h.getChildContext&&(n=Cl(Cl({},n),h.getChildContext())),d||null==h.getSnapshotBeforeUpdate||(g=h.getSnapshotBeforeUpdate(p,u)),y=null!=c&&c.type===Tl&&null==c.key?c.props.children:c,Rl(t,Array.isArray(y)?y:[y],e,i,n,r,o,s,a,l),h.base=e.__e,e.__h=null,h.__h.length&&s.push(h),f&&(h.__E=h.__=null),h.__e=!1}else null==o&&e.__v===i.__v?(e.__k=i.__k,e.__e=i.__e):e.__e=function(t,e,i,n,r,o,s,a){var l,c,h,d,p=i.props,u=e.props,g=e.type,f=0;if("svg"===g&&(r=!0),null!=o)for(;f<o.length;f++)if((l=o[f])&&(l===t||(g?l.localName==g:3==l.nodeType))){t=l,o[f]=null;break}if(null==t){if(null===g)return document.createTextNode(u);t=r?document.createElementNS("http://www.w3.org/2000/svg",g):document.createElement(g,u.is&&u),o=null,a=!1}if(null===g)p===u||a&&t.data===u||(t.data=u);else{if(o=o&&zl.slice.call(t.childNodes),c=(p=i.props||Al).dangerouslySetInnerHTML,h=u.dangerouslySetInnerHTML,!a){if(null!=o)for(p={},d=0;d<t.attributes.length;d++)p[t.attributes[d].name]=t.attributes[d].value;(h||c)&&(h&&(c&&h.__html==c.__html||h.__html===t.innerHTML)||(t.innerHTML=h&&h.__html||""))}if(function(t,e,i,n,r){var o;for(o in i)"children"===o||"key"===o||o in e||Fl(t,o,null,i[o],n);for(o in e)r&&"function"!=typeof e[o]||"children"===o||"key"===o||"value"===o||"checked"===o||i[o]===e[o]||Fl(t,o,e[o],i[o],n)}(t,u,p,r,a),h)e.__k=[];else if(f=e.props.children,Rl(t,Array.isArray(f)?f:[f],e,i,n,r&&"foreignObject"!==g,o,s,t.firstChild,a),null!=o)for(f=o.length;f--;)null!=o[f]&&El(o[f]);a||("value"in u&&void 0!==(f=u.value)&&(f!==t.value||"progress"===g&&!f)&&Fl(t,"value",f,p.value,!1),"checked"in u&&void 0!==(f=u.checked)&&f!==t.checked&&Fl(t,"checked",f,p.checked,!1))}return t}(i.__e,e,i,n,r,o,s,l);(c=bl.diffed)&&c(e)}catch(t){e.__v=null,(l||null!=o)&&(e.__e=a,e.__h=!!l,o[o.indexOf(a)]=null),bl.__e(t,e,i)}}function Ul(t,e){bl.__c&&bl.__c(e,t),t.some((function(e){try{t=e.__h,e.__h=[],t.some((function(t){t.call(e)}))}catch(t){bl.__e(t,e.__v)}}))}function Wl(t,e,i){try{"function"==typeof t?t(e):t.current=e}catch(t){bl.__e(t,i)}}function Yl(t,e,i){var n,r,o;if(bl.unmount&&bl.unmount(t),(n=t.ref)&&(n.current&&n.current!==t.__e||Wl(n,null,e)),i||"function"==typeof t.type||(i=null!=(r=t.__e)),t.__e=t.__d=void 0,null!=(n=t.__c)){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(t){bl.__e(t,e)}n.base=n.__P=null}if(n=t.__k)for(o=0;o<n.length;o++)n[o]&&Yl(n[o],e,i);null!=r&&El(r)}function Gl(t,e,i){return this.constructor(t,i)}function Xl(t,e,i){var n,r,o;bl.__&&bl.__(t,e),r=(n="function"==typeof i)?null:i&&i.__k||e.__k,o=[],ql(e,t=(!n&&i||e).__k=Ml(Tl,null,[t]),r||Al,Al,void 0!==e.ownerSVGElement,!n&&i?[i]:r?null:e.firstChild?zl.slice.call(e.childNodes):null,o,!n&&i?i:r?r.__e:e.firstChild,n),Ul(o,t)}function Kl(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}))}bl={__e:function(t,e){for(var i,n,r;e=e.__;)if((i=e.__c)&&!i.__)try{if((n=i.constructor)&&null!=n.getDerivedStateFromError&&(i.setState(n.getDerivedStateFromError(t)),r=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(t),r=i.__d),r)return i.__E=i}catch(e){t=e}throw t},__v:0},yl=function(t){return null!=t&&void 0===t.constructor},Hl.prototype.setState=function(t,e){var i;i=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=Cl({},this.state),"function"==typeof t&&(t=t(Cl({},i),this.props)),t&&Cl(i,t),null!=t&&this.__v&&(e&&this.__h.push(e),Vl(this))},Hl.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Vl(this))},Hl.prototype.render=Tl,_l=[],wl="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Il.__r=0,kl=0;var Ql=function(){function t(t){this._id=void 0,this._id=t||Kl()}return dl(t,[{key:"id",get:function(){return this._id}}]),t}(),Zl={search:{placeholder:"Type a keyword..."},sort:{sortAsc:"Sort column ascending",sortDesc:"Sort column descending"},pagination:{previous:"Previous",next:"Next",navigate:function(t,e){return"Page "+t+" of "+e},page:function(t){return"Page "+t},showing:"Showing",of:"of",to:"to",results:"results"},loading:"Loading...",noRecordsFound:"No matching records found",error:"An error happened while fetching the data"},Jl=function(){function t(t){this._language=void 0,this._defaultLanguage=void 0,this._language=t,this._defaultLanguage=Zl}var e=t.prototype;return e.getString=function(t,e){if(!e||!t)return null;var i=t.split("."),n=i[0];if(e[n]){var r=e[n];return"string"==typeof r?function(){return r}:"function"==typeof r?r:this.getString(i.slice(1).join("."),r)}return null},e.translate=function(t){var e;return(e=this.getString(t,this._language)||this.getString(t,this._defaultLanguage))?e.apply(void 0,[].slice.call(arguments,1)):t},t}(),tc=function(t){function e(e,i){var n,r;return(n=t.call(this,e,i)||this).config=void 0,n._=void 0,n.config=function(t){if(!t)return null;var e=Object.keys(t);return e.length?t[e[0]].props.value:null}(i),n.config&&(n._=(r=n.config.translator,function(t){return r.translate.apply(r,[t].concat([].slice.call(arguments,1)))})),n}return ul(e,t),e}(Hl),ec=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e.prototype.render=function(){return Ml(this.props.parentElement,{dangerouslySetInnerHTML:{__html:this.props.content}})},e}(tc);function ic(t,e){return Ml(ec,{content:t,parentElement:e})}ec.defaultProps={parentElement:"span"};var nc,rc=function(t){function e(e){var i;return(i=t.call(this)||this).data=void 0,i.update(e),i}ul(e,t);var i=e.prototype;return i.cast=function(t){return t instanceof HTMLElement?ic(t.outerHTML):t},i.update=function(t){return this.data=this.cast(t),this},e}(Ql),oc=function(t){function e(e){var i;return(i=t.call(this)||this)._cells=void 0,i.cells=e||[],i}ul(e,t);var i=e.prototype;return i.cell=function(t){return this._cells[t]},i.toArray=function(){return this.cells.map((function(t){return t.data}))},e.fromCells=function(t){return new e(t.map((function(t){return new rc(t.data)})))},dl(e,[{key:"cells",get:function(){return this._cells},set:function(t){this._cells=t}},{key:"length",get:function(){return this.cells.length}}]),e}(Ql),sc=function(t){function e(e){var i;return(i=t.call(this)||this)._rows=void 0,i._length=void 0,i.rows=e instanceof Array?e:e instanceof oc?[e]:[],i}return ul(e,t),e.prototype.toArray=function(){return this.rows.map((function(t){return t.toArray()}))},e.fromRows=function(t){return new e(t.map((function(t){return oc.fromCells(t.cells)})))},e.fromArray=function(t){return new e((t=function(t){return!t[0]||t[0]instanceof Array?t:[t]}(t)).map((function(t){return new oc(t.map((function(t){return new rc(t)})))})))},dl(e,[{key:"rows",get:function(){return this._rows},set:function(t){this._rows=t}},{key:"length",get:function(){return this._length||this.rows.length},set:function(t){this._length=t}}]),e}(Ql),ac=function(){function t(){this.callbacks=void 0}var e=t.prototype;return e.init=function(t){this.callbacks||(this.callbacks={}),t&&!this.callbacks[t]&&(this.callbacks[t]=[])},e.on=function(t,e){return this.init(t),this.callbacks[t].push(e),this},e.off=function(t,e){var i=t;return this.init(),this.callbacks[i]&&0!==this.callbacks[i].length?(this.callbacks[i]=this.callbacks[i].filter((function(t){return t!=e})),this):this},e.emit=function(t){var e=arguments,i=t;return this.init(i),this.callbacks[i].length>0&&(this.callbacks[i].forEach((function(t){return t.apply(void 0,[].slice.call(e,1))})),!0)},t}();!function(t){t[t.Initiator=0]="Initiator",t[t.ServerFilter=1]="ServerFilter",t[t.ServerSort=2]="ServerSort",t[t.ServerLimit=3]="ServerLimit",t[t.Extractor=4]="Extractor",t[t.Transformer=5]="Transformer",t[t.Filter=6]="Filter",t[t.Sort=7]="Sort",t[t.Limit=8]="Limit"}(nc||(nc={}));var lc=function(t){function e(e){var i;return(i=t.call(this)||this).id=void 0,i._props=void 0,i._props={},i.id=Kl(),e&&i.setProps(e),i}ul(e,t);var i=e.prototype;return i.process=function(){var t=[].slice.call(arguments);this.validateProps instanceof Function&&this.validateProps.apply(this,t),this.emit.apply(this,["beforeProcess"].concat(t));var e=this._process.apply(this,t);return this.emit.apply(this,["afterProcess"].concat(t)),e},i.setProps=function(t){return Object.assign(this._props,t),this.emit("propsUpdated",this),this},dl(e,[{key:"props",get:function(){return this._props}}]),e}(ac),cc=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e.prototype._process=function(t){return this.props.keyword?(e=String(this.props.keyword).trim(),i=this.props.columns,n=this.props.ignoreHiddenColumns,r=t,o=this.props.selector,e=e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),new sc(r.rows.filter((function(t,r){return t.cells.some((function(t,s){if(!t)return!1;if(n&&i&&i[s]&&"object"==typeof i[s]&&i[s].hidden)return!1;var a="";if("function"==typeof o)a=o(t.data,r,s);else if("object"==typeof t.data){var l=t.data;l&&l.props&&l.props.content&&(a=l.props.content)}else a=String(t.data);return new RegExp(e,"gi").test(a)}))})))):t;var e,i,n,r,o},dl(e,[{key:"type",get:function(){return nc.Filter}}]),e}(lc);function hc(){return""+"gridjs"+[].slice.call(arguments).reduce((function(t,e){return t+"-"+e}),"")}function dc(){return[].slice.call(arguments).filter((function(t){return t})).reduce((function(t,e){return(t||"")+" "+e}),"").trim()||null}var pc,uc=function(t){function e(e){var i;return(i=t.call(this)||this)._state=void 0,i.dispatcher=void 0,i.dispatcher=e,i._state=i.getInitialState(),e.register(i._handle.bind(fl(i))),i}ul(e,t);var i=e.prototype;return i._handle=function(t){this.handle(t.type,t.payload)},i.setState=function(t){var e=this._state;this._state=t,this.emit("updated",t,e)},dl(e,[{key:"state",get:function(){return this._state}}]),e}(ac),gc=function(t){function e(){return t.apply(this,arguments)||this}ul(e,t);var i=e.prototype;return i.getInitialState=function(){return{keyword:null}},i.handle=function(t,e){"SEARCH_KEYWORD"===t&&this.search(e.keyword)},i.search=function(t){this.setState({keyword:t})},e}(uc),fc=function(){function t(t){this.dispatcher=void 0,this.dispatcher=t}return t.prototype.dispatch=function(t,e){this.dispatcher.dispatch({type:t,payload:e})},t}(),mc=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e.prototype.search=function(t){this.dispatch("SEARCH_KEYWORD",{keyword:t})},e}(fc),vc=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e.prototype._process=function(t){if(!this.props.keyword)return t;var e={};return this.props.url&&(e.url=this.props.url(t.url,this.props.keyword)),this.props.body&&(e.body=this.props.body(t.body,this.props.keyword)),pl({},t,e)},dl(e,[{key:"type",get:function(){return nc.ServerFilter}}]),e}(lc),bc=new(function(){function t(){}var e=t.prototype;return e.format=function(t,e){return"[Grid.js] ["+e.toUpperCase()+"]: "+t},e.error=function(t,e){void 0===e&&(e=!1);var i=this.format(t,"error");if(e)throw Error(i);console.error(i)},e.warn=function(t){console.warn(this.format(t,"warn"))},e.info=function(t){console.info(this.format(t,"info"))},t}()),yc=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e}(tc);!function(t){t[t.Header=0]="Header",t[t.Footer=1]="Footer",t[t.Cell=2]="Cell"}(pc||(pc={}));var _c=function(){function t(){this.plugins=void 0,this.plugins=[]}var e=t.prototype;return e.get=function(t){var e=this.plugins.filter((function(e){return e.id===t}));return e.length>0?e[0]:null},e.add=function(t){return t.id?null!==this.get(t.id)?(bc.error("Duplicate plugin ID: "+t.id),this):(this.plugins.push(t),this):(bc.error("Plugin ID cannot be empty"),this)},e.remove=function(t){return this.plugins.splice(this.plugins.indexOf(this.get(t)),1),this},e.list=function(t){return(null!=t||null!=t?this.plugins.filter((function(e){return e.position===t})):this.plugins).sort((function(t,e){return t.order-e.order}))},t}(),wc=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e.prototype.render=function(){var t=this;if(this.props.pluginId){var e=this.config.plugin.get(this.props.pluginId);return e?Ml(Tl,{},Ml(e.component,pl({plugin:e},e.props,this.props.props))):null}return void 0!==this.props.position?Ml(Tl,{},this.config.plugin.list(this.props.position).map((function(e){return Ml(e.component,pl({plugin:e},e.props,t.props.props))}))):null},e}(tc),xc=function(t){function e(e,i){var n;(n=t.call(this,e,i)||this).searchProcessor=void 0,n.actions=void 0,n.store=void 0,n.storeUpdatedFn=void 0,n.actions=new mc(n.config.dispatcher),n.store=new gc(n.config.dispatcher);var r,o=e.keyword;return e.enabled&&(o&&n.actions.search(o),n.storeUpdatedFn=n.storeUpdated.bind(fl(n)),n.store.on("updated",n.storeUpdatedFn),r=e.server?new vc({keyword:e.keyword,url:e.server.url,body:e.server.body}):new cc({keyword:e.keyword,columns:n.config.header&&n.config.header.columns,ignoreHiddenColumns:e.ignoreHiddenColumns||void 0===e.ignoreHiddenColumns,selector:e.selector}),n.searchProcessor=r,n.config.pipeline.register(r)),n}ul(e,t);var i=e.prototype;return i.componentWillUnmount=function(){this.config.pipeline.unregister(this.searchProcessor),this.store.off("updated",this.storeUpdatedFn)},i.storeUpdated=function(t){this.searchProcessor.setProps({keyword:t.keyword})},i.onChange=function(t){this.actions.search(t.target.value)},i.render=function(){if(!this.props.enabled)return null;var t,e,i,n=this.onChange.bind(this);return this.searchProcessor instanceof vc&&(t=n,e=this.props.debounceTimeout,n=function(){var n=arguments;return new Promise((function(r){i&&clearTimeout(i),i=setTimeout((function(){return r(t.apply(void 0,[].slice.call(n)))}),e)}))}),Ml("div",{className:hc(dc("search",this.config.className.search))},Ml("input",{type:"search",placeholder:this._("search.placeholder"),"aria-label":this._("search.placeholder"),onInput:n,className:dc(hc("input"),hc("search","input")),value:this.store.state.keyword}))},e}(yc);xc.defaultProps={debounceTimeout:250};var kc=function(t){function e(){return t.apply(this,arguments)||this}ul(e,t);var i=e.prototype;return i.validateProps=function(){if(isNaN(Number(this.props.limit))||isNaN(Number(this.props.page)))throw Error("Invalid parameters passed")},i._process=function(t){var e=this.props.page;return new sc(t.rows.slice(e*this.props.limit,(e+1)*this.props.limit))},dl(e,[{key:"type",get:function(){return nc.Limit}}]),e}(lc),Ac=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e.prototype._process=function(t){var e={};return this.props.url&&(e.url=this.props.url(t.url,this.props.page,this.props.limit)),this.props.body&&(e.body=this.props.body(t.body,this.props.page,this.props.limit)),pl({},t,e)},dl(e,[{key:"type",get:function(){return nc.ServerLimit}}]),e}(lc),zc=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this).processor=void 0,n.onUpdateFn=void 0,n.setTotalFromTabularFn=void 0,n.state={limit:e.limit,page:e.page||0,total:0},n}ul(e,t);var i=e.prototype;return i.componentWillMount=function(){var t,e=this;this.props.enabled&&(this.setTotalFromTabularFn=this.setTotalFromTabular.bind(this),this.props.server?(t=new Ac({limit:this.state.limit,page:this.state.page,url:this.props.server.url,body:this.props.server.body}),this.config.pipeline.on("afterProcess",this.setTotalFromTabularFn)):(t=new kc({limit:this.state.limit,page:this.state.page})).on("beforeProcess",this.setTotalFromTabularFn),this.processor=t,this.config.pipeline.register(t),this.config.pipeline.on("error",(function(){e.setState({total:0,page:0})})))},i.setTotalFromTabular=function(t){this.setTotal(t.length)},i.onUpdate=function(t){this.props.resetPageOnUpdate&&t!==this.processor&&this.setPage(0)},i.componentDidMount=function(){this.onUpdateFn=this.onUpdate.bind(this),this.config.pipeline.on("updated",this.onUpdateFn)},i.componentWillUnmount=function(){this.config.pipeline.unregister(this.processor),this.config.pipeline.off("updated",this.onUpdateFn)},i.setPage=function(t){if(t>=this.pages||t<0||t===this.state.page)return null;this.setState({page:t}),this.processor.setProps({page:t})},i.setTotal=function(t){this.setState({total:t})},i.renderPages=function(){var t=this;if(this.props.buttonsCount<=0)return null;var e=Math.min(this.pages,this.props.buttonsCount),i=Math.min(this.state.page,Math.floor(e/2));return this.state.page+Math.floor(e/2)>=this.pages&&(i=e-(this.pages-this.state.page)),Ml(Tl,null,this.pages>e&&this.state.page-i>0&&Ml(Tl,null,Ml("button",{tabIndex:0,role:"button",onClick:this.setPage.bind(this,0),title:this._("pagination.firstPage"),"aria-label":this._("pagination.firstPage"),className:this.config.className.paginationButton},this._("1")),Ml("button",{tabIndex:-1,className:dc(hc("spread"),this.config.className.paginationButton)},"...")),Array.from(Array(e).keys()).map((function(e){return t.state.page+(e-i)})).map((function(e){return Ml("button",{tabIndex:0,role:"button",onClick:t.setPage.bind(t,e),className:dc(t.state.page===e?dc(hc("currentPage"),t.config.className.paginationButtonCurrent):null,t.config.className.paginationButton),title:t._("pagination.page",e+1),"aria-label":t._("pagination.page",e+1)},t._(""+(e+1)))})),this.pages>e&&this.pages>this.state.page+i+1&&Ml(Tl,null,Ml("button",{tabIndex:-1,className:dc(hc("spread"),this.config.className.paginationButton)},"..."),Ml("button",{tabIndex:0,role:"button",onClick:this.setPage.bind(this,this.pages-1),title:this._("pagination.page",this.pages),"aria-label":this._("pagination.page",this.pages),className:this.config.className.paginationButton},this._(""+this.pages))))},i.renderSummary=function(){return Ml(Tl,null,this.props.summary&&this.state.total>0&&Ml("div",{role:"status","aria-live":"polite",className:dc(hc("summary"),this.config.className.paginationSummary),title:this._("pagination.navigate",this.state.page+1,this.pages)},this._("pagination.showing")," ",Ml("b",null,this._(""+(this.state.page*this.state.limit+1)))," ",this._("pagination.to")," ",Ml("b",null,this._(""+Math.min((this.state.page+1)*this.state.limit,this.state.total)))," ",this._("pagination.of")," ",Ml("b",null,this._(""+this.state.total))," ",this._("pagination.results")))},i.render=function(){return this.props.enabled?Ml("div",{className:dc(hc("pagination"),this.config.className.pagination)},this.renderSummary(),Ml("div",{className:hc("pages")},this.props.prevButton&&Ml("button",{tabIndex:0,role:"button",disabled:0===this.state.page,onClick:this.setPage.bind(this,this.state.page-1),title:this._("pagination.previous"),"aria-label":this._("pagination.previous"),className:dc(this.config.className.paginationButton,this.config.className.paginationButtonPrev)},this._("pagination.previous")),this.renderPages(),this.props.nextButton&&Ml("button",{tabIndex:0,role:"button",disabled:this.pages===this.state.page+1||0===this.pages,onClick:this.setPage.bind(this,this.state.page+1),title:this._("pagination.next"),"aria-label":this._("pagination.next"),className:dc(this.config.className.paginationButton,this.config.className.paginationButtonNext)},this._("pagination.next")))):null},dl(e,[{key:"pages",get:function(){return Math.ceil(this.state.total/this.state.limit)}}]),e}(yc);function Sc(t,e){return"string"==typeof t?t.indexOf("%")>-1?e/100*parseInt(t,10):parseInt(t,10):t}function Cc(t){return t?Math.floor(t)+"px":""}zc.defaultProps={summary:!0,nextButton:!0,prevButton:!0,buttonsCount:3,limit:10,resetPageOnUpdate:!0};var Ec=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this).tableElement=void 0,n.tableClassName=void 0,n.tableStyle=void 0,n.tableElement=n.props.tableRef.current.base.cloneNode(!0),n.tableElement.style.position="absolute",n.tableElement.style.width="100%",n.tableElement.style.zIndex="-2147483640",n.tableElement.style.visibility="hidden",n.tableClassName=n.tableElement.className,n.tableStyle=n.tableElement.style.cssText,n}ul(e,t);var i=e.prototype;return i.widths=function(){this.tableElement.className=this.tableClassName+" "+hc("shadowTable"),this.tableElement.style.tableLayout="auto",this.tableElement.style.width="auto",this.tableElement.style.padding="0",this.tableElement.style.margin="0",this.tableElement.style.border="none",this.tableElement.style.outline="none";var t=Array.from(this.base.parentNode.querySelectorAll("thead th")).reduce((function(t,e){var i;return e.style.width=e.clientWidth+"px",pl(((i={})[e.getAttribute("data-column-id")]={minWidth:e.clientWidth},i),t)}),{});return this.tableElement.className=this.tableClassName,this.tableElement.style.cssText=this.tableStyle,this.tableElement.style.tableLayout="auto",Array.from(this.base.parentNode.querySelectorAll("thead th")).reduce((function(t,e){return t[e.getAttribute("data-column-id")].width=e.clientWidth,t}),t)},i.render=function(){var t=this;return this.props.tableRef.current?Ml("div",{ref:function(e){e&&e.appendChild(t.tableElement)}}):null},e}(tc);function Mc(t){if(!t)return"";var e=t.split(" ");return 1===e.length&&/([a-z][A-Z])+/g.test(t)?t:e.map((function(t,e){return 0==e?t.toLowerCase():t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()})).join("")}var Lc=function(t){function e(){var e;return(e=t.call(this)||this)._columns=void 0,e._columns=[],e}ul(e,t);var i=e.prototype;return i.adjustWidth=function(t){var i=t.container,n=t.tableRef,r=t.tempRef,o=t.tempRef||!0;if(!i)return this;var s=i.clientWidth,a={current:null},l={};if(n.current&&o){var c=Ml(Ec,{tableRef:n});c.ref=a,Xl(c,r.current),l=a.current.widths()}for(var h,d=vl(e.tabularFormat(this.columns).reduce((function(t,e){return t.concat(e)}),[]));!(h=d()).done;){var p=h.value;p.columns&&p.columns.length>0||(!p.width&&o?p.id in l&&(p.width=Cc(l[p.id].width),p.minWidth=Cc(l[p.id].minWidth)):p.width=Cc(Sc(p.width,s)))}return n.current&&o&&Xl(null,r.current),this},i.setSort=function(t,e){for(var i,n=vl(e||this.columns||[]);!(i=n()).done;){var r=i.value;r.columns&&r.columns.length>0&&(r.sort={enabled:!1}),void 0===r.sort&&t.sort&&(r.sort={enabled:!0}),r.sort?"object"==typeof r.sort&&(r.sort=pl({enabled:!0},r.sort)):r.sort={enabled:!1},r.columns&&this.setSort(t,r.columns)}},i.setFixedHeader=function(t,e){for(var i,n=vl(e||this.columns||[]);!(i=n()).done;){var r=i.value;void 0===r.fixedHeader&&(r.fixedHeader=t.fixedHeader),r.columns&&this.setFixedHeader(t,r.columns)}},i.setResizable=function(t,e){for(var i,n=vl(e||this.columns||[]);!(i=n()).done;){var r=i.value;void 0===r.resizable&&(r.resizable=t.resizable),r.columns&&this.setResizable(t,r.columns)}},i.setID=function(t){for(var e,i=vl(t||this.columns||[]);!(e=i()).done;){var n=e.value;n.id||"string"!=typeof n.name||(n.id=Mc(n.name)),n.id||bc.error('Could not find a valid ID for one of the columns. Make sure a valid "id" is set for all columns.'),n.columns&&this.setID(n.columns)}},i.populatePlugins=function(t,e){for(var i,n=vl(e);!(i=n()).done;){var r=i.value;void 0!==r.plugin&&t.plugin.add(pl({id:r.id,props:{}},r.plugin,{position:pc.Cell}))}},e.fromColumns=function(t){for(var i,n=new e,r=vl(t);!(i=r()).done;){var o=i.value;if("string"==typeof o||yl(o))n.columns.push({name:o});else if("object"==typeof o){var s=o;s.columns&&(s.columns=e.fromColumns(s.columns).columns),"object"==typeof s.plugin&&void 0===s.data&&(s.data=null),n.columns.push(o)}}return n},e.fromUserConfig=function(t){var i=new e;return t.from?i.columns=e.fromHTMLTable(t.from).columns:t.columns?i.columns=e.fromColumns(t.columns).columns:!t.data||"object"!=typeof t.data[0]||t.data[0]instanceof Array||(i.columns=Object.keys(t.data[0]).map((function(t){return{name:t}}))),i.columns.length?(i.setID(),i.setSort(t),i.setFixedHeader(t),i.setResizable(t),i.populatePlugins(t,i.columns),i):null},e.fromHTMLTable=function(t){for(var i,n=new e,r=vl(t.querySelector("thead").querySelectorAll("th"));!(i=r()).done;){var o=i.value;n.columns.push({name:o.innerHTML,width:o.width})}return n},e.tabularFormat=function(t){var e=[],i=t||[],n=[];if(i&&i.length){e.push(i);for(var r,o=vl(i);!(r=o()).done;){var s=r.value;s.columns&&s.columns.length&&(n=n.concat(s.columns))}n.length&&(e=e.concat(this.tabularFormat(n)))}return e},e.leafColumns=function(t){var e=[],i=t||[];if(i&&i.length)for(var n,r=vl(i);!(n=r()).done;){var o=n.value;o.columns&&0!==o.columns.length||e.push(o),o.columns&&(e=e.concat(this.leafColumns(o.columns)))}return e},e.maximumDepth=function(t){return this.tabularFormat([t]).length-1},dl(e,[{key:"columns",get:function(){return this._columns},set:function(t){this._columns=t}},{key:"visibleColumns",get:function(){return this._columns.filter((function(t){return!t.hidden}))}}]),e}(Ql),Tc=function(){function t(){this._callbacks=void 0,this._isDispatching=void 0,this._isHandled=void 0,this._isPending=void 0,this._lastID=void 0,this._pendingPayload=void 0,this._callbacks={},this._isDispatching=!1,this._isHandled={},this._isPending={},this._lastID=1}var e=t.prototype;return e.register=function(t){var e="ID_"+this._lastID++;return this._callbacks[e]=t,e},e.unregister=function(t){if(!this._callbacks[t])throw Error("Dispatcher.unregister(...): "+t+" does not map to a registered callback.");delete this._callbacks[t]},e.waitFor=function(t){if(!this._isDispatching)throw Error("Dispatcher.waitFor(...): Must be invoked while dispatching.");for(var e=0;e<t.length;e++){var i=t[e];if(this._isPending[i]){if(!this._isHandled[i])throw Error("Dispatcher.waitFor(...): Circular dependency detected while ' +\n 'waiting for "+i+".")}else{if(!this._callbacks[i])throw Error("Dispatcher.waitFor(...): "+i+" does not map to a registered callback.");this._invokeCallback(i)}}},e.dispatch=function(t){if(this._isDispatching)throw Error("Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.");this._startDispatching(t);try{for(var e in this._callbacks)this._isPending[e]||this._invokeCallback(e)}finally{this._stopDispatching()}},e.isDispatching=function(){return this._isDispatching},e._invokeCallback=function(t){this._isPending[t]=!0,this._callbacks[t](this._pendingPayload),this._isHandled[t]=!0},e._startDispatching=function(t){for(var e in this._callbacks)this._isPending[e]=!1,this._isHandled[e]=!1;this._pendingPayload=t,this._isDispatching=!0},e._stopDispatching=function(){delete this._pendingPayload,this._isDispatching=!1},t}(),Hc=function(){},Oc=function(t){function e(e){var i;return(i=t.call(this)||this).data=void 0,i.set(e),i}ul(e,t);var i=e.prototype;return i.get=function(){try{return Promise.resolve(this.data()).then((function(t){return{data:t,total:t.length}}))}catch(t){return Promise.reject(t)}},i.set=function(t){return t instanceof Array?this.data=function(){return t}:t instanceof Function&&(this.data=t),this},e}(Hc),$c=function(t){function e(e){var i;return(i=t.call(this)||this).options=void 0,i.options=e,i}ul(e,t);var i=e.prototype;return i.handler=function(t){return"function"==typeof this.options.handle?this.options.handle(t):t.ok?t.json():(bc.error("Could not fetch data: "+t.status+" - "+t.statusText,!0),null)},i.get=function(t){var e=pl({},this.options,t);return"function"==typeof e.data?e.data(e):fetch(e.url,e).then(this.handler.bind(this)).then((function(t){return{data:e.then(t),total:"function"==typeof e.total?e.total(t):void 0}}))},e}(Hc),Vc=function(){function t(){}return t.createFromUserConfig=function(t){var e=null;return t.data&&(e=new Oc(t.data)),t.from&&(e=new Oc(this.tableElementToArray(t.from)),t.from.style.display="none"),t.server&&(e=new $c(t.server)),e||bc.error("Could not determine the storage type",!0),e},t.tableElementToArray=function(t){for(var e,i,n=[],r=vl(t.querySelector("tbody").querySelectorAll("tr"));!(e=r()).done;){for(var o,s=[],a=vl(e.value.querySelectorAll("td"));!(o=a()).done;){var l=o.value;1===l.childNodes.length&&l.childNodes[0].nodeType===Node.TEXT_NODE?s.push((i=l.innerHTML,(new DOMParser).parseFromString(i,"text/html").documentElement.textContent)):s.push(ic(l.innerHTML))}n.push(s)}return n},t}(),Ic="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function Rc(t,e,i){if(!t.s){if(i instanceof Pc){if(!i.s)return void(i.o=Rc.bind(null,t,e));1&e&&(e=i.s),i=i.v}if(i&&i.then)return void i.then(Rc.bind(null,t,e),Rc.bind(null,t,2));t.s=e,t.v=i;var n=t.o;n&&n(t)}}var Pc=function(){function t(){}return t.prototype.then=function(e,i){var n=new t,r=this.s;if(r){var o=1&r?e:i;if(o){try{Rc(n,1,o(this.v))}catch(t){Rc(n,2,t)}return n}return this}return this.o=function(t){try{var r=t.v;1&t.s?Rc(n,1,e?e(r):r):i?Rc(n,1,i(r)):Rc(n,2,r)}catch(t){Rc(n,2,t)}},n},t}();function Dc(t){return t instanceof Pc&&1&t.s}var Nc,Fc=function(t){function e(e){var i;return(i=t.call(this)||this)._steps=new Map,i.cache=new Map,i.lastProcessorIndexUpdated=-1,e&&e.forEach((function(t){return i.register(t)})),i}ul(e,t);var i=e.prototype;return i.clearCache=function(){this.cache=new Map,this.lastProcessorIndexUpdated=-1},i.register=function(t,e){if(void 0===e&&(e=null),null===t.type)throw Error("Processor type is not defined");t.on("propsUpdated",this.processorPropsUpdated.bind(this)),this.addProcessorByPriority(t,e),this.afterRegistered(t)},i.unregister=function(t){if(t){var e=this._steps.get(t.type);e&&e.length&&(this._steps.set(t.type,e.filter((function(e){return e!=t}))),this.emit("updated",t))}},i.addProcessorByPriority=function(t,e){var i=this._steps.get(t.type);if(!i){var n=[];this._steps.set(t.type,n),i=n}if(null===e||e<0)i.push(t);else if(i[e]){var r=i.slice(0,e-1),o=i.slice(e+1);this._steps.set(t.type,r.concat(t).concat(o))}else i[e]=t},i.getStepsByType=function(t){return this.steps.filter((function(e){return e.type===t}))},i.getSortedProcessorTypes=function(){return Object.keys(nc).filter((function(t){return!isNaN(Number(t))})).map((function(t){return Number(t)}))},i.process=function(t){try{var e=this,i=function(t){return e.lastProcessorIndexUpdated=r.length,e.emit("afterProcess",o),o},n=e.lastProcessorIndexUpdated,r=e.steps,o=t,s=function(t,i){try{var s=function(t,e,i){if("function"==typeof t[Ic]){var n,r,o,s=t[Ic]();if(function t(i){try{for(;!(n=s.next()).done;)if((i=e(n.value))&&i.then){if(!Dc(i))return void i.then(t,o||(o=Rc.bind(null,r=new Pc,2)));i=i.v}r?Rc(r,1,i):r=i}catch(t){Rc(r||(r=new Pc),2,t)}}(),s.return){var a=function(t){try{n.done||s.return()}catch(t){}return t};if(r&&r.then)return r.then(a,(function(t){throw a(t)}));a()}return r}if(!("length"in t))throw new TypeError("Object is not iterable");for(var l=[],c=0;c<t.length;c++)l.push(t[c]);return function(t,e,i){var n,r,o=-1;return function i(s){try{for(;++o<t.length;)if((s=e(o))&&s.then){if(!Dc(s))return void s.then(i,r||(r=Rc.bind(null,n=new Pc,2)));s=s.v}n?Rc(n,1,s):n=s}catch(t){Rc(n||(n=new Pc),2,t)}}(),n}(l,(function(t){return e(l[t])}))}(r,(function(t){var i=e.findProcessorIndexByID(t.id),r=function(){if(i>=n)return Promise.resolve(t.process(o)).then((function(i){e.cache.set(t.id,o=i)}));o=e.cache.get(t.id)}();if(r&&r.then)return r.then((function(){}))}))}catch(t){return i(t)}return s&&s.then?s.then(void 0,i):s}(0,(function(t){throw bc.error(t),e.emit("error",o),t}));return Promise.resolve(s&&s.then?s.then(i):i())}catch(t){return Promise.reject(t)}},i.findProcessorIndexByID=function(t){return this.steps.findIndex((function(e){return e.id==t}))},i.setLastProcessorIndex=function(t){var e=this.findProcessorIndexByID(t.id);this.lastProcessorIndexUpdated>e&&(this.lastProcessorIndexUpdated=e)},i.processorPropsUpdated=function(t){this.setLastProcessorIndex(t),this.emit("propsUpdated"),this.emit("updated",t)},i.afterRegistered=function(t){this.setLastProcessorIndex(t),this.emit("afterRegister"),this.emit("updated",t)},dl(e,[{key:"steps",get:function(){for(var t,e=[],i=vl(this.getSortedProcessorTypes());!(t=i()).done;){var n=this._steps.get(t.value);n&&n.length&&(e=e.concat(n))}return e.filter((function(t){return t}))}}]),e}(ac),Bc=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e.prototype._process=function(t){try{return Promise.resolve(this.props.storage.get(t))}catch(t){return Promise.reject(t)}},dl(e,[{key:"type",get:function(){return nc.Extractor}}]),e}(lc),jc=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e.prototype._process=function(t){var e=sc.fromArray(t.data);return e.length=t.total,e},dl(e,[{key:"type",get:function(){return nc.Transformer}}]),e}(lc),qc=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e.prototype._process=function(){return Object.entries(this.props.serverStorageOptions).filter((function(t){return"function"!=typeof t[1]})).reduce((function(t,e){var i;return pl({},t,((i={})[e[0]]=e[1],i))}),{})},dl(e,[{key:"type",get:function(){return nc.Initiator}}]),e}(lc),Uc=function(t){function e(){return t.apply(this,arguments)||this}ul(e,t);var i=e.prototype;return i.castData=function(t){if(!t||!t.length)return[];if(!this.props.header||!this.props.header.columns)return t;var e=Lc.leafColumns(this.props.header.columns);return t[0]instanceof Array?t.map((function(t){var i=0;return e.map((function(e,n){return void 0!==e.data?(i++,"function"==typeof e.data?e.data(t):e.data):t[n-i]}))})):"object"!=typeof t[0]||t[0]instanceof Array?[]:t.map((function(t){return e.map((function(e,i){return void 0!==e.data?"function"==typeof e.data?e.data(t):e.data:e.id?t[e.id]:(bc.error("Could not find the correct cell for column at position "+i+".\n Make sure either 'id' or 'selector' is defined for all columns."),null)}))}))},i._process=function(t){return{data:this.castData(t.data),total:t.total}},dl(e,[{key:"type",get:function(){return nc.Transformer}}]),e}(lc),Wc=function(){function t(){}return t.createFromConfig=function(t){var e=new Fc;return t.storage instanceof $c&&e.register(new qc({serverStorageOptions:t.server})),e.register(new Bc({storage:t.storage})),e.register(new Uc({header:t.header})),e.register(new jc),e},t}(),Yc=function(){function t(e){this._userConfig=void 0,Object.assign(this,pl({},t.defaultConfig(),e)),this._userConfig={}}var e=t.prototype;return e.assign=function(t){for(var e=0,i=Object.keys(t);e<i.length;e++){var n=i[e];"_userConfig"!==n&&(this[n]=t[n])}return this},e.update=function(e){return e?(this._userConfig=pl({},this._userConfig,e),this.assign(t.fromUserConfig(this._userConfig)),this):this},t.defaultConfig=function(){return{plugin:new _c,dispatcher:new Tc,tableRef:{current:null},tempRef:{current:null},width:"100%",height:"auto",autoWidth:!0,style:{},className:{}}},t.fromUserConfig=function(e){var i=new t(e);return i._userConfig=e,"boolean"==typeof e.sort&&e.sort&&i.assign({sort:{multiColumn:!0}}),i.assign({header:Lc.fromUserConfig(i)}),i.assign({storage:Vc.createFromUserConfig(e)}),i.assign({pipeline:Wc.createFromConfig(i)}),i.assign({translator:new Jl(e.language)}),i.plugin.add({id:"search",position:pc.Header,component:xc,props:pl({enabled:!0===e.search||e.search instanceof Object},e.search)}),i.plugin.add({id:"pagination",position:pc.Footer,component:zc,props:pl({enabled:!0===e.pagination||e.pagination instanceof Object},e.pagination)}),e.plugins&&e.plugins.forEach((function(t){return i.plugin.add(t)})),i},t}();!function(t){t[t.Init=0]="Init",t[t.Loading=1]="Loading",t[t.Loaded=2]="Loaded",t[t.Rendered=3]="Rendered",t[t.Error=4]="Error"}(Nc||(Nc={}));var Gc,Xc,Kc=function(t){function e(){return t.apply(this,arguments)||this}ul(e,t);var i=e.prototype;return i.content=function(){return this.props.column&&"function"==typeof this.props.column.formatter?this.props.column.formatter(this.props.cell.data,this.props.row,this.props.column):this.props.column&&this.props.column.plugin?Ml(wc,{pluginId:this.props.column.id,props:{column:this.props.column,cell:this.props.cell,row:this.props.row}}):this.props.cell.data},i.handleClick=function(t){this.props.messageCell||this.config.eventEmitter.emit("cellClick",t,this.props.cell,this.props.column,this.props.row)},i.getCustomAttributes=function(t){return t?"function"==typeof t.attributes?t.attributes(this.props.cell.data,this.props.row,this.props.column):t.attributes:{}},i.render=function(){return Ml("td",pl({role:this.props.role,colSpan:this.props.colSpan,"data-column-id":this.props.column&&this.props.column.id,className:dc(hc("td"),this.props.className,this.config.className.td),style:pl({},this.props.style,this.config.style.td),onClick:this.handleClick.bind(this)},this.getCustomAttributes(this.props.column)),this.content())},e}(tc),Qc=function(t){function e(){return t.apply(this,arguments)||this}ul(e,t);var i=e.prototype;return i.getColumn=function(t){if(this.props.header){var e=Lc.leafColumns(this.props.header.columns);if(e)return e[t]}return null},i.handleClick=function(t){this.props.messageRow||this.config.eventEmitter.emit("rowClick",t,this.props.row)},i.getChildren=function(){var t=this;return this.props.children?this.props.children:Ml(Tl,null,this.props.row.cells.map((function(e,i){var n=t.getColumn(i);return n&&n.hidden?null:Ml(Kc,{key:e.id,cell:e,row:t.props.row,column:n})})))},i.render=function(){return Ml("tr",{className:dc(hc("tr"),this.config.className.tr),onClick:this.handleClick.bind(this)},this.getChildren())},e}(tc),Zc=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e.prototype.render=function(){return Ml(Qc,{messageRow:!0},Ml(Kc,{role:"alert",colSpan:this.props.colSpan,messageCell:!0,cell:new rc(this.props.message),className:dc(hc("message"),this.props.className?this.props.className:null)}))},e}(tc),Jc=function(t){function e(){return t.apply(this,arguments)||this}ul(e,t);var i=e.prototype;return i.headerLength=function(){return this.props.header?this.props.header.visibleColumns.length:0},i.render=function(){var t=this;return Ml("tbody",{className:dc(hc("tbody"),this.config.className.tbody)},this.props.data&&this.props.data.rows.map((function(e){return Ml(Qc,{key:e.id,row:e,header:t.props.header})})),this.props.status===Nc.Loading&&(!this.props.data||0===this.props.data.length)&&Ml(Zc,{message:this._("loading"),colSpan:this.headerLength(),className:dc(hc("loading"),this.config.className.loading)}),this.props.status===Nc.Rendered&&this.props.data&&0===this.props.data.length&&Ml(Zc,{message:this._("noRecordsFound"),colSpan:this.headerLength(),className:dc(hc("notfound"),this.config.className.notfound)}),this.props.status===Nc.Error&&Ml(Zc,{message:this._("error"),colSpan:this.headerLength(),className:dc(hc("error"),this.config.className.error)}))},e}(tc),th=function(t){function e(){return t.apply(this,arguments)||this}ul(e,t);var i=e.prototype;return i.validateProps=function(){for(var t,e=vl(this.props.columns);!(t=e()).done;){var i=t.value;void 0===i.direction&&(i.direction=1),1!==i.direction&&-1!==i.direction&&bc.error("Invalid sort direction "+i.direction)}},i.compare=function(t,e){return t>e?1:t<e?-1:0},i.compareWrapper=function(t,e){for(var i,n=0,r=vl(this.props.columns);!(i=r()).done;){var o=i.value;if(0!==n)break;var s=t.cells[o.index].data,a=e.cells[o.index].data;n|="function"==typeof o.compare?o.compare(s,a)*o.direction:this.compare(s,a)*o.direction}return n},i._process=function(t){var e=[].concat(t.rows);e.sort(this.compareWrapper.bind(this));var i=new sc(e);return i.length=t.length,i},dl(e,[{key:"type",get:function(){return nc.Sort}}]),e}(lc),eh=function(t){function e(){return t.apply(this,arguments)||this}ul(e,t);var i=e.prototype;return i.getInitialState=function(){return[]},i.handle=function(t,e){"SORT_COLUMN"===t?this.sortColumn(e.index,e.direction,e.multi,e.compare):"SORT_COLUMN_TOGGLE"===t&&this.sortToggle(e.index,e.multi,e.compare)},i.sortToggle=function(t,e,i){var n=[].concat(this.state).find((function(e){return e.index===t}));this.sortColumn(t,n&&1===n.direction?-1:1,e,i)},i.sortColumn=function(t,e,i,n){var r=[].concat(this.state),o=r.length,s=r.find((function(e){return e.index===t})),a=!1,l=!1,c=!1,h=!1;if(void 0!==s?i?-1===s.direction?c=!0:h=!0:1===o?h=!0:o>1&&(l=!0,a=!0):0===o?a=!0:o>0&&!i?(a=!0,l=!0):o>0&&i&&(a=!0),l&&(r=[]),a)r.push({index:t,direction:e,compare:n});else if(h){var d=r.indexOf(s);r[d].direction=e}else if(c){var p=r.indexOf(s);r.splice(p,1)}this.setState(r)},e}(uc),ih=function(t){function e(){return t.apply(this,arguments)||this}ul(e,t);var i=e.prototype;return i.sortColumn=function(t,e,i,n){this.dispatch("SORT_COLUMN",{index:t,direction:e,multi:i,compare:n})},i.sortToggle=function(t,e,i){this.dispatch("SORT_COLUMN_TOGGLE",{index:t,multi:e,compare:i})},e}(fc),nh=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e.prototype._process=function(t){var e={};return this.props.url&&(e.url=this.props.url(t.url,this.props.columns)),this.props.body&&(e.body=this.props.body(t.body,this.props.columns)),pl({},t,e)},dl(e,[{key:"type",get:function(){return nc.ServerSort}}]),e}(lc),rh=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this).sortProcessor=void 0,n.actions=void 0,n.store=void 0,n.updateStateFn=void 0,n.updateSortProcessorFn=void 0,n.actions=new ih(n.config.dispatcher),n.store=new eh(n.config.dispatcher),e.enabled&&(n.sortProcessor=n.getOrCreateSortProcessor(),n.updateStateFn=n.updateState.bind(fl(n)),n.store.on("updated",n.updateStateFn),n.state={direction:0}),n}ul(e,t);var i=e.prototype;return i.componentWillUnmount=function(){this.config.pipeline.unregister(this.sortProcessor),this.store.off("updated",this.updateStateFn),this.updateSortProcessorFn&&this.store.off("updated",this.updateSortProcessorFn)},i.updateState=function(){var t=this,e=this.store.state.find((function(e){return e.index===t.props.index}));this.setState(e?{direction:e.direction}:{direction:0})},i.updateSortProcessor=function(t){this.sortProcessor.setProps({columns:t})},i.getOrCreateSortProcessor=function(){var t=nc.Sort;this.config.sort&&"object"==typeof this.config.sort.server&&(t=nc.ServerSort);var e,i=this.config.pipeline.getStepsByType(t);return i.length>0?e=i[0]:(this.updateSortProcessorFn=this.updateSortProcessor.bind(this),this.store.on("updated",this.updateSortProcessorFn),e=t===nc.ServerSort?new nh(pl({columns:this.store.state},this.config.sort.server)):new th({columns:this.store.state}),this.config.pipeline.register(e)),e},i.changeDirection=function(t){t.preventDefault(),t.stopPropagation(),this.actions.sortToggle(this.props.index,!0===t.shiftKey&&this.config.sort.multiColumn,this.props.compare)},i.render=function(){if(!this.props.enabled)return null;var t=this.state.direction,e="neutral";return 1===t?e="asc":-1===t&&(e="desc"),Ml("button",{tabIndex:-1,"aria-label":this._("sort.sort"+(1===t?"Desc":"Asc")),title:this._("sort.sort"+(1===t?"Desc":"Asc")),className:dc(hc("sort"),hc("sort",e),this.config.className.sort),onClick:this.changeDirection.bind(this)})},e}(tc),oh=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).moveFn=void 0,e.upFn=void 0,e}ul(e,t);var i=e.prototype;return i.getPageX=function(t){return t instanceof MouseEvent?Math.floor(t.pageX):Math.floor(t.changedTouches[0].pageX)},i.start=function(t){var e,i,n,r,o;t.stopPropagation(),this.setState({offsetStart:parseInt(this.props.thRef.current.style.width,10)-this.getPageX(t)}),this.upFn=this.end.bind(this),this.moveFn=(e=this.move.bind(this),void 0===(i=10)&&(i=100),function(){var t=[].slice.call(arguments);n?(clearTimeout(r),r=setTimeout((function(){Date.now()-o>=i&&(e.apply(void 0,t),o=Date.now())}),Math.max(i-(Date.now()-o),0))):(e.apply(void 0,t),o=Date.now(),n=!0)}),document.addEventListener("mouseup",this.upFn),document.addEventListener("touchend",this.upFn),document.addEventListener("mousemove",this.moveFn),document.addEventListener("touchmove",this.moveFn)},i.move=function(t){t.stopPropagation();var e=this.props.thRef.current;this.state.offsetStart+this.getPageX(t)>=parseInt(e.style.minWidth,10)&&(e.style.width=this.state.offsetStart+this.getPageX(t)+"px")},i.end=function(t){t.stopPropagation(),document.removeEventListener("mouseup",this.upFn),document.removeEventListener("mousemove",this.moveFn),document.removeEventListener("touchmove",this.moveFn),document.removeEventListener("touchend",this.upFn)},i.render=function(){return Ml("div",{className:dc(hc("th"),hc("resizable")),onMouseDown:this.start.bind(this),onTouchStart:this.start.bind(this),onClick:function(t){return t.stopPropagation()}})},e}(tc),sh=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this).sortRef={current:null},n.thRef={current:null},n.state={style:{}},n}ul(e,t);var i=e.prototype;return i.isSortable=function(){return this.props.column.sort.enabled},i.isResizable=function(){return this.props.column.resizable},i.onClick=function(t){t.stopPropagation(),this.isSortable()&&this.sortRef.current.changeDirection(t)},i.keyDown=function(t){this.isSortable()&&13===t.which&&this.onClick(t)},i.componentDidMount=function(){var t=this;setTimeout((function(){if(t.props.column.fixedHeader&&t.thRef.current){var e=t.thRef.current.offsetTop;"number"==typeof e&&t.setState({style:{top:e}})}}),0)},i.content=function(){return void 0!==this.props.column.name?this.props.column.name:void 0!==this.props.column.plugin?Ml(wc,{pluginId:this.props.column.plugin.id,props:{column:this.props.column}}):null},i.getCustomAttributes=function(){var t=this.props.column;return t?"function"==typeof t.attributes?t.attributes(null,null,this.props.column):t.attributes:{}},i.render=function(){var t={};return this.isSortable()&&(t.tabIndex=0),Ml("th",pl({ref:this.thRef,"data-column-id":this.props.column&&this.props.column.id,className:dc(hc("th"),this.isSortable()?hc("th","sort"):null,this.props.column.fixedHeader?hc("th","fixed"):null,this.config.className.th),onClick:this.onClick.bind(this),style:pl({},this.config.style.th,{minWidth:this.props.column.minWidth,width:this.props.column.width},this.state.style,this.props.style),onKeyDown:this.keyDown.bind(this),rowSpan:this.props.rowSpan>1?this.props.rowSpan:void 0,colSpan:this.props.colSpan>1?this.props.colSpan:void 0},this.getCustomAttributes(),t),Ml("div",{className:hc("th","content")},this.content()),this.isSortable()&&Ml(rh,pl({ref:this.sortRef,index:this.props.index},this.props.column.sort)),this.isResizable()&&this.props.index<this.config.header.visibleColumns.length-1&&Ml(oh,{column:this.props.column,thRef:this.thRef}))},e}(tc),ah=function(t){function e(){return t.apply(this,arguments)||this}ul(e,t);var i=e.prototype;return i.renderColumn=function(t,e,i,n){var r=function(t,e,i){var n=Lc.maximumDepth(t),r=i-e;return{rowSpan:Math.floor(r-n-n/r),colSpan:t.columns&&t.columns.length||1}}(t,e,n);return Ml(sh,{column:t,index:i,colSpan:r.colSpan,rowSpan:r.rowSpan})},i.renderRow=function(t,e,i){var n=this,r=Lc.leafColumns(this.props.header.columns);return Ml(Qc,null,t.map((function(t){return t.hidden?null:n.renderColumn(t,e,r.indexOf(t),i)})))},i.renderRows=function(){var t=this,e=Lc.tabularFormat(this.props.header.columns);return e.map((function(i,n){return t.renderRow(i,n,e.length)}))},i.render=function(){return this.props.header?Ml("thead",{key:this.props.header.id,className:dc(hc("thead"),this.config.className.thead)},this.renderRows()):null},e}(tc),lh=function(t){function e(){return t.apply(this,arguments)||this}return ul(e,t),e.prototype.render=function(){return Ml("table",{role:"grid",className:dc(hc("table"),this.config.className.table),style:pl({},this.config.style.table,{height:this.props.height})},Ml(ah,{header:this.props.header}),Ml(Jc,{data:this.props.data,status:this.props.status,header:this.props.header}))},e}(tc),ch=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this).headerRef={current:null},n.state={isActive:!0},n}ul(e,t);var i=e.prototype;return i.componentDidMount=function(){0===this.headerRef.current.children.length&&this.setState({isActive:!1})},i.render=function(){return this.state.isActive?Ml("div",{ref:this.headerRef,className:dc(hc("head"),this.config.className.header),style:pl({},this.config.style.header)},Ml(wc,{position:pc.Header})):null},e}(tc),hh=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this).footerRef={current:null},n.state={isActive:!0},n}ul(e,t);var i=e.prototype;return i.componentDidMount=function(){0===this.footerRef.current.children.length&&this.setState({isActive:!1})},i.render=function(){return this.state.isActive?Ml("div",{ref:this.footerRef,className:dc(hc("footer"),this.config.className.footer),style:pl({},this.config.style.footer)},Ml(wc,{position:pc.Footer})):null},e}(tc),dh=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this).configContext=void 0,n.processPipelineFn=void 0,n.configContext=function(t,e){var i={__c:e="__cC"+kl++,__:null,Consumer:function(t,e){return t.children(e)},Provider:function(t){var i,n;return this.getChildContext||(i=[],(n={})[e]=this,this.getChildContext=function(){return n},this.shouldComponentUpdate=function(t){this.props.value!==t.value&&i.some(Vl)},this.sub=function(t){i.push(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){i.splice(i.indexOf(t),1),e&&e.call(t)}}),t.children}};return i.Provider.__=i.Consumer.contextType=i}(),n.state={status:Nc.Loading,header:e.header,data:null},n}ul(e,t);var i=e.prototype;return i.processPipeline=function(){try{var t=this;t.props.config.eventEmitter.emit("beforeLoad"),t.setState({status:Nc.Loading});var e=function(e,i){try{var n=Promise.resolve(t.props.pipeline.process()).then((function(e){t.setState({data:e,status:Nc.Loaded}),t.props.config.eventEmitter.emit("load",e)}))}catch(t){return i(t)}return n&&n.then?n.then(void 0,i):n}(0,(function(e){bc.error(e),t.setState({status:Nc.Error,data:null})}));return Promise.resolve(e&&e.then?e.then((function(){})):void 0)}catch(t){return Promise.reject(t)}},i.componentDidMount=function(){try{var t=this,e=t.props.config;return Promise.resolve(t.processPipeline()).then((function(){e.header&&t.state.data&&t.state.data.length&&t.setState({header:e.header.adjustWidth(e)}),t.processPipelineFn=t.processPipeline.bind(t),t.props.pipeline.on("updated",t.processPipelineFn)}))}catch(t){return Promise.reject(t)}},i.componentWillUnmount=function(){this.props.pipeline.off("updated",this.processPipelineFn)},i.componentDidUpdate=function(t,e){e.status!=Nc.Rendered&&this.state.status==Nc.Loaded&&(this.setState({status:Nc.Rendered}),this.props.config.eventEmitter.emit("ready"))},i.render=function(){return Ml(this.configContext.Provider,{value:this.props.config},Ml("div",{role:"complementary",className:dc("gridjs",hc("container"),this.state.status===Nc.Loading?hc("loading"):null,this.props.config.className.container),style:pl({},this.props.config.style.container,{width:this.props.width})},this.state.status===Nc.Loading&&Ml("div",{className:hc("loading-bar")}),Ml(ch,null),Ml("div",{className:hc("wrapper"),style:{height:this.props.height}},Ml(lh,{ref:this.props.config.tableRef,data:this.state.data,header:this.state.header,width:this.props.width,height:this.props.height,status:this.state.status})),Ml(hh,null),Ml("div",{ref:this.props.config.tempRef,id:"gridjs-temp",className:hc("temp")})))},e}(tc),ph=function(t){function e(e){var i;return(i=t.call(this)||this).config=void 0,i.plugin=void 0,i.config=new Yc({instance:fl(i),eventEmitter:fl(i)}).update(e),i.plugin=i.config.plugin,i}ul(e,t);var i=e.prototype;return i.updateConfig=function(t){return this.config.update(t),this},i.createElement=function(){return Ml(dh,{config:this.config,pipeline:this.config.pipeline,header:this.config.header,width:this.config.width,height:this.config.height})},i.forceRender=function(){return this.config&&this.config.container||bc.error("Container is empty. Make sure you call render() before forceRender()",!0),this.config.pipeline.clearCache(),Xl(null,this.config.container),Xl(this.createElement(),this.config.container),this},i.render=function(t){return t||bc.error("Container element cannot be null",!0),t.childNodes.length>0?(bc.error("The container element "+t+" is not empty. Make sure the container is empty and call render() again"),this):(this.config.container=t,Xl(this.createElement(),t),this)},e}(ac),uh=[],gh=bl.__b,fh=bl.__r,mh=bl.diffed,vh=bl.__c,bh=bl.unmount;function yh(){uh.forEach((function(t){if(t.__P)try{t.__H.__h.forEach(xh),t.__H.__h.forEach(kh),t.__H.__h=[]}catch(e){t.__H.__h=[],bl.__e(e,t.__v)}})),uh=[]}bl.__b=function(t){Gc=null,gh&&gh(t)},bl.__r=function(t){fh&&fh(t),0;var e=(Gc=t.__c).__H;e&&(e.__h.forEach(xh),e.__h.forEach(kh),e.__h=[])},bl.diffed=function(t){mh&&mh(t);var e=t.__c;e&&e.__H&&e.__H.__h.length&&(1!==uh.push(e)&&Xc===bl.requestAnimationFrame||((Xc=bl.requestAnimationFrame)||function(t){var e,i=function(){clearTimeout(n),wh&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(i,100);wh&&(e=requestAnimationFrame(i))})(yh)),Gc=void 0},bl.__c=function(t,e){e.some((function(t){try{t.__h.forEach(xh),t.__h=t.__h.filter((function(t){return!t.__||kh(t)}))}catch(i){e.some((function(t){t.__h&&(t.__h=[])})),e=[],bl.__e(i,t.__v)}})),vh&&vh(t,e)},bl.unmount=function(t){bh&&bh(t);var e=t.__c;if(e&&e.__H)try{e.__H.__.forEach(xh)}catch(t){bl.__e(t,e.__v)}};var _h,wh="function"==typeof requestAnimationFrame;function xh(t){var e=Gc;"function"==typeof t.__c&&t.__c(),Gc=e}function kh(t){var e=Gc;t.__c=t.__(),Gc=e}class Ah extends T{static get properties(){return Object.assign({label:{type:String},property:{type:String},sort:{type:Boolean},width:{type:String}},super.properties)}constructor(){super(),this.label="no-label",this.property=null,this.sort=!1,this.width=null}connectedCallback(){super.connectedCallback()}data(){const t={name:this.label,sort:{enabled:this.sort},formatter:t=>ic(t)};return this.property&&(t.id=this.property),this.width&&(t.width=this.width),t}}customElements.define("pb-table-column",Ah);class zh extends(R(T)){static get properties(){return Object.assign({source:{type:String},cssPath:{type:String,attribute:"css-path"},resizable:{type:Boolean},perPage:{type:Number,attribute:"per-page"},height:{type:String},search:{type:Boolean},_params:{type:Object}},super.properties)}constructor(){super(),this.cssPath="../css/gridjs",this._params={},this.resizable=!1,this.search=!1,this.perPage=10,this.height=null,this.fixedHeader=!1}connectedCallback(){if(super.connectedCallback(),this.subscribeTo("pb-search-resubmit",t=>{this._params=Object.assign({},t.detail.params),this._submit()}),window.addEventListener("popstate",t=>{this._params=t.state,this._submit()}),!this.height){const t=getComputedStyle(this).getPropertyValue("--pb-table-grid-height");this.height=t||"auto"}}firstUpdated(){const t=this.shadowRoot.getElementById("table"),e=this.querySelectorAll("pb-table-column"),i=[];e.forEach(t=>i.push(t.data())),zh.waitOnce("pb-page-ready",()=>{this._params=this.getParameters();const e=this.toAbsoluteURL(this.source),n={height:this.height,fixedHeader:!0,columns:i,resizable:this.resizable,server:{url:e,then:t=>t.results,total:t=>t.count},sort:{multiColumn:!1,enabled:!0,server:{url:(t,e)=>{if(!e.length)return t;const n=e[0];return`${t}${t.indexOf("?")>-1?"&":"?"}order=${i[n.index].id}&dir=${1===n.direction?"asc":"desc"}`}}},pagination:{enabled:!0,limit:this.perPage,server:{url:(t,e,i)=>{const n=this.shadowRoot.getElementById("form");return n&&Object.assign(this._params,n.serializeForm()),this._params.limit=i,this._params.start=e*i+1,this.setParameters(this._params),this.pushHistory("grid",this._params),`${t}${t.indexOf("?")>-1?"&":"?"}${new URLSearchParams(this._params).toString()}`}}}};this.grid=new ph(n),this.grid.on("load",()=>{this.emitTo("pb-results-received",{params:this._params})}),this.grid.render(t)})}_submit(){this.grid.forceRender()}render(){const t=I(this.cssPath);return O`
|
|
4231
4231
|
<link href="${t}/mermaid.min.css" rel="stylesheet">
|
|
4232
|
-
${this.search?
|
|
4232
|
+
${this.search?O`
|
|
4233
4233
|
<iron-form id="form">
|
|
4234
4234
|
<form action="">
|
|
4235
4235
|
<paper-input id="search" name="search" label="Search" @keyup="${t=>13==t.keyCode?this._submit():null}">
|
|
@@ -4239,16 +4239,16 @@ const qa=e({is:"iron-label",listeners:{tap:"_tapHandler"},properties:{for:{type:
|
|
|
4239
4239
|
</iron-form>
|
|
4240
4240
|
`:null}
|
|
4241
4241
|
<div id="table"></div>
|
|
4242
|
-
`}static get styles(){return
|
|
4242
|
+
`}static get styles(){return V`
|
|
4243
4243
|
:host {
|
|
4244
4244
|
display: block;
|
|
4245
4245
|
}
|
|
4246
4246
|
button {
|
|
4247
4247
|
border: 0;
|
|
4248
4248
|
}
|
|
4249
|
-
`}}customElements.define("pb-table-grid",zh);class Sh extends(
|
|
4249
|
+
`}}customElements.define("pb-table-grid",zh);class Sh extends(R(T)){static get properties(){return Object.assign({url:{type:String},selected:{type:String},subforms:{type:String},_categories:{type:Array}},super.properties)}constructor(){super(),this._categories=[],this._params={},this.selected=null,this.subforms=null}connectedCallback(){super.connectedCallback(),this.selected=this.getParameter("category",this.selected),window.addEventListener("popstate",t=>{console.log("<pb-split-list> popstate: %o",t),this.selected=t.state.category,this.submit()}),this.subscribeTo("pb-submit",this.load.bind(this))}firstUpdated(){super.firstUpdated(),Sh.waitOnce("pb-page-ready",()=>{this.load()})}submit(){this.load()}load(){const t=this._paramsFromSubforms({category:this.selected});this.setParameters(t),this.pushHistory("pb-split-list",t);const e=new URLSearchParams(t),i=`${this.toAbsoluteURL(this.url)}?${e.toString()}`;console.log("<pb-split-list> Fetching from URL: "+i),this.emitTo("pb-start-update"),fetch(i).then(t=>t.ok?t.json():Promise.reject(t.status)).then(t=>{this._categories=t.categories,this.innerHTML=t.items.join(""),this.emitTo("pb-end-update")}).catch(t=>{console.error("<pb-split-list> Error caught: "+t),this.emitTo("pb-end-update")})}_selectCategory(t,e){t.preventDefault(),this.selected=e,this.load()}_paramsFromSubforms(t){return this.subforms&&document.querySelectorAll(this.subforms).forEach(e=>{e.serializeForm&&Object.assign(t,e.serializeForm())}),t}render(){return O`
|
|
4250
4250
|
<header>
|
|
4251
|
-
${this._categories.map(t=>
|
|
4251
|
+
${this._categories.map(t=>O`
|
|
4252
4252
|
<a part="${this.selected===t.category?"active-category":"category"}" href="#${t.category}" title="${t.count}" class="${this.selected===t.category?"active":""}"
|
|
4253
4253
|
@click="${e=>this._selectCategory(e,t.category)}">
|
|
4254
4254
|
${t.category}
|
|
@@ -4256,7 +4256,7 @@ const qa=e({is:"iron-label",listeners:{tap:"_tapHandler"},properties:{for:{type:
|
|
|
4256
4256
|
`)}
|
|
4257
4257
|
</header>
|
|
4258
4258
|
<div id="items" part="items"><slot></slot></div>
|
|
4259
|
-
`}static get styles(){return
|
|
4259
|
+
`}static get styles(){return V`
|
|
4260
4260
|
:host {
|
|
4261
4261
|
display: block;
|
|
4262
4262
|
}
|
|
@@ -4285,7 +4285,7 @@ const qa=e({is:"iron-label",listeners:{tap:"_tapHandler"},properties:{for:{type:
|
|
|
4285
4285
|
text-decoration: none;
|
|
4286
4286
|
color: var(--pb-highlight-color);
|
|
4287
4287
|
}
|
|
4288
|
-
`}}customElements.define("pb-split-list",Sh);class Ch{constructor(t={},e=60,i=["D","W","M","Y","5Y","10Y"]){this.data={invalid:{},valid:{}},this.maxInterval=e,this.scopes=i,this._validateJsonData(t)}getMinDateStr(){return Object.keys(this.data.valid).sort()[0]}getMaxDateStr(){let t=Object.keys(this.data.valid);return t.sort()[t.length-1]}getMinDate(){return this._dateStrToUTCDate(this.getMinDateStr())}getMaxDate(){return this._dateStrToUTCDate(this.getMaxDateStr())}getEndOfRangeDate(t,e){return this._UTCDateToDateStr(this._increaseDateBy(t,e))}export(t){if(t=t||this._autoAssignScope(),!this.scopes.includes(t))throw new Error(`invalid scope provided, expected: ["10Y", "5Y", "Y", "M", "W", "D"]. Got: "${t}"`);const e={data:[],scope:t,binTitleRotated:this._binTitleRotatedLookup(t)};if(0===Object.keys(this.data.valid).length)return e;const i=this._classify(this.getMinDateStr(),t),n=this._getFirstDay(i);let r=this._dateStrToUTCDate(n);const o=this.getMaxDate();for(;r<=o;){const i=this._UTCDateToDateStr(r),n=this._classify(i,t);e.data.push(this._buildBinObject(i,n,t)),r=this._increaseDateBy(t,r)}if(Object.keys(this.data.valid).sort().forEach(i=>{const n=this._classify(i,t),r=e.data.find(t=>t.category===n);try{const t=this.data.valid[i];"object"==typeof t?(r.value+=t.count||0,t.info&&(r.info=r.info.concat(t.info))):r.value+=this.data.valid[i]||0}catch(t){console.log(t),console.log("currentCategory"),console.log(n)}}),this.data.invalid){let t=0,i=[];Object.values(this.data.invalid).forEach(e=>{"object"==typeof e?(t+=e.count||0,i=i.concat(e.info)):t+=e}),t>0&&e.data.push({tooltip:a("timeline.unknown"),title:a("timeline.unknown"),category:"?",separator:!0,value:t,info:i})}return e}_autoAssignScope(){for(let t=0;t<this.scopes.length;t++)if(this._computeIntervalSize(this.scopes[t])<=this.maxInterval)return this.scopes[t];throw new Error(`Interval too big! Computed: ${this._computeIntervalSize(this.scopes[i])}. Allowed: ${this.maxInterval}. Try to increase maxInterval.`)}_validateJsonData(t){Object.keys(t).sort().forEach(e=>{this._isValidDateStr(e)?this.data.valid[e]=t[e]:this.data.invalid[e]=t[e]})}_binTitleRotatedLookup(t){return{"10Y":!0,"5Y":!0,Y:!0,M:!1,W:!0,D:!0}[t]}_buildBinObject(t,e,i){const n=t.split("-"),r=n[0],o=n[1],s=n[2],a={dateStr:t,category:e,value:0,info:[]};if("10Y"===i)a.tooltip=`${e} - ${Number(e)+9}`,a.selectionStart=""+e,a.selectionEnd=""+(Number(e)+9),Number(e)%100==0&&(a.title=`${e} - ${Number(e)+99}`,a.binTitle=e,a.seperator=!0);else if("5Y"===i)a.tooltip=`${e} - ${Number(e)+4}`,a.selectionStart=""+e,a.selectionEnd=""+(Number(e)+4),Number(e)%50==0&&(a.title=`${e} - ${Number(e)+49}`,a.binTitle=e,a.seperator=!0);else if("Y"===i)a.tooltip=e,a.selectionStart=e,a.selectionEnd=e,Number(e)%10==0&&(a.title=`${e} - ${Number(e)+9}`,a.binTitle=""+e,a.seperator=!0);else if("M"===i){const t=Number(o),e=this._monthLookup(t);a.binTitle=e[0],a.tooltip=`${e} ${r}`,a.selectionStart=`${e} ${r}`,a.selectionEnd=`${e} ${r}`,1===t&&(a.title=r,a.seperator=!0)}else if("W"===i){const i=e.split("-")[1];a.tooltip=`${r} ${i}`,a.selectionStart=`${r} ${i}`,a.selectionEnd=`${r} ${i}`;let n=this._dateStrToUTCDate(t),o=this._addDays(n,-7);n.getUTCMonth()!==o.getUTCMonth()&&(a.binTitle=i,a.title=this._monthLookup(n.getUTCMonth()+1)),a.seperator="W1"===i}else{if("D"!==i)throw new Error(`invalid scope provided, expected: ["10Y", "5Y", "Y", "M", "W", "D"]. Got: "${i}"`);a.tooltip=t,a.selectionStart=t,a.selectionEnd=t,1===this._dateStrToUTCDate(t).getUTCDay()&&(a.binTitle=`${Number(s)}.${Number(o)}`,a.title=""+this._classify(t,"W").replace("-"," "),a.seperator=!0)}return a}_classify(t,e){if(!t.match(/^\d{4}-\d{2}-\d{2}$/))throw new Error(`invalid dateStr format, expected "YYYY-MM-DD", got: "${t}".`);if(!t||!e)throw new Error(`both inputs must be provided. Got dateStr=${t}, scope=${e}`);switch(e){case"10Y":case"5Y":const i=Number(e.replace("Y",""));return(Math.floor(Number(t.split("-")[0])/i)*i).toString();case"Y":return t.substr(0,4);case"M":return t.substr(0,7);case"W":const n=this._dateStrToUTCDate(t);return this._UTCDateToWeekFormat(n);case"D":return t}}_getFirstDay(t){if(t.match(/^\d{4}-\d{2}-\d{2}$/))return t;if(t.match(/^\d{4}-\d{2}$/))return t+"-01";if(t.match(/^\d{4}$/))return t+"-01-01";if(t.match(/^\d{4}-W([1-9]|[1-4][0-9]|5[0-3])$/)){const e=t.split("-"),i=Number(e[0]),n=Number(e[1].replace("W",""));return this._getDateStrOfISOWeek(i,n)}throw new Error("invalid categoryStr")}_dateStrToUTCDate(t){if(!this._isValidDateStr(t))throw new Error(`invalid dateStr, expected "YYYY-MM-DD" with month[1-12] and day[1-31], got: "${t}".`);const e=t.split("-"),i=Number(e[0]),n=Number(e[1]),r=Number(e[2]);return new Date(Date.UTC(i,n-1,r))}_UTCDateToDateStr(t){return t.toISOString().split("T")[0]}_UTCDateToWeekFormat(t){return`${this._getISOWeekYear(t)}-W${this._getISOWeek(t)}`}_getISOWeek(t){let e=new Date(t.getTime());e.setHours(0,0,0,0),e.setDate(e.getDate()+3-(e.getDay()+6)%7);let i=new Date(e.getFullYear(),0,4);return 1+Math.round(((e.getTime()-i.getTime())/864e5-3+(i.getDay()+6)%7)/7)}_getISOWeekYear(t){var e=new Date(t.getTime());return e.setDate(e.getDate()+3-(e.getDay()+6)%7),e.getFullYear()}_getDateStrOfISOWeek(t,e){let i=new Date(Date.UTC(t,0,1+7*(e-1))),n=i.getUTCDay(),r=i;return n<=4?r.setDate(i.getDate()-i.getUTCDay()+1):r.setDate(i.getDate()+8-i.getUTCDay()),r.toISOString().split("T")[0]}getIntervalSizes(){return{D:this._computeIntervalSize("D"),W:this._computeIntervalSize("W"),M:this._computeIntervalSize("M"),Y:this._computeIntervalSize("Y"),"5Y":this._computeIntervalSize("5Y"),"10Y":this._computeIntervalSize("10Y")}}_computeIntervalSize(t){const e=this.getMaxDateStr();if(!e)return 0;const i=this._dateStrToUTCDate(e),n=this._getFirstDay(this._classify(this.getMinDateStr(),t));let r=this._dateStrToUTCDate(n),o=0;for(;r<=i;)o++,r=this._increaseDateBy(t,r);return o}_increaseDateBy(t,e){switch(t){case"D":return this._addDays(e,1);case"W":return this._addDays(e,7);case"M":return this._addMonths(e,1);case"Y":return this._addYears(e,1);case"5Y":return this._addYears(e,5);case"10Y":return this._addYears(e,10)}}_addDays(t,e){let i=new Date(t.valueOf());return i.setUTCDate(i.getUTCDate()+e),i}_addMonths(t,e){let i=new Date(t.valueOf()),n=i.getUTCDate();return i.setUTCMonth(i.getUTCMonth()+ +e),i.getUTCDate()!=n&&i.setUTCDate(0),i}_addYears(t,e){let i=new Date(t.valueOf());return i.setUTCFullYear(i.getUTCFullYear()+e),i}_isValidDateStr(t){if(!t)return!1;let e=t.split("-");if(3!==e.length)return!1;let i=e[0],n=e[1],r=e[2];return"0000"!==i&&"00"!==r&&"00"!==n&&(!(Number(r)<1||Number(r)>31)&&!(Number(n)<1||Number(n)>12))}_monthLookup(t){if(t>12||t<1)throw new Error("invalid 'num' provided, expected 1-12. Got: "+t);return{1:"Jan",2:"Feb",3:"Mar",4:"Apr",5:"May",6:"Jun",7:"Jul",8:"Aug",9:"Sep",10:"Oct",11:"Nov",12:"Dec"}[t.toString()]}}class Eh{constructor(){}run(t){this.input=t,this.day="??",this.month="??",this.year="????";const e=this.input.match(this._isoMatchRegex()),i=this.input.match(this._customRegex()),n=this.input.match(this._weekMatchRegex()),r=this.input.match(this._yearAndMonthRegex());if(e){const t=e[1].split(/-|\/|\s/);this.year=t[0],this.month=this._setWithLeadingZero(t[1]),this.day=this._setWithLeadingZero(t[2])}else if(r){const t=r[1].split("-");this.year=t[0],this.month=this._setWithLeadingZero(t[1]),this.day="01"}else if(i){const t=i[0].split(/\.|\s|\/|-/);this.day=this._setWithLeadingZero(t[0]),this.month=this._setWithLeadingZero(t[1]),this.year=t[2]}else{if(n){const t=n[0].split(/\.|\s|\/|-/),e=Number(t[0]),i=Number(t[1].replace("W0","").replace("W",""));return this._getDateStrOfISOWeek(e,i)}this._findYear(),this._findMonth(),this._findDay()}return this._buildResult()}_buildResult(){return"????"!=this.year&&"??"===this.month&&(this.month="01"),"??"!=this.month&&"??"===this.day&&(this.day="01"),`${this.year}-${this.month}-${this.day}`}_isoMatchRegex(){return/(?:\s|^)(\d{4}(-|\s|\/)([0][1-9]|[1-9]|10|11|12)(-|\s|\/)([0][1-9]|[1-2][0-9]|3[01]|[1-9]))(?=\s|$|\.)/}_customRegex(){return/\d{1,2}(\.|\s|\/|-)\d{1,2}(\.|\s|\/|-)\d{4}/}_weekMatchRegex(){return/\d{4}(\.|\s|\/|-)W\d{1,2}(?=\s|$|\.)/}_yearAndMonthRegex(){return/(?:\s|^)(\d{4}-([0][1-9]|[1-9]|10|11|12))(?=\s|$)/}_findYear(){let t=/[1-9]{1}[0-9]{3}/;const e=this.input.match(t);e&&(this.year=e[0],this._removeMatchFromInput(e))}_findMonth(){this._monthDictionaryValues().forEach(t=>{const e=new RegExp(`(?:\\s|^)(${t})(?=\\s|$|\\.)`,"i"),i=this.input.match(e);if(i)return this.month=this._monthDictionary()[i[1].toLowerCase()],this._removeMatchFromInput(i),this.month})}_findDay(){const t=/(?:\s|^)([0][1-9]|[1-2][0-9]|3[01]|[1-9])(?=\s|$|\.|st|nd|rd|th)/,e=this.input.match(t);e&&(this.day=this._setWithLeadingZero(e[1]))}_setWithLeadingZero(t){return 1==(t=t.toString()).length?"0"+t:t}_removeMatchFromInput(t){if(t&&t[0]&&t.index){let e=t[0].length,i=this.input.split("");i.splice(t.index,e),this.input=i.join("")}}_monthDictionaryValues(){return Object.keys(this._monthDictionary())}_monthDictionary(){return{jan:"01",januar:"01",feb:"02",februar:"02","mär":"03","märz":"03",apr:"04",april:"04",mai:"05",mai:"05",jun:"06",juni:"06",jul:"07",juli:"07",aug:"08",august:"08",sep:"09",september:"09",okt:"10",oktober:"10",nov:"11",november:"11",dez:"12",dezember:"12",jan:"01",january:"01",feb:"02",february:"02",mar:"03",march:"03",apr:"04",april:"04",may:"05",may:"05",jun:"06",june:"06",jul:"07",july:"07",aug:"08",august:"08",sep:"09",september:"09",oct:"10",october:"10",nov:"11",november:"11",dec:"12",december:"12",janv:"01",janvier:"01","févr":"02","février'":"02",mars:"03",mars:"03",avr:"04",avril:"04",mai:"05",mai:"05",juin:"06",juin:"06",juil:"07",juillet:"07","août":"08","août":"08",sept:"09",septembre:"09",oct:"10",octobre:"10",nov:"11",novembre:"11","déc":"12","décembre":"12",gen:"01",gennaio:"01",feb:"02",febbraio:"02",mar:"03",marzo:"03",apr:"04",aprile:"04",mag:"05",maggio:"05",giu:"06",giugno:"06",lug:"07",luglio:"07",ago:"08",agosto:"08",set:"09",settembre:"09",ott:"10",ottobre:"10",nov:"11",novembre:"11",dic:"12",dicembre:"12"}}_getDateStrOfISOWeek(t,e){let i=new Date(t,0,1+7*(e-1)),n=i.getDay(),r=i;return n<=4?r.setDate(i.getDate()-i.getDay()+1):r.setDate(i.getDate()+8-i.getDay()),r.getFullYear()>t?t+"-12-31":r.getFullYear()<t?t+"-01-01":this._dateToDateStr(r)}_dateToDateStr(t){let e=new Date(t),i=this._setWithLeadingZero(e.getMonth()+1),n=this._setWithLeadingZero(e.getDate());return`${e.getFullYear()}-${i}-${n}`}}class Mh extends(N(V)){static get styles(){return P`
|
|
4288
|
+
`}}customElements.define("pb-split-list",Sh);class Ch{constructor(t={},e=60,i=["D","W","M","Y","5Y","10Y"]){this.data={invalid:{},valid:{}},this.maxInterval=e,this.scopes=i,this._validateJsonData(t)}getMinDateStr(){return Object.keys(this.data.valid).sort()[0]}getMaxDateStr(){let t=Object.keys(this.data.valid);return t.sort()[t.length-1]}getMinDate(){return this._dateStrToUTCDate(this.getMinDateStr())}getMaxDate(){return this._dateStrToUTCDate(this.getMaxDateStr())}getEndOfRangeDate(t,e){return this._UTCDateToDateStr(this._increaseDateBy(t,e))}export(t){if(t=t||this._autoAssignScope(),!this.scopes.includes(t))throw new Error(`invalid scope provided, expected: ["10Y", "5Y", "Y", "M", "W", "D"]. Got: "${t}"`);const e={data:[],scope:t,binTitleRotated:this._binTitleRotatedLookup(t)};if(0===Object.keys(this.data.valid).length)return e;const i=this._classify(this.getMinDateStr(),t),n=this._getFirstDay(i);let r=this._dateStrToUTCDate(n);const o=this.getMaxDate();for(;r<=o;){const i=this._UTCDateToDateStr(r),n=this._classify(i,t);e.data.push(this._buildBinObject(i,n,t)),r=this._increaseDateBy(t,r)}if(Object.keys(this.data.valid).sort().forEach(i=>{const n=this._classify(i,t),r=e.data.find(t=>t.category===n);try{const t=this.data.valid[i];"object"==typeof t?(r.value+=t.count||0,t.info&&(r.info=r.info.concat(t.info))):r.value+=this.data.valid[i]||0}catch(t){console.log(t),console.log("currentCategory"),console.log(n)}}),this.data.invalid){let t=0,i=[];Object.values(this.data.invalid).forEach(e=>{"object"==typeof e?(t+=e.count||0,i=i.concat(e.info)):t+=e}),t>0&&e.data.push({tooltip:j("timeline.unknown"),title:j("timeline.unknown"),category:"?",separator:!0,value:t,info:i})}return e}_autoAssignScope(){for(let t=0;t<this.scopes.length;t++)if(this._computeIntervalSize(this.scopes[t])<=this.maxInterval)return this.scopes[t];throw new Error(`Interval too big! Computed: ${this._computeIntervalSize(this.scopes[i])}. Allowed: ${this.maxInterval}. Try to increase maxInterval.`)}_validateJsonData(t){Object.keys(t).sort().forEach(e=>{this._isValidDateStr(e)?this.data.valid[e]=t[e]:this.data.invalid[e]=t[e]})}_binTitleRotatedLookup(t){return{"10Y":!0,"5Y":!0,Y:!0,M:!1,W:!0,D:!0}[t]}_buildBinObject(t,e,i){const n=t.split("-"),r=n[0],o=n[1],s=n[2],a={dateStr:t,category:e,value:0,info:[]};if("10Y"===i)a.tooltip=`${e} - ${Number(e)+9}`,a.selectionStart=""+e,a.selectionEnd=""+(Number(e)+9),Number(e)%100==0&&(a.title=`${e} - ${Number(e)+99}`,a.binTitle=e,a.seperator=!0);else if("5Y"===i)a.tooltip=`${e} - ${Number(e)+4}`,a.selectionStart=""+e,a.selectionEnd=""+(Number(e)+4),Number(e)%50==0&&(a.title=`${e} - ${Number(e)+49}`,a.binTitle=e,a.seperator=!0);else if("Y"===i)a.tooltip=e,a.selectionStart=e,a.selectionEnd=e,Number(e)%10==0&&(a.title=`${e} - ${Number(e)+9}`,a.binTitle=""+e,a.seperator=!0);else if("M"===i){const t=Number(o),e=this._monthLookup(t);a.binTitle=e[0],a.tooltip=`${e} ${r}`,a.selectionStart=`${e} ${r}`,a.selectionEnd=`${e} ${r}`,1===t&&(a.title=r,a.seperator=!0)}else if("W"===i){const i=e.split("-")[1];a.tooltip=`${r} ${i}`,a.selectionStart=`${r} ${i}`,a.selectionEnd=`${r} ${i}`;let n=this._dateStrToUTCDate(t),o=this._addDays(n,-7);n.getUTCMonth()!==o.getUTCMonth()&&(a.binTitle=i,a.title=this._monthLookup(n.getUTCMonth()+1)),a.seperator="W1"===i}else{if("D"!==i)throw new Error(`invalid scope provided, expected: ["10Y", "5Y", "Y", "M", "W", "D"]. Got: "${i}"`);a.tooltip=t,a.selectionStart=t,a.selectionEnd=t,1===this._dateStrToUTCDate(t).getUTCDay()&&(a.binTitle=`${Number(s)}.${Number(o)}`,a.title=""+this._classify(t,"W").replace("-"," "),a.seperator=!0)}return a}_classify(t,e){if(!t.match(/^\d{4}-\d{2}-\d{2}$/))throw new Error(`invalid dateStr format, expected "YYYY-MM-DD", got: "${t}".`);if(!t||!e)throw new Error(`both inputs must be provided. Got dateStr=${t}, scope=${e}`);switch(e){case"10Y":case"5Y":const i=Number(e.replace("Y",""));return(Math.floor(Number(t.split("-")[0])/i)*i).toString();case"Y":return t.substr(0,4);case"M":return t.substr(0,7);case"W":const n=this._dateStrToUTCDate(t);return this._UTCDateToWeekFormat(n);case"D":return t}}_getFirstDay(t){if(t.match(/^\d{4}-\d{2}-\d{2}$/))return t;if(t.match(/^\d{4}-\d{2}$/))return t+"-01";if(t.match(/^\d{4}$/))return t+"-01-01";if(t.match(/^\d{4}-W([1-9]|[1-4][0-9]|5[0-3])$/)){const e=t.split("-"),i=Number(e[0]),n=Number(e[1].replace("W",""));return this._getDateStrOfISOWeek(i,n)}throw new Error("invalid categoryStr")}_dateStrToUTCDate(t){if(!this._isValidDateStr(t))throw new Error(`invalid dateStr, expected "YYYY-MM-DD" with month[1-12] and day[1-31], got: "${t}".`);const e=t.split("-"),i=Number(e[0]),n=Number(e[1]),r=Number(e[2]);return new Date(Date.UTC(i,n-1,r))}_UTCDateToDateStr(t){return t.toISOString().split("T")[0]}_UTCDateToWeekFormat(t){return`${this._getISOWeekYear(t)}-W${this._getISOWeek(t)}`}_getISOWeek(t){let e=new Date(t.getTime());e.setHours(0,0,0,0),e.setDate(e.getDate()+3-(e.getDay()+6)%7);let i=new Date(e.getFullYear(),0,4);return 1+Math.round(((e.getTime()-i.getTime())/864e5-3+(i.getDay()+6)%7)/7)}_getISOWeekYear(t){var e=new Date(t.getTime());return e.setDate(e.getDate()+3-(e.getDay()+6)%7),e.getFullYear()}_getDateStrOfISOWeek(t,e){let i=new Date(Date.UTC(t,0,1+7*(e-1))),n=i.getUTCDay(),r=i;return n<=4?r.setDate(i.getDate()-i.getUTCDay()+1):r.setDate(i.getDate()+8-i.getUTCDay()),r.toISOString().split("T")[0]}getIntervalSizes(){return{D:this._computeIntervalSize("D"),W:this._computeIntervalSize("W"),M:this._computeIntervalSize("M"),Y:this._computeIntervalSize("Y"),"5Y":this._computeIntervalSize("5Y"),"10Y":this._computeIntervalSize("10Y")}}_computeIntervalSize(t){const e=this.getMaxDateStr();if(!e)return 0;const i=this._dateStrToUTCDate(e),n=this._getFirstDay(this._classify(this.getMinDateStr(),t));let r=this._dateStrToUTCDate(n),o=0;for(;r<=i;)o++,r=this._increaseDateBy(t,r);return o}_increaseDateBy(t,e){switch(t){case"D":return this._addDays(e,1);case"W":return this._addDays(e,7);case"M":return this._addMonths(e,1);case"Y":return this._addYears(e,1);case"5Y":return this._addYears(e,5);case"10Y":return this._addYears(e,10)}}_addDays(t,e){let i=new Date(t.valueOf());return i.setUTCDate(i.getUTCDate()+e),i}_addMonths(t,e){let i=new Date(t.valueOf()),n=i.getUTCDate();return i.setUTCMonth(i.getUTCMonth()+ +e),i.getUTCDate()!=n&&i.setUTCDate(0),i}_addYears(t,e){let i=new Date(t.valueOf());return i.setUTCFullYear(i.getUTCFullYear()+e),i}_isValidDateStr(t){if(!t)return!1;let e=t.split("-");if(3!==e.length)return!1;let i=e[0],n=e[1],r=e[2];return"0000"!==i&&"00"!==r&&"00"!==n&&(!(Number(r)<1||Number(r)>31)&&!(Number(n)<1||Number(n)>12))}_monthLookup(t){if(t>12||t<1)throw new Error("invalid 'num' provided, expected 1-12. Got: "+t);return{1:"Jan",2:"Feb",3:"Mar",4:"Apr",5:"May",6:"Jun",7:"Jul",8:"Aug",9:"Sep",10:"Oct",11:"Nov",12:"Dec"}[t.toString()]}}class Eh{constructor(){}run(t){this.input=t,this.day="??",this.month="??",this.year="????";const e=this.input.match(this._isoMatchRegex()),i=this.input.match(this._customRegex()),n=this.input.match(this._weekMatchRegex()),r=this.input.match(this._yearAndMonthRegex());if(e){const t=e[1].split(/-|\/|\s/);this.year=t[0],this.month=this._setWithLeadingZero(t[1]),this.day=this._setWithLeadingZero(t[2])}else if(r){const t=r[1].split("-");this.year=t[0],this.month=this._setWithLeadingZero(t[1]),this.day="01"}else if(i){const t=i[0].split(/\.|\s|\/|-/);this.day=this._setWithLeadingZero(t[0]),this.month=this._setWithLeadingZero(t[1]),this.year=t[2]}else{if(n){const t=n[0].split(/\.|\s|\/|-/),e=Number(t[0]),i=Number(t[1].replace("W0","").replace("W",""));return this._getDateStrOfISOWeek(e,i)}this._findYear(),this._findMonth(),this._findDay()}return this._buildResult()}_buildResult(){return"????"!=this.year&&"??"===this.month&&(this.month="01"),"??"!=this.month&&"??"===this.day&&(this.day="01"),`${this.year}-${this.month}-${this.day}`}_isoMatchRegex(){return/(?:\s|^)(\d{4}(-|\s|\/)([0][1-9]|[1-9]|10|11|12)(-|\s|\/)([0][1-9]|[1-2][0-9]|3[01]|[1-9]))(?=\s|$|\.)/}_customRegex(){return/\d{1,2}(\.|\s|\/|-)\d{1,2}(\.|\s|\/|-)\d{4}/}_weekMatchRegex(){return/\d{4}(\.|\s|\/|-)W\d{1,2}(?=\s|$|\.)/}_yearAndMonthRegex(){return/(?:\s|^)(\d{4}-([0][1-9]|[1-9]|10|11|12))(?=\s|$)/}_findYear(){let t=/[1-9]{1}[0-9]{3}/;const e=this.input.match(t);e&&(this.year=e[0],this._removeMatchFromInput(e))}_findMonth(){this._monthDictionaryValues().forEach(t=>{const e=new RegExp(`(?:\\s|^)(${t})(?=\\s|$|\\.)`,"i"),i=this.input.match(e);if(i)return this.month=this._monthDictionary()[i[1].toLowerCase()],this._removeMatchFromInput(i),this.month})}_findDay(){const t=/(?:\s|^)([0][1-9]|[1-2][0-9]|3[01]|[1-9])(?=\s|$|\.|st|nd|rd|th)/,e=this.input.match(t);e&&(this.day=this._setWithLeadingZero(e[1]))}_setWithLeadingZero(t){return 1==(t=t.toString()).length?"0"+t:t}_removeMatchFromInput(t){if(t&&t[0]&&t.index){let e=t[0].length,i=this.input.split("");i.splice(t.index,e),this.input=i.join("")}}_monthDictionaryValues(){return Object.keys(this._monthDictionary())}_monthDictionary(){return{jan:"01",januar:"01",feb:"02",februar:"02","mär":"03","märz":"03",apr:"04",april:"04",mai:"05",mai:"05",jun:"06",juni:"06",jul:"07",juli:"07",aug:"08",august:"08",sep:"09",september:"09",okt:"10",oktober:"10",nov:"11",november:"11",dez:"12",dezember:"12",jan:"01",january:"01",feb:"02",february:"02",mar:"03",march:"03",apr:"04",april:"04",may:"05",may:"05",jun:"06",june:"06",jul:"07",july:"07",aug:"08",august:"08",sep:"09",september:"09",oct:"10",october:"10",nov:"11",november:"11",dec:"12",december:"12",janv:"01",janvier:"01","févr":"02","février'":"02",mars:"03",mars:"03",avr:"04",avril:"04",mai:"05",mai:"05",juin:"06",juin:"06",juil:"07",juillet:"07","août":"08","août":"08",sept:"09",septembre:"09",oct:"10",octobre:"10",nov:"11",novembre:"11","déc":"12","décembre":"12",gen:"01",gennaio:"01",feb:"02",febbraio:"02",mar:"03",marzo:"03",apr:"04",aprile:"04",mag:"05",maggio:"05",giu:"06",giugno:"06",lug:"07",luglio:"07",ago:"08",agosto:"08",set:"09",settembre:"09",ott:"10",ottobre:"10",nov:"11",novembre:"11",dic:"12",dicembre:"12"}}_getDateStrOfISOWeek(t,e){let i=new Date(t,0,1+7*(e-1)),n=i.getDay(),r=i;return n<=4?r.setDate(i.getDate()-i.getDay()+1):r.setDate(i.getDate()+8-i.getDay()),r.getFullYear()>t?t+"-12-31":r.getFullYear()<t?t+"-01-01":this._dateToDateStr(r)}_dateToDateStr(t){let e=new Date(t),i=this._setWithLeadingZero(e.getMonth()+1),n=this._setWithLeadingZero(e.getDate());return`${e.getFullYear()}-${i}-${n}`}}class Mh extends(R(T)){static get styles(){return V`
|
|
4289
4289
|
:host{
|
|
4290
4290
|
display: block;
|
|
4291
4291
|
}
|
|
@@ -4478,11 +4478,11 @@ const qa=e({is:"iron-label",listeners:{tap:"_tapHandler"},properties:{for:{type:
|
|
|
4478
4478
|
.close.rounded::before, .close.rounded::after {
|
|
4479
4479
|
border-radius: 5px;
|
|
4480
4480
|
}
|
|
4481
|
-
`}static get properties(){return Object.assign(Object.assign({},super.properties),{},{startDate:{type:String,reflect:!0,attribute:"start-date"},endDate:{type:String,reflect:!0,attribute:"end-date"},scope:{type:String},scopes:{type:Array},maxInterval:{type:Number,attribute:"max-interval"},url:{type:String},auto:{type:Boolean},resettable:{type:Boolean},_language:{type:String}})}constructor(){super(),this.maxHeight=80,this.multiplier=.75,this.mousedown=!1,this.startDate="",this.endDate="",this.scope="",this.scopes=["D","W","M","Y","5Y","10Y"],this.maxInterval=60,this.url="",this.auto=!1,this.resettable=!1,this._language="en",this._resetSelectionProperty()}connectedCallback(){super.connectedCallback(),this.subscribeTo("pb-results-received",()=>{const t=this.shadowRoot.getElementById("loadData"),e=this.toAbsoluteURL(this.url,this.getEndpoint());t.url=e,t.generateRequest()}),this.subscribeTo("pb-i18n-update",t=>{this._language=t.detail.language})}firstUpdated(){this.bins=this.shadowRoot.querySelectorAll(".bin-container"),this.tooltip=this.shadowRoot.getElementById("tooltip"),document.addEventListener("mouseup",()=>{this._mouseUp()}),document.addEventListener("pb-timeline-daterange-changed",t=>{const e=t.detail.startDateStr,i=t.detail.endDateStr;if(this._fullRangeSelected(e,i))return console.log("_fullRangeSelected() is true"),void this.resetSelection();this.select(e,i)}),document.addEventListener("pb-timeline-reset-selection",()=>{this.resetSelection(),this._hideTooltip()})}updated(t){t.has("scope")&&this.searchResult&&(this.scopes.includes(this.scope)?this.setData(this.searchResult.export(this.scope)):console.error("unknown scope ",this.scope))}setData(t){this.dataObj=t,this.maxValue=Math.max(...this.dataObj.data.map(t=>t.value)),this.requestUpdate(),this.updateComplete.then(()=>{this.bins=this.shadowRoot.querySelectorAll(".bin-container"),this.resetSelection(),this._resetTooltip()})}get label(){return this.dataObj&&0!==this.dataObj.data.length?1===this.dataObj.data.length?this.dataObj.data[0].category:`${this.dataObj.data[0].category} – ${this.dataObj.data[this.dataObj.data.length-1].category}`:""}getSelectedStartDateStr(){return this.shadowRoot.querySelectorAll(".bin-container.selected")[0].dataset.selectionstart}getSelectedEndDateStr(){const t=this.shadowRoot.querySelectorAll(".bin-container.selected");return t[t.length-1].dataset.selectionend}getSelectedCategories(){const t=this.shadowRoot.querySelectorAll(".bin-container.selected"),e=[];return t.forEach(t=>e.push(t.dataset.category)),e}getSelectedItemCount(){const t=this.shadowRoot.querySelectorAll(".bin-container.selected");let e=0;return t.forEach(t=>{e+=parseInt(t.dataset.value)}),e}resetSelection(){this.bins.forEach(t=>{t.classList.remove("selected")}),this._resetSelectionProperty(),this._hideTooltip()}select(t,e){this.bins.forEach(i=>{i.dataset.isodatestr>=t&&i.dataset.isodatestr<=e?i.classList.add("selected"):i.classList.remove("selected")}),this._displayTooltip(),this._showtooltipSelection()}_fullRangeSelected(t,e){const i=this.bins[0].dataset.isodatestr,n=e===this.bins[this.bins.length-1].dataset.isodatestr;return i&&n}_mouseDown(t){this.resetSelection(),this.mousedown=!0,this.selection.start=this._getMousePosition(t).x,this._applySelectionToBins()}_mouseUp(){if(this.mousedown){this.mousedown=!1;const t=this.getSelectedStartDateStr(),e=this.getSelectedEndDateStr();if(t){const i=(new Eh).run(t),n=(new Eh).run(e),r=this.getSelectedItemCount();this._dispatchTimelineDaterangeChangedEvent(i,n,this.getSelectedCategories(),r)}}}_mouseMove(t){this.mousedown?(this._brushing(t),this._showtooltipSelection()):void 0===this.selection.start&&this._showtooltip(t)}_mouseenter(){this.dataObj&&this._displayTooltip()}_getMousePosition(t){let e=this.shadowRoot.querySelector(".wrapper").getBoundingClientRect();return{x:t.clientX-e.left+1,y:t.clientY-e.top+1}}_brushing(t){this.selection.end=this._getMousePosition(t).x,this._applySelectionToBins()}_dispatchTimelineDaterangeChangedEvent(t,e,i,n){"????-??-??"===t?this.emitTo("pb-timeline-date-changed",{startDateStr:null,endDateStr:null,categories:["?"],count:n}):t===e?"D"!==this.dataObj.scope?this.emitTo("pb-timeline-daterange-changed",{startDateStr:t,endDateStr:this.searchResult.getEndOfRangeDate(this.dataObj.scope,e),scope:this.dataObj.scope,categories:i,count:n,label:this.label}):this.emitTo("pb-timeline-date-changed",{startDateStr:t,endDateStr:null,scope:this.dataObj.scope,categories:i,count:n,label:this.label}):this.emitTo("pb-timeline-daterange-changed",{startDateStr:t,endDateStr:e,categories:i,scope:this.dataObj.scope,count:n,label:this.label})}_dispatchPbTimelineResetSelectionEvent(){this.emitTo("pb-timeline-reset-selection")}_showtooltip(t){const e=this._getElementInterval(t.currentTarget);let i;e[0]<e[2]?(i=Math.round((e[0]+e[1])/2-10),this.tooltip.classList.remove("right")):(i=Math.round((e[0]+e[1])/2-this.tooltip.offsetWidth)+10,this.tooltip.classList.add("right")),this.tooltip.style.left=i+"px";const n=t.currentTarget.dataset.tooltip,r=this._numberWithCommas(t.currentTarget.dataset.value),o=t.currentTarget.querySelector(".info");this.tooltip.querySelector("#tooltip-text").innerHTML=`<div><strong>${n}</strong>: ${r}</div><ul>${o?o.innerHTML:""}</ul>`}_showtooltipSelection(){const t=this._getSelectedBins(),e=[this._getElementInterval(t[0])[0],this._getElementInterval(t[t.length-1])[1]],i=`${t[0].dataset.selectionstart} - ${t[t.length-1].dataset.selectionend}`,n=t.map(t=>Number(t.dataset.value)).reduce((t,e)=>t+e),r=this._numberWithCommas(n);this.tooltip.querySelector("#tooltip-text").innerHTML=`<strong>${i}</strong>: ${r}`,this.tooltip.querySelector("#tooltip-close").classList.remove("hidden"),this.tooltip.classList.add("draggable");const o=Math.round((e[0]+e[1])/2-this.tooltip.offsetWidth/2);this.tooltip.style.left=o+"px"}_resetTooltip(){this._hideTooltip(),this.tooltip.style.left="-1000px",this.tooltip.querySelector("#tooltip-text").innerHTML=""}_hideTooltip(){void 0===this.selection.start&&(this.tooltip.classList.add("hidden"),this.tooltip.classList.remove("draggable"),this.tooltip.querySelector("#tooltip-close").classList.add("hidden"))}_displayTooltip(){this.tooltip.classList.remove("hidden")}_getElementInterval(t){let e=this.shadowRoot.querySelector(".wrapper").getBoundingClientRect(),i=t,n=[i.getBoundingClientRect().x,i.getBoundingClientRect().x+i.getBoundingClientRect().width];return[n[0]-e.left+1,n[1]-e.left+1,e.width/2]}_getSelectionInterval(){return[this.selection.start,this.selection.end].sort((t,e)=>t-e)}_getSelectedBins(){return Array.prototype.slice.call(this.bins).filter(t=>t.classList.contains("selected"))}_resetSelectionProperty(){this.selection={start:void 0,end:void 0}}_applySelectionToBins(){const t=this._getSelectionInterval();this.bins.forEach(e=>{const i=this._getElementInterval(e);this._areOverlapping(i,t)?e.classList.add("selected"):e.classList.remove("selected")})}_numberWithCommas(t){return new Intl.NumberFormat(this._language,{style:"decimal"}).format(t)}_areOverlapping(t,e){return e[0]<t[0]?e[1]>t[0]:e[0]<t[1]}render(){return
|
|
4481
|
+
`}static get properties(){return Object.assign(Object.assign({},super.properties),{},{startDate:{type:String,reflect:!0,attribute:"start-date"},endDate:{type:String,reflect:!0,attribute:"end-date"},scope:{type:String},scopes:{type:Array},maxInterval:{type:Number,attribute:"max-interval"},url:{type:String},auto:{type:Boolean},resettable:{type:Boolean},_language:{type:String}})}constructor(){super(),this.maxHeight=80,this.multiplier=.75,this.mousedown=!1,this.startDate="",this.endDate="",this.scope="",this.scopes=["D","W","M","Y","5Y","10Y"],this.maxInterval=60,this.url="",this.auto=!1,this.resettable=!1,this._language="en",this._resetSelectionProperty()}connectedCallback(){super.connectedCallback(),this.subscribeTo("pb-results-received",()=>{const t=this.shadowRoot.getElementById("loadData"),e=this.toAbsoluteURL(this.url,this.getEndpoint());t.url=e,t.generateRequest()}),this.subscribeTo("pb-i18n-update",t=>{this._language=t.detail.language})}firstUpdated(){this.bins=this.shadowRoot.querySelectorAll(".bin-container"),this.tooltip=this.shadowRoot.getElementById("tooltip"),document.addEventListener("mouseup",()=>{this._mouseUp()}),document.addEventListener("pb-timeline-daterange-changed",t=>{const e=t.detail.startDateStr,i=t.detail.endDateStr;if(this._fullRangeSelected(e,i))return console.log("_fullRangeSelected() is true"),void this.resetSelection();this.select(e,i)}),document.addEventListener("pb-timeline-reset-selection",()=>{this.resetSelection(),this._hideTooltip()})}updated(t){t.has("scope")&&this.searchResult&&(this.scopes.includes(this.scope)?this.setData(this.searchResult.export(this.scope)):console.error("unknown scope ",this.scope))}setData(t){this.dataObj=t,this.maxValue=Math.max(...this.dataObj.data.map(t=>t.value)),this.requestUpdate(),this.updateComplete.then(()=>{this.bins=this.shadowRoot.querySelectorAll(".bin-container"),this.resetSelection(),this._resetTooltip()})}get label(){return this.dataObj&&0!==this.dataObj.data.length?1===this.dataObj.data.length?this.dataObj.data[0].category:`${this.dataObj.data[0].category} – ${this.dataObj.data[this.dataObj.data.length-1].category}`:""}getSelectedStartDateStr(){return this.shadowRoot.querySelectorAll(".bin-container.selected")[0].dataset.selectionstart}getSelectedEndDateStr(){const t=this.shadowRoot.querySelectorAll(".bin-container.selected");return t[t.length-1].dataset.selectionend}getSelectedCategories(){const t=this.shadowRoot.querySelectorAll(".bin-container.selected"),e=[];return t.forEach(t=>e.push(t.dataset.category)),e}getSelectedItemCount(){const t=this.shadowRoot.querySelectorAll(".bin-container.selected");let e=0;return t.forEach(t=>{e+=parseInt(t.dataset.value)}),e}resetSelection(){this.bins.forEach(t=>{t.classList.remove("selected")}),this._resetSelectionProperty(),this._hideTooltip()}select(t,e){this.bins.forEach(i=>{i.dataset.isodatestr>=t&&i.dataset.isodatestr<=e?i.classList.add("selected"):i.classList.remove("selected")}),this._displayTooltip(),this._showtooltipSelection()}_fullRangeSelected(t,e){const i=this.bins[0].dataset.isodatestr,n=e===this.bins[this.bins.length-1].dataset.isodatestr;return i&&n}_mouseDown(t){this.resetSelection(),this.mousedown=!0,this.selection.start=this._getMousePosition(t).x,this._applySelectionToBins()}_mouseUp(){if(this.mousedown){this.mousedown=!1;const t=this.getSelectedStartDateStr(),e=this.getSelectedEndDateStr();if(t){const i=(new Eh).run(t),n=(new Eh).run(e),r=this.getSelectedItemCount();this._dispatchTimelineDaterangeChangedEvent(i,n,this.getSelectedCategories(),r)}}}_mouseMove(t){this.mousedown?(this._brushing(t),this._showtooltipSelection()):void 0===this.selection.start&&this._showtooltip(t)}_mouseenter(){this.dataObj&&this._displayTooltip()}_getMousePosition(t){let e=this.shadowRoot.querySelector(".wrapper").getBoundingClientRect();return{x:t.clientX-e.left+1,y:t.clientY-e.top+1}}_brushing(t){this.selection.end=this._getMousePosition(t).x,this._applySelectionToBins()}_dispatchTimelineDaterangeChangedEvent(t,e,i,n){"????-??-??"===t?this.emitTo("pb-timeline-date-changed",{startDateStr:null,endDateStr:null,categories:["?"],count:n}):t===e?"D"!==this.dataObj.scope?this.emitTo("pb-timeline-daterange-changed",{startDateStr:t,endDateStr:this.searchResult.getEndOfRangeDate(this.dataObj.scope,e),scope:this.dataObj.scope,categories:i,count:n,label:this.label}):this.emitTo("pb-timeline-date-changed",{startDateStr:t,endDateStr:null,scope:this.dataObj.scope,categories:i,count:n,label:this.label}):this.emitTo("pb-timeline-daterange-changed",{startDateStr:t,endDateStr:e,categories:i,scope:this.dataObj.scope,count:n,label:this.label})}_dispatchPbTimelineResetSelectionEvent(){this.emitTo("pb-timeline-reset-selection")}_showtooltip(t){const e=this._getElementInterval(t.currentTarget);let i;e[0]<e[2]?(i=Math.round((e[0]+e[1])/2-10),this.tooltip.classList.remove("right")):(i=Math.round((e[0]+e[1])/2-this.tooltip.offsetWidth)+10,this.tooltip.classList.add("right")),this.tooltip.style.left=i+"px";const n=t.currentTarget.dataset.tooltip,r=this._numberWithCommas(t.currentTarget.dataset.value),o=t.currentTarget.querySelector(".info");this.tooltip.querySelector("#tooltip-text").innerHTML=`<div><strong>${n}</strong>: ${r}</div><ul>${o?o.innerHTML:""}</ul>`}_showtooltipSelection(){const t=this._getSelectedBins(),e=[this._getElementInterval(t[0])[0],this._getElementInterval(t[t.length-1])[1]],i=`${t[0].dataset.selectionstart} - ${t[t.length-1].dataset.selectionend}`,n=t.map(t=>Number(t.dataset.value)).reduce((t,e)=>t+e),r=this._numberWithCommas(n);this.tooltip.querySelector("#tooltip-text").innerHTML=`<strong>${i}</strong>: ${r}`,this.tooltip.querySelector("#tooltip-close").classList.remove("hidden"),this.tooltip.classList.add("draggable");const o=Math.round((e[0]+e[1])/2-this.tooltip.offsetWidth/2);this.tooltip.style.left=o+"px"}_resetTooltip(){this._hideTooltip(),this.tooltip.style.left="-1000px",this.tooltip.querySelector("#tooltip-text").innerHTML=""}_hideTooltip(){void 0===this.selection.start&&(this.tooltip.classList.add("hidden"),this.tooltip.classList.remove("draggable"),this.tooltip.querySelector("#tooltip-close").classList.add("hidden"))}_displayTooltip(){this.tooltip.classList.remove("hidden")}_getElementInterval(t){let e=this.shadowRoot.querySelector(".wrapper").getBoundingClientRect(),i=t,n=[i.getBoundingClientRect().x,i.getBoundingClientRect().x+i.getBoundingClientRect().width];return[n[0]-e.left+1,n[1]-e.left+1,e.width/2]}_getSelectionInterval(){return[this.selection.start,this.selection.end].sort((t,e)=>t-e)}_getSelectedBins(){return Array.prototype.slice.call(this.bins).filter(t=>t.classList.contains("selected"))}_resetSelectionProperty(){this.selection={start:void 0,end:void 0}}_applySelectionToBins(){const t=this._getSelectionInterval();this.bins.forEach(e=>{const i=this._getElementInterval(e);this._areOverlapping(i,t)?e.classList.add("selected"):e.classList.remove("selected")})}_numberWithCommas(t){return new Intl.NumberFormat(this._language,{style:"decimal"}).format(t)}_areOverlapping(t,e){return e[0]<t[0]?e[1]>t[0]:e[0]<t[1]}render(){return O`
|
|
4482
4482
|
<div class="label" part="label">
|
|
4483
4483
|
<span class="label"><slot name="label"></slot>${this.label}</span>
|
|
4484
|
-
${this.resettable?
|
|
4485
|
-
<paper-icon-button id="clear" icon="icons:clear" title="${
|
|
4484
|
+
${this.resettable?O`
|
|
4485
|
+
<paper-icon-button id="clear" icon="icons:clear" title="${F("timeline.clear")}"
|
|
4486
4486
|
@click="${this._dispatchPbTimelineResetSelectionEvent}"></paper-icon-button>
|
|
4487
4487
|
`:null}
|
|
4488
4488
|
</div>
|
|
@@ -4501,7 +4501,7 @@ const qa=e({is:"iron-label",listeners:{tap:"_tapHandler"},properties:{for:{type:
|
|
|
4501
4501
|
url="${this.url}?start=${this.startDate}&end=${this.endDate}"
|
|
4502
4502
|
?auto="${this.auto}"></iron-ajax>
|
|
4503
4503
|
</div>
|
|
4504
|
-
`}renderTooltip(){return
|
|
4504
|
+
`}renderTooltip(){return O`
|
|
4505
4505
|
<div id="tooltip" class="hidden" part="tooltip">
|
|
4506
4506
|
<div id="tooltip-text"></div>
|
|
4507
4507
|
<div
|
|
@@ -4511,8 +4511,8 @@ const qa=e({is:"iron-label",listeners:{tap:"_tapHandler"},properties:{for:{type:
|
|
|
4511
4511
|
><span class="close rounded black"></span>
|
|
4512
4512
|
</div>
|
|
4513
4513
|
</div>
|
|
4514
|
-
`}renderBins(){return
|
|
4515
|
-
${this.dataObj.data.map((t,e)=>
|
|
4514
|
+
`}renderBins(){return O`
|
|
4515
|
+
${this.dataObj.data.map((t,e)=>O`
|
|
4516
4516
|
<div class="bin-container ${t.seperator?"border-left":""}
|
|
4517
4517
|
${e%2==0?"grey":"white"} ${"?"===t.category?"unknown":""}"
|
|
4518
4518
|
data-tooltip="${t.tooltip}"
|
|
@@ -4530,17 +4530,17 @@ const qa=e({is:"iron-label",listeners:{tap:"_tapHandler"},properties:{for:{type:
|
|
|
4530
4530
|
${this.scope}"
|
|
4531
4531
|
>${t.binTitle?t.binTitle:""}
|
|
4532
4532
|
</p>
|
|
4533
|
-
${t.title?
|
|
4533
|
+
${t.title?O`
|
|
4534
4534
|
<p class="bins-title" part="title">${t.title}</p>
|
|
4535
4535
|
`:""}
|
|
4536
4536
|
${this.renderInfo(t)}
|
|
4537
4537
|
</div>
|
|
4538
4538
|
`)}
|
|
4539
|
-
`}renderInfo(t){return t.info&&t.info.length>0&&t.info.length<=10?
|
|
4539
|
+
`}renderInfo(t){return t.info&&t.info.length>0&&t.info.length<=10?O`
|
|
4540
4540
|
<ul class="info">
|
|
4541
|
-
${t.info.map(t=>
|
|
4541
|
+
${t.info.map(t=>O`<li>${S(t)}</li>`)}
|
|
4542
4542
|
</ul>
|
|
4543
|
-
`:null}async _handleResponse(){await this.updateComplete;const t=this.shadowRoot.getElementById("loadData").lastResponse;let e={};this.startDate&&this.endDate?Object.keys(t).filter(t=>t>=this.startDate&&t<this.endDate).forEach(i=>{e[i]=t[i]}):e=t,this.searchResult=new Ch(e,this.maxInterval,this.scopes),this.setData(this.searchResult.export(this.scope)),this.emitTo("pb-timeline-loaded",{value:!0,label:this.label})}}function Lh(t,e){t.split(/\s+/).forEach(t=>{e(t)})}customElements.define("pb-timeline",Mh);class Th{constructor(){this._events=void 0,this._events={}}on(t,e){Lh(t,t=>{this._events[t]=this._events[t]||[],this._events[t].push(e)})}off(t,e){var i=arguments.length;0!==i?Lh(t,t=>{if(1===i)return delete this._events[t];t in this._events!=!1&&this._events[t].splice(this._events[t].indexOf(e),1)}):this._events={}}trigger(t,...e){var i=this;Lh(t,t=>{if(t in i._events!=!1)for(let n of i._events[t])n.apply(i,e)})}}function Hh(t){return t.plugins={},class extends t{constructor(...t){super(...t),this.plugins={names:[],settings:{},requested:{},loaded:{}}}static define(e,i){t.plugins[e]={name:e,fn:i}}initializePlugins(t){var e,i;const n=this,r=[];if(Array.isArray(t))t.forEach(t=>{"string"==typeof t?r.push(t):(n.plugins.settings[t.name]=t.options,r.push(t.name))});else if(t)for(e in t)t.hasOwnProperty(e)&&(n.plugins.settings[e]=t[e],r.push(e));for(;i=r.shift();)n.require(i)}loadPlugin(e){var i=this,n=i.plugins,r=t.plugins[e];if(!t.plugins.hasOwnProperty(e))throw new Error('Unable to find "'+e+'" plugin');n.requested[e]=!0,n.loaded[e]=r.fn.apply(i,[i.plugins.settings[e]||{}]),n.names.push(e)}require(t){var e=this,i=e.plugins;if(!e.plugins.loaded.hasOwnProperty(t)){if(i.requested[t])throw new Error('Plugin has circular dependency ("'+t+'")');e.loadPlugin(t)}return i.loaded[t]}}}const Oh="[̀-ͯ·ʾ]",$h=new RegExp(Oh,"g");var Vh;const Ih={"æ":"ae","ⱥ":"a","ø":"o"},Rh=new RegExp(Object.keys(Ih).join("|"),"g"),Ph=[[67,67],[160,160],[192,438],[452,652],[961,961],[1019,1019],[1083,1083],[1281,1289],[1984,1984],[5095,5095],[7429,7441],[7545,7549],[7680,7935],[8580,8580],[9398,9449],[11360,11391],[42792,42793],[42802,42851],[42873,42897],[42912,42922],[64256,64260],[65313,65338],[65345,65370]],Dh=t=>t.normalize("NFKD").replace($h,"").toLowerCase().replace(Rh,(function(t){return Ih[t]})),Nh=(t,e="|")=>{if(1==t.length)return t[0];var i=1;return t.forEach(t=>{i=Math.max(i,t.length)}),1==i?"["+t.join("")+"]":"(?:"+t.join(e)+")"},Fh=t=>{if(1===t.length)return[[t]];var e=[];return Fh(t.substring(1)).forEach((function(i){var n=i.slice(0);n[0]=t.charAt(0)+n[0],e.push(n),(n=i.slice(0)).unshift(t.charAt(0)),e.push(n)})),e},Bh=()=>{var t={};Ph.forEach(e=>{for(let n=e[0];n<=e[1];n++){let e=String.fromCharCode(n),r=Dh(e);if(r!=e.toLowerCase()){r in t||(t[r]=[r]);var i=new RegExp(Nh(t[r]),"iu");e.match(i)||t[r].push(e)}}});var e=Object.keys(t);e=e.sort((t,e)=>e.length-t.length),_h=new RegExp("("+Nh(e)+Oh+"*)","g");var i={};return e.sort((t,e)=>t.length-e.length).forEach(e=>{var n=Fh(e).map(e=>(e=e.map(e=>t.hasOwnProperty(e)?Nh(t[e]):e),Nh(e,"")));i[e]=Nh(n)}),i},jh=t=>{void 0===Vh&&(Vh=Bh());return t.normalize("NFKD").toLowerCase().split(_h).map(t=>{if(""==t)return"";const e=Dh(t);if(Vh.hasOwnProperty(e))return Vh[e];const i=t.normalize("NFC");return i!=t?Nh([t,i]):t}).join("")},qh=(t,e)=>{if(t)return t[e]},Uh=(t,e)=>{if(t){for(var i,n=e.split(".");(i=n.shift())&&(t=t[i]););return t}},Wh=(t,e,i)=>{var n,r;return t?-1===(r=(t+="").search(e.regex))?0:(n=e.string.length/t.length,0===r&&(n+=.5),n*i):0},Yh=t=>(t+"").replace(/([\$\(-\+\.\?\[-\^\{-\}])/g,"\\$1"),Gh=(t,e)=>{var i=t[e];if("function"==typeof i)return i;i&&!Array.isArray(i)&&(t[e]=[i])},Xh=(t,e)=>{if(Array.isArray(t))t.forEach(e);else for(var i in t)t.hasOwnProperty(i)&&e(t[i],i)},Kh=(t,e)=>"number"==typeof t&&"number"==typeof e?t>e?1:t<e?-1:0:(t=Dh(t+"").toLowerCase())>(e=Dh(e+"").toLowerCase())?1:e>t?-1:0;class Qh{constructor(t,e){this.items=void 0,this.settings=void 0,this.items=t,this.settings=e||{diacritics:!0}}tokenize(t,e,i){if(!t||!t.length)return[];const n=[],r=t.split(/\s+/);var o;return i&&(o=new RegExp("^("+Object.keys(i).map(Yh).join("|")+"):(.*)$")),r.forEach(t=>{let i,r=null,s=null;o&&(i=t.match(o))&&(r=i[1],t=i[2]),t.length>0&&(s=Yh(t),this.settings.diacritics&&(s=jh(s)),e&&(s="\\b"+s)),n.push({string:t,regex:s?new RegExp(s,"iu"):null,field:r})}),n}getScoreFunction(t,e){var i=this.prepareSearch(t,e);return this._getScoreFunction(i)}_getScoreFunction(t){const e=t.tokens,i=e.length;if(!i)return function(){return 0};const n=t.options.fields,r=t.weights,o=n.length,s=t.getAttrFn;if(!o)return function(){return 1};const a=1===o?function(t,e){const i=n[0].field;return Wh(s(e,i),t,r[i])}:function(t,e){var i=0;if(t.field){const n=s(e,t.field);!t.regex&&n?i+=1/o:i+=Wh(n,t,1)}else Xh(r,(n,r)=>{i+=Wh(s(e,r),t,n)});return i/o};return 1===i?function(t){return a(e[0],t)}:"and"===t.options.conjunction?function(t){for(var n,r=0,o=0;r<i;r++){if((n=a(e[r],t))<=0)return 0;o+=n}return o/i}:function(t){var n=0;return Xh(e,e=>{n+=a(e,t)}),n/i}}getSortFunction(t,e){var i=this.prepareSearch(t,e);return this._getSortFunction(i)}_getSortFunction(t){var e,i,n;const r=this,o=t.options,s=!t.query&&o.sort_empty?o.sort_empty:o.sort,a=[],l=[];if("function"==typeof s)return s.bind(this);const c=function(e,i){return"$score"===e?i.score:t.getAttrFn(r.items[i.id],e)};if(s)for(e=0,i=s.length;e<i;e++)(t.query||"$score"!==s[e].field)&&a.push(s[e]);if(t.query){for(n=!0,e=0,i=a.length;e<i;e++)if("$score"===a[e].field){n=!1;break}n&&a.unshift({field:"$score",direction:"desc"})}else for(e=0,i=a.length;e<i;e++)if("$score"===a[e].field){a.splice(e,1);break}for(e=0,i=a.length;e<i;e++)l.push("desc"===a[e].direction?-1:1);const h=a.length;if(h){if(1===h){const t=a[0].field,e=l[0];return function(i,n){return e*Kh(c(t,i),c(t,n))}}return function(t,e){var i,n,r;for(i=0;i<h;i++)if(r=a[i].field,n=l[i]*Kh(c(r,t),c(r,e)))return n;return 0}}return null}prepareSearch(t,e){const i={};var n=Object.assign({},e);if(Gh(n,"sort"),Gh(n,"sort_empty"),n.fields){Gh(n,"fields");const t=[];n.fields.forEach(e=>{"string"==typeof e&&(e={field:e,weight:1}),t.push(e),i[e.field]="weight"in e?e.weight:1}),n.fields=t}return{options:n,query:t.toLowerCase().trim(),tokens:this.tokenize(t,n.respect_word_boundaries,i),total:0,items:[],weights:i,getAttrFn:n.nesting?Uh:qh}}search(t,e){var i,n,r=this;n=this.prepareSearch(t,e),e=n.options,t=n.query;const o=e.score||r._getScoreFunction(n);t.length?Xh(r.items,(t,r)=>{i=o(t),(!1===e.filter||i>0)&&n.items.push({score:i,id:r})}):Xh(r.items,(t,e)=>{n.items.push({score:1,id:e})});const s=r._getSortFunction(n);return s&&n.items.sort(s),n.total=n.items.length,"number"==typeof e.limit&&(n.items=n.items.slice(0,e.limit)),n}}const Zh=t=>{if(t.jquery)return t[0];if(t instanceof HTMLElement)return t;if(Jh(t)){let e=document.createElement("div");return e.innerHTML=t.trim(),e.firstChild}return document.querySelector(t)},Jh=t=>"string"==typeof t&&t.indexOf("<")>-1,td=t=>t.replace(/['"\\]/g,"\\$&"),ed=(t,e)=>{var i=document.createEvent("HTMLEvents");i.initEvent(e,!0,!1),t.dispatchEvent(i)},id=(t,e)=>{Object.assign(t.style,e)},nd=(t,...e)=>{var i=od(e);(t=sd(t)).map(t=>{i.map(e=>{t.classList.add(e)})})},rd=(t,...e)=>{var i=od(e);(t=sd(t)).map(t=>{i.map(e=>{t.classList.remove(e)})})},od=t=>{var e=[];return Xh(t,t=>{"string"==typeof t&&(t=t.trim().split(/[\11\12\14\15\40]/)),Array.isArray(t)&&(e=e.concat(t))}),e.filter(Boolean)},sd=t=>(Array.isArray(t)||(t=[t]),t),ad=(t,e,i)=>{if(!i||i.contains(t))for(;t&&t.matches;){if(t.matches(e))return t;t=t.parentNode}},ld=(t,e=0)=>e>0?t[t.length-1]:t[0],cd=t=>0===Object.keys(t).length,hd=(t,e)=>{if(!t)return-1;e=e||t.nodeName;for(var i=0;t=t.previousElementSibling;)t.matches(e)&&i++;return i},dd=(t,e)=>{Xh(e,(e,i)=>{null==e?t.removeAttribute(i):t.setAttribute(i,""+e)})},pd=(t,e)=>{t.parentNode&&t.parentNode.replaceChild(e,t)},ud=(t,e)=>{if(null===e)return;if("string"==typeof e){if(!e.length)return;e=new RegExp(e,"i")}const i=t=>{var i=t.data.match(e);if(i&&t.data.length>0){var n=document.createElement("span");n.className="highlight";var r=t.splitText(i.index);r.splitText(i[0].length);var o=r.cloneNode(!0);return n.appendChild(o),pd(r,n),1}return 0},n=t=>{if(1===t.nodeType&&t.childNodes&&!/(script|style)/i.test(t.tagName)&&("highlight"!==t.className||"SPAN"!==t.tagName))for(var e=0;e<t.childNodes.length;++e)e+=r(t.childNodes[e])},r=t=>3===t.nodeType?i(t):(n(t),0);r(t)},gd=t=>{var e=t.querySelectorAll("span.highlight");Array.prototype.forEach.call(e,(function(t){var e=t.parentNode;e.replaceChild(t.firstChild,t),e.normalize()}))},fd=65,md=13,vd=27,bd=37,yd=38,_d=39,wd=40,xd=8,kd=46,Ad=9,zd="undefined"!=typeof navigator&&/Mac/.test(navigator.userAgent)?"metaKey":"ctrlKey";var Sd={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:null,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,shouldOpen:null,maxOptions:50,maxItems:null,hideSelected:null,duplicates:!1,addPrecedence:!1,selectOnTab:!1,preload:null,allowEmptyOption:!1,loadThrottle:300,loadingClass:"loading",dataAttr:null,optgroupField:"optgroup",valueField:"value",labelField:"text",disabledField:"disabled",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"ts-wrapper",controlClass:"ts-control",dropdownClass:"ts-dropdown",dropdownContentClass:"ts-dropdown-content",itemClass:"item",optionClass:"option",dropdownParent:null,controlInput:'<input type="text" autocomplete="off" size="1" />',copyClassesToDropdown:!1,placeholder:null,hidePlaceholder:null,shouldLoad:function(t){return t.length>0},render:{}};const Cd=t=>null==t?null:Ed(t),Ed=t=>"boolean"==typeof t?t?"1":"0":t+"",Md=t=>(t+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),Ld=(t,e)=>{var i;return function(n,r){var o=this;i&&(o.loading=Math.max(o.loading-1,0),clearTimeout(i)),i=setTimeout((function(){i=null,o.loadedSearches[n]=!0,t.call(o,n,r)}),e)}},Td=(t,e,i)=>{var n,r=t.trigger,o={};for(n of(t.trigger=function(){var i=arguments[0];if(-1===e.indexOf(i))return r.apply(t,arguments);o[i]=arguments},i.apply(t,[]),t.trigger=r,e))n in o&&r.apply(t,o[n])},Hd=t=>({start:t.selectionStart||0,length:(t.selectionEnd||0)-(t.selectionStart||0)}),Od=(t,e=!1)=>{t&&(t.preventDefault(),e&&t.stopPropagation())},$d=(t,e,i,n)=>{t.addEventListener(e,i,n)},Vd=(t,e)=>!!e&&(!!e[t]&&1===(e.altKey?1:0)+(e.ctrlKey?1:0)+(e.shiftKey?1:0)+(e.metaKey?1:0)),Id=(t,e)=>{const i=t.getAttribute("id");return i||(t.setAttribute("id",e),e)},Rd=t=>t.replace(/[\\"']/g,"\\$&"),Pd=(t,e)=>{e&&t.append(e)};function Dd(t,e){var i=Object.assign({},Sd,e),n=i.dataAttr,r=i.labelField,o=i.valueField,s=i.disabledField,a=i.optgroupField,l=i.optgroupLabelField,c=i.optgroupValueField,h=t.tagName.toLowerCase(),d=t.getAttribute("placeholder")||t.getAttribute("data-placeholder");if(!d&&!i.allowEmptyOption){let e=t.querySelector('option[value=""]');e&&(d=e.textContent)}var p={placeholder:d,options:[],optgroups:[],items:[],maxItems:null},u=()=>{const e=t.getAttribute(n);if(e)p.options=JSON.parse(e),Xh(p.options,t=>{p.items.push(t[o])});else{var s=t.value.trim()||"";if(!i.allowEmptyOption&&!s.length)return;const e=s.split(i.delimiter);Xh(e,t=>{const e={};e[r]=t,e[o]=t,p.options.push(e)}),p.items=e}};return"select"===h?(()=>{var e,h=p.options,d={},u=1,g=t=>{var e=Object.assign({},t.dataset),i=n&&e[n];return"string"==typeof i&&i.length&&(e=Object.assign(e,JSON.parse(i))),e},f=(t,e)=>{var n=Cd(t.value);if(null!=n&&(n||i.allowEmptyOption)){if(d.hasOwnProperty(n)){if(e){var l=d[n][a];l?Array.isArray(l)?l.push(e):d[n][a]=[l,e]:d[n][a]=e}}else{var c=g(t);c[r]=c[r]||t.textContent,c[o]=c[o]||n,c[s]=c[s]||t.disabled,c[a]=c[a]||e,c.$option=t,d[n]=c,h.push(c)}t.selected&&p.items.push(n)}},m=t=>{var e,i;(i=g(t))[l]=i[l]||t.getAttribute("label")||"",i[c]=i[c]||u++,i[s]=i[s]||t.disabled,p.optgroups.push(i),e=i[c],Xh(t.children,t=>{f(t,e)})};p.maxItems=t.hasAttribute("multiple")?null:1,Xh(t.children,t=>{"optgroup"===(e=t.tagName.toLowerCase())?m(t):"option"===e&&f(t)})})():u(),Object.assign({},Sd,p,e)}var Nd=0;class Fd extends(Hh(Th)){constructor(t,e){var i;super(),this.control_input=void 0,this.wrapper=void 0,this.dropdown=void 0,this.control=void 0,this.dropdown_content=void 0,this.focus_node=void 0,this.order=0,this.settings=void 0,this.input=void 0,this.tabIndex=void 0,this.is_select_tag=void 0,this.rtl=void 0,this.inputId=void 0,this._destroy=void 0,this.sifter=void 0,this.isOpen=!1,this.isDisabled=!1,this.isRequired=void 0,this.isInvalid=!1,this.isValid=!0,this.isLocked=!1,this.isFocused=!1,this.isInputHidden=!1,this.isSetup=!1,this.ignoreFocus=!1,this.hasOptions=!1,this.currentResults=void 0,this.lastValue="",this.caretPos=0,this.loading=0,this.loadedSearches={},this.activeOption=null,this.activeItems=[],this.optgroups={},this.options={},this.userOptions={},this.items=[],Nd++;var n=Zh(t);if(n.tomselect)throw new Error("Tom Select already initialized on this element");n.tomselect=this,i=(window.getComputedStyle&&window.getComputedStyle(n,null)).getPropertyValue("direction");const r=Dd(n,e);this.settings=r,this.input=n,this.tabIndex=n.tabIndex||0,this.is_select_tag="select"===n.tagName.toLowerCase(),this.rtl=/rtl/i.test(i),this.inputId=Id(n,"tomselect-"+Nd),this.isRequired=n.required,this.sifter=new Qh(this.options,{diacritics:r.diacritics}),r.mode=r.mode||(1===r.maxItems?"single":"multi"),"boolean"!=typeof r.hideSelected&&(r.hideSelected="multi"===r.mode),"boolean"!=typeof r.hidePlaceholder&&(r.hidePlaceholder="multi"!==r.mode);var o=r.createFilter;"function"!=typeof o&&("string"==typeof o&&(o=new RegExp(o)),o instanceof RegExp?r.createFilter=t=>o.test(t):r.createFilter=()=>!0),this.initializePlugins(r.plugins),this.setupCallbacks(),this.setupTemplates();const s=Zh("<div>"),a=Zh("<div>"),l=this._render("dropdown"),c=Zh('<div role="listbox" tabindex="-1">'),h=this.input.getAttribute("class")||"",d=r.mode;var p;(nd(s,r.wrapperClass,h,d),nd(a,r.controlClass),Pd(s,a),nd(l,r.dropdownClass,d),r.copyClassesToDropdown&&nd(l,h),nd(c,r.dropdownContentClass),Pd(l,c),Zh(r.dropdownParent||s).appendChild(l),Jh(r.controlInput))?(p=Zh(r.controlInput),Xh(["autocorrect","autocapitalize","autocomplete"],t=>{n.getAttribute(t)&&dd(p,{[t]:n.getAttribute(t)})}),p.tabIndex=-1,a.appendChild(p),this.focus_node=p):r.controlInput?(p=Zh(r.controlInput),this.focus_node=p):(p=Zh("<input/>"),this.focus_node=a);this.wrapper=s,this.dropdown=l,this.dropdown_content=c,this.control=a,this.control_input=p,this.setup()}setup(){const t=this,e=t.settings,i=t.control_input,n=t.dropdown,r=t.dropdown_content,o=t.wrapper,s=t.control,a=t.input,l=t.focus_node,c={passive:!0},h=t.inputId+"-ts-dropdown";dd(r,{id:h}),dd(l,{role:"combobox","aria-haspopup":"listbox","aria-expanded":"false","aria-controls":h});const d=Id(l,t.inputId+"-ts-control"),p="label[for='"+td(t.inputId)+"']",u=document.querySelector(p),g=t.focus.bind(t);if(u){$d(u,"click",g),dd(u,{for:d});const e=Id(u,t.inputId+"-ts-label");dd(l,{"aria-labelledby":e}),dd(r,{"aria-labelledby":e})}if(o.style.width=a.style.width,t.plugins.names.length){const e="plugin-"+t.plugins.names.join(" plugin-");nd([o,n],e)}(null===e.maxItems||e.maxItems>1)&&t.is_select_tag&&dd(a,{multiple:"multiple"}),t.settings.placeholder&&dd(i,{placeholder:e.placeholder}),!t.settings.splitOn&&t.settings.delimiter&&(t.settings.splitOn=new RegExp("\\s*"+Yh(t.settings.delimiter)+"+\\s*")),e.load&&e.loadThrottle&&(e.load=Ld(e.load,e.loadThrottle)),t.control_input.type=a.type,$d(n,"click",e=>{const i=ad(e.target,"[data-selectable]");i&&(t.onOptionSelect(e,i),Od(e,!0))}),$d(s,"click",e=>{var n=ad(e.target,"[data-ts-item]",s);n&&t.onItemSelect(e,n)?Od(e,!0):""==i.value&&(t.onClick(),Od(e,!0))}),$d(l,"keydown",e=>t.onKeyDown(e)),$d(i,"keypress",e=>t.onKeyPress(e)),$d(i,"input",e=>t.onInput(e)),$d(l,"resize",()=>t.positionDropdown(),c),$d(l,"blur",e=>t.onBlur(e)),$d(l,"focus",e=>t.onFocus(e)),$d(l,"paste",e=>t.onPaste(e));const f=e=>{const r=e.composedPath()[0];if(!o.contains(r)&&!n.contains(r))return t.isFocused&&t.blur(),void t.inputState();r==i&&t.isOpen?e.stopPropagation():Od(e,!0)};var m=()=>{t.isOpen&&t.positionDropdown()};$d(document,"mousedown",f),$d(window,"scroll",m,c),$d(window,"resize",m,c),this._destroy=()=>{document.removeEventListener("mousedown",f),window.removeEventListener("sroll",m),window.removeEventListener("resize",m),u&&u.removeEventListener("click",g)},this.revertSettings={innerHTML:a.innerHTML,tabIndex:a.tabIndex},a.tabIndex=-1,a.insertAdjacentElement("afterend",t.wrapper),t.sync(!1),e.items=[],delete e.optgroups,delete e.options,$d(a,"invalid",e=>{t.isValid&&(t.isValid=!1,t.isInvalid=!0,t.refreshState())}),t.updateOriginalInput(),t.refreshItems(),t.close(!1),t.inputState(),t.isSetup=!0,a.disabled?t.disable():t.enable(),t.on("change",this.onChange),nd(a,"tomselected","ts-hidden-accessible"),t.trigger("initialize"),!0===e.preload&&t.preload()}setupOptions(t=[],e=[]){this.addOptions(t),Xh(e,t=>{this.registerOptionGroup(t)})}setupTemplates(){var t=this,e=t.settings.labelField,i=t.settings.optgroupLabelField,n={optgroup:t=>{let e=document.createElement("div");return e.className="optgroup",e.appendChild(t.options),e},optgroup_header:(t,e)=>'<div class="optgroup-header">'+e(t[i])+"</div>",option:(t,i)=>"<div>"+i(t[e])+"</div>",item:(t,i)=>"<div>"+i(t[e])+"</div>",option_create:(t,e)=>'<div class="create">Add <strong>'+e(t.input)+"</strong>…</div>",no_results:()=>'<div class="no-results">No results found</div>',loading:()=>'<div class="spinner"></div>',not_loading:()=>{},dropdown:()=>"<div></div>"};t.settings.render=Object.assign({},n,t.settings.render)}setupCallbacks(){var t,e,i={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",item_select:"onItemSelect",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(t in i)(e=this.settings[i[t]])&&this.on(t,e)}sync(t=!0){const e=this,i=t?Dd(e.input,{delimiter:e.settings.delimiter}):e.settings;e.setupOptions(i.options,i.optgroups),e.setValue(i.items||[],!0),e.lastQuery=null}onClick(){var t=this;if(t.activeItems.length>0)return t.clearActiveItems(),void t.focus();t.isFocused&&t.isOpen?t.blur():t.focus()}onMouseDown(){}onChange(){ed(this.input,"input"),ed(this.input,"change")}onPaste(t){var e=this;e.isInputHidden||e.isLocked?Od(t):e.settings.splitOn&&setTimeout(()=>{var t=e.inputValue();if(t.match(e.settings.splitOn)){var i=t.trim().split(e.settings.splitOn);Xh(i,t=>{e.createItem(t)})}},0)}onKeyPress(t){var e=this;if(!e.isLocked){var i=String.fromCharCode(t.keyCode||t.which);return e.settings.create&&"multi"===e.settings.mode&&i===e.settings.delimiter?(e.createItem(),void Od(t)):void 0}Od(t)}onKeyDown(t){var e=this;if(e.isLocked)t.keyCode!==Ad&&Od(t);else{switch(t.keyCode){case fd:if(Vd(zd,t)&&""==e.control_input.value)return Od(t),void e.selectAll();break;case vd:return e.isOpen&&(Od(t,!0),e.close()),void e.clearActiveItems();case wd:if(!e.isOpen&&e.hasOptions)e.open();else if(e.activeOption){let t=e.getAdjacent(e.activeOption,1);t&&e.setActiveOption(t)}return void Od(t);case yd:if(e.activeOption){let t=e.getAdjacent(e.activeOption,-1);t&&e.setActiveOption(t)}return void Od(t);case md:return void(e.canSelect(e.activeOption)?(e.onOptionSelect(t,e.activeOption),Od(t)):e.settings.create&&e.createItem()&&Od(t));case bd:return void e.advanceSelection(-1,t);case _d:return void e.advanceSelection(1,t);case Ad:return void(e.settings.selectOnTab&&(e.canSelect(e.activeOption)&&(e.onOptionSelect(t,e.activeOption),Od(t)),e.settings.create&&e.createItem()&&Od(t)));case xd:case kd:return void e.deleteSelection(t)}e.isInputHidden&&!Vd(zd,t)&&Od(t)}}onInput(t){var e=this;if(!e.isLocked){var i=e.inputValue();e.lastValue!==i&&(e.lastValue=i,e.settings.shouldLoad.call(e,i)&&e.load(i),e.refreshOptions(),e.trigger("type",i))}}onFocus(t){var e=this,i=e.isFocused;if(e.isDisabled)return e.blur(),void Od(t);e.ignoreFocus||(e.isFocused=!0,"focus"===e.settings.preload&&e.preload(),i||e.trigger("focus"),e.activeItems.length||(e.showInput(),e.refreshOptions(!!e.settings.openOnFocus)),e.refreshState())}onBlur(t){if(!1!==document.hasFocus()){var e=this;if(e.isFocused){e.isFocused=!1,e.ignoreFocus=!1;var i=()=>{e.close(),e.setActiveItem(),e.setCaret(e.items.length),e.trigger("blur")};e.settings.create&&e.settings.createOnBlur?e.createItem(null,!1,i):i()}}}onOptionSelect(t,e){var i,n=this;e.parentElement&&e.parentElement.matches("[data-disabled]")||(e.classList.contains("create")?n.createItem(null,!0,()=>{n.settings.closeAfterSelect&&n.close()}):void 0!==(i=e.dataset.value)&&(n.lastQuery=null,n.addItem(i),n.settings.closeAfterSelect&&n.close(),!n.settings.hideSelected&&t.type&&/click/.test(t.type)&&n.setActiveOption(e)))}canSelect(t){return!!(this.isOpen&&t&&this.dropdown_content.contains(t))}onItemSelect(t,e){var i=this;return!i.isLocked&&"multi"===i.settings.mode&&(Od(t),i.setActiveItem(e,t),!0)}canLoad(t){return!!this.settings.load&&!this.loadedSearches.hasOwnProperty(t)}load(t){const e=this;if(!e.canLoad(t))return;nd(e.wrapper,e.settings.loadingClass),e.loading++;const i=e.loadCallback.bind(e);e.settings.load.call(e,t,i)}loadCallback(t,e){const i=this;i.loading=Math.max(i.loading-1,0),i.lastQuery=null,i.clearActiveOption(),i.setupOptions(t,e),i.refreshOptions(i.isFocused&&!i.isInputHidden),i.loading||rd(i.wrapper,i.settings.loadingClass),i.trigger("load",t,e)}preload(){var t=this.wrapper.classList;t.contains("preloaded")||(t.add("preloaded"),this.load(""))}setTextboxValue(t=""){var e=this.control_input;e.value!==t&&(e.value=t,ed(e,"update"),this.lastValue=t)}getValue(){return this.is_select_tag&&this.input.hasAttribute("multiple")?this.items:this.items.join(this.settings.delimiter)}setValue(t,e){Td(this,e?[]:["change"],()=>{this.clear(e),this.addItems(t,e)})}setMaxItems(t){0===t&&(t=null),this.settings.maxItems=t,this.refreshState()}setActiveItem(t,e){var i,n,r,o,s,a,l=this;if("single"!==l.settings.mode){if(!t)return l.clearActiveItems(),void(l.isFocused&&l.showInput());if("click"===(i=e&&e.type.toLowerCase())&&Vd("shiftKey",e)&&l.activeItems.length){for(a=l.getLastActive(),(r=Array.prototype.indexOf.call(l.control.children,a))>(o=Array.prototype.indexOf.call(l.control.children,t))&&(s=r,r=o,o=s),n=r;n<=o;n++)t=l.control.children[n],-1===l.activeItems.indexOf(t)&&l.setActiveItemClass(t);Od(e)}else"click"===i&&Vd(zd,e)||"keydown"===i&&Vd("shiftKey",e)?t.classList.contains("active")?l.removeActiveItem(t):l.setActiveItemClass(t):(l.clearActiveItems(),l.setActiveItemClass(t));l.hideInput(),l.isFocused||l.focus()}}setActiveItemClass(t){const e=this,i=e.control.querySelector(".last-active");i&&rd(i,"last-active"),nd(t,"active last-active"),e.trigger("item_select",t),-1==e.activeItems.indexOf(t)&&e.activeItems.push(t)}removeActiveItem(t){var e=this.activeItems.indexOf(t);this.activeItems.splice(e,1),rd(t,"active")}clearActiveItems(){rd(this.activeItems,"active"),this.activeItems=[]}setActiveOption(t){t!==this.activeOption&&(this.clearActiveOption(),t&&(this.activeOption=t,dd(this.focus_node,{"aria-activedescendant":t.getAttribute("id")}),dd(t,{"aria-selected":"true"}),nd(t,"active"),this.scrollToOption(t)))}scrollToOption(t,e){if(!t)return;const i=this.dropdown_content,n=i.clientHeight,r=i.scrollTop||0,o=t.offsetHeight,s=t.getBoundingClientRect().top-i.getBoundingClientRect().top+r;s+o>n+r?this.scroll(s-n+o,e):s<r&&this.scroll(s,e)}scroll(t,e){const i=this.dropdown_content;e&&(i.style.scrollBehavior=e),i.scrollTop=t,i.style.scrollBehavior=""}clearActiveOption(){this.activeOption&&(rd(this.activeOption,"active"),dd(this.activeOption,{"aria-selected":null})),this.activeOption=null,dd(this.focus_node,{"aria-activedescendant":null})}selectAll(){const t=this;if("single"===t.settings.mode)return;const e=t.controlChildren();e.length&&(t.hideInput(),t.close(),t.activeItems=e,Xh(e,e=>{t.setActiveItemClass(e)}))}inputState(){var t=this;t.control.contains(t.control_input)&&(dd(t.control_input,{placeholder:t.settings.placeholder}),t.activeItems.length>0||!t.isFocused&&t.settings.hidePlaceholder&&t.items.length>0?(t.setTextboxValue(),t.isInputHidden=!0):(t.settings.hidePlaceholder&&t.items.length>0&&dd(t.control_input,{placeholder:""}),t.isInputHidden=!1),t.wrapper.classList.toggle("input-hidden",t.isInputHidden))}hideInput(){this.inputState()}showInput(){this.inputState()}inputValue(){return this.control_input.value.trim()}focus(){var t=this;t.isDisabled||(t.ignoreFocus=!0,t.control_input.offsetWidth?t.control_input.focus():t.focus_node.focus(),setTimeout(()=>{t.ignoreFocus=!1,t.onFocus()},0))}blur(){this.focus_node.blur(),this.onBlur()}getScoreFunction(t){return this.sifter.getScoreFunction(t,this.getSearchOptions())}getSearchOptions(){var t=this.settings,e=t.sortField;return"string"==typeof t.sortField&&(e=[{field:t.sortField}]),{fields:t.searchField,conjunction:t.searchConjunction,sort:e,nesting:t.nesting}}search(t){var e,i,n,r=this,o=this.getSearchOptions();if(r.settings.score&&"function"!=typeof(n=r.settings.score.call(r,t)))throw new Error('Tom Select "score" setting must be a function that returns a function');if(t!==r.lastQuery?(r.lastQuery=t,i=r.sifter.search(t,Object.assign(o,{score:n})),r.currentResults=i):i=Object.assign({},r.currentResults),r.settings.hideSelected)for(e=i.items.length-1;e>=0;e--){let t=Cd(i.items[e].id);t&&-1!==r.items.indexOf(t)&&i.items.splice(e,1)}return i}refreshOptions(t=!0){var e,i,n,r,o,s,a,l,c,h,d;const p={},u=[];var g=this,f=g.inputValue(),m=g.search(f),v=null,b=g.settings.shouldOpen||!1,y=g.dropdown_content;for(g.activeOption&&(c=g.activeOption.dataset.value,h=g.activeOption.closest("[data-group]")),r=m.items.length,"number"==typeof g.settings.maxOptions&&(r=Math.min(r,g.settings.maxOptions)),r>0&&(b=!0),e=0;e<r;e++){let t=m.items[e].id,r=g.options[t],a=g.getOption(t,!0);for(g.settings.hideSelected||a.classList.toggle("selected",g.items.includes(t)),o=r[g.settings.optgroupField]||"",i=0,n=(s=Array.isArray(o)?o:[o])&&s.length;i<n;i++)o=s[i],g.optgroups.hasOwnProperty(o)||(o=""),p.hasOwnProperty(o)||(p[o]=document.createDocumentFragment(),u.push(o)),i>0&&(a=a.cloneNode(!0),dd(a,{id:r.$id+"-clone-"+i,"aria-selected":null}),a.classList.add("ts-cloned"),rd(a,"active")),v||c!=t||(h?h.dataset.group===o&&(v=a):v=a),p[o].appendChild(a)}this.settings.lockOptgroupOrder&&u.sort((t,e)=>(g.optgroups[t]&&g.optgroups[t].$order||0)-(g.optgroups[e]&&g.optgroups[e].$order||0)),a=document.createDocumentFragment(),Xh(u,t=>{if(g.optgroups.hasOwnProperty(t)&&p[t].children.length){let e=document.createDocumentFragment(),i=g.render("optgroup_header",g.optgroups[t]);Pd(e,i),Pd(e,p[t]);let n=g.render("optgroup",{group:g.optgroups[t],options:e});Pd(a,n)}else Pd(a,p[t])}),y.innerHTML="",Pd(y,a),g.settings.highlight&&(gd(y),m.query.length&&m.tokens.length&&Xh(m.tokens,t=>{ud(y,t.regex)}));var _=t=>{let e=g.render(t,{input:f});return e&&(b=!0,y.insertBefore(e,y.firstChild)),e};if(g.loading?_("loading"):g.settings.shouldLoad.call(g,f)?0===m.items.length&&_("no_results"):_("not_loading"),(l=g.canCreate(f))&&(d=_("option_create")),g.hasOptions=m.items.length>0||l,b){if(m.items.length>0){if(!v&&"single"===g.settings.mode&&g.items.length&&(v=g.getOption(g.items[0])),!y.contains(v)){let t=0;d&&!g.settings.addPrecedence&&(t=1),v=g.selectable()[t]}}else d&&(v=d);t&&!g.isOpen&&(g.open(),g.scrollToOption(v,"auto")),g.setActiveOption(v)}else g.clearActiveOption(),t&&g.isOpen&&g.close(!1)}selectable(){return this.dropdown_content.querySelectorAll("[data-selectable]")}addOption(t,e=!1){const i=this;if(Array.isArray(t))return i.addOptions(t,e),!1;const n=Cd(t[i.settings.valueField]);return null!==n&&!i.options.hasOwnProperty(n)&&(t.$order=t.$order||++i.order,t.$id=i.inputId+"-opt-"+t.$order,i.options[n]=t,i.lastQuery=null,e&&(i.userOptions[n]=e,i.trigger("option_add",n,t)),n)}addOptions(t,e=!1){Xh(t,t=>{this.addOption(t,e)})}registerOption(t){return this.addOption(t)}registerOptionGroup(t){var e=Cd(t[this.settings.optgroupValueField]);return null!==e&&(t.$order=t.$order||++this.order,this.optgroups[e]=t,e)}addOptionGroup(t,e){var i;e[this.settings.optgroupValueField]=t,(i=this.registerOptionGroup(e))&&this.trigger("optgroup_add",i,e)}removeOptionGroup(t){this.optgroups.hasOwnProperty(t)&&(delete this.optgroups[t],this.clearCache(),this.trigger("optgroup_remove",t))}clearOptionGroups(){this.optgroups={},this.clearCache(),this.trigger("optgroup_clear")}updateOption(t,e){const i=this;var n,r;const o=Cd(t),s=Cd(e[i.settings.valueField]);if(null===o)return;if(!i.options.hasOwnProperty(o))return;if("string"!=typeof s)throw new Error("Value must be set in option data");const a=i.getOption(o),l=i.getItem(o);if(e.$order=e.$order||i.options[o].$order,delete i.options[o],i.uncacheValue(s),i.options[s]=e,a){if(i.dropdown_content.contains(a)){const t=i._render("option",e);pd(a,t),i.activeOption===a&&i.setActiveOption(t)}a.remove()}l&&(-1!==(r=i.items.indexOf(o))&&i.items.splice(r,1,s),n=i._render("item",e),l.classList.contains("active")&&nd(n,"active"),pd(l,n)),i.lastQuery=null}removeOption(t,e){const i=this;t=Ed(t),i.uncacheValue(t),delete i.userOptions[t],delete i.options[t],i.lastQuery=null,i.trigger("option_remove",t),i.removeItem(t,e)}clearOptions(){this.loadedSearches={},this.userOptions={},this.clearCache();var t={};Xh(this.options,(e,i)=>{this.items.indexOf(i)>=0&&(t[i]=this.options[i])}),this.options=this.sifter.items=t,this.lastQuery=null,this.trigger("option_clear")}getOption(t,e=!1){const i=Cd(t);if(null!==i&&this.options.hasOwnProperty(i)){const t=this.options[i];if(t.$div)return t.$div;if(e)return this._render("option",t)}return null}getAdjacent(t,e,i="option"){var n,r=this;if(!t)return null;n="item"==i?r.controlChildren():r.dropdown_content.querySelectorAll("[data-selectable]");for(let i=0;i<n.length;i++)if(n[i]==t)return e>0?n[i+1]:n[i-1];return null}getItem(t){if("object"==typeof t)return t;var e=Cd(t);return null!==e?this.control.querySelector(`[data-value="${Rd(e)}"]`):null}addItems(t,e){var i=this,n=Array.isArray(t)?t:[t];for(let t=0,r=(n=n.filter(t=>-1===i.items.indexOf(t))).length;t<r;t++)i.isPending=t<r-1,i.addItem(n[t],e)}addItem(t,e){Td(this,e?[]:["change","dropdown_close"],()=>{var i,n;const r=this,o=r.settings.mode,s=Cd(t);if((!s||-1===r.items.indexOf(s)||("single"===o&&r.close(),"single"!==o&&r.settings.duplicates))&&null!==s&&r.options.hasOwnProperty(s)&&("single"===o&&r.clear(e),"multi"!==o||!r.isFull())){if(i=r._render("item",r.options[s]),r.control.contains(i)&&(i=i.cloneNode(!0)),n=r.isFull(),r.items.splice(r.caretPos,0,s),r.insertAtCaret(i),r.isSetup){if(!r.isPending&&r.settings.hideSelected){let t=r.getOption(s),e=r.getAdjacent(t,1);e&&r.setActiveOption(e)}r.isPending||r.settings.closeAfterSelect||r.refreshOptions(r.isFocused&&"single"!==o),0!=r.settings.closeAfterSelect&&r.isFull()?r.close():r.isPending||r.positionDropdown(),r.trigger("item_add",s,i),r.isPending||r.updateOriginalInput({silent:e})}(!r.isPending||!n&&r.isFull())&&(r.inputState(),r.refreshState())}})}removeItem(t=null,e){const i=this;if(!(t=i.getItem(t)))return;var n,r;const o=t.dataset.value;n=hd(t),t.remove(),t.classList.contains("active")&&(r=i.activeItems.indexOf(t),i.activeItems.splice(r,1),rd(t,"active")),i.items.splice(n,1),i.lastQuery=null,!i.settings.persist&&i.userOptions.hasOwnProperty(o)&&i.removeOption(o,e),n<i.caretPos&&i.setCaret(i.caretPos-1),i.updateOriginalInput({silent:e}),i.refreshState(),i.positionDropdown(),i.trigger("item_remove",o,t)}createItem(t=null,e=!0,i=(()=>{})){var n,r=this,o=r.caretPos;if(t=t||r.inputValue(),!r.canCreate(t))return i(),!1;r.lock();var s=!1,a=t=>{if(r.unlock(),!t||"object"!=typeof t)return i();var e=Cd(t[r.settings.valueField]);if("string"!=typeof e)return i();r.setTextboxValue(),r.addOption(t,!0),r.setCaret(o),r.addItem(e),i(t),s=!0};return n="function"==typeof r.settings.create?r.settings.create.call(this,t,a):{[r.settings.labelField]:t,[r.settings.valueField]:t},s||a(n),!0}refreshItems(){var t=this;t.lastQuery=null,t.isSetup&&t.addItems(t.items),t.updateOriginalInput(),t.refreshState()}refreshState(){const t=this;t.refreshValidityState();const e=t.isFull(),i=t.isLocked;t.wrapper.classList.toggle("rtl",t.rtl);const n=t.wrapper.classList;n.toggle("focus",t.isFocused),n.toggle("disabled",t.isDisabled),n.toggle("required",t.isRequired),n.toggle("invalid",!t.isValid),n.toggle("locked",i),n.toggle("full",e),n.toggle("input-active",t.isFocused&&!t.isInputHidden),n.toggle("dropdown-active",t.isOpen),n.toggle("has-options",cd(t.options)),n.toggle("has-items",t.items.length>0)}refreshValidityState(){var t=this;t.input.checkValidity&&(t.isValid=t.input.checkValidity(),t.isInvalid=!t.isValid)}isFull(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems}updateOriginalInput(t={}){const e=this;var i,n;const r=e.input.querySelector('option[value=""]');if(e.is_select_tag){const t=[],s=e.input.querySelectorAll("option:checked").length;function o(i,n,o){return i||(i=Zh('<option value="'+Md(n)+'">'+Md(o)+"</option>")),i!=r&&e.input.append(i),t.push(i),(i!=r||s>0)&&(i.selected=!0),i}e.input.querySelectorAll("option:checked").forEach(t=>{t.selected=!1}),0==e.items.length&&"single"==e.settings.mode?o(r,"",""):e.items.forEach(r=>{if(i=e.options[r],n=i[e.settings.labelField]||"",t.includes(i.$option)){o(e.input.querySelector(`option[value="${Rd(r)}"]:not(:checked)`),r,n)}else i.$option=o(i.$option,r,n)})}else e.input.value=e.getValue();e.isSetup&&(t.silent||e.trigger("change",e.getValue()))}open(){var t=this;t.isLocked||t.isOpen||"multi"===t.settings.mode&&t.isFull()||(t.isOpen=!0,dd(t.focus_node,{"aria-expanded":"true"}),t.refreshState(),id(t.dropdown,{visibility:"hidden",display:"block"}),t.positionDropdown(),id(t.dropdown,{visibility:"visible",display:"block"}),t.focus(),t.trigger("dropdown_open",t.dropdown))}close(t=!0){var e=this,i=e.isOpen;t&&(e.setTextboxValue(),"single"===e.settings.mode&&e.items.length&&e.hideInput()),e.isOpen=!1,dd(e.focus_node,{"aria-expanded":"false"}),id(e.dropdown,{display:"none"}),e.settings.hideSelected&&e.clearActiveOption(),e.refreshState(),i&&e.trigger("dropdown_close",e.dropdown)}positionDropdown(){if("body"===this.settings.dropdownParent){var t=this.control,e=t.getBoundingClientRect(),i=t.offsetHeight+e.top+window.scrollY,n=e.left+window.scrollX;id(this.dropdown,{width:e.width+"px",top:i+"px",left:n+"px"})}}clear(t){var e=this;if(e.items.length){var i=e.controlChildren();Xh(i,t=>{e.removeItem(t,!0)}),e.showInput(),t||e.updateOriginalInput(),e.trigger("clear")}}insertAtCaret(t){const e=this,i=e.caretPos,n=e.control;n.insertBefore(t,n.children[i]),e.setCaret(i+1)}deleteSelection(t){var e,i,n,r,o=this;e=t&&t.keyCode===xd?-1:1,i=Hd(o.control_input);const s=[];if(o.activeItems.length)r=ld(o.activeItems,e),n=hd(r),e>0&&n++,Xh(o.activeItems,t=>s.push(t));else if((o.isFocused||"single"===o.settings.mode)&&o.items.length){const t=o.controlChildren();e<0&&0===i.start&&0===i.length?s.push(t[o.caretPos-1]):e>0&&i.start===o.inputValue().length&&s.push(t[o.caretPos])}const a=s.map(t=>t.dataset.value);if(!a.length||"function"==typeof o.settings.onDelete&&!1===o.settings.onDelete.call(o,a,t))return!1;for(Od(t,!0),void 0!==n&&o.setCaret(n);s.length;)o.removeItem(s.pop());return o.showInput(),o.positionDropdown(),o.refreshOptions(!1),!0}advanceSelection(t,e){var i,n,r=this;r.rtl&&(t*=-1),r.inputValue().length||(Vd(zd,e)||Vd("shiftKey",e)?(n=(i=r.getLastActive(t))?i.classList.contains("active")?r.getAdjacent(i,t,"item"):i:t>0?r.control_input.nextElementSibling:r.control_input.previousElementSibling)&&(n.classList.contains("active")&&r.removeActiveItem(i),r.setActiveItemClass(n)):r.moveCaret(t))}moveCaret(t){}getLastActive(t){let e=this.control.querySelector(".last-active");if(e)return e;var i=this.control.querySelectorAll(".active");return i?ld(i,t):void 0}setCaret(t){this.caretPos=this.items.length}controlChildren(){return Array.from(this.control.querySelectorAll("[data-ts-item]"))}lock(){this.isLocked=!0,this.refreshState()}unlock(){this.isLocked=!1,this.refreshState()}disable(){var t=this;t.input.disabled=!0,t.control_input.disabled=!0,t.focus_node.tabIndex=-1,t.isDisabled=!0,this.close(),t.lock()}enable(){var t=this;t.input.disabled=!1,t.control_input.disabled=!1,t.focus_node.tabIndex=t.tabIndex,t.isDisabled=!1,t.unlock()}destroy(){var t=this,e=t.revertSettings;t.trigger("destroy"),t.off(),t.wrapper.remove(),t.dropdown.remove(),t.input.innerHTML=e.innerHTML,t.input.tabIndex=e.tabIndex,rd(t.input,"tomselected","ts-hidden-accessible"),t._destroy(),delete t.input.tomselect}render(t,e){return"function"!=typeof this.settings.render[t]?null:this._render(t,e)}_render(t,e){var i,n,r="";const o=this;return"option"!==t&&"item"!=t||(r=Ed(e[o.settings.valueField])),null==(n=o.settings.render[t].call(this,e,Md))||(n=Zh(n),"option"===t||"option_create"===t?e[o.settings.disabledField]?dd(n,{"aria-disabled":"true"}):dd(n,{"data-selectable":""}):"optgroup"===t&&(i=e.group[o.settings.optgroupValueField],dd(n,{"data-group":i}),e.group[o.settings.disabledField]&&dd(n,{"data-disabled":""})),"option"!==t&&"item"!==t||(dd(n,{"data-value":r}),"item"===t?(nd(n,o.settings.itemClass),dd(n,{"data-ts-item":""})):(nd(n,o.settings.optionClass),dd(n,{role:"option",id:e.$id}),o.options[r].$div=n))),n}clearCache(){Xh(this.options,(t,e)=>{t.$div&&(t.$div.remove(),delete t.$div)})}uncacheValue(t){const e=this.getOption(t);e&&e.remove()}canCreate(t){return this.settings.create&&t.length>0&&this.settings.createFilter.call(this,t)}hook(t,e,i){var n=this,r=n[e];n[e]=function(){var e,o;return"after"===t&&(e=r.apply(n,arguments)),o=i.apply(n,arguments),"instead"===t?o:("before"===t&&(e=r.apply(n,arguments)),e)}}}function Bd(){$d(this.input,"change",()=>{this.sync()})}function jd(){var t=this,e=t.onOptionSelect;t.settings.hideSelected=!1;var i=function(t){setTimeout(()=>{var e=t.querySelector("input");t.classList.contains("selected")?e.checked=!0:e.checked=!1},1)};t.hook("after","setupTemplates",()=>{var e=t.settings.render.option;t.settings.render.option=(i,n)=>{var r=Zh(e.call(t,i,n)),o=document.createElement("input");o.addEventListener("click",(function(t){Od(t)})),o.type="checkbox";const s=Cd(i[t.settings.valueField]);return s&&t.items.indexOf(s)>-1&&(o.checked=!0),r.prepend(o),r}}),t.on("item_remove",e=>{var n=t.getOption(e);n&&(n.classList.remove("selected"),i(n))}),t.on("item_add",e=>{var n=t.getOption(e);n&&i(n)}),t.hook("instead","onOptionSelect",(n,r)=>{if(r.classList.contains("selected"))return r.classList.remove("selected"),t.removeItem(r.dataset.value),t.refreshOptions(),void Od(n,!0);e.call(t,n,r),i(r)})}function qd(t){const e=this,i=Object.assign({className:"clear-button",title:"Clear All",html:t=>`<div class="${t.className}" title="${t.title}">×</div>`},t);e.on("initialize",()=>{var t=Zh(i.html(i));t.addEventListener("click",t=>{e.isDisabled||(e.clear(),"single"===e.settings.mode&&e.settings.allowEmptyOption&&e.addItem(""),t.preventDefault(),t.stopPropagation())}),e.control.appendChild(t)})}function Ud(){var t=this;if(!$.fn.sortable)throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');if("multi"===t.settings.mode){var e=t.lock,i=t.unlock;t.hook("instead","lock",()=>{var i=$(t.control).data("sortable");return i&&i.disable(),e.call(t)}),t.hook("instead","unlock",()=>{var e=$(t.control).data("sortable");return e&&e.enable(),i.call(t)}),t.on("initialize",()=>{var e=$(t.control).sortable({items:"[data-value]",forcePlaceholderSize:!0,disabled:t.isLocked,start:(t,i)=>{i.placeholder.css("width",i.helper.css("width")),e.css({overflow:"visible"})},stop:()=>{e.css({overflow:"hidden"});var i=[];e.children("[data-value]").each((function(){this.dataset.value&&i.push(this.dataset.value)})),t.setValue(i)}})})}}function Wd(t){const e=this,i=Object.assign({title:"Untitled",headerClass:"dropdown-header",titleRowClass:"dropdown-header-title",labelClass:"dropdown-header-label",closeClass:"dropdown-header-close",html:t=>'<div class="'+t.headerClass+'"><div class="'+t.titleRowClass+'"><span class="'+t.labelClass+'">'+t.title+'</span><a class="'+t.closeClass+'">×</a></div></div>'},t);e.on("initialize",()=>{var t=Zh(i.html(i)),n=t.querySelector("."+i.closeClass);n&&n.addEventListener("click",t=>{Od(t,!0),e.close()}),e.dropdown.insertBefore(t,e.dropdown.firstChild)})}function Yd(){var t=this;t.hook("instead","setCaret",e=>{"single"!==t.settings.mode&&t.control.contains(t.control_input)?(e=Math.max(0,Math.min(t.items.length,e)))==t.caretPos||t.isPending||t.controlChildren().forEach((i,n)=>{n<e?t.control_input.insertAdjacentElement("beforebegin",i):t.control.appendChild(i)}):e=t.items.length,t.caretPos=e}),t.hook("instead","moveCaret",e=>{if(!t.isFocused)return;const i=t.getLastActive(e);if(i){const n=hd(i);t.setCaret(e>0?n+1:n),t.setActiveItem(),rd(i,"last-active")}else t.setCaret(t.caretPos+e)})}function Gd(){const t=this;t.settings.shouldOpen=!0,t.hook("before","setup",()=>{t.focus_node=t.control,nd(t.control_input,"dropdown-input");const e=Zh('<div class="dropdown-input-wrap">');e.append(t.control_input),t.dropdown.insertBefore(e,t.dropdown.firstChild);const i=Zh('<input class="items-placeholder" tabindex="-1" />');i.placeholder=t.settings.placeholder,t.control.append(i)}),t.on("initialize",()=>{t.control_input.addEventListener("keydown",e=>{switch(e.keyCode){case vd:return t.isOpen&&(Od(e,!0),t.close()),void t.clearActiveItems();case Ad:t.focus_node.tabIndex=-1}return t.onKeyDown.call(t,e)}),t.on("blur",()=>{t.focus_node.tabIndex=t.isDisabled?-1:t.tabIndex}),t.on("dropdown_open",()=>{t.control_input.focus()});const e=t.onBlur;t.hook("instead","onBlur",i=>{if(!i||i.relatedTarget!=t.control_input)return e.call(t)}),$d(t.control_input,"blur",()=>t.onBlur()),t.hook("before","close",()=>{t.isOpen&&t.focus_node.focus()})})}function Xd(){var t=this;t.on("initialize",()=>{var e=document.createElement("span"),i=t.control_input;e.style.cssText="position:absolute; top:-99999px; left:-99999px; width:auto; padding:0; white-space:pre; ",t.wrapper.appendChild(e);var n=["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"];for(const t of n)e.style[t]=i.style[t];var r=()=>{t.items.length>0?(e.textContent=i.value,i.style.width=e.clientWidth+"px"):i.style.width=""};r(),t.on("update item_add item_remove",r),$d(i,"input",r),$d(i,"keyup",r),$d(i,"blur",r),$d(i,"update",r)})}function Kd(){var t=this,e=t.deleteSelection;this.hook("instead","deleteSelection",i=>!!t.activeItems.length&&e.call(t,i))}function Qd(){this.hook("instead","setActiveItem",()=>{}),this.hook("instead","selectAll",()=>{})}function Zd(){var t=this,e=t.onKeyDown;t.hook("instead","onKeyDown",i=>{var n,r,o,s;if(!t.isOpen||i.keyCode!==bd&&i.keyCode!==_d)return e.call(t,i);s=ad(t.activeOption,"[data-group]"),n=hd(t.activeOption,"[data-selectable]"),s&&(s=i.keyCode===bd?s.previousSibling:s.nextSibling)&&(r=(o=s.querySelectorAll("[data-selectable]"))[Math.min(o.length-1,n)])&&t.setActiveOption(r)})}function Jd(t){const e=Object.assign({label:"×",title:"Remove",className:"remove",append:!0},t);var i=this;if(e.append){var n='<a href="javascript:void(0)" class="'+e.className+'" tabindex="-1" title="'+Md(e.title)+'">'+e.label+"</a>";i.hook("after","setupTemplates",()=>{var t=i.settings.render.item;i.settings.render.item=(e,r)=>{var o=Zh(t.call(i,e,r)),s=Zh(n);return o.appendChild(s),$d(s,"mousedown",t=>{Od(t,!0)}),$d(s,"click",t=>{if(Od(t,!0),!i.isLocked){var e=o.dataset.value;i.removeItem(e),i.refreshOptions(!1),i.inputState()}}),o}})}}function tp(t){const e=this,i=Object.assign({text:t=>t[e.settings.labelField]},t);e.on("item_remove",(function(t){if(e.isFocused&&""===e.control_input.value.trim()){var n=e.options[t];n&&e.setTextboxValue(i.text.call(e,n))}}))}function ep(){const t=this,e=t.canLoad,i=t.clearActiveOption,n=t.loadCallback;var r,o,s={},a=!1;if(t.settings.shouldLoadMore||(t.settings.shouldLoadMore=function(){if(r.clientHeight/(r.scrollHeight-r.scrollTop)>.9)return!0;if(t.activeOption){var e=t.selectable();if([...e].indexOf(t.activeOption)>=e.length-2)return!0}return!1}),!t.settings.firstUrl)throw"virtual_scroll plugin requires a firstUrl() method";function l(e){return!("number"==typeof t.settings.maxOptions&&r.children.length>=t.settings.maxOptions)&&!(!(e in s)||!s[e])}t.settings.sortField=[{field:"$order"},{field:"$score"}],t.setNextUrl=function(t,e){s[t]=e},t.getUrl=function(e){if(e in s){const t=s[e];return s[e]=!1,t}return s={},t.settings.firstUrl.call(t,e)},t.hook("instead","clearActiveOption",()=>{if(!a)return i.call(t)}),t.hook("instead","canLoad",i=>i in s?l(i):e.call(t,i)),t.hook("instead","loadCallback",(e,i)=>{a?o&&e.length>0&&(o.dataset.value=e[0][t.settings.valueField]):t.clearOptions(),n.call(t,e,i),a=!1}),t.hook("after","refreshOptions",()=>{const e=t.lastValue;var i;l(e)?(i=t.render("loading_more",{query:e}))&&(i.setAttribute("data-selectable",""),o=i):e in s&&!r.querySelector(".no-results")&&(i=t.render("no_more_results",{query:e})),i&&(nd(i,t.settings.optionClass),r.append(i))}),t.on("initialize",()=>{r=t.dropdown_content,t.settings.render=Object.assign({},{loading_more:function(){return'<div class="loading-more-results">Loading more results ... </div>'},no_more_results:function(){return'<div class="no-more-results">No more results</div>'}},t.settings.render),r.addEventListener("scroll",(function(){t.settings.shouldLoadMore.call(t)&&l(t.lastValue)&&(a||(a=!0,t.load.call(t,t.lastValue)))}))})}function ip(t){if(document.getElementById("__pb-multi-select-css"))return;const e=D("../css/tom-select"),i=document.createElement("link");i.id="__pb-multi-select-css",i.href=`${e}/tom-select.${t}.min.css`,i.rel="stylesheet",document.head.appendChild(i)}Fd.define("change_listener",Bd),Fd.define("checkbox_options",jd),Fd.define("clear_button",qd),Fd.define("drag_drop",Ud),Fd.define("dropdown_header",Wd),Fd.define("caret_position",Yd),Fd.define("dropdown_input",Gd),Fd.define("input_autogrow",Xd),Fd.define("no_backspace_delete",Kd),Fd.define("no_active_items",Qd),Fd.define("optgroup_columns",Zd),Fd.define("remove_button",Jd),Fd.define("restore_on_backspace",tp),Fd.define("virtual_scroll",ep);const np=t=>t?`<div>${t.text}</div>`:"";class rp extends(N(V)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{source:{type:String},closeAfterSelect:{type:Boolean,attribute:"close-after-select"},preload:{type:Boolean},onBlur:{type:String,attribute:"on-blur"},onChange:{type:String,attribute:"on-change"}})}set renderItem(t){this.renderFunction=t}constructor(){super(),this.theme="default",this.source=null,this.closeAfterSelect=!1,this.preload=!1,this.renderFunction=np,this.onBlur="pb-combo-box-blur",this.onChange="pb-combo-box-change"}connectedCallback(){super.connectedCallback()}firstUpdated(){ip(this.theme);let t=this.querySelector("select,input");t||(t=document.createElement("input"),this.appendChild(t)),t.autocomplete=!1,rp.waitOnce("pb-page-ready",()=>{const e={};if(this.source){const t=this.toAbsoluteURL(this.source);e.labelField="text",e.valueField="value",e.searchField=["text","value"],e.preload=this.preload,e.load=(e,i)=>{fetch(`${t}?query=${encodeURIComponent(e)}`,{method:"GET",mode:"cors",credentials:"same-origin"}).then(t=>t.json()).then(t=>{i(t)}).catch(()=>{i()})},e.render={option:this.renderFunction,item:this.renderFunction}}e.closeAfterSelect=this.closeAfterSelect,e.onBlur=()=>this.emitTo(this.onBlur),e.onChange=()=>this.emitTo(this.onChange),this._select=new Fd(t,e)})}createRenderRoot(){return this}}customElements.define("pb-combo-box",rp);
|
|
4543
|
+
`:null}async _handleResponse(){await this.updateComplete;const t=this.shadowRoot.getElementById("loadData").lastResponse;let e={};this.startDate&&this.endDate?Object.keys(t).filter(t=>t>=this.startDate&&t<this.endDate).forEach(i=>{e[i]=t[i]}):e=t,this.searchResult=new Ch(e,this.maxInterval,this.scopes),this.setData(this.searchResult.export(this.scope)),this.emitTo("pb-timeline-loaded",{value:!0,label:this.label})}}function Lh(t,e){t.split(/\s+/).forEach(t=>{e(t)})}customElements.define("pb-timeline",Mh);class Th{constructor(){this._events=void 0,this._events={}}on(t,e){Lh(t,t=>{this._events[t]=this._events[t]||[],this._events[t].push(e)})}off(t,e){var i=arguments.length;0!==i?Lh(t,t=>{if(1===i)return delete this._events[t];t in this._events!=!1&&this._events[t].splice(this._events[t].indexOf(e),1)}):this._events={}}trigger(t,...e){var i=this;Lh(t,t=>{if(t in i._events!=!1)for(let n of i._events[t])n.apply(i,e)})}}function Hh(t){return t.plugins={},class extends t{constructor(...t){super(...t),this.plugins={names:[],settings:{},requested:{},loaded:{}}}static define(e,i){t.plugins[e]={name:e,fn:i}}initializePlugins(t){var e,i;const n=this,r=[];if(Array.isArray(t))t.forEach(t=>{"string"==typeof t?r.push(t):(n.plugins.settings[t.name]=t.options,r.push(t.name))});else if(t)for(e in t)t.hasOwnProperty(e)&&(n.plugins.settings[e]=t[e],r.push(e));for(;i=r.shift();)n.require(i)}loadPlugin(e){var i=this,n=i.plugins,r=t.plugins[e];if(!t.plugins.hasOwnProperty(e))throw new Error('Unable to find "'+e+'" plugin');n.requested[e]=!0,n.loaded[e]=r.fn.apply(i,[i.plugins.settings[e]||{}]),n.names.push(e)}require(t){var e=this,i=e.plugins;if(!e.plugins.loaded.hasOwnProperty(t)){if(i.requested[t])throw new Error('Plugin has circular dependency ("'+t+'")');e.loadPlugin(t)}return i.loaded[t]}}}const Oh="[̀-ͯ·ʾ]",$h=new RegExp(Oh,"g");var Vh;const Ih={"æ":"ae","ⱥ":"a","ø":"o"},Rh=new RegExp(Object.keys(Ih).join("|"),"g"),Ph=[[67,67],[160,160],[192,438],[452,652],[961,961],[1019,1019],[1083,1083],[1281,1289],[1984,1984],[5095,5095],[7429,7441],[7545,7549],[7680,7935],[8580,8580],[9398,9449],[11360,11391],[42792,42793],[42802,42851],[42873,42897],[42912,42922],[64256,64260],[65313,65338],[65345,65370]],Dh=t=>t.normalize("NFKD").replace($h,"").toLowerCase().replace(Rh,(function(t){return Ih[t]})),Nh=(t,e="|")=>{if(1==t.length)return t[0];var i=1;return t.forEach(t=>{i=Math.max(i,t.length)}),1==i?"["+t.join("")+"]":"(?:"+t.join(e)+")"},Fh=t=>{if(1===t.length)return[[t]];var e=[];return Fh(t.substring(1)).forEach((function(i){var n=i.slice(0);n[0]=t.charAt(0)+n[0],e.push(n),(n=i.slice(0)).unshift(t.charAt(0)),e.push(n)})),e},Bh=()=>{var t={};Ph.forEach(e=>{for(let n=e[0];n<=e[1];n++){let e=String.fromCharCode(n),r=Dh(e);if(r!=e.toLowerCase()){r in t||(t[r]=[r]);var i=new RegExp(Nh(t[r]),"iu");e.match(i)||t[r].push(e)}}});var e=Object.keys(t);e=e.sort((t,e)=>e.length-t.length),_h=new RegExp("("+Nh(e)+Oh+"*)","g");var i={};return e.sort((t,e)=>t.length-e.length).forEach(e=>{var n=Fh(e).map(e=>(e=e.map(e=>t.hasOwnProperty(e)?Nh(t[e]):e),Nh(e,"")));i[e]=Nh(n)}),i},jh=t=>{void 0===Vh&&(Vh=Bh());return t.normalize("NFKD").toLowerCase().split(_h).map(t=>{if(""==t)return"";const e=Dh(t);if(Vh.hasOwnProperty(e))return Vh[e];const i=t.normalize("NFC");return i!=t?Nh([t,i]):t}).join("")},qh=(t,e)=>{if(t)return t[e]},Uh=(t,e)=>{if(t){for(var i,n=e.split(".");(i=n.shift())&&(t=t[i]););return t}},Wh=(t,e,i)=>{var n,r;return t?-1===(r=(t+="").search(e.regex))?0:(n=e.string.length/t.length,0===r&&(n+=.5),n*i):0},Yh=t=>(t+"").replace(/([\$\(-\+\.\?\[-\^\{-\}])/g,"\\$1"),Gh=(t,e)=>{var i=t[e];if("function"==typeof i)return i;i&&!Array.isArray(i)&&(t[e]=[i])},Xh=(t,e)=>{if(Array.isArray(t))t.forEach(e);else for(var i in t)t.hasOwnProperty(i)&&e(t[i],i)},Kh=(t,e)=>"number"==typeof t&&"number"==typeof e?t>e?1:t<e?-1:0:(t=Dh(t+"").toLowerCase())>(e=Dh(e+"").toLowerCase())?1:e>t?-1:0;class Qh{constructor(t,e){this.items=void 0,this.settings=void 0,this.items=t,this.settings=e||{diacritics:!0}}tokenize(t,e,i){if(!t||!t.length)return[];const n=[],r=t.split(/\s+/);var o;return i&&(o=new RegExp("^("+Object.keys(i).map(Yh).join("|")+"):(.*)$")),r.forEach(t=>{let i,r=null,s=null;o&&(i=t.match(o))&&(r=i[1],t=i[2]),t.length>0&&(s=Yh(t),this.settings.diacritics&&(s=jh(s)),e&&(s="\\b"+s)),n.push({string:t,regex:s?new RegExp(s,"iu"):null,field:r})}),n}getScoreFunction(t,e){var i=this.prepareSearch(t,e);return this._getScoreFunction(i)}_getScoreFunction(t){const e=t.tokens,i=e.length;if(!i)return function(){return 0};const n=t.options.fields,r=t.weights,o=n.length,s=t.getAttrFn;if(!o)return function(){return 1};const a=1===o?function(t,e){const i=n[0].field;return Wh(s(e,i),t,r[i])}:function(t,e){var i=0;if(t.field){const n=s(e,t.field);!t.regex&&n?i+=1/o:i+=Wh(n,t,1)}else Xh(r,(n,r)=>{i+=Wh(s(e,r),t,n)});return i/o};return 1===i?function(t){return a(e[0],t)}:"and"===t.options.conjunction?function(t){for(var n,r=0,o=0;r<i;r++){if((n=a(e[r],t))<=0)return 0;o+=n}return o/i}:function(t){var n=0;return Xh(e,e=>{n+=a(e,t)}),n/i}}getSortFunction(t,e){var i=this.prepareSearch(t,e);return this._getSortFunction(i)}_getSortFunction(t){var e,i,n;const r=this,o=t.options,s=!t.query&&o.sort_empty?o.sort_empty:o.sort,a=[],l=[];if("function"==typeof s)return s.bind(this);const c=function(e,i){return"$score"===e?i.score:t.getAttrFn(r.items[i.id],e)};if(s)for(e=0,i=s.length;e<i;e++)(t.query||"$score"!==s[e].field)&&a.push(s[e]);if(t.query){for(n=!0,e=0,i=a.length;e<i;e++)if("$score"===a[e].field){n=!1;break}n&&a.unshift({field:"$score",direction:"desc"})}else for(e=0,i=a.length;e<i;e++)if("$score"===a[e].field){a.splice(e,1);break}for(e=0,i=a.length;e<i;e++)l.push("desc"===a[e].direction?-1:1);const h=a.length;if(h){if(1===h){const t=a[0].field,e=l[0];return function(i,n){return e*Kh(c(t,i),c(t,n))}}return function(t,e){var i,n,r;for(i=0;i<h;i++)if(r=a[i].field,n=l[i]*Kh(c(r,t),c(r,e)))return n;return 0}}return null}prepareSearch(t,e){const i={};var n=Object.assign({},e);if(Gh(n,"sort"),Gh(n,"sort_empty"),n.fields){Gh(n,"fields");const t=[];n.fields.forEach(e=>{"string"==typeof e&&(e={field:e,weight:1}),t.push(e),i[e.field]="weight"in e?e.weight:1}),n.fields=t}return{options:n,query:t.toLowerCase().trim(),tokens:this.tokenize(t,n.respect_word_boundaries,i),total:0,items:[],weights:i,getAttrFn:n.nesting?Uh:qh}}search(t,e){var i,n,r=this;n=this.prepareSearch(t,e),e=n.options,t=n.query;const o=e.score||r._getScoreFunction(n);t.length?Xh(r.items,(t,r)=>{i=o(t),(!1===e.filter||i>0)&&n.items.push({score:i,id:r})}):Xh(r.items,(t,e)=>{n.items.push({score:1,id:e})});const s=r._getSortFunction(n);return s&&n.items.sort(s),n.total=n.items.length,"number"==typeof e.limit&&(n.items=n.items.slice(0,e.limit)),n}}const Zh=t=>{if(t.jquery)return t[0];if(t instanceof HTMLElement)return t;if(Jh(t)){let e=document.createElement("div");return e.innerHTML=t.trim(),e.firstChild}return document.querySelector(t)},Jh=t=>"string"==typeof t&&t.indexOf("<")>-1,td=t=>t.replace(/['"\\]/g,"\\$&"),ed=(t,e)=>{var i=document.createEvent("HTMLEvents");i.initEvent(e,!0,!1),t.dispatchEvent(i)},id=(t,e)=>{Object.assign(t.style,e)},nd=(t,...e)=>{var i=od(e);(t=sd(t)).map(t=>{i.map(e=>{t.classList.add(e)})})},rd=(t,...e)=>{var i=od(e);(t=sd(t)).map(t=>{i.map(e=>{t.classList.remove(e)})})},od=t=>{var e=[];return Xh(t,t=>{"string"==typeof t&&(t=t.trim().split(/[\11\12\14\15\40]/)),Array.isArray(t)&&(e=e.concat(t))}),e.filter(Boolean)},sd=t=>(Array.isArray(t)||(t=[t]),t),ad=(t,e,i)=>{if(!i||i.contains(t))for(;t&&t.matches;){if(t.matches(e))return t;t=t.parentNode}},ld=(t,e=0)=>e>0?t[t.length-1]:t[0],cd=t=>0===Object.keys(t).length,hd=(t,e)=>{if(!t)return-1;e=e||t.nodeName;for(var i=0;t=t.previousElementSibling;)t.matches(e)&&i++;return i},dd=(t,e)=>{Xh(e,(e,i)=>{null==e?t.removeAttribute(i):t.setAttribute(i,""+e)})},pd=(t,e)=>{t.parentNode&&t.parentNode.replaceChild(e,t)},ud=(t,e)=>{if(null===e)return;if("string"==typeof e){if(!e.length)return;e=new RegExp(e,"i")}const i=t=>{var i=t.data.match(e);if(i&&t.data.length>0){var n=document.createElement("span");n.className="highlight";var r=t.splitText(i.index);r.splitText(i[0].length);var o=r.cloneNode(!0);return n.appendChild(o),pd(r,n),1}return 0},n=t=>{if(1===t.nodeType&&t.childNodes&&!/(script|style)/i.test(t.tagName)&&("highlight"!==t.className||"SPAN"!==t.tagName))for(var e=0;e<t.childNodes.length;++e)e+=r(t.childNodes[e])},r=t=>3===t.nodeType?i(t):(n(t),0);r(t)},gd=t=>{var e=t.querySelectorAll("span.highlight");Array.prototype.forEach.call(e,(function(t){var e=t.parentNode;e.replaceChild(t.firstChild,t),e.normalize()}))},fd=65,md=13,vd=27,bd=37,yd=38,_d=39,wd=40,xd=8,kd=46,Ad=9,zd="undefined"!=typeof navigator&&/Mac/.test(navigator.userAgent)?"metaKey":"ctrlKey";var Sd={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:null,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,shouldOpen:null,maxOptions:50,maxItems:null,hideSelected:null,duplicates:!1,addPrecedence:!1,selectOnTab:!1,preload:null,allowEmptyOption:!1,loadThrottle:300,loadingClass:"loading",dataAttr:null,optgroupField:"optgroup",valueField:"value",labelField:"text",disabledField:"disabled",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"ts-wrapper",controlClass:"ts-control",dropdownClass:"ts-dropdown",dropdownContentClass:"ts-dropdown-content",itemClass:"item",optionClass:"option",dropdownParent:null,controlInput:'<input type="text" autocomplete="off" size="1" />',copyClassesToDropdown:!1,placeholder:null,hidePlaceholder:null,shouldLoad:function(t){return t.length>0},render:{}};const Cd=t=>null==t?null:Ed(t),Ed=t=>"boolean"==typeof t?t?"1":"0":t+"",Md=t=>(t+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),Ld=(t,e)=>{var i;return function(n,r){var o=this;i&&(o.loading=Math.max(o.loading-1,0),clearTimeout(i)),i=setTimeout((function(){i=null,o.loadedSearches[n]=!0,t.call(o,n,r)}),e)}},Td=(t,e,i)=>{var n,r=t.trigger,o={};for(n of(t.trigger=function(){var i=arguments[0];if(-1===e.indexOf(i))return r.apply(t,arguments);o[i]=arguments},i.apply(t,[]),t.trigger=r,e))n in o&&r.apply(t,o[n])},Hd=t=>({start:t.selectionStart||0,length:(t.selectionEnd||0)-(t.selectionStart||0)}),Od=(t,e=!1)=>{t&&(t.preventDefault(),e&&t.stopPropagation())},$d=(t,e,i,n)=>{t.addEventListener(e,i,n)},Vd=(t,e)=>!!e&&(!!e[t]&&1===(e.altKey?1:0)+(e.ctrlKey?1:0)+(e.shiftKey?1:0)+(e.metaKey?1:0)),Id=(t,e)=>{const i=t.getAttribute("id");return i||(t.setAttribute("id",e),e)},Rd=t=>t.replace(/[\\"']/g,"\\$&"),Pd=(t,e)=>{e&&t.append(e)};function Dd(t,e){var i=Object.assign({},Sd,e),n=i.dataAttr,r=i.labelField,o=i.valueField,s=i.disabledField,a=i.optgroupField,l=i.optgroupLabelField,c=i.optgroupValueField,h=t.tagName.toLowerCase(),d=t.getAttribute("placeholder")||t.getAttribute("data-placeholder");if(!d&&!i.allowEmptyOption){let e=t.querySelector('option[value=""]');e&&(d=e.textContent)}var p={placeholder:d,options:[],optgroups:[],items:[],maxItems:null},u=()=>{const e=t.getAttribute(n);if(e)p.options=JSON.parse(e),Xh(p.options,t=>{p.items.push(t[o])});else{var s=t.value.trim()||"";if(!i.allowEmptyOption&&!s.length)return;const e=s.split(i.delimiter);Xh(e,t=>{const e={};e[r]=t,e[o]=t,p.options.push(e)}),p.items=e}};return"select"===h?(()=>{var e,h=p.options,d={},u=1,g=t=>{var e=Object.assign({},t.dataset),i=n&&e[n];return"string"==typeof i&&i.length&&(e=Object.assign(e,JSON.parse(i))),e},f=(t,e)=>{var n=Cd(t.value);if(null!=n&&(n||i.allowEmptyOption)){if(d.hasOwnProperty(n)){if(e){var l=d[n][a];l?Array.isArray(l)?l.push(e):d[n][a]=[l,e]:d[n][a]=e}}else{var c=g(t);c[r]=c[r]||t.textContent,c[o]=c[o]||n,c[s]=c[s]||t.disabled,c[a]=c[a]||e,c.$option=t,d[n]=c,h.push(c)}t.selected&&p.items.push(n)}},m=t=>{var e,i;(i=g(t))[l]=i[l]||t.getAttribute("label")||"",i[c]=i[c]||u++,i[s]=i[s]||t.disabled,p.optgroups.push(i),e=i[c],Xh(t.children,t=>{f(t,e)})};p.maxItems=t.hasAttribute("multiple")?null:1,Xh(t.children,t=>{"optgroup"===(e=t.tagName.toLowerCase())?m(t):"option"===e&&f(t)})})():u(),Object.assign({},Sd,p,e)}var Nd=0;class Fd extends(Hh(Th)){constructor(t,e){var i;super(),this.control_input=void 0,this.wrapper=void 0,this.dropdown=void 0,this.control=void 0,this.dropdown_content=void 0,this.focus_node=void 0,this.order=0,this.settings=void 0,this.input=void 0,this.tabIndex=void 0,this.is_select_tag=void 0,this.rtl=void 0,this.inputId=void 0,this._destroy=void 0,this.sifter=void 0,this.isOpen=!1,this.isDisabled=!1,this.isRequired=void 0,this.isInvalid=!1,this.isValid=!0,this.isLocked=!1,this.isFocused=!1,this.isInputHidden=!1,this.isSetup=!1,this.ignoreFocus=!1,this.hasOptions=!1,this.currentResults=void 0,this.lastValue="",this.caretPos=0,this.loading=0,this.loadedSearches={},this.activeOption=null,this.activeItems=[],this.optgroups={},this.options={},this.userOptions={},this.items=[],Nd++;var n=Zh(t);if(n.tomselect)throw new Error("Tom Select already initialized on this element");n.tomselect=this,i=(window.getComputedStyle&&window.getComputedStyle(n,null)).getPropertyValue("direction");const r=Dd(n,e);this.settings=r,this.input=n,this.tabIndex=n.tabIndex||0,this.is_select_tag="select"===n.tagName.toLowerCase(),this.rtl=/rtl/i.test(i),this.inputId=Id(n,"tomselect-"+Nd),this.isRequired=n.required,this.sifter=new Qh(this.options,{diacritics:r.diacritics}),r.mode=r.mode||(1===r.maxItems?"single":"multi"),"boolean"!=typeof r.hideSelected&&(r.hideSelected="multi"===r.mode),"boolean"!=typeof r.hidePlaceholder&&(r.hidePlaceholder="multi"!==r.mode);var o=r.createFilter;"function"!=typeof o&&("string"==typeof o&&(o=new RegExp(o)),o instanceof RegExp?r.createFilter=t=>o.test(t):r.createFilter=()=>!0),this.initializePlugins(r.plugins),this.setupCallbacks(),this.setupTemplates();const s=Zh("<div>"),a=Zh("<div>"),l=this._render("dropdown"),c=Zh('<div role="listbox" tabindex="-1">'),h=this.input.getAttribute("class")||"",d=r.mode;var p;(nd(s,r.wrapperClass,h,d),nd(a,r.controlClass),Pd(s,a),nd(l,r.dropdownClass,d),r.copyClassesToDropdown&&nd(l,h),nd(c,r.dropdownContentClass),Pd(l,c),Zh(r.dropdownParent||s).appendChild(l),Jh(r.controlInput))?(p=Zh(r.controlInput),Xh(["autocorrect","autocapitalize","autocomplete"],t=>{n.getAttribute(t)&&dd(p,{[t]:n.getAttribute(t)})}),p.tabIndex=-1,a.appendChild(p),this.focus_node=p):r.controlInput?(p=Zh(r.controlInput),this.focus_node=p):(p=Zh("<input/>"),this.focus_node=a);this.wrapper=s,this.dropdown=l,this.dropdown_content=c,this.control=a,this.control_input=p,this.setup()}setup(){const t=this,e=t.settings,i=t.control_input,n=t.dropdown,r=t.dropdown_content,o=t.wrapper,s=t.control,a=t.input,l=t.focus_node,c={passive:!0},h=t.inputId+"-ts-dropdown";dd(r,{id:h}),dd(l,{role:"combobox","aria-haspopup":"listbox","aria-expanded":"false","aria-controls":h});const d=Id(l,t.inputId+"-ts-control"),p="label[for='"+td(t.inputId)+"']",u=document.querySelector(p),g=t.focus.bind(t);if(u){$d(u,"click",g),dd(u,{for:d});const e=Id(u,t.inputId+"-ts-label");dd(l,{"aria-labelledby":e}),dd(r,{"aria-labelledby":e})}if(o.style.width=a.style.width,t.plugins.names.length){const e="plugin-"+t.plugins.names.join(" plugin-");nd([o,n],e)}(null===e.maxItems||e.maxItems>1)&&t.is_select_tag&&dd(a,{multiple:"multiple"}),t.settings.placeholder&&dd(i,{placeholder:e.placeholder}),!t.settings.splitOn&&t.settings.delimiter&&(t.settings.splitOn=new RegExp("\\s*"+Yh(t.settings.delimiter)+"+\\s*")),e.load&&e.loadThrottle&&(e.load=Ld(e.load,e.loadThrottle)),t.control_input.type=a.type,$d(n,"click",e=>{const i=ad(e.target,"[data-selectable]");i&&(t.onOptionSelect(e,i),Od(e,!0))}),$d(s,"click",e=>{var n=ad(e.target,"[data-ts-item]",s);n&&t.onItemSelect(e,n)?Od(e,!0):""==i.value&&(t.onClick(),Od(e,!0))}),$d(l,"keydown",e=>t.onKeyDown(e)),$d(i,"keypress",e=>t.onKeyPress(e)),$d(i,"input",e=>t.onInput(e)),$d(l,"resize",()=>t.positionDropdown(),c),$d(l,"blur",e=>t.onBlur(e)),$d(l,"focus",e=>t.onFocus(e)),$d(l,"paste",e=>t.onPaste(e));const f=e=>{const r=e.composedPath()[0];if(!o.contains(r)&&!n.contains(r))return t.isFocused&&t.blur(),void t.inputState();r==i&&t.isOpen?e.stopPropagation():Od(e,!0)};var m=()=>{t.isOpen&&t.positionDropdown()};$d(document,"mousedown",f),$d(window,"scroll",m,c),$d(window,"resize",m,c),this._destroy=()=>{document.removeEventListener("mousedown",f),window.removeEventListener("sroll",m),window.removeEventListener("resize",m),u&&u.removeEventListener("click",g)},this.revertSettings={innerHTML:a.innerHTML,tabIndex:a.tabIndex},a.tabIndex=-1,a.insertAdjacentElement("afterend",t.wrapper),t.sync(!1),e.items=[],delete e.optgroups,delete e.options,$d(a,"invalid",e=>{t.isValid&&(t.isValid=!1,t.isInvalid=!0,t.refreshState())}),t.updateOriginalInput(),t.refreshItems(),t.close(!1),t.inputState(),t.isSetup=!0,a.disabled?t.disable():t.enable(),t.on("change",this.onChange),nd(a,"tomselected","ts-hidden-accessible"),t.trigger("initialize"),!0===e.preload&&t.preload()}setupOptions(t=[],e=[]){this.addOptions(t),Xh(e,t=>{this.registerOptionGroup(t)})}setupTemplates(){var t=this,e=t.settings.labelField,i=t.settings.optgroupLabelField,n={optgroup:t=>{let e=document.createElement("div");return e.className="optgroup",e.appendChild(t.options),e},optgroup_header:(t,e)=>'<div class="optgroup-header">'+e(t[i])+"</div>",option:(t,i)=>"<div>"+i(t[e])+"</div>",item:(t,i)=>"<div>"+i(t[e])+"</div>",option_create:(t,e)=>'<div class="create">Add <strong>'+e(t.input)+"</strong>…</div>",no_results:()=>'<div class="no-results">No results found</div>',loading:()=>'<div class="spinner"></div>',not_loading:()=>{},dropdown:()=>"<div></div>"};t.settings.render=Object.assign({},n,t.settings.render)}setupCallbacks(){var t,e,i={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",item_select:"onItemSelect",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(t in i)(e=this.settings[i[t]])&&this.on(t,e)}sync(t=!0){const e=this,i=t?Dd(e.input,{delimiter:e.settings.delimiter}):e.settings;e.setupOptions(i.options,i.optgroups),e.setValue(i.items||[],!0),e.lastQuery=null}onClick(){var t=this;if(t.activeItems.length>0)return t.clearActiveItems(),void t.focus();t.isFocused&&t.isOpen?t.blur():t.focus()}onMouseDown(){}onChange(){ed(this.input,"input"),ed(this.input,"change")}onPaste(t){var e=this;e.isInputHidden||e.isLocked?Od(t):e.settings.splitOn&&setTimeout(()=>{var t=e.inputValue();if(t.match(e.settings.splitOn)){var i=t.trim().split(e.settings.splitOn);Xh(i,t=>{e.createItem(t)})}},0)}onKeyPress(t){var e=this;if(!e.isLocked){var i=String.fromCharCode(t.keyCode||t.which);return e.settings.create&&"multi"===e.settings.mode&&i===e.settings.delimiter?(e.createItem(),void Od(t)):void 0}Od(t)}onKeyDown(t){var e=this;if(e.isLocked)t.keyCode!==Ad&&Od(t);else{switch(t.keyCode){case fd:if(Vd(zd,t)&&""==e.control_input.value)return Od(t),void e.selectAll();break;case vd:return e.isOpen&&(Od(t,!0),e.close()),void e.clearActiveItems();case wd:if(!e.isOpen&&e.hasOptions)e.open();else if(e.activeOption){let t=e.getAdjacent(e.activeOption,1);t&&e.setActiveOption(t)}return void Od(t);case yd:if(e.activeOption){let t=e.getAdjacent(e.activeOption,-1);t&&e.setActiveOption(t)}return void Od(t);case md:return void(e.canSelect(e.activeOption)?(e.onOptionSelect(t,e.activeOption),Od(t)):e.settings.create&&e.createItem()&&Od(t));case bd:return void e.advanceSelection(-1,t);case _d:return void e.advanceSelection(1,t);case Ad:return void(e.settings.selectOnTab&&(e.canSelect(e.activeOption)&&(e.onOptionSelect(t,e.activeOption),Od(t)),e.settings.create&&e.createItem()&&Od(t)));case xd:case kd:return void e.deleteSelection(t)}e.isInputHidden&&!Vd(zd,t)&&Od(t)}}onInput(t){var e=this;if(!e.isLocked){var i=e.inputValue();e.lastValue!==i&&(e.lastValue=i,e.settings.shouldLoad.call(e,i)&&e.load(i),e.refreshOptions(),e.trigger("type",i))}}onFocus(t){var e=this,i=e.isFocused;if(e.isDisabled)return e.blur(),void Od(t);e.ignoreFocus||(e.isFocused=!0,"focus"===e.settings.preload&&e.preload(),i||e.trigger("focus"),e.activeItems.length||(e.showInput(),e.refreshOptions(!!e.settings.openOnFocus)),e.refreshState())}onBlur(t){if(!1!==document.hasFocus()){var e=this;if(e.isFocused){e.isFocused=!1,e.ignoreFocus=!1;var i=()=>{e.close(),e.setActiveItem(),e.setCaret(e.items.length),e.trigger("blur")};e.settings.create&&e.settings.createOnBlur?e.createItem(null,!1,i):i()}}}onOptionSelect(t,e){var i,n=this;e.parentElement&&e.parentElement.matches("[data-disabled]")||(e.classList.contains("create")?n.createItem(null,!0,()=>{n.settings.closeAfterSelect&&n.close()}):void 0!==(i=e.dataset.value)&&(n.lastQuery=null,n.addItem(i),n.settings.closeAfterSelect&&n.close(),!n.settings.hideSelected&&t.type&&/click/.test(t.type)&&n.setActiveOption(e)))}canSelect(t){return!!(this.isOpen&&t&&this.dropdown_content.contains(t))}onItemSelect(t,e){var i=this;return!i.isLocked&&"multi"===i.settings.mode&&(Od(t),i.setActiveItem(e,t),!0)}canLoad(t){return!!this.settings.load&&!this.loadedSearches.hasOwnProperty(t)}load(t){const e=this;if(!e.canLoad(t))return;nd(e.wrapper,e.settings.loadingClass),e.loading++;const i=e.loadCallback.bind(e);e.settings.load.call(e,t,i)}loadCallback(t,e){const i=this;i.loading=Math.max(i.loading-1,0),i.lastQuery=null,i.clearActiveOption(),i.setupOptions(t,e),i.refreshOptions(i.isFocused&&!i.isInputHidden),i.loading||rd(i.wrapper,i.settings.loadingClass),i.trigger("load",t,e)}preload(){var t=this.wrapper.classList;t.contains("preloaded")||(t.add("preloaded"),this.load(""))}setTextboxValue(t=""){var e=this.control_input;e.value!==t&&(e.value=t,ed(e,"update"),this.lastValue=t)}getValue(){return this.is_select_tag&&this.input.hasAttribute("multiple")?this.items:this.items.join(this.settings.delimiter)}setValue(t,e){Td(this,e?[]:["change"],()=>{this.clear(e),this.addItems(t,e)})}setMaxItems(t){0===t&&(t=null),this.settings.maxItems=t,this.refreshState()}setActiveItem(t,e){var i,n,r,o,s,a,l=this;if("single"!==l.settings.mode){if(!t)return l.clearActiveItems(),void(l.isFocused&&l.showInput());if("click"===(i=e&&e.type.toLowerCase())&&Vd("shiftKey",e)&&l.activeItems.length){for(a=l.getLastActive(),(r=Array.prototype.indexOf.call(l.control.children,a))>(o=Array.prototype.indexOf.call(l.control.children,t))&&(s=r,r=o,o=s),n=r;n<=o;n++)t=l.control.children[n],-1===l.activeItems.indexOf(t)&&l.setActiveItemClass(t);Od(e)}else"click"===i&&Vd(zd,e)||"keydown"===i&&Vd("shiftKey",e)?t.classList.contains("active")?l.removeActiveItem(t):l.setActiveItemClass(t):(l.clearActiveItems(),l.setActiveItemClass(t));l.hideInput(),l.isFocused||l.focus()}}setActiveItemClass(t){const e=this,i=e.control.querySelector(".last-active");i&&rd(i,"last-active"),nd(t,"active last-active"),e.trigger("item_select",t),-1==e.activeItems.indexOf(t)&&e.activeItems.push(t)}removeActiveItem(t){var e=this.activeItems.indexOf(t);this.activeItems.splice(e,1),rd(t,"active")}clearActiveItems(){rd(this.activeItems,"active"),this.activeItems=[]}setActiveOption(t){t!==this.activeOption&&(this.clearActiveOption(),t&&(this.activeOption=t,dd(this.focus_node,{"aria-activedescendant":t.getAttribute("id")}),dd(t,{"aria-selected":"true"}),nd(t,"active"),this.scrollToOption(t)))}scrollToOption(t,e){if(!t)return;const i=this.dropdown_content,n=i.clientHeight,r=i.scrollTop||0,o=t.offsetHeight,s=t.getBoundingClientRect().top-i.getBoundingClientRect().top+r;s+o>n+r?this.scroll(s-n+o,e):s<r&&this.scroll(s,e)}scroll(t,e){const i=this.dropdown_content;e&&(i.style.scrollBehavior=e),i.scrollTop=t,i.style.scrollBehavior=""}clearActiveOption(){this.activeOption&&(rd(this.activeOption,"active"),dd(this.activeOption,{"aria-selected":null})),this.activeOption=null,dd(this.focus_node,{"aria-activedescendant":null})}selectAll(){const t=this;if("single"===t.settings.mode)return;const e=t.controlChildren();e.length&&(t.hideInput(),t.close(),t.activeItems=e,Xh(e,e=>{t.setActiveItemClass(e)}))}inputState(){var t=this;t.control.contains(t.control_input)&&(dd(t.control_input,{placeholder:t.settings.placeholder}),t.activeItems.length>0||!t.isFocused&&t.settings.hidePlaceholder&&t.items.length>0?(t.setTextboxValue(),t.isInputHidden=!0):(t.settings.hidePlaceholder&&t.items.length>0&&dd(t.control_input,{placeholder:""}),t.isInputHidden=!1),t.wrapper.classList.toggle("input-hidden",t.isInputHidden))}hideInput(){this.inputState()}showInput(){this.inputState()}inputValue(){return this.control_input.value.trim()}focus(){var t=this;t.isDisabled||(t.ignoreFocus=!0,t.control_input.offsetWidth?t.control_input.focus():t.focus_node.focus(),setTimeout(()=>{t.ignoreFocus=!1,t.onFocus()},0))}blur(){this.focus_node.blur(),this.onBlur()}getScoreFunction(t){return this.sifter.getScoreFunction(t,this.getSearchOptions())}getSearchOptions(){var t=this.settings,e=t.sortField;return"string"==typeof t.sortField&&(e=[{field:t.sortField}]),{fields:t.searchField,conjunction:t.searchConjunction,sort:e,nesting:t.nesting}}search(t){var e,i,n,r=this,o=this.getSearchOptions();if(r.settings.score&&"function"!=typeof(n=r.settings.score.call(r,t)))throw new Error('Tom Select "score" setting must be a function that returns a function');if(t!==r.lastQuery?(r.lastQuery=t,i=r.sifter.search(t,Object.assign(o,{score:n})),r.currentResults=i):i=Object.assign({},r.currentResults),r.settings.hideSelected)for(e=i.items.length-1;e>=0;e--){let t=Cd(i.items[e].id);t&&-1!==r.items.indexOf(t)&&i.items.splice(e,1)}return i}refreshOptions(t=!0){var e,i,n,r,o,s,a,l,c,h,d;const p={},u=[];var g=this,f=g.inputValue(),m=g.search(f),v=null,b=g.settings.shouldOpen||!1,y=g.dropdown_content;for(g.activeOption&&(c=g.activeOption.dataset.value,h=g.activeOption.closest("[data-group]")),r=m.items.length,"number"==typeof g.settings.maxOptions&&(r=Math.min(r,g.settings.maxOptions)),r>0&&(b=!0),e=0;e<r;e++){let t=m.items[e].id,r=g.options[t],a=g.getOption(t,!0);for(g.settings.hideSelected||a.classList.toggle("selected",g.items.includes(t)),o=r[g.settings.optgroupField]||"",i=0,n=(s=Array.isArray(o)?o:[o])&&s.length;i<n;i++)o=s[i],g.optgroups.hasOwnProperty(o)||(o=""),p.hasOwnProperty(o)||(p[o]=document.createDocumentFragment(),u.push(o)),i>0&&(a=a.cloneNode(!0),dd(a,{id:r.$id+"-clone-"+i,"aria-selected":null}),a.classList.add("ts-cloned"),rd(a,"active")),v||c!=t||(h?h.dataset.group===o&&(v=a):v=a),p[o].appendChild(a)}this.settings.lockOptgroupOrder&&u.sort((t,e)=>(g.optgroups[t]&&g.optgroups[t].$order||0)-(g.optgroups[e]&&g.optgroups[e].$order||0)),a=document.createDocumentFragment(),Xh(u,t=>{if(g.optgroups.hasOwnProperty(t)&&p[t].children.length){let e=document.createDocumentFragment(),i=g.render("optgroup_header",g.optgroups[t]);Pd(e,i),Pd(e,p[t]);let n=g.render("optgroup",{group:g.optgroups[t],options:e});Pd(a,n)}else Pd(a,p[t])}),y.innerHTML="",Pd(y,a),g.settings.highlight&&(gd(y),m.query.length&&m.tokens.length&&Xh(m.tokens,t=>{ud(y,t.regex)}));var _=t=>{let e=g.render(t,{input:f});return e&&(b=!0,y.insertBefore(e,y.firstChild)),e};if(g.loading?_("loading"):g.settings.shouldLoad.call(g,f)?0===m.items.length&&_("no_results"):_("not_loading"),(l=g.canCreate(f))&&(d=_("option_create")),g.hasOptions=m.items.length>0||l,b){if(m.items.length>0){if(!v&&"single"===g.settings.mode&&g.items.length&&(v=g.getOption(g.items[0])),!y.contains(v)){let t=0;d&&!g.settings.addPrecedence&&(t=1),v=g.selectable()[t]}}else d&&(v=d);t&&!g.isOpen&&(g.open(),g.scrollToOption(v,"auto")),g.setActiveOption(v)}else g.clearActiveOption(),t&&g.isOpen&&g.close(!1)}selectable(){return this.dropdown_content.querySelectorAll("[data-selectable]")}addOption(t,e=!1){const i=this;if(Array.isArray(t))return i.addOptions(t,e),!1;const n=Cd(t[i.settings.valueField]);return null!==n&&!i.options.hasOwnProperty(n)&&(t.$order=t.$order||++i.order,t.$id=i.inputId+"-opt-"+t.$order,i.options[n]=t,i.lastQuery=null,e&&(i.userOptions[n]=e,i.trigger("option_add",n,t)),n)}addOptions(t,e=!1){Xh(t,t=>{this.addOption(t,e)})}registerOption(t){return this.addOption(t)}registerOptionGroup(t){var e=Cd(t[this.settings.optgroupValueField]);return null!==e&&(t.$order=t.$order||++this.order,this.optgroups[e]=t,e)}addOptionGroup(t,e){var i;e[this.settings.optgroupValueField]=t,(i=this.registerOptionGroup(e))&&this.trigger("optgroup_add",i,e)}removeOptionGroup(t){this.optgroups.hasOwnProperty(t)&&(delete this.optgroups[t],this.clearCache(),this.trigger("optgroup_remove",t))}clearOptionGroups(){this.optgroups={},this.clearCache(),this.trigger("optgroup_clear")}updateOption(t,e){const i=this;var n,r;const o=Cd(t),s=Cd(e[i.settings.valueField]);if(null===o)return;if(!i.options.hasOwnProperty(o))return;if("string"!=typeof s)throw new Error("Value must be set in option data");const a=i.getOption(o),l=i.getItem(o);if(e.$order=e.$order||i.options[o].$order,delete i.options[o],i.uncacheValue(s),i.options[s]=e,a){if(i.dropdown_content.contains(a)){const t=i._render("option",e);pd(a,t),i.activeOption===a&&i.setActiveOption(t)}a.remove()}l&&(-1!==(r=i.items.indexOf(o))&&i.items.splice(r,1,s),n=i._render("item",e),l.classList.contains("active")&&nd(n,"active"),pd(l,n)),i.lastQuery=null}removeOption(t,e){const i=this;t=Ed(t),i.uncacheValue(t),delete i.userOptions[t],delete i.options[t],i.lastQuery=null,i.trigger("option_remove",t),i.removeItem(t,e)}clearOptions(){this.loadedSearches={},this.userOptions={},this.clearCache();var t={};Xh(this.options,(e,i)=>{this.items.indexOf(i)>=0&&(t[i]=this.options[i])}),this.options=this.sifter.items=t,this.lastQuery=null,this.trigger("option_clear")}getOption(t,e=!1){const i=Cd(t);if(null!==i&&this.options.hasOwnProperty(i)){const t=this.options[i];if(t.$div)return t.$div;if(e)return this._render("option",t)}return null}getAdjacent(t,e,i="option"){var n,r=this;if(!t)return null;n="item"==i?r.controlChildren():r.dropdown_content.querySelectorAll("[data-selectable]");for(let i=0;i<n.length;i++)if(n[i]==t)return e>0?n[i+1]:n[i-1];return null}getItem(t){if("object"==typeof t)return t;var e=Cd(t);return null!==e?this.control.querySelector(`[data-value="${Rd(e)}"]`):null}addItems(t,e){var i=this,n=Array.isArray(t)?t:[t];for(let t=0,r=(n=n.filter(t=>-1===i.items.indexOf(t))).length;t<r;t++)i.isPending=t<r-1,i.addItem(n[t],e)}addItem(t,e){Td(this,e?[]:["change","dropdown_close"],()=>{var i,n;const r=this,o=r.settings.mode,s=Cd(t);if((!s||-1===r.items.indexOf(s)||("single"===o&&r.close(),"single"!==o&&r.settings.duplicates))&&null!==s&&r.options.hasOwnProperty(s)&&("single"===o&&r.clear(e),"multi"!==o||!r.isFull())){if(i=r._render("item",r.options[s]),r.control.contains(i)&&(i=i.cloneNode(!0)),n=r.isFull(),r.items.splice(r.caretPos,0,s),r.insertAtCaret(i),r.isSetup){if(!r.isPending&&r.settings.hideSelected){let t=r.getOption(s),e=r.getAdjacent(t,1);e&&r.setActiveOption(e)}r.isPending||r.settings.closeAfterSelect||r.refreshOptions(r.isFocused&&"single"!==o),0!=r.settings.closeAfterSelect&&r.isFull()?r.close():r.isPending||r.positionDropdown(),r.trigger("item_add",s,i),r.isPending||r.updateOriginalInput({silent:e})}(!r.isPending||!n&&r.isFull())&&(r.inputState(),r.refreshState())}})}removeItem(t=null,e){const i=this;if(!(t=i.getItem(t)))return;var n,r;const o=t.dataset.value;n=hd(t),t.remove(),t.classList.contains("active")&&(r=i.activeItems.indexOf(t),i.activeItems.splice(r,1),rd(t,"active")),i.items.splice(n,1),i.lastQuery=null,!i.settings.persist&&i.userOptions.hasOwnProperty(o)&&i.removeOption(o,e),n<i.caretPos&&i.setCaret(i.caretPos-1),i.updateOriginalInput({silent:e}),i.refreshState(),i.positionDropdown(),i.trigger("item_remove",o,t)}createItem(t=null,e=!0,i=(()=>{})){var n,r=this,o=r.caretPos;if(t=t||r.inputValue(),!r.canCreate(t))return i(),!1;r.lock();var s=!1,a=t=>{if(r.unlock(),!t||"object"!=typeof t)return i();var e=Cd(t[r.settings.valueField]);if("string"!=typeof e)return i();r.setTextboxValue(),r.addOption(t,!0),r.setCaret(o),r.addItem(e),i(t),s=!0};return n="function"==typeof r.settings.create?r.settings.create.call(this,t,a):{[r.settings.labelField]:t,[r.settings.valueField]:t},s||a(n),!0}refreshItems(){var t=this;t.lastQuery=null,t.isSetup&&t.addItems(t.items),t.updateOriginalInput(),t.refreshState()}refreshState(){const t=this;t.refreshValidityState();const e=t.isFull(),i=t.isLocked;t.wrapper.classList.toggle("rtl",t.rtl);const n=t.wrapper.classList;n.toggle("focus",t.isFocused),n.toggle("disabled",t.isDisabled),n.toggle("required",t.isRequired),n.toggle("invalid",!t.isValid),n.toggle("locked",i),n.toggle("full",e),n.toggle("input-active",t.isFocused&&!t.isInputHidden),n.toggle("dropdown-active",t.isOpen),n.toggle("has-options",cd(t.options)),n.toggle("has-items",t.items.length>0)}refreshValidityState(){var t=this;t.input.checkValidity&&(t.isValid=t.input.checkValidity(),t.isInvalid=!t.isValid)}isFull(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems}updateOriginalInput(t={}){const e=this;var i,n;const r=e.input.querySelector('option[value=""]');if(e.is_select_tag){const t=[],s=e.input.querySelectorAll("option:checked").length;function o(i,n,o){return i||(i=Zh('<option value="'+Md(n)+'">'+Md(o)+"</option>")),i!=r&&e.input.append(i),t.push(i),(i!=r||s>0)&&(i.selected=!0),i}e.input.querySelectorAll("option:checked").forEach(t=>{t.selected=!1}),0==e.items.length&&"single"==e.settings.mode?o(r,"",""):e.items.forEach(r=>{if(i=e.options[r],n=i[e.settings.labelField]||"",t.includes(i.$option)){o(e.input.querySelector(`option[value="${Rd(r)}"]:not(:checked)`),r,n)}else i.$option=o(i.$option,r,n)})}else e.input.value=e.getValue();e.isSetup&&(t.silent||e.trigger("change",e.getValue()))}open(){var t=this;t.isLocked||t.isOpen||"multi"===t.settings.mode&&t.isFull()||(t.isOpen=!0,dd(t.focus_node,{"aria-expanded":"true"}),t.refreshState(),id(t.dropdown,{visibility:"hidden",display:"block"}),t.positionDropdown(),id(t.dropdown,{visibility:"visible",display:"block"}),t.focus(),t.trigger("dropdown_open",t.dropdown))}close(t=!0){var e=this,i=e.isOpen;t&&(e.setTextboxValue(),"single"===e.settings.mode&&e.items.length&&e.hideInput()),e.isOpen=!1,dd(e.focus_node,{"aria-expanded":"false"}),id(e.dropdown,{display:"none"}),e.settings.hideSelected&&e.clearActiveOption(),e.refreshState(),i&&e.trigger("dropdown_close",e.dropdown)}positionDropdown(){if("body"===this.settings.dropdownParent){var t=this.control,e=t.getBoundingClientRect(),i=t.offsetHeight+e.top+window.scrollY,n=e.left+window.scrollX;id(this.dropdown,{width:e.width+"px",top:i+"px",left:n+"px"})}}clear(t){var e=this;if(e.items.length){var i=e.controlChildren();Xh(i,t=>{e.removeItem(t,!0)}),e.showInput(),t||e.updateOriginalInput(),e.trigger("clear")}}insertAtCaret(t){const e=this,i=e.caretPos,n=e.control;n.insertBefore(t,n.children[i]),e.setCaret(i+1)}deleteSelection(t){var e,i,n,r,o=this;e=t&&t.keyCode===xd?-1:1,i=Hd(o.control_input);const s=[];if(o.activeItems.length)r=ld(o.activeItems,e),n=hd(r),e>0&&n++,Xh(o.activeItems,t=>s.push(t));else if((o.isFocused||"single"===o.settings.mode)&&o.items.length){const t=o.controlChildren();e<0&&0===i.start&&0===i.length?s.push(t[o.caretPos-1]):e>0&&i.start===o.inputValue().length&&s.push(t[o.caretPos])}const a=s.map(t=>t.dataset.value);if(!a.length||"function"==typeof o.settings.onDelete&&!1===o.settings.onDelete.call(o,a,t))return!1;for(Od(t,!0),void 0!==n&&o.setCaret(n);s.length;)o.removeItem(s.pop());return o.showInput(),o.positionDropdown(),o.refreshOptions(!1),!0}advanceSelection(t,e){var i,n,r=this;r.rtl&&(t*=-1),r.inputValue().length||(Vd(zd,e)||Vd("shiftKey",e)?(n=(i=r.getLastActive(t))?i.classList.contains("active")?r.getAdjacent(i,t,"item"):i:t>0?r.control_input.nextElementSibling:r.control_input.previousElementSibling)&&(n.classList.contains("active")&&r.removeActiveItem(i),r.setActiveItemClass(n)):r.moveCaret(t))}moveCaret(t){}getLastActive(t){let e=this.control.querySelector(".last-active");if(e)return e;var i=this.control.querySelectorAll(".active");return i?ld(i,t):void 0}setCaret(t){this.caretPos=this.items.length}controlChildren(){return Array.from(this.control.querySelectorAll("[data-ts-item]"))}lock(){this.isLocked=!0,this.refreshState()}unlock(){this.isLocked=!1,this.refreshState()}disable(){var t=this;t.input.disabled=!0,t.control_input.disabled=!0,t.focus_node.tabIndex=-1,t.isDisabled=!0,this.close(),t.lock()}enable(){var t=this;t.input.disabled=!1,t.control_input.disabled=!1,t.focus_node.tabIndex=t.tabIndex,t.isDisabled=!1,t.unlock()}destroy(){var t=this,e=t.revertSettings;t.trigger("destroy"),t.off(),t.wrapper.remove(),t.dropdown.remove(),t.input.innerHTML=e.innerHTML,t.input.tabIndex=e.tabIndex,rd(t.input,"tomselected","ts-hidden-accessible"),t._destroy(),delete t.input.tomselect}render(t,e){return"function"!=typeof this.settings.render[t]?null:this._render(t,e)}_render(t,e){var i,n,r="";const o=this;return"option"!==t&&"item"!=t||(r=Ed(e[o.settings.valueField])),null==(n=o.settings.render[t].call(this,e,Md))||(n=Zh(n),"option"===t||"option_create"===t?e[o.settings.disabledField]?dd(n,{"aria-disabled":"true"}):dd(n,{"data-selectable":""}):"optgroup"===t&&(i=e.group[o.settings.optgroupValueField],dd(n,{"data-group":i}),e.group[o.settings.disabledField]&&dd(n,{"data-disabled":""})),"option"!==t&&"item"!==t||(dd(n,{"data-value":r}),"item"===t?(nd(n,o.settings.itemClass),dd(n,{"data-ts-item":""})):(nd(n,o.settings.optionClass),dd(n,{role:"option",id:e.$id}),o.options[r].$div=n))),n}clearCache(){Xh(this.options,(t,e)=>{t.$div&&(t.$div.remove(),delete t.$div)})}uncacheValue(t){const e=this.getOption(t);e&&e.remove()}canCreate(t){return this.settings.create&&t.length>0&&this.settings.createFilter.call(this,t)}hook(t,e,i){var n=this,r=n[e];n[e]=function(){var e,o;return"after"===t&&(e=r.apply(n,arguments)),o=i.apply(n,arguments),"instead"===t?o:("before"===t&&(e=r.apply(n,arguments)),e)}}}function Bd(){$d(this.input,"change",()=>{this.sync()})}function jd(){var t=this,e=t.onOptionSelect;t.settings.hideSelected=!1;var i=function(t){setTimeout(()=>{var e=t.querySelector("input");t.classList.contains("selected")?e.checked=!0:e.checked=!1},1)};t.hook("after","setupTemplates",()=>{var e=t.settings.render.option;t.settings.render.option=(i,n)=>{var r=Zh(e.call(t,i,n)),o=document.createElement("input");o.addEventListener("click",(function(t){Od(t)})),o.type="checkbox";const s=Cd(i[t.settings.valueField]);return s&&t.items.indexOf(s)>-1&&(o.checked=!0),r.prepend(o),r}}),t.on("item_remove",e=>{var n=t.getOption(e);n&&(n.classList.remove("selected"),i(n))}),t.on("item_add",e=>{var n=t.getOption(e);n&&i(n)}),t.hook("instead","onOptionSelect",(n,r)=>{if(r.classList.contains("selected"))return r.classList.remove("selected"),t.removeItem(r.dataset.value),t.refreshOptions(),void Od(n,!0);e.call(t,n,r),i(r)})}function qd(t){const e=this,i=Object.assign({className:"clear-button",title:"Clear All",html:t=>`<div class="${t.className}" title="${t.title}">×</div>`},t);e.on("initialize",()=>{var t=Zh(i.html(i));t.addEventListener("click",t=>{e.isDisabled||(e.clear(),"single"===e.settings.mode&&e.settings.allowEmptyOption&&e.addItem(""),t.preventDefault(),t.stopPropagation())}),e.control.appendChild(t)})}function Ud(){var t=this;if(!$.fn.sortable)throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');if("multi"===t.settings.mode){var e=t.lock,i=t.unlock;t.hook("instead","lock",()=>{var i=$(t.control).data("sortable");return i&&i.disable(),e.call(t)}),t.hook("instead","unlock",()=>{var e=$(t.control).data("sortable");return e&&e.enable(),i.call(t)}),t.on("initialize",()=>{var e=$(t.control).sortable({items:"[data-value]",forcePlaceholderSize:!0,disabled:t.isLocked,start:(t,i)=>{i.placeholder.css("width",i.helper.css("width")),e.css({overflow:"visible"})},stop:()=>{e.css({overflow:"hidden"});var i=[];e.children("[data-value]").each((function(){this.dataset.value&&i.push(this.dataset.value)})),t.setValue(i)}})})}}function Wd(t){const e=this,i=Object.assign({title:"Untitled",headerClass:"dropdown-header",titleRowClass:"dropdown-header-title",labelClass:"dropdown-header-label",closeClass:"dropdown-header-close",html:t=>'<div class="'+t.headerClass+'"><div class="'+t.titleRowClass+'"><span class="'+t.labelClass+'">'+t.title+'</span><a class="'+t.closeClass+'">×</a></div></div>'},t);e.on("initialize",()=>{var t=Zh(i.html(i)),n=t.querySelector("."+i.closeClass);n&&n.addEventListener("click",t=>{Od(t,!0),e.close()}),e.dropdown.insertBefore(t,e.dropdown.firstChild)})}function Yd(){var t=this;t.hook("instead","setCaret",e=>{"single"!==t.settings.mode&&t.control.contains(t.control_input)?(e=Math.max(0,Math.min(t.items.length,e)))==t.caretPos||t.isPending||t.controlChildren().forEach((i,n)=>{n<e?t.control_input.insertAdjacentElement("beforebegin",i):t.control.appendChild(i)}):e=t.items.length,t.caretPos=e}),t.hook("instead","moveCaret",e=>{if(!t.isFocused)return;const i=t.getLastActive(e);if(i){const n=hd(i);t.setCaret(e>0?n+1:n),t.setActiveItem(),rd(i,"last-active")}else t.setCaret(t.caretPos+e)})}function Gd(){const t=this;t.settings.shouldOpen=!0,t.hook("before","setup",()=>{t.focus_node=t.control,nd(t.control_input,"dropdown-input");const e=Zh('<div class="dropdown-input-wrap">');e.append(t.control_input),t.dropdown.insertBefore(e,t.dropdown.firstChild);const i=Zh('<input class="items-placeholder" tabindex="-1" />');i.placeholder=t.settings.placeholder,t.control.append(i)}),t.on("initialize",()=>{t.control_input.addEventListener("keydown",e=>{switch(e.keyCode){case vd:return t.isOpen&&(Od(e,!0),t.close()),void t.clearActiveItems();case Ad:t.focus_node.tabIndex=-1}return t.onKeyDown.call(t,e)}),t.on("blur",()=>{t.focus_node.tabIndex=t.isDisabled?-1:t.tabIndex}),t.on("dropdown_open",()=>{t.control_input.focus()});const e=t.onBlur;t.hook("instead","onBlur",i=>{if(!i||i.relatedTarget!=t.control_input)return e.call(t)}),$d(t.control_input,"blur",()=>t.onBlur()),t.hook("before","close",()=>{t.isOpen&&t.focus_node.focus()})})}function Xd(){var t=this;t.on("initialize",()=>{var e=document.createElement("span"),i=t.control_input;e.style.cssText="position:absolute; top:-99999px; left:-99999px; width:auto; padding:0; white-space:pre; ",t.wrapper.appendChild(e);var n=["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"];for(const t of n)e.style[t]=i.style[t];var r=()=>{t.items.length>0?(e.textContent=i.value,i.style.width=e.clientWidth+"px"):i.style.width=""};r(),t.on("update item_add item_remove",r),$d(i,"input",r),$d(i,"keyup",r),$d(i,"blur",r),$d(i,"update",r)})}function Kd(){var t=this,e=t.deleteSelection;this.hook("instead","deleteSelection",i=>!!t.activeItems.length&&e.call(t,i))}function Qd(){this.hook("instead","setActiveItem",()=>{}),this.hook("instead","selectAll",()=>{})}function Zd(){var t=this,e=t.onKeyDown;t.hook("instead","onKeyDown",i=>{var n,r,o,s;if(!t.isOpen||i.keyCode!==bd&&i.keyCode!==_d)return e.call(t,i);s=ad(t.activeOption,"[data-group]"),n=hd(t.activeOption,"[data-selectable]"),s&&(s=i.keyCode===bd?s.previousSibling:s.nextSibling)&&(r=(o=s.querySelectorAll("[data-selectable]"))[Math.min(o.length-1,n)])&&t.setActiveOption(r)})}function Jd(t){const e=Object.assign({label:"×",title:"Remove",className:"remove",append:!0},t);var i=this;if(e.append){var n='<a href="javascript:void(0)" class="'+e.className+'" tabindex="-1" title="'+Md(e.title)+'">'+e.label+"</a>";i.hook("after","setupTemplates",()=>{var t=i.settings.render.item;i.settings.render.item=(e,r)=>{var o=Zh(t.call(i,e,r)),s=Zh(n);return o.appendChild(s),$d(s,"mousedown",t=>{Od(t,!0)}),$d(s,"click",t=>{if(Od(t,!0),!i.isLocked){var e=o.dataset.value;i.removeItem(e),i.refreshOptions(!1),i.inputState()}}),o}})}}function tp(t){const e=this,i=Object.assign({text:t=>t[e.settings.labelField]},t);e.on("item_remove",(function(t){if(e.isFocused&&""===e.control_input.value.trim()){var n=e.options[t];n&&e.setTextboxValue(i.text.call(e,n))}}))}function ep(){const t=this,e=t.canLoad,i=t.clearActiveOption,n=t.loadCallback;var r,o,s={},a=!1;if(t.settings.shouldLoadMore||(t.settings.shouldLoadMore=function(){if(r.clientHeight/(r.scrollHeight-r.scrollTop)>.9)return!0;if(t.activeOption){var e=t.selectable();if([...e].indexOf(t.activeOption)>=e.length-2)return!0}return!1}),!t.settings.firstUrl)throw"virtual_scroll plugin requires a firstUrl() method";function l(e){return!("number"==typeof t.settings.maxOptions&&r.children.length>=t.settings.maxOptions)&&!(!(e in s)||!s[e])}t.settings.sortField=[{field:"$order"},{field:"$score"}],t.setNextUrl=function(t,e){s[t]=e},t.getUrl=function(e){if(e in s){const t=s[e];return s[e]=!1,t}return s={},t.settings.firstUrl.call(t,e)},t.hook("instead","clearActiveOption",()=>{if(!a)return i.call(t)}),t.hook("instead","canLoad",i=>i in s?l(i):e.call(t,i)),t.hook("instead","loadCallback",(e,i)=>{a?o&&e.length>0&&(o.dataset.value=e[0][t.settings.valueField]):t.clearOptions(),n.call(t,e,i),a=!1}),t.hook("after","refreshOptions",()=>{const e=t.lastValue;var i;l(e)?(i=t.render("loading_more",{query:e}))&&(i.setAttribute("data-selectable",""),o=i):e in s&&!r.querySelector(".no-results")&&(i=t.render("no_more_results",{query:e})),i&&(nd(i,t.settings.optionClass),r.append(i))}),t.on("initialize",()=>{r=t.dropdown_content,t.settings.render=Object.assign({},{loading_more:function(){return'<div class="loading-more-results">Loading more results ... </div>'},no_more_results:function(){return'<div class="no-more-results">No more results</div>'}},t.settings.render),r.addEventListener("scroll",(function(){t.settings.shouldLoadMore.call(t)&&l(t.lastValue)&&(a||(a=!0,t.load.call(t,t.lastValue)))}))})}function ip(t){if(document.getElementById("__pb-multi-select-css"))return;const e=I("../css/tom-select"),i=document.createElement("link");i.id="__pb-multi-select-css",i.href=`${e}/tom-select.${t}.min.css`,i.rel="stylesheet",document.head.appendChild(i)}Fd.define("change_listener",Bd),Fd.define("checkbox_options",jd),Fd.define("clear_button",qd),Fd.define("drag_drop",Ud),Fd.define("dropdown_header",Wd),Fd.define("caret_position",Yd),Fd.define("dropdown_input",Gd),Fd.define("input_autogrow",Xd),Fd.define("no_backspace_delete",Kd),Fd.define("no_active_items",Qd),Fd.define("optgroup_columns",Zd),Fd.define("remove_button",Jd),Fd.define("restore_on_backspace",tp),Fd.define("virtual_scroll",ep);const np=t=>t?`<div>${t.text}</div>`:"";class rp extends(R(T)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{source:{type:String},closeAfterSelect:{type:Boolean,attribute:"close-after-select"},preload:{type:Boolean},onBlur:{type:String,attribute:"on-blur"},onChange:{type:String,attribute:"on-change"}})}set renderItem(t){this.renderFunction=t}constructor(){super(),this.theme="default",this.source=null,this.closeAfterSelect=!1,this.preload=!1,this.renderFunction=np,this.onBlur="pb-combo-box-blur",this.onChange="pb-combo-box-change"}connectedCallback(){super.connectedCallback()}firstUpdated(){ip(this.theme);let t=this.querySelector("select,input");t||(t=document.createElement("input"),this.appendChild(t)),t.autocomplete=!1,rp.waitOnce("pb-page-ready",()=>{const e={};if(this.source){const t=this.toAbsoluteURL(this.source);e.labelField="text",e.valueField="value",e.searchField=["text","value"],e.preload=this.preload,e.load=(e,i)=>{fetch(`${t}?query=${encodeURIComponent(e)}`,{method:"GET",mode:"cors",credentials:"same-origin"}).then(t=>t.json()).then(t=>{i(t)}).catch(()=>{i()})},e.render={option:this.renderFunction,item:this.renderFunction}}e.closeAfterSelect=this.closeAfterSelect,e.onBlur=()=>this.emitTo(this.onBlur),e.onChange=()=>this.emitTo(this.onChange),this._select=new Fd(t,e)})}createRenderRoot(){return this}}customElements.define("pb-combo-box",rp);
|
|
4544
4544
|
/**
|
|
4545
4545
|
@license
|
|
4546
4546
|
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
|
@@ -4993,7 +4993,7 @@ e({_template:n`
|
|
|
4993
4993
|
<div class="textarea-container fit">
|
|
4994
4994
|
<textarea id="textarea" name$="[[name]]" aria-label$="[[label]]" autocomplete$="[[autocomplete]]" autofocus$="[[autofocus]]" autocapitalize$="[[autocapitalize]]" inputmode$="[[inputmode]]" placeholder$="[[placeholder]]" readonly$="[[readonly]]" required$="[[required]]" disabled$="[[disabled]]" rows$="[[rows]]" minlength$="[[minlength]]" maxlength$="[[maxlength]]"></textarea>
|
|
4995
4995
|
</div>
|
|
4996
|
-
`,is:"iron-autogrow-textarea",behaviors:[
|
|
4996
|
+
`,is:"iron-autogrow-textarea",behaviors:[k,o],properties:{value:{observer:"_valueChanged",type:String,notify:!0},bindValue:{observer:"_bindValueChanged",type:String,notify:!0},rows:{type:Number,value:1,observer:"_updateCached"},maxRows:{type:Number,value:0,observer:"_updateCached"},autocomplete:{type:String,value:"off"},autofocus:{type:Boolean,value:!1},autocapitalize:{type:String,value:"none"},inputmode:{type:String},placeholder:{type:String},readonly:{type:String},required:{type:Boolean},minlength:{type:Number},maxlength:{type:Number},label:{type:String}},listeners:{input:"_onInput"},get textarea(){return this.$.textarea},get selectionStart(){return this.$.textarea.selectionStart},get selectionEnd(){return this.$.textarea.selectionEnd},set selectionStart(t){this.$.textarea.selectionStart=t},set selectionEnd(t){this.$.textarea.selectionEnd=t},attached:function(){navigator.userAgent.match(/iP(?:[oa]d|hone)/)&&!navigator.userAgent.match(/OS 1[3456789]/)&&(this.$.textarea.style.marginLeft="-3px")},validate:function(){var t=this.$.textarea.validity.valid;return t&&(this.required&&""===this.value?t=!1:this.hasValidator()&&(t=k.validate.call(this,this.value))),this.invalid=!t,this.fire("iron-input-validate"),t},_bindValueChanged:function(t){this.value=t},_valueChanged:function(t){var e=this.textarea;e&&(e.value!==t&&(e.value=t||0===t?t:""),this.bindValue=t,this.$.mirror.innerHTML=this._valueForMirror(),this.fire("bind-value-changed",{value:this.bindValue}))},_onInput:function(e){var i=t(e).path;this.value=i?i[0].value:e.target.value},_constrain:function(t){var e;for(t=t||[""],e=this.maxRows>0&&t.length>this.maxRows?t.slice(0,this.maxRows):t.slice(0);this.rows>0&&e.length<this.rows;)e.push("");return e.join("<br/>")+" "},_valueForMirror:function(){var t=this.textarea;if(t)return this.tokens=t&&t.value?t.value.replace(/&/gm,"&").replace(/"/gm,""").replace(/'/gm,"'").replace(/</gm,"<").replace(/>/gm,">").split("\n"):[""],this._constrain(this.tokens)},_updateCached:function(){this.$.mirror.innerHTML=this._constrain(this.tokens)}}),
|
|
4997
4997
|
/**
|
|
4998
4998
|
@license
|
|
4999
4999
|
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
@@ -5034,4 +5034,4 @@ e({_template:n`
|
|
|
5034
5034
|
</template>
|
|
5035
5035
|
|
|
5036
5036
|
</paper-input-container>
|
|
5037
|
-
`,is:"paper-textarea",behaviors:[
|
|
5037
|
+
`,is:"paper-textarea",behaviors:[A,z],properties:{_ariaLabelledBy:{observer:"_ariaLabelledByChanged",type:String},_ariaDescribedBy:{observer:"_ariaDescribedByChanged",type:String},value:{type:String},rows:{type:Number,value:1},maxRows:{type:Number,value:0}},get selectionStart(){return this.$.input.textarea.selectionStart},set selectionStart(t){this.$.input.textarea.selectionStart=t},get selectionEnd(){return this.$.input.textarea.selectionEnd},set selectionEnd(t){this.$.input.textarea.selectionEnd=t},_ariaLabelledByChanged:function(t){this._focusableElement.setAttribute("aria-labelledby",t)},_ariaDescribedByChanged:function(t){this._focusableElement.setAttribute("aria-describedby",t)},get _focusableElement(){return this.inputElement.textarea}});
|