1 line
11 KiB
JavaScript
1 line
11 KiB
JavaScript
var je=Object.defineProperty;var Be=(e,t,n)=>t in e?je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var R=(e,t,n)=>(Be(e,typeof t!="symbol"?t+"":t,n),n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const u of s.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&o(u)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function o(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();function E(){}function be(e){return e()}function ue(){return Object.create(null)}function L(e){e.forEach(be)}function S(e){return typeof e=="function"}function te(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let F;function ce(e,t){return e===t?!0:(F||(F=document.createElement("a")),F.href=t,e===F.href)}function Fe(e){return Object.keys(e).length===0}function we(e,...t){if(e==null){for(const o of t)o(void 0);return E}const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function ye(e){let t;return we(e,n=>t=n)(),t}function Me(e,t,n){e.$$.on_destroy.push(we(t,n))}function le(e,t,n){return e.set(n),t}function he(e,t){e.appendChild(t)}function ne(e,t,n){e.insertBefore(t,n||null)}function T(e){e.parentNode&&e.parentNode.removeChild(e)}function Te(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function v(e){return document.createElement(e)}function ke(e){return document.createTextNode(e)}function We(){return ke(" ")}function He(){return ke("")}function G(e,t,n,o){return e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o)}function q(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function De(e){return Array.from(e.childNodes)}function _(e,t,n,o){n==null?e.style.removeProperty(t):e.style.setProperty(t,n,o?"important":"")}let j;function C(e){j=e}function Ke(){if(!j)throw new Error("Function called outside component initialization");return j}function Re(e){Ke().$$.on_mount.push(e)}const P=[],I=[];let U=[];const $=[],Ge=Promise.resolve();let x=!1;function Ve(){x||(x=!0,Ge.then(Ee))}function ee(e){U.push(e)}function V(e){$.push(e)}const X=new Set;let z=0;function Ee(){if(z!==0)return;const e=j;do{try{for(;z<P.length;){const t=P[z];z++,C(t),Xe(t.$$)}}catch(t){throw P.length=0,z=0,t}for(C(null),P.length=0,z=0;I.length;)I.pop()();for(let t=0;t<U.length;t+=1){const n=U[t];X.has(n)||(X.add(n),n())}U.length=0}while(P.length);for(;$.length;)$.pop()();x=!1,X.clear(),C(e)}function Xe(e){if(e.fragment!==null){e.update(),L(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(ee)}}function Ye(e){const t=[],n=[];U.forEach(o=>e.indexOf(o)===-1?t.push(o):n.push(o)),n.forEach(o=>o()),U=t}const M=new Set;let k;function ze(){k={r:0,c:[],p:k}}function Oe(){k.r||L(k.c),k=k.p}function w(e,t){e&&e.i&&(M.delete(e),e.i(t))}function A(e,t,n,o){if(e&&e.o){if(M.has(e))return;M.add(e),k.c.push(()=>{M.delete(e),o&&(n&&e.d(1),o())}),e.o(t)}else o&&o()}function de(e){return(e==null?void 0:e.length)!==void 0?e:Array.from(e)}function Y(e,t,n){const o=e.$$.props[t];o!==void 0&&(e.$$.bound[o]=n,n(e.$$.ctx[o]))}function Pe(e){e&&e.c()}function re(e,t,n){const{fragment:o,after_update:r}=e.$$;o&&o.m(t,n),ee(()=>{const s=e.$$.on_mount.map(be).filter(S);e.$$.on_destroy?e.$$.on_destroy.push(...s):L(s),e.$$.on_mount=[]}),r.forEach(ee)}function oe(e,t){const n=e.$$;n.fragment!==null&&(Ye(n.after_update),L(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Ze(e,t){e.$$.dirty[0]===-1&&(P.push(e),Ve(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function Ue(e,t,n,o,r,s,u=null,l=[-1]){const i=j;C(e);const f=e.$$={fragment:null,ctx:[],props:s,update:E,not_equal:r,bound:ue(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(i?i.$$.context:[])),callbacks:ue(),dirty:l,skip_bound:!1,root:t.target||i.$$.root};u&&u(f.root);let c=!1;if(f.ctx=n?n(e,t.props||{},(a,m,...g)=>{const b=g.length?g[0]:m;return f.ctx&&r(f.ctx[a],f.ctx[a]=b)&&(!f.skip_bound&&f.bound[a]&&f.bound[a](b),c&&Ze(e,a)),m}):[],f.update(),c=!0,L(f.before_update),f.fragment=o?o(f.ctx):!1,t.target){if(t.hydrate){const a=De(t.target);f.fragment&&f.fragment.l(a),a.forEach(T)}else f.fragment&&f.fragment.c();t.intro&&w(e.$$.fragment),re(e,t.target,t.anchor),Ee()}C(i)}class Ae{constructor(){R(this,"$$");R(this,"$$set")}$destroy(){oe(this,1),this.$destroy=E}$on(t,n){if(!S(n))return E;const o=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return o.push(n),()=>{const r=o.indexOf(n);r!==-1&&o.splice(r,1)}}$set(t){this.$$set&&!Fe(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Je="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Je);const O=[];function Le(e,t=E){let n;const o=new Set;function r(l){if(te(e,l)&&(e=l,n)){const i=!O.length;for(const f of o)f[1](),O.push(f,e);if(i){for(let f=0;f<O.length;f+=2)O[f][0](O[f+1]);O.length=0}}}function s(l){r(l(e))}function u(l,i=E){const f=[l,i];return o.add(f),o.size===1&&(n=t(r,s)||E),l(e),()=>{o.delete(f),o.size===0&&n&&(n(),n=null)}}return{set:r,update:s,subscribe:u}}const Qe="/assets/cross-7520W89F.png",ve="/assets/circle-r_eNGtWz.png",$e="/assets/cross_black-kS3T6mqy.png",xe="/assets/circle_black-uPy51558.png",et="/assets/free-KHYXxP94.png",ie=Le(0),ae=()=>ye(ie)%2?d.p2:d.p1,tt=()=>ye(ie)%2?"red":"blue",Z=Le([]),d={fr:"Free",p1:"P1",p2:"P2",tie:"Tie",hid:"Hidden"},J=e=>{switch(e){default:return et;case d.p1:return ve;case d.p2:return Qe}},nt=e=>{switch(e){case d.p1:return xe;case d.p2:return $e}},rt=e=>{let t=e[0],n=e[2];for(let r=0;r<3;r++){let s=e[r*3],u=e[r%3];for(let l=0;l<3;l++)e[r*3+l]!=s&&(s=d.fr),e[r%3+l*3]!=u&&(u=d.fr);if(s!=d.fr)return s;if(u!=d.fr)return u;e[r*4]!=e[0]&&(t=d.fr),e[(r+1)*2]!=e[2]&&(n=d.fr)}if(t!=d.fr)return t;if(n!=d.fr)return n;let o=!0;return e.forEach(r=>{r==d.fr&&(o=!1)}),o?d.tie:d.fr},Q="black",pe=[[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1],[2,2]];function ge(e,t,n){const o=e.slice();return o[25]=t[n],o[26]=t,o[27]=n,o}function _e(e){let t,n,o=de(pe),r=[];for(let u=0;u<o.length;u+=1)r[u]=me(ge(e,o,u));const s=u=>A(r[u],1,1,()=>{r[u]=null});return{c(){for(let u=0;u<r.length;u+=1)r[u].c();t=He()},m(u,l){for(let i=0;i<r.length;i+=1)r[i]&&r[i].m(u,l);ne(u,t,l),n=!0},p(u,l){if(l&478){o=de(pe);let i;for(i=0;i<o.length;i+=1){const f=ge(u,o,i);r[i]?(r[i].p(f,l),w(r[i],1)):(r[i]=me(f),r[i].c(),w(r[i],1),r[i].m(t.parentNode,t))}for(ze(),i=o.length;i<r.length;i+=1)s(i);Oe()}},i(u){if(!n){for(let l=0;l<o.length;l+=1)w(r[l]);n=!0}},o(u){r=r.filter(Boolean);for(let l=0;l<r.length;l+=1)A(r[l]);n=!1},d(u){u&&T(t),Te(r,u)}}}function me(e){let t,n,o,r,s;function u(c){e[16](c,e[27])}function l(c){e[17](c)}function i(c){e[18](c,e[27])}let f={depth:e[1]-1,size:e[3]/3,coords:e[4].concat([e[27]]),position:{x:e[25][0]*e[3]/3+e[2].x,y:e[25][1]*e[3]/3+e[2].y}};return e[6][e[27]]!==void 0&&(f.t=e[6][e[27]]),e[8]!==void 0&&(f.higher=e[8]),e[7][e[27]]!==void 0&&(f.passUp=e[7][e[27]]),t=new Ne({props:f}),I.push(()=>Y(t,"t",u)),I.push(()=>Y(t,"higher",l)),I.push(()=>Y(t,"passUp",i)),{c(){Pe(t.$$.fragment)},m(c,a){re(t,c,a),s=!0},p(c,a){e=c;const m={};a&2&&(m.depth=e[1]-1),a&8&&(m.size=e[3]/3),a&16&&(m.coords=e[4].concat([e[27]])),a&12&&(m.position={x:e[25][0]*e[3]/3+e[2].x,y:e[25][1]*e[3]/3+e[2].y}),!n&&a&64&&(n=!0,m.t=e[6][e[27]],V(()=>n=!1)),!o&&a&256&&(o=!0,m.higher=e[8],V(()=>o=!1)),!r&&a&128&&(r=!0,m.passUp=e[7][e[27]],V(()=>r=!1)),t.$set(m)},i(c){s||(w(t.$$.fragment,c),s=!0)},o(c){A(t.$$.fragment,c),s=!1},d(c){oe(t,c)}}}function ot(e){let t,n,o,r,s,u,l,i=e[1]>0&&_e(e);return{c(){t=v("div"),n=v("img"),r=We(),i&&i.c(),ce(n.src,o=e[12])||q(n,"src",o),q(n,"alt",e[0]),_(n,"width",e[3]+"px"),_(n,"height",e[3]+"px"),_(n,"border","none"),q(t,"aria-hidden","true"),_(t,"border",e[5].width+"px "+e[5].style+" "+e[5].color),_(t,"width",e[3]+"px"),_(t,"height",e[3]+"px"),_(t,"position","fixed"),_(t,"bottom",e[2].y+"px"),_(t,"right",e[2].x+"px")},m(f,c){ne(f,t,c),he(t,n),he(t,r),i&&i.m(t,null),s=!0,u||(l=[G(t,"click",function(){S(e[11])&&e[11].apply(this,arguments)}),G(t,"mouseenter",function(){S(e[9])&&e[9].apply(this,arguments)}),G(t,"mouseleave",function(){S(e[10])&&e[10].apply(this,arguments)})],u=!0)},p(f,[c]){e=f,(!s||c&4096&&!ce(n.src,o=e[12]))&&q(n,"src",o),(!s||c&1)&&q(n,"alt",e[0]),(!s||c&8)&&_(n,"width",e[3]+"px"),(!s||c&8)&&_(n,"height",e[3]+"px"),e[1]>0?i?(i.p(e,c),c&2&&w(i,1)):(i=_e(e),i.c(),w(i,1),i.m(t,null)):i&&(ze(),A(i,1,1,()=>{i=null}),Oe()),(!s||c&32)&&_(t,"border",e[5].width+"px "+e[5].style+" "+e[5].color),(!s||c&8)&&_(t,"width",e[3]+"px"),(!s||c&8)&&_(t,"height",e[3]+"px"),(!s||c&4)&&_(t,"bottom",e[2].y+"px"),(!s||c&4)&&_(t,"right",e[2].x+"px")},i(f){s||(w(i),s=!0)},o(f){A(i),s=!1},d(f){f&&T(t),i&&i.d(),u=!1,L(l)}}}function it(e,t,n){let o,r;Me(e,Z,h=>n(15,r=h));let{depth:s}=t,{position:u,size:l,coords:i,t:f=d.fr}=t,c=!1,a=!0,m=s==0,g={style:"",width:s,color:Q},{higher:b=null}=t,N=[d.fr,d.fr,d.fr,d.fr,d.fr,d.fr,d.fr,d.fr,d.fr],y=[],W={update_win:()=>{if(!m)switch(n(0,f=rt(N)),f){case d.tie:y.forEach(h=>{h.deactivate()}),c=!0;break;default:y.forEach(h=>{h.destroy()}),n(12,o=J(f)),c=!0;case d.fr:}b!=null&&b.update_win()}};const se={deactivate:()=>{B(),c=!0},destroy:()=>{se.deactivate(),n(0,f=d.hid),n(5,g.style="none",g),y.forEach(h=>{h.destroy()})}},qe=()=>{let h=i.length==r.length;for(let p=0;p<i.length&&p<r.length;p++)i[p]!=r[p]&&(h=!1);if(h&&c){le(Z,r=r.slice(0,-1),r),a=!1,n(5,g.color=Q,g);return}a=i.length>=r.length;for(let p=0;p<i.length&&p<r.length;p++)r[p]!=i[p]&&(a=!1);h?n(5,g.color=tt(),g):n(5,g.color=Q,g),m&&a&&!c?fe():B()};let H,D,K,fe=()=>{n(9,H=()=>{n(12,o=nt(ae()))}),n(10,D=()=>{n(12,o=J(f))}),n(11,K=()=>{n(0,f=ae()),B(),c=!0,b!=null&&b.update_win(),le(Z,r=i.slice(1),r),ie.update(h=>h+1)})},B=()=>{n(9,H=()=>{}),n(10,D=()=>{}),n(11,K=()=>{})};Re(()=>{m?(fe(),n(5,g.style="none",g)):(B(),n(5,g.style="solid",g))});function Se(h,p){e.$$.not_equal(N[p],h)&&(N[p]=h,n(6,N))}function Ce(h){W=h,n(8,W)}function Ie(h,p){e.$$.not_equal(y[p],h)&&(y[p]=h,n(7,y))}return e.$$set=h=>{"depth"in h&&n(1,s=h.depth),"position"in h&&n(2,u=h.position),"size"in h&&n(3,l=h.size),"coords"in h&&n(4,i=h.coords),"t"in h&&n(0,f=h.t),"higher"in h&&n(13,b=h.higher)},e.$$.update=()=>{e.$$.dirty&1&&n(12,o=J(f)),e.$$.dirty&32768&&r&&qe()},[f,s,u,l,i,g,N,y,W,H,D,K,o,b,se,r,Se,Ce,Ie]}class Ne extends Ae{constructor(t){super(),Ue(this,t,it,ot,te,{depth:1,position:2,size:3,coords:4,t:0,higher:13,passUp:14})}get passUp(){return this.$$.ctx[14]}}function st(e){let t,n,o;return n=new Ne({props:{depth:e[1],size:e[0],position:e[2],coords:e[3]}}),{c(){t=v("main"),Pe(n.$$.fragment)},m(r,s){ne(r,t,s),re(n,t,null),o=!0},p(r,[s]){const u={};s&2&&(u.depth=r[1]),s&1&&(u.size=r[0]),s&4&&(u.position=r[2]),n.$set(u)},i(r){o||(w(n.$$.fragment,r),o=!0)},o(r){A(n.$$.fragment,r),o=!1},d(r){r&&T(t),oe(n)}}}function ft(e,t,n){let o,r,s,u,l=[],i=-1;for(;i>5||i<0;)i=parseInt(prompt("Zadej hloubku rekurze (0-4)"));return e.$$.update=()=>{e.$$.dirty&48&&n(0,s=Math.min(r,o)-50),e.$$.dirty&49&&n(2,u={x:(r-s)/2,y:(o-s)/2})},n(4,o=window.innerHeight),n(5,r=window.innerWidth),[s,i,u,l,o,r]}class ut extends Ae{constructor(t){super(),Ue(this,t,ft,st,te,{})}}new ut({target:document.getElementById("app")});
|