From 0b876f682e177fa8b1c0c3a5f337377fd7f4945f Mon Sep 17 00:00:00 2001 From: olyalass Date: Wed, 31 Jul 2024 16:59:59 +0200 Subject: [PATCH] build: new build --- dist/assets/{index-DuLgL5cG.js => index-5-9npxk8.js} | 2 +- dist/index.html | 2 +- src/main.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename dist/assets/{index-DuLgL5cG.js => index-5-9npxk8.js} (99%) diff --git a/dist/assets/index-DuLgL5cG.js b/dist/assets/index-5-9npxk8.js similarity index 99% rename from dist/assets/index-DuLgL5cG.js rename to dist/assets/index-5-9npxk8.js index 556f95f..949229e 100644 --- a/dist/assets/index-DuLgL5cG.js +++ b/dist/assets/index-5-9npxk8.js @@ -383,4 +383,4 @@ html body { ${t}-expand, ${t}-edit, ${t}-copy - `]:Object.assign(Object.assign({},l$(e)),{marginInlineStart:e.marginXXS})}),AG(e)),FG(e)),DG()),{"&-rtl":{direction:"rtl"}})}},HG=()=>({titleMarginTop:"1.2em",titleMarginBottom:"0.5em"}),sI=_t("Typography",e=>[BG(e)],HG),kG=e=>{const{prefixCls:t,"aria-label":n,className:r,style:o,direction:i,maxLength:a,autoSize:s=!0,value:c,onSave:u,onCancel:d,onEnd:f,component:m,enterIcon:g=l.createElement(c6,null)}=e,b=l.useRef(null),h=l.useRef(!1),S=l.useRef(),[p,v]=l.useState(c);l.useEffect(()=>{v(c)},[c]),l.useEffect(()=>{if(b.current&&b.current.resizableTextArea){const{textArea:z}=b.current.resizableTextArea;z.focus();const{length:j}=z.value;z.setSelectionRange(j,j)}},[]);const y=z=>{let{target:j}=z;v(j.value.replace(/[\n\r]/g,""))},C=()=>{h.current=!0},$=()=>{h.current=!1},x=z=>{let{keyCode:j}=z;h.current||(S.current=j)},w=()=>{u(p.trim())},E=z=>{let{keyCode:j,ctrlKey:M,altKey:R,metaKey:A,shiftKey:L}=z;S.current===j&&!h.current&&!M&&!R&&!A&&!L&&(j===se.ENTER?(w(),f==null||f()):j===se.ESC&&d())},O=()=>{w()},P=m?`${t}-${m}`:"",[T,N,I]=sI(t),_=V(t,`${t}-edit-content`,{[`${t}-rtl`]:i==="rtl"},r,P,N,I);return T(l.createElement("div",{className:_,style:o},l.createElement(vO,{ref:b,maxLength:a,value:p,onChange:y,onKeyDown:x,onKeyUp:E,onCompositionStart:C,onCompositionEnd:$,onBlur:O,"aria-label":n,rows:1,autoSize:s}),g!==null?Fn(g,{className:`${t}-edit-content-confirm`}):null))},VG=kG;function Km(e,t){return l.useMemo(()=>{const n=!!e;return[n,Object.assign(Object.assign({},t),n&&typeof e=="object"?e:null)]},[e])}const WG=(e,t)=>{const n=l.useRef(!1);l.useEffect(()=>{n.current?e():n.current=!0},t)};var UG=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o{const{prefixCls:n,component:r="article",className:o,rootClassName:i,setContentRef:a,children:s,direction:c,style:u}=e,d=UG(e,["prefixCls","component","className","rootClassName","setContentRef","children","direction","style"]),{getPrefixCls:f,direction:m,typography:g}=l.useContext(Le),b=c??m;let h=t;a&&(h=pr(t,a));const S=f("typography",n),[p,v,y]=sI(S),C=V(S,g==null?void 0:g.className,{[`${S}-rtl`]:b==="rtl"},o,i,v,y),$=Object.assign(Object.assign({},g==null?void 0:g.style),u);return p(l.createElement(r,Object.assign({className:C,style:$,ref:h},d),s))}),cI=GG;function R1(e){return e===!1?[!1,!1]:Array.isArray(e)?e:[e]}function Wc(e,t,n){return e===!0||e===void 0?t:e||n&&t}function KG(e){const{prefixCls:t,copied:n,locale:r={},onCopy:o,iconOnly:i,tooltips:a,icon:s}=e,c=R1(a),u=R1(s),{copied:d,copy:f}=r,m=n?Wc(c[1],d):Wc(c[0],f),b=typeof m=="string"?m:n?d:f;return l.createElement(Eo,{key:"copy",title:m},l.createElement(lI,{className:V(`${t}-copy`,{[`${t}-copy-success`]:n,[`${t}-copy-icon-only`]:i}),onClick:o,"aria-label":b},n?Wc(u[1],l.createElement(F$,null),!0):Wc(u[0],l.createElement(Rj,null),!0)))}const Uc=l.forwardRef((e,t)=>{let{style:n,children:r}=e;const o=l.useRef(null);return l.useImperativeHandle(t,()=>({isExceed:()=>{const i=o.current;return i.scrollHeight>i.clientHeight},getHeight:()=>o.current.clientHeight})),l.createElement("span",{"aria-hidden":!0,ref:o,style:Object.assign({position:"fixed",display:"block",left:0,top:0,pointerEvents:"none",backgroundColor:"rgba(255, 0, 0, 0.65)"},n)},r)});function uI(e){const t=typeof e;return t==="string"||t==="number"}function qG(e){let t=0;return e.forEach(n=>{uI(n)?t+=String(n).length:t+=1}),t}function P1(e,t){let n=0;const r=[];for(let o=0;ot){const u=t-n;return r.push(String(i).slice(0,u)),r}r.push(i),n=c}return e}const qm=0,Xm=1,Ym=2,M1=3,Gc={display:"-webkit-box",overflow:"hidden",WebkitBoxOrient:"vertical"};function XG(e){const{enableMeasure:t,width:n,text:r,children:o,rows:i,miscDeps:a,onEllipsis:s}=e,c=l.useMemo(()=>Pn(r),[r]),u=l.useMemo(()=>qG(c),[r]),d=l.useMemo(()=>o(c,!1,!1),[r]),[f,m]=l.useState(null),g=l.useRef(null),b=l.useRef(null),h=l.useRef(null),S=l.useRef(null),[p,v]=l.useState(qm),[y,C]=l.useState(0);Nt(()=>{v(t&&n&&u?Xm:qm)},[n,r,i,t,c]),Nt(()=>{var E,O,P,T;if(p===Xm){const N=!!(!((E=b.current)===null||E===void 0)&&E.isExceed());v(N?Ym:M1),m(N?[0,u]:null);const I=((O=b.current)===null||O===void 0?void 0:O.getHeight())||0,_=i===1?0:((P=h.current)===null||P===void 0?void 0:P.getHeight())||0,z=((T=S.current)===null||T===void 0?void 0:T.getHeight())||0,j=_+z,M=Math.max(I,j);C(M+1),s(N)}},[p]);const $=f?Math.ceil((f[0]+f[1])/2):0;Nt(()=>{var E;const[O,P]=f||[0,0];if(O!==P){const N=(((E=g.current)===null||E===void 0?void 0:E.getHeight())||0)>y;let I=$;P-O===1&&(I=N?O:P),m(N?[O,I]:[I,P])}},[f,$]);const x=l.useMemo(()=>{if(p!==Ym||!f||f[0]!==f[1]){const E=o(c,!1,!1);return p!==M1&&p!==qm?l.createElement("span",{style:Object.assign(Object.assign({},Gc),{WebkitLineClamp:i})},E):E}return o(P1(c,f[0]),!0,!0)},[p,f,c].concat(Se(a))),w={width:n,whiteSpace:"normal",margin:0,padding:0};return l.createElement(l.Fragment,null,x,p===Xm&&l.createElement(l.Fragment,null,l.createElement(Uc,{style:Object.assign(Object.assign(Object.assign({},w),Gc),{WebkitLineClamp:i}),ref:b},d),l.createElement(Uc,{style:Object.assign(Object.assign(Object.assign({},w),Gc),{WebkitLineClamp:i-1}),ref:h},d),l.createElement(Uc,{style:Object.assign(Object.assign(Object.assign({},w),Gc),{WebkitLineClamp:1}),ref:S},o([],!0,!0))),p===Ym&&f&&f[0]!==f[1]&&l.createElement(Uc,{style:Object.assign(Object.assign({},w),{top:400}),ref:g},o(P1(c,$),!0,!0)))}const YG=e=>{let{enableEllipsis:t,isEllipsis:n,children:r,tooltipProps:o}=e;return!(o!=null&&o.title)||!t?r:l.createElement(Eo,Object.assign({open:n?void 0:!1},o),r)},QG=YG;var ZG=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o{var n,r,o;const{prefixCls:i,className:a,style:s,type:c,disabled:u,children:d,ellipsis:f,editable:m,copyable:g,component:b,title:h}=e,S=ZG(e,["prefixCls","className","style","type","disabled","children","ellipsis","editable","copyable","component","title"]),{getPrefixCls:p,direction:v}=l.useContext(Le),[y]=ui("Text"),C=l.useRef(null),$=l.useRef(null),x=p("typography",i),w=Qt(S,["mark","code","delete","underline","strong","keyboard","italic"]),[E,O]=Km(m),[P,T]=Xt(!1,{value:O.editing}),{triggerType:N=["icon"]}=O,I=ue=>{var Me;ue&&((Me=O.onStart)===null||Me===void 0||Me.call(O)),T(ue)};WG(()=>{var ue;P||(ue=$.current)===null||ue===void 0||ue.focus()},[P]);const _=ue=>{ue==null||ue.preventDefault(),I(!0)},z=ue=>{var Me;(Me=O.onChange)===null||Me===void 0||Me.call(O,ue),I(!1)},j=()=>{var ue;(ue=O.onCancel)===null||ue===void 0||ue.call(O),I(!1)},[M,R]=Km(g),[A,L]=l.useState(!1),F=l.useRef(null),D={};R.format&&(D.format=R.format);const G=()=>{F.current&&clearTimeout(F.current)},Y=ue=>{var Me;ue==null||ue.preventDefault(),ue==null||ue.stopPropagation(),NG(R.text||String(d)||"",D),L(!0),G(),F.current=setTimeout(()=>{L(!1)},3e3),(Me=R.onCopy)===null||Me===void 0||Me.call(R,ue)};l.useEffect(()=>G,[]);const[U,Z]=l.useState(!1),[Q,ne]=l.useState(!1),[oe,te]=l.useState(!1),[q,ie]=l.useState(!1),[le,re]=l.useState(!1),[ee,ve]=l.useState(!0),[de,ce]=Km(f,{expandable:!1}),J=de&&!oe,{rows:ae=1}=ce,me=l.useMemo(()=>!J||ce.suffix!==void 0||ce.onEllipsis||ce.expandable||E||M,[J,ce,E,M]);Nt(()=>{de&&!me&&(Z(Yb("webkitLineClamp")),ne(Yb("textOverflow")))},[me,de]);const pe=l.useMemo(()=>me?!1:ae===1?Q:U,[me,Q,U]),ge=J&&(pe?le:q),Ce=J&&ae===1&&pe,Ie=J&&ae>1&&pe,Re=ue=>{var Me;te(!0),(Me=ce.onExpand)===null||Me===void 0||Me.call(ce,ue)},[Ye,Pe]=l.useState(0),be=ue=>{let{offsetWidth:Me}=ue;Pe(Me)},Oe=ue=>{var Me;ie(ue),q!==ue&&((Me=ce.onEllipsis)===null||Me===void 0||Me.call(ce,ue))};l.useEffect(()=>{const ue=C.current;if(de&&pe&&ue){const Me=Ie?ue.offsetHeight{const ue=C.current;if(typeof IntersectionObserver>"u"||!ue||!pe||!J)return;const Me=new IntersectionObserver(()=>{ve(!!ue.offsetParent)});return Me.observe(ue),()=>{Me.disconnect()}},[pe,J]);let $e={};ce.tooltip===!0?$e={title:(n=O.text)!==null&&n!==void 0?n:d}:l.isValidElement(ce.tooltip)?$e={title:ce.tooltip}:typeof ce.tooltip=="object"?$e=Object.assign({title:(r=O.text)!==null&&r!==void 0?r:d},ce.tooltip):$e={title:ce.tooltip};const Ze=l.useMemo(()=>{const ue=Me=>["string","number"].includes(typeof Me);if(!(!de||pe)){if(ue(O.text))return O.text;if(ue(d))return d;if(ue(h))return h;if(ue($e.title))return $e.title}},[de,pe,h,$e.title,ge]);if(P)return l.createElement(VG,{value:(o=O.text)!==null&&o!==void 0?o:typeof d=="string"?d:"",onSave:z,onCancel:j,onEnd:O.onEnd,prefixCls:x,className:a,style:s,direction:v,component:b,maxLength:O.maxLength,autoSize:O.autoSize,enterIcon:O.enterIcon});const ot=()=>{const{expandable:ue,symbol:Me}=ce;if(!ue)return null;let nt;return Me?nt=Me:nt=y==null?void 0:y.expand,l.createElement("a",{key:"expand",className:`${x}-expand`,onClick:Re,"aria-label":y==null?void 0:y.expand},nt)},tt=()=>{if(!E)return;const{icon:ue,tooltip:Me}=O,nt=Pn(Me)[0]||(y==null?void 0:y.edit),vt=typeof nt=="string"?nt:"";return N.includes("icon")?l.createElement(Eo,{key:"edit",title:Me===!1?"":nt},l.createElement(lI,{ref:$,className:`${x}-edit`,onClick:_,"aria-label":vt},ue||l.createElement(e6,{role:"button"}))):null},lt=()=>M?l.createElement(KG,Object.assign({key:"copy"},R,{prefixCls:x,copied:A,locale:y,onCopy:Y,iconOnly:d==null})):null,Je=ue=>[ue&&ot(),tt(),lt()],Ge=ue=>[ue&&l.createElement("span",{"aria-hidden":!0,key:"ellipsis"},eK),ce.suffix,Je(ue)];return l.createElement(Or,{onResize:be,disabled:!J},ue=>l.createElement(QG,{tooltipProps:$e,enableEllipsis:J,isEllipsis:ge},l.createElement(cI,Object.assign({className:V({[`${x}-${c}`]:c,[`${x}-disabled`]:u,[`${x}-ellipsis`]:de,[`${x}-single-line`]:J&&ae===1,[`${x}-ellipsis-single-line`]:Ce,[`${x}-ellipsis-multiple-line`]:Ie},a),prefixCls:i,style:Object.assign(Object.assign({},s),{WebkitLineClamp:Ie?ae:void 0}),component:b,ref:pr(ue,C,t),direction:v,onClick:N.includes("text")?_:void 0,"aria-label":Ze==null?void 0:Ze.toString(),title:h},w),l.createElement(XG,{enableMeasure:J&&!pe,text:d,rows:ae,width:Ye,onEllipsis:Oe,miscDeps:[A,oe]},(Me,nt)=>{let vt=Me;return Me.length&&nt&&Ze&&(vt=l.createElement("span",{key:"show-content","aria-hidden":!0},vt)),JG(e,l.createElement(l.Fragment,null,vt,Ge(nt)))}))))}),Ef=tK;var nK=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o{var{ellipsis:n,rel:r}=e,o=nK(e,["ellipsis","rel"]);const i=Object.assign(Object.assign({},o),{rel:r===void 0&&o.target==="_blank"?"noopener noreferrer":r});return delete i.navigate,l.createElement(Ef,Object.assign({},i,{ref:t,ellipsis:!!n,component:"a"}))}),oK=rK,iK=l.forwardRef((e,t)=>l.createElement(Ef,Object.assign({ref:t},e,{component:"div"}))),dI=iK;var aK=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o{var{ellipsis:n}=e,r=aK(e,["ellipsis"]);const o=l.useMemo(()=>n&&typeof n=="object"?Qt(n,["expandable","rows"]):n,[n]);return l.createElement(Ef,Object.assign({ref:t},r,{ellipsis:o,component:"span"}))},sK=l.forwardRef(lK);var cK=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o{const{level:n=1}=e,r=cK(e,["level"]);let o;return uK.includes(n)?o=`h${n}`:o="h1",l.createElement(Ef,Object.assign({ref:t},r,{component:o}))}),fK=dK,tc=cI;tc.Text=sK;tc.Link=oK;tc.Title=fK;tc.Paragraph=dI;const mK=tc;function gK(e){return{token:{colorPrimary:"#d29ada",colorSuccess:"#8ae1c0",colorWarning:"#f7c180",colorError:"#fa8788",borderRadius:9,colorBgBase:e?"#f9f9f9":"#26272d",colorLink:"#d29ada",colorLinkHover:"#F593F5",colorTextSecondary:e?"rgba(0, 0, 0, 0.75)":"rgba(255, 255, 255, 0.45)",colorTextPlaceholder:e?"rgba(0, 0, 0, 0.25)":"rgba(220, 186, 224, 0.6)",colorText:e?"#000000":"rgba(255, 255, 255, 0.65)",colorTextHeading:e?"#000":"#E4DEE4",colorTextDescription:e?"rgba(0, 0, 0, 0.45)":"#B7A6B3"},components:{Switch:{trackMinWidth:60},Descriptions:{colorSplit:e?"rgba(5, 5, 5, 0.06)":"rgba(255, 255, 255, 0.25)",titleColor:e?"#000000":"rgba(255, 255, 255, 0.65)",contentColor:e?"#000000":"rgba(255, 255, 255, 0.65)",extraColor:e?"#000000":"rgba(255, 255, 255, 0.65)",labelBg:"rgba(210, 154, 218, 0.1)"}}}}const md=[{key:"g",label:"G - All Ages",color:"green",darkcolor:"#87d068",shortlabel:"G"},{key:"pg",label:"PG - Children",color:"green",darkcolor:"#87d068",shortlabel:"PG"},{key:"pg13",label:"PG-13 - Teens 13 or older",color:"gold",darkcolor:"#e0a502",shortlabel:"PG-13"},{key:"r17",label:"R - 17+ (violence & profanity)",color:"volcano",darkcolor:"#e05302",shortlabel:"R-17"},{key:"r",label:"R+ - Mild Nudity",color:"volcano",darkcolor:"#e05302",shortlabel:"R+"},{key:"rx",label:"Rx - Hentai",color:"red",darkcolor:"#e81b00",shortlabel:"Rx"}],vK=md.reduce((e,t)=>({...e,[t.label]:t}),{}),fl=l.createContext(!1),m0=l.createContext(!1),fI={order_by:"score",isAscending:!1,searchword:null,rating:null,genres:[],genres_exclude:[],status:null},mI=e=>({label:e.name,key:e.mal_id});function gI(e){return{cardTitle:e.title_english,japTitle:e.title,rating:e.rating,genres:e.genres.map(t=>mI(t)),id:e.mal_id,img:e.images.jpg.large_image_url,episodes:e.episodes,year:e.year,synopsis:e.synopsis,status:e.status,score:e.score,trailer:e.trailer.url,studios:e.studios.map(t=>t.name),themes:e.themes.map(t=>t.name),music:{openings:e.theme.openings,endings:e.theme.endings},related:e.relations.filter(t=>t.relation!=="Adaptation").map(t=>({relation:t.relation,entry:t.entry.map(n=>({id:n.mal_id,title:n.name}))}))}}const vI=e=>({titleEnglish:e.title_english,id:e.mal_id,titleOrig:e.title,genres:e.genres.map(t=>({name:t.name,id:t.mal_id})),img:e.images.jpg.large_image_url,rating:e.rating});function pK(e){let t=e.searchword;return typeof t>"u"&&(t=null),[{name:["genres"],value:e.genres.map(n=>Number(n))},{name:["genres_exclude"],value:e.genres_exclude.map(n=>Number(n))},{name:["order_by"],value:e.order_by},{name:["isAscending"],value:e.isAscending},{name:["searchword"],value:t},{name:["status"],value:e.status},{name:["rating"],value:e.rating}]}function hK(e){let t="";if(e.genres[0]){const n=e.genres.join(",");t=t+"&genres="+n}if(e.genres_exclude[0]){const n=e.genres_exclude.join(",");t=t+"&genres_exclude="+n}return e.isAscending?t=t+"&sort=asc":t=t+"&sort=desc",e.order_by&&(t=t+"&order_by="+e.order_by),e.searchword&&(t=t+"&q="+e.searchword),e.rating&&(t=t+"&rating="+e.rating),e.status&&(t=t+"&status="+e.status),t}function yK(e){const t={...fI};if(e){const n=e.get("genres");n&&(t.genres=n==null?void 0:n.split(","));const r=e.get("genres_exclude");r&&(t.genres_exclude=r.split(","));const o=e.get("order_by");o&&(t.order_by=o),e.get("sort=")==="asc"&&(t.isAscending=!0);const a=e.get("rating");a&&(t.rating=a);const s=e.get("status");s&&(t.status=s);const c=e.get("q");c&&(t.searchword=c)}return t}function bK(e){let t=window.location.pathname;const n=t.indexOf("/lists");return n!==-1&&(t=t.substring(0,n)),t=t+"/shared",window.location.protocol+"//"+window.location.host+t+"?ids="+e.join(",")}const T1="https://corsproxy.io/?https://api.jikan.moe/v4/anime?limit=";function SK(e,t){return t?T1+e+"&"+t:T1+e}const CK="https://corsproxy.io/?https://api.jikan.moe/v4/anime/";function g0(e){return CK+e+"/full"}const N1="https://corsproxy.io/?https://api.jikan.moe/v4/top/anime?limit=",xK="https://corsproxy.io/?https://api.jikan.moe/v4/anime?order_by=popularity&limit=";function pI(e,t=1,n=1){if(e){if(e.genre)return xK+t+"&genres="+e.genre+"&page="+n;if(e.rating)return N1+t+"&rating="+e.rating+"&page="+n}return N1+t+"&page="+n}function wK(e,t){if(t){const n=t.indexOf("page=");if(n>=0){const r=t.indexOf("&",n);return r>n+5?t.substring(0,n+5)+e+t.substring(r):t.substring(0,n+5)+e}else return t+"&page="+e}else return"page="+e}function $K(e,t){const n=[{key:"title",label:"Original title",children:e.japTitle,span:{sm:1,md:2,lg:2,xl:2,xxl:2}},{key:"year",label:"Year",children:e.year,span:{md:1,lg:2,xl:1,xxl:1}},{key:"episodes",label:"Episodes",children:e.episodes,span:{md:1,lg:2,xl:1,xxl:1}},{key:"rating",label:"Rating",children:t.rating,span:{md:2,lg:2,xl:2,xxl:2}}];return e.genres.length>0&&n.push({key:"genres",label:"Genres",children:t.genres,span:{md:2,lg:2,xl:2,xxl:3}}),e.themes.length>0&&n.push({key:"themes",label:"Themes",children:e.themes.join(", "),span:{md:2,lg:2,xl:2,xxl:3}}),e.synopsis&&n.push({key:"synopsis",label:"Synopsis",children:t.synopsis,span:{md:2,lg:2,xl:2,xxl:3}}),e.studios.length>0&&n.push({key:"studios",label:"Studios",children:e.studios.join(", "),span:{md:2,lg:2,xl:2,xxl:3}}),n.push({key:"lists",label:"Lists",children:t.lists,span:{md:2,lg:2,xl:2,xxl:3}}),n}function ml(){return window.matchMedia("(min-width: 1841px)").matches?14:window.matchMedia("(min-width: 1581px)").matches?12:window.matchMedia("(min-width: 1401px)").matches?10:window.matchMedia("(min-width: 1131px)").matches?8:6}function hI(e){const t=e.reduce((n,r)=>({...n,[r.mal_id]:!0}),{});return e.filter(n=>t[n.mal_id]?(t[n.mal_id]=!1,!0):!1)}function _1(e){switch(e){case"Finished Airing":return"success";case"Currently Airing":return"processing";case"Not yet aired":return"warning";case"G - All Ages":return"processing";case"PG - Children":return"processing";case"PG-13 - Teens 13 or older":return"success";case"R - 17+ (violence & profanity)":return"warning";case"R+ - Mild Nudity":return"warning";case"Rx - Hentai":return"error";default:return"default"}}function gd(e,t){return e===""?{isValid:!1,message:"Please, write a list name"}:t.includes(e)?{isValid:!1,message:"This list already exists"}:{isValid:!0,message:""}}async function v0(e){const n=await(await fetch(e)).json(),r=n.pagination.last_visible_page,o=hI(n.data);return{data:o,isFiltered:n.data.length>o.length,totalPages:r}}async function p0(e){const t=await fetch(e);return t.status===404?null:(await t.json()).data}async function EK(e,t,n,r,o){let i;e instanceof Array?i=e.slice(0):i=[];let a=n;for(;r-i.length>0&&o>a;){a+=1;const s=r-i.length,c=wK(a,t),{data:u}=await v0(c);i=i.concat(u.slice(0,s)),i=hI(i)}return i}const yI="FETCH_ANIME_PAGE_REQUEST",bI="FETCH_ANIME_PAGE_SUCCESS",SI="FETCH_ANIME_PAGE_FAILURE",CI="FETCH_ANIME_PAGE_EMPTY",xI=()=>({type:yI}),wI=e=>({type:bI,payload:e}),$I=()=>({type:SI}),EI=()=>({type:CI});function OK(e){return async t=>{t(xI());try{const n=await p0(e);if(!n)t(EI());else{const r=gI(n);t(wI(r))}}catch{t($I())}}}function Qm(){return async t=>{t(xI());try{const n=pI(),i=(await(await fetch(n)).json()).pagination.last_visible_page,a=Math.floor(Math.random()*i),s=n+"&page="+a,c=await v0(s);if(!c)t(EI());else{const u=c.data,d=await p0(g0(u[0].mal_id));if(d){const f=gI(d);t(wI(f))}}}catch{t($I())}}}const IK=ml();function Of(e){const[t,n]=l.useState(IK);l.useEffect(()=>{function r(){const o=ml();n(o)}return r(),window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}},[]),l.useEffect(()=>{e(t)},[t,e])}const It=qT,OI="FETCH_HOME_CARDS_DATA_REQUEST",II="FETCH_HOME_CARDS_DATA_SUCCESS",RI="FETCH_HOME_CARDS_DATA_FAILURE",PI="FETCH_HOME_CARDS_DATA_EMPTY",MI="CLEAR_HOME_FILTERS",TI="SET_GENRE_TO_HOME_FILTERS",NI="SET_RATING_TO_HOME_FILTERS",RK=()=>({type:OI}),PK=(e,t)=>({type:II,payload:{data:e,totalPages:t}}),MK=()=>({type:RI}),TK=()=>({type:PI}),_I=()=>({type:MI}),NK=e=>({type:TI,payload:e}),_K=e=>({type:NI,payload:e});function jI(e,t=1,n=1,r,o,i,a){return async s=>{s(r());try{const c=await v0(e);if(!c.data[0])s(a());else{const u=c.data,d=c.totalPages;let f=[];c.isFiltered&&d>t?f=await EK(u,e,t,n,d):f=u;const m=f.map(vI);s(o(m,d))}}catch{s(i())}}}function jK(e,t=1,n=1){const r=pI(e,n,t);return jI(r,t,n,RK,PK,MK,TK)}const LI="FETCH_SEARCH_CARDS_DATA_REQUEST",zI="FETCH_SEARCH_CARDS_DATA_SUCCESS",AI="FETCH_SEARCH_CARDS_DATA_FAILURE",FI="FETCH_SEARCH_CARDS_DATA_EMPTY",LK=()=>({type:LI}),zK=(e,t)=>({type:zI,payload:{data:e,totalPages:t}}),AK=()=>({type:AI}),FK=()=>({type:FI});function DK(e,t,n){const r=SK(e,n);return jI(r,t,e,LK,zK,AK,FK)}const DI="FETCH_LISTS_REQUEST",BI="FETCH_LISTS_SUCCESS",HI="FETCH_LISTS_FAILURE",kI="POST_NEW_LIST_REQUEST",VI="POST_NEW_LIST_SUCCESS",WI="POST_NEW_LIST_FAILURE",UI="POST_NEW_ITEM_TO_LIST_REQUEST",GI="POST_NEW_ITEM_TO_LIST_SUCCESS",KI="POST_NEW_ITEM_TO_LIST_FAILURE",qI="DELETE_LIST_REQUEST",XI="DELETE_LIST_SUCCESS",YI="DELETE_LIST_FAILURE",QI="DELETE_ITEM_FROM_LIST_REQUEST",ZI="DELETE_ITEM_FROM_LIST_SUCCESS",JI="DELETE_ITEM_FROM_LIST_FAILURE",eR="FETCH_LIST_ANIMES_REQUEST",tR="FETCH_LIST_ANIMES_SUCCESS",nR="FETCH_LIST_ANIMES_EMPTY",rR="FETCH_LIST_ANIMES_FAILURE",BK=()=>({type:eR}),HK=e=>({type:tR,payload:e}),kK=()=>({type:nR}),VK=()=>({type:rR}),WK=()=>({type:kI}),UK=(e,t)=>({type:VI,payload:{listName:e,value:t}}),j1=()=>({type:WI}),GK=()=>({type:UI}),KK=(e,t)=>({type:GI,payload:{listName:e,newId:t}}),Zm=()=>({type:KI}),qK=()=>({type:DI}),XK=e=>({type:BI,payload:e}),L1=()=>({type:HI}),YK=()=>({type:qI}),QK=e=>({type:XI,payload:e}),z1=()=>({type:YI}),ZK=()=>({type:QI}),JK=(e,t)=>({type:ZI,payload:{listName:e,animeId:t}}),Jm=()=>({type:JI});function oR(e){return async t=>{if(t(BK()),e.length)try{const n=[];for(const r of e){const o=g0(r),i=await p0(o);if(i){const a=vI(i);n.push(a)}}t(HK(n))}catch{t(VK())}else t(kK())}}function nc(){return new Promise((e,t)=>{const n=indexedDB.open("animeUniverse",1);n.onupgradeneeded=function(r){const o=r.target.result;o.objectStoreNames.contains("lists")||o.createObjectStore("lists")},n.onsuccess=function(r){e(r.target.result)},n.onerror=function(r){t(r.target.error)}})}function vd(e,t){return async n=>{n(WK());try{const i=(await nc()).transaction("lists","readwrite").objectStore("lists");let a=[];t&&(a=[...t]);const s=i.add(a,e);s.onsuccess=()=>{n(UK(e,a))},s.onerror=()=>{n(j1())}}catch{n(j1())}}}function eq(e,t){return async n=>{n(GK());try{const i=(await nc()).transaction("lists","readwrite").objectStore("lists"),a=i.get(e);a.onsuccess=s=>{const c=s.target.result;c.push(t);const u=i.put(c,e);u.onsuccess=()=>{n(KK(e,t))},u.onerror=()=>{n(Zm())}},a.onerror=()=>{n(Zm())}}catch{n(Zm())}}}function tq(e){return async t=>{t(YK());try{const i=(await nc()).transaction("lists","readwrite").objectStore("lists").delete(e);i.onsuccess=()=>{t(QK(e))},i.onerror=()=>{t(z1())}}catch{t(z1())}}}function iR(e,t){return async n=>{n(ZK());try{const i=(await nc()).transaction("lists","readwrite").objectStore("lists"),a=i.get(e);a.onsuccess=s=>{const c=s.target.result;let u=[];c&&c.length>0&&(u=c.filter(f=>f!==t));const d=i.put(u,e);d.onsuccess=()=>{n(JK(e,t))},d.onerror=()=>{n(Jm())}},a.onerror=()=>{n(Jm())}}catch{n(Jm())}}}function nq(){return async e=>{e(qK());try{const o=(await nc()).transaction("lists","readonly").objectStore("lists").openCursor(),i={};o.onsuccess=function(a){const s=a.target.result;s?(i[s.key]=s.value,s.continue()):e(XK(i))},o.onerror=function(){e(L1())}}catch{e(L1())}}}const aR="FETCH_GENRES_SUCCESS",lR="FETCH_GENRES_FAILURE",sR="FETCH_GENRES_REQUEST",rq=()=>({type:sR}),oq=e=>({type:aR,payload:e}),iq=()=>({type:lR});function aq(){return async e=>{try{e(rq());const t=await fetch("https://corsproxy.io/?https://api.jikan.moe/v4/genres/anime"),{data:n}=await t.json();e(oq(n.map(mI)))}catch{e(iq())}}}const lq={data:null,isLoading:!1,isError:!1,isEmpty:!1,currPage:1,totalPages:1,filters:{rating:null,genre:null}},sq=(e=lq,t)=>{switch(t.type){case OI:return{...e,isLoading:!0,isError:!1,isEmpty:!1};case II:return{...e,isLoading:!1,data:t.payload.data,totalPages:t.payload.totalPages};case RI:return{...e,isLoading:!1,isError:!0};case PI:return{...e,isLoading:!1,isError:!1,isEmpty:!0};case MI:return{...e,filters:{rating:null,genre:null}};case TI:return{...e,filters:{rating:null,genre:t.payload}};case NI:return{...e,filters:{rating:t.payload,genre:null}};default:return e}},cq={data:null,isLoading:!1,isError:!1,isEmpty:!1,currPage:1,totalPages:1},uq=(e=cq,t)=>{switch(t.type){case LI:return{...e,isLoading:!0,isError:!1,isEmpty:!1};case zI:return{...e,isLoading:!1,data:t.payload.data,totalPages:t.payload.totalPages};case AI:return{...e,isLoading:!1,isError:!0};case FI:return{...e,isLoading:!1,isError:!1,isEmpty:!0};default:return e}},dq={data:null,isLoading:!1,isError:!1,isEmpty:!1},fq=(e=dq,t)=>{switch(t.type){case yI:return{...e,isLoading:!0,isError:!1,isEmpty:!1};case bI:return{...e,isLoading:!1,data:t.payload};case SI:return{...e,isLoading:!1,isError:!0};case CI:return{...e,isLoading:!1,isEmpty:!0};default:return e}},mq={lists:{},currListAnimeCards:[],isListsLoading:!1,isListsError:!1,isCardsDataLoading:!1,isCardsDataError:!1,isCardsDataEmpty:!1,isPostingLists:!1,isPostingError:!1},gq=(e=mq,t)=>{switch(t.type){case DI:return{...e,isListsLoading:!0,isListsError:!1};case BI:return{...e,isListsLoading:!1,lists:t.payload};case HI:return{...e,isListsLoading:!1,isListsError:!0};case kI:case qI:case UI:case QI:return{...e,isListsLoading:!0,isListsError:!1};case VI:return{...e,isListsLoading:!1,lists:{...e.lists,[t.payload.listName]:t.payload.value}};case XI:{const n={...e.lists};return delete n[t.payload],{...e,isListsLoading:!1,lists:n}}case GI:return{...e,isListsLoading:!1,lists:{...e.lists,[t.payload.listName]:[...e.lists[t.payload.listName],t.payload.newId]}};case ZI:return{...e,isListsLoading:!1,lists:{...e.lists,[t.payload.listName]:[...e.lists[t.payload.listName].filter(n=>n!==t.payload.animeId)]}};case WI:case YI:case KI:case JI:return{...e,isListsLoading:!1,isListsError:!0};case eR:return{...e,isCardsDataLoading:!0,isCardsDataError:!1,isCardsDataEmpty:!1};case tR:return{...e,isCardsDataLoading:!1,currListAnimeCards:t.payload};case nR:return{...e,isCardsDataLoading:!1,currListAnimeCards:[],isCardsDataEmpty:!0};case rR:return{...e,isCardsDataLoading:!1,isCardsDataError:!0};default:return e}},vq={genres:[],isLoading:!1,isError:!1},pq=(e=vq,t)=>{switch(t.type){case sR:return{...e,isLoading:!0,isError:!1};case aR:return{...e,isLoading:!1,genres:t.payload};case lR:return{...e,isLoading:!1,isError:!0};default:return e}};function cR({isBigCard:e,animeId:t}){const n=qr(),[r,o]=l.useState([]),i=It(v=>v.lists.lists),a=It(v=>v.lists.isListsLoading),[s,c]=l.useState(["list1"]),[u,d]=l.useState(""),[f,m]=l.useState(!1),[g,b]=l.useState("Please, write a list name"),h=l.useRef(null),S=v=>{const{value:y}=v.target;/^[a-zA-Z0-9 ]*$/.test(y)?(d(y),m(!1)):(m(!0),b("a-z A-Z 0-9 symbols only"),setTimeout(()=>m(!1),2e3))},p=v=>{v.preventDefault();const y=u.trim(),C=gd(y,s);C.isValid?(m(!1),c([...s].splice(0,1,"add",y)),n(vd(y,[t]))):(m(!0),b(C.message))};return l.useEffect(()=>{const v=Object.keys(i);v.length>0?c(v):c([])},[i,t]),l.useEffect(()=>{const v=s.filter(y=>{var C;return Array.isArray(i[y])?(C=i[y])==null?void 0:C.includes(t):!1});o(v)},[s,t,i]),l.useEffect(()=>{function v(y){h.current!==y.target&&m(!1)}return document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[h]),B.jsx(qn,{disabled:a,className:e?"add-to-list-select add-to-list-select-right":"add-to-list-select",ref:h.current,placeholder:"+ Add to list",onChange:v=>{o(v)},onSelect:v=>n(eq(v,t)),onDeselect:v=>n(iR(v,t)),mode:"multiple",maxTagCount:"responsive",showSearch:!1,value:r,dropdownRender:v=>B.jsxs(B.Fragment,{children:[v,B.jsx(Gk,{style:{margin:"8px 0"}}),B.jsxs(SO,{children:[B.jsx(Eo,{open:f,title:g,children:B.jsx(ki,{placeholder:"New list name",value:u,onChange:y=>S(y),onKeyDown:y=>y.stopPropagation(),onPressEnter:y=>{p(y)}})}),B.jsx(er,{type:"text",icon:B.jsx(U$,{}),onClick:y=>p(y)})]})]}),options:s.map(v=>({value:v,label:v,key:v}))})}function uR({data:e}){const t=l.useContext(fl),n=Ki(),r=$K(e,{rating:B.jsx(_m,{status:_1(e.rating),text:e.rating}),genres:e.genres.map(o=>B.jsx(er,{title:"Go to "+o.label,onClick:()=>{n("/search?genres="+o.key)},children:o.label},o.key)),lists:B.jsx(cR,{isBigCard:!0,animeId:e.id}),synopsis:B.jsx(dI,{ellipsis:{expandable:!0,rows:2},children:e.synopsis})});return B.jsxs("div",{className:"anime-big-card-container",children:[B.jsx(_m,{status:_1(e.status),text:e.status,style:{position:"absolute",top:"2vw",right:"2vw"}}),B.jsxs("div",{className:"anime-big-card",children:[B.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"20px"},children:[B.jsx(_m,{count:e.score,children:B.jsx(yU,{src:e.img,alt:e.cardTitle,width:"20vw"})}),e.trailer&&B.jsxs(mK.Link,{href:e.trailer,target:"_blank",children:[B.jsx(zL,{})," Watch trailer"]})]}),B.jsx(kV,{bordered:!0,title:e.cardTitle,items:r,className:"descriptions",column:{sm:1,md:2,lg:2,xl:2,xxl:3}})]}),B.jsxs("div",{className:t?"anime-big-card-extra":"anime-big-card-extra light-text",children:[e.related.length>0&&B.jsxs("ul",{children:[B.jsx("h3",{children:"Related Titles"}),e.related.map(o=>B.jsxs("ul",{children:[B.jsx("h4",{children:o.relation}),o.entry.map(i=>B.jsx("li",{children:B.jsx(cr,{to:`/${i.id}`,children:i.title})},i.id))]},o.relation))]}),(e.music.openings.length>0||e.music.endings.length>0)&&B.jsxs("ul",{children:[B.jsx("h3",{children:"Music"}),e.music.openings&&B.jsxs("ul",{children:[B.jsx("h4",{children:"Openings"}),e.music.openings.map(o=>B.jsx("li",{children:o},o))]}),e.music.endings&&B.jsxs("ul",{children:[B.jsx("h4",{children:"Endings"}),e.music.endings.map(o=>B.jsx("li",{children:o},o))]})]})]})]})}const{Meta:hq}=sO;function If({cardData:e,isDeletable:t}){const n=qr(),r=Ki(),o=l.useRef(null),[i,a]=l.useState(!1),s=l.useContext(fl),c=vK[e.rating],{listname:u}=jd();let d="Are you sure you want to delete ";if(t){const f=e.titleEnglish;!f||f!==""?d=d+f+" from ":d=d+"this anime from ",u&&u.includes("list")?d=d+u:d=d+u+" list"}return B.jsxs(sO,{className:"anime-card",cover:B.jsxs("div",{className:"poster-container",title:"Show more info",onClick:()=>{r("/"+e.id)},children:[c&&B.jsx(Gm,{color:s?c.color:c.darkcolor,className:"anime-card-tag",children:c.shortlabel}),B.jsxs("div",{className:"poster-addition",children:[B.jsx(G$,{className:"poster-icon"}),B.jsx("p",{children:"Show more info"})]}),B.jsx("img",{className:"poster",alt:e.titleEnglish,src:e.img,style:{width:"inherit"}})]}),children:[u&&t&&B.jsx($f,{open:i,title:d,onOk:()=>{n(iR(u,e.id)),a(!1)},onCancel:()=>a(!1)}),t&&B.jsx(Gm,{title:"remove from list",className:"delete-button",onClick:()=>a(!0),children:B.jsx(D$,{})}),B.jsx(hq,{title:e.titleEnglish,description:e.titleOrig,className:"anime-card-title"}),B.jsx("div",{className:"anime-card-tags-container",ref:o,children:e.genres.map(f=>B.jsx(Gm,{color:s?"magenta":"#d29ada",title:"Go to "+f.name,onClick:()=>{r("/search?genres="+f.id)},style:{cursor:"pointer"},children:f.name},f.id))}),B.jsx(cR,{isBigCard:!1,animeId:e.id})]})}function rc({isError:e,isSpinnerActive:t,isEmpty:n,errorElement:r,loadingElement:o,emptyElement:i,children:a}){return n?i:e?r:t?o:a}function oc({type:e}){let t="";switch(e){case"byFilters":t="Sorry, there're no animes with these parametres";break;case"byId":t="This page doesn't exist";break;case"byList":t="This list is empty";break;case"noList":t="Choose a list to see saved animes";break;default:t="Empty page"}return B.jsxs("div",{className:"icon-container",children:[e!=="noList"&&B.jsx(V$,{className:"icon"}),B.jsx("p",{className:"icon-message",children:t})]})}function ic({children:e}){return B.jsxs("div",{className:"icon-container",children:[B.jsx(V$,{className:"icon"}),B.jsx("p",{className:"icon-message",children:"Oops, something went wrong"}),e]})}function ac(){return B.jsx("div",{className:"icon-container",children:B.jsx(ol,{className:"icon"})})}function yq(){return B.jsx(wn.Item,{style:{padding:0},disabled:!0,children:B.jsx(L8,{type:"error",showIcon:!0,message:"Couldn't get genres"})},"error")}function bq(){return B.jsx(wn.Item,{children:B.jsx(ol,{})},"loading")}function Sq(){const{id:e}=jd(),t=qr(),n=It(a=>a.animePage.data),r=It(a=>a.animePage.isLoading),o=It(a=>a.animePage.isError),i=It(a=>a.animePage.isEmpty);return l.useEffect(()=>{const a=g0(Number(e));t(OK(a))},[t,e]),B.jsx("div",{className:"random-container",children:B.jsx(rc,{isError:o,isSpinnerActive:r,isEmpty:i,errorElement:B.jsx(ic,{}),loadingElement:B.jsx(ac,{}),emptyElement:B.jsx(oc,{type:"byId"}),children:n&&B.jsx(uR,{data:n})})})}const Cq=["rating","genres"];function xq(){const e=It(f=>f.genres.isLoading),t=It(f=>f.genres.isError),n=It(f=>f.genres.genres),r=l.useContext(fl),o=l.useContext(m0),[i,a]=l.useState(o?[]:["rating"]),s=qr(),c=f=>{const m=f.find(g=>i.indexOf(g)===-1);m&&Cq.indexOf(m)===-1?a(f):a(m?[m]:[])},u=({key:f,keyPath:m})=>{m.includes("rating")?s(_K(f)):m.includes("genres")?s(NK(f)):(s(_I()),a([]))};let d=null;return t?d=B.jsx(yq,{}):e?d=B.jsx(bq,{}):d=n.map(f=>B.jsx(wn.Item,{children:f.label},f.key)),B.jsxs(B.Fragment,{children:[!o&&B.jsx(nf,{className:"home-sider",theme:r?"light":"dark",children:B.jsxs(wn,{mode:"inline",theme:r?"light":"dark",onOpenChange:c,onClick:u,openKeys:i,defaultOpenKeys:i,defaultSelectedKeys:["clear"],children:[B.jsx(wn.Item,{children:"No filters"},"clear"),B.jsx(wn.SubMenu,{title:"Rating",children:md.map(f=>B.jsx(wn.Item,{children:f.label},f.key))},"rating"),B.jsx(wn.SubMenu,{title:"Genres",children:d},"genres")]})}),o&&B.jsx(Es,{style:{padding:0},children:B.jsxs(wn,{mode:"horizontal",theme:r?"light":"dark",onOpenChange:c,onClick:u,openKeys:i,defaultOpenKeys:i,defaultSelectedKeys:["clear"],children:[B.jsx(wn.Item,{children:"No filters"},"clear"),B.jsx(wn.SubMenu,{title:"Rating",children:md.map(f=>B.jsx(wn.Item,{children:f.label},f.key))},"rating"),B.jsx(wn.SubMenu,{title:"Genres",children:d},"genres")]})})]})}const wq=ml();function $q(){const[e,t]=l.useState(wq),n=qr(),r=It(d=>d.homeCards.data),o=It(d=>d.homeCards.filters),i=It(d=>d.homeCards.isLoading),a=It(d=>d.homeCards.isError),s=i||!r,c=!1,u=l.useCallback(d=>t(d),[]);return Of(u),l.useEffect(()=>{n(jK(o,1,e))},[e,n,o]),l.useEffect(()=>{n(_I())},[n]),B.jsx(Vs,{className:"content-container",children:B.jsx("div",{className:"content-wrap",children:B.jsx(rc,{isError:a,isSpinnerActive:s,isEmpty:c,errorElement:B.jsx(ic,{}),loadingElement:B.jsx(ac,{}),emptyElement:B.jsx(oc,{type:"byFilters"}),children:r&&r.map(d=>B.jsx(If,{cardData:d,isDeletable:!1},d.id))})})})}function Eq(){return B.jsxs(B.Fragment,{children:[B.jsx(xq,{}),B.jsx($q,{})]})}function A1(e){if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(e).catch(function(t){console.error("Could not copy text: ",t)});{const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.width="2em",t.style.height="2em",t.style.padding="0",t.style.border="none",t.style.outline="none",t.style.boxShadow="none",t.style.background="transparent",document.body.appendChild(t),t.focus(),t.select();try{document.execCommand("copy")}catch(n){console.error("Unable to copy",n)}document.body.removeChild(t)}}const Oq=ml();function Iq(){const{listname:e}=jd(),t=qr(),n=It(v=>v.lists.isCardsDataError),r=It(v=>v.lists.isCardsDataLoading),o=It(v=>v.lists.isCardsDataEmpty),i=It(v=>v.lists.currListAnimeCards),a=!i||r,s=It(v=>v.lists.lists),[c,u]=l.useState(1),[d,f]=l.useState(Oq),m=l.useMemo(()=>e&&s[e]&&s[e].length>0?s[e]:[],[e,s]),g=l.useMemo(()=>bK(m),[m]),b=l.useMemo(()=>e&&s[e]&&s[e].length>0?Math.ceil(s[e].length/d):1,[s,e,d]),[h,S]=l.useState(!1);l.useLayoutEffect(()=>{let v=[];if(m.length&&(v=[...m]),m.length>d){const y=(c-1)*d,C=y+d;v=[...m].slice(y,C)}t(oR(v))},[m,c,d,t]);const p=l.useCallback(v=>{f(v),u(1)},[]);return Of(p),B.jsx(Vs,{className:"content-container",children:B.jsx($O,{vertical:!0,justify:"center",align:"center",gap:"middle",children:B.jsxs(rc,{isError:n,isSpinnerActive:a,isEmpty:o||i.length<0,errorElement:B.jsx(ic,{}),loadingElement:B.jsx(ac,{}),emptyElement:B.jsx(oc,{type:e?"byList":"noList"}),children:[B.jsx("div",{className:"content-wrap",children:i.map(v=>B.jsx(If,{cardData:v,isDeletable:!0},v.id))}),B.jsx(c0,{showSizeChanger:!1,current:c,onChange:v=>{u(v)},total:b*d,pageSize:d,hideOnSinglePage:!0}),B.jsx(er,{onClick:()=>{S(!0)},children:"Share list"}),B.jsxs($f,{open:h,onOk:()=>{A1(g),S(!1)},onCancel:()=>{S(!1)},okText:"Copy link",closable:!1,style:{display:"flex",flexDirection:"column",alignItems:"center",top:"30vh"},children:[B.jsx(rG,{value:g,color:"#d29ada",icon:"/kitsune.svg"}),B.jsx(ki,{value:g,onClick:()=>A1(g)})]})]})})})}const Rq={key:"blank",label:B.jsx("div",{})};function Pq(){const{listname:e}=jd(),t=Ki(),n=qr(),[r,o]=l.useState(!1),[i,a]=l.useState(null),s=l.useContext(fl),c=l.useContext(m0),u=It(C=>C.lists.lists),[d,f]=l.useState(""),[m,g]=l.useState(["add"]),[b,h]=l.useState(!1),[S,p]=l.useState("Please, write a list name"),[v,y]=l.useState([Rq]);return l.useEffect(()=>{g(["add",...Object.keys(u)])},[u]),l.useEffect(()=>{const C=m.map($=>{const x={key:$,label:B.jsx("div",{})};switch($){case"input":x.label=B.jsx(Eo,{open:b,title:S,children:B.jsx(ki.Search,{autoFocus:!0,enterButton:"create",value:d,onChange:w=>{const{value:E}=w.target;/^[a-zA-Z0-9 ]*$/.test(E)?(f(E),h(!1)):(h(!0),p("a-z A-Z 0-9 symbols only"),setTimeout(()=>h(!1),2e3))},onSearch:()=>{const w=d.trim(),E=gd(w,m);E.isValid?(h(!1),g([...m].splice(0,1,"add",w)),n(vd(w)),t("/lists/"+w)):(h(!0),p(E.message))}})});break;case"add":x.label=B.jsx("div",{onClick:()=>{const w=[...m];w.splice(0,1,"input"),g(w)},children:"Create new list +"});break;default:x.label=B.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},onClick:()=>{const w=[...m];w.splice(0,1,"add"),g(w),t("/lists/"+$)},children:[$,B.jsx("span",{title:"delete list",children:B.jsx(D$,{onClick:()=>{o(!0),a($)}})})]})}return x},[]);y(C)},[m,S,b,n,t,d]),B.jsxs(B.Fragment,{children:[" ",B.jsx($f,{open:r,title:"Are you sure you want to delete this list?",onOk:()=>{i&&(n(tq(i)),t("/lists")),o(!1),a(null)},onCancel:()=>{o(!1),a(null)}}),!c&&B.jsx(nf,{theme:s?"light":"dark",className:"lists-sider",children:B.jsx(wn,{theme:s?"light":"dark",items:v,selectedKeys:e?[e]:[]})}),c&&B.jsxs(Es,{style:{width:"100vw",display:"flex",flexWrap:"wrap",columnGap:"20px",alignItems:"center",height:"fit-content",padding:"15px",backgroundColor:s?"rgba(255, 255, 255, 0.65)":"#001529"},children:[B.jsxs("label",{children:["Choose the list:",B.jsx(qn,{style:{marginLeft:"10px",minWidth:"100px"},value:e,onChange:C=>{t("/lists/"+C)},options:Object.keys(u).map(C=>({value:C,key:C,label:C}))})]}),B.jsx(Eo,{open:b,title:S,children:B.jsx(ki.Search,{style:{maxWidth:"170px"},placeholder:"Create new list",title:"create new list",enterButton:"+",value:d,onChange:C=>{const{value:$}=C.target;/^[a-zA-Z0-9 ]*$/.test($)?(f($),h(!1)):(h(!0),p("a-z A-Z 0-9 symbols only"),setTimeout(()=>h(!1),2e3))},onSearch:()=>{const C=d.trim(),$=gd(C,m);$.isValid?(h(!1),g([...m].splice(0,1,"add",C)),n(vd(C)),t("/lists/"+C)):(h(!0),p($.message))}})}),e&&B.jsx(er,{onClick:()=>{a(e),o(!0)},children:"Delete list"})]})]})}function F1(){return B.jsxs("div",{className:"lists-page",children:[B.jsx(Pq,{}),B.jsx(Iq,{})]})}function Mq(){const e=qr(),t=It(a=>a.animePage.isLoading),n=It(a=>a.animePage.isError),r=It(a=>a.animePage.isEmpty),o=It(a=>a.animePage.data),i=t||!o;return l.useEffect(()=>{e(Qm())},[e]),B.jsx("div",{className:"random-container",children:B.jsxs(rc,{isError:n,isSpinnerActive:i,isEmpty:r,errorElement:B.jsx(ic,{children:B.jsx(er,{className:"random-button",onClick:()=>{e(Qm())},children:"Try again"})}),loadingElement:B.jsx(ac,{}),emptyElement:B.jsx(oc,{type:"byId"}),children:[o&&B.jsx(uR,{data:o}),B.jsx(er,{className:"random-button",onClick:()=>{e(Qm())},children:"Try again"})]})})}function Tq(){const e=ci(),t=l.useMemo(()=>new URLSearchParams(e.search),[e.search]),n=l.useMemo(()=>yK(t),[t]),[r,o]=l.useState(n),i=l.useContext(fl),a=It(m=>m.genres.genres),s=Ki(),[c,u]=l.useState("Hide filters"),[d,f]=l.useState(!0);return l.useEffect(()=>{o(n)},[n]),B.jsxs("div",{className:i?d?"search-sider":"search-sider search-sider-closed":d?"search-sider search-sider-dark":"search-sider search-sider-closed search-sider-dark",children:[B.jsxs($W,{labelAlign:"left",layout:"vertical",onFieldsChange:m=>{const g=m.reduce((b,h)=>({...b,[h.name[0]]:h.value}),{...r});o(g)},onFinish:()=>{const m=hK(r);s("/search?"+m)},fields:pK(r),children:[B.jsx(vi,{label:"Order by",name:"order_by",children:B.jsx(qn,{options:[{value:"title",label:"title",key:"title"},{label:"start date",value:"start_date",key:"start"},{label:"end date",value:"end_date",key:"end"},{label:"episodes",value:"episodes",key:"episodes"},{label:"score",value:"score",key:"score"}]})},"order_by"),B.jsx(vi,{label:"Order",name:"isAscending",children:B.jsx(oI,{checkedChildren:B.jsx(lj,{style:{color:"navy"}}),unCheckedChildren:B.jsx(nj,{})})},"isAscending"),B.jsx(vi,{label:"Title",name:"searchword",children:B.jsx(ki,{name:"searchword",placeholder:"input title",allowClear:!0})},"searchword"),B.jsx(vi,{label:"Rating",name:"rating",children:B.jsx(qn,{allowClear:!0,placeholder:"select one",children:md.map(m=>B.jsx(qn.Option,{value:m.key,children:m.label},m.key))})},"rating"),B.jsx(vi,{label:"Genres",name:"genres",children:B.jsx(qn,{allowClear:!0,mode:"multiple",placeholder:"select multiple",children:a.map(m=>B.jsx(qn.Option,{value:m.key,children:m.label},m.key))})},"genres"),B.jsx(vi,{label:"Exclude genres",name:"genres_exclude",children:B.jsx(qn,{allowClear:!0,mode:"multiple",placeholder:"select multiple",children:a.map(m=>B.jsx(qn.Option,{value:m.key,children:m.label},m.key))})},"genres_exclude"),B.jsx(vi,{label:"Status",name:"status",children:B.jsx(qn,{allowClear:!0,placeholder:"select one",options:[{value:"airing",label:"Airing"},{value:"complete",label:"Complete"},{value:"upcoming",label:"Upcoming"}]})},"status"),B.jsxs(er,{htmlType:"submit",style:{alignSelf:"center",backgroundColor:"#d29ada",color:"white"},children:["Search ",B.jsx(wh,{style:{color:"white"}})]}),B.jsx(er,{onClick:()=>{o(fI),s("/search")},children:"Clear filters"})]}),B.jsx("button",{className:"showhide-button",onClick:()=>{u(c==="Hide filters"?"Show filters":"Hide filters"),f(!d)},children:c})]})}const Nq=ml();function _q(e,t){if(t){const n=t.indexOf("page=");if(n>=0){const r=t.indexOf("&",n);return r>n+5?t.substring(0,n+5)+e+t.substring(r):t.substring(0,n+5)+e}else return t+"&page="+e}else return"page="+e}function jq(){const e=ci(),t=new URLSearchParams(e.search),n=t.toString(),r=t.get("page"),o=Ki(),[i,a]=l.useState(Number(r)),[s,c]=l.useState(Nq),u=It(p=>p.searchCards.totalPages),d=It(p=>p.searchCards.data),f=It(p=>p.searchCards.isError),m=It(p=>p.searchCards.isLoading),g=It(p=>p.searchCards.isEmpty),b=qr(),h=m||!d,S=l.useCallback(p=>{c(p),a(1)},[]);return Of(S),l.useEffect(()=>{b(DK(s,i,n))},[b,i,n,s]),l.useEffect(()=>{a(Number(r)?Number(r):1)},[r]),B.jsx(Vs,{className:"content-container",children:B.jsx($O,{vertical:!0,justify:"center",align:"center",gap:"middle",style:{width:"fit-content"},children:B.jsxs(rc,{isError:f,isSpinnerActive:h,isEmpty:g,errorElement:B.jsx(ic,{}),loadingElement:B.jsx(ac,{}),emptyElement:B.jsx(oc,{type:"byFilters"}),children:[d&&B.jsx("div",{className:"content-wrap",children:d.map(p=>B.jsx(If,{cardData:p,isDeletable:!1},p.id))}),B.jsx(c0,{showSizeChanger:!1,current:i,onChange:p=>{a(p),o("/search?"+_q(p,n))},total:u*s,pageSize:s,hideOnSinglePage:!0})]})})})}function D1(){return B.jsxs("div",{className:"search-page",children:[B.jsx(Tq,{}),B.jsx(jq,{})]})}const Lq=ml();function zq(){const e=ci(),n=new URLSearchParams(e.search).get("ids"),[r,o]=l.useState(!1),[i,a]=l.useState(""),[s,c]=l.useState(""),[u,d]=l.useState(!1),f=It(x=>x.lists.lists),m=qr(),g=It(x=>x.lists.currListAnimeCards),[b,h]=l.useState(1),[S,p]=l.useState(Lq+2),v=l.useMemo(()=>n?n.split(",").map(x=>Number(x)):[],[n]),y=l.useMemo(()=>v?v.slice((b-1)*S,b*S):[],[v,S,b]),C=l.useCallback(()=>{const x=i.trim(),w=gd(x,Object.keys(f));w.isValid?(d(!1),m(vd(x,v)),o(!1)):(d(!0),c(w.message))},[i,m,v,f]);l.useEffect(()=>{y&&m(oR(y))},[y,m]);const $=l.useCallback(x=>{p(x+2),h(1)},[]);return Of($),B.jsxs(Vs,{className:"content-container",children:[B.jsx($f,{open:r,title:"Save as new list",onCancel:()=>{o(!1),a("")},onOk:C,children:B.jsx(Eo,{open:u,title:s,children:B.jsx(ki,{placeholder:"New list name",value:i,onChange:x=>{const{value:w}=x.target;if(/^[a-zA-Z0-9 ]*$/.test(w)){const O=x.target.value[0].toUpperCase()+x.target.value.substring(1);a(O)}},onKeyDown:x=>x.stopPropagation(),onPressEnter:C})})}),B.jsx(er,{onClick:()=>o(!0),children:"Save shared list"}),B.jsx("div",{className:"content-wrap",children:g&&g.map(x=>B.jsx(If,{cardData:x,isDeletable:!1},x.id))}),B.jsx(c0,{showSizeChanger:!1,current:b,onChange:x=>{h(x)},total:v?v.length:1,pageSize:S,hideOnSinglePage:!0})]})}const Aq=[{key:"/",label:B.jsx(cr,{to:"/",children:"Home"})},{key:"/search",label:B.jsx(cr,{to:"/search",children:"Search"})},{key:"/lists",label:B.jsx(cr,{to:"/lists",children:"My Lists"})},{key:"/random",label:B.jsx(cr,{to:"/random",children:"Random"})}],Fq=[{key:"nav",label:B.jsx(V6,{className:"burger-menu"}),children:[{key:"/",label:B.jsx(cr,{to:"/",children:"Home"})},{key:"/search",label:B.jsx(cr,{to:"/search",children:"Search"})},{key:"/lists",label:B.jsx(cr,{to:"/lists",children:"My Lists"})},{key:"/random",label:B.jsx(cr,{to:"/random",children:"Random"})}]}],Dq=window.matchMedia("(prefers-color-scheme: light)").matches;function Bq(){const[e,t]=l.useState(Dq),[n,r]=l.useState(""),o=qr(),i=Ki(),a=ci(),s=a.pathname.split("/").slice(1).map(f=>({key:f,title:B.jsx(cr,{to:"/"+f,children:f?f[0].toUpperCase()+f.substring(1):null})})),[c,u]=l.useState(window.matchMedia("(max-width: 720px)").matches);l.useEffect(()=>{function f(){u(window.matchMedia("(max-width: 720px)").matches)}return f(),window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}},[]),l.useEffect(()=>{o(aq()),o(nq())},[o]);function d(f){i("/search?q="+f),r("")}return B.jsx(m0.Provider,{value:c,children:B.jsx(fl.Provider,{value:e,children:B.jsx(Zd,{theme:gK(e),children:B.jsxs(w1,{style:{minHeight:"100vh"},children:[B.jsx(Es,{className:"header",children:B.jsxs("div",{className:"header-container",children:[B.jsx(cr,{to:"/",children:B.jsx("h1",{className:"app-title",children:"Anime Universe"})}),B.jsxs("div",{className:"nav",children:[B.jsx(SO.Compact,{size:"middle",className:"search-container",children:B.jsx(ki.Search,{placeholder:"input anime title",value:n,onChange:f=>r(f.target.value),onSearch:d})}),!c&&B.jsx(wn,{className:"nav-menu",mode:"horizontal",theme:"dark",items:Aq,selectedKeys:["/"+a.pathname.split("/")[1]]})]}),c&&B.jsx(wn,{className:"nav-menu",mode:"vertical",theme:"dark",items:Fq,selectedKeys:["/"+a.pathname.split("/")[1]]}),B.jsx(oI,{style:{marginLeft:"20px"},checkedChildren:B.jsx(IL,{}),unCheckedChildren:B.jsx(q6,{}),defaultChecked:e,onChange:()=>t(!e)})]})}),c&&B.jsx(Es,{style:{height:"fit-content",paddingLeft:"15px",paddingTop:"5px",backgroundColor:e?"#f9f9f9":"#001529"},children:B.jsx(T7,{items:s?[{key:"/",title:B.jsx(cr,{to:"/",children:B.jsx(wb,{})})}].concat(s):[{key:"/",title:B.jsx(cr,{to:"/",children:B.jsx(wb,{})})}]})}),B.jsx(w1,{style:{width:"100vw"},children:B.jsxs($T,{children:[B.jsx(co,{path:"/",element:B.jsx(Eq,{})}),B.jsx(co,{path:"/search",element:B.jsx(D1,{})}),B.jsx(co,{path:"/search",element:B.jsx(D1,{})}),B.jsx(co,{path:"/random",element:B.jsx(Mq,{})}),B.jsx(co,{path:"/:id",element:B.jsx(Sq,{})}),B.jsx(co,{path:"/lists",element:B.jsx(F1,{})}),B.jsx(co,{path:"/lists/:listname",element:B.jsx(F1,{})}),B.jsx(co,{path:"/shared",element:B.jsx(zq,{})})]})})]})})})})}const Hq=sN({lists:gq,genres:pq,homeCards:sq,animePage:fq,searchCards:uq}),kq=pw(Hq,uN(fN));eg.createRoot(document.getElementById("root")).render(B.jsx(K.StrictMode,{children:B.jsx(tN,{store:kq,children:B.jsx(TT,{children:B.jsx(Bq,{})})})})); + `]:Object.assign(Object.assign({},l$(e)),{marginInlineStart:e.marginXXS})}),AG(e)),FG(e)),DG()),{"&-rtl":{direction:"rtl"}})}},HG=()=>({titleMarginTop:"1.2em",titleMarginBottom:"0.5em"}),sI=_t("Typography",e=>[BG(e)],HG),kG=e=>{const{prefixCls:t,"aria-label":n,className:r,style:o,direction:i,maxLength:a,autoSize:s=!0,value:c,onSave:u,onCancel:d,onEnd:f,component:m,enterIcon:g=l.createElement(c6,null)}=e,b=l.useRef(null),h=l.useRef(!1),S=l.useRef(),[p,v]=l.useState(c);l.useEffect(()=>{v(c)},[c]),l.useEffect(()=>{if(b.current&&b.current.resizableTextArea){const{textArea:z}=b.current.resizableTextArea;z.focus();const{length:j}=z.value;z.setSelectionRange(j,j)}},[]);const y=z=>{let{target:j}=z;v(j.value.replace(/[\n\r]/g,""))},C=()=>{h.current=!0},$=()=>{h.current=!1},x=z=>{let{keyCode:j}=z;h.current||(S.current=j)},w=()=>{u(p.trim())},E=z=>{let{keyCode:j,ctrlKey:M,altKey:R,metaKey:A,shiftKey:L}=z;S.current===j&&!h.current&&!M&&!R&&!A&&!L&&(j===se.ENTER?(w(),f==null||f()):j===se.ESC&&d())},O=()=>{w()},P=m?`${t}-${m}`:"",[T,N,I]=sI(t),_=V(t,`${t}-edit-content`,{[`${t}-rtl`]:i==="rtl"},r,P,N,I);return T(l.createElement("div",{className:_,style:o},l.createElement(vO,{ref:b,maxLength:a,value:p,onChange:y,onKeyDown:x,onKeyUp:E,onCompositionStart:C,onCompositionEnd:$,onBlur:O,"aria-label":n,rows:1,autoSize:s}),g!==null?Fn(g,{className:`${t}-edit-content-confirm`}):null))},VG=kG;function Km(e,t){return l.useMemo(()=>{const n=!!e;return[n,Object.assign(Object.assign({},t),n&&typeof e=="object"?e:null)]},[e])}const WG=(e,t)=>{const n=l.useRef(!1);l.useEffect(()=>{n.current?e():n.current=!0},t)};var UG=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o{const{prefixCls:n,component:r="article",className:o,rootClassName:i,setContentRef:a,children:s,direction:c,style:u}=e,d=UG(e,["prefixCls","component","className","rootClassName","setContentRef","children","direction","style"]),{getPrefixCls:f,direction:m,typography:g}=l.useContext(Le),b=c??m;let h=t;a&&(h=pr(t,a));const S=f("typography",n),[p,v,y]=sI(S),C=V(S,g==null?void 0:g.className,{[`${S}-rtl`]:b==="rtl"},o,i,v,y),$=Object.assign(Object.assign({},g==null?void 0:g.style),u);return p(l.createElement(r,Object.assign({className:C,style:$,ref:h},d),s))}),cI=GG;function R1(e){return e===!1?[!1,!1]:Array.isArray(e)?e:[e]}function Wc(e,t,n){return e===!0||e===void 0?t:e||n&&t}function KG(e){const{prefixCls:t,copied:n,locale:r={},onCopy:o,iconOnly:i,tooltips:a,icon:s}=e,c=R1(a),u=R1(s),{copied:d,copy:f}=r,m=n?Wc(c[1],d):Wc(c[0],f),b=typeof m=="string"?m:n?d:f;return l.createElement(Eo,{key:"copy",title:m},l.createElement(lI,{className:V(`${t}-copy`,{[`${t}-copy-success`]:n,[`${t}-copy-icon-only`]:i}),onClick:o,"aria-label":b},n?Wc(u[1],l.createElement(F$,null),!0):Wc(u[0],l.createElement(Rj,null),!0)))}const Uc=l.forwardRef((e,t)=>{let{style:n,children:r}=e;const o=l.useRef(null);return l.useImperativeHandle(t,()=>({isExceed:()=>{const i=o.current;return i.scrollHeight>i.clientHeight},getHeight:()=>o.current.clientHeight})),l.createElement("span",{"aria-hidden":!0,ref:o,style:Object.assign({position:"fixed",display:"block",left:0,top:0,pointerEvents:"none",backgroundColor:"rgba(255, 0, 0, 0.65)"},n)},r)});function uI(e){const t=typeof e;return t==="string"||t==="number"}function qG(e){let t=0;return e.forEach(n=>{uI(n)?t+=String(n).length:t+=1}),t}function P1(e,t){let n=0;const r=[];for(let o=0;ot){const u=t-n;return r.push(String(i).slice(0,u)),r}r.push(i),n=c}return e}const qm=0,Xm=1,Ym=2,M1=3,Gc={display:"-webkit-box",overflow:"hidden",WebkitBoxOrient:"vertical"};function XG(e){const{enableMeasure:t,width:n,text:r,children:o,rows:i,miscDeps:a,onEllipsis:s}=e,c=l.useMemo(()=>Pn(r),[r]),u=l.useMemo(()=>qG(c),[r]),d=l.useMemo(()=>o(c,!1,!1),[r]),[f,m]=l.useState(null),g=l.useRef(null),b=l.useRef(null),h=l.useRef(null),S=l.useRef(null),[p,v]=l.useState(qm),[y,C]=l.useState(0);Nt(()=>{v(t&&n&&u?Xm:qm)},[n,r,i,t,c]),Nt(()=>{var E,O,P,T;if(p===Xm){const N=!!(!((E=b.current)===null||E===void 0)&&E.isExceed());v(N?Ym:M1),m(N?[0,u]:null);const I=((O=b.current)===null||O===void 0?void 0:O.getHeight())||0,_=i===1?0:((P=h.current)===null||P===void 0?void 0:P.getHeight())||0,z=((T=S.current)===null||T===void 0?void 0:T.getHeight())||0,j=_+z,M=Math.max(I,j);C(M+1),s(N)}},[p]);const $=f?Math.ceil((f[0]+f[1])/2):0;Nt(()=>{var E;const[O,P]=f||[0,0];if(O!==P){const N=(((E=g.current)===null||E===void 0?void 0:E.getHeight())||0)>y;let I=$;P-O===1&&(I=N?O:P),m(N?[O,I]:[I,P])}},[f,$]);const x=l.useMemo(()=>{if(p!==Ym||!f||f[0]!==f[1]){const E=o(c,!1,!1);return p!==M1&&p!==qm?l.createElement("span",{style:Object.assign(Object.assign({},Gc),{WebkitLineClamp:i})},E):E}return o(P1(c,f[0]),!0,!0)},[p,f,c].concat(Se(a))),w={width:n,whiteSpace:"normal",margin:0,padding:0};return l.createElement(l.Fragment,null,x,p===Xm&&l.createElement(l.Fragment,null,l.createElement(Uc,{style:Object.assign(Object.assign(Object.assign({},w),Gc),{WebkitLineClamp:i}),ref:b},d),l.createElement(Uc,{style:Object.assign(Object.assign(Object.assign({},w),Gc),{WebkitLineClamp:i-1}),ref:h},d),l.createElement(Uc,{style:Object.assign(Object.assign(Object.assign({},w),Gc),{WebkitLineClamp:1}),ref:S},o([],!0,!0))),p===Ym&&f&&f[0]!==f[1]&&l.createElement(Uc,{style:Object.assign(Object.assign({},w),{top:400}),ref:g},o(P1(c,$),!0,!0)))}const YG=e=>{let{enableEllipsis:t,isEllipsis:n,children:r,tooltipProps:o}=e;return!(o!=null&&o.title)||!t?r:l.createElement(Eo,Object.assign({open:n?void 0:!1},o),r)},QG=YG;var ZG=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o{var n,r,o;const{prefixCls:i,className:a,style:s,type:c,disabled:u,children:d,ellipsis:f,editable:m,copyable:g,component:b,title:h}=e,S=ZG(e,["prefixCls","className","style","type","disabled","children","ellipsis","editable","copyable","component","title"]),{getPrefixCls:p,direction:v}=l.useContext(Le),[y]=ui("Text"),C=l.useRef(null),$=l.useRef(null),x=p("typography",i),w=Qt(S,["mark","code","delete","underline","strong","keyboard","italic"]),[E,O]=Km(m),[P,T]=Xt(!1,{value:O.editing}),{triggerType:N=["icon"]}=O,I=ue=>{var Me;ue&&((Me=O.onStart)===null||Me===void 0||Me.call(O)),T(ue)};WG(()=>{var ue;P||(ue=$.current)===null||ue===void 0||ue.focus()},[P]);const _=ue=>{ue==null||ue.preventDefault(),I(!0)},z=ue=>{var Me;(Me=O.onChange)===null||Me===void 0||Me.call(O,ue),I(!1)},j=()=>{var ue;(ue=O.onCancel)===null||ue===void 0||ue.call(O),I(!1)},[M,R]=Km(g),[A,L]=l.useState(!1),F=l.useRef(null),D={};R.format&&(D.format=R.format);const G=()=>{F.current&&clearTimeout(F.current)},Y=ue=>{var Me;ue==null||ue.preventDefault(),ue==null||ue.stopPropagation(),NG(R.text||String(d)||"",D),L(!0),G(),F.current=setTimeout(()=>{L(!1)},3e3),(Me=R.onCopy)===null||Me===void 0||Me.call(R,ue)};l.useEffect(()=>G,[]);const[U,Z]=l.useState(!1),[Q,ne]=l.useState(!1),[oe,te]=l.useState(!1),[q,ie]=l.useState(!1),[le,re]=l.useState(!1),[ee,ve]=l.useState(!0),[de,ce]=Km(f,{expandable:!1}),J=de&&!oe,{rows:ae=1}=ce,me=l.useMemo(()=>!J||ce.suffix!==void 0||ce.onEllipsis||ce.expandable||E||M,[J,ce,E,M]);Nt(()=>{de&&!me&&(Z(Yb("webkitLineClamp")),ne(Yb("textOverflow")))},[me,de]);const pe=l.useMemo(()=>me?!1:ae===1?Q:U,[me,Q,U]),ge=J&&(pe?le:q),Ce=J&&ae===1&&pe,Ie=J&&ae>1&&pe,Re=ue=>{var Me;te(!0),(Me=ce.onExpand)===null||Me===void 0||Me.call(ce,ue)},[Ye,Pe]=l.useState(0),be=ue=>{let{offsetWidth:Me}=ue;Pe(Me)},Oe=ue=>{var Me;ie(ue),q!==ue&&((Me=ce.onEllipsis)===null||Me===void 0||Me.call(ce,ue))};l.useEffect(()=>{const ue=C.current;if(de&&pe&&ue){const Me=Ie?ue.offsetHeight{const ue=C.current;if(typeof IntersectionObserver>"u"||!ue||!pe||!J)return;const Me=new IntersectionObserver(()=>{ve(!!ue.offsetParent)});return Me.observe(ue),()=>{Me.disconnect()}},[pe,J]);let $e={};ce.tooltip===!0?$e={title:(n=O.text)!==null&&n!==void 0?n:d}:l.isValidElement(ce.tooltip)?$e={title:ce.tooltip}:typeof ce.tooltip=="object"?$e=Object.assign({title:(r=O.text)!==null&&r!==void 0?r:d},ce.tooltip):$e={title:ce.tooltip};const Ze=l.useMemo(()=>{const ue=Me=>["string","number"].includes(typeof Me);if(!(!de||pe)){if(ue(O.text))return O.text;if(ue(d))return d;if(ue(h))return h;if(ue($e.title))return $e.title}},[de,pe,h,$e.title,ge]);if(P)return l.createElement(VG,{value:(o=O.text)!==null&&o!==void 0?o:typeof d=="string"?d:"",onSave:z,onCancel:j,onEnd:O.onEnd,prefixCls:x,className:a,style:s,direction:v,component:b,maxLength:O.maxLength,autoSize:O.autoSize,enterIcon:O.enterIcon});const ot=()=>{const{expandable:ue,symbol:Me}=ce;if(!ue)return null;let nt;return Me?nt=Me:nt=y==null?void 0:y.expand,l.createElement("a",{key:"expand",className:`${x}-expand`,onClick:Re,"aria-label":y==null?void 0:y.expand},nt)},tt=()=>{if(!E)return;const{icon:ue,tooltip:Me}=O,nt=Pn(Me)[0]||(y==null?void 0:y.edit),vt=typeof nt=="string"?nt:"";return N.includes("icon")?l.createElement(Eo,{key:"edit",title:Me===!1?"":nt},l.createElement(lI,{ref:$,className:`${x}-edit`,onClick:_,"aria-label":vt},ue||l.createElement(e6,{role:"button"}))):null},lt=()=>M?l.createElement(KG,Object.assign({key:"copy"},R,{prefixCls:x,copied:A,locale:y,onCopy:Y,iconOnly:d==null})):null,Je=ue=>[ue&&ot(),tt(),lt()],Ge=ue=>[ue&&l.createElement("span",{"aria-hidden":!0,key:"ellipsis"},eK),ce.suffix,Je(ue)];return l.createElement(Or,{onResize:be,disabled:!J},ue=>l.createElement(QG,{tooltipProps:$e,enableEllipsis:J,isEllipsis:ge},l.createElement(cI,Object.assign({className:V({[`${x}-${c}`]:c,[`${x}-disabled`]:u,[`${x}-ellipsis`]:de,[`${x}-single-line`]:J&&ae===1,[`${x}-ellipsis-single-line`]:Ce,[`${x}-ellipsis-multiple-line`]:Ie},a),prefixCls:i,style:Object.assign(Object.assign({},s),{WebkitLineClamp:Ie?ae:void 0}),component:b,ref:pr(ue,C,t),direction:v,onClick:N.includes("text")?_:void 0,"aria-label":Ze==null?void 0:Ze.toString(),title:h},w),l.createElement(XG,{enableMeasure:J&&!pe,text:d,rows:ae,width:Ye,onEllipsis:Oe,miscDeps:[A,oe]},(Me,nt)=>{let vt=Me;return Me.length&&nt&&Ze&&(vt=l.createElement("span",{key:"show-content","aria-hidden":!0},vt)),JG(e,l.createElement(l.Fragment,null,vt,Ge(nt)))}))))}),Ef=tK;var nK=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o{var{ellipsis:n,rel:r}=e,o=nK(e,["ellipsis","rel"]);const i=Object.assign(Object.assign({},o),{rel:r===void 0&&o.target==="_blank"?"noopener noreferrer":r});return delete i.navigate,l.createElement(Ef,Object.assign({},i,{ref:t,ellipsis:!!n,component:"a"}))}),oK=rK,iK=l.forwardRef((e,t)=>l.createElement(Ef,Object.assign({ref:t},e,{component:"div"}))),dI=iK;var aK=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o{var{ellipsis:n}=e,r=aK(e,["ellipsis"]);const o=l.useMemo(()=>n&&typeof n=="object"?Qt(n,["expandable","rows"]):n,[n]);return l.createElement(Ef,Object.assign({ref:t},r,{ellipsis:o,component:"span"}))},sK=l.forwardRef(lK);var cK=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o{const{level:n=1}=e,r=cK(e,["level"]);let o;return uK.includes(n)?o=`h${n}`:o="h1",l.createElement(Ef,Object.assign({ref:t},r,{component:o}))}),fK=dK,tc=cI;tc.Text=sK;tc.Link=oK;tc.Title=fK;tc.Paragraph=dI;const mK=tc;function gK(e){return{token:{colorPrimary:"#d29ada",colorSuccess:"#8ae1c0",colorWarning:"#f7c180",colorError:"#fa8788",borderRadius:9,colorBgBase:e?"#f9f9f9":"#26272d",colorLink:"#d29ada",colorLinkHover:"#F593F5",colorTextSecondary:e?"rgba(0, 0, 0, 0.75)":"rgba(255, 255, 255, 0.45)",colorTextPlaceholder:e?"rgba(0, 0, 0, 0.25)":"rgba(220, 186, 224, 0.6)",colorText:e?"#000000":"rgba(255, 255, 255, 0.65)",colorTextHeading:e?"#000":"#E4DEE4",colorTextDescription:e?"rgba(0, 0, 0, 0.45)":"#B7A6B3"},components:{Switch:{trackMinWidth:60},Descriptions:{colorSplit:e?"rgba(5, 5, 5, 0.06)":"rgba(255, 255, 255, 0.25)",titleColor:e?"#000000":"rgba(255, 255, 255, 0.65)",contentColor:e?"#000000":"rgba(255, 255, 255, 0.65)",extraColor:e?"#000000":"rgba(255, 255, 255, 0.65)",labelBg:"rgba(210, 154, 218, 0.1)"}}}}const md=[{key:"g",label:"G - All Ages",color:"green",darkcolor:"#87d068",shortlabel:"G"},{key:"pg",label:"PG - Children",color:"green",darkcolor:"#87d068",shortlabel:"PG"},{key:"pg13",label:"PG-13 - Teens 13 or older",color:"gold",darkcolor:"#e0a502",shortlabel:"PG-13"},{key:"r17",label:"R - 17+ (violence & profanity)",color:"volcano",darkcolor:"#e05302",shortlabel:"R-17"},{key:"r",label:"R+ - Mild Nudity",color:"volcano",darkcolor:"#e05302",shortlabel:"R+"},{key:"rx",label:"Rx - Hentai",color:"red",darkcolor:"#e81b00",shortlabel:"Rx"}],vK=md.reduce((e,t)=>({...e,[t.label]:t}),{}),fl=l.createContext(!1),m0=l.createContext(!1),fI={order_by:"score",isAscending:!1,searchword:null,rating:null,genres:[],genres_exclude:[],status:null},mI=e=>({label:e.name,key:e.mal_id});function gI(e){return{cardTitle:e.title_english,japTitle:e.title,rating:e.rating,genres:e.genres.map(t=>mI(t)),id:e.mal_id,img:e.images.jpg.large_image_url,episodes:e.episodes,year:e.year,synopsis:e.synopsis,status:e.status,score:e.score,trailer:e.trailer.url,studios:e.studios.map(t=>t.name),themes:e.themes.map(t=>t.name),music:{openings:e.theme.openings,endings:e.theme.endings},related:e.relations.filter(t=>t.relation!=="Adaptation").map(t=>({relation:t.relation,entry:t.entry.map(n=>({id:n.mal_id,title:n.name}))}))}}const vI=e=>({titleEnglish:e.title_english,id:e.mal_id,titleOrig:e.title,genres:e.genres.map(t=>({name:t.name,id:t.mal_id})),img:e.images.jpg.large_image_url,rating:e.rating});function pK(e){let t=e.searchword;return typeof t>"u"&&(t=null),[{name:["genres"],value:e.genres.map(n=>Number(n))},{name:["genres_exclude"],value:e.genres_exclude.map(n=>Number(n))},{name:["order_by"],value:e.order_by},{name:["isAscending"],value:e.isAscending},{name:["searchword"],value:t},{name:["status"],value:e.status},{name:["rating"],value:e.rating}]}function hK(e){let t="";if(e.genres[0]){const n=e.genres.join(",");t=t+"&genres="+n}if(e.genres_exclude[0]){const n=e.genres_exclude.join(",");t=t+"&genres_exclude="+n}return e.isAscending?t=t+"&sort=asc":t=t+"&sort=desc",e.order_by&&(t=t+"&order_by="+e.order_by),e.searchword&&(t=t+"&q="+e.searchword),e.rating&&(t=t+"&rating="+e.rating),e.status&&(t=t+"&status="+e.status),t}function yK(e){const t={...fI};if(e){const n=e.get("genres");n&&(t.genres=n==null?void 0:n.split(","));const r=e.get("genres_exclude");r&&(t.genres_exclude=r.split(","));const o=e.get("order_by");o&&(t.order_by=o),e.get("sort=")==="asc"&&(t.isAscending=!0);const a=e.get("rating");a&&(t.rating=a);const s=e.get("status");s&&(t.status=s);const c=e.get("q");c&&(t.searchword=c)}return t}function bK(e){let t=window.location.pathname;const n=t.indexOf("/lists");return n!==-1&&(t=t.substring(0,n)),t=t+"/shared",window.location.protocol+"//"+window.location.host+t+"?ids="+e.join(",")}const T1="https://corsproxy.io/?https://api.jikan.moe/v4/anime?limit=";function SK(e,t){return t?T1+e+"&"+t:T1+e}const CK="https://corsproxy.io/?https://api.jikan.moe/v4/anime/";function g0(e){return CK+e+"/full"}const N1="https://corsproxy.io/?https://api.jikan.moe/v4/top/anime?limit=",xK="https://corsproxy.io/?https://api.jikan.moe/v4/anime?order_by=popularity&limit=";function pI(e,t=1,n=1){if(e){if(e.genre)return xK+t+"&genres="+e.genre+"&page="+n;if(e.rating)return N1+t+"&rating="+e.rating+"&page="+n}return N1+t+"&page="+n}function wK(e,t){if(t){const n=t.indexOf("page=");if(n>=0){const r=t.indexOf("&",n);return r>n+5?t.substring(0,n+5)+e+t.substring(r):t.substring(0,n+5)+e}else return t+"&page="+e}else return"page="+e}function $K(e,t){const n=[{key:"title",label:"Original title",children:e.japTitle,span:{sm:1,md:2,lg:2,xl:2,xxl:2}},{key:"year",label:"Year",children:e.year,span:{md:1,lg:2,xl:1,xxl:1}},{key:"episodes",label:"Episodes",children:e.episodes,span:{md:1,lg:2,xl:1,xxl:1}},{key:"rating",label:"Rating",children:t.rating,span:{md:2,lg:2,xl:2,xxl:2}}];return e.genres.length>0&&n.push({key:"genres",label:"Genres",children:t.genres,span:{md:2,lg:2,xl:2,xxl:3}}),e.themes.length>0&&n.push({key:"themes",label:"Themes",children:e.themes.join(", "),span:{md:2,lg:2,xl:2,xxl:3}}),e.synopsis&&n.push({key:"synopsis",label:"Synopsis",children:t.synopsis,span:{md:2,lg:2,xl:2,xxl:3}}),e.studios.length>0&&n.push({key:"studios",label:"Studios",children:e.studios.join(", "),span:{md:2,lg:2,xl:2,xxl:3}}),n.push({key:"lists",label:"Lists",children:t.lists,span:{md:2,lg:2,xl:2,xxl:3}}),n}function ml(){return window.matchMedia("(min-width: 1841px)").matches?14:window.matchMedia("(min-width: 1581px)").matches?12:window.matchMedia("(min-width: 1401px)").matches?10:window.matchMedia("(min-width: 1131px)").matches?8:6}function hI(e){const t=e.reduce((n,r)=>({...n,[r.mal_id]:!0}),{});return e.filter(n=>t[n.mal_id]?(t[n.mal_id]=!1,!0):!1)}function _1(e){switch(e){case"Finished Airing":return"success";case"Currently Airing":return"processing";case"Not yet aired":return"warning";case"G - All Ages":return"processing";case"PG - Children":return"processing";case"PG-13 - Teens 13 or older":return"success";case"R - 17+ (violence & profanity)":return"warning";case"R+ - Mild Nudity":return"warning";case"Rx - Hentai":return"error";default:return"default"}}function gd(e,t){return e===""?{isValid:!1,message:"Please, write a list name"}:t.includes(e)?{isValid:!1,message:"This list already exists"}:{isValid:!0,message:""}}async function v0(e){const n=await(await fetch(e)).json(),r=n.pagination.last_visible_page,o=hI(n.data);return{data:o,isFiltered:n.data.length>o.length,totalPages:r}}async function p0(e){const t=await fetch(e);return t.status===404?null:(await t.json()).data}async function EK(e,t,n,r,o){let i;e instanceof Array?i=e.slice(0):i=[];let a=n;for(;r-i.length>0&&o>a;){a+=1;const s=r-i.length,c=wK(a,t),{data:u}=await v0(c);i=i.concat(u.slice(0,s)),i=hI(i)}return i}const yI="FETCH_ANIME_PAGE_REQUEST",bI="FETCH_ANIME_PAGE_SUCCESS",SI="FETCH_ANIME_PAGE_FAILURE",CI="FETCH_ANIME_PAGE_EMPTY",xI=()=>({type:yI}),wI=e=>({type:bI,payload:e}),$I=()=>({type:SI}),EI=()=>({type:CI});function OK(e){return async t=>{t(xI());try{const n=await p0(e);if(!n)t(EI());else{const r=gI(n);t(wI(r))}}catch{t($I())}}}function Qm(){return async t=>{t(xI());try{const n=pI(),i=(await(await fetch(n)).json()).pagination.last_visible_page,a=Math.floor(Math.random()*i),s=n+"&page="+a,c=await v0(s);if(!c)t(EI());else{const u=c.data,d=await p0(g0(u[0].mal_id));if(d){const f=gI(d);t(wI(f))}}}catch{t($I())}}}const IK=ml();function Of(e){const[t,n]=l.useState(IK);l.useEffect(()=>{function r(){const o=ml();n(o)}return r(),window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}},[]),l.useEffect(()=>{e(t)},[t,e])}const It=qT,OI="FETCH_HOME_CARDS_DATA_REQUEST",II="FETCH_HOME_CARDS_DATA_SUCCESS",RI="FETCH_HOME_CARDS_DATA_FAILURE",PI="FETCH_HOME_CARDS_DATA_EMPTY",MI="CLEAR_HOME_FILTERS",TI="SET_GENRE_TO_HOME_FILTERS",NI="SET_RATING_TO_HOME_FILTERS",RK=()=>({type:OI}),PK=(e,t)=>({type:II,payload:{data:e,totalPages:t}}),MK=()=>({type:RI}),TK=()=>({type:PI}),_I=()=>({type:MI}),NK=e=>({type:TI,payload:e}),_K=e=>({type:NI,payload:e});function jI(e,t=1,n=1,r,o,i,a){return async s=>{s(r());try{const c=await v0(e);if(!c.data[0])s(a());else{const u=c.data,d=c.totalPages;let f=[];c.isFiltered&&d>t?f=await EK(u,e,t,n,d):f=u;const m=f.map(vI);s(o(m,d))}}catch{s(i())}}}function jK(e,t=1,n=1){const r=pI(e,n,t);return jI(r,t,n,RK,PK,MK,TK)}const LI="FETCH_SEARCH_CARDS_DATA_REQUEST",zI="FETCH_SEARCH_CARDS_DATA_SUCCESS",AI="FETCH_SEARCH_CARDS_DATA_FAILURE",FI="FETCH_SEARCH_CARDS_DATA_EMPTY",LK=()=>({type:LI}),zK=(e,t)=>({type:zI,payload:{data:e,totalPages:t}}),AK=()=>({type:AI}),FK=()=>({type:FI});function DK(e,t,n){const r=SK(e,n);return jI(r,t,e,LK,zK,AK,FK)}const DI="FETCH_LISTS_REQUEST",BI="FETCH_LISTS_SUCCESS",HI="FETCH_LISTS_FAILURE",kI="POST_NEW_LIST_REQUEST",VI="POST_NEW_LIST_SUCCESS",WI="POST_NEW_LIST_FAILURE",UI="POST_NEW_ITEM_TO_LIST_REQUEST",GI="POST_NEW_ITEM_TO_LIST_SUCCESS",KI="POST_NEW_ITEM_TO_LIST_FAILURE",qI="DELETE_LIST_REQUEST",XI="DELETE_LIST_SUCCESS",YI="DELETE_LIST_FAILURE",QI="DELETE_ITEM_FROM_LIST_REQUEST",ZI="DELETE_ITEM_FROM_LIST_SUCCESS",JI="DELETE_ITEM_FROM_LIST_FAILURE",eR="FETCH_LIST_ANIMES_REQUEST",tR="FETCH_LIST_ANIMES_SUCCESS",nR="FETCH_LIST_ANIMES_EMPTY",rR="FETCH_LIST_ANIMES_FAILURE",BK=()=>({type:eR}),HK=e=>({type:tR,payload:e}),kK=()=>({type:nR}),VK=()=>({type:rR}),WK=()=>({type:kI}),UK=(e,t)=>({type:VI,payload:{listName:e,value:t}}),j1=()=>({type:WI}),GK=()=>({type:UI}),KK=(e,t)=>({type:GI,payload:{listName:e,newId:t}}),Zm=()=>({type:KI}),qK=()=>({type:DI}),XK=e=>({type:BI,payload:e}),L1=()=>({type:HI}),YK=()=>({type:qI}),QK=e=>({type:XI,payload:e}),z1=()=>({type:YI}),ZK=()=>({type:QI}),JK=(e,t)=>({type:ZI,payload:{listName:e,animeId:t}}),Jm=()=>({type:JI});function oR(e){return async t=>{if(t(BK()),e.length)try{const n=[];for(const r of e){const o=g0(r),i=await p0(o);if(i){const a=vI(i);n.push(a)}}t(HK(n))}catch{t(VK())}else t(kK())}}function nc(){return new Promise((e,t)=>{const n=indexedDB.open("animeUniverse",1);n.onupgradeneeded=function(r){const o=r.target.result;o.objectStoreNames.contains("lists")||o.createObjectStore("lists")},n.onsuccess=function(r){e(r.target.result)},n.onerror=function(r){t(r.target.error)}})}function vd(e,t){return async n=>{n(WK());try{const i=(await nc()).transaction("lists","readwrite").objectStore("lists");let a=[];t&&(a=[...t]);const s=i.add(a,e);s.onsuccess=()=>{n(UK(e,a))},s.onerror=()=>{n(j1())}}catch{n(j1())}}}function eq(e,t){return async n=>{n(GK());try{const i=(await nc()).transaction("lists","readwrite").objectStore("lists"),a=i.get(e);a.onsuccess=s=>{const c=s.target.result;c.push(t);const u=i.put(c,e);u.onsuccess=()=>{n(KK(e,t))},u.onerror=()=>{n(Zm())}},a.onerror=()=>{n(Zm())}}catch{n(Zm())}}}function tq(e){return async t=>{t(YK());try{const i=(await nc()).transaction("lists","readwrite").objectStore("lists").delete(e);i.onsuccess=()=>{t(QK(e))},i.onerror=()=>{t(z1())}}catch{t(z1())}}}function iR(e,t){return async n=>{n(ZK());try{const i=(await nc()).transaction("lists","readwrite").objectStore("lists"),a=i.get(e);a.onsuccess=s=>{const c=s.target.result;let u=[];c&&c.length>0&&(u=c.filter(f=>f!==t));const d=i.put(u,e);d.onsuccess=()=>{n(JK(e,t))},d.onerror=()=>{n(Jm())}},a.onerror=()=>{n(Jm())}}catch{n(Jm())}}}function nq(){return async e=>{e(qK());try{const o=(await nc()).transaction("lists","readonly").objectStore("lists").openCursor(),i={};o.onsuccess=function(a){const s=a.target.result;s?(i[s.key]=s.value,s.continue()):e(XK(i))},o.onerror=function(){e(L1())}}catch{e(L1())}}}const aR="FETCH_GENRES_SUCCESS",lR="FETCH_GENRES_FAILURE",sR="FETCH_GENRES_REQUEST",rq=()=>({type:sR}),oq=e=>({type:aR,payload:e}),iq=()=>({type:lR});function aq(){return async e=>{try{e(rq());const t=await fetch("https://corsproxy.io/?https://api.jikan.moe/v4/genres/anime"),{data:n}=await t.json();e(oq(n.map(mI)))}catch{e(iq())}}}const lq={data:null,isLoading:!1,isError:!1,isEmpty:!1,currPage:1,totalPages:1,filters:{rating:null,genre:null}},sq=(e=lq,t)=>{switch(t.type){case OI:return{...e,isLoading:!0,isError:!1,isEmpty:!1};case II:return{...e,isLoading:!1,data:t.payload.data,totalPages:t.payload.totalPages};case RI:return{...e,isLoading:!1,isError:!0};case PI:return{...e,isLoading:!1,isError:!1,isEmpty:!0};case MI:return{...e,filters:{rating:null,genre:null}};case TI:return{...e,filters:{rating:null,genre:t.payload}};case NI:return{...e,filters:{rating:t.payload,genre:null}};default:return e}},cq={data:null,isLoading:!1,isError:!1,isEmpty:!1,currPage:1,totalPages:1},uq=(e=cq,t)=>{switch(t.type){case LI:return{...e,isLoading:!0,isError:!1,isEmpty:!1};case zI:return{...e,isLoading:!1,data:t.payload.data,totalPages:t.payload.totalPages};case AI:return{...e,isLoading:!1,isError:!0};case FI:return{...e,isLoading:!1,isError:!1,isEmpty:!0};default:return e}},dq={data:null,isLoading:!1,isError:!1,isEmpty:!1},fq=(e=dq,t)=>{switch(t.type){case yI:return{...e,isLoading:!0,isError:!1,isEmpty:!1};case bI:return{...e,isLoading:!1,data:t.payload};case SI:return{...e,isLoading:!1,isError:!0};case CI:return{...e,isLoading:!1,isEmpty:!0};default:return e}},mq={lists:{},currListAnimeCards:[],isListsLoading:!1,isListsError:!1,isCardsDataLoading:!1,isCardsDataError:!1,isCardsDataEmpty:!1,isPostingLists:!1,isPostingError:!1},gq=(e=mq,t)=>{switch(t.type){case DI:return{...e,isListsLoading:!0,isListsError:!1};case BI:return{...e,isListsLoading:!1,lists:t.payload};case HI:return{...e,isListsLoading:!1,isListsError:!0};case kI:case qI:case UI:case QI:return{...e,isListsLoading:!0,isListsError:!1};case VI:return{...e,isListsLoading:!1,lists:{...e.lists,[t.payload.listName]:t.payload.value}};case XI:{const n={...e.lists};return delete n[t.payload],{...e,isListsLoading:!1,lists:n}}case GI:return{...e,isListsLoading:!1,lists:{...e.lists,[t.payload.listName]:[...e.lists[t.payload.listName],t.payload.newId]}};case ZI:return{...e,isListsLoading:!1,lists:{...e.lists,[t.payload.listName]:[...e.lists[t.payload.listName].filter(n=>n!==t.payload.animeId)]}};case WI:case YI:case KI:case JI:return{...e,isListsLoading:!1,isListsError:!0};case eR:return{...e,isCardsDataLoading:!0,isCardsDataError:!1,isCardsDataEmpty:!1};case tR:return{...e,isCardsDataLoading:!1,currListAnimeCards:t.payload};case nR:return{...e,isCardsDataLoading:!1,currListAnimeCards:[],isCardsDataEmpty:!0};case rR:return{...e,isCardsDataLoading:!1,isCardsDataError:!0};default:return e}},vq={genres:[],isLoading:!1,isError:!1},pq=(e=vq,t)=>{switch(t.type){case sR:return{...e,isLoading:!0,isError:!1};case aR:return{...e,isLoading:!1,genres:t.payload};case lR:return{...e,isLoading:!1,isError:!0};default:return e}};function cR({isBigCard:e,animeId:t}){const n=qr(),[r,o]=l.useState([]),i=It(v=>v.lists.lists),a=It(v=>v.lists.isListsLoading),[s,c]=l.useState(["list1"]),[u,d]=l.useState(""),[f,m]=l.useState(!1),[g,b]=l.useState("Please, write a list name"),h=l.useRef(null),S=v=>{const{value:y}=v.target;/^[a-zA-Z0-9 ]*$/.test(y)?(d(y),m(!1)):(m(!0),b("a-z A-Z 0-9 symbols only"),setTimeout(()=>m(!1),2e3))},p=v=>{v.preventDefault();const y=u.trim(),C=gd(y,s);C.isValid?(m(!1),c([...s].splice(0,1,"add",y)),n(vd(y,[t]))):(m(!0),b(C.message))};return l.useEffect(()=>{const v=Object.keys(i);v.length>0?c(v):c([])},[i,t]),l.useEffect(()=>{const v=s.filter(y=>{var C;return Array.isArray(i[y])?(C=i[y])==null?void 0:C.includes(t):!1});o(v)},[s,t,i]),l.useEffect(()=>{function v(y){h.current!==y.target&&m(!1)}return document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[h]),B.jsx(qn,{disabled:a,className:e?"add-to-list-select add-to-list-select-right":"add-to-list-select",ref:h.current,placeholder:"+ Add to list",onChange:v=>{o(v)},onSelect:v=>n(eq(v,t)),onDeselect:v=>n(iR(v,t)),mode:"multiple",maxTagCount:"responsive",showSearch:!1,value:r,dropdownRender:v=>B.jsxs(B.Fragment,{children:[v,B.jsx(Gk,{style:{margin:"8px 0"}}),B.jsxs(SO,{children:[B.jsx(Eo,{open:f,title:g,children:B.jsx(ki,{placeholder:"New list name",value:u,onChange:y=>S(y),onKeyDown:y=>y.stopPropagation(),onPressEnter:y=>{p(y)}})}),B.jsx(er,{type:"text",icon:B.jsx(U$,{}),onClick:y=>p(y)})]})]}),options:s.map(v=>({value:v,label:v,key:v}))})}function uR({data:e}){const t=l.useContext(fl),n=Ki(),r=$K(e,{rating:B.jsx(_m,{status:_1(e.rating),text:e.rating}),genres:e.genres.map(o=>B.jsx(er,{title:"Go to "+o.label,onClick:()=>{n("/search?genres="+o.key)},children:o.label},o.key)),lists:B.jsx(cR,{isBigCard:!0,animeId:e.id}),synopsis:B.jsx(dI,{ellipsis:{expandable:!0,rows:2},children:e.synopsis})});return B.jsxs("div",{className:"anime-big-card-container",children:[B.jsx(_m,{status:_1(e.status),text:e.status,style:{position:"absolute",top:"2vw",right:"2vw"}}),B.jsxs("div",{className:"anime-big-card",children:[B.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"20px"},children:[B.jsx(_m,{count:e.score,children:B.jsx(yU,{src:e.img,alt:e.cardTitle,width:"20vw"})}),e.trailer&&B.jsxs(mK.Link,{href:e.trailer,target:"_blank",children:[B.jsx(zL,{})," Watch trailer"]})]}),B.jsx(kV,{bordered:!0,title:e.cardTitle,items:r,className:"descriptions",column:{sm:1,md:2,lg:2,xl:2,xxl:3}})]}),B.jsxs("div",{className:t?"anime-big-card-extra":"anime-big-card-extra light-text",children:[e.related.length>0&&B.jsxs("ul",{children:[B.jsx("h3",{children:"Related Titles"}),e.related.map(o=>B.jsxs("ul",{children:[B.jsx("h4",{children:o.relation}),o.entry.map(i=>B.jsx("li",{children:B.jsx(cr,{to:`/${i.id}`,children:i.title})},i.id))]},o.relation))]}),(e.music.openings.length>0||e.music.endings.length>0)&&B.jsxs("ul",{children:[B.jsx("h3",{children:"Music"}),e.music.openings&&B.jsxs("ul",{children:[B.jsx("h4",{children:"Openings"}),e.music.openings.map(o=>B.jsx("li",{children:o},o))]}),e.music.endings&&B.jsxs("ul",{children:[B.jsx("h4",{children:"Endings"}),e.music.endings.map(o=>B.jsx("li",{children:o},o))]})]})]})]})}const{Meta:hq}=sO;function If({cardData:e,isDeletable:t}){const n=qr(),r=Ki(),o=l.useRef(null),[i,a]=l.useState(!1),s=l.useContext(fl),c=vK[e.rating],{listname:u}=jd();let d="Are you sure you want to delete ";if(t){const f=e.titleEnglish;!f||f!==""?d=d+f+" from ":d=d+"this anime from ",u&&u.includes("list")?d=d+u:d=d+u+" list"}return B.jsxs(sO,{className:"anime-card",cover:B.jsxs("div",{className:"poster-container",title:"Show more info",onClick:()=>{r("/"+e.id)},children:[c&&B.jsx(Gm,{color:s?c.color:c.darkcolor,className:"anime-card-tag",children:c.shortlabel}),B.jsxs("div",{className:"poster-addition",children:[B.jsx(G$,{className:"poster-icon"}),B.jsx("p",{children:"Show more info"})]}),B.jsx("img",{className:"poster",alt:e.titleEnglish,src:e.img,style:{width:"inherit"}})]}),children:[u&&t&&B.jsx($f,{open:i,title:d,onOk:()=>{n(iR(u,e.id)),a(!1)},onCancel:()=>a(!1)}),t&&B.jsx(Gm,{title:"remove from list",className:"delete-button",onClick:()=>a(!0),children:B.jsx(D$,{})}),B.jsx(hq,{title:e.titleEnglish,description:e.titleOrig,className:"anime-card-title"}),B.jsx("div",{className:"anime-card-tags-container",ref:o,children:e.genres.map(f=>B.jsx(Gm,{color:s?"magenta":"#d29ada",title:"Go to "+f.name,onClick:()=>{r("/search?genres="+f.id)},style:{cursor:"pointer"},children:f.name},f.id))}),B.jsx(cR,{isBigCard:!1,animeId:e.id})]})}function rc({isError:e,isSpinnerActive:t,isEmpty:n,errorElement:r,loadingElement:o,emptyElement:i,children:a}){return n?i:e?r:t?o:a}function oc({type:e}){let t="";switch(e){case"byFilters":t="Sorry, there're no animes with these parametres";break;case"byId":t="This page doesn't exist";break;case"byList":t="This list is empty";break;case"noList":t="Choose a list to see saved animes";break;default:t="Empty page"}return B.jsxs("div",{className:"icon-container",children:[e!=="noList"&&B.jsx(V$,{className:"icon"}),B.jsx("p",{className:"icon-message",children:t})]})}function ic({children:e}){return B.jsxs("div",{className:"icon-container",children:[B.jsx(V$,{className:"icon"}),B.jsx("p",{className:"icon-message",children:"Oops, something went wrong"}),e]})}function ac(){return B.jsx("div",{className:"icon-container",children:B.jsx(ol,{className:"icon"})})}function yq(){return B.jsx(wn.Item,{style:{padding:0},disabled:!0,children:B.jsx(L8,{type:"error",showIcon:!0,message:"Couldn't get genres"})},"error")}function bq(){return B.jsx(wn.Item,{children:B.jsx(ol,{})},"loading")}function Sq(){const{id:e}=jd(),t=qr(),n=It(a=>a.animePage.data),r=It(a=>a.animePage.isLoading),o=It(a=>a.animePage.isError),i=It(a=>a.animePage.isEmpty);return l.useEffect(()=>{const a=g0(Number(e));t(OK(a))},[t,e]),B.jsx("div",{className:"random-container",children:B.jsx(rc,{isError:o,isSpinnerActive:r,isEmpty:i,errorElement:B.jsx(ic,{}),loadingElement:B.jsx(ac,{}),emptyElement:B.jsx(oc,{type:"byId"}),children:n&&B.jsx(uR,{data:n})})})}const Cq=["rating","genres"];function xq(){const e=It(f=>f.genres.isLoading),t=It(f=>f.genres.isError),n=It(f=>f.genres.genres),r=l.useContext(fl),o=l.useContext(m0),[i,a]=l.useState(o?[]:["rating"]),s=qr(),c=f=>{const m=f.find(g=>i.indexOf(g)===-1);m&&Cq.indexOf(m)===-1?a(f):a(m?[m]:[])},u=({key:f,keyPath:m})=>{m.includes("rating")?s(_K(f)):m.includes("genres")?s(NK(f)):(s(_I()),a([]))};let d=null;return t?d=B.jsx(yq,{}):e?d=B.jsx(bq,{}):d=n.map(f=>B.jsx(wn.Item,{children:f.label},f.key)),B.jsxs(B.Fragment,{children:[!o&&B.jsx(nf,{className:"home-sider",theme:r?"light":"dark",children:B.jsxs(wn,{mode:"inline",theme:r?"light":"dark",onOpenChange:c,onClick:u,openKeys:i,defaultOpenKeys:i,defaultSelectedKeys:["clear"],children:[B.jsx(wn.Item,{children:"No filters"},"clear"),B.jsx(wn.SubMenu,{title:"Rating",children:md.map(f=>B.jsx(wn.Item,{children:f.label},f.key))},"rating"),B.jsx(wn.SubMenu,{title:"Genres",children:d},"genres")]})}),o&&B.jsx(Es,{style:{padding:0},children:B.jsxs(wn,{mode:"horizontal",theme:r?"light":"dark",onOpenChange:c,onClick:u,openKeys:i,defaultOpenKeys:i,defaultSelectedKeys:["clear"],children:[B.jsx(wn.Item,{children:"No filters"},"clear"),B.jsx(wn.SubMenu,{title:"Rating",children:md.map(f=>B.jsx(wn.Item,{children:f.label},f.key))},"rating"),B.jsx(wn.SubMenu,{title:"Genres",children:d},"genres")]})})]})}const wq=ml();function $q(){const[e,t]=l.useState(wq),n=qr(),r=It(d=>d.homeCards.data),o=It(d=>d.homeCards.filters),i=It(d=>d.homeCards.isLoading),a=It(d=>d.homeCards.isError),s=i||!r,c=!1,u=l.useCallback(d=>t(d),[]);return Of(u),l.useEffect(()=>{n(jK(o,1,e))},[e,n,o]),l.useEffect(()=>{n(_I())},[n]),B.jsx(Vs,{className:"content-container",children:B.jsx("div",{className:"content-wrap",children:B.jsx(rc,{isError:a,isSpinnerActive:s,isEmpty:c,errorElement:B.jsx(ic,{}),loadingElement:B.jsx(ac,{}),emptyElement:B.jsx(oc,{type:"byFilters"}),children:r&&r.map(d=>B.jsx(If,{cardData:d,isDeletable:!1},d.id))})})})}function Eq(){return B.jsxs(B.Fragment,{children:[B.jsx(xq,{}),B.jsx($q,{})]})}function A1(e){if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(e).catch(function(t){console.error("Could not copy text: ",t)});{const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.width="2em",t.style.height="2em",t.style.padding="0",t.style.border="none",t.style.outline="none",t.style.boxShadow="none",t.style.background="transparent",document.body.appendChild(t),t.focus(),t.select();try{document.execCommand("copy")}catch(n){console.error("Unable to copy",n)}document.body.removeChild(t)}}const Oq=ml();function Iq(){const{listname:e}=jd(),t=qr(),n=It(v=>v.lists.isCardsDataError),r=It(v=>v.lists.isCardsDataLoading),o=It(v=>v.lists.isCardsDataEmpty),i=It(v=>v.lists.currListAnimeCards),a=!i||r,s=It(v=>v.lists.lists),[c,u]=l.useState(1),[d,f]=l.useState(Oq),m=l.useMemo(()=>e&&s[e]&&s[e].length>0?s[e]:[],[e,s]),g=l.useMemo(()=>bK(m),[m]),b=l.useMemo(()=>e&&s[e]&&s[e].length>0?Math.ceil(s[e].length/d):1,[s,e,d]),[h,S]=l.useState(!1);l.useLayoutEffect(()=>{let v=[];if(m.length&&(v=[...m]),m.length>d){const y=(c-1)*d,C=y+d;v=[...m].slice(y,C)}t(oR(v))},[m,c,d,t]);const p=l.useCallback(v=>{f(v),u(1)},[]);return Of(p),B.jsx(Vs,{className:"content-container",children:B.jsx($O,{vertical:!0,justify:"center",align:"center",gap:"middle",children:B.jsxs(rc,{isError:n,isSpinnerActive:a,isEmpty:o||i.length<0,errorElement:B.jsx(ic,{}),loadingElement:B.jsx(ac,{}),emptyElement:B.jsx(oc,{type:e?"byList":"noList"}),children:[B.jsx("div",{className:"content-wrap",children:i.map(v=>B.jsx(If,{cardData:v,isDeletable:!0},v.id))}),B.jsx(c0,{showSizeChanger:!1,current:c,onChange:v=>{u(v)},total:b*d,pageSize:d,hideOnSinglePage:!0}),B.jsx(er,{onClick:()=>{S(!0)},children:"Share list"}),B.jsxs($f,{open:h,onOk:()=>{A1(g),S(!1)},onCancel:()=>{S(!1)},okText:"Copy link",closable:!1,style:{display:"flex",flexDirection:"column",alignItems:"center",top:"30vh"},children:[B.jsx(rG,{value:g,color:"#d29ada",icon:"/kitsune.svg"}),B.jsx(ki,{value:g,onClick:()=>A1(g)})]})]})})})}const Rq={key:"blank",label:B.jsx("div",{})};function Pq(){const{listname:e}=jd(),t=Ki(),n=qr(),[r,o]=l.useState(!1),[i,a]=l.useState(null),s=l.useContext(fl),c=l.useContext(m0),u=It(C=>C.lists.lists),[d,f]=l.useState(""),[m,g]=l.useState(["add"]),[b,h]=l.useState(!1),[S,p]=l.useState("Please, write a list name"),[v,y]=l.useState([Rq]);return l.useEffect(()=>{g(["add",...Object.keys(u)])},[u]),l.useEffect(()=>{const C=m.map($=>{const x={key:$,label:B.jsx("div",{})};switch($){case"input":x.label=B.jsx(Eo,{open:b,title:S,children:B.jsx(ki.Search,{autoFocus:!0,enterButton:"create",value:d,onChange:w=>{const{value:E}=w.target;/^[a-zA-Z0-9 ]*$/.test(E)?(f(E),h(!1)):(h(!0),p("a-z A-Z 0-9 symbols only"),setTimeout(()=>h(!1),2e3))},onSearch:()=>{const w=d.trim(),E=gd(w,m);E.isValid?(h(!1),g([...m].splice(0,1,"add",w)),n(vd(w)),t("/lists/"+w)):(h(!0),p(E.message))}})});break;case"add":x.label=B.jsx("div",{onClick:()=>{const w=[...m];w.splice(0,1,"input"),g(w)},children:"Create new list +"});break;default:x.label=B.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},onClick:()=>{const w=[...m];w.splice(0,1,"add"),g(w),t("/lists/"+$)},children:[$,B.jsx("span",{title:"delete list",children:B.jsx(D$,{onClick:()=>{o(!0),a($)}})})]})}return x},[]);y(C)},[m,S,b,n,t,d]),B.jsxs(B.Fragment,{children:[" ",B.jsx($f,{open:r,title:"Are you sure you want to delete this list?",onOk:()=>{i&&(n(tq(i)),t("/lists")),o(!1),a(null)},onCancel:()=>{o(!1),a(null)}}),!c&&B.jsx(nf,{theme:s?"light":"dark",className:"lists-sider",children:B.jsx(wn,{theme:s?"light":"dark",items:v,selectedKeys:e?[e]:[]})}),c&&B.jsxs(Es,{style:{width:"100vw",display:"flex",flexWrap:"wrap",columnGap:"20px",alignItems:"center",height:"fit-content",padding:"15px",backgroundColor:s?"rgba(255, 255, 255, 0.65)":"#001529"},children:[B.jsxs("label",{children:["Choose the list:",B.jsx(qn,{style:{marginLeft:"10px",minWidth:"100px"},value:e,onChange:C=>{t("/lists/"+C)},options:Object.keys(u).map(C=>({value:C,key:C,label:C}))})]}),B.jsx(Eo,{open:b,title:S,children:B.jsx(ki.Search,{style:{maxWidth:"170px"},placeholder:"Create new list",title:"create new list",enterButton:"+",value:d,onChange:C=>{const{value:$}=C.target;/^[a-zA-Z0-9 ]*$/.test($)?(f($),h(!1)):(h(!0),p("a-z A-Z 0-9 symbols only"),setTimeout(()=>h(!1),2e3))},onSearch:()=>{const C=d.trim(),$=gd(C,m);$.isValid?(h(!1),g([...m].splice(0,1,"add",C)),n(vd(C)),t("/lists/"+C)):(h(!0),p($.message))}})}),e&&B.jsx(er,{onClick:()=>{a(e),o(!0)},children:"Delete list"})]})]})}function F1(){return B.jsxs("div",{className:"lists-page",children:[B.jsx(Pq,{}),B.jsx(Iq,{})]})}function Mq(){const e=qr(),t=It(a=>a.animePage.isLoading),n=It(a=>a.animePage.isError),r=It(a=>a.animePage.isEmpty),o=It(a=>a.animePage.data),i=t||!o;return l.useEffect(()=>{e(Qm())},[e]),B.jsx("div",{className:"random-container",children:B.jsxs(rc,{isError:n,isSpinnerActive:i,isEmpty:r,errorElement:B.jsx(ic,{children:B.jsx(er,{className:"random-button",onClick:()=>{e(Qm())},children:"Try again"})}),loadingElement:B.jsx(ac,{}),emptyElement:B.jsx(oc,{type:"byId"}),children:[o&&B.jsx(uR,{data:o}),B.jsx(er,{className:"random-button",onClick:()=>{e(Qm())},children:"Try again"})]})})}function Tq(){const e=ci(),t=l.useMemo(()=>new URLSearchParams(e.search),[e.search]),n=l.useMemo(()=>yK(t),[t]),[r,o]=l.useState(n),i=l.useContext(fl),a=It(m=>m.genres.genres),s=Ki(),[c,u]=l.useState("Hide filters"),[d,f]=l.useState(!0);return l.useEffect(()=>{o(n)},[n]),B.jsxs("div",{className:i?d?"search-sider":"search-sider search-sider-closed":d?"search-sider search-sider-dark":"search-sider search-sider-closed search-sider-dark",children:[B.jsxs($W,{labelAlign:"left",layout:"vertical",onFieldsChange:m=>{const g=m.reduce((b,h)=>({...b,[h.name[0]]:h.value}),{...r});o(g)},onFinish:()=>{const m=hK(r);s("/search?"+m)},fields:pK(r),children:[B.jsx(vi,{label:"Order by",name:"order_by",children:B.jsx(qn,{options:[{value:"title",label:"title",key:"title"},{label:"start date",value:"start_date",key:"start"},{label:"end date",value:"end_date",key:"end"},{label:"episodes",value:"episodes",key:"episodes"},{label:"score",value:"score",key:"score"}]})},"order_by"),B.jsx(vi,{label:"Order",name:"isAscending",children:B.jsx(oI,{checkedChildren:B.jsx(lj,{style:{color:"navy"}}),unCheckedChildren:B.jsx(nj,{})})},"isAscending"),B.jsx(vi,{label:"Title",name:"searchword",children:B.jsx(ki,{name:"searchword",placeholder:"input title",allowClear:!0})},"searchword"),B.jsx(vi,{label:"Rating",name:"rating",children:B.jsx(qn,{allowClear:!0,placeholder:"select one",children:md.map(m=>B.jsx(qn.Option,{value:m.key,children:m.label},m.key))})},"rating"),B.jsx(vi,{label:"Genres",name:"genres",children:B.jsx(qn,{allowClear:!0,mode:"multiple",placeholder:"select multiple",children:a.map(m=>B.jsx(qn.Option,{value:m.key,children:m.label},m.key))})},"genres"),B.jsx(vi,{label:"Exclude genres",name:"genres_exclude",children:B.jsx(qn,{allowClear:!0,mode:"multiple",placeholder:"select multiple",children:a.map(m=>B.jsx(qn.Option,{value:m.key,children:m.label},m.key))})},"genres_exclude"),B.jsx(vi,{label:"Status",name:"status",children:B.jsx(qn,{allowClear:!0,placeholder:"select one",options:[{value:"airing",label:"Airing"},{value:"complete",label:"Complete"},{value:"upcoming",label:"Upcoming"}]})},"status"),B.jsxs(er,{htmlType:"submit",style:{alignSelf:"center",backgroundColor:"#d29ada",color:"white"},children:["Search ",B.jsx(wh,{style:{color:"white"}})]}),B.jsx(er,{onClick:()=>{o(fI),s("/search")},children:"Clear filters"})]}),B.jsx("button",{className:"showhide-button",onClick:()=>{u(c==="Hide filters"?"Show filters":"Hide filters"),f(!d)},children:c})]})}const Nq=ml();function _q(e,t){if(t){const n=t.indexOf("page=");if(n>=0){const r=t.indexOf("&",n);return r>n+5?t.substring(0,n+5)+e+t.substring(r):t.substring(0,n+5)+e}else return t+"&page="+e}else return"page="+e}function jq(){const e=ci(),t=new URLSearchParams(e.search),n=t.toString(),r=t.get("page"),o=Ki(),[i,a]=l.useState(Number(r)),[s,c]=l.useState(Nq),u=It(p=>p.searchCards.totalPages),d=It(p=>p.searchCards.data),f=It(p=>p.searchCards.isError),m=It(p=>p.searchCards.isLoading),g=It(p=>p.searchCards.isEmpty),b=qr(),h=m||!d,S=l.useCallback(p=>{c(p),a(1)},[]);return Of(S),l.useEffect(()=>{b(DK(s,i,n))},[b,i,n,s]),l.useEffect(()=>{a(Number(r)?Number(r):1)},[r]),B.jsx(Vs,{className:"content-container",children:B.jsx($O,{vertical:!0,justify:"center",align:"center",gap:"middle",style:{width:"fit-content"},children:B.jsxs(rc,{isError:f,isSpinnerActive:h,isEmpty:g,errorElement:B.jsx(ic,{}),loadingElement:B.jsx(ac,{}),emptyElement:B.jsx(oc,{type:"byFilters"}),children:[d&&B.jsx("div",{className:"content-wrap",children:d.map(p=>B.jsx(If,{cardData:p,isDeletable:!1},p.id))}),B.jsx(c0,{showSizeChanger:!1,current:i,onChange:p=>{a(p),o("/search?"+_q(p,n))},total:u*s,pageSize:s,hideOnSinglePage:!0})]})})})}function D1(){return B.jsxs("div",{className:"search-page",children:[B.jsx(Tq,{}),B.jsx(jq,{})]})}const Lq=ml();function zq(){const e=ci(),n=new URLSearchParams(e.search).get("ids"),[r,o]=l.useState(!1),[i,a]=l.useState(""),[s,c]=l.useState(""),[u,d]=l.useState(!1),f=It(x=>x.lists.lists),m=qr(),g=It(x=>x.lists.currListAnimeCards),[b,h]=l.useState(1),[S,p]=l.useState(Lq+2),v=l.useMemo(()=>n?n.split(",").map(x=>Number(x)):[],[n]),y=l.useMemo(()=>v?v.slice((b-1)*S,b*S):[],[v,S,b]),C=l.useCallback(()=>{const x=i.trim(),w=gd(x,Object.keys(f));w.isValid?(d(!1),m(vd(x,v)),o(!1)):(d(!0),c(w.message))},[i,m,v,f]);l.useEffect(()=>{y&&m(oR(y))},[y,m]);const $=l.useCallback(x=>{p(x+2),h(1)},[]);return Of($),B.jsxs(Vs,{className:"content-container",children:[B.jsx($f,{open:r,title:"Save as new list",onCancel:()=>{o(!1),a("")},onOk:C,children:B.jsx(Eo,{open:u,title:s,children:B.jsx(ki,{placeholder:"New list name",value:i,onChange:x=>{const{value:w}=x.target;if(/^[a-zA-Z0-9 ]*$/.test(w)){const O=x.target.value[0].toUpperCase()+x.target.value.substring(1);a(O)}},onKeyDown:x=>x.stopPropagation(),onPressEnter:C})})}),B.jsx(er,{onClick:()=>o(!0),children:"Save shared list"}),B.jsx("div",{className:"content-wrap",children:g&&g.map(x=>B.jsx(If,{cardData:x,isDeletable:!1},x.id))}),B.jsx(c0,{showSizeChanger:!1,current:b,onChange:x=>{h(x)},total:v?v.length:1,pageSize:S,hideOnSinglePage:!0})]})}const Aq=[{key:"/",label:B.jsx(cr,{to:"/",children:"Home"})},{key:"/search",label:B.jsx(cr,{to:"/search",children:"Search"})},{key:"/lists",label:B.jsx(cr,{to:"/lists",children:"My Lists"})},{key:"/random",label:B.jsx(cr,{to:"/random",children:"Random"})}],Fq=[{key:"nav",label:B.jsx(V6,{className:"burger-menu"}),children:[{key:"/",label:B.jsx(cr,{to:"/",children:"Home"})},{key:"/search",label:B.jsx(cr,{to:"/search",children:"Search"})},{key:"/lists",label:B.jsx(cr,{to:"/lists",children:"My Lists"})},{key:"/random",label:B.jsx(cr,{to:"/random",children:"Random"})}]}],Dq=window.matchMedia("(prefers-color-scheme: light)").matches;function Bq(){const[e,t]=l.useState(Dq),[n,r]=l.useState(""),o=qr(),i=Ki(),a=ci(),s=a.pathname.split("/").slice(1).map(f=>({key:f,title:B.jsx(cr,{to:"/"+f,children:f?f[0].toUpperCase()+f.substring(1):null})})),[c,u]=l.useState(window.matchMedia("(max-width: 720px)").matches);l.useEffect(()=>{function f(){u(window.matchMedia("(max-width: 720px)").matches)}return f(),window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}},[]),l.useEffect(()=>{o(aq()),o(nq())},[o]);function d(f){i("/search?q="+f),r("")}return B.jsx(m0.Provider,{value:c,children:B.jsx(fl.Provider,{value:e,children:B.jsx(Zd,{theme:gK(e),children:B.jsxs(w1,{style:{minHeight:"100vh"},children:[B.jsx(Es,{className:"header",children:B.jsxs("div",{className:"header-container",children:[B.jsx(cr,{to:"/",children:B.jsx("h1",{className:"app-title",children:"Anime Universe"})}),B.jsxs("div",{className:"nav",children:[B.jsx(SO.Compact,{size:"middle",className:"search-container",children:B.jsx(ki.Search,{placeholder:"input anime title",value:n,onChange:f=>r(f.target.value),onSearch:d})}),!c&&B.jsx(wn,{className:"nav-menu",mode:"horizontal",theme:"dark",items:Aq,selectedKeys:["/"+a.pathname.split("/")[1]]})]}),c&&B.jsx(wn,{className:"nav-menu",mode:"vertical",theme:"dark",items:Fq,selectedKeys:["/"+a.pathname.split("/")[1]]}),B.jsx(oI,{style:{marginLeft:"20px"},checkedChildren:B.jsx(IL,{}),unCheckedChildren:B.jsx(q6,{}),defaultChecked:e,onChange:()=>t(!e)})]})}),c&&B.jsx(Es,{style:{height:"fit-content",paddingLeft:"15px",paddingTop:"5px",backgroundColor:e?"#f9f9f9":"#001529"},children:B.jsx(T7,{items:s?[{key:"/",title:B.jsx(cr,{to:"/",children:B.jsx(wb,{})})}].concat(s):[{key:"/",title:B.jsx(cr,{to:"/",children:B.jsx(wb,{})})}]})}),B.jsx(w1,{style:{width:"100vw"},children:B.jsxs($T,{children:[B.jsx(co,{path:"/",element:B.jsx(Eq,{})}),B.jsx(co,{path:"/search",element:B.jsx(D1,{})}),B.jsx(co,{path:"/search",element:B.jsx(D1,{})}),B.jsx(co,{path:"/random",element:B.jsx(Mq,{})}),B.jsx(co,{path:"/:id",element:B.jsx(Sq,{})}),B.jsx(co,{path:"/lists",element:B.jsx(F1,{})}),B.jsx(co,{path:"/lists/:listname",element:B.jsx(F1,{})}),B.jsx(co,{path:"/shared",element:B.jsx(zq,{})})]})})]})})})})}const Hq=sN({lists:gq,genres:pq,homeCards:sq,animePage:fq,searchCards:uq}),kq=pw(Hq,uN(fN));eg.createRoot(document.getElementById("root")).render(B.jsx(K.StrictMode,{children:B.jsx(tN,{store:kq,children:B.jsx(TT,{basename:"/movie-lib/dist",children:B.jsx(Bq,{})})})})); diff --git a/dist/index.html b/dist/index.html index ee0e9c3..097258f 100644 --- a/dist/index.html +++ b/dist/index.html @@ -5,7 +5,7 @@ Anime Universe - + diff --git a/src/main.tsx b/src/main.tsx index 6d68549..2909926 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -22,7 +22,7 @@ const store: Store & { dispatch: DispatchType } = ReactDOM.createRoot(document.getElementById('root')!).render( - +