quran-madina-html 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -290,6 +290,3 @@ npm run release // build the dist with dependencies
290
290
 
291
291
  Don't forget to see the page source!
292
292
 
293
- ## Links
294
-
295
- [X-Tags Docs](http://x-tags.org/docs)
@@ -1,2 +1,2 @@
1
1
  /*! quran-madina-html 22-07-2026 */
2
- !function(){var I="quran-madina-html",d=/localhost/.test(document.location.hostname)?"../":`https://www.unpkg.com/${I}/`,x={content:"Loading .."},i=/[\u0621-\u064A\u0671-\u06D3]/,k="﷽";function D(t,e){return 1===e&&0!==t}var s={};var c={};function h(i,t,e,n){var a,r=!n&&function(t){if(s[t])return s[t];try{var e=sessionStorage.getItem("quran-madina-html:"+t);if(e)return s[t]=JSON.parse(e)}catch(t){}return null}(i);r?t&&setTimeout(function(){t(r)},0):c[i]?c[i].push({success:t,error:e}):(c[i]=[{success:t,error:e}],(a=new XMLHttpRequest).onreadystatechange=function(){if(a.readyState===XMLHttpRequest.DONE){var t=c[i];if(delete c[i],200===a.status){var e=JSON.parse(a.responseText),n=i,r=e,o=a.responseText;s[n]=r;try{sessionStorage.setItem("quran-madina-html:"+n,o)}catch(t){}t.forEach(function(t){t.success&&t.success(e)})}else t.forEach(function(t){t.error&&t.error(a)})}},a.open("GET",i,!0),a.send())}function A(t){console.log(I+"> "+t)}function R(t){return null!=t&&(""===(t=String(t).trim().toLowerCase())||"true"===t||"1"===t||"yes"===t)}function q(t){var e=(e=(e=getComputedStyle(t).color)&&e.match(/[\d.]+/g))?.2126*n(+e[0])+.7152*n(+e[1])+.0722*n(+e[2]):1;function n(t){return(t/=255)<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}t.setAttribute("data-qmh-text-scheme",.5<e?"dark":"light")}function H(t){return Array(2).fill(t.split("-")[0]-1)}function j(t){return 2==t.split("-").length?t.split("-").map(t=>parseInt(t)+1):Array(2).fill(parseInt(t.split("-")[0])+1)}function F(t){return null==t||2!=(t=1==(t=t.split(/[-:]/).map(t=>parseInt(t,10))).length?[t[0],t[0]]:t).length||isNaN(t[0])||isNaN(t[1])||t[0]<1||t[1]<t[0]?null:t}function z(t,e,n){return null==e?null:e[0]<n[0]||e[1]>n[1]?(A(`${t} range ${e[0]}-${e[1]} outside displayed words ${n[0]}-${n[1]}, ignoring`),null):e}function W(t,e){if(null!=t&&"auto"!==t){if("no"===t)return!0;A("yes"===t?'inline="yes" is not implemented yet; falling back to "auto"':"Bad inline parameter: "+t)}return e}function _(t){return i.test(t)}function U(t,e){return(0===t?2:1)<=e}function Y(t){var e=0;return t.t.split(/\s+/).forEach(function(t){_(t)&&(e+=1)}),e}function $(t){var e=0;return t.r.forEach(function(t){e+=Y(t)}),e}function G(t,e="class",n="lightgrey",r="transparent"){var o="tag"===e.toLowerCase()?document.getElementsByTagName(t):document.getElementsByClassName(t);Array.from(o).forEach(function(t){t.onmouseover=function(){Array.from(o).forEach(function(t){t.style.backgroundColor=n})},t.onmouseout=function(){Array.from(o).forEach(function(t){t.style.backgroundColor=r})}})}function K(t,e){var n=(t,e)=>String(t).padStart(e,"0"),n=[I+"-part",`${I}-${n(t,3)}-`+n(e,3)];return(-1==e||1==t&&0==e)&&n.push("quran-madina-html-sura-start"),n}function E(){var t=document.createElement("div");return t.innerHTML='<svg viewBox="0 0 24 24" class="quran-madina-html-icon" width="20px"><path d="M16.02 20.96H3.78c-.41 0-.75-.34-.75-.75V7.74c0-.41.34-.75.75-.75h7.87c.21 0 .39.08.53.22l4.37 4.37c.14.14.22.32.22.53v8.11c0 .4-.34.74-.75.74ZM4.53 19.47h10.75v-6.61h-3.62c-.41 0-.75-.34-.75-.75V8.48H4.53v10.99Z"></path><path d="m20.74 7.63-4.37-4.37c-.14-.14-.36-.2-.53-.22H8.01c-.41 0-.75.34-.75.75V5.5h1.49v-.97h6.34v3.62c0 .41.34.75.75.75h3.62v8.19h-1.2v1.49h1.95c.41 0 .75-.34.75-.75V8.16c0-.21-.08-.4-.22-.53Z"></path></svg>'.trim(),t.firstChild}function T(){var t=document.createElement("div");return t.innerHTML='<svg class="quran-madina-html-icon" viewBox="0 0 820 615" style="height:20px"><path d="M70 1.9C37.6 8.8 12.6 33.4 3.4 67.5c-1.8 6.6-1.9 11.9-1.9 98v91l2.3 8c5.1 17.8 17 36.4 29.9 46.7 10.8 8.6 25.4 15.4 38.1 17.8 3.1.6 15.2 1 26.8 1 17.7 0 21.3.2 21.7 1.4.4.9.6 17.1.7 36.1 0 32.4.2 34.9 2 38.5 6.4 12.5 21.4 17.4 33.3 10.8 2.3-1.3 7.5-6.4 12.1-11.9l63-74.1c.6-.4 16.3-.8 34.9-.8H300l-.2-18.3-.3-18.2-42.8.1-43.1.5c-.2.2-12.7 15.1-27.9 33.1-15.1 18-27.8 32.4-28.1 32.1-.3-.4-.6-15.3-.6-33.2v-32.6l-38.8-.1c-42.1-.2-43.9-.4-54.3-6-6.5-3.6-16.9-14.6-20.2-21.5-5.8-11.9-5.7-10-5.7-100.7 0-92-.2-89.4 6.3-101.7 3.9-7.3 13.5-17.1 20.3-20.7C76 36.7 66.1 37 244.5 37L412 38.1c18 4.1 33.5 20.5 37.5 39.6 2.2 10.2 2.1 164.6 0 174.8-3.9 18.3-16.4 32.7-33.5 38.5-3.2 1.1-7.8 2-10 2-3.1 0-4 .4-4 1.7 0 1-.2 8.8-.3 17.3-.2 8.5-.2 16.2 0 17 .9 3.3 21.7-.5 34.1-6 13.7-6.3 27.5-17.9 36.2-30.5 5-7.2 10.8-20.4 13.2-30.1l2.3-8.9V165 76.5l-2.3-9c-8.1-31.4-30.5-54.9-61.7-64.8l-7-2.2-169-.2C87.7.1 78 .2 70 1.9zm277.294 102.559q19.5-.5 28.25 24.5 2.5 7.25-3.75 19.75-5.75 11.75-9.75 16-19.5 21.5-67 25.25-27.75 2.25-50.25-2.25-5.25 38.25-16.5 50-26 26.75-66 29.5-27.75 2-42.5-11-20.25-17.75-16.5-48.5 3-23.75 14.25-42.5 2.75-4.5 4.75-7.5 2-3 3-4.25 2.25-2.75 4.75-1.25 2.75 1.5 0 6.25-12.75 24.5-10 45 4 30.5 44.5 30.5 30.25 0 53.25-15.5 12.5-8.25 14.75-14.25-2.25-20.75-13.75-35.75-3.5-4.25-1.75-8l9.5-23.5q3-7.5 8.25 1.25l8.75 14.75q7.75 4.25 28.25 5 16.75-19.25 39.25-36.25 22.5-16.75 36.25-17.25zm11.5 40.5q-12.5-9.5-31.75-5.75-19 3.75-41.25 19.5 50.75.5 73-13.75zm-71.5-89.75q1.5-2 4.25-1.25 5 1.75 9.5 4.5 4.75 2.75 8.75 6.25 2 2 .75 4.5l-12 19q-1.75 2.5-4.5.5-2.5-2-18-11.25-2.75-1.75-1-4.25zm278.784 232.623c-4.7.4-4.7.4-6.7 6.1-1.2 3.1-9.3 25.9-18 50.7l-36.6 102.7-3.5 9.8h17.9 17.8l5.7-17 5.7-17h31.7 31.8l5.6 17.2 5.6 17.3 17.9-.3 18-.3-6-17.2-15-43.2-13.3-38.5-14.1-41-9.9-28.7c-.3-.6-30.2-1.1-34.6-.6zm35.7 106c-.2.2-10 .2-21.9.1l-21.5-.3 9.8-29.5 11-32.5c1.2-2.9 1.8-1.4 12.1 29.4l10.5 32.8zm148.8 139.609c32.4-6.9 57.4-31.5 66.6-65.6 1.8-6.6 1.9-11.9 1.9-98v-91l-2.3-8c-5.1-17.8-17-36.4-29.9-46.7-10.8-8.6-25.4-15.4-38.1-17.8-3.1-.6-15.2-1-26.8-1-17.7 0-21.3-.2-21.7-1.4-.4-.9-.6-17.1-.7-36.1 0-32.4-.2-34.9-2-38.5-6.4-12.5-21.4-17.4-33.3-10.8-2.3 1.3-7.5 6.4-12.1 11.9l-63 74.1c-.6.4-16.3.8-34.9.8h-33.7l.2 18.3.3 18.2 42.8-.1 43.1-.5c.2-.2 12.7-15.1 27.9-33.1 15.1-18 27.8-32.4 28.1-32.1.3.4.6 15.3.6 33.2v32.6l38.8.1c42.1.2 43.9.4 54.3 6 6.5 3.6 16.9 14.6 20.2 21.5 5.8 11.9 5.7 10 5.7 100.7 0 92 .2 89.4-6.3 101.7-3.9 7.3-13.5 17.1-20.3 20.7-11.4 6.1-1.5 5.8-179.9 5.8-108.2 0-164.5-.4-167.5-1.1-18-4.1-33.5-20.5-37.5-39.6-2.2-10.2-2.1-164.6 0-174.8 3.9-18.3 16.4-32.7 33.5-38.5 3.2-1.1 7.8-2 10-2 3.1 0 4-.4 4-1.7 0-1 .2-8.8.3-17.3.2-8.5.2-16.2 0-17-.9-3.3-21.7.5-34.1 6-13.7 6.3-27.5 17.9-36.2 30.5-5 7.2-10.8 20.4-13.2 30.1l-2.3 8.9v88.5 88.5l2.3 9c8.1 31.4 30.5 54.9 61.7 64.8l7 2.2 169 .2 177.5-1.6z"/></svg>'.trim(),t.firstChild}function Z(t){var e=document.createElement("quran-madina-html-header"),t=(e.innerHTML=t,E()),n=(t.addEventListener("click",S),T());return n.addEventListener("click",O),e.appendChild(t),e.appendChild(n),e}var p=null;function B(){p&&(p.popup.classList.remove(I+"-open"),document.removeEventListener("click",p.outsideClick),document.removeEventListener("keydown",p.onEscape),p=null)}function a(e,t,n,r,o){B();function i(t){u.contains(t.target)||B()}function a(t){"Escape"===t.key&&B()}s=e,(c=document.querySelector(`body > ${I}-aya-popup`))||((c=document.createElement(I+"-aya-popup")).appendChild(E()),c.appendChild(T()),document.body.appendChild(c)),["--qmh-header","--qmh-background"].forEach(function(t){c.style.setProperty(t,getComputedStyle(s).getPropertyValue(t))});var s,c,u=c,l=u.children[0],d=u.children[1];l.onclick=function(t){t.stopPropagation();t="“"+Array.from(e.getElementsByClassName(n)).map(function(t){return t.textContent}).join(" ").replace(/\s+/g," ").trim()+"”\n\n"+x.suras[r-1].name;navigator.clipboard.writeText(t),alert("⎘ تم نسخ:\n\n"+t),B()},d.onclick=function(t){t.stopPropagation(),window.open(`https://quran.com/${r}/`+o,"_blank"),B()},l=u,d=(d=t).getBoundingClientRect(),l.style.left=Math.max(4,d.left)+"px",l.style.top=(0<d.top-34-6?d.top-34-6:d.bottom+6)+"px",u.classList.add(I+"-open");document.addEventListener("click",i),document.addEventListener("keydown",a),p={popup:u,outsideClick:i,onEscape:a}}function J(n,r,o,i){i<1||Array.from(n.getElementsByClassName(r)).forEach(function(e){e.style.cursor="pointer",e.onclick=function(t){t.stopPropagation(),a(n,e,r,o,i)}})}function Q(t,e,n){t.style="display:block;",t.style.setProperty("font-family",x.font_family,""),t.style.setProperty("font-size",x.font_size+"px",""),"me_quran"===x.font_family&&t.style.setProperty("line-height",2*x.font_size+"px",""),t.style.width=x.line_width+10+"px",n||t.style.setProperty("box-shadow","inset "+(e%2==1?"":"-")+"8px 0 7px -7px #333","")}function tt(t,e){0<=e?t.style.setProperty("transform",`scaleX(${e*(x.stretch_scale||1)})`,""):t.style.setProperty("text-align","center","")}function C(t,e,n,r){r&&e>=r[0]&&e<=r[1]?t.classList.add(I+"-word-error"):n&&e>=n[0]&&e<=n[1]&&t.classList.add(I+"-word-highlight")}function et(n,t,r,o,i,a){return t.split(/(\s+)/).forEach(function(t){var e;""!==t&&(/^\s+$/.test(t)?n.appendChild(document.createTextNode(t)):((e=document.createElement("span")).textContent=t,e.classList.add(I+"-word"),_(t)&&(o+=1),r&&(o<r[0]||o>r[1])&&e.classList.add(I+"-word-hidden"),C(e,o,i,a),n.appendChild(e)))}),o}function nt(e,n,t,r,o){function i(t){return!t||e+1>=t[0]&&e+n<=t[1]}function a(t){return t&&!i(t)&&e+n>=t[0]&&e+1<=t[1]}return!i(t)||a(r)||a(o)?{ligature:!1}:(t=null,o&&i(o)?t="error":r&&i(r)&&(t="highlight"),{ligature:!0,cls:t})}function L(t,e){for(var n=0;n<t.r.length;n++)if(t.r[n].l===e)return t.r[n];return null}function M(t,e,n){var r,t=x.suras[t].ayas;return e<=0||void 0===(r=t[e-1])||r.p!==t[e].p||null===L(r,n)}function X(t,e,n,r,o){for(var i=x.suras[t].ayas,a=[],s=r+o;0<=s&&s<i.length&&void 0!==i[s]&&i[s].p==e;s+=o){var c=L(i[s],n);if(null===c)break;if(o<0){if(a.unshift(c),M(t,s,n))break}else a.push(c)}return a}function V(t,e){for(var n=0;n<e.length;n++){var r=document.createElement("div");r.textContent=e[n].t,r.style.cssText="display:inline;visibility:hidden",t.appendChild(r)}}function S(){var t=this.parentElement.parentElement,e=t.querySelector("quran-madina-html-header"),n=(e=e?e.textContent.replace(/\s+/g," ").trim():null!=(e=t.getAttribute("sura"))?x.suras[e-1].name:"",(n=(t=(t=t).cloneNode(!0)).querySelector("quran-madina-html-header"))&&n.parentNode.removeChild(n),Array.from(t.querySelectorAll(`.${I}-word-hidden`)).forEach(function(t){t.parentNode.removeChild(t)}),Array.from(t.querySelectorAll("div,span")).forEach(function(t){/visibility:\s*hidden/.test(t.getAttribute("style")||"")&&t.parentNode.removeChild(t)}),t),t=n.querySelectorAll("quran-madina-html-line"),t=t.length?Array.from(t).map(function(t){return t.textContent.replace(/\s+/g," ").trim()}).filter(function(t){return""!==t}).join(" "):n.textContent.replace(/\s+/g," ").trim(),n="“"+t+"”\n\n"+e;navigator.clipboard.writeText(n),alert("⎘ تم نسخ:\n\n"+n)}function O(){var t=this.parentElement.parentElement;let e;e=null!=t.getAttribute("sura")&&null!=t.getAttribute("aya")?`https://quran.com/${t.getAttribute("sura")}/`+t.getAttribute("aya"):"https://quran.com/page/"+t.getAttribute("page"),window.open(e,"_blank")}function rt(s,t,e,c,n,r,o,u,l,d){(l||d)&&q(s);var t=function(t,e,n){for(var r=[],o=null,i=0,a=x.suras.length,s=2===e&&0<t?1:e,c=0;c<a;c++){for(var u=(t+c)%a,l=x.suras[u].ayas,d=!1,h=0===c?s:0;h<l.length;h++){var p=U(u,h),f=l[h];if(void 0===f)break;for(var m=0;m<f.r.length;m++){var v,g=f.r[m];""!==g.t&&(v=f.p+":"+g.l,o&&o.key===v||(o={key:v,stretch:g.s,parts:[]},r.push(o)),o.parts.push({sura:u,ayaIdx:h,part:g,countable:p}))}if(p&&(i+=$(f))>=n[1]){d=!0;break}}if(d)break}for(var y=0,b=(r.forEach(function(t){t.parts.forEach(function(t){t.countable&&(y+=Y(t.part))}),t.lastWord=y}),0);b<r.length-1&&r[b].lastWord<n[0];)b+=1;for(var w=b;w<r.length-1&&r[w].lastWord<n[1];)w+=1;return{groups:r.slice(b,w+1),counterStart:0<b?r[b-1].lastWord:0}}(t,e,c),i=t.groups,h=W(o,1<i.length),p=t.counterStart;B(),s.innerHTML="",s.removeAttribute("style"),s.classList.toggle(I+"-inline",!h&&!r),h&&(e=parseInt(i[0].key.split(":")[0],10),Q(s,e,n),n||s.appendChild(Z(x.suras[i[0].parts[0].sura].name))),i.forEach(function(t,e){var n,a=document.createElement("quran-madina-html-line");h?(a.style.setProperty("display","block",""),tt(a,t.stretch),M((n=t.parts[0]).sura,n.ayaIdx,n.part.l)||V(a,X(n.sura,x.suras[n.sura].ayas[n.ayaIdx].p,n.part.l,n.ayaIdx,-1))):(a.style.setProperty("font-family",x.font_family,""),a.style.setProperty("font-size",x.font_size+"px","")),s.appendChild(a),t.parts.forEach(function(t){var e,n,r,o=document.createElement("div"),i=K(t.sura+1,t.ayaIdx-1);DOMTokenList.prototype.add.apply(o.classList,i),t.countable?(r=0<(e=D(t.sura,t.ayaIdx)?Y(t.part):0)?nt(p,e,c,l,d):{ligature:!1}).ligature?((n=document.createElement("span")).classList.add(I+"-word",I+"-basmala"),r.cls&&n.classList.add(I+"-word-"+r.cls),n.textContent=k,o.appendChild(n),p+=e):p=et(o,t.part.t,c,p,l,d):u&&(0===t.ayaIdx||0===t.sura&&1===t.ayaIdx)?((r=document.createElement("span")).textContent=t.part.t,r.style.visibility="hidden",o.appendChild(r)):o.textContent=t.part.t,o.style.cssText="display:inline",a.appendChild(o),G(i.slice(-1)[0]),J(s,i.slice(-1)[0],t.sura+1,t.ayaIdx-1)}),h&&e===i.length-1&&(n=t.parts[t.parts.length-1],V(a,X(n.sura,x.suras[n.sura].ayas[n.ayaIdx].p,n.part.l,n.ayaIdx,1)))})}var t,N,u,e=16,n=[16,24],r=[6,100],o=document.currentScript||document.querySelector(`script[src*="${I}"]`),f=o.getAttribute("data-name")||"Madina05",m=(o.getAttribute("data-font")||"me_quran").replaceAll(" ","_"),v=parseFloat(o.getAttribute("data-font-size"))||e,r=((v<r[0]||r[1]<v)&&(A(`font-size ${v} outside ${r[0]}..${r[1]}, using `+e),v=e),o.getAttribute("data-cdn")),o=(r&&(d=r.replace(/\/?$/,"/")),A(f+` with font: ${m} size: `+v),d+"dist/"+I+".min.css?v=1.1");function g(t){u=d+`assets/db/${N=f+`-${m}-${v=t}px`}/`}document.getElementById(I)||(r=document.getElementsByTagName("head")[0],(t=document.createElement("link")).id=I,t.rel="stylesheet",t.type="text/css",t.href=o,t.media="all",r.appendChild(t)),g(v);var y=null;function P(){y&&(x.font_size=y.font_size,x.line_width=y.line_width,x.stretch_scale=y.stretch_scale)}var l={};function b(t,e){if(!x.juz)return-1;for(var n=Math.max(e,2),r=0,o=x.juz,i=0;i<o.length&&(o[i][0]<t||o[i][0]===t&&o[i][1]<=n);i++)r=i;return r}function ot(t,i){if(x.juz){for(var a,e=[],n=0;n<t.length;n++){var r=t[n];0<=r&&r<x.juz.length&&!l[r]&&e.indexOf(r)<0&&e.push(r)}0===e.length?i():(a=e.length,e.forEach(function(o){var t;h(u+"juz-"+((t=o+1)<10?"0":"")+t+".json",function(t){for(var e=t,n=0;n<e.d.length;n++){var r=e.d[n];x.suras[r[0]].ayas[r[1]]={p:r[2],r:r[3]}}l[o]=!0,0==--a&&i()},function(t){console.error(I+"> failed to load juz "+(o+1),t),l[o]=!0,0==--a&&i()})}))}else i()}function it(){const t=new FontFace(x.font_family,"url("+encodeURI(null==(e=x.font_url)||/^(https?:)?\/\//.test(e)?e:d+String(e).replace(/^\//,""))+")");t.load().then(()=>{document.fonts.add(t)});var e,n={};["page","page_param","aya","sura","words","highlight","error","headless","quotes","inline","notitle"].forEach(function(t){var e;n[t]=(e=t,{attribute:{},set:function(t){this.xtag.data[e]=t},get:function(){return this.getAttribute(e)}})}),xtag.register(I,{lifecycle:{created:function(){this.render(this)},inserted:function(){},removed:function(){},attributeChanged:function(){this.render(this)}},events:{},accessors:n,methods:{render:function(t){var e;this.xtag.data.rendering||ot(function(t){if(!x.juz)return[];var e,n=[];if(null!=t.getAttribute("sura")&&null!=t.getAttribute("aya")){var r,o=H(t.getAttribute("sura"))[0],i=j(t.getAttribute("aya"));if(null!=t.getAttribute("words"))return[r=b(o,i[0]),(r+1)%x.juz.length];for(e=b(o,i[0]);e<=b(o,i[1]);e++)n.push(e)}else{if(null==t.getAttribute("page"))return[];var a=x.pages[parseInt(t.getAttribute("page"),10)-1];if(!a)return[];for(e=b(a[0],a[1]);e<=b(a[2],a[3]);e++)n.push(e)}return n}(e=this),function(){if(!e.xtag.data.rendering){e.xtag.data.rendering=!0;try{e.doRender(t)}finally{e.xtag.data.rendering=!1}}})},doRender:function(e){var n,r,o,t=null,i=null!=this.highlight?F(this.highlight):null,a=(null!=this.highlight&&null==i&&A("Bad highlight parameter: "+this.highlight),null!=this.error?F(this.error):null),s=(null!=this.error&&null==a&&A("Bad error parameter: "+this.error),this.page),c=R(this.headless),u=R(this.notitle),l=null!=this.quotes&&!R(this.quotes),d=this.inline,h=null!=this.sura&&null!=this.aya;if(h)v=f=H(this.sura)[0],o=!1,[m,g]=j(this.aya),null!=this.page&&A("Ignoring page parameter!"),s=x.suras[f].ayas[m].p;else{if(null==this.page)return console.error(I+"> Bad arguments: Not rendering!"),1;if(x.pages)var p=x.pages[s-1],f=p[0],m=p[1],v=p[2],g=p[3];else{for(g=m=v=f=0;x.suras[f].ayas.slice(-1)[0].p<s;)f+=1;for(v=f;v<114&&x.suras[v].ayas[0].p<=s;)v+=1;for(v-=1;x.suras[f].ayas[m].p<s;)m+=1;for(g=x.suras[v].ayas.length-1;x.suras[v].ayas[g].p>s;)g-=1}o=!0,null!=this.inline&&A("Ignoring inline parameter with page!")}if(null!=this.words)if(h){if(null!=(t=F(this.words)))return g!==m&&A("Ignoring aya range end with words parameter!"),500<t[1]-t[0]+1&&(A("words selection capped at 500 words"),t[1]=t[0]+499),void rt(e,f,m,t,c,l,d,u,i=z("highlight",i,t),a=z("error",a,t));A("Bad words parameter: "+this.words)}else A("Ignoring words parameter with page!");var p=h?function(t,e,n){for(var r=x.suras[t].ayas,o=0,i=e;i<=n;i++)U(t,i)&&(o+=$(r[i]));return o}(f,m,g):function(t,e,n,r,o){for(var i=0,a=t;a<=n;a++)for(var s=x.suras[a].ayas,c=a===n?r:s.length-1,u=a===t?e:0;u<=c;u++){var l=s[u];void 0!==l&&l.p===o&&U(a,u)&&(i+=$(l))}return i}(f,m,v,g,parseInt(s,10)),i=z("highlight",i,[1,p]),a=z("error",a,[1,p]),y=null!=i||null!=a,b=(y&&q(e),B(),e.innerHTML="",e.removeAttribute("style"),o=W(d,o=(n=x.suras[f].ayas[m].r[0].l)!=(r=x.suras[v].ayas[g].r.slice(-1)[0].l)?!0:o),e.classList.toggle(I+"-inline",!o&&!l),o&&(Q(e,s,c),c||e.appendChild(Z(x.suras[f].name))),m),w=f,_=0;for(let t=n;t<=r;t++){const P=t;var E=document.createElement("quran-madina-html-line"),T=(e.appendChild(E),o?E.style.setProperty("display","block",""):(E.style.setProperty("font-family",x.font_family,""),E.style.setProperty("font-size",x.font_size+"px","")),o&&h&&t===n&&V(E,X(f,s,n,m,-1)),f==v?g:x.suras[w].ayas.length-1);for(let t=b;t<=Math.min(b+5,T);t++){var C,L,M,S,O,N=x.suras[w].ayas[t];void 0!==N&&N.p==s&&(N=N.r.filter(t=>t.l==P)).length&&(o&&tt(E,N[0].s),C=document.createElement("div"),L=K(w+1,t-1),DOMTokenList.prototype.add.apply(C.classList,L),y&&U(w,t)?(O=0<(M=D(w,t)?Y(N[0]):0)?nt(_,M,null,i,a):{ligature:!1}).ligature?((S=document.createElement("span")).classList.add(I+"-word",I+"-basmala"),O.cls&&S.classList.add(I+"-word-"+O.cls),S.textContent=k,C.appendChild(S),_+=M):_=et(C,N[0].t,null,_,i,a):C.textContent=D(w,t)&&""!==N[0].t?k:N[0].t,C.style.cssText="display:inline",E.appendChild(C),G(L.slice(-1)[0]),J(e,L.slice(-1)[0],w+1,t-1),b=t,O=w<113?x.suras[w+1].ayas[0]:void 0,T<=b)&&void 0!==O&&O.p==s&&O.r[0].l==P+1&&(w+=1,b=0)}o&&h&&t===r&&V(E,X(v,s,r,g,1))}}}})}function w(){h(u+"manifest.json",function(t){if(t.content_hash){var e="quran-madina-html:hash:"+u,n=null;try{n=sessionStorage.getItem(e)}catch(t){}if(null!==n&&n!==t.content_hash){var r=u;try{for(var o=sessionStorage.length-1;0<=o;o--){var i=sessionStorage.key(o);i&&0===i.indexOf("quran-madina-html:"+r)&&sessionStorage.removeItem(i)}}catch(t){}Object.keys(s).forEach(function(t){0===t.indexOf(r)&&delete s[t]})}try{sessionStorage.setItem(e,t.content_hash)}catch(t){}}x={title:t.title,published:t.published,font_family:t.font_family,font_url:t.font_url,font_size:t.font_size,line_width:t.line_width,suras:t.suras.map(function(t){return{name:t[0],ayas:new Array(t[1])}}),juz:t.juz,pages:t.pages},P(),it()},at,!0)}function at(){h(d+`assets/db/${N}.json`,function(t){x=t,P(),it()},function(t){v!=e?(A(`no DB for font: ${m} size: ${v}, falling back to size: `+e),y=null,g(e),w()):console.error(I+"> no manifest and no monolithic DB",t)})}function st(){function o(t){l||(l=!0,console.error(I+"> missing anchor DB for font-size interpolation",t),A("falling back to size: "+e),g(e),w())}var i=v,a=n[0],s=n[1],c=i-a<=s-i?a:s,u={},l=!1;n.forEach(function(e){var t,n,r;n=o,h(d+`assets/db/${r=f+`-${m}-${e}px`}/manifest.json`,t=function(t){u[e]=t,!l&&a in u&&s in u&&(t=Math.round(u[a].line_width+(u[s].line_width-u[a].line_width)*(i-a)/(s-a)),y={font_size:i,line_width:t,stretch_scale:t*c/(u[c].line_width*i)},A(`font-size ${i}px interpolated from ${a}px/${s}px anchors: line_width ${t}, render data from ${c}px`),g(c),w())},function(){h(d+`assets/db/${r}.json`,t,n)})})}(0<=n.indexOf(v)?w:st)()}(),function(){function t(t){if((this._element=t).className!=this._classCache&&(this._classCache=t.className,this._classCache))for(var e=this._classCache.replace(/^\s+|\s+$/g,"").split(/\s+/),n=0;e.length>n;n++)o.call(this,e[n])}function e(t,e){t.className=e.join(" ")}var n,r,o,i,a,s,c,u;void 0===window.Element||"classList"in document.documentElement||(s=Array.prototype,n=s.indexOf,r=s.slice,o=s.push,i=s.splice,a=s.join,t.prototype={add:function(t){this.contains(t)||(o.call(this,t),e(this._element,r.call(this,0)))},contains:function(t){return-1!==n.call(this,t)},item:function(t){return this[t]||null},remove:function(t){t=n.call(this,t);-1!==t&&(i.call(this,t,1),e(this._element,r.call(this,0)))},toString:function(){return a.call(this," ")},toggle:function(t){-1===n.call(this,t)?this.add(t):this.remove(t)}},window.DOMTokenList=t,s=Element.prototype,c="classList",u=function(){return new t(this)},Object.defineProperty?Object.defineProperty(s,c,{get:u}):s.__defineGetter__(c,u))}(),function(){window.WebComponents=window.WebComponents||{flags:{}};var t,e=document.querySelector('script[src*="webcomponents-lite.js"]'),n={};if(!n.noOpts){if(location.search.slice(1).split("&").forEach(function(t){var e,t=t.split("=");t[0]&&(e=t[0].match(/wc-(.+)/))&&(n[e[1]]=t[1]||!0)}),e)for(var r,o=0;r=e.attributes[o];o++)"src"!==r.name&&(n[r.name]=r.value||!0);n.log&&n.log.split?(t=n.log.split(","),n.log={},t.forEach(function(t){n.log[t]=!0})):n.log={}}n.register&&(window.CustomElements=window.CustomElements||{flags:{}},window.CustomElements.flags.register=n.register),WebComponents.flags=n}(),function(t){"use strict";function g(t){return void 0!==_[t]}function y(){r.call(this),this._isInvalid=!0}function b(t){return""==t&&y.call(this),t.toLowerCase()}function w(t){var e=t.charCodeAt(0);return 32<e&&e<127&&-1==[34,35,60,62,63,96].indexOf(e)?t:encodeURIComponent(t)}function n(t,e,n){function r(t){d.push(t)}var o,i,a=e||"scheme start",s=0,c="",u=!1,l=!1,d=[];t:for(;(t[s-1]!=T||0==s)&&!this._isInvalid;){var h=t[s];switch(a){case"scheme start":if(!h||!C.test(h)){if(e){r("Invalid scheme.");break t}c="",a="no scheme";continue}c+=h.toLowerCase(),a="scheme";break;case"scheme":if(h&&L.test(h))c+=h.toLowerCase();else{if(":"!=h){if(e){if(T==h)break t;r("Code point not allowed in scheme: "+h);break t}c="",s=0,a="no scheme";continue}if(this._scheme=c,c="",e)break t;g(this._scheme)&&(this._isRelative=!0),a="file"==this._scheme?"relative":this._isRelative&&n&&n._scheme==this._scheme?"relative or authority":this._isRelative?"authority first slash":"scheme data"}break;case"scheme data":"?"==h?(this._query="?",a="query"):"#"==h?(this._fragment="#",a="fragment"):T!=h&&"\t"!=h&&"\n"!=h&&"\r"!=h&&(this._schemeData+=w(h));break;case"no scheme":if(n&&g(n._scheme)){a="relative";continue}r("Missing scheme."),y.call(this);break;case"relative or authority":if("/"!=h||"/"!=t[s+1]){r("Expected /, got: "+h),a="relative";continue}a="authority ignore slashes";break;case"relative":if(this._isRelative=!0,"file"!=this._scheme&&(this._scheme=n._scheme),T==h){this._host=n._host,this._port=n._port,this._path=n._path.slice(),this._query=n._query,this._username=n._username,this._password=n._password;break t}if("/"==h||"\\"==h)"\\"==h&&r("\\ is an invalid code point."),a="relative slash";else if("?"==h)this._host=n._host,this._port=n._port,this._path=n._path.slice(),this._query="?",this._username=n._username,this._password=n._password,a="query";else{if("#"!=h){var p=t[s+1],f=t[s+2];("file"!=this._scheme||!C.test(h)||":"!=p&&"|"!=p||T!=f&&"/"!=f&&"\\"!=f&&"?"!=f&&"#"!=f)&&(this._host=n._host,this._port=n._port,this._username=n._username,this._password=n._password,this._path=n._path.slice(),this._path.pop()),a="relative path";continue}this._host=n._host,this._port=n._port,this._path=n._path.slice(),this._query=n._query,this._fragment="#",this._username=n._username,this._password=n._password,a="fragment"}break;case"relative slash":if("/"!=h&&"\\"!=h){"file"!=this._scheme&&(this._host=n._host,this._port=n._port,this._username=n._username,this._password=n._password),a="relative path";continue}"\\"==h&&r("\\ is an invalid code point."),a="file"==this._scheme?"file host":"authority ignore slashes";break;case"authority first slash":if("/"!=h){r("Expected '/', got: "+h),a="authority ignore slashes";continue}a="authority second slash";break;case"authority second slash":if(a="authority ignore slashes","/"==h)break;r("Expected '/', got: "+h);continue;case"authority ignore slashes":if("/"!=h&&"\\"!=h){a="authority";continue}r("Expected authority, got: "+h);break;case"authority":if("@"==h){u&&(r("@ already seen."),c+="%40");for(var u=!0,m=0;c.length>m;m++){var v=c[m];"\t"!=v&&"\n"!=v&&"\r"!=v?":"!=v||null!==this._password?(v=w(v),null!==this._password?this._password+=v:this._username+=v):this._password="":r("Invalid whitespace in authority.")}c=""}else{if(T==h||"/"==h||"\\"==h||"?"==h||"#"==h){s-=c.length,c="",a="host";continue}c+=h}break;case"file host":if(T==h||"/"==h||"\\"==h||"?"==h||"#"==h){a=2!=c.length||!C.test(c[0])||":"!=c[1]&&"|"!=c[1]?(0==c.length||(this._host=b.call(this,c),c=""),"relative path start"):"relative path";continue}"\t"==h||"\n"==h||"\r"==h?r("Invalid whitespace in file host."):c+=h;break;case"host":case"hostname":if(":"!=h||l){if(T==h||"/"==h||"\\"==h||"?"==h||"#"==h){if(this._host=b.call(this,c),c="",a="relative path start",e)break t;continue}"\t"!=h&&"\n"!=h&&"\r"!=h?("["==h?l=!0:"]"==h&&(l=!1),c+=h):r("Invalid code point in host/hostname: "+h)}else if(this._host=b.call(this,c),c="",a="port","hostname"==e)break t;break;case"port":if(/[0-9]/.test(h))c+=h;else{if(T==h||"/"==h||"\\"==h||"?"==h||"#"==h||e){if(""!=c&&((p=parseInt(c,10))!=_[this._scheme]&&(this._port=p+""),c=""),e)break t;a="relative path start";continue}"\t"==h||"\n"==h||"\r"==h?r("Invalid code point in port: "+h):y.call(this)}break;case"relative path start":if("\\"==h&&r("'\\' not allowed in path."),a="relative path","/"!=h&&"\\"!=h)continue;break;case"relative path":T!=h&&"/"!=h&&"\\"!=h&&(e||"?"!=h&&"#"!=h)?"\t"!=h&&"\n"!=h&&"\r"!=h&&(c+=w(h)):("\\"==h&&r("\\ not allowed in relative path."),".."==(c=(f=E[c.toLowerCase()])?f:c)?(this._path.pop(),"/"!=h&&"\\"!=h&&this._path.push("")):"."==c&&"/"!=h&&"\\"!=h?this._path.push(""):"."!=c&&("file"==this._scheme&&0==this._path.length&&2==c.length&&C.test(c[0])&&"|"==c[1]&&(c=c[0]+":"),this._path.push(c)),c="","?"==h?(this._query="?",a="query"):"#"==h&&(this._fragment="#",a="fragment"));break;case"query":e||"#"!=h?T!=h&&"\t"!=h&&"\n"!=h&&"\r"!=h&&(this._query+=(i=void 0,32<(i=(o=h).charCodeAt(0))&&i<127&&-1==[34,35,60,62,96].indexOf(i)?o:encodeURIComponent(o))):(this._fragment="#",a="fragment");break;case"fragment":T!=h&&"\t"!=h&&"\n"!=h&&"\r"!=h&&(this._fragment+=h)}s++}}function r(){this._scheme="",this._schemeData="",this._username="",this._password=null,this._host="",this._port="",this._path=[],this._query="",this._fragment="",this._isInvalid=!1,this._isRelative=!1}function o(t,e){void 0===e||e instanceof o||(e=new o(e+"")),this._url=t,r.call(this);t=t.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g,"");n.call(this,t,null,e)}var _,E,T,C,L,e,i=!1;if(!t.forceJURL)try{var a=new URL("b","http://a");a.pathname="c%20d",i="http://a/c%20d"===a.href}catch(t){}i||((_=Object.create(null)).ftp=21,_.file=0,_.gopher=70,_.http=80,_.https=443,_.ws=80,_.wss=443,(E=Object.create(null))["%2e"]=".",E[".%2e"]="..",E["%2e."]="..",T=void(E["%2e%2e"]=".."),C=/[a-zA-Z]/,L=/[a-zA-Z0-9\+\-\.]/,o.prototype={toString:function(){return this.href},get href(){var t;return this._isInvalid?this._url:((t="")==this._username&&null==this._password||(t=this._username+(null!=this._password?":"+this._password:"")+"@"),this.protocol+(this._isRelative?"//"+t+this.host:"")+this.pathname+this._query+this._fragment)},set href(t){r.call(this),n.call(this,t)},get protocol(){return this._scheme+":"},set protocol(t){this._isInvalid||n.call(this,t+":","scheme start")},get host(){return this._isInvalid?"":this._port?this._host+":"+this._port:this._host},set host(t){!this._isInvalid&&this._isRelative&&n.call(this,t,"host")},get hostname(){return this._host},set hostname(t){!this._isInvalid&&this._isRelative&&n.call(this,t,"hostname")},get port(){return this._port},set port(t){!this._isInvalid&&this._isRelative&&n.call(this,t,"port")},get pathname(){return this._isInvalid?"":this._isRelative?"/"+this._path.join("/"):this._schemeData},set pathname(t){!this._isInvalid&&this._isRelative&&(this._path=[],n.call(this,t,"relative path start"))},get search(){return this._isInvalid||!this._query||"?"==this._query?"":this._query},set search(t){!this._isInvalid&&this._isRelative&&((this._query="?")==t[0]&&(t=t.slice(1)),n.call(this,t,"query"))},get hash(){return this._isInvalid||!this._fragment||"#"==this._fragment?"":this._fragment},set hash(t){this._isInvalid||((this._fragment="#")==t[0]&&(t=t.slice(1)),n.call(this,t,"fragment"))},get origin(){var t;if(this._isInvalid||!this._scheme)return"";switch(this._scheme){case"data":case"file":case"javascript":case"mailto":return"null"}return(t=this.host)?this._scheme+"://"+t:""}},(e=t.URL)&&(o.createObjectURL=function(){return e.createObjectURL.apply(e,arguments)},o.revokeObjectURL=function(t){e.revokeObjectURL(t)}),t.URL=o)}(self),"undefined"==typeof WeakMap&&function(){function t(){this.name="__st"+(1e9*Math.random()>>>0)+e+++"__"}var r=Object.defineProperty,e=Date.now()%1e9;t.prototype={set:function(t,e){var n=t[this.name];return n&&n[0]===t?n[1]=e:r(t,this.name,{value:[t,e],writable:!0}),this},get:function(t){var e;return(e=t[this.name])&&e[0]===t?e[1]:void 0},delete:function(t){var e=t[this.name];return!(!e||e[0]!==t||(e[0]=e[1]=void 0))},has:function(t){var e=t[this.name];return!!e&&e[0]===t}},window.WeakMap=t}(),function(t){function o(){p=!1;var t=f,r=(f=[],t.sort(function(t,e){return t.uid_-e.uid_}),!1);t.forEach(function(t){var e,n=t.takeRecords();(e=t).nodes_.forEach(function(t){t=s.get(t);t&&t.forEach(function(t){t.observer===e&&t.removeTransientObservers()})}),n.length&&(t.callback_(n,t),r=!0)}),r&&o()}function u(t,e){for(var n=t;n;n=n.parentNode){var r=s.get(n);if(r)for(var o=0;r.length>o;o++){var i=r[o],a=i.options;(n===t||a.subtree)&&(a=e(a))&&i.enqueue(a)}}}function e(t){this.callback_=t,this.nodes_=[],this.records_=[],this.uid_=++m}function r(t,e){this.type=t,this.target=e,this.addedNodes=[],this.removedNodes=[],this.previousSibling=null,this.nextSibling=null,this.attributeName=null,this.attributeNamespace=null,this.oldValue=null}function l(t,e){return v=new r(t,e)}function d(t){return g||((n=new r((e=v).type,e.target)).addedNodes=e.addedNodes.slice(),n.removedNodes=e.removedNodes.slice(),n.previousSibling=e.previousSibling,n.nextSibling=e.nextSibling,n.attributeName=e.attributeName,n.attributeNamespace=e.attributeNamespace,n.oldValue=e.oldValue,(g=n).oldValue=t,g);var e,n}function i(t,e){return t===e?t:g&&((e=t)===g||e===v)?g:null}function a(t,e,n){this.observer=t,this.target=e,this.options=n,this.transientObservedNodes=[]}var s,n,c,h,p,f,m,v,g;t.JsMutationObserver||(s=new WeakMap,h=/Trident|Edge/.test(navigator.userAgent)?setTimeout:window.setImmediate||(n=[],c=Math.random()+"",window.addEventListener("message",function(t){t.data===c&&(t=n,n=[],t.forEach(function(t){t()}))}),function(t){n.push(t),window.postMessage(c,"*")}),p=!1,f=[],m=0,e.prototype={observe:function(t,e){if(n=t,t=window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(n)||n,!e.childList&&!e.attributes&&!e.characterData||e.attributeOldValue&&!e.attributes||e.attributeFilter&&e.attributeFilter.length&&!e.attributes||e.characterDataOldValue&&!e.characterData)throw new SyntaxError;var n,r=s.get(t);r||s.set(t,r=[]);for(var o,i=0;r.length>i;i++)if(r[i].observer===this){(o=r[i]).removeListeners(),o.options=e;break}o||(o=new a(this,t,e),r.push(o),this.nodes_.push(t)),o.addListeners()},disconnect:function(){this.nodes_.forEach(function(t){for(var e=s.get(t),n=0;e.length>n;n++){var r=e[n];if(r.observer===this){r.removeListeners(),e.splice(n,1);break}}},this),this.records_=[]},takeRecords:function(){var t=this.records_;return this.records_=[],t}},a.prototype={enqueue:function(t){var e=this.observer.records_,n=e.length;if(0<e.length){var r=i(e[n-1],t);if(r)return void(e[n-1]=r)}else r=this.observer,f.push(r),p||(p=!0,h(o));e[n]=t},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(t){var e=this.options;e.attributes&&t.addEventListener("DOMAttrModified",this,!0),e.characterData&&t.addEventListener("DOMCharacterDataModified",this,!0),e.childList&&t.addEventListener("DOMNodeInserted",this,!0),(e.childList||e.subtree)&&t.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(t){var e=this.options;e.attributes&&t.removeEventListener("DOMAttrModified",this,!0),e.characterData&&t.removeEventListener("DOMCharacterDataModified",this,!0),e.childList&&t.removeEventListener("DOMNodeInserted",this,!0),(e.childList||e.subtree)&&t.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(t){var e;t!==this.target&&(this.addListeners_(t),this.transientObservedNodes.push(t),(e=s.get(t))||s.set(t,e=[]),e.push(this))},removeTransientObservers:function(){var t=this.transientObservedNodes;this.transientObservedNodes=[],t.forEach(function(t){this.removeListeners_(t);for(var e=s.get(t),n=0;e.length>n;n++)if(e[n]===this){e.splice(n,1);break}},this)},handleEvent:function(t){switch(t.stopImmediatePropagation(),t.type){case"DOMAttrModified":var e=t.attrName,n=t.relatedNode.namespaceURI,r=t.target,o=((i=new l("attributes",r)).attributeName=e,i.attributeNamespace=n,t.attrChange===MutationEvent.ADDITION?null:t.prevValue);u(r,function(t){return!t.attributes||t.attributeFilter&&t.attributeFilter.length&&-1===t.attributeFilter.indexOf(e)&&-1===t.attributeFilter.indexOf(n)?void 0:t.attributeOldValue?d(o):i});break;case"DOMCharacterDataModified":var i=l("characterData",r=t.target),o=t.prevValue;u(r,function(t){return t.characterData?t.characterDataOldValue?d(o):i:void 0});break;case"DOMNodeRemoved":this.addTransientObserver(t.target);case"DOMNodeInserted":var a,r=t.target,s="DOMNodeInserted"===t.type?(a=[r],[]):(a=[],[r]),c=r.previousSibling,r=r.nextSibling;(i=l("childList",t.target.parentNode)).addedNodes=a,i.removedNodes=s,i.previousSibling=c,i.nextSibling=r,u(t.relatedNode,function(t){return t.childList?i:void 0})}v=g=void 0}},t.JsMutationObserver=e,t.MutationObserver)||((t.MutationObserver=e)._isPolyfilled=!0)}(self),"undefined"==typeof HTMLTemplateElement&&function(){function n(t){switch(t){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case" ":return"&nbsp;"}}var r=document.implementation.createHTMLDocument("template"),o=!0,e=((HTMLTemplateElement=function(){}).prototype=Object.create(HTMLElement.prototype),HTMLTemplateElement.decorate=function(t){if(!t.content){t.content=r.createDocumentFragment();for(var e;e=t.firstChild;)t.content.appendChild(e);if(o)try{Object.defineProperty(t,"innerHTML",{get:function(){for(var t="",e=this.content.firstChild;e;e=e.nextSibling)t+=e.outerHTML||e.data.replace(i,n);return t},set:function(t){for(r.body.innerHTML=t,HTMLTemplateElement.bootstrap(r);this.content.firstChild;)this.content.removeChild(this.content.firstChild);for(;r.body.firstChild;)this.content.appendChild(r.body.firstChild)},configurable:!0})}catch(t){o=!1}HTMLTemplateElement.bootstrap(t.content)}},HTMLTemplateElement.bootstrap=function(t){for(var e,n=t.querySelectorAll("template"),r=0,o=n.length;r<o&&(e=n[r]);r++)HTMLTemplateElement.decorate(e)},document.addEventListener("DOMContentLoaded",function(){HTMLTemplateElement.bootstrap(document)}),document.createElement),i=(document.createElement=function(){"use strict";var t=e.apply(document,arguments);return"template"==t.localName&&HTMLTemplateElement.decorate(t),t},/[&\u00A0<>]/g)}(),function(){"use strict";var t,e;window.performance||(t=Date.now(),window.performance={now:function(){return Date.now()-t}}),window.requestAnimationFrame||(window.requestAnimationFrame=(e=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame)?function(t){return e(function(){t(performance.now())})}:function(t){return window.setTimeout(t,1e3/60)}),window.cancelAnimationFrame||(window.cancelAnimationFrame=window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||function(t){clearTimeout(t)}),(r=document.createEvent("Event")).initEvent("foo",!0,!0),r.preventDefault();r.defaultPrevented||(n=Event.prototype.preventDefault,Event.prototype.preventDefault=function(){this.cancelable&&(n.call(this),Object.defineProperty(this,"defaultPrevented",{get:function(){return!0},configurable:!0}))});var n,r=/Trident/.test(navigator.userAgent);(!window.CustomEvent||r&&"function"!=typeof window.CustomEvent)&&(window.CustomEvent=function(t,e){e=e||{};var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,Boolean(e.bubbles),Boolean(e.cancelable),e.detail),n},window.CustomEvent.prototype=window.Event.prototype),(!window.Event||r&&"function"!=typeof window.Event)&&(r=window.Event,window.Event=function(t,e){e=e||{};var n=document.createEvent("Event");return n.initEvent(t,Boolean(e.bubbles),Boolean(e.cancelable)),n},window.Event.prototype=r.prototype)}(window.WebComponents),window.HTMLImports=window.HTMLImports||{flags:{}},function(t){function e(t,e){(function t(e,n){{var r;o(n)?e&&e():(r=function(){"complete"!==n.readyState&&n.readyState!==s||(n.removeEventListener(c,r),t(e,n))},n.addEventListener(c,r))}})(function(){!function(t,e){function n(){a==s&&t&&t({allImports:i,loadedImports:c,errorImports:u})}function r(t){h(t),c.push(this),a++,n()}function o(){u.push(this),a++,n()}var i=e.querySelectorAll("link[rel=import]"),a=0,s=i.length,c=[],u=[];if(s)for(var l,d=0;d<s&&(l=i[d]);d++)!function(t){return p?t.__loaded||t.import&&"loading"!==t.import.readyState:t.__importParsed}(l)?(l.addEventListener("load",r),l.addEventListener("error",o)):(c.push(this),a++,n());else n()}(t,e)},e=e||i)}function o(t){return"complete"===t.readyState||t.readyState===s}function h(t){t.target.__loaded=!0}function u(t){t.import?h({target:t}):(t.addEventListener("load",h),t.addEventListener("error",h))}function n(t){return r?window.ShadowDOMPolyfill.wrapIfNeeded(t):t}var p=Boolean("import"in document.createElement("link")),r=Boolean(window.ShadowDOMPolyfill),i=n(document),a={get:function(){var t=window.HTMLImports.currentScript||document.currentScript||("complete"!==document.readyState?document.scripts[document.scripts.length-1]:null);return n(t)},configurable:!0},a=(Object.defineProperty(document,"_currentScript",a),Object.defineProperty(i,"_currentScript",a),/Trident/.test(navigator.userAgent)),s=a?"complete":"interactive",c="readystatechange";if(p&&(new MutationObserver(function(t){for(var e,n=0,r=t.length;n<r&&(e=t[n]);n++)if(e.addedNodes){o=void 0;i=void 0;s=void 0;c=void 0;a=void 0;var o=e.addedNodes;for(var i,a,s=0,c=o.length;s<c&&(i=o[s]);s++)"link"===(a=i).localName&&"import"===a.rel&&u(i)}}).observe(document.head,{childList:!0}),"loading"===document.readyState))for(var l,d=document.querySelectorAll("link[rel=import]"),f=0,m=d.length;f<m&&(l=d[f]);f++)u(l);e(function(t){window.HTMLImports.ready=!0,window.HTMLImports.readyTime=(new Date).getTime();var e=i.createEvent("CustomEvent");e.initCustomEvent("HTMLImportsLoaded",!0,!0,t),i.dispatchEvent(e)}),t.IMPORT_LINK_TYPE="import",t.useNative=p,t.rootDocument=i,t.whenReady=e,t.isIE=a}(window.HTMLImports),function(e){var n=[];e.addModule=function(t){n.push(t)},e.initializeModules=function(){n.forEach(function(t){t(e)})}}(window.HTMLImports),window.HTMLImports.addModule(function(t){var r=/(url\()([^)]*)(\))/g,o=/(@import[\s]+(?!url\())([^;]*)(;)/g;t.path={resolveUrlsInStyle:function(t,e){var n=t.ownerDocument.createElement("a");return t.textContent=this.resolveUrlsInCssText(t.textContent,e,n),t},resolveUrlsInCssText:function(t,e,n){t=this.replaceUrls(t,n,e,r);return this.replaceUrls(t,n,e,o)},replaceUrls:function(t,o,i,e){return t.replace(e,function(t,e,n,r){n=n.replace(/["']/g,"");return i&&(n=new URL(n,i).href),o.href=n,e+"'"+(n=o.href)+"'"+r})}}}),window.HTMLImports.addModule(function(e){var a={async:!0,ok:function(t){return 200<=t.status&&t.status<300||304===t.status||0===t.status},load:function(t,r,o){var i=new XMLHttpRequest;return(e.flags.debug||e.flags.bust)&&(t+="?"+Math.random()),i.open("GET",t,a.async),i.addEventListener("readystatechange",function(t){if(4===i.readyState){var e=null;try{var n=i.getResponseHeader("Location");n&&(e="/"===n.substr(0,1)?location.origin+n:n)}catch(t){console.error(t.message)}r.call(o,!a.ok(i)&&i,i.response||i.responseText,e)}}),i.send(),i},loadDocument:function(t,e,n){this.load(t,e,n).responseType="document"}};e.xhr=a}),window.HTMLImports.addModule(function(t){function e(t,e){this.cache={},this.onload=t,this.oncomplete=e,this.inflight=0,this.pending={}}var i=t.xhr,a=t.flags;e.prototype={addNodes:function(t){this.inflight+=t.length;for(var e,n=0,r=t.length;n<r&&(e=t[n]);n++)this.require(e);this.checkDone()},addNode:function(t){this.inflight++,this.require(t),this.checkDone()},require:function(t){var e=t.src||t.href;t.__nodeUrl=e,this.dedupe(e,t)||this.fetch(e,t)},dedupe:function(t,e){return this.pending[t]?(this.pending[t].push(e),!0):this.cache[t]?(this.onload(t,e,this.cache[t]),this.tail(),!0):!(this.pending[t]=[e])},fetch:function(r,o){var t,e,n;a.load&&console.log("fetch",r,o),r?r.match(/^data:/)?(t=(n=r.split(","))[0],e=n[1],e=(-1<t.indexOf(";base64")?atob:decodeURIComponent)(e),setTimeout(function(){this.receive(r,o,null,e)}.bind(this),0)):(n=function(t,e,n){this.receive(r,o,t,e,n)}.bind(this),i.load(r,n)):setTimeout(function(){this.receive(r,o,{error:"href must be specified"},null)}.bind(this),0)},receive:function(t,e,n,r,o){this.cache[t]=r;for(var i,a=this.pending[t],s=0,c=a.length;s<c&&(i=a[s]);s++)this.onload(t,i,r,n,o),this.tail();this.pending[t]=null},tail:function(){--this.inflight,this.checkDone()},checkDone:function(){this.inflight||this.oncomplete()}},t.Loader=e}),window.HTMLImports.addModule(function(t){function e(t){this.addCallback=t,this.mo=new MutationObserver(this.handler.bind(this))}e.prototype={handler:function(t){for(var e,n=0,r=t.length;n<r&&(e=t[n]);n++)"childList"===e.type&&e.addedNodes.length&&this.addedNodes(e.addedNodes)},addedNodes:function(t){this.addCallback&&this.addCallback(t);for(var e,n=0,r=t.length;n<r&&(e=t[n]);n++)e.children&&e.children.length&&this.addedNodes(e.children)},observe:function(t){this.mo.observe(t,{childList:!0,subtree:!0})}},t.Observer=e}),window.HTMLImports.addModule(function(n){function a(t){return"link"===t.localName&&t.rel===s}function r(t){t=t.textContent+function(t){var e=t.ownerDocument,t=(e.__importedScripts=e.__importedScripts||0,t.ownerDocument.baseURI),n=e.__importedScripts?"-"+e.__importedScripts:"";return e.__importedScripts++,"\n//# sourceURL="+t+n+".js\n"}(t);return"data:text/javascript;charset=utf-8,"+encodeURIComponent(t)}var o=n.path,e=n.rootDocument,i=n.flags,u=n.isIE,s=n.IMPORT_LINK_TYPE,t="link[rel="+s+"]",c={documentSelectors:t,importsSelectors:[t,"link[rel=stylesheet]:not([type])","style:not([type])","script:not([type])",'script[type="application/javascript"]','script[type="text/javascript"]'].join(","),map:{link:"parseLink",script:"parseScript",style:"parseStyle"},dynamicElements:[],parseNext:function(){var t=this.nextToParse();t&&this.parse(t)},parse:function(t){var e;this.isParsed(t)?i.parse&&console.log("[%s] is already parsed",t.localName):(e=this[this.map[t.localName]])&&(this.markParsing(t),e.call(this,t))},parseDynamic:function(t,e){this.dynamicElements.push(t),e||this.parseNext()},markParsing:function(t){i.parse&&console.log("parsing",t),this.parsingElement=t},markParsingComplete:function(t){t.__importParsed=!0,this.markDynamicParsingComplete(t),t.__importElement&&(t.__importElement.__importParsed=!0,this.markDynamicParsingComplete(t.__importElement)),this.parsingElement=null,i.parse&&console.log("completed",t)},markDynamicParsingComplete:function(t){t=this.dynamicElements.indexOf(t);0<=t&&this.dynamicElements.splice(t,1)},parseImport:function(t){if(t.import=t.__doc,window.HTMLImports.__importsParsingHook&&window.HTMLImports.__importsParsingHook(t),t.import&&(t.import.__importParsed=!0),this.markParsingComplete(t),t.__resource&&!t.__error?t.dispatchEvent(new CustomEvent("load",{bubbles:!1})):t.dispatchEvent(new CustomEvent("error",{bubbles:!1})),t.__pending)for(var e;t.__pending.length;)(e=t.__pending.shift())&&e({target:t});this.parseNext()},parseLink:function(t){a(t)?this.parseImport(t):(t.href=t.href,this.parseGeneric(t))},parseStyle:function(t){var e,n,r=t;(n=(e=t).ownerDocument.createElement("style")).textContent=e.textContent,o.resolveUrlsInStyle(n),t=n,(r.__appliedElement=t).__importElement=r,this.parseGeneric(t)},parseGeneric:function(t){this.trackElement(t),this.addElementToDocument(t)},rootImportForElement:function(t){for(var e=t;e.ownerDocument.__importLink;)e=e.ownerDocument.__importLink;return e},addElementToDocument:function(t){var e=this.rootImportForElement(t.__importElement||t);e.parentNode.insertBefore(t,e)},trackElement:function(e,n){function r(t){e.removeEventListener("load",r),e.removeEventListener("error",r),n&&n(t),o.markParsingComplete(e),o.parseNext()}var o=this;if(e.addEventListener("load",r),e.addEventListener("error",r),u&&"style"===e.localName){var t=!1;if(-1==e.textContent.indexOf("@import"))t=!0;else if(e.sheet)for(var i,t=!0,a=e.sheet.cssRules,s=a?a.length:0,c=0;c<s&&(i=a[c]);c++)i.type===CSSRule.IMPORT_RULE&&(t=t&&Boolean(i.styleSheet));t&&setTimeout(function(){e.dispatchEvent(new CustomEvent("load",{bubbles:!1}))})}},parseScript:function(t){var e=document.createElement("script");e.__importElement=t,e.src=t.src||r(t),n.currentScript=t,this.trackElement(e,function(){e.parentNode&&e.parentNode.removeChild(e),n.currentScript=null}),this.addElementToDocument(e)},nextToParse:function(){return this._mayParse=[],!this.parsingElement&&(this.nextToParseInDoc(e)||this.nextToParseDynamic())},nextToParseInDoc:function(t,e){if(t&&this._mayParse.indexOf(t)<0){this._mayParse.push(t);for(var n,r=t.querySelectorAll(this.parseSelectorsForNode(t)),o=0,i=r.length;o<i&&(n=r[o]);o++)if(!this.isParsed(n))return this.hasResource(n)?a(n)?this.nextToParseInDoc(n.__doc,n):n:void 0}return e},nextToParseDynamic:function(){return this.dynamicElements[0]},parseSelectorsForNode:function(t){return(t.ownerDocument||t)===e?this.documentSelectors:this.importsSelectors},isParsed:function(t){return t.__importParsed},needsDynamicParsing:function(t){return 0<=this.dynamicElements.indexOf(t)},hasResource:function(t){return!a(t)||void 0!==t.__doc}};n.parser=c,n.IMPORT_SELECTOR=t}),window.HTMLImports.addModule(function(t){function s(t,e){var n=document.implementation.createHTMLDocument(u),r=(n._URL=e,n.createElement("base")),e=(r.setAttribute("href",e),n.baseURI||Object.getOwnPropertyDescriptor(n,"baseURI")||Object.defineProperty(n,"baseURI",{value:e}),n.createElement("meta"));return e.setAttribute("charset","utf-8"),n.head.appendChild(e),n.head.appendChild(r),n.body.innerHTML=t,window.HTMLTemplateElement&&HTMLTemplateElement.bootstrap&&HTMLTemplateElement.bootstrap(n),n}var c=t.flags,u=t.IMPORT_LINK_TYPE,e=t.IMPORT_SELECTOR,n=t.rootDocument,r=t.Loader,o=t.Observer,l=t.parser,e={documents:{},documentPreloadSelectors:e,importsPreloadSelectors:[e].join(","),loadNode:function(t){i.addNode(t)},loadSubtree:function(t){t=this.marshalNodes(t);i.addNodes(t)},marshalNodes:function(t){return t.querySelectorAll(this.loadSelectorsForNode(t))},loadSelectorsForNode:function(t){return(t.ownerDocument||t)===n?this.documentPreloadSelectors:this.importsPreloadSelectors},loaded:function(t,e,n,r,o){var i,a;c.load&&console.log("loaded",t,e),e.__resource=n,e.__error=r,a=u,"link"===(i=i=e).localName&&i.getAttribute("rel")===a&&(void 0===(i=this.documents[t])&&((i=r?null:s(n,o||t))&&(i.__importLink=e,this.bootDocument(i)),this.documents[t]=i),e.__doc=i),l.parseNext()},bootDocument:function(t){this.loadSubtree(t),this.observer.observe(t),l.parseNext()},loadedAll:function(){l.parseNext()}},i=new r(e.loaded.bind(e),e.loadedAll.bind(e));e.observer=new o,document.baseURI||(r={get:function(){var t=document.querySelector("base");return(t||window.location).href},configurable:!0},Object.defineProperty(document,"baseURI",r),Object.defineProperty(n,"baseURI",r)),t.importer=e,t.importLoader=i}),window.HTMLImports.addModule(function(t){var s=t.parser,c=t.importer,t={added:function(t){for(var e,n,r,o,i=0,a=t.length;i<a&&(o=t[i]);i++)e||(e=o.ownerDocument,n=s.isParsed(e)),(r=this.shouldLoadNode(o))&&c.loadNode(o),this.shouldParseNode(o)&&n&&s.parseDynamic(o,r)},shouldLoadNode:function(t){return 1===t.nodeType&&e.call(t,c.loadSelectorsForNode(t))},shouldParseNode:function(t){return 1===t.nodeType&&e.call(t,s.parseSelectorsForNode(t))}},e=(c.observer.addCallback=t.added.bind(t),HTMLElement.prototype.matches||HTMLElement.prototype.matchesSelector||HTMLElement.prototype.webkitMatchesSelector||HTMLElement.prototype.mozMatchesSelector||HTMLElement.prototype.msMatchesSelector)}),function(t){function e(){window.HTMLImports.importer.bootDocument(n)}var n,r=t.initializeModules;t.isIE,t.useNative||(r(),n=t.rootDocument,"complete"===document.readyState||"interactive"===document.readyState&&!window.attachEvent?e():document.addEventListener("DOMContentLoaded",e))}(window.HTMLImports),window.CustomElements=window.CustomElements||{flags:{}},function(e){var t=e.flags,n=[];e.addModule=function(t){n.push(t)},e.initializeModules=function(){n.forEach(function(t){t(e)})},e.hasNative=Boolean(document.registerElement),e.isIE=/Trident/.test(navigator.userAgent),e.useNative=!t.register&&e.hasNative&&!window.ShadowDOMPolyfill&&(!window.HTMLImports||window.HTMLImports.useNative)}(window.CustomElements),window.CustomElements.addModule(function(t){function r(t,e){(function t(e,n,r){var o=e.firstElementChild;if(!o)for(o=e.firstChild;o&&o.nodeType!==Node.ELEMENT_NODE;)o=o.nextSibling;for(;o;)!0!==n(o,r)&&t(o,n,r),o=o.nextElementSibling;return null})(t,function(t){return!!e(t)||void n(t,e)}),n(t,e)}function n(t,e){for(var n=t.shadowRoot;n;)r(n,e),n=n.olderShadowRoot}var c=window.HTMLImports?window.HTMLImports.IMPORT_LINK_TYPE:"none";t.forDocumentTree=function(t,e){!function t(e,n,r){if(e=window.wrap(e),!(0<=r.indexOf(e))){r.push(e);for(var o,i=e.querySelectorAll("link[rel="+c+"]"),a=0,s=i.length;a<s&&(o=i[a]);a++)o.import&&t(o.import,n,r);n(e)}}(t,e,[])},t.forSubtree=r}),window.CustomElements.addModule(function(n){function a(t,e){return r(t,e)||o(t,e)}function r(t,e){return!!n.upgrade(t,e)||void(e&&s(t))}function o(t,e){m(t,function(t){return!!r(t,e)||void 0})}function e(t){b.push(t),y||(y=!0,setTimeout(i))}function i(){y=!1;for(var t,e=b,n=0,r=e.length;n<r&&(t=e[n]);n++)t();b=[]}function s(t){g?e(function(){c(t)}):c(t)}function c(t){t.__upgraded__&&!t.__attached&&(t.__attached=!0,t.attachedCallback)&&t.attachedCallback()}function u(t){g?e(function(){l(t)}):l(t)}function l(t){t.__upgraded__&&t.__attached&&(t.__attached=!1,t.detachedCallback)&&t.detachedCallback()}function d(t,e){if(f.dom){var n=e[0];if(n&&"childList"===n.type&&n.addedNodes&&n.addedNodes){for(var r=n.addedNodes[0];r&&r!==document&&!r.host;)r=r.parentNode;var o=(o=r&&(r.URL||r._URL||r.host&&r.host.localName)||"").split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",e.length,o||"")}var i=function(t){for(var e=t,n=window.wrap(document);e;){if(e==n)return!0;e=e.parentNode||e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.host}}(t);e.forEach(function(t){"childList"===t.type&&(w(t.addedNodes,function(t){t.localName&&a(t,i)}),w(t.removedNodes,function(t){t.localName&&(u(t=t),m(t,function(t){u(t)}))}))}),f.dom&&console.groupEnd()}function h(t){var e;t.__observer||((e=new MutationObserver(d.bind(this,t))).observe(t,{childList:!0,subtree:!0}),t.__observer=e)}function p(t){t=window.wrap(t),f.dom&&console.group("upgradeDocument: ",t.baseURI.split("/").pop()),a(t,t===window.wrap(document)),h(t),f.dom&&console.groupEnd()}var f=n.flags,m=n.forSubtree,v=n.forDocumentTree,g=window.MutationObserver._isPolyfilled&&f["throttle-attached"],y=(n.hasPolyfillMutations=g,n.hasThrottledAttached=g,!1),b=[],w=Array.prototype.forEach.call.bind(Array.prototype.forEach),_=Element.prototype.createShadowRoot;_&&(Element.prototype.createShadowRoot=function(){var t=_.call(this);return window.CustomElements.watchShadow(this),t}),n.watchShadow=function(t){if(t.shadowRoot&&!t.shadowRoot.__watched){f.dom&&console.log("watching shadow-root for: ",t.localName);for(var e=t.shadowRoot;e;)h(e),e=e.olderShadowRoot}},n.upgradeDocumentTree=function(t){v(t,p)},n.upgradeDocument=p,n.upgradeSubtree=o,n.upgradeAll=a,n.attached=s,n.takeRecords=function(t){for(t=(t=window.wrap(t))||window.wrap(document);t.parentNode;)t=t.parentNode;var e=t.__observer;e&&(d(t,e.takeRecords()),i())}}),window.CustomElements.addModule(function(o){function i(t,e,n){return a.upgrade&&console.group("upgrade:",t.localName),e.is&&t.setAttribute("is",e.is),r(t,e),t.__upgraded__=!0,(e=t).createdCallback&&e.createdCallback(),n&&o.attached(t),o.upgradeSubtree(t,n),a.upgrade&&console.groupEnd(),t}function r(t,e){if(!Object.__proto__)for(var n=t,r=e.prototype,o=e.native,i={},a=r;a!==o&&a!==HTMLElement.prototype;){for(var s,c=Object.getOwnPropertyNames(a),u=0;s=c[u];u++)i[s]||(Object.defineProperty(n,s,Object.getOwnPropertyDescriptor(a,s)),i[s]=1);a=Object.getPrototypeOf(a)}t.__proto__=e.prototype}var a=o.flags;o.upgrade=function(t,e){if("template"===t.localName&&window.HTMLTemplateElement&&HTMLTemplateElement.decorate&&HTMLTemplateElement.decorate(t),!t.__upgraded__&&t.nodeType===Node.ELEMENT_NODE){var n=t.getAttribute("is"),r=o.getRegisteredDefinition(t.localName)||o.getRegisteredDefinition(n);if(r&&(n&&r.tag==t.localName||!n&&!r.extends))return i(t,r,e)}},o.upgradeWithDefinition=i,o.implementPrototype=r}),window.CustomElements.addModule(function(f){function m(t,e,n){t=t.toLowerCase();var r=this.getAttribute(t),o=(n.apply(this,arguments),this.getAttribute(t));this.attributeChangedCallback&&o!==r&&this.attributeChangedCallback(t,r,o)}function v(t){return t?w[t.toLowerCase()]:void 0}function o(t,e){t=t&&t.toLowerCase();var n,r=v((e=e&&e.toLowerCase())||t);if(r){if(t==r.tag&&e==r.is)return new r.ctor;if(!e&&!r.is)return new r.ctor}return e?(n=o(t)).setAttribute("is",e):(n=_(t),0<=t.indexOf("-")&&i(n,HTMLElement)),n}function t(t,e){var n=t[e];t[e]=function(){var t=n.apply(this,arguments);return r(t),t}}var n,e=f.isIE,g=f.upgradeDocumentTree,r=f.upgradeAll,y=f.upgradeWithDefinition,i=f.implementPrototype,a=f.useNative,b=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"],w={},_=document.createElement.bind(document),s=document.createElementNS.bind(document),a=Object.__proto__||a?function(t,e){return t instanceof e}:function(t,e){if(t instanceof e)return!0;for(var n=t;n;){if(n===e.prototype)return!0;n=n.__proto__}return!1};t(Node.prototype,"cloneNode"),t(document,"importNode"),e&&(n=document.importNode,document.importNode=function(){var t,e=n.apply(document,arguments);return e.nodeType==e.DOCUMENT_FRAGMENT_NODE?((t=document.createDocumentFragment()).appendChild(e),t):e}),document.registerElement=function(t,e){var n,r,o,e=e||{};if(!t)throw Error("document.registerElement: first argument `name` must not be empty");if(t.indexOf("-")<0)throw Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+t+"'.");if(function(t){for(var e=0;b.length>e;e++)if(t===b[e])return 1}(t))throw Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '"+t+"'. The type name is invalid.");if(v(t))throw Error("DuplicateDefinitionError: a type with name '"+t+"' is already registered");e.prototype||(e.prototype=Object.create(HTMLElement.prototype)),e.__name=t.toLowerCase(),e.lifecycle=e.lifecycle||{},e.ancestry=function t(e){e=v(e);return e?t(e.extends).concat([e]):[]}(e.extends);for(var i,a=e,s=a.extends,c=0;i=a.ancestry[c];c++)s=i.is&&i.tag;a.tag=s||a.__name,s&&(a.is=a.__name);var t=e;if(!Object.__proto__){var u=HTMLElement.prototype;t.is&&(p=document.createElement(t.tag),u=Object.getPrototypeOf(p));for(var l,d=t.prototype,h=!1;d;)d==u&&(h=!0),(l=Object.getPrototypeOf(d))&&(d.__proto__=l),d=l;h||console.warn(t.tag+" prototype not found in prototype chain for "+t.is),t.native=u}var p=e.prototype;return p.setAttribute._polyfilled||(n=p.setAttribute,p.setAttribute=function(t,e){m.call(this,t,e,n)},r=p.removeAttribute,p.removeAttribute=function(t){m.call(this,t,null,r)},p.setAttribute._polyfilled=!0),t=e.__name,(w[t]=e).ctor=(o=e,function(){return y(_((t=o).tag),t);var t}),e.ctor.prototype=e.prototype,e.prototype.constructor=e.ctor,f.ready&&g(document),e.ctor},document.createElement=o,document.createElementNS=function(t,e,n){return"http://www.w3.org/1999/xhtml"===t?o(e,n):s(t,e)},f.registry=w,f.instanceof=a,f.reservedTagList=b,f.getRegisteredDefinition=v,document.register=document.registerElement}),function(t){function e(){o(window.wrap(document)),window.CustomElements.ready=!0,(window.requestAnimationFrame||function(t){setTimeout(t,16)})(function(){setTimeout(function(){window.CustomElements.readyTime=Date.now(),window.HTMLImports&&(window.CustomElements.elapsed=window.CustomElements.readyTime-window.HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})})}var n=t.useNative,r=t.initializeModules,o=(t.isIE,n?(t.watchShadow=n=function(){},t.upgrade=n,t.upgradeAll=n,t.upgradeDocumentTree=n,t.upgradeSubtree=n,t.takeRecords=n,t.instanceof=function(t,e){return t instanceof e}):r(),t.upgradeDocumentTree),i=t.upgradeDocument;window.wrap||(window.ShadowDOMPolyfill?(window.wrap=window.ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=window.ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(t){return t}),window.HTMLImports&&(window.HTMLImports.__importsParsingHook=function(t){t.import&&i(wrap(t.import))}),"complete"!==document.readyState&&!t.flags.eager&&("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready)?(n=window.HTMLImports&&!window.HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded",window.addEventListener(n,e)):e()}(window.CustomElements),function(){var t=document.createElement("style"),e=(t.textContent="body {transition: opacity ease-in 0.2s; } \nbody[unresolved] {opacity: 0; display: block; overflow: hidden; position: relative; } \n",document.querySelector("head"));e.insertBefore(t,e.firstChild)}(window.WebComponents),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.PointerEventsPolyfill=e()}(this,function(){"use strict";function t(){this.array=[],this.size=0}function e(t,e,n,r){this.addCallback=t.bind(r),this.removeCallback=e.bind(r),this.changedCallback=n.bind(r),_&&(this.observer=new _(this.mutationWatcher.bind(this)))}function n(t){return"body /shadow-deep/ "+r(t)}function r(t){return'[touch-action="'+t+'"]'}function o(t){return"{ -ms-touch-action: "+t+"; touch-action: "+t+"; touch-action-delay: none; }"}function i(t){if(!m.pointermap.has(t))throw Error("InvalidPointerId")}var a=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","pageX","pageY"],s=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0],c=function(t,e){e=e||Object.create(null);var n=document.createEvent("Event");n.initEvent(t,e.bubbles||!1,e.cancelable||!1);for(var r,o=2;o<a.length;o++)n[r=a[o]]=e[r]||s[o];return n.buttons=e.buttons||0,t=e.pressure||(n.buttons?.5:0),n.x=n.clientX,n.y=n.clientY,n.pointerId=e.pointerId||0,n.width=e.width||0,n.height=e.height||0,n.pressure=t,n.tiltX=e.tiltX||0,n.tiltY=e.tiltY||0,n.pointerType=e.pointerType||"",n.hwTimestamp=e.hwTimestamp||0,n.isPrimary=e.isPrimary||!1,n},u=window.Map&&window.Map.prototype.forEach?Map:t,l=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","buttons","pointerId","width","height","pressure","tiltX","tiltY","pointerType","hwTimestamp","isPrimary","type","target","currentTarget","which","pageX","pageY","timeStamp"],d=[!(t.prototype={set:function(t,e){return void 0===e?this.delete(t):(this.has(t)||this.size++,void(this.array[t]=e))},has:function(t){return void 0!==this.array[t]},delete:function(t){this.has(t)&&(delete this.array[t],this.size--)},get:function(t){return this.array[t]},clear:function(){this.array.length=0,this.size=0},forEach:function(n,r){return this.array.forEach(function(t,e){n.call(r,t,e,this)},this)}}),!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0,0,0,0,0,0,"",0,!1,"",null,null,0,0,0,0],h={pointerover:1,pointerout:1,pointerenter:1,pointerleave:1},p="undefined"!=typeof SVGElementInstance,f={pointermap:new u,eventMap:Object.create(null),captureInfo:Object.create(null),eventSources:Object.create(null),eventSourceList:[],registerSource:function(t,e){var n=e,e=n.events;e&&(e.forEach(function(t){n[t]&&(this.eventMap[t]=n[t].bind(n))},this),this.eventSources[t]=n,this.eventSourceList.push(n))},register:function(t){for(var e,n=this.eventSourceList.length,r=0;r<n&&(e=this.eventSourceList[r]);r++)e.register.call(e,t)},unregister:function(t){for(var e,n=this.eventSourceList.length,r=0;r<n&&(e=this.eventSourceList[r]);r++)e.unregister.call(e,t)},contains:function(t,e){try{return t.contains(e)}catch(t){return!1}},down:function(t){t.bubbles=!0,this.fireEvent("pointerdown",t)},move:function(t){t.bubbles=!0,this.fireEvent("pointermove",t)},up:function(t){t.bubbles=!0,this.fireEvent("pointerup",t)},enter:function(t){t.bubbles=!1,this.fireEvent("pointerenter",t)},leave:function(t){t.bubbles=!1,this.fireEvent("pointerleave",t)},over:function(t){t.bubbles=!0,this.fireEvent("pointerover",t)},out:function(t){t.bubbles=!0,this.fireEvent("pointerout",t)},cancel:function(t){t.bubbles=!0,this.fireEvent("pointercancel",t)},leaveOut:function(t){this.out(t),this.contains(t.target,t.relatedTarget)||this.leave(t)},enterOver:function(t){this.over(t),this.contains(t.target,t.relatedTarget)||this.enter(t)},eventHandler:function(t){var e;t._handledByPE||(e=t.type,(e=this.eventMap&&this.eventMap[e])&&e(t),t._handledByPE=!0)},listen:function(e,t){t.forEach(function(t){this.addEvent(e,t)},this)},unlisten:function(e,t){t.forEach(function(t){this.removeEvent(e,t)},this)},addEvent:function(t,e){t.addEventListener(e,this.boundHandler)},removeEvent:function(t,e){t.removeEventListener(e,this.boundHandler)},makeEvent:function(t,e){this.captureInfo[e.pointerId]&&(e.relatedTarget=null);t=new c(t,e);return e.preventDefault&&(t.preventDefault=e.preventDefault),t._target=t._target||e.target,t},fireEvent:function(t,e){t=this.makeEvent(t,e);return this.dispatchEvent(t)},cloneEvent:function(t){for(var e,n=Object.create(null),r=0;r<l.length;r++)n[e=l[r]]=t[e]||d[r],!p||"target"!==e&&"relatedTarget"!==e||n[e]instanceof SVGElementInstance&&(n[e]=n[e].correspondingUseElement);return t.preventDefault&&(n.preventDefault=function(){t.preventDefault()}),n},getTarget:function(t){var e=this.captureInfo[t.pointerId];return e?t._target!==e&&t.type in h?void 0:e:t._target},setCapture:function(t,e){this.captureInfo[t]&&this.releaseCapture(t),this.captureInfo[t]=e;var n=document.createEvent("Event");n.initEvent("gotpointercapture",!0,!1),n.pointerId=t,this.implicitRelease=this.releaseCapture.bind(this,t),document.addEventListener("pointerup",this.implicitRelease),document.addEventListener("pointercancel",this.implicitRelease),n._target=e,this.asyncDispatchEvent(n)},releaseCapture:function(t){var e,n=this.captureInfo[t];n&&((e=document.createEvent("Event")).initEvent("lostpointercapture",!0,!1),e.pointerId=t,this.captureInfo[t]=void 0,document.removeEventListener("pointerup",this.implicitRelease),document.removeEventListener("pointercancel",this.implicitRelease),e._target=n,this.asyncDispatchEvent(e))},dispatchEvent:function(t){var e=this.getTarget(t);return e?e.dispatchEvent(t):void 0},asyncDispatchEvent:function(t){requestAnimationFrame(this.dispatchEvent.bind(this,t))}},m=(f.boundHandler=f.eventHandler.bind(f),f),v={shadow:function(t){return t?t.shadowRoot||t.webkitShadowRoot:void 0},canTarget:function(t){return t&&Boolean(t.elementFromPoint)},targetingShadow:function(t){t=this.shadow(t);return this.canTarget(t)?t:void 0},olderShadow:function(t){var e=t.olderShadowRoot;return e||(t=t.querySelector("shadow"))&&(e=t.olderShadowRoot),e},allShadows:function(t){for(var e=[],n=this.shadow(t);n;)e.push(n),n=this.olderShadow(n);return e},searchRoot:function(t,e,n){if(t){for(var r,o,t=t.elementFromPoint(e,n),i=this.targetingShadow(t);i;){if(r=i.elementFromPoint(e,n))return o=this.targetingShadow(r),this.searchRoot(o,e,n)||r;i=this.olderShadow(i)}return t}},owner:function(t){for(var e=t;e.parentNode;)e=e.parentNode;return e=e.nodeType!==Node.DOCUMENT_NODE&&e.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?document:e},findTarget:function(t){var e=t.clientX,n=t.clientY,t=this.owner(t.target);return t.elementFromPoint(e,n)||(t=document),this.searchRoot(t,e,n)}},g=Array.prototype.forEach.call.bind(Array.prototype.forEach),y=Array.prototype.map.call.bind(Array.prototype.map),b=Array.prototype.slice.call.bind(Array.prototype.slice),w=Array.prototype.filter.call.bind(Array.prototype.filter),_=window.MutationObserver||window.WebKitMutationObserver,R={subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0,attributeFilter:["touch-action"]},f=(e.prototype={watchSubtree:function(t){this.observer&&v.canTarget(t)&&this.observer.observe(t,R)},enableOnSubtree:function(t){this.watchSubtree(t),t===document&&"complete"!==document.readyState?this.installOnLoad():this.installNewSubtree(t)},installNewSubtree:function(t){g(this.findElements(t),this.addElement,this)},findElements:function(t){return t.querySelectorAll?t.querySelectorAll("[touch-action]"):[]},removeElement:function(t){this.removeCallback(t)},addElement:function(t){this.addCallback(t)},elementChanged:function(t,e){this.changedCallback(t,e)},concatLists:function(t,e){return t.concat(b(e))},installOnLoad:function(){document.addEventListener("readystatechange",function(){"complete"===document.readyState&&this.installNewSubtree(document)}.bind(this))},isElement:function(t){return t.nodeType===Node.ELEMENT_NODE},flattenMutationTree:function(t){var e=y(t,this.findElements,this);return e.push(w(t,this.isElement)),e.reduce(this.concatLists,[])},mutationWatcher:function(t){t.forEach(this.mutationHandler,this)},mutationHandler:function(t){"childList"===t.type?(this.flattenMutationTree(t.addedNodes).forEach(this.addElement,this),this.flattenMutationTree(t.removedNodes).forEach(this.removeElement,this)):"attributes"===t.type&&this.elementChanged(t.target,t.oldValue)}},e),E=["none","auto","pan-x","pan-y",{rule:"pan-x pan-y",selectors:["pan-x pan-y","pan-y pan-x"]}],T="",C=window.PointerEvent||window.MSPointerEvent,L=!window.ShadowDOMPolyfill&&document.head.createShadowRoot,M=m.pointermap,S=[1,4,2,8,16],O=!1;try{O=1===new MouseEvent("test",{buttons:1}).buttons}catch(t){}var N,P={POINTER_ID:1,POINTER_TYPE:"mouse",events:["mousedown","mousemove","mouseup","mouseover","mouseout"],register:function(t){m.listen(t,this.events)},unregister:function(t){m.unlisten(t,this.events)},lastTouches:[],isEventSimulatedFromTouch:function(t){for(var e,n=this.lastTouches,r=t.clientX,o=t.clientY,i=0,a=n.length;i<a&&(e=n[i]);i++){var s=Math.abs(r-e.x),c=Math.abs(o-e.y);if(s<=25&&c<=25)return!0}},prepareEvent:function(t){var e=m.cloneEvent(t),n=e.preventDefault;return e.preventDefault=function(){t.preventDefault(),n()},e.pointerId=this.POINTER_ID,e.isPrimary=!0,e.pointerType=this.POINTER_TYPE,e},prepareButtonsForMove:function(t,e){var n=M.get(this.POINTER_ID);t.buttons=n?n.buttons:0,e.buttons=t.buttons},mousedown:function(t){var e,n;this.isEventSimulatedFromTouch(t)||(e=M.get(this.POINTER_ID),n=this.prepareEvent(t),O||(n.buttons=S[n.button],e&&(n.buttons|=e.buttons),t.buttons=n.buttons),M.set(this.POINTER_ID,t),e?m.move(n):m.down(n))},mousemove:function(t){var e;this.isEventSimulatedFromTouch(t)||(e=this.prepareEvent(t),O||this.prepareButtonsForMove(e,t),m.move(e))},mouseup:function(t){var e,n,r;this.isEventSimulatedFromTouch(t)||(e=M.get(this.POINTER_ID),n=this.prepareEvent(t),O||(r=S[n.button],n.buttons=e?e.buttons&~r:0,t.buttons=n.buttons),M.set(this.POINTER_ID,t),0===n.buttons||n.buttons===S[n.button]?(this.cleanupMouse(),m.up(n)):m.move(n))},mouseover:function(t){var e;this.isEventSimulatedFromTouch(t)||(e=this.prepareEvent(t),O||this.prepareButtonsForMove(e,t),m.enterOver(e))},mouseout:function(t){var e;this.isEventSimulatedFromTouch(t)||(e=this.prepareEvent(t),O||this.prepareButtonsForMove(e,t),m.leaveOut(e))},cancel:function(t){t=this.prepareEvent(t);m.cancel(t),this.cleanupMouse()},cleanupMouse:function(){M.delete(this.POINTER_ID)}},q=m.captureInfo,H=v.findTarget.bind(v),I=v.allShadows.bind(v),x=m.pointermap,k="touch-action",D={events:["touchstart","touchmove","touchend","touchcancel"],register:function(t){j.enableOnSubtree(t)},unregister:function(t){},elementAdded:function(t){var e=t.getAttribute(k),n=this.touchActionToScrollType(e);n&&(t._scrollType=n,m.listen(t,this.events),I(t).forEach(function(t){t._scrollType=n,m.listen(t,this.events)},this))},elementRemoved:function(t){t._scrollType=void 0,m.unlisten(t,this.events),I(t).forEach(function(t){t._scrollType=void 0,m.unlisten(t,this.events)},this)},elementChanged:function(t,e){var n=t.getAttribute(k),r=this.touchActionToScrollType(n),n=this.touchActionToScrollType(e);r&&n?(t._scrollType=r,I(t).forEach(function(t){t._scrollType=r},this)):n?this.elementRemoved(t):r&&this.elementAdded(t)},scrollTypes:{EMITTER:"none",XSCROLLER:"pan-x",YSCROLLER:"pan-y",SCROLLER:/^(?:pan-x pan-y)|(?:pan-y pan-x)|auto$/},touchActionToScrollType:function(t){var e=this.scrollTypes;return"none"===t?"none":t===e.XSCROLLER?"X":t===e.YSCROLLER?"Y":e.SCROLLER.exec(t)?"XY":void 0},POINTER_TYPE:"touch",firstTouch:null,isPrimaryTouch:function(t){return this.firstTouch===t.identifier},setPrimaryTouch:function(t){(0===x.size||1===x.size&&x.has(1))&&(this.firstTouch=t.identifier,this.firstXY={X:t.clientX,Y:t.clientY},this.scrolling=!1,this.cancelResetClickCount())},removePrimaryPointer:function(t){t.isPrimary&&(this.firstTouch=null,this.firstXY=null,this.resetClickCount())},clickCount:0,resetId:null,resetClickCount:function(){var t=function(){this.clickCount=0,this.resetId=null}.bind(this);this.resetId=setTimeout(t,200)},cancelResetClickCount:function(){this.resetId&&clearTimeout(this.resetId)},typeToButtons:function(t){return"touchstart"!==t&&"touchmove"!==t?0:1},touchToPointer:function(t){var e=this.currentTouchEvent,n=m.cloneEvent(t),r=n.pointerId=t.identifier+2,o=(n.target=q[r]||H(n),n.bubbles=!0,n.cancelable=!0,n.detail=this.clickCount,n.button=0,n.buttons=this.typeToButtons(e.type),n.width=t.radiusX||t.webkitRadiusX||0,n.height=t.radiusY||t.webkitRadiusY||0,n.pressure=t.force||t.webkitForce||.5,n.isPrimary=this.isPrimaryTouch(t),n.pointerType=this.POINTER_TYPE,this);return n.preventDefault=function(){o.scrolling=!1,o.firstXY=null,e.preventDefault()},n},processTouches:function(t,e){var n=t.changedTouches;this.currentTouchEvent=t;for(var r,o=0;n.length>o;o++)r=n[o],e.call(this,this.touchToPointer(r))},shouldScroll:function(t){var e,n;if(this.firstXY)return t="none"!==(n=t.currentTarget._scrollType)&&("XY"===n||(t=t.changedTouches[0],e="Y"===n?"X":"Y",n=Math.abs(t["client"+n]-this.firstXY[n]),Math.abs(t["client"+e]-this.firstXY[e])<=n)),this.firstXY=null,t},findTouch:function(t,e){for(var n,r=0,o=t.length;r<o&&(n=t[r]);r++)if(n.identifier===e)return!0},vacuumTouches:function(t){var n,r=t.touches;x.size>=r.length&&(n=[],x.forEach(function(t,e){1===e||this.findTouch(r,e-2)||(e=t.out,n.push(e))},this),n.forEach(this.cancelOut,this))},touchstart:function(t){this.vacuumTouches(t),this.setPrimaryTouch(t.changedTouches[0]),this.dedupSynthMouse(t),this.scrolling||(this.clickCount++,this.processTouches(t,this.overDown))},overDown:function(t){x.set(t.pointerId,{target:t.target,out:t,outTarget:t.target}),m.over(t),m.enter(t),m.down(t)},touchmove:function(t){this.scrolling||(this.shouldScroll(t)?(this.scrolling=!0,this.touchcancel(t)):(t.preventDefault(),this.processTouches(t,this.moveOverOut)))},moveOverOut:function(t){var e,n,r=x.get(t.pointerId);r&&(e=r.out,n=r.outTarget,m.move(t),e&&n!==t.target&&(e.relatedTarget=t.target,t.relatedTarget=n,e.target=n,t.target?(m.leaveOut(e),m.enterOver(t)):(t.target=n,t.relatedTarget=null,this.cancelOut(t))),r.out=t,r.outTarget=t.target)},touchend:function(t){this.dedupSynthMouse(t),this.processTouches(t,this.upOut)},upOut:function(t){this.scrolling||(m.up(t),m.out(t),m.leave(t)),this.cleanUpPointer(t)},touchcancel:function(t){this.processTouches(t,this.cancelOut)},cancelOut:function(t){m.cancel(t),m.out(t),m.leave(t),this.cleanUpPointer(t)},cleanUpPointer:function(t){x.delete(t.pointerId),this.removePrimaryPointer(t)},dedupSynthMouse:function(t){var e=P.lastTouches,t=t.changedTouches[0];this.isPrimaryTouch(t)&&(t={x:t.clientX,y:t.clientY},e.push(t),e=function(t,e){e=t.indexOf(e);-1<e&&t.splice(e,1)}.bind(null,e,t),setTimeout(e,2500))}},j=new f(D.elementAdded,D.elementRemoved,D.elementChanged,D),A=m.pointermap,F=window.MSPointerEvent&&"number"==typeof window.MSPointerEvent.MSPOINTER_TYPE_MOUSE,z={events:["MSPointerDown","MSPointerMove","MSPointerUp","MSPointerOut","MSPointerOver","MSPointerCancel","MSGotPointerCapture","MSLostPointerCapture"],register:function(t){m.listen(t,this.events)},unregister:function(t){m.unlisten(t,this.events)},POINTER_TYPES:["","unavailable","touch","pen","mouse"],prepareEvent:function(t){var e=t;return F&&((e=m.cloneEvent(t)).pointerType=this.POINTER_TYPES[t.pointerType]),e},cleanup:function(t){A.delete(t)},MSPointerDown:function(t){A.set(t.pointerId,t);t=this.prepareEvent(t);m.down(t)},MSPointerMove:function(t){t=this.prepareEvent(t);m.move(t)},MSPointerUp:function(t){var e=this.prepareEvent(t);m.up(e),this.cleanup(t.pointerId)},MSPointerOut:function(t){t=this.prepareEvent(t);m.leaveOut(t)},MSPointerOver:function(t){t=this.prepareEvent(t);m.enterOver(t)},MSPointerCancel:function(t){var e=this.prepareEvent(t);m.cancel(e),this.cleanup(t.pointerId)},MSLostPointerCapture:function(t){t=m.makeEvent("lostpointercapture",t);m.dispatchEvent(t)},MSGotPointerCapture:function(t){t=m.makeEvent("gotpointercapture",t);m.dispatchEvent(t)}},U=window.navigator.msPointerEnabled?(N=function(t){i(t),this.msSetPointerCapture(t)},function(t){i(t),this.msReleasePointerCapture(t)}):(N=function(t){i(t),m.setCapture(t,this)},function(t){i(t),m.releaseCapture(t,this)});return C&&(E.forEach(function(t){t+""===t?(T+=r(t)+o(t)+"\n",L&&(T+=n(t)+o(t)+"\n")):(T+=t.selectors.map(r)+o(t.rule)+"\n",L&&(T+=t.selectors.map(n)+o(t.rule)+"\n"))}),(C=document.createElement("style")).textContent=T,document.head.appendChild(C)),window.PointerEvent||(window.PointerEvent=c,window.navigator.msPointerEnabled?(E=window.navigator.msMaxTouchPoints,Object.defineProperty(window.navigator,"maxTouchPoints",{value:E,enumerable:!0}),m.registerSource("ms",z)):(m.registerSource("mouse",P),void 0!==window.ontouchstart&&m.registerSource("touch",D)),m.register(document)),window.Element&&!Element.prototype.setPointerCapture&&Object.defineProperties(Element.prototype,{setPointerCapture:{value:N},releasePointerCapture:{value:U}}),{dispatcher:m,Installer:f,PointerEvent:c,PointerMap:u,targetFinding:v}}),function(){function s(t){t=P.call(t);return N[t]||(N[t]=t.match(I)[1].toLowerCase())}function o(t,e){e=o[e||s(t)];return e?e(t):t}function p(t){return R[s(t)]?[t]:Array.prototype.slice.call(t,0)}function c(t,e,n){var r=s(n);return"object"==r&&"object"==s(t[e])?A.merge(t[e],n):t[e]=o(n,r),t}function d(t,e,n){var r,o,i={};for(o in e)i[o.split(":")[0]]=o;for(o in n)r=i[o.split(":")[0]],"function"==typeof e[r]?(r.match(":mixins")||(e[r+":mixins"]=e[r],delete e[r],r+=":mixins"),e[r].__mixin__=A.applyPseudos(o+(o.match(":mixins")?"":":mixins"),n[o],t.pseudos,e[r].__mixin__)):(e[o]=n[o],delete e[r])}function f(l){return function t(e,n){for(var r=e.length;r--;)n.unshift(e[r]),A.mixins[e[r]].mixins&&t(A.mixins[e[r]].mixins,n);return n}(l.mixins,[]).forEach(function(t){var e,n=A.mixins[t];for(e in n){var r=n[e],o=l[e];if(o)switch(e){case"mixins":break;case"events":i=c=s=a=void 0;var i,a=l,s=o,c=r;for(i in c)s[i+":__mixin__("+q+++")"]=A.applyPseudos(i,c[i],a.pseudos);break;case"accessors":case"prototype":for(var u in r)o[u]?d(l,o[u],r[u]):o[u]=r[u];break;default:d(l,o,r)}else l[e]=r}}),l}function t(t){return 0===t.button}function i(t,e){var n,r,o,i,a,s=Object.getOwnPropertyDescriptor(t,"target");for(n in e)x[n]||(r=n,o=t,i=e,a=s,a?o[r]=i[r]:Object.defineProperty(o,r,{writable:!0,enumerable:!0,value:i[r]}));t.baseEvent=e}function m(t,e,n,r,o){a[o].call(t,n,e&&e.boolean?"":r)}function v(t,e,n,r,o){if(e&&(e.property||e.selector))for(var i=e.property?[t.xtag[e.property]]:e.selector?A.query(t,e.selector):[],a=i.length;a--;)i[a][o](n,r)}function g(t,e){t.prototype[e]={};var n,r,o,i=t.accessors[e],a=i.attribute;for(r in a&&(n=a.name=(a?a.name||e.replace(T,"$1-$2"):e).toLowerCase(),a.key=e,t.attributes[n]=a),i)!function(t,e,r,o,i,a){var n=r.split(":"),s=n[0];"get"==s?(n[0]=e,t.prototype[e].get=A.applyPseudos(n.join(":"),o[r],t.pseudos,o[r])):"set"==s?(n[0]=e,t.prototype[e].set=A.applyPseudos(n.join(":"),i?function(t){var e,n="setAttribute";i.boolean?(t=!!t,e=this.hasAttribute(a),t||(n="removeAttribute")):(t=i.validate?i.validate.call(this,t):t,e=this.getAttribute(a)),m(this,i,a,t,n),o[r].call(this,t,e),v(this,i,a,t,n)}:o[r]?function(t){o[r].call(this,t)}:null,t.pseudos,o[r]),i&&(i.setter=o[r])):t.prototype[e][r]=o[r]}(t,e,r,i,a,n);a&&(t.prototype[e].get||(o=(a.boolean?"has":"get")+"Attribute",t.prototype[e].get=function(){return this[o](n)}),t.prototype[e].set||(t.prototype[e].set=function(t){t=a.boolean?!!t:a.validate?a.validate.call(this,t):t;var e=!a.boolean||t?"setAttribute":"removeAttribute";m(this,a,n,t,e),v(this,a,n,t,e)}))}function y(t){return"function"==typeof t?H.exec(""+t)[1]:t}function h(){}function b(){return!0}var e,n,w=window,_=document,a={setAttribute:Element.prototype.setAttribute,removeAttribute:Element.prototype.removeAttribute},E=Element.prototype.createShadowRoot,u=_.createElement("div"),l=/,/g,T=/([a-z])([A-Z])/g,r=/\(|\)/g,C=/:(\w+)\u276A(.+?(?=\u276B))|:(\w+)/g,L=/(\d+)/g,M={action:function(t,e){return-1<t.value.match(L).indexOf(e.keyCode+"")==("keypass"==t.name)||null}},S={dom:"ms"==(e=((e=Object.keys(window).join()).match(/,(ms)/)||e.match(/,(moz)/)||e.match(/,(O)/)||[null,"webkit"])[1].toLowerCase())?"MS":e,lowercase:e,css:"-"+e+"-",js:"ms"==e?e:e.charAt(0).toUpperCase()+e.substring(1)},O=Element.prototype.matches||Element.prototype.matchesSelector||Element.prototype[S.lowercase+"MatchesSelector"],N={},P=N.toString,I=/\s([a-zA-Z]+)/,R=(o.object=function(t){var e,n={};for(e in t)n[e]=o(t[e]);return n},o.array=function(t){for(var e=t.length,n=Array(e);e--;)n[e]=o(t[e]);return n},{undefined:1,null:1,number:1,boolean:1,string:1,function:1}),q=0,x={};for(n in _.createEvent("CustomEvent"))x[n]=1;var k,D,H=/\/\*!?(?:\@preserve)?[ \t]*(?:\r\n|\n)([\s\S]*?)(?:\r\n|\n)\s*\*\//,A={tags:{},defaultOptions:{pseudos:[],mixins:[],events:{},methods:{},accessors:{},lifecycle:{},attributes:{},prototype:{xtag:{get:function(){return this.__xtag__||(this.__xtag__={data:{}})}}}},register:function(t,e){if("string"!=typeof t)throw"First argument must be a Custom Element string name";t=t.toLowerCase(),A.tags[t]=e||{};var n,o=e.prototype,a=(delete e.prototype,A.tags[t].compiled=f(A.merge({},A.defaultOptions,e))),i=a.prototype,r=a.lifecycle;for(n in a.events)a.events[n]=A.parseEvent(n,a.events[n]);for(n in r)r[n.split(":")[0]]=A.applyPseudos(n,r[n],a.pseudos,r[n]);for(n in a.methods)i[n.split(":")[0]]={value:A.applyPseudos(n,a.methods[n],a.pseudos,a.methods[n]),enumerable:!0};for(n in a.accessors)g(a,n);a.shadow&&(a.shadow=a.shadow.nodeName?a.shadow:A.createFragment(a.shadow)),a.content&&(a.content=a.content.nodeName?a.content.innerHTML:y(a.content));var s=r.created,c=r.finalized,u=(i.createdCallback={enumerable:!0,value:function(){var t,e=this,n=(a.shadow&&E&&this.createShadowRoot().appendChild(a.shadow.cloneNode(!0)),a.content&&(this.appendChild(document.createElement("div")).outerHTML=a.content),s?s.apply(this,arguments):null);for(t in A.addEvents(this,a.events),a.attributes){var r=a.attributes[t],o=this.hasAttribute(t),i=void 0!==r.def;(o||r.boolean||i)&&(this[r.key]=r.boolean?o:!o&&i?r.def:this.getAttribute(t))}return a.pseudos.forEach(function(t){t.onAdd.call(e,t)}),this.xtagComponentReady=!0,c&&c.apply(this,arguments),n}},r.inserted),l=r.removed,e=((u||l)&&(i.attachedCallback={value:function(){return l&&(this.xtag.__parentNode__=this.parentNode),u?u.apply(this,arguments):void 0},enumerable:!0}),l&&(i.detachedCallback={value:function(){var t=p(arguments),t=(t.unshift(this.xtag.__parentNode__),l.apply(this,t));return delete this.xtag.__parentNode__,t},enumerable:!0}),r.attributeChanged&&(i.attributeChangedCallback={value:r.attributeChanged,enumerable:!0}),i.setAttribute={writable:!0,enumerable:!0,value:function(t,e){var n,t=t.toLowerCase(),r=a.attributes[t];r&&(n=this.getAttribute(t),e=r.boolean?"":r.validate?r.validate.call(this,e):e),m(this,r,t,e,"setAttribute"),r&&(r.setter&&r.setter.call(this,!!r.boolean||e,n),v(this,r,t,e,"setAttribute"))}},i.removeAttribute={writable:!0,enumerable:!0,value:function(t){var t=t.toLowerCase(),e=a.attributes[t],n=this.hasAttribute(t);m(this,e,t,"","removeAttribute"),e&&(e.setter&&e.setter.call(this,!e.boolean&&void 0,n),v(this,e,t,"","removeAttribute"))}},{}),d=o instanceof w.HTMLElement,h=a.extends&&(e.extends=a.extends);return o&&Object.getOwnPropertyNames(o).forEach(function(t){var e=i[t],n=d?Object.getOwnPropertyDescriptor(o,t):o[t];if(e)for(var r in n)e[r]="function"==typeof n[r]&&e[r]?A.wrap(n[r],e[r]):n[r];i[t]=e||n}),e.prototype=Object.create((h?Object.create(_.createElement(h).constructor):w.HTMLElement).prototype,i),_.registerElement(t,e)},mixins:{},prefix:S,captureEvents:{focus:1,blur:1,scroll:1,DOMMouseScroll:1},customEvents:{animationstart:{attach:[S.dom+"AnimationStart"]},animationend:{attach:[S.dom+"AnimationEnd"]},transitionend:{attach:[S.dom+"TransitionEnd"]},move:{attach:["pointermove"]},enter:{attach:["pointerenter"]},leave:{attach:["pointerleave"]},scrollwheel:{attach:["DOMMouseScroll","mousewheel"],condition:function(t){return t.delta=t.wheelDelta?t.wheelDelta/40:Math.round(t.detail/3.5*-1),!0}},tap:{attach:["pointerdown","pointerup"],condition:function(t,e){if("pointerdown"==t.type)e.startX=t.clientX,e.startY=t.clientY;else if(0===t.button&&Math.abs(e.startX-t.clientX)<10&&Math.abs(e.startY-t.clientY)<10)return!0}},tapstart:{attach:["pointerdown"],condition:t},tapend:{attach:["pointerup"],condition:t},tapmove:{attach:["pointerdown"],condition:function(t,e){var n;return"pointerdown"==t.type?(n=e.listener.bind(this),e.tapmoveListeners||(e.tapmoveListeners=A.addEvents(document,{pointermove:n,pointerup:n,pointercancel:n}))):"pointerup"!=t.type&&"pointercancel"!=t.type||(A.removeEvents(document,e.tapmoveListeners),e.tapmoveListeners=null),!0}},taphold:{attach:["pointerdown","pointerup"],condition:function(t,e){if("pointerdown"==t.type)(e.pointers=e.pointers||{})[t.pointerId]=setTimeout(A.fireEvent.bind(null,this,"taphold"),e.duration||1e3);else{if("pointerup"!=t.type)return!0;e.pointers&&(clearTimeout(e.pointers[t.pointerId]),delete e.pointers[t.pointerId])}}}},pseudos:{__mixin__:{},mixins:{onCompiled:function(e,t){var n=t.source&&t.source.__mixin__||t.source;if(!n)return e;switch(t.value){case null:case"":case"before":return function(){return n.apply(this,arguments),e.apply(this,arguments)};case"after":return function(){var t=e.apply(this,arguments);return n.apply(this,arguments),t};case"none":return e}}},keypass:M,keyfail:M,delegate:{action:function(t,e){for(var n,r=e.target,o=e.currentTarget;!n&&r&&r!=o;)r.tagName&&O.call(r,t.value)&&(n=r),r=r.parentNode;return(n=!n&&o.tagName&&O.call(o,t.value)?o:n)?t.listener=t.listener.bind(n):null}},preventable:{action:function(t,e){return!e.defaultPrevented}},duration:{onAdd:function(t){t.source.duration=Number(t.value)}},capture:{onCompiled:function(t,e){e.source&&(e.source.capture=!0)}}},clone:o,typeOf:s,toArray:p,wrap:function(e,n){return function(){var t=e.apply(this,arguments);return n.apply(this,arguments),t}},merge:function(t,e,n){if("string"==s(e))return c(t,e,n);for(var r=1,o=arguments.length;r<o;r++){var i,a=arguments[r];for(i in a)c(t,i,a[i])}return t},uid:function(){return Math.random().toString(36).substr(2,10)},query:function(t,e){return(e||"").length?p(t.querySelectorAll(e)):[]},skipTransition:function(t,e,n){var r=S.js+"TransitionProperty",o=(t.style[r]=t.style.transitionProperty="none",e?e.call(n||t):null);return A.skipFrame(function(){t.style[r]=t.style.transitionProperty="",o&&o.call(n||t)})},requestFrame:(D=w.requestAnimationFrame||w[S.lowercase+"RequestAnimationFrame"]||function(t){return w.setTimeout(t,20)},function(t){return D(t)}),cancelFrame:(k=w.cancelAnimationFrame||w[S.lowercase+"CancelAnimationFrame"]||w.clearTimeout,function(t){return k(t)}),skipFrame:function(t){var e=A.requestFrame(function(){e=A.requestFrame(t)});return e},matchSelector:function(t,e){return O.call(t,e)},set:function(t,e,n){t[e]=n,window.CustomElements&&CustomElements.upgradeAll(t)},innerHTML:function(t,e){A.set(t,"innerHTML",e)},hasClass:function(t,e){return-1<t.className.split(" ").indexOf(e.trim())},addClass:function(t,e){var n=t.className.trim().split(" ");return e.trim().split(" ").forEach(function(t){~n.indexOf(t)||n.push(t)}),t.className=n.join(" ").trim(),t},removeClass:function(t,e){var n=e.trim().split(" ");return t.className=t.className.trim().split(" ").filter(function(t){return t&&!~n.indexOf(t)}).join(" "),t},toggleClass:function(t,e){return A[A.hasClass(t,e)?"removeClass":"addClass"].call(null,t,e)},queryChildren:function(t,e){var n=t.id,r="#"+(t.id=n||"x_"+A.uid())+" > ",o=t.parentNode||!u.appendChild(t),r=(e=r+(e+"").replace(l,","+r),t.parentNode.querySelectorAll(e));return n||t.removeAttribute("id"),o||u.removeChild(t),p(r)},createFragment:function(t){var e=document.createElement("template");return t&&(t.nodeName?p(arguments).forEach(function(t){e.content.appendChild(t)}):e.innerHTML=y(t)),document.importNode(e.content,!0)},manipulate:function(t,e){var n=t.nextSibling,r=t.parentNode,e=e.call(t)||t;n?r.insertBefore(e,n):r.appendChild(e)},applyPseudos:function(o,i,a,s){var t,c=i,u={};if(o.match(":")){var l=[],e=0;o.replace(r,function(t){return"("==t?1==++e?"❪":"(":--e?")":"❫"}).replace(C,function(t,e,n,r){l.push([e||r,n])});for(var d=l.length;d--;)!function(){var t=l[d][0],e=l[d][1];if(!A.pseudos[t])throw"pseudo not found: "+t+" "+e;var e=""===e||void 0===e?null:e,n=u[d]=Object.create(A.pseudos[t]),r=(n.key=o,n.name=t,n.value=e,n.arguments=(e||"").split(","),n.action=n.action||b,n.source=s,n.onAdd=n.onAdd||h,n.onRemove=n.onRemove||h,n.listener=c);c=function(){var t=n.action.apply(this,[n].concat(p(arguments)));return null===t||!1===t||(t=n.listener.apply(this,arguments),n.listener=r),t},a?a.push(n):n.onAdd.call(i,n)}()}for(t in u)u[t].onCompiled&&(c=u[t].onCompiled(c,u[t])||c);return c},removePseudos:function(e,t){t.forEach(function(t){t.onRemove.call(e,t)})},parseEvent:function(t,e){var t=t.split(":"),r=t.shift(),n=A.customEvents[r],o=A.merge({type:r,stack:h,condition:b,capture:A.captureEvents[r],attach:[],_attach:[],pseudos:"",_pseudos:[],onAdd:h,onRemove:h},n||{}),i=(o.attach=p(o.base||o.attach),o.chain=r+(o.pseudos.length?":"+o.pseudos:"")+(t.length?":"+t.join(":"):""),A.applyPseudos(o.chain,e,o._pseudos,o));return o.stack=function(t){t.currentTarget=t.currentTarget||this;var e=t.detail||{};return e.__stack__?e.__stack__==i?(t.stopPropagation(),t.cancelBubble=!0,i.apply(this,arguments)):void 0:i.apply(this,arguments)},o.listener=function(t){var e=p(arguments),n=o.condition.apply(this,e.concat([o]));return n&&(t.type!=r&&t.baseEvent&&t.type!=t.baseEvent.type?void A.fireEvent(t.target,r,{baseEvent:t,detail:!0!==n&&(n.__stack__=i)?n:{__stack__:i}}):o.stack.apply(this,e))},o.attach.forEach(function(t){o._attach.push(A.parseEvent(t,o.listener))}),o},addEvent:function(e,t,n,r){t="function"==typeof n?A.parseEvent(t,n):n;return t._pseudos.forEach(function(t){t.onAdd.call(e,t)}),t._attach.forEach(function(t){A.addEvent(e,t.type,t)}),t.onAdd.call(e,t,t.listener),e.addEventListener(t.type,t.stack,r||t.capture),t},addEvents:function(t,e){var n,r={};for(n in e)r[n]=A.addEvent(t,n,e[n]);return r},removeEvent:function(e,t,n){(n=n||t).onRemove.call(e,n,n.listener),A.removePseudos(e,n._pseudos),n._attach.forEach(function(t){A.removeEvent(e,t)}),e.removeEventListener(n.type,n.stack)},removeEvents:function(t,e){for(var n in e)A.removeEvent(t,e[n])},fireEvent:function(t,e,n){var r=_.createEvent("CustomEvent");r.initCustomEvent(e,!1!==(n=n||{}).bubbles,!1!==n.cancelable,n.detail),n.baseEvent&&i(r,n.baseEvent),t.dispatchEvent(r)}};"function"==typeof define&&define.amd?define(A):"undefined"!=typeof module&&module.exports?module.exports=A:w.xtag=A,_.addEventListener("WebComponentsReady",function(){A.fireEvent(_.body,"DOMComponentsLoaded")})}();
2
+ !function(){var I="quran-madina-html",d=/localhost/.test(document.location.hostname)?"../":`https://www.unpkg.com/${I}/`,S={content:"Loading .."},s=/[\u0621-\u064A\u0671-\u06D3]/,T="﷽";function M(t,e){return 1===e&&0!==t}var o={};var l={};function h(s,t,e,n){var i,r=!n&&function(t){if(o[t])return o[t];try{var e=sessionStorage.getItem("quran-madina-html:"+t);if(e)return o[t]=JSON.parse(e)}catch(t){}return null}(s);r?t&&setTimeout(function(){t(r)},0):l[s]?l[s].push({success:t,error:e}):(l[s]=[{success:t,error:e}],(i=new XMLHttpRequest).onreadystatechange=function(){if(i.readyState===XMLHttpRequest.DONE){var t=l[s];if(delete l[s],200===i.status){var e=JSON.parse(i.responseText),n=s,r=e,a=i.responseText;o[n]=r;try{sessionStorage.setItem("quran-madina-html:"+n,a)}catch(t){}t.forEach(function(t){t.success&&t.success(e)})}else t.forEach(function(t){t.error&&t.error(i)})}},i.open("GET",s,!0),i.send())}function j(t){console.log(I+"> "+t)}function N(t){return null!=t&&(""===(t=String(t).trim().toLowerCase())||"true"===t||"1"===t||"yes"===t)}function B(t){var e=(e=(e=getComputedStyle(t).color)&&e.match(/[\d.]+/g))?.2126*n(+e[0])+.7152*n(+e[1])+.0722*n(+e[2]):1;function n(t){return(t/=255)<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}t.setAttribute("data-qmh-text-scheme",.5<e?"dark":"light")}function P(t){return Array(2).fill(t.split("-")[0]-1)}function H(t){return 2==t.split("-").length?t.split("-").map(t=>parseInt(t)+1):Array(2).fill(parseInt(t.split("-")[0])+1)}function O(t){return null==t||2!=(t=1==(t=t.split(/[-:]/).map(t=>parseInt(t,10))).length?[t[0],t[0]]:t).length||isNaN(t[0])||isNaN(t[1])||t[0]<1||t[1]<t[0]?null:t}function D(t,e,n){return null==e?null:e[0]<n[0]||e[1]>n[1]?(j(`${t} range ${e[0]}-${e[1]} outside displayed words ${n[0]}-${n[1]}, ignoring`),null):e}function Z(t,e){if(null!=t&&"auto"!==t){if("no"===t)return!0;j("yes"===t?'inline="yes" is not implemented yet; falling back to "auto"':"Bad inline parameter: "+t)}return e}function x(t){return s.test(t)}function R(t,e){return(0===t?2:1)<=e}function V(t){var e=0;return t.t.split(/\s+/).forEach(function(t){x(t)&&(e+=1)}),e}function w(t){var e=0;return t.r.forEach(function(t){e+=V(t)}),e}function J(t,e,n){for(var r=S.suras[t].ayas,a=0,s=e;s<=n;s++)R(t,s)&&(a+=w(r[s]));return a}function G(t,e,n,r,a){for(var s=0,i=t;i<=n;i++)for(var o=S.suras[i].ayas,l=i===n?r:o.length-1,u=i===t?e:0;u<=l;u++){var c=o[u];void 0!==c&&c.p===a&&R(i,u)&&(s+=w(c))}return s}function U(t,e="class",n="lightgrey",r="transparent"){var a="tag"===e.toLowerCase()?document.getElementsByTagName(t):document.getElementsByClassName(t);Array.from(a).forEach(function(t){t.onmouseover=function(){Array.from(a).forEach(function(t){t.style.backgroundColor=n})},t.onmouseout=function(){Array.from(a).forEach(function(t){t.style.backgroundColor=r})}})}function K(t,e){var n=(t,e)=>String(t).padStart(e,"0"),n=[I+"-part",`${I}-${n(t,3)}-`+n(e,3)];return(-1==e||1==t&&0==e)&&n.push("quran-madina-html-sura-start"),n}function E(){var t=document.createElement("div");return t.innerHTML='<svg viewBox="0 0 24 24" class="quran-madina-html-icon" width="20px"><path d="M16.02 20.96H3.78c-.41 0-.75-.34-.75-.75V7.74c0-.41.34-.75.75-.75h7.87c.21 0 .39.08.53.22l4.37 4.37c.14.14.22.32.22.53v8.11c0 .4-.34.74-.75.74ZM4.53 19.47h10.75v-6.61h-3.62c-.41 0-.75-.34-.75-.75V8.48H4.53v10.99Z"></path><path d="m20.74 7.63-4.37-4.37c-.14-.14-.36-.2-.53-.22H8.01c-.41 0-.75.34-.75.75V5.5h1.49v-.97h6.34v3.62c0 .41.34.75.75.75h3.62v8.19h-1.2v1.49h1.95c.41 0 .75-.34.75-.75V8.16c0-.21-.08-.4-.22-.53Z"></path></svg>'.trim(),t.firstChild}function C(){var t=document.createElement("div");return t.innerHTML='<svg class="quran-madina-html-icon" viewBox="0 0 820 615" style="height:20px"><path d="M70 1.9C37.6 8.8 12.6 33.4 3.4 67.5c-1.8 6.6-1.9 11.9-1.9 98v91l2.3 8c5.1 17.8 17 36.4 29.9 46.7 10.8 8.6 25.4 15.4 38.1 17.8 3.1.6 15.2 1 26.8 1 17.7 0 21.3.2 21.7 1.4.4.9.6 17.1.7 36.1 0 32.4.2 34.9 2 38.5 6.4 12.5 21.4 17.4 33.3 10.8 2.3-1.3 7.5-6.4 12.1-11.9l63-74.1c.6-.4 16.3-.8 34.9-.8H300l-.2-18.3-.3-18.2-42.8.1-43.1.5c-.2.2-12.7 15.1-27.9 33.1-15.1 18-27.8 32.4-28.1 32.1-.3-.4-.6-15.3-.6-33.2v-32.6l-38.8-.1c-42.1-.2-43.9-.4-54.3-6-6.5-3.6-16.9-14.6-20.2-21.5-5.8-11.9-5.7-10-5.7-100.7 0-92-.2-89.4 6.3-101.7 3.9-7.3 13.5-17.1 20.3-20.7C76 36.7 66.1 37 244.5 37L412 38.1c18 4.1 33.5 20.5 37.5 39.6 2.2 10.2 2.1 164.6 0 174.8-3.9 18.3-16.4 32.7-33.5 38.5-3.2 1.1-7.8 2-10 2-3.1 0-4 .4-4 1.7 0 1-.2 8.8-.3 17.3-.2 8.5-.2 16.2 0 17 .9 3.3 21.7-.5 34.1-6 13.7-6.3 27.5-17.9 36.2-30.5 5-7.2 10.8-20.4 13.2-30.1l2.3-8.9V165 76.5l-2.3-9c-8.1-31.4-30.5-54.9-61.7-64.8l-7-2.2-169-.2C87.7.1 78 .2 70 1.9zm277.294 102.559q19.5-.5 28.25 24.5 2.5 7.25-3.75 19.75-5.75 11.75-9.75 16-19.5 21.5-67 25.25-27.75 2.25-50.25-2.25-5.25 38.25-16.5 50-26 26.75-66 29.5-27.75 2-42.5-11-20.25-17.75-16.5-48.5 3-23.75 14.25-42.5 2.75-4.5 4.75-7.5 2-3 3-4.25 2.25-2.75 4.75-1.25 2.75 1.5 0 6.25-12.75 24.5-10 45 4 30.5 44.5 30.5 30.25 0 53.25-15.5 12.5-8.25 14.75-14.25-2.25-20.75-13.75-35.75-3.5-4.25-1.75-8l9.5-23.5q3-7.5 8.25 1.25l8.75 14.75q7.75 4.25 28.25 5 16.75-19.25 39.25-36.25 22.5-16.75 36.25-17.25zm11.5 40.5q-12.5-9.5-31.75-5.75-19 3.75-41.25 19.5 50.75.5 73-13.75zm-71.5-89.75q1.5-2 4.25-1.25 5 1.75 9.5 4.5 4.75 2.75 8.75 6.25 2 2 .75 4.5l-12 19q-1.75 2.5-4.5.5-2.5-2-18-11.25-2.75-1.75-1-4.25zm278.784 232.623c-4.7.4-4.7.4-6.7 6.1-1.2 3.1-9.3 25.9-18 50.7l-36.6 102.7-3.5 9.8h17.9 17.8l5.7-17 5.7-17h31.7 31.8l5.6 17.2 5.6 17.3 17.9-.3 18-.3-6-17.2-15-43.2-13.3-38.5-14.1-41-9.9-28.7c-.3-.6-30.2-1.1-34.6-.6zm35.7 106c-.2.2-10 .2-21.9.1l-21.5-.3 9.8-29.5 11-32.5c1.2-2.9 1.8-1.4 12.1 29.4l10.5 32.8zm148.8 139.609c32.4-6.9 57.4-31.5 66.6-65.6 1.8-6.6 1.9-11.9 1.9-98v-91l-2.3-8c-5.1-17.8-17-36.4-29.9-46.7-10.8-8.6-25.4-15.4-38.1-17.8-3.1-.6-15.2-1-26.8-1-17.7 0-21.3-.2-21.7-1.4-.4-.9-.6-17.1-.7-36.1 0-32.4-.2-34.9-2-38.5-6.4-12.5-21.4-17.4-33.3-10.8-2.3 1.3-7.5 6.4-12.1 11.9l-63 74.1c-.6.4-16.3.8-34.9.8h-33.7l.2 18.3.3 18.2 42.8-.1 43.1-.5c.2-.2 12.7-15.1 27.9-33.1 15.1-18 27.8-32.4 28.1-32.1.3.4.6 15.3.6 33.2v32.6l38.8.1c42.1.2 43.9.4 54.3 6 6.5 3.6 16.9 14.6 20.2 21.5 5.8 11.9 5.7 10 5.7 100.7 0 92 .2 89.4-6.3 101.7-3.9 7.3-13.5 17.1-20.3 20.7-11.4 6.1-1.5 5.8-179.9 5.8-108.2 0-164.5-.4-167.5-1.1-18-4.1-33.5-20.5-37.5-39.6-2.2-10.2-2.1-164.6 0-174.8 3.9-18.3 16.4-32.7 33.5-38.5 3.2-1.1 7.8-2 10-2 3.1 0 4-.4 4-1.7 0-1 .2-8.8.3-17.3.2-8.5.2-16.2 0-17-.9-3.3-21.7.5-34.1 6-13.7 6.3-27.5 17.9-36.2 30.5-5 7.2-10.8 20.4-13.2 30.1l-2.3 8.9v88.5 88.5l2.3 9c8.1 31.4 30.5 54.9 61.7 64.8l7 2.2 169 .2 177.5-1.6z"/></svg>'.trim(),t.firstChild}function Q(t){var e=document.createElement("quran-madina-html-header"),t=(e.innerHTML=t,E()),n=(t.addEventListener("click",z),C());return n.addEventListener("click",$),e.appendChild(t),e.appendChild(n),e}var p=null;function W(){p&&(p.popup.classList.remove(I+"-open"),document.removeEventListener("click",p.outsideClick),document.removeEventListener("keydown",p.onEscape),p=null)}function i(e,t,n,r,a){W();function s(t){u.contains(t.target)||W()}function i(t){"Escape"===t.key&&W()}o=e,(l=document.querySelector(`body > ${I}-aya-popup`))||((l=document.createElement(I+"-aya-popup")).appendChild(E()),l.appendChild(C()),document.body.appendChild(l)),["--qmh-header","--qmh-background"].forEach(function(t){l.style.setProperty(t,getComputedStyle(o).getPropertyValue(t))});var o,l,u=l,c=u.children[0],d=u.children[1];c.onclick=function(t){t.stopPropagation();t="“"+Array.from(e.getElementsByClassName(n)).map(function(t){return t.textContent}).join(" ").replace(/\s+/g," ").trim()+"”\n\n"+S.suras[r-1].name;navigator.clipboard.writeText(t),alert("⎘ تم نسخ:\n\n"+t),W()},d.onclick=function(t){t.stopPropagation(),window.open(`https://quran.com/${r}/`+a,"_blank"),W()},c=u,d=(d=t).getBoundingClientRect(),c.style.left=Math.max(4,d.left)+"px",c.style.top=(0<d.top-34-6?d.top-34-6:d.bottom+6)+"px",u.classList.add(I+"-open");document.addEventListener("click",s),document.addEventListener("keydown",i),p={popup:u,outsideClick:s,onEscape:i}}function Y(n,r,a,s){s<1||Array.from(n.getElementsByClassName(r)).forEach(function(e){e.style.cursor="pointer",e.onclick=function(t){t.stopPropagation(),i(n,e,r,a,s)}})}function tt(t,e,n){t.style="display:block;",t.style.setProperty("font-family",S.font_family,""),t.style.setProperty("font-size",S.font_size+"px",""),"me_quran"===S.font_family&&t.style.setProperty("line-height",2*S.font_size+"px",""),t.style.width=S.line_width+10+"px",n||t.style.setProperty("box-shadow","inset "+(e%2==1?"":"-")+"8px 0 7px -7px #333","")}function et(t,e){0<=e?t.style.setProperty("transform",`scaleX(${e*(S.stretch_scale||1)})`,""):t.style.setProperty("text-align","center","")}function A(t,e,n,r){r&&e>=r[0]&&e<=r[1]?t.classList.add(I+"-word-error"):n&&e>=n[0]&&e<=n[1]&&t.classList.add(I+"-word-highlight")}function nt(n,t,r,a,s,i){return t.split(/(\s+)/).forEach(function(t){var e;""!==t&&(/^\s+$/.test(t)?n.appendChild(document.createTextNode(t)):((e=document.createElement("span")).textContent=t,e.classList.add(I+"-word"),x(t)&&(a+=1),r&&(a<r[0]||a>r[1])&&e.classList.add(I+"-word-hidden"),A(e,a,s,i),n.appendChild(e)))}),a}function rt(e,n,t,r,a){function s(t){return!t||e+1>=t[0]&&e+n<=t[1]}function i(t){return t&&!s(t)&&e+n>=t[0]&&e+1<=t[1]}return!s(t)||i(r)||i(a)?{ligature:!1}:(t=null,a&&s(a)?t="error":r&&s(r)&&(t="highlight"),{ligature:!0,cls:t})}function q(t,e){for(var n=0;n<t.r.length;n++)if(t.r[n].l===e)return t.r[n];return null}function k(t,e,n){var r,t=S.suras[t].ayas;return e<=0||void 0===(r=t[e-1])||r.p!==t[e].p||null===q(r,n)}function F(t,e,n,r,a){for(var s=S.suras[t].ayas,i=[],o=r+a;0<=o&&o<s.length&&void 0!==s[o]&&s[o].p==e;o+=a){var l=q(s[o],n);if(null===l)break;if(a<0){if(i.unshift(l),k(t,o,n))break}else i.push(l)}return i}function X(t,e){for(var n=0;n<e.length;n++){var r=document.createElement("div");r.textContent=e[n].t,r.style.cssText="display:inline;visibility:hidden",t.appendChild(r)}}function z(){var t=this.parentElement.parentElement,e=t.querySelector("quran-madina-html-header"),n=(e=e?e.textContent.replace(/\s+/g," ").trim():null!=(e=t.getAttribute("sura"))?S.suras[e-1].name:"",(n=(t=(t=t).cloneNode(!0)).querySelector("quran-madina-html-header"))&&n.parentNode.removeChild(n),Array.from(t.querySelectorAll(`.${I}-word-hidden`)).forEach(function(t){t.parentNode.removeChild(t)}),Array.from(t.querySelectorAll("div,span")).forEach(function(t){/visibility:\s*hidden/.test(t.getAttribute("style")||"")&&t.parentNode.removeChild(t)}),t),t=n.querySelectorAll("quran-madina-html-line"),t=t.length?Array.from(t).map(function(t){return t.textContent.replace(/\s+/g," ").trim()}).filter(function(t){return""!==t}).join(" "):n.textContent.replace(/\s+/g," ").trim(),n="“"+t+"”\n\n"+e;navigator.clipboard.writeText(n),alert("⎘ تم نسخ:\n\n"+n)}function $(){var t=this.parentElement.parentElement;let e;e=null!=t.getAttribute("sura")&&null!=t.getAttribute("aya")?`https://quran.com/${t.getAttribute("sura")}/`+t.getAttribute("aya"):"https://quran.com/page/"+t.getAttribute("page"),window.open(e,"_blank")}function at(o,t,e,l,n,r,a,u,c,d){(c||d)&&B(o);var t=function(t,e,n){for(var r=[],a=null,s=0,i=S.suras.length,o=2===e&&0<t?1:e,l=0;l<i;l++){for(var u=(t+l)%i,c=S.suras[u].ayas,d=!1,h=0===l?o:0;h<c.length;h++){var p=R(u,h),f=c[h];if(void 0===f)break;for(var g=0;g<f.r.length;g++){var m,y=f.r[g];""!==y.t&&(m=f.p+":"+y.l,a&&a.key===m||(a={key:m,stretch:y.s,parts:[]},r.push(a)),a.parts.push({sura:u,ayaIdx:h,part:y,countable:p}))}if(p&&(s+=w(f))>=n[1]){d=!0;break}}if(d)break}for(var v=0,b=(r.forEach(function(t){t.parts.forEach(function(t){t.countable&&(v+=V(t.part))}),t.lastWord=v}),0);b<r.length-1&&r[b].lastWord<n[0];)b+=1;for(var _=b;_<r.length-1&&r[_].lastWord<n[1];)_+=1;return{groups:r.slice(b,_+1),counterStart:0<b?r[b-1].lastWord:0}}(t,e,l),s=t.groups,h=Z(a,1<s.length),p=t.counterStart;W(),o.innerHTML="",o.removeAttribute("style"),o.classList.toggle(I+"-inline",!h&&!r),h&&(e=parseInt(s[0].key.split(":")[0],10),tt(o,e,n),n||o.appendChild(Q(S.suras[s[0].parts[0].sura].name))),s.forEach(function(t,e){var n,i=document.createElement("quran-madina-html-line");h?(i.style.setProperty("display","block",""),et(i,t.stretch),k((n=t.parts[0]).sura,n.ayaIdx,n.part.l)||X(i,F(n.sura,S.suras[n.sura].ayas[n.ayaIdx].p,n.part.l,n.ayaIdx,-1))):(i.style.setProperty("font-family",S.font_family,""),i.style.setProperty("font-size",S.font_size+"px","")),o.appendChild(i),t.parts.forEach(function(t){var e,n,r,a=document.createElement("div"),s=K(t.sura+1,t.ayaIdx-1);DOMTokenList.prototype.add.apply(a.classList,s),t.countable?(r=0<(e=M(t.sura,t.ayaIdx)?V(t.part):0)?rt(p,e,l,c,d):{ligature:!1}).ligature?((n=document.createElement("span")).classList.add(I+"-word",I+"-basmala"),r.cls&&n.classList.add(I+"-word-"+r.cls),n.textContent=T,a.appendChild(n),p+=e):p=nt(a,t.part.t,l,p,c,d):u&&(0===t.ayaIdx||0===t.sura&&1===t.ayaIdx)?((r=document.createElement("span")).textContent=t.part.t,r.style.visibility="hidden",a.appendChild(r)):a.textContent=t.part.t,a.style.cssText="display:inline",i.appendChild(a),U(s.slice(-1)[0]),Y(o,s.slice(-1)[0],t.sura+1,t.ayaIdx-1)}),h&&e===s.length-1&&(n=t.parts[t.parts.length-1],X(i,F(n.sura,S.suras[n.sura].ayas[n.ayaIdx].p,n.part.l,n.ayaIdx,1)))})}var t,L,u,e=16,n=[16,24],r=[6,100],a=document.currentScript||document.querySelector(`script[src*="${I}"]`),f=a.getAttribute("data-name")||"Madina05",g=(a.getAttribute("data-font")||"me_quran").replaceAll(" ","_"),m=parseFloat(a.getAttribute("data-font-size"))||e,r=((m<r[0]||r[1]<m)&&(j(`font-size ${m} outside ${r[0]}..${r[1]}, using `+e),m=e),a.getAttribute("data-cdn")),a=(r&&(d=r.replace(/\/?$/,"/")),j(f+` with font: ${g} size: `+m),d+"dist/"+I+".min.css?v=1.1");function y(t){u=d+`assets/db/${L=f+`-${g}-${m=t}px`}/`}document.getElementById(I)||(r=document.getElementsByTagName("head")[0],(t=document.createElement("link")).id=I,t.rel="stylesheet",t.type="text/css",t.href=a,t.media="all",r.appendChild(t)),y(m);var v=null;function st(){v&&(S.font_size=v.font_size,S.line_width=v.line_width,S.stretch_scale=v.stretch_scale)}var c={};function b(t,e){if(!S.juz)return-1;for(var n=Math.max(e,2),r=0,a=S.juz,s=0;s<a.length&&(a[s][0]<t||a[s][0]===t&&a[s][1]<=n);s++)r=s;return r}function it(t,s){if(S.juz){for(var i,e=[],n=0;n<t.length;n++){var r=t[n];0<=r&&r<S.juz.length&&!c[r]&&e.indexOf(r)<0&&e.push(r)}0===e.length?s():(i=e.length,e.forEach(function(a){var t;h(u+"juz-"+((t=a+1)<10?"0":"")+t+".json",function(t){for(var e=t,n=0;n<e.d.length;n++){var r=e.d[n];S.suras[r[0]].ayas[r[1]]={p:r[2],r:r[3]}}c[a]=!0,0==--i&&s()},function(t){console.error(I+"> failed to load juz "+(a+1),t),c[a]=!0,0==--i&&s()})}))}else s()}function ot(t){if(!S.juz)return[];var e,n=[];if(null!=t.getAttribute("sura")&&null!=t.getAttribute("aya")){var r,a=P(t.getAttribute("sura"))[0],s=H(t.getAttribute("aya"));if(null!=t.getAttribute("words"))return[r=b(a,s[0]),(r+1)%S.juz.length];for(e=b(a,s[0]);e<=b(a,s[1]);e++)n.push(e)}else{if(null==t.getAttribute("page"))return[];var i=S.pages[parseInt(t.getAttribute("page"),10)-1];if(!i)return[];for(e=b(i[0],i[1]);e<=b(i[2],i[3]);e++)n.push(e)}return n}function lt(){const t=new FontFace(S.font_family,"url("+encodeURI(null==(e=S.font_url)||/^(https?:)?\/\//.test(e)?e:d+String(e).replace(/^\//,""))+")");var e;t.load().then(()=>{document.fonts.add(t)});class n extends HTMLElement{static get observedAttributes(){return["page","page_param","aya","sura","words","highlight","error","headless","quotes","inline","notitle"]}constructor(){super(),this._data={}}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}get page(){return this.getAttribute("page")}set page(t){this._data.page=t}get page_param(){return this.getAttribute("page_param")}set page_param(t){this._data.page_param=t}get aya(){return this.getAttribute("aya")}set aya(t){this._data.aya=t}get sura(){return this.getAttribute("sura")}set sura(t){this._data.sura=t}get words(){return this.getAttribute("words")}set words(t){this._data.words=t}get highlight(){return this.getAttribute("highlight")}set highlight(t){this._data.highlight=t}get error(){return this.getAttribute("error")}set error(t){this._data.error=t}get headless(){return this.getAttribute("headless")}set headless(t){this._data.headless=t}get quotes(){return this.getAttribute("quotes")}set quotes(t){this._data.quotes=t}get inline(){return this.getAttribute("inline")}set inline(t){this._data.inline=t}get notitle(){return this.getAttribute("notitle")}set notitle(t){this._data.notitle=t}render(t=this){var e;this._data.rendering||it(ot(e=this),function(){if(!e._data.rendering){e._data.rendering=!0;try{e.doRender(t)}finally{e._data.rendering=!1}}})}doRender(e){var n,r,a,t=null,s=null!=this.highlight?O(this.highlight):null,i=(null!=this.highlight&&null==s&&j("Bad highlight parameter: "+this.highlight),null!=this.error?O(this.error):null),o=(null!=this.error&&null==i&&j("Bad error parameter: "+this.error),this.page),l=N(this.headless),u=N(this.notitle),c=null!=this.quotes&&!N(this.quotes),d=this.inline,h=null!=this.sura&&null!=this.aya;if(h)m=f=P(this.sura)[0],a=!1,[g,y]=H(this.aya),null!=this.page&&j("Ignoring page parameter!"),o=S.suras[f].ayas[g].p;else{if(null==this.page)return console.error(I+"> Bad arguments: Not rendering!"),1;if(S.pages)var p=S.pages[o-1],f=p[0],g=p[1],m=p[2],y=p[3];else{for(y=g=m=f=0;S.suras[f].ayas.slice(-1)[0].p<o;)f+=1;for(m=f;m<114&&S.suras[m].ayas[0].p<=o;)m+=1;for(m-=1;S.suras[f].ayas[g].p<o;)g+=1;for(y=S.suras[m].ayas.length-1;S.suras[m].ayas[y].p>o;)y-=1}a=!0,null!=this.inline&&j("Ignoring inline parameter with page!")}if(null!=this.words)if(h){if(null!=(t=O(this.words)))return y!==g&&j("Ignoring aya range end with words parameter!"),500<t[1]-t[0]+1&&(j("words selection capped at 500 words"),t[1]=t[0]+499),void at(e,f,g,t,l,c,d,u,s=D("highlight",s,t),i=D("error",i,t));j("Bad words parameter: "+this.words)}else j("Ignoring words parameter with page!");var p=h?J(f,g,y):G(f,g,m,y,parseInt(o,10)),s=D("highlight",s,[1,p]),i=D("error",i,[1,p]),v=null!=s||null!=i,b=(v&&B(e),W(),e.innerHTML="",e.removeAttribute("style"),a=Z(d,a=(n=S.suras[f].ayas[g].r[0].l)!=(r=S.suras[m].ayas[y].r.slice(-1)[0].l)?!0:a),e.classList.toggle(I+"-inline",!a&&!c),a&&(tt(e,o,l),l||e.appendChild(Q(S.suras[f].name))),g),_=f,w=0;for(let t=n;t<=r;t++){const L=t;var x=document.createElement("quran-madina-html-line"),E=(e.appendChild(x),a?x.style.setProperty("display","block",""):(x.style.setProperty("font-family",S.font_family,""),x.style.setProperty("font-size",S.font_size+"px","")),a&&h&&t===n&&X(x,F(f,o,n,g,-1)),f==m?y:S.suras[_].ayas.length-1);for(let t=b;t<=Math.min(b+5,E);t++){var C,A,q,k,z,$=S.suras[_].ayas[t];void 0!==$&&$.p==o&&($=$.r.filter(t=>t.l==L)).length&&(a&&et(x,$[0].s),C=document.createElement("div"),A=K(_+1,t-1),DOMTokenList.prototype.add.apply(C.classList,A),v&&R(_,t)?(z=0<(q=M(_,t)?V($[0]):0)?rt(w,q,null,s,i):{ligature:!1}).ligature?((k=document.createElement("span")).classList.add(I+"-word",I+"-basmala"),z.cls&&k.classList.add(I+"-word-"+z.cls),k.textContent=T,C.appendChild(k),w+=q):w=nt(C,$[0].t,null,w,s,i):C.textContent=M(_,t)&&""!==$[0].t?T:$[0].t,C.style.cssText="display:inline",x.appendChild(C),U(A.slice(-1)[0]),Y(e,A.slice(-1)[0],_+1,t-1),b=t,z=_<113?S.suras[_+1].ayas[0]:void 0,E<=b)&&void 0!==z&&z.p==o&&z.r[0].l==L+1&&(_+=1,b=0)}a&&h&&t===r&&X(x,F(m,o,r,y,1))}}}customElements.define(I,n)}function _(){h(u+"manifest.json",function(t){if(t.content_hash){var e="quran-madina-html:hash:"+u,n=null;try{n=sessionStorage.getItem(e)}catch(t){}if(null!==n&&n!==t.content_hash){var r=u;try{for(var a=sessionStorage.length-1;0<=a;a--){var s=sessionStorage.key(a);s&&0===s.indexOf("quran-madina-html:"+r)&&sessionStorage.removeItem(s)}}catch(t){}Object.keys(o).forEach(function(t){0===t.indexOf(r)&&delete o[t]})}try{sessionStorage.setItem(e,t.content_hash)}catch(t){}}S={title:t.title,published:t.published,font_family:t.font_family,font_url:t.font_url,font_size:t.font_size,line_width:t.line_width,suras:t.suras.map(function(t){return{name:t[0],ayas:new Array(t[1])}}),juz:t.juz,pages:t.pages},st(),lt()},ut,!0)}function ut(){h(d+`assets/db/${L}.json`,function(t){S=t,st(),lt()},function(t){m!=e?(j(`no DB for font: ${g} size: ${m}, falling back to size: `+e),v=null,y(e),_()):console.error(I+"> no manifest and no monolithic DB",t)})}function ct(){function a(t){c||(c=!0,console.error(I+"> missing anchor DB for font-size interpolation",t),j("falling back to size: "+e),y(e),_())}var s=m,i=n[0],o=n[1],l=s-i<=o-s?i:o,u={},c=!1;n.forEach(function(e){var t,n,r;n=a,h(d+`assets/db/${r=f+`-${g}-${e}px`}/manifest.json`,t=function(t){u[e]=t,!c&&i in u&&o in u&&(t=Math.round(u[i].line_width+(u[o].line_width-u[i].line_width)*(s-i)/(o-i)),v={font_size:s,line_width:t,stretch_scale:t*l/(u[l].line_width*s)},j(`font-size ${s}px interpolated from ${i}px/${o}px anchors: line_width ${t}, render data from ${l}px`),y(l),_())},function(){h(d+`assets/db/${r}.json`,t,n)})})}(0<=n.indexOf(m)?_:ct)()}();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quran-madina-html",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "devDependencies": {
5
5
  "grunt": "^1.6.2",
6
6
  "grunt-contrib-clean": "^2.0.1",
@@ -34,7 +34,6 @@
34
34
  "keywords": [
35
35
  "quran",
36
36
  "html",
37
- "x-tag",
38
37
  "madina"
39
38
  ],
40
39
  "author": "Tarek Eldeeb",
@@ -60,9 +59,6 @@
60
59
  ]
61
60
  }
62
61
  },
63
- "dependencies": {
64
- "x-tag": "^1.5.11"
65
- },
66
62
  "overrides": {
67
63
  "minimatch": "3.1.5",
68
64
  "undici": "7.28.0",