From 3730ff182d00303ee38558455a942793dc944b31 Mon Sep 17 00:00:00 2001 From: VividTruthKeeper Date: Sun, 9 Oct 2022 18:34:12 +0500 Subject: [PATCH] build --- dist/assets/{index.65cf41d8.js => index.b20a2649.js} | 2 +- dist/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename dist/assets/{index.65cf41d8.js => index.b20a2649.js} (97%) diff --git a/dist/assets/index.65cf41d8.js b/dist/assets/index.b20a2649.js similarity index 97% rename from dist/assets/index.65cf41d8.js rename to dist/assets/index.b20a2649.js index e0ce4b1..b849a72 100644 --- a/dist/assets/index.65cf41d8.js +++ b/dist/assets/index.b20a2649.js @@ -56,4 +56,4 @@ Error generating stack: `+i.message+` * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var C1=N.exports,N1=Symbol.for("react.element"),P1=Symbol.for("react.fragment"),R1=Object.prototype.hasOwnProperty,L1=C1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,O1={key:!0,ref:!0,__self:!0,__source:!0};function uf(e,t,n){var r,l={},i=null,o=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)R1.call(t,r)&&!O1.hasOwnProperty(r)&&(l[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)l[r]===void 0&&(l[r]=t[r]);return{$$typeof:N1,type:e,key:i,ref:o,props:l,_owner:L1.current}}ii.Fragment=P1;ii.jsx=uf;ii.jsxs=uf;(function(e){e.exports=ii})(Yu);const s=Yu.exports.jsx,x=Yu.exports.jsxs;var Lt=globalThis&&globalThis.__assign||function(){return Lt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{const{pop:e,message:t,success:n}=N.exports.useContext(et).popupValue.popup;return s("div",{className:"popup__wrapper",children:s("div",{className:"popup__wrapper__inner",children:x("div",{className:e?"popup active":"popup",children:[n?s(A.Provider,{value:{color:"#8DD77F"},children:s(B1,{})}):s(A.Provider,{value:{color:"red"},children:s($1,{})}),s("span",{children:n?t.success:t.failure})]})})})},_s={username:"admin",password:"admin@tps"},H1=()=>{const[e,t]=N.exports.useState({username:"",password:"",remember:!1,check:!1,valid:!1}),{user:n,setUser:r}=N.exports.useContext(li);return N.exports.useEffect(()=>{e.username===_s.username&&e.password===_s.password?t({...e,valid:!0}):t({...e,valid:!1})},[e.username,e.password]),s("main",{className:"login",children:s("div",{className:"container",children:s("div",{className:"login inner",children:x("div",{className:"login__wrapper",children:[s("h1",{className:"login__header",children:"Login"}),x("form",{className:"login__form",onSubmit:l=>{l.preventDefault()},children:[x("div",{className:"login__form__block",children:[s("label",{htmlFor:"username",children:"Username"}),s("input",{required:!0,autoComplete:"true",type:"text",id:"username",placeholder:"username",onChange:l=>{t({...e,username:l.target.value})}})]}),x("div",{className:"login__form__block",children:[s("label",{htmlFor:"password",children:"Password"}),s("input",{required:!0,autoComplete:"true",type:"password",id:"password",placeholder:"password",onChange:l=>{t({...e,password:l.target.value})}})]}),s("div",{className:"login__form__block--check",children:x("label",{children:[s("input",{type:"checkbox",name:"remember",id:"remember",onChange:l=>{t({...e,remember:l.target.checked})}}),s("span",{children:"Remember me"})]})}),s("span",{className:e.check&&!e.valid?"login__form__error active":"login__form__error",children:"Invalid credentials"}),s("button",{className:"login__form__button login__form__button--violet",onClick:()=>{if(t({...e,check:!0}),e.valid&&r({username:e.username,accessLevel:"admin"}),e.remember){const l={username:e.username,accessLevel:"admin"};localStorage.setItem("userData",JSON.stringify(l))}},children:"Login"})]})]})})})})};function W1(e){return ie({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M32 96v64h448V96H32zm0 128v64h448v-64H32zm0 128v64h448v-64H32z"}}]})(e)}const Q1=({aside:e,setAside:t})=>{const{user:n,setUser:r}=N.exports.useContext(li),[l,i]=N.exports.useState(!1);return s("nav",{className:"nav",children:s("div",{className:"container",children:x("div",{className:"nav inner",children:[x("div",{className:"nav__left",children:[s(Wt,{to:"/posts",className:"nav__img",onClick:()=>{localStorage.setItem("lastLocation","/dashboard")},children:s(A.Provider,{value:{color:"#7d69ef"},children:s(A1,{})})}),s(A.Provider,{value:{color:"#7d69ef"},children:s(W1,{type:"button",className:"nav__btn",onClick:()=>t(!e)})})]}),s("div",{className:"nav__right",children:x("div",{className:"nav__right__user",onClick:()=>{i(!l)},children:[s(A.Provider,{value:{color:"#7d69ef"},children:s(j1,{className:"nav__right__user__img"})}),s("span",{children:"Profile"}),s("div",{className:l?"nav__dropdown active":"nav__dropdown",children:x("ul",{className:"nav__dropdown__wrapper",children:[x("li",{children:[s("h2",{children:"Username:"}),s("p",{children:n.username})]}),x("li",{children:[s("h2",{children:"Access:"}),s("p",{children:n.accessLevel})]}),s("li",{children:s("button",{type:"button",onClick:()=>{localStorage.removeItem("userData"),r({username:"",accessLevel:""})},children:"Log out"})})]})})]})})]})})})};function K1(e){return ie({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M4 18v-.65c0-.34.16-.66.41-.81C6.1 15.53 8.03 15 10 15c.03 0 .05 0 .08.01.1-.7.3-1.37.59-1.98-.22-.02-.44-.03-.67-.03-2.42 0-4.68.67-6.61 1.82-.88.52-1.39 1.5-1.39 2.53V20h9.26c-.42-.6-.75-1.28-.97-2H4zM10 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0-6c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zM20.75 16c0-.22-.03-.42-.06-.63l1.14-1.01-1-1.73-1.45.49c-.32-.27-.68-.48-1.08-.63L18 11h-2l-.3 1.49c-.4.15-.76.36-1.08.63l-1.45-.49-1 1.73 1.14 1.01c-.03.21-.06.41-.06.63s.03.42.06.63l-1.14 1.01 1 1.73 1.45-.49c.32.27.68.48 1.08.63L16 21h2l.3-1.49c.4-.15.76-.36 1.08-.63l1.45.49 1-1.73-1.14-1.01c.03-.21.06-.41.06-.63zM17 18c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"}}]})(e)}const q1=({aside:e,setAside:t})=>{const{setUser:n}=N.exports.useContext(li);return s("aside",{className:e?"aside active":"aside",children:x("ul",{className:"aside__list",children:[x("li",{className:"aside__list__element aside__list__element--title",children:[s(A.Provider,{value:{color:"#7d69ef"},children:s(D1,{className:"aside__img"})}),s("h2",{children:"Posts"})]}),s("li",{className:"aside__list__element",children:x(Wt,{to:"/posts",onClick:()=>localStorage.setItem("lastLocation","/posts"),children:[s(A.Provider,{value:{color:"#7d69ef"},children:s(cf,{className:"aside__list__element__img"})}),s("span",{children:"Posts"})]})}),x("li",{className:"aside__list__element aside__list__element--title",children:[s(A.Provider,{value:{color:"#7d69ef"},children:s(sf,{})}),s("h2",{children:"Source"})]}),s("li",{className:"aside__list__element",children:x(Wt,{to:"/source",onClick:()=>localStorage.setItem("lastLocation","/source"),children:[s(A.Provider,{value:{color:"#7d69ef"},children:s(F1,{className:"aside__list__element__img"})}),s("span",{children:"Source"})]})}),s("li",{className:"aside__list__element",children:x(Wt,{to:"/source/create",children:[s(A.Provider,{value:{color:"#7d69ef"},children:s(Ju,{className:"aside__list__element__img"})}),s("span",{children:"Create source"})]})}),x("li",{className:"aside__list__element aside__list__element--title",children:[s(A.Provider,{value:{color:"#7d69ef"},children:s(K1,{className:"aside__img"})}),s("h2",{children:"Account"})]}),s("li",{className:"aside__list__element",onClick:()=>{localStorage.removeItem("userData"),n({username:"",accessLevel:""})},children:x("div",{children:[s(A.Provider,{value:{color:"#7d69ef"},children:s(I1,{className:"aside__list__element__img"})}),s("span",{children:"Log out"})]})})]})})},on=({child:e})=>{const[t,n]=N.exports.useState(!0);return x("main",{className:"main",children:[s("div",{className:"main__top",children:s(Q1,{aside:t,setAside:n})}),x("div",{className:"main__mid",children:[s(q1,{aside:t,setAside:n}),s("div",{className:"main-inner",children:e})]})]})};var Zr,X1=new Uint8Array(16);function Y1(){if(!Zr&&(Zr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Zr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Zr(X1)}const J1=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function G1(e){return typeof e=="string"&&J1.test(e)}var oe=[];for(var ji=0;ji<256;++ji)oe.push((ji+256).toString(16).substr(1));function Z1(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(oe[e[t+0]]+oe[e[t+1]]+oe[e[t+2]]+oe[e[t+3]]+"-"+oe[e[t+4]]+oe[e[t+5]]+"-"+oe[e[t+6]]+oe[e[t+7]]+"-"+oe[e[t+8]]+oe[e[t+9]]+"-"+oe[e[t+10]]+oe[e[t+11]]+oe[e[t+12]]+oe[e[t+13]]+oe[e[t+14]]+oe[e[t+15]]).toLowerCase();if(!G1(n))throw TypeError("Stringified UUID is invalid");return n}function jl(e,t,n){e=e||{};var r=e.random||(e.rng||Y1)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(var l=0;l<16;++l)t[n+l]=r[l];return t}return Z1(r)}function ff(e){return ie({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"m13 3 3.293 3.293-7 7 1.414 1.414 7-7L21 11V3z"}},{tag:"path",attr:{d:"M19 19H5V5h7l-2-2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2h14c1.103 0 2-.897 2-2v-5l-2-2v7z"}}]})(e)}var pf={exports:{}},Gu={exports:{}},hf=function(t,n){return function(){for(var l=new Array(arguments.length),i=0;i"u"}function e0(e){return e!==null&&!$l(e)&&e.constructor!==null&&!$l(e.constructor)&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}var mf=tn("ArrayBuffer");function t0(e){var t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&mf(e.buffer),t}function n0(e){return typeof e=="string"}function r0(e){return typeof e=="number"}function vf(e){return e!==null&&typeof e=="object"}function dl(e){if(bu(e)!=="object")return!1;var t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}var l0=tn("Date"),i0=tn("File"),o0=tn("Blob"),u0=tn("FileList");function ta(e){return Zu.call(e)==="[object Function]"}function a0(e){return vf(e)&&ta(e.pipe)}function s0(e){var t="[object FormData]";return e&&(typeof FormData=="function"&&e instanceof FormData||Zu.call(e)===t||ta(e.toString)&&e.toString()===t)}var c0=tn("URLSearchParams");function d0(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function f0(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function na(e,t){if(!(e===null||typeof e>"u"))if(typeof e!="object"&&(e=[e]),ea(e))for(var n=0,r=e.length;n0;)i=r[l],o[i]||(t[i]=e[i],o[i]=!0);e=Object.getPrototypeOf(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t}function y0(e,t,n){e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;var r=e.indexOf(t,n);return r!==-1&&r===n}function g0(e){if(!e)return null;var t=e.length;if($l(t))return null;for(var n=new Array(t);t-- >0;)n[t]=e[t];return n}var _0=function(e){return function(t){return e&&t instanceof e}}(typeof Uint8Array<"u"&&Object.getPrototypeOf(Uint8Array)),ce={isArray:ea,isArrayBuffer:mf,isBuffer:e0,isFormData:s0,isArrayBufferView:t0,isString:n0,isNumber:r0,isObject:vf,isPlainObject:dl,isUndefined:$l,isDate:l0,isFile:i0,isBlob:o0,isFunction:ta,isStream:a0,isURLSearchParams:c0,isStandardBrowserEnv:f0,forEach:na,merge:Zo,extend:p0,trim:d0,stripBOM:h0,inherits:m0,toFlatObject:v0,kindOf:bu,kindOfTest:tn,endsWith:y0,toArray:g0,isTypedArray:_0,isFileList:u0},un=ce;function ws(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var yf=function(t,n,r){if(!n)return t;var l;if(r)l=r(n);else if(un.isURLSearchParams(n))l=n.toString();else{var i=[];un.forEach(n,function(a,d){a===null||typeof a>"u"||(un.isArray(a)?d=d+"[]":a=[a],un.forEach(a,function(v){un.isDate(v)?v=v.toISOString():un.isObject(v)&&(v=JSON.stringify(v)),i.push(ws(d)+"="+ws(v))}))}),l=i.join("&")}if(l){var o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+l}return t},w0=ce;function oi(){this.handlers=[]}oi.prototype.use=function(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1};oi.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)};oi.prototype.forEach=function(t){w0.forEach(this.handlers,function(r){r!==null&&t(r)})};var S0=oi,k0=ce,E0=function(t,n){k0.forEach(t,function(l,i){i!==n&&i.toUpperCase()===n.toUpperCase()&&(t[n]=l,delete t[i])})},gf=ce;function Mn(e,t,n,r,l){Error.call(this),this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),l&&(this.response=l)}gf.inherits(Mn,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var _f=Mn.prototype,wf={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach(function(e){wf[e]={value:e}});Object.defineProperties(Mn,wf);Object.defineProperty(_f,"isAxiosError",{value:!0});Mn.from=function(e,t,n,r,l,i){var o=Object.create(_f);return gf.toFlatObject(e,o,function(a){return a!==Error.prototype}),Mn.call(o,e.message,t,n,r,l),o.name=e.name,i&&Object.assign(o,i),o};var jn=Mn,Sf={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Be=ce;function x0(e,t){t=t||new FormData;var n=[];function r(i){return i===null?"":Be.isDate(i)?i.toISOString():Be.isArrayBuffer(i)||Be.isTypedArray(i)?typeof Blob=="function"?new Blob([i]):Buffer.from(i):i}function l(i,o){if(Be.isPlainObject(i)||Be.isArray(i)){if(n.indexOf(i)!==-1)throw Error("Circular reference detected in "+o);n.push(i),Be.forEach(i,function(a,d){if(!Be.isUndefined(a)){var h=o?o+"."+d:d,v;if(a&&!o&&typeof a=="object"){if(Be.endsWith(d,"{}"))a=JSON.stringify(a);else if(Be.endsWith(d,"[]")&&(v=Be.toArray(a))){v.forEach(function(c){!Be.isUndefined(c)&&t.append(h,r(c))});return}}l(a,h)}}),n.pop()}else t.append(o,r(i))}return l(e),t}var kf=x0,$i,Ss;function C0(){if(Ss)return $i;Ss=1;var e=jn;return $i=function(n,r,l){var i=l.config.validateStatus;!l.status||!i||i(l.status)?n(l):r(new e("Request failed with status code "+l.status,[e.ERR_BAD_REQUEST,e.ERR_BAD_RESPONSE][Math.floor(l.status/100)-4],l.config,l.request,l))},$i}var Bi,ks;function N0(){if(ks)return Bi;ks=1;var e=ce;return Bi=e.isStandardBrowserEnv()?function(){return{write:function(r,l,i,o,u,a){var d=[];d.push(r+"="+encodeURIComponent(l)),e.isNumber(i)&&d.push("expires="+new Date(i).toGMTString()),e.isString(o)&&d.push("path="+o),e.isString(u)&&d.push("domain="+u),a===!0&&d.push("secure"),document.cookie=d.join("; ")},read:function(r){var l=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return l?decodeURIComponent(l[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),Bi}var P0=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)},R0=function(t,n){return n?t.replace(/\/+$/,"")+"/"+n.replace(/^\/+/,""):t},L0=P0,O0=R0,Ef=function(t,n){return t&&!L0(n)?O0(t,n):n},Vi,Es;function T0(){if(Es)return Vi;Es=1;var e=ce,t=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return Vi=function(r){var l={},i,o,u;return r&&e.forEach(r.split(` -`),function(d){if(u=d.indexOf(":"),i=e.trim(d.substr(0,u)).toLowerCase(),o=e.trim(d.substr(u+1)),i){if(l[i]&&t.indexOf(i)>=0)return;i==="set-cookie"?l[i]=(l[i]?l[i]:[]).concat([o]):l[i]=l[i]?l[i]+", "+o:o}}),l},Vi}var Hi,xs;function z0(){if(xs)return Hi;xs=1;var e=ce;return Hi=e.isStandardBrowserEnv()?function(){var n=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),l;function i(o){var u=o;return n&&(r.setAttribute("href",u),u=r.href),r.setAttribute("href",u),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return l=i(window.location.href),function(u){var a=e.isString(u)?i(u):u;return a.protocol===l.protocol&&a.host===l.host}}():function(){return function(){return!0}}(),Hi}var Wi,Cs;function ui(){if(Cs)return Wi;Cs=1;var e=jn,t=ce;function n(r){e.call(this,r==null?"canceled":r,e.ERR_CANCELED),this.name="CanceledError"}return t.inherits(n,e,{__CANCEL__:!0}),Wi=n,Wi}var Qi,Ns;function D0(){return Ns||(Ns=1,Qi=function(t){var n=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return n&&n[1]||""}),Qi}var Ki,Ps;function Rs(){if(Ps)return Ki;Ps=1;var e=ce,t=C0(),n=N0(),r=yf,l=Ef,i=T0(),o=z0(),u=Sf,a=jn,d=ui(),h=D0();return Ki=function(c){return new Promise(function(w,E){var F=c.data,f=c.headers,p=c.responseType,m;function _(){c.cancelToken&&c.cancelToken.unsubscribe(m),c.signal&&c.signal.removeEventListener("abort",m)}e.isFormData(F)&&e.isStandardBrowserEnv()&&delete f["Content-Type"];var g=new XMLHttpRequest;if(c.auth){var L=c.auth.username||"",S=c.auth.password?unescape(encodeURIComponent(c.auth.password)):"";f.Authorization="Basic "+btoa(L+":"+S)}var C=l(c.baseURL,c.url);g.open(c.method.toUpperCase(),r(C,c.params,c.paramsSerializer),!0),g.timeout=c.timeout;function z(){if(!!g){var H="getAllResponseHeaders"in g?i(g.getAllResponseHeaders()):null,de=!p||p==="text"||p==="json"?g.responseText:g.response,ve={data:de,status:g.status,statusText:g.statusText,headers:H,config:c,request:g};t(function(Ft){w(Ft),_()},function(Ft){E(Ft),_()},ve),g=null}}if("onloadend"in g?g.onloadend=z:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(z)},g.onabort=function(){!g||(E(new a("Request aborted",a.ECONNABORTED,c,g)),g=null)},g.onerror=function(){E(new a("Network Error",a.ERR_NETWORK,c,g,g)),g=null},g.ontimeout=function(){var de=c.timeout?"timeout of "+c.timeout+"ms exceeded":"timeout exceeded",ve=c.transitional||u;c.timeoutErrorMessage&&(de=c.timeoutErrorMessage),E(new a(de,ve.clarifyTimeoutError?a.ETIMEDOUT:a.ECONNABORTED,c,g)),g=null},e.isStandardBrowserEnv()){var O=(c.withCredentials||o(C))&&c.xsrfCookieName?n.read(c.xsrfCookieName):void 0;O&&(f[c.xsrfHeaderName]=O)}"setRequestHeader"in g&&e.forEach(f,function(de,ve){typeof F>"u"&&ve.toLowerCase()==="content-type"?delete f[ve]:g.setRequestHeader(ve,de)}),e.isUndefined(c.withCredentials)||(g.withCredentials=!!c.withCredentials),p&&p!=="json"&&(g.responseType=c.responseType),typeof c.onDownloadProgress=="function"&&g.addEventListener("progress",c.onDownloadProgress),typeof c.onUploadProgress=="function"&&g.upload&&g.upload.addEventListener("progress",c.onUploadProgress),(c.cancelToken||c.signal)&&(m=function(H){!g||(E(!H||H&&H.type?new d:H),g.abort(),g=null)},c.cancelToken&&c.cancelToken.subscribe(m),c.signal&&(c.signal.aborted?m():c.signal.addEventListener("abort",m))),F||(F=null);var j=h(C);if(j&&["http","https","file"].indexOf(j)===-1){E(new a("Unsupported protocol "+j+":",a.ERR_BAD_REQUEST,c));return}g.send(F)})},Ki}var qi,Ls;function M0(){return Ls||(Ls=1,qi=null),qi}var ne=ce,Os=E0,Ts=jn,F0=Sf,A0=kf,I0={"Content-Type":"application/x-www-form-urlencoded"};function zs(e,t){!ne.isUndefined(e)&&ne.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}function U0(){var e;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(e=Rs()),e}function j0(e,t,n){if(ne.isString(e))try{return(t||JSON.parse)(e),ne.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}var ai={transitional:F0,adapter:U0(),transformRequest:[function(t,n){if(Os(n,"Accept"),Os(n,"Content-Type"),ne.isFormData(t)||ne.isArrayBuffer(t)||ne.isBuffer(t)||ne.isStream(t)||ne.isFile(t)||ne.isBlob(t))return t;if(ne.isArrayBufferView(t))return t.buffer;if(ne.isURLSearchParams(t))return zs(n,"application/x-www-form-urlencoded;charset=utf-8"),t.toString();var r=ne.isObject(t),l=n&&n["Content-Type"],i;if((i=ne.isFileList(t))||r&&l==="multipart/form-data"){var o=this.env&&this.env.FormData;return A0(i?{"files[]":t}:t,o&&new o)}else if(r||l==="application/json")return zs(n,"application/json"),j0(t);return t}],transformResponse:[function(t){var n=this.transitional||ai.transitional,r=n&&n.silentJSONParsing,l=n&&n.forcedJSONParsing,i=!r&&this.responseType==="json";if(i||l&&ne.isString(t)&&t.length)try{return JSON.parse(t)}catch(o){if(i)throw o.name==="SyntaxError"?Ts.from(o,Ts.ERR_BAD_RESPONSE,this,null,this.response):o}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:M0()},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};ne.forEach(["delete","get","head"],function(t){ai.headers[t]={}});ne.forEach(["post","put","patch"],function(t){ai.headers[t]=ne.merge(I0)});var ra=ai,$0=ce,B0=ra,V0=function(t,n,r){var l=this||B0;return $0.forEach(r,function(o){t=o.call(l,t,n)}),t},Xi,Ds;function xf(){return Ds||(Ds=1,Xi=function(t){return!!(t&&t.__CANCEL__)}),Xi}var Ms=ce,Yi=V0,H0=xf(),W0=ra,Q0=ui();function Ji(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Q0}var K0=function(t){Ji(t),t.headers=t.headers||{},t.data=Yi.call(t,t.data,t.headers,t.transformRequest),t.headers=Ms.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),Ms.forEach(["delete","get","head","post","put","patch","common"],function(l){delete t.headers[l]});var n=t.adapter||W0.adapter;return n(t).then(function(l){return Ji(t),l.data=Yi.call(t,l.data,l.headers,t.transformResponse),l},function(l){return H0(l)||(Ji(t),l&&l.response&&(l.response.data=Yi.call(t,l.response.data,l.response.headers,t.transformResponse))),Promise.reject(l)})},Pe=ce,Cf=function(t,n){n=n||{};var r={};function l(h,v){return Pe.isPlainObject(h)&&Pe.isPlainObject(v)?Pe.merge(h,v):Pe.isPlainObject(v)?Pe.merge({},v):Pe.isArray(v)?v.slice():v}function i(h){if(Pe.isUndefined(n[h])){if(!Pe.isUndefined(t[h]))return l(void 0,t[h])}else return l(t[h],n[h])}function o(h){if(!Pe.isUndefined(n[h]))return l(void 0,n[h])}function u(h){if(Pe.isUndefined(n[h])){if(!Pe.isUndefined(t[h]))return l(void 0,t[h])}else return l(void 0,n[h])}function a(h){if(h in n)return l(t[h],n[h]);if(h in t)return l(void 0,t[h])}var d={url:o,method:o,data:o,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:a};return Pe.forEach(Object.keys(t).concat(Object.keys(n)),function(v){var c=d[v]||i,y=c(v);Pe.isUndefined(y)&&c!==a||(r[v]=y)}),r},Gi,Fs;function Nf(){return Fs||(Fs=1,Gi={version:"0.27.2"}),Gi}var q0=Nf().version,mt=jn,la={};["object","boolean","number","function","string","symbol"].forEach(function(e,t){la[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});var As={};la.transitional=function(t,n,r){function l(i,o){return"[Axios v"+q0+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return function(i,o,u){if(t===!1)throw new mt(l(o," has been removed"+(n?" in "+n:"")),mt.ERR_DEPRECATED);return n&&!As[o]&&(As[o]=!0,console.warn(l(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,u):!0}};function X0(e,t,n){if(typeof e!="object")throw new mt("options must be an object",mt.ERR_BAD_OPTION_VALUE);for(var r=Object.keys(e),l=r.length;l-- >0;){var i=r[l],o=t[i];if(o){var u=e[i],a=u===void 0||o(u,i,e);if(a!==!0)throw new mt("option "+i+" must be "+a,mt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new mt("Unknown option "+i,mt.ERR_BAD_OPTION)}}var Y0={assertOptions:X0,validators:la},Pf=ce,J0=yf,Is=S0,Us=K0,si=Cf,G0=Ef,Rf=Y0,an=Rf.validators;function Fn(e){this.defaults=e,this.interceptors={request:new Is,response:new Is}}Fn.prototype.request=function(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=si(this.defaults,n),n.method?n.method=n.method.toLowerCase():this.defaults.method?n.method=this.defaults.method.toLowerCase():n.method="get";var r=n.transitional;r!==void 0&&Rf.assertOptions(r,{silentJSONParsing:an.transitional(an.boolean),forcedJSONParsing:an.transitional(an.boolean),clarifyTimeoutError:an.transitional(an.boolean)},!1);var l=[],i=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(i=i&&y.synchronous,l.unshift(y.fulfilled,y.rejected))});var o=[];this.interceptors.response.forEach(function(y){o.push(y.fulfilled,y.rejected)});var u;if(!i){var a=[Us,void 0];for(Array.prototype.unshift.apply(a,l),a=a.concat(o),u=Promise.resolve(n);a.length;)u=u.then(a.shift(),a.shift());return u}for(var d=n;l.length;){var h=l.shift(),v=l.shift();try{d=h(d)}catch(c){v(c);break}}try{u=Us(d)}catch(c){return Promise.reject(c)}for(;o.length;)u=u.then(o.shift(),o.shift());return u};Fn.prototype.getUri=function(t){t=si(this.defaults,t);var n=G0(t.baseURL,t.url);return J0(n,t.params,t.paramsSerializer)};Pf.forEach(["delete","get","head","options"],function(t){Fn.prototype[t]=function(n,r){return this.request(si(r||{},{method:t,url:n,data:(r||{}).data}))}});Pf.forEach(["post","put","patch"],function(t){function n(r){return function(i,o,u){return this.request(si(u||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}Fn.prototype[t]=n(),Fn.prototype[t+"Form"]=n(!0)});var Z0=Fn,Zi,js;function b0(){if(js)return Zi;js=1;var e=ui();function t(n){if(typeof n!="function")throw new TypeError("executor must be a function.");var r;this.promise=new Promise(function(o){r=o});var l=this;this.promise.then(function(i){if(!!l._listeners){var o,u=l._listeners.length;for(o=0;o{e(!0),Tr.get("http://95.85.124.41:8080/posts"+(n||"")).then(r=>{t(r.data.data)}).catch(r=>{}).finally(()=>e(!1))},om=(e,t,n,r)=>{Tr.delete(`http://95.85.124.41:8080/link/delete/${r}`).then(l=>{e(!0),n({...t,success:!0,pop:!0}),setTimeout(()=>{n({...t,pop:!1})},2e3)}).catch(l=>{e(!1),n({...t,success:!1,pop:!0}),setTimeout(()=>{n({...t,pop:!1})},2e3)})},ci=e=>{Tr.get("http://95.85.124.41:8080/links/all").then(t=>{e(t.data.data)}).catch(t=>{})},um=(e,t,n,r,l)=>{Tr.post("http://95.85.124.41:8080/link/create",{name:n.name,source:n.source}).then(i=>{t({...e,success:!0,pop:!0}),r(),setTimeout(()=>{t({...e,pop:!1}),l()},2e3)}).catch(i=>{t({...e,success:!1,pop:!0}),setTimeout(()=>{t({...e,pop:!1})},2e3)})},am=(e,t,n,r,l,i)=>{Tr.put(`http://95.85.124.41:8080/link/update/${l}`,i).then(o=>{t({...e,success:!0,pop:!0}),n(),setTimeout(()=>{t({...e,pop:!1}),r()},2e3)}).catch(o=>{t({...e,success:!1,pop:!0}),setTimeout(()=>{t({...e,pop:!1})},2e3)})},G=e=>{const t=e.toString().split("T"),n=t[0];let r,l;return t[1].includes(".")?(r=t[1].split("."),l=r[0]):(r=t[1],l=r.slice(0,r.length-1)),[n,l]},sm="/assets/loader.c7fd17f9.svg",cm=()=>s("div",{className:"loader",children:s("div",{className:"loader inner",children:s("img",{src:sm,alt:""})})}),dm=()=>{const[e,t]=N.exports.useState(!1),n=N.exports.useContext(et),{posts:r,setPosts:l}=n.postValue,{sources:i}=n.sourceValue,[o,u]=N.exports.useState(""),[a,d]=N.exports.useState("id"),[h,v]=N.exports.useState({perPage:10,pageNumber:1}),[c,y]=N.exports.useState({id:"desc",title:"asc",link:"asc",date:"asc",publish_date:"asc",created_at:"asc",updated_at:"asc"}),[w,E]=N.exports.useState({fil_title:{name:"fil_title",value:""},fil_link:{name:"fil_link",value:""},fil_publish_date:{name:"fil_publish_date",value:""},fil_summary:{name:"fil_summary",value:""},fil_created_atAt:{name:"fil_created_atAt",value:""},fil_updated_atAt:{name:"fil_updated_atAt",value:""}}),F=N.exports.useCallback(()=>{let f="";return Object.keys(w).map(m=>{const _=m;w[_].value.length>0&&(f=`${f}&${w[_].name}=${w[_].value}`)}),f},[w,E]);return N.exports.useEffect(()=>{const f=F();im(t,l,`?sortBy=${a}.${c[a]}&category=${o}&strLimit=${h.perPage}&strOffset=${h.pageNumber}${f}`)},[c,a,h,o,w]),s("main",{className:"posts",children:s("div",{className:"container",children:x("div",{className:"posts inner",children:[x("div",{className:"dashboard__head",children:[s(A.Provider,{value:{color:"#7d69ef"},children:s(cf,{className:"dashboard__img"})}),s("h1",{children:"Posts"})]}),x("div",{className:"posts__select__wrapper",children:[x("div",{className:"posts__select",children:[s("label",{htmlFor:"category",children:"Source"}),x("select",{id:"category",value:o,onChange:f=>{f.target.value==="All"?u(""):u(f.target.value)},children:[s("option",{value:"All",defaultChecked:!0,children:"All"}),i?i.map(f=>s("option",{value:f.name,children:f.name},jl())):""]})]}),x("div",{className:"posts__select",children:[s("label",{htmlFor:"pp",children:"Per page"}),x("select",{id:"pp",value:h.perPage,onChange:f=>{v({...h,perPage:parseInt(f.target.value)})},children:[s("option",{value:"10",defaultChecked:!0,children:"10"}),s("option",{value:"15",children:"15"}),s("option",{value:"20",children:"20"}),s("option",{value:"30",children:"30"}),s("option",{value:"40",children:"40"}),s("option",{value:"60",children:"60"}),s("option",{value:"80",children:"80"}),s("option",{value:"100",children:"100"})]})]}),s("div",{className:"posts__select posts__reset__btn",children:s("button",{className:"posts__reset",onClick:()=>{u(""),v({perPage:10,pageNumber:1}),E({fil_title:{name:"fil_title",value:""},fil_link:{name:"fil_link",value:""},fil_publish_date:{name:"fil_publish_date",value:""},fil_summary:{name:"fil_summary",value:""},fil_created_atAt:{name:"fil_created_atAt",value:""},fil_updated_atAt:{name:"fil_updated_atAt",value:""}})},children:"Reset"})})]}),x("table",{className:e?"posts__table disabled":"posts__table",children:[x("thead",{children:[x("tr",{className:"posts__table__head",children:[x("th",{className:a==="id"?"active":"",onClick:()=>{d("id"),c.id!=="asc"?y({...c,id:"asc"}):y({...c,id:"desc"})},children:[a==="id"&&c.id==="asc"?s(A.Provider,{value:{color:"#7d69ef"},children:s(ln,{})}):null,a==="id"&&c.id==="desc"?s(A.Provider,{value:{color:"#7d69ef"},children:s(rn,{})}):null,s("span",{children:"ID"})]}),s("th",{className:a==="category"?"active":"",children:s("span",{children:"Source"})}),x("th",{className:a==="title"?"active":"",onClick:()=>{d("title"),c.title!=="asc"?y({...c,title:"asc"}):y({...c,title:"desc"})},children:[a==="title"&&c.title==="asc"?s(A.Provider,{value:{color:"#7d69ef"},children:s(ln,{})}):null,a==="title"&&c.title==="desc"?s(A.Provider,{value:{color:"#7d69ef"},children:s(rn,{})}):null,s("span",{children:"Title"})]}),x("th",{className:a==="link"?"active":"",onClick:()=>{d("link"),c.link!=="asc"?y({...c,link:"asc"}):y({...c,link:"desc"})},children:[a==="link"&&c.link==="asc"?s(A.Provider,{value:{color:"#7d69ef"},children:s(ln,{})}):null,a==="link"&&c.link==="desc"?s(A.Provider,{value:{color:"#7d69ef"},children:s(rn,{})}):null,s("span",{children:"Link"})]}),x("th",{className:a==="publish_date"?"active":"",onClick:()=>{d("publish_date"),c.publish_date!=="asc"?y({...c,publish_date:"asc"}):y({...c,publish_date:"desc"})},children:[a==="publish_date"&&c.publish_date==="asc"?s(A.Provider,{value:{color:"#7d69ef"},children:s(ln,{})}):null,a==="publish_date"&&c.publish_date==="desc"?s(A.Provider,{value:{color:"#7d69ef"},children:s(rn,{})}):null,s("span",{children:"Published"})]}),x("th",{className:a==="created_at"?"active":"",onClick:()=>{d("created_at"),c.created_at!=="asc"?y({...c,created_at:"asc"}):y({...c,created_at:"desc"})},children:[a==="created_at"&&c.created_at==="asc"?s(A.Provider,{value:{color:"#7d69ef"},children:s(ln,{})}):null,a==="created_at"&&c.created_at==="desc"?s(A.Provider,{value:{color:"#7d69ef"},children:s(rn,{})}):null,s("span",{children:"Created"})]}),x("th",{className:a==="updated_at"?"active":"",onClick:()=>{d("updated_at"),c.updated_at!=="asc"?y({...c,updated_at:"asc"}):y({...c,updated_at:"desc"})},children:[a==="updated_at"&&c.updated_at==="asc"?s(A.Provider,{value:{color:"#7d69ef"},children:s(ln,{})}):null,a==="updated_at"&&c.updated_at==="desc"?s(A.Provider,{value:{color:"#7d69ef"},children:s(rn,{})}):null,s("span",{children:"Updated"})]})]}),x("tr",{className:"posts__table__head posts__table__head--inputs",children:[s("th",{}),s("th",{}),s("th",{children:s("input",{placeholder:"Filter by title",id:"filter-title",type:"text",value:w.fil_title.value,onChange:f=>E({...w,fil_title:{...w.fil_title,value:f.target.value}})})}),s("th",{children:s("input",{placeholder:"Filter by link",id:"filter-link",type:"text",value:w.fil_link.value,onChange:f=>{E({...w,fil_link:{...w.fil_link,value:f.target.value}})}})}),s("th",{children:s("input",{placeholder:"Filter by publish_date",id:"filter-publish_date",type:"date",value:w.fil_publish_date.value,onChange:f=>{E({...w,fil_publish_date:{...w.fil_publish_date,value:f.target.value}})}})}),s("th",{children:s("input",{placeholder:"Filter by created_at",id:"filter-created_at",type:"date",value:w.fil_created_atAt.value,onChange:f=>{E({...w,fil_created_atAt:{...w.fil_created_atAt,value:f.target.value}})}})}),s("th",{children:s("input",{placeholder:"Filter by updated_at",id:"filter-updated_at",type:"date",value:w.fil_updated_atAt.value,onChange:f=>E({...w,fil_updated_atAt:{...w.fil_updated_atAt,value:f.target.value}})})})]})]}),x("tbody",{children:[e?s(cm,{}):null,r?r.length>0?r[0].id!==-1?r.map(f=>s(Wt,{className:"post-link",to:`/posts/${f.id}`,children:x("tr",{children:[s("td",{children:f.id}),s("td",{children:f.category}),s("td",{children:f.title}),s("td",{children:s("a",{href:f.link,target:"_blank",rel:"noopener noreferrer",children:s(ff,{})})}),s("td",{children:`${G(f.publish_date)[0]}, ${G(f.publish_date)[1]}`}),s("td",{children:`${G(f.created_at)[0]}, ${G(f.created_at)[1]}`}),s("td",{children:`${G(f.created_at)[0]}, ${G(f.created_at)[1]}`})]})},jl())):s("tr",{children:s("td",{className:"table__empty",colSpan:7,children:"No posts"})}):s("tr",{children:s("td",{className:"table__empty",colSpan:7,children:"No posts"})}):s("tr",{children:s("td",{className:"table__empty",colSpan:7,children:"No posts"})})]})]}),x("div",{className:"posts__pagination",children:[s("button",{type:"button",disabled:h.pageNumber===1,onClick:()=>v({...h,pageNumber:h.pageNumber-1}),children:"Previous"}),s("input",{type:"text",value:h.pageNumber,readOnly:!0}),s("button",{disabled:!r,type:"button",onClick:()=>v({...h,pageNumber:h.pageNumber+1}),children:"Next"})]})]})})})},fm=()=>{const[e,t]=N.exports.useState(),{posts:n}=N.exports.useContext(et).postValue,{id:r}=tc();return new DOMParser,N.exports.useEffect(()=>{n&&n[0].id!==-1&&n.map(l=>{l.id.toString()===r&&t(l)})},[n]),s("main",{className:"post",children:s("div",{className:"container",children:x("div",{className:"post inner",children:[x("div",{className:"dashboard__head post__head",children:[s(A.Provider,{value:{color:"#7d69ef"},children:s(M1,{className:"dashboard__img"})}),s("h1",{className:"post__head",children:e?e.title:""})]}),x("div",{className:"post__date",children:[s("h4",{children:"Publish date:"}),s("h4",{children:e&&e.publish_date?`${G(e.publish_date)[0]}, ${G(e.publish_date)[1]}`:""})]}),x("div",{className:"post__content",children:[x("div",{className:"post__content__block",children:[s("h4",{children:"Category"}),s("input",{type:"text",readOnly:!0,value:e?e.category:""})]}),x("div",{className:"post__content__block",children:[s("h4",{children:"Summary"}),s("p",{dangerouslySetInnerHTML:{__html:e?e.summary:""}})]}),x("div",{className:"post__content__block",children:[s("h4",{children:"Created"}),s("input",{type:"text",readOnly:!0,value:e?`${G(e.created_at)[0]}, ${G(e.created_at)[1]}`:""})]}),x("div",{className:"post__content__block",children:[s("h4",{children:"Updated"}),s("input",{type:"text",readOnly:!0,value:e?`${G(e.updated_at)[0]}, ${G(e.updated_at)[1]}`:""})]}),x("a",{className:"post__content__btn",href:e?e.link:"",target:"_blank",rel:"noopener noreferrer",children:[s(A.Provider,{value:{color:"#FFFFFF"},children:s(ff,{})}),s("span",{children:"Link"})]}),e&&e.HistoryList.length>0?x("div",{className:"post__content__block post__content__table",children:[s("h2",{children:"History List"}),x("table",{children:[s("thead",{children:x("tr",{children:[s("th",{children:"Post ID"}),s("th",{children:"Old published"}),s("th",{children:"New published"}),s("th",{children:"Created"}),s("th",{children:"Updated"})]})}),s("tbody",{children:e&&e.HistoryList.length>0?e.HistoryList.map(l=>x("tr",{children:[s("td",{children:l.PostID}),s("td",{children:`${G(l.old_published_at)[0]}, ${G(l.old_published_at)[1]}`}),s("td",{children:`${G(l.new_published_at)[0]}, ${G(l.new_published_at)[1]}`}),s("td",{children:`${G(l.created_at)[0]}, ${G(l.created_at)[1]}`}),s("td",{children:`${G(l.updated_at)[0]}, ${G(l.updated_at)[1]}`})]},jl())):""})]})]}):""]})]})})})},pm=()=>{const{sources:e,setSources:t}=N.exports.useContext(et).sourceValue,{popup:n,setPopup:r}=N.exports.useContext(et).popupValue,[l,i]=N.exports.useState(!1);return N.exports.useEffect(()=>{l&&setTimeout(()=>{i(!1),ci(t)},2e3)},[l,i]),s("main",{className:"category",children:s("div",{className:"container",children:x("div",{className:"category inner",children:[x("div",{className:"dashboard__head category__head",children:[s(A.Provider,{value:{color:"#7d69ef"},children:s(sf,{})}),s("h1",{children:"Source"})]}),x("div",{className:"category__table__wrapper",children:[s("h3",{children:"All sources"}),x("table",{className:"category__table",children:[s("thead",{children:x("tr",{className:"category__table__head",children:[s("th",{children:"ID"}),s("th",{children:"Name"}),s("th",{children:"Source"}),s("th",{children:"Actions"})]})}),s("tbody",{children:e?e.map(o=>x("tr",{children:[s("td",{children:o.id}),s("td",{children:o.name}),s("td",{className:"category__table__tab",children:o.source}),x("td",{className:"source-action",children:[s("div",{className:"source-action__block",children:x(Wt,{to:`/source/edit/${o.id}`,children:[s("span",{children:"Edit"}),s(A.Provider,{value:{color:"#7d69ef"},children:s(df,{})})]})}),s("div",{className:"source-action__block",children:x("button",{onClick:()=>{om(i,n,r,o.id)},children:[s("span",{children:"Delete"}),s(A.Provider,{value:{color:"#7d69ef"},children:s(U1,{})})]})})]})]},jl())):x("tr",{children:[s("td",{}),s("td",{}),s("td",{})]})})]})]}),x(Wt,{to:"/source/create",className:"source__link",children:[s(Ju,{}),s("span",{children:"Create source"})]})]})})})},hm=()=>{const e=Vl(),{sources:t,setSources:n}=N.exports.useContext(et).sourceValue,{popup:r,setPopup:l}=N.exports.useContext(et).popupValue,[i,o]=N.exports.useState();N.exports.useEffect(()=>{t&&t.map(h=>{h.id.toString()===u&&o(h)})},[t]);const{id:u}=tc(),[a,d]=N.exports.useState({name:"",source:""});return s("main",{className:"source-edit",children:s("div",{className:"container",children:x("div",{className:"source-edit inner",children:[x("div",{className:"dashboard__head source-edit__head",children:[s(A.Provider,{value:{color:"#7d69ef"},children:s(df,{className:"dashboard__img"})}),s("h1",{children:"Edit source"})]}),s("div",{className:"source-edit__content",children:x("form",{onSubmit:h=>{h.preventDefault()},children:[x("div",{className:"source-edit__info",children:[s("h2",{children:"Information"}),x("div",{className:"source-edit__input",children:[s("label",{htmlFor:"id",children:"Source ID"}),s("input",{readOnly:!0,type:"text",id:"id",value:i?i.id:""})]}),x("div",{className:"source-edit__input",children:[s("label",{htmlFor:"name",children:"Source old name"}),s("input",{readOnly:!0,type:"text",id:"name",value:i?i.name:""})]}),x("div",{className:"source-edit__input",children:[s("label",{htmlFor:"source",children:"Source old link"}),s("input",{readOnly:!0,type:"text",id:"source",value:i?i.source:""})]})]}),x("div",{className:"source-edit__content",children:[s("h2",{children:"Edit"}),x("div",{className:"source-edit__input",children:[s("label",{htmlFor:"new_name",children:"Source new name"}),s("input",{placeholder:"Enter new name",type:"text",id:"new_name",value:a.name,onChange:h=>{d({...a,name:h.target.value})}})]}),x("div",{className:"source-edit__input",children:[s("label",{htmlFor:"new_source",children:"Source new link"}),s("input",{placeholder:"Enter new link",type:"text",id:"new_source",value:a.source,onChange:h=>{d({...a,source:h.target.value})}})]})]}),s("button",{disabled:!(a.name.length>0&&a.source.length>0),className:"source-edit__submit",onClick:()=>{am(r,l,()=>e("/source"),()=>ci(n),u?parseInt(u):0,a)},children:"Update source"})]})})]})})})},mm=()=>{const{setSources:e}=N.exports.useContext(et).sourceValue,{popup:t,setPopup:n}=N.exports.useContext(et).popupValue,r=Vl(),[l,i]=N.exports.useState({name:"",source:""});return s("main",{className:"source__create",children:s("div",{className:"container",children:x("div",{className:"source__create inner",children:[x("div",{className:"dashboard__head source__head",children:[s(A.Provider,{value:{color:"#7d69ef"},children:s(Ju,{})}),s("h1",{children:"Create source"})]}),x("form",{onSubmit:o=>o.preventDefault(),className:"source__create__block",children:[x("div",{className:"source-edit__input",children:[s("label",{htmlFor:"name",children:"Source name"}),s("input",{placeholder:"Enter name",type:"text",id:"name",value:l.name,onChange:o=>{i({...l,name:o.target.value})}})]}),x("div",{className:"source-edit__input",children:[s("label",{htmlFor:"source",children:"Source link"}),s("input",{placeholder:"Enter link",type:"text",id:"source",value:l.source,onChange:o=>{i({...l,source:o.target.value})}})]}),s("button",{disabled:!(l.name.length>0&&l.source.length>0),className:"source-edit__submit",onClick:()=>{um(t,n,l,()=>r("/source"),()=>ci(e))},children:"Create new source"})]})]})})})},vm=()=>{const e=Vl(),[t,n]=N.exports.useState(),[r,l]=N.exports.useState({success:!1,pop:!1,message:{success:"Success",failure:"Failure"}}),[i,o]=N.exports.useState(),[u,a]=N.exports.useState({username:"",accessLevel:""});N.exports.useEffect(()=>{const y=localStorage.getItem("userData");y&&a(JSON.parse(y))},[]);const d=N.exports.useMemo(()=>({user:u,setUser:a}),[u,a]),h=N.exports.useMemo(()=>({posts:t,setPosts:n}),[t,n]),v=N.exports.useMemo(()=>({popup:r,setPopup:l}),[r,l]),c=N.exports.useMemo(()=>({sources:i,setSources:o}),[i,o]);return N.exports.useEffect(()=>{u.username?e(localStorage.getItem("lastLocation")||"/posts"):e("/login")},[u]),N.exports.useEffect(()=>{ci(o)},[]),s(et.Provider,{value:{postValue:h,sourceValue:c,popupValue:v},children:s(li.Provider,{value:d,children:x("div",{className:"App",children:[s(V1,{}),x(yp,{children:[s(ft,{path:"/",element:s(on,{})}),s(ft,{path:"/posts",element:s(on,{child:s(dm,{})})}),s(ft,{path:"/source",element:s(on,{child:s(pm,{})})}),s(ft,{path:"/source/edit/:id",element:s(on,{child:s(hm,{})})}),s(ft,{path:"/posts/:id",element:s(on,{child:s(fm,{})})}),s(ft,{path:"/source/create",element:s(on,{child:s(mm,{})})}),s(ft,{path:"/login",element:s(H1,{})})]})]})})})};lo.createRoot(document.getElementById("root")).render(s(pl.StrictMode,{children:s(wp,{children:s(vm,{})})})); +`),function(d){if(u=d.indexOf(":"),i=e.trim(d.substr(0,u)).toLowerCase(),o=e.trim(d.substr(u+1)),i){if(l[i]&&t.indexOf(i)>=0)return;i==="set-cookie"?l[i]=(l[i]?l[i]:[]).concat([o]):l[i]=l[i]?l[i]+", "+o:o}}),l},Vi}var Hi,xs;function z0(){if(xs)return Hi;xs=1;var e=ce;return Hi=e.isStandardBrowserEnv()?function(){var n=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),l;function i(o){var u=o;return n&&(r.setAttribute("href",u),u=r.href),r.setAttribute("href",u),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return l=i(window.location.href),function(u){var a=e.isString(u)?i(u):u;return a.protocol===l.protocol&&a.host===l.host}}():function(){return function(){return!0}}(),Hi}var Wi,Cs;function ui(){if(Cs)return Wi;Cs=1;var e=jn,t=ce;function n(r){e.call(this,r==null?"canceled":r,e.ERR_CANCELED),this.name="CanceledError"}return t.inherits(n,e,{__CANCEL__:!0}),Wi=n,Wi}var Qi,Ns;function D0(){return Ns||(Ns=1,Qi=function(t){var n=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return n&&n[1]||""}),Qi}var Ki,Ps;function Rs(){if(Ps)return Ki;Ps=1;var e=ce,t=C0(),n=N0(),r=yf,l=Ef,i=T0(),o=z0(),u=Sf,a=jn,d=ui(),h=D0();return Ki=function(c){return new Promise(function(w,E){var F=c.data,f=c.headers,p=c.responseType,m;function _(){c.cancelToken&&c.cancelToken.unsubscribe(m),c.signal&&c.signal.removeEventListener("abort",m)}e.isFormData(F)&&e.isStandardBrowserEnv()&&delete f["Content-Type"];var g=new XMLHttpRequest;if(c.auth){var L=c.auth.username||"",S=c.auth.password?unescape(encodeURIComponent(c.auth.password)):"";f.Authorization="Basic "+btoa(L+":"+S)}var C=l(c.baseURL,c.url);g.open(c.method.toUpperCase(),r(C,c.params,c.paramsSerializer),!0),g.timeout=c.timeout;function z(){if(!!g){var H="getAllResponseHeaders"in g?i(g.getAllResponseHeaders()):null,de=!p||p==="text"||p==="json"?g.responseText:g.response,ve={data:de,status:g.status,statusText:g.statusText,headers:H,config:c,request:g};t(function(Ft){w(Ft),_()},function(Ft){E(Ft),_()},ve),g=null}}if("onloadend"in g?g.onloadend=z:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(z)},g.onabort=function(){!g||(E(new a("Request aborted",a.ECONNABORTED,c,g)),g=null)},g.onerror=function(){E(new a("Network Error",a.ERR_NETWORK,c,g,g)),g=null},g.ontimeout=function(){var de=c.timeout?"timeout of "+c.timeout+"ms exceeded":"timeout exceeded",ve=c.transitional||u;c.timeoutErrorMessage&&(de=c.timeoutErrorMessage),E(new a(de,ve.clarifyTimeoutError?a.ETIMEDOUT:a.ECONNABORTED,c,g)),g=null},e.isStandardBrowserEnv()){var O=(c.withCredentials||o(C))&&c.xsrfCookieName?n.read(c.xsrfCookieName):void 0;O&&(f[c.xsrfHeaderName]=O)}"setRequestHeader"in g&&e.forEach(f,function(de,ve){typeof F>"u"&&ve.toLowerCase()==="content-type"?delete f[ve]:g.setRequestHeader(ve,de)}),e.isUndefined(c.withCredentials)||(g.withCredentials=!!c.withCredentials),p&&p!=="json"&&(g.responseType=c.responseType),typeof c.onDownloadProgress=="function"&&g.addEventListener("progress",c.onDownloadProgress),typeof c.onUploadProgress=="function"&&g.upload&&g.upload.addEventListener("progress",c.onUploadProgress),(c.cancelToken||c.signal)&&(m=function(H){!g||(E(!H||H&&H.type?new d:H),g.abort(),g=null)},c.cancelToken&&c.cancelToken.subscribe(m),c.signal&&(c.signal.aborted?m():c.signal.addEventListener("abort",m))),F||(F=null);var j=h(C);if(j&&["http","https","file"].indexOf(j)===-1){E(new a("Unsupported protocol "+j+":",a.ERR_BAD_REQUEST,c));return}g.send(F)})},Ki}var qi,Ls;function M0(){return Ls||(Ls=1,qi=null),qi}var ne=ce,Os=E0,Ts=jn,F0=Sf,A0=kf,I0={"Content-Type":"application/x-www-form-urlencoded"};function zs(e,t){!ne.isUndefined(e)&&ne.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}function U0(){var e;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(e=Rs()),e}function j0(e,t,n){if(ne.isString(e))try{return(t||JSON.parse)(e),ne.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}var ai={transitional:F0,adapter:U0(),transformRequest:[function(t,n){if(Os(n,"Accept"),Os(n,"Content-Type"),ne.isFormData(t)||ne.isArrayBuffer(t)||ne.isBuffer(t)||ne.isStream(t)||ne.isFile(t)||ne.isBlob(t))return t;if(ne.isArrayBufferView(t))return t.buffer;if(ne.isURLSearchParams(t))return zs(n,"application/x-www-form-urlencoded;charset=utf-8"),t.toString();var r=ne.isObject(t),l=n&&n["Content-Type"],i;if((i=ne.isFileList(t))||r&&l==="multipart/form-data"){var o=this.env&&this.env.FormData;return A0(i?{"files[]":t}:t,o&&new o)}else if(r||l==="application/json")return zs(n,"application/json"),j0(t);return t}],transformResponse:[function(t){var n=this.transitional||ai.transitional,r=n&&n.silentJSONParsing,l=n&&n.forcedJSONParsing,i=!r&&this.responseType==="json";if(i||l&&ne.isString(t)&&t.length)try{return JSON.parse(t)}catch(o){if(i)throw o.name==="SyntaxError"?Ts.from(o,Ts.ERR_BAD_RESPONSE,this,null,this.response):o}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:M0()},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};ne.forEach(["delete","get","head"],function(t){ai.headers[t]={}});ne.forEach(["post","put","patch"],function(t){ai.headers[t]=ne.merge(I0)});var ra=ai,$0=ce,B0=ra,V0=function(t,n,r){var l=this||B0;return $0.forEach(r,function(o){t=o.call(l,t,n)}),t},Xi,Ds;function xf(){return Ds||(Ds=1,Xi=function(t){return!!(t&&t.__CANCEL__)}),Xi}var Ms=ce,Yi=V0,H0=xf(),W0=ra,Q0=ui();function Ji(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Q0}var K0=function(t){Ji(t),t.headers=t.headers||{},t.data=Yi.call(t,t.data,t.headers,t.transformRequest),t.headers=Ms.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),Ms.forEach(["delete","get","head","post","put","patch","common"],function(l){delete t.headers[l]});var n=t.adapter||W0.adapter;return n(t).then(function(l){return Ji(t),l.data=Yi.call(t,l.data,l.headers,t.transformResponse),l},function(l){return H0(l)||(Ji(t),l&&l.response&&(l.response.data=Yi.call(t,l.response.data,l.response.headers,t.transformResponse))),Promise.reject(l)})},Pe=ce,Cf=function(t,n){n=n||{};var r={};function l(h,v){return Pe.isPlainObject(h)&&Pe.isPlainObject(v)?Pe.merge(h,v):Pe.isPlainObject(v)?Pe.merge({},v):Pe.isArray(v)?v.slice():v}function i(h){if(Pe.isUndefined(n[h])){if(!Pe.isUndefined(t[h]))return l(void 0,t[h])}else return l(t[h],n[h])}function o(h){if(!Pe.isUndefined(n[h]))return l(void 0,n[h])}function u(h){if(Pe.isUndefined(n[h])){if(!Pe.isUndefined(t[h]))return l(void 0,t[h])}else return l(void 0,n[h])}function a(h){if(h in n)return l(t[h],n[h]);if(h in t)return l(void 0,t[h])}var d={url:o,method:o,data:o,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:a};return Pe.forEach(Object.keys(t).concat(Object.keys(n)),function(v){var c=d[v]||i,y=c(v);Pe.isUndefined(y)&&c!==a||(r[v]=y)}),r},Gi,Fs;function Nf(){return Fs||(Fs=1,Gi={version:"0.27.2"}),Gi}var q0=Nf().version,mt=jn,la={};["object","boolean","number","function","string","symbol"].forEach(function(e,t){la[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});var As={};la.transitional=function(t,n,r){function l(i,o){return"[Axios v"+q0+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return function(i,o,u){if(t===!1)throw new mt(l(o," has been removed"+(n?" in "+n:"")),mt.ERR_DEPRECATED);return n&&!As[o]&&(As[o]=!0,console.warn(l(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,u):!0}};function X0(e,t,n){if(typeof e!="object")throw new mt("options must be an object",mt.ERR_BAD_OPTION_VALUE);for(var r=Object.keys(e),l=r.length;l-- >0;){var i=r[l],o=t[i];if(o){var u=e[i],a=u===void 0||o(u,i,e);if(a!==!0)throw new mt("option "+i+" must be "+a,mt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new mt("Unknown option "+i,mt.ERR_BAD_OPTION)}}var Y0={assertOptions:X0,validators:la},Pf=ce,J0=yf,Is=S0,Us=K0,si=Cf,G0=Ef,Rf=Y0,an=Rf.validators;function Fn(e){this.defaults=e,this.interceptors={request:new Is,response:new Is}}Fn.prototype.request=function(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=si(this.defaults,n),n.method?n.method=n.method.toLowerCase():this.defaults.method?n.method=this.defaults.method.toLowerCase():n.method="get";var r=n.transitional;r!==void 0&&Rf.assertOptions(r,{silentJSONParsing:an.transitional(an.boolean),forcedJSONParsing:an.transitional(an.boolean),clarifyTimeoutError:an.transitional(an.boolean)},!1);var l=[],i=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(i=i&&y.synchronous,l.unshift(y.fulfilled,y.rejected))});var o=[];this.interceptors.response.forEach(function(y){o.push(y.fulfilled,y.rejected)});var u;if(!i){var a=[Us,void 0];for(Array.prototype.unshift.apply(a,l),a=a.concat(o),u=Promise.resolve(n);a.length;)u=u.then(a.shift(),a.shift());return u}for(var d=n;l.length;){var h=l.shift(),v=l.shift();try{d=h(d)}catch(c){v(c);break}}try{u=Us(d)}catch(c){return Promise.reject(c)}for(;o.length;)u=u.then(o.shift(),o.shift());return u};Fn.prototype.getUri=function(t){t=si(this.defaults,t);var n=G0(t.baseURL,t.url);return J0(n,t.params,t.paramsSerializer)};Pf.forEach(["delete","get","head","options"],function(t){Fn.prototype[t]=function(n,r){return this.request(si(r||{},{method:t,url:n,data:(r||{}).data}))}});Pf.forEach(["post","put","patch"],function(t){function n(r){return function(i,o,u){return this.request(si(u||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}Fn.prototype[t]=n(),Fn.prototype[t+"Form"]=n(!0)});var Z0=Fn,Zi,js;function b0(){if(js)return Zi;js=1;var e=ui();function t(n){if(typeof n!="function")throw new TypeError("executor must be a function.");var r;this.promise=new Promise(function(o){r=o});var l=this;this.promise.then(function(i){if(!!l._listeners){var o,u=l._listeners.length;for(o=0;o{e(!0),Tr.get("http://95.85.124.41:8080/posts"+(n||"")).then(r=>{t(r.data.data)}).catch(r=>{}).finally(()=>e(!1))},om=(e,t,n,r)=>{Tr.delete(`http://95.85.124.41:8080/link/delete/${r}`).then(l=>{e(!0),n({...t,success:!0,pop:!0}),setTimeout(()=>{n({...t,pop:!1})},2e3)}).catch(l=>{e(!1),n({...t,success:!1,pop:!0}),setTimeout(()=>{n({...t,pop:!1})},2e3)})},ci=e=>{Tr.get("http://95.85.124.41:8080/links/all").then(t=>{e(t.data.data)}).catch(t=>{})},um=(e,t,n,r,l)=>{Tr.post("http://95.85.124.41:8080/link/create",{name:n.name,source:n.source}).then(i=>{t({...e,success:!0,pop:!0}),r(),setTimeout(()=>{t({...e,pop:!1}),l()},2e3)}).catch(i=>{t({...e,success:!1,pop:!0}),setTimeout(()=>{t({...e,pop:!1})},2e3)})},am=(e,t,n,r,l,i)=>{Tr.put(`http://95.85.124.41:8080/link/update/${l}`,i).then(o=>{t({...e,success:!0,pop:!0}),n(),setTimeout(()=>{t({...e,pop:!1}),r()},2e3)}).catch(o=>{t({...e,success:!1,pop:!0}),setTimeout(()=>{t({...e,pop:!1})},2e3)})},G=e=>{const t=e.toString().split("T"),n=t[0];let r,l;return t[1].includes(".")?(r=t[1].split("."),l=r[0]):(r=t[1],l=r.slice(0,r.length-1)),[n,l]},sm="/assets/loader.c7fd17f9.svg",cm=()=>s("div",{className:"loader",children:s("div",{className:"loader inner",children:s("img",{src:sm,alt:""})})}),dm=()=>{const[e,t]=N.exports.useState(!1),n=N.exports.useContext(et),{posts:r,setPosts:l}=n.postValue,{sources:i}=n.sourceValue,[o,u]=N.exports.useState(""),[a,d]=N.exports.useState("id"),[h,v]=N.exports.useState({perPage:10,pageNumber:1}),[c,y]=N.exports.useState({id:"desc",title:"asc",link:"asc",date:"asc",publish_date:"asc",created_at:"asc",updated_at:"asc"}),[w,E]=N.exports.useState({fil_title:{name:"fil_title",value:""},fil_link:{name:"fil_link",value:""},fil_publish_date:{name:"fil_publish_date",value:""},fil_summary:{name:"fil_summary",value:""},fil_created_atAt:{name:"fil_created_atAt",value:""},fil_updated_atAt:{name:"fil_updated_atAt",value:""}}),F=N.exports.useCallback(()=>{let f="";return Object.keys(w).map(m=>{const _=m;w[_].value.length>0&&(f=`${f}&${w[_].name}=${w[_].value}`)}),f},[w,E]);return N.exports.useEffect(()=>{const f=F();im(t,l,`?sortBy=${a}.${c[a]}&category=${o}&strLimit=${h.perPage}&strOffset=${h.pageNumber}${f}`)},[c,a,h,o,w]),s("main",{className:"posts",children:s("div",{className:"container",children:x("div",{className:"posts inner",children:[x("div",{className:"dashboard__head",children:[s(A.Provider,{value:{color:"#7d69ef"},children:s(cf,{className:"dashboard__img"})}),s("h1",{children:"Posts"})]}),x("div",{className:"posts__select__wrapper",children:[x("div",{className:"posts__select",children:[s("label",{htmlFor:"category",children:"Source"}),x("select",{id:"category",value:o,onChange:f=>{f.target.value==="All"?u(""):u(f.target.value)},children:[s("option",{value:"All",defaultChecked:!0,children:"All"}),i?i.map(f=>s("option",{value:f.name,children:f.name},jl())):""]})]}),x("div",{className:"posts__select",children:[s("label",{htmlFor:"pp",children:"Per page"}),x("select",{id:"pp",value:h.perPage,onChange:f=>{v({...h,perPage:parseInt(f.target.value)})},children:[s("option",{value:"10",defaultChecked:!0,children:"10"}),s("option",{value:"15",children:"15"}),s("option",{value:"20",children:"20"}),s("option",{value:"30",children:"30"}),s("option",{value:"40",children:"40"}),s("option",{value:"60",children:"60"}),s("option",{value:"80",children:"80"}),s("option",{value:"100",children:"100"})]})]}),s("div",{className:"posts__select posts__reset__btn",children:s("button",{className:"posts__reset",onClick:()=>{u(""),v({perPage:10,pageNumber:1}),E({fil_title:{name:"fil_title",value:""},fil_link:{name:"fil_link",value:""},fil_publish_date:{name:"fil_publish_date",value:""},fil_summary:{name:"fil_summary",value:""},fil_created_atAt:{name:"fil_created_atAt",value:""},fil_updated_atAt:{name:"fil_updated_atAt",value:""}})},children:"Reset"})})]}),x("table",{className:e?"posts__table disabled":"posts__table",children:[x("thead",{children:[x("tr",{className:"posts__table__head",children:[x("th",{className:a==="id"?"active":"",onClick:()=>{d("id"),c.id!=="asc"?y({...c,id:"asc"}):y({...c,id:"desc"})},children:[a==="id"&&c.id==="asc"?s(A.Provider,{value:{color:"#7d69ef"},children:s(ln,{})}):null,a==="id"&&c.id==="desc"?s(A.Provider,{value:{color:"#7d69ef"},children:s(rn,{})}):null,s("span",{children:"ID"})]}),s("th",{className:a==="category"?"active":"",children:s("span",{children:"Source"})}),x("th",{className:a==="title"?"active":"",onClick:()=>{d("title"),c.title!=="asc"?y({...c,title:"asc"}):y({...c,title:"desc"})},children:[a==="title"&&c.title==="asc"?s(A.Provider,{value:{color:"#7d69ef"},children:s(ln,{})}):null,a==="title"&&c.title==="desc"?s(A.Provider,{value:{color:"#7d69ef"},children:s(rn,{})}):null,s("span",{children:"Title"})]}),x("th",{className:a==="link"?"active":"",onClick:()=>{d("link"),c.link!=="asc"?y({...c,link:"asc"}):y({...c,link:"desc"})},children:[a==="link"&&c.link==="asc"?s(A.Provider,{value:{color:"#7d69ef"},children:s(ln,{})}):null,a==="link"&&c.link==="desc"?s(A.Provider,{value:{color:"#7d69ef"},children:s(rn,{})}):null,s("span",{children:"Link"})]}),x("th",{className:a==="publish_date"?"active":"",onClick:()=>{d("publish_date"),c.publish_date!=="asc"?y({...c,publish_date:"asc"}):y({...c,publish_date:"desc"})},children:[a==="publish_date"&&c.publish_date==="asc"?s(A.Provider,{value:{color:"#7d69ef"},children:s(ln,{})}):null,a==="publish_date"&&c.publish_date==="desc"?s(A.Provider,{value:{color:"#7d69ef"},children:s(rn,{})}):null,s("span",{children:"Published"})]}),x("th",{className:a==="created_at"?"active":"",onClick:()=>{d("created_at"),c.created_at!=="asc"?y({...c,created_at:"asc"}):y({...c,created_at:"desc"})},children:[a==="created_at"&&c.created_at==="asc"?s(A.Provider,{value:{color:"#7d69ef"},children:s(ln,{})}):null,a==="created_at"&&c.created_at==="desc"?s(A.Provider,{value:{color:"#7d69ef"},children:s(rn,{})}):null,s("span",{children:"Created"})]}),x("th",{className:a==="updated_at"?"active":"",onClick:()=>{d("updated_at"),c.updated_at!=="asc"?y({...c,updated_at:"asc"}):y({...c,updated_at:"desc"})},children:[a==="updated_at"&&c.updated_at==="asc"?s(A.Provider,{value:{color:"#7d69ef"},children:s(ln,{})}):null,a==="updated_at"&&c.updated_at==="desc"?s(A.Provider,{value:{color:"#7d69ef"},children:s(rn,{})}):null,s("span",{children:"Updated"})]})]}),x("tr",{className:"posts__table__head posts__table__head--inputs",children:[s("th",{}),s("th",{}),s("th",{children:s("input",{placeholder:"Filter by title",id:"filter-title",type:"text",value:w.fil_title.value,onChange:f=>E({...w,fil_title:{...w.fil_title,value:f.target.value}})})}),s("th",{children:s("input",{placeholder:"Filter by link",id:"filter-link",type:"text",value:w.fil_link.value,onChange:f=>{E({...w,fil_link:{...w.fil_link,value:f.target.value}})}})}),s("th",{children:s("input",{placeholder:"Filter by publish_date",id:"filter-publish_date",type:"date",value:w.fil_publish_date.value,onChange:f=>{E({...w,fil_publish_date:{...w.fil_publish_date,value:f.target.value}})}})}),s("th",{children:s("input",{placeholder:"Filter by created_at",id:"filter-created_at",type:"date",value:w.fil_created_atAt.value,onChange:f=>{E({...w,fil_created_atAt:{...w.fil_created_atAt,value:f.target.value}})}})}),s("th",{children:s("input",{placeholder:"Filter by updated_at",id:"filter-updated_at",type:"date",value:w.fil_updated_atAt.value,onChange:f=>E({...w,fil_updated_atAt:{...w.fil_updated_atAt,value:f.target.value}})})})]})]}),x("tbody",{children:[e?s(cm,{}):null,r?r.length>0?r[0].id!==-1?r.map(f=>s(Wt,{className:"post-link",to:`/posts/${f.id}`,children:x("tr",{children:[s("td",{children:f.id}),s("td",{children:f.category}),s("td",{children:f.title}),s("td",{children:s("a",{href:f.link,target:"_blank",rel:"noopener noreferrer",children:s(ff,{})})}),s("td",{children:`${G(f.publish_date)[0]}, ${G(f.publish_date)[1]}`}),s("td",{children:`${G(f.created_at)[0]}, ${G(f.created_at)[1]}`}),s("td",{children:`${G(f.created_at)[0]}, ${G(f.created_at)[1]}`})]})},jl())):s("tr",{children:s("td",{className:"table__empty",colSpan:7,children:"No posts"})}):s("tr",{children:s("td",{className:"table__empty",colSpan:7,children:"No posts"})}):s("tr",{children:s("td",{className:"table__empty",colSpan:7,children:"No posts"})})]})]}),x("div",{className:"posts__pagination",children:[s("button",{type:"button",disabled:h.pageNumber===1,onClick:()=>v({...h,pageNumber:h.pageNumber-1}),children:"Previous"}),s("input",{type:"text",value:h.pageNumber,readOnly:!0}),s("button",{disabled:!r,type:"button",onClick:()=>v({...h,pageNumber:h.pageNumber+1}),children:"Next"})]})]})})})},fm=()=>{const[e,t]=N.exports.useState(),{posts:n}=N.exports.useContext(et).postValue,{id:r}=tc();return new DOMParser,N.exports.useEffect(()=>{n&&n[0].id!==-1&&n.map(l=>{l.id.toString()===r&&t(l)})},[n]),s("main",{className:"post",children:s("div",{className:"container",children:x("div",{className:"post inner",children:[x("div",{className:"dashboard__head post__head",children:[s(A.Provider,{value:{color:"#7d69ef"},children:s(M1,{className:"dashboard__img"})}),s("h1",{className:"post__head",children:e?e.title:""})]}),x("div",{className:"post__date",children:[s("h4",{children:"Publish date:"}),s("h4",{children:e&&e.publish_date?`${G(e.publish_date)[0]}, ${G(e.publish_date)[1]}`:""})]}),x("div",{className:"post__content",children:[x("div",{className:"post__content__block",children:[s("h4",{children:"Category"}),s("input",{type:"text",readOnly:!0,value:e?e.category:""})]}),x("div",{className:"post__content__block",children:[s("h4",{children:"Summary"}),s("p",{dangerouslySetInnerHTML:{__html:e?e.summary:""}})]}),x("div",{className:"post__content__block",children:[s("h4",{children:"Created"}),s("input",{type:"text",readOnly:!0,value:e?`${G(e.created_at)[0]}, ${G(e.created_at)[1]}`:""})]}),x("div",{className:"post__content__block",children:[s("h4",{children:"Updated"}),s("input",{type:"text",readOnly:!0,value:e?`${G(e.updated_at)[0]}, ${G(e.updated_at)[1]}`:""})]}),x("a",{className:"post__content__btn",href:e?e.link:"",target:"_blank",rel:"noopener noreferrer",children:[s(A.Provider,{value:{color:"#FFFFFF"},children:s(ff,{})}),s("span",{children:"Link"})]}),e&&e.HistoryList.length>0?x("div",{className:"post__content__block post__content__table",children:[s("h2",{children:"History List"}),x("table",{children:[s("thead",{children:x("tr",{children:[s("th",{children:"Post ID"}),s("th",{children:"Old published"}),s("th",{children:"New published"}),s("th",{children:"Created"}),s("th",{children:"Updated"})]})}),s("tbody",{children:e&&e.HistoryList.length>0?e.HistoryList.map(l=>x("tr",{children:[s("td",{children:l.PostID}),s("td",{children:`${G(l.old_published_at)[0]}, ${G(l.old_published_at)[1]}`}),s("td",{children:`${G(l.new_published_at)[0]}, ${G(l.new_published_at)[1]}`}),s("td",{children:`${G(l.created_at)[0]}, ${G(l.created_at)[1]}`}),s("td",{children:`${G(l.updated_at)[0]}, ${G(l.updated_at)[1]}`})]},jl())):""})]})]}):""]})]})})})},pm=()=>{const{sources:e,setSources:t}=N.exports.useContext(et).sourceValue,{popup:n,setPopup:r}=N.exports.useContext(et).popupValue,[l,i]=N.exports.useState(!1);return N.exports.useEffect(()=>{l&&setTimeout(()=>{i(!1),ci(t)},2e3)},[l,i]),s("main",{className:"category",children:s("div",{className:"container",children:x("div",{className:"category inner",children:[x("div",{className:"dashboard__head category__head",children:[s(A.Provider,{value:{color:"#7d69ef"},children:s(sf,{})}),s("h1",{children:"Source"})]}),x("div",{className:"category__table__wrapper",children:[s("h3",{children:"All sources"}),x("table",{className:"category__table",children:[s("thead",{children:x("tr",{className:"category__table__head",children:[s("th",{children:"ID"}),s("th",{children:"Name"}),s("th",{children:"Source"}),s("th",{children:"Actions"})]})}),s("tbody",{children:e?e.map((o,u)=>x("tr",{children:[s("td",{children:u+1}),s("td",{children:o.name}),s("td",{className:"category__table__tab",children:o.source}),x("td",{className:"source-action",children:[s("div",{className:"source-action__block",children:x(Wt,{to:`/source/edit/${o.id}`,children:[s("span",{children:"Edit"}),s(A.Provider,{value:{color:"#7d69ef"},children:s(df,{})})]})}),s("div",{className:"source-action__block",children:x("button",{onClick:()=>{om(i,n,r,o.id)},children:[s("span",{children:"Delete"}),s(A.Provider,{value:{color:"#7d69ef"},children:s(U1,{})})]})})]})]},jl())):x("tr",{children:[s("td",{}),s("td",{}),s("td",{})]})})]})]}),x(Wt,{to:"/source/create",className:"source__link",children:[s(Ju,{}),s("span",{children:"Create source"})]})]})})})},hm=()=>{const e=Vl(),{sources:t,setSources:n}=N.exports.useContext(et).sourceValue,{popup:r,setPopup:l}=N.exports.useContext(et).popupValue,[i,o]=N.exports.useState();N.exports.useEffect(()=>{t&&t.map(h=>{h.id.toString()===u&&o(h)})},[t]);const{id:u}=tc(),[a,d]=N.exports.useState({name:"",source:""});return s("main",{className:"source-edit",children:s("div",{className:"container",children:x("div",{className:"source-edit inner",children:[x("div",{className:"dashboard__head source-edit__head",children:[s(A.Provider,{value:{color:"#7d69ef"},children:s(df,{className:"dashboard__img"})}),s("h1",{children:"Edit source"})]}),s("div",{className:"source-edit__content",children:x("form",{onSubmit:h=>{h.preventDefault()},children:[x("div",{className:"source-edit__info",children:[s("h2",{children:"Information"}),x("div",{className:"source-edit__input",children:[s("label",{htmlFor:"id",children:"Source ID"}),s("input",{readOnly:!0,type:"text",id:"id",value:i?i.id:""})]}),x("div",{className:"source-edit__input",children:[s("label",{htmlFor:"name",children:"Source old name"}),s("input",{readOnly:!0,type:"text",id:"name",value:i?i.name:""})]}),x("div",{className:"source-edit__input",children:[s("label",{htmlFor:"source",children:"Source old link"}),s("input",{readOnly:!0,type:"text",id:"source",value:i?i.source:""})]})]}),x("div",{className:"source-edit__content",children:[s("h2",{children:"Edit"}),x("div",{className:"source-edit__input",children:[s("label",{htmlFor:"new_name",children:"Source new name"}),s("input",{placeholder:"Enter new name",type:"text",id:"new_name",value:a.name,onChange:h=>{d({...a,name:h.target.value})}})]}),x("div",{className:"source-edit__input",children:[s("label",{htmlFor:"new_source",children:"Source new link"}),s("input",{placeholder:"Enter new link",type:"text",id:"new_source",value:a.source,onChange:h=>{d({...a,source:h.target.value})}})]})]}),s("button",{disabled:!(a.name.length>0&&a.source.length>0),className:"source-edit__submit",onClick:()=>{am(r,l,()=>e("/source"),()=>ci(n),u?parseInt(u):0,a)},children:"Update source"})]})})]})})})},mm=()=>{const{setSources:e}=N.exports.useContext(et).sourceValue,{popup:t,setPopup:n}=N.exports.useContext(et).popupValue,r=Vl(),[l,i]=N.exports.useState({name:"",source:""});return s("main",{className:"source__create",children:s("div",{className:"container",children:x("div",{className:"source__create inner",children:[x("div",{className:"dashboard__head source__head",children:[s(A.Provider,{value:{color:"#7d69ef"},children:s(Ju,{})}),s("h1",{children:"Create source"})]}),x("form",{onSubmit:o=>o.preventDefault(),className:"source__create__block",children:[x("div",{className:"source-edit__input",children:[s("label",{htmlFor:"name",children:"Source name"}),s("input",{placeholder:"Enter name",type:"text",id:"name",value:l.name,onChange:o=>{i({...l,name:o.target.value})}})]}),x("div",{className:"source-edit__input",children:[s("label",{htmlFor:"source",children:"Source link"}),s("input",{placeholder:"Enter link",type:"text",id:"source",value:l.source,onChange:o=>{i({...l,source:o.target.value})}})]}),s("button",{disabled:!(l.name.length>0&&l.source.length>0),className:"source-edit__submit",onClick:()=>{um(t,n,l,()=>r("/source"),()=>ci(e))},children:"Create new source"})]})]})})})},vm=()=>{const e=Vl(),[t,n]=N.exports.useState(),[r,l]=N.exports.useState({success:!1,pop:!1,message:{success:"Success",failure:"Failure"}}),[i,o]=N.exports.useState(),[u,a]=N.exports.useState({username:"",accessLevel:""});N.exports.useEffect(()=>{const y=localStorage.getItem("userData");y&&a(JSON.parse(y))},[]);const d=N.exports.useMemo(()=>({user:u,setUser:a}),[u,a]),h=N.exports.useMemo(()=>({posts:t,setPosts:n}),[t,n]),v=N.exports.useMemo(()=>({popup:r,setPopup:l}),[r,l]),c=N.exports.useMemo(()=>({sources:i,setSources:o}),[i,o]);return N.exports.useEffect(()=>{u.username?e(localStorage.getItem("lastLocation")||"/posts"):e("/login")},[u]),N.exports.useEffect(()=>{ci(o)},[]),s(et.Provider,{value:{postValue:h,sourceValue:c,popupValue:v},children:s(li.Provider,{value:d,children:x("div",{className:"App",children:[s(V1,{}),x(yp,{children:[s(ft,{path:"/",element:s(on,{})}),s(ft,{path:"/posts",element:s(on,{child:s(dm,{})})}),s(ft,{path:"/source",element:s(on,{child:s(pm,{})})}),s(ft,{path:"/source/edit/:id",element:s(on,{child:s(hm,{})})}),s(ft,{path:"/posts/:id",element:s(on,{child:s(fm,{})})}),s(ft,{path:"/source/create",element:s(on,{child:s(mm,{})})}),s(ft,{path:"/login",element:s(H1,{})})]})]})})})};lo.createRoot(document.getElementById("root")).render(s(pl.StrictMode,{children:s(wp,{children:s(vm,{})})})); diff --git a/dist/index.html b/dist/index.html index b123238..38f3753 100644 --- a/dist/index.html +++ b/dist/index.html @@ -5,7 +5,7 @@ Admin Panel - +