rachpt / mteam-preview

// ==UserScript==
// @name         mteam-preview
// @namespace    https://rachpt.cn
// @version      2025.04.06.302
// @author       rachpt
// @description  mteam增强插件
// @license      MIT
// @icon         https://static.m-team.cc/favicon.ico
// @match        https://kp.m-team.cc/browse/*
// @match        https://kp.m-team.cc/browse
// @match        https://kp.m-team.cc/detail/*
// @connect      static.m-team.cc
// @connect      img.m-team.cc
// @connect      *
// @grant        GM_addStyle
// @grant        GM_xmlhttpRequest
// @run-at       document-start
// ==/UserScript==

(n=>{if(typeof GM_addStyle=="function"){GM_addStyle(n);return}const t=document.createElement("style");t.textContent=n,document.head.append(t)})(` #root #app-content .app-content__inner .ant-spin-nested-loading table>thead>tr>th:nth-child(2) {
  width: 560px !important;
}
#root #app-content .app-content__inner .ant-image img.ant-image-img {
  /* height: 444px !important; */
  width: 100%;
}
#root #app-content .ant-spin-container .flex-grow .inline-flex.max-w-full.items-center.pr-3.whitespace-nowrap,
#root #app-content .ant-spin-container .flex-grow .inline-flex.max-w-full.items-center.pr-3.whitespace-nowrap .ant-typography.ant-typography-ellipsis.ant-typography-ellipsis-single-line {
  flex-wrap: wrap !important;
  text-wrap: wrap !important;
}
#root #app-content .app-content__inner .mx-auto ul.ant-pagination.ant-pagination-mini {
  display: none;
}
#root #app-content tr.download-history[data-type="append"] {
  background-color: #8a2be236;
}
#root #app-content tr.download-history[data-type="append"] .download-status.hide {
  display: none;
}
#root #app-content tr.download-history[data-type="append"] .download-status {
  margin-top: 4px;
}
#root #app-content tr.download-history[data-type="append"] .down-percent {
  border-radius: 5px;
  padding: 2px 5px;
  background-color: #73e10594;
}
#root #app-content tr.download-history[data-type="append"] .down-date {
  border-radius: 5px;
  padding: 2px 5px;
  background-color: #73e10594;
}
/* rynl2q */
:where(.css-custom).ant-tag {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
    font-size: 14px;
    box-sizing: border-box;
}

:where(.css-custom).ant-tag::before,
:where(.css-custom).ant-tag::after {
    box-sizing: border-box;
}

:where(.css-custom).ant-tag [class^="ant-tag"],
:where(.css-custom).ant-tag [class*=" ant-tag"] {
    box-sizing: border-box;
}

:where(.css-custom).ant-tag [class^="ant-tag"]::before,
:where(.css-custom).ant-tag [class*=" ant-tag"]::before,
:where(.css-custom).ant-tag [class^="ant-tag"]::after,
:where(.css-custom).ant-tag [class*=" ant-tag"]::after {
    box-sizing: border-box;
}

:where(.css-custom).ant-tag {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    color: rgba(0, 0, 0, 0.88);
    font-size: 12px;
    line-height: 20px;
    list-style: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
    display: inline-block;
    height: auto;
    margin-inline-end: 8px;
    padding-inline: 7px;
    white-space: nowrap;
    background: #fafafa;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    opacity: 1;
    transition: all 0.2s;
    text-align: start;
    position: relative;
}

:where(.css-custom).ant-tag.ant-tag-rtl {
    direction: rtl;
}

:where(.css-custom).ant-tag,
:where(.css-custom).ant-tag a,
:where(.css-custom).ant-tag a:hover {
    color: rgba(0, 0, 0, 0.88);
}

:where(.css-custom).ant-tag .ant-tag-close-icon {
    margin-inline-start: 3px;
    font-size: 10px;
    color: rgba(0, 0, 0, 0.45);
    cursor: pointer;
    transition: all 0.2s;
}

:where(.css-custom).ant-tag .ant-tag-close-icon:hover {
    color: rgba(0, 0, 0, 0.88);
}

:where(.css-custom).ant-tag.ant-tag-has-color {
    border-color: transparent;
}

:where(.css-custom).ant-tag.ant-tag-has-color,
:where(.css-custom).ant-tag.ant-tag-has-color a,
:where(.css-custom).ant-tag.ant-tag-has-color a:hover,
:where(.css-custom).ant-tag.ant-tag-has-color .anticon-close,
:where(.css-custom).ant-tag.ant-tag-has-color .anticon-close:hover {
    color: #fff;
}

:where(.css-custom).ant-tag-checkable {
    background-color: transparent;
    border-color: transparent;
    cursor: pointer;
}

:where(.css-custom).ant-tag-checkable:not(.ant-tag-checkable-checked):hover {
    color: #2f4879;
    background-color: rgba(0, 0, 0, 0.06);
}

:where(.css-custom).ant-tag-checkable:active,
:where(.css-custom).ant-tag-checkable-checked {
    color: #fff;
}

:where(.css-custom).ant-tag-checkable-checked {
    background-color: #2f4879;
}

:where(.css-custom).ant-tag-checkable-checked:hover {
    background-color: #495f85;
}

:where(.css-custom).ant-tag-checkable:active {
    background-color: #1c2c52;
}

:where(.css-custom).ant-tag-hidden {
    display: none;
}

:where(.css-custom).ant-tag>.anticon+span,
:where(.css-custom).ant-tag>span+.anticon {
    margin-inline-start: 7px;
}

:where(.css-custom).ant-tag-borderless {
    border-color: transparent;
    background: #fafafa;
}

/* button */
:where(.css-custom).ant-btn {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
    font-size: 14px;
    box-sizing: border-box;
}

:where(.css-custom).ant-btn::before,
:where(.css-custom).ant-btn::after {
    box-sizing: border-box;
}

:where(.css-custom).ant-btn [class^="ant-btn"],
:where(.css-custom).ant-btn [class*=" ant-btn"] {
    box-sizing: border-box;
}

:where(.css-custom).ant-btn [class^="ant-btn"]::before,
:where(.css-custom).ant-btn [class*=" ant-btn"]::before,
:where(.css-custom).ant-btn [class^="ant-btn"]::after,
:where(.css-custom).ant-btn [class*=" ant-btn"]::after {
    box-sizing: border-box;
}

:where(.css-custom).ant-btn {
    outline: none;
    position: relative;
    display: inline-flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    font-weight: 400;
    white-space: nowrap;
    text-align: center;
    background-image: none;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
    user-select: none;
    touch-action: manipulation;
    color: rgba(0, 0, 0, 0.88);
}

:where(.css-custom).ant-btn:disabled>* {
    pointer-events: none;
}

:where(.css-custom).ant-btn .ant-btn-icon>svg {
    display: inline-flex;
    align-items: center;
    color: inherit;
    font-style: normal;
    line-height: 0;
    text-align: center;
    text-transform: none;
    vertical-align: -0.125em;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

:where(.css-custom).ant-btn .ant-btn-icon>svg>* {
    line-height: 1;
}

:where(.css-custom).ant-btn .ant-btn-icon>svg svg {
    display: inline-block;
}

:where(.css-custom).ant-btn>a {
    color: currentColor;
}

:where(.css-custom).ant-btn:not(:disabled):focus-visible {
    outline: 3px solid #8a929e;
    outline-offset: 1px;
    transition: outline-offset 0s, outline 0s;
}

:where(.css-custom).ant-btn.ant-btn-two-chinese-chars::first-letter {
    letter-spacing: 0.34em;
}

:where(.css-custom).ant-btn.ant-btn-two-chinese-chars>*:not(.anticon) {
    margin-inline-end: -0.34em;
    letter-spacing: 0.34em;
}

:where(.css-custom).ant-btn.ant-btn-icon-only {
    padding-inline: 0;
}

:where(.css-custom).ant-btn.ant-btn-icon-only.ant-btn-compact-item {
    flex: none;
}

:where(.css-custom).ant-btn.ant-btn-icon-only.ant-btn-round {
    width: auto;
}

:where(.css-custom).ant-btn.ant-btn-loading {
    opacity: 0.65;
    cursor: default;
}

:where(.css-custom).ant-btn .ant-btn-loading-icon {
    transition: width 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), opacity 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), margin 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
}

:where(.css-custom).ant-btn:not(.ant-btn-icon-end) .ant-btn-loading-icon-motion-appear-start,
:where(.css-custom).ant-btn:not(.ant-btn-icon-end) .ant-btn-loading-icon-motion-enter-start {
    margin-inline-end: -8px;
}

:where(.css-custom).ant-btn:not(.ant-btn-icon-end) .ant-btn-loading-icon-motion-appear-active,
:where(.css-custom).ant-btn:not(.ant-btn-icon-end) .ant-btn-loading-icon-motion-enter-active {
    margin-inline-end: 0;
}

:where(.css-custom).ant-btn:not(.ant-btn-icon-end) .ant-btn-loading-icon-motion-leave-start {
    margin-inline-end: 0;
}

:where(.css-custom).ant-btn:not(.ant-btn-icon-end) .ant-btn-loading-icon-motion-leave-active {
    margin-inline-end: -8px;
}

:where(.css-custom).ant-btn-icon-end {
    flex-direction: row-reverse;
}

:where(.css-custom).ant-btn-icon-end .ant-btn-loading-icon-motion-appear-start,
:where(.css-custom).ant-btn-icon-end .ant-btn-loading-icon-motion-enter-start {
    margin-inline-start: -8px;
}

:where(.css-custom).ant-btn-icon-end .ant-btn-loading-icon-motion-appear-active,
:where(.css-custom).ant-btn-icon-end .ant-btn-loading-icon-motion-enter-active {
    margin-inline-start: 0;
}

:where(.css-custom).ant-btn-icon-end .ant-btn-loading-icon-motion-leave-start {
    margin-inline-start: 0;
}

:where(.css-custom).ant-btn-icon-end .ant-btn-loading-icon-motion-leave-active {
    margin-inline-start: -8px;
}

:where(.css-custom).ant-btn {
    font-size: 14px;
    height: 32px;
    padding: 0px 15px;
    border-radius: 6px;
}

:where(.css-custom).ant-btn.ant-btn-icon-only {
    width: 32px;
}

:where(.css-custom).ant-btn.ant-btn-icon-only .anticon {
    font-size: inherit;
}

:where(.css-custom).ant-btn.ant-btn-circle.ant-btn {
    min-width: 32px;
    padding-inline-start: 0;
    padding-inline-end: 0;
    border-radius: 50%;
}

:where(.css-custom).ant-btn.ant-btn-round.ant-btn {
    border-radius: 32px;
    padding-inline-start: 16px;
    padding-inline-end: 16px;
}

:where(.css-custom).ant-btn-sm {
    font-size: 14px;
    height: 24px;
    padding: 0px 7px;
    border-radius: 4px;
}

:where(.css-custom).ant-btn-sm.ant-btn-icon-only {
    width: 24px;
}

:where(.css-custom).ant-btn-sm.ant-btn-icon-only .anticon {
    font-size: inherit;
}

:where(.css-custom).ant-btn.ant-btn-circle.ant-btn-sm {
    min-width: 24px;
    padding-inline-start: 0;
    padding-inline-end: 0;
    border-radius: 50%;
}

:where(.css-custom).ant-btn.ant-btn-round.ant-btn-sm {
    border-radius: 24px;
    padding-inline-start: 12px;
    padding-inline-end: 12px;
}

:where(.css-custom).ant-btn-lg {
    font-size: 16px;
    height: 40px;
    padding: 0px 15px;
    border-radius: 8px;
}

:where(.css-custom).ant-btn-lg.ant-btn-icon-only {
    width: 40px;
}

:where(.css-custom).ant-btn-lg.ant-btn-icon-only .anticon {
    font-size: inherit;
}

:where(.css-custom).ant-btn.ant-btn-circle.ant-btn-lg {
    min-width: 40px;
    padding-inline-start: 0;
    padding-inline-end: 0;
    border-radius: 50%;
}

:where(.css-custom).ant-btn.ant-btn-round.ant-btn-lg {
    border-radius: 40px;
    padding-inline-start: 20px;
    padding-inline-end: 20px;
}

:where(.css-custom).ant-btn.ant-btn-block {
    width: 100%;
}

:where(.css-custom).ant-btn-color-default {
    color: rgba(0, 0, 0, 0.88);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.02);
}

:where(.css-custom).ant-btn-color-default.ant-btn-variant-solid {
    color: #fff;
    background: rgb(0, 0, 0);
}

:where(.css-custom).ant-btn-color-default.ant-btn-variant-solid:disabled,
:where(.css-custom).ant-btn-color-default.ant-btn-variant-solid.ant-btn-disabled {
    cursor: not-allowed;
    border-color: #d9d9d9;
    color: rgba(0, 0, 0, 0.25);
    background: rgba(0, 0, 0, 0.04);
    box-shadow: none;
}

:where(.css-custom).ant-btn-color-default.ant-btn-variant-solid:not(:disabled):not(.ant-btn-disabled):hover {
    color: #fff;
    background: rgba(0, 0, 0, 0.75);
}

:where(.css-custom).ant-btn-color-default.ant-btn-variant-solid:not(:disabled):not(.ant-btn-disabled):active {
    color: #fff;
    background: rgba(0, 0, 0, 0.95);
}

:where(.css-custom).ant-btn-color-default.ant-btn-variant-dashed {
    border-style: dashed;
}

:where(.css-custom).ant-btn-color-default.ant-btn-variant-filled {
    box-shadow: none;
    background: rgba(0, 0, 0, 0.04);
}

:where(.css-custom).ant-btn-color-default.ant-btn-variant-filled:disabled,
:where(.css-custom).ant-btn-color-default.ant-btn-variant-filled.ant-btn-disabled {
    cursor: not-allowed;
    border-color: #d9d9d9;
    color: rgba(0, 0, 0, 0.25);
    background: rgba(0, 0, 0, 0.04);
    box-shadow: none;
}

:where(.css-custom).ant-btn-color-default.ant-btn-variant-filled:not(:disabled):not(.ant-btn-disabled):hover {
    background: rgba(0, 0, 0, 0.06);
}

:where(.css-custom).ant-btn-color-default.ant-btn-variant-filled:not(:disabled):not(.ant-btn-disabled):active {
    background: rgba(0, 0, 0, 0.15);
}

:where(.css-custom).ant-btn-color-default.ant-btn-background-ghost {
    color: #ffffff;
    background: transparent;
    border-color: #ffffff;
    box-shadow: none;
}

:where(.css-custom).ant-btn-color-default.ant-btn-background-ghost:not(:disabled):not(.ant-btn-disabled):hover {
    background: transparent;
}

:where(.css-custom).ant-btn-color-default.ant-btn-background-ghost:not(:disabled):not(.ant-btn-disabled):active {
    background: transparent;
}

:where(.css-custom).ant-btn-color-default.ant-btn-background-ghost:disabled {
    cursor: not-allowed;
    color: rgba(0, 0, 0, 0.25);
    border-color: #d9d9d9;
}

:where(.css-custom).ant-btn-color-default.ant-btn-variant-link {
    color: rgba(0, 0, 0, 0.88);
    box-shadow: none;
}

:where(.css-custom).ant-btn-color-default.ant-btn-variant-link:disabled,
:where(.css-custom).ant-btn-color-default.ant-btn-variant-link.ant-btn-disabled {
    cursor: not-allowed;
    color: rgba(0, 0, 0, 0.25);
}

:where(.css-custom).ant-btn-color-default.ant-btn-variant-link:not(:disabled):not(.ant-btn-disabled):hover {
    color: #69b1ff;
    background: transparent;
}

:where(.css-custom).ant-btn-color-default.ant-btn-variant-link:not(:disabled):not(.ant-btn-disabled):active {
    color: #0958d9;
}

:where(.css-custom).ant-btn-color-primary {
    color: #2f4879;
    box-shadow: 0 2px 0 rgba(7, 22, 40, 0.33);
}

:where(.css-custom).ant-btn-color-primary.ant-btn-variant-outlined,
:where(.css-custom).ant-btn-color-primary.ant-btn-variant-dashed {
    border-color: #2f4879;
    background: #ffffff;
}

:where(.css-custom).ant-btn-color-primary.ant-btn-variant-outlined:disabled,
:where(.css-custom).ant-btn-color-primary.ant-btn-variant-dashed:disabled,
:where(.css-custom).ant-btn-color-primary.ant-btn-variant-outlined.ant-btn-disabled,
:where(.css-custom).ant-btn-color-primary.ant-btn-variant-dashed.ant-btn-disabled {
    cursor: not-allowed;
    border-color: #d9d9d9;
    color: rgba(0, 0, 0, 0.25);
    background: rgba(0, 0, 0, 0.04);
    box-shadow: none;
}

:where(.css-custom).ant-btn-color-primary.ant-btn-variant-outlined:not(:disabled):not(.ant-btn-disabled):hover,
:where(.css-custom).ant-btn-color-primary.ant-btn-variant-dashed:not(:disabled):not(.ant-btn-disabled):hover {
    color: #495f85;
    border-color: #495f85;
    background: #ffffff;
}

:where(.css-custom).ant-btn-color-primary.ant-btn-variant-outlined:not(:disabled):not(.ant-btn-disabled):active,
:where(.css-custom).ant-btn-color-primary.ant-btn-variant-dashed:not(:disabled):not(.ant-btn-disabled):active {
    color: #1c2c52;
    border-color: #1c2c52;
    background: #ffffff;
}

:where(.css-custom).ant-btn-color-primary.ant-btn-variant-dashed {
    border-style: dashed;
}

:where(.css-custom).ant-btn-color-primary.ant-btn-variant-filled {
    box-shadow: none;
    background: #adb2b8;
}

:where(.css-custom).ant-btn-color-primary.ant-btn-variant-filled:disabled,
:where(.css-custom).ant-btn-color-primary.ant-btn-variant-filled.ant-btn-disabled {
    cursor: not-allowed;
    border-color: #d9d9d9;
    color: rgba(0, 0, 0, 0.25);
    background: rgba(0, 0, 0, 0.04);
    box-shadow: none;
}

:where(.css-custom).ant-btn-color-primary.ant-btn-variant-filled:not(:disabled):not(.ant-btn-disabled):hover {
    background: #a1a5ab;
}

:where(.css-custom).ant-btn-color-primary.ant-btn-variant-filled:not(:disabled):not(.ant-btn-disabled):active {
    background: #8a929e;
} `);

