al-quran.reflectslight.io/build/al-quran/js/loaders/surah-index-loader.js
2024-10-02 21:01:13 -03:00

1 line
No EOL
3.1 KiB
JavaScript

(()=>{"use strict";const t=(t,e)=>({priority:1,group:"fonts",requestId:"font",href:e,fontFamily:t}),e=(t,e)=>({priority:4,group:"scripts",requestId:"script",href:t,props:e}),r=t=>t,n={font(t){const{fontFamily:e,href:r}=t;return new FontFace(e,r).load()},script(t,e={}){const{href:r}=t;return fetch(r,e).then((t=>t.text())).then((e=>({type:"application/javascript",text:e,...t.props}))).then((t=>Object.assign(document.createElement("script"),t)))},css(t,e={}){const{href:r}=t;return fetch(r,e).then((t=>t.text())).then((t=>({innerText:t}))).then((t=>Object.assign(document.createElement("style"),t)))},image(t){const{href:e}=t;return new Promise(((t,r)=>{const n=document.createElement("img");n.onload=()=>t(n),n.onerror=r,n.src=e}))},json(t,e={}){const{href:r}=t;return fetch(r,e).then((t=>t.text())).then((t=>({type:"application/json",text:t}))).then((e=>Object.assign(e,t.props||{}))).then((t=>Object.assign(document.createElement("script"),t)))}};var o=Object.defineProperty,s=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,a=(t,e,r)=>e in t?o(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;!function(){return o=this,u=function*(){const o=document.documentElement,u=o.querySelector(".postman.main"),l=o.querySelector(".postman.css"),p=o.querySelector("meta[name='revision']").getAttribute("content"),f=(()=>{const e=[t("Cairo Regular","url(/fonts/cairo-regular.ttf)"),t("Kanit Regular","url(/fonts/kanit-regular.ttf)")];return"rtl"===o.dir&&e.push(t("Cairo Bold","url(/fonts/cairo-bold.ttf)")),e})(),h=yield function(...t){const e=Object.create(null),r={fonts:[],images:[],css:[],scripts:[],json:[]},[o,s]=function(t){const e=[];let r=t=>t;return t.forEach((t=>{"function"==typeof t?r=t:e.push(t)})),[e,r]}(t);o.sort(((t,e)=>t.priority>=e.priority?1:-1));let c=0;const i=t=>(c++,c<=o.length&&s(c/o.length*100),t);return e.deliver=async()=>(await Promise.all((()=>{const t=o.map((t=>{if("fontFamily"in t)return(0,n.font)(t).then((t=>i(t))).then((t=>r.fonts.push(t))).then((()=>r));if("font"!==t.requestId&&"fonts"!==t.group){const e=n[t.requestId],o=r[t.group];return e(t).then((t=>i(t))).then((t=>o.push(t))).then((()=>r))}return null}));return t})()),r),e}(e(`/js/main/vendor.js?v=${p}`,{id:"0"}),e(`/js/main/surah-index.js?v=${p}`,{id:"1"}),...f,r((t=>{const e=u.querySelector("progress"),r=u.querySelector(".percentage");e.value=t,r.innerText=function(t,e,r={}){const n="string"==typeof t?t:t.name,o="ar"===n?"ar-SA":n;return new Intl.NumberFormat(o,((t,e)=>{for(var r in e||(e={}))c.call(e,r)&&a(t,r,e[r]);if(s)for(var r of s(e))i.call(e,r)&&a(t,r,e[r]);return t})({maximumFractionDigits:1},r)).format(e)}(o.lang,Number(t.toFixed(0)))}))).deliver();[u,l].forEach((t=>t.remove())),h.fonts.forEach((t=>document.fonts.add(t))),h.css.forEach((t=>document.head.appendChild(t))),h.scripts.sort(((t,e)=>Number(t.id)-Number(e.id))).forEach((t=>{document.body.removeChild(document.body.appendChild(t))}))},new Promise(((t,e)=>{var r=t=>{try{s(u.next(t))}catch(t){e(t)}},n=t=>{try{s(u.throw(t))}catch(t){e(t)}},s=e=>e.done?t(e.value):Promise.resolve(e.value).then(r,n);s((u=u.apply(o,null)).next())}));var o,u}()})();