@teipublisher/pb-components 1.38.6 → 1.39.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.
@@ -1,4 +1,4 @@
1
- import{t as e}from"./paper-checkbox-ea000977.js";import{p as t,L as p,h as o,c as a}from"./pb-mixin-ae9e2885.js";import"./iron-form-ee64c98d.js";class i extends(t(p)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{error:{type:String},url:{type:String},templates:{type:Array},odds:{type:Array}})}constructor(){super(),this.templates=[],this.odds=[]}connectedCallback(){super.connectedCallback()}firstUpdated(){const e=this.shadowRoot.getElementById("form"),t=this.shadowRoot.getElementById("defaultView"),p=this.shadowRoot.getElementById("index"),o=this.shadowRoot.getElementById("template");this.subscribeTo("pb-i18n-update",e=>{const t=this.shadowRoot.querySelector("#defaultView paper-listbox");let p=t.selected;t.selected=void 0,t.selected=p;const o=this.shadowRoot.querySelector("#index paper-listbox");p=o.selected,o.selected=void 0,o.selected=p},[]),i.waitOnce("pb-page-ready",e=>{let t;t=this.minApiVersion("1.0.0")?e.endpoint+"/api/templates":e.endpoint+"/modules/lib/components-list-templates.xql",fetch(t,{method:"GET",mode:"cors",credentials:"same-origin"}).then(e=>e.json()).then(e=>{this.templates=e}),t=this.minApiVersion("1.0.0")?e.endpoint+"/api/odd":e.endpoint+"/modules/lib/components-list-odds.xql",fetch(t,{method:"GET",mode:"cors",credentials:"same-origin"}).then(e=>e.json()).then(e=>{this.odds=e});const p=this.shadowRoot.querySelector("form");this.minApiVersion("1.0.0")?p.action=e.endpoint+"/api/apps/generate":p.action=e.endpoint+"/modules/components-generate.xql"}),e.addEventListener("iron-form-presubmit",(function(){const e=t.selectedItem.getAttribute("value");this.request.body["default-view"]=e,this.request.body.index=p.selectedItem.getAttribute("value"),this.request.body.template=o.selectedItem.getAttribute("value")})),e.addEventListener("iron-form-response",e=>{console.log(e),e.detail.completes.then(e=>{this.emitTo("pb-end-update");const t=e.parseResponse();if(console.log("<pb-edit-app> Received response: %o",t),t.target){const e=window.location.href.replace(/^(.*)\/tei-publisher\/.*/,"$1");this.url=e+"/"+this.shadowRoot.querySelector("paper-input[name=abbrev]").value,this.error=null}else this.error=t.description;this.shadowRoot.getElementById("dialog").open()})}),e.addEventListener("iron-form-error",e=>{this.emitTo("pb-end-update"),console.log("<pb-edit-app> Received response: %o",e.detail.request.response),this.error=e.detail.request.response.description,this.shadowRoot.getElementById("dialog").open()}),e.addEventListener("iron-form-invalid",()=>this.emitTo("pb-end-update"))}_doSubmit(){this.emitTo("pb-start-update");this.shadowRoot.getElementById("form").submit()}render(){return o`
1
+ import{t as e}from"./paper-checkbox-f6a70487.js";import{p as t,L as p,h as o,c as a}from"./pb-mixin-15ff531f.js";import"./iron-form-f540b15b.js";class i extends(t(p)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{error:{type:String},url:{type:String},templates:{type:Array},odds:{type:Array}})}constructor(){super(),this.templates=[],this.odds=[]}connectedCallback(){super.connectedCallback()}firstUpdated(){const e=this.shadowRoot.getElementById("form"),t=this.shadowRoot.getElementById("defaultView"),p=this.shadowRoot.getElementById("index"),o=this.shadowRoot.getElementById("template");this.subscribeTo("pb-i18n-update",e=>{const t=this.shadowRoot.querySelector("#defaultView paper-listbox");let p=t.selected;t.selected=void 0,t.selected=p;const o=this.shadowRoot.querySelector("#index paper-listbox");p=o.selected,o.selected=void 0,o.selected=p},[]),i.waitOnce("pb-page-ready",e=>{let t;t=this.minApiVersion("1.0.0")?e.endpoint+"/api/templates":e.endpoint+"/modules/lib/components-list-templates.xql",fetch(t,{method:"GET",mode:"cors",credentials:"same-origin"}).then(e=>e.json()).then(e=>{this.templates=e}),t=this.minApiVersion("1.0.0")?e.endpoint+"/api/odd":e.endpoint+"/modules/lib/components-list-odds.xql",fetch(t,{method:"GET",mode:"cors",credentials:"same-origin"}).then(e=>e.json()).then(e=>{this.odds=e});const p=this.shadowRoot.querySelector("form");this.minApiVersion("1.0.0")?p.action=e.endpoint+"/api/apps/generate":p.action=e.endpoint+"/modules/components-generate.xql"}),e.addEventListener("iron-form-presubmit",(function(){const e=t.selectedItem.getAttribute("value");this.request.body["default-view"]=e,this.request.body.index=p.selectedItem.getAttribute("value"),this.request.body.template=o.selectedItem.getAttribute("value")})),e.addEventListener("iron-form-response",e=>{console.log(e),e.detail.completes.then(e=>{this.emitTo("pb-end-update");const t=e.parseResponse();if(console.log("<pb-edit-app> Received response: %o",t),t.target){const e=window.location.href.replace(/^(.*)\/tei-publisher\/.*/,"$1");this.url=e+"/"+this.shadowRoot.querySelector("paper-input[name=abbrev]").value,this.error=null}else this.error=t.description;this.shadowRoot.getElementById("dialog").open()})}),e.addEventListener("iron-form-error",e=>{this.emitTo("pb-end-update"),console.log("<pb-edit-app> Received response: %o",e.detail.request.response),this.error=e.detail.request.response.description,this.shadowRoot.getElementById("dialog").open()}),e.addEventListener("iron-form-invalid",()=>this.emitTo("pb-end-update"))}_doSubmit(){this.emitTo("pb-start-update");this.shadowRoot.getElementById("form").submit()}render(){return o`
2
2
  <iron-form id="form">
3
3
  <form method="POST" accept="application/json" enctype="application/json">
4
4
  <fieldset>
@@ -2012,6 +2012,11 @@
2012
2012
  "name": "--pb-code-highlight-white-space",
2013
2013
  "description": "configures line wrapping",
2014
2014
  "default": "\"pre\""
2015
+ },
2016
+ {
2017
+ "name": "--pb-code-highlight-theme",
2018
+ "description": "configures the default theme to be used",
2019
+ "default": "\"default\""
2015
2020
  }
2016
2021
  ]
2017
2022
  },
