<!DOCTYPE html>
<html lang="en">
    <head>
        <script disable-devtool-auto src='https://cdn.jsdelivr.net/npm/disable-devtool@latest'></script>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="google-adsense-account" content="ca-pub-4637804660279187">
        <meta name="theme-color" content="#ff0000" />
        <meta name="robots" content="index, follow" />
        <meta name="description" content="Discover and stream your favorite Movies, TV Shows, Anime, LiveTV, and explore Torrents with RgShows - a content search and watch website. Enjoy unlimited access to a vast library of content for free." />
        <meta property="og:title" content="RgShows" />
        <meta property="og:description" content="Discover and stream your favorite Movies, TV Shows, Anime, LiveTV, and explore Torrents with RgShows - a content search and watch website. Enjoy unlimited access to a vast library of content for free." />
        <meta property="og:image" content="https://rgshows.me/logo.png" />
        <meta property="og:url" content="https://rgshows.me/" />
        <meta property="og:type" content="website" />
        <script src="https://cdnjs.cloudflare.com/ajax/libs/devtools-detector/2.0.17/devtools-detector.js"></script>
        <script src="js/protected_devtoolsdetector.js" defer></script>
        <script src="js/nocheats.js" defer></script>
        <script src="https://www.rgshows.me/js/venus.js" type="text/javascript" data-cfasync="false"></script>      
        <link rel="manifest" href="/manifest.json">
        <link rel="preload stylesheet" href="css/flash.css" as="style">
        <script src="https://cdn.jsdelivr.net/npm/@simondmc/popup-js@1.4.3/popup.min.js"></script>
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" />
        <link rel="stylesheet" href="https://unpkg.com/kursor/dist/kursor.css">
        <style>
            @import url(https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;500&display=swap);html {
                line-height: 1.15;
                -webkit-text-size-adjust: 100%
            }

            body {
                margin: 0
            }

            main {
                display: block
            }

            h1 {
                font-size: 2em;
                margin: .67em 0
            }

            hr {
                box-sizing: content-box;
                height: 0;
                overflow: visible
            }

            pre {
                font-family: monospace,monospace;
                font-size: 1em
            }

            a {
                background-color: transparent
            }

            abbr[title] {
                border-bottom: none;
                text-decoration: underline;
                text-decoration: underline dotted
            }

            b,strong {
                font-weight: bolder
            }

            code,kbd,samp {
                font-family: monospace,monospace;
                font-size: 1em
            }

            small {
                font-size: 80%
            }

            sub,sup {
                font-size: 75%;
                line-height: 0;
                position: relative;
                vertical-align: baseline
            }

            sub {
                bottom: -.25em
            }

            sup {
                top: -.5em
            }

            img {
                border-style: none
            }

            button,input,optgroup,select,textarea {
                font-family: inherit;
                font-size: 100%;
                line-height: 1.15;
                margin: 0
            }

            button,input {
                overflow: visible
            }

            button,select {
                text-transform: none
            }

            [type=button],[type=reset],[type=submit],button {
                -webkit-appearance: button
            }

            [type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner {
                border-style: none;
                padding: 0
            }

            [type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring {
                outline: 1px dotted ButtonText
            }

            fieldset {
                padding: .35em .75em .625em
            }

            legend {
                box-sizing: border-box;
                color: inherit;
                display: table;
                max-width: 100%;
                padding: 0;
                white-space: normal
            }

            progress {
                vertical-align: baseline
            }

            textarea {
                overflow: auto
            }

            [type=checkbox],[type=radio] {
                box-sizing: border-box;
                padding: 0
            }

            [type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button {
                height: auto
            }

            [type=search] {
                -webkit-appearance: textfield;
                outline-offset: -2px
            }

            [type=search]::-webkit-search-decoration {
                -webkit-appearance: none
            }

            ::-webkit-file-upload-button {
                -webkit-appearance: button;
                font: inherit
            }

            details {
                display: block
            }

            summary {
                display: list-item
            }

            [hidden],template {
                display: none
            }

            html {
                --border-radius: 8px;
                --max-width: 85rem;
                --transition-speed: .15s;
                --dim-opacity: 75%;
                --dimmer-opacity: 50%;
                --small-gap: 10px;
                --large-gap: 20px;
                --small-border: 1px;
                --large-border: 2px;
                --small-padding: 10px;
                --large-padding: 20px;
                --min-font: 13px;
                --small-font: 14px;
                --large-font: 15px;
                --max-font: 17px;
                --footer-height: 4rem
            }

            @media (prefers-color-scheme: dark) {
                html {
                    --background:#141414;
                    --primary: #e12323;
                    --light: #1a1a1a;
                    --light-rgb: 26,26,28;
                    --lighter: #232323;
                    --lightest: #373737;
                    --dark: #0f0f0f;
                    --text: #fafafa
                }
            }

            @media (prefers-color-scheme: light) {
                html {
                    --background:#f7f3f3;
                    --primary: #ee2020;
                    --light: #d8d3d3;
                    --light-rgb: 247,243,243;
                    --lighter: #c0bdbd;
                    --lightest: #9c9a9a;
                    --dark: #ece6e6;
                    --text: #080808
                }
            }

            html.dark {
                --background: #141414;
                --primary: #e12323;
                --light: #1a1a1a;
                --light-rgb: 26,26,28;
                --lighter: #232323;
                --lightest: #373737;
                --dark: #0f0f0f;
                --text: #fafafa
            }

            html.light {
                --background: #f7f3f3;
                --primary: #ee2020;
                --light: #d8d3d3;
                --light-rgb: 247,243,243;
                --lighter: #c0bdbd;
                --lightest: #9c9a9a;
                --dark: #ece6e6;
                --text: #080808
            }

            * {
                -webkit-tap-highlight-color: transparent;
                -webkit-user-drag: none
            }

            body {
                font-family: Open Sans,sans-serif!important;
                font-weight: 300;
                -webkit-font-smoothing: antialiased;
                -moz-osx-font-smoothing: grayscale;
                background-color: var(--background);
                color: var(--text);
                opacity: 0;
                transition: calc(var(--transition-speed)*2) opacity
            }

            body.active {
                opacity: 100%
            }

            body>.container {
                min-height: calc(100vh - var(--large-padding)*4);
                min-height: calc(100dvh - var(--large-padding)*4);
                position: relative
            }

            body>.container>.content-container {
                margin-top: calc(var(--large-padding)*4);
                padding-bottom: var(--footer-height)
            }

            body.modal-active {
                overflow: hidden
            }

            body.modal-active>.container {
                user-select: none
            }

            img {
                font-size: 0
            }

            @font-face {
                font-family: 'Font Awesome 5 Free';
                font-style: normal;
                font-weight: 900;
                font-display: block;
                src: url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/webfonts/fa-solid-900.woff2') format('woff2'),
                    url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/webfonts/fa-solid-900.woff') format('woff');
            }

            [class*=" icon-"], [class^=icon-] {
                font-family: 'Font Awesome 5 Free' !important;
                font-style: normal;
                font-variant: normal;
                font-weight: 900; /* Use 900 for solid icons */
                line-height: 1;
                text-transform: none;
            }


            .icon-star:before {
                content: "\f005"
            }

            .icon-film:before {
                content: "\f008"
            }

            .icon-magnet:before {
                content: "\f076"
            }

            .icon-list:before {
                content: "\f00b"
            }

            .icon-check:before {
                content: "\f00c"
            }

            .icon-cursor:before {
                content: "\f245"
            }

            .icon-widget:before {
                content: "\f09e"
            }

            .icon-ai:before {
                content: "\f544"
            }

            .icon-times:before {
                content: "\f00d"
            }

            .icon-cog:before {
                content: "\f013"
            }

            .icon-clock:before {
                content: "\f017"
            }

            .icon-sync:before {
                content: "\f021"
            }

            .icon-tags:before {
                content: "\f02c"
            }

            .icon-bookmark:before {
                content: "\f02e"
            }

            .icon-play:before {
                content: "\f04b"
            }

            .icon-arrow-left:before {
                content: "\f060"
            }

            .icon-arrow-right:before {
                content: "\f061"
            }

            .icon-arrow-up:before {
                content: "\f062"
            }

            .icon-arrow-down:before {
                content: "\f063"
            }

            .icon-download:before {
                content: "\f019"
            }

            .icon-eye:before {
                content: "\f06e"
            }

            .icon-eye-slash:before {
                content: "\f070"
            }

            .icon-github:before {
                content: "\f09b"
            }

            .icon-group:before {
                content: "\f0c0"
            }

            .icon-link:before {
                content: "\f0c1"
            }

            .icon-calendar:before {
                content: "\f133"
            }

            .icon-file:before {
                content: "\f15c"
            }

            .icon-youtube:before {
                content: "\f144"
            }

            .icon-instagram:before {
                content: "\f16d"
            }

            .icon-livetv:before {
                content: "\f519"
            }

            .icon-issue:before {
                content: "\f2b5"
            }

            .icon-bell:before {
                content: "\f0f3"
            }

            .icon-stats:before {
                content: "\f080"
            }

            .icon-help:before {
                content: "\f059"
            }

            .icon-discord:before {
                content: "\f0c0"
            }

            .icon-box:before {
                content: "\f187"
            }

            .icon-trash:before {
                content: "\f1f8"
            }

            .icon-paint-brush:before {
                content: "\f1fc"
            }

            .icon-tv:before {
                content: "\f26c"
            }

            .icon-anime:before {
                content: "\f6d5"
            }

            .icon-warning:before {
                content: "\f071"
            }

            .icon-search:before {
                content: "\f002"
            }

            .icon-keyboard:before {
                content: "\f11c"
            }

            .icon-language:before {
                content: "\f1ab"
            }

            .icon-home:before {
                content: "\f015"
            }

            .icon-censor:before {
                content: "\f05e"
            }

            .icon-games:before {
                content: "\f11b"
            }

            .icon-api:before {
                content: "\f121"
            }

            .icon-autonext:before {
                content: "\f04e"
            }

            ::-webkit-scrollbar {
                width: 7px
            }

            ::-webkit-scrollbar-track {
                background-color: var(--light);
                border-radius: var(--border-radius)
            }

            ::-webkit-scrollbar-thumb {
                background-color: var(--lighter);
                border-radius: var(--border-radius)
            }

            @media (hover: hover) {
                ::-webkit-scrollbar-thumb:hover {
                    background-color:var(--lightest)
                }
            }

            cache {
                left: 0;
                opacity: 0;
                top: 0;
                user-select: none;
                z-index: -1000
            }

            cache,cache img {
                position: absolute
            }

            cache img {
                height: .1px;
                width: .1px
            }

            .header-container {
                background-color: var(--background);
                border-bottom: var(--small-border) solid var(--lighter);
                position: fixed;
                top: 0;
                width: 100vw;
                width: 100dvw;
                z-index: 3
            }

            .header-container .header {
                align-items: center;
                box-sizing: border-box;
                display: flex;
                gap: var(--large-gap);
                height: calc(var(--large-padding)*4);
                justify-content: space-between;
                margin-left: auto;
                margin-right: auto;
                max-width: var(--max-width);
                padding: var(--large-padding);
                width: 100%
            }

            .header-container .header .brand {
                align-items: center;
                display: flex;
                font-weight: 500;
                margin: 0;
                user-select: none
            }

            .header-container .header .brand .accent {
                color: var(--primary)
            }

            .header-container .header .links {
                align-items: center;
                background-color: var(--dark);
                border: var(--small-border) solid var(--lighter);
                border-radius: var(--border-radius);
                box-sizing: border-box;
                display: flex;
                gap: 1rem;
                padding: 1rem;
            }

            body.modal-active .header-container .header .links {
                opacity: 25%;
                pointer-events: none
            }

            .header-container .header .links .link {
                align-items: center;
                border-radius: calc(var(--border-radius)/2);
                display: flex;
                font-size: 0.8rem;
                gap: 1rem;
                padding: 0.5rem 0.5rem;
                transition: var(--transition-speed) background-color;
                user-select: none
            }

            .header-container .header .links .link.active {
                background-color: var(--light);
                pointer-events: none
            }

            .header-container .header .links .link:not(.active) {
                cursor: pointer;
                opacity: var(--dim-opacity)
            }

            @media (hover: hover) {
                .header-container .header .links .link:not(.active):hover {
                    background-color:var(--light);
                    opacity: 100%
                }
            }

            .header-container .header .links .link .icon {
                opacity: var(--dim-opacity)
            }

            @media only screen and (max-width: 700px) {
                .header .links {
                    width:100%
                }

                .header .links .link {
                    justify-content: center;
                    width: 100%
                }
            }

            @media only screen and (max-width: 550px) {
                .header .links .link .text {
                    display:none
                }
            }

            @media only screen and (max-width: 350px) {
                .header .links {
                    width:fit-content
                }

                .header .links .link {
                    width: .5rem
                }
            }

            .content {
                box-sizing: border-box;
                margin-left: auto;
                margin-right: auto;
                max-width: var(--max-width);
                padding: var(--large-padding);
                width: 100%
            }

            .content>.section {
                display: none;
                width: 100%
            }

            .content>.section.active {
                display: inline-block
            }

            .carousel {
                align-items: center;
                border-radius: var(--border-radius);
                display: flex;
                height: fit-content;
                justify-content: center;
                overflow: hidden;
                position: relative;
                width: 100%
            }

            .carousel .image {
                height: 65vh;
                height: 65dvh;
                max-height: calc(var(--max-width)/1.5);
                min-height: calc(var(--max-width)/3);
                object-fit: cover;
                pointer-events: none;
                user-select: none;
                width: 100%
            }

            .carousel .image:not([src]),.carousel .image[src=""],.carousel .image[src=null] {
                opacity: 0
            }

            .carousel .details {
                align-items: center;
                border-radius: var(--border-radius);
                bottom: 3rem;
                display: flex;
                flex-direction: column;
                justify-content: center;
                max-width: 80%;
                padding: var(--small-padding);
                position: absolute;
                text-align: center;
                text-overflow: ellipsis;
                text-wrap: wrap;
                overflow: hidden;
                z-index: 2
            }

            .carousel .vignette {
                background: linear-gradient(to bottom,transparent,rgba(var(--light-rgb),.75) 75%);
                height: 100%;
                left: 0;
                position: absolute;
                top: 0;
                width: 100%
            }

            .carousel .title {
                font-size: calc(var(--max-font)*1.25);
                font-weight: 500;
                margin-bottom: 0
            }

            .carousel .description {
                opacity: var(--dim-opacity)
            }

            .carousel .buttons {
                display: flex;
                gap: var(--small-padding)
            }

            .carousel .control {
                align-items: center;
                bottom: .5rem;
                display: flex;
                justify-content: space-between;
                left: var(--small-padding);
                position: absolute;
                width: calc(100% - var(--small-padding)*2)
            }

            @media only screen and (max-width: 1200px) {
                .carousel .title {
                    margin-bottom:var(--large-padding)
                }

                .carousel .description {
                    display: none
                }

                .carousel .buttons {
                    flex-direction: column
                }
            }

            .button {
                align-items: center;
                background-color: var(--primary);
                border-radius: var(--border-radius);
                box-sizing: border-box;
                cursor: pointer;
                display: flex;
                font-size: var(--large-font);
                gap: var(--small-padding);
                justify-content: center;
                padding: calc(var(--small-padding)*1.25) var(--large-padding);
                transition: var(--transition-speed) opacity;
                user-select: none;
                width: fit-content
            }

            .button.icon-only {
                padding: calc(var(--small-padding)*1.25)
            }

            .button.secondary {
                background-color: var(--dark);
                border: var(--small-border) solid var(--lighter)
            }

            @media (hover: hover) {
                .button:hover {
                    opacity:var(--dim-opacity)
                }

                .button.secondary:hover {
                    background-color: var(--light)
                }
            }

            .area {
                border: var(--small-border) solid var(--lighter);
                border-radius: var(--border-radius);
                box-sizing: border-box;
                margin-top: calc(var(--large-padding)*2.5);
                padding: var(--large-padding);
                padding-top: calc(var(--large-padding)*1.75);
                position: relative;
                width: 100%
            }

            .content.no-carousel>.section .area:first-child,.section.home .area:first-child {
                margin-top: var(--large-padding)
            }

            .area.minimal {
                border: none;
                border-radius: 0
            }

            .area.inactive {
                display: none
            }

            .area:not(.search) .notice {
                display: flex;
                margin-top: 0
            }

            .area .label {
                background-color: var(--primary);
                border-radius: var(--border-radius);
                font-size: var(--large-font);
                font-weight: 500;
                padding: var(--small-padding) var(--large-padding);
                position: absolute;
                top: calc(var(--small-padding)*-2)
            }

            .area.minimal .label {
                display: none
            }

            .area .control {
                position: absolute;
                right: calc(var(--small-padding)*2);
                top: calc(var(--small-padding)*-2.5)
            }

            .area .control .button {
                height: 1rem;
                width: 1rem
            }

            .area .control,.watch .details .control {
                align-items: center;
                background-color: var(--dark);
                border: var(--small-border) solid var(--light);
                border-radius: var(--border-radius);
                box-sizing: border-box;
                display: flex;
                gap: calc(var(--small-gap)/3);
                height: fit-content;
                padding: var(--small-padding);
                width: fit-content
            }

            .control.inactive {
                display: none
            }

            .area .control .button {
                background-color: var(--light);
                border: var(--small-border) solid var(--lighter);
                font-size: var(--min-font)
            }

            .control .indicators {
                align-items: center;
                background-color: var(--dark);
                border-radius: var(--border-radius);
                display: flex;
                gap: calc(var(--small-gap)/3);
                padding: calc(var(--small-padding)/1.25)
            }

            .control .indicator {
                background-color: var(--lighter);
                border-radius: var(--border-radius);
                padding: 2px 8px;
                transition: var(--transition-speed) background-color
            }

            .control .indicator:not(.active) {
                cursor: pointer
            }

            .control .indicator.active {
                background-color: var(--primary);
                pointer-events: none
            }

            @media (hover: hover) {
                .area .control .button:hover {
                    background-color:var(--lighter)
                }

                .control .indicator:not(.active):hover {
                    background-color: var(--lightest)
                }
            }

            @media only screen and (max-width: 500px) {
                .area .control .indicators {
                    display:none
                }
            }

            .cards {
                display: flex;
                gap: var(--small-gap);
                justify-content: center
            }

            .cards.inactive {
                display: none
            }

            .card {
                background-color: var(--light);
                border: var(--small-border) solid var(--lighter);
                border-radius: var(--border-radius);
                box-sizing: border-box;
                cursor: pointer;
                display: flex;
                flex-direction: column;
                gap: calc(var(--small-padding)/2);
                justify-content: space-between;
                overflow: hidden;
                padding: var(--small-padding);
                position: relative;
                transition: var(--transition-speed) background-color;
                user-select: none;
                width: calc(25% - var(--small-padding))
            }

            @media (hover: hover) {
                .card:hover {
                    background-color:var(--lighter)
                }
            }

            .card .play {
                align-items: center;
                background-color: rgba(var(--light-rgb),.5);
                display: flex;
                height: 100%;
                justify-content: center;
                left: 0;
                opacity: 0;
                pointer-events: none;
                position: absolute;
                top: 0;
                transition: var(--transition-speed) opacity;
                width: 100%;
                z-index: 2
            }

            .card .play .icon {
                font-size: var(--max-font)
            }

            .card:hover .play {
                opacity: 100%
            }

            .card .image {
                background-color: var(--dark);
                border-radius: calc(var(--border-radius)/2);
                height: 100%;
                margin-bottom: calc(var(--small-padding)/2);
                max-height: 25rem;
                object-fit: cover;
                pointer-events: none;
                user-select: none;
                width: 100%
            }

            .card .image:not([src]),.card .image[src=""],.card .image[src=null] {
                opacity: 0
            }

            .card .season-info,.card .type-info {
                background-color: var(--lighter);
                border: var(--small-border) solid var(--lightest);
                border-radius: calc(var(--border-radius)/1.5);
                box-sizing: border-box;
                opacity: var(--dim-opacity);
                padding: calc(var(--small-padding)/2);
                position: absolute;
                right: calc(var(--small-padding)*1.25);
                top: calc(var(--small-padding)*1.25)
            }

            .card .type-info {
                left: calc(var(--small-padding)*1.25);
                right: auto!important
            }

            .card .footer {
                display: flex;
                font-size: var(--small-font);
                gap: var(--small-gap);
                justify-content: space-between
            }

            .card .footer>div,.card .title,.watch .rating {
                align-items: center;
                background-color: var(--dark);
                border: var(--small-border) solid var(--lighter);
                border-radius: var(--border-radius);
                box-sizing: border-box;
                display: flex;
                gap: calc(var(--small-gap)/2);
                justify-content: center;
                padding: calc(var(--small-padding)/1.5);
                text-align: center;
                width: 100%
            }

            .card .title {
                font-size: var(--large-font);
                font-weight: 500
            }

            .card .footer .icon,.card .footer .text,.watch .rating .icon,.watch .rating .rating-text {
                opacity: var(--dim-opacity)
            }

            .card .footer .stars,.watch .rating .stars {
                display: flex;
                gap: calc(var(--small-gap)/4)
            }

            .card .footer .star.fill,.watch .rating .star.fill {
                color: var(--primary)
            }

            .card .footer .star.half-fill,.watch .rating .star.half-fill {
                background: linear-gradient(to right,var(--primary) 50%,hsla(0,0%,100%,.75) 50%);
                background-clip: text;
                -webkit-background-clip: text;
                color: transparent
            }

            .card .footer .star.fill .icon,.card .footer .star.half-fill .icon,.watch .rating .star.fill .icon,.watch .rating .star.half-fill .icon {
                opacity: 100%
            }

            @media only screen and (max-width: 1200px) {
                .card .footer {
                    flex-direction:column;
                    gap: calc(var(--small-gap)/3)
                }

                .card .footer,.card .season-info,.card .title,.card .type-info {
                    font-size: var(--min-font)
                }
            }

            @media only screen and (max-width: 700px) {
                .card {
                    width:calc(50% - var(--small-padding))
                }
            }

            .modal-container {
                align-items: center;
                background-color: rgba(var(--light-rgb),.75);
                box-sizing: border-box;
                display: flex;
                height: 100vh;
                height: 100dvh;
                justify-content: center;
                left: 0;
                opacity: 0;
                overflow: auto;
                position: fixed;
                top: 0;
                transition: var(--transition-speed) opacity;
                width: 100vw;
                width: 100dvw;
                z-index: -10
            }

            body.modal-active .modal-container {
                opacity: 100%;
                z-index: 4
            }

            .modal,.modal-container.fill {
                background-color: var(--background)
            }

            .modal {
                border-radius: var(--border-radius);
                height: fit-content;
                position: relative;
                width: fit-content
            }

            .modal-container.fill .modal {
                background-color: transparent;
                border-radius: 0;
                height: 100%;
                max-width: var(--max-width);
                width: 100%
            }

            .modal-header {
                align-items: center;
                background-color: var(--dark);
                border-bottom: var(--small-border) solid var(--light);
                box-sizing: border-box;
                display: flex;
                gap: var(--large-gap);
                height: calc(var(--small-padding)*6);
                justify-content: space-between;
                margin-left: var(--large-padding);
                margin-right: var(--large-padding);
                padding: calc(var(--small-padding)*1.25) var(--large-padding)
            }

            .modal-container.fill .modal-header {
                border: var(--small-border) solid var(--light);
                border-radius: var(--border-radius);
                margin-top: 1rem
            }

            .modal-header .header-buttons {
                display: flex;
                font-size: var(--min-font);
                gap: var(--small-gap)
            }

            .modal-header .text-container {
                align-items: center;
                display: flex;
                font-weight: 500;
                gap: var(--small-padding)
            }

            .modal-header .text {
                max-width: 40vw;
                max-width: 40dvw;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap
            }

            .modal-header .text.tv {
                max-width: 25vw;
                max-width: 25dvw
            }

            .modal-header .info {
                background-color: var(--light);
                border: var(--small-border) solid var(--lighter);
                border-radius: var(--border-radius);
                box-sizing: border-box;
                display: none;
                padding: calc(var(--small-padding)/2);
                text-align: center
            }

            .modal-header .info.active {
                display: inline-block
            }

            .modal-header .button {
                width: 2.6rem
            }

            .modal-header .copied {
                opacity: var(--dim-opacity);
                pointer-events: none
            }

            .modal-header .button.secondary {
                background-color: var(--light);
                border: var(--small-border) solid var(--lighter)
            }

            @media (hover: hover) {
                .modal-header .button.secondary:hover {
                    background-color:var(--lighter)
                }
            }

            .modal-content {
                border-bottom-left-radius: var(--border-radius);
                border-bottom-right-radius: var(--border-radius);
                padding: var(--large-padding)
            }

            @media only screen and (max-width: 600px) {
                .modal-header {
                    padding:var(--small-padding)
                }

                .modal-header .header-buttons,.modal-header .text-container .info,.modal-header .text-container .text {
                    font-size: var(--small-font)
                }

                .modal-header .header-buttons .button {
                    padding: var(--small-padding);
                    width: 2.3rem
                }
            }

            .area.genres .genres {
                display: flex;
                gap: var(--small-gap)
            }

            .area.genres .genres .genre {
                align-items: center;
                background-color: var(--light);
                border: var(--small-border) solid var(--lighter);
                border-radius: var(--border-radius);
                box-sizing: border-box;
                cursor: pointer;
                display: flex;
                gap: var(--small-padding);
                justify-content: space-between;
                padding: calc(var(--small-padding)*1.5) var(--large-padding);
                transition: var(--transition-speed) background-color;
                user-select: none;
                width: 100%
            }

            @media (hover: hover) {
                .area.genres .genres .genre:hover {
                    background-color:var(--lighter)
                }
            }

            @media only screen and (max-width: 600px) {
                .area.genres .genres .genre .icon,.area.genres .genres .genre .text {
                    font-size:var(--min-font)
                }
            }

            .area.search .search {
                align-items: center;
                background-color: var(--light);
                border: var(--small-border) solid var(--lighter);
                border-radius: var(--border-radius);
                box-sizing: border-box;
                cursor: text;
                display: flex;
                gap: var(--small-gap);
                height: 3rem;
                padding: var(--small-padding);
                transition: var(--transition-speed) background-color;
                width: 100%
            }

            .area.search .search:focus-within,.area.search .search:hover {
                background-color: var(--lighter)
            }

            .area.search .search .input {
                background-color: transparent;
                border: none;
                color: var(--text);
                font-size: var(--large-font);
                outline: none;
                width: 100%
            }

            .area.search .search .input::placeholder {
                opacity: var(--dim-opacity);
                user-select: none
            }

            .area.search .search .icon {
                opacity: 25%
            }

            .area.search .search .clear {
                align-items: center;
                background-color: var(--primary);
                border-radius: var(--border-radius);
                box-sizing: border-box;
                cursor: pointer;
                display: none;
                justify-content: center;
                padding: calc(var(--small-padding)/1.75);
                transition: var(--transition-speed) opacity;
                width: 1.8rem
            }

            .area.search .search .clear.active {
                display: flex
            }

            @media (hover: hover) {
                .area.search .search .clear:hover {
                    opacity:var(--dim-opacity)
                }
            }

            .area.search .cards {
                margin-top: 1rem
            }

            @media only screen and (max-width: 600px) {
                .area.search .search .icon,.area.search .search .input {
                    font-size:var(--small-font)
                }
            }

            .notice {
                align-items: center;
                background-color: var(--light);
                border-radius: var(--border-radius);
                box-sizing: border-box;
                display: none;
                gap: var(--small-gap);
                justify-content: center;
                margin-left: auto;
                margin-right: auto;
                margin-top: 1rem;
                padding: calc(var(--small-padding)/1.5);
                width: fit-content
            }

            .notice.active {
                display: flex
            }

            .notice .icon {
                color: var(--primary)
            }

            .notice .text {
                opacity: var(--dim-opacity)
            }

            .watch .video {
                background-color: #000;
                box-sizing: border-box;
                height: 100vh;
                height: 100dvh;
                -webkit-mask-image: -webkit-radial-gradient(var(--light),var(--dark));
                mask-image: -webkit-radial-gradient(var(--light),var(--dark));
                min-height: calc(var(--max-width)/25);
                overflow: hidden;
                position: relative;
                user-select: none;
                width: calc(100vw - 4px);
                width: calc(100dvw - 4px)
            }

            .watch .video.theme {
                background-color: var(--light);
                border: var(--small-border) solid var(--lighter)
            }

            .watch .video .iframe {
                border: none;
                display: none;
                height: 100%;
                outline: none;
                position: absolute;
                width: 100%
            }

            .watch .video .iframe.active {
                display: inline-block
            }

            .watch .video .video-notice {
                align-items: center;
                display: none;
                height: 100%;
                justify-content: center;
                position: absolute;
                width: 100%
            }

            .watch .video .video-notice.active {
                display: flex
            }

            .watch .video .video-notice .notice {
                margin: 0
            }

            .watch .video.theme .video-notice .notice {
                background-color: var(--dark)
            }

            .watch .video .scroll {
                background-color: var(--lighter);
                border: var(--small-border) solid var(--lightest);
                border-radius: 50%;
                box-sizing: border-box;
                cursor: pointer;
                left: 50%;
                opacity: 0;
                padding: var(--small-padding);
                position: fixed;
                top: var(--small-padding);
                transform: translate(-50%);
                transition: var(--transition-speed) opacity;
                z-index: -10
            }

            .watch .video .scroll.active {
                opacity: calc(var(--dimmer-opacity)/2);
                z-index: 3
            }

            .watch .video .scroll:hover {
                opacity: var(--dim-opacity)
            }

            .watch .video .scroll.down {
                bottom: var(--small-padding);
                top: auto
            }

            .watch .details {
                display: flex;
                justify-content: space-between;
                margin-top: var(--large-padding);
                width: 100%
            }

            .watch .details.no-video {
                margin-top: 0
            }

            .watch .container {
                display: flex;
                flex-direction: column;
                gap: var(--large-gap)
            }

            .watch .details .left {
                width: 66.25%
            }

            .watch .details .left.full-width {
                width: 100%
            }

            .watch .details .right {
                width: 32%
            }

            .watch .details .right.full-width {
                flex-direction: row;
                justify-content: space-between;
                width: 100%
            }

            .watch .details .right.full-width .details-card {
                height: fit-content
            }

            .watch .details .details-card {
                background-color: var(--light);
                border: var(--small-border) solid var(--lighter);
                border-radius: var(--border-radius);
                box-sizing: border-box;
                display: flex;
                flex-direction: column;
                gap: var(--small-gap);
                overflow: hidden;
                padding: var(--large-padding)
            }

            .watch .details .text,.watch .details .title {
                font-size: var(--large-font);
                margin: 0
            }

            .watch .details .title {
                align-items: center;
                display: flex;
                font-weight: 500;
                gap: var(--small-gap)
            }

            .watch .details .title .icon,.watch .details .title .text {
                opacity: var(--dim-opacity)
            }

            .watch .details .notice {
                background-color: var(--dark);
                margin: 0
            }

            .watch .details .control {
                border: none;
                gap: calc(var(--small-gap)/4);
                margin-left: auto;
                padding: 0
            }

            .watch .details .control,.watch .details .control .indicators {
                background-color: transparent
            }

            .watch .details .control .button {
                border-radius: 50%;
                width: 2.6rem
            }

            .watch .details .cast-cards,.watch .details .cast-cards .cast-card {
                display: flex;
                gap: var(--small-gap);
                justify-content: center
            }

            .watch .details .cast-cards .cast-card {
                align-items: center;
                background-color: var(--dark);
                border: var(--small-border) solid var(--lighter);
                border-radius: var(--border-radius);
                box-sizing: border-box;
                cursor: pointer;
                overflow: hidden;
                padding: var(--small-padding);
                transition: var(--transition-speed) opacity;
                user-select: none;
                width: calc(25% - var(--small-padding))
            }

            .watch .details .cast-cards .cast-card .text {
                display: flex;
                flex-direction: column;
                font-size: calc(var(--min-font)*1.05);
                gap: calc(var(--small-gap)/3);
                justify-content: center
            }

            .watch .details .cast-cards .cast-card .text .cast-name {
                font-weight: 500
            }

            .watch .details .cast-cards .cast-card .text .cast-character {
                font-size: var(--min-font);
                opacity: var(--dim-opacity)
            }

            .watch .details .cast-cards .cast-card .image {
                border-radius: 50%;
                height: 3rem;
                object-fit: cover;
                pointer-events: none;
                user-select: none
            }

            .watch .details .cast-cards .cast-card .image:not([src]),.watch .details .cast-cards .cast-card .image[src=""],.watch .details .cast-cards .cast-card .image[src=null] {
                opacity: 0
            }

            .watch .details .review-cards {
                display: flex;
                gap: var(--small-gap);
                justify-content: center
            }

            .watch .details .review-cards .review-card {
                background-color: var(--dark);
                border: var(--small-border) solid var(--lighter);
                border-radius: var(--border-radius);
                box-sizing: border-box;
                cursor: pointer;
                display: flex;
                flex-direction: column;
                gap: var(--large-gap);
                overflow: hidden;
                padding: var(--large-padding);
                transition: var(--transition-speed) opacity;
                user-select: none;
                width: calc(50% - var(--small-padding))
            }

            .watch .details .review-title {
                font-weight: 500;
                justify-content: space-between
            }

            .watch .details .review-title,.watch .details .review-title .title-container {
                align-items: center;
                display: flex;
                gap: var(--small-gap)
            }

            .watch .details .review-title .title-container .avatar {
                align-items: center;
                background-color: var(--light);
                border: var(--small-border) solid var(--lighter);
                border-radius: 5rem;
                box-sizing: border-box;
                display: flex;
                justify-content: center;
                overflow: hidden;
                position: relative
            }

            .watch .details .review-title .title-container .avatar .image {
                height: 1.75rem;
                object-fit: cover;
                pointer-events: none;
                user-select: none;
                width: 1.75rem
            }

            .watch .details .review-title .title-container .avatar .image:not([src]),.watch .details .review-title .title-container .avatar .image[src=""],.watch .details .review-title .title-container .avatar .image[src=null] {
                opacity: 0
            }

            .watch .details .rating {
                background-color: var(--light);
                border-radius: 5rem;
                font-size: var(--small-font);
                width: fit-content
            }

            .watch .details .review-content {
                font-size: var(--large-font);
                opacity: var(--dim-opacity)
            }

            .watch .details .details-card.misc {
                flex-direction: row;
                gap: var(--large-gap)
            }

            .watch .details .details-card.misc>div {
                display: flex;
                flex-direction: column;
                gap: var(--small-gap)
            }

            .watch .details .details-card.misc .title:not(:first-child) {
                margin-top: var(--large-padding)
            }

            .watch .details .details-card.misc .rating {
                background-color: var(--dark);
                border-radius: var(--border-radius)
            }

            .watch .details .genre-cards {
                display: flex;
                flex-wrap: wrap;
                gap: calc(var(--small-gap)/2)
            }

            .watch .details .genre-card {
                background-color: var(--dark);
                border: var(--small-border) solid var(--lighter);
                border-radius: var(--border-radius);
                box-sizing: border-box;
                font-size: var(--large-font);
                padding: calc(var(--small-padding)/1.5)
            }

            .watch .details .season-cards {
                display: flex;
                flex-direction: column;
                gap: var(--small-gap)
            }

            .watch .details .season-card {
                background-color: var(--dark);
                border: var(--small-border) solid var(--lighter);
                border-radius: var(--border-radius);
                box-sizing: border-box;
                padding: var(--small-padding) var(--large-padding)
            }

            .watch .details .season-card .season-title {
                align-items: center;
                display: flex;
                font-weight: 500;
                gap: var(--small-gap)
            }

            .watch .details .season-card .season-title .button {
                background-color: var(--light);
                border: var(--small-border) solid var(--lighter);
                border-radius: 50%;
                font-size: var(--small-font);
                height: 2rem;
                margin-left: auto;
                width: 2rem
            }

            .watch .details .season-card .season-title .button .icon {
                opacity: var(--dim-opacity)
            }

            .watch .details .season-card .season-title .name {
                font-weight: 500
            }

            .watch .details .season-card .season-title .amount {
                font-size: var(--small-font);
                opacity: var(--dim-opacity)
            }

            .watch .details .season-card .episodes {
                box-sizing: border-box;
                display: none;
                flex-direction: column;
                padding: var(--small-padding) 0
            }

            .watch .details .season-card.active .episodes {
                display: flex;
                gap: var(--small-gap)
            }

            .watch .details .season-card .episodes .episode {
                align-items: center;
                border-radius: var(--border-radius);
                box-sizing: border-box;
                display: flex;
                gap: var(--small-gap);
                padding: var(--large-padding);
                transition: var(--transition-speed) opacity;
                user-select: none
            }

            .watch .details .season-card .episodes .episode.active {
                background-color: var(--light);
                pointer-events: none
            }

            .watch .details:not(.no-video) .season-card .episodes .episode:not(.active) {
                cursor: pointer
            }

            .watch .details .season-card .episodes .episode .number {
                font-size: var(--max-font);
                font-weight: 500;
                opacity: var(--dim-opacity)
            }

            .watch .details .season-card .episodes .episode .episode-left {
                align-items: center;
                display: flex;
                gap: var(--large-gap)
            }

            .watch .details .season-card .episodes .episode .episode-right {
                display: flex;
                flex-direction: column;
                gap: var(--small-gap);
                width: 100%
            }

            .watch .details .season-card .episodes .episode .preview {
                align-items: center;
                background-color: var(--light);
                border: var(--small-border) solid var(--lighter);
                border-radius: var(--border-radius);
                box-sizing: border-box;
                display: flex;
                justify-content: center;
                overflow: hidden;
                position: relative
            }

            .watch .details .season-card .episodes .episode .preview .image {
                height: 5rem;
                object-fit: cover;
                pointer-events: none;
                user-select: none;
                width: 8rem
            }

            .watch .details .season-card .episodes .episode .preview .image:not([src]),.watch .details .season-card .episodes .episode .preview .image[src=""],.watch .details .season-card .episodes .episode .preview .image[src=null] {
                opacity: 0
            }

            .watch .details .season-card .episodes .episode:not(.active) .notice {
                background-color: var(--light)
            }

            .watch .details .season-card .episodes .episode .preview .notice {
                background-color: var(--light);
                position: absolute
            }

            .watch .details .season-card .episodes .episode .episode-title {
                align-items: center;
                display: flex;
                font-weight: 500;
                gap: var(--small-gap);
                justify-content: space-between
            }

            .watch .details .season-card .episodes .episode .episode-title .name {
                font-weight: 500
            }

            .watch .details .season-card .episodes .episode .episode-title .time {
                align-items: center;
                background-color: var(--light);
                border: var(--small-border) solid var(--lighter);
                border-radius: var(--border-radius);
                box-sizing: border-box;
                display: flex;
                gap: var(--small-gap);
                justify-content: center;
                padding: calc(var(--small-padding)/2)
            }

            .watch .details .season-card .episodes .episode.active .episode-title .time {
                background-color: var(--lighter);
                border: var(--small-border) solid var(--lightest)
            }

            .watch .details .season-card .episodes .episode .description {
                font-size: var(--large-font)
            }

            .watch .details .season-card .episodes .episode .description,.watch .details .season-card .episodes .episode .episode-title .time .icon,.watch .details .season-card .episodes .episode .episode-title .time .text {
                opacity: var(--dim-opacity)
            }

            .watch .details .area.minimal {
                margin: 0;
                padding: 0
            }

            .watch .details .area.minimal .cards .card {
                background-color: var(--dark);
                width: calc(50% - var(--small-padding))
            }

            .watch .details .area.minimal .cards .card .title {
                background-color: var(--light)
            }

            .watch .season-control .button.inactive {
                opacity: calc(var(--dimmer-opacity)/2);
                pointer-events: none
            }

            .watch .season-control.inactive {
                display: none
            }

            .provider-cards {
                background-color: var(--dark);
                border: var(--small-border) solid var(--light);
                border-radius: var(--border-radius);
                box-sizing: border-box;
                display: flex;
                flex-wrap: wrap;
                gap: var(--small-gap);
                justify-content: center;
                padding: var(--small-padding);
                transition: var(--transition-speed) background-color;
                user-select: none;
                width: fit-content
            }

            .provider-cards>div:not(.active) {
                cursor: pointer
            }

            .provider-cards>div {
                border: var(--small-border) solid transparent;
                border-radius: calc(var(--border-radius)/2);
                box-sizing: border-box;
                opacity: var(--dim-opacity);
                padding: calc(var(--large-padding)/1.5) var(--large-padding)
            }

            .provider-cards>div.active {
                background-color: var(--light);
                border: var(--small-border) solid var(--lighter);
                opacity: 100%;
                pointer-events: none
            }

            @media (hover: hover) {
                .watch .details .cast-cards .cast-card:hover,.watch .details .review-cards .review-card:hover {
                    opacity:var(--dim-opacity)
                }

                .watch .details .season-card .season-title .button:hover {
                    background-color: var(--lighter)
                }

                .watch .details:not(.no-video) .season-card .episodes .episode:not(.active):hover {
                    opacity: var(--dim-opacity)
                }

                .provider-cards>div:not(.active):hover {
                    background-color: var(--light)
                }
            }

            @media only screen and (max-width: 1200px) {
                .watch .details {
                    flex-direction:column;
                    gap: var(--large-padding)
                }

                .watch .container {
                    width: 100%!important
                }

                .watch .details .control .indicators {
                    display: none
                }

                .watch .details .area.minimal .cards .card {
                    width: calc(25% - var(--small-padding))
                }

                .watch .details .right.full-width {
                    flex-direction: column
                }
            }

            @media only screen and (max-width: 700px) {
                .watch .details .cast-cards .cast-card {
                    width:calc(50% - var(--small-padding))
                }

                .watch .details .review-cards .review-card {
                    width: calc(100% - var(--small-padding))
                }

                .watch .details .review-cards .review-card .stars {
                    display: none
                }

                .watch .details .review-cards .review-card .rating {
                    padding: var(--small-padding) var(--large-padding)
                }

                .watch .details .season-card {
                    padding: var(--small-padding)
                }

                .watch .details .season-card .episodes .episode {
                    flex-direction: column-reverse;
                    padding: var(--small-padding)
                }

                .watch .details .season-card .episodes .episode .description {
                    display: none
                }

                .watch .details .season-card .episodes .episode .episode-left {
                    flex-direction: row-reverse;
                    justify-content: space-between;
                    width: 100%
                }

                .watch .details .area.minimal .cards .card {
                    width: calc(50% - var(--small-padding))
                }
            }

            @media only screen and (max-width: 600px) {
                .provider-cards>div {
                    text-align:center;
                    width: calc(50% - var(--small-padding))
                }
            }

            @media only screen and (max-width: 350px) {
                .provider-cards {
                    flex-direction:column;
                    width: 100%
                }

                .provider-cards>div {
                    width: 100%
                }
            }

            .section.settings .label {
                align-items: center;
                display: flex;
                font-weight: 500;
                gap: var(--small-gap);
                margin-bottom: 1rem;
                opacity: var(--dim-opacity)
            }

            .section.settings .label:not(:first-child) {
                margin-top: 2rem
            }

            .section.settings .selection {
                background-color: var(--dark);
                border: var(--small-border) solid var(--light);
                border-radius: var(--border-radius);
                box-sizing: border-box;
                display: flex;
                flex-wrap: wrap;
                gap: var(--small-gap);
                padding: var(--small-padding);
                transition: var(--transition-speed) background-color;
                user-select: none;
                width: fit-content
            }

            .section.settings .selection>div {
                border: var(--small-border) solid transparent;
                border-radius: calc(var(--border-radius)/2);
                box-sizing: border-box;
                opacity: var(--dim-opacity);
                padding: calc(var(--large-padding)/1.5) var(--large-padding)
            }

            .section.settings .selection.multi>div,.section.settings .selection>div:not(.active) {
                cursor: pointer
            }

            @media (hover: hover) {
                .section.settings .selection>div:not(.active):hover {
                    background-color:var(--light)
                }
            }

            .section.settings .selection>div.active {
                background-color: var(--light);
                border: var(--small-border) solid var(--lighter);
                opacity: 100%
            }

            .section.settings .selection:not(.multi)>div.active {
                pointer-events: none
            }

            .section.settings .button.inactive {
                opacity: var(--dim-opacity);
                pointer-events: none
            }

            .section.settings .buttons {
                align-items: center;
                display: flex;
                flex-wrap: wrap;
                gap: var(--small-gap)
            }

            @media only screen and (max-width: 600px) {
                .section.settings .selection {
                    flex-direction:column;
                    width: 100%
                }

                .section.settings .buttons {
                    flex-direction: column
                }

                .section.settings .buttons .button {
                    width: 100%
                }
            }

            .footer-container {
                background-color: var(--dark);
                border-top: var(--small-border) solid var(--light);
                bottom: 0;
                box-sizing: border-box;
                height: var(--footer-height);
                position: absolute;
                width: 100%
            }

            .footer-container .footer {
                align-items: center;
                box-sizing: border-box;
                display: flex;
                gap: var(--large-gap);
                height: 100%;
                justify-content: space-between;
                margin-left: auto;
                margin-right: auto;
                max-width: var(--max-width);
                padding: 0 var(--large-padding);
                width: 100%
            }

            .footer-container .footer .copyright {
                font-weight: 500;
                opacity: var(--dim-opacity);
                user-select: none
            }

            .footer-container .footer .links {
        
                align-items: center;
                display: flex;
                gap: calc(var(--small-gap)*2)
            }

            .footer-container .footer .links .link {
                color: var(--text);
                opacity: var(--dim-opacity);
                text-decoration: none;
                transition: var(--transition-speed) opacity
            }

            @media (hover: hover) {
                .footer-container .footer .links .link:hover {
                    opacity:100%
                }
            }

            .popup-overlay {
                position: fixed;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                background: rgba(0, 0, 0, 0.8);
                display: flex;
                justify-content: center;
                align-items: center;
                z-index: 1000;
            }

            .popup-content {
                background: #222;
                color: #fff;
                padding: 2rem;
                border-radius: 10px;
                text-align: center;
                width: 90%;
                max-width: 400px;
            }

            .popup-content h2 {
                margin-top: 0;
            }

            .popup-content p {
                margin: 1.5rem 0;
            }

            .popup-content a.button {
                display: inline-block;
                padding: 0.75rem 1.5rem;
                background-color: #555;
                color: #fff;
                border-radius: 5px;
                text-decoration: none;
                transition: background-color 0.3s ease;
            }

            .popup-content a.button:hover {
                background-color: #888;
            }

            .popup-content a.link {
                color: #888;
                text-decoration: underline;
            }
            .popup-content .button-container {
                display: flex;
                justify-content: center;
                gap: 10px;
            }
        </style>
    </head>
    <body>
<!--
    <div id="guide-popup" class="popup-overlay" style="display: none;">
        <div class="popup-content">
            <h2>How to use RgShows?</h2>
            <p>Make sure to read the guide of RgShows before using it at your own discretion. By the way, you have no choice but to read it ;)</p>
            <div class="button-container">
                <a id="guide-popup-button" class="button" href="./guide.html">Read the Guide 😈</a>
            </div>
        </div>
    </div>
-->
<script src="js/aichat_widget.js"></script>
<script src="js/screenshare_widget.js"></script>
<script src="js/auto_next.js"></script>
<script src="js/country_guide.js"></script>
    <!-- Sharing Popup -->
<div id="event-popup" class="popup-overlay" style="display: none;">
    <div class="popup-content">
        <h2>Sharing is Caring! ❤️</h2>
        <p>Share RgShows with others because it’s free, and sharing gives us the motivation and support to keep the site alive! This popup will only appear once.</p>
        <div class="button-container">
            <a id="event-popup-button" class="button">I promise i will share 💪!</a>
        </div>
    </div>
</div>

    <!-- Domain change popup -->
    <div id="domain-change-popup" class="popup-overlay" style="display: none;">
        <div class="popup-content">
            <h2>Domain Changed 🚨</h2>
            <p>We have moved to a new domain. Please update your bookmarks to the new address: https://rgshows.me</p>
            <div class="button-container">
                <a id="domain-popup-button" class="button" href="https://rgshows.me">Got it!</a>
            </div>
        </div>
    </div>
        
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            if (
                window.location.href === 'https://rgshows.vercel.app' || 
                window.location.href === 'https://rgshows.vercel.app/?p=1' || 
                window.location.href === 'https://rgshows.vercel.app/?p=2' || 
                window.location.href === 'https://rgshows.vercel.app/?p=3' || 
                window.location.href === 'https://rgshows.vercel.app/?p=4' || 
                window.location.href === 'https://rgshows.vercel.app/?p=5' || 
                window.location.href === 'https://rgshows.vercel.app/?p=6'
            ) {
                document.getElementById('domain-change-popup').style.display = 'flex';
            }

            document.getElementById('domain-popup-button').addEventListener('click', function() {
                document.getElementById('domain-change-popup').style.display = 'none';
            });

            document.getElementById('event-popup-button').addEventListener('click', function() {
                document.getElementById('event-popup').style.display = 'none';
            });
        });
    </script>
        
    <script>
        if ('serviceWorker' in navigator) {
          window.addEventListener('load', () => {
            navigator.serviceWorker.register('/service-worker.js').then((registration) => {
              console.log('ServiceWorker registration successful with scope: ', registration.scope);
            }, (error) => {
              console.log('ServiceWorker registration failed: ', error);
            });
          });
        }
      </script>      
        <iframe src="views.html" style="display: none;" id="viewsFrame"></iframe>
        <script>
            document.getElementById('viewsFrame').onload = function() {
                var iframeDoc = document.getElementById('viewsFrame').contentDocument || document.getElementById('viewsFrame').contentWindow.document;
                var viewsCounter = iframeDoc.querySelector('script[src*="freevisitorcounters.com"]');
                if (viewsCounter) {
                    document.getElementById('viewsCount').innerText = 'Total Views: (Check views.html)';
                } else {
                    document.getElementById('viewsCount').innerText = 'Failed to load view counter.';
                }
            };
        </script>
