PageSourceSearch

https://modrinth.com/_nuxt/J0qZ0mnJ.js

js modrinth.com collected 2026-09-24 09:09:33 UTC 37,136 bytes, 12 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./B95hnibr.js","./BQ7Ybl0L.js","./DvgxvNL0.js","./entry.CS40kdde.css","./DMa9lCt8.js","./BnONrIGD.js"])))=>i.map(i=>d[i]);
2import{o,a as d,b as n,d as ot,c as h,z as q,j as c,p as b,ac as Ft,v as i,k as s,bc as Jt,V as it,aX as qt,aU as Ht,aW as Wt,r as le,a_ as Ze,ai as Re,b2 as Yt,w as Le,am as Gt,n as x,m as $,F as C,y as ae,as as Qe,Q as g,cy as Me,bN as Kt,aJ as X,_ as L,da as J,q as u,J as Zt,cs as Qt,dk as Xt,bl as es,fT as ts,b3 as ss,ez as Xe,gt as ns,H as et,cw as rs,c1 as ls,E as as,T as os,B as is,P as ds,cZ as tt,R as st,gA as us,e5 as cs,gB as ps}from"./DvgxvNL0.js";import{_ as fs}from"./DxLa6F7e.js";import{_ as ms}from"./BtJK9Gh1.js";import{_ as nt}from"./m7MBEAIv.js";import{_ as rt}from"./Bg3NgDeQ.js";import{_ as gs}from"./id9sXQe_.js";import{_ as lt}from"./BnYmAWDS.js";import{_ as ys}from"./C6ZpWnnc.js";import{_ as vs}from"./BdoLP461.js";import{M as xs}from"./BjU-IAMN.js";import{N as hs}from"./BuVIxg8d.js";import"./BT-X2sQH.js";import"./BiDyM4rQ.js";import"./0Xf0gEog.js";import"./BmilNSRs.js";import"./Ba6enZVq.js";import"./DQSAL0As.js";const bs={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",viewBox:"0 0 24 24"};function _s(y,I){return o(),d("svg",bs,[...I[0]||(I[0]=[n("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4",opacity:".25"},null,-1),n("path",{fill:"currentColor",d:"M4 12a8 8 0 0 1 8-8V0C5.373 0 0 5.373 0 12zm2 5.291A7.96 7.96 0 0 1 4 12H0c0 3.042 1.135 5.824 3 7.938z",opacity:".75"},null,-1)])])}const ws={render:_s},Ts={key:0,class:"flex items-center justify-between"},Ss={key:1,class:"flex items-center gap-1 text-sm text-secondary"},ks=["aria-valuenow","aria-label"],Es=ot({__name:"ProgressBar",props:{progress:{},max:{default:1},color:{default:"brand"},waiting:{type:Boolean,default:!1},fullWidth:{type:Boolean,default:!1},striped:{type:Boolean,default:!1},gradientBorder:{type:Boolean,default:!0},animated:{type:Boolean,default:!0},label:{},labelClass:{},showProgress:{type:Boolean,default:!1}},setup(y){const I=y,oe={brand:{fg:"bg-brand",bg:"bg-brand-highlight"},green:{fg:"bg-green",bg:"bg-bg-green"},red:{fg:"bg-red",bg:"bg-bg-red"},orange:{fg:"bg-orange",bg:"bg-bg-orange"},blue:{fg:"bg-blue",bg:"bg-bg-blue"},purple:{fg:"bg-purple",bg:"bg-bg-purple"},gray:{fg:"bg-gray",bg:"bg-bg-gray"}},H=h(()=>I.progress/I.max);return(we,De)=>(o(),d("div",{class:q(["flex w-full flex-col gap-2",y.fullWidth?"":"max-w-[15rem]"])},[y.label||y.showProgress?(o(),d("div",Ts,[y.label?(o(),d("span",{key:0,class:q(y.labelClass)},c(y.label),3)):b("",!0),y.showProgress?(o(),d("div",Ss,[n("span",null,c(Math.round(H.value*100))+"%",1),Ft(we.$slots,"progress-icon",{},()=>[i(s(ws),{class:"size-5 animate-spin","aria-hidden":"true"})],!0)])):b("",!0)])):b("",!0),n("div",{role:"progressbar","aria-valuenow":y.waiting?void 0:Math.round(H.value*100),"aria-valuemin":"0","aria-valuemax":"100","aria-label":y.label||void 0,class:q(["flex h-2 w-full overflow-hidden rounded-full",[oe[I.color].bg]])},[n("div",{class:q(["rounded-full progress-bar",[oe[I.color].fg,{"progress-bar--animated":y.animated},{"progress-bar--waiting":y.waiting},{"progress-bar--gradient-border":y.gradientBorder},y.striped?`progress-bar--striped--${y.color}`:""]]),style:Jt(y.waiting?{}:{width:`${H.value*100}%`})},null,6)],10,ks)],2))}}),As=it(Es,[["__scopeId","data-v-7a86fc99"]]),$s={class:"flex flex-col gap-1"},Cs={key:0,class:"flex items-center justify-between gap-2"},Is={class:"relative overflow-hidden rounded-[20px] border border-solid border-surface-4 shadow-sm"},Ps={key:1,class:"flex h-64 items-center justify-center bg-bg-raised"},js={key:0,role:"alert",class:"border-red/40 max-h-64 overflow-auto rounded-lg border bg-highlight-red p-3 text-red"},Rs={class:"rule-test-error"},Ls={class:"flex w-fit items-center gap-1 text-sm text-link",href:"https://cel.dev/reference/api-reference",target:"_blank",rel:"noopener noreferrer"},Ms={class:"rounded-xl border border-divider bg-bg-raised p-3"},Ds={key:0,class:"mt-3 flex items-center gap-2 text-secondary"},Os={key:1,class:"m-0 mt-3 text-sm text-red"},Ns={key:2,class:"mt-3 grid gap-3 md:grid-cols-2"},Vs={class:"min-w-0"},Us={class:"m-0 overflow-x-auto rounded-lg bg-surface-1 p-3 text-xs leading-relaxed text-contrast"},zs={class:"min-w-0"},Bs={class:"m-0 overflow-x-auto rounded-lg bg-surface-1 p-3 text-xs leading-relaxed text-contrast"},Fs={class:"mt-2 flex flex-col gap-3"},Js={key:0,role:"alert",class:"border-orange/40 flex items-start gap-2 rounded-lg border bg-highlight-orange p-3 text-orange"},qs={class:"m-0 text-sm"},Hs={class:"flex items-center justify-between gap-3"},Ws={class:"grid items-stretch gap-3 md:grid-cols-[minmax(0,2fr)_auto_minmax(0,1fr)]"},Ys={class:"universal-card flex min-w-0 flex-col gap-3"},Gs={class:"flex flex-wrap items-center justify-between gap-2"},Ks={class:"grid gap-3 sm:grid-cols-2"},Zs={class:"flex min-w-0 flex-col gap-1 text-sm font-semibold text-contrast"},Qs={class:"flex min-w-0 flex-col gap-1 text-sm font-semibold text-contrast"},Xs={class:"flex min-w-0 flex-col gap-1 text-sm font-semibold text-contrast"},en=["value"],tn={class:"flex min-w-0 flex-col gap-1 text-sm font-semibold text-contrast"},sn={class:"flex min-w-0 flex-col gap-1 text-sm font-semibold text-contrast"},nn={class:"flex min-w-0 flex-col gap-1 text-sm font-semibold text-contrast"},rn={key:0,class:"m-0 text-sm text-red"},ln={key:0,class:"m-0 text-sm text-red"},an={class:"universal-card flex min-w-0 flex-col gap-3"},on={key:0,class:"flex items-center gap-2 text-secondary"},dn={key:1,class:"m-0 text-sm text-secondary"},un={key:2,class:"flex items-center gap-2 text-secondary"},cn={key:3,class:"flex flex-col gap-2"},pn={class:"m-0 text-sm text-secondary"},fn={class:"flex flex-wrap items-center gap-2"},mn={class:"break-all text-contrast"},gn={class:"m-0 text-sm text-secondary"},yn={class:"flex justify-end gap-2"},vn={class:"flex flex-col gap-6"},xn={class:"flex flex-wrap items-center justify-between gap-3"},hn={class:"flex items-center gap-3"},bn={class:"flex flex-wrap gap-2"},_n={key:0,class:"universal-card flex flex-col gap-3 tabular-nums"},wn={class:"flex flex-wrap items-center justify-between gap-2"},Tn={key:0,class:"text-sm font-semibold capitalize text-secondary"},Sn={key:1,class:"universal-card flex h-32 items-center justify-center"},kn={key:2,class:"universal-card flex flex-col items-center gap-3 py-8"},En={key:4,class:"flex flex-col gap-3"},An={class:"flex flex-wrap items-start justify-between gap-3"},$n={class:"m-0 text-lg font-bold text-contrast"},Cn={class:"mt-1 flex items-center gap-2 text-sm text-secondary"},In={class:"mt-2 flex flex-wrap items-center gap-1.5"},Pn={class:"flex gap-2"},jn={class:"m-0 overflow-x-auto rounded-lg bg-bg-raised p-3 text-sm"},Rn={class:"flex flex-col gap-2"},Ln={class:"flex flex-wrap items-center justify-between gap-2"},Mn={class:"m-0 text-sm font-semibold text-contrast"},Dn={class:"flex cursor-pointer items-center gap-2 text-sm text-secondary"},On={key:0,class:"m-0 text-sm text-secondary"},Nn={key:1,class:"flex flex-col gap-2"},Vn={class:"min-w-0"},Un={class:"mb-1 flex min-w-0 items-center gap-1.5 text-sm"},zn={class:"truncate"},Bn={key:1,class:"text-secondary"},Fn={class:"flex min-w-0 flex-wrap items-center gap-2"},Jn={key:1,class:"flex items-center gap-1 text-xs font-semibold text-secondary"},qn={class:"truncate text-sm text-contrast"},Hn={class:"m-0 mt-0.5 flex min-w-0 items-center gap-1 font-mono text-xs text-secondary"},Wn={key:0,class:"mt-1 flex flex-wrap items-center justify-between gap-2"},Yn={class:"m-0 flex items-center gap-2 text-sm text-secondary"},at=`#define ISSUE_TYPE "OBFUSCATED_NAMES"
3
4trace.issue_type == ISSUE_TYPE
5	? "low"
6	: null`,_e=3,Gn=8,Kn=ot({__name:"rules",setup(y){const I=[...["true","false","null","in"].map(t=>({value:t,score:900,meta:"keyword"})),{caption:"has()",snippet:"has(${1:field})",score:850,meta:"macro"},{caption:"size()",snippet:"size(${1:value})",score:850,meta:"function"},{caption:"string()",snippet:"string(${1:value})",score:850,meta:"function"},{caption:"int()",snippet:"int(${1:value})",score:850,meta:"function"},{caption:"or_null()",snippet:"or_null(${1:field})",score:850,meta:"function"},{caption:"url.parse()",snippet:'url.parse("${1:url}")',score:850,meta:"URL"},{caption:"url.is_valid()",snippet:'url.is_valid("${1:url}")',score:850,meta:"URL"},{caption:"#define",snippet:"#define ${1:NAME} ${2:value}",score:800,meta:"preprocessor"},{caption:"#bind",snippet:"#bind ${1:NAME} ${2:expression}",score:800,meta:"preprocessor"}],oe=[{caption:"contains()",snippet:'contains("${1:value}")',score:800,meta:"string"},{caption:"startsWith()",snippet:'startsWith("${1:prefix}")',score:800,meta:"string"},{caption:"endsWith()",snippet:'endsWith("${1:suffix}")',score:800,meta:"string"},{caption:"matches()",snippet:'matches("${1:pattern}")',score:800,meta:"regex"},{caption:"all()",snippet:"all(${1:item}, ${2:predicate})",score:750,meta:"list macro"},{caption:"exists()",snippet:"exists(${1:item}, ${2:predicate})",score:750,meta:"list macro"},{caption:"exists_one()",snippet:"exists_one(${1:item}, ${2:predicate})",score:750,meta:"list macro"},{caption:"filter()",snippet:"filter(${1:item}, ${2:predicate})",score:750,meta:"list macro"},{caption:"map()",snippet:"map(${1:item}, ${2:expression})",score:750,meta:"list macro"}],H={id:"delphi-cel",triggerCharacters:["."],getCompletions(t,e,a,r,l){const k=e.getLine(a.row).slice(0,Math.max(0,a.column-r.length)).match(/([A-Za-z_][\w.]*)\.$/)?.[1];if(!k){l(null,[...He(),...I]);return}const V=He(k);if(V.length>0){l(null,V);return}l(null,oe)}},we={useWorker:!1,tabSize:2,useSoftTabs:!0,enableBasicAutocompletion:[H],enableLiveAutocompletion:[H],liveAutocompletionDelay:150,liveAutocompletionThreshold:1,enableSnippets:!0},De=[{label:"Fields",value:"fields"},{label:"Raw CEL JSON",value:"json"}],Oe=["low","medium","high","severe","malware","hidden"],dt={schema_version:1,scan:{delphi_version:17},artifact:{size:412892,hashes:{sha1:"0123456789abcdef",sha512:"fedcba9876543210"}},project:{id:"example-project",types:["mod"]},version:{id:"example-version",loaders:["fabric"]},file:{id:"example-file"}};function Te(){return{key:"known-safe:obfuscated-bootstrap",issueType:"OBFUSCATED_NAMES",severity:"high",jar:"META-INF/jars/embedded.jar",filePath:"com/example/Bootstrap.class",data:JSON.stringify({confidence:.97,symbol_count:42},null,2)}}qt({title:"Delphi rules - Modrinth"});const P=Ht(),{addNotification:M}=Wt(),ie=Me("ruleModal"),Ne=Me("deleteModal"),Ve=Me("scanModal"),Se=Qe(null),de=Qe(null),ke=g([]),Ee=g(!0),ee=g(!1),_=g(!1),D=g(!1),ue=g(!1),te=g(!1),Ae=g(!1),ce=g(null),j=g(null),se=g(null),pe=g(null),fe=g([]),O=g
6(null),N=g(null),T=g("fields"),R=g(""),S=g(null),W=g(null),z=[],B=le(new Map),Y=le(new Set),ne=le(new Set),p=le({name:"",priority:0,rule:at,onIssueTypes:[]}),m=le(Te());let G=0,me=null;Ze(async()=>{const[{VAceEditor:t}]=await Promise.all([Re(()=>import("./B95hnibr.js"),__vite__mapDeps([0,1,2,3]),import.meta.url),Re(()=>import("./DMa9lCt8.js"),__vite__mapDeps([4,2,3,1]),import.meta.url)]);await Re(()=>import("./BnONrIGD.js").then(e=>e.e),__vite__mapDeps([5,2,3]),import.meta.url),Se.value=t});const ut=h(()=>se.value===null?"Create rule":"Edit rule"),Ue=h(()=>{const t=W.value;if(t===null)return null;if(t<60){const l=Math.max(1,Math.ceil(t));return`${l} second${l===1?"":"s"}`}const e=Math.ceil(t/60);if(e<60)return`${e} minute${e===1?"":"s"}`;const a=Math.floor(e/60),r=e%60;return r===0?`${a}h`:`${a}h ${r}m`}),ct=h(()=>{const t=S.value;if(!t)return"Preparing scan...";const e=`${t.scanned.toLocaleString()} of ${t.total.toLocaleString()} details scanned · ${t.effects.toLocaleString()} effects`;return Ue.value?`${e} · About ${Ue.value} remaining`:e}),{data:pt,isPending:ze,isError:Be,isFetching:Fe,refetch:ft}=Yt({queryKey:["delphi","issue-types","schema"],queryFn:()=>P.labrinth.tech_review_internal.getIssueTypeSchema(),staleTime:6e4}),mt=h(()=>[...new Set([...Object.keys(pt.value??{}),...p.onIssueTypes])].sort((t,e)=>t.localeCompare(e)).map(t=>({value:t,label:t}))),gt=h(()=>j.value?F(j.value.input,j.value.components):""),yt=h(()=>j.value?F(j.value.output,j.value.components):""),ge=h(()=>{if(!R.value.trim())return{input:null,error:null};let t;try{t=JSON.parse(R.value)}catch{return{input:null,error:"Enter valid CEL JSON."}}if(typeof t!="object"||t===null||Array.isArray(t))return{input:null,error:"CEL JSON must be an object."};const e=t.trace;if(typeof e!="object"||e===null||Array.isArray(e))return{input:null,error:"CEL JSON must include a trace object."};const{issue_type:a,severity:r}=e;return typeof a!="string"?{input:null,error:"CEL JSON trace.issue_type must be a string."}:Oe.includes(r)?{input:t,error:null}
6:{input:null,error:"CEL JSON trace.severity is invalid."}}),ye=h(()=>ge.value.error),vt=h(()=>T.value==="json"&&!R.value.trim()),xt=h(()=>T.value==="fields"?N.value:ye.value),ve=h(()=>T.value==="fields"?m.issueType:ge.value.input?.trace.issue_type),ht=h(()=>T.value==="fields"?m.severity:ge.value.input?.trace.severity),bt=h(()=>ve.value!==void 0&&p.onIssueTypes.length>0&&!p.onIssueTypes.includes(ve.value)),K=h(()=>{const t=fe.value[0]??null,e=ht.value??"low",a=t?.severity??e;let r;return t?t.severity!==e?r=`Severity changed from ${e} to ${t.severity}.`:r="The rule matched without changing the severity.":r="This rule would not change the trace.",{effect:t,effectiveSeverity:a,summary:r}});function Je(t){return t.current_revision===void 0||t.revision===t.current_revision}function qe(t){switch(t){case"malware":case"severe":return"border-red/60 bg-highlight-red text-red";case"high":return"border-orange/60 bg-highlight-orange text-orange";case"medium":return"border-green/60 bg-highlight-green text-green";case"hidden":return"border-divider bg-surface-2 text-secondary";default:return"border-blue/60 bg-highlight-blue text-blue"}}function A(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function $e(t,e){let a=t;const r=new Set;for(;typeof a.$ref=="string";){const l=decodeURIComponent(a.$ref.split("/").at(-1)??"");if(!l||r.has(l)||!e[l])break;r.add(l),a=e[l]}return a}function _t(t,e){if(typeof t.$ref=="string")return decodeURIComponent(t.$ref.split("/").at(-1)??"")||"context";const a=$e(t,e);return(Array.isArray(a.type)?a.type.filter(l=>typeof l=="string"):typeof a.type=="string"?[a.type]:[]).join(" | ")||"context"}function He(t){const e=j.value;if(!e)return[];let a=e.input;for(const l of t?.split(".")??[]){const v=$e(a,e.components);if(!A(v.properties))return[];const k=v.properties[l];if(!A(k))return[];a=k}const r=$e(a,e.components);return A(r.properties)?Object.entries(r.properties).filter(l=>A(l[1])).map(([l,v])=>({value:l,score:1e3,meta:_t(v,e.components)})):[]}function F(t,e,a=0,r=new Set){if(typeof t.$ref=="string"){const f=decodeURIComponent(t.$ref.split("/").at(-1)??"");if(r.has(f))return f||"unknown";const U=e[f];if(!U)return f||"unknown";const he=new Set(r);return he.add(f),F(U,e,a,he)}const l=t,v=[l.oneOf,l.anyOf].find(Array.isArray);if(v)return v.filter(A).map(f=>F(f,e,a,r)).join(" | ");if(Array.isArray(l.enum))return l.enum.map(f=>JSON.stringify(f)).join(" | ");const k=Array.isArray(l.type)?l.type.filter(f=>typeof f=="string"):typeof l.type=="string"?[l.type]:[],V=l.nullable===!0||k.includes("null"),E=k.find(f=>f!=="null");let w;if(E==="object"||A(l.properties)||l.additionalProperties){const f=A(l.properties)?l.properties:{},U=new Set(Array.isArray(l.required)?l.required.filter(Q=>typeof Q=="string"):[]),he="  ".repeat(a),je="  ".repeat(a+1),be=Object.entries(f).filter(Q=>A(Q[1])).map(([Q,Bt])=>`${je}${JSON.stringify(Q)}${U.has(Q)?"":"?"}: ${F(Bt,e,a+1,r)}`);A(l.additionalProperties)?be.push(`${je}[key: string]: ${F(l.additionalProperties,e,a+1,r)}`):l.additionalProperties===!0&&be.push(`${je}[key: string]: unknown`),w=be.length===0?"{}":`{
7${be.join(`,
8`)}
9${he}}`}else E==="array"?w=A(l.items)?`Array<${F(l.items,e,a,r)}>`:"unknown[]":E==="integer"||E==="number"?w="number":E==="boolean"||E==="string"||E==="null"?w=E:w="unknown";return V&&w!=="null"?`${w} | null`:w}function wt(t){de.value=t,t.session.setUseWrapMode(!0)}function Tt(t){p.rule=t,xe()}function St(){if(T.value==="json")return ge.value.input;let t;try{t=JSON.parse(m.data)}catch{return N.value="Enter valid JSON data for the trace.",null}if(typeof t!="object"||t===null||Array.isArray(t))return N.value="Trace data must be a JSON object.",null;N.value=null;const e={key:m.key,issue_type:m.issueType,severity:m.severity,jar:m.jar.trim()||null,file_path:m.filePath,data:t};return{...dt,trace:e,file_traces:[e]}}async function Ce(){if(!te.value)return;const t=++G,e=p.rule.trim();if(fe.value=[],O.value=null,N.value=null,!e){D.value=!1,O.value={summary:"Enter a CEL expression to test it.",details:[]};return}const a=St();if(!a){D.value=!1;return}D.value=!0;try{const r=await P.labrinth.tech_review_internal.testRule({rule:e,inputs:[a]});if(t!==G)return;fe.value=r.effects}catch(r){if(t!==G)return;const l=r instanceof ps&&Array.isArray(r.v1Error?.details)?r.v1Error.details.filter(v=>typeof v=="string"):[];O.value={summary:r instanceof Error?r.message:"The rule could not be tested.",details:l}}finally{t===G&&(D.value=!1)}}const kt=cs(Ce,350);function xe(){te.value&&(G+=1,fe.value=[],O.value=null,D.value=!0,kt())}Le(m,()=>{T.value==="fields"&&xe()},{flush:"sync"}),Le(R,()=>{T.value==="json"&&xe()},{flush:"sync"}),Le(T,xe,{flush:"sync"});async function re(){Ee.value=!0,Ae.value=!1;try{ke.value=await P.labrinth.tech_review_internal.getRules(),B.clear(),ne.clear()}catch(t){console.error("Failed to load Delphi rules",t),Ae.value=!0}finally{Ee.value=!1}}async function We(){if(!(j.value||ue.value)){ue.value=!0,ce.value=null;try{j.value=await P.labrinth.tech_review_internal.getRuleSchema()}catch(t){console.error("Failed to load Delphi rule schema",t),ce.value="The rule input and output schema could not be loaded."}finally{ue.value=!1}}}function Et(t){return B.get(t.id)?.details??t.affected_details}function Ie(t){return B.get(t.id)?.page??1}function Z(t){return B.get(t.id)?.total??t.affected_details_count}function Ye(t){return Math.max(Math.ceil(Z(t)/_e),1)}function At(t){return Z(t)===0?0:(Ie(t)-1)*_e+1}function $t(t){return Math.min(Ie(t)*_e,Z(t))}function Ct(t){return`/moderation/technical-review/${t.project_id}?detail=${encodeURIComponent(t.detail_id)}`}function It(t){return`/project/${t.project_id}`}function Pt(t){return`/project/${t.project_id}/version/${t.version_id}`}function Pe(t){return ne.has(t.id)}async function jt(t,e){Y.has(t.id)||(e?(ne.add(t.id),await Ge(t,1)||ne.delete(t.id)):(ne.delete(t.id),B.delete(t.id)))}async function Rt(t,e){if(!Y.has(t.id)){if(e===1&&!Pe(t)){B.delete(t.id);return}await Ge(t,e)}}async function Ge(t,e){Y.add(t.id);try{const a=await P.labrinth.tech_review_internal.getRuleAffectedDetail
9s(t.id,{limit:_e,page:e-1,processing_only:Pe(t)});return B.set(t.id,{page:e,total:a.total,details:a.details}),!0}catch(a){return console.error("Failed to load details affected by Delphi rule",a),M({type:"error",title:"Failed to load affected details",text:"The requested page of affected details could not be loaded."}),!1}finally{Y.delete(t.id)}}function Lt(){_.value||(se.value=null,p.name="",p.priority=0,p.rule=at,p.onIssueTypes=[],Object.assign(m,Te()),T.value="fields",R.value="",te.value=!0,ie.value?.show(),st(()=>de.value?.resize(!0)),We(),Ce())}function Mt(t){_.value||(se.value=t.id,p.name=t.name,p.priority=t.priority,p.rule=t.rule,p.onIssueTypes=[...t.on_issue_types],Object.assign(m,Te()),T.value="fields",R.value="",te.value=!0,ie.value?.show(),st(()=>de.value?.resize(!0)),We(),Ce())}function Ke(){ie.value?.hide()}function Dt(){te.value=!1,de.value=null,G+=1,D.value=!1}async function Ot(){if(ee.value||_.value)return;const t=p.priority;if(!p.name.trim()||!p.rule.trim()||typeof t!="number"||!Number.isInteger(t)||t<-2147483648||t>2147483647){M({type:"error",title:"Invalid rule",text:"Enter a name, an integer priority, and a CEL expression."});return}ee.value=!0;const e={name:p.name,priority:t,rule:p.rule,on_issue_types:p.onIssueTypes};try{se.value===null?await P.labrinth.tech_review_internal.createRule(e):await P.labrinth.tech_review_internal.updateRule(se.value,e),Ke(),M({type:"success",title:"Rule saved",text:"The rule will take effect after the next manual scan."}),await re()}catch(a){console.error("Failed to save Delphi rule",a),M({type:"error",title:"Failed to save rule",text:"Check the CEL expression and try again."})}finally{ee.value=!1}}function Nt(t){_.value||(pe.value=t,Ne.value?.show())}async function Vt(){if(_.value)return;const t=pe.value;if(t)try{await P.labrinth.tech_review_internal.deleteRule(t.id),M({type:"success",title:"Rule deleted",text:`${t.name} will be removed by the next manual scan.`}),await re()}catch(e){console.error("Failed to delete Delphi rule",e),M({type:"error",title:"Failed to delete rule",text:"The Delphi rule could not be deleted."})}finally{pe.value=null}}function Ut(t){if(S.value=t,t.phase!=="scanning"||t.total===0||t.scanned>=t.total){W.value=null;return}const e=z.at(-1);(!e||t.scanned>e.scanned)&&(z.push({scanned:t.scanned,recordedAt:Date.now()}),z.length>Gn&&z.shift());const a=z[0],r=z.at(-1);if(!a||!r||a===r){W.value=null;return}const l=(r.recordedAt-a.recordedAt)/1e3,v=r.scanned-a.scanned;if(l<=0||v<=0){W.value=null;return}const k=v/l;W.value=(t.total-t.scanned)/k}async function zt(){if(_.value)return;_.value=!0,S.value=null,W.value=null,z.length=0,me=new AbortController;let t=!1;try{const a=(await P.labrinth.tech_review_internal.scanRules(me.signal)).getReader(),r=new TextDecoder,l=new us,v=E=>{let w=null;for(const f of E)if(f.kind==="event"){if(f.event==="failed"){const U=JSON.parse(f.data);throw new Error(U.message)}(f.event==="progress"||f.event==="complete")&&(w=JSON.parse(f.data),t||=f.event==="complete")}return w?(Ut(w),!0):!1};for(;;){const{done:E,value:w}=await a.read();if(E)break;v(l.feed(r.decode(w,{stream:!0})))&&await new Promise(U=>setTimeout(U,0))}const k=r.decode();k&&v(l.feed(k)),v(l.end());const V=S.value;if(!t||!V)throw new Error("The scan stream ended before the new revision was published.");M({type:"success",title:"Rule scan complete",text:`${V.scanned.toLocaleString()} details were scanned for revision ${V.revision}.`}),await re()}catch(e){console.error("Failed to scan Delphi rules",e),M({type:"error",title:"Rule scan failed",text:e instanceof Error?e.message:"The previous rule revision remains active."})}finally{_.value=!1,me=null}}return Ze(re),Gt(()=>me?.abort()),(t,e)=>{const a=ds;return o(),d(C,null,[i(s(hs),{ref_key:"ruleModal",ref:ie,header:s(ut),"on-hide":Dt},{default:x(()=>[n("form",{class:"flex w-[48rem] max-w-full flex-col gap-3",onSubmit:Kt(Ot,["prevent"])},[e[42]||(e[42]=n("label",{class:"font-semibold text-contrast",for:"rule-name"},"Name",-1)),i(s(X),{id:"rule-name",modelValue:s(p).name,"onUpdate:modelValue":e[0]||(e[0]=r=>s(p).name=r),type:"text",maxlength:256,placeholder:"Known-safe obfuscated bootstrap"},null,8,["modelValue"]),e[43]||(e[43]=n("label",{class:"font-semibold text-contrast",for:"rule-priority"}
9,"Priority",-1)),i(s(X),{id:"rule-priority",modelValue:s(p).priority,"onUpdate:modelValue":e[1]||(e[1]=r=>s(p).priority=r),type:"number",min:-2147483648,max:2147483647,step:1},null,8,["modelValue"]),e[44]||(e[44]=n("p",{class:"m-0 text-sm text-secondary"}," Higher-priority rules run first. Rules with the same priority run in creation order. ",-1)),n("div",$s,[e[15]||(e[15]=n("label",{class:"font-semibold text-contrast"},"Issue types",-1)),e[16]||(e[16]=n("p",{class:"m-0 text-sm text-secondary"}," Choose which issue types this rule evaluates. Leave empty to run it against every issue type. ",-1)),i(s(xs),{modelValue:s(p).onIssueTypes,"onUpdate:modelValue":e[2]||(e[2]=r=>s(p).onIssueTypes=r),options:s(mt),disabled:s(ze),placeholder:s(ze)?"Loading issue types…":"All issue types","no-options-message":s(Be)?"Issue types could not be loaded":"No issue types available","search-placeholder":"Search issue types…",searchable:"","fuzzy-search":"",clearable:"","max-tag-rows":2},null,8,["modelValue","options","disabled","placeholder","no-options-message"]),s(Be)?(o(),d("div",Cs,[e[14]||(e[14]=n("p",{class:"m-0 text-sm text-red"},"The available issue types could not be loaded.",-1)),i(s(L),{size:"sm",disabled:s(Fe),onClick:e[3]||(e[3]=r=>s(ft)())},{default:x(()=>[s(Fe)?(o(),$(s(J),{key:0,class:"animate-spin"})):b("",!0),e[13]||(e[13]=u(" Try again ",-1))]),_:1},8,["disabled"])])):b("",!0)]),e[45]||(e[45]=n("label",{class:"font-semibold text-contrast",for:"rule-expression"},"CEL expression",-1)),n("div",Is,[s(Se)?(o(),$(Zt(s(Se)),{key:0,id:"rule-expression",value:s(p).rule,lang:"javascript",theme:"modrinth","print-margin":!1,options:we,style:{height:"16rem",fontSize:"0.875rem"},class:"ace-modrinth rounded-[20px]",onInit:wt,"onUpdate:value":Tt},null,40,["value"])):(o(),d("div",Ps,[i(s(J),{class:"size-8 animate-spin text-secondary"})]))]),s(O)?(o(),d("div",js,[n("code",Rs,[n("span",null,c(s(O).summary),1),(o(!0),d(C,null,ae(s(O).details,(r,l)=>(o(),d("span",{key:l,class:"rule-test-error-detail"},c(r),1))),128))])])):b("",!0),n("a",Ls,[i(s(Qt),{class:"size-4"}),e[17]||(e[17]=u(" CEL API reference ",-1))]),n("details",Ms,[e[24]||(e[24]=n("summary",{class:"cursor-pointer font-semibold text-contrast"}," Input and output schema ",-1)),s(ue)?(o(),d("div",Ds,[i(s(J),{class:"size-4 animate-spin"}),e[18]||(e[18]=u(" Loading schema… ",-1))])):s(ce)?(o(),d("p",Os,c(s(ce)),1)):(o(),d("div",Ns,[n("div",Vs,[e[19]||(e[19]=n("p",{class:"m-0 mb-2 text-xs font-semibold uppercase tracking-wide text-secondary"}," Context ",-1)),n("pre",Us,[n("code",null,c(s(gt)),1)])]),n("div",zs,[e[20]||(e[20]=n("p",{class:"m-0 mb-2 text-xs font-semibold uppercase tracking-wide text-secondary"}," Output ",-1)),n("pre",Bs,[n("code",null,c(s(yt)),1)]),e[21]||(e[21]=n("p",{class:"m-0 mb-2 mt-3 text-xs font-semibold uppercase tracking-wide text-secondary"}," Extensions ",-1)),e[22]||(e[22]=n("ul",{class:"m-0 mb-3 list-disc pl-5 text-sm text-secondary"},[n("li",null,[n("a",{class:"text-link",href:"https://cel.dev/reference/api-reference#general_string_functions",target:"_blank",rel:"noopener noreferrer"}," Regex ")]),n("li",null,[n("code",null,"or_null(field)"),u(" returns the field's value when present or "),n("code",null,"null"),u(" when it is missing. ")]),n("li",null,[n("a",{class:"text-link",href:"https://docs.rs/url/latest/url/struct.Url.html",target:"_blank",rel:"noopener noreferrer"}," URL parsing "),u(" with "),n("code",null,"url.parse(string)"),u(" and "),n("code",null,"url.is_valid(string)"),n("div",{class:"mt-1 text-xs"},[u(" Parsed URLs expose "),n("code",null,"href"),u(", "),n("code",null,"scheme"),u(", "),n("code",null,"host"),u(", "),n("code",null,"domain"),u(", "),n("code",null,"port"),u(", "),n("code",null,"path"),u(", "),n("code",null,"path_segments"),u(", "),n("code",null,"query"),u(", "),n("code",null,"query_pairs"),u(", "),n("code",null,"fragment"),u(", credentials, and origin fields. ")])])],-1)),e[23]||(e[23]=n("pre",{class:"m-0 overflow-x-auto rounded-lg bg-surface-1 p-3 text-xs leading-relaxed text-contrast"},[n("code",null,`#define ISSUE_TYPE "OBFUSCATED_NAMES"
10#bind IS_MATCH trace.issue_type == ISSUE_TYPE
11
12IS_MATCH ? "low" : null`)],-1))])]))]),n("section",Fs,[s(bt)?(o(),d("div",Js,[i(s(Xt),{class:"mt-0.5 size-5 shrink-0"}),n("p",qs,[e[25]||(e[25]=u(" The test trace issue type ",-1)),n("strong",null,c(s(ve)||"(empty)"),1),e[26]||(e[26]=u(" is not selected for this rule. The CEL expression is still evaluated in this preview, but the rule will not run for this issue type during a scan. ",-1))])])):b("",!0),n("div",Hs,[e[27]||(e[27]=n("div",null,[n("h3",{class:"m-0 text-base font-bold text-contrast"},"Test trace"),n("p",{class:"m-0 text-sm text-secondary"}," Change the trace details to evaluate the current expression. ")],-1)),s(D)?(o(),$(s(J),{key:0,class:"size-5 animate-spin text-secondary"})):b("",!0)]),n("div",Ws,[n("article",Ys,[n("div",Gs,[e[28]||(e[28]=n("p",{class:"m-0 text-xs font-semibold uppercase tracking-wide text-secondary"}," Trace details ",-1)),i(s(ms),{value:s(T),tabs:De,"aria-label":"Test trace input format","onUpdate:value":e[4]||(e[4]=r=>T.value=r)}
12,null,8,["value"])]),s(T)==="fields"?(o(),d(C,{key:0},[n("div",Ks,[n("label",Zs,[e[29]||(e[29]=u(" Key ",-1)),i(s(X),{modelValue:s(m).key,"onUpdate:modelValue":e[5]||(e[5]=r=>s(m).key=r),placeholder:"unique-trace-key"},null,8,["modelValue"])]),n("label",Qs,[e[30]||(e[30]=u(" Issue type ",-1)),i(s(X),{modelValue:s(m).issueType,"onUpdate:modelValue":e[6]||(e[6]=r=>s(m).issueType=r),placeholder:"OBFUSCATED_NAMES"},null,8,["modelValue"])]),n("label",Xs,[e[31]||(e[31]=u(" Severity ",-1)),es(n("select",{"onUpdate:modelValue":e[7]||(e[7]=r=>s(m).severity=r),class:"h-9 w-full rounded-xl border-none bg-surface-4 px-3 font-medium capitalize text-primary outline-none focus:ring-4 focus:ring-brand-shadow"},[(o(),d(C,null,ae(Oe,r=>n("option",{key:r,value:r},c(r),9,en)),64))],512),[[ts,s(m).severity]])]),n("label",tn,[e[32]||(e[32]=u(" JAR ",-1)),i(s(X),{modelValue:s(m).jar,"onUpdate:modelValue":e[8]||(e[8]=r=>s(m).jar=r),placeholder:"META-INF/jars/embedded.jar"},null,8,["modelValue"])])]),n("label",sn,[e[33]||(e[33]=u(" File path ",-1)),i(s(X),{modelValue:s(m).filePath,"onUpdate:modelValue":e[9]||(e[9]=r=>s(m).filePath=r),placeholder:"com/example/Bootstrap.class"},null,8,["modelValue"])]),n("label",nn,[e[34]||(e[34]=u(" Data (JSON) ",-1)),i(s(nt),{modelValue:s(m).data,"onUpdate:modelValue":e[10]||(e[10]=r=>s(m).data=r),rows:4,resize:"vertical","input-class":"font-mono text-sm",error:!!s(N)},null,8,["modelValue","error"])]),s(N)?(o(),d("p",rn,c(s(N)),1)):b("",!0)],64)):(o(),d(C,{key:1},[e[35]||(e[35]=n("p",{class:"m-0 text-sm text-secondary"}," Paste the complete JSON object produced by the Copy CEL button. ",-1)),i(s(nt),{modelValue:s(R),"onUpdate:modelValue":e[11]||(e[11]=r=>ss(R)?R.value=r:null),rows:16,placeholder:"Paste CEL JSON…",resize:"vertical","input-class":"font-mono text-sm",error:!!s(ye)},null,8,["modelValue","error"]),s(ye)?(o(),d("p",ln,c(s(ye)),1)):b("",!0)],64))]),e[40]||(e[40]=n("div",{class:"flex items-center justify-center text-2xl font-bold text-secondary max-md:rotate-90","aria-hidden":"true"}," → ",-1)),n("article",an,[e[39]||(e[39]=n("p",{class:"m-0 text-xs font-semibold uppercase tracking-wide text-secondary"}," Rule result ",-1)),s(D)?(o(),d("div",on,[i(s(J),{class:"size-5 animate-spin"}),e[36]||(e[36]=n("span",null,"Evaluating…",-1))])):s(vt)||s(xt)||s(O)?(o(),d("p",dn," Preview unavailable. ")):s(K).effectiveSeverity==="hidden"?(o(),d("div",un,[i(s(Xe),{class:"size-5"}),e[37]||(e[37]=n("strong",{class:"text-contrast"},"Hidden from reports",-1))])):s(K).effect?(o(),d(C,{key:4},[n("div",fn,[n("span",{class:q(["rounded-full border px-2 py-0.5 text-xs font-semibold capitalize",qe(s(K).effectiveSeverity)])},c(s(K).effectiveSeverity),3),n("strong",mn,c(s(ve)),1)]),n("p",gn,c(s(K).summary),1)],64)):(o(),d("div",cn,[e[38]||(e[38]=n("strong",{class:"text-contrast"},"No match",-1)),n("p",pn,c(s(K).summary),1)]))])])]),n("div",yn,[i(s(L),{onClick:Ke},{default:x(()=>[...e[41]||(e[41]=[u("Cancel",-1)])]),_:1}),i(s(L),{type:"colored",color:"brand","native-type":"submit",disabled:s(ee)},{default:x(()=>[u(c(s(ee)?"Saving...":"Save rule"),1)]),_:1},8,["disabled"])])],32)]),_:1},8,["header"]),i(s(rt),{ref_key:"deleteModal",ref:Ne,title:`Delete ${s(pe)?.name??"rule"}?`,description:"The rule will stop being included the next time the rules are scanned. Existing effects remain active until then.",markdown:!1,"proceed-label":"Delete rule",onProceed:Vt},null,8,["title"]),i(s(rt),{ref_key:"scanModal",ref:Ve,title:"Run a full Delphi rule scan?",description:"Every stored issue detail will be evaluated against the current rules. Existing effects remain active unless the entire scan succeeds.",markdown:!1,"proceed-label":"Run full scan",onProceed:zt},null,512),n("div",vn,[n("div",xn,[n("div",hn,[i(s(et),{to:"/moderation/technical-review",type:"quiet",class:"!size-10 !rounded-full !p-0","aria-label":"Back to tech review queue"},{default:x(()=>[i(s(ns))]),_:1}),e[46]||(e[46]=n("div",null,[n("h1",{class:"m-0 text-2xl font-bold text-contrast"},"Delphi rules"),n("p",{class:"m-0 text-secondary"},"Transform or hide Delphi issue traces.")],-1))]),n("div",bn,[i(s(L),{disabled:s(_),onClick:e[12]||(e[12]=r=>s(Ve)?.show())},{default:x(()=>[i(s(rs)),u(" "+c(s(_)?"Scanning...":"Run full scan"),1)]),_:1},8,["disabled"]),i(s(L),{type:"colored",color:"brand",disabled:s(_),onClick:Lt},{default:x(()=>[i(s(ls)),e[47]||(e[47]=u(" Create rule ",-1))]),_:1},8,["disabled"])])]),s(_)?(o(),d("section",_n,[n("div",wn,[e[48]||(e[48]=n("h2",{class:"m-0 text-base font-bold text-contrast"},"Scanning Delphi rule effects",-1)),s(S)?(o(),d("span",Tn,c(s(S).phase)+" revision "+c(s(S).revision),1)):b("",!0)]),i(s(As),{progress:s(S)?.scanned??0,max:Math.max(s(S)?.total??0,1),waiting:!s(S)||s(S).total===0&&s(S).phase!=="complete",label:s(ct),"show-progress":s(S)!==null,animated:!1,"label-class":"min-w-0 text-sm text-secondary","full-width":""},null,8,["progress","max","waiting","label","show-progress"])])):b("",!0),s(Ee)?(o(),d("div",Sn,[i(s(J),{class:"size-8 animate-spin text-secondary"})])):s(Ae)?(o(),d("div",kn,[e[50]||(e[50]=n("p",{class:"m-0 text-secondary"},"Failed to load Delphi rules.",-1)),i(s(L),{onClick:re},{default:x(()=>[...e[49]||(e[49]=[u("Try again",-1)])]),_:1})])):s(ke).length===0?(o(),$(s(gs),{key:3,type:"no-search-result",heading:"No Delphi rules",description:"Create a rule to transform matching issue traces."})):(o(),d("div",En,[(o(!0),d(C,null,ae(s(ke),r=>(o(),d("article",{key:r.id,class:"universal-card relative flex flex-col gap-3 overflow-hidden"},[n("div",An,[n("div",null,[n("h2",$n,c(r.name),1),n("div",Cn,[n("span",null,"Priority "+c(r.priority),1),e[51]||(e[51]=n("span",{"aria-hidden":"true"},"·",-1)),n("span",{class:q(["rounded-full border px-2 py-0.5 text-xs font-semibold",Je(r)?"border-green/60 bg-highlight-green text-green":"border-orange/60 bg-highlight-orange text-orange"])},c(Je(r)?"Live":"Outdated"),3)]),n("div",In,[e[53]||(e[53]=n("span",{class:"text-xs font-semibold text-secondary"},"Applies to",-1)),r.on_issue_types.length===0?(o(),$(s(lt),{key:0},{default:x(()=>[...e[52]||(e[52]=[u("All issue types",-1)])]),_:1})):(o(!0),d(C,{key:1},ae(r.on_issue_types,l=>(o(),$(s(lt),{key:l},{default:x(()=>[u(c(l),1)]),_:2},1024))),128))])]),n("div",Pn,[i(s(L),{disabled:s(_),onClick:l=>Mt(r)},{default:x(()=>[i(s(as)),e[54]||(e[54]=u(" Edit ",-1))]),_:1},8,["disabled","onClick"]),i(s(L),{type:"colored",color:"red",disabled:s(_),onClick:l=>Nt(r)},{default:x(()=>[i(s(os)),e[55]||(e[55]=u(" Delete ",-1))]),_:1},8,["disabled","onClick"])])]),n("pre",jn,[n("code",null,c(r.rule),1)]),n("section",Rn,[n("div",Ln,[n("h3",Mn," Affected details ("+c(Z(r).toLocaleStr
12ing())+") ",1),n("label",Dn,[e[56]||(e[56]=u(" Processing projects only ",-1)),i(s(ys),{"model-value":Pe(r),disabled:s(Y).has(r.id),small:"","onUpdate:modelValue":l=>jt(r,l??!1)},null,8,["model-value","disabled","onUpdate:modelValue"])])]),Z(r)===0?(o(),d("p",On," No details are affected in the current revision. ")):(o(),d("div",Nn,[(o(!0),d(C,null,ae(Et(r),l=>(o(),d("div",{key:l.detail_id,class:"flex min-w-0 items-center justify-between gap-3 rounded-lg border border-divider bg-bg-raised px-3 py-2"},[n("div",Vn,[n("div",Un,[l.project_id?(o(),$(a,{key:0,to:It(l),class:"flex min-w-0 items-center gap-1.5 font-semibold text-contrast hover:underline"},{default:x(()=>[i(s(is),{src:l.project_icon_url,alt:l.project_name??"",size:"xs","no-shadow":""},null,8,["src","alt"]),n("span",zn,c(l.project_name??l.project_id),1)]),_:2},1032,["to"])):(o(),d("span",Bn,"Unattached trace")),l.project_id&&l.version_id?(o(),d(C,{key:2},[e[57]||(e[57]=n("span",{class:"shrink-0 text-secondary","aria-hidden":"true"},"·",-1)),i(a,{to:Pt(l),class:"truncate text-secondary hover:underline"},{default:x(()=>[u(c(l.version_name??l.version_number??l.version_id),1)]),_:2},1032,["to"])],64)):b("",!0)]),n("div",Fn,[l.severity!=="hidden"?(o(),d("span",{key:0,class:q(["rounded-full border px-2 py-0.5 text-xs font-semibold capitalize",qe(l.severity)])},c(l.severity),3)):(o(),d("span",Jn,[i(s(Xe),{class:"size-4"}),e[58]||(e[58]=u(" Hidden ",-1))])),n("strong",qn,c(l.issue_type),1)]),n("p",Hn,[i(fs,{segments:[l.jar,l.file_path],"hide-base-mrpack":"",truncate:""},null,8,["segments"])])]),l.project_id?(o(),$(s(et),{key:0,to:Ct(l)},{default:x(()=>[i(s(tt)),e[59]||(e[59]=u(" View ",-1))]),_:1},8,["to"])):(o(),$(s(L),{key:1,disabled:"",title:"This trace is not attached to a project"},{default:x(()=>[i(s(tt)),e[60]||(e[60]=u(" View ",-1))]),_:1}))]))),128)),Ye(r)>1?(o(),d("div",Wn,[n("p",Yn,[s(Y).has(r.id)?(o(),$(s(J),{key:0,class:"size-4 animate-spin"})):b("",!0),u(" Showing "+c(At(r).toLocaleString())+"–"+c($t(r).toLocaleString())+" of "+c(Z(r).toLocaleString()),1)]),i(s(vs),{page:Ie(r),count:Ye(r),onSwitchPage:l=>Rt(r,l)},null,8,["page","count","onSwitchPage"])])):b("",!0)]))])]))),128))]))])],64)}}}),mr=it(Kn,[["__scopeId","data-v-f40ce531"]]);export{mr as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.