PageSourceSearch

https://korekthor.cz/_next/static/chunks/app/layout-b1812c56c18b3887.js

js korekthor.cz collected 2026-10-02 01:51:25 UTC 6,343 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3185],{64826:function(e,t,r){Promise.resolve().then(r.bind(r,37140)),Promise.resolve().then(r.bind(r,31892)),Promise.resolve().then(r.t.bind(r,9646,23)),Promise.resolve().then(r.t.bind(r,95050,23))},46729:function(e,t,r){"use strict";r.d(t,{Lh:function(){return f},PR:function(){return s},SO:function(){return h},T:function(){return o},Vx:function(){return a},bC:function(){return i},cZ:function(){return l},kS:function(){return u},sx:function(){return c},tm:function(){return k},xA:function(){return d}});var n=r(45878);let s=async()=>{let e=await n.hi.request({method:"GET",url:"/auth/me",useAuth:!0});return e},u=async()=>{let e=await n.hi.request({method:"POST",url:"/auth/logout",useAuth:!0});return localStorage.removeItem("editor_text"),e},o=async()=>{let e=await n.hi.request({method:"POST",url:"/auth/verify",useAuth:!0});return e},i=async e=>{let{selector:t,token:r}=e,s=await n.hi.request({method:"POST",url:"/auth/verify/".concat(t),body:{token:r}});return s},a=async e=>{let{email:t,prefersTheme:r,username:s,selectedDictionaries:u}=e,o=await n.hi.request({method:"PATCH",url:"/auth/",body:{email:t,prefersTheme:r,username:s,selectedDictionaries:u},useAuth:!0});return o},l=async e=>{let{file:t,onUploadProgress:r}=e,s=new FormData;s.append("file",t);let u=await n.hi.request({method:"PATCH",url:"/auth/profile-picture",body:s,useAuth:!0,onUploadProgress:r});return u},c=async()=>{let e=await n.hi.request({method:"DELETE",url:"/auth/profile-picture",useAuth:!0});return e},h=async e=>{let t=await n.hi.request({method:"DELETE",url:"/auth/sessions/".concat(e),useAuth:!0});return t},d=async()=>{let e=await n.hi.request({method:"DELETE",url:"/auth/sessions",useAuth:!0});return e},f=async()=>{let e=await n.hi.request({method:"POST",url:"/users/delete",useAuth:!0});return e},k=async e=>{let{selector:t,token:r}=e,s=await n.hi.request({method:"POST",url:"/users/delete/".concat(t),body:{token:r}});return s}},45878:function(e,t,r){"use strict";r.d(t,{hi:function(){return a}});var n=r(99472),s=r(92164),u=r(47940);let o=n.default.create({baseURL:"https://api.korekthor.cz"});class i{async request(e){let{method:t,url:r,body:n,headers:o={},useAuth:i,queryParameters:a,responseType:l,onUploadProgress:c}=e;i&&(o.Authorization="Bearer "+u.M.getToken());try{let e=await this.server.request({method:t,url:r,data:n,headers:{...o},params:a,responseType:l,onUploadProgress:c});return e.data}catch(e){if((0,s.IZ)(e)){var h,d;throw Error((null===(d=e.response)||void 0===d?void 0:null===(h=d.data)||void 0===h?void 0:h.error)||e.message)}throw Error("Nezn\xe1m\xe1 chyba (".concat(e,")"))}}constructor(e){this.server=e}}let a=new i(o)},37140:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return g}});var n=r(57437),s=r(2265),u=r(94743),o=r(59077),i=r(46729),a=r(47940),l=r(6435),c=r(45575),h=r(27337),d=r(75128),f=r(24033),k=r(87415),m=e=>{let{children:t}=e,[r,o]=s.useState(null),{user:i,setUser:m}=(0,u.a)(),{theme:g,setTheme:v}=(0,l.F)(),y=(0,f.useRouter)();return s.useEffect(()=>{if(!r){let e=(0,h.io)("https://api.korekthor.cz");e.on("connect",()=>{e.emit("authenticate",{token:a.M.getToken()})}),e.on("authenticated",()=>{console.log("Websocket authenticated"),o(e)}),e.on("auth_error",e=>{console.error("Couldn't authenticate websocket: ",e)})}},[i,r]),s.useEffect(()=>{if(r)return r.on("user_update",e=>{m(e),v(d.y[e.prefersTheme].className)}),r.on("user_logout",e=>{console.log("user_logout",e,null==i?void 0:i.sessionId),((null==i?void 0:i.sessionId)===e||"all"===e)&&(m(null),a.M.removeToken(),y.push("/prihlaseni"))}),()=>{r.off("user_update")}},[r]),(0,n.jsxs)(c.J.Provider,{value:{socket:r,setSocket:o},children:[t,(0,n.jsx)(k.Ix,{theme:"light"===g?"light":"dark",toastStyle:{backgroundColor:"light"===g?"#eeeeee":"#242424",fontFamily:"inherit"}})]})};r(94592),r(83343);var g=e=>{let{children:t}=e,[r,c]=s.useState(null),h=(0,o.useQuery)("user",i.PR,{enabled:!1,retry:!1,onSuccess:e=>{c(e)}});return s.useEffect(()=>{if(a.M.init(),a.M.getToken()){h.refetch();return}a.M.onTokenChange(e=>{e?h.refetch():c(null)})},[]),(0,n.jsx)(l.f,{defaultTheme:"dark",children:(0,n.jsx)(u.S.Provider,{value:{user:r,setUser:c,isLoading:h.isLoading},children:(0,n.jsx)(m,{children:t})})})}},31892:function(e,t,r){"use strict";r.r(t);var n=r(57437),s=r(2265),u=r(59077),o=r(29921);t.default=e=>{let{children:t}=e,[r]=s.useState(()=>new u.QueryClient);return(0,n.jsxs)(u.QueryClientProvider,{client:r,children:[t,(0,n.jsx)(o.ReactQueryDevtools,{})]})}},75128:function(e,t,r){"use strict";r.d(t,{y:function(){return n}});let n=[{className:"dark",name:"Tmav\xe9",id:0},{className:"light",name:"Světl\xe9",id:1}]},47940:function(e,t,r){"use strict";r.d(t,{M:function(){return n}});
1class n{static init(){this.token=n.getCookie("token")||null,this.listeners.forEach(e=>e(this.token))}static setToken(e){this.token=e,n.setCookie("token",e),this.listeners.forEach(t=>t(e))}static getToken(){return this.token}static removeToken(){this.token=null,n.deleteCookie("token"),this.listeners.forEach(e=>e(null))}static onTokenChange(e){this.listeners.push(e)}static setCookie(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:365,n=new Date;n.setTime(n.getTime()+864e5*r);let s="expires="+n.toUTCString();document.cookie=e+"="+t+";"+s+";path=/"}static getCookie(e){let t=e+"=",r=decodeURIComponent(document.cookie),n=r.split(";");for(let e=0;e<n.length;e++){let r=n[e];for(;" "==r.charAt(0);)r=r.substring(1);if(0==r.indexOf(t))return r.substring(t.length,r.length)}return""}static deleteCookie(e){document.cookie=e+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC;"}}n.listeners=[]},45575:function(e,t,r){"use strict";r.d(t,{J:function(){return s},s:function(){return u}});var n=r(2265);let s=(0,n.createContext)({socket:null,setSocket:()=>{}}),u=()=>{let e=(0,n.useContext)(s);return{socket:e.socket,setSocket:e.setSocket}}},94743:function(e,t,r){"use strict";r.d(t,{S:function(){return u},a:function(){return o}});var n=r(2265),s=r(59077);let u=(0,n.createContext)({user:null,isLoading:!0,setUser:()=>{}}),o=()=>{let e=(0,n.useContext)(u),t=(0,s.useQueryClient)().isFetching("user");return{user:e.user,setUser:e.setUser,fetching:t,isLoading:e.isLoading}}},95050:function(){}},function(e){e.O(0,[4936,2164,7552,2971,2472,1744],function(){return e(e.s=64826)}),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.