@@ -1,4 +1,4 @@
1
- import{L as t,p as e,r as i,h as s,c as a}from"./pb-mixin-ae9e2885.js";import"./es-global-bridge-6abe3a88.js";const o=["type","url","label","base","show"];class r extends t{static get properties(){return{type:{type:String},url:{type:String},base:{type:Boolean},show:{type:Boolean},label:{type:String},attribution:{type:String},minZoom:{type:Number,attribute:"min-zoom"},maxZoom:{type:Number,attribute:"max-zoom"},zoomOffset:{type:Number,attribute:"zoom-offset"},opacity:{type:Number},tileSize:{type:Number},id:{type:String},accessToken:{type:String,attribute:"access-token"}}}constructor(){super(),this.type="tile",this.url=null}get options(){const t={};return Object.keys(r.properties).forEach(e=>{o.indexOf(e)<0&&this[e]&&(t[e]=this[e])}),console.log("<pb-leaflet-map-layer> Options: %o",t),t}async data(){return new Promise(t=>{fetch(this.url).then(t=>t.json()).then(e=>t(e))})}}function l(t,e){try{return t.split(/\s*,\s*/).map(t=>parseInt(t,10))}catch(e){return console.error("<pb-map-icon> Invalid size specified: "+t),null}}customElements.define("pb-map-layer",r);class n extends t{static get properties(){return{name:{type:String},iconUrl:{type:String,attribute:"icon-url"},iconSize:{type:Array,converter:l,attribute:"icon-size"},iconAnchor:{type:Array,converter:l,attribute:"icon-anchor"},shadowUrl:{type:String,attribute:"shadow-url"},shadowSize:{type:Array,converter:l,attribute:"shadow-size"},shadowAnchor:{type:Array,converter:l,attribute:"shadow-anchor"},popupAncor:{type:Array,converter:l,attribute:"popup-anchor"}}}constructor(){super(),this.name="default",this.type="image",this.iconUrl=null}get options(){const t={};return Object.keys(n.properties).forEach(e=>{this[e]&&(t[e]=this[e])}),console.log("<pb-map-icon> Options: %o",t),t}}customElements.define("pb-map-icon",n);class c extends(e(t)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{latitude:{type:Number},longitude:{type:Number},zoom:{type:Number},crs:{type:String},fitMarkers:{type:Boolean,attribute:"fit-markers"},cluster:{type:Boolean},disableClusteringAt:{type:Number,attribute:"disable-clustering-at"},noScroll:{type:Boolean,attribute:"no-scroll"},accessToken:{type:String,attribute:"access-token"},toggle:{type:Boolean},imagesPath:{type:String,attribute:"images-path"},cssPath:{type:String,attribute:"css-path"},_map:{type:Object}})}constructor(){super(),this.latitude=51.505,this.longitude=-.09,this.zoom=15,this.crs="EPSG3857",this.accessToken="",this.imagesPath="../images/leaflet/",this.cssPath="../css/leaflet",this.toggle=!1,this.noScroll=!1,this.disabled=!0,this.cluster=!1,this.fitMarkers=!1,this.disableClusteringAt=null,this._icons={}}connectedCallback(){super.connectedCallback(),this._layers=this.querySelectorAll("pb-map-layer"),this._markers=this.querySelectorAll("pb-map-icon"),this.subscribeTo("pb-update-map",t=>{this._markerLayer.clearLayers(),t.detail.forEach(t=>{const e=L.marker([t.latitude,t.longitude]);t.label&&e.bindTooltip(t.label),e.addEventListener("click",()=>{this.emitTo("pb-leaflet-marker-click",t)}),e.bindTooltip(t.label),this.setMarkerIcon(e),this._markerLayer.addLayer(e)}),this._fitBounds()}),this.subscribeTo("pb-update",t=>{this._markerLayer.clearLayers();t.detail.root.querySelectorAll("pb-geolocation").forEach(t=>{const e=L.latLng(t.latitude,t.longitude),i=L.marker(e).addTo(this._markerLayer);t.label&&i.bindTooltip(t.label),t.popup&&i.bindPopup(t.popup),i.addEventListener("click",()=>{this.emitTo("pb-leaflet-marker-click",t)}),this.setMarkerIcon(i)}),this._fitBounds()}),this.subscribeTo("pb-geolocation",t=>{if(t.detail.coordinates){if(this.latitude=t.detail.coordinates.latitude,this.longitude=t.detail.coordinates.longitude,this._hasMarker(this.latitude,this.longitude))console.log("<pb-leaflet-map> Marker already added to map");else{const e=L.marker([this.latitude,this.longitude]);e.addEventListener("click",()=>{this.emitTo("pb-leaflet-marker-click",t.detail.element)}),t.detail.label&&e.bindTooltip(t.detail.label),t.detail.popup&&e.bindPopup(t.detail.popup),this.setMarkerIcon(e),e.addTo(this._markerLayer),t.detail.fitBounds&&this._fitBounds(),console.log("<pb-leaflet-map> added marker")}this.toggle&&(this.disabled=!1);const e=t.detail.event;this._locationChanged(this.latitude,this.longitude,t.detail.zoom,e)}})}setMarkerIcon(t){this._icons&&this._icons.default&&t.setIcon(this._icons.default)}firstUpdated(){this.toggle||(this.disabled=!1),window.ESGlobalBridge.requestAvailability();const t=i("../lib/leaflet-src.js"),e=i("../lib/leaflet.markercluster-src.js");window.ESGlobalBridge.instance.load("leaflet",t).then(()=>window.ESGlobalBridge.instance.load("plugin",e)),window.addEventListener("es-bridge-plugin-loaded",this._initMap.bind(this),{once:!0})}render(){const t=i(this.cssPath);return s`
1
+ import{L as t,p as e,r as i,h as s,c as a}from"./pb-mixin-15ff531f.js";import"./es-global-bridge-6abe3a88.js";const o=["type","url","label","base","show"];class r extends t{static get properties(){return{type:{type:String},url:{type:String},base:{type:Boolean},show:{type:Boolean},label:{type:String},attribution:{type:String},minZoom:{type:Number,attribute:"min-zoom"},maxZoom:{type:Number,attribute:"max-zoom"},zoomOffset:{type:Number,attribute:"zoom-offset"},opacity:{type:Number},tileSize:{type:Number},id:{type:String},accessToken:{type:String,attribute:"access-token"}}}constructor(){super(),this.type="tile",this.url=null}get options(){const t={};return Object.keys(r.properties).forEach(e=>{o.indexOf(e)<0&&this[e]&&(t[e]=this[e])}),console.log("<pb-leaflet-map-layer> Options: %o",t),t}async data(){return new Promise(t=>{fetch(this.url).then(t=>t.json()).then(e=>t(e))})}}function l(t,e){try{return t.split(/\s*,\s*/).map(t=>parseInt(t,10))}catch(e){return console.error("<pb-map-icon> Invalid size specified: "+t),null}}customElements.define("pb-map-layer",r);class n extends t{static get properties(){return{name:{type:String},iconUrl:{type:String,attribute:"icon-url"},iconSize:{type:Array,converter:l,attribute:"icon-size"},iconAnchor:{type:Array,converter:l,attribute:"icon-anchor"},shadowUrl:{type:String,attribute:"shadow-url"},shadowSize:{type:Array,converter:l,attribute:"shadow-size"},shadowAnchor:{type:Array,converter:l,attribute:"shadow-anchor"},popupAncor:{type:Array,converter:l,attribute:"popup-anchor"}}}constructor(){super(),this.name="default",this.type="image",this.iconUrl=null}get options(){const t={};return Object.keys(n.properties).forEach(e=>{this[e]&&(t[e]=this[e])}),console.log("<pb-map-icon> Options: %o",t),t}}customElements.define("pb-map-icon",n);class c extends(e(t)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{latitude:{type:Number},longitude:{type:Number},zoom:{type:Number},crs:{type:String},fitMarkers:{type:Boolean,attribute:"fit-markers"},cluster:{type:Boolean},disableClusteringAt:{type:Number,attribute:"disable-clustering-at"},noScroll:{type:Boolean,attribute:"no-scroll"},accessToken:{type:String,attribute:"access-token"},toggle:{type:Boolean},imagesPath:{type:String,attribute:"images-path"},cssPath:{type:String,attribute:"css-path"},_map:{type:Object}})}constructor(){super(),this.latitude=51.505,this.longitude=-.09,this.zoom=15,this.crs="EPSG3857",this.accessToken="",this.imagesPath="../images/leaflet/",this.cssPath="../css/leaflet",this.toggle=!1,this.noScroll=!1,this.disabled=!0,this.cluster=!1,this.fitMarkers=!1,this.disableClusteringAt=null,this._icons={}}connectedCallback(){super.connectedCallback(),this._layers=this.querySelectorAll("pb-map-layer"),this._markers=this.querySelectorAll("pb-map-icon"),this.subscribeTo("pb-update-map",t=>{this._markerLayer.clearLayers(),t.detail.forEach(t=>{const e=L.marker([t.latitude,t.longitude]);t.label&&e.bindTooltip(t.label),e.addEventListener("click",()=>{this.emitTo("pb-leaflet-marker-click",t)}),e.bindTooltip(t.label),this.setMarkerIcon(e),this._markerLayer.addLayer(e)}),this._fitBounds()}),this.subscribeTo("pb-update",t=>{this._markerLayer.clearLayers();t.detail.root.querySelectorAll("pb-geolocation").forEach(t=>{const e=L.latLng(t.latitude,t.longitude),i=L.marker(e).addTo(this._markerLayer);t.label&&i.bindTooltip(t.label),t.popup&&i.bindPopup(t.popup),i.addEventListener("click",()=>{this.emitTo("pb-leaflet-marker-click",t)}),this.setMarkerIcon(i)}),this._fitBounds()}),this.subscribeTo("pb-geolocation",t=>{if(t.detail.coordinates){if(this.latitude=t.detail.coordinates.latitude,this.longitude=t.detail.coordinates.longitude,this._hasMarker(this.latitude,this.longitude))console.log("<pb-leaflet-map> Marker already added to map");else{const e=L.marker([this.latitude,this.longitude]);e.addEventListener("click",()=>{this.emitTo("pb-leaflet-marker-click",t.detail.element)}),t.detail.label&&e.bindTooltip(t.detail.label),t.detail.popup&&e.bindPopup(t.detail.popup),this.setMarkerIcon(e),e.addTo(this._markerLayer),t.detail.fitBounds&&this._fitBounds(),console.log("<pb-leaflet-map> added marker")}this.toggle&&(this.disabled=!1);const e=t.detail.event;this._locationChanged(this.latitude,this.longitude,t.detail.zoom,e)}})}setMarkerIcon(t){this._icons&&this._icons.default&&t.setIcon(this._icons.default)}firstUpdated(){this.toggle||(this.disabled=!1),window.ESGlobalBridge.requestAvailability();const t=i("../lib/leaflet-src.js"),e=i("../lib/leaflet.markercluster-src.js");window.ESGlobalBridge.instance.load("leaflet",t).then(()=>window.ESGlobalBridge.instance.load("plugin",e)),window.addEventListener("es-bridge-plugin-loaded",this._initMap.bind(this),{once:!0})}render(){const t=i(this.cssPath);return s`
2
2
  <link rel="Stylesheet" href="${t}/leaflet.css">
3
3
  <link rel="Stylesheet" href="${t}/MarkerCluster.Default.css">
4
4
  <div id="map" style="height: 100%; width: 100%"></div>
@@ -1,4 +1,4 @@
1
- import{P as e,h as t,x as i,f as n,B as r,d as o,b as l,I as s,T as a,y as c,z as h,A as d,D as u,C as p,n as m,g,t as f}from"./paper-checkbox-ea000977.js";import{d as v,N as y,i as b,p as x,L as w,h as z,c as C,a as k,r as M}from"./pb-mixin-ae9e2885.js";
1
+ import{P as e,h as t,x as i,f as n,B as r,d as o,b as l,I as s,T as a,y as c,z as h,A as d,D as u,C as p,n as m,g,t as f}from"./paper-checkbox-f6a70487.js";import{d as v,N as y,i as b,p as x,L as w,h as z,c as C,a as k,r as M}from"./pb-mixin-15ff531f.js";
2
2
  /**
3
3
  @license
4
4
  Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
@@ -11,7 +11,7 @@
11
11
  * subject to an additional IP rights grant found at
12
12
  * http://polymer.github.io/PATENTS.txt
13
13
  */
14
- const e="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,t=(e,t,s=null,i=null)=>{for(;t!==s;){const s=t.nextSibling;e.insertBefore(t,i),t=s}},s=(e,t,s=null)=>{for(;t!==s;){const s=t.nextSibling;e.removeChild(t),t=s}},i=`{{lit-${String(Math.random()).slice(2)}}}`,n=`\x3c!--${i}--\x3e`,r=new RegExp(`${i}|${n}`),o="$lit$";class a{constructor(e,t){this.parts=[],this.element=t;const s=[],n=[],a=document.createTreeWalker(t.content,133,null,!1);let h=0,u=-1,p=0;const{strings:m,values:{length:f}}=e;for(;p<f;){const e=a.nextNode();if(null!==e){if(u++,1===e.nodeType){if(e.hasAttributes()){const t=e.attributes,{length:s}=t;let i=0;for(let e=0;e<s;e++)l(t[e].name,o)&&i++;for(;i-- >0;){const t=m[p],s=d.exec(t)[2],i=s.toLowerCase()+o,n=e.getAttribute(i);e.removeAttribute(i);const a=n.split(r);this.parts.push({type:"attribute",index:u,name:s,strings:a}),p+=a.length-1}}"TEMPLATE"===e.tagName&&(n.push(e),a.currentNode=e.content)}else if(3===e.nodeType){const t=e.data;if(t.indexOf(i)>=0){const i=e.parentNode,n=t.split(r),a=n.length-1;for(let t=0;t<a;t++){let s,r=n[t];if(""===r)s=c();else{const e=d.exec(r);null!==e&&l(e[2],o)&&(r=r.slice(0,e.index)+e[1]+e[2].slice(0,-o.length)+e[3]),s=document.createTextNode(r)}i.insertBefore(s,e),this.parts.push({type:"node",index:++u})}""===n[a]?(i.insertBefore(c(),e),s.push(e)):e.data=n[a],p+=a}}else if(8===e.nodeType)if(e.data===i){const t=e.parentNode;null!==e.previousSibling&&u!==h||(u++,t.insertBefore(c(),e)),h=u,this.parts.push({type:"node",index:u}),null===e.nextSibling?e.data="":(s.push(e),u--),p++}else{let t=-1;for(;-1!==(t=e.data.indexOf(i,t+1));)this.parts.push({type:"node",index:-1}),p++}}else a.currentNode=n.pop()}for(const e of s)e.parentNode.removeChild(e)}}const l=(e,t)=>{const s=e.length-t.length;return s>=0&&e.slice(s)===t},h=e=>-1!==e.index,c=()=>document.createComment(""),d=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/,u=133;function p(e,t){const{element:{content:s},parts:i}=e,n=document.createTreeWalker(s,u,null,!1);let r=f(i),o=i[r],a=-1,l=0;const h=[];let c=null;for(;n.nextNode();){a++;const e=n.currentNode;for(e.previousSibling===c&&(c=null),t.has(e)&&(h.push(e),null===c&&(c=e)),null!==c&&l++;void 0!==o&&o.index===a;)o.index=null!==c?-1:o.index-l,r=f(i,r),o=i[r]}h.forEach(e=>e.parentNode.removeChild(e))}const m=e=>{let t=11===e.nodeType?0:1;const s=document.createTreeWalker(e,u,null,!1);for(;s.nextNode();)t++;return t},f=(e,t=-1)=>{for(let s=t+1;s<e.length;s++){const t=e[s];if(h(t))return s}return-1};function _(e,t,s=null){const{element:{content:i},parts:n}=e;if(null==s)return void i.appendChild(t);const r=document.createTreeWalker(i,u,null,!1);let o=f(n),a=0,l=-1;for(;r.nextNode();){l++;for(r.currentNode===s&&(a=m(t),s.parentNode.insertBefore(t,s));-1!==o&&n[o].index===l;){if(a>0){for(;-1!==o;)n[o].index+=a,o=f(n,o);return}o=f(n,o)}}}
14
+ const e="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,t=(e,t,s=null,i=null)=>{for(;t!==s;){const s=t.nextSibling;e.insertBefore(t,i),t=s}},s=(e,t,s=null)=>{for(;t!==s;){const s=t.nextSibling;e.removeChild(t),t=s}},i=`{{lit-${String(Math.random()).slice(2)}}}`,r=`\x3c!--${i}--\x3e`,n=new RegExp(`${i}|${r}`),o="$lit$";class a{constructor(e,t){this.parts=[],this.element=t;const s=[],r=[],a=document.createTreeWalker(t.content,133,null,!1);let h=0,u=-1,p=0;const{strings:m,values:{length:f}}=e;for(;p<f;){const e=a.nextNode();if(null!==e){if(u++,1===e.nodeType){if(e.hasAttributes()){const t=e.attributes,{length:s}=t;let i=0;for(let e=0;e<s;e++)l(t[e].name,o)&&i++;for(;i-- >0;){const t=m[p],s=d.exec(t)[2],i=s.toLowerCase()+o,r=e.getAttribute(i);e.removeAttribute(i);const a=r.split(n);this.parts.push({type:"attribute",index:u,name:s,strings:a}),p+=a.length-1}}"TEMPLATE"===e.tagName&&(r.push(e),a.currentNode=e.content)}else if(3===e.nodeType){const t=e.data;if(t.indexOf(i)>=0){const i=e.parentNode,r=t.split(n),a=r.length-1;for(let t=0;t<a;t++){let s,n=r[t];if(""===n)s=c();else{const e=d.exec(n);null!==e&&l(e[2],o)&&(n=n.slice(0,e.index)+e[1]+e[2].slice(0,-o.length)+e[3]),s=document.createTextNode(n)}i.insertBefore(s,e),this.parts.push({type:"node",index:++u})}""===r[a]?(i.insertBefore(c(),e),s.push(e)):e.data=r[a],p+=a}}else if(8===e.nodeType)if(e.data===i){const t=e.parentNode;null!==e.previousSibling&&u!==h||(u++,t.insertBefore(c(),e)),h=u,this.parts.push({type:"node",index:u}),null===e.nextSibling?e.data="":(s.push(e),u--),p++}else{let t=-1;for(;-1!==(t=e.data.indexOf(i,t+1));)this.parts.push({type:"node",index:-1}),p++}}else a.currentNode=r.pop()}for(const e of s)e.parentNode.removeChild(e)}}const l=(e,t)=>{const s=e.length-t.length;return s>=0&&e.slice(s)===t},h=e=>-1!==e.index,c=()=>document.createComment(""),d=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/,u=133;function p(e,t){const{element:{content:s},parts:i}=e,r=document.createTreeWalker(s,u,null,!1);let n=f(i),o=i[n],a=-1,l=0;const h=[];let c=null;for(;r.nextNode();){a++;const e=r.currentNode;for(e.previousSibling===c&&(c=null),t.has(e)&&(h.push(e),null===c&&(c=e)),null!==c&&l++;void 0!==o&&o.index===a;)o.index=null!==c?-1:o.index-l,n=f(i,n),o=i[n]}h.forEach(e=>e.parentNode.removeChild(e))}const m=e=>{let t=11===e.nodeType?0:1;const s=document.createTreeWalker(e,u,null,!1);for(;s.nextNode();)t++;return t},f=(e,t=-1)=>{for(let s=t+1;s<e.length;s++){const t=e[s];if(h(t))return s}return-1};function _(e,t,s=null){const{element:{content:i},parts:r}=e;if(null==s)return void i.appendChild(t);const n=document.createTreeWalker(i,u,null,!1);let o=f(r),a=0,l=-1;for(;n.nextNode();){l++;for(n.currentNode===s&&(a=m(t),s.parentNode.insertBefore(t,s));-1!==o&&r[o].index===l;){if(a>0){for(;-1!==o;)r[o].index+=a,o=f(r,o);return}o=f(r,o)}}}
15
15
  /**
16
16
  * @license
17
17
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -38,7 +38,7 @@ const e="undefined"!=typeof window&&null!=window.customElements&&void 0!==window
38
38
  * subject to an additional IP rights grant found at
39
39
  * http://polymer.github.io/PATENTS.txt
40
40
  */
41
- class v{constructor(e,t,s){this.__parts=[],this.template=e,this.processor=t,this.options=s}update(e){let t=0;for(const s of this.__parts)void 0!==s&&s.setValue(e[t]),t++;for(const e of this.__parts)void 0!==e&&e.commit()}_clone(){const t=e?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),s=[],i=this.template.parts,n=document.createTreeWalker(t,133,null,!1);let r,o=0,a=0,l=n.nextNode();for(;o<i.length;)if(r=i[o],h(r)){for(;a<r.index;)a++,"TEMPLATE"===l.nodeName&&(s.push(l),n.currentNode=l.content),null===(l=n.nextNode())&&(n.currentNode=s.pop(),l=n.nextNode());if("node"===r.type){const e=this.processor.handleTextExpression(this.options);e.insertAfterNode(l.previousSibling),this.__parts.push(e)}else this.__parts.push(...this.processor.handleAttributeExpressions(l,r.name,r.strings,this.options));o++}else this.__parts.push(void 0),o++;return e&&(document.adoptNode(t),customElements.upgrade(t)),t}}
41
+ class v{constructor(e,t,s){this.__parts=[],this.template=e,this.processor=t,this.options=s}update(e){let t=0;for(const s of this.__parts)void 0!==s&&s.setValue(e[t]),t++;for(const e of this.__parts)void 0!==e&&e.commit()}_clone(){const t=e?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),s=[],i=this.template.parts,r=document.createTreeWalker(t,133,null,!1);let n,o=0,a=0,l=r.nextNode();for(;o<i.length;)if(n=i[o],h(n)){for(;a<n.index;)a++,"TEMPLATE"===l.nodeName&&(s.push(l),r.currentNode=l.content),null===(l=r.nextNode())&&(r.currentNode=s.pop(),l=r.nextNode());if("node"===n.type){const e=this.processor.handleTextExpression(this.options);e.insertAfterNode(l.previousSibling),this.__parts.push(e)}else this.__parts.push(...this.processor.handleAttributeExpressions(l,n.name,n.strings,this.options));o++}else this.__parts.push(void 0),o++;return e&&(document.adoptNode(t),customElements.upgrade(t)),t}}
42
42
  /**
43
43
  * @license
44
44
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -51,7 +51,7 @@ class v{constructor(e,t,s){this.__parts=[],this.template=e,this.processor=t,this
51
51
  * Code distributed by Google as part of the polymer project is also
52
52
  * subject to an additional IP rights grant found at
53
53
  * http://polymer.github.io/PATENTS.txt
54
- */const P=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:e=>e}),C=` ${i} `;class x{constructor(e,t,s,i){this.strings=e,this.values=t,this.type=s,this.processor=i}getHTML(){const e=this.strings.length-1;let t="",s=!1;for(let r=0;r<e;r++){const e=this.strings[r],a=e.lastIndexOf("\x3c!--");s=(a>-1||s)&&-1===e.indexOf("--\x3e",a+1);const l=d.exec(e);t+=null===l?e+(s?C:n):e.substr(0,l.index)+l[1]+l[2]+o+l[3]+i}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");let t=this.getHTML();return void 0!==P&&(t=P.createHTML(t)),e.innerHTML=t,e}}
54
+ */const P=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:e=>e}),C=` ${i} `;class x{constructor(e,t,s,i){this.strings=e,this.values=t,this.type=s,this.processor=i}getHTML(){const e=this.strings.length-1;let t="",s=!1;for(let n=0;n<e;n++){const e=this.strings[n],a=e.lastIndexOf("\x3c!--");s=(a>-1||s)&&-1===e.indexOf("--\x3e",a+1);const l=d.exec(e);t+=null===l?e+(s?C:r):e.substr(0,l.index)+l[1]+l[2]+o+l[3]+i}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");let t=this.getHTML();return void 0!==P&&(t=P.createHTML(t)),e.innerHTML=t,e}}
55
55
  /**
56
56
  * @license
57
57
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -64,7 +64,7 @@ class v{constructor(e,t,s){this.__parts=[],this.template=e,this.processor=t,this
64
64
  * Code distributed by Google as part of the polymer project is also
65
65
  * subject to an additional IP rights grant found at
66
66
  * http://polymer.github.io/PATENTS.txt
67
- */const T=e=>null===e||!("object"==typeof e||"function"==typeof e),E=e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]);class N{constructor(e,t,s){this.dirty=!0,this.element=e,this.name=t,this.strings=s,this.parts=[];for(let e=0;e<s.length-1;e++)this.parts[e]=this._createPart()}_createPart(){return new A(this)}_getValue(){const e=this.strings,t=e.length-1,s=this.parts;if(1===t&&""===e[0]&&""===e[1]){const e=s[0].value;if("symbol"==typeof e)return String(e);if("string"==typeof e||!E(e))return e}let i="";for(let n=0;n<t;n++){i+=e[n];const t=s[n];if(void 0!==t){const e=t.value;if(T(e)||!E(e))i+="string"==typeof e?e:String(e);else for(const t of e)i+="string"==typeof t?t:String(t)}}return i+=e[t],i}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class A{constructor(e){this.value=void 0,this.committer=e}setValue(e){e===S||T(e)&&e===this.value||(this.value=e,b(e)||(this.committer.dirty=!0))}commit(){for(;b(this.value);){const e=this.value;this.value=S,e(this)}this.value!==S&&this.committer.commit()}}class V{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(c()),this.endNode=e.appendChild(c())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=c()),e.__insert(this.endNode=c())}insertAfterPart(e){e.__insert(this.startNode=c()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(null===this.startNode.parentNode)return;for(;b(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=S,e(this)}const e=this.__pendingValue;e!==S&&(T(e)?e!==this.value&&this.__commitText(e):e instanceof x?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):E(e)?this.__commitIterable(e):e===w?(this.value=w,this.clear()):this.__commitText(e))}__insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}__commitNode(e){this.value!==e&&(this.clear(),this.__insert(e),this.value=e)}__commitText(e){const t=this.startNode.nextSibling,s="string"==typeof(e=null==e?"":e)?e:String(e);t===this.endNode.previousSibling&&3===t.nodeType?t.data=s:this.__commitNode(document.createTextNode(s)),this.value=e}__commitTemplateResult(e){const t=this.options.templateFactory(e);if(this.value instanceof v&&this.value.template===t)this.value.update(e.values);else{const s=new v(t,e.processor,this.options),i=s._clone();s.update(e.values),this.__commitNode(i),this.value=s}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());const t=this.value;let s,i=0;for(const n of e)s=t[i],void 0===s&&(s=new V(this.options),t.push(s),0===i?s.appendIntoPart(this):s.insertAfterPart(t[i-1])),s.setValue(n),s.commit(),i++;i<t.length&&(t.length=i,this.clear(s&&s.endNode))}clear(e=this.startNode){s(this.startNode.parentNode,e.nextSibling,this.endNode)}}class U{constructor(e,t,s){if(this.value=void 0,this.__pendingValue=void 0,2!==s.length||""!==s[0]||""!==s[1])throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=t,this.strings=s}setValue(e){this.__pendingValue=e}commit(){for(;b(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=S,e(this)}if(this.__pendingValue===S)return;const e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=S}}class O extends N{constructor(e,t,s){super(e,t,s),this.single=2===s.length&&""===s[0]&&""===s[1]}_createPart(){return new R(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class R extends A{}let k=!1;(()=>{try{const e={get capture(){return k=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}})();class M{constructor(e,t,s){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=s,this.__boundHandleEvent=e=>this.handleEvent(e)}setValue(e){this.__pendingValue=e}commit(){for(;b(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=S,e(this)}if(this.__pendingValue===S)return;const e=this.__pendingValue,t=this.value,s=null==e||null!=t&&(e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive),i=null!=e&&(null==t||s);s&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),i&&(this.__options=L(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=S}handleEvent(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const L=e=>e&&(k?{capture:e.capture,passive:e.passive,once:e.once}:e.capture)
67
+ */const T=e=>null===e||!("object"==typeof e||"function"==typeof e),E=e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]);class N{constructor(e,t,s){this.dirty=!0,this.element=e,this.name=t,this.strings=s,this.parts=[];for(let e=0;e<s.length-1;e++)this.parts[e]=this._createPart()}_createPart(){return new A(this)}_getValue(){const e=this.strings,t=e.length-1,s=this.parts;if(1===t&&""===e[0]&&""===e[1]){const e=s[0].value;if("symbol"==typeof e)return String(e);if("string"==typeof e||!E(e))return e}let i="";for(let r=0;r<t;r++){i+=e[r];const t=s[r];if(void 0!==t){const e=t.value;if(T(e)||!E(e))i+="string"==typeof e?e:String(e);else for(const t of e)i+="string"==typeof t?t:String(t)}}return i+=e[t],i}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class A{constructor(e){this.value=void 0,this.committer=e}setValue(e){e===S||T(e)&&e===this.value||(this.value=e,b(e)||(this.committer.dirty=!0))}commit(){for(;b(this.value);){const e=this.value;this.value=S,e(this)}this.value!==S&&this.committer.commit()}}class V{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(c()),this.endNode=e.appendChild(c())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=c()),e.__insert(this.endNode=c())}insertAfterPart(e){e.__insert(this.startNode=c()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(null===this.startNode.parentNode)return;for(;b(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=S,e(this)}const e=this.__pendingValue;e!==S&&(T(e)?e!==this.value&&this.__commitText(e):e instanceof x?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):E(e)?this.__commitIterable(e):e===w?(this.value=w,this.clear()):this.__commitText(e))}__insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}__commitNode(e){this.value!==e&&(this.clear(),this.__insert(e),this.value=e)}__commitText(e){const t=this.startNode.nextSibling,s="string"==typeof(e=null==e?"":e)?e:String(e);t===this.endNode.previousSibling&&3===t.nodeType?t.data=s:this.__commitNode(document.createTextNode(s)),this.value=e}__commitTemplateResult(e){const t=this.options.templateFactory(e);if(this.value instanceof v&&this.value.template===t)this.value.update(e.values);else{const s=new v(t,e.processor,this.options),i=s._clone();s.update(e.values),this.__commitNode(i),this.value=s}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());const t=this.value;let s,i=0;for(const r of e)s=t[i],void 0===s&&(s=new V(this.options),t.push(s),0===i?s.appendIntoPart(this):s.insertAfterPart(t[i-1])),s.setValue(r),s.commit(),i++;i<t.length&&(t.length=i,this.clear(s&&s.endNode))}clear(e=this.startNode){s(this.startNode.parentNode,e.nextSibling,this.endNode)}}class U{constructor(e,t,s){if(this.value=void 0,this.__pendingValue=void 0,2!==s.length||""!==s[0]||""!==s[1])throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=t,this.strings=s}setValue(e){this.__pendingValue=e}commit(){for(;b(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=S,e(this)}if(this.__pendingValue===S)return;const e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=S}}class O extends N{constructor(e,t,s){super(e,t,s),this.single=2===s.length&&""===s[0]&&""===s[1]}_createPart(){return new R(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class R extends A{}let k=!1;(()=>{try{const e={get capture(){return k=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}})();class M{constructor(e,t,s){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=s,this.__boundHandleEvent=e=>this.handleEvent(e)}setValue(e){this.__pendingValue=e}commit(){for(;b(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=S,e(this)}if(this.__pendingValue===S)return;const e=this.__pendingValue,t=this.value,s=null==e||null!=t&&(e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive),i=null!=e&&(null==t||s);s&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),i&&(this.__options=L(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=S}handleEvent(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const L=e=>e&&(k?{capture:e.capture,passive:e.passive,once:e.once}:e.capture)
68
68
  /**
69
69
  * @license
70
70
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -77,7 +77,7 @@ class v{constructor(e,t,s){this.__parts=[],this.template=e,this.processor=t,this
77
77
  * Code distributed by Google as part of the polymer project is also
78
78
  * subject to an additional IP rights grant found at
79
79
  * http://polymer.github.io/PATENTS.txt
80
- */;function j(e){let t=q.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},q.set(e.type,t));let s=t.stringsArray.get(e.strings);if(void 0!==s)return s;const n=e.strings.join(i);return s=t.keyString.get(n),void 0===s&&(s=new a(e,e.getTemplateElement()),t.keyString.set(n,s)),t.stringsArray.set(e.strings,s),s}const q=new Map,I=new WeakMap,F=(e,t,i)=>{let n=I.get(t);void 0===n&&(s(t,t.firstChild),I.set(t,n=new V(Object.assign({templateFactory:j},i))),n.appendInto(t)),n.setValue(e),n.commit()};
80
+ */;function j(e){let t=q.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},q.set(e.type,t));let s=t.stringsArray.get(e.strings);if(void 0!==s)return s;const r=e.strings.join(i);return s=t.keyString.get(r),void 0===s&&(s=new a(e,e.getTemplateElement()),t.keyString.set(r,s)),t.stringsArray.set(e.strings,s),s}const q=new Map,I=new WeakMap,F=(e,t,i)=>{let r=I.get(t);void 0===r&&(s(t,t.firstChild),I.set(t,r=new V(Object.assign({templateFactory:j},i))),r.appendInto(t)),r.setValue(e),r.commit()};
81
81
  /**
82
82
  * @license
83
83
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -104,7 +104,7 @@ class v{constructor(e,t,s){this.__parts=[],this.template=e,this.processor=t,this
104
104
  * subject to an additional IP rights grant found at
105
105
  * http://polymer.github.io/PATENTS.txt
106
106
  */
107
- class B{handleAttributeExpressions(e,t,s,i){const n=t[0];if("."===n){return new O(e,t.slice(1),s).parts}if("@"===n)return[new M(e,t.slice(1),i.eventContext)];if("?"===n)return[new U(e,t.slice(1),s)];return new N(e,t,s).parts}handleTextExpression(e){return new V(e)}}const H=new B;
107
+ class B{handleAttributeExpressions(e,t,s,i){const r=t[0];if("."===r){return new O(e,t.slice(1),s).parts}if("@"===r)return[new M(e,t.slice(1),i.eventContext)];if("?"===r)return[new U(e,t.slice(1),s)];return new N(e,t,s).parts}handleTextExpression(e){return new V(e)}}const H=new B;
108
108
  /**
109
109
  * @license
110
110
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -130,7 +130,7 @@ class B{handleAttributeExpressions(e,t,s,i){const n=t[0];if("."===n){return new
130
130
  * Code distributed by Google as part of the polymer project is also
131
131
  * subject to an additional IP rights grant found at
132
132
  * http://polymer.github.io/PATENTS.txt
133
- */,z=(e,t)=>`${e}--${t}`;let W=!0;void 0===window.ShadyCSS?W=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),W=!1);const D=e=>t=>{const s=z(t.type,e);let n=q.get(s);void 0===n&&(n={stringsArray:new WeakMap,keyString:new Map},q.set(s,n));let r=n.stringsArray.get(t.strings);if(void 0!==r)return r;const o=t.strings.join(i);if(r=n.keyString.get(o),void 0===r){const s=t.getTemplateElement();W&&window.ShadyCSS.prepareTemplateDom(s,e),r=new a(t,s),n.keyString.set(o,r)}return n.stringsArray.set(t.strings,r),r},J=["html","svg"],Z=e=>{J.forEach(t=>{const s=q.get(z(t,e));void 0!==s&&s.keyString.forEach(e=>{const{element:{content:t}}=e,s=new Set;Array.from(t.querySelectorAll("style")).forEach(e=>{s.add(e)}),p(e,s)})})},G=new Set,K=(e,t,s)=>{G.add(e);const i=s?s.element:document.createElement("template"),n=t.querySelectorAll("style"),{length:r}=n;if(0===r)return void window.ShadyCSS.prepareTemplateStyles(i,e);const o=document.createElement("style");for(let e=0;e<r;e++){const t=n[e];t.parentNode.removeChild(t),o.textContent+=t.textContent}Z(e);const a=i.content;s?_(s,o,a.firstChild):a.insertBefore(o,a.firstChild),window.ShadyCSS.prepareTemplateStyles(i,e);const l=a.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==l)t.insertBefore(l.cloneNode(!0),t.firstChild);else if(s){a.insertBefore(o,a.firstChild);const e=new Set;e.add(o),p(s,e)}},Q=(e,t,i)=>{if(!i||"object"!=typeof i||!i.scopeName)throw new Error("The `scopeName` option is required.");const n=i.scopeName,r=I.has(t),o=W&&11===t.nodeType&&!!t.host,a=o&&!G.has(n),l=a?document.createDocumentFragment():t;if(F(e,l,Object.assign({templateFactory:D(n)},i)),a){const e=I.get(l);I.delete(l);const i=e.value instanceof v?e.value.template:void 0;K(n,l,i),s(t,t.firstChild),t.appendChild(l),I.set(t,e)}!r&&o&&window.ShadyCSS.styleElement(t.host)};window.JSCompiler_renameProperty=(e,t)=>e;const X={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},Y=(e,t)=>t!==e&&(t==t||e==e),ee={attribute:!0,type:String,converter:X,reflect:!1,hasChanged:Y},te=1,se=4,ie=8,ne=16,re="finalized";class oe extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach((t,s)=>{const i=this._attributeNameForProperty(s,t);void 0!==i&&(this._attributeToPropertyMap.set(i,s),e.push(i))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach((e,t)=>this._classProperties.set(t,e))}}static createProperty(e,t=ee){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const s="symbol"==typeof e?Symbol():"__"+e,i=this.getPropertyDescriptor(e,s,t);void 0!==i&&Object.defineProperty(this.prototype,e,i)}static getPropertyDescriptor(e,t,s){return{get(){return this[t]},set(i){const n=this[e];this[t]=i,this.requestUpdateInternal(e,n,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||ee}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty(re)||e.finalize(),this[re]=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const s of t)this.createProperty(s,e[s])}}static _attributeNameForProperty(e,t){const s=t.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,t,s=Y){return s(e,t)}static _propertyValueFromAttribute(e,t){const s=t.type,i=t.converter||X,n="function"==typeof i?i:i.fromAttribute;return n?n(e,s):e}static _propertyValueToAttribute(e,t){if(void 0===t.reflect)return;const s=t.type,i=t.converter;return(i&&i.toAttribute||X.toAttribute)(e,s)}initialize(){this._updateState=0,this._updatePromise=new Promise(e=>this._enableUpdatingResolver=e),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,t)=>{if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,t)=>this[t]=e),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,s){t!==s&&this._attributeToProperty(e,s)}_propertyToAttribute(e,t,s=ee){const i=this.constructor,n=i._attributeNameForProperty(e,s);if(void 0!==n){const e=i._propertyValueToAttribute(t,s);if(void 0===e)return;this._updateState=this._updateState|ie,null==e?this.removeAttribute(n):this.setAttribute(n,e),this._updateState=this._updateState&~ie}}_attributeToProperty(e,t){if(this._updateState&ie)return;const s=this.constructor,i=s._attributeToPropertyMap.get(e);if(void 0!==i){const e=s.getPropertyOptions(i);this._updateState=this._updateState|ne,this[i]=s._propertyValueFromAttribute(t,e),this._updateState=this._updateState&~ne}}requestUpdateInternal(e,t,s){let i=!0;if(void 0!==e){const n=this.constructor;s=s||n.getPropertyOptions(e),n._valueHasChanged(this[e],t,s.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==s.reflect||this._updateState&ne||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,s))):i=!1}!this._hasRequestedUpdate&&i&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,t){return this.requestUpdateInternal(e,t),this.updateComplete}async _enqueueUpdate(){this._updateState=this._updateState|se;try{await this._updatePromise}catch(e){}const e=this.performUpdate();return null!=e&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&se}get hasUpdated(){return this._updateState&te}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1;const t=this._changedProperties;try{e=this.shouldUpdate(t),e?this.update(t):this._markUpdated()}catch(t){throw e=!1,this._markUpdated(),t}e&&(this._updateState&te||(this._updateState=this._updateState|te,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~se}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((e,t)=>this._propertyToAttribute(t,this[t],e)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}}oe[re]=!0;
133
+ */,z=(e,t)=>`${e}--${t}`;let W=!0;void 0===window.ShadyCSS?W=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),W=!1);const J=e=>t=>{const s=z(t.type,e);let r=q.get(s);void 0===r&&(r={stringsArray:new WeakMap,keyString:new Map},q.set(s,r));let n=r.stringsArray.get(t.strings);if(void 0!==n)return n;const o=t.strings.join(i);if(n=r.keyString.get(o),void 0===n){const s=t.getTemplateElement();W&&window.ShadyCSS.prepareTemplateDom(s,e),n=new a(t,s),r.keyString.set(o,n)}return r.stringsArray.set(t.strings,n),n},D=["html","svg"],Z=e=>{D.forEach(t=>{const s=q.get(z(t,e));void 0!==s&&s.keyString.forEach(e=>{const{element:{content:t}}=e,s=new Set;Array.from(t.querySelectorAll("style")).forEach(e=>{s.add(e)}),p(e,s)})})},G=new Set,K=(e,t,s)=>{G.add(e);const i=s?s.element:document.createElement("template"),r=t.querySelectorAll("style"),{length:n}=r;if(0===n)return void window.ShadyCSS.prepareTemplateStyles(i,e);const o=document.createElement("style");for(let e=0;e<n;e++){const t=r[e];t.parentNode.removeChild(t),o.textContent+=t.textContent}Z(e);const a=i.content;s?_(s,o,a.firstChild):a.insertBefore(o,a.firstChild),window.ShadyCSS.prepareTemplateStyles(i,e);const l=a.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==l)t.insertBefore(l.cloneNode(!0),t.firstChild);else if(s){a.insertBefore(o,a.firstChild);const e=new Set;e.add(o),p(s,e)}},Q=(e,t,i)=>{if(!i||"object"!=typeof i||!i.scopeName)throw new Error("The `scopeName` option is required.");const r=i.scopeName,n=I.has(t),o=W&&11===t.nodeType&&!!t.host,a=o&&!G.has(r),l=a?document.createDocumentFragment():t;if(F(e,l,Object.assign({templateFactory:J(r)},i)),a){const e=I.get(l);I.delete(l);const i=e.value instanceof v?e.value.template:void 0;K(r,l,i),s(t,t.firstChild),t.appendChild(l),I.set(t,e)}!n&&o&&window.ShadyCSS.styleElement(t.host)};window.JSCompiler_renameProperty=(e,t)=>e;const X={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},Y=(e,t)=>t!==e&&(t==t||e==e),ee={attribute:!0,type:String,converter:X,reflect:!1,hasChanged:Y},te=1,se=4,ie=8,re=16,ne="finalized";class oe extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach((t,s)=>{const i=this._attributeNameForProperty(s,t);void 0!==i&&(this._attributeToPropertyMap.set(i,s),e.push(i))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach((e,t)=>this._classProperties.set(t,e))}}static createProperty(e,t=ee){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const s="symbol"==typeof e?Symbol():"__"+e,i=this.getPropertyDescriptor(e,s,t);void 0!==i&&Object.defineProperty(this.prototype,e,i)}static getPropertyDescriptor(e,t,s){return{get(){return this[t]},set(i){const r=this[e];this[t]=i,this.requestUpdateInternal(e,r,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||ee}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty(ne)||e.finalize(),this[ne]=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const s of t)this.createProperty(s,e[s])}}static _attributeNameForProperty(e,t){const s=t.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,t,s=Y){return s(e,t)}static _propertyValueFromAttribute(e,t){const s=t.type,i=t.converter||X,r="function"==typeof i?i:i.fromAttribute;return r?r(e,s):e}static _propertyValueToAttribute(e,t){if(void 0===t.reflect)return;const s=t.type,i=t.converter;return(i&&i.toAttribute||X.toAttribute)(e,s)}initialize(){this._updateState=0,this._updatePromise=new Promise(e=>this._enableUpdatingResolver=e),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,t)=>{if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,t)=>this[t]=e),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,s){t!==s&&this._attributeToProperty(e,s)}_propertyToAttribute(e,t,s=ee){const i=this.constructor,r=i._attributeNameForProperty(e,s);if(void 0!==r){const e=i._propertyValueToAttribute(t,s);if(void 0===e)return;this._updateState=this._updateState|ie,null==e?this.removeAttribute(r):this.setAttribute(r,e),this._updateState=this._updateState&~ie}}_attributeToProperty(e,t){if(this._updateState&ie)return;const s=this.constructor,i=s._attributeToPropertyMap.get(e);if(void 0!==i){const e=s.getPropertyOptions(i);this._updateState=this._updateState|re,this[i]=s._propertyValueFromAttribute(t,e),this._updateState=this._updateState&~re}}requestUpdateInternal(e,t,s){let i=!0;if(void 0!==e){const r=this.constructor;s=s||r.getPropertyOptions(e),r._valueHasChanged(this[e],t,s.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==s.reflect||this._updateState&re||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,s))):i=!1}!this._hasRequestedUpdate&&i&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,t){return this.requestUpdateInternal(e,t),this.updateComplete}async _enqueueUpdate(){this._updateState=this._updateState|se;try{await this._updatePromise}catch(e){}const e=this.performUpdate();return null!=e&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&se}get hasUpdated(){return this._updateState&te}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1;const t=this._changedProperties;try{e=this.shouldUpdate(t),e?this.update(t):this._markUpdated()}catch(t){throw e=!1,this._markUpdated(),t}e&&(this._updateState&te||(this._updateState=this._updateState|te,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~se}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((e,t)=>this._propertyToAttribute(t,this[t],e)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}}oe[ne]=!0;
134
134
  /**
135
135
  @license
136
136
  Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
@@ -155,4 +155,4 @@ const ae=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeSha
155
155
  * subject to an additional IP rights grant found at
156
156
  * http://polymer.github.io/PATENTS.txt
157
157
  */
