Files
sm-bm-plugin/public/assets/realtime-Bwb1cJz2.js
Jakub Zych 85cae45cb9 build: frontend with Microsoft 365 sign-in
The student app's login page offers Microsoft 365 when the provider is
configured, /auth/oauth/callback redeems the one-time code, a consent
screen finishes a first sign-in, the profile attaches Microsoft through
a link ticket, and the service worker leaves /oauth alone. The build
also carries the summer presentation theme already committed in the
frontend sources.
2026-10-21 00:23:38 +02:00

2 lines
9.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{Y as j,N as v,A as O}from"./index-DmTksCHf.js";function m(e){const n=e<0,t=Math.abs(Math.round(e)),o=Math.floor(t/60),r=t%60;return(n?"−":"")+o+":"+(r<10?"0":"")+r}function P(e){return e.map(n=>Number.isFinite(n)&&n>0?n:0)}function k(e){return Number.isFinite(e)&&e>0?e:0}function D(e){const n=P(e.budgets),t=n.reduce((f,p)=>f+p,0),o=e.targetSeconds>0?e.targetSeconds:t,r=n.length===0?0:Math.max(0,Math.min(n.length-1,Math.trunc(e.index)||0)),i=k(e.elapsed),l=k(e.slideElapsed),s=n[r]??0,a=s-l;let d="",u=!1;if(!e.idle){let f=Math.min(l,s);for(let b=0;b<r;b++)f+=n[b]??0;const p=Math.round(f-i);u=p<0,d=p>=0?"zapas "+m(p):"opóźnienie "+m(-p)}return{slide:s?m(a):"—",total:m(o-i),pace:d,slideOver:s>0&&a<0,totalOver:i>o,late:u,idle:e.idle,paused:e.paused,hidden:e.hidden,elapsed:Math.floor(i),slideElapsed:Math.floor(l)}}function fe(e){const n=P(e.budgets),t=n.map(()=>0);let o=0,r=0,i=0,l=!1;function s(c){return n.length===0?0:Math.max(0,Math.min(n.length-1,c))}function a(){return r===0&&o===0}function d(){return D({budgets:n,targetSeconds:e.targetSeconds,index:i,slideElapsed:t[i]??0,elapsed:o,idle:a(),paused:r===0&&o>0,hidden:l})}function u(){if(!r)return;const c=e.now(),A=(c-r)/1e3;r=c,n.length>0&&(t[i]+=A),o+=A}function f(c){i=s(c),r===0&&o===0&&(r=e.now())}function p(c){i=s(c)}function b(){!o&&!r||(u(),r=r?0:e.now())}function L(){for(let c=0;c<t.length;c++)t[c]=0;o=0,r=0}return{go:f,seek:p,tick:u,pause:b,reset:L,toggleHidden(){l=!l},view:d}}const w="remote.action",_="remote.state",pe=300,be=1e4,H=45e3,he=15e3,S=25e3,me=1e4,ge=1e3,y=800,x=["next","prev","first","last","goto","speak","notes","sources","special","back","clock-pause","clock","clock-reset","toolbar","scheme","sync"],C=/^[A-Za-z0-9_-]{8,64}$/,U=9999,T=9999,E=86400,V=new Set(x),F=new Set(["say","notes","srcs"]),B={next:"ArrowRight",prev:"ArrowLeft",first:"Home",last:"End",speak:"p",notes:"n",sources:"z",special:"s",back:"Escape","clock-pause":"t",clock:"c","clock-reset":"r",toolbar:"h",scheme:"j"};function ye(e){const n=B[e];return!n||n.toLowerCase()==="f"?null:n}function g(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function h(e,n,t){return typeof e=="number"&&Number.isInteger(e)&&e>=n&&e<=t}function G(e){if(!g(e))return null;const n=e.action,t=e.tab;if(typeof n!="string"||!V.has(n)||typeof t!="string"||t!==""&&!C.test(t))return null;const o=n;return o==="goto"?h(e.number,1,U)?{action:o,number:e.number,tab:t}:null:e.number!==void 0?null:{action:o,tab:t}}function K(e){if(!g(e))return null;const{elapsed:n,slide_elapsed:t,paused:o,hidden:r,idle:i}=e;return!h(n,0,E)||!h(t,0,E)||typeof o!="boolean"||typeof r!="boolean"||typeof i!="boolean"?null:{elapsed:n,slide_elapsed:t,paused:o,hidden:r,idle:i}}function $(e){if(!g(e))return null;const{tab:n,claim:t,bye:o,number:r,total:i,special:l,has_special:s,panel:a,toolbar_hidden:d}=e;if(typeof n!="string"||!C.test(n)||typeof t!="boolean"||typeof o!="boolean"||!h(r,0,T)||!h(i,0,T)||r>i||typeof l!="boolean"||typeof s!="boolean"||typeof d!="boolean"||a!==null&&(typeof a!="string"||!F.has(a)))return null;const u=e.light===void 0?!1:e.light;if(typeof u!="boolean")return null;const f=K(e.clock);return f?{tab:n,claim:t,bye:o,number:r,total:i,special:l,has_special:s,panel:a,toolbar_hidden:d,light:u,clock:f}:null}function Te(e){if(!g(e))return null;if(e.event===w){const n=G(e.payload);return n?{event:w,payload:n}:null}if(e.event===_){const n=$(e.payload);return n?{event:_,payload:n}:null}return null}function Ee(){const e=globalThis.crypto;if(e&&typeof e.randomUUID=="function")return e.randomUUID();const n=new Uint8Array(16);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(n);else for(let t=0;t<n.length;t++)n[t]=Math.floor(Math.random()*256);return Array.from(n,t=>t.toString(16).padStart(2,"0")).join("")}function M(e){return!Number.isFinite(e)||e<=0?0:Math.min(E,Math.floor(e))}function N(e){return!Number.isFinite(e)||e<=0?0:Math.min(T,Math.floor(e))}function Ae(e,n,t,o={}){const r=N(e.total),i=Math.min(N(e.number),r);return{tab:t,claim:!!o.claim,bye:!!o.bye,number:i,total:r,special:e.special,has_special:e.hasSpecial,panel:e.panel,toolbar_hidden:e.toolbarHidden,light:!!o.light,clock:n?{elapsed:M(n.elapsed),slide_elapsed:M(n.slideElapsed),paused:n.paused,hidden:n.hidden,idle:n.idle}:{elapsed:0,slide_elapsed:0,paused:!1,hidden:!1,idle:!0}}}function ke(e){let n=null;return{observe(t){const o=n===e;return t.bye?(t.tab===n&&(n=null),!1):((t.claim||n===null&&t.tab!==e)&&(n=t.tab),!o&&n===e)},activeTab:()=>n,isActive:()=>n===e,shouldApply(t){return n===e&&(t.tab===""||t.tab===e)}}}function we(e,n=!1){const t=Number.isFinite(e)?Math.min(Math.max(e,0),1):0;return(n?y:2*y)+Math.floor(t*(y/2))}function _e(){let e=null,n=0,t=null;return{observe(o,r){const i=e===null||e.bye||r-n>=S;return(o.claim&&!o.bye||t===null||i)&&(t=o.tab),o.tab!==t?!1:(e=o,n=r,o.bye&&(t=null),!0)},current:()=>e,receivedAt:()=>n,actionTab:()=>t??"",live(o){return e!==null&&!e.bye&&o-n<S},release(){t=null}}}function Se(e,n){return e>0&&n-e<H}const Y={now:()=>Date.now(),setTimeout:(e,n)=>globalThis.setTimeout(e,n),clearTimeout:e=>globalThis.clearTimeout(e)};function Me(e,n,t=Y){let o=Number.NEGATIVE_INFINITY,r=null;function i(){o=t.now(),e()}function l(){r!==null&&t.clearTimeout(r),r=null}return{call(){if(r!==null)return;const s=o+n-t.now();if(s<=0){i();return}r=t.setTimeout(()=>{r=null,i()},s)},flush(){l(),i()},cancel:l}}const q=/<h([1-3])\b[^>]*>([\s\S]*?)<\/h\1\s*>/gi,Z=/<br\s*\/?>/gi,W=/<[^>]*>/g,X=/&(#x[0-9a-f]+|#[0-9]+|amp|lt|gt|quot|apos|nbsp);/gi,z={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "};function R(e){return e.replace(X,(n,t)=>{const o=t.toLowerCase();if(o in z)return z[o];const r=o.startsWith("#x")?parseInt(o.slice(2),16):parseInt(o.slice(1),10);return!Number.isFinite(r)||r<=0||r>1114111?n:r===160?" ":String.fromCodePoint(r)})}function J(e){return R(e.replace(Z," ").replace(W,"")).replace(/\s+/g," ").trim()}function I(e,n){const t=e.findIndex(o=>o.number===n);return t<0?0:t}function Ne(e){const n=e.body_html??"";for(const o of n.matchAll(q)){const r=J(o[2]??"");if(r)return r}const t=(e.section_label??"").trim();return t||`Slajd ${e.number}`}const Q={say:"Na ekranie: Powiedz",notes:"Na ekranie: Notatki",srcs:"Na ekranie: Źródła"};function ze(e){const n=[];return e.special&&n.push("Specjalny"),e.panel&&n.push(Q[e.panel]),e.toolbar_hidden&&n.push("Pasek ukryty"),e.clock.hidden&&n.push("Zegar ukryty"),n}const ee={connecting:"Łączenie…",waiting:"Czekam na komputer",live:"Połączono",reconnecting:"Ponowne łączenie…",unavailable:"Pilot niedostępny"};function Ie(e){return ee[e]}function Pe(e,n,t,o,r,i){const{clock:l}=e,a=!l.paused&&!l.idle?Math.max(0,(i-r)/1e3):0;return{budgets:n,targetSeconds:t,index:o,slideElapsed:l.slide_elapsed+a,elapsed:l.elapsed+a,idle:l.idle,paused:l.paused,hidden:l.hidden}}function Ce(e,n){const t=n&&e!==null,o=e?.panel??null,r=!!e?.special,i=(l,s,a,d,u=null)=>({action:l,label:s,kbd:a,enabled:t&&d,pressed:u});return[i("prev","Wstecz","",!0),i("next","Dalej","",!0),i("sources","Źródła","Z",!0,o==="srcs"),i("notes","Notatki","N",!0,o==="notes"),i("special","Specjalny","S",!!e?.has_special||r,r),i("back","Powrót","Esc",r),i("clock-pause",e?.clock.paused?"Wznów":"Pauza","T",!e?.clock.idle),i("clock-reset","Zeruj","R",!0),i("clock",e?.clock.hidden?"Pokaż zegar":"Ukryj zegar","C",!0),i("toolbar","Pasek","H",!0,e?!e.toolbar_hidden:!1),i("speak","Powiedz","P",!0,o==="say"),i("scheme","Jasny","J",!0,!!e?.light),i("first","Początek","Home",!0),i("last","Koniec","End",!0)]}function Re(e){return e===0?"Nie wysłano: brak połączenia z internetem. Naciśnij ponownie.":e===429?"Za dużo naciśnięć naraz. Odczekaj chwilę i naciśnij ponownie.":e===503?"Pilot jest teraz niedostępny. Steruj klawiaturą na komputerze.":"Nie wysłano polecenia. Naciśnij ponownie."}const ne=/<img\b((?:[^>"']|"[^"]*"|'[^']*')*)>/gi,te=/([^\s"'=<>/]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g;function oe(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function re(e){const n=new Map;for(const t of e.matchAll(te)){const o=(t[1]??"").toLowerCase();!o||n.has(o)||n.set(o,t[2]??t[3]??t[4]??"")}return n}function Le(e){return e?e.replace(ne,(n,t)=>{const o=re(t);if(!o.has("data-deck-image"))return n;const r=R(o.get("alt")??"").replace(/\s+/g," ").trim();return`<em class="drawer-image">${r?`[obraz: ${oe(r)}]`:"[obraz]"}</em>`}):""}function je(e,n,t,o){if(e.slides.length===0)return null;if(t&&n){const r=e.slides[I(e.slides,n.number)]??null;return r&&n.special&&r.special?r.special:r}return e.slides[I(e.slides,o)]??null}const ie="/ws",se="/api/realtime/token",le=new Set([401,403,404]);function ae(e){return le.has(e)}function ce(e=window.location){return`${e.protocol==="https:"?"wss":"ws"}://${e.host}${ie}`}function ue(e){const n=String(e);return n==="connected"||n==="connecting"?n:"disconnected"}async function ve(e,n){const{Centrifuge:t,UnauthorizedError:o}=await j(async()=>{const{Centrifuge:s,UnauthorizedError:a}=await import("./index-B53bcf0x.js");return{Centrifuge:s,UnauthorizedError:a}},[]),r=new t(ce(),{minReconnectDelay:500,maxReconnectDelay:1e4,getToken:async()=>{try{const s=await v.request(se);if(!s||typeof s.token!="string"||s.token==="")throw new Error("realtime: empty token");return s.token}catch(s){throw s instanceof O&&ae(s.status)?(n.onUnavailable?.(),new o("realtime unavailable")):s}}});r.on("state",s=>n.onConnection?.(ue(s.newState)));const i=r.newSubscription(e);i.on("publication",s=>n.onPublication(s.data)),i.on("subscribed",()=>n.onSubscribed?.()),i.on("unsubscribed",s=>{s.code>=400&&n.onDenied?.(s.code)}),i.subscribe(),r.connect();let l=!1;return{close(){l||(l=!0,i.removeAllListeners(),i.unsubscribe(),r.removeSubscription(i),r.disconnect(),r.removeAllListeners())},resubscribe(){l||i.subscribe()}}}export{ge as C,me as D,be as H,_ as R,pe as S,Me as a,fe as b,ke as c,Te as d,Ae as e,Le as f,Ne as g,je as h,Ce as i,Ie as j,he as k,_e as l,Re as m,Ee as n,ve as o,Se as p,ze as q,ye as r,I as s,we as t,D as u,Pe as v};