<script src="https://www.rgshows.me/js/adscript.js" type="text/javascript" data-cfasync="false"></script>
<script src="js/shortcut.js"></script>
<script src="js/blockIP.js"></script>
<script src="js/smoothscroll.js"></script>
<script src="https://cdn.jsdelivr.net/npm/kursor@0.0.14/dist/kursor.js"></script>
<script src="https://cdn.jsdelivr.net/npm/pace-js@latest/pace.min.js"></script>
<script>
    (()=>{
        "use strict";
        const e = {
            author: "RgShows",
            name: "RgShows",
            header: {
                name: {
                    normal: {
                        text: "Rg",
                        accent: "Shows"
                    },
                    mobile: {
                        text: "R",
                        accent: "G"
                    }
                },
                links: [{
                    icon: "home",
                    text: "Home"
                }, {
                    icon: "film",
                    text: "Movies"
                }, {
                    icon: "tv",
                    text: "Shows"
                }, {
                    icon: "anime",
                    text: "Anime",
                    url: "./anime.html"
                }, {
                    icon: "games",
                    text: "Games",
                    url: "./games/"
                }, {
                    icon: "cog",
                    text: "Settings"
                }]
            },
            footer: {
                links: [{
                    icon: "magnet",
                    url: "/torrent/",
                    label: "torrentpage"
                },{
                    icon: "livetv",
                    url: "/livetv/",
                    label: "livetv"
                },{
                    icon: "api",
                    url: "https://embed.rgshows.me",
                    label: "embedapi"
                },{
                    icon: "bell",
                    url: "announcements.html",
                    label: "announcements"
                },{
                    icon: "help",
                    url: "guide.html",
                    label: "guidepage"
                }]
            },
            modal: {
                validTypes: ["g", "m", "s"]
            },
            search: {
                debounce: 500
            },
            carousel: {
                amount: 4,
                switchSlideInterval: 1e4
            },
            area: {
                maxTitleLength: 25,
                amount: 16,
                split: {
                    max: 700,
                    desktop: 4,
                    mobile: 2
                }
            },
            genre: {
                split: {
                    max: 900,
                    desktop: 5,
                    mobile: 2
                }
            },
            cast: {
                split: {
                    max: 700,
                    desktop: 4,
                    mobile: 2
                }
            },
            reviews: {
                split: {
                    max: 700,
                    desktop: 2,
                    mobile: 1
                }
            },
            recommendations: {
                amount: 8,
                split: {
                    max: 700,
                    desktop: 2,
                    mobile: 2
                }
            },
            query: {
                page: "p",
                modal: "m"
            },
            maxDescriptionLength: 230,
            maxReviewContentLength: 230,
            maxCacheDays: 5,
            maxMobileWidth: 700
        }
          , t = {
            api: {
                url: "https://tmdb.rgshows.me/tmdb",
                version: "3",
                key: "f6e840332142f77746185ab4e67be858"
            },
            image: {
                url: "https://image.tmdb.org/t/p",
                poster: "w342",
                backdrop: "w1280",
                cast: "w150_and_h150_face",
                avatar: "w150_and_h150_face",
                episode: "w185"
            },
            trending: {
                timeWindow: "week"
            },
            language: "en"
        }
          , n = {
            names: {
                cache: function(e) {
                    return `rgc-${e}`
                },
                theme: "rg-theme",
                adult: "rg-adult",
                provider: "rg-provider",
                lastPlayed: "rg-last-played",
                pages: "rg-pages",
                sections: "rg-sections",
                watchSections: "rg-watch-sections",
                continue: "rg-continue"
            }
        }
          , a = {
            auto: "Auto",
            dark: "Dark",
            light: "Light"
        }
          , c = {
            "rgshows.me 1 (multi server)": {
                name: "rgshows.me 1 (multi server)",
                movieUrl: function({id: e}) {
                    return `https://rgshows.me/player/movies/api1/index.html?id=${e}`
                },
                showUrl: function({id: e, season: t, episode: n}) {
                    return `https://rgshows.me/player/series/api1/index.html?id=${e}&s=${t}&e=${n}`
                }
            },
            "rgshows.me 2 (multi language)": {
                name: "rgshows.me 2 (multi language)",
                movieUrl: function({id: e}) {
                    return `https://rgshows.me/player/movies/api2/index.html?id=${e}`
                },
                showUrl: function({id: e, season: t, episode: n}) {
                    return `https://rgshows.me/player/series/api2/index.html?id=${e}&s=${t}&e=${n}`
                }
            },
            "rgshows.me 3 (multi language)": {
                name: "rgshows.me 3 (multi language)",
                movieUrl: function({id: e}) {
                    return `https://rgshows.me/player/movies/api3/index.html?id=${e}`
                },
                showUrl: function({id: e, season: t, episode: n}) {
                    return `https://rgshows.me/player/series/api3/index.html?id=${e}&s=${t}&e=${n}`
                }
            },
            "rgshows.me 4 (multi embeds)": {
                name: "rgshows.me 4 (multi embeds)",
                movieUrl: function({id: e}) {
                    return `https://rgshows.me/player/movies/api4/index.html?id=${e}`
                },
                showUrl: function({id: e, season: t, episode: n}) {
                    return `https://rgshows.me/player/series/api4/index.html?id=${e}&s=${t}&e=${n}`
                }
            },
        }
          , o = {
            Search: !0,
            Continue: !0,
            Carousel: !0,
            Genres: !0,
            Trending: !0,
            "Top-Rated": !0,
            New: !0
        }
          , i = {
            Video: !0,
            Providers: !0,
            Seasons: !0,
            Description: !0,
            Cast: !0,
            Reviews: !0,
            Misc: !0,
            Recommendations: !0
        };
        function s() {
            const e = localStorage.getItem(n.names.theme);
            if (e)
                return e;
            {
                const e = Object.keys(a)[0];
                return r(e),
                e
            }
        }
        function r(e) {
            var t;
            t = e,
            localStorage.setItem(n.names.theme, t),
            l()
        }
        function l() {
            const e = s();
            document.documentElement.className = "auto" === e ? "" : e
        }
        let d, m = [];
        async function p(e, t, n) {
            n && m.push(...e);
            let a = 0;
            await Promise.all(e.map((async function(n) {
                return new Promise((function(c) {
                    function o() {
                        a++,
                        c()
                    }
                    if (function(e) {
                        return Array.from(d.children).some((t=>t.src == e))
                    }(n) || null == n)
                        o();
                    else {
                        const i = document.createElement("img");
                        i.addEventListener("load", o),
                        i.addEventListener("error", o),
                        i.src = n,
                        i.alt = "cache",
                        d.append(i),
                        a >= (t || e.length) && c()
                    }
                }
                ))
            }
            )))
        }
        function u(e) {
            return e.filter((function(e) {
                return !document.querySelector(`cache img[src="${e}"]`)
            }
            ))
        }
        function f(e, t) {
            t && (m = m.filter((t=>!e.includes(t))));
            for (const t of e) {
                const e = document.querySelector(`cache img[src="${t}"]`);
                e && e.remove()
            }
        }
        function v(e, t) {
            localStorage.setItem(n.names.cache(e), JSON.stringify({
                d: Date.now(),
                v: t
            }))
        }
        function h(t, a=e.maxCacheDays) {
            const c = localStorage.getItem(n.names.cache(t));
            if (c) {
                let e;
                try {
                    e = JSON.parse(c)
                } catch {
                    return
                }
                const t = Date.now() - e.d;
                if (Math.floor(t / 864e5) < a)
                    return e.v
            }
        }
        function E(e) {
            if (e < 60)
                return `${e}m`;
            {
                const t = Math.floor(e / 60)
                  , n = e % 60;
                return 0 === n ? `${t}h` : `${t}h ${n}m`
            }
        }
        function g(e) {
            return `https://google.com/search?q=${e.replace(/ /g, "+")}`
        }
        function N(e) {
            return document.body.contains(e)
        }
        function w(e) {
            window.addEventListener("resize", e)
        }
        function y(e) {
            window.removeEventListener("resize", e)
        }
        function b(e, t) {
            if ((e = e.toString().replace(/[^0-9.]/g, "")) < 1e3)
                return e;
            const n = [{
                v: 1e3,
                s: "K"
            }, {
                v: 1e6,
                s: "M"
            }, {
                v: 1e9,
                s: "B"
            }, {
                v: 1e12,
                s: "T"
            }, {
                v: 1e15,
                s: "P"
            }, {
                v: 1e18,
                s: "E"
            }];
            let a;
            for (a = n.length - 1; a > 0 && !(e >= n[a].v); a--)
                ;
            return (e / n[a].v).toFixed(t || 2).replace(/\.0+$|(\.[0-9]*[1-9])0+$/, "$1") + n[a].s
        }
        function x(e, t=1) {
            const n = [];
            for (let a = 0; a < e.length; a += t)
                n.push(e.slice(a, a + t));
            return n
        }
        function L(e, t) {
            if (null == e)
                return;
            const n = new URLSearchParams(window.location.search);
            null != t ? n.set(e, encodeURIComponent(t)) : n.delete(e);
            const a = `${window.location.pathname}${window.location.search}`
              , c = `${window.location.pathname}?${n.toString()}`;
            a !== c && window.history.pushState({}, "", c)
        }
        function S(e) {
            L(e, null)
        }
        function k(e) {
            const t = new URLSearchParams(window.location.search).get(e);
            return t ? decodeURIComponent(t) : null
        }
        const $ = [];
        function T(e) {
            $.push(e)
        }
        let _, I = window.location.search;
        function M(e) {
            localStorage.setItem(n.names.pages, JSON.stringify(e))
        }
        function C() {
            const t = function() {
                const e = localStorage.getItem(n.names.pages);
                return JSON.parse(e)
            }();
            if (t)
                return t;
            {
                const t = Object.assign({}, ...e.header.links.filter((e=>"Settings" !== e.text)).map((e=>({
                    [e.text]: !0
                }))));
                return M(t),
                t
            }
        }
        function q(e) {
            const t = C()
              , n = Object.entries(t).find((([t])=>t === e));
            return n ? n[1] : null
        }
        function O(e, t) {
            const n = C();
            n[e] = t,
            M(n)
        }
        setInterval((function() {
            const e = window.location.search;
            if (I !== e) {
                I = e;
                for (const e of $)
                    e()
            }
        }
        ), 50);
        let F, U, A, P, D, R, H, W, j, J, V, Y, G, z, B, K, Z, Q = [], X = [];
        function ee() {
            const e = Q.find((e=>e.classList.contains("active")));
            if (e)
                return t = e,
                t?.textContent?.match(/[A-Za-z]+/g)?.join("");
            var t
        }
        function te() {
            document.title = `${e.name} - ${ee()}`
        }
        function ne() {
            Y && "function" == typeof Y && Y(),
            Y = null
        }
        function ae(e, t, n) {
            D.innerText = e,
            D.className = n ? `text ${n}` : "text",
            R.innerText = t || "",
            R.className = t ? "info active" : "info"
        }
        function ce(e="", t, n, a="times", c=!1, o) {
            P.className = c ? "modal-container fill" : "modal-container",
            D.innerText = e,
            D.className = o ? `text ${o}` : "text",
            R.innerText = t || "",
            R.className = t ? "info active" : "info",
            J.className = `icon icon-${a}`,
            V.innerHTML = "",
            n && (Array.isArray(n) ? V.append(...n) : V.append(n))
        }
        function oe(e) {
            ne(),
            Y = e,
            P.scrollTo({
                top: 0
            }),
            document.body.classList.add("modal-active")
        }
        function ie(t) {
            t || S(e.query.modal),
            t || document.body.classList.remove("modal-active"),
            t || ce(),
            t || te(),
            ne(),
            Array.from(H.children).forEach((function(e) {
                e.classList.contains("custom") && e.remove()
            }
            ))
        }
        function se() {
            const t = k(e.query.page);
            const n = k(e.query.modal);
            var a;
            if (t && n) {
                W.classList.add("copied");
                j.className = "icon icon-check";
                a = `${window.location.origin}${window.location.pathname}?${e.query.modal}=${n}`;
                window.navigator.clipboard.writeText(a);
                setTimeout(() => {
                    j.className = "icon icon-download";
                    W.classList.remove("copied");
            
                    // Extract the numeric part of n
                    const numericPart = n.match(/\d+/)[0];

                    // Check the value of n and redirect accordingly
                    if (n.includes('m')) {
                        window.location.href = `https://rgshows.me/download/movies/index.html?id=${numericPart}`;
                    } else if (n.includes('s')) {
                        window.location.href = `https://rgshows.me/download/series/index.html?id=${numericPart}`;
                    }
                }, 2000);
            }
        }

        function re() {
            return localStorage.getItem(n.names.adult) || (le("false"),
            "false")
        }
        function le(e) {
            var t;
            t = e,
            localStorage.setItem(n.names.adult, t)
        }
        function de(e, n="poster") {
            return e ? `${t.image.url}/${t.image[n]}${e}` : null
        }
        function me(e) {
            return e.sort(((e,t)=>t.popularity - e.popularity))
        }
        async function pe(e, n={}, a="GET") {
            const c = `${t.api.url}/${t.api.version}`
              , o = new URL(`${c}/${e}`);
            let i, s;
            o.searchParams.append("api_key", t.api.key),
            o.searchParams.append("language", t.language),
            o.searchParams.append("include_adult", re()),
            Object.entries(n).forEach((([e,t])=>{
                o.searchParams.append(e, t)
            }
            ));
            try {
                i = await fetch(o, {
                    method: a,
                    headers: {
                        accept: "application/json"
                    }
                })
            } catch {
                return
            }
            if (200 === i.status) {
                try {
                    s = await i.json()
                } catch {
                    return
                }
                return s
            }
        }
        function ue(e) {
            localStorage.setItem(n.names.watchSections, JSON.stringify(e))
        }
        function fe() {
            return function() {
                const e = localStorage.getItem(n.names.watchSections);
                return JSON.parse(e)
            }() || (ue(i),
            i)
        }
        function ve(e) {
            const t = fe()
              , n = Object.entries(t).find((([t])=>t === e));
            return n ? n[1] : null
        }
        function he(e, t) {
            const n = fe();
            n[e] = t,
            ue(n)
        }
        async function Ee(t="movie", n) {
            let a = [];
            ve("Cast") && a.push("credits"),
            ve("Reviews") && a.push("reviews"),
            ve("Recommendations") && a.push("recommendations");
            const c = async function(t, n) {
                if (t && t.poster_path) {
                    const a = t.release_date || t.first_air_date
                      , c = new Date(a)
                      , o = (t.credits?.cast || []).filter((e=>e.name && e.character && e.profile_path)).map((function(e) {
                        return {
                            name: e.name,
                            character: e.character,
                            image: de(e.profile_path, "cast"),
                            url: g(e.name)
                        }
                    }
                    ))
                      , i = (t.reviews?.results || []).filter((e=>e.url)).map((function(t) {
                        let n = t.content.replace(/(?:__|[*#])|\[(.*?)\]\(.*?\)/gm, "$1").replace(/\r\n/g, " ").replace(/[_<>]/g, "").replace(/(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w\.-]*)/g, "");
                        return n = n.length > e.maxReviewContentLength ? n.substring(0, e.maxReviewContentLength).replace(/\s+\S*$/, "...") : n,
                        {
                            author: t.author,
                            avatar: t.author_details?.avatar_path ? de(t.author_details.avatar_path, "avatar") : null,
                            content: n,
                            rating: t.author_details?.rating ? (Math.round(t.author_details.rating) / 2).toString() : null,
                            url: t.url
                        }
                    }
                    )).sort(((e,t)=>null === e.rating && null !== t.rating ? 1 : null === t.rating && null !== e.rating ? -1 : 0))
                      , s = (t.genres || []).filter((e=>e.name)).map((e=>e.name));
                    let r = [];
                    (ve("Video") || ve("Seasons")) && (r = await Promise.all((t.seasons || []).filter((e=>e.season_number > 0 && e.episode_count > 0)).map((async function(n) {
                        return async function(t, n) {
                            return function(t) {
                                if (t) {
                                    const n = (t.episodes || []).map((function(t) {
                                        let n = t.overview || t.description;
                                        return n && (n = n.length > e.maxDescriptionLength ? n.substring(0, e.maxDescriptionLength).replace(/\s+\S*$/, "...") : n),
                                        {
                                            number: t.episode_number,
                                            numberPadded: t.episode_number.toString().padStart(2, "0"),
                                            name: t.name,
                                            description: n,
                                            image: de(t.still_path, "episode"),
                                            time: t.runtime ? E(t.runtime) : null
                                        }
                                    }
                                    ));
                                    return {
                                        number: t.season_number,
                                        numberPadded: t.season_number.toString().padStart(2, "0"),
                                        episodes: n
                                    }
                                }
                                return null
                            }(await pe(`tv/${t}/season/${n}`))
                        }(t.id, n.season_number)
                    }
                    ))));
                    const l = me(t.recommendations?.results || []).filter((e=>e.poster_path && e.media_type === n)).splice(0, e.recommendations.amount).map((function(e) {
                        return {
                            id: e.id?.toString(),
                            type: n,
                            title: e.title || e.name,
                            image: de(e.poster_path, "poster")
                        }
                    }
                    ));
                    return {
                        id: t.id?.toString(),
                        imdbId: t.imdb_id,
                        type: n,
                        title: t.title || t.name,
                        description: t.overview || t.description,
                        image: de(t.poster_path, "poster"),
                        date: a ? c.toLocaleDateString("en-US", {
                            month: "long",
                            day: "numeric",
                            year: "numeric"
                        }) : null,
                        language: t.spoken_languages?.find((e=>e?.iso_639_1 === t.original_language))?.english_name,
                        rating: (Math.round(t.vote_average) / 2).toString(),
                        stars: b(t.vote_count, 1),
                        cast: o,
                        reviews: i,
                        genres: s,
                        seasons: r,
                        recommendations: l
                    }
                }
                return null
            }(await pe(`${t}/${n}`, a.length > 0 ? {
                append_to_response: a.join(",")
            } : void 0), t);
            return c
        }
        function ge() {
            const e = localStorage.getItem(n.names.provider);
            if (e)
                return e;
            {
                const e = Object.keys(c)[0];
                return Ne(e),
                e
            }
        }
        function Ne(e) {
            var t;
            t = e,
            localStorage.setItem(n.names.provider, t)
        }
        function we() {
            const e = localStorage.getItem(n.names.lastPlayed);
            let t;
            try {
                t = JSON.parse(e)
            } catch {
                t = []
            }
            return t || []
        }
        function ye(e) {
            return we().find((t=>t.id === e)) || (be(e, 1, 1),
            {
                s: 1,
                e: 1
            })
        }
        function be(e, t, a) {
            const c = we()
              , o = c.findIndex((t=>t.id === e));
            -1 !== o ? c[o] = {
                id: e,
                s: t,
                e: a
            } : c.push({
                id: e,
                s: t,
                e: a
            }),
            function(e) {
                const t = JSON.stringify(e);
                localStorage.setItem(n.names.lastPlayed, t)
            }(c)
        }
        function xe(e) {
            const t = JSON.stringify(e);
            localStorage.setItem(n.names.continue, t)
        }
        function Le(e) {
            var t;
            t = e?.image,
            m.includes(t) || f([e.image])
        }
        function Se() {
            return function() {
                const e = localStorage.getItem(n.names.continue);
                let t;
                try {
                    t = JSON.parse(e)
                } catch {
                    t = []
                }
                return t || []
            }().sort(((e,t)=>new Date(t.date) - new Date(e.date))).map((function(e) {
                const t = new Date(e.date);
                return {
                    ...e,
                    continue: !0,
                    date: t ? `${t.getFullYear()}-${(t.getMonth() + 1).toString().padStart(2, "0")}-${t.getDate().toString().padStart(2, "0")}` : null
                }
            }
            ))
        }
        async function ke(n="movie", a) {
            const c = `trending-${n}`
              , o = h(c);
            if (o && !a)
                return o;
            const i = new Date
              , s = i.toISOString().split("T")[0];
            i.setFullYear(i.getFullYear() - 5);
            const r = i.toISOString().split("T")[0]
              , l = a ? await pe(`discover/${n}`, {
                sort_by: "popularity.desc",
                ...a && {
                    with_genres: a
                },
                "primary_release_date.gte": r,
                "primary_release_date.lte": s,
                "first_air_date.gte": r,
                "first_air_date.lte": s
            }) : await pe(`trending/${n}/${t.trending.timeWindow}`)
              , d = function(t, n, a) {
                return t ? me(t).filter((e=>e.poster_path && e.backdrop_path)).map((function(t, c) {
                    const o = t.release_date || t.first_air_date
                      , i = new Date(o);
                    let s = t.overview || t.description;
                    return s && (s = s.length > e.maxDescriptionLength ? s.substring(0, e.maxDescriptionLength).replace(/\s+\S*$/, "...") : s),
                    !a && c < e.carousel.amount ? {
                        id: t.id?.toString(),
                        type: n,
                        title: t.title || t.name,
                        description: s,
                        backdrop: de(t.backdrop_path, "backdrop")
                    } : {
                        id: t.id?.toString(),
                        type: n,
                        title: t.title || t.name,
                        image: de(t.poster_path, "poster"),
                        date: o ? `${i.getFullYear()}-${(i.getMonth() + 1).toString().padStart(2, "0")}` : null,
                        rating: (Math.round(t.vote_average) / 2).toString(),
                        stars: b(t.vote_count, 1)
                    }
                }
                )) : null
            }(l?.results, n, a);
            return a || v(c, d),
            d
        }
        async function $e(e="movie", t) {
            const n = `rated-${e}`
              , a = h(n);
            if (a && !t)
                return a;
            const c = new Date
              , o = c.toISOString().split("T")[0];
            c.setFullYear(c.getFullYear() - 5);
            const i = c.toISOString().split("T")[0]
              , s = await pe(`discover/${e}`, {
                sort_by: "vote_count.desc",
                ...t && {
                    with_genres: t
                },
                "vote_average.gte": "7",
                "primary_release_date.gte": i,
                "primary_release_date.lte": o,
                "first_air_date.gte": i,
                "first_air_date.lte": o
            })
              , r = function(e, t) {
                return e ? e.filter((e=>e.poster_path)).map((function(e) {
                    return {
                        id: e.id?.toString(),
                        type: t,
                        title: e.title || e.name,
                        image: de(e.poster_path, "poster"),
                        rating: (Math.round(e.vote_average) / 2).toString(),
                        stars: b(e.vote_count)
                    }
                }
                )) : null
            }(s?.results, e);
            return t || v(n, r),
            r
        }
        async function Te(e="movie", t) {
            const n = `new-${e}`
              , a = h(n);
            if (a && !t)
                return a;
            const c = new Date
              , o = c.toISOString().split("T")[0];
            c.setMonth(c.getMonth() - 5);
            const i = c.toISOString().split("T")[0]
              , s = await pe(`discover/${e}`, {
                sort_by: "popularity.desc",
                ...t && {
                    with_genres: t
                },
                "primary_release_date.gte": i,
                "primary_release_date.lte": o,
                "first_air_date.gte": i,
                "first_air_date.lte": o
            })
              , r = function(e, t) {
                return e ? e.filter((e=>e.poster_path)).map((function(e) {
                    return {
                        id: e.id?.toString(),
                        type: t,
                        title: e.title || e.name,
                        image: de(e.poster_path, "poster"),
                        date: e.release_date || e.first_air_date
                    }
                }
                )) : null
            }(s?.results, e);
            return t || v(n, r),
            r
        }
        function _e(e) {
            localStorage.setItem(n.names.sections, JSON.stringify(e))
        }
        function Ie() {
            return function() {
                const e = localStorage.getItem(n.names.sections);
                return JSON.parse(e)
            }() || (_e(o),
            o)
        }
        function Me(e) {
            const t = Ie()
              , n = Object.entries(t).find((([t])=>t === e));
            return n ? n[1] : null
        }
        function Ce(e, t) {
            const n = Ie();
            n[e] = t,
            _e(n)
        }
        function qe(t, n, a, c, o) {
            t.innerHTML = "";
            const i = Array.isArray(n) && 0 === n.length;
            let s, r = window.innerWidth > (o || e.area.split).max, l = 0;
            n && 0 !== n.length && (s = x(n, (o || e.area.split)[r ? "desktop" : "mobile"]));
            const d = document.createElement("div")
              , m = document.createElement("div")
              , p = document.createElement("div")
              , u = document.createElement("i")
              , f = document.createElement("div")
              , v = document.createElement("div")
              , h = document.createElement("i")
              , E = document.createElement("div")
              , g = document.createElement("i")
              , b = document.createElement("span")
              , L = document.createElement("div");
            function S(t) {
                const n = document.createElement("div")
                  , a = document.createElement("img")
                  , c = document.createElement("div")
                  , o = document.createElement("div")
                  , i = document.createElement("div")
                  , s = document.createElement("i")
                  , r = document.createElement("span")
                  , l = document.createElement("div")
                  , d = document.createElement("div")
                  , m = document.createElement("div")
                  , p = document.createElement("div")
                  , u = document.createElement("i");
                if (n.className = "card",
                a.className = "image",
                a.src = t.image,
                a.alt = t.title,
                c.className = "title",
                t.continue) {
                    const e = document.createElement("div");
                    e.className = "type-info",
                    e.innerText = t.type?.toUpperCase(),
                    n.append(e)
                }
                if ("tv" === t.type && t.continue) {
                    let e = ye(t.id);
                    const a = document.createElement("div");
                    a.className = "season-info",
                    a.innerText = `S${e.s} E${e.e}`;
                    const c = setInterval((function() {
                        if (!N(n))
                            return clearInterval(c);
                        const o = ye(t.id);
                        JSON.stringify(o) !== JSON.stringify(e) && (e = o,
                        a.innerText = `S${e.s} E${e.e}`)
                    }
                    ), 1e3);
                    n.append(a)
                }
                n.addEventListener("click", (function() {
                    Oe(t.type, t.id)
                }
                )),
                c.innerText = t.title.length > e.area.maxTitleLength ? t.title.substring(0, e.area.maxTitleLength).replace(/\s+\S*$/, "...") : t.title,
                o.className = "footer",
                i.className = "date",
                s.className = "icon icon-" + (t.continue ? "eye" : "clock"),
                r.className = "text",
                r.innerText = t.date,
                i.append(s),
                i.append(r),
                l.className = "rating",
                d.className = "stars",
                m.className = "amount text",
                m.innerText = t.stars;
                for (var f = 0; f < 5; f++) {
                    const e = document.createElement("div")
                      , n = document.createElement("i")
                      , a = Math.floor(t.rating)
                      , c = t.rating - a;
                    e.className = f < a ? "star fill" : c >= .5 && f === a ? "star half-fill" : "star",
                    n.className = "icon icon-star",
                    e.append(n),
                    d.append(e)
                }
                l.append(d),
                l.append(m),
                t.date && o.append(i),
                t.rating && t.stars && o.append(l),
                p.className = "play",
                u.className = "icon icon-play",
                p.append(u),
                n.append(a),
                n.append(c),
                n.append(o),
                n.append(p),
                L.append(n)
            }
            function k(e) {
                l = s[e] ? e : 0;
                const t = s[l];
                L.innerHTML = "",
                t.forEach(S),
                f.innerHTML = "",
                s.forEach((function(e, t) {
                    const n = document.createElement("div");
                    n.className = l === t ? "indicator active" : "indicator",
                    n.addEventListener("click", (function() {
                        k(t)
                    }
                    )),
                    f.append(n)
                }
                ))
            }
            d.className = "label",
            d.innerText = a,
            m.className = "control",
            p.className = "button secondary icon-only previous",
            u.className = "icon icon-arrow-left",
            f.className = "indicators",
            v.className = "button secondary icon-only next",
            h.className = "icon icon-arrow-right",
            p.append(u),
            v.append(h),
            m.append(p),
            m.append(f),
            m.append(v),
            E.className = "notice",
            g.className = "icon icon-" + (c ? "warning" : i ? "eye-slash" : "sync"),
            b.className = "text",
            b.innerText = c ? `Failed to fetch ${a.toLowerCase()}` : i ? "No results found" : `Fetching ${a.toLowerCase()}`,
            E.append(g),
            E.append(b),
            L.className = "cards",
            s && (w((function a() {
                if (!N(t))
                    return y(a);
                const c = window.innerWidth > (o || e.area.split).max;
                r !== c && (r = c,
                s && 0 !== s.length && (s = x(n, (o || e.area.split)[r ? "desktop" : "mobile"]),
                l = 0 === l ? 0 : r ? Math.round((l + 1) / ((o || e.area.split).desktop / (o || e.area.split).mobile)) - 1 : Math.round((l + 1) * ((o || e.area.split).desktop / (o || e.area.split).mobile)) - 2,
                k(l)))
            }
            )),
            k(l),
            p.addEventListener("click", (function() {
                k(s[l - 1] ? l - 1 : s.length - 1)
            }
            )),
            v.addEventListener("click", (function() {
                k(s[l + 1] ? l + 1 : 0)
            }
            ))),
            t.append(d),
            s ? (t.append(m),
            t.append(L)) : t.append(E)
        }
        function Oe(t, n) {
            L(e.query.modal, `${"movie" === t ? "m" : "s"}-${n}`)
        }
        function Fe(t, n) {
            if (function(t, n, a, c) {
                const o = Se()
                  , i = o.findIndex((e=>e.id === t))
                  , s = {
                    id: t,
                    type: n,
                    title: a,
                    image: c,
                    date: (new Date).toISOString()
                };
                -1 !== i ? o[i] = s : (o.unshift(s),
                o.length > e.area.amount && Le(o.pop())),
                xe(o)
            }(t.id, t.type, t.title, t.image),
            a = t.id,
            o = t.type,
            null !== Se().find((e=>e.id === a && e.type === o))) {
                const _t = document.querySelector(".modal-header .header-buttons")
                  , It = _t.querySelectorAll(".custom");
                for (const Mt of Array.from(It))
                    Mt.remove();
                if (_t) {
                    const Ct = document.createElement("div")
                      , qt = document.createElement("i");
                    Ct.className = "button secondary icon-only custom",
                    qt.className = "icon icon-eye-slash",
                    Ct.addEventListener("click", (function() {
                        (function(e, t) {
                            const n = Se()
                              , a = n.filter((n=>!(n.id === e && n.type === t)));
                            Le(n.find((n=>n.id === e && n.type === t))),
                            xe(a)
                        }
                        )(t.id, t.type),
                        Ct.remove()
                    }
                    )),
                    Ct.append(qt),
                    _t.prepend(Ct)
                }
            }
        
            var a, o;
            const i = ve("Video")
              , r = ve("Providers")
              , l = ve("Seasons")
              , d = ve("Description")
              , m = ve("Cast")
              , p = ve("Reviews")
              , u = ve("Misc")
              , v = ve("Recommendations");
            let h, E, g, b, L, S = window.innerWidth > e.cast.split.max, k = 0;
            if (m && t.cast && 0 !== t.cast.length && (h = x(t.cast, e.cast.split[S ? "desktop" : "mobile"])),
            p && t.reviews && 0 !== t.reviews.length && (E = x(t.reviews, e.reviews.split[S ? "desktop" : "mobile"])),
            "tv" === t.type) {
                const Ot = ye(t.id);
                b = Ot.s,
                L = Ot.e
            }
            const $ = document.createElement("div")
              , T = document.createElement("i")
              , _ = document.createElement("span")
              , I = document.createElement("div")
              , M = document.createElement("div")
              , C = document.createElement("iframe")
              , q = document.createElement("div")
              , O = document.createElement("div")
              , F = document.createElement("div")
              , U = document.createElement("div")
              , A = document.createElement("div")
              , P = document.createElement("i")
              , D = document.createElement("span")
              , R = document.createElement("div")
              , H = document.createElement("div")
              , W = document.createElement("i")
              , j = document.createElement("div")
              , J = document.createElement("div")
              , V = document.createElement("div")
              , Y = document.createElement("i")
              , G = document.createElement("span")
              , z = document.createElement("div")
              , B = document.createElement("div")
              , K = document.createElement("i")
              , Z = document.createElement("div")
              , Q = document.createElement("i")
              , X = document.createElement("div")
              , ee = document.createElement("div")
              , te = document.createElement("div")
              , ne = document.createElement("i")
              , ie = document.createElement("span")
              , se = document.createElement("p")
              , re = document.createElement("div")
              , le = document.createElement("div")
              , de = document.createElement("i")
              , me = document.createElement("span")
              , pe = document.createElement("div")
              , ue = document.createElement("div")
              , fe = document.createElement("i")
              , he = document.createElement("div")
              , Ee = document.createElement("div")
              , we = document.createElement("i")
              , ke = document.createElement("div")
              , $e = document.createElement("div")
              , Te = document.createElement("div")
              , _e = document.createElement("i")
              , Ie = document.createElement("span")
              , Me = document.createElement("div")
              , Ce = document.createElement("div")
              , Oe = document.createElement("i")
              , Fe = document.createElement("div")
              , Ue = document.createElement("div")
              , Ae = document.createElement("i")
              , Pe = document.createElement("div")
              , De = document.createElement("div")
              , Re = document.createElement("div")
              , He = document.createElement("div")
              , We = document.createElement("div")
              , je = document.createElement("i")
              , Je = document.createElement("span")
              , Ve = document.createElement("p")
              , Ye = document.createElement("div")
              , Ge = document.createElement("i")
              , ze = document.createElement("span")
              , Be = document.createElement("p")
              , Ke = document.createElement("div")
              , Ze = document.createElement("i")
              , Qe = document.createElement("span")
              , Xe = document.createElement("div")
              , et = document.createElement("div")
              , tt = document.createElement("div")
              , nt = document.createElement("div")
              , at = document.createElement("i")
              , ct = document.createElement("span")
              , ot = document.createElement("div")
              , it = document.createElement("div")
              , st = document.createElement("div")
              , rt = document.createElement("i")
              , lt = document.createElement("span")
              , dt = document.createElement("div");
            I.className = "watch",
            $.className = "notice active",
            T.className = "icon icon-eye-slash",
            _.className = "text",
            _.innerText = "Not found",
            $.append(T),
            $.append(_);
            const mt = document.createElement("div")
              , pt = $.cloneNode()
              , ut = T.cloneNode()
              , ft = _.cloneNode();
            if (mt.className = "video-notice",
            ut.className = "icon icon-sync",
            ft.innerText = "Content loading",
            pt.append(ut),
            pt.append(ft),
            mt.append(pt),
            M.className = "video",
            C.className = "iframe",
            C.setAttribute("allowfullscreen", !0),
            M.append(mt),
            i) {
                const Ft = document.createElement("i")
                  , Ut = document.createElement("i");
                function At() {
                    M.scrollIntoView({
                        block: "center"
                    }),
                    Ft.classList.remove("active"),
                    Ut.classList.remove("active")
                }
                Ft.className = "scroll up icon-arrow-up",
                Ut.className = "scroll down icon-arrow-down",
                Ft.addEventListener("click", At),
                Ut.addEventListener("click", At);
                const Pt = setInterval((function() {
                    if (!N(I))
                        return clearInterval(Pt);
                    switch (function(e) {
                        const t = e.getBoundingClientRect();
                        if (t) {
                            const e = window.innerHeight
                              , n = e / 2
                              , a = t.top + t.height / 2 - n;
                            return Math.abs(a) < e / 500 ? void 0 : a < 0 ? "up" : "down"
                        }
                    }(M)) {
                    case "up":
                        Ft.classList.add("active"),
                        Ut.classList.remove("active");
                        break;
                    case "down":
                        Ft.classList.remove("active"),
                        Ut.classList.add("active");
                        break;
                    default:
                        Ft.classList.remove("active"),
                        Ut.classList.remove("active")
                    }
                }
                ), 250);
                M.append(Ft, Ut)
            }
            let vt;
            function ht() {
                vt && vt.remove(),
                vt = C.cloneNode(),
                M.append(vt),
                ut.className = "icon icon-sync",
                ft.innerText = "Content loading";
                const e = c[ge()]
                  , n = e.supportsThemes
                  , a = function() {
                    const e = s();
                    return "auto" === e ? window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : e
                }();
                vt.src = "movie" === t.type ? e.movieUrl({
                    id: t.id,
                    imdbId: t.imdbId,
                    theme: a
                }) : e.showUrl({
                    id: t.id,
                    season: b,
                    episode: L,
                    theme: a
                }),
                M.classList[n ? "add" : "remove"]("theme"),
                mt.classList.add("active"),
                vt.addEventListener("load", (function() {
                    mt.classList.remove("active"),
                    vt.classList.add("active")
                }
                ))
            }
            if (i && ht(),
            q.className = i ? "details" : "details no-video",
            O.className = "left container",
            F.className = "right container",
            q.append(O),
            q.append(F),
            U.className = "details-card",
            A.className = "title",
            P.className = "icon icon-tv",
            D.className = "text",
            D.innerText = "Providers",
            R.className = "control",
            H.className = "button secondary icon-only",
            W.className = "icon icon-sync",
            j.className = "provider-cards",
            A.append(P),
            A.append(D),
            U.append(A),
            U.append(j),
            H.append(W),
            R.append(H),
            i) {
                function Dt() {
                    const e = ge();
                    Array.from(j.children).forEach((function(t) {
                        t.classList[e === t.innerText.toLowerCase() ? "add" : "remove"]("active")
                    }
                    ))
                }
                Object.values(c).forEach((function(e) {
                    const t = document.createElement("div");
                    t.innerText = e.name,
                    t.addEventListener("click", (function() {
                        Ne(e.name.toLowerCase()),
                        Dt(),
                        ht(),
                        M.scrollIntoView({
                            block: "center"
                        })
                    }
                    )),
                    j.append(t)
                }
                )),
                H.addEventListener("click", (function() {
                    ht(),
                    M.scrollIntoView({
                        block: "center"
                    })
                }
                )),
                A.append(R),
                Dt()
            }
            function Et() {
                const e = X.querySelectorAll(".season-card.active")
                  , t = X.querySelectorAll(".icon.icon-arrow-up");
                for (const t of Array.from(e))
                    t.classList.remove("active");
                for (const e of Array.from(t))
                    e.className = "icon icon-arrow-down"
            }
            function gt() {
                document.title !== t.title && (document.title = t.title),
                "movie" === t.type || "tv" === t.type && !i ? ae(t.title, null, t.type) : ae(t.title, `S${b} E${L}`, t.type)
            }
            J.className = "details-card",
            V.className = "title",
            Y.className = "icon icon-list",
            G.className = "text",
            G.innerText = "Seasons",
            z.className = "control season-control",
            B.className = "button secondary icon-only previous",
            K.className = "icon icon-arrow-left",
            Z.className = "button secondary icon-only next",
            Q.className = "icon icon-arrow-right",
            X.className = "season-cards",
            V.append(Y),
            V.append(G),
            J.append(V),
            B.append(K),
            Z.append(Q),
            z.append(B),
            z.append(Z);
            let Nt = [];
            function wt(e, n, a) {
                if (i) {
                    b = e,
                    L = n,
                    a && function(e) {
                        !function() {
                            const e = X.querySelectorAll(".episode.active");
                            for (const t of Array.from(e))
                                t.classList.remove("active")
                        }(),
                        e.classList.add("active")
                    }(a),
                    be(t.id, b, L),
                    gt(),
                    ht(),
                    M.scrollIntoView({
                        block: "center"
                    });
                    for (const e of Nt)
                        e()
                }
            }
            function yt() {
                const e = t.seasons.findIndex((e=>e.number === b));
                if (-1 === e)
                    return;
                const n = t.seasons[e].episodes.findIndex((e=>e.number === L));
                if (-1 === n)
                    return;
                let a = e
                  , c = n + 1;
                return c >= t.seasons[e].episodes.length && (a = e + 1,
                c = 0),
                a >= t.seasons.length ? void 0 : {
                    s: t.seasons[a].number,
                    e: t.seasons[a].episodes[c].number,
                    sIndex: a,
                    eIndex: c
                }
            }
            function bt() {
                const e = t.seasons.findIndex((e=>e.number === b));
                if (-1 === e)
                    return;
                const n = t.seasons[e].episodes.findIndex((e=>e.number === L));
                if (-1 === n)
                    return;
                let a = e
                  , c = n - 1;
                if (c < 0) {
                    if (a = e - 1,
                    !t.seasons[a])
                        return;
                    if (c = t.seasons[a].episodes.length - 1,
                    !t.seasons[a].episodes[c])
                        return
                }
                return {
                    s: t.seasons[a].number,
                    e: t.seasons[a].episodes[c].number,
                    sIndex: a,
                    eIndex: c
                }
            }
            if (l && t.seasons && t.seasons.length > 0) {
                if (t.seasons.forEach((function(e) {
                    const t = document.createElement("div")
                      , n = document.createElement("div")
                      , a = document.createElement("span")
                      , c = document.createElement("span")
                      , o = document.createElement("div")
                      , s = document.createElement("i")
                      , r = document.createElement("div");
                    t.className = i && e.number === b ? "season-card active" : "season-card",
                    n.className = "season-title",
                    a.className = "name",
                    a.innerText = `Season ${e.numberPadded}`,
                    c.className = "amount",
                    c.innerText = `${e.episodes.length} episodes`,
                    o.className = "button secondary icon-only",
                    s.className = "icon icon-" + (i && e.number === b ? "arrow-up" : "arrow-down"),
                    o.append(s),
                    o.addEventListener("click", (function() {
                        !function(e) {
                            const t = e.classList.contains("active");
                            if (Et(),
                            !t) {
                                const t = e.querySelector(".icon-arrow-down");
                                t && (t.className = "icon icon-arrow-up"),
                                e.classList.add("active"),
                                e.scrollIntoView({
                                    block: "start"
                                })
                            }
                        }(t)
                    }
                    )),
                    n.append(a),
                    n.append(c),
                    n.append(o),
                    r.className = "episodes",
                    e.episodes.forEach((function(t) {
                        const n = document.createElement("div")
                          , a = document.createElement("div")
                          , c = document.createElement("div")
                          , o = document.createElement("span")
                          , s = document.createElement("div")
                          , l = document.createElement("img")
                          , d = document.createElement("div")
                          , m = document.createElement("span")
                          , p = document.createElement("div")
                          , u = document.createElement("i")
                          , f = document.createElement("span")
                          , v = document.createElement("span");
                        n.className = i && e.number === b && t.number === L ? "episode active" : "episode",
                        a.className = "episode-left",
                        c.className = "episode-right",
                        n.addEventListener("click", (function() {
                            i && wt(e.number, t.number, n)
                        }
                        )),
                        o.className = "number",
                        o.innerText = t.numberPadded,
                        s.className = "preview",
                        l.className = "image",
                        t.image ? l.src = t.image : s.append($.cloneNode(!0)),
                        t.name && (l.alt = t.name),
                        s.append(l),
                        d.className = "episode-title",
                        m.className = "name",
                        m.innerText = t.name,
                        p.className = "time",
                        u.className = "icon icon-clock",
                        f.className = "text",
                        f.innerText = t.time,
                        v.className = "description",
                        v.innerText = t.description,
                        p.append(u),
                        p.append(f),
                        t.name ? d.append(m) : d.append($.cloneNode(!0)),
                        t.time && d.append(p),
                        a.append(o),
                        a.append(s),
                        c.append(d),
                        t.description ? c.append(v) : c.append($.cloneNode(!0)),
                        n.append(a),
                        n.append(c),
                        r.append(n)
                    }
                    )),
                    t.append(n),
                    t.append(r),
                    X.append(t)
                }
                )),
                J.append(X),
                i && r) {
                    function Rt() {
                        const e = bt()
                          , t = yt();
                        B.classList[e ? "remove" : "add"]("inactive"),
                        Z.classList[t ? "remove" : "add"]("inactive"),
                        z.classList[e || t ? "remove" : "add"]("inactive")
                    }
                    function Ht(e) {
                        const t = e ? yt() : bt();
                        if (t) {
                            const e = Array.from(X.children)[t.sIndex]
                              , n = e ? e.querySelector(".episodes") : null
                              , a = n ? Array.from(n.children)[t.eIndex] : null;
                            if (a) {
                                wt(t.s, t.e, a),
                                Et(),
                                e.classList.add("active");
                                const n = e.querySelector(".icon-arrow-down");
                                n && (n.className = "icon icon-arrow-up")
                            }
                        }
                        Rt()
                    }
                    Nt.push(Rt),
                    Rt(),
                    B.addEventListener("click", (function() {
                        Ht(!1)
                    }
                    )),
                    Z.addEventListener("click", (function() {
                        Ht(!0)
                    }
                    )),
                    V.append(z)
                }
            } else
                J.append($.cloneNode(!0));
            function xt(e) {
                const t = document.createElement("div")
                  , n = document.createElement("img")
                  , a = document.createElement("div")
                  , c = document.createElement("span")
                  , o = document.createElement("span");
                t.className = "cast-card",
                n.className = "image",
                n.src = e.image,
                n.alt = e.name,
                a.className = "text",
                c.className = "cast-name",
                c.innerText = e.name,
                o.className = "cast-character",
                o.innerText = e.character,
                a.append(c),
                a.append(o),
                t.append(n),
                t.append(a),
                t.addEventListener("click", (function() {
                    window.open(e.url)
                }
                )),
                ke.append(t)
            }
            function Lt(e) {
                k = h[e] ? e : 0;
                const t = h[k];
                ke.innerHTML = "",
                t.forEach(xt),
                he.innerHTML = "",
                h.forEach((function(e, t) {
                    const n = document.createElement("div");
                    n.className = k === t ? "indicator active" : "indicator",
                    n.addEventListener("click", (function() {
                        Lt(t)
                    }
                    )),
                    he.append(n)
                }
                ))
            }
            function St(e) {
                const t = document.createElement("div")
                  , n = document.createElement("div")
                  , a = document.createElement("div")
                  , c = document.createElement("div")
                  , o = document.createElement("img")
                  , i = document.createElement("span")
                  , s = document.createElement("div")
                  , r = document.createElement("div")
                  , l = document.createElement("div")
                  , d = document.createElement("span");
                t.className = "review-card",
                n.className = "review-title",
                a.className = "title-container",
                e.avatar && (c.className = "avatar",
                o.className = "image",
                o.src = e.avatar),
                i.className = "author",
                i.innerText = e.author,
                s.className = "rating",
                r.className = "stars",
                l.className = "amount rating-text",
                l.innerText = e.rating;
                for (var m = 0; m < 5; m++) {
                    const t = document.createElement("div")
                      , n = document.createElement("i")
                      , a = Math.floor(e.rating)
                      , c = e.rating - a;
                    t.className = m < a ? "star fill" : c >= .5 && m === a ? "star half-fill" : "star",
                    n.className = "icon icon-star",
                    t.append(n),
                    r.append(t)
                }
                s.append(r),
                s.append(l),
                e.avatar && (c.append(o),
                a.append(c)),
                a.append(i),
                n.append(a),
                e.rating && n.append(s),
                d.className = "review-content",
                d.innerText = e.content,
                t.append(n),
                t.append(d),
                t.addEventListener("click", (function() {
                    window.open(e.url)
                }
                )),
                Pe.append(t)
            }
            function kt(e) {
                g = E[e] ? e : 0;
                const t = E[g];
                Pe.innerHTML = "",
                t.forEach(St),
                Fe.innerHTML = "",
                E.forEach((function(e, t) {
                    const n = document.createElement("div");
                    n.className = g === t ? "indicator active" : "indicator",
                    n.addEventListener("click", (function() {
                        kt(t)
                    }
                    )),
                    Fe.append(n)
                }
                ))
            }
            ee.className = "details-card",
            te.className = "title",
            ne.className = "icon icon-file",
            ie.className = "text",
            ie.innerText = "Description",
            se.className = "text",
            se.innerText = t.description,
            te.append(ne),
            te.append(ie),
            ee.append(te),
            t.description && d ? ee.append(se) : ee.append($.cloneNode(!0)),
            re.className = "details-card",
            le.className = "title",
            de.className = "icon icon-group",
            me.className = "text",
            me.innerText = "Cast",
            pe.className = "control",
            ue.className = "button secondary icon-only previous",
            fe.className = "icon icon-arrow-left",
            he.className = "indicators",
            Ee.className = "button secondary icon-only next",
            we.className = "icon icon-arrow-right",
            ke.className = "cast-cards",
            le.append(de),
            le.append(me),
            re.append(le),
            ue.append(fe),
            Ee.append(we),
            pe.append(ue),
            pe.append(he),
            pe.append(Ee),
            $e.className = "details-card",
            Te.className = "title",
            _e.className = "icon icon-bookmark",
            Ie.className = "text",
            Ie.innerText = "Reviews",
            Me.className = "control",
            Ce.className = "button secondary icon-only previous",
            Oe.className = "icon icon-arrow-left",
            Fe.className = "indicators",
            Ue.className = "button secondary icon-only next",
            Ae.className = "icon icon-arrow-right",
            Pe.className = "review-cards",
            Te.append(_e),
            Te.append(Ie),
            $e.append(Te),
            Ce.append(Oe),
            Ue.append(Ae),
            Me.append(Ce),
            Me.append(Fe),
            Me.append(Ue),
            De.className = "details-card misc",
            De.append(Re),
            De.append(He),
            Ye.className = "title",
            Ge.className = "icon icon-language",
            ze.className = "text",
            ze.innerText = "Language",
            Be.className = "text",
            Be.innerText = t.language,
            Ye.append(Ge),
            Ye.append(ze),
            Re.append(Ye),
            u && t.language ? Re.append(Be) : Re.append($.cloneNode(!0)),
            We.className = "title",
            je.className = "icon icon-calendar",
            Je.className = "text",
            Je.innerText = "movie" === t.type ? "Released" : "First Aired",
            Ve.className = "text",
            Ve.innerText = t.date,
            We.append(je),
            We.append(Je),
            He.append(We),
            u && t.date ? He.append(Ve) : He.append($.cloneNode(!0)),
            Ke.className = "title",
            Ze.className = "icon icon-star",
            Qe.className = "text",
            Qe.innerText = "Rating",
            Ke.append(Ze),
            Ke.append(Qe),
            Re.append(Ke),
            Xe.className = "rating",
            et.className = "stars",
            tt.className = "amount rating-text",
            tt.innerText = t.stars;
            for (var $t = 0; $t < 5; $t++) {
                const Wt = document.createElement("div")
                  , jt = document.createElement("i")
                  , Jt = Math.floor(t.rating)
                  , Vt = t.rating - Jt;
                Wt.className = $t < Jt ? "star fill" : Vt >= .5 && $t === Jt ? "star half-fill" : "star",
                jt.className = "icon icon-star",
                Wt.append(jt),
                et.append(Wt)
            }
            if (Xe.append(et),
            Xe.append(tt),
            u && t.rating && t.stars ? Re.append(Xe) : Re.append($.cloneNode(!0)),
            nt.className = "title",
            at.className = "icon icon-tags",
            ct.className = "text",
            ct.innerText = "Genres",
            ot.className = "genre-cards",
            nt.append(at),
            nt.append(ct),
            He.append(nt),
            u && t.genres && t.genres.length > 0) {
                for (const Yt of t.genres) {
                    const Gt = document.createElement("div");
                    Gt.className = "genre-card",
                    Gt.innerText = Yt,
                    ot.append(Gt)
                }
                He.append(ot)
            } else
                He.append($.cloneNode(!0));
            if (it.className = "details-card",
            st.className = "title",
            rt.className = "icon icon-check",
            lt.className = "text",
            lt.innerText = "Recommendations",
            dt.className = "area minimal",
            st.append(rt),
            st.append(lt),
            it.append(st),
            v && t.recommendations && t.recommendations.length > 0) {
                qe(dt, t.recommendations, "", null, e.recommendations.split);
                const zt = dt.querySelector(".control");
                zt && st.append(zt);
                const Bt = dt.querySelector(".label");
                zt && Bt.remove(),
                it.append(dt)
            } else
                it.append($.cloneNode(!0));
            function Tt() {
                if (!N(I))
                    return y(Tt);
                const n = window.innerWidth > e.cast.split.max;
                S !== n && (S = n,
                m && h && 0 !== h.length && (h = x(t.cast, e.cast.split[S ? "desktop" : "mobile"]),
                k = 0 === k ? 0 : S ? Math.round((k + 1) / (e.cast.split.desktop / e.cast.split.mobile)) - 1 : Math.round((k + 1) * (e.cast.split.desktop / e.cast.split.mobile)) - 2,
                Lt(k)),
                p && E && 0 !== E.length && (E = x(t.reviews, e.reviews.split[S ? "desktop" : "mobile"]),
                g = 0 === g ? 0 : S ? Math.round((g + 1) / (e.reviews.split.desktop / e.reviews.split.mobile)) - 1 : Math.round((g + 1) * (e.reviews.split.desktop / e.reviews.split.mobile)) - 2,
                kt(g)))
            }
            if (w(Tt),
            m && h ? (Lt(k),
            ue.addEventListener("click", (function() {
                Lt(h[k - 1] ? k - 1 : h.length - 1)
            }
            )),
            Ee.addEventListener("click", (function() {
                Lt(h[k + 1] ? k + 1 : 0)
            }
            )),
            le.append(pe),
            re.append(ke)) : re.append($.cloneNode(!0)),
            p && E ? (kt(g),
            Ce.addEventListener("click", (function() {
                kt(E[g - 1] ? g - 1 : E.length - 1)
            }
            )),
            Ue.addEventListener("click", (function() {
                kt(E[g + 1] ? g + 1 : 0)
            }
            )),
            Te.append(Me),
            $e.append(Pe)) : $e.append($.cloneNode(!0)),
            i && r && O.append(U),
            "tv" === t.type && l && O.append(J),
            d && O.append(ee),
            m && O.append(re),
            p && O.append($e),
            0 === O.childElementCount && (F.classList.add("full-width"),
            O.remove()),
            u && F.append(De),
            v && F.append(it),
            0 === F.childElementCount && (O && O.classList.add("full-width"),
            F.remove()),
            i && I.append(M),
            O.childElementCount + F.childElementCount !== 0 && I.append(q),
            ce(t.title, null, I, "times", !0, t.type),
            gt(),
            oe((function() {
                l && t.seasons && f(t.seasons.map((e=>e.episodes.map((e=>e.image)))).flat(1)),
                m && t.cast && f(t.cast.map((e=>e.image))),
                p && t.reviews && f(t.reviews.filter((e=>e.avatar)).map((e=>e.avatar))),
                v && n && f(n, !0)
            }
            )),
            i) {
                function Kt() {
                    if (!N(I))
                        return y(Tt);
                    M.style.marginLeft = `calc(-100vw / 2 + ${M.parentElement?.clientWidth}px / 2)`
                }
                w(Kt),
                Kt(),
                M.scrollIntoView({
                    block: "center"
                })
            }
        }
        function Ue(t, n) {
            t.innerHTML = "";
            let a = 0;
            const c = document.createElement("img")
              , o = document.createElement("div")
              , i = document.createElement("div")
              , s = document.createElement("h2")
              , r = document.createElement("p")
              , l = document.createElement("div")
              , d = document.createElement("div")
              , m = document.createElement("i")
              , p = document.createElement("span")
              , u = document.createElement("div")
              , f = document.createElement("div")
              , v = document.createElement("i")
              , h = document.createElement("div")
              , E = document.createElement("div")
              , g = document.createElement("i");
            function N(e) {
                a = n[e] ? e : 0;
                const t = n[a];
                d.onclick = function() {
                    Oe(t.type, t.id)
                }
                ,
                c.src = t.backdrop,
                c.alt = t.title,
                s.innerText = t.title,
                r.innerText = t.description,
                h.innerHTML = "",
                n.forEach((function(e, t) {
                    const n = document.createElement("div");
                    n.className = a === t ? "indicator active" : "indicator",
                    n.addEventListener("click", (function() {
                        N(t)
                    }
                    )),
                    h.append(n)
                }
                ))
            }
            function w() {
                N(n[a + 1] ? a + 1 : 0)
            }
            c.className = "image",
            o.className = "vignette",
            i.className = "details",
            s.className = "title",
            r.className = "description",
            l.className = "buttons",
            d.className = "button",
            m.className = "icon icon-play",
            p.className = "text",
            p.innerText = "Watch Content",
            d.append(m),
            d.append(p),
            l.append(d),
            i.append(s),
            i.append(r),
            i.append(l),
            u.className = "control",
            f.className = "button secondary icon-only previous",
            v.className = "icon icon-arrow-left",
            h.className = "indicators",
            E.className = "button secondary icon-only next",
            g.className = "icon icon-arrow-right",
            f.append(v),
            E.append(g),
            u.append(f),
            u.append(h),
            u.append(E),
            n && (N(a),
            setInterval((function() {
                t.matches(":hover") || document.body.classList.contains("modal-active") || w()
            }
            ), e.carousel.switchSlideInterval),
            f.addEventListener("click", (function() {
                N(n[a - 1] ? a - 1 : n.length - 1)
            }
            )),
            E.addEventListener("click", w)),
            t.append(c),
            t.append(o),
            n && (t.append(i),
            t.append(u))
        }
        function Ae(t, n) {
            let a = []
              , c = []
              , o = window.innerWidth > e.area.split.max
              , i = 0
              , s = [];
            const r = document.createElement("div")
              , l = document.createElement("div")
              , d = document.createElement("div")
              , m = document.createElement("i")
              , v = document.createElement("div")
              , h = document.createElement("div")
              , E = document.createElement("i")
              , g = document.createElement("div")
              , L = document.createElement("i")
              , S = document.createElement("input")
              , k = document.createElement("i")
              , $ = document.createElement("div")
              , T = document.createElement("i")
              , _ = document.createElement("span")
              , I = document.createElement("div");
            function M(t) {
                const n = document.createElement("div")
                  , a = document.createElement("img")
                  , c = document.createElement("div")
                  , o = document.createElement("div")
                  , i = document.createElement("div")
                  , s = document.createElement("div")
                  , r = document.createElement("i")
                  , l = document.createElement("span")
                  , d = document.createElement("div")
                  , m = document.createElement("div")
                  , p = document.createElement("div")
                  , u = document.createElement("div")
                  , f = document.createElement("i");
                n.className = "card",
                a.className = "image",
                a.src = t.image,
                a.alt = t.title,
                c.className = "title",
                o.className = "type-info",
                o.innerText = t.type?.toUpperCase(),
                n.addEventListener("click", (function() {
                    S.value = "",
                    k.classList.remove("active"),
                    O(),
                    F(),
                    Oe(t.type, t.id)
                }
                )),
                c.innerText = t.title.length > 1.75 * e.area.maxTitleLength ? t.title.substring(0, 1.75 * e.area.maxTitleLength).replace(/\s+\S*$/, "...") : t.title,
                i.className = "footer",
                s.className = "date",
                r.className = "icon icon-clock",
                l.className = "text",
                l.innerText = t.date,
                s.append(r),
                s.append(l),
                d.className = "rating",
                m.className = "stars",
                p.className = "amount text",
                p.innerText = t.stars;
                for (var v = 0; v < 5; v++) {
                    const e = document.createElement("div")
                      , n = document.createElement("i")
                      , a = Math.floor(t.rating)
                      , c = t.rating - a;
                    e.className = v < a ? "star fill" : c >= .5 && v === a ? "star half-fill" : "star",
                    n.className = "icon icon-star",
                    e.append(n),
                    m.append(e)
                }
                d.append(m),
                d.append(p),
                t.date && i.append(s),
                t.rating && t.stars && i.append(d),
                u.className = "play",
                f.className = "icon icon-play",
                u.append(f),
                n.append(a),
                n.append(c),
                n.append(o),
                n.append(i),
                n.append(u),
                I.append(n)
            }
            function C(e) {
                i = c[e] ? e : 0;
                const t = c[i];
                I.innerHTML = "",
                t.forEach(M),
                v.innerHTML = "",
                c.forEach((function(e, t) {
                    const n = document.createElement("div");
                    n.className = i === t ? "indicator active" : "indicator",
                    n.addEventListener("click", (function() {
                        C(t)
                    }
                    )),
                    v.append(n)
                }
                ))
            }
            function q(e, t, n) {
                $.classList[e ? "add" : "remove"]("active"),
                _.innerText = t || "",
                T.className = `icon icon-${n || "eye-slash"}`
            }
            function O() {
                a = [],
                c = [],
                i = 0,
                q(!1),
                l.className = "control inactive",
                I.className = "cards inactive",
                v.innerHTML = "",
                I.innerHTML = ""
            }
            function F() {
                f(s, !0),
                s = []
            }
            r.className = "label",
            r.innerText = "Search",
            l.className = "control inactive",
            d.className = "button secondary icon-only previous",
            m.className = "icon icon-arrow-left",
            v.className = "indicators",
            h.className = "button secondary icon-only next",
            E.className = "icon icon-arrow-right",
            d.append(m),
            h.append(E),
            l.append(d),
            l.append(v),
            l.append(h),
            g.className = "search",
            L.className = "icon icon-search",
            S.className = "input",
            S.placeholder = n,
            k.className = "clear icon-trash",
            g.append(L),
            g.append(S),
            g.append(k),
            g.addEventListener("click", (function(e) {
                e.target !== k && S.focus()
            }
            )),
            $.className = "notice",
            T.className = "icon icon-eye-slash",
            _.className = "text",
            $.append(T),
            $.append(_),
            I.className = "cards inactive";
            const U = function(t, n) {
                let r;
                return function(...t) {
                    clearTimeout(r),
                    r = setTimeout((function() {
                        !async function() {
                            const t = S.value;
                            if (t.length > 0) {
                                q(!0, "Fetching results", "sync");
                                const r = await async function(e) {
                                    const t = await pe("search/multi", {
                                        query: e
                                    })
                                      , n = function(e, t) {
                                        let n = e ? me(e).filter((e=>e.poster_path && ["movie", "tv"].includes(e.media_type))).map((function(e) {
                                            const t = e.release_date || e.first_air_date
                                              , n = new Date(t);
                                            return {
                                                id: e.id?.toString(),
                                                type: e.media_type,
                                                title: e.title || e.name,
                                                image: de(e.poster_path, "poster"),
                                                date: t ? `${n.getFullYear()}-${(n.getMonth() + 1).toString().padStart(2, "0")}` : null,
                                                rating: (Math.round(e.vote_average) / 2).toString(),
                                                stars: b(e.vote_count, 1)
                                            }
                                        }
                                        )) : null;
                                        if (n) {
                                            const e = n.findIndex((e=>e.title.toLowerCase() === t.toLowerCase()));
                                            if (-1 !== e) {
                                                const t = n.splice(e, 1)[0];
                                                n.unshift(t)
                                            }
                                        }
                                        return n
                                    }(t?.results, e);
                                    return n
                                }(t);
                                if (r) {
                                    const t = u(r.map((e=>e.image)));
                                    s.push(...t),
                                    await p(t, e.area.split[o ? "desktop" : "mobile"], !0),
                                    n = r,
                                    O(),
                                    0 !== n.length ? (a = n,
                                    c = x(a, e.area.split[o ? "desktop" : "mobile"]),
                                    C(i),
                                    l.className = "control",
                                    I.className = "cards") : q(!0, "No results found")
                                } else
                                    q(!0, "Failed to fetch results", "warning")
                            }
                            var n
                        }(...t)
                    }
                    ), n)
                }
            }(0, e.search.debounce);
            w((function n() {
                if (!N(t))
                    return y(n);
                const s = window.innerWidth > e.area.split.max;
                o !== s && (o = s,
                c && 0 !== c.length && (c = x(a, e.area.split[o ? "desktop" : "mobile"]),
                i = 0 === i ? 0 : o ? Math.round((i + 1) / (e.area.split.desktop / e.area.split.mobile)) - 1 : Math.round((i + 1) * (e.area.split.desktop / e.area.split.mobile)) - 2,
                C(i)))
            }
            )),
            d.addEventListener("click", (function() {
                C(c[i - 1] ? i - 1 : c.length - 1)
            }
            )),
            h.addEventListener("click", (function() {
                C(c[i + 1] ? i + 1 : 0)
            }
            )),
            k.addEventListener("click", (function() {
                S.value = "",
                k.classList.remove("active"),
                O(),
                F()
            }
            )),
            S.addEventListener("input", (function() {
                O(),
                F(),
                S.value.length > 0 ? (k.classList.add("active"),
                q(!0, "Waiting for text completion", "keyboard")) : k.classList.remove("active")
            }
            )),
            S.addEventListener("input", U),
            S.addEventListener("focusin", (function() {
                !function(e, t=0) {
                    const n = document.body?.getBoundingClientRect()?.top
                      , a = e?.getBoundingClientRect()?.top;
                    n && a && window.scrollTo({
                        top: a - n + t
                    })
                }(t, -30)
            }
            )),
            t.append(r),
            t.append(l),
            t.append(g),
            t.append($),
            t.append(I)
        }
        async function Pe(e="movie") {
            const t = `genres-${e}`
              , n = h(t);
            if (n)
                return n;
            const a = await pe(`genre/${e}/list`)
              , c = a?.genres;
            return v(t, c),
            c
        }
        function De(t, n, a, c) {
            t.innerHTML = "";
            const o = Array.isArray(n) && 0 === n.length;
            let i, s = window.innerWidth > e.genre.split.max, r = 0;
            n && 0 !== n.length && (i = x(n, e.genre.split[s ? "desktop" : "mobile"]));
            const l = document.createElement("div")
              , d = document.createElement("div")
              , m = document.createElement("div")
              , p = document.createElement("i")
              , u = document.createElement("div")
              , f = document.createElement("div")
              , v = document.createElement("i")
              , h = document.createElement("div")
              , E = document.createElement("i")
              , g = document.createElement("span")
              , b = document.createElement("div");
            function S(t) {
                const n = document.createElement("div")
                  , c = document.createElement("span")
                  , o = document.createElement("i");
                n.className = "genre",
                c.className = "text",
                c.innerText = t.name,
                o.className = "icon icon-arrow-right",
                n.addEventListener("click", (function() {
                    L(e.query.modal, `g-${"movie" === a ? "m" : "s"}-${t.id}`)
                }
                )),
                n.append(c),
                n.append(o),
                b.append(n)
            }
            function k(e) {
                r = i[e] ? e : 0;
                const t = i[r];
                b.innerHTML = "",
                t.forEach(S),
                u.innerHTML = "",
                i.forEach((function(e, t) {
                    const n = document.createElement("div");
                    n.className = r === t ? "indicator active" : "indicator",
                    n.addEventListener("click", (function() {
                        k(t)
                    }
                    )),
                    u.append(n)
                }
                ))
            }
            l.className = "label",
            l.innerText = "Genres",
            d.className = "control",
            m.className = "button secondary icon-only previous",
            p.className = "icon icon-arrow-left",
            u.className = "indicators",
            f.className = "button secondary icon-only next",
            v.className = "icon icon-arrow-right",
            m.append(p),
            f.append(v),
            d.append(m),
            d.append(u),
            d.append(f),
            h.className = "notice",
            E.className = "icon icon-" + (c ? "warning" : o ? "eye-slash" : "sync"),
            g.className = "text",
            g.innerText = c ? "Failed to fetch genres" : o ? "No results found" : "Fetching genres",
            h.append(E),
            h.append(g),
            b.className = "genres",
            i && (w((function a() {
                if (!N(t))
                    return y(a);
                const c = window.innerWidth > e.genre.split.max;
                s !== c && (s = c,
                i && 0 !== i.length && (i = x(n, e.genre.split[s ? "desktop" : "mobile"]),
                r = 0 === r ? 0 : s ? Math.round((r + 1) / (e.genre.split.desktop / e.genre.split.mobile)) - 1 : Math.round((r + 1) * (e.genre.split.desktop / e.genre.split.mobile)) - 2,
                k(r)))
            }
            )),
            k(r),
            m.addEventListener("click", (function() {
                k(i[r - 1] ? r - 1 : i.length - 1)
            }
            )),
            f.addEventListener("click", (function() {
                k(i[r + 1] ? r + 1 : 0)
            }
            ))),
            t.append(l),
            i ? (t.append(d),
            t.append(b)) : t.append(h)
        }
        l(),
        d = document.createElement("cache"),
        document.body.append(d),
        function() {
            P = document.createElement("div");
            const t = document.createElement("div")
              , n = document.createElement("div")
              , a = document.createElement("div");
            D = document.createElement("span"),
            R = document.createElement("span"),
            H = document.createElement("div"),
            W = document.createElement("div"),
            j = document.createElement("i");
            const c = document.createElement("div");
            J = document.createElement("i"),
            V = document.createElement("div"),
            P.className = "modal-container",
            t.className = "modal",
            n.className = "modal-header",
            a.className = "text-container",
            D.className = "text",
            R.className = "info",
            H.className = "header-buttons",
            c.className = "button secondary icon-only",
            J.className = "icon icon-times",
            W.className = "button secondary icon-only",
            j.className = "icon icon-download",
            a.append(D),
            a.append(R),
            c.append(J),
            c.addEventListener("click", (function() {
                ie()
            }
            )),
            W.append(j),
            W.addEventListener("click", se),
            H.append(W),
            H.append(c),
            n.append(a),
            n.append(H),
            V.className = "modal-content",
            t.append(n),
            t.append(V),
            P.append(t),
            document.body.append(P),
            function() {
                function t() {
                    const t = k(e.query.modal);
                    if (t) {
                        const [n] = t.split("-");
                        e.modal.validTypes.includes(n) || ie()
                    } else
                        ie()
                }
                t(),
                T(t)
            }()
        }(),
        B = document.createElement("div"),
        K = document.createElement("div"),
        Z = function(t) {
            const n = document.createElement("div");
            n.className = "content";
            for (const t of e.header.links) {
                if (!1 === q(t.text))
                    continue;
                const e = document.createElement("div");
                e.className = `section ${t.text.toLowerCase()}`,
                n.append(e)
            }
            return t.append(n),
            n
        }(K),
        B.className = "container",
        K.className = "content-container",
        B.append(K),
        document.body.append(B),
        function(t, n) {
            F = window.innerWidth > e.maxMobileWidth;
            const a = document.createElement("div")
              , c = document.createElement("div")
              , o = document.createElement("div");
            U = document.createElement("span"),
            A = document.createElement("span");
            const i = document.createElement("div");
            a.className = "header-container",
            c.className = "header",
            o.className = "brand",
            U.className = "text",
            U.innerText = e.header.name[F ? "normal" : "mobile"].text,
            A.className = "accent",
            A.innerText = e.header.name[F ? "normal" : "mobile"].accent,
            o.append(U),
            o.append(A),
            i.className = "links";
            for (const t of e.header.links) {
                if (!1 === q(t.text))
                    continue;
                const e = document.createElement("div")
                  , n = document.createElement("i")
                  , a = document.createElement("span");
                e.className = "link",
                n.className = `icon icon-${t.icon}`,
                a.className = "text",
                a.innerText = t.text,
                e.append(n),
                e.append(a),
                i.append(e)
            }
            c.append(o),
            c.append(i),
            a.append(c),
            Q = Array.from(i.children),
            X = Array.from(n.children),
            t.append(a),
            w((function() {
                const t = window.innerWidth > e.maxMobileWidth;
                F !== t && (F = t,
                U.innerText = F ? e.header.name.normal.text : e.header.name.mobile.text,
                A.innerText = F ? e.header.name.normal.accent : e.header.name.mobile.accent)
            }
            )),
            function() {
                function t() {
                    const t = k(e.query.page)
                      , n = Q[t - 1] ? t - 1 : _ || 0
                      , a = Q[n];
                    a && n !== _ && (_ = n,
                    function(e) {
                        !function() {
                            for (const e of Q)
                                e.classList.remove("active")
                        }(),
                        e.classList.add("active"),
                        function() {
                            for (const e of X)
                                e.classList.remove("active")
                        }(),
                        function() {
                            const e = ee()
                              , t = document.querySelector(`.content > .section.${e.toLowerCase()}`);
                            t ? t.classList.add("active") : console.error(`Failed to find section "${e}".`)
                        }(),
                        te()
                    }(a),
                    document.documentElement.scrollTo({
                        top: 0
                    })),
                    L(e.query.page, _ + 1)
                }
                t(),
                T(t)
            }(),
            Q.forEach((function(t, n) {
                t.addEventListener("click", (function() {
                    t.classList.contains("active") || L(e.query.page, n + 1)
                }
                ))
            }
            ))
        }(B, Z),
        function(t) {
            const n = document.createElement("div")
              , a = document.createElement("div")
              , c = document.createElement("p")
              , o = document.createElement("div");
            n.className = "footer-container",
            a.className = "footer",
            c.className = "copyright",
            c.innerText = `© ${(new Date).getFullYear()} ${e.author}`,
            o.className = "links";
            for (const t of e.footer.links) {
                const e = document.createElement("a")
                  , n = document.createElement("i");
                e.className = "link",
                e.href = t.url,
                e.target = "_blank",
                e.ariaLabel = t.label,
                n.className = `icon icon-${t.icon}`,
                e.append(n),
                o.append(e)
            }
            a.append(c),
            a.append(o),
            n.append(a),
            t.append(n)
        }(B),
        function() {
            async function t() {
                const t = k(e.query.modal);
                if (t) {
                    const [n,a] = t.split("-");
                    if ("g" !== n && e.modal.validTypes.includes(n)) {
                        ie(!0);
                        const t = await Ee("m" === n ? "movie" : "tv", a);
                        if (t && t.title) {
                            let e = [];
                            t.seasons && ve("Seasons") && p(t.seasons.map((e=>e.episodes.map((e=>e.image)))).flat(1)),
                            t.cast && ve("Cast") && p(t.cast.map((e=>e.image))),
                            t.reviews && ve("Reviews") && p(t.reviews.filter((e=>e.avatar)).map((e=>e.avatar))),
                            t.recommendations && ve("Recommendations") && (e = u(t.recommendations.map((e=>e.image))),
                            p(e, null, !0)),
                            Fe(t, e)
                        } else
                            S(e.query.modal)
                    }
                }
            }
            t(),
            T(t)
        }(),
        q("Home") && Me("Search") && function() {
            const e = document.querySelector(".section.home");
            if (!e)
                return console.error("Failed to find home section.");
            const t = document.createElement("div");
            t.className = "area search",
            e.append(t),
            Ae(t, "Search for movies & shows...")
        }(),
        q("Home") && Me("Continue") && async function() {
            const t = window.innerWidth > e.area.split.max
              , n = "Continue"
              , a = document.querySelector(".section.home");
            if (!a)
                return console.error("Failed to find home section.");
            const c = document.createElement("div");
            c.className = "area inactive",
            a.append(c);
            let o = [];
            async function i() {
                const a = Se();
                (0 === o.length && a.length > 0 || JSON.stringify(a) !== JSON.stringify(o)) && (o = a,
                await async function() {
                    qe(c, null, n),
                    o && 0 !== o.length ? (await p(o.map((e=>e.image)), e.area.split[t ? "desktop" : "mobile"]),
                    qe(c, o, n),
                    c.classList.remove("inactive")) : c.classList.add("inactive")
                }())
            }
            await i(),
            setInterval(i, 500)
        }(),
        Me("Carousel") ? (q("Movies") && async function() {
            const t = document.querySelector(".section.movies");
            if (!t)
                return console.error("Failed to find movie section.");
            const n = document.createElement("div");
            n.className = "carousel",
            t.append(n),
            Ue(n, null);
            let a = await ke("movie");
            a && (a.splice(e.carousel.amount, a.length),
            p(a.map((e=>e.backdrop)), null, !0),
            Ue(n, a))
        }(),
        q("Shows") && async function() {
            const t = document.querySelector(".section.shows");
            if (!t)
                return console.error("Failed to find show section.");
            const n = document.createElement("div");
            n.className = "carousel",
            t.append(n),
            Ue(n, null);
            let a = await ke("tv");
            a && (a.splice(e.carousel.amount, a.length),
            p(a.map((e=>e.backdrop)), null, !0),
            Ue(n, a))
        }()) : Z.classList.add("no-carousel"),
        Me("Genres") && async function() {
            const t = [];
            q("Movies") && t.push(async function() {
                const e = "movie"
                  , t = document.querySelector(".section.movies");
                if (!t)
                    return console.error("Failed to find movies section.");
                const n = document.createElement("div");
                n.className = "area genres",
                t.append(n),
                De(n, null, e),
                G = await Pe("movie"),
                G ? De(n, G, e) : De(n, null, e, !0)
            }()),
            q("Shows") && t.push(async function() {
                const e = "tv"
                  , t = document.querySelector(".section.shows");
                if (!t)
                    return console.error("Failed to find shows section.");
                const n = document.createElement("div");
                n.className = "area genres",
                t.append(n),
                De(n, null, e),
                z = await Pe("tv"),
                z ? De(n, z, e) : De(n, null, e, !0)
            }()),
            await Promise.all(t),
            function() {
                function t() {
                    const t = k(e.query.modal);
                    if (t) {
                        const [n,a,c] = t.split("-");
                        if ("g" === n) {
                            ie(!0);
                            const t = "m" === a ? (G || []).find((e=>e.id?.toString() === c)) : (z || []).find((e=>e.id?.toString() === c));
                            t ? (async function(t, n) {
                                const a = window.innerWidth > e.area.split.max
                                  , c = document.createElement("div")
                                  , o = document.createElement("div")
                                  , i = document.createElement("div");
                                c.className = "area",
                                o.className = "area",
                                i.className = "area";
                                const s = [];
                                ce(t.name, null, [c, o, i], "arrow-left", !0),
                                oe((function() {
                                    f(s, !0)
                                }
                                )),
                                async function() {
                                    const o = "Popular";
                                    qe(c, null, o);
                                    let i = await ke(n, t.id);
                                    if (i) {
                                        i.splice(e.area.amount, i.length);
                                        const t = u(i.map((e=>e.image)));
                                        s.push(...t),
                                        await p(t, e.area.split[a ? "desktop" : "mobile"], !0),
                                        qe(c, i, o)
                                    } else
                                        qe(c, null, o, !0)
                                }(),
                                async function() {
                                    const c = "Top-Rated";
                                    qe(o, null, c);
                                    let i = await $e(n, t.id);
                                    if (i) {
                                        i.splice(e.area.amount, i.length);
                                        const t = u(i.map((e=>e.image)));
                                        s.push(...t),
                                        await p(t, e.area.split[a ? "desktop" : "mobile"], !0),
                                        qe(o, i, c)
                                    } else
                                        qe(o, null, c, !0)
                                }(),
                                async function() {
                                    const c = "New";
                                    qe(i, null, c);
                                    let o = await Te(n, t.id);
                                    if (o) {
                                        o.splice(e.area.amount, o.length);
                                        const t = u(o.map((e=>e.image)));
                                        s.push(...t),
                                        await p(t, e.area.split[a ? "desktop" : "mobile"], !0),
                                        qe(i, o, c)
                                    } else
                                        qe(i, null, c, !0)
                                }()
                            }(t, "m" === a ? "movie" : "tv"),
                            document.title = `${"m" === a ? "Movies" : "Shows"} - ${t.name}`) : S(e.query.modal)
                        }
                    }
                }
                t(),
                T(t)
            }()
        }(),
        function() {
            const t = window.innerWidth > e.area.split.max
              , n = q("Movies")
              , a = q("Shows")
              , c = Me("Trending")
              , o = Me("Top-Rated")
              , i = Me("New");
            c && function() {
                const c = "Trending";
                n && async function() {
                    const n = document.querySelector(".section.movies");
                    if (!n)
                        return console.error("Failed to find movies section.");
                    const a = document.createElement("div");
                    a.className = "area",
                    n.append(a),
                    qe(a, null, c);
                    let o = await ke("movie");
                    o ? (o.splice(0, e.carousel.amount),
                    o.splice(e.area.amount, o.length),
                    await p(o.map((e=>e.image)), e.area.split[t ? "desktop" : "mobile"], !0),
                    qe(a, o, c)) : qe(a, null, c, !0)
                }(),
                a && async function() {
                    const n = document.querySelector(".section.shows");
                    if (!n)
                        return console.error("Failed to find shows section.");
                    const a = document.createElement("div");
                    a.className = "area",
                    n.append(a),
                    qe(a, null, c);
                    let o = await ke("tv");
                    o ? (o.splice(0, e.carousel.amount),
                    o.splice(e.area.amount, o.length),
                    await p(o.map((e=>e.image)), e.area.split[t ? "desktop" : "mobile"], !0),
                    qe(a, o, c)) : qe(a, null, c, !0)
                }()
            }(),
            o && function() {
                const c = "Top-Rated";
                n && async function() {
                    const n = document.querySelector(".section.movies");
                    if (!n)
                        return console.error("Failed to find movies section.");
                    const a = document.createElement("div");
                    a.className = "area",
                    n.append(a),
                    qe(a, null, c);
                    let o = await $e("movie");
                    o ? (o.splice(e.area.amount, o.length),
                    await p(o.map((e=>e.image)), e.area.split[t ? "desktop" : "mobile"], !0),
                    qe(a, o, c)) : qe(a, null, c, !0)
                }(),
                a && async function() {
                    const n = document.querySelector(".section.shows");
                    if (!n)
                        return console.error("Failed to find shows section.");
                    const a = document.createElement("div");
                    a.className = "area",
                    n.append(a),
                    qe(a, null, c);
                    let o = await $e("tv");
                    o ? (o.splice(e.area.amount, o.length),
                    await p(o.map((e=>e.image)), e.area.split[t ? "desktop" : "mobile"], !0),
                    qe(a, o, c)) : qe(a, null, c, !0)
                }()
            }(),
            i && function() {
                const c = "New";
                n && async function() {
                    const n = document.querySelector(".section.movies");
                    if (!n)
                        return console.error("Failed to find movies section.");
                    const a = document.createElement("div");
                    a.className = "area",
                    n.append(a),
                    qe(a, null, c);
                    let o = await Te("movie");
                    o ? (o.splice(e.area.amount, o.length),
                    await p(o.map((e=>e.image)), e.area.split[t ? "desktop" : "mobile"], !0),
                    qe(a, o, c)) : qe(a, null, c, !0)
                }(),
                a && async function() {
                    const n = document.querySelector(".section.shows");
                    if (!n)
                        return console.error("Failed to find shows section.");
                    const a = document.createElement("div");
                    a.className = "area",
                    n.append(a),
                    qe(a, null, c);
                    let o = await Te("tv");
                    o ? (o.splice(e.area.amount, o.length),
                    await p(o.map((e=>e.image)), e.area.split[t ? "desktop" : "mobile"], !0),
                    qe(a, o, c)) : qe(a, null, c, !0)
                }()
            }()
        }(),
        function() {
            const t = document.querySelector(".section.settings");
            if (!t)
                return console.error("Failed to find section.");
            const c = document.createElement("div")
              , o = document.createElement("i")
              , i = document.createElement("span")
              , l = document.createElement("div")
              , d = document.createElement("div")
              , m = document.createElement("i")
              , p = document.createElement("span")
              , u = document.createElement("div")
              , f = document.createElement("div")
              , v = document.createElement("i")
              , h = document.createElement("span")
              , E = document.createElement("div")
              , g = document.createElement("div")
              , N = document.createElement("i")
              , w = document.createElement("span")
              , y = document.createElement("div")
              , b = document.createElement("div")
              , x = document.createElement("i")
              , L = document.createElement("span")
              , S = document.createElement("div")
              , k = document.createElement("div")
              , $ = document.createElement("i")
              , T = document.createElement("span")
              , _ = document.createElement("div")
              , I = document.createElement("div")
              , M = document.createElement("i")
              , F = document.createElement("span")
              , U = document.createElement("div")
              , A = document.createElement("div")
              , P = document.createElement("i")
              , D = document.createElement("span")
              , R = document.createElement("div")
              , H = document.createElement("i")
              , W = document.createElement("span")
              , j = document.createElement("div")
              , J = document.createElement("i")
              , V = document.createElement("span")
              , Y = document.createElement("div")
              , G = document.createElement("i")
              , z = document.createElement("span");
            function B() {
                const e = s();
                Array.from(l.children).forEach((function(t) {
                    t.classList[e === t.innerText.toLowerCase() ? "add" : "remove"]("active")
                }
                ))
            }
            function K() {
                const e = "true" === re() ? "show" : "hide";
                Array.from(u.children).forEach((function(t) {
                    t.classList[e === t.innerText.toLowerCase() ? "add" : "remove"]("active")
                }
                ))
            }
            function Z() {
                Array.from(y.children).forEach((function(e) {
                    e.classList[q(e.innerText) ? "add" : "remove"]("active")
                }
                ))
            }
            function Q() {
                Array.from(S.children).forEach((function(e) {
                    e.classList[Me(e.innerText) ? "add" : "remove"]("active")
                }
                ))
            }
            function X() {
                Array.from(_.children).forEach((function(e) {
                    e.classList[ve(e.innerText) ? "add" : "remove"]("active")
                }
                ))
            }
            c.className = "label",
            o.className = "icon icon-paint-brush",
            i.className = "text",
            i.innerText = "Theme",
            l.className = "selection",
            c.append(o),
            c.append(i),
            Object.values(a).forEach((function(e) {
                const t = document.createElement("div");
                t.innerText = e,
                t.addEventListener("click", (function() {
                    r(e.toLowerCase()),
                    B()
                }
                )),
                l.append(t)
            }
            )),
            B(),
            d.className = "label",
            m.className = "icon icon-censor",
            p.className = "text",
            p.innerText = "Adult Content",
            u.className = "selection",
            d.append(m),
            d.append(p),
            ["Hide", "Show"].forEach((function(e) {
                const t = document.createElement("div");
                t.innerText = e,
                t.addEventListener("click", (function() {
                    le(("Show" === e).toString()),
                    K()
                }
                )),
                u.append(t)
            }
            )),
            K(),
            f.className = "label",
            v.className = "icon icon-list",
            h.className = "text",
            h.innerText = "Presets",
            E.className = "selection",
            f.append(v),
            f.append(h),
            ["Full", "Minimal"].forEach((function(t) {
                const n = document.createElement("div");
                n.innerText = t,
                n.addEventListener("click", (function() {
                    "Full" === t ? (Object.keys(C()).forEach((function(e) {
                        O(e, !0)
                    }
                    )),
                    Object.keys(Ie()).forEach((function(e) {
                        Ce(e, !0)
                    }
                    )),
                    Object.keys(fe()).forEach((function(e) {
                        he(e, !0)
                    }
                    ))) : "Minimal" === t && (Object.keys(C()).forEach((function(e) {
                        O(e, !!["Home"].includes(e))
                    }
                    )),
                    Object.keys(Ie()).forEach((function(e) {
                        Ce(e, !!["Search", "Continue", "Carousel", "Genres"].includes(e))
                    }
                    )),
                    Object.keys(fe()).forEach((function(e) {
                        he(e, !!["Video", "Providers", "Seasons"].includes(e))
                    }
                    ))),
                    Z(),
                    Q(),
                    X(),
                    window.location.href = `${window.location.origin}${window.location.pathname}?${e.query.page}=${"Full" === t ? 4 : 2}`
                }
                )),
                E.append(n)
            }
            )),
            b.className = "label",
            x.className = "icon icon-tags",
            L.className = "text",
            L.innerText = "Sections (requires refresh)",
            S.className = "selection multi",
            b.append(x),
            b.append(L),
            Object.keys(Ie()).forEach((function(e) {
                const t = document.createElement("div");
                t.innerText = e,
                t.addEventListener("click", (function() {
                    Ce(e, !Me(e)),
                    Q()
                }
                )),
                S.append(t)
            }
            )),
            Q(),
            k.className = "label",
            $.className = "icon icon-play",
            T.className = "text",
            T.innerText = "Watch Sections (requires refresh)",
            _.className = "selection multi",
            k.append($),
            k.append(T),
            Object.keys(fe()).forEach((function(e) {
                const t = document.createElement("div");
                t.innerText = e,
                t.addEventListener("click", (function() {
                    he(e, !ve(e)),
                    X()
                }
                )),
                _.append(t)
            }
            )),
            X(),
            I.className = "label",
            M.className = "icon icon-box",
            F.className = "text",
            F.innerText = "Data",
            U.className = "buttons",
            I.append(M),
            I.append(F),
            A.className = "button",
            P.className = "icon icon-sync",
            D.className = "text",
            D.innerText = "Clear Everything",
            A.append(P),
            A.append(D),
            U.append(A),
            A.addEventListener("click", (function() {
                localStorage.clear(),
                location.reload(!0),
                A.classList.add("inactive"),
                P.className = "icon icon-check"
            }
            )),
            R.className = "button",
            H.className = "icon icon-sync",
            W.className = "text",
            W.innerText = "Clear Cache",
            R.append(H),
            R.append(W),
            U.append(R),
            R.addEventListener("click", (function() {
                !function() {
                    const e = n.names.cache("");
                    for (const t in localStorage)
                        t.startsWith(e) && localStorage.removeItem(t)
                }(),
                location.reload(!0),
                R.classList.add("inactive"),
                H.className = "icon icon-check"
            }
            )),
            j.className = "button secondary",
            J.className = "icon icon-eye-slash",
            V.className = "text",
            V.innerText = "Clear Continue Watching",
            j.append(J),
            j.append(V),
            U.append(j),
            j.addEventListener("click", (function() {
                !function() {
                    for (const e of Se())
                        Le(e);
                    localStorage.removeItem(n.names.continue)
                }(),
                j.classList.add("inactive"),
                J.className = "icon icon-check",
                setTimeout((function() {
                    J.className = "icon icon-eye-slash",
                    j.classList.remove("inactive")
                }
                ), 2500)
            }
            )),
            Y.className = "button secondary",
            G.className = "icon icon-eye-slash",
            z.className = "text",
            z.innerText = "Clear Last Watched",
            Y.append(G),
            Y.append(z),
            U.append(Y),
            Y.addEventListener("click", (function() {
                localStorage.removeItem(n.names.lastPlayed),
                Y.classList.add("inactive"),
                G.className = "icon icon-check",
                setTimeout((function() {
                    G.className = "icon icon-eye-slash",
                    Y.classList.remove("inactive")
                }), 2500)
            }));
            const customCursorLabel = document.createElement("div");
customCursorLabel.className = "label custom-cursor-label";
customCursorLabel.style.display = "block";
const customCursorIcon = document.createElement("i");
customCursorIcon.className = "icon icon-cursor";
customCursorIcon.style.display = "inline-block";
const customCursorText = document.createElement("span");
customCursorText.className = "text";
customCursorText.innerText = "ㅤCustom Cursor";
customCursorText.style.display = "inline-block";
const customCursorSelection = document.createElement("div");
customCursorSelection.className = "selection";
customCursorSelection.style.display = "block";
customCursorSelection.style.marginTop = "15px";

customCursorLabel.append(customCursorIcon);
customCursorLabel.append(customCursorText);
customCursorLabel.append(document.createElement("br"));

const cursorOptions = ["Off", "Type 1", "Type 2", "Type 3", "Type 4", "Type 5"];
cursorOptions.forEach((option, index) => {
    const optionDiv = document.createElement("div");
    optionDiv.innerText = option;
    optionDiv.style.display = "inline-block";
    optionDiv.style.marginRight = "10px";
    optionDiv.style.cursor = "pointer";
    optionDiv.addEventListener("click", () => {
        localStorage.setItem("selectedCursor", index);
        location.reload();
    });
    customCursorSelection.append(optionDiv);
});

// Add a color picker beside "Type 5"
const colorPickerDiv = document.createElement("div");
colorPickerDiv.style.display = "inline-block";
colorPickerDiv.style.marginLeft = "10px";
colorPickerDiv.style.cursor = "pointer";

// Create the input for the color picker
const colorPickerInput = document.createElement("input");
colorPickerInput.type = "color";
colorPickerInput.style.cursor = "pointer";
colorPickerInput.title = "Choose cursor color";

// Retrieve the saved color from localStorage
const savedColor = localStorage.getItem("selectedColor");
if (savedColor) {
    colorPickerInput.value = savedColor; // Set the saved color as the current value
}

// Save the selected color to localStorage on change and reload the page
colorPickerInput.addEventListener("change", (event) => {
    const selectedColor = event.target.value;
    localStorage.setItem("selectedColor", selectedColor);
    console.log(`Selected color: ${selectedColor}`);
    location.reload(); // Reload the page after the user finalizes their selection
});

colorPickerDiv.append(colorPickerInput);
customCursorSelection.append(colorPickerDiv);

customCursorLabel.append(customCursorSelection);

// Append the custom cursor label to the body or any container
document.body.append(customCursorLabel);


            const widgetSettingLabel = document.createElement("div");
    widgetSettingLabel.className = "label widget-setting-label";
    widgetSettingLabel.style.display = "block";

    const widgetSettingIcon = document.createElement("i");
    widgetSettingIcon.className = "icon icon-widget";
    widgetSettingIcon.style.display = "inline-block";

    const widgetSettingText = document.createElement("span");
    widgetSettingText.className = "text";
    widgetSettingText.innerText = "ㅤScreenShare Widget (Not for Mobile)";
    widgetSettingText.style.display = "inline-block";

    const widgetSettingSelection = document.createElement("div");
    widgetSettingSelection.className = "selection";
    widgetSettingSelection.style.display = "block";
    widgetSettingSelection.style.marginTop = "15px";

    widgetSettingLabel.append(widgetSettingIcon, widgetSettingText, document.createElement("br"));

    const widgetOptions = ["Off", "On"];
    widgetOptions.forEach((option, index) => {
        const optionDiv = document.createElement("div");
        optionDiv.innerText = option;
        optionDiv.style.display = "inline-block";
        optionDiv.style.marginRight = "10px";

        if (localStorage.getItem("widgetSetting") === String(index)) {
            optionDiv.classList.add("selected");
        }

        optionDiv.addEventListener("click", () => {
            localStorage.setItem("widgetSetting", index);

            if (index === 1) {
                // Turn off AI Widget Setting if turning on Widget Setting
                localStorage.setItem("aiWidgetSetting", 0);
            }
            location.reload();
        });

        widgetSettingSelection.append(optionDiv);
    });

    widgetSettingLabel.append(widgetSettingSelection);

    const aiWidgetSettingLabel = document.createElement("div");
    aiWidgetSettingLabel.className = "label ai-widget-setting-label";
    aiWidgetSettingLabel.style.display = "block";

    const aiWidgetSettingIcon = document.createElement("i");
    aiWidgetSettingIcon.className = "icon icon-ai";
    aiWidgetSettingIcon.style.display = "inline-block";

    const aiWidgetSettingText = document.createElement("span");
    aiWidgetSettingText.className = "text";

    const aiWidgetSettingState = localStorage.getItem("aiWidgetSetting");
    aiWidgetSettingText.innerText = aiWidgetSettingState === "0" ? "ㅤAI Chat Widget" : "ㅤAI Chat Widget";
    aiWidgetSettingText.style.display = "inline-block";

    const aiWidgetSettingSelection = document.createElement("div");
    aiWidgetSettingSelection.className = "selection";
    aiWidgetSettingSelection.style.display = "block";
    aiWidgetSettingSelection.style.marginTop = "15px";

    const aiWidgetOptions = ["Off", "On"];
    aiWidgetOptions.forEach((option, index) => {
        const optionDiv = document.createElement("div");
        optionDiv.innerText = option;
        optionDiv.style.display = "inline-block";
        optionDiv.style.marginRight = "10px";

        if (aiWidgetSettingState === String(index)) {
            optionDiv.classList.add("selected");
        }

        optionDiv.addEventListener("click", () => {
            localStorage.setItem("aiWidgetSetting", index);

            if (index === 1) {
                // Turn off Widget Setting if turning on AI Widget Setting
                localStorage.setItem("widgetSetting", 0);
            }
            location.reload();
        });

        aiWidgetSettingSelection.append(optionDiv);
        aiWidgetSettingLabel.append(aiWidgetSettingIcon, aiWidgetSettingText, document.createElement("br"), aiWidgetSettingSelection);
    });

    const AutoNextLabel = document.createElement("div");
            AutoNextLabel.className = "label autonext-setting-label";
            AutoNextLabel.style.display = "block";
            const AutoNextIcon = document.createElement("i");
            AutoNextIcon.className = "icon icon-autonext";
            AutoNextIcon.style.display = "inline-block";
            const AutoNextText = document.createElement("span");
            AutoNextText.className = "text";
            AutoNextText.innerText = "ㅤAutoNext (SOON)";
            AutoNextText.style.display = "inline-block";
            const AutoNextSelection = document.createElement("div");
            AutoNextSelection.className = "selection";
            AutoNextSelection.style.display = "block";
            AutoNextSelection.style.marginTop = "15px";

            AutoNextLabel.append(AutoNextIcon);
            AutoNextLabel.append(AutoNextText);
            AutoNextLabel.append(document.createElement("br"));

            const AutoNextOptions = ["Off", "On"];
            AutoNextOptions.forEach((option, index) => {
                const optionDiv = document.createElement("div");
                optionDiv.innerText = option;
                optionDiv.style.display = "inline-block";
                optionDiv.style.marginRight = "10px";
                optionDiv.addEventListener("click", () => {
                    localStorage.setItem("RgShows-AutoNext", index);
                    location.reload();
                });
                AutoNextSelection.append(optionDiv);
            });

            AutoNextLabel.append(AutoNextSelection);


            t.append(c);
            t.append(l);
            t.append(d);
            t.append(u);
            t.append(f);
            t.append(E);
            t.append(g);
            t.append(y);
            t.append(b);
            t.append(S);
            t.append(k);
            t.append(_);
            t.append(customCursorLabel); // Append custom cursor label first
            t.append(widgetSettingLabel); // Append widget setting label after custom cursor label
            t.append(aiWidgetSettingLabel); // Append widget setting label after custom cursor label
            t.append(AutoNextLabel);
            t.append(I);
            t.append(U);

            const storedCursor = localStorage.getItem("selectedCursor");
            const selectedColor = localStorage.getItem("selectedColor") || "#000000"; // Default to black if no color is stored

            if (storedCursor !== null) {
                new kursor({ type: parseInt(storedCursor), color: selectedColor }); // Use selectedColor directly
                Array.from(customCursorSelection.children).forEach((child, index) => {
                    if (index === parseInt(storedCursor)) {
                        child.classList.add("active");
                    } else {
                        child.classList.remove("active"); // Ensure only one is active
                    }
                });
            } else {
                new kursor({ type: 1, color: selectedColor }); // Default type is 1
                customCursorSelection.children[1]?.classList.add("active"); // Safely add class to the second child
                localStorage.setItem("selectedCursor", 1);
            }

            const storedAutoNext = localStorage.getItem("RgShows-AutoNext");
            if (storedAutoNext !== null) {
                Array.from(AutoNextSelection.children).forEach((child, index) => {
                    if (index === parseInt(storedAutoNext)) {
                        child.classList.add("active");
                    }
                });
            } else {
                const defaultSetting = 1;
                AutoNextSelection.children[defaultSetting].classList.add("active");
                localStorage.setItem("RgShows-AutoNext", defaultSetting);
            }

            document.addEventListener('DOMContentLoaded', () => {
    let widgetSetting = parseInt(localStorage.getItem("widgetSetting"));
    let aiWidgetSetting = parseInt(localStorage.getItem("aiWidgetSetting"));

    // Initialize settings with default values if not set
    if (isNaN(widgetSetting)) {
        widgetSetting = 0;
        localStorage.setItem("widgetSetting", widgetSetting);
    }

    if (isNaN(aiWidgetSetting)) {
        aiWidgetSetting = 1;
        localStorage.setItem("aiWidgetSetting", aiWidgetSetting);
    }

    // Ensure widgetSetting and aiWidgetSetting cannot both be 1 at the same time
    if (widgetSetting === 1 && aiWidgetSetting === 1) {
        aiWidgetSetting = 0; // Reset aiWidgetSetting if both are 1
        localStorage.setItem("aiWidgetSetting", aiWidgetSetting);
    }

    // Set active class based on current settings for widget setting
    Array.from(widgetSettingSelection.children).forEach((child, index) => {
        if (index === widgetSetting) {
            child.classList.add("active");
        }
    });

    // Set active class based on current settings for AI widget setting
    Array.from(aiWidgetSettingSelection.children).forEach((child, index) => {
        if (index === aiWidgetSetting) {
            child.classList.add("active");
        }
    });

    // Function to change widgetSetting and handle mutual exclusivity
    function changeWidgetSetting(newSetting) {
        if (newSetting === 1 && aiWidgetSetting === 1) {
            aiWidgetSetting = 0;
            localStorage.setItem("aiWidgetSetting", aiWidgetSetting);
        }
        localStorage.setItem("widgetSetting", newSetting);
        location.reload(); // Reload to apply changes
    }

    // Function to change aiWidgetSetting and handle mutual exclusivity
    function changeAIWidgetSetting(newSetting) {
        if (newSetting === 1 && widgetSetting === 1) {
            widgetSetting = 0;
            localStorage.setItem("widgetSetting", widgetSetting);
        }
        localStorage.setItem("aiWidgetSetting", newSetting);
        location.reload(); // Reload to apply changes
    }

    // Example event listeners for changing settings
    document.getElementById('changeWidgetSetting').addEventListener('click', () => {
        const newWidgetSetting = widgetSetting === 1 ? 0 : 1;
        changeWidgetSetting(newWidgetSetting);
    });

    document.getElementById('changeAIWidgetSetting').addEventListener('click', () => {
        const newAIWidgetSetting = aiWidgetSetting === 1 ? 0 : 1;
        changeAIWidgetSetting(newAIWidgetSetting);
    });
});
        }(),
        document.body.classList.add("active")
    }
    )();

    
    
    document.addEventListener("DOMContentLoaded", function() {
    function updateContent() {
        const urlParams = new URLSearchParams(window.location.search);
        const pageParam = urlParams.get('p');

        if (pageParam === '4') {
            window.location.href = './anime/';
        } else if (pageParam == '5') {
            window.location.href = './games/';
        }
    }

    updateContent();  // Call the function once when the page loads


    // Listen for popstate event (back/forward navigation)
    window.addEventListener('popstate', updateContent);

    // Override history.pushState and history.replaceState
    const originalPushState = history.pushState;
    const originalReplaceState = history.replaceState;

    history.pushState = function(...args) {
        originalPushState.apply(this, args);
        updateContent();
    };

    history.replaceState = function(...args) {
        originalReplaceState.apply(this, args);
        updateContent();
    };

    // Optionally, listen for changes to the URL hash
    window.addEventListener('hashchange', updateContent);
});

    document.addEventListener("DOMContentLoaded", function() {
    // Function to safely remove the target attribute
    function removeTargetAttribute(link) {
        if (link && link.hasAttribute('target')) {
            // Use setTimeout to delay the attribute removal slightly
            setTimeout(() => {
                link.removeAttribute('target');
            }, 0);
        }
    }

    const footerLiveTvLink = document.querySelector('.footer-container .footer .links a[href="/livetv/"]');
    const footerGuideLink = document.querySelector('.footer-container .footer .links a[href="guide.html"]');
    const footerAnnouncementsLink = document.querySelector('.footer-container .footer .links a[href="announcements.html"]');
    const footerIssuesLink = document.querySelector('.footer-container .footer .links a[href="issues.html"]');
    const footerTorrentLink = document.querySelector('.footer-container .footer .links a[href="/torrent/"]');
    // Remove the target attribute safely
    removeTargetAttribute(footerLiveTvLink);
    removeTargetAttribute(footerGuideLink);
    removeTargetAttribute(footerAnnouncementsLink);
    removeTargetAttribute(footerIssuesLink);
    removeTargetAttribute(footerTorrentLink);
});
</script>
<!--
<script>
        document.addEventListener('DOMContentLoaded', function () {
        // Start with the guide popup
        if (!localStorage.getItem('guidePopupShown')) {
            document.getElementById('guide-popup').style.display = 'flex';

            document.getElementById('guide-popup-button').addEventListener('click', function () {
                localStorage.setItem('guidePopupShown', 'true');
                document.getElementById('guide-popup').style.display = 'none';
                showSharingPopup(); // Show sharing popup after guide popup
            });
        } else {
            showSharingPopup();
        }
    });
</script>
-->
<script>
    document.addEventListener('DOMContentLoaded', function () {
        // Check if the sharing popup has been shown
        if (!localStorage.getItem('sharingPopupShown')) {
            showSharingPopup();
        }
    });

    function showSharingPopup() {
        const eventPopup = document.getElementById('event-popup');

        // Show the sharing popup
        eventPopup.style.display = 'flex';

        document.getElementById('event-popup-button').addEventListener('click', function () {
            // Mark the sharing popup as shown
            localStorage.setItem('sharingPopupShown', 'true');
            eventPopup.style.display = 'none';
        });
    }
</script>
<script>
    // Define a unique key to track if the 'rg-provider' key has already been cleared
    const clearKey = 'rg-provider-cleared-v8';
  
    // Check if the 'rg-provider-cleared' key exists
    if (!localStorage.getItem(clearKey)) {
      // If it doesn't exist, clear the 'rg-provider' key in localStorage
      localStorage.removeItem('rg-provider');
      localStorage.removeItem('rg-pages');
      
      // Set the 'rg-provider-cleared' key to mark that this action has been performed
      localStorage.setItem(clearKey, 'true');
    }
</script>  
<script>
    // Check if it's the user's first time visiting the page
if (!localStorage.getItem('themeSet')) {
  // Set the theme to dark
  document.documentElement.setAttribute('rg-theme', 'dark');

  // Mark that the theme has been set
  localStorage.setItem('themeSet', 'true');
}
</script>
<script>
    window.addEventListener('message', (event) => {
      if (event.origin !== 'https://vidlink.pro') {
        return;
      }

      if (event.data && event.data.type === 'MEDIA_DATA') {
        // Get the media data from the message
        const mediaData = event.data.data;

        // Save the media data to localStorage
        localStorage.setItem('vidLinkProgress', JSON.stringify(mediaData));
      }
    });
</script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-MRLWZB0FWK"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-MRLWZB0FWK');
</script>
<script>
/*
const myPopup = new Popup({
    id: "resetdata",
    title: "Error Notice",
    content: `
        I am so Sorry to you Users for the movie unplayable error, i know some people would be getting a error
        that they are not able to play the movie, this bcz the new servers are obstructing the previous srv user used that are stored in localstorage but not present in site
        so in SHORT YOU ARE REQUIRED TO CLEAR SITE DATA, FROM SETTINGS OF RGSHOWS CLICK ON CLEAR EVERYTHING PLEASE :).`,
    showImmediately: true
});
const myPopup = new Popup({
    id: "HappyNewYear",
    title: "Happy New Year 🎉",
    content: `
    Ladies 😘 and Gentleman 💪
    We have now proceeded into 2025! 🌟
    New year, new dreams, new adventures. Let’s make it amazing! 🚀
    Cheers to a bright and successful year ahead! 🥂
    `,
    showImmediately: true,
    showOnce: true,
});
const myPopup = new Popup({
    id: "AiChatUpdate",
    title: "Updates",
    content: `
    RgShows User 💗, i added Ai chat widget, enable it from settings :)
    `,
    showImmediately: true,
    showOnce: true,
});
*/
</script>
</body></html>