(function () {
  'use strict';

  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
  var Le=Object.defineProperty;var ke=(e,t,n)=>t in e?Le(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n;var C=(e,t,n)=>ke(e,typeof t!="symbol"?t+"":t,n);function qe(e){const t=Array.isArray(e)?e:[e],n=()=>{t.forEach((a,o)=>{try{a();}catch(r){console.error(`执行函数 ${a.name||`#${o+1}`} 时发生错误:`,r);}});};document.readyState==="complete"?n():window.addEventListener("load",n);}const k=e=>{const t=performance.now();return new Promise(n=>{const a=()=>{performance.now()-t>=e?n():requestAnimationFrame(a);};requestAnimationFrame(a);})};async function K(e,t=200,n=300,a=false){for(;t--;){const o=document.querySelector(e);if(!o){await k(n);continue}if(a&&o.innerText?.length===0){await k(n);continue}return o}return null}const le="css-xwzqqd";function he(){const e=document.querySelector('[class*="ant-image"][class*="css-"]');return e?.classList?.length&&Array.from(e.classList.values()).find(n=>n.startsWith("css-"))||le}async function Me(){if(!Ie())return;const e=await K('.grid .ant-image-img-placeholder[class*="css-"]',50,400);if(!e)return;await k(100);const t=he(),n=e.closest(".grid.grid-cols-7");n?.classList?.remove("grid-cols-7"),n?.classList?.add("grid-cols-4");const a=document.querySelectorAll(`.ant-image-img.ant-image-img-placeholder.${t}`);for(const o of a){const r=o;if(!r.src)continue;r.src=je(r.src);const c=r.nextElementSibling;c?.className==="ant-image-mask"&&c?.remove();}}function Ie(){const{host:e,pathname:t}=location;return e.endsWith("m-team.cc")?t.startsWith("/detail/"):false}function je(e){return e.replace(/(\d+)-(\d+)\.jpg$/,"$1jp-$2.jpg")}const Pe="mteam-preview",Be=2;var f=(e=>(e.ImageCache="image-cache",e.TorrentHistory="torrent-history",e))(f||{});function Ne(e){if(!e.objectStoreNames.contains("image-cache")){const t=e.createObjectStore("image-cache",{keyPath:"id"});t.createIndex("insertTime","insertTime",{unique:false}),t.createIndex("lastAccessTime","lastAccessTime",{unique:false});}if(!e.objectStoreNames.contains("torrent-history")){const t=e.createObjectStore("torrent-history",{keyPath:"id"});t.createIndex("dateTime","dateTime",{unique:false}),t.createIndex("updateTime","updateTime",{unique:false});}}var Fe="__monkeyWindow-"+(()=>{try{return new URL((_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('__entry.js', document.baseURI).href)).origin}catch{return location.origin}})(),fe=document[Fe]??window,Oe=fe.GM,ze=fe.GM_xmlhttpRequest;function Ve(e){var t;const n=new Headers,a=e.replace(/\r?\n[\t ]+/g," ");for(const o of a.split(/\r?\n/)){const r=o.split(":"),s=(t=r.shift())==null?void 0:t.trim();if(s){const c=r.join(":").trim();try{n.append(s,c);}catch(i){console.warn(`Response ${i.message}`);}}}return n}const Ue=async(e,t)=>{const n=ze||Oe.xmlHttpRequest;if(typeof n!="function")throw new DOMException("GM_xmlhttpRequest or GM.xmlHttpRequest is not granted.","NotFoundError");const a=new Request(e,t);if(a.signal.aborted)throw new DOMException("Network request aborted.","AbortError");const o=await a.arrayBuffer(),r=o.byteLength?new TextDecoder().decode(o):void 0,s=Object.fromEntries(a.headers);return new Headers(t?.headers).forEach((c,i)=>{s[i]=c;}),new Promise((c,i)=>{let l=false;const d=new Promise(m=>{const{abort:x}=n({method:a.method.toUpperCase(),url:a.url||location.href,headers:s,data:r,redirect:a.redirect,binary:true,nocache:a.cache==="no-store",revalidate:a.cache==="reload",timeout:3e5,responseType:n.RESPONSE_TYPE_STREAM??"blob",overrideMimeType:a.headers.get("Content-Type")??void 0,anonymous:a.credentials==="omit",onload:({response:g})=>{if(l){m(null);return}m(g);},async onreadystatechange({readyState:g,responseHeaders:w,status:p,statusText:y,finalUrl:q,response:A}){if(g===XMLHttpRequest.DONE)a.signal.removeEventListener("abort",x);else if(g!==XMLHttpRequest.HEADERS_RECEIVED)return;if(l){m(null);return}const S=Ve(w),M=a.url!==q,R=new Response(A instanceof ReadableStream?A:await d,{headers:S,status:p,statusText:y});Object.defineProperties(R,{url:{value:q},type:{value:"basic"},...R.redirected!==M?{redirected:{value:M}}:{},...S.has("set-cookie")||S.has("set-cookie2")?{headers:{value:S}}:{}}),c(R),l=true;},onerror:({statusText:g,error:w})=>{i(new TypeError(g||w||"Network request failed.")),m(null);},ontimeout(){i(new TypeError("Network request timeout.")),m(null);},onabort(){i(new DOMException("Network request aborted.","AbortError")),m(null);}});a.signal.addEventListener("abort",x);});})};let _e=(e,t)=>{console.error("Fetch Error:",e.message,t);};async function ye(e,t={},n=3){let a=0,o;for(;;)try{const r=await Ue(e,t);if(!r.ok){const{status:c,statusText:i}=r,l=`状态: ${i||c}`;throw new Xe(l)}const s=t.responseType||"auto";return s==="blob"?await r.blob():s==="text"?await r.text():r.headers.get("content-type")?.includes("application/json")?await r.json():await r.text()}catch(r){if(o||(o=r),a++,a>=n)throw _e(o||r,e),o||r;await k(200*a);}}class Xe extends Error{constructor(t){super(t),this.name="FetchError";}}const Ge=e=>e?.includes("m-team.cc/")?{Referer:"https://kp.m-team.cc/"}:void 0;let ae=0;async function We(e,t=540,n=.75){try{const a=await ye(e,{method:"GET",responseType:"blob",credentials:"include",headers:Ge(e)});return new Promise((o,r)=>{const s=new Image;s.onload=()=>{const c=document.createElement("canvas");let i=s.width,l=s.height;if(i>t){const m=t/i;i=t,l=l*m;}c.width=i,c.height=l;const d=c.getContext("2d");if(!d){r(new Error("无法获取 canvas 上下文"));return}d.drawImage(s,0,0,i,l),c.toBlob(m=>{m?o(m):r(new Error("无法创建 Blob"));},"image/webp",n);},s.onerror=()=>r(new Error("图像加载失败")),s.src=URL.createObjectURL(a);})}catch(a){throw new Error(`获取图像失败: ${a}`)}}async function Je(e,t){try{const n=await We(t),r=(await H()).transaction(f.ImageCache,"readwrite").objectStore(f.ImageCache),s={id:e,imageData:n,originalUrl:t,insertTime:Date.now(),lastAccessTime:Date.now()},c=r.put(s);return new Promise((i,l)=>{c.onsuccess=()=>{i();},c.onerror=d=>{l(new Error(`缓存图像失败: ${d}`));};})}catch(n){throw new Error(`缓存图像时出错: ${n}`)}}async function Ke(e){try{const a=(await H()).transaction(f.ImageCache,"readwrite").objectStore(f.ImageCache),o=a.get(e);return new Promise((r,s)=>{o.onsuccess=()=>{const c=o.result;if(c){c.lastAccessTime=Date.now(),a.put(c);const i=URL.createObjectURL(c.imageData);ae++,r(i);}else r(null);},o.onerror=()=>s(new Error("获取缓存图像失败"));})}catch(t){return console.error("获取缓存图像时出错:",t),null}}async function Ye(e=30){try{const o=(await H()).transaction(f.ImageCache,"readwrite").objectStore(f.ImageCache).index("lastAccessTime"),r=Date.now()-e*24*60*60*1e3,s=o.openCursor(IDBKeyRange.upperBound(r));s.onsuccess=c=>{const i=c.target.result;i&&(i.delete(),i.continue());};}catch(t){console.error("清理缓存时出错:",t);}}async function Qe(){try{const n=(await H()).transaction(f.ImageCache,"readonly").objectStore(f.ImageCache);return new Promise((a,o)=>{let r=0,s=0;const c=n.openCursor();c.onsuccess=i=>{const l=i.target.result;if(l){r++;const d=l.value;s+=d.imageData.size,l.continue();}else a({count:r,size:s});},c.onerror=()=>o(new Error("获取缓存统计信息失败"));})}catch(e){return console.error("获取缓存统计信息时出错:",e),{count:0,size:0}}}function Ze(){return ae}function et(){ae=0;}let T=null;async function H(){return T||new Promise((e,t)=>{const n=indexedDB.open(Pe,Be);n.onerror=()=>{t(new Error("无法打开数据库"));},n.onsuccess=a=>{T=a.target.result,T.onclose=()=>{T=null;},e(T);},n.onupgradeneeded=a=>{const o=a.target.result;Ne(o);};})}function tt(){const e=localStorage.getItem("lastImageCacheCleanup"),t=Date.now();(!e||t-parseInt(e)>30*24*60*60*1e3)&&Ye(60).then(()=>{localStorage.setItem("lastImageCacheCleanup",t.toString()),console.log("图像缓存清理完成");}).catch(n=>{console.error("设置缓存清理任务时出错:",n);});}async function nt(e){try{const a=(await H()).transaction(f.TorrentHistory,"readwrite").objectStore(f.TorrentHistory);return new Promise((o,r)=>{let s=0;for(const c of e){const i=a.put(c);i.onsuccess=()=>{s++,s===e.length&&o();},i.onerror=()=>r(new Error("批量保存下载历史记录失败"));}e.length===0&&o();})}catch(t){console.error("批量保存下载历史记录时出错:",t);}}async function we(e){try{const a=(await H()).transaction(f.TorrentHistory,"readonly").objectStore(f.TorrentHistory),o={},r=e.map(s=>new Promise(c=>{const i=a.get(s);i.onsuccess=()=>{i.result&&(o[s]=i.result),c();},i.onerror=()=>{console.error(`获取种子${s}的下载历史失败`),c();};}));return await Promise.all(r),o}catch(t){return console.error("批量获取下载历史记录时出错:",t),{}}}async function at(e){const t=await we(e);return e.filter(n=>!t[n])}const z=Object.freeze({secret:"HLkPcWmycL57mfJt",webversion:"1140",version:"1.1.4"}),v={secret:"",version:{}};function be(e){return e?.length?e.filter(t=>!ot(t.smallDescr)):[]}async function ve(){if(v.secret)return v.secret;const{secret:e,...t}=await xe();return v.version=t,v.secret=e,e}async function rt(){if(Object.keys(v.version).length)return v.version;const{secret:e,...t}=await xe();return v.version=t,v.secret=e,t}async function xe(){const e=st();if(!e)return z;const t=await await ye(e);if(!t)return z;const n=/version:"(?<v>[^"]+)"/,a=/secret:"(?<v>[^"]+)"/,o=n.exec(t)?.groups?.v,r=a.exec(t)?.groups?.v;if(!o||!r)return z;const s=o.split("-")[0].replace(/\./g,"")+"0";return {secret:r,version:o,webversion:s}}function ot(e){return e?["#GV","#GAY","WARNING","人妖","勿入","伪娘"].some(n=>e.includes(n)):false}function st(){const e=document.querySelectorAll("script"),t=/\/js\/main\.[^/]+\.js$/;for(const n of e){const a=n.getAttribute("src");if(a&&t.test(a))return a}return null}const re=()=>{const e=localStorage.getItem("visitorId"),t=localStorage.getItem("apiHost"),n=localStorage.getItem("auth"),a=localStorage.getItem("did");return {host:t,genHeaders:async()=>({...await rt(),accept:"application/json","Content-Type":"application/json",ts:Math.floor(Date.now()/1e3).toString(),...n&&{Authorization:n},...e&&{visitorId:e},...a&&{did:a}})}};async function Se(e,t){const n=new TextEncoder,a=n.encode(e),o=n.encode(t),r=await crypto.subtle.importKey("raw",o,{name:"HMAC",hash:"SHA-1"},false,["sign"]),s=await crypto.subtle.sign("HMAC",r,a);return btoa(String.fromCharCode(...new Uint8Array(s)))}async function it(e){const t=Date.now(),n=await ve(),a=await Se(`POST&/api/tracker/queryHistory&${t}`,n),{host:o,genHeaders:r}=re(),s={_timestamp:t,_sgin:a,tids:e},c=`${o}/tracker/queryHistory`,i=await r();return (await(await fetch(c,{body:JSON.stringify(s),method:"POST",headers:i})).json()).data}function ct(e){return e.map(t=>t.id)}function lt(e){const t={};return e.forEach(n=>{n.id&&n.size&&(t[n.id]=n.size);}),t}function de(e){return {id:e.torrent,dateTime:e.lastCompleteDate||e.lastModifiedDate||e.createdDate,download:e.downloadedReal||e.downloaded||"0",timesCompleted:e.timesCompleted||"0",updateTime:Date.now()}}function dt(e,t){if(!e.download||!t)return "0%";const n=parseFloat(e.download),a=parseFloat(t);if(isNaN(n)||isNaN(a)||a===0)return "0%";const o=n/a*100;return o>=100?"100%":`${o.toFixed(1)}%`}function ut(e){if(!e)return "";try{return new Date(e).toLocaleDateString()}catch{return ""}}function ue(e,t){Object.entries(e).forEach(([n,a])=>{const o=document.querySelector(`tr[data-id="${n}"]`);if(!o)return;const r=o.querySelector(".download-status"),s=o.querySelector(".down-percent"),c=o.querySelector(".down-date");if(r?.classList.remove("hide"),o.classList?.add("download-history"),s){let i="";t&&t[n]?i=t[n]:i=s.getAttribute("data-size")||"";const l=dt(a,i);s.textContent=`完成:${l}`;}if(c){const i=ut(a.dateTime);c.textContent=`日期:${i}`;}});}async function $e(e){try{const t=ct(e);if(!t.length)return;const n=e?lt(e):void 0,a=await we(t);Object.keys(a).length>0&&ue(a,n);const o=await at(t);if(o.length>0)try{const r=await it(o),s=[];if(r.historyMap&&Object.values(r?.historyMap||{}).forEach(c=>{const i=de(c);s.push(i);}),r.peerMap&&Object.values(r?.peerMap||{}).forEach(c=>{const i=de(c);s.push(i);}),s.length>0){nt(s).catch(i=>console.error("保存下载历史记录失败:",i));const c=Object.fromEntries(s.map(i=>[i.id,i]));ue(c,n);}}catch(r){console.error("从API获取下载历史记录失败:",r);}}catch(t){console.error("处理下载历史记录时出错:",t);}}const mt=e=>`<button type="button" class="ant-btn css-custom ${e} ant-btn-circle ant-btn-primary ant-btn-color-primary ant-btn-variant-solid ant-btn-sm ant-btn-icon-only ant-btn-background-ghost mr-2">
    <span class="ant-btn-icon">
      <span role="img" aria-label="download" class="anticon anticon-download">
        <svg viewBox="64 64 896 896" focusable="false" data-icon="download" width="1em" height="1em" fill="currentColor" aria-hidden="true">
          <path d="M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"></path>
        </svg>
      </span>
    </span>
  </button>`,pt=e=>`<button type="button" class="ant-btn css-custom ${e} ant-btn-circle ant-btn-primary ant-btn-color-primary ant-btn-variant-solid ant-btn-sm ant-btn-icon-only ant-btn-background-ghost">
    <span class="ant-btn-icon">
      <span role="img" aria-label="star" class="anticon anticon-star">
        <svg viewBox="64 64 896 896" focusable="false" data-icon="star" width="1em" height="1em" fill="currentColor" aria-hidden="true">
          <path d="M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3zM664.8 561.6l36.1 210.3L512 672.7 323.1 772l36.1-210.3-152.8-149L417.6 382 512 190.7 606.4 382l211.2 30.7-152.8 148.9z"></path>
        </svg>
      </span>
    </span>
  </button>`,gt=()=>`<span role="img" aria-label="arrow-up" class="anticon anticon-arrow-up mr-0.5" style="color: green;">
    <svg viewBox="64 64 896 896" focusable="false" data-icon="arrow-up" width="1em" height="1em" fill="currentColor" aria-hidden="true">
      <path d="M868 545.5L536.1 163a31.96 31.96 0 00-48.3 0L156 545.5a7.97 7.97 0 006 13.2h81c4.6 0 9-2 12.1-5.5L474 300.9V864c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V300.9l218.9 252.3c3 3.5 7.4 5.5 12.1 5.5h81c6.8 0 10.5-8 6-13.2z"></path>
    </svg>
  </span>`,ht=()=>`<span role="img" aria-label="arrow-down" class="anticon anticon-arrow-down mr-0.5" style="color: red;">
    <svg viewBox="64 64 896 896" focusable="false" data-icon="arrow-down" width="1em" height="1em" fill="currentColor" aria-hidden="true">
      <path d="M862 465.3h-81c-4.6 0-9 2-12.1 5.5L550 723.1V160c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v563.1L255.1 470.8c-3-3.5-7.4-5.5-12.1-5.5h-81c-6.8 0-10.5 8.1-6 13.2L487.9 861a31.96 31.96 0 0048.3 0L868 478.5c4.5-5.2.8-13.2-6-13.2z"></path>
    </svg>
  </span>`,ft=()=>{const e=document.createElement("div");return e.style.left="50%",e.style.bottom="20px",e.style.color="white",e.style.position="fixed",e.className="loading-tip",e.style.transform="translateX(-50%)",e.style.background="rgba(0, 0, 0, 0.7)",e.style.borderRadius="4px",e.style.padding="8px 16px",e.style.display="none",e.style.zIndex="1000",e.textContent="加载中...",e},yt=Object.freeze({1:{name:"DIY",color:"rgb(90, 189, 72)"},2:{name:"国配",color:"rgb(90, 59, 20)"},4:{name:"中字",color:"rgb(59, 74, 127)"}}),wt=e=>{const t=Number(e),n=[];return t&1&&n.push("1"),t&2&&n.push("2"),t&4&&n.push("4"),n},bt=(e,t)=>{if(!e||String(e)==="0")return "";const n=wt(e);if(!n.length)return "";const a="ant-tag ant-tag-has-color ml-1 mt-default css-custom";return n.map(o=>{const{name:r,color:s}=yt[o];return `<span class="${a} ${t}" style="background-color:${s};">${r}</span>`}).join("")},vt=(e,t="",n="")=>`<div class='download-status hide'><span data-size="${e}" class="down-percent">${t}</span> <span class="down-date">${n}</span></div>`,xt=e=>{const t=Date.now(),a=new Date(e).getTime()-t,o=1e3*60*60*24;if(t>o)return `${Math.floor(a/o)} 天`;const r=1e3*60*60;return t>r?`${Math.floor(a/r)} 小时`:`${Math.floor(a/(1e3*60))} 分钟`},Y=1024,Q=Y*1024,Z=Q*1024,V=Z*1024,U=16,St=e=>{if(e.length>U){const n=parseFloat(e.slice(0,U));return `${((e.length-U)*(n/V)).toFixed(2)} TB`}const t=parseFloat(e);return t<Y?`${t.toFixed(2)} B`:t<Q?`${(t/Y).toFixed(2)} KB`:t<Z?`${(t/Q).toFixed(2)} MB`:t<V?`${(t/Z).toFixed(2)} GB`:`${(t/V).toFixed(2)} TB`},$t=e=>Ct.find(t=>t.id===String(e)),Ct=[{id:"100",image:"",name:"电影"},{id:"105",image:"",name:"影剧/综艺"},{id:"110",image:"",name:"Music"},{id:"115",image:"",name:"AV(有码)"},{id:"120",image:"",name:"AV(无码)"},{id:"401",image:"moviesd.png",name:"电影/SD"},{id:"402",image:"tvhd.png",name:"影剧/综艺/HD"},{id:"403",image:"tvsd.png",name:"影剧/综艺/SD"},{id:"404",image:"bbc.png",name:"纪录"},{id:"405",image:"anime.png",name:"动画"},{id:"406",image:"mv.png",name:"演唱"},{id:"407",image:"sport.png",name:"运动"},{id:"409",image:"other.png",name:"Misc(其他)"},{id:"410",image:"cenhd.png",name:"AV(有码)/HD Censored"},{id:"411",image:"hgame.png",name:"H-游戏"},{id:"412",image:"hanime.png",name:"H-动漫"},{id:"413",image:"hcomic.png",name:"H-漫画"},{id:"419",image:"moviehd.png",name:"电影/HD"},{id:"420",image:"moviedvd.png",name:"电影/DVDiSo"},{id:"421",image:"moviebd.png",name:"电影/Blu-Ray"},{id:"422",image:"software.png",name:"软件"},{id:"423",image:"game-pc-3.jpeg",name:"PC游戏"},{id:"424",image:"censd.png",name:"AV(有码)/SD Censored"},{id:"425",image:"ivvideo.png",name:"IV(写真影集)"},{id:"426",image:"uendvd.png",name:"AV(无码)/DVDiSo Uncensored"},{id:"427",image:"Study.png",name:"教育書面"},{id:"429",image:"uenhd.png",name:"AV(无码)/HD Uncensored"},{id:"430",image:"uensd.png",name:"AV(无码)/SD Uncensored"},{id:"431",image:"cenbd.png",name:"AV(有码)/Blu-Ray Censored"},{id:"432",image:"uenbd.png",name:"AV(无码)/Blu-Ray Uncensored"},{id:"433",image:"ivpic.png",name:"IV(写真图集)"},{id:"434",image:"flac.png",name:"Music(无损)"},{id:"435",image:"tvdvd.png",name:"影剧/综艺/DVDiSo"},{id:"436",image:"adult0day.png",name:"AV(网站)/0Day"},{id:"437",image:"cendvd.png",name:"AV(有码)/DVDiSo Censored"},{id:"438",image:"tvbd.png",name:"影剧/综艺/BD"},{id:"439",image:"movieremux.png",name:"电影/Remux"},{id:"440",image:"gayhd.gif",name:"AV(Gay)/HD"},{id:"441",image:"Study_Video.png",name:"教育(影片)"},{id:"442",image:"Study_Audio.png",name:"有声书"},{id:"443",image:"",name:"教育"},{id:"444",image:"",name:"紀錄"},{id:"445",image:"",name:"IV"},{id:"446",image:"",name:"H-ACG"},{id:"447",image:"",name:"遊戲"},{id:"448",image:"pcgame.png",name:"TV游戏"},{id:"449",image:"",name:"動漫"},{id:"450",image:"",name:"其他"}];let h="";const _={},ee=e=>e?.[0]?.includes("m-team.cc/")?"origin":"no-referrer",Tt=(e,t)=>!e||!t?"":`<a href="${e}" target="_blank" rel="noreferrer" class="mr-2">
    <span class="ant-typography css-custom ${h}">
      <img src="https://static.m-team.cc/static/douban.ico" alt="imdb" height="14" class="rounded-sm" />
      <span class="align-middle">${t}</span>
    </span>
  </a>`,Et=(e,t)=>!e||!t?"":`<a href="${e}" target="_blank" rel="noreferrer" class="mr-2">
    <span class="ant-typography css-custom ${h}">
      <img src="https://static.m-team.cc/static/imdb.gif" alt="imdb" />
      <span class="align-middle">${t}</span>
    </span>
  </a>`,Ht=({douban:e,doubanRating:t,imdb:n,imdbRating:a})=>{const o=Et(n,a),s=[Tt(e,t),o].filter(Boolean);return s.length?`<div class="flex items-center justify-end flex-nowrap">${s.join("")}</div>`:""},At=e=>Number(e)?`<img src="https://static.m-team.cc/static/ms_up.jpg" alt="+${e}%" title="+${e}%" />`:"",Rt=e=>Array.from({length:Number(e)||0},()=>'<img src="https://static.m-team.cc/static/trans.gif" class="sticky" alt="sticky" title="置頂">').join(""),me=e=>{const t="background-color:rgb(255, 85, 0);",n="background-color:rgb(16, 142, 233);",a=`ant-tag mt-default ml-2 css-custom ${h}}`;switch(e){case "NORMAL":return "";case "PERCENT_70":return `<span class="${a} ant-tag-gold">30%</span>`;case "PERCENT_50":return `<span class="${a} ant-tag-has-color" style="${t}">50%</span>`;case "FREE":return `<span class="${a} ant-tag-has-color" style="${n}">Free</span>`;default:return ""}},Dt=(e,t,n)=>t?`<span class="ant-typography ml-2 ${n}" title="促销, 截止日期:${t}">
    ${me(e)}
    <span class="ant-typography ${n}" style="font-size: 13px;">限时:${xt(t)}</span>
  </span>`:me(e),b="border border-solid border-black p-2";async function Lt(e,t,n){if(!_[e])try{_[e]=!0;for(let a=0;a<t.length;a++){const o=t[a];try{n.referrerPolicy=ee([o]);const r=await Ke(e);if(r){n.src=r;return}await new Promise((s,c)=>{n.onload=s,n.onerror=c,n.src=o;}),await Je(e,o);return}catch(r){console.error(`图片 ${o} 加载失败:`,r),a===t.length-1&&(n.src=o);}}}catch(a){console.error("所有图片加载失败,使用最后一张:",a),t.length>0&&(n.src=t[t.length-1]);}finally{_[e]=false;}}const Ce=e=>{h||(h=he());const{comments:t,seeders:n,timesCompleted:a,leechers:o,discount:r,discountEndTime:s,toppingLevel:c}=e.status,{imageList:i,msUp:l,douban:d,createdDate:m,imdbRating:x,imdb:g,doubanRating:w}=e,{name:p,id:y,smallDescr:q,category:A,size:S,labels:M}=e,R=St(S),se=$t(A),De=Ht({douban:d,doubanRating:w,imdb:g,imdbRating:x}),ie=`torrent-img-${y}`;return requestAnimationFrame(()=>{const ce=document.getElementById(ie);ce&&i?.length&&Lt(y,i,ce);}),`<tr data-id="${y}" data-type="append">
      <td class="${b}" align="center">
        <a href="/browse?cat=${A}" target="_self">
          <img class="cate" src="https://static.m-team.cc/static/cate/${se?.image}" alt="${se?.name}" />
        </a>
      </td>
      <td class="${b}" align="center">
        <div referrerpolicy="${ee(i)}" class="ant-image css-custom ${h}">
          <img id="${ie}" referrerpolicy="${ee(i)}" class="ant-image-img css-custom ${h}" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" alt="${p}" />
        </div>
      </td>
      <td class="${b}">
        <div class="flex flex-nowrap">
          <div class="w-2 flex-grow">
            <div>
              <a href="/detail/${y}" target="_blank">
                <div class="inline-flex max-w-full items-center pr-3 whitespace-nowrap" style="margin-top: 1px; margin-bottom: 1px">
                  <span class="ant-typography ant-typography-ellipsis ant-typography-ellipsis-single-line mr-1 css-custom ${h}">
                    <strong>
                      ${Rt(c)}
                      ${At(l)}
                      <span>${p}</span>
                    </strong>
                  </span>
                  <a href="https://wiki.m-team.cc/zh-tw/seedbox-rules" target="_blank">
                    <img class="box_img" src="https://static.m-team.cc/static/box_small.png" alt="box-img" />
                  </a>
                  ${Dt(r,s,h)}
                </div>
              </a>
              <br />
              <div class="inline-flex max-w-full items-center pr-3 whitespace-nowrap">
                <span class="ant-typography ant-typography-ellipsis ant-typography-ellipsis-single-line css-custom ${h}">
                  ${q}
                </span>
                ${bt(M,h)}
              </div>
            </div>
          </div>
          <div>
            <div class="flex rows-center justify-end flex-nowrap">
              <div>${mt(h)} ${pt(h)}</div>
            </div>
            ${De}
            </div>
          </div>
        </div>
        ${vt(S)}
      </td>
      <td class="${b}" align="center">${t}</td>
      <td class="${b}" align="center">
        <span title="" class="block mx-[-5px]">${m}</span>
      </td>
      <td class="${b} whitespace-pre-line" align="center">
        <div class="mx-[-5px]">${R}</div>
      </td>
      <td class="${b}" align="center">
        ${gt()}<span>${n}</span>
      </td>
      <td class="${b}" align="center">
        ${ht()}<span>${o}/${a}</span>
      </td>
    </tr>`};function kt(e){const t=history.pushState,n=history.replaceState;history.pushState=function(a,o,r){e(a,o,r);const s=[a,o,r];return t.apply(history,s)},history.replaceState=function(a,o,r){e(a,o,r);const s=[a,o,r];return n.apply(history,s)};}const qt=Object.freeze({descend:"DESC",ascend:"ASC"}),Mt=()=>1+(Number(new URL(location.href).searchParams.get("pageNumber"))||1),It=e=>e.replace(/([A-Z])/g,"_$1").toUpperCase(),jt=e=>{const t=e.get("sort");if(!t)return {};const[n,a]=t.split(":");return {sortField:It(n),sortDirection:qt[a]}},Pt=e=>{const t=e.get("uploadDateStart"),n=e.get("uploadDateEnd");return !t||!n?{}:{uploadDateStart:t,uploadDateEnd:n}},Bt=()=>{const{href:e,pathname:t}=location,{searchParams:n}=new URL(e),a=t.match(/^\/browse\/(?<m>\w+)$/)?.groups?.m||"normal",o=Number(n.get("pageSize"))||100,r=n.getAll("cat")||[],s=Pt(n),c=jt(n);return {mode:a,pageSize:o,categories:r,...c,...s}};async function Nt(e=Mt()){const t=Date.now(),n=await ve(),a=await Se(`POST&/api/torrent/search&${t}`,n),o={...Bt(),visible:1,pageNumber:e,_timestamp:t,_sgin:a},{host:r,genHeaders:s}=re(),c=`${r}/torrent/search`,i=await s(),d=await(await fetch(c,{body:JSON.stringify(o),method:"POST",headers:i})).json();return be(d.data?.data)}const Te=(e,t,n="beforeend")=>{t.insertAdjacentHTML(n,e);},Ft=(e,t)=>{let n=null;return (...a)=>{n&&clearTimeout(n),n=setTimeout(()=>{e.apply(null,a),n=null;},t);}};let u=null,B=1,E=0,N=0,X=false;const Ot=`<svg viewBox="64 64 896 896" focusable="false" data-icon="reload" width="1em" height="1em" fill="currentColor" aria-hidden="true">
  <path d="M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"></path></svg>`,zt=e=>{if(e===0)return "0 B";const t=["B","KB","MB","GB"],n=Math.floor(Math.log(e)/Math.log(1024)),a=Math.min(n,t.length-1);return (e/Math.pow(1024,a)).toFixed(2)+" "+t[a]},Vt=()=>{const e=document.createElement("div");e.id="torrent-status-indicator",e.style.cssText="position:fixed;left:0;top:50%;color:white;transform:translateY(-50%);background-color:rgba(0, 0, 0, 0.5);padding:5px 8px 6px 5px;border-radius:0 12px 12px 0;font-size:12px;z-index:1000;display:flex;flex-direction:column;box-shadow:0 0 10px rgba(0, 0, 0, 0.3);position:absolute;",e.innerHTML=`<div class="status-header" style="margin-bottom:8px;font-weight:bold;border-bottom:1px solid rgba(255,255,255,0.2);padding-bottom:5px;">状态监视器</div><div id="status-body"><div class="cache-stats" style="margin-bottom:8px;"><div>缓存:<span id="cache-count">0</span> 条</div><div>空间:<span id="cache-size">0 B</span></div><div>命中:<span id="cache-hits">0</span> 次</div></div><div class="status-content" style="margin-bottom:8px;border-top:1px solid rgba(255,255,255,0.2);padding-top:5px;"><div>页码:<span id="current-page">1 / ${N}</span></div><div>总数:<span id="total-records">${E}</span></div></div><button id="load-next-page" style=" background:none;border:1px solid rgba(255,255,255,0.6);color:#fff;padding:2px;border-radius:4px;cursor:pointer;display:flex;font-size:xx-small;align-items:center;justify-content:center;transition:background-color 0.2s;width:100%;"> ${Ot} 下一页 </button></div><div id="loading-animation" style=" display:none;position:absolute;top:24px;left:0;right:0;bottom:0;background-color:rgba(0, 0, 0, 0.7);text-align:center;flex-direction:column;justify-content:center;align-items:center;border-radius:0 0 12px 0;z-index:10;"><div class="loading-spinner" style=" width:24px;height:24px;border:2px solid rgba(255, 255, 255, 0.3);border-radius:50%;border-top-color:#fff;animation:spin 1s ease-in-out infinite;margin-top:12px;display:inline-block;"></div><style> @keyframes spin { to { transform:rotate(360deg);} } </style><div style="margin-top:5px;font-size:12px;">加载中...</div></div>`;const t=e.querySelector("#load-next-page");return t&&(t.addEventListener("mouseover",()=>{t.style.backgroundColor="rgba(255,255,255,0.1)";}),t.addEventListener("mouseout",()=>{t.style.backgroundColor="transparent";})),e},Ut=e=>{u&&document.body.removeChild(u),u=Vt(),document.body.appendChild(u);const t=u.querySelector("#load-next-page");return t&&t.addEventListener("click",e),te(),setInterval(te,1e4),u},te=async()=>{if(u&&!X){X=true;try{const{count:e,size:t}=await Qe(),n=Ze(),a=u.querySelector("#cache-count"),o=u.querySelector("#cache-size"),r=u.querySelector("#cache-hits");a&&(a.textContent=String(e)),o&&(o.textContent=zt(t)),r&&(r.textContent=String(n));}catch(e){console.error("更新缓存信息时出错:",e);}finally{X=false;}}},oe=(e,t)=>{if(!u)return;B=e,t>0&&(E+=t);const n=u.querySelector("#current-page"),a=u.querySelector("#total-records");n&&(n.textContent=`${B} / ${N}`),a&&(a.textContent=String(E)),te();},_t=()=>{E=0,B=1;},Xt=(e,t=0)=>{const n=e?.length||0;if(E+=n,N=t,!u)return;const a=u?.querySelector("#current-page"),o=u?.querySelector("#total-records");a&&(a.textContent=`${B} / ${N}`),o&&(o.textContent=String(E));},Gt=e=>{if(!u)return;const t=u.querySelector("#loading-animation"),n=u.querySelector("#load-next-page");t&&(t.style.display=e?"flex":"none"),n&&(n.disabled=e);},Wt=()=>{u&&u.parentNode&&(u.parentNode.removeChild(u),u=null);};let j=false,P=false,D=1,F="",$=null,O=false;const Jt=()=>{const e=document.querySelector("#app-content");if(!e)return  false;const{scrollHeight:t,scrollTop:n,clientHeight:a}=e;return t-n-a<=1e3},pe=e=>{$&&($.style.display=e?"block":"none",Gt(e));},Ee=async()=>{if(!P)try{P=!0,pe(!0);const e=document.querySelector(".ant-spin-container tbody");if(!e)return;const t=await Nt(D+1);if(!t?.length)return;t.forEach(n=>{const a=Ce(n);Te(a,e);}),D++,oe(D,t.length),setTimeout(()=>{$e(t);},100);}catch(e){console.error("加载更多失败:",e);}finally{setTimeout(()=>{P=false;},3e3),pe(false);}},He=Ft(async()=>{Jt()&&await Ee();},1e3),Kt=e=>{const t=e.target;(t.classList.contains("ant-image")||t.classList.contains("ant-image-img"))&&(e.preventDefault(),e.stopPropagation());},Ae=()=>{const e=document.querySelectorAll('tr[data-type="append"]');for(const t of e)t.remove();_t(),et();},Re=()=>{document.querySelector("#app-content")?.removeEventListener("scroll",He),$?.remove(),Ae(),Wt(),F="",j=false,D=1,P=false,$=null,O=false,window.handleScrollEventRef=void 0,console.log("run cleanup.");};async function Yt(){tt(),kt((e,t,n)=>{if(console.log("url change:",n),!n?.startsWith("/browse"))return Re();n!==F&&(F=n,D=1,Ae(),O&&oe(1,0)),ge();}),Qt()&&await ge();}async function ge(){if(j)return;F=location.pathname,await K(".ant-image-img",50,400),await k(500),await K(".ant-image-mask",50,400),$||($=ft(),document.body.appendChild($)),O||(Ut(Ee),oe(1,0),O=true),document.querySelector("#float-btns")?.remove(),document.querySelectorAll(".ant-image > .ant-image-mask").forEach(n=>n?.remove()),document.addEventListener("click",Kt,true),setTimeout(()=>{const n=document.querySelector("#app-content");n&&(j||(j=true,window.handleScrollEventRef&&window.handleScrollEventRef?.(),n.addEventListener("scroll",He),window.handleScrollEventRef=Re,console.log("Adding scroll listener to #app-content")));},8e3);}function Qt(){const{host:e,pathname:t}=location;return e.endsWith("m-team.cc")?t.startsWith("/browse"):false}let I=null;const L=class L{constructor(t){C(this,"originalXHRopen");C(this,"originalXHRsend");C(this,"interceptConfigs",[]);C(this,"originalFetch");if(L.isHijacked){if(I)return I.addConfig(t),I;console.warn("XHRAndFetchInterceptor: 拦截器已经被激活,避免重复拦截。");return}this.interceptConfigs=Array.isArray(t)?t:[t],this.originalXHRopen=XMLHttpRequest.prototype.open,this.originalXHRsend=XMLHttpRequest.prototype.send,this.originalFetch=window.fetch,this.hijackXHR(),this.hijackFetch(),L.isHijacked=true,I=this;}addConfig(t){(Array.isArray(t)?t:[t]).forEach(a=>{this.interceptConfigs.some(r=>r.url===a.url&&r.method===a.method)||this.interceptConfigs.push(a);});}hijackXHR(){const t=this;XMLHttpRequest.prototype.open=function(n,a,o=true,r,s){this.uri=a,this.method=n,t.originalXHRopen.apply(this,[n,a,o,r,s]);},XMLHttpRequest.prototype.send=async function(n){const a=this.onreadystatechange,o=t.originalXHRsend.bind(this),r={status:0,statusText:"",response:null,responseText:"",responseXML:null,responseType:"",readyState:0},s=new Proxy(this,{get:(i,l)=>l==="readyState"?r.readyState:Reflect.get(i,l)}),c=this.uri?.startsWith("/")?`${location.origin}${this.uri}`:this.uri;for(const i of t.interceptConfigs)if(G(c,i.url)&&W(this.method,i.method)){if(i.beforeSendCallback){const l={url:new URL(c),data:n},{data:d,url:m}=await i.beforeSendCallback(l)||{};d&&(n=d),m&&(this.uri=m.toString(),t.originalXHRopen.apply(this,[this.method,this.uri,true]));}break}return this.onreadystatechange=async function(i){let l=true;if(this.readyState===4&&this.status===200)for(const d of t.interceptConfigs){if(!G(this.responseURL,d.url)||!W(this.method,d.method))continue;const m={url:new URL(this.responseURL),data:n};if(d.preCallback){const[g,w]=await d.preCallback(J(this),m);if(!g){l=false;const p=new XMLHttpRequest;return p.open(this.method,w.uri,true),p.onreadystatechange=async()=>{if(p.readyState===4){if(r.status=p.status,r.statusText=p.statusText,r.response=p.response,r.responseText=p.responseText,r.responseXML=p.responseXML,r.readyState=p.readyState,d.lastCallback){const y=await d.lastCallback(J(r),m);r.response=y,r.responseText=JSON.stringify(y);}Object.defineProperties(this,{status:{get:()=>r.status},response:{get:()=>r.response},statusText:{get:()=>r.statusText},responseXML:{get:()=>r.responseXML},responseText:{get:()=>r.responseText},responseType:{get:()=>r.responseType},readyState:{get:()=>r.readyState}}),a&&a.call(s,i);}},p.send(w?.data)}}const x=J(this);if(d.callback&&await d.callback(x),d.lastCallback){const g=await d.lastCallback(x,m);r.response=g,r.responseText=JSON.stringify(g),Object.defineProperties(this,{response:{get:()=>r.response},responseText:{get:()=>r.responseText}});}}a&&l&&a.call(this,i);},o(n)};}hijackFetch(){const t=this,n=this.originalFetch;window.fetch=async function(a,o){const r=typeof a=="string"?a:a instanceof URL?a.href:a.url,s=o&&o.method?o.method:"GET",c=await n.apply(window,[a,o]);return c.clone().text().then(async i=>{for(const l of t.interceptConfigs)G(c.url,l.url)&&W(s,l.method)&&(console.log(`Fetch 请求被拦截,URL: ${r}, ${s}`),l.callback&&await l.callback(i));}),c};}restore(){XMLHttpRequest.prototype.open=this.originalXHRopen,XMLHttpRequest.prototype.send=this.originalXHRsend,window.fetch=this.originalFetch;}};C(L,"isHijacked",false);let ne=L;function G(e,t){if(t instanceof RegExp)return t.test(e);try{const n=new URL(e),a=new URL(t);return n.host===a.host&&n.protocol===a.protocol&&n.pathname===a.pathname}catch{return  false}}function W(e,t){return e?.toLocaleLowerCase()===t?.toLocaleLowerCase()}function J(e){return e.responseType==="json"?e.response:e.responseText}async function Zt(){if(!en())return;const{host:e}=re();new ne([{method:"POST",url:`${e}/torrent/search`,lastCallback:tn}]);}function en(){const{host:e}=location;return e.endsWith(".m-team.cc")}async function tn(e){const t=typeof e=="string"?JSON.parse(e):e;if(t?.data?.data?.length){const n=be(t.data.data);t.data.data=[],await nn(n);const a=t?.data.totalPages;Xt(n,a);}return t}async function nn(e){if(!e?.length)return;const t=document.querySelector(".ant-spin-container tbody");if(!t)return;e.forEach(a=>{const o=Ce(a);Te(o,t);}),setTimeout(()=>{const a=document.querySelector(".ant-spin-container>div>div.ant-empty");a&&(a.style.display="none");},100),setTimeout(()=>{$e(e);},100);const n=document.createElement("style");n.textContent="body>div.ant-message.ant-message-top { display: none !important; }",document.head.appendChild(n),setTimeout(()=>{n.remove();},6e3);}Zt(),qe([Yt,Me]);

})();