import{o as st,p as ot,q as le,r as j,t as z,u as O,v as T,w as ut,S as Q,i as X,s as G,x as de,y as $,a as y,z as se,c as k,A as P,B as _e,C as me,D as be,E as Ye,f as w,F as We,G as oe,I as Ze,J as ue,K as J,n as v,L as Ce,M as De,N as Qe,j as F,b as f,d as C,O as Xe,P as ke,Q as K,R as p,T as E,U as ce,V as I,W as pe,X as H,Y as B,Z as ge,_ as V,k as U,$ as ct,a0 as at,e as ae,a1 as ft,a2 as dt,a3 as ze,a4 as Ge,a5 as _t,a6 as fe,a7 as mt,h as te,a8 as bt,g as pt,l as Je,m as Ke}from"./app-CzRDsf-o.js";import{a9 as sl}from"./app-CzRDsf-o.js";import{S as gt}from"./SidebarLayout-Bi47sXCP.js";const ht=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function R(l,e){const n=e.token={};function t(r,i,s,o){if(e.token!==n)return;e.resolved=o;let u=e.ctx;s!==void 0&&(u=u.slice(),u[s]=o);const c=r&&(e.current=r)(u);let a=!1;e.block&&(e.blocks?e.blocks.forEach((g,d)=>{d!==i&&g&&(j(),z(g,1,1,()=>{e.blocks[d]===g&&(e.blocks[d]=null)}),O())}):e.block.d(1),c.c(),T(c,1),c.m(e.mount(),e.anchor),a=!0),e.block=c,e.blocks&&(e.blocks[i]=c),a&&ut()}if(st(l)){const r=ot();if(l.then(i=>{le(r),t(e.then,1,e.value,i),le(null)},i=>{if(le(r),t(e.catch,2,e.error,i),le(null),!e.hasCatch)throw i}),e.current!==e.pending)return t(e.pending,0),!0}else{if(e.current!==e.then)return t(e.then,1,e.value,l),!0;e.resolved=l}}function ne(l,e,n){const t=e.slice(),{resolved:r}=l;l.current===l.then&&(t[l.value]=r),l.current===l.catch&&(t[l.error]=r),l.block.p(t,n)}function Se(l,e){return["a","b","c","d","e","f","g","h","ch","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"][l]??e}async function kt(l){const e=l.requestFullscreen||l.webkitRequestFullscreen||l.mozRequestFullscreen||l.msRequestFullscreen;if(e)e.call(l);else if(typeof window.ActiveXObject<"u"){const n=new ActiveXObject("WScript.Shell");n!==null&&n.SendKeys("{F11}")}}async function wt(l,e=.5){return new Promise(n=>{const t=document.createElement("canvas"),r=document.createElement("video"),i=document.createElement("source"),s=t.getContext("2d");r.style.display="none",t.style.display="none",i.setAttribute("src",l),r.setAttribute("crossorigin","anonymous"),r.setAttribute("preload","metadata"),r.appendChild(i),document.body.appendChild(t),document.body.appendChild(r),s&&(r.addEventListener("loadedmetadata",function(){t.width=r.videoWidth,t.height=r.videoHeight}),r.addEventListener("seeked",function(){s.drawImage(r,0,0,r.videoWidth,r.videoHeight),t.toBlob(o=>{let u="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";o!==null&&(u=URL.createObjectURL(o)),n(u)})}),r.currentTime=e,r.load())})}async function Z(l){const e=await fetch(l);return URL.createObjectURL(await e.blob())}function vt(l){const e=Object.prototype.toString.call(l);return l instanceof Date||typeof l=="object"&&e==="[object Date]"?new l.constructor(+l):typeof l=="number"||e==="[object Number]"||typeof l=="string"||e==="[object String]"?new Date(l):new Date(NaN)}const $e=6e4,xe=36e5;function yt(l){return vt(l).getTime()}function Nt(l,e){const t=Ct(l);let r;if(t.date){const u=zt(t.date,2);r=St(u.restDateString,u.year)}if(!r||isNaN(r.getTime()))return new Date(NaN);const i=r.getTime();let s=0,o;if(t.time&&(s=At(t.time),isNaN(s)))return new Date(NaN);if(t.timezone){if(o=Mt(t.timezone),isNaN(o))return new Date(NaN)}else{const u=new Date(i+s),c=new Date(0);return c.setFullYear(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()),c.setHours(u.getUTCHours(),u.getUTCMinutes(),u.getUTCSeconds(),u.getUTCMilliseconds()),c}return new Date(i+s+o)}const re={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Tt=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,Dt=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,qt=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Ct(l){const e={},n=l.split(re.dateTimeDelimiter);let t;if(n.length>2)return e;if(/:/.test(n[0])?t=n[0]:(e.date=n[0],t=n[1],re.timeZoneDelimiter.test(e.date)&&(e.date=l.split(re.timeZoneDelimiter)[0],t=l.substr(e.date.length,l.length))),t){const r=re.timezone.exec(t);r?(e.time=t.replace(r[1],""),e.timezone=r[1]):e.time=t}return e}function zt(l,e){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),t=l.match(n);if(!t)return{year:NaN,restDateString:""};const r=t[1]?parseInt(t[1]):null,i=t[2]?parseInt(t[2]):null;return{year:i===null?r:i*100,restDateString:l.slice((t[1]||t[2]).length)}}function St(l,e){if(e===null)return new Date(NaN);const n=l.match(Tt);if(!n)return new Date(NaN);const t=!!n[4],r=ee(n[1]),i=ee(n[2])-1,s=ee(n[3]),o=ee(n[4]),u=ee(n[5])-1;if(t)return Et(e,o,u)?Ft(e,o,u):new Date(NaN);{const c=new Date(0);return!Ut(e,i,s)||!It(e,r)?new Date(NaN):(c.setUTCFullYear(e,i,Math.max(r,s)),c)}}function ee(l){return l?parseInt(l):1}function At(l){const e=l.match(Dt);if(!e)return NaN;const n=we(e[1]),t=we(e[2]),r=we(e[3]);return Rt(n,t,r)?n*xe+t*$e+r*1e3:NaN}function we(l){return l&&parseFloat(l.replace(",","."))||0}function Mt(l){if(l==="Z")return 0;const e=l.match(qt);if(!e)return 0;const n=e[1]==="+"?-1:1,t=parseInt(e[2]),r=e[3]&&parseInt(e[3])||0;return jt(t,r)?n*(t*xe+r*$e):NaN}function Ft(l,e,n){const t=new Date(0);t.setUTCFullYear(l,0,4);const r=t.getUTCDay()||7,i=(e-1)*7+n+1-r;return t.setUTCDate(t.getUTCDate()+i),t}const Lt=[31,null,31,30,31,30,31,31,30,31,30,31];function et(l){return l%400===0||l%4===0&&l%100!==0}function Ut(l,e,n){return e>=0&&e<=11&&n>=1&&n<=(Lt[e]||(et(l)?29:28))}function It(l,e){return e>=1&&e<=(et(l)?366:365)}function Et(l,e,n){return e>=1&&e<=53&&n>=0&&n<=6}function Rt(l,e,n){return l===24?e===0&&n===0:n>=0&&n<60&&e>=0&&e<60&&l>=0&&l<25}function jt(l,e){return e>=0&&e<=59}function Ot(l){let e,n,t,r;const i=l[3].default,s=de(i,l,l[2],null);let o=[l[1]],u={};for(let c=0;c<o.length;c+=1)u=$(u,o[c]);return{c(){e=y("video"),s&&s.c(),se(e,u)},m(c,a){k(c,e,a),s&&s.m(e,null),l[6](e),n=!0,t||(r=[P(e,"ended",l[4]),P(e,"timeupdate",l[5])],t=!0)},p(c,[a]){s&&s.p&&(!n||a&4)&&_e(s,i,c,c[2],n?be(i,c[2],a,null):me(c[2]),null),se(e,u=Ye(o,[a&2&&c[1]]))},i(c){n||(T(s,c),n=!0)},o(c){z(s,c),n=!1},d(c){c&&w(e),s&&s.d(c),l[6](null),t=!1,We(r)}}}function Pt(l,e,n){const t=["video"];let r=oe(e,t),{$$slots:i={},$$scope:s}=e,{video:o}=e;function u(g){ue.call(this,l,g)}function c(g){ue.call(this,l,g)}function a(g){J[g?"unshift":"push"](()=>{o=g,n(0,o)})}return l.$$set=g=>{e=$($({},e),Ze(g)),n(1,r=oe(e,t)),"video"in g&&n(0,o=g.video),"$$scope"in g&&n(2,s=g.$$scope)},[o,r,s,i,u,c,a]}class Ht extends Q{constructor(e){super(),X(this,e,Pt,Ot,G,{video:0})}}function Bt(l){let e,n,t,r=[l[1]],i={};for(let s=0;s<r.length;s+=1)i=$(i,r[s]);return{c(){e=y("video"),se(e,i)},m(s,o){k(s,e,o),l[6](e),n||(t=[P(e,"ended",l[4]),P(e,"timeupdate",l[5])],n=!0)},p(s,[o]){se(e,i=Ye(r,[o&2&&s[1]]))},i:v,o:v,d(s){s&&w(e),l[6](null),n=!1,We(t)}}}function Vt(l,e,n){const t=["video","hls","source"];let r=oe(e,t),{video:i}=e,{hls:s=new Ce}=e,{source:o}=e;De(function(){s.attachMedia(i)}),Qe(function(){s.removeAllListeners(),s.detachMedia(),s.destroy()});function u(d){Ce.isSupported()?(s.loadSource(d),s.startLoad()):i.canPlayType("application/vnd.apple.mpegurl")&&n(0,i.src=d,i)}function c(d){ue.call(this,l,d)}function a(d){ue.call(this,l,d)}function g(d){J[d?"unshift":"push"](()=>{i=d,n(0,i)})}return l.$$set=d=>{e=$($({},e),Ze(d)),n(1,r=oe(e,t)),"video"in d&&n(0,i=d.video),"hls"in d&&n(2,s=d.hls),"source"in d&&n(3,o=d.source)},l.$$.update=()=>{l.$$.dirty&9&&i&&u(o)},[i,r,s,o,c,a,g]}class tt extends Q{constructor(e){super(),X(this,e,Vt,Bt,G,{video:0,hls:2,source:3})}}const{document:Yt}=ht;function Wt(l){return{c:v,m:v,p:v,i:v,o:v,d:v}}function Zt(l){let e,n,t,r,i,s,o,u,c;const a=[Xt,Qt],g=[];function d(h,N){return h[2].is_remote?0:1}n=d(l),t=g[n]=a[n](l);let m=l[1]&&l[4]&&Ae(l);return{c(){e=y("div"),t.c(),r=F(),m&&m.c(),i=F(),s=y("button"),s.textContent="Start",f(e,"class","video-container pointer-events-none"),p(e,"hidden",!l[1]),f(s,"class","bg-primary px-4 py-2 font-bold text-white"),f(s,"type","button")},m(h,N){k(h,e,N),g[n].m(e,null),C(e,r),m&&m.m(e,null),l[20](e),k(h,i,N),k(h,s,N),o=!0,u||(c=P(s,"click",l[8]),u=!0)},p(h,N){let D=n;n=d(h),n===D?g[n].p(h,N):(j(),z(g[D],1,1,()=>{g[D]=null}),O(),t=g[n],t?t.p(h,N):(t=g[n]=a[n](h),t.c()),T(t,1),t.m(e,r)),h[1]&&h[4]?m?m.p(h,N):(m=Ae(h),m.c(),m.m(e,null)):m&&(m.d(1),m=null),(!o||N&2)&&p(e,"hidden",!h[1])},i(h){o||(T(t),o=!0)},o(h){z(t),o=!1},d(h){h&&(w(e),w(i),w(s)),g[n].d(),m&&m.d(),l[20](null),u=!1,c()}}}function Qt(l){let e,n,t;function r(s){l[19](s)}let i={$$slots:{default:[Gt]},$$scope:{ctx:l}};return l[7]!==void 0&&(i.video=l[7]),e=new Ht({props:i}),J.push(()=>pe(e,"video",r)),e.$on("ended",l[9]),e.$on("timeupdate",l[11]),{c(){H(e.$$.fragment)},m(s,o){B(e,s,o),t=!0},p(s,o){const u={};o&2097164&&(u.$$scope={dirty:o,ctx:s}),!n&&o&128&&(n=!0,u.video=s[7],ge(()=>n=!1)),e.$set(u)},i(s){t||(T(e.$$.fragment,s),t=!0)},o(s){z(e.$$.fragment,s),t=!1},d(s){V(e,s)}}}function Xt(l){let e,n,t;function r(s){l[18](s)}let i={source:l[28]};return l[7]!==void 0&&(i.video=l[7]),e=new tt({props:i}),J.push(()=>pe(e,"video",r)),e.$on("ended",l[9]),e.$on("timeupdate",l[11]),{c(){H(e.$$.fragment)},m(s,o){B(e,s,o),t=!0},p(s,o){const u={};o&4&&(u.source=s[28]),!n&&o&128&&(n=!0,u.video=s[7],ge(()=>n=!1)),e.$set(u)},i(s){t||(T(e.$$.fragment,s),t=!0)},o(s){z(e.$$.fragment,s),t=!1},d(s){V(e,s)}}}function Gt(l){let e,n;return{c(){e=y("source"),U(e.src,n=l[28])||f(e,"src",n),f(e,"type",l[3])},m(t,r){k(t,e,r)},p(t,r){r&4&&!U(e.src,n=t[28])&&f(e,"src",n),r&8&&f(e,"type",t[3])},d(t){t&&w(e)}}}function Ae(l){let e,n=l[7].currentTime+"",t,r,i=(isNaN(l[7].duration)?0:l[7].duration)+"",s;return{c(){e=y("progress"),t=E(n),r=E("/"),s=E(i),f(e,"max",100),e.value=l[0],f(e,"class","absolute bottom-0 left-0 right-0 z-50 h-2 w-full text-center")},m(o,u){k(o,e,u),C(e,t),C(e,r),C(e,s)},p(o,u){u&128&&n!==(n=o[7].currentTime+"")&&ce(t,n),u&128&&i!==(i=(isNaN(o[7].duration)?0:o[7].duration)+"")&&ce(s,i),u&1&&(e.value=o[0])},d(o){o&&w(e)}}}function Jt(l){let e;return{c(){e=y("p"),e.textContent="Video se stahuje...",f(e,"class","text-center text-white")},m(n,t){k(n,e,t)},p:v,i:v,o:v,d(n){n&&w(e)}}}function Kt(l){let e,n,t={ctx:l,current:null,token:null,hasCatch:!0,pending:tn,then:en,catch:xt,value:26,error:27};return R(n=l[13](l[2],l[5]),t),{c(){e=I(),t.block.c()},m(r,i){k(r,e,i),t.block.m(r,t.anchor=i),t.mount=()=>e.parentNode,t.anchor=e},p(r,i){l=r,t.ctx=l,i&36&&n!==(n=l[13](l[2],l[5]))&&R(n,t)||ne(t,l,i)},i:v,o:v,d(r){r&&w(e),t.block.d(r),t.token=null,t=null}}}function $t(l){let e;const n=l[17].default,t=de(n,l,l[21],null);return{c(){t&&t.c()},m(r,i){t&&t.m(r,i),e=!0},p(r,i){t&&t.p&&(!e||i&2097152)&&_e(t,n,r,r[21],e?be(n,r[21],i,null):me(r[21]),null)},i(r){e||(T(t,r),e=!0)},o(r){z(t,r),e=!1},d(r){t&&t.d(r)}}}function xt(l){let e;return{c(){e=y("div"),e.textContent="Náhled nelze naÄŤĂst",f(e,"class","absolute bottom-0 left-0 right-0 top-0 -z-10 h-full w-full bg-primary p-2 text-white")},m(n,t){k(n,e,t)},p:v,d(n){n&&w(e)}}}function en(l){let e,n;return{c(){e=y("img"),U(e.src,n=l[26])||f(e,"src",n),f(e,"class","absolute bottom-0 left-0 right-0 top-0 -z-10 h-full w-full object-cover object-center"),f(e,"alt","Náhled videa")},m(t,r){k(t,e,r)},p(t,r){r&36&&!U(e.src,n=t[26])&&f(e,"src",n)},d(t){t&&w(e)}}}function tn(l){let e;return{c(){e=y("div"),e.textContent="Náhled se naÄŤĂtá...",f(e,"class","absolute bottom-0 left-0 right-0 top-0 -z-10 h-full w-full bg-primary p-2 text-white")},m(n,t){k(n,e,t)},p:v,d(n){n&&w(e)}}}function nn(l){let e,n,t,r,i,s,o,u,c,a={ctx:l,current:null,token:null,hasCatch:!1,pending:Jt,then:Zt,catch:Wt,value:28,blocks:[,,,]};R(t=l[12](l[2]),a);const g=[$t,Kt],d=[];function m(h,N){return h[14].default?0:1}return i=m(l),s=d[i]=g[i](l),{c(){e=F(),n=y("div"),a.block.c(),r=F(),s.c(),f(n,"class","relative grid h-80 w-full place-items-center bg-black bg-opacity-10")},m(h,N){k(h,e,N),k(h,n,N),a.block.m(n,a.anchor=null),a.mount=()=>n,a.anchor=r,C(n,r),d[i].m(n,null),o=!0,u||(c=P(Yt.body,"fullscreenchange",l[10]),u=!0)},p(h,[N]){l=h,a.ctx=l,N&4&&t!==(t=l[12](l[2]))&&R(t,a)||ne(a,l,N);let D=i;i=m(l),i===D?d[i].p(l,N):(j(),z(d[D],1,1,()=>{d[D]=null}),O(),s=d[i],s?s.p(l,N):(s=d[i]=g[i](l),s.c()),T(s,1),s.m(n,null))},i(h){o||(T(a.block),T(s),o=!0)},o(h){for(let N=0;N<3;N+=1){const D=a.blocks[N];z(D)}z(s),o=!1},d(h){h&&(w(e),w(n)),a.block.d(),a.token=null,a=null,d[i].d(),u=!1,c()}}}function ve(l=void 0){var e,n;return(e=l==null?void 0:l.targer)!=null&&e.type?l.target.type.includes("landscape"):(n=screen==null?void 0:screen.orientation)!=null&&n.type?screen.orientation.type.includes("landscape"):Math.abs(window.orientation)===90}function ln(){return window.navigator.maxTouchPoints>1||"ontouchstart"in document}function ye(l=window.document){if(l.exitFullscreen)return l.exitFullscreen();if(l.webkitExitFullscreen)return l.webkitExitFullscreen();if(l.mozCancelFullScreen)return l.mozCancelFullScreen();if(l.msExitFullscreen)return l.msExitFullscreen();throw new Error("Nelze opustit fullscreen!")}function rn(l){return!l.paused&&!l.ended&&l.currentTime>0}async function sn(l){await new Promise(e=>setTimeout(e,l))}function ie(l){l.pause(),l.currentTime=0}function on(l,e,n){let{$$slots:t={},$$scope:r}=e;const i=Xe(t);let s,o,u=ve();const c=ke.mixin({toast:!0,position:"top-end",showConfirmButton:!1,timer:3e3,timerProgressBar:!0,didOpen:b=>{b.onmouseenter=ke.stopTimer,b.onmouseleave=ke.resumeTimer}}),a=250;let{file:g}=e,{type:d=void 0}=e,{ended:m=!1}=e,{progress:h=0}=e,{fullscreen:N=!1}=e,{enableProgress:D=!0}=e,{frameTimeInSeconds:L=.25}=e;De(function(){var b;(b=screen==null?void 0:screen.orientation)==null||b.addEventListener("change",S,!0)}),Qe(function(){var b;(b=screen==null?void 0:screen.orientation)==null||b.removeEventListener("change",S,!0)});function S(b){var W;u=ve(b),!u&&rn(o)&&(ye(o),ie(o),(W=K.orientation)==null||W.unlock(),c.fire({icon:"warning",title:"Video pĹ™erušeno!",text:"BÄ›hem pĹ™ehrávánĂ nemÄ›Ĺte orientaci zaĹ™ĂzenĂ"}))}async function M(){var b,W,x;if(ie(o),await kt(s),ln()&&!u&&(((b=K.orientation)==null?void 0:b.lock)instanceof Function&&await((x=(W=K.orientation)==null?void 0:W.lock("landscape"))==null?void 0:x.catch(()=>{})),await sn(a),u||(u=ve()),!u)){q();return}await o.play()}function q(){var b;ye(o),ie(o),((b=K.orientation)==null?void 0:b.unlock)instanceof Function&&K.orientation.unlock(),console.error("Nelze vynutit reĹľim na šĂĹ™ku!"),c.fire({icon:"warning",title:"OtoÄŤte zaĹ™ĂzenĂ na šĂĹ™ku a zkuste znovu!"})}function A(){n(15,m=!0),ye(o)}function _(){var b;n(1,N=document.fullscreenElement!==null),!N&&o&&(ie(o),(b=K.orientation)==null||b.unlock())}function Y(){n(0,h=isNaN(o.duration)?0:Math.round(o.currentTime/o.duration*100))}async function he(b){return b.is_remote?b.source:Z(b.source)}async function nt(b,W){var x;if(b!=null&&b.thumbnail){let qe=(x=b==null?void 0:b.thumbnail)==null?void 0:x.source;return b!=null&&b.updated_at&&(qe+=`?${yt(Nt(b.updated_at))}`),Z(qe)}return wt(b.source,W)}function lt(b){o=b,n(7,o)}function rt(b){o=b,n(7,o)}function it(b){J[b?"unshift":"push"](()=>{s=b,n(6,s)})}return l.$$set=b=>{"file"in b&&n(2,g=b.file),"type"in b&&n(3,d=b.type),"ended"in b&&n(15,m=b.ended),"progress"in b&&n(0,h=b.progress),"fullscreen"in b&&n(1,N=b.fullscreen),"enableProgress"in b&&n(4,D=b.enableProgress),"frameTimeInSeconds"in b&&n(5,L=b.frameTimeInSeconds),"$$scope"in b&&n(21,r=b.$$scope)},[h,N,g,d,D,L,s,o,M,A,_,Y,he,nt,i,m,a,t,lt,rt,it,r]}class un extends Q{constructor(e){super(),X(this,e,on,nn,G,{timeout:16,file:2,type:3,ended:15,progress:0,fullscreen:1,enableProgress:4,frameTimeInSeconds:5})}get timeout(){return this.$$.ctx[16]}}function cn(l){return{c:v,m:v,p:v,i:v,o:v,d:v}}function an(l){let e,n,t,r;const i=[dn,fn],s=[];function o(u,c){return u[0].is_remote?0:1}return e=o(l),n=s[e]=i[e](l),{c(){n.c(),t=I()},m(u,c){s[e].m(u,c),k(u,t,c),r=!0},p(u,c){let a=e;e=o(u),e===a?s[e].p(u,c):(j(),z(s[a],1,1,()=>{s[a]=null}),O(),n=s[e],n?n.p(u,c):(n=s[e]=i[e](u),n.c()),T(n,1),n.m(t.parentNode,t))},i(u){r||(T(n),r=!0)},o(u){z(n),r=!1},d(u){u&&w(t),s[e].d(u)}}}function fn(l){let e,n,t;return{c(){e=y("video"),n=y("source"),U(n.src,t=l[3])||f(n,"src",t),f(n,"type",l[1]),f(e,"class","max-h-80 w-auto"),e.autoplay=!0,e.controls=!0,e.muted=!0},m(r,i){k(r,e,i),C(e,n)},p(r,i){i&1&&!U(n.src,t=r[3])&&f(n,"src",t),i&2&&f(n,"type",r[1])},i:v,o:v,d(r){r&&w(e)}}}function dn(l){let e,n;return e=new tt({props:{source:l[3],autoplay:!0,controls:!0,muted:!0}}),{c(){H(e.$$.fragment)},m(t,r){B(e,t,r),n=!0},p(t,r){const i={};r&1&&(i.source=t[3]),e.$set(i)},i(t){n||(T(e.$$.fragment,t),n=!0)},o(t){z(e.$$.fragment,t),n=!1},d(t){V(e,t)}}}function _n(l){let e;return{c(){e=y("p"),e.textContent="Media se naÄŤĂtajĂ..."},m(n,t){k(n,e,t)},p:v,i:v,o:v,d(n){n&&w(e)}}}function mn(l){let e,n,t,r={ctx:l,current:null,token:null,hasCatch:!1,pending:_n,then:an,catch:cn,value:3,blocks:[,,,]};return R(n=l[2](l[0]),r),{c(){e=I(),r.block.c()},m(i,s){k(i,e,s),r.block.m(i,r.anchor=s),r.mount=()=>e.parentNode,r.anchor=e,t=!0},p(i,[s]){l=i,r.ctx=l,s&1&&n!==(n=l[2](l[0]))&&R(n,r)||ne(r,l,s)},i(i){t||(T(r.block),t=!0)},o(i){for(let s=0;s<3;s+=1){const o=r.blocks[s];z(o)}t=!1},d(i){i&&w(e),r.block.d(i),r.token=null,r=null}}}function bn(l,e,n){let{file:t}=e,{type:r}=e;async function i(s){return s.is_remote?s.source:Z(s.source)}return l.$$set=s=>{"file"in s&&n(0,t=s.file),"type"in s&&n(1,r=s.type)},[t,r,i]}class pn extends Q{constructor(e){super(),X(this,e,bn,mn,G,{file:0,type:1})}}function gn(l){return{c:v,m:v,p:v,d:v}}function hn(l){let e,n;return{c(){e=y("img"),U(e.src,n=l[1])||f(e,"src",n),f(e,"alt",l[0]),f(e,"class","max-h-80 w-auto")},m(t,r){k(t,e,r)},p(t,r){r&2&&!U(e.src,n=t[1])&&f(e,"src",n),r&1&&f(e,"alt",t[0])},d(t){t&&w(e)}}}function kn(l){let e;return{c(){e=y("p"),e.textContent="Media se naÄŤĂtajĂ..."},m(n,t){k(n,e,t)},p:v,d(n){n&&w(e)}}}function wn(l){let e,n,t={ctx:l,current:null,token:null,hasCatch:!1,pending:kn,then:hn,catch:gn,value:1};return R(n=Z(l[1]),t),{c(){e=I(),t.block.c()},m(r,i){k(r,e,i),t.block.m(r,t.anchor=i),t.mount=()=>e.parentNode,t.anchor=e},p(r,[i]){l=r,t.ctx=l,i&2&&n!==(n=Z(l[1]))&&R(n,t)||ne(t,l,i)},i:v,o:v,d(r){r&&w(e),t.block.d(r),t.token=null,t=null}}}function vn(l,e,n){let{src:t}=e,{alt:r}=e;return l.$$set=i=>{"src"in i&&n(1,t=i.src),"alt"in i&&n(0,r=i.alt)},[r,t]}class yn extends Q{constructor(e){super(),X(this,e,vn,wn,G,{src:1,alt:0})}}const Nn=l=>({}),Me=l=>({}),Tn=l=>({}),Fe=l=>({});function Le(l,e,n){var i;const t=l.slice();t[19]=e[n],t[22]=n;const r=((i=t[0])==null?void 0:i.id)===t[19].id;return t[20]=r,t}function Ne(l){const e=l.slice(),n=e[19].file.source;e[23]=n;const t=e[19].file.mime_type;return e[24]=t,e}function Te(l){const e=l.slice(),n=e[2].file.source;e[23]=n;const t=e[2].file.mime_type;return e[24]=t,e}function Ue(l){let e,n,t,r,i;const s=[Cn,qn,Dn],o=[];function u(c,a){return c[2].file.type==="image"?0:(e==null&&(e=c[8]("answer")===2),e?1:2)}return n=u(l),t=o[n]=s[n](l),{c(){t.c(),r=I()},m(c,a){o[n].m(c,a),k(c,r,a),i=!0},p(c,a){let g=n;n=u(c),n===g?o[n].p(c,a):(j(),z(o[g],1,1,()=>{o[g]=null}),O(),t=o[n],t?t.p(c,a):(t=o[n]=s[n](c),t.c()),T(t,1),t.m(r.parentNode,r))},i(c){i||(T(t),i=!0)},o(c){z(t),i=!1},d(c){c&&w(r),o[n].d(c)}}}function Dn(l){let e,n;return e=new pn({props:{file:l[2].file,type:l[24]}}),{c(){H(e.$$.fragment)},m(t,r){B(e,t,r),n=!0},p(t,r){const i={};r&4&&(i.file=t[2].file),r&4&&(i.type=t[24]),e.$set(i)},i(t){n||(T(e.$$.fragment,t),n=!0)},o(t){z(e.$$.fragment,t),n=!1},d(t){V(e,t)}}}function qn(l){let e,n,t=!l[1]&&Ie(l);return{c(){t&&t.c(),e=I()},m(r,i){t&&t.m(r,i),k(r,e,i),n=!0},p(r,i){r[1]?t&&(j(),z(t,1,1,()=>{t=null}),O()):t?(t.p(r,i),i&2&&T(t,1)):(t=Ie(r),t.c(),T(t,1),t.m(e.parentNode,e))},i(r){n||(T(t),n=!0)},o(r){z(t),n=!1},d(r){r&&w(e),t&&t.d(r)}}}function Cn(l){let e,n;return e=new yn({props:{src:l[23],alt:l[2].title}}),{c(){H(e.$$.fragment)},m(t,r){B(e,t,r),n=!0},p(t,r){const i={};r&4&&(i.src=t[23]),r&4&&(i.alt=t[2].title),e.$set(i)},i(t){n||(T(e.$$.fragment,t),n=!0)},o(t){z(e.$$.fragment,t),n=!1},d(t){V(e,t)}}}function Ie(l){let e,n,t;function r(s){l[14](s)}let i={file:l[2].file,type:l[24],frameTimeInSeconds:4};return l[1]!==void 0&&(i.ended=l[1]),e=new un({props:i}),J.push(()=>pe(e,"ended",r)),{c(){H(e.$$.fragment)},m(s,o){B(e,s,o),t=!0},p(s,o){const u={};o&4&&(u.file=s[2].file),o&4&&(u.type=s[24]),!n&&o&2&&(n=!0,u.ended=s[1],ge(()=>n=!1)),e.$set(u)},i(s){t||(T(e.$$.fragment,s),t=!0)},o(s){z(e.$$.fragment,s),t=!1},d(s){V(e,s)}}}function zn(l){let e;return{c(){e=y("p"),e.textContent="Po odehránĂ celĂ©ho videa se zobrazĂ odpovÄ›di...",f(e,"class","my-6 italic")},m(n,t){k(n,e,t)},p:v,d(n){n&&w(e)}}}function Sn(l){let e,n=[],t=new Map,r=ae(l[7]);const i=s=>s[19].id;for(let s=0;s<r.length;s+=1){let o=Le(l,r,s),u=i(o);t.set(u,n[s]=je(u,o))}return{c(){e=y("ul");for(let s=0;s<n.length;s+=1)n[s].c();f(e,"class","my-12 flex flex-col gap-4")},m(s,o){k(s,e,o);for(let u=0;u<n.length;u+=1)n[u]&&n[u].m(e,null)},p(s,o){o&137&&(r=ae(s[7]),n=ft(n,o,i,1,s,r,t,e,_t,je,null,Le))},d(s){s&&w(e);for(let o=0;o<n.length;o+=1)n[o].d()}}}function An(l){let e,n=Se(l[22],"?").toUpperCase()+"",t;return{c(){e=y("strong"),t=E(n)},m(r,i){k(r,e,i),C(e,t)},p(r,i){i&128&&n!==(n=Se(r[22],"?").toUpperCase()+"")&&ce(t,n)},d(r){r&&w(e)}}}function Mn(l){let e;function n(i,s){return i[19].is_correct?Ln:Fn}let t=n(l),r=t(l);return{c(){r.c(),e=I()},m(i,s){r.m(i,s),k(i,e,s)},p(i,s){t!==(t=n(i))&&(r.d(1),r=t(i),r&&(r.c(),r.m(e.parentNode,e)))},d(i){i&&w(e),r.d(i)}}}function Fn(l){let e,n;return{c(){e=fe("svg"),n=fe("path"),f(n,"d","m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"),f(e,"class","h-8 fill-current"),f(e,"xmlns","http://www.w3.org/2000/svg"),f(e,"height","24"),f(e,"viewBox","0 -960 960 960"),f(e,"width","24")},m(t,r){k(t,e,r),C(e,n)},d(t){t&&w(e)}}}function Ln(l){let e,n;return{c(){e=fe("svg"),n=fe("path"),f(n,"d","M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"),f(e,"class","h-8 fill-current"),f(e,"xmlns","http://www.w3.org/2000/svg"),f(e,"height","24"),f(e,"viewBox","0 -960 960 960"),f(e,"width","24")},m(t,r){k(t,e,r),C(e,n)},d(t){t&&w(e)}}}function Ee(l){let e,n=l[19].content+"";return{c(){e=y("span"),f(e,"class","max-w-3xl")},m(t,r){k(t,e,r),e.innerHTML=n},p(t,r){r&128&&n!==(n=t[19].content+"")&&(e.innerHTML=n)},d(t){t&&w(e)}}}function Re(l){let e,n,t={ctx:l,current:null,token:null,hasCatch:!1,pending:jn,then:In,catch:Un,value:23};return R(n=Z(l[23]),t),{c(){e=I(),t.block.c()},m(r,i){k(r,e,i),t.block.m(r,t.anchor=i),t.mount=()=>e.parentNode,t.anchor=e},p(r,i){l=r,t.ctx=l,i&128&&n!==(n=Z(l[23]))&&R(n,t)||ne(t,l,i)},d(r){r&&w(e),t.block.d(r),t.token=null,t=null}}}function Un(l){return{c:v,m:v,p:v,d:v}}function In(l){let e;function n(i,s){if(i[19].file.type==="image")return Rn;if(i[19].file.type==="video")return En}let t=n(l),r=t&&t(l);return{c(){r&&r.c(),e=I()},m(i,s){r&&r.m(i,s),k(i,e,s)},p(i,s){t===(t=n(i))&&r?r.p(i,s):(r&&r.d(1),r=t&&t(i),r&&(r.c(),r.m(e.parentNode,e)))},d(i){i&&w(e),r&&r.d(i)}}}function En(l){let e,n,t,r;return{c(){e=y("video"),n=y("source"),U(n.src,t=l[23])||f(n,"src",t),f(n,"type",r=l[24]),f(e,"class","h-40 w-auto"),e.autoplay=!0,e.controls=!0},m(i,s){k(i,e,s),C(e,n)},p(i,s){s&128&&!U(n.src,t=i[23])&&f(n,"src",t),s&128&&r!==(r=i[24])&&f(n,"type",r)},d(i){i&&w(e)}}}function Rn(l){let e,n,t;return{c(){e=y("img"),U(e.src,n=l[19].file.source)||f(e,"src",n),f(e,"alt",t=l[19].title),f(e,"class","h-40 w-auto")},m(r,i){k(r,e,i)},p(r,i){i&128&&!U(e.src,n=r[19].file.source)&&f(e,"src",n),i&128&&t!==(t=r[19].title)&&f(e,"alt",t)},d(r){r&&w(e)}}}function jn(l){let e;return{c(){e=y("p"),e.textContent="Obrázek se naÄŤĂtá..."},m(n,t){k(n,e,t)},p:v,d(n){n&&w(e)}}}function je(l,e){let n,t,r,i,s=!1,o,u,c,a,g,d,m,h,N;function D(A,_){return A[3]?Mn:An}let L=D(e),S=L(e),M=e[19].content&&Ee(e),q=e[19].file&&Re(Ne(e));return m=dt(e[16][0]),{key:l,first:null,c(){n=y("li"),t=y("label"),r=y("input"),o=F(),u=y("span"),S.c(),c=F(),a=y("div"),M&&M.c(),g=F(),q&&q.c(),d=F(),r.hidden=!0,f(r,"type","radio"),f(r,"name","answer"),r.__value=i=e[19],ze(r,r.__value),r.required=!0,r.disabled=e[3],f(u,"class","grid aspect-square h-10 place-items-center text-lg"),p(u,"text-white",e[20]),p(u,"text-answer-wrong-writing",e[3]&&!e[19].is_correct&&!e[20]),p(u,"text-answer-correct-writing",e[3]&&e[19].is_correct&&!e[20]),p(u,"bg-answer-letter",!e[20]&&!e[3]),p(u,"bg-answer-letter-selected",e[20]&&!e[3]),p(u,"bg-answer-letter-correct",e[3]&&e[19].is_correct&&!e[20]),p(u,"bg-answer-letter-wrong",e[3]&&!e[19].is_correct&&!e[20]),p(u,"bg-answer-letter-correct-selected",e[3]&&e[19].is_correct&&e[20]),p(u,"bg-answer-letter-wrong-selected",e[3]&&!e[19].is_correct&&e[20]),f(a,"class","flex flex-col items-center gap-8"),f(t,"class","flex items-center gap-6 border p-4"),p(t,"cursor-pointer",!e[3]),p(t,"border-transparent",!e[20]||e[3]),p(t,"border-primary",e[20]&&!e[3]),p(t,"text-primary",e[20]&&!e[3]),p(t,"hover:bg-answer-selected",!e[3]),p(t,"bg-answer",!e[3]),p(t,"bg-answer-selected",!e[3]&&e[20]),p(t,"text-white",e[3]&&e[20]),p(t,"text-answer-wrong-writing",e[3]&&!e[19].is_correct&&!e[20]),p(t,"text-answer-correct-writing",e[3]&&e[19].is_correct&&!e[20]),p(t,"bg-answer-correct",e[3]&&e[19].is_correct&&!e[20]),p(t,"bg-answer-wrong",e[3]&&!e[19].is_correct&&!e[20]),p(t,"bg-answer-correct-selected",e[3]&&e[19].is_correct&&e[20]),p(t,"bg-answer-wrong-selected",e[3]&&!e[19].is_correct&&e[20]),m.p(r),this.first=n},m(A,_){k(A,n,_),C(n,t),C(t,r),r.checked=r.__value===e[0],C(t,o),C(t,u),S.m(u,null),C(t,c),C(t,a),M&&M.m(a,null),C(a,g),q&&q.m(a,null),C(n,d),h||(N=P(r,"change",e[15]),h=!0)},p(A,_){e=A,_&128&&i!==(i=e[19])&&(r.__value=i,ze(r,r.__value),s=!0),_&8&&(r.disabled=e[3]),(s||_&129)&&(r.checked=r.__value===e[0]),L===(L=D(e))&&S?S.p(e,_):(S.d(1),S=L(e),S&&(S.c(),S.m(u,null))),_&129&&p(u,"text-white",e[20]),_&137&&p(u,"text-answer-wrong-writing",e[3]&&!e[19].is_correct&&!e[20]),_&137&&p(u,"text-answer-correct-writing",e[3]&&e[19].is_correct&&!e[20]),_&137&&p(u,"bg-answer-letter",!e[20]&&!e[3]),_&137&&p(u,"bg-answer-letter-selected",e[20]&&!e[3]),_&137&&p(u,"bg-answer-letter-correct",e[3]&&e[19].is_correct&&!e[20]),_&137&&p(u,"bg-answer-letter-wrong",e[3]&&!e[19].is_correct&&!e[20]),_&137&&p(u,"bg-answer-letter-correct-selected",e[3]&&e[19].is_correct&&e[20]),_&137&&p(u,"bg-answer-letter-wrong-selected",e[3]&&!e[19].is_correct&&e[20]),e[19].content?M?M.p(e,_):(M=Ee(e),M.c(),M.m(a,g)):M&&(M.d(1),M=null),e[19].file?q?q.p(Ne(e),_):(q=Re(Ne(e)),q.c(),q.m(a,null)):q&&(q.d(1),q=null),_&8&&p(t,"cursor-pointer",!e[3]),_&137&&p(t,"border-transparent",!e[20]||e[3]),_&137&&p(t,"border-primary",e[20]&&!e[3]),_&137&&p(t,"text-primary",e[20]&&!e[3]),_&8&&p(t,"hover:bg-answer-selected",!e[3]),_&8&&p(t,"bg-answer",!e[3]),_&137&&p(t,"bg-answer-selected",!e[3]&&e[20]),_&137&&p(t,"text-white",e[3]&&e[20]),_&137&&p(t,"text-answer-wrong-writing",e[3]&&!e[19].is_correct&&!e[20]),_&137&&p(t,"text-answer-correct-writing",e[3]&&e[19].is_correct&&!e[20]),_&137&&p(t,"bg-answer-correct",e[3]&&e[19].is_correct&&!e[20]),_&137&&p(t,"bg-answer-wrong",e[3]&&!e[19].is_correct&&!e[20]),_&137&&p(t,"bg-answer-correct-selected",e[3]&&e[19].is_correct&&e[20]),_&137&&p(t,"bg-answer-wrong-selected",e[3]&&!e[19].is_correct&&e[20])},d(A){A&&w(n),S.d(),M&&M.d(),q&&q.d(),m.r(),h=!1,N()}}}function On(l){let e,n,t;return{c(){e=y("button"),n=E("Vyhodnotit"),f(e,"class","w-40 bg-primary px-6 py-2 font-bold text-white hover:bg-opacity-80 disabled:bg-opacity-60"),f(e,"type","submit"),e.disabled=t=l[0]===void 0},m(r,i){k(r,e,i),C(e,n)},p(r,i){i&1&&t!==(t=r[0]===void 0)&&(e.disabled=t)},i:v,o:v,d(r){r&&w(e)}}}function Pn(l){let e;const n=l[13].submit,t=de(n,l,l[12],Me);return{c(){t&&t.c()},m(r,i){t&&t.m(r,i),e=!0},p(r,i){t&&t.p&&(!e||i&4096)&&_e(t,n,r,r[12],e?be(n,r[12],i,Nn):me(r[12]),Me)},i(r){e||(T(t,r),e=!0)},o(r){z(t,r),e=!1},d(r){t&&t.d(r)}}}function Hn(l){let e,n,t,r;const i=[Vn,Bn],s=[];function o(u,c){return u[9].next?0:1}return e=o(l),n=s[e]=i[e](l),{c(){n.c(),t=I()},m(u,c){s[e].m(u,c),k(u,t,c),r=!0},p(u,c){let a=e;e=o(u),e===a?s[e].p(u,c):(j(),z(s[a],1,1,()=>{s[a]=null}),O(),n=s[e],n?n.p(u,c):(n=s[e]=i[e](u),n.c()),T(n,1),n.m(t.parentNode,t))},i(u){r||(T(n),r=!0)},o(u){z(n),r=!1},d(u){u&&w(t),s[e].d(u)}}}function Bn(l){let e,n,t,r,i;return{c(){e=y("button"),n=E("DalšĂ"),f(e,"class","w-40 bg-primary px-6 py-2 font-bold text-white hover:bg-opacity-80 disabled:bg-opacity-60"),f(e,"type","button"),e.disabled=t=!l[6]()},m(s,o){k(s,e,o),C(e,n),r||(i=P(e,"click",function(){Ge(l[5])&&l[5].apply(this,arguments)}),r=!0)},p(s,o){l=s,o&64&&t!==(t=!l[6]())&&(e.disabled=t)},i:v,o:v,d(s){s&&w(e),r=!1,i()}}}function Vn(l){let e;const n=l[13].next,t=de(n,l,l[12],Fe);return{c(){t&&t.c()},m(r,i){t&&t.m(r,i),e=!0},p(r,i){t&&t.p&&(!e||i&4096)&&_e(t,n,r,r[12],e?be(n,r[12],i,Tn):me(r[12]),Fe)},i(r){e||(T(t,r),e=!0)},o(r){z(t,r),e=!1},d(r){t&&t.d(r)}}}function Yn(l){let e,n,t,r=l[2].content+"",i,s,o,u,c,a,g,d,m=l[2].file&&Ue(Te(l));function h(q,A){return q[1]?Sn:zn}let N=h(l),D=N(l);const L=[Hn,Pn,On],S=[];function M(q,A){return q[3]?0:q[9].submit?1:2}return u=M(l),c=S[u]=L[u](l),{c(){e=y("form"),n=y("div"),t=y("h3"),i=F(),m&&m.c(),s=F(),D.c(),o=F(),c.c(),f(t,"class","max-w-3xl text-3xl font-bold"),f(n,"class","grid min-h-80 place-items-center gap-8 border-2 border-secondary p-6 text-center"),f(e,"enctype","multipart/form-data")},m(q,A){k(q,e,A),C(e,n),C(n,t),t.innerHTML=r,C(n,i),m&&m.m(n,null),C(e,s),D.m(e,null),C(e,o),S[u].m(e,null),a=!0,g||(d=P(e,"submit",ct(function(){Ge(l[4])&&l[4].apply(this,arguments)})),g=!0)},p(q,[A]){l=q,(!a||A&4)&&r!==(r=l[2].content+"")&&(t.innerHTML=r),l[2].file?m?(m.p(Te(l),A),A&4&&T(m,1)):(m=Ue(Te(l)),m.c(),T(m,1),m.m(n,null)):m&&(j(),z(m,1,1,()=>{m=null}),O()),N===(N=h(l))&&D?D.p(l,A):(D.d(1),D=N(l),D&&(D.c(),D.m(e,o)));let _=u;u=M(l),u===_?S[u].p(l,A):(j(),z(S[_],1,1,()=>{S[_]=null}),O(),c=S[u],c?c.p(l,A):(c=S[u]=L[u](l),c.c()),T(c,1),c.m(e,null))},i(q){a||(T(m),T(c),a=!0)},o(q){z(m),z(c),a=!1},d(q){q&&w(e),m&&m.d(),D.d(),S[u].d(),g=!1,d()}}}function Wn(l,e,n){let{$$slots:t={},$$scope:r}=e;const i=Xe(t);let{test:s}=e,{question:o}=e,{submitted:u=!1}=e,{shuffle:c=!0}=e,{submit:a=()=>{}}=e,{next:g=()=>{}}=e,{canNext:d=()=>!1}=e,{selected:m}=e,{renderAnswer:h=!1}=e,N=[];function D(_,Y){return Y?at.shuffle(_.answers):_.answers}function L(_){if(S("answer")===2){n(1,h=!1);return}n(1,h=!0)}function S(_){const Y=s[`${_}_render_type`],he=o[`${_}_render_type`];return s.force_render?Y:Y===1?he:Y}const M=[[]];function q(_){h=_,n(1,h)}function A(){m=this.__value,n(0,m)}return l.$$set=_=>{"test"in _&&n(10,s=_.test),"question"in _&&n(2,o=_.question),"submitted"in _&&n(3,u=_.submitted),"shuffle"in _&&n(11,c=_.shuffle),"submit"in _&&n(4,a=_.submit),"next"in _&&n(5,g=_.next),"canNext"in _&&n(6,d=_.canNext),"selected"in _&&n(0,m=_.selected),"renderAnswer"in _&&n(1,h=_.renderAnswer),"$$scope"in _&&n(12,r=_.$$scope)},l.$$.update=()=>{l.$$.dirty&4&&L(),l.$$.dirty&2052&&n(7,N=D(o,c))},[m,h,o,u,a,g,d,N,S,i,s,c,r,t,q,A,M]}class Zn extends Q{constructor(e){super(),X(this,e,Wn,Yn,G,{test:10,question:2,submitted:3,shuffle:11,submit:4,next:5,canNext:6,selected:0,renderAnswer:1})}}function Oe(l){const e=l.slice(),n=te(e[1],{page:Number(te().params.page)+1});return e[11]=n,e}function Pe(l,e,n){const t=l.slice();t[9]=e[n],t[13]=n;const r=t[13]===t[3]-1;t[10]=r;const i=te(t[1],{page:t[13]+1});return t[11]=i,t}function Qn(l){let e,n,t;return{c(){e=y("button"),n=E("Vyhodnotit"),f(e,"class","btn svelte-1ye3tal"),e.disabled=t=l[4]===void 0,f(e,"type","submit")},m(r,i){k(r,e,i),C(e,n)},p(r,i){i&16&&t!==(t=r[4]===void 0)&&(e.disabled=t)},d(r){r&&w(e)}}}function Xn(l){let e,n,t,r,i;return{c(){e=y("a"),n=E("DalšĂ"),f(e,"class","btn svelte-1ye3tal"),f(e,"href",t=l[11])},m(s,o){k(s,e,o),C(e,n),r||(i=Je(Ke.call(null,e,{only:["question"]})),r=!0)},p(s,o){o&2&&t!==(t=s[11])&&f(e,"href",t)},d(s){s&&w(e),r=!1,i()}}}function Gn(l){let e=l[7](),n,t=e&&Xn(Oe(l));return{c(){t&&t.c(),n=I()},m(r,i){t&&t.m(r,i),k(r,n,i)},p(r,i){e&&t.p(Oe(r),i)},d(r){r&&w(n),t&&t.d(r)}}}function Jn(l){let e,n,t,r;function i(o){l[8](o)}let s={canNext:l[7],question:l[2],shuffle:xn,submit:l[6],submitted:l[5],test:l[0],$$slots:{next:[Gn],submit:[Qn]},$$scope:{ctx:l}};return l[4]!==void 0&&(s.selected=l[4]),n=new Zn({props:s}),J.push(()=>pe(n,"selected",i)),{c(){e=y("main"),H(n.$$.fragment)},m(o,u){k(o,e,u),B(n,e,null),r=!0},p(o,u){const c={};u&4&&(c.question=o[2]),u&32&&(c.submitted=o[5]),u&1&&(c.test=o[0]),u&16402&&(c.$$scope={dirty:u,ctx:o}),!t&&u&16&&(t=!0,c.selected=o[4],ge(()=>t=!1)),n.$set(c)},i(o){r||(T(n.$$.fragment,o),r=!0)},o(o){z(n.$$.fragment,o),r=!1},d(o){o&&w(e),V(n)}}}function He(l){let e,n=l[0].content_before+"";return{c(){e=y("article"),f(e,"class","prose")},m(t,r){k(t,e,r),e.innerHTML=n},p(t,r){r&1&&n!==(n=t[0].content_before+"")&&(e.innerHTML=n)},d(t){t&&w(e)}}}function Be(l){let e,n=ae(l[0].questions),t=[];for(let r=0;r<n.length;r+=1)t[r]=Ve(Pe(l,n,r));return{c(){e=y("ul");for(let r=0;r<t.length;r+=1)t[r].c();f(e,"class","grid grid-cols-6 gap-2 sm:grid-cols-8 md:grid-cols-12 lg:grid-cols-7")},m(r,i){k(r,e,i);for(let s=0;s<t.length;s+=1)t[s]&&t[s].m(e,null)},p(r,i){if(i&11){n=ae(r[0].questions);let s;for(s=0;s<n.length;s+=1){const o=Pe(r,n,s);t[s]?t[s].p(o,i):(t[s]=Ve(o),t[s].c(),t[s].m(e,null))}for(;s<t.length;s+=1)t[s].d(1);t.length=n.length}},d(r){r&&w(e),pt(t,r)}}}function Ve(l){let e,n,t=l[13]+1+"",r,i,s,o,u;return{c(){e=y("li"),n=y("a"),r=E(t),s=F(),f(n,"href",i=l[11]),f(n,"class","grid h-full w-full place-items-center font-medium"),p(n,"bg-secondary",!l[10]),p(n,"hover:bg-primary-light",!l[10]),p(n,"bg-primary",l[10]),p(n,"text-white",l[10]),f(e,"class","aspect-square")},m(c,a){k(c,e,a),C(e,n),C(n,r),C(e,s),o||(u=Je(Ke.call(null,n,{only:["question"]})),o=!0)},p(c,a){a&2&&i!==(i=c[11])&&f(n,"href",i),a&8&&p(n,"bg-secondary",!c[10]),a&8&&p(n,"hover:bg-primary-light",!c[10]),a&8&&p(n,"bg-primary",c[10]),a&8&&p(n,"text-white",c[10])},d(c){c&&w(e),o=!1,u()}}}function Kn(l){var c,a,g;let e,n=((c=l[0])==null?void 0:c.title)+"",t,r,i,s,o=((a=l[0])==null?void 0:a.content_before)&&He(l),u=(((g=l[0])==null?void 0:g.questions)??[].length>0)&&Be(l);return{c(){e=y("h2"),t=E(n),r=F(),o&&o.c(),i=F(),u&&u.c(),s=I(),f(e,"class","decor-dash mb-8 text-2xl font-bold")},m(d,m){k(d,e,m),C(e,t),k(d,r,m),o&&o.m(d,m),k(d,i,m),u&&u.m(d,m),k(d,s,m)},p(d,m){var h,N,D;m&1&&n!==(n=((h=d[0])==null?void 0:h.title)+"")&&ce(t,n),(N=d[0])!=null&&N.content_before?o?o.p(d,m):(o=He(d),o.c(),o.m(i.parentNode,i)):o&&(o.d(1),o=null),((D=d[0])==null?void 0:D.questions)??[].length>0?u?u.p(d,m):(u=Be(d),u.c(),u.m(s.parentNode,s)):u&&(u.d(1),u=null)},d(d){d&&(w(e),w(r),w(i),w(s)),o&&o.d(d),u&&u.d(d)}}}function $n(l){let e,n;return e=new gt({props:{$$slots:{aside:[Kn],default:[Jn]},$$scope:{ctx:l}}}),{c(){H(e.$$.fragment)},m(t,r){B(e,t,r),n=!0},p(t,[r]){const i={};r&16447&&(i.$$scope={dirty:r,ctx:t}),e.$set(i)},i(t){n||(T(e.$$.fragment,t),n=!0)},o(t){z(e.$$.fragment,t),n=!1},d(t){V(e,t)}}}let xn=!0;function el(l,e,n){let{test:t}=e,{testRoute:r}=e,{question:i}=e,s=1,o,u=!1;De(function(){mt.subscribe(function(){n(5,u=!1),n(4,o=void 0),n(3,s=Number(te().params.page))})});function c(){n(5,u=!0),bt.post(te("base.student.answer",{answer:o.id,question:i.id,test:t.id})).catch(function(){n(5,u=!1)})}function a(){return t.questions.length>s}function g(d){o=d,n(4,o)}return l.$$set=d=>{"test"in d&&n(0,t=d.test),"testRoute"in d&&n(1,r=d.testRoute),"question"in d&&n(2,i=d.question)},[t,r,i,s,o,u,c,a,g]}class ll extends Q{constructor(e){super(),X(this,e,el,$n,G,{test:0,testRoute:1,question:2})}}export{ll as default,sl as layout};