158
- (window.litElementVersions||(window.litElementVersions=[])).push("2.5.1");const pe={};class me extends oe{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(Array.isArray(e)){const t=(e,s)=>e.reduceRight((e,s)=>Array.isArray(s)?t(s,e):(e.add(s),e),s),s=t(e,new Set),i=[];s.forEach(e=>i.unshift(e)),this._styles=i}else this._styles=void 0===e?[]:[e];this._styles=this._styles.map(e=>{if(e instanceof CSSStyleSheet&&!ae){const t=Array.prototype.slice.call(e.cssRules).reduce((e,t)=>e+t.cssText,"");return ce(t)}return e})}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow(this.constructor.shadowRootOptions)}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?ae?this.renderRoot.adoptedStyleSheets=e.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(e=>e.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==pe&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)}))}render(){return pe}}function fe(e){const t=document.querySelector("script[src*=pb-components]");return t?new URL(e,t.src).href:new URL(e,window.location.href).href}function _e(e,t){var s,i,n;for(e=(e+"").split("."),t=(t+"").split("."),n=Math.max(e.length,t.length),s=0;s<n;s++)if(void 0===e[s]&&(e[s]="0"),void 0===t[s]&&(t[s]="0"),0!==(i=parseInt(e[s],10)-parseInt(t[s],10)))return i<0?-1:1;return 0}function ge(e,t){return _e(e,t)>=0}me.finalized=!0,me.render=Q,me.shadowRootOptions={mode:"open"},window.TeiPublisher||(window.TeiPublisher={},TeiPublisher.url=new URL(window.location.href));const ye=new Set,be=new Map;function Se(){be.clear()}const we=e=>class t extends e{static get properties(){return{subscribe:{type:String},subscribeConfig:{type:Object,attribute:"subscribe-config"},emit:{type:String},emitConfig:{type:Object,attribute:"emit-config"},waitFor:{type:String,attribute:"wait-for"},_isReady:{type:Boolean},disabled:{type:Boolean,reflect:!0},_endpoint:{type:String},_apiVersion:{type:String}}}constructor(){super(),this._isReady=!1,this.disabled=!1,this._subscriptions=new Map}connectedCallback(){super.connectedCallback(),t.waitOnce("pb-page-ready",e=>{this._endpoint=e.endpoint,this._apiVersion=e.apiVersion})}disconnectedCallback(){super.disconnectedCallback(),this._subscriptions.forEach((e,t)=>{e.forEach(e=>{document.removeEventListener(t,e)})})}command(e,t){"disable"===e&&(this.disabled=t)}wait(e){if(this.waitFor){const t=Array.from(document.querySelectorAll(this.waitFor)).filter(e=>this.emitsOnSameChannel(e)),s=t.length;if(0===s)return e();let i=0;t.forEach(t=>{if(t._isReady)i++,s===i&&e();else{const n=t.addEventListener("pb-ready",r=>{r.detail.source!=this&&(i++,s===i&&(t.removeEventListener("pb-ready",n),e()))})}})}else e()}waitForChannel(e){if(this.subscribeConfig)for(const t in this.subscribeConfig)this.subscribeConfig[t].forEach(s=>{if("pb-ready"===s&&ye.has(t))return e()});else if(this.subscribe&&ye.has(this.subscribe)||!this.subscribe&&ye.has("__default__"))return e();const t=this.subscribeTo("pb-ready",s=>{s.detail._source!=this&&(t.forEach(e=>document.removeEventListener("pb-ready",e)),e())})}static waitOnce(e,t){be.has(e)?t(be.get(e)):document.addEventListener(e,s=>{be.set(e,s.detail),t(s.detail)},{once:!0})}signalReady(e="pb-ready",t){this._isReady=!0,be.set(e,t),this.dispatchEvent(new CustomEvent(e,{detail:{data:t,source:this}})),this.emitTo(e,t)}getSubscribedChannels(){const e=[];return this.subscribeConfig?Object.keys(this.subscribeConfig).forEach(t=>{e.push(t)}):this.subscribe&&e.push(this.subscribe),e}emitsOnSameChannel(e){const s=this.getSubscribedChannels(),i=t.getEmittedChannels(e);return 0===s.length&&0===i.length||s.some(e=>i.includes(e))}static getEmittedChannels(e){const t=[],s=e.getAttribute("emit-config");if(s){const e=JSON.parse(s);Object.keys(e).forEach(e=>{t.push(e)})}else{const s=e.getAttribute("emit");s&&t.push(s)}return t}subscribeTo(e,t,s){let i;const n=s||this.getSubscribedChannels();if(0===n.length){const s=e=>{e.detail&&e.detail.key||t(e)};document.addEventListener(e,s),i=[s]}else i=n.map(s=>{const i=e=>{e.detail&&e.detail.key&&e.detail.key===s&&t(e)};return document.addEventListener(e,i),i});return this._subscriptions.set(e,i),i}emitTo(e,s,i){const n=i||t.getEmittedChannels(this);if(0==n.length){"pb-ready"===e&&ye.add("__default__"),s=s?Object.assign({_source:this},s):{_source:this};const t=new CustomEvent(e,{detail:s,composed:!0,bubbles:!0});this.dispatchEvent(t)}else n.forEach(t=>{const i={key:t,_source:this};if(s)for(const e in s)s.hasOwnProperty(e)&&(i[e]=s[e]);"pb-ready"===e&&ye.add(t);const n=new CustomEvent(e,{detail:i,composed:!0,bubbles:!0});this.dispatchEvent(n)})}getDocument(){if(this.src){const e=document.getElementById(this.src);if(e)return e}return null}getParameter(e,t){const s=TeiPublisher.url.searchParams&&TeiPublisher.url.searchParams.getAll(e);return s&&1==s.length?s[0]:s&&s.length>1?s:t}getParameterValues(e){return TeiPublisher.url.searchParams.getAll(e)}setParameter(e,t){void 0===t?TeiPublisher.url.searchParams.delete(e):Array.isArray(t)?(TeiPublisher.url.searchParams.delete(e),t.forEach((function(t){TeiPublisher.url.searchParams.append(e,t)}))):TeiPublisher.url.searchParams.set(e,t)}setParameters(e){TeiPublisher.url.search="";for(let t in e)e.hasOwnProperty(t)&&this.setParameter(t,e[t])}getParameters(){const e={};for(let t of TeiPublisher.url.searchParams.keys())e[t]=this.getParameter(t);return e}getParametersMatching(e){const t={};for(let s of TeiPublisher.url.searchParams.entries())if(e.test(s[0])){const e=t[s[0]];e?e.push(s[1]):t[s[0]]=[s[1]]}return t}clearParametersMatching(e){for(let t of TeiPublisher.url.searchParams.entries())e.test(t[0])&&TeiPublisher.url.searchParams.delete(t[0])}setPath(e){const t=document.querySelector("pb-page");if(t){const s=t.appRoot;this.getUrl().pathname=s+"/"+e}}getUrl(){return TeiPublisher.url}pushHistory(e,t){history.pushState(t,e,TeiPublisher.url.toString())}getEndpoint(){return this._endpoint}toAbsoluteURL(e,t){if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(e))return e;const s=t||this.getEndpoint();let i;return i="."===s?new URL(window.location.href):"about:"===window.location.protocol?document.baseURI:new URL(s+"/",`${window.location.protocol}//${window.location.host}`),new URL(e,i).href}minApiVersion(e){return _e(this._apiVersion,e)>=0}lessThanApiVersion(e){return _e(this._apiVersion,e)<0}compareApiVersion(e){return _e(this._apiVersion,e)}};export{A,me as L,V as N,_e as a,Se as b,ue as c,y as d,c as e,t as f,s as g,$ as h,T as i,ge as m,we as p,fe as r};
158
+ (window.litElementVersions||(window.litElementVersions=[])).push("2.5.1");const pe={};class me extends oe{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(Array.isArray(e)){const t=(e,s)=>e.reduceRight((e,s)=>Array.isArray(s)?t(s,e):(e.add(s),e),s),s=t(e,new Set),i=[];s.forEach(e=>i.unshift(e)),this._styles=i}else this._styles=void 0===e?[]:[e];this._styles=this._styles.map(e=>{if(e instanceof CSSStyleSheet&&!ae){const t=Array.prototype.slice.call(e.cssRules).reduce((e,t)=>e+t.cssText,"");return ce(t)}return e})}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow(this.constructor.shadowRootOptions)}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?ae?this.renderRoot.adoptedStyleSheets=e.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(e=>e.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==pe&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)}))}render(){return pe}}function fe(e){const t=document.querySelector("script[src*=pb-components]");return t?new URL(e,t.src).href:new URL(e,window.location.href).href}function _e(e,t){var s,i,r;for(e=(e+"").split("."),t=(t+"").split("."),r=Math.max(e.length,t.length),s=0;s<r;s++)if(void 0===e[s]&&(e[s]="0"),void 0===t[s]&&(t[s]="0"),0!==(i=parseInt(e[s],10)-parseInt(t[s],10)))return i<0?-1:1;return 0}function ge(e,t){return _e(e,t)>=0}function ye(e,t,s){const i=getComputedStyle(e).getPropertyValue(t);if(i)try{return JSON.parse(i)}catch(e){return s}return s}me.finalized=!0,me.render=Q,me.shadowRootOptions={mode:"open"},window.TeiPublisher||(window.TeiPublisher={},TeiPublisher.url=new URL(window.location.href));const be=new Set,Se=new Map;function we(){Se.clear()}const ve=e=>class t extends e{static get properties(){return{subscribe:{type:String},subscribeConfig:{type:Object,attribute:"subscribe-config"},emit:{type:String},emitConfig:{type:Object,attribute:"emit-config"},waitFor:{type:String,attribute:"wait-for"},_isReady:{type:Boolean},disabled:{type:Boolean,reflect:!0},_endpoint:{type:String},_apiVersion:{type:String}}}constructor(){super(),this._isReady=!1,this.disabled=!1,this._subscriptions=new Map}connectedCallback(){super.connectedCallback(),t.waitOnce("pb-page-ready",e=>{this._endpoint=e.endpoint,this._apiVersion=e.apiVersion})}disconnectedCallback(){super.disconnectedCallback(),this._subscriptions.forEach((e,t)=>{e.forEach(e=>{document.removeEventListener(t,e)})})}command(e,t){"disable"===e&&(this.disabled=t)}wait(e){if(this.waitFor){const t=Array.from(document.querySelectorAll(this.waitFor)).filter(e=>this.emitsOnSameChannel(e)),s=t.length;if(0===s)return e();let i=0;t.forEach(t=>{if(t._isReady)i++,s===i&&e();else{const r=t.addEventListener("pb-ready",n=>{n.detail.source!=this&&(i++,s===i&&(t.removeEventListener("pb-ready",r),e()))})}})}else e()}waitForChannel(e){if(this.subscribeConfig)for(const t in this.subscribeConfig)this.subscribeConfig[t].forEach(s=>{if("pb-ready"===s&&be.has(t))return e()});else if(this.subscribe&&be.has(this.subscribe)||!this.subscribe&&be.has("__default__"))return e();const t=this.subscribeTo("pb-ready",s=>{s.detail._source!=this&&(t.forEach(e=>document.removeEventListener("pb-ready",e)),e())})}static waitOnce(e,t){Se.has(e)?t(Se.get(e)):document.addEventListener(e,s=>{Se.set(e,s.detail),t(s.detail)},{once:!0})}signalReady(e="pb-ready",t){this._isReady=!0,Se.set(e,t),this.dispatchEvent(new CustomEvent(e,{detail:{data:t,source:this}})),this.emitTo(e,t)}getSubscribedChannels(){const e=[];return this.subscribeConfig?Object.keys(this.subscribeConfig).forEach(t=>{e.push(t)}):this.subscribe&&e.push(this.subscribe),e}emitsOnSameChannel(e){const s=this.getSubscribedChannels(),i=t.getEmittedChannels(e);return 0===s.length&&0===i.length||s.some(e=>i.includes(e))}static getEmittedChannels(e){const t=[],s=e.getAttribute("emit-config");if(s){const e=JSON.parse(s);Object.keys(e).forEach(e=>{t.push(e)})}else{const s=e.getAttribute("emit");s&&t.push(s)}return t}subscribeTo(e,t,s){let i;const r=s||this.getSubscribedChannels();if(0===r.length){const s=e=>{e.detail&&e.detail.key||t(e)};document.addEventListener(e,s),i=[s]}else i=r.map(s=>{const i=e=>{e.detail&&e.detail.key&&e.detail.key===s&&t(e)};return document.addEventListener(e,i),i});return this._subscriptions.set(e,i),i}emitTo(e,s,i){const r=i||t.getEmittedChannels(this);if(0==r.length){"pb-ready"===e&&be.add("__default__"),s=s?Object.assign({_source:this},s):{_source:this};const t=new CustomEvent(e,{detail:s,composed:!0,bubbles:!0});this.dispatchEvent(t)}else r.forEach(t=>{const i={key:t,_source:this};if(s)for(const e in s)s.hasOwnProperty(e)&&(i[e]=s[e]);"pb-ready"===e&&be.add(t);const r=new CustomEvent(e,{detail:i,composed:!0,bubbles:!0});this.dispatchEvent(r)})}getDocument(){if(this.src){const e=document.getElementById(this.src);if(e)return e}return null}getParameter(e,t){const s=TeiPublisher.url.searchParams&&TeiPublisher.url.searchParams.getAll(e);return s&&1==s.length?s[0]:s&&s.length>1?s:t}getParameterValues(e){return TeiPublisher.url.searchParams.getAll(e)}setParameter(e,t){void 0===t?TeiPublisher.url.searchParams.delete(e):Array.isArray(t)?(TeiPublisher.url.searchParams.delete(e),t.forEach((function(t){TeiPublisher.url.searchParams.append(e,t)}))):TeiPublisher.url.searchParams.set(e,t)}setParameters(e){TeiPublisher.url.search="";for(let t in e)e.hasOwnProperty(t)&&this.setParameter(t,e[t])}getParameters(){const e={};for(let t of TeiPublisher.url.searchParams.keys())e[t]=this.getParameter(t);return e}getParametersMatching(e){const t={};for(let s of TeiPublisher.url.searchParams.entries())if(e.test(s[0])){const e=t[s[0]];e?e.push(s[1]):t[s[0]]=[s[1]]}return t}clearParametersMatching(e){for(let t of TeiPublisher.url.searchParams.entries())e.test(t[0])&&TeiPublisher.url.searchParams.delete(t[0])}setPath(e){const t=document.querySelector("pb-page");if(t){const s=t.appRoot;this.getUrl().pathname=s+"/"+e}}getUrl(){return TeiPublisher.url}pushHistory(e,t){history.pushState(t,e,TeiPublisher.url.toString())}getEndpoint(){return this._endpoint}toAbsoluteURL(e,t){if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(e))return e;const s=t||this.getEndpoint();let i;return i="."===s?new URL(window.location.href):"about:"===window.location.protocol?document.baseURI:new URL(s+"/",`${window.location.protocol}//${window.location.host}`),new URL(e,i).href}minApiVersion(e){return _e(this._apiVersion,e)>=0}lessThanApiVersion(e){return _e(this._apiVersion,e)<0}compareApiVersion(e){return _e(this._apiVersion,e)}};export{A,me as L,V as N,_e as a,we as b,ue as c,y as d,c as e,t as f,ye as g,$ as h,T as i,s as j,ge as m,ve as p,fe as r};
@@ -1,4 +1,4 @@
1
- import{h as e,o as t,F as o,D as i,E as s,H as r,l as a,f as n,t as d,g as l}from"./paper-checkbox-ea000977.js";import{E as c,T as p,D as h,p as m}from"./pb-message-a461d7ee.js";import{d as u,N as b,e as g,f as v,g as f,A as w,L as y,c as _,h as x,a as $,p as E}from"./pb-mixin-ae9e2885.js";
1
+ import{h as e,o as t,F as o,D as i,E as s,H as r,l as a,f as n,t as d,g as l}from"./paper-checkbox-f6a70487.js";import{E as c,T as p,D as h,p as m}from"./pb-message-1a0c0c52.js";import{d as u,N as b,e as g,f as v,j as f,A as w,L as y,c as _,h as x,a as $,p as E}from"./pb-mixin-15ff531f.js";
2
2
  /**
3
3
  * @license
4
4
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -483,12 +483,12 @@ This program is available under Apache License Version 2.0, available at https:/
483
483
  Copyright (c) 2017 Vaadin Ltd.
484
484
  This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
485
485
  */
486
- const N=e=>class extends e{static get properties(){return{_hasVaadinListMixin:{value:!0},selected:{type:Number,reflectToAttribute:!0,notify:!0},orientation:{type:String,reflectToAttribute:!0,value:""},items:{type:Array,readOnly:!0,notify:!0},_searchBuf:{type:String,value:""}}}static get observers(){return["_enhanceItems(items, orientation, selected, disabled)"]}ready(){super.ready(),this.addEventListener("keydown",e=>this._onKeydown(e)),this.addEventListener("click",e=>this._onClick(e)),this._observer=new o(this,e=>{this._setItems(this._filterItems(Array.from(this.children)))})}_enhanceItems(e,t,o,i){if(!i&&e){this.setAttribute("aria-orientation",t||"vertical"),this.items.forEach(e=>{t?e.setAttribute("orientation",t):e.removeAttribute("orientation"),e.updateStyles()}),this._setFocusable(o);const i=e[o];e.forEach(e=>e.selected=e===i),i&&!i.disabled&&this._scrollToItem(o)}}get focused(){return this.getRootNode().activeElement}_filterItems(e){return e.filter(e=>e._hasVaadinItemMixin)}_onClick(e){if(e.metaKey||e.shiftKey||e.ctrlKey||e.defaultPrevented)return;const t=this._filterItems(e.composedPath())[0];let o;t&&!t.disabled&&(o=this.items.indexOf(t))>=0&&(this.selected=o)}_searchKey(e,t){this._searchReset=i.debounce(this._searchReset,s.after(500),()=>this._searchBuf=""),this._searchBuf+=t.toLowerCase();const o=1,r=e=>!(e.disabled||this._isItemHidden(e))&&0===e.textContent.replace(/[^a-zA-Z0-9]/g,"").toLowerCase().indexOf(this._searchBuf);this.items.some(e=>0===e.textContent.replace(/[^a-zA-Z0-9]/g,"").toLowerCase().indexOf(this._searchBuf))||(this._searchBuf=t.toLowerCase());const a=1===this._searchBuf.length?e+1:e;return this._getAvailableIndex(a,o,r)}get _isRTL(){return!this._vertical&&"rtl"===this.getAttribute("dir")}_onKeydown(e){if(e.metaKey||e.ctrlKey)return;const t=e.key.replace(/^Arrow/,""),o=this.items.indexOf(this.focused);if(/[a-zA-Z0-9]/.test(t)&&1===t.length){const e=this._searchKey(o,t);return void(e>=0&&this._focus(e))}const i=e=>!(e.disabled||this._isItemHidden(e));let s,r;const a=this._isRTL?-1:1;this._vertical&&"Up"===t||!this._vertical&&"Left"===t?(r=-a,s=o-a):this._vertical&&"Down"===t||!this._vertical&&"Right"===t?(r=a,s=o+a):"Home"===t?(r=1,s=0):"End"===t&&(r=-1,s=this.items.length-1),s=this._getAvailableIndex(s,r,i),s>=0&&(this._focus(s),e.preventDefault())}_getAvailableIndex(e,t,o){const i=this.items.length;for(let s=0;"number"==typeof e&&s<i;s++,e+=t||1){e<0?e=i-1:e>=i&&(e=0);if(o(this.items[e]))return e}return-1}_isItemHidden(e){return"none"===getComputedStyle(e).display}_setFocusable(e){e=this._getAvailableIndex(e,1,e=>!e.disabled);const t=this.items[e]||this.items[0];this.items.forEach(e=>e.tabIndex=e===t?0:-1)}_focus(e){const t=this.items[e];this.items.forEach(e=>e.focused=e===t),this._setFocusable(e),this._scrollToItem(e),t.focus()}focus(){this._observer&&this._observer.flush();const e=this.querySelector('[tabindex="0"]')||(this.items?this.items[0]:null);e&&e.focus()}get _scrollerElement(){}_scrollToItem(e){const t=this.items[e];if(!t)return;const o=this._vertical?["top","bottom"]:this._isRTL?["right","left"]:["left","right"],i=this._scrollerElement.getBoundingClientRect(),s=(this.items[e+1]||t).getBoundingClientRect(),r=(this.items[e-1]||t).getBoundingClientRect();let a=0;!this._isRTL&&s[o[1]]>=i[o[1]]||this._isRTL&&s[o[1]]<=i[o[1]]?a=s[o[1]]-i[o[1]]:(!this._isRTL&&r[o[0]]<=i[o[0]]||this._isRTL&&r[o[0]]>=i[o[0]])&&(a=r[o[0]]-i[o[0]]),this._scroll(a)}get _vertical(){return"horizontal"!==this.orientation}_scroll(e){if(this._vertical)this._scrollerElement.scrollTop+=e;else{const t=h.detectScrollType(),o=h.getNormalizedScrollLeft(t,this.getAttribute("dir")||"ltr",this._scrollerElement)+e;h.setNormalizedScrollLeft(t,this.getAttribute("dir")||"ltr",this._scrollerElement,o)}}}
486
+ const j=e=>class extends e{static get properties(){return{_hasVaadinListMixin:{value:!0},selected:{type:Number,reflectToAttribute:!0,notify:!0},orientation:{type:String,reflectToAttribute:!0,value:""},items:{type:Array,readOnly:!0,notify:!0},_searchBuf:{type:String,value:""}}}static get observers(){return["_enhanceItems(items, orientation, selected, disabled)"]}ready(){super.ready(),this.addEventListener("keydown",e=>this._onKeydown(e)),this.addEventListener("click",e=>this._onClick(e)),this._observer=new o(this,e=>{this._setItems(this._filterItems(Array.from(this.children)))})}_enhanceItems(e,t,o,i){if(!i&&e){this.setAttribute("aria-orientation",t||"vertical"),this.items.forEach(e=>{t?e.setAttribute("orientation",t):e.removeAttribute("orientation"),e.updateStyles()}),this._setFocusable(o);const i=e[o];e.forEach(e=>e.selected=e===i),i&&!i.disabled&&this._scrollToItem(o)}}get focused(){return this.getRootNode().activeElement}_filterItems(e){return e.filter(e=>e._hasVaadinItemMixin)}_onClick(e){if(e.metaKey||e.shiftKey||e.ctrlKey||e.defaultPrevented)return;const t=this._filterItems(e.composedPath())[0];let o;t&&!t.disabled&&(o=this.items.indexOf(t))>=0&&(this.selected=o)}_searchKey(e,t){this._searchReset=i.debounce(this._searchReset,s.after(500),()=>this._searchBuf=""),this._searchBuf+=t.toLowerCase();const o=1,r=e=>!(e.disabled||this._isItemHidden(e))&&0===e.textContent.replace(/[^a-zA-Z0-9]/g,"").toLowerCase().indexOf(this._searchBuf);this.items.some(e=>0===e.textContent.replace(/[^a-zA-Z0-9]/g,"").toLowerCase().indexOf(this._searchBuf))||(this._searchBuf=t.toLowerCase());const a=1===this._searchBuf.length?e+1:e;return this._getAvailableIndex(a,o,r)}get _isRTL(){return!this._vertical&&"rtl"===this.getAttribute("dir")}_onKeydown(e){if(e.metaKey||e.ctrlKey)return;const t=e.key.replace(/^Arrow/,""),o=this.items.indexOf(this.focused);if(/[a-zA-Z0-9]/.test(t)&&1===t.length){const e=this._searchKey(o,t);return void(e>=0&&this._focus(e))}const i=e=>!(e.disabled||this._isItemHidden(e));let s,r;const a=this._isRTL?-1:1;this._vertical&&"Up"===t||!this._vertical&&"Left"===t?(r=-a,s=o-a):this._vertical&&"Down"===t||!this._vertical&&"Right"===t?(r=a,s=o+a):"Home"===t?(r=1,s=0):"End"===t&&(r=-1,s=this.items.length-1),s=this._getAvailableIndex(s,r,i),s>=0&&(this._focus(s),e.preventDefault())}_getAvailableIndex(e,t,o){const i=this.items.length;for(let s=0;"number"==typeof e&&s<i;s++,e+=t||1){e<0?e=i-1:e>=i&&(e=0);if(o(this.items[e]))return e}return-1}_isItemHidden(e){return"none"===getComputedStyle(e).display}_setFocusable(e){e=this._getAvailableIndex(e,1,e=>!e.disabled);const t=this.items[e]||this.items[0];this.items.forEach(e=>e.tabIndex=e===t?0:-1)}_focus(e){const t=this.items[e];this.items.forEach(e=>e.focused=e===t),this._setFocusable(e),this._scrollToItem(e),t.focus()}focus(){this._observer&&this._observer.flush();const e=this.querySelector('[tabindex="0"]')||(this.items?this.items[0]:null);e&&e.focus()}get _scrollerElement(){}_scrollToItem(e){const t=this.items[e];if(!t)return;const o=this._vertical?["top","bottom"]:this._isRTL?["right","left"]:["left","right"],i=this._scrollerElement.getBoundingClientRect(),s=(this.items[e+1]||t).getBoundingClientRect(),r=(this.items[e-1]||t).getBoundingClientRect();let a=0;!this._isRTL&&s[o[1]]>=i[o[1]]||this._isRTL&&s[o[1]]<=i[o[1]]?a=s[o[1]]-i[o[1]]:(!this._isRTL&&r[o[0]]<=i[o[0]]||this._isRTL&&r[o[0]]>=i[o[0]])&&(a=r[o[0]]-i[o[0]]),this._scroll(a)}get _vertical(){return"horizontal"!==this.orientation}_scroll(e){if(this._vertical)this._scrollerElement.scrollTop+=e;else{const t=h.detectScrollType(),o=h.getNormalizedScrollLeft(t,this.getAttribute("dir")||"ltr",this._scrollerElement)+e;h.setNormalizedScrollLeft(t,this.getAttribute("dir")||"ltr",this._scrollerElement,o)}}}
487
487
  /**
488
488
  @license
489
489
  Copyright (c) 2017 Vaadin Ltd.
490
490
  This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
491
- */,j=/Apple.* Version\/(9|10)/.test(navigator.userAgent);class D extends(c(N(p(r([n],t))))){static get template(){return e`
491
+ */,N=/Apple.* Version\/(9|10)/.test(navigator.userAgent);class D extends(c(j(p(r([n],t))))){static get template(){return e`
492
492
  <style>
493
493
  :host {
494
494
  display: flex;
@@ -574,7 +574,7 @@ This program is available under Apache License Version 2.0, available at https:/
574
574
  </div>
575
575
 
576
576
  <div on-click="_scrollForward" part="forward-button"></div>
577
- `}static get is(){return"vaadin-tabs"}static get version(){return"3.2.0"}static get properties(){return{orientation:{value:"horizontal",type:String},selected:{value:0,type:Number}}}static get observers(){return["_updateOverflow(items.*, vertical)"]}ready(){super.ready(),this.addEventListener("iron-resize",()=>this._updateOverflow()),this._scrollerElement.addEventListener("scroll",()=>this._updateOverflow()),this.setAttribute("role","tablist"),a(this,()=>{this._updateOverflow()})}_scrollForward(){this._scroll(-this.__direction*this._scrollOffset)}_scrollBack(){this._scroll(this.__direction*this._scrollOffset)}get _scrollOffset(){return this._vertical?this._scrollerElement.offsetHeight:this._scrollerElement.offsetWidth}get _scrollerElement(){return this.$.scroll}get __direction(){return this._vertical||"rtl"!==this.getAttribute("dir")?-1:1}_updateOverflow(){const e=this._vertical?this._scrollerElement.scrollTop:this.__getNormalizedScrollLeft(this._scrollerElement);let t=this._vertical?this._scrollerElement.scrollHeight:this._scrollerElement.scrollWidth;t-=1;let o=e>0?"start":"";o+=e+this._scrollOffset<t?" end":"",1==this.__direction&&(o=o.replace(/start|end/gi,e=>"start"===e?"end":"start")),o?this.setAttribute("overflow",o.trim()):this.removeAttribute("overflow"),this._repaintShadowNodesHack()}_repaintShadowNodesHack(){if(j&&this.root){const e="-webkit-backface-visibility";this.root.querySelectorAll("*").forEach(t=>{t.style[e]="visible",t.style[e]=""})}}}customElements.define(D.is,D);class V extends y{static get styles(){return _`
577
+ `}static get is(){return"vaadin-tabs"}static get version(){return"3.2.0"}static get properties(){return{orientation:{value:"horizontal",type:String},selected:{value:0,type:Number}}}static get observers(){return["_updateOverflow(items.*, vertical)"]}ready(){super.ready(),this.addEventListener("iron-resize",()=>this._updateOverflow()),this._scrollerElement.addEventListener("scroll",()=>this._updateOverflow()),this.setAttribute("role","tablist"),a(this,()=>{this._updateOverflow()})}_scrollForward(){this._scroll(-this.__direction*this._scrollOffset)}_scrollBack(){this._scroll(this.__direction*this._scrollOffset)}get _scrollOffset(){return this._vertical?this._scrollerElement.offsetHeight:this._scrollerElement.offsetWidth}get _scrollerElement(){return this.$.scroll}get __direction(){return this._vertical||"rtl"!==this.getAttribute("dir")?-1:1}_updateOverflow(){const e=this._vertical?this._scrollerElement.scrollTop:this.__getNormalizedScrollLeft(this._scrollerElement);let t=this._vertical?this._scrollerElement.scrollHeight:this._scrollerElement.scrollWidth;t-=1;let o=e>0?"start":"";o+=e+this._scrollOffset<t?" end":"",1==this.__direction&&(o=o.replace(/start|end/gi,e=>"start"===e?"end":"start")),o?this.setAttribute("overflow",o.trim()):this.removeAttribute("overflow"),this._repaintShadowNodesHack()}_repaintShadowNodesHack(){if(N&&this.root){const e="-webkit-backface-visibility";this.root.querySelectorAll("*").forEach(t=>{t.style[e]="visible",t.style[e]=""})}}}customElements.define(D.is,D);class V extends y{static get styles(){return _`
578
578
  :host {
579
579
  display: block;
580
580
  }
@@ -0,0 +1 @@
1
+ window.polymerSkipLoadingFontRoboto=!0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teipublisher/pb-components",
3
- "version": "1.38.6",
3
+ "version": "1.39.0",
4
4
  "description": "Collection of webcomponents underlying TEI Publisher",
5
5
  "repository": "https://github.com/eeditiones/tei-publisher-components.git",
6
6
  "main": "index.html",
package/pb-elements.json CHANGED
@@ -2012,6 +2012,11 @@
2012
2012
  "name": "--pb-code-highlight-white-space",
2013
2013
  "description": "configures line wrapping",
2014
2014
  "default": "\"pre\""
2015
+ },
2016
+ {
2017
+ "name": "--pb-code-highlight-theme",
2018
+ "description": "configures the default theme to be used",
2019
+ "default": "\"default\""
2015
2020
  }
2016
2021
  ]
2017
2022
  },
@@ -3,7 +3,30 @@ import "prismjs/prism";
3
3
  import 'prismjs/components/prism-xquery';
4
4
  import 'prismjs/plugins/normalize-whitespace/prism-normalize-whitespace';
5
5
  import 'prismjs/plugins/line-numbers/prism-line-numbers';
6
- import { resolveURL } from './utils.js';
6
+ import { resolveURL, getCSSProperty } from './utils.js';
7
+
8
+ const PRISM_THEMES = new Map();
9
+
10
+ function loadTheme(theme) {
11
+ const themeName = theme === 'default' ? 'prism.css' : `prism-${theme}.css`;
12
+ if (PRISM_THEMES.has(themeName)) {
13
+ console.log('Using cached theme: %s', themeName);
14
+ return PRISM_THEMES.get(themeName);
15
+ }
16
+
17
+ const promise = new Promise((resolve) => {
18
+ const resource = resolveURL('../css/prismjs/') + themeName;
19
+ console.log('<pb-code-highlight> loading theme %s from %s', theme, resource);
20
+ fetch(resource)
21
+ .then(response => response.text())
22
+ .catch(() => resolve(''))
23
+ .then(text => {
24
+ resolve(html`<style>${text}</style>`);
25
+ });
26
+ });
27
+ PRISM_THEMES.set(themeName, promise);
28
+ return promise;
29
+ }
7
30
 
