/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/@kv8n2oryk/tizenfilm@1.4.0/dist/userScript.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
const initUI=()=>{const t=document.createElement("style");t.textContent="\n    .rophim-ui {\n      position: fixed;\n      top: 10px;\n      right: 10px;\n      background: rgba(0,0,0,0.8);\n      color: white;\n      padding: 10px;\n      border-radius: 5px;\n      z-index: 9999;\n    }\n    .rophim-ui button {\n      margin: 5px;\n      padding: 5px 10px;\n      background: #007bff;\n      color: white;\n      border: none;\n      border-radius: 3px;\n      cursor: pointer;\n    }\n  ",document.head.appendChild(t);const e=document.createElement("div");e.className="rophim-ui",e.innerHTML='\n    <h3>Rophim Module</h3>\n    <button id="fullscreen">Fullscreen</button>\n    <button id="load-movies">Load Movies</button>\n  ',document.body.appendChild(e),document.getElementById("fullscreen").addEventListener("click",(()=>{document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()}));const n=document.getElementById("load-movies");n&&n.addEventListener("click",(()=>{window.rophimContentLoader?window.rophimContentLoader.loadContent():alert("Content loader not available. Please refresh the page.")}))};class ContentLoader{constructor(){this.baseUrl="https://www.rophim.me",this.apiEndpoints={movies:"/api/movies",search:"/api/search",details:"/api/movie/"},this.corsProxy="https://cors-anywhere.herokuapp.com/",this.isLoading=!1}init(){this.waitForPageLoad().then((()=>{this.injectContentLoader(),this.setupEventListeners()}))}waitForPageLoad(){return new Promise((t=>{"complete"===document.readyState?t():window.addEventListener("load",t)}))}injectContentLoader(){const t=document.createElement("div");t.id="rophim-content-loader",t.innerHTML='\n      <div style="\n        position: fixed;\n        top: 50px;\n        right: 10px;\n        background: rgba(0,0,0,0.9);\n        color: white;\n        padding: 15px;\n        border-radius: 8px;\n        z-index: 9998;\n        max-width: 300px;\n        font-size: 14px;\n      ">\n        <div id="loader-status">Initializing...</div>\n        <button id="refresh-content" style="\n          margin-top: 10px;\n          padding: 5px 10px;\n          background: #007bff;\n          color: white;\n          border: none;\n          border-radius: 3px;\n          cursor: pointer;\n        ">Refresh Content</button>\n      </div>\n    ',document.body.appendChild(t)}setupEventListeners(){const t=document.getElementById("refresh-content");t&&t.addEventListener("click",(()=>this.loadContent())),setTimeout((()=>{this.loadContent()}),2e3)}async loadContent(){if(!this.isLoading){this.isLoading=!0,this.updateStatus("Loading content...");try{const t=await this.tryLoadContent();t?(this.injectContent(t),this.updateStatus("Content loaded successfully!")):this.updateStatus("Failed to load content")}catch(t){console.error("Content loading error:",t),this.updateStatus("Error: "+t.message)}finally{this.isLoading=!1}}}async tryLoadContent(){try{const t=await this.loadFromAPI();if(t)return t}catch(t){console.log("Direct API failed, trying alternative methods")}try{const t=await this.scrapePageContent();if(t)return t}catch(t){console.log("Page scraping failed")}try{const t=await this.loadViaCORSProxy();if(t)return t}catch(t){console.log("CORS proxy failed")}return null}async loadFromAPI(){const t=await fetch(`${this.baseUrl}${this.apiEndpoints.movies}`,{method:"GET",headers:{Accept:"application/json","Content-Type":"application/json"}});if(!t.ok)throw new Error(`API request failed: ${t.status}`);const e=await t.json();return this.formatAPIContent(e)}async scrapePageContent(){const t=document.querySelectorAll(".movie-item, .film-item, .video-item, [data-movie], [data-film]"),e=[];return t.forEach((t=>{const n=t.querySelector(".title, .name, h3, h4")?.textContent?.trim(),o=t.querySelector("img")?.src,i=t.querySelector("a")?.href;n&&(o||i)&&e.push({title:n,image:o,link:i,source:"page-scrape"})})),e.length>0?{movies:e,source:"page-scrape"}:null}async loadViaCORSProxy(){const t=`${this.corsProxy}${this.baseUrl}`,e=await fetch(t);if(!e.ok)throw new Error("CORS proxy request failed");const n=await e.text();return this.parseHTMLContent(n)}parseHTMLContent(t){const e=(new DOMParser).parseFromString(t,"text/html"),n=[];return e.querySelectorAll(".movie-item, .film-item, .video-item").forEach((t=>{const e=t.querySelector(".title, .name, h3, h4")?.textContent?.trim(),o=t.querySelector("img")?.src,i=t.querySelector("a")?.href;e&&n.push({title:e,image:o?o.startsWith("http")?o:`${this.baseUrl}${o}`:null,link:i?i.startsWith("http")?i:`${this.baseUrl}${i}`:null,source:"cors-proxy"})})),n.length>0?{movies:n,source:"cors-proxy"}:null}formatAPIContent(t){return t&&Array.isArray(t)?{movies:t.map((t=>({title:t.title||t.name,image:t.image||t.poster||t.thumbnail,link:t.link||t.url||`${this.baseUrl}/movie/${t.id}`,source:"api"}))),source:"api"}:null}injectContent(t){if(!t||!t.movies)return;let e=document.getElementById("rophim-injected-content");if(!e){e=document.createElement("div"),e.id="rophim-injected-content",e.style.cssText="\n        position: fixed;\n        top: 120px;\n        right: 10px;\n        background: rgba(0,0,0,0.9);\n        color: white;\n        padding: 15px;\n        border-radius: 8px;\n        z-index: 9997;\n        max-width: 300px;\n        max-height: 400px;\n        overflow-y: auto;\n        font-size: 12px;\n      ";const t=document.createElement("button");t.textContent="×",t.style.cssText="\n        position: absolute;\n        top: 5px;\n        right: 5px;\n        background: none;\n        border: none;\n        color: white;\n        font-size: 18px;\n        cursor: pointer;\n      ",t.onclick=()=>e.remove(),e.appendChild(t),document.body.appendChild(e)}e.innerHTML='<button style="position:absolute;top:5px;right:5px;background:none;border:none;color:white;font-size:18px;cursor:pointer;">×</button>';const n=document.createElement("h4");n.textContent=`Loaded ${t.movies.length} movies (${t.source})`,n.style.margin="0 0 10px 0",e.appendChild(n),t.movies.slice(0,10).forEach((t=>{const n=document.createElement("div");n.style.cssText="\n        margin-bottom: 10px;\n        padding: 8px;\n        background: rgba(255,255,255,0.1);\n        border-radius: 4px;\n      ",n.innerHTML=`\n        <div style="font-weight: bold; margin-bottom: 5px;">${t.title}</div>\n        ${t.image?`<img src="${t.image}" style="width:100%;height:60px;object-fit:cover;border-radius:3px;margin-bottom:5px;" onerror="this.style.display='none'">`:""}\n        ${t.link?`<a href="${t.link}" target="_blank" style="color:#007bff;text-decoration:none;font-size:11px;">Watch →</a>`:""}\n      `,e.appendChild(n)}))}updateStatus(t){const e=document.getElementById("loader-status");e&&(e.textContent=t)}}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",initUI):initUI();const contentLoader=new ContentLoader;contentLoader.init(),window.rophimContentLoader=contentLoader;
//# sourceMappingURL=/sm/f5ac09089cafe95a89fd9bfb89476e93fffeeabec4f442374a276093e51ea3ed.map