Commit 7513ed3b authored by David Trattnig's avatar David Trattnig
Browse files

Commit web-apps to avoid Node dependency in Prod.

parent 6ee84fe0
......@@ -5,10 +5,6 @@ logs
tmp
.vscode/tags
configuration/engine.ini
web/css/aura-clock-bundle.css
web/css/aura-player-bundle.css
web/js/aura-clock-bundle.js
web/js/aura-player-bundle.js
web/clock.html
web/trackservice.html
script/.engine.install-db.lock
\ No newline at end of file
/*# sourceMappingURL=aura-clock-bundle.css.map */
\ No newline at end of file
/*# sourceMappingURL=aura-player-bundle.css.map */
\ No newline at end of file
!function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function r(t){t.forEach(e)}function o(t){return"function"==typeof t}function l(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function i(t,e){t.appendChild(e)}function s(t,e,n){t.insertBefore(e,n||null)}function c(t){t.parentNode.removeChild(t)}function a(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}function u(t){return document.createElement(t)}function d(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function h(t){return document.createTextNode(t)}function f(){return h(" ")}function g(){return h("")}function p(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function m(t,e){e=""+e,t.data!==e&&(t.data=e)}function b(t,e,n,r){t.style.setProperty(e,n,r?"important":"")}class x{constructor(t,e=null){this.e=u("div"),this.a=e,this.u(t)}m(t,e=null){for(let n=0;n<this.n.length;n+=1)s(t,this.n[n],e);this.t=t}u(t){this.e.innerHTML=t,this.n=Array.from(this.e.childNodes)}p(t){this.d(),this.u(t),this.m(this.t,this.a)}d(){this.n.forEach(c)}}let y;function k(t){y=t}function w(){if(!y)throw new Error("Function called outside component initialization");return y}const $=[],v=[],S=[],_=[],E=Promise.resolve();let z=!1;function M(t){S.push(t)}let A=!1;const C=new Set;function N(){if(!A){A=!0;do{for(let t=0;t<$.length;t+=1){const e=$[t];k(e),L(e.$$)}for($.length=0;v.length;)v.pop()();for(let t=0;t<S.length;t+=1){const e=S[t];C.has(e)||(C.add(e),e())}S.length=0}while($.length);for(;_.length;)_.pop()();z=!1,A=!1,C.clear()}}function L(t){if(null!==t.fragment){t.update(),r(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(M)}}const T=new Set;let D,j;function H(t,e){t&&t.i&&(T.delete(t),t.i(e))}function I(t,e){const n=e.token={};function o(t,o,l,i){if(e.token!==n)return;e.resolved=i;let s=e.ctx;void 0!==l&&(s=s.slice(),s[l]=i);const c=t&&(e.current=t)(s);let a=!1;e.block&&(e.blocks?e.blocks.forEach((t,n)=>{n!==o&&t&&(D={r:0,c:[],p:D},function(t,e,n,r){if(t&&t.o){if(T.has(t))return;T.add(t),D.c.push(()=>{T.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}}(t,1,1,()=>{e.blocks[n]=null}),D.r||r(D.c),D=D.p)}):e.block.d(1),c.c(),H(c,1),c.m(e.mount(),e.anchor),a=!0),e.block=c,e.blocks&&(e.blocks[o]=c),a&&N()}if((l=t)&&"object"==typeof l&&"function"==typeof l.then){const n=w();if(t.then(t=>{k(n),o(e.then,1,e.value,t),k(null)},t=>{k(n),o(e.catch,2,e.error,t),k(null)}),e.current!==e.pending)return o(e.pending,0),!0}else{if(e.current!==e.then)return o(e.then,1,e.value,t),!0;e.resolved=t}var l}function O(t,e){-1===t.$$.dirty[0]&&($.push(t),z||(z=!0,E.then(N)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function R(l,i,s,c,a,u,d=[-1]){const h=y;k(l);const f=i.props||{},g=l.$$={fragment:null,ctx:null,props:u,update:t,not_equal:a,bound:n(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(h?h.$$.context:[]),callbacks:n(),dirty:d};let p=!1;g.ctx=s?s(l,f,(t,e,...n)=>{const r=n.length?n[0]:e;return g.ctx&&a(g.ctx[t],g.ctx[t]=r)&&(g.bound[t]&&g.bound[t](r),p&&O(l,t)),e}):[],g.update(),p=!0,r(g.before_update),g.fragment=!!c&&c(g.ctx),i.target&&(i.hydrate?g.fragment&&g.fragment.l(function(t){return Array.from(t.childNodes)}(i.target)):g.fragment&&g.fragment.c(),i.intro&&H(l.$$.fragment),function(t,n,l){const{fragment:i,on_mount:s,on_destroy:c,after_update:a}=t.$$;i&&i.m(n,l),M(()=>{const n=s.map(e).filter(o);c?c.push(...n):r(n),t.$$.on_mount=[]}),a.forEach(M)}(l,i.target,i.anchor),N()),k(h)}function B(t,e,n){const r=t.slice();return r[21]=e[n],r[23]=n,r}function P(t,e,n){const r=t.slice();return r[27]=e[n],r}function q(t,e,n){const r=t.slice();return r[24]=e[n],r}function F(t){let e,n;return{c(){e=d("line"),p(e,"class","minor"),p(e,"y1","42"),p(e,"y2","45"),p(e,"transform",n="rotate("+6*(t[24]+t[27])+")")},m(t,n){s(t,e,n)},d(t){t&&c(e)}}}function J(e){let n,r,o,l=[1,2,3,4],i=[];for(let t=0;t<4;t+=1)i[t]=F(P(e,l,t));return{c(){n=d("line");for(let t=0;t<4;t+=1)i[t].c();o=g(),p(n,"class","major"),p(n,"y1","35"),p(n,"y2","45"),p(n,"transform",r="rotate("+30*e[24]+")")},m(t,e){s(t,n,e);for(let n=0;n<4;n+=1)i[n].m(t,e);s(t,o,e)},p:t,d(t){t&&c(n),a(i,t),t&&c(o)}}}function G(t){let e,n,r,o=t[20]+"";return{c(){e=u("div"),n=u("p"),r=h(o),p(e,"class","error")},m(t,o){s(t,e,o),i(e,n),i(n,r)},p(t,e){16&e&&o!==(o=t[20]+"")&&m(r,o)},d(t){t&&c(e)}}}function K(t){let e,n,r,o=t[9](t[19])+"",l=t[19].current.show&&Q(t);return{c(){e=h(o),n=f(),l&&l.c(),r=g()},m(t,o){s(t,e,o),s(t,n,o),l&&l.m(t,o),s(t,r,o)},p(t,n){16&n&&o!==(o=t[9](t[19])+"")&&m(e,o),t[19].current.show?l?l.p(t,n):(l=Q(t),l.c(),l.m(r.parentNode,r)):l&&(l.d(1),l=null)},d(t){t&&c(e),t&&c(n),l&&l.d(t),t&&c(r)}}}function Q(t){let e,n,r,o,l,a,d,g,b,y,k,w,$,v,S=t[11](t[19].current.show)+"",_=nt(t[19].current)+"",E=t[11](t[19].next.show)+"",z=nt(t[19])+"";function M(t,e){return t[19].current.playlist?V:U}let A=M(t),C=A(t);return{c(){e=u("div"),n=u("h1"),o=f(),l=h(_),a=f(),d=u("div"),C.c(),g=f(),b=u("div"),y=u("h3"),k=h("Next: "),$=f(),v=h(z),r=new x(S,o),p(n,"class","schedule-title"),p(e,"id","current-schedule"),p(d,"id","playlist"),w=new x(E,$),p(y,"class","schedule-title"),p(b,"id","next-schedule")},m(t,c){s(t,e,c),i(e,n),r.m(n),i(n,o),i(n,l),s(t,a,c),s(t,d,c),C.m(d,null),s(t,g,c),s(t,b,c),i(b,y),i(y,k),w.m(y),i(y,$),i(y,v)},p(t,e){16&e&&S!==(S=t[11](t[19].current.show)+"")&&r.p(S),16&e&&_!==(_=nt(t[19].current)+"")&&m(l,_),A===(A=M(t))&&C?C.p(t,e):(C.d(1),C=A(t),C&&(C.c(),C.m(d,null))),16&e&&E!==(E=t[11](t[19].next.show)+"")&&w.p(E),16&e&&z!==(z=nt(t[19])+"")&&m(v,z)},d(t){t&&c(e),t&&c(a),t&&c(d),C.d(),t&&c(g),t&&c(b)}}}function U(t){let e,n,r,o,l,a,d,g=et(t[19].track)+"",b=t[10](t[5])+"";return{c(){e=u("div"),n=u("h2"),r=u("span"),o=h(g),l=f(),a=u("span"),d=h(b),p(r,"class","track-title"),p(a,"class","track-time-left"),p(e,"id","current-track"),p(e,"class","is-active")},m(t,c){s(t,e,c),i(e,n),i(n,r),i(r,o),i(n,l),i(n,a),i(a,d)},p(t,e){16&e&&g!==(g=et(t[19].track)+"")&&m(o,g),32&e&&b!==(b=t[10](t[5])+"")&&m(d,b)},d(t){t&&c(e)}}}function V(t){let e,n=t[19].current.playlist.entries,r=[];for(let e=0;e<n.length;e+=1)r[e]=Y(B(t,n,e));return{c(){e=u("ol");for(let t=0;t<r.length;t+=1)r[t].c()},m(t,n){s(t,e,n);for(let t=0;t<r.length;t+=1)r[t].m(e,null)},p(t,o){if(1072&o){let l;for(n=t[19].current.playlist.entries,l=0;l<n.length;l+=1){const i=B(t,n,l);r[l]?r[l].p(i,o):(r[l]=Y(i),r[l].c(),r[l].m(e,null))}for(;l<r.length;l+=1)r[l].d(1);r.length=n.length}},d(t){t&&c(e),a(r,t)}}}function W(t){let e,n,r,o,l,a,d,g,b,x=et(t[21])+"",y=t[10](t[21].duration)+"";return{c(){e=u("li"),n=u("span"),r=h(x),o=f(),l=u("span"),a=h("("),d=h(y),g=h(")"),b=f(),p(n,"class","track-title"),p(l,"class","track-duration"),p(e,"class","playlist-entry")},m(t,c){s(t,e,c),i(e,n),i(n,r),i(e,o),i(e,l),i(l,a),i(l,d),i(l,g),i(e,b)},p(t,e){16&e&&x!==(x=et(t[21])+"")&&m(r,x),16&e&&y!==(y=t[10](t[21].duration)+"")&&m(d,y)},d(t){t&&c(e)}}}function X(t){let e,n,r,o,l,a,d,g,b,x=et(t[21])+"",y=t[10](t[5])+"";return{c(){e=u("li"),n=u("span"),r=h(x),o=f(),l=u("span"),a=h("("),d=h(y),g=h(")"),b=f(),p(n,"class","track-title"),p(l,"class","track-time-left"),p(e,"id","current-playlist-entry"),p(e,"class","playlist-entry is-active")},m(t,c){s(t,e,c),i(e,n),i(n,r),i(e,o),i(e,l),i(l,a),i(l,d),i(l,g),i(e,b)},p(t,e){16&e&&x!==(x=et(t[21])+"")&&m(r,x),32&e&&y!==(y=t[10](t[5])+"")&&m(d,y)},d(t){t&&c(e)}}}function Y(t){let e,n;function r(t,n){return(null==e||16&n)&&(e=!!function(t,e){if(null!=e&&t.id==e.id)return location.hash="#current-playlist-entry",!0;return!1}(t[21],t[19].track)),e?X:W}let o=r(t,-1),l=o(t);return{c(){l.c(),n=g()},m(t,e){l.m(t,e),s(t,n,e)},p(t,e){o===(o=r(t,e))&&l?l.p(t,e):(l.d(1),l=o(t),l&&(l.c(),l.m(n.parentNode,n)))},d(t){l.d(t),t&&c(n)}}}function Z(e){let n;return{c(){n=u("div"),n.innerHTML='<span class="sr-only">Loading...</span>',p(n,"class","spinner-border mt-5"),p(n,"role","status")},m(t,e){s(t,n,e)},p:t,d(t){t&&c(n)}}}function tt(e){let n,r,o,l,g,x,y,k,w,$,v,S,_,E,z,M,A,C,N,L,T,D,j,H,O,R,B=[0,5,10,15,20,25,30,35,40,45,50,55],P=[];for(let t=0;t<12;t+=1)P[t]=J(q(e,B,t));let F={ctx:e,current:null,token:null,pending:Z,then:K,catch:G,value:19,error:20};return I(H=e[4],F),{c(){n=u("main"),r=f(),o=u("div"),l=u("img"),x=f(),y=u("h1"),k=h(e[0]),w=f(),$=u("div"),v=u("div"),S=d("svg"),_=d("circle");for(let t=0;t<12;t+=1)P[t].c();E=d("line"),M=d("line"),C=d("g"),N=d("line"),L=d("line"),D=f(),j=u("div"),F.block.c(),O=f(),R=u("footer"),R.innerHTML='<a href="https://gitlab.servus.at/aura/meta"><img id="aura-logo" src="https://gitlab.servus.at/aura/meta/-/raw/master/images/aura-logo.png" alt="Aura Logo"></a> \n\t<br>\n\tStudio Clock is powered by <a href="https://gitlab.servus.at/autoradio">Aura Engine</a>',this.c=t,p(l,"id","station-logo"),l.src!==(g=e[1])&&p(l,"src",g),b(l,"width",e[2]),p(l,"alt","Radio Station"),p(l,"align","left"),p(y,"id","station-name"),p(o,"id","station-header"),p(_,"class","clock-face"),p(_,"r","48"),p(E,"class","hour"),p(E,"y1","2"),p(E,"y2","-20"),p(E,"transform",z="rotate("+(30*e[6]+e[7]/2)+")"),p(M,"class","minute"),p(M,"y1","4"),p(M,"y2","-30"),p(M,"transform",A="rotate("+(6*e[7]+e[8]/10)+")"),p(N,"class","second"),p(N,"y1","10"),p(N,"y2","-38"),p(L,"class","second-counterweight"),p(L,"y1","10"),p(L,"y2","2"),p(C,"transform",T="rotate("+6*e[8]+")"),p(S,"viewBox","-50 -50 100 100"),p(v,"id","left-column"),p(v,"class","column"),p(j,"id","right-column"),p(j,"class","column"),p($,"id","studio-clock")},m(t,c){s(t,n,c),e[18](n),s(t,r,c),s(t,o,c),i(o,l),i(o,x),i(o,y),i(y,k),s(t,w,c),s(t,$,c),i($,v),i(v,S),i(S,_);for(let t=0;t<12;t+=1)P[t].m(S,null);i(S,E),i(S,M),i(S,C),i(C,N),i(C,L),i($,D),i($,j),F.block.m(j,F.anchor=null),F.mount=()=>j,F.anchor=null,s(t,O,c),s(t,R,c)},p(t,[n]){if(e=t,2&n&&l.src!==(g=e[1])&&p(l,"src",g),4&n&&b(l,"width",e[2]),1&n&&m(k,e[0]),192&n&&z!==(z="rotate("+(30*e[6]+e[7]/2)+")")&&p(E,"transform",z),384&n&&A!==(A="rotate("+(6*e[7]+e[8]/10)+")")&&p(M,"transform",A),256&n&&T!==(T="rotate("+6*e[8]+")")&&p(C,"transform",T),F.ctx=e,16&n&&H!==(H=e[4])&&I(H,F));else{const t=e.slice();t[19]=F.resolved,F.block.p(t,n)}},i:t,o:t,d(t){t&&c(n),e[18](null),t&&c(r),t&&c(o),t&&c(w),t&&c($),a(P,t),F.block.d(),F.token=null,F=null,t&&c(O),t&&c(R)}}}"function"==typeof HTMLElement&&(j=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){for(const t in this.$$.slotted)this.appendChild(this.$$.slotted[t])}attributeChangedCallback(t,e,n){this[t]=n}$destroy(){!function(t,e){const n=t.$$;null!==n.fragment&&(r(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(){}});function et(t){if(null!=t){let e="";return""!=t.artist&&(e=t.artist+" - "),e+t.title}return""}function nt(t){let e="";if(null!=t&&null!=t.schedule_start){let n="";if(null!=t.schedule_start){let n=new Date(Date.parse(t.schedule_start));n=n.toLocaleTimeString(navigator.language,{hour:"2-digit",minute:"2-digit"}),e="("+n}null!=t.schedule_end?(n=new Date(Date.parse(t.schedule_end)),n=n.toLocaleTimeString(navigator.language,{hour:"2-digit",minute:"2-digit"}),e=e+" - "+n+")"):e+=")"}return e}function rt(t,e,n){let r,o,l,{css:i=""}=e,{api:s="http://localhost:3333/api/v1"}=e,{name:c="Studio Clock"}=e,{logo:a="https://gitlab.servus.at/aura/meta/-/raw/master/images/aura-logo.png"}=e,{logosize:u="100px"}=e,{noScheduleMessage:d="Nothing scheduled!"}=e,h=new Date,f=null;var g;async function p(t){let e,n;try{e=await fetch(s+t)}catch{throw new Error("Cannot connect to Engine!")}try{n=await e.json()}catch(t){throw console.log("Error while converting response to JSON!",t),new Error(e.statusText)}if(e.ok)return n;throw console.log("Error:",n),new Error(n.message)}let m,b,x;return o=p("/clock"),g=()=>{const t=setInterval(()=>{n(15,h=new Date),n(5,l-=1),(l<=0||null==o)&&(f=null,n(4,o=null),n(4,o=p("/clock")))},1e3);return()=>{clearInterval(t)}},w().$$.on_mount.push(g),t.$set=t=>{"css"in t&&n(12,i=t.css),"api"in t&&n(13,s=t.api),"name"in t&&n(0,c=t.name),"logo"in t&&n(1,a=t.logo),"logosize"in t&&n(2,u=t.logosize),"noScheduleMessage"in t&&n(14,d=t.noScheduleMessage)},t.$$.update=()=>{32768&t.$$.dirty&&n(6,m=h.getHours()),32768&t.$$.dirty&&n(7,b=h.getMinutes()),32768&t.$$.dirty&&n(8,x=h.getSeconds())},[c,a,u,r,o,l,m,b,x,function(t){if(null!=i&&function(t,e){let n=document.createElement("link");n.setAttribute("rel","stylesheet"),n.setAttribute("type","text/css"),n.setAttribute("href",e),t.appendChild(n)}(r,i),null==f&&null!=t&&null!=t.track){f=t;let e=h-Date.parse(t.track_start);e=parseInt(e/1e3),n(5,l=t.track.duration-e-3),console.log("Current Data",t)}return""},function(t){if(null!=t&&Number.isInteger(t)){let e,n=new Date(null);return n.setSeconds(t),e=t>3600?n.toISOString().substr(11,8):n.toISOString().substr(14,5),e}return""},function(t){let e="";return e=null==t||null==t.name?'<span class="error">'+d+"</span>":t.name,e},i,s,d,h,f,p,function(t){v[t?"unshift":"push"](()=>{n(3,r=t)})}]}customElements.define("aura-clock",class extends j{constructor(t){super(),this.shadowRoot.innerHTML='<style>#station-header{width:100%;height:50px;padding:40px 100px}#station-name{margin:0;font-size:3em;line-height:80px}#station-logo{align-content:left;text-align:right;margin:0 40px 0 10px;opacity:0.5;filter:invert(100%)}#studio-clock{width:calc(100% - 200px);height:calc(100% - 500px);margin:100px;display:-webkit-flex;display:-ms-flexbox;display:flex;flex-direction:row}#left-column{width:30%;padding:25px}#right-column{width:70%;padding:25px 25px 25px 50px}#current-schedule,#next-schedule{margin:0 0 40px 20px}#next-schedule{background-color:rgb(24, 24, 24);margin-right:20px;padding:12px}#current-schedule .schedule-title{color:#ccc;font-size:3.5em}#next-schedule .schedule-title{color:gray !important;font-size:2em}#playlist{border:2px solid #333;margin:20px 20px 40px 20px;padding:10px;height:calc(80% - 100px);overflow-y:auto;scroll-behavior:smooth;background-color:#111;display:flex;align-items:center}#playlist::-webkit-scrollbar-track{border-radius:10px;-webkit-box-shadow:inset 0 0 6px rgba(0,0,0,0.3);background-color:rgb(77, 73, 73)}#playlist::-webkit-scrollbar{width:12px;background-color:rgb(0, 0, 0)}#playlist::-webkit-scrollbar-thumb{border-radius:10px;-webkit-box-shadow:inset 0 0 6px rgba(0,0,0,.3);background-color:rgb(34, 32, 32)}.playlist-entry{font-size:1.9em;padding-left:53px}#current-track *{font-size:1.5em}.track-time-left{margin:25px 50px}.is-active{color:green;padding-left:0}.is-active .track-title::before{content:"\\00a0\\00a0▶\\00a0\\00a0\\00a0";font-size:larger;color:green}.is-active .track-time-left{color:rgb(43, 241, 36);background-color:#222;padding:5px 15px}.error{font-size:1.3em;color:red;height:100%;display:flex;align-items:center;justify-content:center}svg{width:100%;height:100%}.clock-face{stroke:rgb(66, 66, 66);fill:black}.minor{stroke:rgb(132, 132, 132);stroke-width:0.5}.major{stroke:rgb(162, 162, 162);stroke-width:1}.hour{stroke:rgba(255, 255, 255, 0.705)}.minute{stroke:rgba(255, 255, 255, 0.705)}.second,.second-counterweight{stroke:rgb(180,0,0)}footer{width:100%;text-align:center;font-size:0.8em;color:gray;opacity:0.5}footer a{color:gray;text-decoration:underline}footer #aura-logo{filter:invert(100%);width:75px;margin:0 0 20px 0}</style>',R(this,{target:this.shadowRoot},rt,tt,l,{css:12,api:13,name:0,logo:1,logosize:2,noScheduleMessage:14}),t&&(t.target&&s(t.target,this,t.anchor),t.props&&(this.$set(t.props),N()))}static get observedAttributes(){return["css","api","name","logo","logosize","noScheduleMessage"]}get css(){return this.$$.ctx[12]}set css(t){this.$set({css:t}),N()}get api(){return this.$$.ctx[13]}set api(t){this.$set({api:t}),N()}get name(){return this.$$.ctx[0]}set name(t){this.$set({name:t}),N()}get logo(){return this.$$.ctx[1]}set logo(t){this.$set({logo:t}),N()}get logosize(){return this.$$.ctx[2]}set logosize(t){this.$set({logosize:t}),N()}get noScheduleMessage(){return this.$$.ctx[14]}set noScheduleMessage(t){this.$set({noScheduleMessage:t}),N()}})}();
//# sourceMappingURL=aura-clock-bundle.js.map
!function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function r(t){t.forEach(e)}function o(t){return"function"==typeof t}function a(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function c(t,e){t.appendChild(e)}function i(t,e,n){t.insertBefore(e,n||null)}function l(t){t.parentNode.removeChild(t)}function s(t){return document.createElement(t)}function u(t){return document.createTextNode(t)}function d(){return u(" ")}function f(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function p(t,e){e=""+e,t.data!==e&&(t.data=e)}let h;function m(t){h=t}function g(){if(!h)throw new Error("Function called outside component initialization");return h}const b=[],k=[],$=[],y=[],x=Promise.resolve();let v=!1;function w(t){$.push(t)}function _(){const t=new Set;do{for(;b.length;){const t=b.shift();m(t),S(t.$$)}for(;k.length;)k.pop()();for(let e=0;e<$.length;e+=1){const n=$[e];t.has(n)||(n(),t.add(n))}$.length=0}while(b.length);for(;y.length;)y.pop()();v=!1}function S(t){if(null!==t.fragment){t.update(),r(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(w)}}const T=new Set;let E,L;function D(t,e){t&&t.i&&(T.delete(t),t.i(e))}function A(t,e){const n=e.token={};function o(t,o,a,c){if(e.token!==n)return;e.resolved=c;let i=e.ctx;void 0!==a&&(i=i.slice(),i[a]=c);const l=t&&(e.current=t)(i);let s=!1;e.block&&(e.blocks?e.blocks.forEach((t,n)=>{n!==o&&t&&(E={r:0,c:[],p:E},function(t,e,n,r){if(t&&t.o){if(T.has(t))return;T.add(t),E.c.push(()=>{T.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}}(t,1,1,()=>{e.blocks[n]=null}),E.r||r(E.c),E=E.p)}):e.block.d(1),l.c(),D(l,1),l.m(e.mount(),e.anchor),s=!0),e.block=l,e.blocks&&(e.blocks[o]=l),s&&_()}if((a=t)&&"object"==typeof a&&"function"==typeof a.then){const n=g();if(t.then(t=>{m(n),o(e.then,1,e.value,t),m(null)},t=>{m(n),o(e.catch,2,e.error,t),m(null)}),e.current!==e.pending)return o(e.pending,0),!0}else{if(e.current!==e.then)return o(e.then,1,e.value,t),!0;e.resolved=t}var a}function C(t,e){-1===t.$$.dirty[0]&&(b.push(t),v||(v=!0,x.then(_)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function I(a,c,i,l,s,u,d=[-1]){const f=h;m(a);const p=c.props||{},g=a.$$={fragment:null,ctx:null,props:u,update:t,not_equal:s,bound:n(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(f?f.$$.context:[]),callbacks:n(),dirty:d};let b=!1;g.ctx=i?i(a,p,(t,e,n=e)=>(g.ctx&&s(g.ctx[t],g.ctx[t]=n)&&(g.bound[t]&&g.bound[t](n),b&&C(a,t)),e)):[],g.update(),b=!0,r(g.before_update),g.fragment=!!l&&l(g.ctx),c.target&&(c.hydrate?g.fragment&&g.fragment.l(function(t){return Array.from(t.childNodes)}(c.target)):g.fragment&&g.fragment.c(),c.intro&&D(a.$$.fragment),function(t,n,a){const{fragment:c,on_mount:i,on_destroy:l,after_update:s}=t.$$;c&&c.m(n,a),w(()=>{const n=i.map(e).filter(o);l?l.push(...n):r(n),t.$$.on_mount=[]}),s.forEach(w)}(a,c.target,c.anchor),_()),m(f)}function M(t,e,n){const r=t.slice();return r[9]=e[n],r}function H(t){let e,n,r=t[8].message+"";return{c(){var t,o,a;e=s("p"),n=u(r),t="color",o="red",e.style.setProperty(t,o,a?"important":"")},m(t,r){i(t,e,r),c(e,n)},p(t,e){2&e&&r!==(r=t[8].message+"")&&p(n,r)},d(t){t&&l(e)}}}function N(t){let e,n=t[7],r=[];for(let e=0;e<n.length;e+=1)r[e]=j(M(t,n,e));return{c(){for(let t=0;t<r.length;t+=1)r[t].c();e=u("")},m(t,n){for(let e=0;e<r.length;e+=1)r[e].m(t,n);i(t,e,n)},p(t,o){if(6&o){let a;for(n=t[7],a=0;a<n.length;a+=1){const c=M(t,n,a);r[a]?r[a].p(c,o):(r[a]=j(c),r[a].c(),r[a].m(e.parentNode,e))}for(;a<r.length;a+=1)r[a].d(1);r.length=n.length}},d(t){!function(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}(r,t),t&&l(e)}}}function j(t){let e,n,r,o,a,h,m,g,b,k,$,y,x,v,w,_,S=t[2](t[9])+"",T=R(t[9])+"",E=t[9].track.artist+"",L=t[9].track.title+"",D=B(t[9])+"";return{c(){e=s("h4"),n=u(S),r=d(),o=s("div"),a=s("div"),h=s("h5"),m=s("b"),g=u(T),b=u(" | "),k=u(E),$=u(" - "),y=u(L),x=d(),v=u(D),w=d(),f(e,"class","current-date"),f(h,"class","card-title"),f(a,"class","card-body"),f(o,"class",_="card mt-5 "+q(t[9]))},m(t,l){i(t,e,l),c(e,n),i(t,r,l),i(t,o,l),c(o,a),c(a,h),c(h,m),c(m,g),c(h,b),c(h,k),c(h,$),c(h,y),c(h,x),c(h,v),c(o,w)},p(t,e){2&e&&S!==(S=t[2](t[9])+"")&&p(n,S),2&e&&T!==(T=R(t[9])+"")&&p(g,T),2&e&&E!==(E=t[9].track.artist+"")&&p(k,E),2&e&&L!==(L=t[9].track.title+"")&&p(y,L),2&e&&D!==(D=B(t[9])+"")&&p(v,D),2&e&&_!==(_="card mt-5 "+q(t[9]))&&f(o,"class",_)},d(t){t&&l(e),t&&l(r),t&&l(o)}}}function z(e){let n;return{c(){n=s("div"),n.innerHTML='<div class="lds-dual-ring"></div> \n\t\t\t\t\t<div class="loading">Loading...</div>',f(n,"class","spinner"),f(n,"role","status")},m(t,e){i(t,n,e)},p:t,d(t){t&&l(n)}}}function O(e){let n,r,o,a,h,m,g,b,k,$,y,x,v,w={ctx:e,current:null,token:null,pending:z,then:N,catch:H,value:7,error:8};return A(k=e[1],w),{c(){n=s("div"),r=s("div"),o=s("div"),a=d(),h=s("div"),m=s("h1"),g=u(e[0]),b=d(),w.block.c(),$=d(),y=s("div"),x=d(),v=s("footer"),v.innerHTML='Track Service is powered by <a href="https://gitlab.servus.at/autoradio">Aura</a>',this.c=t,f(o,"class","col-md"),f(m,"class","display-4"),f(h,"class","col-md-8 text-center"),f(y,"class","col-md"),f(r,"class","row"),f(n,"class","container mt-5")},m(t,e){i(t,n,e),c(n,r),c(r,o),c(r,a),c(r,h),c(h,m),c(m,g),c(h,b),w.block.m(h,w.anchor=null),w.mount=()=>h,w.anchor=null,c(r,$),c(r,y),i(t,x,e),i(t,v,e)},p(t,[n]){if(e=t,1&n&&p(g,e[0]),w.ctx=e,2&n&&k!==(k=e[1])&&A(k,w));else{const t=e.slice();t[7]=w.resolved,w.block.p(t,n)}},i:t,o:t,d(t){t&&l(n),w.block.d(),w.token=null,w=null,t&&l(x),t&&l(v)}}}"function"==typeof HTMLElement&&(L=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){for(const t in this.$$.slotted)this.appendChild(this.$$.slotted[t])}attributeChangedCallback(t,e,n){this[t]=n}$destroy(){!function(t,e){const n=t.$$;null!==n.fragment&&(r(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(){}});let P="trackservice";function R(t){return new Date(t.track_start).toLocaleTimeString("de-at",{hour:"2-digit",minute:"2-digit"})}function q(t){if(null!=t.track.duration&&parseInt(t.track.duration)>0){let e=new Date(t.track_start),n=new Date(e.getTime());n.setSeconds(n.getSeconds()+parseInt(t.track.duration));let r=new Date;return e<r&&r<n?"active-track":""}return""}function B(t){return null!=t.track.duration&&parseInt(t.track.duration)>0?"("+function(t){if(null!=t&&Number.isInteger(t)){let e,n=new Date(null);return n.setSeconds(t),e=t>3600?n.toISOString().substr(11,8):n.toISOString().substr(14,5),e}return""}(t.track.duration)+")":""}function F(t,e,n){let r,{api:o="http://localhost:3333/api/v1/"}=e,{name:a="Track Service"}=e,c="";return r=async function(t){let e=await fetch(`${o}${t}`),n=await e.json();if(e.ok)return n;throw new Error(n)}(P),t.$set=t=>{"api"in t&&n(3,o=t.api),"name"in t&&n(0,a=t.name)},[a,r,function(t){let e="";if(null!=t.track_start&&(e=t.track_start.split("T")[0]),c!=e){c=e;let t={weekday:"long",year:"numeric",month:"short",day:"numeric"};return new Date(c).toLocaleDateString("de-at",t)}return""},o]}customElements.define("aura-trackservice",class extends L{constructor(t){super(),this.shadowRoot.innerHTML='<style>h1,h4,h5{text-align:center}.card{margin-bottom:38px;font-size:1.3em}.card.active-track{border:3px solid greenyellow}.spinner{text-align:center}.spinner .loading{margin:10px 0 0 0;color:gray}.lds-dual-ring{display:inline-block;width:80px;height:80px}.lds-dual-ring:after{content:" ";display:block;width:64px;height:64px;margin:8px;border-radius:50%;border:6px solid #000;border-color:#aaa transparent #aaa transparent;animation:lds-dual-ring 1.2s linear infinite}@keyframes lds-dual-ring{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.current-date{font-size:1.3em}footer{font-size:0.8em;margin:40px 0;text-align:center;color:gray}footer a{color:gray;text-decoration:underline}</style>',I(this,{target:this.shadowRoot},F,O,a,{api:3,name:0}),t&&(t.target&&i(t.target,this,t.anchor),t.props&&(this.$set(t.props),_()))}static get observedAttributes(){return["api","name"]}get api(){return this.$$.ctx[3]}set api(t){this.$set({api:t}),_()}get name(){return this.$$.ctx[0]}set name(t){this.$set({name:t}),_()}})}();
//# sourceMappingURL=aura-player-bundle.js.map
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment