Skip to content

Comments

Implement full-stack Plex integration with authentication, scanning, and extras checking#278

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/fix-87efcdd2-f25b-409c-9e92-81e7ff32f57e
Draft

Implement full-stack Plex integration with authentication, scanning, and extras checking#278
Copilot wants to merge 5 commits intomainfrom
copilot/fix-87efcdd2-f25b-409c-9e92-81e7ff32f57e

Conversation

Copy link
Contributor

Copilot AI commented Aug 11, 2025

  • Analyze the reported issues in Plex integration
  • Fix baseUrl construction in plex.service.ts (remove extra slash)
  • Add X-Plex-Client-Identifier header to polling requests in auth.py
  • Update API endpoint to accept client identifier as query parameter
  • Update frontend component to store and pass client identifier
  • Test the fixes to ensure frontend builds successfully

Issues Fixed

  1. URL Construction: Fixed the extra / in baseUrl construction in plex.service.ts - changed from environment.apiUrl + '/plex' to environment.apiUrl + 'plex'

  2. Missing Header: Added required X-Plex-Client-Identifier header to Plex polling requests:

    • Updated poll_for_token() function to accept client_identifier parameter
    • Modified API endpoint to accept client identifier as query parameter
    • Updated frontend service to pass client identifier in polling requests
    • Updated frontend component to store and manage client identifier state

Technical Changes

  • Backend: Modified auth.py to include client identifier header in Plex API calls
  • API: Updated polling endpoint to accept client_identifier query parameter
  • Frontend Service: Updated pollForToken() method to include client identifier
  • Frontend Component: Added client identifier state management and proper parameter passing

The Plex authentication flow should now work correctly with proper API communication.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits August 11, 2025 18:57
Co-authored-by: nandyalu <18457369+nandyalu@users.noreply.github.com>
Co-authored-by: nandyalu <18457369+nandyalu@users.noreply.github.com>
…y and UI demonstrations

Co-authored-by: nandyalu <18457369+nandyalu@users.noreply.github.com>
Copilot AI changed the title [WIP] Plex Integration ImplementationObjective: Implement a full-stack Plex integration feature for a web application using an Angular 20 frontend and a FastAPI backend. The goal is to allow users to link their Plex account, retrieve an authentication token,... Implement full-stack Plex integration with authentication, scanning, and extras checking Aug 11, 2025
Copilot AI requested a review from nandyalu August 11, 2025 19:14
@nandyalu
Copy link
Owner

@copilot

Some things are not working.

  1. First things first, the baseUrl in plex.service.ts has an extra \ as the apiUrl already has an ending slash.
  2. I tried changing that and then getting this error on trying to connect to Plex. Looks like we need to send client identifier for poll to work:
2025-09-18T04:27:31+0000 [ERROR|auth|L107]: PlexAuth: Failed to poll token from Plex: 400 - {"errors":[{"code":1000,"message":"X-Plex-Client-Identifier is missing","status":400}]}
ERROR: Failed to poll token from Plex: 400 - {"errors":[{"code":1000,"message":"X-Plex-Client-Identifier is missing","status":400}]}
2025-09-18T04:27:31+0000 [ERROR|auth|L136]: PlexAuth: Unexpected error during token polling: Failed to poll token from Plex: 400
ERROR: Unexpected error during token polling: Failed to poll token from Plex: 400
2025-09-18T04:27:31+0000 [ERROR|plex|L122]: PlexAPI: Failed to poll Plex token: Failed to poll token from Plex: 400
ERROR: Failed to poll Plex token: Failed to poll token from Plex: 400
INFO:     172.17.0.1:52849 - "GET /api/v1/plex/auth/poll/m91bdyoej1622un33bmia0sre" 400 Bad Request 477.44ms

…o polling

Co-authored-by: nandyalu <18457369+nandyalu@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Sep 18, 2025

@copilot

Some things are not working.
...

Fixed both issues in commit 84da1b0:

  1. URL Construction: Removed the extra / in plex.service.ts baseUrl construction
  2. Missing Client Identifier: Added X-Plex-Client-Identifier header to Plex polling requests

The backend now properly accepts the client identifier as a query parameter and includes it in the Plex API headers. The frontend has been updated to store and pass the client identifier throughout the authentication flow.

The Plex authentication should now work correctly without the 400 error.

@@ -1 +1 @@
import{b as qe,d as Be}from"./chunk-2DI3O7OK.js";import{a as Oe}from"./chunk-DSSANAWE.js";import{a as _e,b as Ce,c as be,d as I,e as R,f as xe,g as we,h as ye,i as Te,j as Pe,k as ke,p as _,q as D,r as M,s as H,u as L,v as Z,w as A,z as Ee}from"./chunk-GX43XB6K.js";import{a as Ne}from"./chunk-EWRSLDPL.js";import{A as Ve,M as ze,N as Fe,Q as Ue,g as fe,j as ve,o as Se,p as Ie,r as Re,s as De,t as He,u as Le,v as Ze,w as Ae}from"./chunk-3N2GIQV3.js";import{b as je}from"./chunk-O55CDUTY.js";import{$b as j,E as X,Ea as oe,Eb as N,Fb as ce,Ha as x,Hb as w,I as W,Ia as l,Jb as de,Kb as m,L as K,La as re,Lb as P,Mb as me,Ob as pe,Pb as he,Qb as ue,Ra as y,T as Y,Ua as ae,Ub as B,Xb as ge,_ as J,_b as U,da as u,fa as ee,fb as k,gb as q,hb as se,ib as le,ja as C,jb as E,ka as b,kb as O,la as f,lb as h,lc as Q,ma as v,mb as i,nb as r,ob as c,pa as te,qa as ne,s as G,sa as F,tb as S,w as $,xa as ie,xb as g,yc as Me,zb as T}from"./chunk-APGJX63Q.js";var Qe=(()=>{let o=class o{transform(e){let t=()=>typeof e=="number"?e:e instanceof Date?e.getTime():null;return X(1e3).pipe(Y(0),$(()=>{let n=t();return n===null?"Invalid date":qe(n)}))}};o.\u0275fac=function(t){return new(t||o)},o.\u0275pipe=ae({name:"timeRemaining",type:o,pure:!0});let a=o;return a})();var Ge=(()=>{let o=class o{constructor(){this.RouteHome=_,this.RouteLogs=D,this.RouteMedia=M,this.RouteMovies=H,this.RouteSeries=L,this.RouteSettings=Z,this.RouteTasks=A,this.router=u(I),this.previousUrl="",this.currentUrl="",this.router.events.subscribe(e=>{e instanceof Ce&&(this.previousUrl=this.currentUrl,this.currentUrl=e.url)})}isActiveLink(e){return this.previousUrl.includes(e)&&this.currentUrl.includes(M)||this.currentUrl.includes(e)}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=y({type:o,selectors:[["app-sidenav"]],decls:31,vars:12,consts:[[1,"navmenu"],["routerLinkActive","active",1,"sidenav-button",3,"routerLink"],["xmlns","http://www.w3.org/2000/svg","viewBox","0 -960 960 960",1,"icon"],["d","M240-200h120v-240h240v240h120v-360L480-740 240-560v360Zm-80 80v-480l320-240 320 240v480H520v-240h-80v240H160Zm320-350Z"],[1,"btntext"],["d","m160-800 80 160h120l-80-160h80l80 160h120l-80-160h80l80 160h120l-80-160h120q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800Zm0 240v320h640v-320H160Zm0 0v320-320Z"],["d","M320-120v-80H160q-33 0-56.5-23.5T80-280v-480q0-33 23.5-56.5T160-840h640q33 0 56.5 23.5T880-760v480q0 33-23.5 56.5T800-200H640v80H320ZM160-280h640v-480H160v480Zm0 0v-480 480Z"],["d","M200-640h560v-80H200v80Zm0 0v-80 80Zm0 560q-33 0-56.5-23.5T120-160v-560q0-33 23.5-56.5T200-800h40v-80h80v80h320v-80h80v80h40q33 0 56.5 23.5T840-720v227q-19-9-39-15t-41-9v-43H200v400h252q7 22 16.5 42T491-80H200Zm520 40q-83 0-141.5-58.5T520-240q0-83 58.5-141.5T720-440q83 0 141.5 58.5T920-240q0 83-58.5 141.5T720-40Zm67-105 28-28-75-75v-112h-40v128l87 87Z"],["d","M280-280h280v-80H280v80Zm0-160h400v-80H280v80Zm0-160h400v-80H280v80Zm-80 480q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"],["d","m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm70-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"]],template:function(t,n){t&1&&(i(0,"nav",0)(1,"a",1),f(),i(2,"svg",2),c(3,"path",3),r(),v(),i(4,"span",4),m(5,"Home"),r()(),i(6,"a",1),f(),i(7,"svg",2),c(8,"path",5),r(),v(),i(9,"span",4),m(10,"Movies"),r()(),i(11,"a",1),f(),i(12,"svg",2),c(13,"path",6),r(),v(),i(14,"span",4),m(15,"Series"),r()(),i(16,"a",1),f(),i(17,"svg",2),c(18,"path",7),r(),v(),i(19,"span",4),m(20,"Tasks"),r()(),i(21,"a",1),f(),i(22,"svg",2),c(23,"path",8),r(),v(),i(24,"span",4),m(25,"Logs"),r()(),i(26,"a",1),f(),i(27,"svg",2),c(28,"path",9),r(),v(),i(29,"span",4),m(30,"Settings"),r()()()),t&2&&(l(),w("active2",n.isActiveLink(n.RouteHome)),h("routerLink",n.RouteHome),l(5),w("active2",n.isActiveLink(n.RouteMovies)),h("routerLink",n.RouteMovies),l(5),w("active2",n.isActiveLink(n.RouteSeries)),h("routerLink",n.RouteSeries),l(5),h("routerLink",n.RouteTasks),l(5),h("routerLink",n.RouteLogs),l(5),h("routerLink",n.RouteSettings))},dependencies:[R,xe],styles:[".navmenu[_ngcontent-%COMP%]{overflow:auto;width:210px;height:100%;margin:0;padding:0;box-sizing:border-box;display:flex;flex-direction:column;align-items:start;justify-items:stretch}.sidenav-button[_ngcontent-%COMP%]{margin:0;padding:1rem 1rem 1rem 2rem;box-sizing:border-box;width:100%;text-decoration:none;color:inherit;text-align:start;font-weight:400;display:flex;align-items:center;transition:.3s;cursor:pointer;border-radius:0;border-bottom:2px solid transparent}.sidenav-button.active[_ngcontent-%COMP%], .sidenav-button.active2[_ngcontent-%COMP%]{background-color:var(--color-secondary-container);opacity:1;font-weight:600;color:var(--color-on-secondary-container);border-bottom:2px solid var(--color-primary)}.sidenav-button[_ngcontent-%COMP%]:not(.active,.active2):hover{background-color:var(--color-secondary-container);opacity:.6;font-weight:500;color:var(--color-on-secondary-container);border-bottom:2px solid var(--color-primary)}.sidenav-button[_ngcontent-%COMP%]:last-child{margin-bottom:auto}.sidenav-button[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{margin:0;margin-right:.5rem;height:1.75rem;width:1.75rem;padding:.25rem}@media (max-width: 1100px){.navmenu[_ngcontent-%COMP%]{width:auto}.sidenav-button[_ngcontent-%COMP%]{padding:1rem}.sidenav-button[_ngcontent-%COMP%] .btntext[_ngcontent-%COMP%]{display:none}.sidenav-button[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{margin:auto}}@media (max-width: 765px){.navmenu[_ngcontent-%COMP%]{flex-direction:row;width:100%;height:78px;margin:0;padding:0;padding-top:1rem;padding-bottom:1rem;justify-content:space-evenly;align-items:center}.sidenav-button[_ngcontent-%COMP%]{padding:0;width:auto;border-radius:0;border-bottom:2px solid transparent}.sidenav-button[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{margin:.5rem;height:1.75rem;width:1.75rem}.sidenav-button[_ngcontent-%COMP%]:last-child{margin-bottom:0}}"],changeDetection:0});let a=o;return a})();var et=a=>["/media/",a];function tt(a,o){if(a&1&&c(0,"img",36),a&2){let d=T().$implicit;h("src",B(d.poster_path||"assets/poster-lg.png"),oe)("alt",B(d.title))}}function nt(a,o){if(a&1&&(i(0,"span",37),m(1),r()),a&2){let d=T().$implicit;l(),P(d.title+" ("+d.year+")")}}function it(a,o){if(a&1&&(i(0,"span",37),m(1),r()),a&2){let d=T().$implicit;l(),P(d.title)}}function ot(a,o){if(a&1){let d=S();i(0,"div",35),g("click",function(){C(d);let t=T();return b(t.searchResults=[])}),k(1,tt,1,4,"img",36),k(2,nt,2,1,"span",37),k(3,it,2,1,"span",37),r()}if(a&2){let d=o.$implicit,e=T();w("selected",d.id===e.selectedId),h("routerLink",d.id===-1?null:ge(6,et,d.id)),l(),q(d.id>0?1:-1),l(),q(d.id>0?2:-1),l(),q(d.id<0?3:-1)}}var $e=(()=>{let o=class o{constructor(){this.destroyRef=u(te),this.elementRef=u(ie),this.mediaService=u(Be),this.renderer=u(re),this.router=u(I),this.isDarkModeEnabled=!0,this.searchQuery="",this.searchForm=new Le,this.searchResults=[],this.selectedIndex=-1,this.selectedId=-1,this.RouteHome=_,this.noSearchResult={id:-1,title:"No results found",imdb_id:"",txdb_id:"",poster_path:"",year:0,youtube_trailer_id:"",is_movie:!0}}clickout(e){this.elementRef.nativeElement.contains(e.target)||(this.searchResults=[],this.selectedId=-1,this.selectedIndex=-1)}disableSelection(e){this.searchResults.length>0&&(this.selectedId=-1,this.selectedIndex=-1)}handleKeyboardEvent(e){let t=document.activeElement;if(!(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable)&&e.key==="f"){e.preventDefault(),document.getElementById("searchForm")?.querySelector("input")?.focus();return}if(this.searchResults.length>0){if(e.key==="Escape"){this.searchResults=[],this.selectedId=-1,this.selectedIndex=-1;return}let p=this.searchResults[0].id,s=this.searchResults[this.searchResults.length-1].id;if(e.key==="ArrowDown"||e.key==="Tab"&&!e.shiftKey){if(e.preventDefault(),this.selectedId===s){this.selectedIndex=0,this.selectedId=p;return}this.selectedIndex=this.selectedIndex+1,this.selectedId=this.searchResults[this.selectedIndex].id;return}else if(e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"){if(e.preventDefault(),this.selectedId===p){this.selectedIndex=this.searchResults.length-1,this.selectedId=s;return}this.selectedIndex=this.selectedIndex-1,this.selectedId=this.searchResults[this.selectedIndex].id;return}else if(e.key==="Enter"){this.router.navigate([M,this.selectedId]),this.searchResults=[];return}}}ngOnInit(){this.searchForm.valueChanges.pipe(W(400),K(),Oe(this.destroyRef)).subscribe(t=>{this.onSearch(t)});let e=localStorage.getItem("theme");if(e){let t=e==="dark";this.setTheme(t)}else window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?this.setTheme(!0):this.setTheme(!1)}onThemeChange(e){this.setTheme(!!e)}setTheme(e=!0){let t=e?"dark":"light",n=e?"light":"dark";this.isDarkModeEnabled=e,this.renderer.setAttribute(document.documentElement,"theme",t),this.renderer.removeClass(document.body,n),this.renderer.addClass(document.body,t),localStorage.setItem("theme",t)}onSearch(e=""){if(e.length<3){this.searchResults=[];return}e.trim()!==this.searchQuery&&(this.searchQuery=e,this.mediaService.searchMedia(this.searchQuery).subscribe(t=>{if(t.length===0){this.searchResults=[this.noSearchResult];return}this.searchResults=t}))}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=y({type:o,selectors:[["app-topnav"]],hostBindings:function(t,n){t&1&&g("click",function(s){return n.clickout(s)},x)("mousemove",function(s){return n.disableSelection(s)},x)("keydown",function(s){return n.handleKeyboardEvent(s)},x)},decls:37,vars:5,consts:[[1,"navbar"],[1,"navlogo",3,"routerLink"],["xmlns","http://www.w3.org/2000/svg","viewBox","0 0 2260 512","alt","Trailarr Logo","height","40",1,"sm-none","trailarr"],["d","M0 90h60c0 -8.284 6.716 -15 15 -15s15 6.716 15 15h90l-75 -74H40C17.909 16 0 33.909 0 56z","fill","#d9e7ec"],["d","M60 90c0 -8.284 6.716 -15 15 -15s15 6.716 15 15z","fill","#005fe4"],["d","M180 90h120l-75 -74H105z","fill","#005fe4"],["d","M300 90h120l-75 -74H225z","fill","#d9e7ec"],["d","M420 90h92V56c0 -22.091 -17.909 -40 -40 -40H345z","fill","#005fe4"],["d","M0 90h60c0 8.284 6.716 15 15 15s15 -6.716 15 -15h90l-75 76H0z","fill","#b6c4cf"],["d","M60 90c0 8.284 6.716 15 15 15s15 -6.716 15 -15z","fill","#0040a0"],["d","M180 90h120l-75 76H105z","fill","#0040a0"],["d","M300 90h120l-75 76H225z","fill","#b6c4cf"],["d","M420 90h92v76H345z","fill","#0040a0"],["d","M0 166h256v330H40c-22.091 0 -40 -17.909 -40 -40z","fill","#ff631a"],["d","M512 166H256v330h216c22.091 0 40 -17.909 40 -40z","fill","#f03800"],["d","M256 256H100c-8.284 0 -15 6.716 -15 15s6.716 15 15 15h50v60h-50c-8.284 0 -15 6.716 -15 15s6.716 15 15 15h156v-30h-76v-60h76z","fill","#005fe4"],["d","M256 256h156c8.284 0 15 6.716 15 15s-6.716 15 -15 15h-46v60h46c8.284 0 15 6.716 15 15s-6.716 15 -15 15H256v-30h76v-60h-76z","fill","#0040a0"],["transform","translate(620 50)","fill","#006a6a","fill-rule","evenodd","stroke","#006a6a","stroke-width","0.944882","stroke-linecap","round",1,"logo-text"],["d","M0 158.208v-41.472h46.08l10.24 -59.904 48.128 -10.752v70.656h62.976l-7.168 41.472h-55.808V309.76c-0.012 1.914 0.12 3.826 0.394 5.72q1.101 7.273 5.285 10.473 0.706 0.54 1.489 0.959a32.74 32.74 0 0 0 14.521 3.817q0.675 0.024 1.351 0.023 7.168 0 14.336 -1.024 3.358 -0.475 6.684 -1.132 3.205 -0.638 6.027 -1.404l0.089 -0.024c4.317 -0.99 8.584 -2.185 12.788 -3.58l0.012 -0.004 9.728 38.4 -4.608 1.536q-1.538 0.676 -3.12 1.239 -3.176 1.143 -7.613 2.361 -1.415 0.387 -2.835 0.752 -8.96 2.304 -20.992 4.096t-26.368 1.792 -26.368 -3.072a58.7 58.7 0 0 1 -13.115 -5.002 50 50 0 0 1 -7.621 -4.982 46.5 46.5 0 0 1 -13.104 -16.664 54 54 0 0 1 -0.464 -1q-4.864 -10.752 -4.864 -26.624V158.208z"],["d","M275.968 231.424v140.288H217.6V242.688c0.012 -7.18 -0.178 -14.36 -0.57 -21.531q-0.569 -10.049 -1.705 -18.714a176 176 0 0 0 -1.821 -11.211q-4.096 -20.736 -8.704 -33.536 -5.632 -14.848 -12.288 -24.064l46.08 -18.432q4.608 5.632 9.728 13.824 3.552 6.216 7.104 14.357 0.552 1.266 1.088 2.539 4.096 9.728 6.656 23.04 7.878 -22.845 21.209 -35.842a60 60 0 0 1 8.487 -6.91q19.456 -13.056 44.032 -13.056a87 87 0 0 1 15.131 1.271c2.318 0.407 4.616 0.922 6.885 1.545l2.286 0.631q7.786 2.155 7.453 2.185h-0.011l-16.384 56.832a0.1 0.1 0 0 0 0.032 -0.006q0.189 -0.122 -5.92 -2.81 -5.733 -2.523 -16.603 -2.785 -1.298 -0.03 -2.597 -0.031 -9.216 0 -18.432 4.608t-16.384 12.544a61.2 61.2 0 0 0 -8.641 12.475 75 75 0 0 0 -3.135 6.725q-4.608 11.264 -4.608 25.088Z"],["d","M592.384 127.488V248.32c-0.012 7.18 0.166 14.36 0.534 21.531q0.899 16.924 3.306 29.925 1.23 6.687 2.731 13.318 1.346 5.909 2.776 10.964a140 140 0 0 0 2.941 9.254q3.986 10.871 8.485 18.408a60 60 0 0 0 3.803 5.656l-45.568 18.432q-6.656 -6.656 -12.288 -15.872 -4.608 -8.192 -8.704 -19.712 -3.687 -10.37 -4.885 -24.268a145 145 0 0 1 -0.235 -3.124q-8.704 30.72 -27.904 46.336 -16.95 13.786 -44.474 15.402 -3.743 0.217 -7.494 0.214c-6.874 0.036 -13.736 -0.58 -20.494 -1.84a80 80 0 0 1 -21.234 -7.12q-17.664 -8.96 -29.44 -25.6a103.8 103.8 0 0 1 -11.818 -22.197 136 136 0 0 1 -5.59 -17.995q-5.632 -23.552 -5.632 -52.224 0 -29.184 8.96 -54.016a134.2 134.2 0 0 1 15.276 -30.248 119 119 0 0 1 9.812 -12.504q16.128 -17.92 38.656 -28.16t49.664 -10.24q15.36 0 32 2.304t30.976 4.864q10.976 1.96 19.401 3.77 2.463 0.528 4.919 1.094 9.984 2.304 11.52 2.816ZM534.016 232.96v-73.728q-5.12 -1.536 -15.36 -3.584 -9.34 -1.868 -16.976 -2.032 -0.727 -0.015 -1.456 -0.016 -15.212 0 -26.198 4.069a48 48 0 0 0 -5.802 2.587Q455.68 166.912 448 178.688t-10.752 28.16 -3.072 35.84q0 17.92 1.024 34.304t5.376 29.184T453.12 326.4q8.096 7.337 21.693 7.423l0.323 0.001q12.8 0 23.552 -8.704t18.688 -22.784 12.288 -32.256 4.352 -37.12Z"],["d","M658.944 315.904V116.736h58.368v194.048a61 61 0 0 0 0.21 5.254q0.447 5.108 1.846 8.178a10 10 0 0 0 1.528 2.44q3.584 4.096 10.752 4.096H736q2.304 0 4.352 -0.512 2.048 0 4.608 -0.512l6.144 36.864q-2.74 1.565 -6.676 2.832 -1.261 0.404 -2.54 0.752 -4.608 1.536 -11.52 2.56a91 91 0 0 1 -7.345 0.767q-3.91 0.257 -8.271 0.257a73 73 0 0 1 -16.43 -1.736q-12.009 -2.771 -20.509 -9.964a45 45 0 0 1 -4.533 -4.428 55.7 55.7 0 0 1 -13.072 -27.363 78 78 0 0 1 -1.264 -14.365ZM689.152 3.072q16.384 0 25.088 9.728t8.704 25.088 -8.96 25.6 -26.368 10.24q-16.384 0 -25.344 -9.984a34.8 34.8 0 0 1 -8.933 -22.765 45 45 0 0 1 -0.027 -1.555 46.1 46.1 0 0 1 1.479 -11.966 34.9 34.9 0 0 1 7.481 -14.146q8.278 -9.46 24.202 -10.181 1.338 -0.06 2.678 -0.059Z"],["d","M789.504 316.416V10.752L847.872 0v310.784q0 9.831 3.212 14.666 0.613 0.929 1.396 1.718a14.8 14.8 0 0 0 6.372 3.694q2.298 0.686 5.053 0.857a30 30 0 0 0 1.887 0.057q5.12 0 9.984 -0.512t8.96 -1.536q4.608 -1.024 8.192 -2.048l7.168 36.864q-6.656 2.56 -14.848 4.608 -6.16 1.76 -14.211 2.953 -1.341 0.198 -2.685 0.375 -4.996 0.647 -10.025 0.94 -5.655 0.34 -11.991 0.34a84 84 0 0 1 -15.974 -1.421q-17.314 -3.367 -27.034 -14.707a56.4 56.4 0 0 1 -12.606 -27.11 78.3 78.3 0 0 1 -1.218 -14.106Z"],["d","M1139.2 127.488V248.32c-0.012 7.18 0.166 14.36 0.534 21.531q0.899 16.924 3.306 29.925 1.23 6.687 2.731 13.318 1.346 5.909 2.776 10.964a140 140 0 0 0 2.941 9.254q3.986 10.871 8.485 18.408a60 60 0 0 0 3.803 5.656l-45.568 18.432q-6.656 -6.656 -12.288 -15.872 -4.608 -8.192 -8.704 -19.712 -3.687 -10.37 -4.885 -24.268a145 145 0 0 1 -0.235 -3.124q-8.704 30.72 -27.904 46.336 -16.95 13.786 -44.474 15.402 -3.743 0.217 -7.494 0.214c-6.874 0.036 -13.736 -0.58 -20.494 -1.84a80 80 0 0 1 -21.234 -7.12q-17.664 -8.96 -29.44 -25.6a103.8 103.8 0 0 1 -11.818 -22.197 136 136 0 0 1 -5.59 -17.995q-5.632 -23.552 -5.632 -52.224 0 -29.184 8.96 -54.016a134.2 134.2 0 0 1 15.276 -30.248 119 119 0 0 1 9.812 -12.504q16.128 -17.92 38.656 -28.16t49.664 -10.24q15.36 0 32 2.304t30.976 4.864q10.976 1.96 19.401 3.77 2.463 0.528 4.919 1.094 9.984 2.304 11.52 2.816Zm-58.368 105.472v-73.728q-5.12 -1.536 -15.36 -3.584 -9.34 -1.868 -16.976 -2.032 -0.727 -0.015 -1.456 -0.016 -15.212 0 -26.198 4.069a48 48 0 0 0 -5.802 2.587q-12.544 6.656 -20.224 18.432t-10.752 28.16 -3.072 35.84q0 17.92 1.024 34.304t5.376 29.184 12.544 20.224q8.096 7.337 21.693 7.423l0.323 0.001q12.8 0 23.552 -8.704t18.688 -22.784 12.288 -32.256 4.352 -37.12Z"],["d","M1260.544 231.424v140.288h-58.368V242.688c0.012 -7.18 -0.178 -14.36 -0.57 -21.531q-0.569 -10.049 -1.705 -18.714a176 176 0 0 0 -1.821 -11.211q-4.096 -20.736 -8.704 -33.536 -5.632 -14.848 -12.288 -24.064l46.08 -18.432q4.608 5.632 9.728 13.824 3.552 6.216 7.104 14.357 0.552 1.266 1.088 2.539 4.096 9.728 6.656 23.04 7.878 -22.845 21.209 -35.842a60 60 0 0 1 8.487 -6.91q19.456 -13.056 44.032 -13.056a87 87 0 0 1 15.131 1.271c2.318 0.407 4.616 0.922 6.885 1.545l2.286 0.631q7.786 2.155 7.453 2.185h-0.011l-16.384 56.832a0.1 0.1 0 0 0 0.032 -0.006q0.189 -0.122 -5.92 -2.81 -5.733 -2.523 -16.603 -2.785 -1.299 -0.03 -2.597 -0.031 -9.216 0 -18.432 4.608t-16.384 12.544a61.2 61.2 0 0 0 -8.641 12.475 75 75 0 0 0 -3.135 6.725q-4.608 11.264 -4.608 25.088Z"],["d","M1449.472 231.424v140.288h-58.368V242.688c0.012 -7.18 -0.178 -14.36 -0.57 -21.531q-0.569 -10.049 -1.705 -18.714a176 176 0 0 0 -1.821 -11.211q-4.096 -20.736 -8.704 -33.536 -5.632 -14.848 -12.288 -24.064l46.08 -18.432q4.608 5.632 9.728 13.824 3.552 6.216 7.104 14.357 0.552 1.266 1.088 2.539 4.096 9.728 6.656 23.04 7.878 -22.845 21.209 -35.842a60 60 0 0 1 8.487 -6.91q19.456 -13.056 44.032 -13.056a87 87 0 0 1 15.131 1.271c2.318 0.407 4.616 0.922 6.885 1.545l2.286 0.631q7.786 2.155 7.453 2.185h-0.011l-16.384 56.832a0.1 0.1 0 0 0 0.032 -0.006q0.189 -0.122 -5.92 -2.81 -5.733 -2.523 -16.603 -2.785 -1.299 -0.03 -2.597 -0.031 -9.216 0 -18.432 4.608t-16.384 12.544a61.2 61.2 0 0 0 -8.641 12.475 75 75 0 0 0 -3.135 6.725q-4.608 11.264 -4.608 25.088Z"],["src","/assets/logos/trailarr.svg","alt","Trailarr Logo","width","30","height","30",1,"sm-show"],[1,"navsearch"],["id","searchForm",1,"navsearch-form"],["type","text","autocomplete","off","name","query","placeholder","Search for media...","aria-label","search",3,"formControl"],[1,"navsearch-results"],[1,"title",3,"selected","routerLink"],[1,"switch2","sm-none"],["id","theme-switch","type","checkbox",3,"ngModelChange","ngModel"],[1,"slider2"],[1,"title",3,"click","routerLink"],[1,"search-poster",3,"src","alt"],[1,"search-title"]],template:function(t,n){t&1&&(i(0,"div",0)(1,"a",1),f(),i(2,"svg",2)(3,"g"),c(4,"path",3)(5,"path",4)(6,"path",5)(7,"path",6)(8,"path",7)(9,"path",8)(10,"path",9)(11,"path",10)(12,"path",11)(13,"path",12)(14,"path",13)(15,"path",14)(16,"path",15)(17,"path",16),r(),i(18,"g",17),c(19,"path",18)(20,"path",19)(21,"path",20)(22,"path",21)(23,"path",22)(24,"path",23)(25,"path",24)(26,"path",25),r()(),v(),c(27,"img",26),r(),i(28,"div",27)(29,"form",28),c(30,"input",29),r(),i(31,"div",30),E(32,ot,4,8,"div",31,le),r()(),i(34,"label",32)(35,"input",33),ue("ngModelChange",function(s){return he(n.isDarkModeEnabled,s)||(n.isDarkModeEnabled=s),s}),g("ngModelChange",function(s){return n.onThemeChange(s)}),r(),c(36,"span",34),r()()),t&2&&(l(),h("routerLink",n.RouteHome),l(29),h("formControl",n.searchForm),l(),w("active",n.searchResults.length>0),l(),O(n.searchResults),l(3),pe("ngModel",n.isDarkModeEnabled))},dependencies:[R,ze,Ae,Ie,Se,Re,De,Ze,He,Fe,Ve],styles:['.navbar[_ngcontent-%COMP%]{padding:1rem .5rem;display:flex;justify-content:space-between;align-items:center;flex-direction:row;width:100%}.navlogo[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;justify-content:center;font-size:1.5rem;font-weight:500;color:var(--color-on-surface);text-decoration:none;margin:0;padding:0;width:210px}.trailarr[_ngcontent-%COMP%] .logo-text[_ngcontent-%COMP%]{fill:var(--color-on-surface)}.trailarr[_ngcontent-%COMP%]:hover .logo-text[_ngcontent-%COMP%]{fill:var(--color-primary)}.navlogotext[_ngcontent-%COMP%]{margin-left:.5rem}.navsearch[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;justify-content:center;width:auto;flex-grow:1;padding:.25rem;position:relative}.navsearch-form[_ngcontent-%COMP%]{width:100%}.navsearch-form[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:100%;padding:.5rem;border:1px solid var(--color-outline);border-radius:.5rem;margin:0;font-size:1rem;background-color:var(--color-surface-container-highest);color:var(--color-on-surface)}.navsearch-form[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:focus{outline:var(--color-primary);border:1px solid var(--color-primary)}.navsearch-results[_ngcontent-%COMP%]{position:absolute;top:100%;left:2%;color:var(--color-on-surface);background-color:var(--color-surface-container-highest);border:.5px solid var(--color-outline);border-radius:5px;visibility:hidden;opacity:0;display:none;z-index:10}.active[_ngcontent-%COMP%]{visibility:visible;opacity:1;display:flex;flex-direction:column;max-height:40vh;max-width:60vw;overflow-x:hidden;overflow-y:auto;padding:.5rem;scroll-behavior:smooth;scroll-snap-type:y mandatory;transition:.25s}@media (width < 765px){.active[_ngcontent-%COMP%]{max-width:75vw}}.navsearch-results[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{display:flex;min-width:300px;width:auto;padding:.5rem;text-align:left;text-wrap:pretty;cursor:pointer}.search-poster[_ngcontent-%COMP%]{width:3rem}.search-title[_ngcontent-%COMP%]{margin:auto .5rem;text-align:left}.navsearch-results[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]:hover, .navsearch-results[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]:focus, .navsearch-results[_ngcontent-%COMP%] .selected[_ngcontent-%COMP%]{background-color:var(--color-surface-variant);outline:none}.navsearch-results[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]:focus, .navsearch-results[_ngcontent-%COMP%] .selected[_ngcontent-%COMP%]{scroll-snap-align:center}@media (max-width: 900px){.navlogo[_ngcontent-%COMP%]{width:auto;padding-left:1rem;padding-right:1rem}.navlogotext[_ngcontent-%COMP%]{display:none}}.switch2[_ngcontent-%COMP%]{margin:0 1rem;display:block;--width-of-switch: 3.5em;--height-of-switch: 2em;--size-of-icon: 1.4em;--slider-offset: .3em;position:relative;width:var(--width-of-switch);height:var(--height-of-switch)}.switch2[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{opacity:0;width:0;height:0}.slider2[_ngcontent-%COMP%]{position:absolute;cursor:pointer;inset:0;background-color:#fff;transition:.5s;border-radius:30px}.slider2[_ngcontent-%COMP%]:before{position:absolute;content:"";height:var(--size-of-icon, 1.4em);width:var(--size-of-icon, 1.4em);border-radius:20px;left:var(--slider-offset, .3em);top:50%;transform:translateY(-50%);background:linear-gradient(40deg,#775651,#904b40 70%);transition:.5s}input[_ngcontent-%COMP%]:checked + .slider2[_ngcontent-%COMP%]{background-color:#140c0b}input[_ngcontent-%COMP%]:checked + .slider2[_ngcontent-%COMP%]:before{left:calc(100% - (var(--size-of-icon, 1.4em) + var(--slider-offset, .3em)));background:#140c0b;box-shadow:inset -3px -2px 5px -2px #e7bdb6,inset -10px -4px #ffb4a8}']});let a=o;return a})();var rt=["sessionEndingDialog"],at=["sessionEndedDialog"];function st(a,o){if(a&1&&(i(0,"div",18)(1,"span"),m(2),r()()),a&2){let d=o.$implicit;de(d.type.toLowerCase()),l(2),P(d.message)}}var We=(()=>{let o=class o{constructor(){this.websocketService=u(Ne),this.messages=F([]),this.IDLE_LIMIT=12*6e4,this.EXTEND_LIMIT=3*6e4,this.sessionEndTime=F(Date.now()+this.IDLE_LIMIT+this.EXTEND_LIMIT),this.sessionEndingDialog=Q.required("sessionEndingDialog"),this.sessionEndedDialog=Q.required("sessionEndedDialog")}ngOnInit(){this.resetIdleTimer(),this.toastSubscription=this.websocketService.toastMessage.subscribe({next:e=>{this.messages.update(t=>[...t,e]),setTimeout(()=>{this.messages.update(t=>t.filter(n=>n!==e))},3e3)}})}resetIdleTimer(){clearTimeout(this.sessionTimeoutId),clearTimeout(this.extendTimeoutId),this.extendTimeoutId=setTimeout(()=>{this.showEndingDialog()},this.IDLE_LIMIT)}closeAllSubscriptions(){console.log("Session Idle, closing all subscriptions!"),this.showEndedDialog(),this.websocketService.close(),this.toastSubscription?.unsubscribe(),document.cookie="trailarr_api_key=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"}ngOnDestroy(){this.closeAllSubscriptions(),this.extendTimeoutId&&clearTimeout(this.extendTimeoutId),this.sessionTimeoutId&&clearTimeout(this.sessionTimeoutId)}showEndingDialog(){this.sessionEndTime.set(Date.now()+this.EXTEND_LIMIT),this.sessionEndingDialog().nativeElement.showModal(),this.sessionTimeoutId=setTimeout(()=>{this.closeAllSubscriptions()},this.EXTEND_LIMIT)}showEndedDialog(){this.closeEndingDialog(),this.sessionEndedDialog().nativeElement.showModal()}closeEndingDialog(){this.sessionEndingDialog().nativeElement.close()}extendTime(){this.sessionEndTime.set(Date.now()+this.EXTEND_LIMIT),this.resetIdleTimer(),this.closeEndingDialog()}reloadPage(){window.location.reload()}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=y({type:o,selectors:[["app-root"]],viewQuery:function(t,n){t&1&&(N(n.sessionEndingDialog,rt,5),N(n.sessionEndedDialog,at,5)),t&2&&ce(2)},hostBindings:function(t,n){t&1&&g("click",function(s){return n.resetIdleTimer(s)},x)("keypress",function(s){return n.resetIdleTimer(s)},x)},decls:45,vars:5,consts:[["sessionEndingDialog",""],["sessionEndedDialog",""],[1,"mainroot"],[1,"topnavbar"],[1,"mainbody"],[1,"sidebar"],[1,"main-content"],[1,"toast-container"],[1,"toast",3,"class"],[1,"dialog-content",3,"click"],[1,"loading-container"],[1,"loading-container-inner"],[1,"dash","first"],[1,"dash","seconde"],[1,"dash","third"],[1,"dash","fourth"],[1,"primary",3,"click"],["tabindex","1",1,"secondary",3,"click"],[1,"toast"]],template:function(t,n){if(t&1){let p=S();i(0,"div",2)(1,"header",3),c(2,"app-topnav"),r(),i(3,"div",4)(4,"div",5),c(5,"app-sidenav"),r(),i(6,"main",6),c(7,"router-outlet"),r()(),i(8,"div",7),E(9,st,3,3,"div",8,se),r()(),i(11,"dialog",null,0)(13,"div",9),g("click",function(z){return C(p),b(z.stopPropagation())}),i(14,"h2"),m(15,"Extend Session?"),r(),i(16,"p"),m(17,"You we gone for a while, we are about to close your session!"),r(),i(18,"p"),m(19),U(20,"timeRemaining"),U(21,"async"),r(),i(22,"div",10)(23,"div",11),c(24,"div",12)(25,"div",13)(26,"div",14)(27,"div",15),r()(),i(28,"button",16),g("click",function(){return C(p),b(n.extendTime())}),m(29,"Extend Session"),r()()(),i(30,"dialog",null,1)(32,"div",9),g("click",function(z){return C(p),b(z.stopPropagation())}),i(33,"h2"),m(34,"Session Timed Out!"),r(),i(35,"p"),m(36,"You we gone for a while, we closed your session!"),r(),i(37,"div",10)(38,"div",11),c(39,"div",12)(40,"div",13)(41,"div",14)(42,"div",15),r()(),i(43,"button",17),g("click",function(){return C(p),b(n.reloadPage())}),m(44,"Refresh"),r()()()}t&2&&(l(9),O(n.messages()),l(10),me("",j(21,3,j(20,1,n.sessionEndTime()))," remaining"))},dependencies:[be,$e,Ge,fe,Qe],styles:[".mainroot[_ngcontent-%COMP%]{height:100%;display:flex;flex-direction:column;background-color:var(--color-background);color:var(--color-on-background);position:relative}@media (width < 765px){.mainroot[_ngcontent-%COMP%]{height:auto}}.topnavbar[_ngcontent-%COMP%]{width:100%;height:auto;z-index:100;position:sticky;top:0;background-color:var(--color-surface-container);color:var(--color-on-surface)}.mainbody[_ngcontent-%COMP%]{margin:0;display:flex;flex-direction:row;flex:1 1 auto;background-color:var(--color-surface);color:var(--color-on-surface)}@media (width < 765px){.mainbody[_ngcontent-%COMP%]{flex-direction:column}}.sidebar[_ngcontent-%COMP%]{width:auto;z-index:100;background-color:var(--color-surface-container);color:var(--color-on-surface);order:1;position:sticky;top:76px;height:calc(100vh - 76px);view-transition-name:navmenu;view-transition-class:navmenu-class}@media (width < 765px){.sidebar[_ngcontent-%COMP%]{width:100%;height:78px;position:fixed;top:auto;bottom:-1px;left:0;order:2}}.main-content[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1 1 auto;order:2;background-color:var(--color-surface);color:var(--color-on-surface)}@media (width < 765px){.main-content[_ngcontent-%COMP%]{order:1;margin:.5rem;margin-bottom:80px}}.toast-container[_ngcontent-%COMP%]{position:fixed;top:5rem;right:3rem;z-index:999;max-width:25%;padding:1rem;display:flex;flex-direction:column;gap:1rem}@media (width < 765px){.toast-container[_ngcontent-%COMP%]{max-width:80%;right:1rem;padding:.5rem}}.toast[_ngcontent-%COMP%]{text-wrap:wrap;padding:1rem;border-radius:.5rem;background-color:var(--color-surface-container-high);color:var(--color-on-surface);animation:_ngcontent-%COMP%_slideInRight .3s ease-out forwards}.info[_ngcontent-%COMP%]{background-color:var(--color-info);color:var(--color-info-text)}.success[_ngcontent-%COMP%]{background-color:var(--color-success);color:var(--color-success-text)}.error[_ngcontent-%COMP%]{background-color:var(--color-warning);color:var(--color-warning-text)}@keyframes _ngcontent-%COMP%_slideInRight{0%{transform:translate(100%);opacity:0}to{transform:translate(0);opacity:1}}.dialog-content[_ngcontent-%COMP%]{padding:1rem}.loading-container[_ngcontent-%COMP%]{position:relative;height:6rem;margin:1rem}.loading-container-inner[_ngcontent-%COMP%]{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);display:flex}.dash[_ngcontent-%COMP%]{margin:0 15px;width:35px;height:15px;border-radius:8px;background:var(--color-primary);box-shadow:var(--color-surface-tint) 0 0 15px 0}.first[_ngcontent-%COMP%]{margin-right:-18px;transform-origin:center left;animation:_ngcontent-%COMP%_spin 3s linear infinite}.seconde[_ngcontent-%COMP%]{transform-origin:center right;animation:_ngcontent-%COMP%_spin2 3s linear infinite;animation-delay:.2s}.third[_ngcontent-%COMP%]{transform-origin:center right;animation:_ngcontent-%COMP%_spin3 3s linear infinite;animation-delay:.3s}.fourth[_ngcontent-%COMP%]{transform-origin:center right;animation:_ngcontent-%COMP%_spin4 3s linear infinite;animation-delay:.4s}@keyframes _ngcontent-%COMP%_spin{0%{transform:rotate(0)}25%{transform:rotate(360deg)}30%{transform:rotate(370deg)}35%{transform:rotate(360deg)}to{transform:rotate(360deg)}}@keyframes _ngcontent-%COMP%_spin2{0%{transform:rotate(0)}20%{transform:rotate(0)}30%{transform:rotate(-180deg)}35%{transform:rotate(-190deg)}40%{transform:rotate(-180deg)}78%{transform:rotate(-180deg)}95%{transform:rotate(-360deg)}98%{transform:rotate(-370deg)}to{transform:rotate(-360deg)}}@keyframes _ngcontent-%COMP%_spin3{0%{transform:rotate(0)}27%{transform:rotate(0)}40%{transform:rotate(180deg)}45%{transform:rotate(190deg)}50%{transform:rotate(180deg)}62%{transform:rotate(180deg)}75%{transform:rotate(360deg)}80%{transform:rotate(370deg)}85%{transform:rotate(360deg)}to{transform:rotate(360deg)}}@keyframes _ngcontent-%COMP%_spin4{0%{transform:rotate(0)}38%{transform:rotate(0)}60%{transform:rotate(-360deg)}65%{transform:rotate(-370deg)}75%{transform:rotate(-360deg)}to{transform:rotate(-360deg)}}"]});let a=o;return a})();var Ke=[{path:M,redirectTo:_,pathMatch:"full"},{path:_,loadChildren:()=>import("./routes-NHNKH5A6.js")},{path:`${M}/:${Ee}`,loadChildren:()=>import("./routes-NZ2SBGZ7.js")},{path:H,loadChildren:()=>import("./routes-NHNKH5A6.js")},{path:L,loadChildren:()=>import("./routes-NHNKH5A6.js")},{path:A,loadChildren:()=>import("./routes-MVNYOIPH.js")},{path:D,loadChildren:()=>import("./routes-SISZ4ED2.js")},{path:Z,loadChildren:()=>import("./routes-DPO7IHIM.js")},{path:"",redirectTo:_,pathMatch:"full"},{path:"**",redirectTo:""}];var Ye=(()=>{let o=class o{handleError(e){let t="";if(e.error instanceof ErrorEvent)t=`Client Error: ${e.error.message}`;else{let n=e.error?.detail,p=e.error?.message,s=e.message||"Unknown error occurred";t=`Server Error (${e.status}): ${n||p||s}`}return G(()=>new Error(t))}};o.\u0275fac=function(t){return new(t||o)},o.\u0275prov=J({token:o,factory:o.\u0275fac});let a=o;return a})();var Je={providers:[ye(Ke,ke(),Pe(we),Te({scrollPositionRestoration:"top",anchorScrolling:"enabled"})),{provide:ne,useClass:Ye},Me(),{provide:ve,useValue:{dateFormat:"medium",timezone:"UTC"}},ee(Ue.forRoot({rootUrl:""}),je.forRoot())]};_e(We,Je).catch(a=>console.error(a));
import{b as qe,d as Be}from"./chunk-VK2ZVBNO.js";import{a as Oe}from"./chunk-5Z466776.js";import{A as Ee,a as _e,b as Ce,c as be,d as I,e as R,f as xe,g as we,h as ye,i as Te,j as Pe,k as ke,p as _,q as D,r as M,s as H,u as L,v as Z,w as A}from"./chunk-FI53EPCD.js";import{a as Ne}from"./chunk-S5S5JI4K.js";import{B as Ve,N as ze,O as Fe,R as Ue,h as fe,k as ve,p as Se,q as Ie,s as Re,t as De,u as He,v as Le,w as Ze,x as Ae}from"./chunk-DD4PNHA2.js";import{b as je}from"./chunk-IPHAWIJV.js";import{$ as J,Ac as Me,Bb as T,E as X,Fa as oe,Gb as N,Hb as ce,I as W,Ia as x,Ja as l,Jb as w,L as K,Lb as de,Mb as m,Na as re,Nb as P,Ob as me,Qb as pe,Rb as he,Sb as ue,T as Y,Ta as y,Wa as ae,Wb as B,Zb as ge,ac as U,bc as j,ea as u,ga as ee,hb as k,ib as q,jb as se,ka as C,kb as le,la as b,lb as E,ma as f,mb as O,na as v,nb as h,nc as Q,ob as i,pb as r,qa as te,qb as c,ra as ne,s as G,ta as F,vb as S,w as $,ya as ie,zb as g}from"./chunk-D2M2EQWU.js";var Qe=(()=>{let o=class o{transform(e){let t=()=>typeof e=="number"?e:e instanceof Date?e.getTime():null;return X(1e3).pipe(Y(0),$(()=>{let n=t();return n===null?"Invalid date":qe(n)}))}};o.\u0275fac=function(t){return new(t||o)},o.\u0275pipe=ae({name:"timeRemaining",type:o,pure:!0});let a=o;return a})();var Ge=(()=>{let o=class o{constructor(){this.RouteHome=_,this.RouteLogs=D,this.RouteMedia=M,this.RouteMovies=H,this.RouteSeries=L,this.RouteSettings=Z,this.RouteTasks=A,this.router=u(I),this.previousUrl="",this.currentUrl="",this.router.events.subscribe(e=>{e instanceof Ce&&(this.previousUrl=this.currentUrl,this.currentUrl=e.url)})}isActiveLink(e){return this.previousUrl.includes(e)&&this.currentUrl.includes(M)||this.currentUrl.includes(e)}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=y({type:o,selectors:[["app-sidenav"]],decls:31,vars:12,consts:[[1,"navmenu"],["routerLinkActive","active",1,"sidenav-button",3,"routerLink"],["xmlns","http://www.w3.org/2000/svg","viewBox","0 -960 960 960",1,"icon"],["d","M240-200h120v-240h240v240h120v-360L480-740 240-560v360Zm-80 80v-480l320-240 320 240v480H520v-240h-80v240H160Zm320-350Z"],[1,"btntext"],["d","m160-800 80 160h120l-80-160h80l80 160h120l-80-160h80l80 160h120l-80-160h120q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800Zm0 240v320h640v-320H160Zm0 0v320-320Z"],["d","M320-120v-80H160q-33 0-56.5-23.5T80-280v-480q0-33 23.5-56.5T160-840h640q33 0 56.5 23.5T880-760v480q0 33-23.5 56.5T800-200H640v80H320ZM160-280h640v-480H160v480Zm0 0v-480 480Z"],["d","M200-640h560v-80H200v80Zm0 0v-80 80Zm0 560q-33 0-56.5-23.5T120-160v-560q0-33 23.5-56.5T200-800h40v-80h80v80h320v-80h80v80h40q33 0 56.5 23.5T840-720v227q-19-9-39-15t-41-9v-43H200v400h252q7 22 16.5 42T491-80H200Zm520 40q-83 0-141.5-58.5T520-240q0-83 58.5-141.5T720-440q83 0 141.5 58.5T920-240q0 83-58.5 141.5T720-40Zm67-105 28-28-75-75v-112h-40v128l87 87Z"],["d","M280-280h280v-80H280v80Zm0-160h400v-80H280v80Zm0-160h400v-80H280v80Zm-80 480q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"],["d","m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm70-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"]],template:function(t,n){t&1&&(i(0,"nav",0)(1,"a",1),f(),i(2,"svg",2),c(3,"path",3),r(),v(),i(4,"span",4),m(5,"Home"),r()(),i(6,"a",1),f(),i(7,"svg",2),c(8,"path",5),r(),v(),i(9,"span",4),m(10,"Movies"),r()(),i(11,"a",1),f(),i(12,"svg",2),c(13,"path",6),r(),v(),i(14,"span",4),m(15,"Series"),r()(),i(16,"a",1),f(),i(17,"svg",2),c(18,"path",7),r(),v(),i(19,"span",4),m(20,"Tasks"),r()(),i(21,"a",1),f(),i(22,"svg",2),c(23,"path",8),r(),v(),i(24,"span",4),m(25,"Logs"),r()(),i(26,"a",1),f(),i(27,"svg",2),c(28,"path",9),r(),v(),i(29,"span",4),m(30,"Settings"),r()()()),t&2&&(l(),w("active2",n.isActiveLink(n.RouteHome)),h("routerLink",n.RouteHome),l(5),w("active2",n.isActiveLink(n.RouteMovies)),h("routerLink",n.RouteMovies),l(5),w("active2",n.isActiveLink(n.RouteSeries)),h("routerLink",n.RouteSeries),l(5),h("routerLink",n.RouteTasks),l(5),h("routerLink",n.RouteLogs),l(5),h("routerLink",n.RouteSettings))},dependencies:[R,xe],styles:[".navmenu[_ngcontent-%COMP%]{overflow:auto;width:210px;height:100%;margin:0;padding:0;box-sizing:border-box;display:flex;flex-direction:column;align-items:start;justify-items:stretch}.sidenav-button[_ngcontent-%COMP%]{margin:0;padding:1rem 1rem 1rem 2rem;box-sizing:border-box;width:100%;text-decoration:none;color:inherit;text-align:start;font-weight:400;display:flex;align-items:center;transition:.3s;cursor:pointer;border-radius:0;border-bottom:2px solid transparent}.sidenav-button.active[_ngcontent-%COMP%], .sidenav-button.active2[_ngcontent-%COMP%]{background-color:var(--color-secondary-container);opacity:1;font-weight:600;color:var(--color-on-secondary-container);border-bottom:2px solid var(--color-primary)}.sidenav-button[_ngcontent-%COMP%]:not(.active,.active2):hover{background-color:var(--color-secondary-container);opacity:.6;font-weight:500;color:var(--color-on-secondary-container);border-bottom:2px solid var(--color-primary)}.sidenav-button[_ngcontent-%COMP%]:last-child{margin-bottom:auto}.sidenav-button[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{margin:0;margin-right:.5rem;height:1.75rem;width:1.75rem;padding:.25rem}@media (max-width: 1100px){.navmenu[_ngcontent-%COMP%]{width:auto}.sidenav-button[_ngcontent-%COMP%]{padding:1rem}.sidenav-button[_ngcontent-%COMP%] .btntext[_ngcontent-%COMP%]{display:none}.sidenav-button[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{margin:auto}}@media (max-width: 765px){.navmenu[_ngcontent-%COMP%]{flex-direction:row;width:100%;height:78px;margin:0;padding:0;padding-top:1rem;padding-bottom:1rem;justify-content:space-evenly;align-items:center}.sidenav-button[_ngcontent-%COMP%]{padding:0;width:auto;border-radius:0;border-bottom:2px solid transparent}.sidenav-button[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{margin:.5rem;height:1.75rem;width:1.75rem}.sidenav-button[_ngcontent-%COMP%]:last-child{margin-bottom:0}}"],changeDetection:0});let a=o;return a})();var et=a=>["/media/",a];function tt(a,o){if(a&1&&c(0,"img",36),a&2){let d=T().$implicit;h("src",B(d.poster_path||"assets/poster-lg.png"),oe)("alt",B(d.title))}}function nt(a,o){if(a&1&&(i(0,"span",37),m(1),r()),a&2){let d=T().$implicit;l(),P(d.title+" ("+d.year+")")}}function it(a,o){if(a&1&&(i(0,"span",37),m(1),r()),a&2){let d=T().$implicit;l(),P(d.title)}}function ot(a,o){if(a&1){let d=S();i(0,"div",35),g("click",function(){C(d);let t=T();return b(t.searchResults=[])}),k(1,tt,1,4,"img",36),k(2,nt,2,1,"span",37),k(3,it,2,1,"span",37),r()}if(a&2){let d=o.$implicit,e=T();w("selected",d.id===e.selectedId),h("routerLink",d.id===-1?null:ge(6,et,d.id)),l(),q(d.id>0?1:-1),l(),q(d.id>0?2:-1),l(),q(d.id<0?3:-1)}}var $e=(()=>{let o=class o{constructor(){this.destroyRef=u(te),this.elementRef=u(ie),this.mediaService=u(Be),this.renderer=u(re),this.router=u(I),this.isDarkModeEnabled=!0,this.searchQuery="",this.searchForm=new Le,this.searchResults=[],this.selectedIndex=-1,this.selectedId=-1,this.RouteHome=_,this.noSearchResult={id:-1,title:"No results found",imdb_id:"",txdb_id:"",poster_path:"",year:0,youtube_trailer_id:"",is_movie:!0}}clickout(e){this.elementRef.nativeElement.contains(e.target)||(this.searchResults=[],this.selectedId=-1,this.selectedIndex=-1)}disableSelection(e){this.searchResults.length>0&&(this.selectedId=-1,this.selectedIndex=-1)}handleKeyboardEvent(e){let t=document.activeElement;if(!(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable)&&e.key==="f"){e.preventDefault(),document.getElementById("searchForm")?.querySelector("input")?.focus();return}if(this.searchResults.length>0){if(e.key==="Escape"){this.searchResults=[],this.selectedId=-1,this.selectedIndex=-1;return}let p=this.searchResults[0].id,s=this.searchResults[this.searchResults.length-1].id;if(e.key==="ArrowDown"||e.key==="Tab"&&!e.shiftKey){if(e.preventDefault(),this.selectedId===s){this.selectedIndex=0,this.selectedId=p;return}this.selectedIndex=this.selectedIndex+1,this.selectedId=this.searchResults[this.selectedIndex].id;return}else if(e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"){if(e.preventDefault(),this.selectedId===p){this.selectedIndex=this.searchResults.length-1,this.selectedId=s;return}this.selectedIndex=this.selectedIndex-1,this.selectedId=this.searchResults[this.selectedIndex].id;return}else if(e.key==="Enter"){this.router.navigate([M,this.selectedId]),this.searchResults=[];return}}}ngOnInit(){this.searchForm.valueChanges.pipe(W(400),K(),Oe(this.destroyRef)).subscribe(t=>{this.onSearch(t)});let e=localStorage.getItem("theme");if(e){let t=e==="dark";this.setTheme(t)}else window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?this.setTheme(!0):this.setTheme(!1)}onThemeChange(e){this.setTheme(!!e)}setTheme(e=!0){let t=e?"dark":"light",n=e?"light":"dark";this.isDarkModeEnabled=e,this.renderer.setAttribute(document.documentElement,"theme",t),this.renderer.removeClass(document.body,n),this.renderer.addClass(document.body,t),localStorage.setItem("theme",t)}onSearch(e=""){if(e.length<3){this.searchResults=[];return}e.trim()!==this.searchQuery&&(this.searchQuery=e,this.mediaService.searchMedia(this.searchQuery).subscribe(t=>{if(t.length===0){this.searchResults=[this.noSearchResult];return}this.searchResults=t}))}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=y({type:o,selectors:[["app-topnav"]],hostBindings:function(t,n){t&1&&g("click",function(s){return n.clickout(s)},x)("mousemove",function(s){return n.disableSelection(s)},x)("keydown",function(s){return n.handleKeyboardEvent(s)},x)},decls:37,vars:5,consts:[[1,"navbar"],[1,"navlogo",3,"routerLink"],["xmlns","http://www.w3.org/2000/svg","viewBox","0 0 2260 512","alt","Trailarr Logo","height","40",1,"sm-none","trailarr"],["d","M0 90h60c0 -8.284 6.716 -15 15 -15s15 6.716 15 15h90l-75 -74H40C17.909 16 0 33.909 0 56z","fill","#d9e7ec"],["d","M60 90c0 -8.284 6.716 -15 15 -15s15 6.716 15 15z","fill","#005fe4"],["d","M180 90h120l-75 -74H105z","fill","#005fe4"],["d","M300 90h120l-75 -74H225z","fill","#d9e7ec"],["d","M420 90h92V56c0 -22.091 -17.909 -40 -40 -40H345z","fill","#005fe4"],["d","M0 90h60c0 8.284 6.716 15 15 15s15 -6.716 15 -15h90l-75 76H0z","fill","#b6c4cf"],["d","M60 90c0 8.284 6.716 15 15 15s15 -6.716 15 -15z","fill","#0040a0"],["d","M180 90h120l-75 76H105z","fill","#0040a0"],["d","M300 90h120l-75 76H225z","fill","#b6c4cf"],["d","M420 90h92v76H345z","fill","#0040a0"],["d","M0 166h256v330H40c-22.091 0 -40 -17.909 -40 -40z","fill","#ff631a"],["d","M512 166H256v330h216c22.091 0 40 -17.909 40 -40z","fill","#f03800"],["d","M256 256H100c-8.284 0 -15 6.716 -15 15s6.716 15 15 15h50v60h-50c-8.284 0 -15 6.716 -15 15s6.716 15 15 15h156v-30h-76v-60h76z","fill","#005fe4"],["d","M256 256h156c8.284 0 15 6.716 15 15s-6.716 15 -15 15h-46v60h46c8.284 0 15 6.716 15 15s-6.716 15 -15 15H256v-30h76v-60h-76z","fill","#0040a0"],["transform","translate(620 50)","fill","#006a6a","fill-rule","evenodd","stroke","#006a6a","stroke-width","0.944882","stroke-linecap","round",1,"logo-text"],["d","M0 158.208v-41.472h46.08l10.24 -59.904 48.128 -10.752v70.656h62.976l-7.168 41.472h-55.808V309.76c-0.012 1.914 0.12 3.826 0.394 5.72q1.101 7.273 5.285 10.473 0.706 0.54 1.489 0.959a32.74 32.74 0 0 0 14.521 3.817q0.675 0.024 1.351 0.023 7.168 0 14.336 -1.024 3.358 -0.475 6.684 -1.132 3.205 -0.638 6.027 -1.404l0.089 -0.024c4.317 -0.99 8.584 -2.185 12.788 -3.58l0.012 -0.004 9.728 38.4 -4.608 1.536q-1.538 0.676 -3.12 1.239 -3.176 1.143 -7.613 2.361 -1.415 0.387 -2.835 0.752 -8.96 2.304 -20.992 4.096t-26.368 1.792 -26.368 -3.072a58.7 58.7 0 0 1 -13.115 -5.002 50 50 0 0 1 -7.621 -4.982 46.5 46.5 0 0 1 -13.104 -16.664 54 54 0 0 1 -0.464 -1q-4.864 -10.752 -4.864 -26.624V158.208z"],["d","M275.968 231.424v140.288H217.6V242.688c0.012 -7.18 -0.178 -14.36 -0.57 -21.531q-0.569 -10.049 -1.705 -18.714a176 176 0 0 0 -1.821 -11.211q-4.096 -20.736 -8.704 -33.536 -5.632 -14.848 -12.288 -24.064l46.08 -18.432q4.608 5.632 9.728 13.824 3.552 6.216 7.104 14.357 0.552 1.266 1.088 2.539 4.096 9.728 6.656 23.04 7.878 -22.845 21.209 -35.842a60 60 0 0 1 8.487 -6.91q19.456 -13.056 44.032 -13.056a87 87 0 0 1 15.131 1.271c2.318 0.407 4.616 0.922 6.885 1.545l2.286 0.631q7.786 2.155 7.453 2.185h-0.011l-16.384 56.832a0.1 0.1 0 0 0 0.032 -0.006q0.189 -0.122 -5.92 -2.81 -5.733 -2.523 -16.603 -2.785 -1.298 -0.03 -2.597 -0.031 -9.216 0 -18.432 4.608t-16.384 12.544a61.2 61.2 0 0 0 -8.641 12.475 75 75 0 0 0 -3.135 6.725q-4.608 11.264 -4.608 25.088Z"],["d","M592.384 127.488V248.32c-0.012 7.18 0.166 14.36 0.534 21.531q0.899 16.924 3.306 29.925 1.23 6.687 2.731 13.318 1.346 5.909 2.776 10.964a140 140 0 0 0 2.941 9.254q3.986 10.871 8.485 18.408a60 60 0 0 0 3.803 5.656l-45.568 18.432q-6.656 -6.656 -12.288 -15.872 -4.608 -8.192 -8.704 -19.712 -3.687 -10.37 -4.885 -24.268a145 145 0 0 1 -0.235 -3.124q-8.704 30.72 -27.904 46.336 -16.95 13.786 -44.474 15.402 -3.743 0.217 -7.494 0.214c-6.874 0.036 -13.736 -0.58 -20.494 -1.84a80 80 0 0 1 -21.234 -7.12q-17.664 -8.96 -29.44 -25.6a103.8 103.8 0 0 1 -11.818 -22.197 136 136 0 0 1 -5.59 -17.995q-5.632 -23.552 -5.632 -52.224 0 -29.184 8.96 -54.016a134.2 134.2 0 0 1 15.276 -30.248 119 119 0 0 1 9.812 -12.504q16.128 -17.92 38.656 -28.16t49.664 -10.24q15.36 0 32 2.304t30.976 4.864q10.976 1.96 19.401 3.77 2.463 0.528 4.919 1.094 9.984 2.304 11.52 2.816ZM534.016 232.96v-73.728q-5.12 -1.536 -15.36 -3.584 -9.34 -1.868 -16.976 -2.032 -0.727 -0.015 -1.456 -0.016 -15.212 0 -26.198 4.069a48 48 0 0 0 -5.802 2.587Q455.68 166.912 448 178.688t-10.752 28.16 -3.072 35.84q0 17.92 1.024 34.304t5.376 29.184T453.12 326.4q8.096 7.337 21.693 7.423l0.323 0.001q12.8 0 23.552 -8.704t18.688 -22.784 12.288 -32.256 4.352 -37.12Z"],["d","M658.944 315.904V116.736h58.368v194.048a61 61 0 0 0 0.21 5.254q0.447 5.108 1.846 8.178a10 10 0 0 0 1.528 2.44q3.584 4.096 10.752 4.096H736q2.304 0 4.352 -0.512 2.048 0 4.608 -0.512l6.144 36.864q-2.74 1.565 -6.676 2.832 -1.261 0.404 -2.54 0.752 -4.608 1.536 -11.52 2.56a91 91 0 0 1 -7.345 0.767q-3.91 0.257 -8.271 0.257a73 73 0 0 1 -16.43 -1.736q-12.009 -2.771 -20.509 -9.964a45 45 0 0 1 -4.533 -4.428 55.7 55.7 0 0 1 -13.072 -27.363 78 78 0 0 1 -1.264 -14.365ZM689.152 3.072q16.384 0 25.088 9.728t8.704 25.088 -8.96 25.6 -26.368 10.24q-16.384 0 -25.344 -9.984a34.8 34.8 0 0 1 -8.933 -22.765 45 45 0 0 1 -0.027 -1.555 46.1 46.1 0 0 1 1.479 -11.966 34.9 34.9 0 0 1 7.481 -14.146q8.278 -9.46 24.202 -10.181 1.338 -0.06 2.678 -0.059Z"],["d","M789.504 316.416V10.752L847.872 0v310.784q0 9.831 3.212 14.666 0.613 0.929 1.396 1.718a14.8 14.8 0 0 0 6.372 3.694q2.298 0.686 5.053 0.857a30 30 0 0 0 1.887 0.057q5.12 0 9.984 -0.512t8.96 -1.536q4.608 -1.024 8.192 -2.048l7.168 36.864q-6.656 2.56 -14.848 4.608 -6.16 1.76 -14.211 2.953 -1.341 0.198 -2.685 0.375 -4.996 0.647 -10.025 0.94 -5.655 0.34 -11.991 0.34a84 84 0 0 1 -15.974 -1.421q-17.314 -3.367 -27.034 -14.707a56.4 56.4 0 0 1 -12.606 -27.11 78.3 78.3 0 0 1 -1.218 -14.106Z"],["d","M1139.2 127.488V248.32c-0.012 7.18 0.166 14.36 0.534 21.531q0.899 16.924 3.306 29.925 1.23 6.687 2.731 13.318 1.346 5.909 2.776 10.964a140 140 0 0 0 2.941 9.254q3.986 10.871 8.485 18.408a60 60 0 0 0 3.803 5.656l-45.568 18.432q-6.656 -6.656 -12.288 -15.872 -4.608 -8.192 -8.704 -19.712 -3.687 -10.37 -4.885 -24.268a145 145 0 0 1 -0.235 -3.124q-8.704 30.72 -27.904 46.336 -16.95 13.786 -44.474 15.402 -3.743 0.217 -7.494 0.214c-6.874 0.036 -13.736 -0.58 -20.494 -1.84a80 80 0 0 1 -21.234 -7.12q-17.664 -8.96 -29.44 -25.6a103.8 103.8 0 0 1 -11.818 -22.197 136 136 0 0 1 -5.59 -17.995q-5.632 -23.552 -5.632 -52.224 0 -29.184 8.96 -54.016a134.2 134.2 0 0 1 15.276 -30.248 119 119 0 0 1 9.812 -12.504q16.128 -17.92 38.656 -28.16t49.664 -10.24q15.36 0 32 2.304t30.976 4.864q10.976 1.96 19.401 3.77 2.463 0.528 4.919 1.094 9.984 2.304 11.52 2.816Zm-58.368 105.472v-73.728q-5.12 -1.536 -15.36 -3.584 -9.34 -1.868 -16.976 -2.032 -0.727 -0.015 -1.456 -0.016 -15.212 0 -26.198 4.069a48 48 0 0 0 -5.802 2.587q-12.544 6.656 -20.224 18.432t-10.752 28.16 -3.072 35.84q0 17.92 1.024 34.304t5.376 29.184 12.544 20.224q8.096 7.337 21.693 7.423l0.323 0.001q12.8 0 23.552 -8.704t18.688 -22.784 12.288 -32.256 4.352 -37.12Z"],["d","M1260.544 231.424v140.288h-58.368V242.688c0.012 -7.18 -0.178 -14.36 -0.57 -21.531q-0.569 -10.049 -1.705 -18.714a176 176 0 0 0 -1.821 -11.211q-4.096 -20.736 -8.704 -33.536 -5.632 -14.848 -12.288 -24.064l46.08 -18.432q4.608 5.632 9.728 13.824 3.552 6.216 7.104 14.357 0.552 1.266 1.088 2.539 4.096 9.728 6.656 23.04 7.878 -22.845 21.209 -35.842a60 60 0 0 1 8.487 -6.91q19.456 -13.056 44.032 -13.056a87 87 0 0 1 15.131 1.271c2.318 0.407 4.616 0.922 6.885 1.545l2.286 0.631q7.786 2.155 7.453 2.185h-0.011l-16.384 56.832a0.1 0.1 0 0 0 0.032 -0.006q0.189 -0.122 -5.92 -2.81 -5.733 -2.523 -16.603 -2.785 -1.299 -0.03 -2.597 -0.031 -9.216 0 -18.432 4.608t-16.384 12.544a61.2 61.2 0 0 0 -8.641 12.475 75 75 0 0 0 -3.135 6.725q-4.608 11.264 -4.608 25.088Z"],["d","M1449.472 231.424v140.288h-58.368V242.688c0.012 -7.18 -0.178 -14.36 -0.57 -21.531q-0.569 -10.049 -1.705 -18.714a176 176 0 0 0 -1.821 -11.211q-4.096 -20.736 -8.704 -33.536 -5.632 -14.848 -12.288 -24.064l46.08 -18.432q4.608 5.632 9.728 13.824 3.552 6.216 7.104 14.357 0.552 1.266 1.088 2.539 4.096 9.728 6.656 23.04 7.878 -22.845 21.209 -35.842a60 60 0 0 1 8.487 -6.91q19.456 -13.056 44.032 -13.056a87 87 0 0 1 15.131 1.271c2.318 0.407 4.616 0.922 6.885 1.545l2.286 0.631q7.786 2.155 7.453 2.185h-0.011l-16.384 56.832a0.1 0.1 0 0 0 0.032 -0.006q0.189 -0.122 -5.92 -2.81 -5.733 -2.523 -16.603 -2.785 -1.299 -0.03 -2.597 -0.031 -9.216 0 -18.432 4.608t-16.384 12.544a61.2 61.2 0 0 0 -8.641 12.475 75 75 0 0 0 -3.135 6.725q-4.608 11.264 -4.608 25.088Z"],["src","/assets/logos/trailarr.svg","alt","Trailarr Logo","width","30","height","30",1,"sm-show"],[1,"navsearch"],["id","searchForm",1,"navsearch-form"],["type","text","autocomplete","off","name","query","placeholder","Search for media...","aria-label","search",3,"formControl"],[1,"navsearch-results"],[1,"title",3,"selected","routerLink"],[1,"switch2","sm-none"],["id","theme-switch","type","checkbox",3,"ngModelChange","ngModel"],[1,"slider2"],[1,"title",3,"click","routerLink"],[1,"search-poster",3,"src","alt"],[1,"search-title"]],template:function(t,n){t&1&&(i(0,"div",0)(1,"a",1),f(),i(2,"svg",2)(3,"g"),c(4,"path",3)(5,"path",4)(6,"path",5)(7,"path",6)(8,"path",7)(9,"path",8)(10,"path",9)(11,"path",10)(12,"path",11)(13,"path",12)(14,"path",13)(15,"path",14)(16,"path",15)(17,"path",16),r(),i(18,"g",17),c(19,"path",18)(20,"path",19)(21,"path",20)(22,"path",21)(23,"path",22)(24,"path",23)(25,"path",24)(26,"path",25),r()(),v(),c(27,"img",26),r(),i(28,"div",27)(29,"form",28),c(30,"input",29),r(),i(31,"div",30),E(32,ot,4,8,"div",31,le),r()(),i(34,"label",32)(35,"input",33),ue("ngModelChange",function(s){return he(n.isDarkModeEnabled,s)||(n.isDarkModeEnabled=s),s}),g("ngModelChange",function(s){return n.onThemeChange(s)}),r(),c(36,"span",34),r()()),t&2&&(l(),h("routerLink",n.RouteHome),l(29),h("formControl",n.searchForm),l(),w("active",n.searchResults.length>0),l(),O(n.searchResults),l(3),pe("ngModel",n.isDarkModeEnabled))},dependencies:[R,ze,Ae,Ie,Se,Re,De,Ze,He,Fe,Ve],styles:['.navbar[_ngcontent-%COMP%]{padding:1rem .5rem;display:flex;justify-content:space-between;align-items:center;flex-direction:row;width:100%}.navlogo[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;justify-content:center;font-size:1.5rem;font-weight:500;color:var(--color-on-surface);text-decoration:none;margin:0;padding:0;width:210px}.trailarr[_ngcontent-%COMP%] .logo-text[_ngcontent-%COMP%]{fill:var(--color-on-surface)}.trailarr[_ngcontent-%COMP%]:hover .logo-text[_ngcontent-%COMP%]{fill:var(--color-primary)}.navlogotext[_ngcontent-%COMP%]{margin-left:.5rem}.navsearch[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;justify-content:center;width:auto;flex-grow:1;padding:.25rem;position:relative}.navsearch-form[_ngcontent-%COMP%]{width:100%}.navsearch-form[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:100%;padding:.5rem;border:1px solid var(--color-outline);border-radius:.5rem;margin:0;font-size:1rem;background-color:var(--color-surface-container-highest);color:var(--color-on-surface)}.navsearch-form[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:focus{outline:var(--color-primary);border:1px solid var(--color-primary)}.navsearch-results[_ngcontent-%COMP%]{position:absolute;top:100%;left:2%;color:var(--color-on-surface);background-color:var(--color-surface-container-highest);border:.5px solid var(--color-outline);border-radius:5px;visibility:hidden;opacity:0;display:none;z-index:10}.active[_ngcontent-%COMP%]{visibility:visible;opacity:1;display:flex;flex-direction:column;max-height:40vh;max-width:60vw;overflow-x:hidden;overflow-y:auto;padding:.5rem;scroll-behavior:smooth;scroll-snap-type:y mandatory;transition:.25s}@media (width < 765px){.active[_ngcontent-%COMP%]{max-width:75vw}}.navsearch-results[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{display:flex;min-width:300px;width:auto;padding:.5rem;text-align:left;text-wrap:pretty;cursor:pointer}.search-poster[_ngcontent-%COMP%]{width:3rem}.search-title[_ngcontent-%COMP%]{margin:auto .5rem;text-align:left}.navsearch-results[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]:hover, .navsearch-results[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]:focus, .navsearch-results[_ngcontent-%COMP%] .selected[_ngcontent-%COMP%]{background-color:var(--color-surface-variant);outline:none}.navsearch-results[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]:focus, .navsearch-results[_ngcontent-%COMP%] .selected[_ngcontent-%COMP%]{scroll-snap-align:center}@media (max-width: 900px){.navlogo[_ngcontent-%COMP%]{width:auto;padding-left:1rem;padding-right:1rem}.navlogotext[_ngcontent-%COMP%]{display:none}}.switch2[_ngcontent-%COMP%]{margin:0 1rem;display:block;--width-of-switch: 3.5em;--height-of-switch: 2em;--size-of-icon: 1.4em;--slider-offset: .3em;position:relative;width:var(--width-of-switch);height:var(--height-of-switch)}.switch2[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{opacity:0;width:0;height:0}.slider2[_ngcontent-%COMP%]{position:absolute;cursor:pointer;inset:0;background-color:#fff;transition:.5s;border-radius:30px}.slider2[_ngcontent-%COMP%]:before{position:absolute;content:"";height:var(--size-of-icon, 1.4em);width:var(--size-of-icon, 1.4em);border-radius:20px;left:var(--slider-offset, .3em);top:50%;transform:translateY(-50%);background:linear-gradient(40deg,#775651,#904b40 70%);transition:.5s}input[_ngcontent-%COMP%]:checked + .slider2[_ngcontent-%COMP%]{background-color:#140c0b}input[_ngcontent-%COMP%]:checked + .slider2[_ngcontent-%COMP%]:before{left:calc(100% - (var(--size-of-icon, 1.4em) + var(--slider-offset, .3em)));background:#140c0b;box-shadow:inset -3px -2px 5px -2px #e7bdb6,inset -10px -4px #ffb4a8}']});let a=o;return a})();var rt=["sessionEndingDialog"],at=["sessionEndedDialog"];function st(a,o){if(a&1&&(i(0,"div",18)(1,"span"),m(2),r()()),a&2){let d=o.$implicit;de(d.type.toLowerCase()),l(2),P(d.message)}}var We=(()=>{let o=class o{constructor(){this.websocketService=u(Ne),this.messages=F([]),this.IDLE_LIMIT=12*6e4,this.EXTEND_LIMIT=3*6e4,this.sessionEndTime=F(Date.now()+this.IDLE_LIMIT+this.EXTEND_LIMIT),this.sessionEndingDialog=Q.required("sessionEndingDialog"),this.sessionEndedDialog=Q.required("sessionEndedDialog")}ngOnInit(){this.resetIdleTimer(),this.toastSubscription=this.websocketService.toastMessage.subscribe({next:e=>{this.messages.update(t=>[...t,e]),setTimeout(()=>{this.messages.update(t=>t.filter(n=>n!==e))},3e3)}})}resetIdleTimer(){clearTimeout(this.sessionTimeoutId),clearTimeout(this.extendTimeoutId),this.extendTimeoutId=setTimeout(()=>{this.showEndingDialog()},this.IDLE_LIMIT)}closeAllSubscriptions(){console.log("Session Idle, closing all subscriptions!"),this.showEndedDialog(),this.websocketService.close(),this.toastSubscription?.unsubscribe(),document.cookie="trailarr_api_key=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"}ngOnDestroy(){this.closeAllSubscriptions(),this.extendTimeoutId&&clearTimeout(this.extendTimeoutId),this.sessionTimeoutId&&clearTimeout(this.sessionTimeoutId)}showEndingDialog(){this.sessionEndTime.set(Date.now()+this.EXTEND_LIMIT),this.sessionEndingDialog().nativeElement.showModal(),this.sessionTimeoutId=setTimeout(()=>{this.closeAllSubscriptions()},this.EXTEND_LIMIT)}showEndedDialog(){this.closeEndingDialog(),this.sessionEndedDialog().nativeElement.showModal()}closeEndingDialog(){this.sessionEndingDialog().nativeElement.close()}extendTime(){this.sessionEndTime.set(Date.now()+this.EXTEND_LIMIT),this.resetIdleTimer(),this.closeEndingDialog()}reloadPage(){window.location.reload()}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=y({type:o,selectors:[["app-root"]],viewQuery:function(t,n){t&1&&(N(n.sessionEndingDialog,rt,5),N(n.sessionEndedDialog,at,5)),t&2&&ce(2)},hostBindings:function(t,n){t&1&&g("click",function(s){return n.resetIdleTimer(s)},x)("keypress",function(s){return n.resetIdleTimer(s)},x)},decls:45,vars:5,consts:[["sessionEndingDialog",""],["sessionEndedDialog",""],[1,"mainroot"],[1,"topnavbar"],[1,"mainbody"],[1,"sidebar"],[1,"main-content"],[1,"toast-container"],[1,"toast",3,"class"],[1,"dialog-content",3,"click"],[1,"loading-container"],[1,"loading-container-inner"],[1,"dash","first"],[1,"dash","seconde"],[1,"dash","third"],[1,"dash","fourth"],[1,"primary",3,"click"],["tabindex","1",1,"secondary",3,"click"],[1,"toast"]],template:function(t,n){if(t&1){let p=S();i(0,"div",2)(1,"header",3),c(2,"app-topnav"),r(),i(3,"div",4)(4,"div",5),c(5,"app-sidenav"),r(),i(6,"main",6),c(7,"router-outlet"),r()(),i(8,"div",7),E(9,st,3,3,"div",8,se),r()(),i(11,"dialog",null,0)(13,"div",9),g("click",function(z){return C(p),b(z.stopPropagation())}),i(14,"h2"),m(15,"Extend Session?"),r(),i(16,"p"),m(17,"You we gone for a while, we are about to close your session!"),r(),i(18,"p"),m(19),U(20,"timeRemaining"),U(21,"async"),r(),i(22,"div",10)(23,"div",11),c(24,"div",12)(25,"div",13)(26,"div",14)(27,"div",15),r()(),i(28,"button",16),g("click",function(){return C(p),b(n.extendTime())}),m(29,"Extend Session"),r()()(),i(30,"dialog",null,1)(32,"div",9),g("click",function(z){return C(p),b(z.stopPropagation())}),i(33,"h2"),m(34,"Session Timed Out!"),r(),i(35,"p"),m(36,"You we gone for a while, we closed your session!"),r(),i(37,"div",10)(38,"div",11),c(39,"div",12)(40,"div",13)(41,"div",14)(42,"div",15),r()(),i(43,"button",17),g("click",function(){return C(p),b(n.reloadPage())}),m(44,"Refresh"),r()()()}t&2&&(l(9),O(n.messages()),l(10),me("",j(21,3,j(20,1,n.sessionEndTime()))," remaining"))},dependencies:[be,$e,Ge,fe,Qe],styles:[".mainroot[_ngcontent-%COMP%]{height:100%;display:flex;flex-direction:column;background-color:var(--color-background);color:var(--color-on-background);position:relative}@media (width < 765px){.mainroot[_ngcontent-%COMP%]{height:auto}}.topnavbar[_ngcontent-%COMP%]{width:100%;height:auto;z-index:100;position:sticky;top:0;background-color:var(--color-surface-container);color:var(--color-on-surface)}.mainbody[_ngcontent-%COMP%]{margin:0;display:flex;flex-direction:row;flex:1 1 auto;background-color:var(--color-surface);color:var(--color-on-surface)}@media (width < 765px){.mainbody[_ngcontent-%COMP%]{flex-direction:column}}.sidebar[_ngcontent-%COMP%]{width:auto;z-index:100;background-color:var(--color-surface-container);color:var(--color-on-surface);order:1;position:sticky;top:76px;height:calc(100vh - 76px);view-transition-name:navmenu;view-transition-class:navmenu-class}@media (width < 765px){.sidebar[_ngcontent-%COMP%]{width:100%;height:78px;position:fixed;top:auto;bottom:-1px;left:0;order:2}}.main-content[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1 1 auto;order:2;background-color:var(--color-surface);color:var(--color-on-surface)}@media (width < 765px){.main-content[_ngcontent-%COMP%]{order:1;margin:.5rem;margin-bottom:80px}}.toast-container[_ngcontent-%COMP%]{position:fixed;top:5rem;right:3rem;z-index:999;max-width:25%;padding:1rem;display:flex;flex-direction:column;gap:1rem}@media (width < 765px){.toast-container[_ngcontent-%COMP%]{max-width:80%;right:1rem;padding:.5rem}}.toast[_ngcontent-%COMP%]{text-wrap:wrap;padding:1rem;border-radius:.5rem;background-color:var(--color-surface-container-high);color:var(--color-on-surface);animation:_ngcontent-%COMP%_slideInRight .3s ease-out forwards}.info[_ngcontent-%COMP%]{background-color:var(--color-info);color:var(--color-info-text)}.success[_ngcontent-%COMP%]{background-color:var(--color-success);color:var(--color-success-text)}.error[_ngcontent-%COMP%]{background-color:var(--color-warning);color:var(--color-warning-text)}@keyframes _ngcontent-%COMP%_slideInRight{0%{transform:translate(100%);opacity:0}to{transform:translate(0);opacity:1}}.dialog-content[_ngcontent-%COMP%]{padding:1rem}.loading-container[_ngcontent-%COMP%]{position:relative;height:6rem;margin:1rem}.loading-container-inner[_ngcontent-%COMP%]{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);display:flex}.dash[_ngcontent-%COMP%]{margin:0 15px;width:35px;height:15px;border-radius:8px;background:var(--color-primary);box-shadow:var(--color-surface-tint) 0 0 15px 0}.first[_ngcontent-%COMP%]{margin-right:-18px;transform-origin:center left;animation:_ngcontent-%COMP%_spin 3s linear infinite}.seconde[_ngcontent-%COMP%]{transform-origin:center right;animation:_ngcontent-%COMP%_spin2 3s linear infinite;animation-delay:.2s}.third[_ngcontent-%COMP%]{transform-origin:center right;animation:_ngcontent-%COMP%_spin3 3s linear infinite;animation-delay:.3s}.fourth[_ngcontent-%COMP%]{transform-origin:center right;animation:_ngcontent-%COMP%_spin4 3s linear infinite;animation-delay:.4s}@keyframes _ngcontent-%COMP%_spin{0%{transform:rotate(0)}25%{transform:rotate(360deg)}30%{transform:rotate(370deg)}35%{transform:rotate(360deg)}to{transform:rotate(360deg)}}@keyframes _ngcontent-%COMP%_spin2{0%{transform:rotate(0)}20%{transform:rotate(0)}30%{transform:rotate(-180deg)}35%{transform:rotate(-190deg)}40%{transform:rotate(-180deg)}78%{transform:rotate(-180deg)}95%{transform:rotate(-360deg)}98%{transform:rotate(-370deg)}to{transform:rotate(-360deg)}}@keyframes _ngcontent-%COMP%_spin3{0%{transform:rotate(0)}27%{transform:rotate(0)}40%{transform:rotate(180deg)}45%{transform:rotate(190deg)}50%{transform:rotate(180deg)}62%{transform:rotate(180deg)}75%{transform:rotate(360deg)}80%{transform:rotate(370deg)}85%{transform:rotate(360deg)}to{transform:rotate(360deg)}}@keyframes _ngcontent-%COMP%_spin4{0%{transform:rotate(0)}38%{transform:rotate(0)}60%{transform:rotate(-360deg)}65%{transform:rotate(-370deg)}75%{transform:rotate(-360deg)}to{transform:rotate(-360deg)}}"]});let a=o;return a})();var Ke=[{path:M,redirectTo:_,pathMatch:"full"},{path:_,loadChildren:()=>import("./routes-W3UVQJFH.js")},{path:`${M}/:${Ee}`,loadChildren:()=>import("./routes-XZB7MBQP.js")},{path:H,loadChildren:()=>import("./routes-W3UVQJFH.js")},{path:L,loadChildren:()=>import("./routes-W3UVQJFH.js")},{path:A,loadChildren:()=>import("./routes-54SPYTVT.js")},{path:D,loadChildren:()=>import("./routes-SJUJR4RA.js")},{path:Z,loadChildren:()=>import("./routes-WQ6WUWLE.js")},{path:"",redirectTo:_,pathMatch:"full"},{path:"**",redirectTo:""}];var Ye=(()=>{let o=class o{handleError(e){let t="";if(e.error instanceof ErrorEvent)t=`Client Error: ${e.error.message}`;else{let n=e.error?.detail,p=e.error?.message,s=e.message||"Unknown error occurred";t=`Server Error (${e.status}): ${n||p||s}`}return G(()=>new Error(t))}};o.\u0275fac=function(t){return new(t||o)},o.\u0275prov=J({token:o,factory:o.\u0275fac});let a=o;return a})();var Je={providers:[ye(Ke,ke(),Pe(we),Te({scrollPositionRestoration:"top",anchorScrolling:"enabled"})),{provide:ne,useClass:Ye},Me(),{provide:ve,useValue:{dateFormat:"medium",timezone:"UTC"}},ee(Ue.forRoot({rootUrl:""}),je.forRoot())]};_e(We,Je).catch(a=>console.error(a));

Check warning

Code scanning / CodeQL

Clear text transmission of sensitive cookie Medium

Sensitive cookie sent without enforcing SSL encryption.

Copilot Autofix

AI 5 months ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants