(this["webpackJsonplibdrive-web"]=this["webpackJsonplibdrive-web"]||[]).push([[0],{114:function(e){e.exports=JSON.parse('{"a":"1.4.7"}')},186:function(e,t,n){},188:function(e,t,n){},189:function(e,t,n){},190:function(e,t,n){},192:function(e,t,n){},193:function(e,t,n){},194:function(e,t,n){"use strict";n.r(t);var a=n(8),r=n(0),o=n.n(r),i=n(20),s=n.n(i),c=n(15),l=n(27),d=n(241),u=n(253),h=n(9),p=n(10),m=n(6),j=n(11),b=n(12),g=n(228),f=n(141),O=n(232),v=n(233),x=n(115),w=n.n(x),y=(n(39),n(1)),S=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={menuAnchor:!1},a.handleClick=a.handleClick.bind(Object(m.a)(a)),a.handleClose=a.handleClose.bind(Object(m.a)(a)),a}return Object(p.a)(n,[{key:"handleClick",value:function(e){this.setState({menuAnchor:e.currentTarget})}},{key:"handleClose",value:function(e){this.setState({menuAnchor:!1})}},{key:"render",value:function(){var e=this.props,t=e.accounts,n=e.ui_config,a=Object(y.jsx)(w.a,{});return t&&t.pic&&(t.pic.includes("http")||t.pic.includes("www"))&&(a=Object(y.jsx)("img",{src:t.pic,width:"32px",alt:"profile-pic"})),Object(y.jsxs)("div",{className:"AccountMenu",children:[Object(y.jsx)(g.a,{"aria-label":"more","aria-controls":"account-menu","aria-haspopup":"true",onClick:this.handleClick,children:a}),Object(y.jsxs)(f.a,{id:"account-menu",anchorEl:this.state.menuAnchor,anchorOrigin:{vertical:"top",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},keepMounted:!0,open:Boolean(this.state.menuAnchor),onClose:this.handleClose,children:[(n.custom_button||{}).text?Object(y.jsxs)("div",{children:[Object(y.jsx)(O.a,{}),Object(y.jsx)("a",{href:n.custom_button.url,target:"__blank",className:"no_decoration_link",children:Object(y.jsx)(v.a,{onClick:this.handleClose,children:n.custom_button.text})})]}):null,Object(y.jsx)(c.b,{to:"/settings",className:"no_decoration_link",children:Object(y.jsx)(v.a,{onClick:this.handleClose,children:"Settings"})}),Object(y.jsx)(c.b,{to:"/logout",className:"no_decoration_link",children:Object(y.jsx)(v.a,{onClick:this.handleClose,children:"Logout"})})]})]})}}]),n}(r.Component),C=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={auth:window.sessionStorage.getItem("auth")||window.localStorage.getItem("auth"),server:window.sessionStorage.getItem("server")||window.localStorage.getItem("server")},a}return Object(p.a)(n,[{key:"componentDidMount",value:function(){window.localStorage.getItem("_VERSION")||window.localStorage.setItem("_VERSION",Pt.a),window.localStorage.getItem("_VERSION")!==Pt.a&&("caches"in window&&(caches.keys().then((function(e){e.forEach((function(e){caches.delete(e)}))})),window.location.reload(!0)),window.localStorage.setItem("_VERSION",Pt.a))}},{key:"render",value:function(){var e=this.state,t=e.auth,n=e.server;return t&&n?Object(y.jsx)(l.a,{to:"/browse"},we()):Object(y.jsx)(l.a,{to:"/login"},we())}}]),n}(r.Component),k=n(234),_=n(13),I=n(19),N=n.n(I),B=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={auth:window.sessionStorage.getItem("auth")||window.localStorage.getItem("auth")||"0",isLoaded:!1,metadata:{},server:window.sessionStorage.getItem("server")||window.localStorage.getItem("server")||window.location.origin,starred_lists:JSON.parse(window.localStorage.getItem("starred_lists")||"[]"),ui_config:JSON.parse(window.localStorage.getItem("ui_config")||window.sessionStorage.getItem("ui_config")||"{}")},a}return Object(p.a)(n,[{key:"componentDidMount",value:function(){var e=this,t=this.state,n=t.auth,a=t.server,r=t.starred_lists,o=t.ui_config;n&&a||this.props.history.push("/logout");var i="".concat(a,"/api/v1/metadata"),s="?a=".concat(n,"&r=0:").concat(o.range||"16","&s=popularity-des&rmdup=true");N.a.get(i+s).then((function(t){for(var n=t.data.content,a=r.length-1;a>=0;a--)r[a].categoryInfo.pinned&&n.unshift(r[a]);e.setState({isLoaded:!0,metadata:n})})).catch((function(t){if(console.error(t),t.response){var n=t.response.data;401===n.code?_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"Login",confirmButtonColor:Dt.palette.success.main}).then((function(t){t.isConfirmed&&e.props.history.push("/logout")})):a?_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(t){t.isConfirmed?e.props.history.push("/logout"):t.isDismissed&&location.reload()})):e.props.history.push("/logout")}else t.request&&(a?_.a.fire({title:"Error!",text:"libDrive could not communicate with the server! Is '".concat(a,"' the correct address?"),icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(t){t.isConfirmed?e.props.history.push("/logout"):t.isDismissed&&location.reload()})):e.props.history.push("/logout"))}))}},{key:"render",value:function(){var e=this.state,t=e.isLoaded,n=e.metadata;return t?Object(y.jsxs)("div",{className:"Browse",children:[Object(y.jsx)(Ue,Object(a.a)({},this.props)),Object(y.jsx)(ue,{metadata:n}),Object(y.jsx)(ve,{})]}):Object(y.jsx)("div",{className:"Loading",children:Object(y.jsx)(k.a,{})})}}]),n}(r.Component),T=n(235),D=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={menuAnchor:!1},a.handleClick=a.handleClick.bind(Object(m.a)(a)),a.handleClose=a.handleClose.bind(Object(m.a)(a)),a}return Object(p.a)(n,[{key:"handleClick",value:function(e){this.setState({menuAnchor:e.currentTarget})}},{key:"handleClose",value:function(e){this.setState({menuAnchor:!1})}},{key:"render",value:function(){var e=this,t=this.props.categories,n=JSON.parse(window.localStorage.getItem("starred_lists")||"[]");return Object(y.jsxs)("div",{className:"Browse",style:{marginRight:"15px"},children:[Object(y.jsx)(T.a,{"aria-controls":"browse-menu","aria-haspopup":"true",onClick:this.handleClick,children:"Browse"}),Object(y.jsxs)(f.a,{id:"browse-menu",anchorEl:this.state.menuAnchor,keepMounted:!0,anchorOrigin:{vertical:"top",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},open:Boolean(this.state.menuAnchor),onClose:this.handleClose,children:[Object(y.jsx)(c.b,{to:"/",className:"no_decoration_link",children:Object(y.jsx)(v.a,{onClick:this.handleClose,children:"Home Page"})}),Object(y.jsx)(O.a,{}),t.length?t.map((function(t){return Object(y.jsx)(c.b,{to:"/browse/".concat(t.name),className:"no_decoration_link",children:Object(y.jsx)(v.a,{onClick:e.handleClose,children:t.name})},we())})):null,n.length?Object(y.jsxs)("div",{children:[Object(y.jsx)(O.a,{}),Object(y.jsx)(c.b,{to:"/starred",className:"no_decoration_link",children:Object(y.jsx)(v.a,{onClick:this.handleClose,children:"Starred Lists"})})]}):null]})]})}}]),n}(r.Component),E=n(121),L=n.n(E),R=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var r;return Object(h.a)(this,n),(r=t.call(this,e)).state=Object(a.a)({menuAnchor:!1},e.state),r.handleClick=r.handleClick.bind(Object(m.a)(r)),r.handleClose=r.handleClose.bind(Object(m.a)(r)),r.handleSeason=r.handleSeason.bind(Object(m.a)(r)),r}return Object(p.a)(n,[{key:"handleClick",value:function(e){this.setState({menuAnchor:e.currentTarget})}},{key:"handleClose",value:function(){this.setState({menuAnchor:!1})}},{key:"handleSeason",value:function(e){e.preventDefault();for(var t=this.state,n=t.auth,a=t.metadata,r=t.server,o=0;o1?Object(y.jsx)(O.a,{}):null})]},we())})):null,this.props.tv?Object(y.jsxs)("div",{children:[Object(y.jsx)(O.a,{}),Object(y.jsx)(v.a,{onClick:this.handleSeason,children:"Entire Season"})]}):null]})]})}}]),n}(r.Component),A=n(258),M=n(65),P=n(257),J=n(236),U=n(126),q=n.n(U),W=n(125),F=n.n(W),K=n(124),V=n.n(K),z=n(123),H=n.n(z),G=n(129),Y=n.n(G),X=n(130),Q=n.n(X),$=n(128),Z=n.n($),ee=n(61),te=n.n(ee),ne=n(93),ae=n(140),re=n(231),oe=n(196),ie=n(239),se=n(237),ce=n(238),le=n(127),de=n.n(le),ue=(n(186),function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={currentEditing:null,hide:e.hide||!1,isAndroid:/(android)/i.test(navigator.userAgent||navigator.vendor||window.opera),isIOS:/iPad|iPhone|iPod/.test(navigator.userAgent||navigator.vendor||window.opera)&&!window.MSStream,isEditOpen:!1,metadata:a.props.metadata,server:window.sessionStorage.getItem("server")||window.localStorage.getItem("server")||window.location.origin,star:e.star},a.handleStar=a.handleStar.bind(Object(m.a)(a)),a.handleStarReset=a.handleStarReset.bind(Object(m.a)(a)),a.handleStarImport=a.handleStarImport.bind(Object(m.a)(a)),a.handleStarExport=a.handleStarExport.bind(Object(m.a)(a)),a.handlePin=a.handlePin.bind(Object(m.a)(a)),a.handleEditOpen=a.handleEditOpen.bind(Object(m.a)(a)),a.handleEditClose=a.handleEditClose.bind(Object(m.a)(a)),a.handleEditDrop=a.handleEditDrop.bind(Object(m.a)(a)),a.handleEditSave=a.handleEditSave.bind(Object(m.a)(a)),a.handleScroll=a.handleScroll.bind(Object(m.a)(a)),a}return Object(p.a)(n,[{key:"handleStar",value:function(e,t){var n=this.state.metadata,a=JSON.parse(window.localStorage.getItem("starred_lists")||"[]");try{var r=a.findIndex((function(e){return e.id==t.id})),o=a[r].children.findIndex((function(t){return t.id==e.id})),i=n.findIndex((function(e){return e.id==t.id})),s=n[i].children.findIndex((function(t){return t.id==e.id}));a[r].children.splice(o,1),n[i].children.splice(s,1),window.localStorage.setItem("starred_lists",JSON.stringify(a)),this.setState({metadata:n})}catch(c){_.a.fire({title:"Error!",text:"Your starred list seems to be corrupted!",icon:"error",confirmButtonText:"Reset",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Ignore",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(e){e.isConfirmed&&(window.localStorage.setItem("starred_lists","[]"),location.reload())}))}}},{key:"handleStarReset",value:function(e){var t=this,n=this.state.metadata;_.a.fire({title:"Warning!",text:"Are you sure you want to delete this starred list?",icon:"warning",confirmButtonText:"Delete",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"No",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(a){if(a.isConfirmed){var r=JSON.parse(window.localStorage.getItem("starred_lists")||"[]");1==r.length?(r.shift(),n.shift()):(r.splice(e,1),n.splice(e,1)),window.localStorage.setItem("starred_lists",JSON.stringify(r)),t.setState({metadata:n})}}))}},{key:"handleStarImport",value:function(e){var t=this;if(e.target.files.length){var n=e.target.files[0],a=new FileReader;a.onload=function(n){var a=JSON.parse(window.localStorage.getItem("starred_lists")||"[]"),r=JSON.parse(n.target.result),o=parseInt(e.target.id.replace("file-input-",""));a[o].children=r.children,window.localStorage.setItem("starred_lists",JSON.stringify(a));var i=t.state.metadata;i.length&&"Starred"==i[o].type&&(i[o].children=r.children,t.setState({metadata:i}))},a.readAsText(n)}}},{key:"handleStarExport",value:function(e){var t=JSON.parse(window.localStorage.getItem("starred_lists")||"[]")[e],n=new Blob([JSON.stringify(t)],{type:"application/json"}),a=document.createElement("a");a.href=window.URL.createObjectURL(n),a.download="libdrive-starred-".concat(t.name,"-").concat(+new Date,".json"),a.click()}},{key:"handlePin",value:function(e,t){var n=JSON.parse(window.localStorage.getItem("starred_lists")||"[]");t?(n[e].categoryInfo.pinned=!0,window.localStorage.setItem("starred_lists",JSON.stringify(n)),this.setState({metadata:n})):(n[e].categoryInfo.pinned=!1,window.localStorage.setItem("starred_lists",JSON.stringify(n)),this.setState({metadata:n}))}},{key:"handleEditOpen",value:function(e){this.setState({currentEditing:e,isEditOpen:!0})}},{key:"handleEditClose",value:function(){var e=JSON.parse(window.localStorage.getItem("starred_lists")||"[]");this.setState({currentEditing:null,isEditOpen:!1,metadata:e})}},{key:"handleEditDrop",value:function(e){var t=e.removedIndex,n=e.addedIndex,a=this.state,r=a.metadata,o=a.currentEditing,i=r[o].children;r[o].children=Object(ae.a)(i,t,n),this.setState({metadata:r})}},{key:"handleEditSave",value:function(){var e=this.state.metadata;window.localStorage.setItem("starred_lists",JSON.stringify(e)),this.setState({currentEditing:null,isEditOpen:!1})}},{key:"handleScroll",value:function(e,t){document.getElementsByClassName("carousel__items")[e].scrollLeft+=t}},{key:"render",value:function(){var e=this,t=this.state,n=t.currentEditing,a=t.hide,r=t.isAndroid,o=t.isIOS,i=t.isEditOpen,s=t.metadata,l=t.server;return t.star?Object(y.jsxs)("div",{className:"Carousel",style:{paddingTop:"3%"},children:[s.length?s.map((function(t,n){return t.children.length||!a?Object(y.jsxs)("div",{className:"carousel__category",style:{margin:"0 auto 0 auto"},children:[Object(y.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:Object(y.jsxs)("div",{style:{width:"100%"},children:[Object(y.jsxs)("div",{style:{float:"left",display:"flex",justifyContent:"center",alignItems:"center"},children:[Object(y.jsx)(c.b,{id:"".concat(t.categoryInfo.name),to:"#".concat(t.categoryInfo.name),className:"carousel__category__title no_decoration_link",children:t.categoryInfo.name}),Object(y.jsx)(A.a,{title:"Edit",placement:"top",children:Object(y.jsx)(g.a,{color:"primary",onClick:function(){return e.handleEditOpen(n)},style:{marginLeft:"20px"},children:Object(y.jsx)(H.a,{})})}),Object(y.jsx)(A.a,{title:"Delete",placement:"top",children:Object(y.jsx)(g.a,{color:"primary",onClick:function(){return e.handleStarReset(n)},children:Object(y.jsx)(V.a,{})})})]}),Object(y.jsxs)("div",{style:{float:"right",display:"flex",justifyContent:"center",alignItems:"center"},children:[Object(y.jsx)("input",{id:"file-input-".concat(n),hidden:!0,onChange:e.handleStarImport,type:"file"}),Object(y.jsx)("label",{htmlFor:"file-input-".concat(n),children:Object(y.jsx)(A.a,{title:"Upload",placement:"top",children:Object(y.jsx)(g.a,{color:"primary",children:Object(y.jsx)(F.a,{})})})}),Object(y.jsx)(A.a,{title:"Export",placement:"top",children:Object(y.jsx)(g.a,{color:"primary",onClick:function(){return e.handleStarExport(n)},children:Object(y.jsx)(q.a,{})})}),t.categoryInfo.pinned?Object(y.jsx)(A.a,{title:"Unpin",placement:"top",children:Object(y.jsx)(g.a,{color:"primary",onClick:function(){return e.handlePin(n,!1)},children:Object(y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",enableBackground:"new 0 0 24 24",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:Dt.palette.primary.main,children:[Object(y.jsx)("g",{children:Object(y.jsx)("rect",{fill:"none",height:"24",width:"24"})}),Object(y.jsx)("g",{children:Object(y.jsx)("path",{d:"M16,9V4l1,0c0.55,0,1-0.45,1-1v0c0-0.55-0.45-1-1-1H7C6.45,2,6,2.45,6,3v0 c0,0.55,0.45,1,1,1l1,0v5c0,1.66-1.34,3-3,3h0v2h5.97v7l1,1l1-1v-7H19v-2h0C17.34,12,16,10.66,16,9z",fillRule:"evenodd"})})]})})}):Object(y.jsx)(A.a,{title:"Pin",placement:"top",children:Object(y.jsx)(g.a,{color:"primary",onClick:function(){return e.handlePin(n,!0)},children:Object(y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",enableBackground:"new 0 0 24 24",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:Dt.palette.primary.main,children:[Object(y.jsx)("g",{children:Object(y.jsx)("rect",{fill:"none",height:"24",width:"24"})}),Object(y.jsx)("g",{children:Object(y.jsx)("path",{d:"M14,4v5c0,1.12,0.37,2.16,1,3H9c0.65-0.86,1-1.9,1-3V4H14 M17,2H7C6.45,2,6,2.45,6,3c0,0.55,0.45,1,1,1c0,0,0,0,0,0l1,0v5 c0,1.66-1.34,3-3,3v2h5.97v7l1,1l1-1v-7H19v-2c0,0,0,0,0,0c-1.66,0-3-1.34-3-3V4l1,0c0,0,0,0,0,0c0.55,0,1-0.45,1-1 C18,2.45,17.55,2,17,2L17,2z"})})]})})})]})]})}),Object(y.jsx)("div",{className:"carousel__items",children:t.children.length?t.children.map((function(n){return Object(y.jsx)("div",{children:Object(y.jsxs)("figure",{className:"carousel__item__figure",children:[Object(y.jsx)(c.b,{to:"/view/".concat(n.id),children:Object(y.jsx)("img",{src:n.posterPath||"".concat(l,"/api/v1/image/poster?text=").concat(n.title,"&extention=jpeg"),className:"carousel__item__poster",alt:n.title},we())},we()),Object(y.jsx)(M.a,{className:"carousel__item__title",children:n.title}),Object(y.jsx)("div",{style:{display:"flex",justifyContent:"center"},children:Object(y.jsx)(g.a,{style:{padding:"2px"},onClick:function(){return e.handleStar(n,t)},children:Object(y.jsx)(te.a,{})})})]},we())})})):null})]},we()):null})):null,i?Object(y.jsxs)(P.a,{onClose:this.handleEditClose,"aria-labelledby":"simple-dialog-title",fullWidth:!0,maxWidth:"md",open:i||!1,children:[Object(y.jsx)(J.a,{id:"simple-dialog-title",children:s[n].categoryInfo.name}),Object(y.jsx)(re.a,{children:Object(y.jsxs)(ne.Container,{dragHandleSelector:".drag-handle",lockAxis:"y",onDrop:this.handleEditDrop,children:[s[n].children.map((function(e){var t=e.id,n=e.title;return Object(y.jsx)(ne.Draggable,{children:Object(y.jsxs)(oe.a,{divider:!0,children:[Object(y.jsx)(se.a,{primary:n}),Object(y.jsx)(ce.a,{children:Object(y.jsx)(ie.a,{className:"drag-handle",children:Object(y.jsx)(de.a,{})})})]})},t)})),Object(y.jsx)(T.a,{variant:"contained",color:"primary",style:{width:"135px",margin:"30px 0 15px 15px"},onClick:this.handleEditSave,startIcon:Object(y.jsx)(Z.a,{}),children:"Save"})]})})]}):null]}):Object(y.jsx)("div",{className:"Carousel",children:s.length?s.map((function(t,n){return t.children.length||!a?Object(y.jsxs)("div",{className:"carousel__category",children:[Object(y.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:[Object(y.jsx)("div",{style:{display:"flex",flexShrink:"0"},children:Object(y.jsx)(c.b,{id:"".concat(t.categoryInfo.name),to:"Starred"==t.categoryInfo.type?"/starred#".concat(t.categoryInfo.name):"/browse/".concat(t.categoryInfo.name),className:"carousel__category__title no_decoration_link",children:t.categoryInfo.name},we())}),r||o?null:Object(y.jsxs)("div",{style:{width:"100%",display:"flex",justifyContent:"space-between"},children:[Object(y.jsx)(g.a,{onClick:function(){return e.handleScroll(n,-500)},children:Object(y.jsx)(Y.a,{style:{fontSize:"36px",fill:Dt.palette.primary.main}})}),Object(y.jsx)(g.a,{onClick:function(){return e.handleScroll(n,500)},children:Object(y.jsx)(Q.a,{style:{fontSize:"36px",fill:Dt.palette.primary.main}})})]})]}),Object(y.jsx)("div",{className:"carousel__items",children:t.children.length?t.children.map((function(e){return Object(y.jsxs)("figure",{className:"carousel__item__figure",children:[Object(y.jsx)(c.b,{to:"/view/".concat("file"==e.type?"m":"tb","/").concat(e.id),children:Object(y.jsx)("img",{src:e.posterPath||"".concat(l,"/api/v1/image/poster?text=").concat(e.title,"&extention=jpeg"),className:"carousel__item__poster",alt:e.title},we())},we()),Object(y.jsx)(M.a,{className:"carousel__item__title",children:e.title},we())]},we())})):null})]},we()):null})):null})}}]),n}(r.Component)),he=n(31),pe=n.n(he),me=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={auth:window.sessionStorage.getItem("auth")||window.localStorage.getItem("auth")||"0",category:a.props.match.params.category,genre:pe.a.parse(a.props.location.search).genre||"",isLoaded:!1,metadata:{},page:parseInt(pe.a.parse(a.props.location.search).page)||1,range:"".concat(void 0===pe.a.parse(a.props.location.search).page?"0:".concat(JSON.parse(window.localStorage.getItem("ui_config")||window.sessionStorage.getItem("ui_config")||"{}").range||"16"):"".concat((parseInt(pe.a.parse(a.props.location.search).page)-1)*parseInt(JSON.parse(window.localStorage.getItem("ui_config")||window.sessionStorage.getItem("ui_config")||"{}").range||"16"),":").concat(parseInt(pe.a.parse(a.props.location.search).page)*parseInt(JSON.parse(window.localStorage.getItem("ui_config")||window.sessionStorage.getItem("ui_config")||"{}").range||"16"))),server:window.sessionStorage.getItem("server")||window.localStorage.getItem("server")||window.location.origin,sort:pe.a.parse(a.props.location.search).sort||"",ui_config:JSON.parse(window.localStorage.getItem("ui_config")||window.sessionStorage.getItem("ui_config")||"{}")},a}return Object(p.a)(n,[{key:"componentDidMount",value:function(){var e=this,t=this.state,n=t.auth,a=t.category,r=t.genre,o=t.range,i=t.server,s=t.sort,c=t.ui_config;n&&i||this.props.history.push("/logout"),window.scrollTo(0,0);var l="".concat(i,"/api/v1/metadata"),d="?a=".concat(n,"&c=").concat(encodeURIComponent(a),"&g=").concat(encodeURIComponent(r),"&r=").concat(o,"&s=").concat(s);N.a.get(l+d).then((function(t){e.setState({isLoaded:!0,metadata:t.data.content,pages:Math.ceil(t.data.content[0].length/parseInt(c.range||"16"))||1})})).catch((function(t){if(console.error(t),t.response){var n=t.response.data;401===n.code?_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"Login",confirmButtonColor:Dt.palette.success.main}).then((function(t){t.isConfirmed&&e.props.history.push("/logout")})):i?_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(t){t.isConfirmed?e.props.history.push("/logout"):t.isDismissed&&location.reload()})):e.props.history.push("/logout")}else t.request&&(i?_.a.fire({title:"Error!",text:"libDrive could not communicate with the server! Is '".concat(i,"' the correct address?"),icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(t){t.isConfirmed?e.props.history.push("/logout"):t.isDismissed&&location.reload()})):e.props.history.push("/logout"))}))}},{key:"componentWillUnmount",value:function(){at()}},{key:"render",value:function(){var e=this.state,t=e.genre,n=e.isLoaded,r=e.metadata,o=e.page,i=e.pages,s=e.sort,c=e.ui_config;return n&&at({title:"".concat(c.title||"libDrive"," - ").concat(r[0].categoryInfo.name),description:"Browse ".concat(r[0].categoryInfo.name," on ").concat(c.title||"libDrive","!")}),n?Object(y.jsxs)("div",{className:"CategoryBrowse",children:[Object(y.jsx)(Ue,Object(a.a)({},this.props)),Object(y.jsx)(At,{metadata:r}),Object(y.jsx)(Ye,{state:{genre:t,page:o,pages:i,sort:s},props:this.props}),Object(y.jsx)(jt,{state:{genre:t,sort:s},props:this.props}),Object(y.jsx)(ve,{})]}):Object(y.jsx)("div",{className:"Loading",children:Object(y.jsx)(k.a,{})})}}]),n}(r.Component),je=n(131),be=n.n(je),ge=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var r;return Object(h.a)(this,n),(r=t.call(this,e)).state=Object(a.a)({menuAnchor:!1},e.state),r.handleClick=r.handleClick.bind(Object(m.a)(r)),r.handleClose=r.handleClose.bind(Object(m.a)(r)),r}return Object(p.a)(n,[{key:"handleClick",value:function(e){this.setState({menuAnchor:e.currentTarget})}},{key:"handleClose",value:function(){this.setState({menuAnchor:!1})}},{key:"render",value:function(){var e=this,t=this.state,n=t.metadata,a=t.menuAnchor;return Object(y.jsxs)("div",{className:"info__button2",children:[Object(y.jsx)(T.a,{variant:"outlined",color:"primary",style:{width:"135px"},"aria-controls":"children-menu","aria-haspopup":"true",onClick:this.handleClick,startIcon:Object(y.jsx)(be.a,{}),children:"Seasons"}),Object(y.jsx)(f.a,{id:"children-menu",anchorEl:a,keepMounted:!0,anchorOrigin:{vertical:"top",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},open:Boolean(a),onClose:this.handleClose,children:n.children.length?n.children.map((function(t){if("directory"==t.type)return Object(y.jsx)(c.b,{to:"/view/ts/".concat(t.id),className:"no_decoration_link",children:Object(y.jsx)(v.a,{onClick:e.handleClose,children:t.name})},we())})):null})]})}}]),n}(r.Component);var fe=n(5),Oe=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(){return Object(h.a)(this,n),t.apply(this,arguments)}return Object(p.a)(n,[{key:"render",value:function(){var e=this.props.classes;return Object(y.jsx)("div",{style:{paddingTop:"75px"},children:Object(y.jsxs)("footer",{className:e.footer__container,id:"footer__container",children:[Object(y.jsx)("img",{src:"https://cdn2.iconfinder.com/data/icons/social-media-2285/512/1_Instagram_colored_svg_1-512.png",className:"footer__github",height:"64px",alt:"github-logo"}),Object(y.jsx)("a",{className:"no_decoration_link footer__text",href:"https://www.instagram.com/thejagstudio/",target:"_blank",children:"\xa9 2024 Copyright: TheJagStudio - v".concat(Pt.a)})]})})}}]),n}(r.Component),ve=Object(fe.a)((function(e){return{footer__container:{width:"100%",height:"75px",display:"flex",alignItems:"center",justifyContent:"center"}}}),{withTheme:!0})(Oe),xe=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={auth:window.sessionStorage.getItem("auth")||window.localStorage.getItem("auth")||"0",genre:pe.a.parse(a.props.location.search).genre||"",isLoaded:!1,metadata:{},page:parseInt(pe.a.parse(a.props.location.search).page)||1,range:"".concat(void 0===pe.a.parse(a.props.location.search).page?"0:8":"".concat(8*(parseInt(pe.a.parse(a.props.location.search).page)-1),":").concat(8*parseInt(pe.a.parse(a.props.location.search).page))),server:window.sessionStorage.getItem("server")||window.localStorage.getItem("server")||window.location.origin,sort:pe.a.parse(a.props.location.search).sort||"",ui_config:JSON.parse(window.localStorage.getItem("ui_config")||window.sessionStorage.getItem("ui_config")||"{}")},a}return Object(p.a)(n,[{key:"componentDidMount",value:function(){var e=this,t=this.state,n=t.auth,a=t.genre,r=t.range,o=t.server,i=t.sort;n&&o||this.props.history.push("/logout");var s="".concat(o,"/api/v1/metadata"),c="?a=".concat(n,"&g=").concat(encodeURIComponent(a),"&r=").concat(r,"&s=").concat(i);N.a.get(s+c).then((function(t){e.setState({isLoaded:!0,metadata:t.data.content,pages:Math.ceil(t.data.content[0].length/8)||1})})).catch((function(t){if(console.error(t),t.response){var n=t.response.data;401===n.code?_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"Login",confirmButtonColor:Dt.palette.success.main}).then((function(t){t.isConfirmed&&e.props.history.push("/logout")})):o?_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(t){t.isConfirmed?e.props.history.push("/logout"):t.isDismissed&&location.reload()})):e.props.history.push("/logout")}else t.request&&(o?_.a.fire({title:"Error!",text:"libDrive could not communicate with the server! Is '".concat(o,"' the correct address?"),icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(t){t.isConfirmed?e.props.history.push("/logout"):t.isDismissed&&location.reload()})):e.props.history.push("/logout"))}))}},{key:"componentWillUnmount",value:function(){at()}},{key:"render",value:function(){var e=this.state,t=e.genre,n=e.isLoaded,r=e.metadata,o=e.page,i=e.pages,s=e.sort,c=e.ui_config;return n&&at({title:"".concat(c.title||"libDrive").concat(t?" - ".concat(t):""),description:"Browse ".concat(t?"the ".concat(t," genre"):"genres"," on ").concat(c.title||"libDrive","!")}),n?Object(y.jsxs)("div",{className:"CategoryBrowse",children:[Object(y.jsx)(Ue,Object(a.a)({},this.props)),Object(y.jsx)(At,{metadata:r}),Object(y.jsx)(Ye,{state:{genre:t,page:o,pages:i,sort:s},props:this.props}),Object(y.jsx)(jt,{state:{genre:t,sort:s},props:this.props}),Object(y.jsx)(ve,{})]}):Object(y.jsx)("div",{className:"Loading",children:Object(y.jsx)(k.a,{})})}}]),n}(r.Component);function we(){function e(e){var t=(Math.random().toString(16)+"000000000").substr(2,8);return e?"-"+t.substr(0,4)+"-"+t.substr(4,4):t}return e()+e(!0)+e(!0)+e()}var ye=n(240),Se=n(259),Ce=n(260),ke=n(69),_e=n.n(ke),Ie=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={auth:"",error:"",page:!1,password:"",signup:!1,server:window.location.origin,username:""},a.handleTempServerChange=a.handleTempServerChange.bind(Object(m.a)(a)),a.handlePassChange=a.handlePassChange.bind(Object(m.a)(a)),a.handleUserChange=a.handleUserChange.bind(Object(m.a)(a)),a.handleServerSubmit=a.handleServerSubmit.bind(Object(m.a)(a)),a.handleSubmit=a.handleSubmit.bind(Object(m.a)(a)),a.handleSignup=a.handleSignup.bind(Object(m.a)(a)),a.dismissError=a.dismissError.bind(Object(m.a)(a)),a}return Object(p.a)(n,[{key:"componentDidMount",value:function(){var e=this,t=this.state.server,n="".concat(t,"/api/v1/auth");N.a.get(n+"?rules=signup").then((function(n){var a=n.data;200===a.code?(window.localStorage.setItem("auth","0"),window.localStorage.setItem("server",t),window.localStorage.setItem("ui_config",JSON.stringify(a.content.ui_config)),window.sessionStorage.setItem("auth","0"),window.sessionStorage.setItem("server",t),window.sessionStorage.setItem("ui_config",JSON.stringify(a.content.ui_config)),e.props.history.push("/browse")):!0===a.content?e.setState({signup:!0,page:!0}):!1===a.content&&e.setState({signup:!1,page:!0})}))}},{key:"dismissError",value:function(){this.setState({error:""})}},{key:"handleServerSubmit",value:function(e){var t=this;e.preventDefault();var n=this.state.server;if(!n)return this.setState({error:"Server is required"});n.startsWith("http")||(n="https://".concat(n));var a="".concat(n,"/api/v1/auth");N.a.get(a+"?rules=signup").then((function(e){var a=e.data;200===a.code?(window.localStorage.setItem("auth","0"),window.localStorage.setItem("server",n),window.localStorage.setItem("ui_config",JSON.stringify(a.content.ui_config)),window.sessionStorage.setItem("auth","0"),window.sessionStorage.setItem("server",n),window.sessionStorage.setItem("ui_config",JSON.stringify(a.content.ui_config)),t.props.history.push("/browse")):!0===a.content?t.setState({server:n,signup:!0,page:!0}):!1===a.content&&t.setState({server:n,signup:!1,page:!0})})).catch((function(e){console.error(e);try{var t=response.data;_.a.fire({title:"Error!",text:t.message,icon:"error",confirmButtonText:"OK",confirmButtonColor:Dt.palette.success.main})}catch(a){_.a.fire({title:"Error!",text:"You were unable to communicate with the server. Are you sure ".concat(n," is the correct server?"),icon:"error",confirmButtonText:"OK",confirmButtonColor:Dt.palette.success.main})}}))}},{key:"handleSubmit",value:function(e){var t=this;e.preventDefault();var n=this.state,a=n.password,r=n.server,o=n.username,i="".concat(r,"/api/v1/auth"),s="?u=".concat(encodeURIComponent(o),"&p=").concat(encodeURIComponent(a));return N.a.get(i+s).then((function(e){var n=e.data;window.localStorage.setItem("server",r),window.sessionStorage.setItem("server",r),window.localStorage.setItem("ui_config",JSON.stringify(n.content.ui_config)),window.localStorage.setItem("auth",n.content.auth),window.sessionStorage.setItem("auth",n.content.auth),window.sessionStorage.setItem("ui_config",JSON.stringify(n.content.ui_config)),t.props.history.push("/")})).catch((function(e){console.error(e);try{var t=response.data;_.a.fire({title:"Error!",text:t.message,icon:"error",confirmButtonText:"OK",confirmButtonColor:Dt.palette.success.main})}catch(n){_.a.fire({title:"Error!",text:"The username and or password was incorrect!",icon:"error",confirmButtonText:"OK",confirmButtonColor:Dt.palette.success.main})}})),this.setState({error:""})}},{key:"handleSignup",value:function(){var e=this,t=this.state,n=t.password,a=t.server,r=t.username;if(!r)return this.setState({error:"Username is required"});if(!n)return this.setState({error:"Password is required"});var o="".concat(a,"/api/v1/signup"),i="?u=".concat(encodeURIComponent(r),"&p=").concat(encodeURIComponent(n));return N.a.get(o+i).then((function(t){var n=t.data;window.localStorage.setItem("server",a),window.sessionStorage.setItem("server",a),window.localStorage.setItem("auth",n.content.auth),window.sessionStorage.setItem("auth",n.content.auth),e.props.history.push("/")})).catch((function(e){console.error(e);var t=e.response;try{_.a.fire({title:"Error!",text:t.message,icon:"error",confirmButtonText:"OK",confirmButtonColor:Dt.palette.success.main})}catch(n){_.a.fire({title:"Error!",text:"Something went wrong while communicating with the server ".concat(a),icon:"error",confirmButtonText:"OK",confirmButtonColor:Dt.palette.success.main})}})),this.setState({error:""})}},{key:"handleTempServerChange",value:function(e){this.setState({server:e.target.value})}},{key:"handleUserChange",value:function(e){this.setState({username:e.target.value})}},{key:"handlePassChange",value:function(e){this.setState({password:e.target.value})}},{key:"render",value:function(){var e=this.state,t=e.error,n=e.password,a=e.page,r=e.server,o=e.username,i=this.props.classes;return a?Object(y.jsxs)("div",{className:"Login",children:[Object(y.jsxs)(ye.a,{component:"main",maxWidth:"xs",children:[Object(y.jsx)(d.a,{}),Object(y.jsxs)("div",{className:i.paper,children:[Object(y.jsx)(Se.a,{className:i.avatar,children:Object(y.jsx)(_e.a,{})}),Object(y.jsx)(M.a,{variant:"h5",children:"Sign in"}),Object(y.jsxs)("form",{className:i.form,onSubmit:this.handleSubmit,noValidate:!0,children:[t&&Object(y.jsx)("div",{style:{},children:Object(y.jsxs)("h3",{"data-test":"error",onClick:this.dismissError,children:[Object(y.jsx)("button",{onClick:this.dismissError,children:"\u2716"}),t]})}),Object(y.jsx)(Ce.a,{variant:"outlined",margin:"normal",required:!0,fullWidth:!0,id:"server",label:"Server",name:"server",autoComplete:"server",onChange:this.handleTempServerChange,value:r,autoFocus:!0,disabled:!0}),Object(y.jsx)(Ce.a,{variant:"outlined",margin:"normal",required:!0,fullWidth:!0,id:"username",label:"Username",name:"username",autoComplete:"username",onChange:this.handleUserChange,value:o}),Object(y.jsx)(Ce.a,{variant:"outlined",margin:"normal",required:!0,fullWidth:!0,name:"password",label:"Password",type:"password",id:"password",autoComplete:"current-password",onChange:this.handlePassChange,value:n}),Object(y.jsx)(T.a,{type:"submit",fullWidth:!0,variant:"contained",color:"primary",className:i.submit,children:"Sign In"}),this.state.signup?Object(y.jsxs)("div",{className:"Signup",style:{textAlign:"center"},children:[Object(y.jsx)(T.a,{type:"button",onClick:this.handleSignup,fullWidth:!0,variant:"contained",color:"primary",style:{marginTop:0},className:i.submit,children:"Sign Up"}),Object(y.jsx)(M.a,{variant:"body1",children:"Be aware that the owner of this server can view your credentials!"})]}):Object(y.jsx)("div",{className:"Signup"})]})]})]}),Object(y.jsx)(ve,{})]}):Object(y.jsxs)("div",{className:"Login",children:[Object(y.jsxs)(ye.a,{component:"main",maxWidth:"xs",children:[Object(y.jsx)(d.a,{}),Object(y.jsxs)("div",{className:i.paper,children:[Object(y.jsx)(Se.a,{className:i.avatar,children:Object(y.jsx)(_e.a,{})}),Object(y.jsx)(M.a,{variant:"h5",children:"Sign in"}),Object(y.jsxs)("form",{className:i.form,onSubmit:this.handleServerSubmit,noValidate:!0,children:[t&&Object(y.jsx)("div",{style:{},children:Object(y.jsxs)("h3",{"data-test":"error",onClick:this.dismissError,children:[Object(y.jsx)("button",{onClick:this.dismissError,children:"\u2716"}),t]})}),Object(y.jsx)(Ce.a,{variant:"outlined",margin:"normal",required:!0,fullWidth:!0,id:"server",label:"Server",name:"server",autoComplete:"server",onChange:this.handleTempServerChange,value:r,autoFocus:!0}),Object(y.jsx)(T.a,{type:"submit",fullWidth:!0,variant:"contained",color:"primary",className:i.submit,children:"Next"})]})]})]}),Object(y.jsx)(ve,{})]})}}]),n}(r.Component),Ne=Object(fe.a)((function(e){return{paper:{marginTop:e.spacing(8),display:"flex",flexDirection:"column",alignItems:"center"},avatar:{margin:e.spacing(1),backgroundColor:e.palette.secondary.main},form:{width:"100%",marginTop:e.spacing(1)},submit:{margin:e.spacing(3,0,2)}}}),{withTheme:!0})(Ie),Be=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={isLoaded:!1},a}return Object(p.a)(n,[{key:"componentDidMount",value:function(){var e=this;window.localStorage.clear(),window.sessionStorage.clear(),setTimeout((function(){return e.setState({isLoaded:!0})}),500)}},{key:"render",value:function(){return this.state.isLoaded?Object(y.jsx)(l.a,{to:"/login"},we()):Object(y.jsx)("div",{className:"Loading",children:Object(y.jsx)(k.a,{})})}}]),n}(r.Component),Te=n(66),De=n(245),Ee=n(246),Le=n(144),Re=n(18),Ae=n(132),Me=n.n(Ae),Pe=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var r;return Object(h.a)(this,n),(r=t.call(this,e)).state=Object(a.a)(Object(a.a)({},e.state),{},{ui_config:JSON.parse(window.localStorage.getItem("ui_config")||window.sessionStorage.getItem("ui_config")||"{}")}),r.searchChange=r.searchChange.bind(Object(m.a)(r)),r.searchSubmit=r.searchSubmit.bind(Object(m.a)(r)),r.onMouseOver=r.onMouseOver.bind(Object(m.a)(r)),r.onMouseOut=r.onMouseOut.bind(Object(m.a)(r)),r}return Object(p.a)(n,[{key:"searchChange",value:function(e){this.setState({search:e.target.value})}},{key:"searchSubmit",value:function(e){e.preventDefault(),""!=this.state.search&&null!=this.state.search&&this.props.history.push({pathname:"/search/".concat(this.state.search),key:we()})}},{key:"onMouseOver",value:function(e){e.target.style.width="20vw"}},{key:"onMouseOut",value:function(e){e.target.style.width="15vw"}},{key:"render",value:function(){var e=this.state,t=e.accounts,n=e.categories,a=e.query,r=e.search,o=e.ui_config,i=this.props.classes;return Object(y.jsx)("div",{className:i.grow,children:Object(y.jsx)(De.a,{position:"static",className:i.root,children:Object(y.jsxs)(Ee.a,{children:[Object(y.jsx)(c.b,{to:"/",className:"no_decoration_link",children:o.icon_on_nav?Object(y.jsx)(Se.a,{alt:"logo",src:o.icon,children:"L"}):Object(y.jsx)(M.a,{className:i.title,variant:"h6",noWrap:!0,children:o.title||"libDrive"})}),Object(y.jsxs)("form",{className:i.search,onSubmit:this.searchSubmit,children:[Object(y.jsx)(g.a,{onClick:this.searchSubmit,className:i.searchIcon,children:Object(y.jsx)(Me.a,{})}),Object(y.jsx)(Le.a,{placeholder:"Search\u2026",classes:{root:i.inputRoot,input:i.inputInput},inputProps:{"aria-label":"search"},onChange:this.searchChange,onMouseOver:this.onMouseOver,onMouseOut:this.onMouseOut,value:null==r?a:r})]}),Object(y.jsx)("div",{className:i.grow}),Object(y.jsx)(D,{categories:n}),Object(y.jsx)(Rt,{ui_config:o}),o.hide_news?null:Object(y.jsx)(Ke,{}),Object(y.jsx)(S,{accounts:t,ui_config:o})]})})})}}]),n}(r.Component),Je=Object(fe.a)((function(e){return{root:{backgroundColor:e.palette.background.default,color:e.palette.text.primary},grow:{flexGrow:1},title:Object(Te.a)({display:"none"},e.breakpoints.up("sm"),{display:"block"}),search:Object(Te.a)({position:"relative",borderRadius:e.shape.borderRadius,backgroundColor:Object(Re.a)(e.palette.common.main,.15),"&:hover":{backgroundColor:Object(Re.a)(e.palette.common.main,.25)},marginRight:e.spacing(2),marginLeft:0,width:"100%"},e.breakpoints.up("sm"),{marginLeft:e.spacing(3),width:"auto"}),searchIcon:{padding:e.spacing(0,2),height:"100%",position:"absolute",zIndex:10,display:"flex",alignItems:"center",justifyContent:"center"},inputRoot:{color:"inherit"},inputInput:{padding:e.spacing(1,1,1,0),paddingLeft:"calc(1em + ".concat(e.spacing(4),"px)"),transition:e.transitions.create("width"),width:"15vw",maxWidth:"500px"}}}),{withTheme:!0})(Pe),Ue=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={accounts:{},auth:window.sessionStorage.getItem("auth")||window.localStorage.getItem("auth")||"0",categories:[],isLoaded:!1,server:window.sessionStorage.getItem("server")||window.localStorage.getItem("server")||window.location.origin,ui_config:{}},a}return Object(p.a)(n,[{key:"componentDidMount",value:function(){var e=this,t=this.state,n=t.auth,a=t.server,r="".concat(a,"/api/v1/environment"),o="?a=".concat(n);N.a.get(r+o).then((function(t){var n=t.data;e.setState({accounts:n.content.account_list,categories:n.content.category_list,isLoaded:!0,ui_config:n.content.ui_config}),"object"==typeof n.content.ui_config&&(window.localStorage.setItem("ui_config",JSON.stringify(n.content.ui_config)),window.sessionStorage.setItem("ui_config",JSON.stringify(n.content.ui_config)))}))}},{key:"render",value:function(){var e=this.state,t=e.accounts,n=e.categories,r=e.isLoaded;return r||r?Object(y.jsx)("div",{className:"Nav",children:Object(y.jsx)(Je,Object(a.a)({state:{accounts:t,categories:n,query:this.props.query}},this.props))}):Object(y.jsx)(Je,Object(a.a)({state:{accounts:[],categories:[],query:this.props.query}},this.props))}}]),n}(r.Component),qe=n(247),We=n(94),Fe=n.n(We),Ke=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={dismissed:"true"==(window.localStorage.getItem("dismissed")||"false"),isLoaded:!1,isNew:!1,lastChecked:new Date(window.localStorage.getItem("last_news_check")||"0").getTime(),menuAnchor:!1,news:JSON.parse(window.localStorage.getItem("news")||"[]"),now:(new Date).getTime()},a.handleClick=a.handleClick.bind(Object(m.a)(a)),a.handleClose=a.handleClose.bind(Object(m.a)(a)),a}return Object(p.a)(n,[{key:"componentDidMount",value:function(){var e=this,t=this.state,n=t.isNew,a=t.lastChecked,r=t.news,o=t.now,i=a+108e5;r.length&&r[0].tag_name&&Pt.a!=r[0].tag_name.replace("v","")&&(n=!0),o>=i?N.a.get("https://api.github.com/repos/libDrive/libDrive/releases").then((function(t){var a=t.data;window.localStorage.setItem("news",JSON.stringify(a)),window.localStorage.setItem("last_news_check",o),r.length&&a.length&&r[0].tag_name!=a[0].tag_name?(window.localStorage.setItem("dismissed","false"),e.setState({dismissed:!1,isLoaded:!0,isNew:n,news:a})):e.setState({isLoaded:!0,isNew:n,news:a})})):this.setState({isLoaded:!0,isNew:n})}},{key:"handleClick",value:function(e){var t=this,n=this.state,a=(n.news,n.now);this.setState({menuAnchor:e.currentTarget}),N.a.get("https://api.github.com/repos/libDrive/libDrive/releases").then((function(e){var n=e.data;window.localStorage.setItem("news",JSON.stringify(n)),window.localStorage.setItem("last_news_check",a),window.localStorage.setItem("dismissed","true"),t.setState({dismissed:!0,news:n})}))}},{key:"handleClose",value:function(){this.setState({menuAnchor:!1})}},{key:"render",value:function(){var e=this.state,t=e.dismissed,n=e.isNew,a=e.isLoaded,r=e.menuAnchor,i=e.news;return a?Object(y.jsxs)("div",{className:"NewsMenu",children:[Object(y.jsx)(g.a,{"aria-label":"more","aria-controls":"news-menu","aria-haspopup":"true",onClick:this.handleClick,children:!t&&n?Object(y.jsx)(qe.a,{badgeContent:"N",color:"primary",children:Object(y.jsx)(Fe.a,{})}):Object(y.jsx)(Fe.a,{})}),Object(y.jsx)(f.a,{id:"news-menu",anchorEl:r,keepMounted:!0,open:Boolean(r),onClose:this.handleClose,children:Object(y.jsxs)(re.a,{style:{width:"530px",maxwidth:"90vw"},children:[Object(y.jsx)(oe.a,{pri:"true",alignItems:"flex-start",children:Object(y.jsx)(se.a,{primary:n?Object(y.jsx)("strong",{style:{color:Dt.palette.warning.main},children:"There is a new version available!"}):Object(y.jsx)("strong",{style:{color:Dt.palette.success.main},children:"You are on the latest version"})})}),Object(y.jsx)(O.a,{}),i.length?i.slice(0,3).map((function(e){return Object(y.jsx)(oe.a,{pri:"true",alignItems:"flex-start",children:Object(y.jsx)(se.a,{primary:Object(y.jsxs)("strong",{children:["libDrive ",e.tag_name]}),secondary:Object(y.jsx)(o.a.Fragment,{children:Object(y.jsxs)("span",{style:{whiteSpace:"pre-line"},children:["Version: ",e.tag_name,"\n","Date: ",new Date(e.published_at).toDateString(),"\n","Info:"," ",Object(y.jsx)("a",{href:e.html_url,target:"_blank",className:"no_decoration_link",children:Object(y.jsx)("u",{children:e.html_url.replace("https://github.com/","")})})]})})})},we())})):null]})})]}):null}}]),n}(r.Component),Ve=(n(188),function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(){return Object(h.a)(this,n),t.apply(this,arguments)}return Object(p.a)(n,[{key:"render",value:function(){return Object(y.jsxs)("div",{className:"NotFound",children:[Object(y.jsx)(Ue,Object(a.a)({},this.props)),Object(y.jsx)("div",{className:"nf",children:Object(y.jsx)("div",{className:"fof",children:Object(y.jsx)("h1",{children:"Error 404: Not Found"})})})]})}}]),n}(r.Component)),ze=n(265),He=n(256),Ge=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state=e.state,a}return Object(p.a)(n,[{key:"render",value:function(){var e=this,t=this.state,n=t.genre,r=t.page,o=t.pages,i=t.sort,s=this.props.classes;return r>o?Object(y.jsx)(l.a,{to:{pathname:this.props.props.location.pathname,search:"?page=".concat(o,"&genre=").concat(n,"&sort=").concat(i)}},we()):Object(y.jsx)("div",{className:s.root,children:Object(y.jsx)(ze.a,{page:r,count:o,variant:"outlined",size:window.innerWidth>=600?"large":window.innerWidth>=390?"medium":"small",color:"primary",renderItem:function(t){return t.page?Object(y.jsx)(c.b,{to:{pathname:e.props.props.location.pathname,search:"?page=".concat(t.page,"&genre=").concat(n,"&sort=").concat(i)},className:"no_decoration_link",children:Object(y.jsx)(He.a,Object(a.a)({},t))},we()):Object(y.jsx)(He.a,Object(a.a)({},t))}})})}}]),n}(r.Component),Ye=Object(fe.a)((function(e){return{root:{"& > *":{display:"flex",justifyContent:"center",alignItems:"center",margin:"20px"}}}}),{withTheme:!0})(Ge),Xe=n(133),Qe=n.n(Xe),$e=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var r;return Object(h.a)(this,n),(r=t.call(this,e)).state=Object(a.a)({menuAnchor:!1},e.state),r.handleClick=r.handleClick.bind(Object(m.a)(r)),r.handleClose=r.handleClose.bind(Object(m.a)(r)),r}return Object(p.a)(n,[{key:"handleClick",value:function(e){this.setState({menuAnchor:e.currentTarget})}},{key:"handleClose",value:function(e){this.setState({menuAnchor:!1})}},{key:"render",value:function(){var e,t=this,n=this.state,a=(n.auth,n.id),r=n.isAndroid,o=n.isIOS,i=n.metadata,s=n.server,c=new URL("".concat(s,"/api/v1/redirectdownload/").concat(encodeURIComponent(i.name),"?id=").concat(a));if(r){var l=c.protocol.slice(0,-1);c.hash="Intent;action=android.intent.action.VIEW;scheme=".concat(l,";type=").concat(i.mimeType,";S.title=").concat(encodeURIComponent(i.name),";end"),c.protocol="intent",e=c.toString()}else o&&(c.host="x-callback-url",c.port="",c.pathname="stream",c.search="url=".concat(s,"/api/v1/redirectdownload/").concat(encodeURIComponent(i.name),"?id=").concat(a),c.protocol="vlc-x-callback",e=c.toString());return Object(y.jsxs)("div",{className:"info__button",children:[Object(y.jsx)(T.a,{variant:"outlined",color:"primary",style:{width:"135px"},"aria-controls":"player-menu","aria-haspopup":"true",onClick:this.handleClick,startIcon:Object(y.jsx)(Qe.a,{}),children:"Player"}),Object(y.jsxs)(f.a,{id:"player-menu",anchorEl:this.state.menuAnchor,keepMounted:!0,anchorOrigin:{vertical:"top",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},open:Boolean(this.state.menuAnchor),onClose:this.handleClose,children:[r||o?Object(y.jsxs)("div",{children:[Object(y.jsx)("a",{href:e,className:"no_decoration_link",children:Object(y.jsx)(v.a,{onClick:this.handleClose,children:r?"Android":o?"IOS selector":null})}),Object(y.jsx)(O.a,{})]}):Object(y.jsx)("div",{children:Object(y.jsx)("a",{href:"potplayer://".concat(s,"/api/v1/redirectdownload/").concat(encodeURIComponent(i.name),"?id=").concat(a),className:"no_decoration_link",children:Object(y.jsx)(v.a,{onClick:this.handleClose,children:"PotPlayer"})})}),Object(y.jsx)(O.a,{}),Object(y.jsx)(v.a,{onClick:function(){navigator.clipboard.writeText("".concat(s,"/api/v1/redirectdownload/").concat(encodeURIComponent(i.name),"?id=").concat(a)),t.handleClose()},children:"Copy URL"})]})]})}}]),n}(r.Component),Ze=n(134),et=n.n(Ze),tt=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state=e.state,a.handleClick=a.handleClick.bind(Object(m.a)(a)),a}return Object(p.a)(n,[{key:"handleClick",value:function(e){for(var t=this.state,n=(t.auth,t.metadata),a=t.server,r="#EXTM3U\n#EXTENC: UTF-8\n#PLAYLIST: ".concat(n.name,"\n"),o=0;o0&&void 0!==arguments[0]?arguments[0]:{},t=JSON.parse(window.localStorage.getItem("ui_config")||window.sessionStorage.getItem("ui_config")||"{}");e.title=e.title||t.title||"libDrive",e.description=e.description||"libDrive is a Google Drive media library manager and indexer, similar to Plex, that organizes Google Drive media to offer an intuitive and user-friendly experience.",e.image=e.image||t.icon||"/images/icons/icon-512x512.png",e.type=e.type||"website",document.title=e.title||t.title,document.querySelector('meta[property="og:title"]').setAttribute("content",e.title),document.querySelector('meta[name="description"]').setAttribute("content",e.description),document.querySelector('meta[property="og:description"]').setAttribute("content",e.description),document.querySelector('meta[property="og:image"]').setAttribute("content",e.image),document.querySelector('meta[property="og:type"]').setAttribute("content",e.type)}var rt,ot,it=n(263),st=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={auth:window.sessionStorage.getItem("auth")||window.localStorage.getItem("auth")||"0",error:"",isLoaded:!1,secret:window.sessionStorage.getItem("secret"),server:window.sessionStorage.getItem("server")||window.localStorage.getItem("server")||window.location.origin},a.dismissError=a.dismissError.bind(Object(m.a)(a)),a.handleSubmit=a.handleSubmit.bind(Object(m.a)(a)),a.handleChange=a.handleChange.bind(Object(m.a)(a)),a.handleRestart=a.handleRestart.bind(Object(m.a)(a)),a.handleKillSwitch=a.handleKillSwitch.bind(Object(m.a)(a)),a.handleRebuild=a.handleRebuild.bind(Object(m.a)(a)),a.handleFileBrowser=a.handleFileBrowser.bind(Object(m.a)(a)),a}return Object(p.a)(n,[{key:"componentDidMount",value:function(){var e=this,t=this.state,n=t.secret,r=t.server,o=Object(a.a)({},this.props);if(o.classes={},null==window.sessionStorage.getItem("secret"))this.props.history.push("/settings/login");else{var i="".concat(r,"/api/v1/config"),s="?a=".concat(auth,"&secret=").concat(encodeURIComponent(n));N.a.get(i+s).then((function(t){return e.setState({config:JSON.stringify(t.data.content,null,4),isLoaded:!0,navProps:o,tempSecret:t.data.content.secret_key})})).catch((function(t){if(console.error(t),t.response){var n=t.response.data;401===n.code?_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"Login",confirmButtonColor:Dt.palette.success.main}).then((function(t){t.isConfirmed&&e.props.history.push("/logout")})):r?_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(t){t.isConfirmed?e.props.history.push("/logout"):t.isDismissed&&location.reload()})):e.props.history.push("/logout")}else t.request&&(r?_.a.fire({title:"Error!",text:"libDrive could not communicate with the server! Is '".concat(r,"' the correct address?"),icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(t){t.isConfirmed?e.props.history.push("/logout"):t.isDismissed&&location.reload()})):e.props.history.push("/logout"))}))}}},{key:"dismissError",value:function(){this.setState({error:""})}},{key:"handleRestart",value:function(e){e.preventDefault();var t=this.state,n=t.secret,a=t.server,r="".concat(a,"/api/v1/restart"),o="?a=".concat(auth,"&secret=").concat(encodeURIComponent(n));N.a.get(r+o).then((function(e){_.a.fire({title:"Success!",text:e.data.message,icon:"success",confirmButtonText:"OK",confirmButtonColor:Dt.palette.success.main})})).catch((function(e){console.error(e),_.a.fire({title:"Success!",text:"libDrive is being restarted, this might take some time, so the app won't load",icon:"success",confirmButtonText:"OK",confirmButtonColor:Dt.palette.success.main})}))}},{key:"handleSubmit",value:function(e){var t=this;e.preventDefault();var n=this.state,a=n.secret,r=n.server,o="".concat(r,"/api/v1/config"),i="?a=".concat(auth,"&secret=").concat(encodeURIComponent(a));N.a.post(o+i,JSON.parse(this.state.config)).then((function(e){_.a.fire({title:"Success!",text:e.data.message,icon:"success",confirmButtonText:"OK",confirmButtonColor:Dt.palette.success.main})})).catch((function(e){if(console.error(e),e.response){var n=e.response.data;401===n.code?_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main}).then((function(e){e.isConfirmed&&(window.sessionStorage.removeItem("secret"),t.props.history.push("/settings/login"))})):_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(e){e.isConfirmed?t.props.history.push("/logout"):e.isDismissed&&location.reload()}))}else e.request&&_.a.fire({title:"Error!",text:"libDrive could not communicate with the server! Is ".concat(r," the correct address?"),icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(e){e.isConfirmed?t.props.history.push("/logout"):e.isDismissed&&location.reload()}))}))}},{key:"handleChange",value:function(e){this.setState({config:e.target.value})}},{key:"handleKillSwitch",value:function(e){var t=JSON.parse(this.state.config);t.kill_switch=e.target.checked,this.setState({config:JSON.stringify(t,null,4)}),this.handleSubmit(e)}},{key:"handleRebuild",value:function(e){var t=this,n=this.state,a=n.secret,r=n.server,o="".concat(r,"/api/v1/rebuild"),i="?a=".concat(auth,"&secret=").concat(encodeURIComponent(a));N.a.get(o+i).then((function(e){return _.a.fire({title:"Success!",text:"libDrive's metadata is being rebuilt...",icon:"success",confirmButtonText:"OK",confirmButtonColor:Dt.palette.success.main})})).catch((function(e){console.error(e),null==auth||null==r?t.props.history.push("/login"):e.response?401===e.response.status?_.a.fire({title:"Error!",text:"Your credentials are invalid!",icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main}).then((function(e){e.isConfirmed&&t.props.history.push("/logout")})):_.a.fire({title:"Error!",text:"Something went wrong while communicating with the server!",icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(e){e.isConfirmed?t.props.history.push("/logout"):e.isDismissed&&location.reload()})):e.request&&_.a.fire({title:"Error!",text:"libDrive could not communicate with the server! Is ".concat(r," the correct address?"),icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(e){e.isConfirmed?t.props.history.push("/logout"):e.isDismissed&&location.reload()}))}))}},{key:"handleFileBrowser",value:function(){var e=this.state,t=e.secret,n=e.server;window.open("".concat(n,"/api/v1/debug?secret=").concat(t))}},{key:"render",value:function(){var e=this.state,t=e.config,n=e.isLoaded,r=e.navProps,o=this.props.classes;return n?Object(y.jsxs)("div",{className:"Settings",children:[Object(y.jsx)(Ue,Object(a.a)({},r)),Object(y.jsx)("div",{style:{margin:"auto",marginTop:"50px",width:"80vw",maxWidth:"1500px"},children:Object(y.jsx)(Ce.a,{style:{width:"100%",backgroundColor:Dt.palette.background.paper},variant:"outlined",label:"Config",value:t,id:"config-box",onChange:this.handleChange,multiline:!0,minRows:15,maxRows:30})}),Object(y.jsx)("form",{className:o.Form,noValidate:!0,autoComplete:"off",onSubmit:this.handleSubmit,children:Object(y.jsxs)("div",{style:{margin:"30px"},children:[Object(y.jsx)(T.a,{style:{margin:"10px",width:"175px"},type:"submit",fullWidth:!0,variant:"contained",color:"primary",className:o.submit,children:"Submit Config"}),Object(y.jsx)(T.a,{style:{margin:"10px",width:"175px"},fullWidth:!0,variant:"contained",color:"primary",className:o.submit,onClick:this.handleRestart,children:"Restart Server"}),Object(y.jsx)(T.a,{style:{margin:"10px",width:"175px"},fullWidth:!0,variant:"contained",color:"primary",className:o.submit,onClick:this.handleRebuild,children:"Rebuild Metadata"}),Object(y.jsx)(T.a,{style:{margin:"10px",width:"175px"},fullWidth:!0,variant:"contained",color:"primary",className:o.submit,onClick:this.handleFileBrowser,children:"File Browser"}),Object(y.jsx)("br",{}),Object(y.jsx)("p",{style:{fontSize:"16px",marginTop:"10px",marginBotoom:"5px"},children:"Kill Switch"}),Object(y.jsx)(it.a,{checked:this.state.config.kill_switch,onChange:this.handleKillSwitch,color:"primary",name:"checkedB",inputProps:{"aria-label":"primary checkbox"}})]})}),Object(y.jsx)(ve,{})]}):Object(y.jsx)("div",{className:"Loading",children:Object(y.jsx)(k.a,{})})}}]),n}(r.Component),ct=Object(fe.a)((function(e){return{Form:{textAlign:"center","& .MuiTextField-root":{width:"30ch",margin:e.spacing(1),textAlign:"left"},"& .MuiTypography-root":{margin:"30px 30px"}},submit:{margin:e.spacing(4,0,2),width:"20ch"}}}),{withTheme:!0})(st),lt=function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state={auth:window.sessionStorage.getItem("auth")||window.localStorage.getItem("auth")||"0",isLoaded:!1,secret:"",server:window.sessionStorage.getItem("server")||window.localStorage.getItem("server")||window.location.origin},a.handleSecretChange=a.handleSecretChange.bind(Object(m.a)(a)),a.handleSubmit=a.handleSubmit.bind(Object(m.a)(a)),a}return Object(p.a)(n,[{key:"componentDidMount",value:function(){var e=Object(a.a)({},this.props);e.classes={},this.setState({isLoaded:!0,navProps:e})}},{key:"handleSubmit",value:function(e){var t=this;e.preventDefault();var n=this.state,a=n.secret,r=n.server,o="".concat(r,"/api/v1/config"),i="?a=".concat(auth,"&secret=").concat(encodeURIComponent(a));N.a.get(o+i).then((function(e){window.sessionStorage.setItem("secret",a),t.props.history.push("/settings")})).catch((function(e){if(console.error(e),e.response){var n=e.response.data;401===n.code?_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"OK",confirmButtonColor:Dt.palette.success.main}):_.a.fire({title:"Error!",text:n.message,icon:"error",confirmButtonText:"OK",confirmButtonColor:Dt.palette.success.main}).then((function(e){location.reload()}))}else e.request&&_.a.fire({title:"Error!",text:"libDrive could not communicate with the server. Is ${server} the correct address?",icon:"error",confirmButtonText:"Logout",confirmButtonColor:Dt.palette.success.main,cancelButtonText:"Retry",cancelButtonColor:Dt.palette.error.main,showCancelButton:!0}).then((function(e){e.isConfirmed?t.props.history.push("/logout"):e.isDismissed&&location.reload()}))}))}},{key:"handleSecretChange",value:function(e){this.setState({secret:e.target.value})}},{key:"render",value:function(){var e=this.state,t=e.isLoaded,n=e.navProps,r=e.secret,o=this.props.classes;return t?Object(y.jsxs)("div",{className:"SettingsLoginForm",children:[Object(y.jsx)(Ue,Object(a.a)({},n)),Object(y.jsxs)(ye.a,{component:"main",maxWidth:"xs",children:[Object(y.jsx)(d.a,{}),Object(y.jsxs)("div",{className:o.paper,children:[Object(y.jsx)(Se.a,{className:o.avatar,children:Object(y.jsx)(_e.a,{})}),Object(y.jsx)(M.a,{variant:"h5",children:"Settings Login"}),Object(y.jsxs)("form",{className:o.form,onSubmit:this.handleSubmit,noValidate:!0,children:[Object(y.jsx)(Ce.a,{variant:"outlined",margin:"normal",fullWidth:!0,id:"secret",label:"Secret",name:"secret",type:"password",autoComplete:"secret",onChange:this.handleSecretChange,value:r,required:!0,autoFocus:!0}),Object(y.jsx)(T.a,{type:"submit",fullWidth:!0,variant:"contained",color:"primary",className:o.submit,children:"Sign In"})]})]})]}),Object(y.jsx)(ve,{})]}):Object(y.jsx)("div",{className:"Loading",children:Object(y.jsx)(k.a,{})})}}]),n}(r.Component),dt=Object(fe.a)((function(e){return{paper:{marginTop:e.spacing(8),display:"flex",flexDirection:"column",alignItems:"center"},avatar:{margin:e.spacing(1),backgroundColor:e.palette.secondary.main},form:{width:"100%",marginTop:e.spacing(1)},submit:{margin:e.spacing(3,0,2)}}}),{withTheme:!0})(lt),ut=n(244),ht=n(262),pt=n(255),mt=(n(189),function(e){Object(j.a)(n,e);var t=Object(b.a)(n);function n(e){var a;return Object(h.a)(this,n),(a=t.call(this,e)).state=e.state,a.formatSort=a.formatSort.bind(Object(m.a)(a)),a}return Object(p.a)(n,[{key:"formatSort",value:function(e){if(!e)return"Sort";for(var t=e.split("-"),n=0;n