8
31
  /**
9
32
  * Highlight a code snippet. The snippet may either be passed in a template child
@@ -12,6 +35,7 @@ import { resolveURL } from './utils.js';
12
35
  * pass the code to be highlighted in the `code` property.
13
36
  *
14
37
  * @cssprop [--pb-code-highlight-white-space=pre] - configures line wrapping
38
+ * @cssprop [--pb-code-highlight-theme=default] - configures the default theme to be used
15
39
  */
16
40
  export class PbCodeHighlight extends LitElement {
17
41
  static get properties() {
@@ -41,7 +65,7 @@ export class PbCodeHighlight extends LitElement {
41
65
  type: Boolean,
42
66
  attribute: 'line-numbers'
43
67
  },
44
- _styles: {
68
+ _themeStyles: {
45
69
  type: String
46
70
  }
47
71
  };
@@ -52,13 +76,15 @@ export class PbCodeHighlight extends LitElement {
52
76
  this.language = 'xml';
53
77
  this.theme = 'default';
54
78
  this.lineNumbers = false;
79
+ this._themeStyles = null;
55
80
  }
56
81
 
57
82
  connectedCallback() {
58
83
  super.connectedCallback();
59
- const theme = this.getAttribute('theme');
84
+ let theme = this.getAttribute('theme');
60
85
  if (theme === null) {
61
- this.setAttribute('theme', 'default');
86
+ theme = getCSSProperty(this, '--pb-code-highlight-theme', 'default');
87
+ this.setAttribute('theme', theme);
62
88
  }
63
89
  }
64
90
 
@@ -79,8 +105,8 @@ export class PbCodeHighlight extends LitElement {
79
105
  super.attributeChangedCallback(name, oldValue, newValue);
80
106
  switch (name) {
81
107
  case 'theme':
82
- PbCodeHighlight.loadTheme(newValue).then((styles) => {
83
- this._styles = styles;
108
+ loadTheme(newValue).then(loadedStyles => {
109
+ this._themeStyles = loadedStyles;
84
110
  });
85
111
  break;
86
112
  default:
@@ -102,23 +128,13 @@ export class PbCodeHighlight extends LitElement {
102
128
  render() {
103
129
  if (this.code) {
104
130
  return html`
105
- ${this._styles}
131
+ ${this._themeStyles}
106
132
  <pre class="${this.lineNumbers ? 'line-numbers' : ''} language-${this.language}"><code>${this.code}</code></pre>
107
133
  `;
108
134
  }
109
135
  return html`<pre class="line-numbers"><code><code></pre>`;
110
136
  }
111
137
 
112
- static async loadTheme(theme) {
113
- const themeName = theme === 'default' ? 'prism.css' : `prism-${theme}.css`;
114
- const resource = resolveURL('../css/prismjs/') + themeName;
115
- console.log('<pb-code-highlight> loading theme %s from %s', theme, resource);
116
-
117
- const fetchedStyles = await fetch(resource).then(async response => response.text()).catch(e => '');
118
-
119
- return html`<style>${fetchedStyles}</style>`;
120
- }
121
-
122
138
  static get styles() {
123
139
  return css`
124
140
  :host {
@@ -1,7 +1,8 @@
1
+ import './polymer-hack.js';
1
2
  import '@polymer/app-layout/app-scroll-effects/app-scroll-effects.js';
2
3
  import '@polymer/app-layout/app-scroll-effects/effects/material.js';
3
4
  import '@polymer/paper-tooltip/paper-tooltip.js';
4
5
  import '@polymer/paper-fab';
5
6
  import '@polymer/paper-card';
6
7
  import './docs/pb-demo-snippet.js';
7
- import './pb-components.js';
8
+ import './pb-components.js';
package/src/pb-page.js CHANGED
@@ -174,6 +174,8 @@ class PbPage extends pbMixin(LitElement) {
174
174
  return;
175
175
  }
176
176
 
177
+ this.endpoint = this.endpoint.replace(/\/+$/, '');
178
+
177
179
  if (this.locales && this._localeFallbacks.indexOf('app') === -1) {
178
180
  this._localeFallbacks.push('app');
179
181
  }
@@ -202,7 +204,12 @@ class PbPage extends pbMixin(LitElement) {
202
204
  return fetch(`${this.endpoint}/api/version`)
203
205
  .then((res2) => res2.json());
204
206
  })
205
- .catch(() => null)
207
+ .catch((error) => {
208
+ if (error.response.status === 404) {
209
+ return fetch(`${this.endpoint}/api/version`)
210
+ .then((res2) => res2.json());
211
+ }
212
+ });
206
213
 
207
214
  if (json) {
208
215
  this.apiVersion = json.api;
@@ -219,6 +226,13 @@ class PbPage extends pbMixin(LitElement) {
219
226
  template: this.template,
220
227
  apiVersion: this.apiVersion
221
228
  });
229
+ } else if (this._i18nInstance) {
230
+ this.signalReady('pb-page-ready', {
231
+ endpoint: this.endpoint,
232
+ apiVersion: this.apiVersion,
233
+ template: this.template,
234
+ language: this._i18nInstance.language
235
+ });
222
236
  }
223
237
  }
224
238
 
@@ -287,7 +301,7 @@ class PbPage extends pbMixin(LitElement) {
287
301
  // initialized and ready to go!
288
302
  this._updateI18n(t);
289
303
  this.signalReady('pb-i18n-update', { t, language: this._i18nInstance.language });
290
- if (this.requireLanguage) {
304
+ if (this.requireLanguage && this.apiVersion) {
291
305
  this.signalReady('pb-page-ready', {
292
306
  endpoint: this.endpoint,
293
307
  apiVersion: this.apiVersion,
package/src/pb-popover.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { LitElement, html, css } from 'lit-element';
2
2
  import tippy from 'tippy.js';
3
3
  import { pbMixin } from './pb-mixin.js';
4
+ import { getCSSProperty } from "./utils.js";
4
5
  import * as themes from './pb-popover-themes.js';
5
6
 
6
7
  function _injectStylesheet(root, name, cssCode) {
@@ -161,34 +162,22 @@ export class PbPopover extends pbMixin(LitElement) {
161
162
 
162
163
  _checkCSSProperties() {
163
164
  if (!this.theme && this.theme !== 'none') {
164
- this.theme = this._getCSSProperty('--pb-popover-theme', 'none');
165
+ this.theme = getCSSProperty(this, '--pb-popover-theme', 'none');
165
166
  }
166
167
  if (!this.placement) {
167
- this.placement = this._getCSSProperty('--pb-popover-placement', 'auto');
168
+ this.placement = getCSSProperty(this, '--pb-popover-placement', 'auto');
168
169
  }
169
170
  if (!this.fallbackPlacement) {
170
- this.fallbackPlacement = this._getCSSProperty('--pb-popover-fallback-placement', null);
171
+ this.fallbackPlacement = getCSSProperty(this, '--pb-popover-fallback-placement', null);
171
172
  }
172
173
  if (!this.persistent) {
173
- this.persistent = this._getCSSProperty('--pb-popover-persistent', false);
174
+ this.persistent = getCSSProperty(this, '--pb-popover-persistent', false);
174
175
  }
175
176
  if (!this.trigger) {
176
- this.trigger = this._getCSSProperty('--pb-popover-trigger', null);
177
+ this.trigger = getCSSProperty(this, '--pb-popover-trigger', null);
177
178
  }
178
179
  }
179
180
 
180
- _getCSSProperty(name, defaultValue) {
181
- const property = getComputedStyle(this).getPropertyValue(name);
182
- if (property) {
183
- try {
184
- return JSON.parse(property);
185
- } catch (e) {
186
- return defaultValue;
187
- }
188
- }
189
- return defaultValue;
190
- }
191
-
192
181
  _injectStyles() {
193
182
  this._checkCSSProperties();
194
183
 
package/src/pb-upload.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { LitElement, html, css } from 'lit-element';
2
2
  import { pbMixin } from './pb-mixin.js';
3
3
  import { translate } from "./pb-i18n.js";
4
+ import { getCSSProperty } from "./utils.js";
4
5
  import '@vaadin/vaadin-upload';
5
6
  import '@polymer/paper-button';
6
7
  import '@polymer/paper-icon-button';
@@ -108,8 +109,8 @@ export class PbUpload extends pbMixin(LitElement) {
108
109
  }
109
110
 
110
111
  render() {
111
- const uploadIcon = this._getCSSProperty('--pb-upload-button-icon', 'icons:file-upload');
112
- const dropLabelIcon = this._getCSSProperty('--pb-upload-drop-icon', null);
112
+ const uploadIcon = getCSSProperty(this, '--pb-upload-button-icon', 'icons:file-upload');
113
+ const dropLabelIcon = getCSSProperty(this, '--pb-upload-drop-icon', null);
113
114
  return html`
114
115
  <vaadin-upload id="uploader" accept="${this.accept}" method="post" tabindex="-1" form-data-name="files[]"
115
116
  with-credentials>
@@ -170,18 +171,6 @@ export class PbUpload extends pbMixin(LitElement) {
170
171
  this.requestUpdate();
171
172
  }
172
173
 
173
- _getCSSProperty(name, defaultValue) {
174
- const property = getComputedStyle(this).getPropertyValue(name);
175
- if (property) {
176
- try {
177
- return JSON.parse(property);
178
- } catch (e) {
179
- return defaultValue;
180
- }
181
- }
182
- return defaultValue;
183
- }
184
-
185
174
  static get styles() {
186
175
  return css`
187
176
  ul {
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Disable automatic loading of Roboto from Google fonts
3
+ */
4
+ window.polymerSkipLoadingFontRoboto = true;
5
+
6
+ export {};
package/src/utils.js CHANGED
@@ -29,4 +29,24 @@ export function cmpVersion(a, b) {
29
29
 
30
30
  export function minVersion(given, required) {
31
31
  return cmpVersion(given, required) >= 0;
32
+ }
33
+
34
+ /**
35
+ * Retrieve value of a CSS property.
36
+ *
37
+ * @param {Element} elem the component
38
+ * @param {string} name name of the property
39
+ * @param {any} defaultValue default value
40
+ * @returns the value or defaultValue if it does not exist
41
+ */
42
+ export function getCSSProperty(elem, name, defaultValue) {
43
+ const property = getComputedStyle(elem).getPropertyValue(name);
44
+ if (property) {
45
+ try {
46
+ return JSON.parse(property);
47
+ } catch (e) {
48
+ return defaultValue;
49
+ }
50
+ }
51
+ return defaultValue;
32
52
  }