// Built at: 2026/7/16 22:29:11 var C=s=>async(e,t)=>{let n=i=>async()=>{let r=i===s.length?t:s[i];if(r)return await r(e,n(i+1))};return n(0)()};function le(s){let e=23442827791579n,t=1n<<51n,n=58n,i="FcwAPNKTMug3GV5Lj7EJnHpWsx4tb8haYeviqBz6rkCy12mUSDQX9RdoZf",r=["B","V","1","0","0","0","0","0","0","0","0","0"],l=r.length-1,o=(t|BigInt(s))^e;for(;o>0;)r[l]=i[Number(o%BigInt(n))],o=o/n,l-=1;return[r[3],r[9]]=[r[9],r[3]],[r[4],r[7]]=[r[7],r[4]],r.join("")}function fe(s){return s instanceof Uint8Array}function rt(s){return typeof s!="object"||s===null?String(s):s instanceof Error?`${s.toString()} ${JSON.stringify({stack:s.stack})}`:Array.isArray(s)?JSON.stringify(s):typeof s.toString=="function"&&s.toString!==Object.prototype.toString?s.toString():JSON.stringify(s)}function W(s){return $utils.ungzip(s)}var F=class extends Error{constructor(t,n=`Process exited with code ${t}`){super(n);this.code=t}name="Exit";toString(){return`[${this.name}] ${this.message}`}};function ue(s=0){throw new F(s)}var it=(r=>(r[r.DEBUG=1]="DEBUG",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.OFF=5]="OFF",r))(it||{}),B=class{static level=4;static setLevel(e){this.level=Number(e)||it[e.toUpperCase()]||4}static log(...e){console.log(e.map(t=>rt(t)).join(" "))}static debug(...e){this.level>1||this.log("[DEBUG]",...e)}static info(...e){this.level>2||this.log("[INFO]",...e)}static warn(...e){this.level>3||this.log("[WARN]",...e)}static error(...e){if(this.level>4)return;let t=e[0];if(t instanceof F){t.code!==0&&this.error(t.toString());return}this.log("[ERROR]",...e)}};var $=class s{static getInstance(){return s.instance||(s.instance=s.createInstance()),s.instance}static createInstance(){if(typeof $loon<"u")return new ce;if(typeof $task<"u")throw new Error("QuantumultX is not supported");return new j}static instance;request;response;state={};argument={};#e;get url(){return this.#e||(this.#e=new URL(this.request.url)),this.#e}get path(){return this.url.pathname}get method(){return this.request.method}constructor(){this.request=this.createRequest(typeof $request<"u"?$request:null),this.response=this.createResponse(typeof $response<"u"?$response:null)}getJSON(e){let t=this.getVal(e);return t?JSON.parse(t):null}setJSON(e,t){this.setVal(JSON.stringify(e),t)}exit(){$done({})}toString(){let{method:e,url:t}=this.request,{status:n,body:i}=this.response;return JSON.stringify({method:e,url:t,status:n,body:i})}},j=class extends ${createRequest(e){return Object.create(e,{bodyBytes:{get(){return this.body},set(t){this.body=t}}})}createResponse(e){return Object.create(e,{bodyBytes:{get(){return this.body},set(t){this.body=t}}})}initArgument(e){if(Object.assign(this.argument,e),typeof $argument=="string")try{Object.assign(this.argument,JSON.parse($argument))}catch(t){B.log(t)}}getVal(e){return $persistentStore.read(e)}setVal(e,t){return $persistentStore.write(e,t)}fetch(e){let{method:t,body:n,timeout:i=5,...r}=e;return new Promise((l,o)=>{$httpClient[t.toLowerCase()]({...r,body:n,"binary-mode":fe(n),timeout:i},(a,f,d)=>{if(a)return o(a);l(this.createResponse({...f,body:d}))})})}notify(e="",t="",n="",i={}){let{openUrl:r,clipboard:l,mediaUrl:o,dismiss:a,sound:f=!0}=i,d={url:r,text:l,"media-url":o,"auto-dismiss":a,sound:f};r?d.action="open-url":l&&(d.action="clipboard"),$notification.post(e,t,n,d)}done(e){$done({...e})}abort(){$done({abort:!0})}},ce=class extends j{initArgument(e){super.initArgument(e),typeof $argument=="object"&&Object.assign(this.argument,$argument)}fetch(e){return e.timeout=(e.timeout??5)*1e3,e.alpn="h2",super.fetch(e)}notify(e="",t="",n="",i={}){let{openUrl:r,mediaUrl:l,clipboard:o,delay:a}=i,f={openUrl:r,mediaUrl:l,clipboard:o};$notification.post(e,t,n,f,a)}abort(){$done()}};var D=$.getInstance();var q=class{middleware=[];use(e){return this.middleware.push(e),this}run(){C(this.middleware)(D).catch(e=>B.error(e,D)).finally(()=>D.exit())}};var st=(s,e)=>e().then(()=>{s.done({response:s.response})});var v=async(s,e)=>{let t=s.response.bodyBytes;s.response.bodyBytes=t[0]?W(t.subarray(5)):t.subarray(5),await e(),t=s.response.bodyBytes;let n=t.length,i=new Uint8Array(5+n);i[0]=0,i[1]=n>>>24,i[2]=n>>>16&255,i[3]=n>>>8&255,i[4]=n&255,i.set(t,5),s.response.bodyBytes=i};var ot=s=>(e,t)=>(e.initArgument(s),B.setLevel(String(e.argument.logLevel)),B.debug("[Argument]",e.argument),t());var at=ot({displayUpList:"show",purifyComment:!0,sponsorBlock:!0}),lt=(s,e)=>e().then(()=>{if(s.response.h2_trailers!==void 0)return;let t=s.request.headers["x-bili-moss-engine-type"];if(t===void 0)return;if(t!=="1"){B.error(`x-bili-moss-engine-type: ${t}`);return}let n=s.response.headers;Object.hasOwn(n,"grpc-status")||(s.response.headers={...n,"grpc-status":"0"})});var A=class{path;methods;stack;constructor(e,t,n){this.path=e,this.methods=t,this.stack=n}};var _t=(s,e)=>e.path===s.path,ft=(s,e)=>e.request.url.endsWith(s.path);var _=class{stack=[];matchPath;constructor(e={}){this.matchPath=e.matchPath||_t}use(...e){return this.register("",[],e)}get(e,...t){return this.register(e,["GET"],t)}post(e,...t){return this.register(e,["POST"],t)}routes(){return(e,t)=>{let n=this.match(e);if(!n.route)return t();e.state.route=!0;let i=n.pathAndMethod.flatMap(r=>r.stack);return C(i)(e,t)}}routeNotMatched(){return(e,t)=>t().then(()=>{if(!e.state.route)throw new Error("Unexpected request")})}match(e){let t={path:[],pathAndMethod:[],route:!1};for(let n of this.stack)(n.path===""||this.matchPath(n,e))&&(t.path.push(n),(n.methods.length===0||n.methods.includes(e.method))&&(t.pathAndMethod.push(n),n.methods.length>0&&(t.route=!0)));return t}register(e,t,n){if(Array.isArray(e))for(let i of e)this.stack.push(new A(i,t,n));else this.stack.push(new A(e,t,n));return this}};function K(s){let e=typeof s;if(e=="object"){if(Array.isArray(s))return"array";if(s===null)return"null"}return e}function ut(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}var O="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),J=[];for(let s=0;s>4,l=r,i=2;break;case 2:t[n++]=(l&15)<<4|(r&60)>>2,l=r,i=3;break;case 3:t[n++]=(l&3)<<6|r,i=0;break}}if(i==1)throw Error("invalid base64 string.");return t.subarray(0,n)}function dt(s){let e="",t=0,n,i=0;for(let r=0;r>2],i=(n&3)<<4,t=1;break;case 1:e+=O[i|n>>4],i=(n&15)<<2,t=2;break;case 2:e+=O[i|n>>6],e+=O[n&63],t=0;break}return t&&(e+=O[i],e+="=",t==1&&(e+="=")),e}var p;(function(s){s.symbol=Symbol.for("protobuf-ts/unknown"),s.onRead=(t,n,i,r,l)=>{(e(n)?n[s.symbol]:n[s.symbol]=[]).push({no:i,wireType:r,data:l})},s.onWrite=(t,n,i)=>{for(let{no:r,wireType:l,data:o}of s.list(n))i.tag(r,l).raw(o)},s.list=(t,n)=>{if(e(t)){let i=t[s.symbol];return n?i.filter(r=>r.no==n):i}return[]},s.last=(t,n)=>s.list(t,n).slice(-1)[0];let e=t=>t&&Array.isArray(t[s.symbol])})(p||(p={}));var c;(function(s){s[s.Varint=0]="Varint",s[s.Bit64=1]="Bit64",s[s.LengthDelimited=2]="LengthDelimited",s[s.StartGroup=3]="StartGroup",s[s.EndGroup=4]="EndGroup",s[s.Bit32=5]="Bit32"})(c||(c={}));function pt(){let s=0,e=0;for(let n=0;n<28;n+=7){let i=this.buf[this.pos++];if(s|=(i&127)<>4,(t&128)==0)return this.assertBounds(),[s,e];for(let n=3;n<=31;n+=7){let i=this.buf[this.pos++];if(e|=(i&127)<>>r,o=!(!(l>>>7)&&e==0),a=(o?l|128:l)&255;if(t.push(a),!o)return}let n=s>>>28&15|(e&7)<<4,i=e>>3!=0;if(t.push((i?n|128:n)&255),!!i){for(let r=3;r<31;r=r+7){let l=e>>>r,o=!!(l>>>7),a=(o?l|128:l)&255;if(t.push(a),!o)return}t.push(e>>>31&1)}}var G=65536*65536;function de(s){let e=s[0]=="-";e&&(s=s.slice(1));let t=1e6,n=0,i=0;function r(l,o){let a=Number(s.slice(l,o));i*=t,n=n*t+a,n>=G&&(i=i+(n/G|0),n=n%G)}return r(-24,-18),r(-18,-12),r(-12,-6),r(-6),[e,n,i]}function H(s,e){if(e>>>0<=2097151)return""+(G*e+(s>>>0));let t=s&16777215,n=(s>>>24|e<<8)>>>0&16777215,i=e>>16&65535,r=t+n*6777216+i*6710656,l=n+i*8147497,o=i*2,a=1e7;r>=a&&(l+=Math.floor(r/a),r%=a),l>=a&&(o+=Math.floor(l/a),l%=a);function f(d,y){let m=d?String(d):"";return y?"0000000".slice(m.length)+m:m}return f(o,0)+f(l,o)+f(r,1)}function pe(s,e){if(s>=0){for(;s>127;)e.push(s&127|128),s=s>>>7;e.push(s)}else{for(let t=0;t<9;t++)e.push(s&127|128),s=s>>7;e.push(1)}}function mt(){let s=this.buf[this.pos++],e=s&127;if((s&128)==0)return this.assertBounds(),e;if(s=this.buf[this.pos++],e|=(s&127)<<7,(s&128)==0)return this.assertBounds(),e;if(s=this.buf[this.pos++],e|=(s&127)<<14,(s&128)==0)return this.assertBounds(),e;if(s=this.buf[this.pos++],e|=(s&127)<<21,(s&128)==0)return this.assertBounds(),e;s=this.buf[this.pos++],e|=(s&15)<<28;for(let t=5;(s&128)!==0&&t<10;t++)s=this.buf[this.pos++];if((s&128)!=0)throw new Error("invalid varint");return this.assertBounds(),e>>>0}var b;function Kt(){let s=new DataView(new ArrayBuffer(8));b=globalThis.BigInt!==void 0&&typeof s.getBigInt64=="function"&&typeof s.getBigUint64=="function"&&typeof s.setBigInt64=="function"&&typeof s.setBigUint64=="function"?{MIN:BigInt("-9223372036854775808"),MAX:BigInt("9223372036854775807"),UMIN:BigInt("0"),UMAX:BigInt("18446744073709551615"),C:BigInt,V:s}:void 0}Kt();function ht(s){if(!s)throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support")}var yt=/^-?[0-9]+$/,Z=4294967296,Y=2147483648,z=class{constructor(e,t){this.lo=e|0,this.hi=t|0}isZero(){return this.lo==0&&this.hi==0}toNumber(){let e=this.hi*Z+(this.lo>>>0);if(!Number.isSafeInteger(e))throw new Error("cannot convert to safe number");return e}},R=class s extends z{static from(e){if(b)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=b.C(e);case"number":if(e===0)return this.ZERO;e=b.C(e);case"bigint":if(!e)return this.ZERO;if(eb.UMAX)throw new Error("ulong too large");return b.V.setBigUint64(0,e,!0),new s(b.V.getInt32(0,!0),b.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!yt.test(e))throw new Error("string is no integer");let[t,n,i]=de(e);if(t)throw new Error("signed value for ulong");return new s(n,i);case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");if(e<0)throw new Error("signed value for ulong");return new s(e,e/Z)}throw new Error("unknown value "+typeof e)}toString(){return b?this.toBigInt().toString():H(this.lo,this.hi)}toBigInt(){return ht(b),b.V.setInt32(0,this.lo,!0),b.V.setInt32(4,this.hi,!0),b.V.getBigUint64(0,!0)}};R.ZERO=new R(0,0);var k=class s extends z{static from(e){if(b)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=b.C(e);case"number":if(e===0)return this.ZERO;e=b.C(e);case"bigint":if(!e)return this.ZERO;if(eb.MAX)throw new Error("signed long too large");return b.V.setBigInt64(0,e,!0),new s(b.V.getInt32(0,!0),b.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!yt.test(e))throw new Error("string is no integer");let[t,n,i]=de(e);if(t){if(i>Y||i==Y&&n!=0)throw new Error("signed long too small")}else if(i>=Y)throw new Error("signed long too large");let r=new s(n,i);return t?r.negate():r;case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");return e>0?new s(e,e/Z):new s(-e,-e/Z).negate()}throw new Error("unknown value "+typeof e)}isNegative(){return(this.hi&Y)!==0}negate(){let e=~this.hi,t=this.lo;return t?t=~t+1:e+=1,new s(t,e)}toString(){if(b)return this.toBigInt().toString();if(this.isNegative()){let e=this.negate();return"-"+H(e.lo,e.hi)}return H(this.lo,this.hi)}toBigInt(){return ht(b),b.V.setInt32(0,this.lo,!0),b.V.setInt32(4,this.hi,!0),b.V.getBigInt64(0,!0)}};k.ZERO=new k(0,0);var bt={readUnknownField:!0,readerFactory:s=>new me(s)};function gt(s){return s?Object.assign(Object.assign({},bt),s):bt}var me=class{constructor(e,t){this.varint64=pt,this.uint32=mt,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=t??new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0})}tag(){let e=this.uint32(),t=e>>>3,n=e&7;if(t<=0||n<0||n>5)throw new Error("illegal tag: field no "+t+" wire type "+n);return[t,n]}skip(e){let t=this.pos;switch(e){case c.Varint:for(;this.buf[this.pos++]&128;);break;case c.Bit64:this.pos+=4;case c.Bit32:this.pos+=4;break;case c.LengthDelimited:let n=this.uint32();this.pos+=n;break;case c.StartGroup:let i;for(;(i=this.tag()[1])!==c.EndGroup;)this.skip(i);break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(t,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return new k(...this.varint64())}uint64(){return new R(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,new k(e,t)}bool(){let[e,t]=this.varint64();return e!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return new R(this.sfixed32(),this.sfixed32())}sfixed64(){return new k(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}};function h(s,e){if(!s)throw new Error(e)}var Jt=34028234663852886e22,Gt=-34028234663852886e22,Xt=4294967295,Ht=2147483647,Yt=-2147483648;function E(s){if(typeof s!="number")throw new Error("invalid int 32: "+typeof s);if(!Number.isInteger(s)||s>Ht||sXt||s<0)throw new Error("invalid uint 32: "+s)}function M(s){if(typeof s!="number")throw new Error("invalid float 32: "+typeof s);if(Number.isFinite(s)&&(s>Jt||snew he};function kt(s){return s?Object.assign(Object.assign({},wt),s):wt}var he=class{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let i=0;i>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(U(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return E(e),pe(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){M(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){U(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){E(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return E(e),e=(e<<1^e>>31)>>>0,pe(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),i=k.from(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),i=R.from(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(t)}int64(e){let t=k.from(e);return X(t.lo,t.hi,this.buf),this}sint64(e){let t=k.from(e),n=t.hi>>31,i=t.lo<<1^n,r=(t.hi<<1|t.lo>>>31)^n;return X(i,r,this.buf),this}uint64(e){let t=R.from(e);return X(t.lo,t.hi,this.buf),this}};var Rt={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},Bt={ignoreUnknownFields:!1};function It(s){return s?Object.assign(Object.assign({},Bt),s):Bt}function Nt(s){return s?Object.assign(Object.assign({},Rt),s):Rt}var Q=Symbol.for("protobuf-ts/message-type");function ye(s){let e=!1,t=[];for(let n=0;n!i.includes(l))||!n&&i.some(l=>!r.known.includes(l)))return!1;if(t<1)return!0;for(let l of r.oneofs){let o=e[l];if(!xt(o))return!1;if(o.oneofKind===void 0)continue;let a=this.fields.find(f=>f.localName===o.oneofKind);if(!a||!this.field(o[o.oneofKind],a,n,t))return!1}for(let l of this.fields)if(l.oneof===void 0&&!this.field(e[l.localName],l,n,t))return!1;return!0}field(e,t,n,i){let r=t.repeat;switch(t.kind){case"scalar":return e===void 0?t.opt:r?this.scalars(e,t.T,i,t.L):this.scalar(e,t.T,t.L);case"enum":return e===void 0?t.opt:r?this.scalars(e,u.INT32,i):this.scalar(e,u.INT32);case"message":return e===void 0?!0:r?this.messages(e,t.T(),n,i):this.message(e,t.T(),n,i);case"map":if(typeof e!="object"||e===null)return!1;if(i<2)return!0;if(!this.mapKeys(e,t.K,i))return!1;switch(t.V.kind){case"scalar":return this.scalars(Object.values(e),t.V.T,i,t.V.L);case"enum":return this.scalars(Object.values(e),u.INT32,i);case"message":return this.messages(Object.values(e),t.V.T(),n,i)}break}return!0}message(e,t,n,i){return n?t.isAssignable(e,i):t.is(e,i)}messages(e,t,n,i){if(!Array.isArray(e))return!1;if(i<2)return!0;if(n){for(let r=0;rparseInt(r)),t,n);case u.BOOL:return this.scalars(i.slice(0,n).map(r=>r=="true"?!0:r=="false"?!1:r),t,n);default:return this.scalars(i,t,n,I.STRING)}}};function N(s,e){switch(e){case I.BIGINT:return s.toBigInt();case I.NUMBER:return s.toNumber();default:return s.toString()}}var te=class{constructor(e){this.info=e}prepare(){var e;if(this.fMap===void 0){this.fMap={};let t=(e=this.info.fields)!==null&&e!==void 0?e:[];for(let n of t)this.fMap[n.name]=n,this.fMap[n.jsonName]=n,this.fMap[n.localName]=n}}assert(e,t,n){if(!e){let i=K(n);throw(i=="number"||i=="boolean")&&(i=n.toString()),new Error(`Cannot parse JSON ${i} for ${this.info.typeName}#${t}`)}}read(e,t,n){this.prepare();let i=[];for(let[r,l]of Object.entries(e)){let o=this.fMap[r];if(!o){if(!n.ignoreUnknownFields)throw new Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${r}`);continue}let a=o.localName,f;if(o.oneof){if(l===null&&(o.kind!=="enum"||o.T()[0]!=="google.protobuf.NullValue"))continue;if(i.includes(o.oneof))throw new Error(`Multiple members of the oneof group "${o.oneof}" of ${this.info.typeName} are present in JSON.`);i.push(o.oneof),f=t[o.oneof]={oneofKind:a}}else f=t;if(o.kind=="map"){if(l===null)continue;this.assert(ut(l),o.name,l);let d=f[a];for(let[y,m]of Object.entries(l)){this.assert(m!==null,o.name+" map value",null);let T;switch(o.V.kind){case"message":T=o.V.T().internalJsonRead(m,n);break;case"enum":if(T=this.enum(o.V.T(),m,o.name,n.ignoreUnknownFields),T===!1)continue;break;case"scalar":T=this.scalar(m,o.V.T,o.V.L,o.name);break}this.assert(T!==void 0,o.name+" map value",m);let x=y;o.K==u.BOOL&&(x=x=="true"?!0:x=="false"?!1:x),x=this.scalar(x,o.K,I.STRING,o.name).toString(),d[x]=T}}else if(o.repeat){if(l===null)continue;this.assert(Array.isArray(l),o.name,l);let d=f[a];for(let y of l){this.assert(y!==null,o.name,null);let m;switch(o.kind){case"message":m=o.T().internalJsonRead(y,n);break;case"enum":if(m=this.enum(o.T(),y,o.name,n.ignoreUnknownFields),m===!1)continue;break;case"scalar":m=this.scalar(y,o.T,o.L,o.name);break}this.assert(m!==void 0,o.name,l),d.push(m)}}else switch(o.kind){case"message":if(l===null&&o.T().typeName!="google.protobuf.Value"){this.assert(o.oneof===void 0,o.name+" (oneof member)",null);continue}f[a]=o.T().internalJsonRead(l,n,f[a]);break;case"enum":if(l===null)continue;let d=this.enum(o.T(),l,o.name,n.ignoreUnknownFields);if(d===!1)continue;f[a]=d;break;case"scalar":if(l===null)continue;f[a]=this.scalar(l,o.T,o.L,o.name);break}}}enum(e,t,n,i){if(e[0]=="google.protobuf.NullValue"&&h(t===null||t==="NULL_VALUE",`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} only accepts null.`),t===null)return 0;switch(typeof t){case"number":return h(Number.isInteger(t),`Unable to parse field ${this.info.typeName}#${n}, enum can only be integral number, got ${t}.`),t;case"string":let r=t;e[2]&&t.substring(0,e[2].length)===e[2]&&(r=t.substring(e[2].length));let l=e[1][r];return typeof l>"u"&&i?!1:(h(typeof l=="number",`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} has no value for "${t}".`),l)}h(!1,`Unable to parse field ${this.info.typeName}#${n}, cannot parse enum value from ${typeof t}".`)}scalar(e,t,n,i){let r;try{switch(t){case u.DOUBLE:case u.FLOAT:if(e===null)return 0;if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""){r="empty string";break}if(typeof e=="string"&&e.trim().length!==e.length){r="extra whitespace";break}if(typeof e!="string"&&typeof e!="number")break;let l=Number(e);if(Number.isNaN(l)){r="not a number";break}if(!Number.isFinite(l)){r="too large or small";break}return t==u.FLOAT&&M(l),l;case u.INT32:case u.FIXED32:case u.SFIXED32:case u.SINT32:case u.UINT32:if(e===null)return 0;let o;if(typeof e=="number"?o=e:e===""?r="empty string":typeof e=="string"&&(e.trim().length!==e.length?r="extra whitespace":o=Number(e)),o===void 0)break;return t==u.UINT32?U(o):E(o),o;case u.INT64:case u.SFIXED64:case u.SINT64:if(e===null)return N(k.ZERO,n);if(typeof e!="number"&&typeof e!="string")break;return N(k.from(e),n);case u.FIXED64:case u.UINT64:if(e===null)return N(R.ZERO,n);if(typeof e!="number"&&typeof e!="string")break;return N(R.from(e),n);case u.BOOL:if(e===null)return!1;if(typeof e!="boolean")break;return e;case u.STRING:if(e===null)return"";if(typeof e!="string"){r="extra whitespace";break}try{encodeURIComponent(e)}catch(a){a="invalid UTF8";break}return e;case u.BYTES:if(e===null||e==="")return new Uint8Array(0);if(typeof e!="string")break;return ct(e)}}catch(l){r=l.message}this.assert(!1,i+(r?" - "+r:""),e)}};var ne=class{constructor(e){var t;this.fields=(t=e.fields)!==null&&t!==void 0?t:[]}write(e,t){let n={},i=e;for(let r of this.fields){if(!r.oneof){let f=this.field(r,i[r.localName],t);f!==void 0&&(n[t.useProtoFieldName?r.name:r.jsonName]=f);continue}let l=i[r.oneof];if(l.oneofKind!==r.localName)continue;let o=r.kind=="scalar"||r.kind=="enum"?Object.assign(Object.assign({},t),{emitDefaultValues:!0}):t,a=this.field(r,l[r.localName],o);h(a!==void 0),n[t.useProtoFieldName?r.name:r.jsonName]=a}return n}field(e,t,n){let i;if(e.kind=="map"){h(typeof t=="object"&&t!==null);let r={};switch(e.V.kind){case"scalar":for(let[a,f]of Object.entries(t)){let d=this.scalar(e.V.T,f,e.name,!1,!0);h(d!==void 0),r[a.toString()]=d}break;case"message":let l=e.V.T();for(let[a,f]of Object.entries(t)){let d=this.message(l,f,e.name,n);h(d!==void 0),r[a.toString()]=d}break;case"enum":let o=e.V.T();for(let[a,f]of Object.entries(t)){h(f===void 0||typeof f=="number");let d=this.enum(o,f,e.name,!1,!0,n.enumAsInteger);h(d!==void 0),r[a.toString()]=d}break}(n.emitDefaultValues||Object.keys(r).length>0)&&(i=r)}else if(e.repeat){h(Array.isArray(t));let r=[];switch(e.kind){case"scalar":for(let a=0;a0||n.emitDefaultValues)&&(i=r)}else switch(e.kind){case"scalar":i=this.scalar(e.T,t,e.name,e.opt,n.emitDefaultValues);break;case"enum":i=this.enum(e.T(),t,e.name,e.opt,n.emitDefaultValues,n.enumAsInteger);break;case"message":i=this.message(e.T(),t,e.name,n);break}return i}enum(e,t,n,i,r,l){if(e[0]=="google.protobuf.NullValue")return!r&&!i?void 0:null;if(t===void 0){h(i);return}if(!(t===0&&!r&&!i))return h(typeof t=="number"),h(Number.isInteger(t)),l||!e[1].hasOwnProperty(t)?t:e[2]?e[2]+e[1][t]:e[1][t]}message(e,t,n,i){return t===void 0?i.emitDefaultValues?null:void 0:e.internalJsonWrite(t,i)}scalar(e,t,n,i,r){if(t===void 0){h(i);return}let l=r||i;switch(e){case u.INT32:case u.SFIXED32:case u.SINT32:return t===0?l?0:void 0:(E(t),t);case u.FIXED32:case u.UINT32:return t===0?l?0:void 0:(U(t),t);case u.FLOAT:M(t);case u.DOUBLE:return t===0?l?0:void 0:(h(typeof t=="number"),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t);case u.STRING:return t===""?l?"":void 0:(h(typeof t=="string"),t);case u.BOOL:return t===!1?l?!1:void 0:(h(typeof t=="boolean"),t);case u.UINT64:case u.FIXED64:h(typeof t=="number"||typeof t=="string"||typeof t=="bigint");let o=R.from(t);return o.isZero()&&!l?void 0:o.toString();case u.INT64:case u.SFIXED64:case u.SINT64:h(typeof t=="number"||typeof t=="string"||typeof t=="bigint");let a=k.from(t);return a.isZero()&&!l?void 0:a.toString();case u.BYTES:return h(t instanceof Uint8Array),t.byteLength?dt(t):l?"":void 0}}};function V(s,e=I.STRING){switch(s){case u.BOOL:return!1;case u.UINT64:case u.FIXED64:return N(R.ZERO,e);case u.INT64:case u.SFIXED64:case u.SINT64:return N(k.ZERO,e);case u.DOUBLE:case u.FLOAT:return 0;case u.BYTES:return new Uint8Array(0);case u.STRING:return"";default:return 0}}var re=class{constructor(e){this.info=e}prepare(){var e;if(!this.fieldNoToField){let t=(e=this.info.fields)!==null&&e!==void 0?e:[];this.fieldNoToField=new Map(t.map(n=>[n.no,n]))}}read(e,t,n,i){this.prepare();let r=i===void 0?e.len:e.pos+i;for(;e.post.no-n.no)}}write(e,t,n){this.prepare();for(let r of this.fields){let l,o,a=r.repeat,f=r.localName;if(r.oneof){let d=e[r.oneof];if(d.oneofKind!==f)continue;l=d[f],o=!0}else l=e[f],o=!1;switch(r.kind){case"scalar":case"enum":let d=r.kind=="enum"?u.INT32:r.T;if(a)if(h(Array.isArray(l)),a==P.PACKED)this.packed(t,d,r.no,l);else for(let y of l)this.scalar(t,d,r.no,y,!0);else l===void 0?h(r.opt):this.scalar(t,d,r.no,l,o||r.opt);break;case"message":if(a){h(Array.isArray(l));for(let y of l)this.message(t,n,r.T(),r.no,y)}else this.message(t,n,r.T(),r.no,l);break;case"map":h(typeof l=="object"&&l!==null);for(let[y,m]of Object.entries(l))this.mapEntry(t,n,r,y,m);break}}let i=n.writeUnknownFields;i!==!1&&(i===!0?p.onWrite:i)(this.info.typeName,e,t)}mapEntry(e,t,n,i,r){e.tag(n.no,c.LengthDelimited),e.fork();let l=i;switch(n.K){case u.INT32:case u.FIXED32:case u.UINT32:case u.SFIXED32:case u.SINT32:l=Number.parseInt(i);break;case u.BOOL:h(i=="true"||i=="false"),l=i=="true";break}switch(this.scalar(e,n.K,1,l,!0),n.V.kind){case"scalar":this.scalar(e,n.V.T,2,r,!0);break;case"enum":this.scalar(e,u.INT32,2,r,!0);break;case"message":this.message(e,t,n.V.T(),2,r);break}e.join()}message(e,t,n,i,r){r!==void 0&&(n.internalBinaryWrite(r,e.tag(i,c.LengthDelimited).fork(),t),e.join())}scalar(e,t,n,i,r){let[l,o,a]=this.scalarInfo(t,i);(!a||r)&&(e.tag(n,l),e[o](i))}packed(e,t,n,i){if(!i.length)return;h(t!==u.BYTES&&t!==u.STRING),e.tag(n,c.LengthDelimited),e.fork();let[,r]=this.scalarInfo(t);for(let l=0;l(t[t.TAB_NONE=0]="TAB_NONE",t[t.TAB_INTRODUCTION=1]="TAB_INTRODUCTION",t))(Ft||{}),Ve=(a=>(a[a.UNKNOWN=0]="UNKNOWN",a[a.UGC_HEADLINE=3]="UGC_HEADLINE",a[a.ACTIVITY=18]="ACTIVITY",a[a.RELATED_RECOMMEND=28]="RELATED_RECOMMEND",a[a.PAY_BAR=29]="PAY_BAR",a[a.SPECIALTAG=37]="SPECIALTAG",a[a.MERCHANDISE=55]="MERCHANDISE",a[a.VIDEO_MENTIONS=63]="VIDEO_MENTIONS",a))(Ve||{}),Le=(o=>(o[o.CARD_TYPE_UNKNOWN=0]="CARD_TYPE_UNKNOWN",o[o.AV=1]="AV",o[o.GAME=4]="GAME",o[o.CM_TYPE=5]="CM_TYPE",o[o.LIVE=6]="LIVE",o[o.AI_RECOMMEND=7]="AI_RECOMMEND",o[o.COURSE=11]="COURSE",o))(Le||{}),xe=class extends w{constructor(){super("bilibili.app.viewunite.v1.ViewReply",[{no:3,name:"req_user",kind:"message",T:()=>be},{no:5,name:"tab",kind:"message",T:()=>ge},{no:7,name:"cm",kind:"scalar",opt:!0,T:12}])}create(e){let t=globalThis.Object.create(this.messagePrototype);return e!==void 0&&g(this,t,e),t}internalBinaryRead(e,t,n,i){let r=i??this.create(),l=e.pos+t;for(;e.poswe}])}create(e){let t=globalThis.Object.create(this.messagePrototype);return t.tabModule=[],e!==void 0&&g(this,t,e),t}internalBinaryRead(e,t,n,i){let r=i??this.create(),l=e.pos+t;for(;e.pos["bilibili.app.viewunite.v1.TabType",Ft]},{no:2,name:"introduction",kind:"message",oneof:"tab",T:()=>ke}])}create(e){let t=globalThis.Object.create(this.messagePrototype);return t.tabType=0,t.tab={oneofKind:void 0},e!==void 0&&g(this,t,e),t}internalBinaryRead(e,t,n,i){let r=i??this.create(),l=e.pos+t;for(;e.posRe}])}create(e){let t=globalThis.Object.create(this.messagePrototype);return t.modules=[],e!==void 0&&g(this,t,e),t}internalBinaryRead(e,t,n,i){let r=i??this.create(),l=e.pos+t;for(;e.pos["bilibili.app.viewunite.v1.ModuleType",Ve]},{no:5,name:"head_line",kind:"message",oneof:"data",T:()=>Be},{no:22,name:"relates",kind:"message",oneof:"data",T:()=>Ie}])}create(e){let t=globalThis.Object.create(this.messagePrototype);return t.type=0,t.data={oneofKind:void 0},e!==void 0&&g(this,t,e),t}internalBinaryRead(e,t,n,i){let r=i??this.create(),l=e.pos+t;for(;e.posNe}])}create(e){let t=globalThis.Object.create(this.messagePrototype);return t.cards=[],e!==void 0&&g(this,t,e),t}internalBinaryRead(e,t,n,i){let r=i??this.create(),l=e.pos+t;for(;e.pos["bilibili.app.viewunite.v1.RelateCardType",Le]},{no:11,name:"cm_stock",kind:"scalar",T:12},{no:12,name:"basic_info",kind:"message",T:()=>Te}])}create(e){let t=globalThis.Object.create(this.messagePrototype);return t.relateCardType=0,t.cmStock=new Uint8Array(0),e!==void 0&&g(this,t,e),t}internalBinaryRead(e,t,n,i){let r=i??this.create(),l=e.pos+t;for(;e.pos(t[t.NONE_TYPE=0]="NONE_TYPE",t[t.VIP_GRADUAL_COLOR=60001]="VIP_GRADUAL_COLOR",t))(ve||{});var $e=class extends w{constructor(){super("bilibili.community.service.dm.v1.DmSegMobileReq",[{no:1,name:"pid",kind:"scalar",T:3},{no:2,name:"oid",kind:"scalar",T:3},{no:3,name:"type",kind:"scalar",T:5},{no:4,name:"segment_index",kind:"scalar",T:3},{no:6,name:"ps",kind:"scalar",T:3},{no:7,name:"pe",kind:"scalar",T:3}])}create(e){let t=globalThis.Object.create(this.messagePrototype);return t.pid="0",t.oid="0",t.type=0,t.segmentIndex="0",t.ps="0",t.pe="0",e!==void 0&&g(this,t,e),t}internalBinaryRead(e,t,n,i){let r=i??this.create(),l=e.pos+t;for(;e.posWe}])}create(e){let t=globalThis.Object.create(this.messagePrototype);return t.elems=[],e!==void 0&&g(this,t,e),t}internalBinaryRead(e,t,n,i){let r=i??this.create(),l=e.pos+t;for(;e.pos["bilibili.community.service.dm.v1.DmColorfulType",ve]},{no:25,name:"type",kind:"scalar",T:5},{no:26,name:"oid",kind:"scalar",T:3},{no:27,name:"dm_from",kind:"scalar",T:5}])}create(e){let t=globalThis.Object.create(this.messagePrototype);return t.id="0",t.progress=0,t.mode=0,t.fontsize=0,t.color=0,t.midHash="",t.content="",t.ctime="0",t.weight=0,t.action="",t.pool=0,t.idStr="",t.attr=0,t.animation="",t.extra="",t.colorful=0,t.type=0,t.oid="0",t.dmFrom=0,e!==void 0&&g(this,t,e),t}internalBinaryRead(e,t,n,i){let r=i??this.create(),l=e.pos+t;for(;e.pos(a[a.UNKNOWN=0]="UNKNOWN",a[a.OGV_GRADE=1]="OGV_GRADE",a[a.UP_PROTECTION=2]="UP_PROTECTION",a[a.CM=3]="CM",a[a.UP_SELECTION=4]="UP_SELECTION",a[a.OPERATION=5]="OPERATION",a[a.VOTE=6]="VOTE",a[a.ESPORTS_GRADE=7]="ESPORTS_GRADE",a))(Qe||{}),Xe=class extends w{constructor(){super("bilibili.main.community.reply.v1.MainListReply",[{no:11,name:"cm",kind:"scalar",opt:!0,T:12},{no:14,name:"top_replies",kind:"message",repeat:2,T:()=>Ke},{no:28,name:"subject_top_cards",kind:"message",repeat:2,T:()=>Ge}])}create(e){let t=globalThis.Object.create(this.messagePrototype);return t.topReplies=[],t.subjectTopCards=[],e!==void 0&&g(this,t,e),t}internalBinaryRead(e,t,n,i){let r=i??this.create(),l=e.pos+t;for(;e.posJe}])}create(e){let t=globalThis.Object.create(this.messagePrototype);return e!==void 0&&g(this,t,e),t}internalBinaryRead(e,t,n,i){let r=i??this.create(),l=e.pos+t;for(;e.posoe}}])}create(e){let t=globalThis.Object.create(this.messagePrototype);return t.message="",t.urls={},e!==void 0&&g(this,t,e),t}internalBinaryRead(e,t,n,i){let r=i??this.create(),l=e.pos+t;for(;e.pos["bilibili.main.community.reply.v1.Type",Qe]}])}create(e){let t=globalThis.Object.create(this.messagePrototype);return t.type=0,e!==void 0&&g(this,t,e),t}internalBinaryRead(e,t,n,i){let r=i??this.create(),l=e.pos+t;for(;e.pos{let t=Ce.fromBinary(s.response.bodyBytes);t.cm=void 0,t.reqUser&&(t.reqUser.elecPlusBtn=void 0);let n=[18,29,37,55,63];return t.tab?.tabModule.forEach(i=>{i.tab.oneofKind==="introduction"&&(i.tab.introduction.modules=i.tab.introduction.modules.filter(r=>n.includes(r.type)?!1:(r.type===3&&r.data.oneofKind==="headLine"?r.data.headLine.label=void 0:r.type===28&&r.data.oneofKind==="relates"&&(r.data.relates.cards=zt(r.data.relates.cards)),!0),[]))}),s.response.bodyBytes=Ce.toBinary(t),e()};function zt(s){let e=[4,5,6,7,11];return s.filter(t=>!e.includes(t.relateCardType)&&!t.cmStock.length&&!t.basicInfo?.uniqueId)}var Lt=(s,e)=>{let{purifyComment:t}=s.argument,n=et.fromBinary(s.response.bodyBytes);n.cm=void 0;let i=[3,5];if(n.subjectTopCards=n.subjectTopCards.filter(r=>!i.includes(r.type)),t){let r=/https:\/\/b23\.tv\/(?:cm|mall)/,l=/淘宝|某宝|天猫|京东|狗东|拼多多|饿了么|美团|转转|妙界|神气小鹿/;n.topReplies=n.topReplies.filter(o=>{let a=o.content?.urls||{},f=o.content?.message||"";return!Object.keys(a).some(d=>r.test(d))&&!r.test(f)&&!l.test(f)})}return s.response.bodyBytes=et.toBinary(n),e()};var tt=async(s,e)=>{let{headers:t,bodyBytes:n,h2_trailers:i}=await Wt(s);return s.response.headers=t,s.response.bodyBytes=n,s.response.h2_trailers=i,e()},Ct=async(s,e)=>{let t=s.request.bodyBytes,n=t[0]?W(t.subarray(5)):t.subarray(5),i=At.fromBinary(n);i.type!==1&&ue();let{pid:r,oid:l}=i,o=le(r),[{headers:a,bodyBytes:f,h2_trailers:d},y]=await Promise.all([Wt(s,1),Qt(o,l)]);if(s.response.headers=a,s.response.bodyBytes=f,s.response.h2_trailers=d,y.length)return s.state.segments=y,e()};async function Wt(s,e=2){let{method:t,url:n,headers:i,bodyBytes:r}=s.request,l=new URL(n),o=["grpc.biliapi.net","app.bilibili.com"],a=o.indexOf(l.hostname),f=Math.min(a+e,o.length);for(let d=a;d(t==="skip"&&n[1]-n[0]>=8&&e.push(n),e),[])}var $t=(s,e)=>{let t=_e.fromBinary(s.response.bodyBytes);return t.elems.push(...tn(s.state.segments)),s.response.bodyBytes=_e.toBinary(t),e()};function tn(s){return s.map((t,n)=>{let i=String(n+1),r=Math.floor(t[0]*1e3)+2e3,l=Math.floor(t[1]*1e3);return{id:i,progress:r,mode:5,fontsize:50,color:16777215,midHash:"1948dd5d",content:"\u7A7A\u6307\u90E8\u5DF2\u5C31\u4F4D",ctime:"1735660800",weight:11,action:`airborne:${l}`,pool:0,idStr:i,attr:1310724,animation:"",extra:"",colorful:0,type:1,oid:"212364987",dmFrom:1}})}var S=new _({matchPath:ft});S.post("v1.DM/DmSegMobile",Ct,v,$t);S.post("viewunite.v1.View/View",tt,v,Vt);S.post("v1.Reply/MainList",tt,v,Lt);var nt=new q;nt.use(st).use(at).use(lt).use(S.routes()).use(S.routeNotMatched());nt.run();