@preventive/triage 1.0.0-alpha.41 → 1.0.0-alpha.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/managed/report-filter.ts +2 -1
- package/common/security-links.d.ts +5 -0
- package/common/security-links.js +33 -0
- package/out/{chunk-TY4RZD3Z.js → chunk-7RU5EDRO.js} +61 -61
- package/out/{chunk-XL35ZV6R.js → chunk-A7M4GV7M.js} +1 -1
- package/out/{chunk-2AFQKRAM.js → chunk-CLPKNNC7.js} +7 -7
- package/out/{chunk-UZAZM2SX.js → chunk-LAAB5SZT.js} +1 -1
- package/out/{chunk-KVEUXIEU.js → chunk-NWZ4PVPN.js} +1 -1
- package/out/{chunk-QZ3A376W.js → chunk-OSIMGFUF.js} +1 -1
- package/out/{chunk-U6OPEXIA.js → chunk-XOCAPDCM.js} +1 -1
- package/out/client-managed.js +19 -19
- package/out/index.html +3 -3
- package/out/view.js +54 -54
- package/package.json +9 -3
- package/risk/files/runs-code.js +13 -5
- package/risk/index.d.ts +26 -0
- package/risk/index.js +1 -1
- package/risk/npm/assess.js +60 -14
- package/risk/npm/combined.js +4 -1
- package/risk/npm/compare.js +10 -5
- package/risk/npm/dependencies.js +11 -3
- package/risk/npm/diff.js +42 -6
- package/risk/npm/held.js +5 -2
- package/risk/npm/new-dependency.js +42 -12
- package/risk/npm/registry.js +122 -21
- package/server-managed/http.ts +63 -26
- package/server-managed/locked-packages.ts +18 -6
- package/server-managed/npm-kept.ts +38 -14
- package/server-managed/npm-packages.ts +27 -13
- package/server-managed/npm-risk.ts +69 -11
- package/server-managed/pretty-print.ts +1 -1
- package/server-managed/queue.ts +23 -0
- package/server-managed/report-sources.ts +1 -1
- package/server-managed/repository-risk-assess.ts +105 -0
- package/server-managed/repository-risk-audit.ts +66 -0
- package/server-managed/repository-risk.ts +255 -201
- package/server-managed/scan-downloads.ts +87 -0
- package/server-managed/sql.ts +1 -1
- package/server-managed/team-reports.ts +6 -11
- package/server-managed/type-only-worker.js +3 -3
- package/server-managed/type-only.ts +4 -2
- package/server-managed/upstream-cache.ts +16 -0
package/out/view.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as xt,b as Le,c as zd,d as Tn}from"./chunk-XL35ZV6R.js";import{a as Hd}from"./chunk-KEX2ATEW.js";import{$ as Di,$a as et,$b as zc,$c as Xi,A as fl,Aa as Bi,Ab as Gt,Ac as ed,Ad as Fd,B as gl,Ba as Zl,Bb as $c,Bc as td,Bd as Dd,C as bl,Ca as ec,Cb as xc,Cc as id,D as vl,Da as tc,Db as Sc,Dc as kt,Dd as Zt,E as yl,Ea as an,Eb as Cc,Ec as rd,Ed as Od,F as _l,Fa as ic,Fb as Vi,Fc as nd,Fd as Qi,G as wl,Ga as Vt,Gb as Ki,Gc as sd,Gd as Bd,H as kl,Ha as ln,Hb as Ec,Hc as od,Hd as $t,I as $l,Ia as rc,Ib as Tc,Ic as ad,Id as Nd,J as xl,Ja as de,Jb as Rc,Jc as ld,Jd as fe,K as Fi,Ka as D,Kb as Lc,Kc as Xt,Kd as qd,L as me,La as yt,Lb as Mc,Lc as cd,Ld as St,M as Sl,Ma as Ni,Mb as Wt,Mc as dd,N as Cl,Na as cn,Nb as pn,Nc as ud,O as El,Oa as nc,Ob as Pc,Oc as Sn,P as Tl,Pa as sc,Pb as Ac,Pc as pd,Q as Rl,Qa as oc,Qb as Gi,Qc as hd,R as Je,Ra as ac,Rb as Wi,Rc as Oe,S as Ll,Sa as Kt,Sb as Ic,Sc as md,T as Ml,Ta as _t,Tb as Fc,U as bt,Ua as lc,Ub as hn,V as Pl,Va as wt,Vb as Dc,W as vt,Wa as zi,Wb as mn,X as Al,Xa as dn,Xb as fn,Y as Il,Ya as cc,Yb as Oc,Yc as fd,Z as Fl,Za as dc,Zb as Bc,Zc as Be,_ as Dl,_a as qi,_b as Nc,_c as tt,a as Ja,aa as Ol,ab as uc,ac as qc,ad as Cn,b as Xa,ba as Bl,bb as pc,bc as Yt,bd as it,c as Qa,ca as Nl,cb as hc,cc as gn,cd as gd,d as Za,da as qt,dc as Hc,dd as bd,e as el,ea as Ht,ec as Uc,ed as vd,f as on,fa as zl,fc as jc,fd as yd,g as Ai,ga as ql,gb as mc,gc as bn,gd as _d,h as l,ha as Hl,hb as fc,hc as vn,hd as wd,i as H,ia as Ul,ic as Vc,id as kd,j as nl,ja as Oi,jc as Kc,jd as $d,k as sl,ka as jl,kc as yn,kd as xd,l as ol,la as Vl,lc as _n,ld as Qt,m as al,ma as Xe,mc as Gc,md as En,n as he,na as Kl,nc as Wc,nd as Sd,o as Ii,oa as Gl,ob as un,oc as Yc,od as Cd,p as ll,pa as Qe,pb as Hi,pc as Jt,pd as $,qa as Wl,qb as gc,qc as Yi,ra as Yl,rb as xe,rc as Jc,sa as Ut,sb as bc,sc as Xc,sd as Ed,t as cl,ta as De,tb as Ui,tc as Qc,td as Td,u as dl,ua as Ze,ub as ji,uc as Ji,ud as Rd,v as ul,va as Jl,vb as vc,vc as wn,vd as Ld,w as pl,wa as Xl,wb as yc,wc as kn,wd as Md,x as ke,xa as $e,xb as _c,xc as $n,xd as Pd,y as hl,ya as jt,yb as wc,yc as Zc,yd as Ad,z as ml,za as Ql,zb as kc,zc as xn,zd as Id}from"./chunk-TY4RZD3Z.js";import{a as Ei}from"./chunk-2KBF5TZ7.js";import{b as Ta}from"./chunk-K3X5EJBQ.js";import{a as $a,b as R,c as xa,d as Ge,g as q,h as Y,i as Ca}from"./chunk-CVVJAXVY.js";import{B as gt,D as tl,K as il,O as rl,c as ja,d as we,e as Ye,f as Va,j as Pi,k as Ka,n as Ga,r as Wa,u as Ya}from"./chunk-VIHGO77Y.js";import{u as Ha,z as Ua}from"./chunk-RFZQQXSG.js";import{d as ca,p as ma,q as fa}from"./chunk-RSHMVYNS.js";import{A as _a,B as wa,D as Nt,E as tn,I as rn,M as ka,b as Xr,ba as Ci,c as Qr,d as j,ea as Ea,k as xi,l as ba,m as Zr,n as Ve,q as va,t as en,v as Si,w as ya,y as K,z as Re}from"./chunk-2AFQKRAM.js";import{f as ga}from"./chunk-UYAXVRVL.js";import"./chunk-NRPC74AM.js";import"./chunk-VQJCXGIY.js";import{f as X}from"./chunk-W4J3MGLB.js";import"./chunk-GJ4IUCNS.js";import"./chunk-PNHBZGDD.js";import{$ as E,A as Ri,C as G,D as ft,G as zt,H as We,J as Li,O as Fe,P as Aa,R as Ia,S as Fa,V as Da,W as Oa,Y as Ba,a as I,aa as oe,b as _e,c as mt,da as Na,e as Ra,ea as za,f as nn,fa as Mi,g as Ti,ga as qa,o as sn,p as La,r as Ma,z as Pa}from"./chunk-UXNUAIIC.js";import"./chunk-R5O6FAW4.js";import{b as Sa,d as ht}from"./chunk-CMQA4DM6.js";import{g as ha}from"./chunk-4F6JSF57.js";import"./chunk-V3ME6FI5.js";import{e as pt,h as Ke}from"./chunk-YVZH5SHP.js";import"./chunk-4XCDFGDP.js";import"./chunk-3BZ7JERB.js";import{a as le}from"./chunk-TZ5KB2Y5.js";import"./chunk-XYFXXB2G.js";import{a as J}from"./chunk-DIJJNTRH.js";import{a as ki,g as $i,h as ua,j as Yr,l as pa,n as Jr}from"./chunk-WZDTZE64.js";import{B as wi,I as oa,J as aa,L as la,a as yi,b as Qo,e as Zo,f as ea,g as ta,j as ia,k as ra,l as na,m as _i,p as sa,v as Bt}from"./chunk-GNXOKIGP.js";import"./chunk-C4Z6ZBXV.js";import{a as M,b as ut,c as a,d as ye,e as Go,g as m,i as Wo,j as U}from"./chunk-2XUEZHIP.js";import{b as da}from"./chunk-TUII34K2.js";import{c as Yo,e as Jo,f as Xo,k as gi,p as bi,t as vi}from"./chunk-V5O7M2YT.js";import"./chunk-OOJM4CTU.js";var Ud={attach:{title:"Synced triage on report attach",intro:"have triage from your workspace that disagrees with your local view on",trailingNote:"Other findings in this report whose chain value didn't conflict were applied automatically; this list only covers disagreements. Pick which side to keep.",importedSideLabel:"Apply from chain",applyButton:"Apply"},chain:{title:"Triage conflict from peer update",intro:"were changed by a peer (or by another tab) in a way that disagrees with your local triage on",trailingNote:`Other findings whose remote value didn't conflict were applied automatically; this list only covers disagreements. Pick which side to keep for each \u2014 a "keep current" pick re-publishes your local value to the chain on your next save.`,importedSideLabel:"Apply from chain",applyButton:"Apply"}};function jd(){xl(async(i,e,t)=>{let r=cl(i);try{return await Al(i,r,Ud[t]??Ud.attach)}catch{let n=i.length;return alert(`${t==="attach"?"A report attach":"A workspace sync"} had ${n} triage disagreement${n===1?"":"s"} with your local view. Kept your local values because another dialog is open. ${t==="attach"?"Detach and re-attach the report to pick again.":"Your local values will re-publish to the chain on the next change."}`),null}})}var Rn=class extends q{static properties={retry:{type:Boolean},_value:{state:!0}};constructor(){super(),this.retry=!1,this._value=""}_finish(e){this._value="",super._finish(e)}_onCancel=()=>this._finish(null);_onInput=e=>{this._value=e.target.value};_onSubmit=()=>{let e=this._value??"";e&&this._finish(e)};_onKeydown=e=>{e.key==="Enter"&&(e.preventDefault(),this._onSubmit())};render(){let e=(this._value??"").length>0,t=this.retry?"That password didn't match. Try again, or cancel to leave the workspace unsynced for now.":"This sync server requires a password before it accepts a new workspace. Enter it to create the workspace on the server.";return a`<dialog @close="${this._onClose}"><header><h3>Sync server password</h3></header><p class="nwd-intro">${t}</p><input type="password" class="nwd-input" placeholder="Password" autocomplete="off" data-1p-ignore="true" data-lpignore="true" data-bwignore="true" data-form-type="other" name="dv-sync-auth" maxlength="4096" .value="${this._value}" @input="${this._onInput}" @keydown="${this._onKeydown}"><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!e}" @click="${this._onSubmit}">${this.retry?"Retry":"Authenticate"}</button></footer></dialog>`}};customElements.define("sync-auth-dialog",Rn);function Vd({retry:i=!1}={}){return Y("sync-auth-dialog",{retry:!!i})}function Kd(){$l(async({retry:i})=>{try{return await Vd({retry:i})}catch(e){return console.warn("Sync auth dialog failed to open:",e),null}})}var Zi="https://triage.space/",Nh=[{hostname:"deepaudit.dev",pathPrefix:"/",supportsSync:!0},{hostname:"chalker.github.io",pathPrefix:"/deepview/",supportsSync:!1}];function zh(){for(let i of Nh)if(location.hostname===i.hostname&&location.pathname.startsWith(i.pathPrefix))return i;return null}var qh=["deepview.triage","deepview.triage.pending"],Hh="deepview.repoUrls";function Uh(){try{for(let i of qh)if(localStorage.getItem(i))return!0}catch{return!0}try{let i=localStorage.getItem(Hh);if(i){let e=JSON.parse(i);if(e&&typeof e=="object"&&Object.keys(e).length>0)return!0}}catch{return!0}return!1}async function jh(){if(Uh())return!0;let i=[];try{i=await gt()}catch{return!0}if(i.length>0)return!0;try{if(he().length>0)return!0}catch{return!0}try{return await il()}catch{return!0}}var Ln=class extends U{static properties={supportsSync:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.supportsSync=!1}firstUpdated(){let e=this.querySelector("dialog");e&&e.showModal();let t=this.querySelector("button.om-stay");t&&t.focus()}_finish(e){if(this._settled)return;this._settled=!0;let t=this.querySelector("dialog");t&&t.close(),this.dispatchEvent(new CustomEvent("resolve",{detail:e}))}_onClose=()=>this._finish(!1);_onStay=()=>this._finish(!1);_onMigrate=()=>this._finish(!0);render(){let e=()=>a`<a class="om-link" href="${Zi}" target="_blank" rel="noopener noreferrer">${Zi}</a>`;return a`<dialog class="origin-migration-dialog" @close="${this._onClose}"><header class="om-head"><h3>This deepview build has moved</h3><p><code>${location.host}${location.pathname}</code> has moved to ${e()}.</p></header><section class="om-body"><p>Workspaces and reports don't migrate automatically — they live in this origin's browser storage (OPFS where available, localStorage as a fallback) and have to be re-imported on ${e()}.</p>${this.supportsSync?a`<p>For each workspace, use the <strong>Export workspace</strong> button in the sidebar to download a <code>.gz</code> bundle (workspace + its reports + its triage), then drop that file on ${e()}. Workspaces that had sync configured will pick their triage state back up from the sync server once you re-import them with the same key.</p><p>For triage attached to loose reports (or as a top-up after re-importing workspaces), call <code>DeepView.export()</code> in the browser console — that downloads just the triage entries plus saved repo URLs, no reports or workspaces.</p>`:a`<p>This build has no sync layer. For each workspace, use the <strong>Export workspace</strong> button in the sidebar to download a <code>.gz</code> bundle (workspace + its reports + its triage), then drop that file on ${e()}.</p><p>For triage attached to loose reports, call <code>DeepView.export()</code> in the browser console — that downloads just the triage entries plus saved repo URLs, no reports or workspaces. Reports themselves need to be re-dropped from their original JSON on the new origin.</p>`}</section><footer class="om-actions"><button type="button" class="om-stay" @click="${this._onStay}">Keep editing on ${location.host}</button> <button type="button" class="primary om-go" @click="${this._onMigrate}">Switch to triage.space</button></footer></dialog>`}};customElements.define("origin-migration-dialog",Ln);function Vh(i){return new Promise(e=>{let t=document.createElement("origin-migration-dialog");t.supportsSync=i.supportsSync,t.addEventListener("resolve",r=>{t.remove(),e(!!r.detail)}),document.body.append(t)})}async function Gd(){let i=zh();return i?await jh()?await Vh(i)?(location.assign(Zi),!0):!1:(location.replace(Zi),!0):!1}var Mn=class extends q{static styles=[...q.styles,M(Ml)];static properties={encoded:{type:String},_stage:{state:!0},_password:{state:!0},_name:{state:!0},_decoded:{state:!0},_existingById:{state:!0},_busy:{state:!0},_error:{state:!0},_settled:{state:!0}};constructor(){super(),this.encoded="",this._stage="password",this._password="",this._name="",this._decoded=null,this._existingById=null,this._busy=!1,this._error="",this._settled=!1}focusInitial(){this._focusActiveInput()}updated(e){e.has("_stage")&&this._focusActiveInput()}_focusActiveInput(){if(this._stage==="password")this.renderRoot.querySelector('input[type="password"]')?.focus();else if(this._stage==="name"){let e=this.renderRoot.querySelector('input[data-role="name"]');e&&(e.focus(),e.select())}}_finish(e){this._settled||(this._decoded=null,this._password="",this.encoded="",super._finish(e))}_onClose=()=>this._finish(null);_onCancel=()=>this._finish(null);_onPasswordInput=e=>{this._password=e.target.value,this._error=""};_onNameInput=e=>{this._name=e.target.value};_onUnlock=async()=>{if(!(!this._password||this._busy)){this._busy=!0,this._error="";try{let e=await bl({encoded:this.encoded,password:this._password});if(this._settled)return;let t=he().find(r=>r.id===e.id)??null;this._decoded=e,this._existingById=t,this._name=e.name,this._password="",this._stage="name"}catch(e){if(this._settled)return;this._error=e?.message??String(e)}finally{this._busy=!1}}};_onAttach=()=>{if(!this._decoded)return;let e=Ii(this._name);if(!e)return;let t=he().find(r=>r.id===this._decoded.id)??null;if(t){this._existingById=t;return}this._nameCollision(e)||this._finish({id:this._decoded.id,name:e,privateKeyBase64:this._decoded.privateKeyBase64})};_nameCollision(e){if(!e||!this._decoded)return null;for(let t of he())if(t.id!==this._decoded.id&&Ii(t.name)===e)return t;return null}_onKeydown=e=>{e.key==="Enter"&&(e.preventDefault(),this._stage==="password"?this._onUnlock():this._stage==="name"&&this._onAttach())};_passwordStage(){return a`<p class="nwd-note ui-hint">Someone shared a workspace with you. Enter the password they sent separately to attach it to this browser.</p><label class="wsl-field"><span>Password</span> <input type="password" class="nwd-input" autocomplete="off" data-1p-ignore="true" data-lpignore="true" data-bwignore="true" data-form-type="other" name="dv-share-link-unlock" maxlength="1024" .value="${this._password}" @input="${this._onPasswordInput}" @keydown="${this._onKeydown}"></label> ${this._error?a`<p class="wsl-error" role="alert">${this._error}</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!this._password||this._busy}" @click="${this._onUnlock}">${this._busy?"Unlocking\u2026":"Unlock"}</button></footer>`}_alreadyAttachedStage(){let e=this._existingById;return a`<p class="nwd-note">This workspace is already attached as <strong>"${e?.name??""}"</strong>. Open it from the sidebar.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" class="primary" @click="${this._onCancel}">Close</button></footer>`}_nameStage(){if(this._existingById)return this._alreadyAttachedStage();let e=Ii(this._name),t=this._nameCollision(e),r=!!e&&!t;return a`<p class="nwd-note ui-hint">Pick a name for the workspace on this device. The shared identity is preserved either way — only the visible label changes.</p><label class="wsl-field"><span>Workspace name</span> <input type="text" class="nwd-input" data-role="name" placeholder="Workspace name" maxlength="200" .value="${this._name}" @input="${this._onNameInput}" @keydown="${this._onKeydown}"></label> ${t?a`<p class="wsl-error" role="alert">A workspace named "${e}" already exists on this device. Pick a different name.</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!r}" @click="${this._onAttach}">Attach</button></footer>`}render(){let e=this._stage==="password"?"Attach shared workspace":this._existingById?"Workspace already attached":"Name the workspace";return a`<dialog @close="${this._onClose}"><header><h3>${e}</h3></header>${this._stage==="password"?this._passwordStage():this._nameStage()}</dialog>`}};customElements.define("workspace-unlock-link-dialog",Mn);function Wd({encoded:i}={}){return Ca("workspace-unlock-link-dialog",{encoded:i??""},e=>{e.encoded=""})}var ee=null,er=!1,ei=null;function Kh(i){if(!i)return"Could not unlock. Try again.";switch(i.name??""){case"NotAllowedError":case"AbortError":return"";case"SecurityError":return"The site identity does not match the one this passkey was registered for. If you opened DeepView through a different URL (different subdomain, different port), reload via the original URL.";case"InvalidStateError":return"The passkey state on this device is inconsistent. Try reloading the page or removing and re-creating the passkey.";case"NotSupportedError":return"This browser does not support the WebAuthn PRF extension this site needs. Try a recent Chrome, Safari, or Edge with a platform authenticator.";case"NetworkError":return"A network error prevented the passkey from completing. Check your connection and try again.";case"UnknownError":return"The authenticator returned an unknown error. Try again, or use a different passkey.";default:{let t=i.message??String(i);return t.length>200?t.slice(0,197)+"\u2026":t}}}function Gh(){if(ee)return ee;ee=document.createElement("div"),ee.id="lock-overlay",ee.setAttribute("role","dialog"),ee.setAttribute("aria-modal","true"),ee.setAttribute("aria-label","Unlock DeepView"),ee.innerHTML=`
|
|
1
|
+
import{a as xt,b as Le,c as Ud,d as Tr}from"./chunk-A7M4GV7M.js";import{a as Vd}from"./chunk-KEX2ATEW.js";import{$ as Di,$a as et,$b as Uc,$c as Xi,A as vl,Aa as Bi,Ab as Gt,Ac as nd,Ad as Bd,B as yl,Ba as ic,Bb as Cc,Bc as rd,Bd as Nd,C as _l,Ca as nc,Cb as Ec,Cc as sd,D as wl,Da as rc,Db as Tc,Dc as kt,Dd as Zt,E as kl,Ea as ar,Eb as Rc,Ec as od,Ed as zd,F as $l,Fa as sc,Fb as Vi,Fc as ad,Fd as Qi,G as xl,Ga as Vt,Gb as Ki,Gc as ld,Gd as qd,H as Sl,Ha as lr,Hb as Lc,Hc as cd,Hd as $t,I as Cl,Ia as oc,Ib as Mc,Ic as dd,Id as Hd,J as El,Ja as de,Jb as Pc,Jc as ud,Jd as fe,K as Fi,Ka as D,Kb as Ac,Kc as Xt,Kd as jd,L as me,La as yt,Lb as Ic,Lc as pd,Ld as St,M as Tl,Ma as Ni,Mb as Wt,Mc as hd,N as Rl,Na as cr,Nb as pr,Nc as md,O as Ll,Oa as ac,Ob as Fc,Oc as Sr,P as Ml,Pa as lc,Pb as Dc,Pc as fd,Q as Pl,Qa as cc,Qb as Gi,Qc as gd,R as Je,Ra as dc,Rb as Wi,Rc as Oe,S as Al,Sa as Kt,Sb as Oc,Sc as bd,T as Il,Ta as _t,Tb as Bc,U as bt,Ua as uc,Ub as hr,V as Fl,Va as wt,Vb as Nc,W as vt,Wa as zi,Wb as mr,X as Dl,Xa as dr,Xb as fr,Y as Ol,Ya as pc,Yb as zc,Yc as vd,Z as Bl,Za as hc,Zb as qc,Zc as Be,_ as Nl,_a as qi,_b as Hc,_c as tt,a as Za,aa as zl,ab as mc,ac as jc,ad as Cr,b as el,ba as ql,bb as fc,bc as Yt,bd as it,c as tl,ca as Hl,cb as gc,cc as gr,cd as yd,d as il,da as qt,dc as Vc,dd as _d,e as nl,ea as Ht,ec as Kc,ed as wd,f as or,fa as Ul,fc as Gc,fd as kd,g as Ai,ga as jl,gb as bc,gc as br,gd as $d,h as l,ha as Vl,hb as vc,hc as vr,hd as xd,i as H,ia as Kl,ic as Wc,id as Sd,j as al,ja as Oi,jc as Yc,jd as Cd,k as ll,ka as Gl,kc as yr,kd as Ed,l as cl,la as Wl,lc as _r,ld as Qt,m as dl,ma as Xe,mc as Jc,md as Er,n as he,na as Yl,nc as Xc,nd as Td,o as Ii,oa as Jl,ob as ur,oc as Qc,od as Rd,p as ul,pa as Qe,pb as Hi,pc as Jt,pd as $,qa as Xl,qb as yc,qc as Yi,ra as Ql,rb as xe,rc as Zc,sa as Ut,sb as _c,sc as ed,sd as Ld,t as pl,ta as De,tb as Ui,tc as td,td as Md,u as hl,ua as Ze,ub as ji,uc as Ji,ud as Pd,v as ml,va as Zl,vb as wc,vc as wr,vd as Ad,w as fl,wa as ec,wb as kc,wc as kr,wd as Id,x as ke,xa as $e,xb as $c,xc as $r,xd as Fd,y as gl,ya as jt,yb as xc,yc as id,yd as Dd,z as bl,za as tc,zb as Sc,zc as xr,zd as Od}from"./chunk-7RU5EDRO.js";import{a as Ei}from"./chunk-2KBF5TZ7.js";import{b as Ma}from"./chunk-K3X5EJBQ.js";import{a as Ca,b as R,c as Ea,d as Ge,g as q,h as Y,i as Ra}from"./chunk-CVVJAXVY.js";import{B as gt,D as rl,K as sl,O as ol,c as Ga,d as we,e as Ye,f as Wa,j as Pi,k as Ya,n as Ja,r as Xa,u as Qa}from"./chunk-VIHGO77Y.js";import{u as Va,z as Ka}from"./chunk-RFZQQXSG.js";import{d as pa,p as ba,q as va}from"./chunk-RSHMVYNS.js";import{A as $a,B as xa,D as Nt,E as ir,I as nr,M as Sa,b as Qn,ba as Ci,c as Zn,d as j,ea as La,k as xi,l as _a,m as er,n as Ve,q as wa,t as tr,v as Si,w as ka,y as K,z as Re}from"./chunk-CLPKNNC7.js";import{f as ya}from"./chunk-UYAXVRVL.js";import"./chunk-NRPC74AM.js";import"./chunk-VQJCXGIY.js";import{f as X}from"./chunk-W4J3MGLB.js";import"./chunk-GJ4IUCNS.js";import"./chunk-PNHBZGDD.js";import{$ as E,A as Ri,C as G,D as ft,G as zt,H as We,J as Li,O as Fe,P as Da,R as Oa,S as Ba,V as Na,W as za,Y as qa,a as I,aa as oe,b as _e,c as mt,da as Ha,e as Pa,ea as Ua,f as rr,fa as Mi,g as Ti,ga as ja,o as sr,p as Aa,r as Ia,z as Fa}from"./chunk-UXNUAIIC.js";import"./chunk-R5O6FAW4.js";import{b as Ta,d as ht}from"./chunk-CMQA4DM6.js";import{g as ga}from"./chunk-4F6JSF57.js";import"./chunk-V3ME6FI5.js";import{e as pt,h as Ke}from"./chunk-YVZH5SHP.js";import"./chunk-4XCDFGDP.js";import"./chunk-3BZ7JERB.js";import{a as ce}from"./chunk-TZ5KB2Y5.js";import"./chunk-XYFXXB2G.js";import{a as J}from"./chunk-DIJJNTRH.js";import{a as ki,g as $i,h as ma,j as Jn,l as fa,n as Xn}from"./chunk-WZDTZE64.js";import{B as wi,I as ca,J as da,L as ua,a as yi,b as ta,e as ia,f as na,g as ra,j as sa,k as oa,l as aa,m as _i,p as la,v as Bt}from"./chunk-GNXOKIGP.js";import"./chunk-C4Z6ZBXV.js";import{a as M,b as ut,c as a,d as ye,e as Jo,g as m,i as Xo,j as U}from"./chunk-2XUEZHIP.js";import{b as ha}from"./chunk-TUII34K2.js";import{c as Qo,e as Zo,f as ea,k as gi,p as bi,t as vi}from"./chunk-V5O7M2YT.js";import"./chunk-OOJM4CTU.js";var Kd={attach:{title:"Synced triage on report attach",intro:"have triage from your workspace that disagrees with your local view on",trailingNote:"Other findings in this report whose chain value didn't conflict were applied automatically; this list only covers disagreements. Pick which side to keep.",importedSideLabel:"Apply from chain",applyButton:"Apply"},chain:{title:"Triage conflict from peer update",intro:"were changed by a peer (or by another tab) in a way that disagrees with your local triage on",trailingNote:`Other findings whose remote value didn't conflict were applied automatically; this list only covers disagreements. Pick which side to keep for each \u2014 a "keep current" pick re-publishes your local value to the chain on your next save.`,importedSideLabel:"Apply from chain",applyButton:"Apply"}};function Gd(){El(async(i,e,t)=>{let n=pl(i);try{return await Dl(i,n,Kd[t]??Kd.attach)}catch{let r=i.length;return alert(`${t==="attach"?"A report attach":"A workspace sync"} had ${r} triage disagreement${r===1?"":"s"} with your local view. Kept your local values because another dialog is open. ${t==="attach"?"Detach and re-attach the report to pick again.":"Your local values will re-publish to the chain on the next change."}`),null}})}var Rr=class extends q{static properties={retry:{type:Boolean},_value:{state:!0}};constructor(){super(),this.retry=!1,this._value=""}_finish(e){this._value="",super._finish(e)}_onCancel=()=>this._finish(null);_onInput=e=>{this._value=e.target.value};_onSubmit=()=>{let e=this._value??"";e&&this._finish(e)};_onKeydown=e=>{e.key==="Enter"&&(e.preventDefault(),this._onSubmit())};render(){let e=(this._value??"").length>0,t=this.retry?"That password didn't match. Try again, or cancel to leave the workspace unsynced for now.":"This sync server requires a password before it accepts a new workspace. Enter it to create the workspace on the server.";return a`<dialog @close="${this._onClose}"><header><h3>Sync server password</h3></header><p class="nwd-intro">${t}</p><input type="password" class="nwd-input" placeholder="Password" autocomplete="off" data-1p-ignore="true" data-lpignore="true" data-bwignore="true" data-form-type="other" name="dv-sync-auth" maxlength="4096" .value="${this._value}" @input="${this._onInput}" @keydown="${this._onKeydown}"><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!e}" @click="${this._onSubmit}">${this.retry?"Retry":"Authenticate"}</button></footer></dialog>`}};customElements.define("sync-auth-dialog",Rr);function Wd({retry:i=!1}={}){return Y("sync-auth-dialog",{retry:!!i})}function Yd(){Cl(async({retry:i})=>{try{return await Wd({retry:i})}catch(e){return console.warn("Sync auth dialog failed to open:",e),null}})}var Zi="https://triage.space/",qh=[{hostname:"deepaudit.dev",pathPrefix:"/",supportsSync:!0},{hostname:"chalker.github.io",pathPrefix:"/deepview/",supportsSync:!1}];function Hh(){for(let i of qh)if(location.hostname===i.hostname&&location.pathname.startsWith(i.pathPrefix))return i;return null}var Uh=["deepview.triage","deepview.triage.pending"],jh="deepview.repoUrls";function Vh(){try{for(let i of Uh)if(localStorage.getItem(i))return!0}catch{return!0}try{let i=localStorage.getItem(jh);if(i){let e=JSON.parse(i);if(e&&typeof e=="object"&&Object.keys(e).length>0)return!0}}catch{return!0}return!1}async function Kh(){if(Vh())return!0;let i=[];try{i=await gt()}catch{return!0}if(i.length>0)return!0;try{if(he().length>0)return!0}catch{return!0}try{return await sl()}catch{return!0}}var Lr=class extends U{static properties={supportsSync:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.supportsSync=!1}firstUpdated(){let e=this.querySelector("dialog");e&&e.showModal();let t=this.querySelector("button.om-stay");t&&t.focus()}_finish(e){if(this._settled)return;this._settled=!0;let t=this.querySelector("dialog");t&&t.close(),this.dispatchEvent(new CustomEvent("resolve",{detail:e}))}_onClose=()=>this._finish(!1);_onStay=()=>this._finish(!1);_onMigrate=()=>this._finish(!0);render(){let e=()=>a`<a class="om-link" href="${Zi}" target="_blank" rel="noopener noreferrer">${Zi}</a>`;return a`<dialog class="origin-migration-dialog" @close="${this._onClose}"><header class="om-head"><h3>This deepview build has moved</h3><p><code>${location.host}${location.pathname}</code> has moved to ${e()}.</p></header><section class="om-body"><p>Workspaces and reports don't migrate automatically — they live in this origin's browser storage (OPFS where available, localStorage as a fallback) and have to be re-imported on ${e()}.</p>${this.supportsSync?a`<p>For each workspace, use the <strong>Export workspace</strong> button in the sidebar to download a <code>.gz</code> bundle (workspace + its reports + its triage), then drop that file on ${e()}. Workspaces that had sync configured will pick their triage state back up from the sync server once you re-import them with the same key.</p><p>For triage attached to loose reports (or as a top-up after re-importing workspaces), call <code>DeepView.export()</code> in the browser console — that downloads just the triage entries plus saved repo URLs, no reports or workspaces.</p>`:a`<p>This build has no sync layer. For each workspace, use the <strong>Export workspace</strong> button in the sidebar to download a <code>.gz</code> bundle (workspace + its reports + its triage), then drop that file on ${e()}.</p><p>For triage attached to loose reports, call <code>DeepView.export()</code> in the browser console — that downloads just the triage entries plus saved repo URLs, no reports or workspaces. Reports themselves need to be re-dropped from their original JSON on the new origin.</p>`}</section><footer class="om-actions"><button type="button" class="om-stay" @click="${this._onStay}">Keep editing on ${location.host}</button> <button type="button" class="primary om-go" @click="${this._onMigrate}">Switch to triage.space</button></footer></dialog>`}};customElements.define("origin-migration-dialog",Lr);function Gh(i){return new Promise(e=>{let t=document.createElement("origin-migration-dialog");t.supportsSync=i.supportsSync,t.addEventListener("resolve",n=>{t.remove(),e(!!n.detail)}),document.body.append(t)})}async function Jd(){let i=Hh();return i?await Kh()?await Gh(i)?(location.assign(Zi),!0):!1:(location.replace(Zi),!0):!1}var Mr=class extends q{static styles=[...q.styles,M(Il)];static properties={encoded:{type:String},_stage:{state:!0},_password:{state:!0},_name:{state:!0},_decoded:{state:!0},_existingById:{state:!0},_busy:{state:!0},_error:{state:!0},_settled:{state:!0}};constructor(){super(),this.encoded="",this._stage="password",this._password="",this._name="",this._decoded=null,this._existingById=null,this._busy=!1,this._error="",this._settled=!1}focusInitial(){this._focusActiveInput()}updated(e){e.has("_stage")&&this._focusActiveInput()}_focusActiveInput(){if(this._stage==="password")this.renderRoot.querySelector('input[type="password"]')?.focus();else if(this._stage==="name"){let e=this.renderRoot.querySelector('input[data-role="name"]');e&&(e.focus(),e.select())}}_finish(e){this._settled||(this._decoded=null,this._password="",this.encoded="",super._finish(e))}_onClose=()=>this._finish(null);_onCancel=()=>this._finish(null);_onPasswordInput=e=>{this._password=e.target.value,this._error=""};_onNameInput=e=>{this._name=e.target.value};_onUnlock=async()=>{if(!(!this._password||this._busy)){this._busy=!0,this._error="";try{let e=await _l({encoded:this.encoded,password:this._password});if(this._settled)return;let t=he().find(n=>n.id===e.id)??null;this._decoded=e,this._existingById=t,this._name=e.name,this._password="",this._stage="name"}catch(e){if(this._settled)return;this._error=e?.message??String(e)}finally{this._busy=!1}}};_onAttach=()=>{if(!this._decoded)return;let e=Ii(this._name);if(!e)return;let t=he().find(n=>n.id===this._decoded.id)??null;if(t){this._existingById=t;return}this._nameCollision(e)||this._finish({id:this._decoded.id,name:e,privateKeyBase64:this._decoded.privateKeyBase64})};_nameCollision(e){if(!e||!this._decoded)return null;for(let t of he())if(t.id!==this._decoded.id&&Ii(t.name)===e)return t;return null}_onKeydown=e=>{e.key==="Enter"&&(e.preventDefault(),this._stage==="password"?this._onUnlock():this._stage==="name"&&this._onAttach())};_passwordStage(){return a`<p class="nwd-note ui-hint">Someone shared a workspace with you. Enter the password they sent separately to attach it to this browser.</p><label class="wsl-field"><span>Password</span> <input type="password" class="nwd-input" autocomplete="off" data-1p-ignore="true" data-lpignore="true" data-bwignore="true" data-form-type="other" name="dv-share-link-unlock" maxlength="1024" .value="${this._password}" @input="${this._onPasswordInput}" @keydown="${this._onKeydown}"></label> ${this._error?a`<p class="wsl-error" role="alert">${this._error}</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!this._password||this._busy}" @click="${this._onUnlock}">${this._busy?"Unlocking\u2026":"Unlock"}</button></footer>`}_alreadyAttachedStage(){let e=this._existingById;return a`<p class="nwd-note">This workspace is already attached as <strong>"${e?.name??""}"</strong>. Open it from the sidebar.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" class="primary" @click="${this._onCancel}">Close</button></footer>`}_nameStage(){if(this._existingById)return this._alreadyAttachedStage();let e=Ii(this._name),t=this._nameCollision(e),n=!!e&&!t;return a`<p class="nwd-note ui-hint">Pick a name for the workspace on this device. The shared identity is preserved either way — only the visible label changes.</p><label class="wsl-field"><span>Workspace name</span> <input type="text" class="nwd-input" data-role="name" placeholder="Workspace name" maxlength="200" .value="${this._name}" @input="${this._onNameInput}" @keydown="${this._onKeydown}"></label> ${t?a`<p class="wsl-error" role="alert">A workspace named "${e}" already exists on this device. Pick a different name.</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!n}" @click="${this._onAttach}">Attach</button></footer>`}render(){let e=this._stage==="password"?"Attach shared workspace":this._existingById?"Workspace already attached":"Name the workspace";return a`<dialog @close="${this._onClose}"><header><h3>${e}</h3></header>${this._stage==="password"?this._passwordStage():this._nameStage()}</dialog>`}};customElements.define("workspace-unlock-link-dialog",Mr);function Xd({encoded:i}={}){return Ra("workspace-unlock-link-dialog",{encoded:i??""},e=>{e.encoded=""})}var ee=null,en=!1,ei=null;function Wh(i){if(!i)return"Could not unlock. Try again.";switch(i.name??""){case"NotAllowedError":case"AbortError":return"";case"SecurityError":return"The site identity does not match the one this passkey was registered for. If you opened DeepView through a different URL (different subdomain, different port), reload via the original URL.";case"InvalidStateError":return"The passkey state on this device is inconsistent. Try reloading the page or removing and re-creating the passkey.";case"NotSupportedError":return"This browser does not support the WebAuthn PRF extension this site needs. Try a recent Chrome, Safari, or Edge with a platform authenticator.";case"NetworkError":return"A network error prevented the passkey from completing. Check your connection and try again.";case"UnknownError":return"The authenticator returned an unknown error. Try again, or use a different passkey.";default:{let t=i.message??String(i);return t.length>200?t.slice(0,197)+"\u2026":t}}}function Yh(){if(ee)return ee;ee=document.createElement("div"),ee.id="lock-overlay",ee.setAttribute("role","dialog"),ee.setAttribute("aria-modal","true"),ee.setAttribute("aria-label","Unlock DeepView"),ee.innerHTML=`
|
|
2
2
|
<div class="lock-overlay-card">
|
|
3
3
|
<div class="lock-overlay-icon" aria-hidden="true">
|
|
4
4
|
<svg viewBox="0 0 32 32" width="40" height="40" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="7" y="15" width="18" height="12" rx="1.5"/><path d="M11 15v-4a5 5 0 0 1 10 0v4"/></svg>
|
|
@@ -15,38 +15,38 @@ import{a as xt,b as Le,c as zd,d as Tn}from"./chunk-XL35ZV6R.js";import{a as Hd}
|
|
|
15
15
|
<a href="#" class="lock-overlay-wipe">Wipe local data and start over</a>
|
|
16
16
|
</p>
|
|
17
17
|
</div>
|
|
18
|
-
`;let i=ee.querySelector("button"),e=ee.querySelector(".lock-overlay-error");return i.addEventListener("click",async()=>{if(!(
|
|
18
|
+
`;let i=ee.querySelector("button"),e=ee.querySelector(".lock-overlay-error");return i.addEventListener("click",async()=>{if(!(en||!Pr())){en=!0,e.hidden=!0,e.textContent="",i.disabled=!0,i.textContent="Waiting\u2026",ei=new AbortController;try{await Ya({signal:ei.signal})}catch(n){let r=Wh(n);e.textContent=r,e.hidden=!r}finally{en=!1,ei=null,i.disabled=!1,i.textContent="Unlock with passkey"}}}),ee.querySelector(".lock-overlay-wipe").addEventListener("click",async n=>{if(n.preventDefault(),!(en||!Pr())&&confirm(`Wipe ALL local DeepView data and start over?
|
|
19
19
|
|
|
20
20
|
This deletes your encrypted triage, all reports, and the passkey registration on this device. The data CANNOT be recovered after this \u2014 there is no backup.
|
|
21
21
|
|
|
22
|
-
Use this only if you have lost access to your passkey and have no other way to unlock.`)&&confirm("Really wipe everything? This cannot be undone.")){try{await
|
|
23
|
-
`;var
|
|
24
|
-
`).map((t,
|
|
25
|
-
`;var
|
|
26
|
-
`),{target:t=
|
|
27
|
-
`;var
|
|
28
|
-
</code>`}return
|
|
29
|
-
`),
|
|
22
|
+
Use this only if you have lost access to your passkey and have no other way to unlock.`)&&confirm("Really wipe everything? This cannot be undone.")){try{await Ja()}catch(r){alert(`Wipe failed: ${r?.message??r}. Try again or clear localStorage manually via DevTools.`);return}location.reload()}}),document.body.append(ee),ee}function Pr(){return H()||!Wa()?!1:we()&&!Ye()}async function Ar(){if(await St(),Pr()){let i=Yh();i.hidden=!1;let e=i.querySelector("button");e&&e.focus()}else if(ee&&(ee.hidden=!0,ei))try{ei.abort()}catch{}}Pi(Ar);document.addEventListener("managed-client-mode-change",Ar);Ar();var Ir=class extends q{static styles=[...q.styles,M(bt),M(Vd)];static properties={initial:{attribute:!1},finding:{attribute:!1},_value:{state:!0}};constructor(){super(),this.initial="",this.finding=null,this._value=""}beforeOpen(){this._value=this.initial??""}focusInitial(){let e=this.renderRoot.querySelector("textarea");if(!e)return;e.focus();let t=e.value.length;try{e.setSelectionRange(t,t)}catch{}}_onInput=e=>{this._value=e.target.value};_onSave=()=>{let e=(this._value??"").trim(),t=(this.initial??"").trim();if(e===t){this._finish(null);return}this._finish(e)};_onClear=()=>this._finish("");_onCancel=()=>this._finish(null);_onKeydown=e=>{e.key==="Enter"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this._onSave())};render(){let e=this.finding??{},t=e.file?e.line?`${e.file}:${e.line}`:e.file:"",n=(this.initial??"").length>0;return a`<dialog @close="${this._onClose}"><header><h3>${n?"Edit comment":"Add comment"}</h3><div class="finding">${vt(_i(e,l.severityMode))} ${t?a`<span class="loc" data-tooltip-truncated data-tooltip="${t}">${t}</span>`:m}</div>${e.description?a`<div class="desc" data-tooltip-truncated data-tooltip="${e.description}">${e.description}</div>`:m}</header><textarea rows="6" placeholder="Write your notes here. Markdown is not rendered. Ctrl/⌘+Enter to save, Esc to cancel." .value="${this._value}" @input="${this._onInput}" @keydown="${this._onKeydown}"></textarea><footer class="nwd-actions">${n?a`<button type="button" class="danger" @click="${this._onClear}">Clear</button>`:m} <span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" @click="${this._onSave}">Save</button></footer></dialog>`}};customElements.define("comment-dialog",Ir);function Qd({initial:i="",finding:e=null}={}){return Y("comment-dialog",{initial:i,finding:e})}var Zd=`dialog{width:min(96vw,1400px);max-width:1400px;height:min(88dvh,1000px);max-height:92dvh;margin:auto;padding:0;overflow:hidden}dialog[open]{display:flex;flex-direction:column}header{display:flex;align-items:center;gap:1rem;padding:.7rem 1rem;border-bottom:1px solid var(--border);flex:0 0 auto;& h3{margin:0;min-width:0;flex:1;overflow-wrap:anywhere;font:.85rem ui-monospace,monospace}& button{border:0;background:transparent;color:var(--muted);font-size:1.4rem;padding:0 .3rem;&:hover{color:var(--text)}}}.source-scroll{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain}.source-status{padding:1rem;color:var(--muted)}.source-lines{display:flex;min-width:100%;width:max-content;font:.8rem/1.6 ui-monospace,monospace;& aside{position:sticky;left:0;align-self:stretch;flex:0 0 auto;padding:.75rem 0;background:var(--surface);color:var(--muted);border-right:1px solid var(--border);text-align:right;user-select:none;& div{padding:0 .75rem}.cited{background:rgb(from var(--accent) r g b / .18);color:var(--accent);font-weight:700}}& pre{padding:.75rem 1rem;margin:0;tab-size:4}& pre,code{font:inherit;white-space:pre}}
|
|
23
|
+
`;var Fr=class extends q{static styles=[...q.styles,M(Zd),M(kt)];static properties={reportId:{attribute:!1},file:{attribute:!1},line:{attribute:!1},_path:{state:!0},_content:{state:!0},_highlighted:{state:!0},_loading:{state:!0}};constructor(){super(),this.reportId="",this.file="",this.line="",this._path="",this._content=null,this._highlighted=null,this._loading=!0}beforeOpen(){this._load()}async _load(){try{let{data:e,error:t}=await Md(this.reportId).then(o=>({data:o}),o=>({error:o}));if(this._settled||!this.isConnected)return;let n=Ld(this.reportId),r=t?n?.error===t:n?.data===e||e===null&&!!n?.error;if(!n||!r||t?.name==="AbortError"||n.controller?.signal.aborted){this._finish(null);return}if(this._sourceSignal=n.controller?.signal,this._sourceSignal?.addEventListener("abort",this._onClose,{once:!0}),this._path=e?.paths.get(this.file)??this.file,this._content=e?.sources.get(this._path)??null,this._loading=!1,await this.updateComplete,this._settled||!this.isConnected)return;qi(this.renderRoot.querySelector(".source-scroll"),this.renderRoot.querySelectorAll(".cited"));let s=xi(this._path,e?.formats?.get(this._path),this._content);if(s&&this._content!==null){let o=await yt(this._content,s);!this._settled&&this.isConnected&&(this._highlighted=o)}}catch(e){e.name==="AbortError"?this._finish(null):this._loading=!1}}disconnectedCallback(){this._sourceSignal?.removeEventListener("abort",this._onClose),this._content=null,this._highlighted=null,super.disconnectedCallback()}_onKeydown=e=>{e.key==="Escape"&&e.stopPropagation()};render(){let e=Fe(this.line);return a`<dialog aria-labelledby="source-title" @close="${this._onClose}" @keydown="${this._onKeydown}" @click="${this._onBackdrop}"><header><h3 id="source-title" class="mono">${this._path||this.file}</h3><button type="button" aria-label="Close source viewer" @click="${this._onClose}">×</button></header><div class="source-scroll" tabindex="0" aria-label="Full source code" aria-busy="${String(this._loading)}">${this._content===null?a`<p class="source-status" role="status">${this._loading?"Loading source\u2026":"Source unavailable"}</p>`:a`<div class="source-lines"><aside aria-hidden="true">${this._content.split(`
|
|
24
|
+
`).map((t,n)=>a`<div class="${e&&n+1>=e.start&&n+1<=e.end?"cited":""}">${n+1}</div>`)}</aside><pre><code>${typeof this._highlighted=="string"?J(this._highlighted):this._content}</code></pre></div>`}</div></dialog>`}};customElements.define("finding-source-dialog",Fr);function eu({reportId:i,file:e,line:t}){return Y("finding-source-dialog",{reportId:i,file:e,line:t})}var Dr=class extends q{static styles=[...q.styles,M(Ol)];static properties={bundleName:{type:String},encrypted:{type:Boolean}};constructor(){super(),this.bundleName="",this.encrypted=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(e){this._settled||super._finish({confirmed:!!e})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);_securityNote(){return this.encrypted?a`<p class="lwd-note">The bundle is saved <strong>unencrypted</strong> — even though your vault keeps its stored copy encrypted — and the file contains <strong>all of the bundle's related sources</strong>. Anyone with access to the downloaded file can read every bundled source, so store or share it with care.</p>`:a`<p class="lwd-note">The downloaded file is <strong>unencrypted</strong> and contains <strong>all of the bundle's related sources</strong>. Anyone with access to it can read every bundled source, so store or share it with care.</p>`}render(){return a`<dialog @close="${this._onClose}"><header><h3>Download bundle</h3></header><p class="lwd-body">Download <strong>"${this.bundleName}"</strong> to disk?</p>${this._securityNote()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" @click="${this._onConfirm}">Download</button></footer></dialog>`}};customElements.define("download-bundle-dialog",Dr);function tu({name:i,encrypted:e}={}){return Y("download-bundle-dialog",{bundleName:i??"",encrypted:!!e})}var iu=a`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/></svg>`,nu=a`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="1.8" y="5" width="20.4" height="14" rx="2"/><path d="M5.6 15.6V8.4l3.1 3.6 3.1-3.6v7.2"/><path d="M16.9 8.4v7.2m-2.6-2.9 2.6 2.9 2.6-2.9"/></svg>`,ru=a`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M6 9V2h12v7"/><path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"/><rect x="6" y="14" width="12" height="8"/></svg>`;function Xh(i,e){let t=Pa.find(n=>n.value===i)?.label??i;return rr(i)?.includes("partial")?e==="exclude"?`${t} (full only)`:e==="only"?`${t} (partial only)`:t:t}function Qh(i){return sa.filter(e=>i.has(e)).map(e=>ia[e]??e).join(", ")}function Or(i=l){let e=[];if(i.filterSeverities.size>0&&e.push({key:"severity",label:"Severity",value:Qh(i.filterSeverities),clear:{filterSeverities:new Set}}),i.filterColors.size>0&&e.push({key:"marks",label:"Marks",value:[...i.filterColors].map(t=>ra[t]??t).join(", "),clear:{filterColors:new Set}}),i.filterSources.size===1&&e.push({key:"source",label:"Source",value:i.filterSources.has("own")?"Sources only":"Dependencies only",clear:{filterSources:new Set}}),i.filterAnalyzer&&e.push({key:"analyzer",label:"Analyzer",value:i.filterAnalyzer===Nl?"(none)":i.filterAnalyzer,clear:{filterAnalyzer:""}}),i.filterModel&&e.push({key:"model",label:"Model",value:i.filterModel===zl?"(none)":i.filterModel,clear:{filterModel:""}}),i.filterRepo&&e.push({key:"repo",label:"Repository",value:i.filterRepo===Di?"(no repo)":i.filterRepo,clear:{filterRepo:""}}),rr(i.filterRevalidate)&&e.push({key:"revalidate",label:"Revalidation",value:Xh(i.filterRevalidate,i.filterPartial),clear:{filterRevalidate:"",filterPartial:""}}),!i.filterRevalidate&&(i.filterConfMin>0||i.filterConfMax<10)){let t;i.filterConfMin>0&&i.filterConfMax<10?t=`${i.filterConfMin}\u2013${i.filterConfMax}`:i.filterConfMin>0?t=`\u2265 ${i.filterConfMin}`:t=`\u2264 ${i.filterConfMax}`,e.push({key:"confidence",label:"Confidence",value:t,clear:{filterConfMin:0,filterConfMax:10}})}i.filterInclude&&e.push({key:"search",label:i.filterIncludeNegate?"Excluding":"Search",value:`"${i.filterInclude}"`,clear:{filterInclude:"",filterIncludeNegate:!1}});for(let[t,n]of[["filterComment","comment"],["filterFix","fix"],["filterFlagged","flag"]]){let r=i[t];r&&e.push({key:`annotation:${n}`,label:"Annotation",value:`${r==="with"?"With":"Without"} ${n}`,clear:{[t]:""}})}return!l.currentWorkspace&&i.filterDuplicates&&e.push({key:"duplicates",label:"Duplicates",value:i.filterDuplicates==="with"?"Only rows linked to other reports":"Exclude rows linked to other reports",clear:{filterDuplicates:""}}),i.filterCrossContext&&e.push({key:"cross-context",label:"Context",value:i.filterCrossContext==="with"?"Only rows across multiple repos or packages":"Exclude rows across multiple repos or packages",clear:{filterCrossContext:""}}),i.filterAppStacked&&e.push({key:"app-stacked",label:"App stack",value:i.filterAppStacked==="with"?"Only rows with multiple App findings":"Exclude rows with multiple App findings",clear:{filterAppStacked:""}}),i.filterSecurity&&e.push({key:"security",label:"Security",value:i.filterSecurity==="with"?"Only security-related rows":"Exclude security-related rows",clear:{filterSecurity:""}}),e}function Br(){return Vt().filter(i=>Bi(i).commonTriage===l.shownTriage)}function Nr(){return l.shownTriage?na[l.shownTriage]??l.shownTriage:null}function tn(i,e=Hl()){let t=Br(),n=t.length;qt(e);let r;try{r=Oi(t).length}finally{Ht()}return{included:r,total:n,excluded:n-r,fields:e,filters:Or(e),bucketLabel:Nr(),focusedOnly:i==="print"&&l.viewMode==="focus"}}var su=`dialog{max-width:515px;width:min(94vw,515px)}.ecd-count{margin:0;font-size:1.02rem;color:var(--text);& strong{color:var(--accent);font-weight:700}}.ecd-excluded{margin:.25rem 0 0;color:var(--muted);font-size:.82rem}.ecd-filters{margin:.9rem 0 0;display:grid;grid-template-columns:auto minmax(0,1fr);gap:.3rem .7rem;font-size:.82rem}.ecd-filters dt{color:var(--muted);font-weight:600;white-space:nowrap}.ecd-filters dd{display:flex;align-items:baseline;gap:.5rem;color:var(--text);overflow-wrap:anywhere}.ecd-filter-value{min-width:0}.ecd-filter-drop{margin-left:auto;flex:none;padding:0 .2rem;border:0;border-radius:var(--ui-radius, 4px);background:none;color:var(--muted);font:inherit;font-size:1rem;line-height:1;&:hover{color:var(--critical, #f87171)}&:focus-visible{outline:2px solid var(--accent);outline-offset:1px}}.ecd-filters-label{margin:.9rem 0 0;font-size:.76rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--muted)}.ecd-filters-label+.ecd-filters{margin-top:.35rem}.ecd-samples{display:flex;align-items:flex-start;gap:.5rem;margin-top:1rem;font-size:.82rem;color:var(--text)}.ecd-samples input{margin-top:.15rem;accent-color:var(--accent)}.ecd-samples-hint{display:block;margin-top:.2rem;color:var(--muted);font-size:.76rem}
|
|
25
|
+
`;var em=[{id:"download",label:"Markdown",icon:nu},{id:"print",label:"Print",icon:ru}],zr=class extends q{static styles=[...q.styles,M(su),M(Hd)];static properties={mode:{type:String},included:{type:Number},excluded:{type:Number},total:{type:Number},filters:{attribute:!1},fields:{attribute:!1},bucketLabel:{type:String},focusedOnly:{type:Boolean},oneSamplePerGroup:{type:Boolean}};constructor(){super(),this.mode="download",this.included=0,this.excluded=0,this.total=0,this.filters=[],this.fields=null,this._relaxed=!1,this.bucketLabel=null,this.focusedOnly=!1,this.oneSamplePerGroup=!1}get _focusedOnly(){return this.mode==="print"&&this.focusedOnly}_selectTab(e){this.mode!==e&&(this.mode=e)}focusInitial(){let e=this.included===0?'button[data-role="cancel"]':"button.primary";this.renderRoot.querySelector(e)?.focus()}_finish(e){this._settled||super._finish({confirmed:e==="confirm",view:e==="view",fields:this._relaxed?this.fields:null,mode:this.mode,oneSamplePerGroup:this.oneSamplePerGroup})}_onClose=()=>this._finish("cancel");_onCancel=()=>this._finish("cancel");_onView=()=>this._finish("view");_onConfirm=()=>this._finish("confirm");async _onDropFilter(e){let t=this.filters.findIndex(o=>o.key===e);if(t===-1)return;let n=tn(this.mode,{...this.fields,...this.filters[t].clear});this._relaxed=!0,this.fields=n.fields,this.filters=n.filters,this.included=n.included,this.excluded=n.excluded,this.total=n.total,await this.updateComplete;let r=[...this.renderRoot.querySelectorAll("button[data-drop]")];(r[Math.min(t,r.length-1)]??this.renderRoot.querySelector("button.primary")??this.renderRoot.querySelector('button[data-role="cancel"]'))?.focus()}_countSection(){if(this.total===0)return a`<p class="ecd-count">No findings to ${this.mode==="print"?"print":"download"}.</p>`;if(this._focusedOnly&&this.included>0)return a`<p class="ecd-count">Only the <strong>focused</strong> finding will be printed.</p><p class="ecd-excluded">Focus mode prints just the finding you're viewing. Switch to the list or grouped view to print all ${this.included} matching ${this.included===1?"finding":"findings"}.</p>`;let t=this.excluded===0&&this.filters.length===0?a`All <strong>${this.included}</strong> ${this.included===1?"finding":"findings"} included.`:a`<strong>${this.included}</strong> of ${this.total} ${this.total===1?"finding":"findings"} included.`;return a`<p class="ecd-count">${t}</p>${this.excluded>0?a`<p class="ecd-excluded">${this.excluded} filtered out and ${this.mode==="print"?"won't be printed":"won't be downloaded"}.</p>`:m}`}_filtersSection(){return this.filters.length===0?a`<p class="ecd-filters-label">No filters active — the full ${this.bucketLabel?`${this.bucketLabel.toLowerCase()} `:""}set is included.</p>`:a`<p class="ecd-filters-label">Active filters</p><dl class="ecd-filters">${this.filters.map(e=>a`<dt>${e.label}</dt><dd><span class="ecd-filter-value">${e.value}</span> <button type="button" class="ecd-filter-drop" data-drop="${e.key}" aria-label="${`Drop the ${e.label.toLowerCase()} filter (${e.value}) from this export`}" @click="${()=>this._onDropFilter(e.key)}">×</button></dd>`)}</dl>`}render(){let e=this.mode==="print",t=this._focusedOnly?"You're in focus mode \u2014 printing outputs just the finding you're focused on.":e?"Prints only the findings matching your current filters \u2014 the same set shown on screen. Use the toolbar to change the selection first.":"Downloads a Markdown file of the findings matching your current filters \u2014 the same set shown on screen. Use the toolbar to change the selection first.";return a`<dialog @close="${this._onClose}"><header>${Fl({tabs:em,current:this.mode,prefix:"ecd",select:n=>this._selectTab(n)})}</header><div role="tabpanel" id="${`ecd-panel-${this.mode}`}" aria-labelledby="${`ecd-tab-${this.mode}`}"><p class="nwd-intro">${t}</p>${this._countSection()} ${this.bucketLabel?a`<p class="nwd-note">Scoped to the <strong>${this.bucketLabel}</strong> list — live findings are not included.</p>`:m} ${this._filtersSection()} <label class="ecd-samples"><input type="checkbox" .checked="${this.oneSamplePerGroup}" @change="${n=>{this.oneSamplePerGroup=n.target.checked}}"> <span>One sample per group<span class="ecd-samples-hint">Include only the currently selected sample from each group.</span></span></label></div><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> ${e?m:a`<button type="button" data-role="view" ?disabled="${this.included===0}" @click="${this._onView}">View</button>`} <button type="button" class="primary" ?disabled="${this.included===0}" @click="${this._onConfirm}">${e?"Print":"Download"}</button></footer></dialog>`}};customElements.define("export-confirm-dialog",zr);function ou(i="download"){let e=tn(i),t=i==="print"?e.focusedOnly:tn("print").focusedOnly;return new Promise(n=>{let r=document.createElement("export-confirm-dialog");Object.assign(r,{mode:i,included:e.included,excluded:e.excluded,total:e.total,filters:e.filters,fields:e.fields,bucketLabel:e.bucketLabel,focusedOnly:t});let s=o=>{r.remove(),n(o)};r.addEventListener("resolve",o=>s({confirmed:!!o.detail?.confirmed,view:!!o.detail?.view,fields:o.detail?.fields??null,mode:o.detail?.mode??i,oneSamplePerGroup:!!o.detail?.oneSamplePerGroup})),r.addEventListener("modal-conflict",()=>s({confirmed:!1,view:!1,fields:null,mode:i})),document.body.append(r)})}var tm=160,im=320,nm=/^ {0,3}#{1,6}(?: |$)/u,rm=/^ {0,3}(?:=+|-+) *$/u,nn=/^\|?[^|\n]+(?:\|[^|\n]+)+\|?$/u,au=/^\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?$/u;function lu(i,e=i.join(`
|
|
26
|
+
`),{target:t=tm,max:n=im}={}){let r=i.length;if(r===0)return[];let s=ta(e),o=0,c=0,u=()=>{for(;o<s.length&&s[o][1]<=c-1;)o++;return o<s.length&&c-1>=s[o][0]},d=g=>i[g].trim()==="",p=g=>nn.test(i[g]),h=g=>!u()&&!(au.test(i[g])&&p(g-1))&&!(rm.test(i[g])&&!d(g-1)),f=g=>d(g-1)||nm.test(i[g]),b=[],v=0;for(let g=1;g<r;g++){c+=i[g-1].length+1;let y=g-v;y<t||!h(g)||(y>=n||f(g))&&(b.push([v,g]),v=g)}return b.push([v,r]),b}function cu(i,e){if(e<2||!nn.test(i[e])||!nn.test(i[e-1]))return null;let t=e-1;for(;t>0&&nn.test(i[t-1]);)t--;for(let n=t+1;n<e;n++)if(au.test(i[n]))return[n-1,n+1];return null}function du(i){return i.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">")}var uu=`dialog{max-width:none;max-height:none;width:calc(100vw - 4rem);height:calc(100vh - 4rem);margin:2rem auto;position:relative;padding:12px}dialog[open]{display:flex;flex-direction:column}dialog::backdrop{backdrop-filter:none}header{display:flex;align-items:center;gap:.45rem;margin-bottom:.6rem;padding-right:3rem;user-select:none}header h3{margin:0}.evd-close{position:absolute;top:6px;right:6px;z-index:1;width:22px;height:22px;display:grid;place-items:center;background:transparent;border:0;border-radius:var(--ui-radius, 4px);color:var(--muted);font:500 16px/1 ui-monospace,monospace;cursor:default;&:hover{color:var(--accent);background:var(--surface-active)}&:focus-visible{outline:2px solid var(--accent);outline-offset:1px}}.evd-code{flex:1 1 auto;min-height:0;margin:0;overflow:auto;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);background:var(--bg, var(--surface));color:var(--text);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.78rem;line-height:1.55;scrollbar-width:thin;scrollbar-color:var(--border) transparent;&::-webkit-scrollbar{width:6px;height:6px}&::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}}.evd-lines{--evd-gutter: calc(var(--evd-lineno-width, 3ch) + 1.4rem);padding:.5rem 0;background-image:linear-gradient(to right,rgb(from var(--text) r g b / .03) 0 calc(var(--evd-gutter) - 1px),var(--border) calc(var(--evd-gutter) - 1px) var(--evd-gutter),transparent var(--evd-gutter))}.evd-chunk{display:grid;grid-template-columns:var(--evd-gutter) minmax(0,1fr);align-items:start;content-visibility:auto;contain-intrinsic-size:auto calc(var(--evd-chunk-lines, 1) * 1.55em)}.evd-chunk.evd-pending{display:block;padding:0 .75rem 0 calc(var(--evd-gutter) + .6rem);white-space:pre-wrap;overflow-wrap:anywhere}.evd-lineno{padding:0 .55rem 0 .4rem;color:var(--muted);text-align:right;font-variant-numeric:tabular-nums;user-select:none}.evd-line{padding:0 .75rem 0 .6rem;font:inherit;background:none;white-space:pre-wrap;overflow-wrap:anywhere}.evd-meta{color:var(--muted);font-size:.74rem;font-variant-numeric:tabular-nums}.evd-copy{margin-left:auto;flex-shrink:0;height:1.75rem;padding:0 .55rem;gap:.35rem;display:inline-flex;align-items:center;background:transparent;color:var(--muted);border:1px solid var(--border);border-radius:var(--ui-radius, 3px);font:inherit;font-size:.72rem;font-weight:500;letter-spacing:.02em;cursor:default;&:hover{color:var(--accent);background:var(--surface-active)}&:focus-visible{outline:2px solid var(--accent);outline-offset:1px}&.evd-done{color:var(--green, #4ade80);background:color-mix(in srgb,var(--green, #4ade80) 14%,transparent)}&.evd-failed{color:var(--critical, #f87171);background:color-mix(in srgb,var(--critical, #f87171) 14%,transparent)}}
|
|
27
|
+
`;var om=a`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><rect x="3" y="2.5" width="8" height="10" rx="1" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/><rect x="5.5" y="5" width="8" height="9" rx="1" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`;function am(i,e,t,n=null){let r="";for(let s=e;s<t;s++){let o=n===null?du(i[s]):n[s-e];r+=`<span class="evd-lineno" aria-hidden="true">${s+1}</span><code class="evd-line">${o}
|
|
28
|
+
</code>`}return r}var qr=class extends q{static styles=[...q.styles,M(kt),M(uu)];static properties={markdown:{attribute:!1},_copied:{state:!0}};_lines=[];_kb="0.0";_chunks=[];_copiedTimer=null;constructor(){super(),this.markdown="",this._copied=""}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}willUpdate(e){if(!e.has("markdown"))return;let t=this.markdown.split(`
|
|
29
|
+
`),n=t.length>1&&t.at(-1)===""?t.length-1:t.length;this._lines=t.slice(0,n),this._kb=(new TextEncoder().encode(this.markdown).length/1024).toFixed(1),this._chunks=lu(this._lines,this.markdown).map(([r,s])=>({start:r,end:s,asked:!1}))}render(){let e=this._lines.length,t=this._copied==="done"?"Copied":this._copied==="failed"?"Copy failed":"Copy",n=this._copied==="failed"?"Select the text and copy it by hand":m;return a`<dialog @close="${this._onClose}"><button type="button" class="evd-close" data-role="cancel" aria-label="Close" @click="${this._onClose}">×</button><header><h3>Report markdown</h3><span class="evd-meta">· ${e} ${e===1?"line":"lines"} · ${this._kb} KB</span> <button type="button" class="evd-copy ${this._copied==="done"?"evd-done":this._copied==="failed"?"evd-failed":""}" data-role="copy" data-tooltip="${n}" @click="${this._onCopy}">${om}${t}</button></header><div class="evd-code" tabindex="0"><div class="evd-lines" style="--evd-lineno-width: ${String(e).length}ch">${this._chunks.map((r,s)=>a`<div class="evd-chunk evd-pending" data-chunk="${s}" style="--evd-chunk-lines: ${r.end-r.start}"></div>`)}</div></div></dialog>`}updated(){if(this.isConnected)for(let e of this.renderRoot.querySelectorAll(".evd-chunk:not([data-watched])")){e.dataset.watched="";let t=Number(e.dataset.chunk),n=this._chunks[t];e.textContent=`${this._lines.slice(n.start,n.end).join(`
|
|
30
30
|
`)}
|
|
31
|
-
`,xt(e,
|
|
32
|
-
`),o=await yt(s,"markdown");if(!this.isConnected)return;let c=o===null?null:Ni(o).slice(
|
|
33
|
-
`;var
|
|
34
|
-
`;var lm={revalidate:"Outcome",revalidateVerdict:"Explanation",revalidateRecommendation:"Recommendation"},Un=class extends q{static styles=[...q.styles,M(bt),M($t),M(pu)];static properties={conflicts:{attribute:!1}};constructor(){super(),this.conflicts=[]}render(){return a`<dialog aria-labelledby="revalidation-conflicts-title" @close="${this._onClose}"><header><h3 id="revalidation-conflicts-title">Revalidation conflicts</h3><p class="nwd-intro">Reports disagree about ${this.conflicts.length} finding${this.conflicts.length===1?"":"s"}. App view is unavailable until the conflicting reports are separated or updated.</p></header><ul class="conflicts-list">${this.conflicts.map(({finding:e,copies:t})=>a`<li class="conflict-card"><div class="finding-meta">${vt(e.severity)} ${e.file?a`<span class="location">${e.file}${Fe(e.line)?`:${Aa(Fe(e.line))}`:""}</span>`:m} <code>${Ba(e.id)??e.id}</code></div><h4>${Bt(e)}</h4><dl>${Vl(t).map(({field:r,variants:n})=>a`<dt>${lm[r]??r}</dt>${n.map(({value:s,reports:o})=>a`<dd class="variant"><div class="value">${s||a`<em>Empty</em>`}</div><div class="reports">${o.map(c=>c?a`<button type="button" class="report-button" aria-label="${`Open ${Qr(c)} at this finding`}" @click="${()=>this._finish({id:e.id,reportName:c})}">${J(Xr[Ll(c)]??Xr.default)}<span>${Qr(c)}</span></button>`:a`<span>Loaded report</span>`)}</div></dd>`)}`)}</dl></li>`)}</ul><footer class="nwd-actions"><span class="nwd-spacer"></span><button type="button" @click="${this._onClose}">Close</button></footer></dialog>`}};customElements.define("revalidation-conflicts-dialog",Un);function hu(i){return Y("revalidation-conflicts-dialog",{conflicts:[...i.values()]})}var mu=2;function fu(i,e){l.focusSplit=e,i.closest(".focus-main")?.style.setProperty("--focus-split",String(e)),i.setAttribute("aria-valuenow",String(Math.round(e)))}function gu(){try{localStorage.setItem(Xa,String(l.focusSplit))}catch{}}function bu(i,e){fu(i,on(e)),gu()}function vu(i,e){bu(i,l.focusSplit+e)}function yu(i){bu(i,el)}function _u(i,e){let t=i.closest(".focus-main");if(!t)return;e.preventDefault(),i.classList.add("dragging");try{i.setPointerCapture(e.pointerId)}catch{}let r=s=>{let o=t.getBoundingClientRect();o.width!==0&&fu(i,on((s.clientX-o.left)/o.width*100))},n=()=>{i.removeEventListener("pointermove",r),i.removeEventListener("pointerup",n),i.removeEventListener("pointercancel",n),i.classList.remove("dragging"),gu()};i.addEventListener("pointermove",r),i.addEventListener("pointerup",n),i.addEventListener("pointercancel",n)}function cm(i,e){return jl(Oi(i)).map(t=>e?[$e(t)]:Xl(t))}var dm={annotation(i){let e=Ze(i),t=Jl(i);return!e&&!t?null:{triage:e?.triage,color:e?.color,comment:e?.comment,fix:e?.fix,flagged:e?.flagged===!0,ignored:t}},location:i=>Li(i,jt(i)),evidence:(i,e,t)=>Ia(i,e,jt(e),t),commit:i=>Da(i.repo?.github,i.commitHash),report:i=>i._reportName??null};function um(i,e){let t=new Set(i.map(s=>s.repo??null)),r=t.size===1?[...t][0]:null;if(r)return r;let n=new Set;for(let s of e)for(let o of s)o.repo?.github&&!Ri(o.file)&&n.add(o.repo.github);return n.size===1?[...n][0]:n.size===0&&!l.currentWorkspace&&l.repoUrl?l.repoUrl:null}function jn(i){return i.replace(/\.(?:json|md|codex)$/iu,"")}function wu(){return l.currentWorkspace?he().find(i=>i.id===l.currentWorkspace)??null:null}function pm(i,e){if(e)return e.name;let t=i.map(n=>n.fileName);return t.length===1?jn(t[0]):zt(t).replace(/[-_. ]+$/u,"")||`${t.length} reports`}function Vn({oneSamplePerGroup:i=!1}={}){let e=l.reports,t=zl(),r=Bn(),n=cm(r,i),s=wu(),o=e.flatMap(d=>d.groups??[]),c=o.some(d=>d.some(na)),u=o.some(d=>d.some(Ma));return oa({title:pm(e,s),workspace:s?.name??null,reports:e.map(d=>({name:d.fileName,source:d.source})),repo:um(e,n),generatedAt:new Date,view:{bucket:Nn(),severityMode:c?l.severityMode:null,revalidation:u?l.showRevalidation:null,revalidationDetail:u&&l.showRevalidation!==!1?Wl():null},filters:On(t),counts:{included:n.length,total:r.length},groups:n},dm)}function hm(){let i=wu(),e=l.reports.map(r=>r.fileName),t="";return i?t=i.name:e.length===1?t=jn(e[0]):e.length>1&&(t=jn(zt(e))),t=t.replaceAll(/[\\/:*?"<>|\p{Cc}]/gu,"-").trim(),`${t||"deepview-report"}.md`}function ku(i){if(l.reports.length===0)return;let e=new Blob([Vn(i)],{type:"text/markdown;charset=utf-8"});Ge(e,hm())}function rr(i){return!H()||!me.active||!l.currentManagedTeam?null:me.navigate(Jr({view:i,teamId:l.currentManagedTeam,reportId:l.currentManagedReport},l.managedTeams))}var Xn=!1;nl(()=>{if(Xn)return;Xn=!0;let i=2;function e(){--i===0&&mm()}requestAnimationFrame(e),setTimeout(e,350)});function mm(){Xn=!1,l.findingIndexTick++,l.currentView==="bundles"&&l.selectedBundle?$():l.currentView==="packages"?$():l.currentView==="repositories"?$():l.currentView==="links"?$():(l.currentView==="findings"||l.currentView==="files")&&(fe().catch(()=>{}),$())}var Kn=!1;sl(()=>{l.currentView!=="findings"&&l.currentView!=="files"&&!Xe()||Kn||(Kn=!0,queueMicrotask(()=>{Kn=!1,!(l.currentView!=="findings"&&l.currentView!=="files"&&!Xe())&&(l.bundleHashTick++,$())}))});dl(()=>{l.linksTick++,$()});function $u(){l.currentView==="bundles"&&l.bundleDetailsTab==="graph"?$d():Sd()}function lr(){l.currentView==="bundles"&&l.bundleDetailsTab==="graph"?xd():Cd()}function ti(){let i=document.querySelector(".bundle-source-code-wrap"),e=i?.scrollTop??0,t=i?.scrollLeft??0;$();let r=document.querySelector(".bundle-source-code-wrap");r&&(r.scrollTop=e,r.scrollLeft=t)}function rt(i){let t=document.querySelector(i)?.scrollTop??0;$();let r=document.querySelector(i);r&&(r.scrollTop=t)}function Me(){l.viewMode==="table"?rt(".findings-table-list"):$()}var Gn=0;function xu(){Gn||(Gn=requestAnimationFrame(()=>{Gn=0,$()}))}function B(i,e){for(let t of i.composedPath())if(t?.matches?.(e))return t;return null}function or(i,e){queueMicrotask(()=>{let t=document.querySelector(`.bundle-source-lineno-row[data-line="${i}"]`);t&&t.scrollIntoView(e)})}function Ru(i){i.classList.add("copied"),setTimeout(()=>i.classList.remove("copied"),1e3)}function nr(i,e){try{navigator.clipboard.writeText(e).then(()=>(Ru(i),null)).catch(()=>{})}catch{}}function Lu(i){let e=gn(l.bundleCodeHistory,l.bundleDetails?.integrity??null,l.bundleSourceFile);l.bundleCodeHistory=Hc(e,i),l.bundleSourceFile=i}function Wn(i=!1){queueMicrotask(()=>{let e=document.querySelector(".bundle-source-code-wrap");e&&(e.scrollTop=0,e.scrollLeft=0),i&&e?.querySelector(".bundle-source-code")?.focus({preventScroll:!0})})}window.addEventListener("hashchange",()=>{if(!H()||ga()||l.currentView!=="bundles"||l.bundleDetailsTab!=="code")return;let i=pa(new URL(location.href));if(i?.bundleTab!=="code"||i.file==null||i.file!==xc(l)?.file)return;let e=l.bundleSourceFile,t=i.endLine??i.line;l.bundleSourceTargetLine=i.line&&t<=ya(Si(l.bundleDetails).get(e)??"")?{bundle:l.bundleDetails?.integrity??null,path:e,line:i.line,...i.endLine?{end:i.endLine}:{}}:null,$(),l.bundleSourceTargetLine&&or(i.line,{block:"center"})});function Mu(i){let e=i.target.closest("[data-bundle-source-line]");if(e){let o=Number(e.dataset.bundleSourceLine),c=l.bundleDetails?.integrity??null,u=l.bundleSourceFile,d=l.bundleSourceTargetLine,p=d?.bundle===c&&d.path===u?d:null;if(i.shiftKey&&p){let h=p.anchor??p.line;l.bundleSourceTargetLine={bundle:c,path:u,line:Math.min(h,o),end:Math.max(h,o),anchor:h}}else p?.line===o&&!(p.end>o)?l.bundleSourceTargetLine=null:l.bundleSourceTargetLine={bundle:c,path:u,line:o};return ti(),!0}let t=i.target.closest("[data-bundle-source-wrap]");if(t){let o=Ac(t);l.bundleSourceWrap=!l.bundleSourceWrap;try{localStorage.setItem(Za,String(l.bundleSourceWrap))}catch{}return $(),queueMicrotask(o),!0}if(i.target.closest("[data-bundle-source-pretty]"))return Yt(),$(),Wn(),!0;let r=i.target.closest("[data-bundle-code-history]");if(r){let o=gn(l.bundleCodeHistory,l.bundleDetails?.integrity??null,l.bundleSourceFile),c=Uc(o,r.dataset.bundleCodeHistory==="back"?-1:1),u=c.files[c.at];return c.at===o.at||!Si(l.bundleDetails).has(u)||(l.bundleCodeHistory=c,l.bundleSourceFile=u,l.bundleSourceFindingIdx=null,l.bundleCodeSearchMode="files",l.bundleCodeSearchQuery="",rt(".bundle-code-rail-body"),Qt(),Wn()),!0}let n=i.target.closest("[data-bundle-source-link]");if(n){let o=n.dataset.bundleSourceLink,c=n.closest(".focus-pane-code");if(c){let u=ii(i),d=pc(u,c.dataset.focusCodeIntegrity,c.dataset.focusCodeFile,o);return d&&(ts(u,d),queueMicrotask(()=>c.querySelector(".focus-code-source")?.focus({preventScroll:!0}))),!0}return Si(l.bundleDetails).has(o)&&(l.currentView==="bundles"&&l.bundleDetailsTab==="search"&&(_t("code",{preserveSource:!0}),l.selectedBundle&&Be(l.selectedBundle,"code",{push:!0})),Lu(o),l.bundleSourceFindingIdx=null,l.bundleDetailsTab==="code"&&(l.bundleCodeSearchMode="files",l.bundleCodeSearchQuery=""),rt(".bundle-code-rail-body"),Qt(),Wn(!0)),!0}if(i.target.classList?.contains("bundle-source-overlay")||i.target.closest('[data-action="bundle-source-close"]'))return l.bundleSourceFile&&(_t(l.bundleDetailsTab),$()),!0;if(i.target.closest('[data-action="bundle-source-panel-close"]'))return l.bundleSourceFindingIdx!=null&&(l.bundleSourceFindingIdx=null,ti()),!0;let s=i.target.closest("[data-bundle-source-finding]");if(s){let o=parseInt(s.dataset.bundleSourceFinding,10);return Number.isFinite(o)&&(l.bundleSourceFindingIdx=l.bundleSourceFindingIdx===o?null:o,ti()),!0}return!1}function Su(i){let e=ii(i);if(!e)return null;let t=$e(e);return Oa(t,Ql(t))}R.addEventListener("click",i=>{if(B(i,"[data-finding-history]")){let w=ii(i),C=w&&$e(w);Sl(C)&&Dd(C);return}let e=B(i,"[data-code-nav-file]");if(e){ts(ii(i),{integrity:e.dataset.codeNavIntegrity,file:e.dataset.codeNavFile,range:Fe(e.dataset.codeNavLine)});return}let t=B(i,"[data-code-history]");if(t){gm(t.dataset.codeHistory==="forward"?1:-1);return}let r=B(i,"[data-code-preview]");if(r){let w=r.dataset.codePreview,C=new Set(l.codePreviews);C.delete(w)||C.add(w),l.codePreviews=C,$();return}let n=B(i,"[data-finding-code-report]");if(n&&H()){Xd({reportId:n.dataset.findingCodeReport,file:n.dataset.findingCodeFile,line:n.dataset.findingCodeLine});return}let s=B(i,"[data-finding-code-bundle]");if(s){let w=s.dataset.findingCodeBundle,C=s.dataset.findingCodeFile,P=s.dataset.findingCodeLine,L=P?parseInt(P,10):null;l.bundleSourceFile=C||null,l.bundleCodeHistory=null,l.bundleSourceFindingIdx=null,(l.bundleDetailsTab==="code"||l.bundleDetailsTab==="search")&&(l.bundleDetailsTab="overview");let V=()=>{Number.isFinite(L)&&or(L,{block:"start",behavior:"instant"})};if(l.selectedBundle===w&&l.bundleDetails?.integrity===w){$(),zi().then(()=>(l.selectedBundle===w&&l.bundleSourceFile===C&&V(),null));return}l.selectedBundle=w,l.selectedBundleWorkspace=null,l.bundleDetails=null,$(),(async()=>(await wt(w),V()))();return}let o=i.target.closest("[data-package-expand]");if(o){let w=o.dataset.packageExpand;l.expandedPackages.has(w)?l.expandedPackages.delete(w):l.expandedPackages.add(w),$();return}let c=i.target.closest("[data-package-row-issues]");if(c){let w=c.dataset.packageRowIssues,C=c.dataset.packageRowIssuesVersion;l.selectedPackage=w,l.selectedPackageVersion=C||null,l.packageDetailsTab="issues",l.packageSlideTriage=null,l.packageSlideTransient=!0,$();return}let u=i.target.closest("[data-repository-row-issues]");if(u){let w=u.dataset.repositoryRowIssues;l.selectedRepository=w,l.repositoryDetailsTab="issues",l.repositorySlideTriage=null,l.repositorySlideTransient=!0,$();return}let d=i.target.closest("[data-select-package]");if(d){let w=d.dataset.selectPackage,C=d.dataset.selectPackageVersion??"",P=C===""?null:C;if(l.selectedPackage===w&&l.selectedPackageVersion===P)return;l.selectedPackage=w,l.selectedPackageVersion=P,l.packageDetailsTab="overview",l.packageSlideTriage=null,l.packageSlideTransient=!1,$();return}if(i.target.closest("[data-deselect-package]")){l.selectedPackage=null,l.selectedPackageVersion=null,$();return}let p=i.target.closest("[data-package-tab]");if(p){let w=p.dataset.packageTab;(w==="overview"||w==="issues")&&l.packageDetailsTab!==w&&(l.packageDetailsTab=w,$());return}if(i.target.closest('[data-action="package-slide-back"]')){l.packageDetailsTab="overview",l.packageSlideTriage=null,l.packageSlideTransient&&(l.selectedPackage=null,l.selectedPackageVersion=null,l.packageSlideTransient=!1),$();return}let h=B(i,"[data-links-report][data-links-finding]");if(h){i.preventDefault();let{linksReport:w,linksFinding:C,managedReport:P}=h.dataset;w&&C&&(async()=>{let L=await Tn(C,w,P);L.ok||alert(L.reason)})().catch(L=>console.warn("links: reveal in report failed:",L));return}let f=i.target.closest("[data-package-report]");if(f){let w=f.dataset.packageReport;w&&tt(w);return}let b=i.target.closest("[data-select-repository]");if(b){let w=b.dataset.selectRepository;if(l.selectedRepository===w)return;l.selectedRepository=w,l.repositoryDetailsTab="overview",l.repositorySlideTriage=null,l.repositorySlideTransient=!1,$();return}if(i.target.closest("[data-deselect-repository]")){l.selectedRepository=null,$();return}let v=i.target.closest("[data-repository-tab]");if(v){let w=v.dataset.repositoryTab;(w==="overview"||w==="issues")&&l.repositoryDetailsTab!==w&&(l.repositoryDetailsTab=w,$());return}if(i.target.closest('[data-action="repository-slide-back"]')){l.repositoryDetailsTab="overview",l.repositorySlideTriage=null,l.repositorySlideTransient&&(l.selectedRepository=null,l.repositorySlideTransient=!1),$();return}let g=i.target.closest("[data-bundle-tab]");if(g){let w=g.dataset.bundleTab;if(ki.has(w)||w==="review"&&l.bundleDetails?.npm){if(w===l.bundleDetailsTab){l.selectedBundle&&Be(l.selectedBundle,w);return}l.bundleDetailsTab==="graph"&&w!=="graph"&&(oe(),document.body.classList.remove("report-fullscreen")),Sc(l,w,C=>Kc(C)?.oldVersion??null),_t(w),l.selectedBundle&&Be(l.selectedBundle,w,{push:!0}),$(),w==="code"&&zi().then(()=>(l.bundleDetailsTab==="code"&&Qt(),null))}return}if(i.target.closest("[data-bundle-retry-sources]")){l.bundleDetails&&delete l.bundleDetails.sourceError,$();return}let y=i.target.closest("[data-bundle-download]");if(y){let w=y.dataset.bundleDownload,C=(l.bundles??[]).find(P=>P.integrity===w);if(!C)return;(async()=>{let{confirmed:P}=await Qd({name:C.name,encrypted:we()});if(P)try{let L=await rl(w);Ge(new Blob([L],{type:"application/octet-stream"}),C.name)}catch(L){alert(`Failed to download bundle: ${L.message}`)}})();return}let k=i.target.closest("[data-bundle-export-sbom]");if(k){let w=k.dataset.bundleExportSbom,C=l.bundleDetails,P=(l.bundles??[]).find(L=>L.integrity===l.selectedBundle);if(!P||!C||C.integrity!==P.integrity)return;try{let L=w==="cyclonedx",V=L?bd(C,P):vd(C,P),ae=`${gd(P.name)}.${L?"cdx":"spdx"}.json`;Ge(new Blob([V],{type:"application/json"}),ae)}catch(L){alert(`Failed to export ${w==="cyclonedx"?"CycloneDX":"SPDX"}: ${L.message}`)}return}if(B(i,"[data-bundle-search-context]")){l.bundleSearchContext=!l.bundleSearchContext,rt(".bundle-search-results");return}if(i.target.closest("[data-advisories-consent]")){wd(),$();return}if(i.target.closest("[data-advisories-retry]")){kd(l.bundleDetails,$).catch(()=>{}),$();return}let x=i.target.closest("[data-bundle-issue-report]");if(x){let w=x.dataset.bundleIssueReport;w&&tt(w);return}if(Mu(i))return;let S=i.target.closest("[data-bundle-code-issue-step]");if(S){let w=S.closest("[data-bundle-code-issue-order]"),C=null;try{C=JSON.parse(w?.dataset.bundleCodeIssueOrder??"null")}catch{}if(Array.isArray(C)&&C.length>0){let P=S.dataset.bundleCodeIssueStep==="-1"?-1:1,L=C.findIndex(ae=>ae.idx===l.bundleSourceFindingIdx),V=L===-1?P>0?C[0]:C.at(-1):C[(L+P+C.length)%C.length];l.bundleSourceFindingIdx=V.idx,ti(),V.line>0&&or(V.line,{block:"center",behavior:"smooth"})}return}let T=B(i,"[data-bundle-view-source]");if(T){let w=T.dataset.bundleViewSource;if(!w)return;let C=T.dataset.bundleViewFindingIdx,P=C===void 0?null:parseInt(C,10),L=T.dataset.bundleViewLine,V=L?parseInt(L,10):null;Number.isFinite(V)&&(l.bundleSourcePretty=!1);let ae=l.bundleSourceFile!==w;if(Lu(w),Number.isFinite(P)?l.bundleSourceFindingIdx=P:ae&&(l.bundleSourceFindingIdx=null),l.bundleSourceTargetLine=Number.isFinite(V)?{bundle:l.bundleDetails?.integrity??null,path:w,line:V}:null,T.closest(".bundle-code-rail")?rt(".bundle-code-rail-body"):T.closest(".bundle-search-results")?rt(".bundle-search-results"):T.closest(".bundles-slide-body")?rt(".bundles-slide-body"):$(),Number.isFinite(V)){let ve=T.dataset.bundleViewScrollBlock||"center";zi().then(()=>(l.bundleSourceFile===w&&or(V,{block:ve,behavior:"smooth"}),null))}return}let F=i.target.closest('[data-action="workspace-reports"], [data-action="workspace-bundles"]');if(F){let w=F.dataset.action.slice(10);l.currentView!==`workspace-${w}`&&Xi(l.currentManagedTeam??l.currentWorkspace,w);return}if(i.target.closest('[data-action="workspace-findings"]')){if(l.currentView==="findings")return;if(l.currentView==="files"){if(rr("findings"))return;l.currentView="findings",l.filesSelectedFile=null,document.body.classList.remove("report-fullscreen"),$()}else H()?Cn(l.managedTeams.find(w=>w.id===l.currentManagedTeam)):it(l.currentWorkspace);return}let O=i.target.closest("[data-workspace-report]");if(O){H()?Cn(l.managedTeams.find(w=>w.id===l.currentManagedTeam),O.dataset.workspaceReport):tt(O.dataset.workspaceReport,void 0,{workspaceId:l.currentWorkspace});return}let A=i.target.closest("[data-workspace-bundle]");if(A){if(H())me.navigate(Jr({view:"bundles",teamId:l.currentManagedTeam,bundleId:A.dataset.workspaceBundle,bundleTab:"overview"},l.managedTeams));else{let w=A.dataset.workspaceBundle;Kt(w,"overview",{workspaceId:l.currentWorkspace}),Be(w,"overview"),$(),fe(),wt(w)}return}if(i.target.closest('[data-action="toggle-files"]')){if(rr(l.currentView==="files"?"findings":"files"))return;if(l.currentView==="workspace-reports"||l.currentView==="workspace-bundles"){l.currentView="files",it(l.currentWorkspace);return}l.currentView==="files"?l.currentView="findings":(l.viewMode==="graph"&&oe(),l.currentView="files"),document.body.classList.remove("report-fullscreen"),$();return}let Z=B(i,"[data-g2-pkg]");if(Z){let w=Z.dataset.g2Pkg;E.solo=E.solo===w?null:w,E.solo&&(E.selected=null),$u(),lr(),E.graphState?.requestDraw?.();return}let re=B(i,"[data-g2-select]");if(re){E.selected=re.dataset.g2Select,$u(),E.graphState?.requestDraw?.();return}let ne=B(i,"[data-g2-top-pkgs]");if(ne){E.topPkgsTab=ne.dataset.g2TopPkgs,lr();return}let jr=B(i,"[data-g2-jump-findings]");if(jr){if(l.currentView==="bundles"){l.bundleDetailsTab==="graph"&&oe(),_t("issues"),l.selectedBundle&&Be(l.selectedBundle,"issues",{push:!0}),$();return}if(Bl(),l.filterConfMin=0,l.filterInclude=jr.dataset.g2JumpFindings,l.currentView="findings",l.viewMode==="graph"&&(l.viewMode="table"),oe(),rr("findings"))return;$();return}let se=B(i,"[data-g2-jump-file]");if(se){let w=se.dataset.g2JumpFile;oe();let C=()=>requestAnimationFrame(()=>{let L=document.querySelector(`#${qa(w)}`);L&&L.scrollIntoView({behavior:"smooth",block:"start"})}),P=rr("files");if(P){P.then(L=>L?C():void 0);return}l.currentView="files",$(),C();return}if(B(i,"#g2-path-filter-clear")){E.pathFilter="";let w=document.querySelector("graph-layout")?.shadowRoot?.querySelector("#g2-path-filter");w&&(w.value=""),E.graphState?.requestDraw?.();return}if(B(i,"#g2-fullscreen")){document.body.classList.toggle("report-fullscreen");return}if(B(i,"[data-g2-show-all]")){E.showAll=!E.showAll,E.layoutCache=null,E.selected=null,oe(),$();return}if(B(i,"[data-g2-packages-view]")){E.bundleLayout==="flow"?E.flowPackagesView=!E.flowPackagesView:E.bundleLayout==="dependencies"?(E.dependencyPackagesView=!E.dependencyPackagesView,E.solo=null):E.packagesView=!E.packagesView,E.layoutCache=null,E.selected=null,E.focusedPkg=null,oe(),$();return}if(B(i,"[data-g2-bundle-issues]")){E.bundleIssues=!E.bundleIssues,oe({keepViewport:!0}),$();return}let Dt=B(i,"[data-g2-layout]");if(Dt){let w=Dt.dataset.g2Layout;if(!["graph","layers","matrix","dependencies","flow"].includes(w)||E.bundleLayout===w&&!E.focusedPkg)return;E.bundleLayout=w,w==="dependencies"&&(E.dependencyPackagesView=!1),E.layoutCache=null,E.selected=null,E.solo=null,E.focusedPkg=null,oe(),$();return}let hi=B(i,".graph2-triage-selector [data-triage-show]");if(hi){let w=hi.dataset.triageShow;l.shownTriage=l.shownTriage===w?null:w,E.layoutCache=null,E.selected=null,oe(),$();return}let mi=B(i,"[data-g2-focus-pkg]");if(mi){E.focusedPkg=mi.dataset.g2FocusPkg,E.layoutCache=null,oe(),$();return}if(B(i,"#g2-back-to-full")){E.focusedPkg=null,E.layoutCache=null,(E.packagesView||E.bundleLayout==="layers")&&(E.selected=null),oe(),$();return}let dt=B(i,".tab");if(dt&&B(i,".tabs")){let C=B(i,"[data-gid]").dataset.gid,P=dt.dataset.tid;l.activeTabByGroup.set(C,P),Me();return}let je=B(i,"[data-triage-action]");if(je){let w=je.closest(".triage-menu"),C=w?.dataset.gid;if(!C)return;let P=de(C);if(!P)return;let L=je.dataset.triageAction;if(!["inprogress","fixed","invalid","deleted","ignored","restore"].includes(L))return;let{targets:V,clearing:ae}=tc(P,L);if(V.length===0)return;Pu(V,ae?"untriaged":L);try{w.hidePopover()}catch{}ke(),Me();return}if(B(i,".mark-comment")){let C=B(i,"[data-gid]").dataset.gid,P=de(C);if(!P)return;let L=$e(P);if(!Yl(L))return;if(H()){import("./chunk-UZAZM2SX.js").then(({openManagedCommentsDialog:ve})=>ve(L,Me)).catch(()=>Oe("Could not open comments. Please retry."));return}let V=mt(L),ae=Ze(L)?.comment??"";Yd({initial:ae,finding:L}).then(ve=>(ve===null||!De(L)||(X(l.triage,V,{comment:ve||void 0}),ke(),Me()),null)).catch(()=>{});return}let fi=B(i,".mark-copy");if(fi){let w=Su(i);if(w===null)return;nr(fi,w);return}let zo=B(i,".mark-link");if(zo){let w=B(i,"[data-gid]"),C=w?de(w.dataset.gid):null;if(!C)return;let P=hc($e(C));if(!P)return;nr(zo,P);return}let Kr=B(i,"[data-copy-report]");if(Kr){nr(Kr,Kr.dataset.copyReport);return}let Gr=B(i,"[data-copy-path]");if(Gr){nr(Gr,Gr.dataset.copyPath);return}let qo=B(i,".mark-issue");if(qo&&H()&&l.managedSession&&!l.managedSession.publicShare&&l.currentManagedTeam){let w=B(i,"[data-gid]"),C=w?de(w.dataset.gid):null,P=C?$e(C):null;if(P?._managedReportId&&P.id){i.preventDefault();let L=new URL(qo.dataset.issueForm);Fd({teamId:l.currentManagedTeam,session:{...l.managedSession},context:{reportId:P._managedReportId,findingId:P.id,repository:L.pathname.split("/").slice(1,3).join("/")},formUrl:L.href,title:L.searchParams.get("title")??"",body:L.searchParams.get("body")??"",finding:P,draftOptions:{sourceUrl:Li(P,jt(P)),evidence:Fa(P),showRevalidation:La()},renderBody:vc}).catch(()=>Oe("Could not open issue creation. Please retry."));return}}let Ho=B(i,".mark-claude");if(Ho){let w=Su(i);if(w===null)return;let C=`claude://code/new?q=${encodeURIComponent(`Confirm and fix:
|
|
31
|
+
`,xt(e,r=>{r&&(Le(e),this._paint(e,t))})}}disconnectedCallback(){for(let e of this.renderRoot.querySelectorAll(".evd-chunk[data-watched]"))Le(e);clearTimeout(this._copiedTimer),super.disconnectedCallback()}_onCopy=async()=>{let e="done";try{await navigator.clipboard.writeText(this.markdown)}catch{e="failed"}this.isConnected&&(this._copied=e,clearTimeout(this._copiedTimer),this._copiedTimer=setTimeout(()=>{this._copied="",this._copiedTimer=null},1500))};async _paint(e,t){let n=this._chunks[t];if(!n||n.asked)return;n.asked=!0;let r=cu(this._lines,n.start),s=[...r?this._lines.slice(r[0],r[1]):[],...this._lines.slice(n.start,n.end)].join(`
|
|
32
|
+
`),o=await yt(s,"markdown");if(!this.isConnected)return;let c=o===null?null:Ni(o).slice(r?r[1]-r[0]:0);e.innerHTML=am(this._lines,n.start,n.end,c?.length===n.end-n.start?c:null),e.classList.remove("evd-pending")}};customElements.define("export-view-dialog",qr);function pu(i){return new Promise(e=>{let t=document.createElement("export-view-dialog");t.markdown=i;let n=()=>{t.remove(),e()};t.addEventListener("resolve",n),t.addEventListener("modal-conflict",n),document.body.append(t)})}var hu=`dialog{max-width:560px;width:min(94vw,560px)}header h3{margin:0 0 .4rem}.finding{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;margin-bottom:.35rem}.loc{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.76rem;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;flex:1}.desc{font-size:.78rem;color:var(--muted);margin:0 0 .7rem;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.input-row{display:flex;align-items:stretch;gap:.4rem}input{flex:1;min-width:0;padding:.5rem .65rem;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);background:var(--bg, var(--surface));color:var(--text);font:inherit;font-size:.88rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;&:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px rgb(from var(--accent) r g b / .18)}&::placeholder{color:var(--muted);font-family:inherit}}.open{display:inline-flex;align-items:center;padding:0 .7rem;border:1px solid var(--accent);border-radius:var(--ui-radius, 6px);color:var(--accent);text-decoration:none;font-size:.8rem;font-weight:600;white-space:nowrap;&:hover{background:rgb(from var(--accent) r g b / .1)}}.hint{margin:.45rem 0 0;color:var(--muted);font-size:.74rem}
|
|
33
|
+
`;var Hr=class extends q{static styles=[...q.styles,M(bt),M(hu)];static properties={initial:{attribute:!1},finding:{attribute:!1},canApplyToGroup:{attribute:!1},_value:{state:!0}};constructor(){super(),this.initial="",this.finding=null,this.canApplyToGroup=!1,this._value=""}beforeOpen(){this._value=this.initial??""}focusInitial(){let e=this.renderRoot.querySelector('input[type="url"]');if(e){e.focus();try{e.select()}catch{}}}_onInput=e=>{this._value=e.target.value};get _trimmed(){return(this._value??"").trim()}_onSave=()=>{let e=(this.initial??"").trim();if(this._trimmed===e){this._finish(null);return}this._finish({value:this._trimmed,scope:"finding"})};_onApplyToGroup=()=>{this._trimmed&&this._finish({value:this._trimmed,scope:"group"})};_onClear=()=>this._finish({value:"",scope:"finding"});_onCancel=()=>this._finish(null);_onKeydown=e=>{e.key==="Enter"&&(e.preventDefault(),this._onSave())};render(){let e=this.finding??{},t=e.file?e.line?`${e.file}:${e.line}`:e.file:"",n=(this.initial??"").length>0,r=this._trimmed,s=wi(r);return a`<dialog @close="${this._onClose}"><header><h3>${n?"Edit fix link":"Add fix link"}</h3><div class="finding">${vt(_i(e,l.severityMode))} ${t?a`<span class="loc" data-tooltip-truncated data-tooltip="${t}">${t}</span>`:m}</div>${e.description?a`<div class="desc" data-tooltip-truncated data-tooltip="${e.description}">${e.description}</div>`:m}</header><div class="input-row"><input type="url" inputmode="url" autocomplete="off" spellcheck="false" placeholder="https://github.com/owner/repo/pull/123" .value="${this._value}" @input="${this._onInput}" @keydown="${this._onKeydown}"> ${s?a`<a class="open" href="${r}" target="_blank" rel="noopener noreferrer">Open ↗</a>`:m}</div><p class="hint">PR URL, issue link, commit, or any free-form reference. Enter to save, Esc to cancel.</p><footer class="nwd-actions">${n?a`<button type="button" class="danger" @click="${this._onClear}">Clear</button>`:m} <span class="nwd-spacer"></span> ${this.canApplyToGroup?a`<button type="button" class="quiet" ?disabled="${!r}" @click="${this._onApplyToGroup}">Apply to whole group</button> <span class="nwd-spacer"></span>`:m} <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" @click="${this._onSave}">Save</button></footer></dialog>`}};customElements.define("fix-link-dialog",Hr);function mu({initial:i="",finding:e=null,canApplyToGroup:t=!1}={}){return Y("fix-link-dialog",{initial:i,finding:e,canApplyToGroup:t})}var fu=`dialog{width:min(94vw,880px);max-width:880px}.conflicts-list{list-style:none;display:flex;flex-direction:column;gap:.6rem;max-height:65vh;overflow-y:auto;overscroll-behavior:contain}.conflict-card{padding:.6rem .7rem;border:1px solid var(--border);border-radius:var(--ui-radius, 6px)}.finding-meta{display:flex;flex-wrap:wrap;align-items:center;gap:.4rem;color:var(--muted);font-size:.72rem}.location,code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;overflow-wrap:anywhere}.location{flex:1}h4{margin:.4rem 0 .55rem;font-size:.88rem;font-weight:600;overflow-wrap:anywhere}dt{margin-top:.5rem;color:var(--muted);font-size:.72rem}.variant{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,15rem);gap:.65rem;padding:.4rem 0;font-size:.8rem;+&{border-top:1px solid var(--border)}}.value{white-space:pre-wrap;overflow-wrap:anywhere}.reports{display:flex;flex-wrap:wrap;place-content:start flex-end;gap:.3rem}.report-button{display:inline-flex;align-items:center;gap:.4rem;max-width:100%;min-height:22px;padding:0 .4rem 0 0;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);overflow:hidden;background:var(--bg);color:var(--text);font:inherit;font-size:.72rem;cursor:default;text-align:left;>span:last-child{min-width:0;overflow-wrap:anywhere}&:hover{border-color:var(--accent)}}
|
|
34
|
+
`;var dm={revalidate:"Outcome",revalidateVerdict:"Explanation",revalidateRecommendation:"Recommendation"},Ur=class extends q{static styles=[...q.styles,M(bt),M($t),M(fu)];static properties={conflicts:{attribute:!1}};constructor(){super(),this.conflicts=[]}render(){return a`<dialog aria-labelledby="revalidation-conflicts-title" @close="${this._onClose}"><header><h3 id="revalidation-conflicts-title">Revalidation conflicts</h3><p class="nwd-intro">Reports disagree about ${this.conflicts.length} finding${this.conflicts.length===1?"":"s"}. App view is unavailable until the conflicting reports are separated or updated.</p></header><ul class="conflicts-list">${this.conflicts.map(({finding:e,copies:t})=>a`<li class="conflict-card"><div class="finding-meta">${vt(e.severity)} ${e.file?a`<span class="location">${e.file}${Fe(e.line)?`:${Da(Fe(e.line))}`:""}</span>`:m} <code>${qa(e.id)??e.id}</code></div><h4>${Bt(e)}</h4><dl>${Wl(t).map(({field:n,variants:r})=>a`<dt>${dm[n]??n}</dt>${r.map(({value:s,reports:o})=>a`<dd class="variant"><div class="value">${s||a`<em>Empty</em>`}</div><div class="reports">${o.map(c=>c?a`<button type="button" class="report-button" aria-label="${`Open ${Zn(c)} at this finding`}" @click="${()=>this._finish({id:e.id,reportName:c})}">${J(Qn[Al(c)]??Qn.default)}<span>${Zn(c)}</span></button>`:a`<span>Loaded report</span>`)}</div></dd>`)}`)}</dl></li>`)}</ul><footer class="nwd-actions"><span class="nwd-spacer"></span><button type="button" @click="${this._onClose}">Close</button></footer></dialog>`}};customElements.define("revalidation-conflicts-dialog",Ur);function gu(i){return Y("revalidation-conflicts-dialog",{conflicts:[...i.values()]})}var bu=2;function vu(i,e){l.focusSplit=e,i.closest(".focus-main")?.style.setProperty("--focus-split",String(e)),i.setAttribute("aria-valuenow",String(Math.round(e)))}function yu(){try{localStorage.setItem(el,String(l.focusSplit))}catch{}}function _u(i,e){vu(i,or(e)),yu()}function wu(i,e){_u(i,l.focusSplit+e)}function ku(i){_u(i,nl)}function $u(i,e){let t=i.closest(".focus-main");if(!t)return;e.preventDefault(),i.classList.add("dragging");try{i.setPointerCapture(e.pointerId)}catch{}let n=s=>{let o=t.getBoundingClientRect();o.width!==0&&vu(i,or((s.clientX-o.left)/o.width*100))},r=()=>{i.removeEventListener("pointermove",n),i.removeEventListener("pointerup",r),i.removeEventListener("pointercancel",r),i.classList.remove("dragging"),yu()};i.addEventListener("pointermove",n),i.addEventListener("pointerup",r),i.addEventListener("pointercancel",r)}function um(i,e){return Gl(Oi(i)).map(t=>e?[$e(t)]:ec(t))}var pm={annotation(i){let e=Ze(i),t=Zl(i);return!e&&!t?null:{triage:e?.triage,color:e?.color,comment:e?.comment,fix:e?.fix,flagged:e?.flagged===!0,ignored:t}},location:i=>Li(i,jt(i)),evidence:(i,e,t)=>Oa(i,e,jt(e),t),commit:i=>Na(i.repo?.github,i.commitHash),report:i=>i._reportName??null};function hm(i,e){let t=new Set(i.map(s=>s.repo??null)),n=t.size===1?[...t][0]:null;if(n)return n;let r=new Set;for(let s of e)for(let o of s)o.repo?.github&&!Ri(o.file)&&r.add(o.repo.github);return r.size===1?[...r][0]:r.size===0&&!l.currentWorkspace&&l.repoUrl?l.repoUrl:null}function jr(i){return i.replace(/\.(?:json|md|codex)$/iu,"")}function xu(){return l.currentWorkspace?he().find(i=>i.id===l.currentWorkspace)??null:null}function mm(i,e){if(e)return e.name;let t=i.map(r=>r.fileName);return t.length===1?jr(t[0]):zt(t).replace(/[-_. ]+$/u,"")||`${t.length} reports`}function Vr({oneSamplePerGroup:i=!1}={}){let e=l.reports,t=Ul(),n=Br(),r=um(n,i),s=xu(),o=e.flatMap(d=>d.groups??[]),c=o.some(d=>d.some(aa)),u=o.some(d=>d.some(Ia));return ca({title:mm(e,s),workspace:s?.name??null,reports:e.map(d=>({name:d.fileName,source:d.source})),repo:hm(e,r),generatedAt:new Date,view:{bucket:Nr(),severityMode:c?l.severityMode:null,revalidation:u?l.showRevalidation:null,revalidationDetail:u&&l.showRevalidation!==!1?Xl():null},filters:Or(t),counts:{included:r.length,total:n.length},groups:r},pm)}function fm(){let i=xu(),e=l.reports.map(n=>n.fileName),t="";return i?t=i.name:e.length===1?t=jr(e[0]):e.length>1&&(t=jr(zt(e))),t=t.replaceAll(/[\\/:*?"<>|\p{Cc}]/gu,"-").trim(),`${t||"deepview-report"}.md`}function Su(i){if(l.reports.length===0)return;let e=new Blob([Vr(i)],{type:"text/markdown;charset=utf-8"});Ge(e,fm())}function rn(i){return!H()||!me.active||!l.currentManagedTeam?null:me.navigate(Xn({view:i,teamId:l.currentManagedTeam,reportId:l.currentManagedReport},l.managedTeams))}var Xr=!1;al(()=>{if(Xr)return;Xr=!0;let i=2;function e(){--i===0&&gm()}requestAnimationFrame(e),setTimeout(e,350)});function gm(){Xr=!1,l.findingIndexTick++,l.currentView==="bundles"&&l.selectedBundle?$():l.currentView==="packages"?$():l.currentView==="repositories"?$():l.currentView==="links"?$():(l.currentView==="findings"||l.currentView==="files")&&(fe().catch(()=>{}),$())}var Kr=!1;ll(()=>{l.currentView!=="findings"&&l.currentView!=="files"&&!Xe()||Kr||(Kr=!0,queueMicrotask(()=>{Kr=!1,!(l.currentView!=="findings"&&l.currentView!=="files"&&!Xe())&&(l.bundleHashTick++,$())}))});hl(()=>{l.linksTick++,$()});function Cu(){l.currentView==="bundles"&&l.bundleDetailsTab==="graph"?Cd():Td()}function cn(){l.currentView==="bundles"&&l.bundleDetailsTab==="graph"?Ed():Rd()}function ti(){let i=document.querySelector(".bundle-source-code-wrap"),e=i?.scrollTop??0,t=i?.scrollLeft??0;$();let n=document.querySelector(".bundle-source-code-wrap");n&&(n.scrollTop=e,n.scrollLeft=t)}function nt(i){let t=document.querySelector(i)?.scrollTop??0;$();let n=document.querySelector(i);n&&(n.scrollTop=t)}function Me(){l.viewMode==="table"?nt(".findings-table-list"):$()}var Gr=0;function Eu(){Gr||(Gr=requestAnimationFrame(()=>{Gr=0,$()}))}function B(i,e){for(let t of i.composedPath())if(t?.matches?.(e))return t;return null}function an(i,e){queueMicrotask(()=>{let t=document.querySelector(`.bundle-source-lineno-row[data-line="${i}"]`);t&&t.scrollIntoView(e)})}function Pu(i){i.classList.add("copied"),setTimeout(()=>i.classList.remove("copied"),1e3)}function sn(i,e){try{navigator.clipboard.writeText(e).then(()=>(Pu(i),null)).catch(()=>{})}catch{}}function Au(i){let e=gr(l.bundleCodeHistory,l.bundleDetails?.integrity??null,l.bundleSourceFile);l.bundleCodeHistory=Vc(e,i),l.bundleSourceFile=i}function Wr(i=!1){queueMicrotask(()=>{let e=document.querySelector(".bundle-source-code-wrap");e&&(e.scrollTop=0,e.scrollLeft=0),i&&e?.querySelector(".bundle-source-code")?.focus({preventScroll:!0})})}window.addEventListener("hashchange",()=>{if(!H()||ya()||l.currentView!=="bundles"||l.bundleDetailsTab!=="code")return;let i=fa(new URL(location.href));if(i?.bundleTab!=="code"||i.file==null||i.file!==Ec(l)?.file)return;let e=l.bundleSourceFile,t=i.endLine??i.line;l.bundleSourceTargetLine=i.line&&t<=ka(Si(l.bundleDetails).get(e)??"")?{bundle:l.bundleDetails?.integrity??null,path:e,line:i.line,...i.endLine?{end:i.endLine}:{}}:null,$(),l.bundleSourceTargetLine&&an(i.line,{block:"center"})});function Iu(i){let e=i.target.closest("[data-bundle-source-line]");if(e){let o=Number(e.dataset.bundleSourceLine),c=l.bundleDetails?.integrity??null,u=l.bundleSourceFile,d=l.bundleSourceTargetLine,p=d?.bundle===c&&d.path===u?d:null;if(i.shiftKey&&p){let h=p.anchor??p.line;l.bundleSourceTargetLine={bundle:c,path:u,line:Math.min(h,o),end:Math.max(h,o),anchor:h}}else p?.line===o&&!(p.end>o)?l.bundleSourceTargetLine=null:l.bundleSourceTargetLine={bundle:c,path:u,line:o};return ti(),!0}let t=i.target.closest("[data-bundle-source-wrap]");if(t){let o=Dc(t);l.bundleSourceWrap=!l.bundleSourceWrap;try{localStorage.setItem(il,String(l.bundleSourceWrap))}catch{}return $(),queueMicrotask(o),!0}if(i.target.closest("[data-bundle-source-pretty]"))return Yt(),$(),Wr(),!0;let n=i.target.closest("[data-bundle-code-history]");if(n){let o=gr(l.bundleCodeHistory,l.bundleDetails?.integrity??null,l.bundleSourceFile),c=Kc(o,n.dataset.bundleCodeHistory==="back"?-1:1),u=c.files[c.at];return c.at===o.at||!Si(l.bundleDetails).has(u)||(l.bundleCodeHistory=c,l.bundleSourceFile=u,l.bundleSourceFindingIdx=null,l.bundleCodeSearchMode="files",l.bundleCodeSearchQuery="",nt(".bundle-code-rail-body"),Qt(),Wr()),!0}let r=i.target.closest("[data-bundle-source-link]");if(r){let o=r.dataset.bundleSourceLink,c=r.closest(".focus-pane-code");if(c){let u=ii(i),d=fc(u,c.dataset.focusCodeIntegrity,c.dataset.focusCodeFile,o);return d&&(ts(u,d),queueMicrotask(()=>c.querySelector(".focus-code-source")?.focus({preventScroll:!0}))),!0}return Si(l.bundleDetails).has(o)&&(l.currentView==="bundles"&&l.bundleDetailsTab==="search"&&(_t("code",{preserveSource:!0}),l.selectedBundle&&Be(l.selectedBundle,"code",{push:!0})),Au(o),l.bundleSourceFindingIdx=null,l.bundleDetailsTab==="code"&&(l.bundleCodeSearchMode="files",l.bundleCodeSearchQuery=""),nt(".bundle-code-rail-body"),Qt(),Wr(!0)),!0}if(i.target.classList?.contains("bundle-source-overlay")||i.target.closest('[data-action="bundle-source-close"]'))return l.bundleSourceFile&&(_t(l.bundleDetailsTab),$()),!0;if(i.target.closest('[data-action="bundle-source-panel-close"]'))return l.bundleSourceFindingIdx!=null&&(l.bundleSourceFindingIdx=null,ti()),!0;let s=i.target.closest("[data-bundle-source-finding]");if(s){let o=parseInt(s.dataset.bundleSourceFinding,10);return Number.isFinite(o)&&(l.bundleSourceFindingIdx=l.bundleSourceFindingIdx===o?null:o,ti()),!0}return!1}function Tu(i){let e=ii(i);if(!e)return null;let t=$e(e);return za(t,tc(t))}R.addEventListener("click",i=>{if(B(i,"[data-finding-history]")){let w=ii(i),C=w&&$e(w);Tl(C)&&Nd(C);return}let e=B(i,"[data-code-nav-file]");if(e){ts(ii(i),{integrity:e.dataset.codeNavIntegrity,file:e.dataset.codeNavFile,range:Fe(e.dataset.codeNavLine)});return}let t=B(i,"[data-code-history]");if(t){vm(t.dataset.codeHistory==="forward"?1:-1);return}let n=B(i,"[data-code-preview]");if(n){let w=n.dataset.codePreview,C=new Set(l.codePreviews);C.delete(w)||C.add(w),l.codePreviews=C,$();return}let r=B(i,"[data-finding-code-report]");if(r&&H()){eu({reportId:r.dataset.findingCodeReport,file:r.dataset.findingCodeFile,line:r.dataset.findingCodeLine});return}let s=B(i,"[data-finding-code-bundle]");if(s){let w=s.dataset.findingCodeBundle,C=s.dataset.findingCodeFile,P=s.dataset.findingCodeLine,L=P?parseInt(P,10):null;l.bundleSourceFile=C||null,l.bundleCodeHistory=null,l.bundleSourceFindingIdx=null,(l.bundleDetailsTab==="code"||l.bundleDetailsTab==="search")&&(l.bundleDetailsTab="overview");let V=()=>{Number.isFinite(L)&&an(L,{block:"start",behavior:"instant"})};if(l.selectedBundle===w&&l.bundleDetails?.integrity===w){$(),zi().then(()=>(l.selectedBundle===w&&l.bundleSourceFile===C&&V(),null));return}l.selectedBundle=w,l.selectedBundleWorkspace=null,l.bundleDetails=null,$(),(async()=>(await wt(w),V()))();return}let o=i.target.closest("[data-package-expand]");if(o){let w=o.dataset.packageExpand;l.expandedPackages.has(w)?l.expandedPackages.delete(w):l.expandedPackages.add(w),$();return}let c=i.target.closest("[data-package-row-issues]");if(c){let w=c.dataset.packageRowIssues,C=c.dataset.packageRowIssuesVersion;l.selectedPackage=w,l.selectedPackageVersion=C||null,l.packageDetailsTab="issues",l.packageSlideTriage=null,l.packageSlideTransient=!0,$();return}let u=i.target.closest("[data-repository-row-issues]");if(u){let w=u.dataset.repositoryRowIssues;l.selectedRepository=w,l.repositoryDetailsTab="issues",l.repositorySlideTriage=null,l.repositorySlideTransient=!0,$();return}let d=i.target.closest("[data-select-package]");if(d){let w=d.dataset.selectPackage,C=d.dataset.selectPackageVersion??"",P=C===""?null:C;if(l.selectedPackage===w&&l.selectedPackageVersion===P)return;l.selectedPackage=w,l.selectedPackageVersion=P,l.packageDetailsTab="overview",l.packageSlideTriage=null,l.packageSlideTransient=!1,$();return}if(i.target.closest("[data-deselect-package]")){l.selectedPackage=null,l.selectedPackageVersion=null,$();return}let p=i.target.closest("[data-package-tab]");if(p){let w=p.dataset.packageTab;(w==="overview"||w==="issues")&&l.packageDetailsTab!==w&&(l.packageDetailsTab=w,$());return}if(i.target.closest('[data-action="package-slide-back"]')){l.packageDetailsTab="overview",l.packageSlideTriage=null,l.packageSlideTransient&&(l.selectedPackage=null,l.selectedPackageVersion=null,l.packageSlideTransient=!1),$();return}let h=B(i,"[data-links-report][data-links-finding]");if(h){i.preventDefault();let{linksReport:w,linksFinding:C,managedReport:P}=h.dataset;w&&C&&(async()=>{let L=await Tr(C,w,P);L.ok||alert(L.reason)})().catch(L=>console.warn("links: reveal in report failed:",L));return}let f=i.target.closest("[data-package-report]");if(f){let w=f.dataset.packageReport;w&&tt(w);return}let b=i.target.closest("[data-select-repository]");if(b){let w=b.dataset.selectRepository;if(l.selectedRepository===w)return;l.selectedRepository=w,l.repositoryDetailsTab="overview",l.repositorySlideTriage=null,l.repositorySlideTransient=!1,$();return}if(i.target.closest("[data-deselect-repository]")){l.selectedRepository=null,$();return}let v=i.target.closest("[data-repository-tab]");if(v){let w=v.dataset.repositoryTab;(w==="overview"||w==="issues")&&l.repositoryDetailsTab!==w&&(l.repositoryDetailsTab=w,$());return}if(i.target.closest('[data-action="repository-slide-back"]')){l.repositoryDetailsTab="overview",l.repositorySlideTriage=null,l.repositorySlideTransient&&(l.selectedRepository=null,l.repositorySlideTransient=!1),$();return}let g=i.target.closest("[data-bundle-tab]");if(g){let w=g.dataset.bundleTab;if(ki.has(w)||w==="review"&&l.bundleDetails?.npm){if(w===l.bundleDetailsTab){l.selectedBundle&&Be(l.selectedBundle,w);return}l.bundleDetailsTab==="graph"&&w!=="graph"&&(oe(),document.body.classList.remove("report-fullscreen")),Tc(l,w,C=>Yc(C)?.oldVersion??null),_t(w),l.selectedBundle&&Be(l.selectedBundle,w,{push:!0}),$(),w==="code"&&zi().then(()=>(l.bundleDetailsTab==="code"&&Qt(),null))}return}if(i.target.closest("[data-bundle-retry-sources]")){l.bundleDetails&&delete l.bundleDetails.sourceError,$();return}let y=i.target.closest("[data-bundle-download]");if(y){let w=y.dataset.bundleDownload,C=(l.bundles??[]).find(P=>P.integrity===w);if(!C)return;(async()=>{let{confirmed:P}=await tu({name:C.name,encrypted:we()});if(P)try{let L=await ol(w);Ge(new Blob([L],{type:"application/octet-stream"}),C.name)}catch(L){alert(`Failed to download bundle: ${L.message}`)}})();return}let k=i.target.closest("[data-bundle-export-sbom]");if(k){let w=k.dataset.bundleExportSbom,C=l.bundleDetails,P=(l.bundles??[]).find(L=>L.integrity===l.selectedBundle);if(!P||!C||C.integrity!==P.integrity)return;try{let L=w==="cyclonedx",V=L?_d(C,P):wd(C,P),le=`${yd(P.name)}.${L?"cdx":"spdx"}.json`;Ge(new Blob([V],{type:"application/json"}),le)}catch(L){alert(`Failed to export ${w==="cyclonedx"?"CycloneDX":"SPDX"}: ${L.message}`)}return}if(B(i,"[data-bundle-search-context]")){l.bundleSearchContext=!l.bundleSearchContext,nt(".bundle-search-results");return}if(i.target.closest("[data-advisories-consent]")){xd(),$();return}if(i.target.closest("[data-advisories-retry]")){Sd(l.bundleDetails,$).catch(()=>{}),$();return}let x=i.target.closest("[data-bundle-issue-report]");if(x){let w=x.dataset.bundleIssueReport;w&&tt(w);return}if(Iu(i))return;let S=i.target.closest("[data-bundle-code-issue-step]");if(S){let w=S.closest("[data-bundle-code-issue-order]"),C=null;try{C=JSON.parse(w?.dataset.bundleCodeIssueOrder??"null")}catch{}if(Array.isArray(C)&&C.length>0){let P=S.dataset.bundleCodeIssueStep==="-1"?-1:1,L=C.findIndex(le=>le.idx===l.bundleSourceFindingIdx),V=L===-1?P>0?C[0]:C.at(-1):C[(L+P+C.length)%C.length];l.bundleSourceFindingIdx=V.idx,ti(),V.line>0&&an(V.line,{block:"center",behavior:"smooth"})}return}let T=B(i,"[data-bundle-view-source]");if(T){let w=T.dataset.bundleViewSource;if(!w)return;let C=T.dataset.bundleViewFindingIdx,P=C===void 0?null:parseInt(C,10),L=T.dataset.bundleViewLine,V=L?parseInt(L,10):null;Number.isFinite(V)&&(l.bundleSourcePretty=!1);let le=l.bundleSourceFile!==w;if(Au(w),Number.isFinite(P)?l.bundleSourceFindingIdx=P:le&&(l.bundleSourceFindingIdx=null),l.bundleSourceTargetLine=Number.isFinite(V)?{bundle:l.bundleDetails?.integrity??null,path:w,line:V}:null,T.closest(".bundle-code-rail")?nt(".bundle-code-rail-body"):T.closest(".bundle-search-results")?nt(".bundle-search-results"):T.closest(".bundles-slide-body")?nt(".bundles-slide-body"):$(),Number.isFinite(V)){let ve=T.dataset.bundleViewScrollBlock||"center";zi().then(()=>(l.bundleSourceFile===w&&an(V,{block:ve,behavior:"smooth"}),null))}return}let F=i.target.closest('[data-action="workspace-reports"], [data-action="workspace-bundles"]');if(F){let w=F.dataset.action.slice(10);l.currentView!==`workspace-${w}`&&Xi(l.currentManagedTeam??l.currentWorkspace,w);return}if(i.target.closest('[data-action="workspace-findings"]')){if(l.currentView==="findings")return;if(l.currentView==="files"){if(rn("findings"))return;l.currentView="findings",l.filesSelectedFile=null,document.body.classList.remove("report-fullscreen"),$()}else H()?Cr(l.managedTeams.find(w=>w.id===l.currentManagedTeam)):it(l.currentWorkspace);return}let O=i.target.closest("[data-workspace-report]");if(O){H()?Cr(l.managedTeams.find(w=>w.id===l.currentManagedTeam),O.dataset.workspaceReport):tt(O.dataset.workspaceReport,void 0,{workspaceId:l.currentWorkspace});return}let A=i.target.closest("[data-workspace-bundle]");if(A){if(H())me.navigate(Xn({view:"bundles",teamId:l.currentManagedTeam,bundleId:A.dataset.workspaceBundle,bundleTab:"overview"},l.managedTeams));else{let w=A.dataset.workspaceBundle;Kt(w,"overview",{workspaceId:l.currentWorkspace}),Be(w,"overview"),$(),fe(),wt(w)}return}if(i.target.closest('[data-action="toggle-files"]')){if(rn(l.currentView==="files"?"findings":"files"))return;if(l.currentView==="workspace-reports"||l.currentView==="workspace-bundles"){l.currentView="files",it(l.currentWorkspace);return}l.currentView==="files"?l.currentView="findings":(l.viewMode==="graph"&&oe(),l.currentView="files"),document.body.classList.remove("report-fullscreen"),$();return}let Z=B(i,"[data-g2-pkg]");if(Z){let w=Z.dataset.g2Pkg;E.solo=E.solo===w?null:w,E.solo&&(E.selected=null),Cu(),cn(),E.graphState?.requestDraw?.();return}let ne=B(i,"[data-g2-select]");if(ne){E.selected=ne.dataset.g2Select,Cu(),E.graphState?.requestDraw?.();return}let re=B(i,"[data-g2-top-pkgs]");if(re){E.topPkgsTab=re.dataset.g2TopPkgs,cn();return}let Vn=B(i,"[data-g2-jump-findings]");if(Vn){if(l.currentView==="bundles"){l.bundleDetailsTab==="graph"&&oe(),_t("issues"),l.selectedBundle&&Be(l.selectedBundle,"issues",{push:!0}),$();return}if(ql(),l.filterConfMin=0,l.filterInclude=Vn.dataset.g2JumpFindings,l.currentView="findings",l.viewMode==="graph"&&(l.viewMode="table"),oe(),rn("findings"))return;$();return}let se=B(i,"[data-g2-jump-file]");if(se){let w=se.dataset.g2JumpFile;oe();let C=()=>requestAnimationFrame(()=>{let L=document.querySelector(`#${ja(w)}`);L&&L.scrollIntoView({behavior:"smooth",block:"start"})}),P=rn("files");if(P){P.then(L=>L?C():void 0);return}l.currentView="files",$(),C();return}if(B(i,"#g2-path-filter-clear")){E.pathFilter="";let w=document.querySelector("graph-layout")?.shadowRoot?.querySelector("#g2-path-filter");w&&(w.value=""),E.graphState?.requestDraw?.();return}if(B(i,"#g2-fullscreen")){document.body.classList.toggle("report-fullscreen");return}if(B(i,"[data-g2-show-all]")){E.showAll=!E.showAll,E.layoutCache=null,E.selected=null,oe(),$();return}if(B(i,"[data-g2-packages-view]")){E.bundleLayout==="flow"?E.flowPackagesView=!E.flowPackagesView:E.bundleLayout==="dependencies"?(E.dependencyPackagesView=!E.dependencyPackagesView,E.solo=null):E.packagesView=!E.packagesView,E.layoutCache=null,E.selected=null,E.focusedPkg=null,oe(),$();return}if(B(i,"[data-g2-bundle-issues]")){E.bundleIssues=!E.bundleIssues,oe({keepViewport:!0}),$();return}let Dt=B(i,"[data-g2-layout]");if(Dt){let w=Dt.dataset.g2Layout;if(!["graph","layers","matrix","dependencies","flow"].includes(w)||E.bundleLayout===w&&!E.focusedPkg)return;E.bundleLayout=w,w==="dependencies"&&(E.dependencyPackagesView=!1),E.layoutCache=null,E.selected=null,E.solo=null,E.focusedPkg=null,oe(),$();return}let hi=B(i,".graph2-triage-selector [data-triage-show]");if(hi){let w=hi.dataset.triageShow;l.shownTriage=l.shownTriage===w?null:w,E.layoutCache=null,E.selected=null,oe(),$();return}let mi=B(i,"[data-g2-focus-pkg]");if(mi){E.focusedPkg=mi.dataset.g2FocusPkg,E.layoutCache=null,oe(),$();return}if(B(i,"#g2-back-to-full")){E.focusedPkg=null,E.layoutCache=null,(E.packagesView||E.bundleLayout==="layers")&&(E.selected=null),oe(),$();return}let dt=B(i,".tab");if(dt&&B(i,".tabs")){let C=B(i,"[data-gid]").dataset.gid,P=dt.dataset.tid;l.activeTabByGroup.set(C,P),Me();return}let je=B(i,"[data-triage-action]");if(je){let w=je.closest(".triage-menu"),C=w?.dataset.gid;if(!C)return;let P=de(C);if(!P)return;let L=je.dataset.triageAction;if(!["inprogress","fixed","invalid","deleted","ignored","restore"].includes(L))return;let{targets:V,clearing:le}=rc(P,L);if(V.length===0)return;Fu(V,le?"untriaged":L);try{w.hidePopover()}catch{}ke(),Me();return}if(B(i,".mark-comment")){let C=B(i,"[data-gid]").dataset.gid,P=de(C);if(!P)return;let L=$e(P);if(!Ql(L))return;if(H()){import("./chunk-LAAB5SZT.js").then(({openManagedCommentsDialog:ve})=>ve(L,Me)).catch(()=>Oe("Could not open comments. Please retry."));return}let V=mt(L),le=Ze(L)?.comment??"";Qd({initial:le,finding:L}).then(ve=>(ve===null||!De(L)||(X(l.triage,V,{comment:ve||void 0}),ke(),Me()),null)).catch(()=>{});return}let fi=B(i,".mark-copy");if(fi){let w=Tu(i);if(w===null)return;sn(fi,w);return}let Uo=B(i,".mark-link");if(Uo){let w=B(i,"[data-gid]"),C=w?de(w.dataset.gid):null;if(!C)return;let P=gc($e(C));if(!P)return;sn(Uo,P);return}let Gn=B(i,"[data-copy-report]");if(Gn){sn(Gn,Gn.dataset.copyReport);return}let Wn=B(i,"[data-copy-path]");if(Wn){sn(Wn,Wn.dataset.copyPath);return}let jo=B(i,".mark-issue");if(jo&&H()&&l.managedSession&&!l.managedSession.publicShare&&l.currentManagedTeam){let w=B(i,"[data-gid]"),C=w?de(w.dataset.gid):null,P=C?$e(C):null;if(P?._managedReportId&&P.id){i.preventDefault();let L=new URL(jo.dataset.issueForm);Bd({teamId:l.currentManagedTeam,session:{...l.managedSession},context:{reportId:P._managedReportId,findingId:P.id,repository:L.pathname.split("/").slice(1,3).join("/")},formUrl:L.href,title:L.searchParams.get("title")??"",body:L.searchParams.get("body")??"",finding:P,draftOptions:{sourceUrl:Li(P,jt(P)),evidence:Ba(P),showRevalidation:Aa()},renderBody:wc}).catch(()=>Oe("Could not open issue creation. Please retry."));return}}let Vo=B(i,".mark-claude");if(Vo){let w=Tu(i);if(w===null)return;let C=`claude://code/new?q=${encodeURIComponent(`Confirm and fix:
|
|
35
35
|
|
|
36
|
-
${w}`)}`;try{window.location.href=C,Ru(Ho)}catch{}return}if(B(i,".mark-fix")){let C=B(i,"[data-gid]")?.dataset.gid,P=C?de(C):null;if(!P)return;let L=$e(P);if(!De(L))return;let V=rc(P),ae=Ze(L)?.fix??"";uu({initial:ae,finding:L,canApplyToGroup:Zl(V,ae)}).then(ve=>{if(ve===null||!De(L))return null;let Vo=ve.scope==="group"?V.filter(Ot=>De(Ot)&&(Ot===L||ec(Ot,ae))):[L],Ko=!1;for(let Ot of Vo)X(l.triage,mt(Ot),{fix:ve.value||void 0})&&(Ko=!0);return Ko&&(Vo.length>1&&l.activeTabByGroup.set(C,mt(L)),Me(),queueMicrotask(ke)),null}).catch(()=>{});return}let Uo=B(i,"[data-flag-toggle]");if(Uo){let w=Uo.dataset.flagToggle,C=B(i,"[data-gid]")?.dataset.gid,P=(C?de(C):null)?.find(V=>mt(V)===w);if(!P||!De(P))return;let L=Ze(P)?.flagged;X(l.triage,w,{flagged:L!==!0}),ke(),Me();return}let Wr=i.target.closest("[data-triage-show]");if(Wr&&!Wr.closest(".graph2-triage-selector")){let w=Wr.dataset.triageShow;l.shownTriage=l.shownTriage===w?null:w,$();return}if(i.target.closest("[data-table-deselect]")){l.tableSelectedGid=null,Me();return}let jo=i.target.closest("[data-tree-select]");if(jo){let w=jo.dataset.treeSelect;l.filesSelectedFile=l.filesSelectedFile===w?null:w,$();return}i.target.closest("[data-tree-deselect]")&&(l.filesSelectedFile=null,$())});var Cu=document.querySelector("#bundle-source-overlay-slot");Cu&&Cu.addEventListener("click",Mu);function cr(i){let e=i?de(i):null;e&&ic(e)&&queueMicrotask(ke)}R.addEventListener("row-select",i=>{let e=i.detail?.gid;if(!e)return;let t=l.tableSelectedGid!==e;l.tableSelectedGid=t?e:null,t&&cr(e),Me()});var dr="application/x-deepview-kanban-gid";function Pu(i,e){for(let t of i)De(t)&&ca(l.triage,t,e,Pa())}function Qn(){for(let i of R.querySelectorAll(".kanban-card.dragging"))i.classList.remove("dragging");for(let i of R.querySelectorAll(".kanban-column.drag-over"))i.classList.remove("drag-over")}R.addEventListener("dragstart",i=>{let e=i.target.closest?.(".kanban-card[data-kanban-source]");if(!e||!i.dataTransfer)return;let t=e.dataset.gid;if(!t)return;let r=de(t);if(!r||an(r).length===0){i.preventDefault();return}i.dataTransfer.setData(dr,t),i.dataTransfer.setData("text/plain",t),i.dataTransfer.effectAllowed="move",e.classList.add("dragging")});R.addEventListener("dragend",Qn);R.addEventListener("dragover",i=>{if(!i.dataTransfer?.types.includes(dr))return;let e=i.target.closest?.(".kanban-column[data-kanban-target]");if(e&&(i.preventDefault(),i.dataTransfer.dropEffect="move",!e.classList.contains("drag-over"))){for(let t of R.querySelectorAll(".kanban-column.drag-over"))t!==e&&t.classList.remove("drag-over");e.classList.add("drag-over")}});R.addEventListener("dragleave",i=>{let e=i.target.closest?.(".kanban-column[data-kanban-target]");e&&(e.contains(i.relatedTarget)||e.classList.remove("drag-over"))});R.addEventListener("drop",i=>{if(!i.dataTransfer?.types.includes(dr))return;let e=i.target.closest?.(".kanban-column[data-kanban-target]");if(!e){Qn();return}i.preventDefault();let t=i.dataTransfer.getData(dr),r=e.dataset.kanbanTarget;if(Qn(),!t||!r)return;let n=de(t);if(!n||(Bi(n).commonTriage??"untriaged")===r)return;let o=an(n);o.length!==0&&(Pu(o,r),$(),queueMicrotask(ke))});var Yn=!1;function nt(i){return i?R.querySelector(`.kanban-card[data-gid="${CSS.escape(i)}"]`):null}function sr(i){let e=i??R.querySelector(".kanban-card");if(!e)return;let t=e.getBoundingClientRect();t.width<=0||t.height<=0||(document.documentElement.style.setProperty("--kanban-clip-card-w",`${Math.floor(t.width)}px`),document.documentElement.style.setProperty("--kanban-clip-card-h",`${Math.floor(t.height)}px`),document.documentElement.style.setProperty("--kanban-return-card-bg",getComputedStyle(e).backgroundColor))}function fm(){let i=R.querySelector(".kanban-detail-side [data-kanban-select].active");i&&i.scrollIntoView({block:"nearest",behavior:"instant"})}function Jn(i){l.kanbanPopoverGid=i,l.focusCodeStack=[],l.focusCodeAt=0}function Eu(){fm(),et()}function st(i){let e=l.kanbanPopoverGid;if(e===i)return;let t=e===null&&i!==null,r=e!==null&&i===null;if(!document.startViewTransition||!t&&!r){cr(i),Jn(i),$(),Eu();return}if(Yn)return;cr(i),Yn=!0;let n=t?"kanban-opening":"kanban-closing";document.documentElement.classList.add(n);let s=d=>{d&&(d.style.viewTransitionName=""),document.documentElement.classList.remove(n),Yn=!1};if(t){let d=nt(i);d?(sr(d),d.style.viewTransitionName="kanban-detail-modal",d.getBoundingClientRect()):sr(),Jn(i);let p=En(()=>{$(),Eu(),d&&(d.style.viewTransitionName="")}),h=setTimeout(()=>s(d),600);(async()=>{try{await p.finished}catch{}clearTimeout(h),s(d)})();return}sr(),Jn(i);let o=null,c=En(()=>{$(),o=nt(e),o&&(sr(o),o.style.viewTransitionName="kanban-detail-modal")}),u=setTimeout(()=>s(o??nt(e)),600);(async()=>{try{await c.finished}catch{}clearTimeout(u),s(o??nt(e))})()}function Au(i){let e=nt(l.kanbanPopoverGid),t=e?.closest(".kanban-column");if(!t)return;let r=[...t.querySelectorAll(".kanban-card[data-kanban-source]")],n=r.indexOf(e);if(n<0)return;let s=Math.min(Math.max(n+i,0),r.length-1);if(s===n)return;let o=r[s].dataset.gid;if(!o)return;st(o);let c=nt(o);c&&(c.focus({preventScroll:!0}),c.scrollIntoView({block:"nearest",behavior:"instant"}))}var ar=null;function Zn(){Kl(),l.focusCodeStack=[],l.focusCodeAt=0,$(),ar?.isConnected&&ar.focus({preventScroll:!0}),ar=null}R.addEventListener("click",i=>{let e=B(i,"[data-links-preview]");if(e){i.preventDefault(),ar=e;let o=e.dataset.previewRow,c=Gl(e.dataset.linksPreview,e.dataset.previewReport,o===void 0?void 0:Number(o),e.dataset.previewManagedReport);$(),R.querySelector(".kanban-detail-close")?.focus({preventScroll:!0}),c.then(()=>{$(),et();let u=Xe()?.group?.[0]._bundleHashes;if(Array.isArray(u))for(let d of u)lc(d).catch(()=>{});return null});return}if(i.target.closest?.(".kanban-detail-close")){if(Xe()){Zn();return}st(null);return}if(i.target.closest?.("[data-kanban-detail-fullscreen]")){l.kanbanDetailFullscreen=!l.kanbanDetailFullscreen;try{localStorage.setItem(Qa,String(l.kanbanDetailFullscreen))}catch{}$(),et();return}let t=i.target.closest?.("[data-kanban-expand]");if(t){let o=t.dataset.kanbanExpand,c=l.kanbanExpandedColumn===o?null:o;l.kanbanExpandedColumn=c,c&&l.kanbanPopoverGid&&nt(l.kanbanPopoverGid)?.closest(".kanban-column")?.dataset.kanbanTarget!==c&&(l.kanbanPopoverGid=null),$();return}let r=i.target.closest?.("[data-kanban-nav]");if(r){Au(r.dataset.kanbanNav==="next"?1:-1);return}let n=i.target.closest?.("[data-kanban-select]");if(n){if(window.getSelection?.()?.toString())return;let o=n.dataset.gid;o&&st(o);return}if(i.target.closest?.(".kanban-action:not(.kanban-fix-note)"))return;let s=i.target.closest?.(".kanban-card[data-kanban-source]");if(s){if(window.getSelection?.()?.toString())return;let o=s.dataset.gid;if(!o)return;st(l.kanbanPopoverGid===o?null:o);return}if(!B(i,".kanban-detail-modal, .kanban-detail-side")){if(Xe()){Zn();return}l.kanbanPopoverGid&&st(null)}});R.addEventListener("change",i=>{let e=i.target.closest?.("[data-kanban-column]");if(!e)return;let t=e.selectedOptions[0]?.dataset.gid;t&&st(t)});document.addEventListener("keydown",i=>{if(i.key==="Escape"){if(Xe()){!i.defaultPrevented&&!Ou(i)&&!document.querySelector(":popover-open:not(#styled-tooltip)")&&Zn();return}if(l.kanbanPopoverGid){st(null);return}l.viewMode!=="kanban"||l.kanbanExpandedColumn===null||(l.kanbanExpandedColumn=null,$())}});function ii(i){let t=B(i,"[data-gid]")?.dataset?.gid;return t?de(t):null}function ts(i,e){if(!e.integrity||!e.file)return;let t=uc(i);if(!t)return;let r=cc(t,e);r&&(l.focusCodeStack=r.stack,l.focusCodeAt=r.at,$()),e.range||Iu(),et()}function Iu(){for(let i of R.querySelectorAll(".focus-code-body"))i.scrollTop=0,i.scrollLeft=0}R.addEventListener("keydown",i=>{if(i.key!=="Enter"&&i.key!==" ")return;let e=B(i,"[data-code-nav-file]");e&&(i.preventDefault(),ts(ii(i),{integrity:e.dataset.codeNavIntegrity,file:e.dataset.codeNavFile,range:Fe(e.dataset.codeNavLine)}))});function gm(i){let e=dc(l.focusCodeStack,l.focusCodeAt,i);e!==l.focusCodeAt&&(l.focusCodeAt=e,$(),l.focusCodeStack[e]?.range||Iu(),et())}function Fu(i){if(!i||l.focusGid===i)return;cr(i),l.focusGid=i,l.focusCodeStack=[],l.focusCodeAt=0,$();let e=R.querySelector(".focus-side-card.active");e&&e.scrollIntoView({block:"nearest",behavior:"instant"}),et()}function Du(i){let e=[...R.querySelectorAll(".focus-side-card[data-focus-select]")];if(e.length===0)return;let t=e.findIndex(s=>s.classList.contains("active")),r=t<0?i>0?0:e.length-1:Math.min(Math.max(t+i,0),e.length-1);if(r===t)return;let n=e[r].dataset.gid;n&&Fu(n)}R.addEventListener("click",i=>{let e=i.target.closest?.("[data-focus-nav]");if(e){Du(e.dataset.focusNav==="next"?1:-1);return}let t=i.target.closest?.(".focus-side-card[data-focus-select]");if(!t||window.getSelection?.()?.toString())return;let r=t.dataset.gid;r&&Fu(r)});R.addEventListener("pointerdown",i=>{if(i.button!==0)return;let e=i.target.closest?.("[data-focus-splitter]");e&&_u(e,i)});R.addEventListener("dblclick",i=>{let e=i.target.closest?.("[data-focus-splitter]");e&&yu(e)});function Ou(i){if(document.querySelector("dialog[open]"))return!0;for(let e of i.composedPath()){if(!e||e.nodeType!==1)continue;let t=e.tagName;if(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||t==="DIALOG"&&e.open||e.isContentEditable)return!0}return!1}document.addEventListener("keydown",i=>{if(l.currentView!=="findings")return;let e=l.viewMode==="focus",t=l.viewMode==="kanban"&&l.kanbanPopoverGid!==null;if(!e&&!t||i.metaKey||i.ctrlKey||i.altKey||i.shiftKey||Ou(i))return;let r=0;if(i.key==="ArrowRight")r=1;else if(i.key==="ArrowLeft")r=-1;else return;i.preventDefault();let n=i.target?.closest?.("[data-focus-splitter]");if(n){vu(n,r*mu);return}e?Du(r):Au(r)});R.addEventListener("mark-color",i=>{let e=B(i,"[data-gid]");if(!e)return;let t=e.dataset.gid,r=de(t);if(!r)return;let n=$e(r);if(!De(n))return;let s=mt(n),o=i.detail?.color;if(!o)return;Ze(n)?.color===o?X(l.triage,s,{color:void 0}):X(l.triage,s,{color:o}),ke(),Me()});var ot=null,es=null,Ct=null,ur=!1;function Bu(){if(ot!==null)return;if(l.reports.length===0){Ct=null,ur=!1;return}ot=l.viewMode,es=document.title;let i=!1;l.viewMode==="table"&&(l.viewMode="list",i=!0),Ct&&(qt(Ct),i=!0),i&&$();for(let r of R.querySelectorAll("finding-card"))r.toggleAttribute("print-one-sample",ur),r.ensureRendered({sync:!0});let e=l.reports.map(r=>r.fileName),t="";e.length===1?t=e[0]:e.length>1&&(t=zt(e)),t=t.replace(/\.json$/u,""),t&&(document.title=t)}function Nu(){if(ot===null)return;for(let e of R.querySelectorAll("finding-card"))e.removeAttribute("print-one-sample");ur=!1;let i=!1;l.viewMode!==ot&&(l.viewMode=ot,i=!0),Ct&&(Ht(),Ct=null,i=!0),i&&$(),document.title=es,ot=null,es=null}window.addEventListener("beforeprint",Bu);window.addEventListener("afterprint",Nu);async function bm(i,{oneSamplePerGroup:e=!1}={}){if(ot===null){Ct=i,ur=e;try{Bu(),await Promise.all([...R.querySelectorAll("finding-card")].map(t=>t.ensureRendered())),window.print()}catch(t){throw Nu(),t}}}function Tu(i,e){if(!i)return e();qt(i);try{return e()}finally{Ht()}}document.addEventListener("download-requested",async()=>{if(l.reports.length===0)return;let{confirmed:i,view:e,fields:t,mode:r,oneSamplePerGroup:n}=await ru("download");if(e){await cu(Tu(t,()=>Vn({oneSamplePerGroup:n})));return}if(i){if(r==="print"){await bm(t,{oneSamplePerGroup:n});return}Tu(t,()=>ku({oneSamplePerGroup:n}))}});R.addEventListener("analyzer-change",i=>{l.filterAnalyzer=i.detail.analyzer,l.filterModel=i.detail.model,$()});R.addEventListener("repo-change",i=>{l.filterRepo=i.detail.value,$()});R.addEventListener("revalidate-change",i=>{l.filterRevalidate=i.detail.value,$()});R.addEventListener("partial-change",i=>{l.filterPartial=i.detail.value,$()});R.addEventListener("revalidation-change",i=>{l.showRevalidation=i.detail.on,!i.detail.on&&l.reports.some(t=>(t.groups??[]).some(r=>r.some(n=>!n.isApp&&(n.isUpstream||Ri(n.file)))))?Oe("App mode off is not recommended; it can conflate triage for issues in dependencies.",{kind:"warning"}):i.detail.on&&md(),sn(l.showRevalidation,l.upstreamOnly),Ul(ln(),{resetSort:!1}),$()});R.addEventListener("revalidation-conflicts-open",()=>{(async()=>{let i=await hu(l.revalidateConflicts);if(!i)return;let e=await Tn(i.id,i.reportName);e.ok||alert(e.reason)})().catch(i=>console.warn("revalidation: open conflicting finding failed:",i))});R.addEventListener("revalidation-detail-change",i=>{l.revalidationDetailed=i.detail.on===!0,$()});R.addEventListener("upstream-only-change",i=>{if(l.upstreamOnly=i.detail.on===!0,sn(l.showRevalidation,l.upstreamOnly),!l.upstreamOnly){let e=ln();ql(e,Hl(e))==="confirmed"&&(l.filterRevalidate="confirmed",l.filterPartial="")}$()});R.addEventListener("bundle-search-mode-change",i=>{let e=i.detail?.mode;if(["files","code","issues","largest"].includes(e)){if(l.bundleCodeSearchMode=e,$(),e==="files")Qt();else if(e==="largest"){let t=document.querySelector(".bundle-code-rail-body");t&&(t.scrollTop=0)}}});R.addEventListener("bundle-graph-reason-change",i=>{let e=i.detail?.reason;e!==null&&typeof e!="string"||(E.bundleReason=e,E.layoutCache=null,E.selected=null,E.solo=null,E.focusedPkg=null,oe(),$())});R.addEventListener("bundle-search-regex-toggle",()=>{l.bundleSearchRegex=!l.bundleSearchRegex,$()});R.addEventListener("bundle-search-case-toggle",()=>{l.bundleSearchCase=!l.bundleSearchCase,$()});R.addEventListener("bundle-swap",i=>{let e=i.detail?.integrity;if(!e||!(l.bundles??[]).some(s=>s.integrity===e))return;let t=l.bundles.find(s=>s.integrity===e),r=nc(i.detail.bundles??[]),n=()=>{setTimeout(()=>sc(r))};if(t.managedId){let s=i.detail.target===void 0?l.selectedBundle:i.detail.target,o=l.bundles.find(u=>u.integrity===s),c=o?.managedId?{compareId:o.managedId,...ua(i.detail.mode)}:null;me.navigate($c(l.managedTeams,t,l.currentManagedTeam,"compare",c,l.bundles)).finally(n);return}Kt(e,"compare"),Be(e,"compare"),$(),fe(),wt(e).finally(n)});R.addEventListener("bundle-compare-change",i=>{let{base:e,target:t,mode:r}=i.detail??{};!H()||!e||e!==l.selectedBundle||l.bundleDetailsTab!=="compare"||(l.bundleCompare=t?{bundle:e,target:t,mode:$i(r)}:null,Be(e,"compare"))});R.addEventListener("sort-change",i=>{let{kind:e,value:t}=i.detail;if(e==="findings")l.sortBy=t;else if(e==="packages")l.packagesSortBy=t;else if(e==="repositories")l.repositoriesSortBy=t;else return;$()});R.addEventListener("range-change",i=>{i.target.id==="conf-range"&&(l.filterConfMin=i.detail.low,l.filterConfMax=i.detail.high,$())});R.addEventListener("input",i=>{let e=i.composedPath()[0],t=e?.id,r=e?.value;t==="g2-path-filter"&&(E.pathFilter=r,E.graphState?.requestDraw?.())});R.addEventListener("search-input",i=>{if(!i.detail)return;let{kind:e,value:t}=i.detail;if(e==="findings"){l.filterInclude=t,t||(l.filterIncludeNegate=!1),xu();return}else if(e==="files")l.filesSearch=t;else if(e==="packages")l.packagesSearchQuery=t;else if(e==="repositories")l.repositoriesSearchQuery=t;else if(e==="bundle-code")l.bundleCodeSearchQuery=t;else if(e==="bundle-search"){l.bundleSearchQuery=t,xu();return}else return;$()});R.addEventListener("search-negate-toggle",()=>{l.filterIncludeNegate=!l.filterIncludeNegate,$()});R.addEventListener("severity-toggle",i=>{let e=i.detail.severity;if(i.detail.kind==="graph"){E.selectedSeverities.has(e)?E.selectedSeverities.delete(e):E.selectedSeverities.add(e),i.composedPath()[0].selected=[...E.selectedSeverities],E.graphState?.requestDraw?.(),lr();return}l.filterSeverities.has(e)?l.filterSeverities.delete(e):l.filterSeverities.add(e),$()});R.addEventListener("color-toggle",i=>{let e=i.detail.color;if(i.detail.kind==="graph"){E.selectedColors.has(e)?E.selectedColors.delete(e):E.selectedColors.add(e),i.composedPath()[0].selected=[...E.selectedColors],E.graphState?.requestDraw?.(),lr();return}l.filterColors.has(e)?l.filterColors.delete(e):l.filterColors.add(e),$()});R.addEventListener("source-toggle",i=>{let e=i.detail.source,t=l.filterSources.has(e);l.filterSources.clear(),t||l.filterSources.add(e),$()});R.addEventListener("annotation-filter-toggle",i=>{let e=i.detail?.key,t=r=>r===""?"with":r==="with"?"without":"";if(e==="comment")l.filterComment=t(l.filterComment);else if(e==="fix")l.filterFix=t(l.filterFix);else if(e==="flag")l.filterFlagged=t(l.filterFlagged);else if(e==="duplicates"&&!l.currentWorkspace)l.filterDuplicates=t(l.filterDuplicates);else if(e==="cross-context")l.filterCrossContext=t(l.filterCrossContext);else if(e==="app-stacked")l.filterAppStacked=t(l.filterAppStacked);else if(e==="security")l.filterSecurity=t(l.filterSecurity);else return;$()});R.addEventListener("slide-triage-toggle",i=>{let{kind:e,value:t}=i.detail;if(e==="package")l.packageSlideTriage=l.packageSlideTriage===t?null:t;else if(e==="repository")l.repositorySlideTriage=l.repositorySlideTriage===t?null:t;else return;$()});R.addEventListener("view-mode-change",i=>{if(i.detail.kind==="files"){l.filesViewMode=i.detail.mode,$();return}l.viewMode=i.detail.mode,l.viewMode!=="kanban"&&(l.kanbanPopoverGid=null),l.viewMode!=="focus"&&(l.focusGid=null),$()});R.addEventListener("severity-mode-change",i=>{let e=i.detail?.mode;if(!(e!=="corrected"&&e!=="original")){l.severityMode=e;try{localStorage.setItem(Ja,e)}catch{}$()}});R.addEventListener("repo-edit-start",()=>{H()||(l.repoEditing=!0,$())});R.addEventListener("repo-input",i=>{H()||(l.repoUrl=i.detail.url,Ai(l.currentFile,l.repoUrl))});R.addEventListener("repo-commit",i=>{H()||(l.repoUrl=i.detail.url,Ai(l.currentFile,l.repoUrl),l.repoEditing=!1,$())});R.addEventListener("repo-cancel",i=>{H()||(l.repoUrl=i.detail.url,Ai(l.currentFile,l.repoUrl),l.repoEditing=!1,$())});document.addEventListener("keydown",i=>{if(i.key==="Escape"){if(l.bundleSourceFindingIdx!=null){l.bundleSourceFindingIdx=null,ti();return}if(l.bundleSourceFile){if(l.currentView==="bundles"&&l.bundleDetailsTab==="code")return;_t(l.bundleDetailsTab),$()}}});function W(i,e){for(let[t,r]of Object.entries(e))i.hasAttribute(t)||i.setAttribute(t,r)}var Pe=Math.PI*2;function vm(i){return()=>{i=i+1831565813|0;let e=i;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}function zu(i,e,t,r){let n=Math.cos(e),s=Math.sin(e);return Math.min(n>0?(t-i.x)/n:n<0?-i.x/n:1/0,s>0?(r-i.y)/s:s<0?-i.y/s:1/0)}function ym(i){return Math.abs(i.reduce((e,t,r)=>{let n=i[(r+1)%i.length];return e+t.x*n.y-n.x*t.y},0))/2}function is(i){return i.slice(1).reduce((e,t,r)=>e+Math.hypot(t.x-i[r].x,t.y-i[r].y),0)}function _m(i,e,t,r){let n=i.map(d=>d.x),s=i.map(d=>d.y),o={x:(Math.min(...n)+Math.max(...n))/2,y:(Math.min(...s)+Math.max(...s))/2},c=Math.max(...i.map(d=>Math.hypot(d.x-o.x,d.y-o.y))),u=Math.atan2(o.y-e.y,o.x-e.x);return{center:o,distance:Math.hypot(o.x-e.x,o.y-e.y),dx:Math.cos(u)*(80+r()*200)+(r()-.5)*90,dy:t-o.y+c+40,rotation:(r()-.5)*160,delay:r()*120}}function qu(i,e,t=7){let r=vm(t),n={x:i*1820/1920,y:e*90/1080},s=Math.hypot(i,e),o=(_,x)=>_<1e-8?0:_>x-1e-8?x:_,c=_=>({x:o(_.x,i),y:o(_.y,e)}),u=Array.from({length:20},(_,x)=>((x+(r()-.5)*.35)*Pe/20+Pe)%Pe);for(let[_,x]of[[0,0],[i,0],[i,e],[0,e]])u.push((Math.atan2(x-n.y,_-n.x)+Pe)%Pe);u.sort((_,x)=>_-x);let p=[.045,.29,.58].map(_=>_*Math.min(i,e)).map(_=>u.map(x=>{let S=Math.min(_*(.92+r()*.16),zu(n,x,i,e));return c({x:n.x+Math.cos(x)*S,y:n.y+Math.sin(x)*S})}));p.push(u.map(_=>{let x=zu(n,_,i,e);return c({x:n.x+Math.cos(_)*x,y:n.y+Math.sin(_)*x})}));let h=p.map((_,x)=>_.map((S,T)=>{let F=_[(T+1)%_.length],O={x:(S.x+F.x)/2,y:(S.y+F.y)/2},A=Math.hypot(F.x-S.x,F.y-S.y),z=S.x===F.x&&(S.x===0||S.x===i)||S.y===F.y&&(S.y===0||S.y===e),Z=x===p.length-1||z?0:(r()-.5)*A*.08,re=Math.atan2(O.y-n.y,O.x-n.x);return[S,c({x:O.x+Math.cos(re)*Z,y:O.y+Math.sin(re)*Z}),F]})),f=p.slice(1).map((_,x)=>_.map((S,T)=>{let F=p[x][T],O=Math.hypot(S.x-F.x,S.y-F.y),A={x:(F.x+S.x)/2,y:(F.y+S.y)/2},z=(u[T]-u[(T+u.length-1)%u.length]+Pe)%Pe,Z=(u[(T+1)%u.length]-u[T]+Pe)%Pe,re=Math.min(z,Z)*Math.hypot(A.x-n.x,A.y-n.y),ne=(r()-.5)*Math.min(O*.12,re*.14);return[F,c({x:A.x-Math.sin(u[T])*ne,y:A.y+Math.cos(u[T])*ne}),S]})),b=[],v=_=>{ym(_)>.01&&b.push({points:_,..._m(_,n,e,r)})};v(h[0].flatMap(_=>_.slice(0,-1)));for(let _=0;_<p.length-1;_++)for(let x=0;x<u.length;x++){let S=(x+1)%u.length;v([...f[_][x],...h[_+1][x].slice(1),...f[_][S].toReversed().slice(1),...h[_][x].toReversed().slice(1)])}let g=Math.max(...b.map(_=>_.distance));for(let _ of b)_.delay+=_.distance/g*400;let y=[],k=(_,x,S,T)=>{let F=is(_);F>.1&&y.push({points:_,length:F,delay:x,duration:S,width:T})};for(let _=0;_<u.length;_++){let x=[n,p[0][_],...f.flatMap(S=>S[_].slice(1))];k(x,0,200+is(x)/s*1e3,1.1)}for(let _ of h.slice(0,-1))for(let x of _){let S=Math.hypot(x[0].x-n.x,x[0].y-n.y);k(x,S/s*1e3,220+is(x)/s*400,.7)}for(let _ of p[1]){let x=Math.atan2(_.y-n.y,_.x-n.x)+(r()-.5)*1.4,S=Math.min(i,e)*(.07+r()*.12),T=[_];for(let F=1;F<=3;F++)T.push(c({x:_.x+Math.cos(x+(r()-.5)*.3)*S*F/3,y:_.y+Math.sin(x+(r()-.5)*.3)*S*F/3}));k(T,Math.hypot(_.x-n.x,_.y-n.y)/s*1e3+80,220,.5)}return{width:i,height:e,impact:n,pieces:b,cracks:y}}var Hu=`.screen-crack{position:fixed;inset:0;z-index:2147483646;overflow:hidden;pointer-events:none;user-select:none}.screen-crack-svg{position:absolute;inset:0;width:100%;height:100%;overflow:hidden}.screen-crack-glass{position:absolute;inset:0;backdrop-filter:blur(9px) brightness(1.06) saturate(.85);background:linear-gradient(135deg,#dcebff0f,#dcebff00 55%);mask-mode:luminance;opacity:0}.screen-crack-shard{transform-box:fill-box;transform-origin:center}.screen-crack-outline{opacity:0}.screen-crack-flash{position:absolute;width:18vmin;height:18vmin;border-radius:50%;background:radial-gradient(circle,rgb(255 255 255 / .85),rgb(200 230 255 / .15) 55%,transparent 75%);transform:translate(-50%,-50%);opacity:0}@media print{.screen-crack{display:none}}
|
|
37
|
-
`;var
|
|
38
|
-
`;var ss="deepview.theme",
|
|
39
|
-
`;var
|
|
40
|
-
`;var
|
|
41
|
-
`;var
|
|
42
|
-
`;var
|
|
43
|
-
`;var
|
|
44
|
-
`;var ms=class extends U{static properties={items:{attribute:!1},selectedGid:{attribute:!1}};static styles=M(Ju);constructor(){super(),this.items=[],this.selectedGid=null}render(){return a`${le(this.items??[],e=>Qe(e),e=>a`<finding-row .group="${e}" ?selected="${Qe(e)===this.selectedGid}"></finding-row>`)}`}};customElements.define("finding-table",ms);var Xu=`:host{display:block}:host(.hidden){display:none}:host([lazy]:not(.content-ready)){visibility:hidden}.card{padding:.5rem .75rem;padding-bottom:var(--finding-card-pad-bottom, .5rem);border-bottom:1px solid var(--border);font-size:.875rem;display:var(--finding-card-display, block);flex-direction:column;flex:1}:host(:last-child) .card{border-bottom:none}.card.card-pending{min-height:8rem}:host(.has-conflict) .card{outline:2px dashed var(--accent);outline-offset:-2px}:host(.has-conflict[popup][context="kanban-detail"]) .card{outline:none}:host(.link-target) .card{animation:link-target-flash 1.6s ease-out}@keyframes link-target-flash{0%,30%{box-shadow:inset 0 0 0 2px var(--accent)}to{box-shadow:inset 0 0 0 2px rgb(from var(--accent) r g b / 0)}}@media(prefers-reduced-motion:reduce){:host(.link-target) .card{animation:none;box-shadow:inset 0 0 0 2px var(--accent)}}:host([in-group]) .line-row{display:none}@media not print{:host([in-group]) .line-row+*{margin-top:0}:host([in-group]) .line-row+:is(.conf-reason,.revalidate-verdict,.severity-reason){padding-top:0;border-top:0}}.tabs{display:flex;gap:.25rem;flex-wrap:wrap}.marks-left{display:flex;align-items:center;gap:.5rem;margin-right:auto;flex-wrap:wrap}.commit-ref{color:var(--muted);font-size:.8rem;& a{color:var(--accent);font-family:ui-monospace,SFMono-Regular,Menlo,monospace}& a:hover{text-decoration:underline}& span{font-family:ui-monospace,SFMono-Regular,Menlo,monospace}}.marks-commit-row{margin-top:.4rem;padding-left:4.75rem}.tab-body{display:none;grid-template-columns:auto 1fr;gap:.25rem .75rem;&.active{display:grid}}.tab-body>:not(.finding-left){min-width:0;overflow-wrap:break-word}.desc-title{grid-column:2;font-size:1.08em;font-weight:600;letter-spacing:-.005em;line-height:1.35;color:var(--text)}.desc{grid-column:2;white-space:pre-wrap;font-size:.96em;line-height:1.6;color:rgb(from var(--text) r g b / .82);margin-top:.4rem}.section,.evidence,.recommendation{grid-column:2;margin-top:.55rem;font-size:.92em}.section-label{display:flex;align-items:center;gap:.3rem;color:var(--muted);font-weight:600;font-size:.62rem;text-transform:uppercase;letter-spacing:.06em;&:before{content:"";flex:none;width:2px;height:.58rem;margin-left:calc((2px + .3rem)*-1);border-radius:1px;background:currentcolor;opacity:.75;-webkit-print-color-adjust:exact;print-color-adjust:exact}}.code-preview-btn{display:inline-flex;align-items:center;margin-left:.35rem;padding:0 .15rem;border:0;background:transparent;color:var(--muted);vertical-align:-2px;&.open{color:var(--accent)}}.gh-ref-btn{display:inline-flex;align-items:center;margin-left:.25rem;padding:0 .15rem;color:var(--muted);vertical-align:-2px}:is(.code-preview-btn,.gh-ref-btn){position:relative;&:before{content:"";position:absolute;inset:-.25rem -2px}&:hover{color:var(--accent)}&:focus-visible{outline:1px solid var(--accent);outline-offset:1px;border-radius:var(--ui-radius, 2px)}}.code-preview-tip{position:absolute;z-index:20;top:100%;left:0;margin-top:.3rem;width:max-content;max-width:min(100%,46rem);visibility:hidden;filter:drop-shadow(0 2px 6px rgb(0 0 0 / .35));background:var(--bg);border-radius:var(--ui-radius, 4px);.code-preview{margin:0}}:is(.line-row,.evidence-list li):has(.code-preview-btn:is(:hover,:focus-visible))>.code-preview-tip{visibility:visible}.code-preview{margin:.3rem 0 .1rem;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);background:var(--surface);backdrop-filter:var(--glass-blur);max-height:calc(10lh + .7rem);overflow:auto;display:flex;align-items:flex-start;white-space:normal;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.75rem;line-height:1.5}.code-preview-pending{display:block;padding:.35rem .5rem;color:var(--muted);font-style:italic}.code-preview-gutter{flex:none;padding:.35rem .45rem .35rem .5rem;border-right:1px solid var(--border);color:var(--muted);text-align:right;user-select:none;position:sticky;left:0;z-index:1;background-color:var(--bg);background-image:linear-gradient(rgb(from var(--text) r g b / .03),rgb(from var(--text) r g b / .03)),linear-gradient(var(--surface),var(--surface));.code-preview-lineno{width:var(--lineno-width, 3ch);opacity:.7}.cited{opacity:1;color:var(--accent);font-weight:600}}.code-preview-source{margin:0;padding:.35rem .6rem;white-space:pre;color:var(--text);font:inherit;& code{font:inherit}}summary.section-label{cursor:default;list-style:none;&::-webkit-details-marker{display:none}&:after{content:"";flex:none;width:.3rem;height:.3rem;margin-left:.05rem;border-right:1.5px solid currentcolor;border-bottom:1.5px solid currentcolor;transform:translateY(-1px) rotate(-45deg);transition:transform .12s;opacity:.8}}details[open]>summary.section-label:after{transform:translateY(-2px) rotate(45deg)}.evidence-count{font-weight:500;opacity:.8}.section-body{white-space:pre-wrap;line-height:1.55;color:rgb(from var(--text) r g b / .82);margin-top:.1rem}.para+.para{margin-top:.5lh}.md-list{margin:0;padding-inline-start:1.2em}.md-list li+li{margin-top:.25lh}.para+.md-list,.md-list+.para,.md-list+.md-list{margin-top:.5lh}.md-list li::marker{color:rgb(from currentcolor r g b / .45)}.recommendation .section-label,.recommendation .section-body{color:var(--green)}.conf-reason,.revalidate-verdict{grid-column:2;white-space:pre-wrap;font-size:.92em;font-style:italic;color:var(--muted);margin-top:.6rem;padding-top:.55rem;border-top:1px dashed var(--border)}.revalidate-stamp{display:inline-block;margin-top:.1rem;font-size:.55rem;font-weight:600;line-height:1;text-transform:uppercase;letter-spacing:.03em;padding:.14rem .3rem;border-radius:3px;background:transparent;color:var(--muted);border:1px solid var(--border);white-space:nowrap;&.confirmed{color:var(--critical);border-color:rgb(from var(--critical) r g b / .55)}&.partial{color:var(--yellow);border-color:rgb(from var(--yellow) r g b / .55)}&.unknown{color:var(--warning);border-color:rgb(from var(--warning) r g b / .55)}}.evidence-list{margin:.25rem 0 0;padding-left:1.6rem;display:flex;flex-direction:column;gap:.15rem;>li{position:relative}& li::marker{color:var(--muted);font-size:.9em}>li.current:before{content:"";position:absolute;left:-1.5rem;top:.58em;width:.35rem;height:.35rem;border-radius:50%;background:var(--accent)}>li.current::marker{color:var(--accent)}& li:has(.evidence-note):not(:last-child){margin-bottom:.3rem}}.evidence-ref{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.92em;overflow-wrap:anywhere;color:var(--accent);text-decoration:none;&:is(a,[role=link]):hover{text-decoration:underline}&:focus-visible{outline:1px solid var(--accent);outline-offset:1px;border-radius:var(--ui-radius, 2px)}}:is(.line-num a,.evidence-ref,.gh-ref-btn){cursor:default}span.evidence-ref:not([role]){color:var(--muted)}.evidence-note{white-space:pre-wrap;line-height:1.5;color:rgb(from var(--text) r g b / .78);margin-top:.1rem}.desc-title a,.desc a,.section-body a,.conf-reason a,.revalidate-verdict a{color:var(--accent);text-decoration:none;&:hover{text-decoration:underline}}.inline-quote{background:rgb(from var(--accent) r g b / .1);padding:1px;border-radius:3px;color:var(--text)}.inline-code{background:var(--surface-active);border-radius:3px;border:1px solid var(--border);padding:0 .25em;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.9em;color:var(--text)}.code-block:not(.token){white-space:normal;margin:.5rem 0;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);background:rgb(from var(--text) r g b / .05);overflow:hidden;width:fit-content;max-width:100%;.code-block-lang{padding:.15rem .5rem;border-bottom:1px solid var(--border);color:var(--muted);font-size:.62rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em}& pre{margin:0;padding:.45rem .6rem;overflow-x:auto;white-space:pre;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.85em;line-height:1.5;color:var(--text)}& code{font:inherit}}.line-row{display:flex;justify-content:space-between;align-items:baseline;gap:.5rem;flex-wrap:wrap;padding-right:var(--finding-line-end-inset, 0);position:relative}.run-meta{color:var(--muted);font-size:.65rem}.finding-code-btn{display:inline-block;margin-top:.35rem;padding:.1rem .45rem;background:transparent;border:1px solid var(--border);border-radius:var(--ui-radius, 999px);color:var(--muted);font:inherit;font-size:.65rem;font-weight:500;white-space:nowrap}.finding-code-btn:hover{border-color:var(--accent);color:var(--accent)}.marks{display:flex;gap:.35rem;justify-content:flex-end;margin-top:.4rem;align-items:center;position:var(--finding-marks-position, static);bottom:0;background:var(--finding-marks-bg, transparent);padding-bottom:var(--finding-marks-pad-bottom, 0);padding-left:4.75rem;user-select:none}.finding-left{align-self:start;text-align:center;min-width:4rem;padding-top:var(--finding-left-inset, 0);position:var(--finding-left-position, relative);top:var(--finding-mark-sticky-top, 0);.value-label:last-child{margin-bottom:0}}:host(:not([popup])) .finding-left{padding-top:calc(var(--finding-left-inset, 0px) + 2px)}.conf-score{font-size:.75rem;color:var(--muted);margin-top:.3rem;& strong{color:var(--text);font-size:.85rem}}.conf-ring{--col: var(--muted);position:relative;width:3rem;height:3rem;margin:.7rem auto .15rem;display:flex;align-items:center;justify-content:center;& svg{position:absolute;inset:0;width:100%;height:100%;transform:rotate(-90deg)}& circle{fill:none;stroke-width:4}.conf-ring-track{stroke:var(--border)}.conf-ring-arc{stroke:var(--col);stroke-linecap:round}& span{position:relative;z-index:1;font-size:.8rem;font-weight:700;color:var(--text);font-variant-numeric:tabular-nums}& small{font-size:.55rem;color:var(--muted);font-weight:500}&.critical{--col: var(--critical)}&.high{--col: var(--high)}&.medium{--col: var(--medium)}&.low{--col: var(--low)}&.high_bug{--col: var(--high-bug)}&.bug{--col: var(--bug)}&.informational{--col: var(--info)}}.value-label{display:block;font-size:.45rem;color:var(--muted);text-transform:uppercase;letter-spacing:.04em;margin-top:.1rem;margin-bottom:.3rem;font-weight:500}.print-case-label{display:none}.badge,.tabs,.tab,.value-label,.run-meta,.conf-ring{cursor:default;user-select:none}.severity-reason{margin-top:.4rem;padding-top:.35rem;border-top:1px dashed var(--border);font-size:.82em;font-style:italic;color:var(--muted)}.severity-reason-label{font-style:normal;font-weight:600;text-transform:uppercase;font-size:.85em;letter-spacing:.04em;margin-right:.35rem}.duplicates-block .file-icon{flex-shrink:0}:host([context="focus"]) .triage-menu-wrap>.mark-triage-menu{display:none}:host([context="focus"]) .triage-menu-wrap{display:inline-flex}:host([context="focus"]) .triage-menu[popover]{position:static;inset:auto;display:inline-flex!important;flex-flow:row wrap;margin:0;padding:0;background:transparent;border:0;border-radius:0;box-shadow:none;min-width:0;gap:.25rem}:host([context="focus"]) .triage-menu-item{background:transparent;border:1px solid var(--border);padding:.2rem .5rem;border-radius:var(--ui-radius, 3px);font-size:.72rem;font-weight:500;text-transform:uppercase;letter-spacing:.04em}:host([context="focus"]) .triage-menu-item.active{background:rgb(from var(--accent) r g b / .12);border-color:var(--accent);color:var(--accent)}:host([context="focus"]) .triage-menu-item:not(:disabled):hover{background:var(--surface-active)}:host([context="focus"]) .triage-menu-inprogress.active{background:rgb(from var(--warning, #d97706) r g b / .12);border-color:var(--warning, #d97706);color:var(--warning, #d97706)}:host([context="focus"]) .triage-menu-fixed.active{background:rgb(from var(--green, #4ade80) r g b / .12);border-color:var(--green, #4ade80);color:var(--green, #4ade80)}:host([context="focus"]) .triage-menu-deleted.active{background:rgb(from var(--critical) r g b / .12);border-color:var(--critical);color:var(--critical)}:host([context="focus"]) .triage-menu-item.active:before{content:"";margin:0}:host([context="focus"]) .marks{gap:.5rem;margin-top:var(--finding-marks-margin-top, .65rem);padding-left:0;padding-top:.55rem;border-top:1px solid var(--border);flex-wrap:wrap}:host([context="focus"]) .marks-commit-row{padding-left:0}:host([context="focus"]) .mark-comment,:host([context="focus"]) .mark-fix,:host([context="focus"]) .mark-flag,:host([context="focus"]) .mark-copy,:host([context="focus"]) .mark-link,:host([context="focus"]) .mark-issue,:host([context="focus"]) .mark-claude{height:1.75rem;padding:0 .55rem;gap:.35rem;display:inline-flex;align-items:center;font-size:.72rem}:host([context="focus"]) .mark-btn-label{color:inherit;font-weight:500;letter-spacing:.02em}.finding-top-marks{position:absolute;top:calc(var(--finding-left-inset, 0px) - var(--finding-mark-inset, .5rem));left:calc(.75rem - var(--finding-mark-inset, .5rem));display:grid;grid-template-columns:24px 12px;column-gap:31px;&.color-red{color:var(--marker-red)}&.color-blue{color:var(--marker-blue)}&.color-green{color:var(--marker-green)}&.color-gray{color:var(--marker-gray)}}.finding-color-mark{grid-column:1;display:block;width:24px;height:12px;border-radius:var(--ui-radius, 0 0 6px 6px);background:currentcolor;box-shadow:inset 0 0 0 1px rgb(from var(--text) r g b / .15)}.finding-bookmark-mark{grid-column:2;display:block;width:12px;height:12px;background:var(--bookmark-color);clip-path:polygon(0 0,100% 0,100% 100%,50% 75%,0 100%)}:host(:not([popup])) :is(.finding-color-mark,.finding-bookmark-mark){height:10px}.comment-block,.fix-block{margin-top:.5rem;padding:.35rem .55rem;border-left:3px solid var(--accent);background:rgb(from var(--accent) r g b / .08);border-radius:var(--ui-radius, 0 4px 4px 0);font-size:.82rem;color:var(--text)}.comment-block{white-space:pre-wrap;& a{color:var(--accent);text-decoration:none}& a:hover{text-decoration:underline}& a.comment-self-ref{text-decoration:underline dotted;text-underline-offset:2px}& a.comment-self-ref:hover{text-decoration:underline solid}}.comment-block:has(.managed-comment){white-space:normal}.fix-block{word-break:break-all;& a{color:var(--accent);text-decoration:none}& a:hover{text-decoration:underline}}.fix-block:has(managed-fix-link){display:flex;align-items:center;gap:.6rem;padding:.45rem .65rem;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);background:rgb(from var(--muted) r g b / .04);word-break:normal;.fix-label{flex:none;font-size:.75rem;font-weight:500}& managed-fix-link{flex:1;min-width:0}}.duplicates-block{display:flex;align-items:baseline;flex-wrap:wrap;gap:.1rem .4rem;margin-top:.5rem;padding:.35rem .55rem;border-left:3px solid var(--muted);background:rgb(from var(--muted) r g b / .1);border-radius:var(--ui-radius, 0 4px 4px 0);font-size:.82rem;color:var(--text);.duplicates-label{color:var(--muted);font-weight:600}& a.duplicate-ref{display:inline-flex;align-items:center;gap:.25rem;color:var(--accent);text-decoration:none}& a.duplicate-ref .duplicate-ref-id{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.78rem;text-decoration:underline dotted;text-underline-offset:2px}& a.duplicate-ref:hover .duplicate-ref-id{text-decoration:underline solid}}.comment-label,.fix-label{color:var(--muted);font-weight:600;margin-right:.35rem}.line-num{color:var(--muted);font-size:.8rem}.line-num a{color:inherit;text-decoration:none}.npm-link{display:inline-block;padding:0 .4rem;border:1px solid var(--border);border-radius:var(--ui-radius, 3px);font-size:.72rem;font-weight:500;color:var(--muted);text-decoration:none}.npm-link:hover{border-color:var(--accent);color:var(--accent)}@media print{.card{break-inside:var(--finding-print-break, avoid);box-decoration-break:clone;padding:.45rem .25rem}.finding-code-btn,.mark-copy,.mark-link,.mark-issue,.mark-claude{display:none!important}.npm-link{border:0;padding:0}:host(.triage-fixed),:host(.triage-invalid),:host(.triage-deleted),:host(.triage-ignored){opacity:1}:host(.link-target) .card{animation:none;box-shadow:none!important}:host(.multi-case) .card:before{content:"Multiple reports of one finding";display:block;font-size:.7rem;font-weight:700;color:#555;text-transform:uppercase;letter-spacing:.06em;border-bottom:1px solid #bbb;padding-bottom:.2rem;margin-bottom:.35rem;-webkit-print-color-adjust:exact;print-color-adjust:exact}.marks,.tabs{display:none!important}.tab-body{display:grid!important;break-inside:var(--finding-print-break, avoid)}:host(.multi-case) .tab-body{break-inside:auto}:host(.multi-case) .tab-body+.tab-body{break-inside:avoid}.tab-body+.tab-body{margin-top:.5rem;padding-top:.5rem;border-top:1px dashed #999}:host([print-one-sample]) .tab-body:not(.active),:host([print-one-sample]) .print-case-label,:host([print-one-sample]) .card:before{display:none!important}:host([print-one-sample]) .tab-body.active{margin-top:0;padding-top:0;border-top:0;break-inside:var(--finding-print-break, avoid)}.finding-body{display:flex;flex-direction:column;>*{flex-shrink:0}}.line-row,.desc-title,.conf-reason,.severity-reason{break-inside:avoid}.section-label{break-after:avoid}.desc,.section-body{orphans:2;widows:2}.section,.recommendation,.evidence{break-inside:avoid}.evidence{order:99}.evidence>summary{break-after:avoid}.evidence-list>li{break-inside:avoid}:host([in-group].multi-case:not([print-one-sample])) .tab-body .line-row{display:flex}:host([in-group]:is(:not(.multi-case),[print-one-sample])) .line-row+*{margin-top:0}:host([in-group]:is(:not(.multi-case),[print-one-sample])) .line-row+.conf-reason{padding-top:0;border-top:0}.line-row .discovered-in{flex-basis:100%;order:99}.print-case-label{display:block;grid-column:1 / -1;break-after:avoid;font-size:.65rem;font-weight:600;color:#555;background:#eee;padding:.1rem .35rem;border-radius:3px;margin-bottom:.25rem;letter-spacing:.04em;-webkit-print-color-adjust:exact;print-color-adjust:exact}.value-label{color:#777}.badge{-webkit-print-color-adjust:exact;print-color-adjust:exact;&.critical{background:#a30b0f!important;color:#fff!important}&.high{background:#b8400a!important;color:#fff!important}&.medium{background:#855107!important;color:#fff!important}&.low{background:#374151!important;color:#fff!important}&.high_bug{background:#7a3e0c!important;color:#fff!important}&.bug{background:#4d4538!important;color:#fff!important}&.informational{background:#0550ae!important;color:#fff!important}}.badge-orig{background:transparent!important;color:#555!important;border-color:#999!important}.badge-varies,.revalidate-stamp{color:#555!important;border-color:#999!important}.badge-arrow,.badge-corr-mark,.badge-pre,.severity-reason{color:#555!important}a,.line-num,.line-num a,.desc-title a,.desc a,.section-body a,.conf-reason a,.revalidate-verdict a,.evidence-ref{color:inherit}details:not([open])>:not(summary){display:block}details::details-content{content-visibility:visible}summary.section-label{cursor:default;&:after{display:none}}.code-preview-btn,.gh-ref-btn{display:none}.inline-code{border:0;background:transparent}.code-block:not(.token){background:transparent;border-color:#bbb;.code-block-lang{color:#555;border-bottom-color:#bbb}& pre{white-space:pre-wrap;overflow:visible}.token{color:#333!important}.token.comment,.token.prolog,.token.cdata{color:#666!important}}}
|
|
45
|
-
`;var
|
|
46
|
-
`;var Hm=["red","blue","green","gray"],gs=class extends U{static properties={selected:{type:String},disabled:{type:Boolean}};static styles=M(Qu);constructor(){super(),this.selected=null,this.disabled=!1}render(){return a`${Hm.map(e=>a`<button type="button" class="${`color-${e}${this.selected===e?" active":""}`}" data-color="${e}" aria-label="${`mark ${e}`}" ?disabled="${this.disabled}" @click="${this._onClick}"></button>`)}`}_onClick=e=>{if(this.disabled)return;let t=e.currentTarget.dataset.color;this.dispatchEvent(new CustomEvent("mark-color",{detail:{color:t},bubbles:!0,composed:!0}))}};customElements.define("color-marker",gs);var bs=class extends D{static properties={rangeDisabled:{type:Boolean,attribute:"range-disabled"},revalidateOptions:{attribute:!1},hasPartial:{type:Boolean,attribute:"has-partial"}};createRenderRoot(){return this}constructor(){super(),this.rangeDisabled=!1,this.revalidateOptions=[],this.hasPartial=!1}render(){let e=l.filterConfMin,t=l.filterConfMax,r=this.revalidateOptions??[],n=this.rangeDisabled,s=r.length>0&&!!l.filterRevalidate,o=n?"No confidence range: some findings on screen carry no confidence score":m;return a`<span class="${I({"conf-range-label":!0,replaced:s,disabled:n})}" data-tooltip="${o}">Confidence</span> <span class="${I({"conf-range":!0,replaced:s,disabled:n})}" ?inert="${n||s}"><range-slider id="conf-range" min="0" max="10" step="1" low="${e}" high="${t}" aria-label="Confidence range"></range-slider><conf-range-mirror id="conf-range-vals" class="conf-vals" for="conf-range" .low="${e}" .high="${t}"></conf-range-mirror></span>${r.length>0?a`<revalidate-filter class="${I({replaces:s})}" .options="${r}" ?has-partial="${this.hasPartial}"></revalidate-filter>`:m}`}};customElements.define("conf-filter",bs);var Zu={files:"Filter files\u2026",code:"Search code\u2026",issues:"Search issues\u2026",largest:"Filter largest files\u2026"},ep={files:"Filter files",code:"Search code",issues:"Search issues",largest:"Largest files"},Um=a`<svg class="bundle-code-search-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="6.5" cy="6.5" r="4.5"/><path d="M9.7 9.7L13 13" stroke-linecap="round"/></svg>`,jm={files:Ui,code:ji,issues:a`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.3" aria-hidden="true"><circle cx="8" cy="8" r="6"/><path d="M8 4.8v3.6" stroke-linecap="round"/><circle cx="8" cy="11" r=".7" fill="currentColor" stroke="none"/></svg>`,largest:a`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true"><path d="M2.5 4h11M2.5 8h7.5M2.5 12h4"/></svg>`},vs=class extends D{static properties={modes:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.modes=[]}render(){let e=l.bundleCodeSearchQuery,t=l.bundleCodeSearchMode,r=this.modes.includes(t)?t:"files",n=Zu[r]??Zu.files;return a`${Um} <input type="text" class="bundle-code-search-input" placeholder="${n}" aria-label="${n}" .value="${j(e)}" @input="${this._onInput}"> ${e?a`<button type="button" class="bundle-code-search-clear" aria-label="Clear search" @click="${this._onClear}">×</button>`:m} ${this.modes.length>0?a`<span class="bundle-code-search-modes" role="tablist">${this.modes.map(s=>a`<button type="button" class="${I({"bundle-code-search-mode":!0,active:r===s})}" role="tab" aria-selected="${String(r===s)}" data-tooltip="${ep[s]??s}" aria-label="${ep[s]??s}" @click="${()=>this._selectMode(s)}">${jm[s]??m}</button>`)}</span>`:m}`}_onInput=e=>{this._dispatchInput(e.target.value)};_onClear=()=>{this._dispatchInput("")};_dispatchInput(e){this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:"bundle-code",value:e},bubbles:!0,composed:!0}))}_selectMode(e){this.dispatchEvent(new CustomEvent("bundle-search-mode-change",{detail:{mode:e},bubbles:!0,composed:!0}))}};customElements.define("bundle-code-search",vs);var Tt=320,ys=class extends HTMLElement{constructor(){super(),this._drag=null,this.addEventListener("pointerdown",e=>this._startDrag(e)),this.addEventListener("pointermove",e=>{this._drag?.id===e.pointerId&&(Tt=this._apply(this._drag.width+e.clientX-this._drag.x))});for(let e of["pointerup","pointercancel","lostpointercapture"])this.addEventListener(e,t=>{this._drag?.id===t.pointerId&&this._endDrag()});this.addEventListener("keydown",e=>this._onKeyDown(e)),this.addEventListener("dblclick",()=>{Tt=320,this._apply(Tt)})}connectedCallback(){this._view=this.closest(".bundle-code-view"),this._view&&(this._observer=new ResizeObserver(()=>this._apply(Tt)),this._observer.observe(this._view),this._apply(Tt))}disconnectedCallback(){this._observer?.disconnect(),this._endDrag(),this._view=null}_bounds(){let e=this._view.getBoundingClientRect().width;return{min:Math.min(180,e*.4),max:e*.6}}_apply(e){if(!this._view)return e;let{min:t,max:r}=this._bounds();if(r===0)return e;let n=Math.max(t,Math.min(r,e));return this._view.style.setProperty("--bundle-code-rail-width",`${n}px`),this.setAttribute("aria-valuemin",String(Math.round(t))),this.setAttribute("aria-valuemax",String(Math.round(r))),this.setAttribute("aria-valuenow",String(Math.round(n))),this.setAttribute("aria-valuetext",`${Math.round(n)} pixels`),n}_startDrag(e){if(e.button!==0||!e.isPrimary||this._drag||!this._view)return;e.preventDefault();let t=this._view.querySelector(".bundle-code-rail").getBoundingClientRect().width;this._drag={id:e.pointerId,x:e.clientX,width:t},this.setPointerCapture(e.pointerId),this.classList.add("dragging")}_endDrag(){if(!this._drag)return;let{id:e}=this._drag;this._drag=null,this.classList.remove("dragging"),this.hasPointerCapture(e)&&this.releasePointerCapture(e)}_onKeyDown(e){if(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||!this._view)return;let t=this._view.querySelector(".bundle-code-rail").getBoundingClientRect().width,{min:r,max:n}=this._bounds(),s={ArrowLeft:t-16,ArrowRight:t+16,Home:r,End:n}[e.key];s!==void 0&&(e.preventDefault(),e.stopPropagation(),Tt=this._apply(s))}};customElements.define("bundle-code-splitter",ys);var _s=class extends HTMLElement{connectedCallback(){this._schedule=()=>{this._frame||(this._frame=requestAnimationFrame(()=>this._update()))},this._resize=new ResizeObserver(this._schedule),this._resize.observe(this),this._mutation=new MutationObserver(this._schedule),this._mutation.observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["hidden"]}),this._mode=matchMedia("(display-mode: window-controls-overlay)"),this._mode.addEventListener("change",this._schedule),navigator.windowControlsOverlay?.addEventListener("geometrychange",this._schedule),this._schedule()}disconnectedCallback(){cancelAnimationFrame(this._frame),this._frame=0,this._resize.disconnect(),this._mutation.disconnect(),this._mode.removeEventListener("change",this._schedule),navigator.windowControlsOverlay?.removeEventListener("geometrychange",this._schedule)}_update(){this._frame=0,this.classList.remove("boxed");let e=this.querySelector(".bundles-slide-bar");if(!e)return;this._resize.observe(e);let t=this.querySelector(".bundles-slide-tabs");t&&this._resize.observe(t);let r=parseFloat(getComputedStyle(this,"::before").height)||0;if(!r)return;let n=this.getBoundingClientRect(),s=e.getBoundingClientRect();this.classList.toggle("boxed",s.top>n.top+1||s.height>r+1)}};customElements.define("bundle-slide-header",_s);var Vm=a`<svg class="bundle-search-icon" viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="6.5" cy="6.5" r="4.5"/><path d="M9.7 9.7L13 13" stroke-linecap="round"/></svg>`,ws=class extends D{createRenderRoot(){return this}render(){let e=l.bundleSearchQuery,t=l.bundleSearchRegex,r=l.bundleSearchCase,n=t?"Search by regular expression\u2026":"Search all source\u2026";return a`${Vm} <input type="text" class="bundle-search-input" placeholder="${n}" aria-label="${n}" spellcheck="false" autocapitalize="off" autocomplete="off" .value="${j(e)}" @input="${this._onInput}"> ${e?a`<button type="button" class="bundle-search-clear" aria-label="Clear search" @click="${this._onClear}">×</button>`:m} <span class="bundle-search-mods"><button type="button" class="${I({"bundle-search-mod":!0,active:r})}" data-tooltip="${r?"Case-sensitive on \u2014 click to ignore case":"Match case"}" aria-label="Match case" aria-pressed="${String(r)}" @click="${this._onToggleCase}">Aa</button> <button type="button" class="${I({"bundle-search-mod":!0,active:t})}" data-tooltip="${t?"Regular expression on \u2014 click for plain text":"Match by regular expression"}" aria-label="Match by regular expression" aria-pressed="${String(t)}" @click="${this._onToggleRegex}">.*</button></span>`}_onInput=e=>{this._dispatchInput(e.target.value)};_onClear=()=>{this._dispatchInput("")};_dispatchInput(e){this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:"bundle-search",value:e},bubbles:!0,composed:!0}))}_onToggleRegex=()=>{this.dispatchEvent(new CustomEvent("bundle-search-regex-toggle",{bubbles:!0,composed:!0}))};_onToggleCase=()=>{this.dispatchEvent(new CustomEvent("bundle-search-case-toggle",{bubbles:!0,composed:!0}))}};customElements.define("bundle-search",ws);function Se(i,e,t){let r=e[t];return r||console.warn(`<${i}>: unknown kind ${JSON.stringify(t)}; expected one of ${Object.keys(e).map(n=>JSON.stringify(n)).join(", ")}.`),r}var Km={packages:{stateKey:"packagesSearchQuery",label:"Filter packages"},repositories:{stateKey:"repositoriesSearchQuery",label:"Filter repositories"}},ks=class extends D{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let e=Se("entity-search",Km,this.kind);return e?a`<input type="search" class="packages-search" placeholder="${`${e.label}\u2026`}" aria-label="${e.label}" .value="${j(l[e.stateKey])}" @input="${this._onInput}">`:m}_onInput=e=>{this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:this.kind,value:e.target.value},bubbles:!0,composed:!0}))}};customElements.define("entity-search",ks);var Gm=[["findings-desc","Findings \u2193"],["files-desc","Files \u2193"],["reports-desc","Reports \u2193"],["name-asc","Name A\u2192Z"]],Wm={packages:{stateKey:"packagesSortBy",aria:"Sort packages"},repositories:{stateKey:"repositoriesSortBy",aria:"Sort repositories"}},$s=class extends D{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let e=Se("entity-sort",Wm,this.kind);return e?a`<select class="packages-sort" aria-label="${e.aria}" .value="${j(l[e.stateKey])}" @change="${this._onChange}">${Gm.map(([t,r])=>a`<option value="${t}" ?selected="${l[e.stateKey]===t}">${r}</option>`)}</select>`:m}_onChange=e=>{this.dispatchEvent(new CustomEvent("sort-change",{detail:{kind:this.kind,value:e.target.value},bubbles:!0,composed:!0}))}};customElements.define("entity-sort",$s);var xs=class extends D{static properties={showFile:{type:Boolean,attribute:"show-file"},showConfidence:{type:Boolean,attribute:"show-confidence"},showPriority:{type:Boolean,attribute:"show-priority"}};createRenderRoot(){return this}constructor(){super(),this.showFile=!1,this.showConfidence=!1,this.showPriority=!1}render(){let e=(t,r)=>a`<option value="${t}" ?selected="${l.sortBy===t}">${r}</option>`;return a`<select class="sort-select" aria-label="Sort findings" .value="${j(l.sortBy)}" @change="${this._onChange}">${e("severity","Severity \u2193")} ${this.showFile?e("file","File \u2191"):m} ${this.showConfidence?a`${e("confidence-desc","Confidence \u2193")}${e("confidence-asc","Confidence \u2191")}`:m} ${this.showPriority?a`${e("priority-desc","Priority \u2193")}${e("priority-asc","Priority \u2191")}`:m}</select>`}_onChange=e=>{this.dispatchEvent(new CustomEvent("sort-change",{detail:{kind:"findings",value:e.target.value},bubbles:!0,composed:!0}))}};customElements.define("findings-sort",xs);var tp=`:host{display:inline-flex;align-items:center;width:8.5rem;height:16px;--rs-thumb-size: 14px;--rs-track-height: 3px;--rs-rail: rgb(from currentcolor r g b / .25);--rs-fill: var(--accent, currentColor)}.track-wrap{position:relative;flex:1;height:var(--rs-thumb-size)}.track{position:absolute;left:0;right:0;top:50%;height:var(--rs-track-height);transform:translateY(-50%);border-radius:var(--ui-radius, 99px);background:linear-gradient(to right,var(--rs-rail) 0,var(--rs-rail) var(--low, 0%),var(--rs-fill) var(--low, 0%),var(--rs-fill) var(--high, 100%),var(--rs-rail) var(--high, 100%))}input[type=range]{appearance:none;-webkit-appearance:none;position:absolute;left:0;right:0;top:0;width:100%;height:var(--rs-thumb-size);background:transparent;pointer-events:none;margin:0;padding:0;outline:none}input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;pointer-events:auto;width:var(--rs-thumb-size);height:var(--rs-thumb-size);border-radius:50%;background:var(--rs-fill);border:0;box-shadow:0 1px 3px #00000080}input[type=range]::-moz-range-thumb{pointer-events:auto;width:var(--rs-thumb-size);height:var(--rs-thumb-size);border-radius:50%;background:var(--rs-fill);border:0;box-shadow:0 1px 3px #00000080}input[type=range]::-webkit-slider-runnable-track{background:transparent;height:var(--rs-thumb-size)}
|
|
47
|
-
`;var Ss=class extends U{static properties={min:{type:Number},max:{type:Number},step:{type:Number},low:{type:Number},high:{type:Number}};static styles=M(
|
|
48
|
-
`;var Es=class extends q{static styles=[...q.styles,M(
|
|
49
|
-
`;var Ts=a`<svg viewBox="0 0 16 16" width="12" height="12" fill="currentColor" aria-hidden="true"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>`,sp=a`<svg viewBox="0 0 16 16" width="11" height="11" fill="currentColor" aria-hidden="true"><path d="M11.013 1.427a1.75 1.75 0 0 1 2.474 0l1.086 1.086a1.75 1.75 0 0 1 0 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 0 1-.927-.928l.929-3.25c.082-.286.235-.547.445-.758l8.61-8.61z"/></svg>`,Rs=class extends U{static properties={url:{type:String},editable:{type:Boolean,reflect:!0},editing:{type:Boolean,reflect:!0},_copied:{state:!0}};static styles=M(np);constructor(){super(),this.url="",this.editable=!1,this.editing=!1,this._copied=!1,this._opener=""}render(){if(this.editable&&this.editing){let e=!!this.url,t=e?We(this.url):"Set repo";return a`<span class="${e?"chip":"chip empty"}" aria-hidden="true" inert>${Ts} <span class="label">${t}</span> <button type="button" class="edit-btn">${sp}</button> </span><input type="text" .value="${j(this.url)}" placeholder="user/repo or https://github.com/user/repo" @input="${this._onInput}" @focus="${this._onFocus}" @keydown="${this._onKeydown}" @blur="${this._onBlur}">`}if(this.editable){let e=!!this.url,t=e?We(this.url):"Set repo",r=e?this._copied?"chip copied":"chip":"chip empty";return a`<span class="${r}" @click="${e?null:this._onEdit}">${Ts} ${e?this._slugLabel(t):a`<span class="label">${t}</span>`} <button type="button" class="edit-btn" aria-label="Edit repo URL" @click="${this._onEdit}">${sp}</button></span>`}if(this.url){let e=this._copied?"chip readonly copied":"chip readonly";return a`<span class="${e}">${Ts} ${this._slugLabel(We(this.url))}</span>`}return m}_slugLabel(e){return a`<span class="label" @click="${this._onCopyLabel}">${e}</span>`}updated(e){if(e.has("editing")&&this.editing){let t=this.renderRoot.querySelector("input");t&&(t.focus(),t.select())}}_onEdit=e=>{e&&e.stopPropagation(),this._emit("repo-edit-start")};_onCopyLabel=e=>{e&&e.stopPropagation();let t=We(this.url);if(t)try{navigator.clipboard.writeText(t).then(()=>(this._copied=!0,setTimeout(()=>{this._copied=!1},1e3),null)).catch(()=>{})}catch{}};_onFocus=e=>{this._opener=e.target.value};_onInput=e=>{this.url=e.target.value,this._emit("repo-input",{url:this.url})};_onKeydown=e=>{e.key==="Enter"?(e.preventDefault(),this._emit("repo-commit",{url:this.url})):e.key==="Escape"&&(e.preventDefault(),this.url=this._opener,this._emit("repo-cancel",{url:this._opener}))};_onBlur=()=>{this.editing&&this._emit("repo-commit",{url:this.url})};_emit(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}};customElements.define("repo-chip",Rs);var Qm=a`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path class="bubble" d="M2.5 3h11a.5.5 0 0 1 .5.5v6.5a.5.5 0 0 1-.5.5H8.4l-3 2.6V10.5H2.5a.5.5 0 0 1-.5-.5V3.5a.5.5 0 0 1 .5-.5z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,Zm=a`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path class="wrench" d="M10.4 2.6a3 3 0 0 0-3.6 4.5L2 12l2 2 4.9-4.8a3 3 0 0 0 4.5-3.6l-1.8 1.8-1.5-.4-.4-1.5z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,ef=a`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path class="flag-cloth" d="M5 1.5h6v13l-3-2.7-3 2.7z" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linejoin="round"/></svg>`,tf=J(gi.replace('width="14" height="14"','width="12" height="12"')),rf=a`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-width="1.15" stroke-linecap="round" stroke-linejoin="round"><path d="M5 1.2 1.3 3.1v5.7L5 10.7l3.7-1.9V3.1Z M1.3 3.1 5 5l3.7-1.9 M5 5v5.7"/><path d="M11 5.2 7.3 7.1v5.7l3.7 1.9 3.7-1.9V7.1Z M7.3 7.1 11 9l3.7-1.9 M11 9v5.7"/></g></svg>`,nf=a`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"><rect x="3.4" y="1.5" width="10" height="3.6" rx=".8"/><rect x="2.2" y="5.3" width="10" height="3.6" rx=".8"/><rect x="1" y="9.1" width="10" height="3.6" rx=".8"/></g></svg>`,sf=a`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path d="M8 1.5 13 3.5v4c0 3-2.1 5.5-5 7-2.9-1.5-5-4-5-7v-4Z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,of=[{key:"comment",glyph:Qm,label:"commented",stateKey:"filterComment",hasKey:"hasComment"},{key:"fix",glyph:Zm,label:"fixed",stateKey:"filterFix",hasKey:"hasFix"},{key:"flag",glyph:ef,label:"flagged",stateKey:"filterFlagged",hasKey:"hasFlagged"},{key:"duplicates",glyph:tf,label:"rows with duplicates in other reports",stateKey:"filterDuplicates",hasKey:"hasDuplicates"},{key:"cross-context",glyph:rf,label:"rows across multiple repos or packages",stateKey:"filterCrossContext",hasKey:"hasCrossContext"},{key:"app-stacked",glyph:nf,label:"stacked App rows",stateKey:"filterAppStacked",hasKey:"hasAppStacked"},{key:"security",glyph:sf,label:"security-related rows",stateKey:"filterSecurity",hasKey:"hasSecurityContrast"}],op=new Set(["duplicates","cross-context","app-stacked","security"]),Ls=class extends D{static properties={group:{type:String},hasComment:{attribute:!1},hasFix:{attribute:!1},hasFlagged:{attribute:!1},hasDuplicates:{attribute:!1},hasCrossContext:{attribute:!1},hasAppStacked:{attribute:!1},hasSecurityContrast:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.group="marks",this.hasComment=!1,this.hasFix=!1,this.hasFlagged=!1,this.hasDuplicates=!1,this.hasCrossContext=!1,this.hasAppStacked=!1,this.hasSecurityContrast=!1}connectedCallback(){super.connectedCallback(),W(this,{role:"group","aria-label":this.group==="context"?"Finding row filters":"Annotation filter"})}render(){let e=of.filter(r=>this.group==="context"===op.has(r.key)).filter(r=>r.key==="security"?this.hasSecurityContrast:r.key==="duplicates"?!l.currentWorkspace&&(this.hasDuplicates||l[r.stateKey]):this[r.hasKey]||l[r.stateKey]);if(e.length===0)return m;let t=r=>{let n=l[r.stateKey],s=op.has(r.key)?r.label:`${r.label} findings`,o=n==="with"?`Showing only ${s} \u2014 click to exclude them`:n==="without"?`Excluding ${s} \u2014 click to clear`:`Show only ${s}`;return a`<button type="button" class="${I({"annotation-chip":!0,"sel-with":n==="with","sel-without":n==="without"})}" aria-label="${o}" aria-pressed="${String(n!=="")}" @click="${()=>this._toggle(r.key)}">${r.glyph}</button>`};return a`${e.map(t)}`}_toggle(e){this.dispatchEvent(new CustomEvent("annotation-filter-toggle",{detail:{key:e},bubbles:!0,composed:!0}))}};customElements.define("annotation-filter",Ls);var af=[["critical","Critical"],["high","High"],["medium","Medium"],["low","Low"],["high_bug","High bug"],["bug","Bug"],["informational","Info"]],Ms=class extends D{static properties={counts:{attribute:!1},selected:{attribute:!1},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.selected=[],this.kind="findings"}connectedCallback(){super.connectedCallback(),W(this,{role:"group","aria-label":"Filter by severity"})}render(){let e=this.kind==="graph"?new Set(this.selected):l.filterSeverities,t=af.filter(([r])=>(this.counts[r]??0)||e.has(r));return t.length===0?m:a`${t.map(([r,n])=>{let s=this.counts[r]??0,o=e.has(r);return a`<button type="button" class="${I({"sev-chip":!0,[r]:!0,active:o})}" aria-pressed="${String(o)}" @click="${()=>this._toggle(r)}"><span class="sd"></span><span class="name">${n}</span><span class="n">${s}</span></button>`})}`}_toggle(e){this.dispatchEvent(new CustomEvent("severity-toggle",{detail:{severity:e,kind:this.kind},bubbles:!0,composed:!0}))}};customElements.define("severity-chips",Ms);var lf=[["corrected","Corrected","Show corrected severities (application-specific re-ratings)"],["original","Original",m]],Ps=class extends D{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),W(this,{role:"group","aria-label":"Severity display mode"})}render(){let e=l.severityMode;return a`<span class="severity-mode-label">Severity</span><span class="severity-mode-chips">${lf.map(([t,r,n])=>{let s=e===t;return a`<button type="button" class="${I({"severity-mode-chip":!0,active:s})}" aria-pressed="${String(s)}" data-tooltip="${n}" @click="${()=>this._select(t)}">${r}</button>`})}</span>`}_select(e){e!==l.severityMode&&this.dispatchEvent(new CustomEvent("severity-mode-change",{detail:{mode:e},bubbles:!0,composed:!0}))}};customElements.define("severity-mode-switch",Ps);var cf=a`<svg viewBox="0 0 16 16" width="13" height="13" aria-hidden="true"><path d="M8 1.8 14.4 5 8 8.2 1.6 5z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/><path d="M2.6 8 8 10.7 13.4 8" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/><path d="M2.6 11 8 13.7 13.4 11" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/></svg>`,ap="Show underlying code findings",df=a`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 5.5v2h10v-2M8 7.5v3"/><rect x="1" y="1.5" width="4" height="4" rx=".6"/><rect x="11" y="1.5" width="4" height="4" rx=".6"/><rect x="6" y="10.5" width="4" height="4" rx=".6"/></svg>`,lp="Show only upstream dependency findings",As=class extends D{static properties={canDrop:{type:Boolean,attribute:"can-drop"},canDetail:{type:Boolean,attribute:"can-detail"},canUpstream:{type:Boolean,attribute:"can-upstream"},upstreamDisabled:{type:Boolean,attribute:"upstream-disabled"}};createRenderRoot(){return this}constructor(){super(),this.canDrop=!1,this.canDetail=!1,this.canUpstream=!1,this.upstreamDisabled=!1}connectedCallback(){super.connectedCallback(),W(this,{role:"group","aria-label":"Revalidation layer"})}render(){let e=l.revalidateConflicts.size,t=e>0?a`<button type="button" class="revalidation-toggle revalidation-conflicts" aria-haspopup="dialog" aria-label="${`View ${e} revalidation conflict${e===1?"":"s"}`}" @click="${this._openConflicts}">${e} ${e===1?"conflict":"conflicts"}</button>`:m,r=l.showRevalidation!==!1,n=r&&l.revalidationDetailed===!0,s=l.upstreamOnly===!0,o=s&&!this.upstreamDisabled;return a`${t}${e===0&&this.canDrop?a`<mode-switch class="revalidation-toggle" label="App" borderless .checked="${r}" accessible-label="App view — hide the issues the revalidation pass ruled out" .disabled="${s}" @click="${this._toggle}"></mode-switch>`:m}${e===0&&this.canDrop&&this.canDetail?a`<button type="button" class="${I({"revalidation-detail":!0,on:n})}" aria-pressed="${String(n)}" aria-label="${ap}" data-tooltip="${ap}" ?disabled="${!r||s}" @click="${this._toggleDetail}">${cf}</button>`:m}${this.canUpstream?a`<button type="button" class="${I({"revalidation-upstream":!0,on:o})}" aria-pressed="${String(o)}" aria-label="${lp}" data-tooltip="${lp}" ?disabled="${this.upstreamDisabled}" @click="${this._toggleUpstream}">${df}</button>`:m}`}_toggle=()=>{this.dispatchEvent(new CustomEvent("revalidation-change",{detail:{on:l.showRevalidation===!1},bubbles:!0,composed:!0}))};_openConflicts=()=>{this.dispatchEvent(new CustomEvent("revalidation-conflicts-open",{bubbles:!0,composed:!0}))};_toggleDetail=()=>{this.dispatchEvent(new CustomEvent("revalidation-detail-change",{detail:{on:l.revalidationDetailed!==!0},bubbles:!0,composed:!0}))};_toggleUpstream=()=>{this.upstreamDisabled||this.dispatchEvent(new CustomEvent("upstream-only-change",{detail:{on:l.upstreamOnly!==!0},bubbles:!0,composed:!0}))}};customElements.define("revalidation-switch",As);var uf=a`<svg class="trash-icon" viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 4h10M6.5 4V2.5h3V4M5 4l.7 9h4.6L11 4"/></svg>`,Is=class extends D{createRenderRoot(){return this}render(){let e=l.currentView==="bundles"&&l.selectedBundle,t=!l.currentFile&&!e;return a`<button type="button" class="danger" ?disabled="${t}">${uf}<span>Delete current</span></button>`}};customElements.define("sidebar-delete-current",Is);var pf=a`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 6h12v7a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V6Z"/><path d="M2 6l1.6-3.3A1.3 1.3 0 0 1 4.8 2h6.4a1.3 1.3 0 0 1 1.2.7L14 6"/><path d="M8 2v4"/></svg>`,hf=a`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="4" x2="4" y1="2.5" y2="10"/><circle cx="12" cy="4" r="2"/><circle cx="4" cy="12" r="2"/><path d="M12 6a6 6 0 0 1-6 6"/></svg>`,mf={packages:{title:"Show packages",icon:pf,view:"packages"},repositories:{title:"Show repositories",icon:hf,view:"repositories"}},Fs=class extends D{static properties={kind:{type:String},count:{type:Number}};createRenderRoot(){return this}constructor(){super(),this.kind="",this.count=0}render(){if(this.count===0)return m;let e=Se("sidebar-view-button",mf,this.kind);if(!e)return m;let t=l.currentView===e.view;return a`<button type="button" class="${I({"sidebar-view-btn":!0,active:t})}" aria-label="${e.title}">${e.icon}<span class="view-btn-count">${this.count}</span></button>`}};customElements.define("sidebar-view-button",Fs);var ff=["invalid","deleted"],gf={package:{stateKey:"packageSlideTriage"},repository:{stateKey:"repositorySlideTriage"}},Ds=class extends D{static properties={counts:{attribute:!1},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.kind=""}connectedCallback(){super.connectedCallback(),W(this,{role:"group","aria-label":"Triage view"})}render(){let e=Se("slide-triage-tabs",gf,this.kind);if(!e)return m;let t=l[e.stateKey],r=ff.filter(n=>(this.counts[n]??0)>0||t===n);return r.length===0?m:a`${r.map(n=>{let s=t===n,o=this.counts[n]??0;return a`<button type="button" class="${I({"triage-state-btn":!0,[`triage-state-${n}`]:!0,active:s})}" aria-pressed="${String(s)}" @click="${()=>this._toggle(n)}">${n.charAt(0).toUpperCase()+n.slice(1)} (${o})</button>`})}`}_toggle(e){this.dispatchEvent(new CustomEvent("slide-triage-toggle",{detail:{kind:this.kind,value:e},bubbles:!0,composed:!0}))}};customElements.define("slide-triage-tabs",Ds);var bf=[["own","Sources"],["modules","Deps"]],Os=class extends D{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),W(this,{role:"group","aria-label":"Source filter"})}render(){return a`${bf.map(([e,t])=>{let r=l.filterSources.has(e);return a`<button type="button" class="${I({"source-chip":!0,active:r})}" aria-pressed="${String(r)}" @click="${()=>this._toggle(e)}">${t}</button>`})}`}_toggle(e){this.dispatchEvent(new CustomEvent("source-toggle",{detail:{source:e},bubbles:!0,composed:!0}))}};customElements.define("source-filter",Os);var vf=a`<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>`,yf=a`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6h10v4"/></svg>`,_f={findings:{stateKey:"filterInclude",placeholder:"Search findings\u2026"},files:{stateKey:"filesSearch",placeholder:"Search files\u2026"}},Bs=class extends D{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let e=Se("toolbar-search",_f,this.kind);if(!e)return m;let t=l[e.stateKey];return a`${vf} <input type="text" aria-label="${e.placeholder}" placeholder="${e.placeholder}" .value="${j(t)}" @input="${this._onInput}"> ${this.kind==="findings"&&t?this._negateToggle():m}`}_negateToggle(){let e=l.filterIncludeNegate;return a`<button type="button" class="${I({"search-negate-btn":!0,active:e})}" data-tooltip="${e?"Negation on \u2014 click to undo":"Negate: show non-matching findings"}" aria-label="Negate search" aria-pressed="${String(e)}" @click="${this._onToggleNegate}">${yf}</button>`}_onInput=e=>{this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:this.kind,value:e.target.value},bubbles:!0,composed:!0}))};_onToggleNegate=()=>{this.dispatchEvent(new CustomEvent("search-negate-toggle",{bubbles:!0,composed:!0}))}};customElements.define("toolbar-search",Bs);var Ns=class extends D{static properties={options:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.options=[]}render(){let e=[{value:"",label:"All repositories",special:!0,reset:!0},...this.options.map(t=>({value:t??Di,label:t==null?"(no repo)":We(t),special:t==null}))];return a`<repository-selector variant="filter" label="Filter by repository" .options="${e}" .value="${l.filterRepo}" @repository-change="${t=>this.dispatchEvent(new CustomEvent("repo-change",{detail:{value:t.detail.value},bubbles:!0,composed:!0}))}"></repository-selector>`}};customElements.define("repo-filter",Ns);var cp={"":{cls:"included",label:"+ Partial",title:"Confirmed, partial and revalidation rows \u2014 click for full confirmations only"},exclude:{cls:"excluded",label:"\u2212 Partial",title:"Full confirmations only \u2014 click to show the partial ones only"},only:{cls:"only",label:"only Partial",title:"Partial confirmations only \u2014 click to show all of them again"}},zs=class extends D{static properties={options:{attribute:!1},hasPartial:{type:Boolean,attribute:"has-partial"}};createRenderRoot(){return this}constructor(){super(),this.options=[],this.hasPartial=!1}render(){return a`<select class="sort-select" aria-label="Filter by revalidation outcome" .value="${j(l.filterRevalidate)}" @change="${this._onChange}"><option value="" hidden ?selected="${l.filterRevalidate===""}"></option><option value="">Confidence</option>${this.options.map(e=>a`<option value="${e.value}" ?selected="${l.filterRevalidate===e.value}">${e.label}</option>`)}</select> ${this.hasPartial&&l.filterRevalidate==="confirmed"?this._partialChip():m}`}_partialChip(){let e=cp[l.filterPartial]??cp[""];return a`<button type="button" class="${I({"partial-cycle":!0,[e.cls]:!0})}" data-tooltip="${e.title}" @click="${this._onPartial}">${e.label}</button>`}_onPartial=()=>{let e=Ti.indexOf(l.filterPartial),t=Ti[(e+1)%Ti.length];this.dispatchEvent(new CustomEvent("partial-change",{detail:{value:t},bubbles:!0,composed:!0}))};_onChange=e=>{let{value:t}=e.target;t||(e.target.selectedIndex=0),this.dispatchEvent(new CustomEvent("revalidate-change",{detail:{value:t},bubbles:!0,composed:!0}))}};customElements.define("revalidate-filter",zs);var dp=[["none","none","unmarked"],["red","r","red"],["blue","b","blue"],["green","g","green"],["gray","x","gray"]],qs=class extends D{static properties={counts:{attribute:!1},selected:{attribute:!1},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.selected=[],this.kind="findings"}connectedCallback(){super.connectedCallback(),W(this,{role:"group","aria-label":"Filter by mark color"})}render(){let e=this.kind==="graph"?new Set(this.selected):l.filterColors;return dp.some(([r])=>(this.counts[r]??0)||e.has(r))?a`${dp.map(([r,n,s])=>{let o=this.counts[r]??0,c=e.has(r);return a`<button type="button" class="${c?"active":""}" aria-label="${`${s} (${o})`}" aria-pressed="${String(c)}" @click="${()=>this._toggle(r)}"><span class="${`td ${n}`}"></span><span class="count">${o}</span></button>`})}`:m}_toggle(e){this.dispatchEvent(new CustomEvent("color-toggle",{detail:{color:e,kind:this.kind},bubbles:!0,composed:!0}))}};customElements.define("triage-filter",qs);var wf=["inprogress","fixed","invalid","deleted","ignored"],Hs={graph:"graph2-triage-selector",packages:"packages-triage-selector"},kf={inprogress:"In progress"},$f=i=>kf[i]??i.charAt(0).toUpperCase()+i.slice(1),Us=class extends D{static properties={counts:{attribute:!1},states:{attribute:!1},variant:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.states=null,this.variant=""}connectedCallback(){super.connectedCallback(),W(this,{role:"group","aria-label":"Triage view"})}render(){let e=this.states??wf,t=e.reduce((s,o)=>s+(this.counts[o]??0),0),r=this.variant?Hs[this.variant]:null;this.variant&&r===void 0&&console.warn(`<triage-selector>: unknown variant ${JSON.stringify(this.variant)}; expected one of ${Object.keys(Hs).map(s=>JSON.stringify(s)).join(", ")} or "".`);for(let s of Object.values(Hs))this.classList.toggle(s,s===r);let n=t===0&&!l.shownTriage;return this.classList.toggle("is-empty",n),n?m:a`${e.map(s=>{let o=this.counts[s]??0,c=l.shownTriage===s;if(o===0&&!c)return m;let u=$f(s);return a`<button type="button" class="${I({"triage-state-btn":!0,[`triage-state-${s}`]:!0,active:c})}" data-triage-show="${s}" aria-pressed="${String(c)}"><span>${u}</span><span class="n">${o}</span></button>`})}`}};customElements.define("triage-selector",Us);var xf={table:a`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><rect x="3" y="3" width="18" height="18" rx="2"/><line x1="3" x2="21" y1="9" y2="9"/><line x1="3" x2="21" y1="15" y2="15"/><line x1="9" x2="9" y1="3" y2="21"/></svg>`,list:a`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><line x1="3" x2="21" y1="6" y2="6"/><line x1="3" x2="21" y1="12" y2="12"/><line x1="3" x2="21" y1="18" y2="18"/></svg>`,grouped:a`<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><rect x="2" y="1.5" width="12" height="2" rx=".4"/><rect x="5" y="4.4" width="9" height="1.3"/><rect x="5" y="6.2" width="9" height="1.3"/><rect x="2" y="8.5" width="12" height="2" rx=".4"/><rect x="5" y="11.4" width="9" height="1.3"/><rect x="5" y="13.2" width="9" height="1.3"/></svg>`,kanban:a`<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><rect x="1.5" y="2" width="3.8" height="12" rx=".6" fill="none" stroke="currentColor" stroke-width="1"/><rect x="6.1" y="2" width="3.8" height="12" rx=".6" fill="none" stroke="currentColor" stroke-width="1"/><rect x="10.7" y="2" width="3.8" height="12" rx=".6" fill="none" stroke="currentColor" stroke-width="1"/><rect x="2.4" y="3.6" width="2" height="1.4" rx=".2"/><rect x="2.4" y="5.6" width="2" height="1.4" rx=".2"/><rect x="7" y="3.6" width="2" height="1.4" rx=".2"/><rect x="11.6" y="3.6" width="2" height="1.4" rx=".2"/><rect x="11.6" y="5.6" width="2" height="1.4" rx=".2"/><rect x="11.6" y="7.6" width="2" height="1.4" rx=".2"/></svg>`,focus:a`<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><rect x="1.5" y="2.5" width="8.5" height="11" rx=".6" fill="none" stroke="currentColor" stroke-width="1"/><rect x="3" y="4.4" width="5.5" height="1"/><rect x="3" y="6.4" width="5.5" height="1"/><rect x="3" y="8.4" width="3.5" height="1"/><rect x="11.2" y="2.5" width="3.3" height="2.5" rx=".4" fill="currentColor" opacity=".55"/><rect x="11.2" y="5.7" width="3.3" height="2.5" rx=".4" fill="currentColor" opacity=".35"/><rect x="11.2" y="8.9" width="3.3" height="2.5" rx=".4" fill="currentColor" opacity=".22"/></svg>`,graph:a`${J(Xo)}`},Sf={table:"Table view (compact rows, click a row to expand)",list:"List view (flat, one card per finding)",grouped:"List view, grouped by file",focus:"Focus view (one finding centered + a queue of next findings)",kanban:"Kanban board, columns grouped by triage status",graph:"Graph view (canvas with imports / exports)"},js=["kanban","focus","table","list","grouped","graph"],Vs=class extends D{static properties={modes:{type:String},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.modes=js.join(","),this.kind="findings"}connectedCallback(){super.connectedCallback(),W(this,{role:"group","aria-label":"View mode"})}render(){let e=this.kind==="files"?l.filesViewMode:l.viewMode,t=this.modes.split(",").map(n=>n.trim()).filter(n=>js.includes(n)),r=t.length>0?t:js;return a`${r.map(n=>a`<button type="button" class="${I({"view-mode-btn":!0,active:e===n})}" aria-label="${Sf[n]}" aria-pressed="${String(e===n)}" @click="${()=>this._select(n,e)}">${xf[n]}</button>`)}`}_select(e,t){e!==t&&this.dispatchEvent(new CustomEvent("view-mode-change",{detail:{mode:e,kind:this.kind},bubbles:!0,composed:!0}))}};customElements.define("view-mode-buttons",Vs);var up=i=>{let e=i.lastIndexOf(".");return e>0?i.slice(e).toLowerCase():""};function pp(i,e=""){let t=i.map(s=>s.split("/")),r=[];for(;;){let s=r.length,o=new Set;for(let c of t)c.length>s+1&&r.every((u,d)=>c[d]===u)&&o.add(c[s]);if(o.size!==1)break;r.push(o.values().next().value)}let n=t.map(s=>{let o=0;for(;o<r.length&&s.length>o+1;)o++;let c=e+s.slice(0,o).map(u=>`${u}/`).join("");return s.length>o+1?`${c}${s[o]}/`:`${c}*`});if(new Set(n).size>1){let s=new Map;n.forEach((c,u)=>{if(!c.endsWith("*"))return;let d=s.get(c)??new Set;d.add(up(t[u].at(-1))),s.set(c,d)});let o=c=>{let u=s.get(c);return u?.size===1&&!u.has("")?`${c}${[...u][0]}`:c};return new Map(i.map((c,u)=>[c,o(n[u])]))}return new Map(i.map((s,o)=>{let c=up(t[o].at(-1));return[s,c?`*${c}`:"No extension"]}))}var bp=6,hp=14,yr=2,mp=24,ri=4,Cf=1.5,_r=new Map,wr=new Map,fp="treemap",gp=!1;function Ef(i){let e=/^#?([0-9a-f]{6})$/iu.exec(i);if(!e)return"#fff";let t=parseInt(e[1],16),r=t>>16&255,n=t>>8&255,s=t&255;return(.2126*r+.7152*n+.0722*s)/255>.6?"#1a1a1a":"#fff"}function Tf(i,e,t,r){let n=t*t,s=r*r;return Math.max(s*i/n,n/(s*e))}function vp(i,e){let t=[],r=i.filter(h=>h.value>0),{x:n,y:s,w:o,h:c}=e;if(r.length===0||o<=0||c<=0)return t;let u=0;for(let h of r)u+=h.value;let d=o*c/u,p=0;for(;p<r.length&&o>.5&&c>.5;){let h=Math.min(o,c),f=p,b=0,v=0,g=1/0,y=1/0;for(;f<r.length;){let _=r[f].value*d,x=_>v?_:v,S=_<g?_:g,T=Tf(x,S,b+_,h);if(f===p||T<=y)y=T,b+=_,v=x,g=S,f++;else break}let k=b/h;if(o>=c){let _=s;for(let x=p;x<f;x++){let S=x===f-1?s+c-_:r[x].value*d/k;t.push({node:r[x],x:n,y:_,w:k,h:S}),_+=S}n+=k,o-=k}else{let _=n;for(let x=p;x<f;x++){let S=x===f-1?n+o-_:r[x].value*d/k;t.push({node:r[x],x:_,y:s,w:S,h:k}),_+=S}s+=k,c-=k}p=f}return t}function yp(i){for(;i.children&&i.children.size===1;){let e=i.children.values().next().value;if(e.isFile)break;i.name=`${i.name}/${e.name}`,i.children=e.children}if(i.children)for(let e of i.children.values())yp(e)}function _p(i,e,t,r){if(i.path=i.name?e?`${e}/${i.name}`:i.name:e,i.parent=t,i.isFile)return i.count=1,i.value;r.set(i.path,i);let n=0,s=0,o,c;for(let u of i.children.values())n+=_p(u,i.path,i,r),s+=u.count,c===void 0?c=u.pkg:c!==u.pkg&&(c=null),o===void 0?o=u.group:o!==u.group&&(o=null);return i.value=n,i.count=s,i.pkg=c??null,i.group=o??null,n}function Rf(i,e,t,r){let n=new Set(i).size===1?pp(e,t):new Map,s=new Map;return e.forEach((o,c)=>{n.has(o)&&s.set(n.get(o),(s.get(n.get(o))??0)+Math.max(r[c]??0,0))}),{groups:n,ranks:new Map([...s].toSorted((o,c)=>c[1]-o[1]||o[0].localeCompare(c[0])).map(([o],c)=>[o,c]))}}function wp(i,e,t,r,n,s,o){if(r<ri||n<ri)return;if(i.isFile){o.push({kind:"file",node:i,x:e,y:t,w:r,h:n});return}if(!(s<bp&&r>=mp&&n>=mp&&i.children.size>0)){o.push({kind:"agg",node:i,x:e,y:t,w:r,h:n});return}o.push({kind:"dir",node:i,x:e,y:t,w:r,h:n});let u=n>=hp+ri+yr?hp:0,d=e+yr,p=t+u,h=r-yr*2,f=n-u-yr;if(h<ri||f<ri)return;let b=[...i.children.values()].toSorted((v,g)=>g.value-v.value);for(let v of vp(b,{x:d,y:p,w:h,h:f}))wp(v.node,v.x,v.y,v.w,v.h,s+1,o)}function Ks(i,e){let t=i/(e||1)*100;return t>=10?t.toFixed(0):t.toFixed(t>=1?1:2)}function kp(i,e){if(e<=0||i.isFile||!i.children||i.children.size===0)return 0;let t=1;for(let r of i.children.values()){if(t>=e)break;let n=1+kp(r,e-1);n>t&&(t=n)}return t}function Lf(i,e,t,r,n,s){let o=Math.min(s-n,Math.PI*2-1e-4),c=n+o,u=o>Math.PI?1:0,d=Math.cos(n),p=Math.sin(n),h=Math.cos(c),f=Math.sin(c),b=v=>v.toFixed(2);return`M${b(i+r*d)} ${b(e+r*p)}A${b(r)} ${b(r)} 0 ${u} 1 ${b(i+r*h)} ${b(e+r*f)}L${b(i+t*h)} ${b(e+t*f)}A${b(t)} ${b(t)} 0 ${u} 0 ${b(i+t*d)} ${b(e+t*p)}Z`}function Mf(i,e){let t=Math.max(4,Math.floor(e/6.4));return i.length>t?`${i.slice(0,t-1)}\u2026`:i}var Gs=class extends U{static properties={details:{attribute:!1},_w:{state:!0},_h:{state:!0},_focus:{state:!0},_mode:{state:!0},_reason:{state:!0},_codeOnly:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.details=null,this._w=0,this._h=0,this._root=null,this._focus=[],this._mode=fp,this._reason="",this._codeOnly=gp,this._hasResources=!1,this._reasons=new Map,this._dirByPath=new Map,this._status="loading",this._meta={total:0,prefix:""},this._ro=null,this._plot=null,this._tooltip=null,this._ttCell=null}willUpdate(e){e.has("details")&&(this._reason=wr.get(this.details?.integrity)??""),(e.has("details")||e.has("_reason")||e.has("_codeOnly"))&&this._rebuild()}firstUpdated(){this._plot=this.querySelector(".bundle-treemap-plot"),this._tooltip=this.querySelector(".bundle-treemap-tooltip"),!(!this._plot||typeof ResizeObserver>"u")&&(this._ro=new ResizeObserver(e=>{let t=e[0]?.contentRect;if(!t)return;let r=Math.floor(t.width),n=Math.floor(t.height);(r!==this._w||n!==this._h)&&(this._w=r,this._h=n)}),this._ro.observe(this._plot))}disconnectedCallback(){super.disconnectedCallback(),this._ro&&(this._ro.disconnect(),this._ro=null)}_onPointerMove(e){let t=e.target.closest(".bundle-treemap-node");if(!t||!this._tooltip){this._hideTooltip();return}if(t!==this._ttCell){this._ttCell=t;let r=t.dataset;Wo(a`<div class="bundle-treemap-tt-path">${r.ttPath}</div>${r.ttPkg?a`<div class="bundle-treemap-tt-head"><span class="bundle-treemap-tt-dot" style="${`background:${r.ttColor}`}"></span> <span class="bundle-treemap-tt-pkg">${r.ttPkg}</span></div>`:""}<div class="bundle-treemap-tt-meta">${r.ttMeta}</div>`,this._tooltip)}this._positionTooltip(e.clientX,e.clientY)}_onPointerLeave(){this._hideTooltip()}_positionTooltip(e,t){let r=this._tooltip;if(!r||!this._plot)return;r.classList.add("show");let n=this._plot.getBoundingClientRect(),s=e-n.left,o=t-n.top,c=12,u=s+c;u+r.offsetWidth>n.width-4&&(u=s-r.offsetWidth-c),u<4&&(u=4);let d=o+c;d+r.offsetHeight>n.height-4&&(d=o-r.offsetHeight-c),d<4&&(d=4),r.style.left=`${u}px`,r.style.top=`${d}px`}_hideTooltip(){this._ttCell=null,this._tooltip&&this._tooltip.classList.remove("show")}_rebuild(){if(this._root=null,this._focus=[],this._dirByPath=new Map,this._reasons=new Map,this._hasResources=!1,this._meta={total:0,prefix:""},this._hideTooltip(),!this.details){this._status="loading";return}let e=_a(this.details),t=[...e.keys()].filter(y=>e.get(y)!==null);if(t.length===0){this._status="empty";return}this._reasons=ka(this.details,t),this._reasons.has(this._reason)||(this._reason="",wr.delete(this.details.integrity));let r=this._reasons.get(this._reason),n=Nt(this.details),s=wa(this.details);this._hasResources=t.some(y=>s.get(y)==="resource"&&e.get(y)>0);let o=this._codeOnly&&this._hasResources,{prefix:c,stripped:u}=ft(t),d=t.map(y=>pt(y,{packageDir:n?.get(y)})),{groups:p,ranks:h}=Rf(d,u,c,t.map(y=>e.get(y))),f={name:"",children:new Map,value:0,isFile:!1},b=0;for(let y=0;y<t.length;y++){if(r&&!r.has(t[y])||o&&s.get(t[y])==="resource")continue;let k=e.get(t[y]);if(k<=0)continue;let _=u[y].split("/"),x=f,S=!1;for(let O=0;O<_.length-1;O++){let A=x.children.get(_[O]);if(A&&A.isFile){S=!0;break}A||(A={name:_[O],children:new Map,value:0,isFile:!1},x.children.set(_[O],A)),x=A}if(S)continue;let T=_.at(-1),F=x.children.get(T);F&&!F.isFile||(F||(F={name:T,isFile:!0,value:0,origPath:t[y],pkg:d[y],group:p.get(u[y])??null,resource:s.get(t[y])==="resource"},x.children.set(T,F)),F.value+=k,b+=k)}if(b===0){this._status="empty";return}for(let y of f.children.values())yp(y);let v=new Map;_p(f,"",null,v),this._groupRanks=h,this._root=f,this._dirByPath=v,this._meta={total:b,prefix:c},this._status="ok";let g=this.details?.integrity?_r.get(this.details.integrity):null;if(g){let y=v.get(g);y?this._focus=this._chainTo(y):_r.delete(this.details.integrity)}}get _focusNode(){return this._focus.length>0?this._focus.at(-1):this._root}_chainTo(e){let t=[];for(let r=e;r&&r!==this._root;r=r.parent)t.push(r);return t.reverse(),t}_rememberFocus(){let e=this.details?.integrity;if(!e)return;let t=this._focus.at(-1)?.path;t?_r.set(e,t):_r.delete(e)}_drillInto(e){!e||e.isFile||!e.children||e.children.size===0||(this._focus=this._chainTo(e),this._rememberFocus(),this._hideTooltip())}_focusTo(e){let t=e<0?[]:this._focus.slice(0,e+1);t.length!==this._focus.length&&(this._focus=t,this._rememberFocus(),this._hideTooltip())}_toggleMode(){this._mode=this._mode==="sunburst"?"treemap":"sunburst",fp=this._mode,this._hideTooltip()}_toggleCode(){this._codeOnly=!this._codeOnly,gp=this._codeOnly}_changeReason(e){this._reason=e.detail.value.replace(/^reason:/u,"");let t=this.details?.integrity;t&&(this._reason?wr.set(t,this._reason):wr.delete(t))}_onPlotClick(e){let t=e.target.closest("[data-treemap-into]");if(!t)return;let r=this._dirByPath.get(t.dataset.treemapInto);r&&this._drillInto(r)}_renderCrumbs(){let e=this._focus,t=e.length===0,r=e.slice(0,-1),n=t?null:e.at(-1);return a`<nav class="bundle-treemap-crumbs" aria-label="Treemap location"><span class="bundle-treemap-crumbs-lead"><button type="button" class="${I({"bundle-treemap-crumb-home":!0,"at-root":t})}" @click="${()=>this._focusTo(-1)}">Source ${this._mode==="sunburst"?"sunburst":"treemap"}</button> ${r.map((s,o)=>a`<span class="bundle-treemap-crumb-sep" aria-hidden="true">›</span><button type="button" class="bundle-treemap-crumb" @click="${()=>this._focusTo(o)}" data-tooltip-truncated data-tooltip="${s.path}">${s.name}</button>`)} </span>${n?a`<span class="bundle-treemap-crumb-sep" aria-hidden="true">›</span><span class="bundle-treemap-crumb-current" aria-current="location" data-tooltip-truncated data-tooltip="${n.path}">${n.name}</span>`:""}</nav>`}_paint(e){if(this._groupRanks?.size>0)return e.group==null?{color:za(),label:null,named:!1}:{color:Na(this._groupRanks.get(e.group)??0),label:e.group,named:!0};let t=e.pkg??pt(e.path);return{color:Mi(t),label:Ke(t),named:e.pkg!=null}}_cell(e){let t=Ks(e.node.value,this._meta.total),r={left:`${e.x}px`,top:`${e.y}px`,width:`${e.w}px`,height:`${e.h}px`},n=`${e.node.count} ${e.node.count===1?"file":"files"}`;if(e.kind==="dir")return a`<div class="bundle-treemap-node bundle-treemap-dir" style="${_e(r)}" data-treemap-into="${e.node.path}" data-tt-path="${`${e.node.path}/`}" data-tt-meta="${`${G(e.node.value)} \xB7 ${n} \xB7 ${t}%`}"><span class="bundle-treemap-dirname">${e.node.name}</span></div>`;let{color:s,label:o}=this._paint(e.node),c=_e({...r,background:s,color:Ef(s)}),u=o??m;return e.kind==="agg"?a`<div class="bundle-treemap-node bundle-treemap-leaf bundle-treemap-agg" style="${c}" data-treemap-into="${e.node.path}" data-tt-path="${`${e.node.path}/`}" data-tt-pkg="${u}" data-tt-color="${s}" data-tt-meta="${`${G(e.node.value)} \xB7 ${n} \xB7 ${t}%`}"><span class="bundle-treemap-label">${e.node.name}/</span></div>`:a`<div class="bundle-treemap-node bundle-treemap-leaf bundle-treemap-file" style="${c}" data-bundle-view-source="${e.node.resource?m:e.node.origPath}" data-tt-path="${e.node.path}" data-tt-pkg="${u}" data-tt-color="${s}" data-tt-meta="${`${G(e.node.value)} \xB7 ${t}% of bundle`}"><span class="bundle-treemap-label">${e.node.name}</span></div>`}_arc(e,t,r){let n=Ks(e.value,r),{color:s,label:o,named:c}=this._paint(e),u=o??m;if(e.isFile)return ye`<path
|
|
36
|
+
${w}`)}`;try{window.location.href=C,Pu(Vo)}catch{}return}if(B(i,".mark-fix")){let C=B(i,"[data-gid]")?.dataset.gid,P=C?de(C):null;if(!P)return;let L=$e(P);if(!De(L))return;let V=oc(P),le=Ze(L)?.fix??"";mu({initial:le,finding:L,canApplyToGroup:ic(V,le)}).then(ve=>{if(ve===null||!De(L))return null;let Wo=ve.scope==="group"?V.filter(Ot=>De(Ot)&&(Ot===L||nc(Ot,le))):[L],Yo=!1;for(let Ot of Wo)X(l.triage,mt(Ot),{fix:ve.value||void 0})&&(Yo=!0);return Yo&&(Wo.length>1&&l.activeTabByGroup.set(C,mt(L)),Me(),queueMicrotask(ke)),null}).catch(()=>{});return}let Ko=B(i,"[data-flag-toggle]");if(Ko){let w=Ko.dataset.flagToggle,C=B(i,"[data-gid]")?.dataset.gid,P=(C?de(C):null)?.find(V=>mt(V)===w);if(!P||!De(P))return;let L=Ze(P)?.flagged;X(l.triage,w,{flagged:L!==!0}),ke(),Me();return}let Yn=i.target.closest("[data-triage-show]");if(Yn&&!Yn.closest(".graph2-triage-selector")){let w=Yn.dataset.triageShow;l.shownTriage=l.shownTriage===w?null:w,$();return}if(i.target.closest("[data-table-deselect]")){l.tableSelectedGid=null,Me();return}let Go=i.target.closest("[data-tree-select]");if(Go){let w=Go.dataset.treeSelect;l.filesSelectedFile=l.filesSelectedFile===w?null:w,$();return}i.target.closest("[data-tree-deselect]")&&(l.filesSelectedFile=null,$())});var Ru=document.querySelector("#bundle-source-overlay-slot");Ru&&Ru.addEventListener("click",Iu);function dn(i){let e=i?de(i):null;e&&sc(e)&&queueMicrotask(ke)}R.addEventListener("row-select",i=>{let e=i.detail?.gid;if(!e)return;let t=l.tableSelectedGid!==e;l.tableSelectedGid=t?e:null,t&&dn(e),Me()});var un="application/x-deepview-kanban-gid";function Fu(i,e){for(let t of i)De(t)&&pa(l.triage,t,e,Fa())}function Qr(){for(let i of R.querySelectorAll(".kanban-card.dragging"))i.classList.remove("dragging");for(let i of R.querySelectorAll(".kanban-column.drag-over"))i.classList.remove("drag-over")}R.addEventListener("dragstart",i=>{let e=i.target.closest?.(".kanban-card[data-kanban-source]");if(!e||!i.dataTransfer)return;let t=e.dataset.gid;if(!t)return;let n=de(t);if(!n||ar(n).length===0){i.preventDefault();return}i.dataTransfer.setData(un,t),i.dataTransfer.setData("text/plain",t),i.dataTransfer.effectAllowed="move",e.classList.add("dragging")});R.addEventListener("dragend",Qr);R.addEventListener("dragover",i=>{if(!i.dataTransfer?.types.includes(un))return;let e=i.target.closest?.(".kanban-column[data-kanban-target]");if(e&&(i.preventDefault(),i.dataTransfer.dropEffect="move",!e.classList.contains("drag-over"))){for(let t of R.querySelectorAll(".kanban-column.drag-over"))t!==e&&t.classList.remove("drag-over");e.classList.add("drag-over")}});R.addEventListener("dragleave",i=>{let e=i.target.closest?.(".kanban-column[data-kanban-target]");e&&(e.contains(i.relatedTarget)||e.classList.remove("drag-over"))});R.addEventListener("drop",i=>{if(!i.dataTransfer?.types.includes(un))return;let e=i.target.closest?.(".kanban-column[data-kanban-target]");if(!e){Qr();return}i.preventDefault();let t=i.dataTransfer.getData(un),n=e.dataset.kanbanTarget;if(Qr(),!t||!n)return;let r=de(t);if(!r||(Bi(r).commonTriage??"untriaged")===n)return;let o=ar(r);o.length!==0&&(Fu(o,n),$(),queueMicrotask(ke))});var Yr=!1;function rt(i){return i?R.querySelector(`.kanban-card[data-gid="${CSS.escape(i)}"]`):null}function on(i){let e=i??R.querySelector(".kanban-card");if(!e)return;let t=e.getBoundingClientRect();t.width<=0||t.height<=0||(document.documentElement.style.setProperty("--kanban-clip-card-w",`${Math.floor(t.width)}px`),document.documentElement.style.setProperty("--kanban-clip-card-h",`${Math.floor(t.height)}px`),document.documentElement.style.setProperty("--kanban-return-card-bg",getComputedStyle(e).backgroundColor))}function bm(){let i=R.querySelector(".kanban-detail-side [data-kanban-select].active");i&&i.scrollIntoView({block:"nearest",behavior:"instant"})}function Jr(i){l.kanbanPopoverGid=i,l.focusCodeStack=[],l.focusCodeAt=0}function Lu(){bm(),et()}function st(i){let e=l.kanbanPopoverGid;if(e===i)return;let t=e===null&&i!==null,n=e!==null&&i===null;if(!document.startViewTransition||!t&&!n){dn(i),Jr(i),$(),Lu();return}if(Yr)return;dn(i),Yr=!0;let r=t?"kanban-opening":"kanban-closing";document.documentElement.classList.add(r);let s=d=>{d&&(d.style.viewTransitionName=""),document.documentElement.classList.remove(r),Yr=!1};if(t){let d=rt(i);d?(on(d),d.style.viewTransitionName="kanban-detail-modal",d.getBoundingClientRect()):on(),Jr(i);let p=Er(()=>{$(),Lu(),d&&(d.style.viewTransitionName="")}),h=setTimeout(()=>s(d),600);(async()=>{try{await p.finished}catch{}clearTimeout(h),s(d)})();return}on(),Jr(i);let o=null,c=Er(()=>{$(),o=rt(e),o&&(on(o),o.style.viewTransitionName="kanban-detail-modal")}),u=setTimeout(()=>s(o??rt(e)),600);(async()=>{try{await c.finished}catch{}clearTimeout(u),s(o??rt(e))})()}function Du(i){let e=rt(l.kanbanPopoverGid),t=e?.closest(".kanban-column");if(!t)return;let n=[...t.querySelectorAll(".kanban-card[data-kanban-source]")],r=n.indexOf(e);if(r<0)return;let s=Math.min(Math.max(r+i,0),n.length-1);if(s===r)return;let o=n[s].dataset.gid;if(!o)return;st(o);let c=rt(o);c&&(c.focus({preventScroll:!0}),c.scrollIntoView({block:"nearest",behavior:"instant"}))}var ln=null;function Zr(){Yl(),l.focusCodeStack=[],l.focusCodeAt=0,$(),ln?.isConnected&&ln.focus({preventScroll:!0}),ln=null}R.addEventListener("click",i=>{let e=B(i,"[data-links-preview]");if(e){i.preventDefault(),ln=e;let o=e.dataset.previewRow,c=Jl(e.dataset.linksPreview,e.dataset.previewReport,o===void 0?void 0:Number(o),e.dataset.previewManagedReport);$(),R.querySelector(".kanban-detail-close")?.focus({preventScroll:!0}),c.then(()=>{$(),et();let u=Xe()?.group?.[0]._bundleHashes;if(Array.isArray(u))for(let d of u)uc(d).catch(()=>{});return null});return}if(i.target.closest?.(".kanban-detail-close")){if(Xe()){Zr();return}st(null);return}if(i.target.closest?.("[data-kanban-detail-fullscreen]")){l.kanbanDetailFullscreen=!l.kanbanDetailFullscreen;try{localStorage.setItem(tl,String(l.kanbanDetailFullscreen))}catch{}$(),et();return}let t=i.target.closest?.("[data-kanban-expand]");if(t){let o=t.dataset.kanbanExpand,c=l.kanbanExpandedColumn===o?null:o;l.kanbanExpandedColumn=c,c&&l.kanbanPopoverGid&&rt(l.kanbanPopoverGid)?.closest(".kanban-column")?.dataset.kanbanTarget!==c&&(l.kanbanPopoverGid=null),$();return}let n=i.target.closest?.("[data-kanban-nav]");if(n){Du(n.dataset.kanbanNav==="next"?1:-1);return}let r=i.target.closest?.("[data-kanban-select]");if(r){if(window.getSelection?.()?.toString())return;let o=r.dataset.gid;o&&st(o);return}if(i.target.closest?.(".kanban-action:not(.kanban-fix-note)"))return;let s=i.target.closest?.(".kanban-card[data-kanban-source]");if(s){if(window.getSelection?.()?.toString())return;let o=s.dataset.gid;if(!o)return;st(l.kanbanPopoverGid===o?null:o);return}if(!B(i,".kanban-detail-modal, .kanban-detail-side")){if(Xe()){Zr();return}l.kanbanPopoverGid&&st(null)}});R.addEventListener("change",i=>{let e=i.target.closest?.("[data-kanban-column]");if(!e)return;let t=e.selectedOptions[0]?.dataset.gid;t&&st(t)});document.addEventListener("keydown",i=>{if(i.key==="Escape"){if(Xe()){!i.defaultPrevented&&!zu(i)&&!document.querySelector(":popover-open:not(#styled-tooltip)")&&Zr();return}if(l.kanbanPopoverGid){st(null);return}l.viewMode!=="kanban"||l.kanbanExpandedColumn===null||(l.kanbanExpandedColumn=null,$())}});function ii(i){let t=B(i,"[data-gid]")?.dataset?.gid;return t?de(t):null}function ts(i,e){if(!e.integrity||!e.file)return;let t=mc(i);if(!t)return;let n=pc(t,e);n&&(l.focusCodeStack=n.stack,l.focusCodeAt=n.at,$()),e.range||Ou(),et()}function Ou(){for(let i of R.querySelectorAll(".focus-code-body"))i.scrollTop=0,i.scrollLeft=0}R.addEventListener("keydown",i=>{if(i.key!=="Enter"&&i.key!==" ")return;let e=B(i,"[data-code-nav-file]");e&&(i.preventDefault(),ts(ii(i),{integrity:e.dataset.codeNavIntegrity,file:e.dataset.codeNavFile,range:Fe(e.dataset.codeNavLine)}))});function vm(i){let e=hc(l.focusCodeStack,l.focusCodeAt,i);e!==l.focusCodeAt&&(l.focusCodeAt=e,$(),l.focusCodeStack[e]?.range||Ou(),et())}function Bu(i){if(!i||l.focusGid===i)return;dn(i),l.focusGid=i,l.focusCodeStack=[],l.focusCodeAt=0,$();let e=R.querySelector(".focus-side-card.active");e&&e.scrollIntoView({block:"nearest",behavior:"instant"}),et()}function Nu(i){let e=[...R.querySelectorAll(".focus-side-card[data-focus-select]")];if(e.length===0)return;let t=e.findIndex(s=>s.classList.contains("active")),n=t<0?i>0?0:e.length-1:Math.min(Math.max(t+i,0),e.length-1);if(n===t)return;let r=e[n].dataset.gid;r&&Bu(r)}R.addEventListener("click",i=>{let e=i.target.closest?.("[data-focus-nav]");if(e){Nu(e.dataset.focusNav==="next"?1:-1);return}let t=i.target.closest?.(".focus-side-card[data-focus-select]");if(!t||window.getSelection?.()?.toString())return;let n=t.dataset.gid;n&&Bu(n)});R.addEventListener("pointerdown",i=>{if(i.button!==0)return;let e=i.target.closest?.("[data-focus-splitter]");e&&$u(e,i)});R.addEventListener("dblclick",i=>{let e=i.target.closest?.("[data-focus-splitter]");e&&ku(e)});function zu(i){if(document.querySelector("dialog[open]"))return!0;for(let e of i.composedPath()){if(!e||e.nodeType!==1)continue;let t=e.tagName;if(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||t==="DIALOG"&&e.open||e.isContentEditable)return!0}return!1}document.addEventListener("keydown",i=>{if(l.currentView!=="findings")return;let e=l.viewMode==="focus",t=l.viewMode==="kanban"&&l.kanbanPopoverGid!==null;if(!e&&!t||i.metaKey||i.ctrlKey||i.altKey||i.shiftKey||zu(i))return;let n=0;if(i.key==="ArrowRight")n=1;else if(i.key==="ArrowLeft")n=-1;else return;i.preventDefault();let r=i.target?.closest?.("[data-focus-splitter]");if(r){wu(r,n*bu);return}e?Nu(n):Du(n)});R.addEventListener("mark-color",i=>{let e=B(i,"[data-gid]");if(!e)return;let t=e.dataset.gid,n=de(t);if(!n)return;let r=$e(n);if(!De(r))return;let s=mt(r),o=i.detail?.color;if(!o)return;Ze(r)?.color===o?X(l.triage,s,{color:void 0}):X(l.triage,s,{color:o}),ke(),Me()});var ot=null,es=null,Ct=null,pn=!1;function qu(){if(ot!==null)return;if(l.reports.length===0){Ct=null,pn=!1;return}ot=l.viewMode,es=document.title;let i=!1;l.viewMode==="table"&&(l.viewMode="list",i=!0),Ct&&(qt(Ct),i=!0),i&&$();for(let n of R.querySelectorAll("finding-card"))n.toggleAttribute("print-one-sample",pn),n.ensureRendered({sync:!0});let e=l.reports.map(n=>n.fileName),t="";e.length===1?t=e[0]:e.length>1&&(t=zt(e)),t=t.replace(/\.json$/u,""),t&&(document.title=t)}function Hu(){if(ot===null)return;for(let e of R.querySelectorAll("finding-card"))e.removeAttribute("print-one-sample");pn=!1;let i=!1;l.viewMode!==ot&&(l.viewMode=ot,i=!0),Ct&&(Ht(),Ct=null,i=!0),i&&$(),document.title=es,ot=null,es=null}window.addEventListener("beforeprint",qu);window.addEventListener("afterprint",Hu);async function ym(i,{oneSamplePerGroup:e=!1}={}){if(ot===null){Ct=i,pn=e;try{qu(),await Promise.all([...R.querySelectorAll("finding-card")].map(t=>t.ensureRendered())),window.print()}catch(t){throw Hu(),t}}}function Mu(i,e){if(!i)return e();qt(i);try{return e()}finally{Ht()}}document.addEventListener("download-requested",async()=>{if(l.reports.length===0)return;let{confirmed:i,view:e,fields:t,mode:n,oneSamplePerGroup:r}=await ou("download");if(e){await pu(Mu(t,()=>Vr({oneSamplePerGroup:r})));return}if(i){if(n==="print"){await ym(t,{oneSamplePerGroup:r});return}Mu(t,()=>Su({oneSamplePerGroup:r}))}});R.addEventListener("analyzer-change",i=>{l.filterAnalyzer=i.detail.analyzer,l.filterModel=i.detail.model,$()});R.addEventListener("repo-change",i=>{l.filterRepo=i.detail.value,$()});R.addEventListener("revalidate-change",i=>{l.filterRevalidate=i.detail.value,$()});R.addEventListener("partial-change",i=>{l.filterPartial=i.detail.value,$()});R.addEventListener("revalidation-change",i=>{l.showRevalidation=i.detail.on,!i.detail.on&&l.reports.some(t=>(t.groups??[]).some(n=>n.some(r=>!r.isApp&&(r.isUpstream||Ri(r.file)))))?Oe("App mode off is not recommended; it can conflate triage for issues in dependencies.",{kind:"warning"}):i.detail.on&&bd(),sr(l.showRevalidation,l.upstreamOnly),Kl(lr(),{resetSort:!1}),$()});R.addEventListener("revalidation-conflicts-open",()=>{(async()=>{let i=await gu(l.revalidateConflicts);if(!i)return;let e=await Tr(i.id,i.reportName);e.ok||alert(e.reason)})().catch(i=>console.warn("revalidation: open conflicting finding failed:",i))});R.addEventListener("revalidation-detail-change",i=>{l.revalidationDetailed=i.detail.on===!0,$()});R.addEventListener("upstream-only-change",i=>{if(l.upstreamOnly=i.detail.on===!0,sr(l.showRevalidation,l.upstreamOnly),!l.upstreamOnly){let e=lr();jl(e,Vl(e))==="confirmed"&&(l.filterRevalidate="confirmed",l.filterPartial="")}$()});R.addEventListener("bundle-search-mode-change",i=>{let e=i.detail?.mode;if(["files","code","issues","largest"].includes(e)){if(l.bundleCodeSearchMode=e,$(),e==="files")Qt();else if(e==="largest"){let t=document.querySelector(".bundle-code-rail-body");t&&(t.scrollTop=0)}}});R.addEventListener("bundle-graph-reason-change",i=>{let e=i.detail?.reason;e!==null&&typeof e!="string"||(E.bundleReason=e,E.layoutCache=null,E.selected=null,E.solo=null,E.focusedPkg=null,oe(),$())});R.addEventListener("bundle-search-regex-toggle",()=>{l.bundleSearchRegex=!l.bundleSearchRegex,$()});R.addEventListener("bundle-search-case-toggle",()=>{l.bundleSearchCase=!l.bundleSearchCase,$()});R.addEventListener("bundle-swap",i=>{let e=i.detail?.integrity;if(!e||!(l.bundles??[]).some(s=>s.integrity===e))return;let t=l.bundles.find(s=>s.integrity===e),n=ac(i.detail.bundles??[]),r=()=>{setTimeout(()=>lc(n))};if(t.managedId){let s=i.detail.target===void 0?l.selectedBundle:i.detail.target,o=l.bundles.find(u=>u.integrity===s),c=o?.managedId?{compareId:o.managedId,...ma(i.detail.mode)}:null;me.navigate(Cc(l.managedTeams,t,l.currentManagedTeam,"compare",c,l.bundles)).finally(r);return}Kt(e,"compare"),Be(e,"compare"),$(),fe(),wt(e).finally(r)});R.addEventListener("bundle-compare-change",i=>{let{base:e,target:t,mode:n}=i.detail??{};!H()||!e||e!==l.selectedBundle||l.bundleDetailsTab!=="compare"||(l.bundleCompare=t?{bundle:e,target:t,mode:$i(n)}:null,Be(e,"compare"))});R.addEventListener("sort-change",i=>{let{kind:e,value:t}=i.detail;if(e==="findings")l.sortBy=t;else if(e==="packages")l.packagesSortBy=t;else if(e==="repositories")l.repositoriesSortBy=t;else return;$()});R.addEventListener("range-change",i=>{i.target.id==="conf-range"&&(l.filterConfMin=i.detail.low,l.filterConfMax=i.detail.high,$())});R.addEventListener("input",i=>{let e=i.composedPath()[0],t=e?.id,n=e?.value;t==="g2-path-filter"&&(E.pathFilter=n,E.graphState?.requestDraw?.())});R.addEventListener("search-input",i=>{if(!i.detail)return;let{kind:e,value:t}=i.detail;if(e==="findings"){l.filterInclude=t,t||(l.filterIncludeNegate=!1),Eu();return}else if(e==="files")l.filesSearch=t;else if(e==="packages")l.packagesSearchQuery=t;else if(e==="repositories")l.repositoriesSearchQuery=t;else if(e==="bundle-code")l.bundleCodeSearchQuery=t;else if(e==="bundle-search"){l.bundleSearchQuery=t,Eu();return}else return;$()});R.addEventListener("search-negate-toggle",()=>{l.filterIncludeNegate=!l.filterIncludeNegate,$()});R.addEventListener("severity-toggle",i=>{let e=i.detail.severity;if(i.detail.kind==="graph"){E.selectedSeverities.has(e)?E.selectedSeverities.delete(e):E.selectedSeverities.add(e),i.composedPath()[0].selected=[...E.selectedSeverities],E.graphState?.requestDraw?.(),cn();return}l.filterSeverities.has(e)?l.filterSeverities.delete(e):l.filterSeverities.add(e),$()});R.addEventListener("color-toggle",i=>{let e=i.detail.color;if(i.detail.kind==="graph"){E.selectedColors.has(e)?E.selectedColors.delete(e):E.selectedColors.add(e),i.composedPath()[0].selected=[...E.selectedColors],E.graphState?.requestDraw?.(),cn();return}l.filterColors.has(e)?l.filterColors.delete(e):l.filterColors.add(e),$()});R.addEventListener("source-toggle",i=>{let e=i.detail.source,t=l.filterSources.has(e);l.filterSources.clear(),t||l.filterSources.add(e),$()});R.addEventListener("annotation-filter-toggle",i=>{let e=i.detail?.key,t=n=>n===""?"with":n==="with"?"without":"";if(e==="comment")l.filterComment=t(l.filterComment);else if(e==="fix")l.filterFix=t(l.filterFix);else if(e==="flag")l.filterFlagged=t(l.filterFlagged);else if(e==="duplicates"&&!l.currentWorkspace)l.filterDuplicates=t(l.filterDuplicates);else if(e==="cross-context")l.filterCrossContext=t(l.filterCrossContext);else if(e==="app-stacked")l.filterAppStacked=t(l.filterAppStacked);else if(e==="security")l.filterSecurity=t(l.filterSecurity);else return;$()});R.addEventListener("slide-triage-toggle",i=>{let{kind:e,value:t}=i.detail;if(e==="package")l.packageSlideTriage=l.packageSlideTriage===t?null:t;else if(e==="repository")l.repositorySlideTriage=l.repositorySlideTriage===t?null:t;else return;$()});R.addEventListener("view-mode-change",i=>{if(i.detail.kind==="files"){l.filesViewMode=i.detail.mode,$();return}l.viewMode=i.detail.mode,l.viewMode!=="kanban"&&(l.kanbanPopoverGid=null),l.viewMode!=="focus"&&(l.focusGid=null),$()});R.addEventListener("severity-mode-change",i=>{let e=i.detail?.mode;if(!(e!=="corrected"&&e!=="original")){l.severityMode=e;try{localStorage.setItem(Za,e)}catch{}$()}});R.addEventListener("repo-edit-start",()=>{H()||(l.repoEditing=!0,$())});R.addEventListener("repo-input",i=>{H()||(l.repoUrl=i.detail.url,Ai(l.currentFile,l.repoUrl))});R.addEventListener("repo-commit",i=>{H()||(l.repoUrl=i.detail.url,Ai(l.currentFile,l.repoUrl),l.repoEditing=!1,$())});R.addEventListener("repo-cancel",i=>{H()||(l.repoUrl=i.detail.url,Ai(l.currentFile,l.repoUrl),l.repoEditing=!1,$())});document.addEventListener("keydown",i=>{if(i.key==="Escape"){if(l.bundleSourceFindingIdx!=null){l.bundleSourceFindingIdx=null,ti();return}if(l.bundleSourceFile){if(l.currentView==="bundles"&&l.bundleDetailsTab==="code")return;_t(l.bundleDetailsTab),$()}}});function W(i,e){for(let[t,n]of Object.entries(e))i.hasAttribute(t)||i.setAttribute(t,n)}var Pe=Math.PI*2;function _m(i){return()=>{i=i+1831565813|0;let e=i;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}function Uu(i,e,t,n){let r=Math.cos(e),s=Math.sin(e);return Math.min(r>0?(t-i.x)/r:r<0?-i.x/r:1/0,s>0?(n-i.y)/s:s<0?-i.y/s:1/0)}function wm(i){return Math.abs(i.reduce((e,t,n)=>{let r=i[(n+1)%i.length];return e+t.x*r.y-r.x*t.y},0))/2}function is(i){return i.slice(1).reduce((e,t,n)=>e+Math.hypot(t.x-i[n].x,t.y-i[n].y),0)}function km(i,e,t,n){let r=i.map(d=>d.x),s=i.map(d=>d.y),o={x:(Math.min(...r)+Math.max(...r))/2,y:(Math.min(...s)+Math.max(...s))/2},c=Math.max(...i.map(d=>Math.hypot(d.x-o.x,d.y-o.y))),u=Math.atan2(o.y-e.y,o.x-e.x);return{center:o,distance:Math.hypot(o.x-e.x,o.y-e.y),dx:Math.cos(u)*(80+n()*200)+(n()-.5)*90,dy:t-o.y+c+40,rotation:(n()-.5)*160,delay:n()*120}}function ju(i,e,t=7){let n=_m(t),r={x:i*1820/1920,y:e*90/1080},s=Math.hypot(i,e),o=(_,x)=>_<1e-8?0:_>x-1e-8?x:_,c=_=>({x:o(_.x,i),y:o(_.y,e)}),u=Array.from({length:20},(_,x)=>((x+(n()-.5)*.35)*Pe/20+Pe)%Pe);for(let[_,x]of[[0,0],[i,0],[i,e],[0,e]])u.push((Math.atan2(x-r.y,_-r.x)+Pe)%Pe);u.sort((_,x)=>_-x);let p=[.045,.29,.58].map(_=>_*Math.min(i,e)).map(_=>u.map(x=>{let S=Math.min(_*(.92+n()*.16),Uu(r,x,i,e));return c({x:r.x+Math.cos(x)*S,y:r.y+Math.sin(x)*S})}));p.push(u.map(_=>{let x=Uu(r,_,i,e);return c({x:r.x+Math.cos(_)*x,y:r.y+Math.sin(_)*x})}));let h=p.map((_,x)=>_.map((S,T)=>{let F=_[(T+1)%_.length],O={x:(S.x+F.x)/2,y:(S.y+F.y)/2},A=Math.hypot(F.x-S.x,F.y-S.y),z=S.x===F.x&&(S.x===0||S.x===i)||S.y===F.y&&(S.y===0||S.y===e),Z=x===p.length-1||z?0:(n()-.5)*A*.08,ne=Math.atan2(O.y-r.y,O.x-r.x);return[S,c({x:O.x+Math.cos(ne)*Z,y:O.y+Math.sin(ne)*Z}),F]})),f=p.slice(1).map((_,x)=>_.map((S,T)=>{let F=p[x][T],O=Math.hypot(S.x-F.x,S.y-F.y),A={x:(F.x+S.x)/2,y:(F.y+S.y)/2},z=(u[T]-u[(T+u.length-1)%u.length]+Pe)%Pe,Z=(u[(T+1)%u.length]-u[T]+Pe)%Pe,ne=Math.min(z,Z)*Math.hypot(A.x-r.x,A.y-r.y),re=(n()-.5)*Math.min(O*.12,ne*.14);return[F,c({x:A.x-Math.sin(u[T])*re,y:A.y+Math.cos(u[T])*re}),S]})),b=[],v=_=>{wm(_)>.01&&b.push({points:_,...km(_,r,e,n)})};v(h[0].flatMap(_=>_.slice(0,-1)));for(let _=0;_<p.length-1;_++)for(let x=0;x<u.length;x++){let S=(x+1)%u.length;v([...f[_][x],...h[_+1][x].slice(1),...f[_][S].toReversed().slice(1),...h[_][x].toReversed().slice(1)])}let g=Math.max(...b.map(_=>_.distance));for(let _ of b)_.delay+=_.distance/g*400;let y=[],k=(_,x,S,T)=>{let F=is(_);F>.1&&y.push({points:_,length:F,delay:x,duration:S,width:T})};for(let _=0;_<u.length;_++){let x=[r,p[0][_],...f.flatMap(S=>S[_].slice(1))];k(x,0,200+is(x)/s*1e3,1.1)}for(let _ of h.slice(0,-1))for(let x of _){let S=Math.hypot(x[0].x-r.x,x[0].y-r.y);k(x,S/s*1e3,220+is(x)/s*400,.7)}for(let _ of p[1]){let x=Math.atan2(_.y-r.y,_.x-r.x)+(n()-.5)*1.4,S=Math.min(i,e)*(.07+n()*.12),T=[_];for(let F=1;F<=3;F++)T.push(c({x:_.x+Math.cos(x+(n()-.5)*.3)*S*F/3,y:_.y+Math.sin(x+(n()-.5)*.3)*S*F/3}));k(T,Math.hypot(_.x-r.x,_.y-r.y)/s*1e3+80,220,.5)}return{width:i,height:e,impact:r,pieces:b,cracks:y}}var Vu=`.screen-crack{position:fixed;inset:0;z-index:2147483646;overflow:hidden;pointer-events:none;user-select:none}.screen-crack-svg{position:absolute;inset:0;width:100%;height:100%;overflow:hidden}.screen-crack-glass{position:absolute;inset:0;backdrop-filter:blur(9px) brightness(1.06) saturate(.85);background:linear-gradient(135deg,#dcebff0f,#dcebff00 55%);mask-mode:luminance;opacity:0}.screen-crack-shard{transform-box:fill-box;transform-origin:center}.screen-crack-outline{opacity:0}.screen-crack-flash{position:absolute;width:18vmin;height:18vmin;border-radius:50%;background:radial-gradient(circle,rgb(255 255 255 / .85),rgb(200 230 255 / .15) 55%,transparent 75%);transform:translate(-50%,-50%);opacity:0}@media print{.screen-crack{display:none}}
|
|
37
|
+
`;var xm="http://www.w3.org/2000/svg",ns=1.5,Sm=0;function ge(i,e={}){let t=document.createElementNS(xm,i);for(let[n,r]of Object.entries(e))t.setAttribute(n,String(r));return t}function Cm(i){let e=document.createElement("div");e.className="screen-crack",e.setAttribute("aria-hidden","true");let t=document.createElement("style");t.textContent=Vu;let n=ge("svg",{viewBox:`0 0 ${i.width} ${i.height}`,preserveAspectRatio:"none"});n.classList.add("screen-crack-svg");let r=ge("defs"),s=`screen-crack-mask-${++Sm}`,o=ge("mask",{id:s,maskUnits:"userSpaceOnUse",maskContentUnits:"userSpaceOnUse",x:0,y:0,width:i.width,height:i.height});o.append(ge("rect",{width:i.width,height:i.height,fill:"black"})),r.append(o);let c=ge("g"),u=ge("g"),d=i.pieces.map(b=>{let v=b.points.map(_=>`${_.x},${_.y}`).join(" "),g=ge("g"),y=ge("g");g.classList.add("screen-crack-shard"),y.classList.add("screen-crack-shard"),g.append(ge("polygon",{points:v,fill:"white"}));let k=ge("polygon",{points:v,fill:"none",stroke:"rgb(240 248 255 / .8)","stroke-width":1.1,"stroke-linejoin":"round"});return k.classList.add("screen-crack-outline"),y.append(k),o.append(g),u.append(y),{masked:g,outlined:y,outline:k,piece:b}});n.append(r,c,u);let p=document.createElement("div");p.className="screen-crack-glass";let h=`${document.URL.split("#")[0]}#${s}`;p.style.maskImage=`url("${h}")`,p.style.webkitMaskImage=`url("${h}")`;let f=document.createElement("div");return f.className="screen-crack-flash",f.style.left=`${i.impact.x}px`,f.style.top=`${i.impact.y}px`,e.append(t,p,n,f),{overlay:e,glass:p,cracks:c,shards:d,flash:f}}function Em(i,e,t){for(let n of e.cracks){let r=n.points.map((s,o)=>`${o===0?"M":"L"}${s.x} ${s.y}`).join(" ");for(let s of[!0,!1]){let o=ge("path",{d:r,fill:"none",stroke:s?"rgb(0 0 0 / .55)":"rgb(232 244 255 / .95)","stroke-width":n.width+(s?.8:0),"stroke-linecap":"round","stroke-linejoin":"round"});s&&o.setAttribute("transform","translate(.5 .7)"),o.style.strokeDasharray=`${n.length} ${n.length}`,o.style.strokeDashoffset=String(n.length),i.append(o),t(o,[{strokeDashoffset:String(n.length)},{strokeDashoffset:"0"}],{duration:n.duration*ns,delay:n.delay*ns,easing:"cubic-bezier(.2,.7,.2,1)"})}}}function Ku(i){let e=window.innerHeight,t=window.innerWidth;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches||!t||!e||!Element.prototype.animate)return i(),Promise.resolve();let n=ju(t,e),{overlay:r,glass:s,cracks:o,shards:c,flash:u}=Cm(n);document.body.append(r);let d=document.timeline.currentTime,p=[],h=(T,F,O)=>{let A=T.animate(F,{fill:"both",...O});return A.playbackRate=2,A.startTime=d,p.push(A),A},f=!1,b=!1,v=()=>{b||(b=!0,i())},g=()=>{if(!f){f=!0,window.removeEventListener("resize",g),window.removeEventListener("beforeprint",g),document.removeEventListener("visibilitychange",y),r.remove();for(let T of p)T.cancel();v()}},y=()=>{document.hidden&&g()};window.addEventListener("resize",g,{once:!0}),window.addEventListener("beforeprint",g,{once:!0}),document.addEventListener("visibilitychange",y),Em(o,n,h),h(u,[{opacity:0,transform:"translate(-50%, -50%) scale(0)"},{opacity:.85,transform:"translate(-50%, -50%) scale(.8)",offset:.08},{opacity:0,transform:"translate(-50%, -50%) scale(2.4)"}],{duration:600,easing:"ease-out"}),h(o,[{transform:"translate(0, 0)"},{transform:"translate(-3px, 2px)"},{transform:"translate(3px, -2px)"},{transform:"translate(-2px, -2px)"},{transform:"translate(2px, 2px)"},{transform:"translate(0, 0)"}],{duration:450});let k=Math.max(...n.cracks.map(T=>T.delay+T.duration))*ns,_=500,x=Math.max(_,k*.8);h(s,[{opacity:0},{opacity:1}],{duration:_,easing:"ease-out"}),h(u,[{visibility:"visible"},{visibility:"visible"}],{duration:1,delay:x-1}).finished.then(v,()=>{}),h(o,[{opacity:1},{opacity:0}],{duration:450,delay:x,easing:"ease-out"});for(let{masked:T,outlined:F,outline:O,piece:A}of c){let z=x+A.delay,Z=[{transform:"translate(0, 0) rotate(0deg)"},{transform:`translate(${A.dx}px, ${A.dy}px) rotate(${A.rotation}deg)`}];for(let ne of[T,F])h(ne,Z,{duration:1700,delay:z,easing:"cubic-bezier(.32,0,.82,.94)"});h(O,[{opacity:0},{opacity:1}],{duration:250,delay:z})}return Promise.all(p.map(T=>T.finished)).then(g,g)}var Gu=`:host{position:absolute;top:.5rem;right:.5rem;z-index:1000;width:30px;height:30px;background:var(--theme-toggle-bg, transparent);color:var(--muted);border:var(--theme-toggle-border, 0);border-radius:var(--ui-radius, 6px);font-size:1rem;line-height:1;font-family:inherit;display:flex;align-items:center;justify-content:center;transition:color .12s,background .12s;cursor:default;user-select:none}:host(:hover){color:var(--text);background:var(--theme-toggle-hover-bg, rgb(from var(--text) r g b / .06))}:host(:focus-visible){outline:2px solid var(--accent);outline-offset:2px}@media print{:host{display:none!important}}@media(display-mode:window-controls-overlay){:host{-webkit-app-region:no-drag;app-region:no-drag}}
|
|
38
|
+
`;var ss="deepview.theme",mn=Object.freeze(["dark","light","green","pink","paper"]),rs=Object.freeze(["dark","green","pink","paper","light"]),Rm={dark:{base:"#1a1a1b",dim:"#0a0a0a"},light:{base:"#f6f6fa",dim:"#646464"},green:{base:"#0a140a",dim:"#050a05",sidebar:"#0f1e0f"},pink:{base:"#ffe4ee",dim:"#a3727f",sidebar:"#ffe0f0"},paper:{base:"#ffffff",dim:"#666666"}},os=window.matchMedia?.("(display-mode: window-controls-overlay)"),Wu=window.matchMedia?.("(display-mode: standalone)"),Yu=window.navigator?.windowControlsOverlay,Lm={light:"\u2600",dark:"\u263E",green:"\u{1F576}\uFE0F",pink:"\u273F",paper:"\u{1F4C4}"},as="deepview-theme-changed",be="dark",ps=!1,Mm=0,ls=!1,hn=!1,cs=0;function Pm(){return ls?rs[(rs.indexOf(be)+1)%rs.length]:be==="light"?"dark":"light"}function ds(){window.dispatchEvent(new CustomEvent(as,{detail:{theme:be}}))}function Am(){try{let i=localStorage.getItem(ss);return mn.includes(i)?i:"dark"}catch{return"dark"}}function fn(){let i=document.querySelector('meta[name="theme-color"]');if(!i)return;let{base:e,dim:t,sidebar:n}=Rm[be],r=Yu?.visible??os?.matches??!1,s=(Wu?.matches||os?.matches)&&!r;i.setAttribute("content",ps?t:s&&n?n:e)}function Et(i){mn.includes(i)||(i="dark"),be=i;for(let e of mn)e!=="dark"&&document.body.classList.remove(`theme-${e}`);i!=="dark"&&document.body.classList.add(`theme-${i}`);try{i==="dark"?localStorage.removeItem(ss):localStorage.setItem(ss,i)}catch{}fn(),ds()}Et(Am());os?.addEventListener("change",fn);Wu?.addEventListener("change",fn);Yu?.addEventListener("geometrychange",fn);window.addEventListener("beforeprint",()=>{ps=!0,Et(be)});window.addEventListener("afterprint",()=>{ps=!1,Et(be)});function Ju(i){if(!mn.includes(i))throw new TypeError("unknown theme");cs++,Et(i)}function Xu(){return be}var us=class extends U{static properties={_theme:{state:!0}};static styles=M(Gu);constructor(){super(),this._theme=be}connectedCallback(){super.connectedCallback(),W(this,{role:"button",tabindex:"0","aria-label":"toggle theme"}),this.addEventListener("click",this._toggle),this.addEventListener("keydown",this._onKeydown),window.addEventListener(as,this._onThemeChanged),this._onThemeChanged()}disconnectedCallback(){window.removeEventListener(as,this._onThemeChanged),this.removeEventListener("click",this._toggle),this.removeEventListener("keydown",this._onKeydown),super.disconnectedCallback()}_onThemeChanged=()=>{this._theme=be,this.setAttribute("aria-disabled",String(hn))};_toggle=()=>{if(!hn){if(!ls&&++Mm>=8&&be==="dark"){ls=!0,hn=!0,ds();let e=cs,t=()=>{cs===e&&Et("green")},n=()=>{hn=!1,ds()};try{Ku(t).catch(t).finally(n)}catch{t(),n()}return}Et(Pm())}};_onKeydown=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.repeat||this._toggle())};render(){return a`${Lm[this._theme]}`}};customElements.define("theme-toggle",us);var Qu=`:host{display:block}.row{display:grid;grid-template-columns:5.5rem minmax(0,1fr);gap:.2rem .85rem;padding:.25rem .7rem;font-size:.8rem;border-bottom:1px solid var(--border);transition:background .12s}:host(:last-child) .row{border-bottom:none}.row.row-pending{min-height:3rem}:host(:hover) .row{background:rgb(from var(--text) r g b / .04)}:host(.mark-red) .row{background:var(--mark-red-bg)}:host(.mark-blue) .row{background:var(--mark-blue-bg)}:host(.mark-green) .row{background:var(--mark-green-bg)}:host(.mark-gray) .row{background:var(--mark-gray-bg)}:host(.has-conflict) .row{outline:2px dashed var(--accent);outline-offset:-2px}:host(.selected) .row{outline:2px solid var(--accent);outline-offset:-2px}:host(.link-target) .row{animation:link-target-flash 1.6s ease-out}@keyframes link-target-flash{0%,30%{box-shadow:inset 0 0 0 2px var(--accent)}to{box-shadow:inset 0 0 0 2px rgb(from var(--accent) r g b / 0)}}@media(prefers-reduced-motion:reduce){:host(.link-target) .row{animation:none;box-shadow:inset 0 0 0 2px var(--accent)}}:host(:first-of-type) .row{border-top-left-radius:var(--ui-radius, 6px);border-top-right-radius:var(--ui-radius, 6px)}:host(:last-of-type) .row{border-bottom-left-radius:var(--ui-radius, 6px);border-bottom-right-radius:var(--ui-radius, 6px)}.row-score{grid-column:1;grid-row:1 / 3;align-self:center;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.2rem;font-variant-numeric:tabular-nums;.badge{min-width:4.4rem;text-align:center}.row-conf{color:var(--muted);font-size:.72rem;user-select:none;& strong{color:var(--text);font-size:.8rem}}}.row-body{display:contents}.title-row{grid-column:2;grid-row:1;min-width:0;display:flex;align-items:baseline;gap:.5rem;.title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500;user-select:none}.row-type{color:var(--muted);font-size:.68rem;flex-shrink:0}}.meta-row{grid-column:2;grid-row:2;min-width:0;display:flex;align-items:center;gap:.55rem;.row-loc{color:var(--muted);font-size:.72rem;flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;& a{color:inherit;text-decoration:none;cursor:default}& a:hover{color:var(--accent)}}.marks{display:flex;gap:.35rem;align-items:center;min-width:0;margin-left:auto;user-select:none}}.gh-ref-btn{display:inline-flex;align-items:center;position:relative;flex-shrink:0;padding:0 .15rem;color:var(--muted);cursor:default;&:before{content:"";position:absolute;inset:-.25rem -2px}&:hover{color:var(--accent)}&:focus-visible{outline:1px solid var(--accent);outline-offset:1px;border-radius:var(--ui-radius, 2px)}}.tabs-row{grid-column:2;grid-row:3;min-width:0;.tabs{display:flex;gap:.25rem;flex-wrap:wrap}}.badge,.tabs,.tab,.row-type{cursor:default;user-select:none}.line-num{color:var(--muted);font-size:.75rem}.line-num a{color:inherit}@media print{:host(:hover) .row,:host(.mark-red) .row,:host(.mark-blue) .row,:host(.mark-green) .row,:host(.mark-gray) .row{background:transparent!important}:host(.triage-fixed),:host(.triage-invalid),:host(.triage-deleted),:host(.triage-ignored){opacity:1}:host(.selected) .row,:host(.has-conflict) .row{outline:none!important}:host(.link-target) .row{animation:none;box-shadow:none!important}.row{break-inside:avoid}.marks{display:none!important}.badge{-webkit-print-color-adjust:exact;print-color-adjust:exact;&.critical{background:#a30b0f!important;color:#fff!important}&.high{background:#b8400a!important;color:#fff!important}&.medium{background:#855107!important;color:#fff!important}&.low{background:#374151!important;color:#fff!important}&.high_bug{background:#7a3e0c!important;color:#fff!important}&.bug{background:#4d4538!important;color:#fff!important}&.informational{background:#0550ae!important;color:#fff!important}}.badge-orig{background:transparent!important;color:#555!important;border-color:#999!important}.badge-varies{color:#555!important;border-color:#999!important}.badge-arrow,.badge-corr-mark,.badge-pre{color:#555!important}a,.line-num,.line-num a{color:inherit}}
|
|
39
|
+
`;var gn=`:host(.triage-fixed),:host(.triage-invalid),:host(.triage-deleted),:host(.triage-ignored){opacity:.75}.badge{display:inline-block;font-size:.7rem;font-weight:600;text-transform:uppercase;padding:.15rem .45rem;border-radius:3px;letter-spacing:.03em;line-height:1;&.critical{background:var(--critical);color:#fff}&.high{background:var(--high);color:#fff}&.medium{background:var(--medium);color:#000}&.low{background:var(--low);color:var(--badge-low-text)}&.high_bug{background:var(--high-bug);color:#fff}&.bug{background:var(--bug);color:#fff}&.informational{background:var(--info);color:#fff}}.badge-pair{display:inline-flex;align-items:center;gap:.25rem}.badge-pair-full,.badge-pair-compact{flex-direction:column;gap:.15rem}.badge-orig-wrap{display:inline-flex;align-items:center;gap:.15rem;line-height:1}.badge-arrow,.badge-corr-mark{font-size:.6rem;line-height:1;color:var(--muted)}.badge-arrow.up,.badge-corr-mark.up{color:var(--high)}.badge-pre{font-size:.55rem;text-transform:uppercase;letter-spacing:.03em;color:var(--muted)}.badge-orig{display:inline-block;font-size:.58rem;font-weight:600;text-transform:uppercase;padding:.08rem .3rem;border-radius:3px;letter-spacing:.03em;line-height:1;background:transparent;color:var(--muted);border:1px solid var(--border);&.struck{text-decoration:line-through;text-decoration-thickness:1px}&.critical{border-color:rgb(from var(--critical) r g b / .55)}&.high{border-color:rgb(from var(--high) r g b / .55)}&.medium{border-color:rgb(from var(--medium) r g b / .55)}&.low{border-color:rgb(from var(--low) r g b / .55)}&.high_bug{border-color:rgb(from var(--high-bug) r g b / .55)}&.bug{border-color:rgb(from var(--bug) r g b / .55)}&.informational{border-color:rgb(from var(--info) r g b / .55)}}.badge-varies{font-size:.55rem;font-weight:600;text-transform:uppercase;letter-spacing:.03em;padding:.08rem .3rem;border-radius:3px;line-height:1;background:transparent;color:var(--muted);border:1px dashed var(--border)}.mark-action-group{display:inline-flex;border:1px solid var(--border);border-radius:var(--ui-radius, 3px);background:linear-gradient(var(--surface),var(--surface)),var(--bg);overflow:hidden;margin-right:.25rem;flex-shrink:0}.mark-comment,.mark-fix,.mark-flag,.mark-copy,.mark-link,.mark-issue,.mark-claude{background:transparent;border:0;color:var(--muted);padding:0 .25rem;height:1.4rem;cursor:default;display:inline-flex;align-items:center;justify-content:center;&:not(:last-child){border-right:1px solid var(--border)}&:not(:disabled):hover{color:var(--accent);background:var(--surface-active)}}.mark-issue{text-decoration:none}.mark-comment.has-comment,.mark-fix.has-fix,.mark-flag.flagged{color:var(--accent)}.mark-flag svg{display:block}.mark-copy.copied,.mark-link.copied,.mark-claude.copied{color:var(--green, #4ade80);background:color-mix(in srgb,var(--green, #4ade80) 14%,transparent)}.mark-comment.has-comment .bubble,.mark-fix.has-fix .wrench,.mark-flag.flagged .flag-cloth{fill:var(--accent);fill-opacity:.15}.triage-menu-wrap{position:relative;display:inline-flex;margin-left:.25rem;flex-shrink:0}.mark-triage-menu{cursor:default;background:linear-gradient(var(--surface),var(--surface)),var(--bg);border:1px solid var(--border);color:var(--muted);border-radius:var(--ui-radius, 3px);padding:0 .3rem;height:1.5rem;display:inline-flex;align-items:center;justify-content:center;gap:.25rem;font:inherit}.mark-triage-menu:not(:disabled):hover{color:var(--text);border-color:var(--accent)}.mark-comment:disabled,.mark-fix:disabled,.mark-flag:disabled,.mark-triage-menu:disabled,.triage-menu-item:disabled{opacity:.4}.mark-triage-menu.with-label{padding:0 .35rem 0 .5rem;font-size:.72rem;height:1.5rem}.mark-triage-menu .mark-triage-label{text-transform:uppercase;letter-spacing:.05em;font-weight:600}.mark-triage-menu.triage-state-deleted{border-color:var(--critical);color:var(--critical)}.mark-triage-menu.triage-state-fixed{border-color:var(--green, #4ade80);color:var(--green, #4ade80)}.mark-triage-menu.triage-state-inprogress{border-color:var(--warning, #d97706);color:var(--warning, #d97706)}.mark-triage-menu.triage-state-invalid{border-color:var(--muted);color:var(--text)}.mark-triage-menu.triage-state-ignored{border-color:var(--accent, #2563eb);color:var(--accent, #2563eb)}.triage-menu[popover]{position:fixed;inset:auto;margin:0;min-width:7rem;background:var(--bg);border:1px solid var(--border);border-radius:var(--ui-radius, 4px);padding:.25rem;box-shadow:0 4px 12px #00000040;display:flex;flex-direction:column;gap:1px;-webkit-app-region:no-drag;app-region:no-drag}.triage-menu[popover]:not(:popover-open){display:none}.triage-menu[popover]:popover-open{display:flex}.triage-menu-item{cursor:default;background:transparent;border:0;padding:.35rem .5rem;font-size:.78rem;color:var(--text);text-align:left;border-radius:var(--ui-radius, 3px);font-family:inherit}.triage-menu-item:not(:disabled):hover{background:var(--surface)}.triage-menu-item.active:before{content:"\\2713 ";color:var(--accent)}.triage-menu-inprogress:not(:disabled):hover{color:var(--warning, #d97706)}.triage-menu-fixed:not(:disabled):hover{color:var(--green, #4ade80)}.triage-menu-invalid:not(:disabled):hover{color:var(--muted)}.triage-menu-deleted:not(:disabled):hover{color:var(--critical)}.line-num a:hover{color:var(--accent)}
|
|
40
|
+
`;var bn=`.tab-level-separator{align-self:center;padding-inline:.125rem;color:var(--muted);font-size:.75rem;line-height:1}.tab{--tab-severity: var(--bg);position:relative;display:inline-flex;align-items:center;gap:.35rem;border:1px solid transparent;border-radius:var(--ui-radius, 4px);padding-block:calc(.35rem - .1em);padding-inline:.5rem;min-width:0;font-family:inherit;font-size:.75rem;line-height:1.3;color:var(--text);background:var(--tab-severity);background-image:linear-gradient(135deg,var(--tab-marker, transparent) 50%,var(--tab-marker-shadow, transparent) 50%,transparent 60%);background-size:12px 12px;background-repeat:no-repeat;background-origin:border-box;&.tab-with-confidence{padding-right:1rem;min-width:3.25rem}&.tab-with-analyzer{padding-right:calc(.5rem + 20px)}&.tab-severity-critical{--tab-severity: var(--critical);color:#fff}&.tab-severity-high{--tab-severity: var(--high);color:#fff}&.tab-severity-medium{--tab-severity: var(--medium);color:#000}&.tab-severity-low{--tab-severity: var(--low);color:var(--badge-low-text)}&.tab-severity-high_bug{--tab-severity: var(--high-bug);color:#fff}&.tab-severity-bug{--tab-severity: var(--bug);color:#fff}&.tab-severity-informational{--tab-severity: var(--info);color:#fff}&.tab-mark-red{--tab-marker: var(--marker-red)}&.tab-mark-blue{--tab-marker: var(--marker-blue)}&.tab-mark-green{--tab-marker: var(--marker-green)}&.tab-mark-gray{--tab-marker: var(--marker-gray)}&:is(.tab-mark-red,.tab-mark-blue,.tab-mark-green,.tab-mark-gray){--tab-marker-shadow: rgb(0 0 0 / .3)}&:hover{border-color:var(--muted)}&.active{border-color:var(--text);box-shadow:inset 0 0 0 1px var(--text)}&.active:before{content:"";position:absolute;z-index:1;top:-1px;left:-1px;width:12px;height:12px;border-top-left-radius:inherit;background:var(--tab-marker, transparent);clip-path:polygon(0 0,100% 0,0 100%);pointer-events:none}&.tab-with-analyzer:is(:hover,.active):after{content:"";position:absolute;inset:-1px;border:1px solid var(--muted);border-radius:inherit;pointer-events:none}&.tab-with-analyzer.active:after{border-color:var(--text);box-shadow:inset 0 0 0 1px var(--text)}&.tab-deleted .tab-label{text-decoration:line-through;opacity:.6}&.tab-inprogress .tab-label:after{content:" \\25d0";opacity:.6}&.tab-fixed .tab-label{opacity:.65}&.tab-fixed .tab-label:after{content:" \\2713";opacity:.6}&.tab-invalid .tab-label{opacity:.65}&.tab-invalid .tab-label:after{content:" \\2298";opacity:.6}&.tab-ignored .tab-label{opacity:.55}&.tab-ignored .tab-label:after{content:" \\1f441";opacity:.6;font-size:.7em}.tab-label{display:flex;align-items:center;gap:.35rem;text-align:left}.tab-conf{position:absolute;right:.25rem;bottom:.15rem;font-size:.6rem;line-height:1;color:inherit}.tab-analyzer{position:absolute;inset:-1px -1px -1px auto;width:20px;display:flex;overflow:hidden;border-radius:var(--ui-radius, 0 4px 4px 0);box-shadow:0 0 2px #0003}.tab-analyzer .report-logo{flex:1;border:0}.tab-analyzer svg{display:block}.tab-conf-max{display:none}.tab-severity{display:inline-flex}.badge{padding:0;background:none;color:inherit}.tab-indicators{display:inline-flex;align-items:center;gap:.25rem}.tab-indicators:empty{display:none}.tab-marks{display:inline-flex;align-items:center;gap:.15rem;color:inherit}.tab-marks svg{display:block}.tab-marks :is(.bubble,.wrench,.flag-cloth){fill:currentcolor;fill-opacity:.15}.badge-corr-mark{color:inherit}}
|
|
41
|
+
`;var vn=`.report-button{display:inline-flex;align-items:center;max-width:16rem;padding:0;overflow:hidden;background:transparent;border:1px solid var(--border);border-radius:var(--ui-radius, 3px);color:var(--muted);font:inherit;font-size:.7rem;text-decoration:none;cursor:default;transition:border-color .12s,color .12s;&:hover{border-color:var(--accent);color:var(--accent)}&:focus-visible{outline:2px solid var(--accent);outline-offset:1px}}.report-button-label{min-width:0;padding:.1rem .4rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
42
|
+
`;var yn=`a{cursor:default}.finding-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:.25rem 1rem;min-width:0;max-width:100%}.finding-action-controls{display:flex;flex:0 0 auto;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:.35rem;max-width:100%}.finding-actions .report-chip{flex:0 1 auto;width:max-content;min-width:0;max-width:100%;min-height:1.4rem}.finding-actions .report-chip-label{white-space:normal;overflow-wrap:anywhere;text-align:left}
|
|
43
|
+
`;var Nm=["is-critical","mark-red","mark-blue","mark-green","mark-gray","has-conflict","triage-inprogress","triage-fixed","triage-invalid","triage-deleted","triage-ignored","selected"],hs=class extends D{static properties={group:{attribute:!1},selected:{type:Boolean}};static styles=[M($t),M(vn),M(gn),M(Qu),M(yn),M(bn)];_near=!1;_watching=!1;constructor(){super(),this.group=null,this.selected=!1}render(){if(!this.group)return a``;if(this.dataset.gid=Qe(this.group),!this._near)return this.classList.toggle("selected",this.selected),a`<div class="row row-pending" aria-busy="true"></div>`;let e=new Set(xc(this.group));this.selected&&e.add("selected");for(let t of Nm)this.classList.toggle(t,e.has(t));return a`<div class="row">${Sc(this.group)}</div>`}connectedCallback(){super.connectedCallback(),ht(this.renderRoot),this.addEventListener("click",this._onClick),this._watching=!0,xt(this,e=>this._onNear(e))}disconnectedCallback(){this.removeEventListener("click",this._onClick),this._watching&&(Le(this),this._watching=!1),super.disconnectedCallback()}_onNear(e){e?(this._watching&&(Le(this),this._watching=!1),this._near=!0,this.requestUpdate()):this._near&&(this._near=!1,this.requestUpdate())}ensureRendered({sync:e=!1}={}){return this._near||this._onNear(!0),e&&this.isConnected&&this.isUpdatePending&&this.performUpdate(),this.updateComplete}_onClick=e=>{e.composedPath().some(n=>n?.matches?.("a, button, label"))||this.dataset.gid&&this.dispatchEvent(new CustomEvent("row-select",{detail:{gid:this.dataset.gid},bubbles:!0,composed:!0}))}};customElements.define("finding-row",hs);var Zu=`:host{display:block;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:var(--ui-radius, 6px);overflow:hidden;box-shadow:var(--shadow-glass);margin-bottom:1rem;max-width:1200px}@media not print{finding-row{content-visibility:auto;contain-intrinsic-size:auto 3.2rem}}
|
|
44
|
+
`;var ms=class extends U{static properties={items:{attribute:!1},selectedGid:{attribute:!1}};static styles=M(Zu);constructor(){super(),this.items=[],this.selectedGid=null}render(){return a`${ce(this.items??[],e=>Qe(e),e=>a`<finding-row .group="${e}" ?selected="${Qe(e)===this.selectedGid}"></finding-row>`)}`}};customElements.define("finding-table",ms);var ep=`:host{display:block}:host(.hidden){display:none}:host([lazy]:not(.content-ready)){visibility:hidden}.card{padding:.5rem .75rem;padding-bottom:var(--finding-card-pad-bottom, .5rem);border-bottom:1px solid var(--border);font-size:.875rem;display:var(--finding-card-display, block);flex-direction:column;flex:1}:host(:last-child) .card{border-bottom:none}.card.card-pending{min-height:8rem}:host(.has-conflict) .card{outline:2px dashed var(--accent);outline-offset:-2px}:host(.has-conflict[popup][context="kanban-detail"]) .card{outline:none}:host(.link-target) .card{animation:link-target-flash 1.6s ease-out}@keyframes link-target-flash{0%,30%{box-shadow:inset 0 0 0 2px var(--accent)}to{box-shadow:inset 0 0 0 2px rgb(from var(--accent) r g b / 0)}}@media(prefers-reduced-motion:reduce){:host(.link-target) .card{animation:none;box-shadow:inset 0 0 0 2px var(--accent)}}:host([in-group]) .line-row{display:none}@media not print{:host([in-group]) .line-row+*{margin-top:0}:host([in-group]) .line-row+:is(.conf-reason,.revalidate-verdict,.severity-reason){padding-top:0;border-top:0}}.tabs{display:flex;gap:.25rem;flex-wrap:wrap}.marks-left{display:flex;align-items:center;gap:.5rem;margin-right:auto;flex-wrap:wrap}.commit-ref{color:var(--muted);font-size:.8rem;& a{color:var(--accent);font-family:ui-monospace,SFMono-Regular,Menlo,monospace}& a:hover{text-decoration:underline}& span{font-family:ui-monospace,SFMono-Regular,Menlo,monospace}}.marks-commit-row{margin-top:.4rem;padding-left:4.75rem}.tab-body{display:none;grid-template-columns:auto 1fr;gap:.25rem .75rem;&.active{display:grid}}.tab-body>:not(.finding-left){min-width:0;overflow-wrap:break-word}.desc-title{grid-column:2;font-size:1.08em;font-weight:600;letter-spacing:-.005em;line-height:1.35;color:var(--text)}.desc{grid-column:2;white-space:pre-wrap;font-size:.96em;line-height:1.6;color:rgb(from var(--text) r g b / .82);margin-top:.4rem}.section,.evidence,.recommendation{grid-column:2;margin-top:.55rem;font-size:.92em}.section-label{display:flex;align-items:center;gap:.3rem;color:var(--muted);font-weight:600;font-size:.62rem;text-transform:uppercase;letter-spacing:.06em;&:before{content:"";flex:none;width:2px;height:.58rem;margin-left:calc((2px + .3rem)*-1);border-radius:1px;background:currentcolor;opacity:.75;-webkit-print-color-adjust:exact;print-color-adjust:exact}}.code-preview-btn{display:inline-flex;align-items:center;margin-left:.35rem;padding:0 .15rem;border:0;background:transparent;color:var(--muted);vertical-align:-2px;&.open{color:var(--accent)}}.gh-ref-btn{display:inline-flex;align-items:center;margin-left:.25rem;padding:0 .15rem;color:var(--muted);vertical-align:-2px}:is(.code-preview-btn,.gh-ref-btn){position:relative;&:before{content:"";position:absolute;inset:-.25rem -2px}&:hover{color:var(--accent)}&:focus-visible{outline:1px solid var(--accent);outline-offset:1px;border-radius:var(--ui-radius, 2px)}}.code-preview-tip{position:absolute;z-index:20;top:100%;left:0;margin-top:.3rem;width:max-content;max-width:min(100%,46rem);visibility:hidden;filter:drop-shadow(0 2px 6px rgb(0 0 0 / .35));background:var(--bg);border-radius:var(--ui-radius, 4px);.code-preview{margin:0}}:is(.line-row,.evidence-list li):has(.code-preview-btn:is(:hover,:focus-visible))>.code-preview-tip{visibility:visible}.code-preview{margin:.3rem 0 .1rem;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);background:var(--surface);backdrop-filter:var(--glass-blur);max-height:calc(10lh + .7rem);overflow:auto;display:flex;align-items:flex-start;white-space:normal;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.75rem;line-height:1.5}.code-preview-pending{display:block;padding:.35rem .5rem;color:var(--muted);font-style:italic}.code-preview-gutter{flex:none;padding:.35rem .45rem .35rem .5rem;border-right:1px solid var(--border);color:var(--muted);text-align:right;user-select:none;position:sticky;left:0;z-index:1;background-color:var(--bg);background-image:linear-gradient(rgb(from var(--text) r g b / .03),rgb(from var(--text) r g b / .03)),linear-gradient(var(--surface),var(--surface));.code-preview-lineno{width:var(--lineno-width, 3ch);opacity:.7}.cited{opacity:1;color:var(--accent);font-weight:600}}.code-preview-source{margin:0;padding:.35rem .6rem;white-space:pre;color:var(--text);font:inherit;& code{font:inherit}}summary.section-label{cursor:default;list-style:none;&::-webkit-details-marker{display:none}&:after{content:"";flex:none;width:.3rem;height:.3rem;margin-left:.05rem;border-right:1.5px solid currentcolor;border-bottom:1.5px solid currentcolor;transform:translateY(-1px) rotate(-45deg);transition:transform .12s;opacity:.8}}details[open]>summary.section-label:after{transform:translateY(-2px) rotate(45deg)}.evidence-count{font-weight:500;opacity:.8}.section-body{white-space:pre-wrap;line-height:1.55;color:rgb(from var(--text) r g b / .82);margin-top:.1rem}.para+.para{margin-top:.5lh}.md-list{margin:0;padding-inline-start:1.2em}.md-list li+li{margin-top:.25lh}.para+.md-list,.md-list+.para,.md-list+.md-list{margin-top:.5lh}.md-list li::marker{color:rgb(from currentcolor r g b / .45)}.recommendation .section-label,.recommendation .section-body{color:var(--green)}.conf-reason,.revalidate-verdict{grid-column:2;white-space:pre-wrap;font-size:.92em;font-style:italic;color:var(--muted);margin-top:.6rem;padding-top:.55rem;border-top:1px dashed var(--border)}.revalidate-stamp{display:inline-block;margin-top:.1rem;font-size:.55rem;font-weight:600;line-height:1;text-transform:uppercase;letter-spacing:.03em;padding:.14rem .3rem;border-radius:3px;background:transparent;color:var(--muted);border:1px solid var(--border);white-space:nowrap;&.confirmed{color:var(--critical);border-color:rgb(from var(--critical) r g b / .55)}&.partial{color:var(--yellow);border-color:rgb(from var(--yellow) r g b / .55)}&.unknown{color:var(--warning);border-color:rgb(from var(--warning) r g b / .55)}}.evidence-list{margin:.25rem 0 0;padding-left:1.6rem;display:flex;flex-direction:column;gap:.15rem;>li{position:relative}& li::marker{color:var(--muted);font-size:.9em}>li.current:before{content:"";position:absolute;left:-1.5rem;top:.58em;width:.35rem;height:.35rem;border-radius:50%;background:var(--accent)}>li.current::marker{color:var(--accent)}& li:has(.evidence-note):not(:last-child){margin-bottom:.3rem}}.evidence-ref{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.92em;overflow-wrap:anywhere;color:var(--accent);text-decoration:none;&:is(a,[role=link]):hover{text-decoration:underline}&:focus-visible{outline:1px solid var(--accent);outline-offset:1px;border-radius:var(--ui-radius, 2px)}}:is(.line-num a,.evidence-ref,.gh-ref-btn){cursor:default}span.evidence-ref:not([role]){color:var(--muted)}.evidence-note{white-space:pre-wrap;line-height:1.5;color:rgb(from var(--text) r g b / .78);margin-top:.1rem}.desc-title a,.desc a,.section-body a,.conf-reason a,.revalidate-verdict a{color:var(--accent);text-decoration:none;&:hover{text-decoration:underline}}.inline-quote{background:rgb(from var(--accent) r g b / .1);padding:1px;border-radius:3px;color:var(--text)}.inline-code{background:var(--surface-active);border-radius:3px;border:1px solid var(--border);padding:0 .25em;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.9em;color:var(--text)}.code-block:not(.token){white-space:normal;margin:.5rem 0;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);background:rgb(from var(--text) r g b / .05);overflow:hidden;width:fit-content;max-width:100%;.code-block-lang{padding:.15rem .5rem;border-bottom:1px solid var(--border);color:var(--muted);font-size:.62rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em}& pre{margin:0;padding:.45rem .6rem;overflow-x:auto;white-space:pre;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.85em;line-height:1.5;color:var(--text)}& code{font:inherit}}.line-row{display:flex;justify-content:space-between;align-items:baseline;gap:.5rem;flex-wrap:wrap;padding-right:var(--finding-line-end-inset, 0);position:relative}.run-meta{color:var(--muted);font-size:.65rem}.finding-code-btn{display:inline-block;margin-top:.35rem;padding:.1rem .45rem;background:transparent;border:1px solid var(--border);border-radius:var(--ui-radius, 999px);color:var(--muted);font:inherit;font-size:.65rem;font-weight:500;white-space:nowrap}.finding-code-btn:hover{border-color:var(--accent);color:var(--accent)}.marks{display:flex;gap:.35rem;justify-content:flex-end;margin-top:.4rem;align-items:center;position:var(--finding-marks-position, static);bottom:0;background:var(--finding-marks-bg, transparent);padding-bottom:var(--finding-marks-pad-bottom, 0);padding-left:4.75rem;user-select:none}.finding-left{align-self:start;text-align:center;min-width:4rem;padding-top:var(--finding-left-inset, 0);position:var(--finding-left-position, relative);top:var(--finding-mark-sticky-top, 0);.value-label:last-child{margin-bottom:0}}:host(:not([popup])) .finding-left{padding-top:calc(var(--finding-left-inset, 0px) + 2px)}.conf-score{font-size:.75rem;color:var(--muted);margin-top:.3rem;& strong{color:var(--text);font-size:.85rem}}.conf-ring{--col: var(--muted);position:relative;width:3rem;height:3rem;margin:.7rem auto .15rem;display:flex;align-items:center;justify-content:center;& svg{position:absolute;inset:0;width:100%;height:100%;transform:rotate(-90deg)}& circle{fill:none;stroke-width:4}.conf-ring-track{stroke:var(--border)}.conf-ring-arc{stroke:var(--col);stroke-linecap:round}& span{position:relative;z-index:1;font-size:.8rem;font-weight:700;color:var(--text);font-variant-numeric:tabular-nums}& small{font-size:.55rem;color:var(--muted);font-weight:500}&.critical{--col: var(--critical)}&.high{--col: var(--high)}&.medium{--col: var(--medium)}&.low{--col: var(--low)}&.high_bug{--col: var(--high-bug)}&.bug{--col: var(--bug)}&.informational{--col: var(--info)}}.value-label{display:block;font-size:.45rem;color:var(--muted);text-transform:uppercase;letter-spacing:.04em;margin-top:.1rem;margin-bottom:.3rem;font-weight:500}.print-case-label{display:none}.badge,.tabs,.tab,.value-label,.run-meta,.conf-ring{cursor:default;user-select:none}.severity-reason{margin-top:.4rem;padding-top:.35rem;border-top:1px dashed var(--border);font-size:.82em;font-style:italic;color:var(--muted)}.severity-reason-label{font-style:normal;font-weight:600;text-transform:uppercase;font-size:.85em;letter-spacing:.04em;margin-right:.35rem}.duplicates-block .file-icon{flex-shrink:0}:host([context="focus"]) .triage-menu-wrap>.mark-triage-menu{display:none}:host([context="focus"]) .triage-menu-wrap{display:inline-flex}:host([context="focus"]) .triage-menu[popover]{position:static;inset:auto;display:inline-flex!important;flex-flow:row wrap;margin:0;padding:0;background:transparent;border:0;border-radius:0;box-shadow:none;min-width:0;gap:.25rem}:host([context="focus"]) .triage-menu-item{background:transparent;border:1px solid var(--border);padding:.2rem .5rem;border-radius:var(--ui-radius, 3px);font-size:.72rem;font-weight:500;text-transform:uppercase;letter-spacing:.04em}:host([context="focus"]) .triage-menu-item.active{background:rgb(from var(--accent) r g b / .12);border-color:var(--accent);color:var(--accent)}:host([context="focus"]) .triage-menu-item:not(:disabled):hover{background:var(--surface-active)}:host([context="focus"]) .triage-menu-inprogress.active{background:rgb(from var(--warning, #d97706) r g b / .12);border-color:var(--warning, #d97706);color:var(--warning, #d97706)}:host([context="focus"]) .triage-menu-fixed.active{background:rgb(from var(--green, #4ade80) r g b / .12);border-color:var(--green, #4ade80);color:var(--green, #4ade80)}:host([context="focus"]) .triage-menu-deleted.active{background:rgb(from var(--critical) r g b / .12);border-color:var(--critical);color:var(--critical)}:host([context="focus"]) .triage-menu-item.active:before{content:"";margin:0}:host([context="focus"]) .marks{gap:.5rem;margin-top:var(--finding-marks-margin-top, .65rem);padding-left:0;padding-top:.55rem;border-top:1px solid var(--border);flex-wrap:wrap}:host([context="focus"]) .marks-commit-row{padding-left:0}:host([context="focus"]) .mark-comment,:host([context="focus"]) .mark-fix,:host([context="focus"]) .mark-flag,:host([context="focus"]) .mark-copy,:host([context="focus"]) .mark-link,:host([context="focus"]) .mark-issue,:host([context="focus"]) .mark-claude{height:1.75rem;padding:0 .55rem;gap:.35rem;display:inline-flex;align-items:center;font-size:.72rem}:host([context="focus"]) .mark-btn-label{color:inherit;font-weight:500;letter-spacing:.02em}.finding-top-marks{position:absolute;top:calc(var(--finding-left-inset, 0px) - var(--finding-mark-inset, .5rem));left:calc(.75rem - var(--finding-mark-inset, .5rem));display:grid;grid-template-columns:24px 12px;column-gap:31px;&.color-red{color:var(--marker-red)}&.color-blue{color:var(--marker-blue)}&.color-green{color:var(--marker-green)}&.color-gray{color:var(--marker-gray)}}.finding-color-mark{grid-column:1;display:block;width:24px;height:12px;border-radius:var(--ui-radius, 0 0 6px 6px);background:currentcolor;box-shadow:inset 0 0 0 1px rgb(from var(--text) r g b / .15)}.finding-bookmark-mark{grid-column:2;display:block;width:12px;height:12px;background:var(--bookmark-color);clip-path:polygon(0 0,100% 0,100% 100%,50% 75%,0 100%)}:host(:not([popup])) :is(.finding-color-mark,.finding-bookmark-mark){height:10px}.comment-block,.fix-block{margin-top:.5rem;padding:.35rem .55rem;border-left:3px solid var(--accent);background:rgb(from var(--accent) r g b / .08);border-radius:var(--ui-radius, 0 4px 4px 0);font-size:.82rem;color:var(--text)}.comment-block{white-space:pre-wrap;& a{color:var(--accent);text-decoration:none}& a:hover{text-decoration:underline}& a.comment-self-ref{text-decoration:underline dotted;text-underline-offset:2px}& a.comment-self-ref:hover{text-decoration:underline solid}}.comment-block:has(.managed-comment){white-space:normal}.fix-block{word-break:break-all;& a{color:var(--accent);text-decoration:none}& a:hover{text-decoration:underline}}.fix-block:has(managed-fix-link){display:flex;align-items:center;gap:.6rem;padding:.45rem .65rem;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);background:rgb(from var(--muted) r g b / .04);word-break:normal;.fix-label{flex:none;font-size:.75rem;font-weight:500}& managed-fix-link{flex:1;min-width:0}}.duplicates-block{display:flex;align-items:baseline;flex-wrap:wrap;gap:.1rem .4rem;margin-top:.5rem;padding:.35rem .55rem;border-left:3px solid var(--muted);background:rgb(from var(--muted) r g b / .1);border-radius:var(--ui-radius, 0 4px 4px 0);font-size:.82rem;color:var(--text);.duplicates-label{color:var(--muted);font-weight:600}& a.duplicate-ref{display:inline-flex;align-items:center;gap:.25rem;color:var(--accent);text-decoration:none}& a.duplicate-ref .duplicate-ref-id{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.78rem;text-decoration:underline dotted;text-underline-offset:2px}& a.duplicate-ref:hover .duplicate-ref-id{text-decoration:underline solid}}.comment-label,.fix-label{color:var(--muted);font-weight:600;margin-right:.35rem}.line-num{color:var(--muted);font-size:.8rem}.line-num a{color:inherit;text-decoration:none}.npm-link{display:inline-block;padding:0 .4rem;border:1px solid var(--border);border-radius:var(--ui-radius, 3px);font-size:.72rem;font-weight:500;color:var(--muted);text-decoration:none}.npm-link:hover{border-color:var(--accent);color:var(--accent)}@media print{.card{break-inside:var(--finding-print-break, avoid);box-decoration-break:clone;padding:.45rem .25rem}.finding-code-btn,.mark-copy,.mark-link,.mark-issue,.mark-claude{display:none!important}.npm-link{border:0;padding:0}:host(.triage-fixed),:host(.triage-invalid),:host(.triage-deleted),:host(.triage-ignored){opacity:1}:host(.link-target) .card{animation:none;box-shadow:none!important}:host(.multi-case) .card:before{content:"Multiple reports of one finding";display:block;font-size:.7rem;font-weight:700;color:#555;text-transform:uppercase;letter-spacing:.06em;border-bottom:1px solid #bbb;padding-bottom:.2rem;margin-bottom:.35rem;-webkit-print-color-adjust:exact;print-color-adjust:exact}.marks,.tabs{display:none!important}.tab-body{display:grid!important;break-inside:var(--finding-print-break, avoid)}:host(.multi-case) .tab-body{break-inside:auto}:host(.multi-case) .tab-body+.tab-body{break-inside:avoid}.tab-body+.tab-body{margin-top:.5rem;padding-top:.5rem;border-top:1px dashed #999}:host([print-one-sample]) .tab-body:not(.active),:host([print-one-sample]) .print-case-label,:host([print-one-sample]) .card:before{display:none!important}:host([print-one-sample]) .tab-body.active{margin-top:0;padding-top:0;border-top:0;break-inside:var(--finding-print-break, avoid)}.finding-body{display:flex;flex-direction:column;>*{flex-shrink:0}}.line-row,.desc-title,.conf-reason,.severity-reason{break-inside:avoid}.section-label{break-after:avoid}.desc,.section-body{orphans:2;widows:2}.section,.recommendation,.evidence{break-inside:avoid}.evidence{order:99}.evidence>summary{break-after:avoid}.evidence-list>li{break-inside:avoid}:host([in-group].multi-case:not([print-one-sample])) .tab-body .line-row{display:flex}:host([in-group]:is(:not(.multi-case),[print-one-sample])) .line-row+*{margin-top:0}:host([in-group]:is(:not(.multi-case),[print-one-sample])) .line-row+.conf-reason{padding-top:0;border-top:0}.line-row .discovered-in{flex-basis:100%;order:99}.print-case-label{display:block;grid-column:1 / -1;break-after:avoid;font-size:.65rem;font-weight:600;color:#555;background:#eee;padding:.1rem .35rem;border-radius:3px;margin-bottom:.25rem;letter-spacing:.04em;-webkit-print-color-adjust:exact;print-color-adjust:exact}.value-label{color:#777}.badge{-webkit-print-color-adjust:exact;print-color-adjust:exact;&.critical{background:#a30b0f!important;color:#fff!important}&.high{background:#b8400a!important;color:#fff!important}&.medium{background:#855107!important;color:#fff!important}&.low{background:#374151!important;color:#fff!important}&.high_bug{background:#7a3e0c!important;color:#fff!important}&.bug{background:#4d4538!important;color:#fff!important}&.informational{background:#0550ae!important;color:#fff!important}}.badge-orig{background:transparent!important;color:#555!important;border-color:#999!important}.badge-varies,.revalidate-stamp{color:#555!important;border-color:#999!important}.badge-arrow,.badge-corr-mark,.badge-pre,.severity-reason{color:#555!important}a,.line-num,.line-num a,.desc-title a,.desc a,.section-body a,.conf-reason a,.revalidate-verdict a,.evidence-ref{color:inherit}details:not([open])>:not(summary){display:block}details::details-content{content-visibility:visible}summary.section-label{cursor:default;&:after{display:none}}.code-preview-btn,.gh-ref-btn{display:none}.inline-code{border:0;background:transparent}.code-block:not(.token){background:transparent;border-color:#bbb;.code-block-lang{color:#555;border-bottom-color:#bbb}& pre{white-space:pre-wrap;overflow:visible}.token{color:#333!important}.token.comment,.token.prolog,.token.cdata{color:#666!important}}}
|
|
45
|
+
`;var Hm=["finding","is-critical","mark-red","mark-blue","mark-green","mark-gray","has-conflict","triage-inprogress","triage-fixed","triage-invalid","triage-deleted","triage-ignored","multi-case"],fs=class extends D{static properties={group:{attribute:!1},inGroup:{type:Boolean,attribute:"in-group",reflect:!0},context:{type:String,reflect:!0},lazy:{type:Boolean}};static styles=[M($t),M(vn),M(gn),M(ep),M(yn),M(bn),M(kt),M(Ei)];_near=!1;_watched=null;constructor(){super(),this.group=null,this.inGroup=!1,this.context=null,this.lazy=!1}render(){if(!this.group)return a``;if(this.dataset.gid=Qe(this.group),this.lazy&&!this._near)return this.classList.add("finding"),a`<div class="card card-pending" aria-busy="true"></div>`;let e=new Set(kc(this.group));for(let t of Hm)this.classList.toggle(t,e.has(t));return a`<div class="card">${$c(this.group,{context:this.context})}</div>`}updated(){this.classList.toggle("content-ready",!!this.group&&(!this.lazy||this._near));for(let e of this.renderRoot.querySelectorAll(".code-preview")){let t=e.dataset.revealedTo;if(t!==void 0&&Math.round(e.scrollTop)!==Number(t))continue;let n=e.querySelectorAll(".code-preview-lineno.cited");n.length!==0&&(qi(e,n),e.dataset.revealedTo=String(Math.round(e.scrollTop)))}}connectedCallback(){if(super.connectedCallback(),ht(this.renderRoot),this.lazy){this._watched=this.closest(".flat-group")??this,xt(this._watched,e=>this._onNear(e));return}this.hasUpdated&&this.requestUpdate()}disconnectedCallback(){this._watched&&(Le(this._watched),this._watched=null),super.disconnectedCallback()}_onNear(e){e?(this._watched&&(Le(this._watched),this._watched=null),this._near=!0,this.requestUpdate()):this._near&&(this._near=!1,this.requestUpdate())}ensureRendered({sync:e=!1}={}){return this.lazy&&!this._near&&this._onNear(!0),e&&this.isConnected&&this.isUpdatePending&&this.performUpdate(),this.updateComplete}};customElements.define("finding-card",fs);var tp=`:host{display:inline-flex;gap:4px;align-items:center;flex-shrink:0}button{width:14px;height:14px;user-select:none;padding:0;background:transparent;border:1.5px solid currentcolor;border-radius:var(--ui-radius, 50%);opacity:.55;transition:opacity .12s,transform .12s}button:not(:disabled):hover{opacity:1;transform:scale(1.12)}button:disabled{opacity:.25}button.active{background:currentcolor;opacity:1;box-shadow:0 0 0 2px var(--surface),0 0 0 3px currentcolor}.color-red{color:var(--marker-red)}.color-blue{color:var(--marker-blue)}.color-green{color:var(--marker-green)}.color-gray{color:var(--marker-gray)}
|
|
46
|
+
`;var jm=["red","blue","green","gray"],gs=class extends U{static properties={selected:{type:String},disabled:{type:Boolean}};static styles=M(tp);constructor(){super(),this.selected=null,this.disabled=!1}render(){return a`${jm.map(e=>a`<button type="button" class="${`color-${e}${this.selected===e?" active":""}`}" data-color="${e}" aria-label="${`mark ${e}`}" ?disabled="${this.disabled}" @click="${this._onClick}"></button>`)}`}_onClick=e=>{if(this.disabled)return;let t=e.currentTarget.dataset.color;this.dispatchEvent(new CustomEvent("mark-color",{detail:{color:t},bubbles:!0,composed:!0}))}};customElements.define("color-marker",gs);var bs=class extends D{static properties={rangeDisabled:{type:Boolean,attribute:"range-disabled"},revalidateOptions:{attribute:!1},hasPartial:{type:Boolean,attribute:"has-partial"}};createRenderRoot(){return this}constructor(){super(),this.rangeDisabled=!1,this.revalidateOptions=[],this.hasPartial=!1}render(){let e=l.filterConfMin,t=l.filterConfMax,n=this.revalidateOptions??[],r=this.rangeDisabled,s=n.length>0&&!!l.filterRevalidate,o=r?"No confidence range: some findings on screen carry no confidence score":m;return a`<span class="${I({"conf-range-label":!0,replaced:s,disabled:r})}" data-tooltip="${o}">Confidence</span> <span class="${I({"conf-range":!0,replaced:s,disabled:r})}" ?inert="${r||s}"><range-slider id="conf-range" min="0" max="10" step="1" low="${e}" high="${t}" aria-label="Confidence range"></range-slider><conf-range-mirror id="conf-range-vals" class="conf-vals" for="conf-range" .low="${e}" .high="${t}"></conf-range-mirror></span>${n.length>0?a`<revalidate-filter class="${I({replaces:s})}" .options="${n}" ?has-partial="${this.hasPartial}"></revalidate-filter>`:m}`}};customElements.define("conf-filter",bs);var ip={files:"Filter files\u2026",code:"Search code\u2026",issues:"Search issues\u2026",largest:"Filter largest files\u2026"},np={files:"Filter files",code:"Search code",issues:"Search issues",largest:"Largest files"},Vm=a`<svg class="bundle-code-search-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="6.5" cy="6.5" r="4.5"/><path d="M9.7 9.7L13 13" stroke-linecap="round"/></svg>`,Km={files:Ui,code:ji,issues:a`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.3" aria-hidden="true"><circle cx="8" cy="8" r="6"/><path d="M8 4.8v3.6" stroke-linecap="round"/><circle cx="8" cy="11" r=".7" fill="currentColor" stroke="none"/></svg>`,largest:a`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true"><path d="M2.5 4h11M2.5 8h7.5M2.5 12h4"/></svg>`},vs=class extends D{static properties={modes:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.modes=[]}render(){let e=l.bundleCodeSearchQuery,t=l.bundleCodeSearchMode,n=this.modes.includes(t)?t:"files",r=ip[n]??ip.files;return a`${Vm} <input type="text" class="bundle-code-search-input" placeholder="${r}" aria-label="${r}" .value="${j(e)}" @input="${this._onInput}"> ${e?a`<button type="button" class="bundle-code-search-clear" aria-label="Clear search" @click="${this._onClear}">×</button>`:m} ${this.modes.length>0?a`<span class="bundle-code-search-modes" role="tablist">${this.modes.map(s=>a`<button type="button" class="${I({"bundle-code-search-mode":!0,active:n===s})}" role="tab" aria-selected="${String(n===s)}" data-tooltip="${np[s]??s}" aria-label="${np[s]??s}" @click="${()=>this._selectMode(s)}">${Km[s]??m}</button>`)}</span>`:m}`}_onInput=e=>{this._dispatchInput(e.target.value)};_onClear=()=>{this._dispatchInput("")};_dispatchInput(e){this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:"bundle-code",value:e},bubbles:!0,composed:!0}))}_selectMode(e){this.dispatchEvent(new CustomEvent("bundle-search-mode-change",{detail:{mode:e},bubbles:!0,composed:!0}))}};customElements.define("bundle-code-search",vs);var Tt=320,ys=class extends HTMLElement{constructor(){super(),this._drag=null,this.addEventListener("pointerdown",e=>this._startDrag(e)),this.addEventListener("pointermove",e=>{this._drag?.id===e.pointerId&&(Tt=this._apply(this._drag.width+e.clientX-this._drag.x))});for(let e of["pointerup","pointercancel","lostpointercapture"])this.addEventListener(e,t=>{this._drag?.id===t.pointerId&&this._endDrag()});this.addEventListener("keydown",e=>this._onKeyDown(e)),this.addEventListener("dblclick",()=>{Tt=320,this._apply(Tt)})}connectedCallback(){this._view=this.closest(".bundle-code-view"),this._view&&(this._observer=new ResizeObserver(()=>this._apply(Tt)),this._observer.observe(this._view),this._apply(Tt))}disconnectedCallback(){this._observer?.disconnect(),this._endDrag(),this._view=null}_bounds(){let e=this._view.getBoundingClientRect().width;return{min:Math.min(180,e*.4),max:e*.6}}_apply(e){if(!this._view)return e;let{min:t,max:n}=this._bounds();if(n===0)return e;let r=Math.max(t,Math.min(n,e));return this._view.style.setProperty("--bundle-code-rail-width",`${r}px`),this.setAttribute("aria-valuemin",String(Math.round(t))),this.setAttribute("aria-valuemax",String(Math.round(n))),this.setAttribute("aria-valuenow",String(Math.round(r))),this.setAttribute("aria-valuetext",`${Math.round(r)} pixels`),r}_startDrag(e){if(e.button!==0||!e.isPrimary||this._drag||!this._view)return;e.preventDefault();let t=this._view.querySelector(".bundle-code-rail").getBoundingClientRect().width;this._drag={id:e.pointerId,x:e.clientX,width:t},this.setPointerCapture(e.pointerId),this.classList.add("dragging")}_endDrag(){if(!this._drag)return;let{id:e}=this._drag;this._drag=null,this.classList.remove("dragging"),this.hasPointerCapture(e)&&this.releasePointerCapture(e)}_onKeyDown(e){if(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||!this._view)return;let t=this._view.querySelector(".bundle-code-rail").getBoundingClientRect().width,{min:n,max:r}=this._bounds(),s={ArrowLeft:t-16,ArrowRight:t+16,Home:n,End:r}[e.key];s!==void 0&&(e.preventDefault(),e.stopPropagation(),Tt=this._apply(s))}};customElements.define("bundle-code-splitter",ys);var _s=class extends HTMLElement{connectedCallback(){this._schedule=()=>{this._frame||(this._frame=requestAnimationFrame(()=>this._update()))},this._resize=new ResizeObserver(this._schedule),this._resize.observe(this),this._mutation=new MutationObserver(this._schedule),this._mutation.observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["hidden"]}),this._mode=matchMedia("(display-mode: window-controls-overlay)"),this._mode.addEventListener("change",this._schedule),navigator.windowControlsOverlay?.addEventListener("geometrychange",this._schedule),this._schedule()}disconnectedCallback(){cancelAnimationFrame(this._frame),this._frame=0,this._resize.disconnect(),this._mutation.disconnect(),this._mode.removeEventListener("change",this._schedule),navigator.windowControlsOverlay?.removeEventListener("geometrychange",this._schedule)}_update(){this._frame=0,this.classList.remove("boxed");let e=this.querySelector(".bundles-slide-bar");if(!e)return;this._resize.observe(e);let t=this.querySelector(".bundles-slide-tabs");t&&this._resize.observe(t);let n=parseFloat(getComputedStyle(this,"::before").height)||0;if(!n)return;let r=this.getBoundingClientRect(),s=e.getBoundingClientRect();this.classList.toggle("boxed",s.top>r.top+1||s.height>n+1)}};customElements.define("bundle-slide-header",_s);var Gm=a`<svg class="bundle-search-icon" viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="6.5" cy="6.5" r="4.5"/><path d="M9.7 9.7L13 13" stroke-linecap="round"/></svg>`,ws=class extends D{createRenderRoot(){return this}render(){let e=l.bundleSearchQuery,t=l.bundleSearchRegex,n=l.bundleSearchCase,r=t?"Search by regular expression\u2026":"Search all source\u2026";return a`${Gm} <input type="text" class="bundle-search-input" placeholder="${r}" aria-label="${r}" spellcheck="false" autocapitalize="off" autocomplete="off" .value="${j(e)}" @input="${this._onInput}"> ${e?a`<button type="button" class="bundle-search-clear" aria-label="Clear search" @click="${this._onClear}">×</button>`:m} <span class="bundle-search-mods"><button type="button" class="${I({"bundle-search-mod":!0,active:n})}" data-tooltip="${n?"Case-sensitive on \u2014 click to ignore case":"Match case"}" aria-label="Match case" aria-pressed="${String(n)}" @click="${this._onToggleCase}">Aa</button> <button type="button" class="${I({"bundle-search-mod":!0,active:t})}" data-tooltip="${t?"Regular expression on \u2014 click for plain text":"Match by regular expression"}" aria-label="Match by regular expression" aria-pressed="${String(t)}" @click="${this._onToggleRegex}">.*</button></span>`}_onInput=e=>{this._dispatchInput(e.target.value)};_onClear=()=>{this._dispatchInput("")};_dispatchInput(e){this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:"bundle-search",value:e},bubbles:!0,composed:!0}))}_onToggleRegex=()=>{this.dispatchEvent(new CustomEvent("bundle-search-regex-toggle",{bubbles:!0,composed:!0}))};_onToggleCase=()=>{this.dispatchEvent(new CustomEvent("bundle-search-case-toggle",{bubbles:!0,composed:!0}))}};customElements.define("bundle-search",ws);function Se(i,e,t){let n=e[t];return n||console.warn(`<${i}>: unknown kind ${JSON.stringify(t)}; expected one of ${Object.keys(e).map(r=>JSON.stringify(r)).join(", ")}.`),n}var Wm={packages:{stateKey:"packagesSearchQuery",label:"Filter packages"},repositories:{stateKey:"repositoriesSearchQuery",label:"Filter repositories"}},ks=class extends D{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let e=Se("entity-search",Wm,this.kind);return e?a`<input type="search" class="packages-search" placeholder="${`${e.label}\u2026`}" aria-label="${e.label}" .value="${j(l[e.stateKey])}" @input="${this._onInput}">`:m}_onInput=e=>{this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:this.kind,value:e.target.value},bubbles:!0,composed:!0}))}};customElements.define("entity-search",ks);var Ym=[["findings-desc","Findings \u2193"],["files-desc","Files \u2193"],["reports-desc","Reports \u2193"],["name-asc","Name A\u2192Z"]],Jm={packages:{stateKey:"packagesSortBy",aria:"Sort packages"},repositories:{stateKey:"repositoriesSortBy",aria:"Sort repositories"}},$s=class extends D{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let e=Se("entity-sort",Jm,this.kind);return e?a`<select class="packages-sort" aria-label="${e.aria}" .value="${j(l[e.stateKey])}" @change="${this._onChange}">${Ym.map(([t,n])=>a`<option value="${t}" ?selected="${l[e.stateKey]===t}">${n}</option>`)}</select>`:m}_onChange=e=>{this.dispatchEvent(new CustomEvent("sort-change",{detail:{kind:this.kind,value:e.target.value},bubbles:!0,composed:!0}))}};customElements.define("entity-sort",$s);var xs=class extends D{static properties={showFile:{type:Boolean,attribute:"show-file"},showConfidence:{type:Boolean,attribute:"show-confidence"},showPriority:{type:Boolean,attribute:"show-priority"}};createRenderRoot(){return this}constructor(){super(),this.showFile=!1,this.showConfidence=!1,this.showPriority=!1}render(){let e=(t,n)=>a`<option value="${t}" ?selected="${l.sortBy===t}">${n}</option>`;return a`<select class="sort-select" aria-label="Sort findings" .value="${j(l.sortBy)}" @change="${this._onChange}">${e("severity","Severity \u2193")} ${this.showFile?e("file","File \u2191"):m} ${this.showConfidence?a`${e("confidence-desc","Confidence \u2193")}${e("confidence-asc","Confidence \u2191")}`:m} ${this.showPriority?a`${e("priority-desc","Priority \u2193")}${e("priority-asc","Priority \u2191")}`:m}</select>`}_onChange=e=>{this.dispatchEvent(new CustomEvent("sort-change",{detail:{kind:"findings",value:e.target.value},bubbles:!0,composed:!0}))}};customElements.define("findings-sort",xs);var rp=`:host{display:inline-flex;align-items:center;width:8.5rem;height:16px;--rs-thumb-size: 14px;--rs-track-height: 3px;--rs-rail: rgb(from currentcolor r g b / .25);--rs-fill: var(--accent, currentColor)}.track-wrap{position:relative;flex:1;height:var(--rs-thumb-size)}.track{position:absolute;left:0;right:0;top:50%;height:var(--rs-track-height);transform:translateY(-50%);border-radius:var(--ui-radius, 99px);background:linear-gradient(to right,var(--rs-rail) 0,var(--rs-rail) var(--low, 0%),var(--rs-fill) var(--low, 0%),var(--rs-fill) var(--high, 100%),var(--rs-rail) var(--high, 100%))}input[type=range]{appearance:none;-webkit-appearance:none;position:absolute;left:0;right:0;top:0;width:100%;height:var(--rs-thumb-size);background:transparent;pointer-events:none;margin:0;padding:0;outline:none}input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;pointer-events:auto;width:var(--rs-thumb-size);height:var(--rs-thumb-size);border-radius:50%;background:var(--rs-fill);border:0;box-shadow:0 1px 3px #00000080}input[type=range]::-moz-range-thumb{pointer-events:auto;width:var(--rs-thumb-size);height:var(--rs-thumb-size);border-radius:50%;background:var(--rs-fill);border:0;box-shadow:0 1px 3px #00000080}input[type=range]::-webkit-slider-runnable-track{background:transparent;height:var(--rs-thumb-size)}
|
|
47
|
+
`;var Ss=class extends U{static properties={min:{type:Number},max:{type:Number},step:{type:Number},low:{type:Number},high:{type:Number}};static styles=M(rp);constructor(){super(),this.min=0,this.max=100,this.step=1,this.low=0,this.high=100}willUpdate(){this.low<this.min&&(this.low=this.min),this.high>this.max&&(this.high=this.max),this.low>this.high&&(this.low=this.high)}render(){let e=this.max-this.min||1,t=(this.low-this.min)/e*100,n=(this.high-this.min)/e*100;return a`<div class="track-wrap" style="${`--low:${t}%;--high:${n}%`}"><div class="track"></div><input type="range" min="${this.min}" max="${this.max}" step="${this.step}" @input="${this._onInput}" @change="${this._onChange}"> <input type="range" min="${this.min}" max="${this.max}" step="${this.step}" @input="${this._onInput}" @change="${this._onChange}"></div>`}firstUpdated(){this._inputs=[...this.renderRoot.querySelectorAll('input[type="range"]')],this._inputs[0].value=this.low,this._inputs[1].value=this.high}updated(e){if(!this._inputs||!(e.has("low")||e.has("high")))return;let t=this._inputs.map(o=>Number(o.value)),n=t[0]>t[1],r=n?1:0,s=n?0:1;this.low!==t[r]&&(this._inputs[r].value=this.low),this.high!==t[s]&&(this._inputs[s].value=this.high)}_onInput=()=>{let e=Number(this._inputs[0].value),t=Number(this._inputs[1].value);this.low=Math.min(e,t),this.high=Math.max(e,t),this._emit("range-input")};_onChange=()=>{this._emit("range-change")};_emit(e){this.dispatchEvent(new CustomEvent(e,{detail:{low:this.low,high:this.high},bubbles:!0,composed:!0}))}};customElements.define("range-slider",Ss);var Cs=class extends U{static properties={low:{type:Number},high:{type:Number},for:{type:String}};createRenderRoot(){return this}constructor(){super(),this.low=0,this.high=10,this.for="conf-range",this._dragging=!1,this._liveLow=0,this._liveHigh=10}connectedCallback(){super.connectedCallback(),document.addEventListener("range-input",this._onRangeInput),document.addEventListener("range-change",this._onRangeChange)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("range-input",this._onRangeInput),document.removeEventListener("range-change",this._onRangeChange)}willUpdate(e){this._dragging&&(e.has("low")&&this.low!==this._liveLow&&(this.low=this._liveLow),e.has("high")&&this.high!==this._liveHigh&&(this.high=this._liveHigh))}_onRangeInput=e=>{e.target?.id===this.for&&(this._dragging=!0,this._liveLow=e.detail.low,this._liveHigh=e.detail.high,this.low=e.detail.low,this.high=e.detail.high)};_onRangeChange=e=>{e.target?.id===this.for&&(this._dragging=!1)};render(){return a`<span>${this.low}</span><span class="dash">–</span><span>${this.high}</span>`}};customElements.define("conf-range-mirror",Cs);var sp=`dialog{max-width:560px;width:min(94vw,560px)}header h3{margin:0 0 .25rem}header p{margin:0 0 .9rem;color:var(--muted);font-size:.82rem}hr{border:0;border-top:1px solid var(--border);margin:.9rem 0}.section h4{margin:0 0 .25rem;font-size:.82rem;font-weight:600;text-transform:uppercase;letter-spacing:.08em;color:var(--muted)}.section p{margin:0 0 .55rem;color:var(--muted);font-size:.78rem}.section button{background:transparent;border:1px solid var(--border);color:var(--text);border-radius:var(--ui-radius, 5px);padding:.35rem .9rem;font:inherit;font-size:.8rem;&:hover{border-color:var(--accent);color:var(--accent)}&.primary{background:var(--accent);color:var(--surface);border-color:var(--accent)}&.primary:hover{filter:brightness(1.08)}&:disabled{opacity:.5}}input[type=file]{display:block;color:var(--text);font:inherit;font-size:.78rem;margin-bottom:.5rem}.error{margin:.5rem 0;padding:.4rem .6rem;border:1px solid var(--critical, #f87171);border-radius:var(--ui-radius, 5px);background:rgb(from var(--critical, #f87171) r g b / .07);color:var(--text);font-size:.78rem}.summary{margin:.5rem 0;font-size:.82rem;& strong{color:var(--text)}.meta{margin-left:.4rem;color:var(--muted);font-size:.74rem}}.mode{border:1px solid var(--border);border-radius:var(--ui-radius, 6px);padding:.55rem .7rem;margin:.55rem 0 .7rem;display:flex;flex-direction:column;gap:.35rem}.mode legend{padding:0 .35rem;font-size:.68rem;color:var(--muted);text-transform:uppercase;letter-spacing:.08em}.mode label{display:flex;align-items:flex-start;gap:.5rem;font-size:.82rem;& em{color:var(--muted);font-style:normal;font-size:.74rem}}.status{margin:.8rem 0 0;padding:.4rem .6rem;border-radius:5px;font-size:.78rem;&.status-ok{border:1px solid var(--accent);background:rgb(from var(--accent) r g b / .08);color:var(--text)}&.status-err{border:1px solid var(--critical, #f87171);background:rgb(from var(--critical, #f87171) r g b / .07);color:var(--text)}}.actions{display:flex;justify-content:flex-end;gap:.4rem;margin-top:.8rem;padding-top:.7rem;border-top:1px solid var(--border)}.actions button{background:transparent;border:1px solid var(--border);color:var(--text);border-radius:var(--ui-radius, 5px);padding:.3rem .8rem;font:inherit;font-size:.78rem;&:hover{border-color:var(--accent);color:var(--accent)}}
|
|
48
|
+
`;var Es=class extends q{static styles=[...q.styles,M(sp)];static properties={parsed:{state:!0},parseError:{state:!0},mode:{state:!0},busy:{state:!0},status:{state:!0}};constructor(){super(),this.parsed=null,this.parseError=null,this.mode="prefer-current",this.busy=!1,this.status=null}focusInitial(){this.renderRoot.querySelector("button.primary")?.focus()}async _onDownload(){this.busy=!0,this.status=null;try{let{blob:e,filename:t}=await bl();Ge(e,t),this.status={kind:"ok",text:`Downloaded ${t}`}}catch(e){this.status={kind:"err",text:`Export failed: ${e.message}`}}finally{this.busy=!1}}async _onFile(e){let t=e.target.files?.[0];if(this.parsed=null,this.parseError=null,this.status=null,!!t)try{this.parsed=await vl(t)}catch(n){this.parseError=n.message}}_onMode(e){this.mode=e.target.value}async _onApply(){if(!(!this.parsed||this.busy||Ut())){this.busy=!0,this.status=null;try{let e=await yl(this.parsed,this.mode);$(),this.status=e.repoUrlError?{kind:"err",text:`Applied ${e.triageEntries} triage entries (${this.mode}), but saving repo URLs failed: ${e.repoUrlError.message}`}:{kind:"ok",text:`Applied ${e.triageEntries} triage entries and ${e.repoUrls} repo URLs (${this.mode}).`},this.parsed=null;let t=this.renderRoot.querySelector('input[type="file"]');t&&(t.value="")}catch(e){this.status={kind:"err",text:`Import failed: ${e.message}`}}finally{this.busy=!1}}}render(){return a`<dialog @close="${this._onClose}"><header><h3>Triage backup</h3><p>Bundles every triage entry (markers, triage states, comments, fixes, per-report ignores) and all saved repo URLs into a single gzipped JSON file.</p></header><section class="section"><h4>Export</h4><p>Download the current triage + repo-URL set as a portable backup.</p><button type="button" class="primary" @click="${this._onDownload}" ?disabled="${this.busy}">${this.busy?"Working\u2026":"Download backup"}</button></section>${Ut()?m:this._importTemplate()} ${this.status?a`<div class="${`status status-${this.status.kind}`}">${this.status.text}</div>`:m}<footer class="actions"><button type="button" @click="${this._onClose}">Close</button></footer></dialog>`}_importTemplate(){let e=this.parsed;return a`<hr><section class="section"><h4>Import</h4><p>Pick a previously-exported backup. Nothing is applied until you click Apply.</p><input type="file" accept=".gz,application/gzip" @change="${this._onFile}" ?disabled="${this.busy}"> ${this.parseError?a`<div class="error">Failed to parse: ${this.parseError}</div>`:m} ${e?a`<div class="summary">Found <strong>${Object.keys(e.triage).length}</strong> triage entries and <strong>${Object.keys(e.repoUrls).length}</strong> repo URLs. ${e.exportedAt?a`<span class="meta">Exported ${e.exportedAt}.</span>`:m}</div><fieldset class="mode"><legend>Merge mode</legend><label><input type="radio" name="te-mode" value="prefer-current" .checked="${this.mode==="prefer-current"}" @change="${this._onMode}"> <span>Merge — keep current on conflict <em>(safest, only fills gaps)</em></span></label> <label><input type="radio" name="te-mode" value="prefer-imported" .checked="${this.mode==="prefer-imported"}" @change="${this._onMode}"> <span>Merge — prefer imported on conflict <em>(overwrites where both have a value)</em></span></label> <label><input type="radio" name="te-mode" value="replace" .checked="${this.mode==="replace"}" @change="${this._onMode}"> <span>Replace all <em>(drops every current persisted entry first — destructive)</em></span></label></fieldset><button type="button" class="primary" @click="${this._onApply}" ?disabled="${this.busy}">${this.busy?"Applying\u2026":"Apply import"}</button>`:m}</section>`}};customElements.define("triage-export-dialog",Es);function op(){return Y("triage-export-dialog")}var ap=`:host{display:inline-flex;vertical-align:middle;position:relative}.chip{display:inline-flex;align-items:center;gap:.375rem;cursor:default;user-select:none;position:relative;min-height:24px;box-sizing:border-box;padding:.125rem .375rem .125rem .5rem;background:var(--surface);border:var(--header-tag-border, 1px solid var(--border));border-radius:var(--ui-radius, 999px);color:var(--text);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.72rem;font-weight:500}.chip svg{color:var(--muted);flex-shrink:0}.chip.empty:hover{border-color:var(--accent)}.chip.empty .label{color:var(--muted);font-style:italic}.chip.readonly{padding-right:.5rem}.chip.copied:after{content:"Copied";position:absolute;inset:0;display:grid;place-items:center;background:var(--surface);backdrop-filter:var(--glass-blur);border-radius:var(--ui-radius, 999px);color:var(--text);font-weight:400;white-space:nowrap;pointer-events:none}.edit-btn{width:18px;height:18px;display:grid;place-items:center;padding:0;margin-left:.125rem;background:transparent;border:0;border-radius:var(--ui-radius, 4px);color:var(--muted)}.edit-btn:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}@media(display-mode:window-controls-overlay){.edit-btn,input{-webkit-app-region:no-drag;app-region:no-drag}}.chip[inert]{visibility:hidden;min-width:19rem}input{position:absolute;inset:0;box-sizing:border-box;padding:0 .55rem;background:var(--surface);border:1px solid var(--accent);border-radius:var(--ui-radius, 999px);color:var(--text);font:inherit;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.72rem;font-weight:400;outline:none}@media print{.chip{color:#000!important;border:0!important}.chip svg{color:#000!important}.edit-btn,input{display:none!important}}
|
|
49
|
+
`;var Ts=a`<svg viewBox="0 0 16 16" width="12" height="12" fill="currentColor" aria-hidden="true"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>`,lp=a`<svg viewBox="0 0 16 16" width="11" height="11" fill="currentColor" aria-hidden="true"><path d="M11.013 1.427a1.75 1.75 0 0 1 2.474 0l1.086 1.086a1.75 1.75 0 0 1 0 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 0 1-.927-.928l.929-3.25c.082-.286.235-.547.445-.758l8.61-8.61z"/></svg>`,Rs=class extends U{static properties={url:{type:String},editable:{type:Boolean,reflect:!0},editing:{type:Boolean,reflect:!0},_copied:{state:!0}};static styles=M(ap);constructor(){super(),this.url="",this.editable=!1,this.editing=!1,this._copied=!1,this._opener=""}render(){if(this.editable&&this.editing){let e=!!this.url,t=e?We(this.url):"Set repo";return a`<span class="${e?"chip":"chip empty"}" aria-hidden="true" inert>${Ts} <span class="label">${t}</span> <button type="button" class="edit-btn">${lp}</button> </span><input type="text" .value="${j(this.url)}" placeholder="user/repo or https://github.com/user/repo" @input="${this._onInput}" @focus="${this._onFocus}" @keydown="${this._onKeydown}" @blur="${this._onBlur}">`}if(this.editable){let e=!!this.url,t=e?We(this.url):"Set repo",n=e?this._copied?"chip copied":"chip":"chip empty";return a`<span class="${n}" @click="${e?null:this._onEdit}">${Ts} ${e?this._slugLabel(t):a`<span class="label">${t}</span>`} <button type="button" class="edit-btn" aria-label="Edit repo URL" @click="${this._onEdit}">${lp}</button></span>`}if(this.url){let e=this._copied?"chip readonly copied":"chip readonly";return a`<span class="${e}">${Ts} ${this._slugLabel(We(this.url))}</span>`}return m}_slugLabel(e){return a`<span class="label" @click="${this._onCopyLabel}">${e}</span>`}updated(e){if(e.has("editing")&&this.editing){let t=this.renderRoot.querySelector("input");t&&(t.focus(),t.select())}}_onEdit=e=>{e&&e.stopPropagation(),this._emit("repo-edit-start")};_onCopyLabel=e=>{e&&e.stopPropagation();let t=We(this.url);if(t)try{navigator.clipboard.writeText(t).then(()=>(this._copied=!0,setTimeout(()=>{this._copied=!1},1e3),null)).catch(()=>{})}catch{}};_onFocus=e=>{this._opener=e.target.value};_onInput=e=>{this.url=e.target.value,this._emit("repo-input",{url:this.url})};_onKeydown=e=>{e.key==="Enter"?(e.preventDefault(),this._emit("repo-commit",{url:this.url})):e.key==="Escape"&&(e.preventDefault(),this.url=this._opener,this._emit("repo-cancel",{url:this._opener}))};_onBlur=()=>{this.editing&&this._emit("repo-commit",{url:this.url})};_emit(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}};customElements.define("repo-chip",Rs);var ef=a`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path class="bubble" d="M2.5 3h11a.5.5 0 0 1 .5.5v6.5a.5.5 0 0 1-.5.5H8.4l-3 2.6V10.5H2.5a.5.5 0 0 1-.5-.5V3.5a.5.5 0 0 1 .5-.5z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,tf=a`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path class="wrench" d="M10.4 2.6a3 3 0 0 0-3.6 4.5L2 12l2 2 4.9-4.8a3 3 0 0 0 4.5-3.6l-1.8 1.8-1.5-.4-.4-1.5z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,nf=a`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path class="flag-cloth" d="M5 1.5h6v13l-3-2.7-3 2.7z" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linejoin="round"/></svg>`,rf=J(gi.replace('width="14" height="14"','width="12" height="12"')),sf=a`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-width="1.15" stroke-linecap="round" stroke-linejoin="round"><path d="M5 1.2 1.3 3.1v5.7L5 10.7l3.7-1.9V3.1Z M1.3 3.1 5 5l3.7-1.9 M5 5v5.7"/><path d="M11 5.2 7.3 7.1v5.7l3.7 1.9 3.7-1.9V7.1Z M7.3 7.1 11 9l3.7-1.9 M11 9v5.7"/></g></svg>`,of=a`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"><rect x="3.4" y="1.5" width="10" height="3.6" rx=".8"/><rect x="2.2" y="5.3" width="10" height="3.6" rx=".8"/><rect x="1" y="9.1" width="10" height="3.6" rx=".8"/></g></svg>`,af=a`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path d="M8 1.5 13 3.5v4c0 3-2.1 5.5-5 7-2.9-1.5-5-4-5-7v-4Z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,lf=[{key:"comment",glyph:ef,label:"commented",stateKey:"filterComment",hasKey:"hasComment"},{key:"fix",glyph:tf,label:"fixed",stateKey:"filterFix",hasKey:"hasFix"},{key:"flag",glyph:nf,label:"flagged",stateKey:"filterFlagged",hasKey:"hasFlagged"},{key:"duplicates",glyph:rf,label:"rows with duplicates in other reports",stateKey:"filterDuplicates",hasKey:"hasDuplicates"},{key:"cross-context",glyph:sf,label:"rows across multiple repos or packages",stateKey:"filterCrossContext",hasKey:"hasCrossContext"},{key:"app-stacked",glyph:of,label:"stacked App rows",stateKey:"filterAppStacked",hasKey:"hasAppStacked"},{key:"security",glyph:af,label:"security-related rows",stateKey:"filterSecurity",hasKey:"hasSecurityContrast"}],cp=new Set(["duplicates","cross-context","app-stacked","security"]),Ls=class extends D{static properties={group:{type:String},hasComment:{attribute:!1},hasFix:{attribute:!1},hasFlagged:{attribute:!1},hasDuplicates:{attribute:!1},hasCrossContext:{attribute:!1},hasAppStacked:{attribute:!1},hasSecurityContrast:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.group="marks",this.hasComment=!1,this.hasFix=!1,this.hasFlagged=!1,this.hasDuplicates=!1,this.hasCrossContext=!1,this.hasAppStacked=!1,this.hasSecurityContrast=!1}connectedCallback(){super.connectedCallback(),W(this,{role:"group","aria-label":this.group==="context"?"Finding row filters":"Annotation filter"})}render(){let e=lf.filter(n=>this.group==="context"===cp.has(n.key)).filter(n=>n.key==="security"?this.hasSecurityContrast:n.key==="duplicates"?!l.currentWorkspace&&(this.hasDuplicates||l[n.stateKey]):this[n.hasKey]||l[n.stateKey]);if(e.length===0)return m;let t=n=>{let r=l[n.stateKey],s=cp.has(n.key)?n.label:`${n.label} findings`,o=r==="with"?`Showing only ${s} \u2014 click to exclude them`:r==="without"?`Excluding ${s} \u2014 click to clear`:`Show only ${s}`;return a`<button type="button" class="${I({"annotation-chip":!0,"sel-with":r==="with","sel-without":r==="without"})}" aria-label="${o}" aria-pressed="${String(r!=="")}" @click="${()=>this._toggle(n.key)}">${n.glyph}</button>`};return a`${e.map(t)}`}_toggle(e){this.dispatchEvent(new CustomEvent("annotation-filter-toggle",{detail:{key:e},bubbles:!0,composed:!0}))}};customElements.define("annotation-filter",Ls);var cf=[["critical","Critical"],["high","High"],["medium","Medium"],["low","Low"],["high_bug","High bug"],["bug","Bug"],["informational","Info"]],Ms=class extends D{static properties={counts:{attribute:!1},selected:{attribute:!1},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.selected=[],this.kind="findings"}connectedCallback(){super.connectedCallback(),W(this,{role:"group","aria-label":"Filter by severity"})}render(){let e=this.kind==="graph"?new Set(this.selected):l.filterSeverities,t=cf.filter(([n])=>(this.counts[n]??0)||e.has(n));return t.length===0?m:a`${t.map(([n,r])=>{let s=this.counts[n]??0,o=e.has(n);return a`<button type="button" class="${I({"sev-chip":!0,[n]:!0,active:o})}" aria-pressed="${String(o)}" @click="${()=>this._toggle(n)}"><span class="sd"></span><span class="name">${r}</span><span class="n">${s}</span></button>`})}`}_toggle(e){this.dispatchEvent(new CustomEvent("severity-toggle",{detail:{severity:e,kind:this.kind},bubbles:!0,composed:!0}))}};customElements.define("severity-chips",Ms);var df=[["corrected","Corrected","Show corrected severities (application-specific re-ratings)"],["original","Original",m]],Ps=class extends D{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),W(this,{role:"group","aria-label":"Severity display mode"})}render(){let e=l.severityMode;return a`<span class="severity-mode-label">Severity</span><span class="severity-mode-chips">${df.map(([t,n,r])=>{let s=e===t;return a`<button type="button" class="${I({"severity-mode-chip":!0,active:s})}" aria-pressed="${String(s)}" data-tooltip="${r}" @click="${()=>this._select(t)}">${n}</button>`})}</span>`}_select(e){e!==l.severityMode&&this.dispatchEvent(new CustomEvent("severity-mode-change",{detail:{mode:e},bubbles:!0,composed:!0}))}};customElements.define("severity-mode-switch",Ps);var uf=a`<svg viewBox="0 0 16 16" width="13" height="13" aria-hidden="true"><path d="M8 1.8 14.4 5 8 8.2 1.6 5z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/><path d="M2.6 8 8 10.7 13.4 8" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/><path d="M2.6 11 8 13.7 13.4 11" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/></svg>`,dp="Show underlying code findings",pf=a`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 5.5v2h10v-2M8 7.5v3"/><rect x="1" y="1.5" width="4" height="4" rx=".6"/><rect x="11" y="1.5" width="4" height="4" rx=".6"/><rect x="6" y="10.5" width="4" height="4" rx=".6"/></svg>`,up="Show only upstream dependency findings",As=class extends D{static properties={canDrop:{type:Boolean,attribute:"can-drop"},canDetail:{type:Boolean,attribute:"can-detail"},canUpstream:{type:Boolean,attribute:"can-upstream"},upstreamDisabled:{type:Boolean,attribute:"upstream-disabled"}};createRenderRoot(){return this}constructor(){super(),this.canDrop=!1,this.canDetail=!1,this.canUpstream=!1,this.upstreamDisabled=!1}connectedCallback(){super.connectedCallback(),W(this,{role:"group","aria-label":"Revalidation layer"})}render(){let e=l.revalidateConflicts.size,t=e>0?a`<button type="button" class="revalidation-toggle revalidation-conflicts" aria-haspopup="dialog" aria-label="${`View ${e} revalidation conflict${e===1?"":"s"}`}" @click="${this._openConflicts}">${e} ${e===1?"conflict":"conflicts"}</button>`:m,n=l.showRevalidation!==!1,r=n&&l.revalidationDetailed===!0,s=l.upstreamOnly===!0,o=s&&!this.upstreamDisabled;return a`${t}${e===0&&this.canDrop?a`<mode-switch class="revalidation-toggle" label="App" borderless .checked="${n}" accessible-label="App view — hide the issues the revalidation pass ruled out" .disabled="${s}" @click="${this._toggle}"></mode-switch>`:m}${e===0&&this.canDrop&&this.canDetail?a`<button type="button" class="${I({"revalidation-detail":!0,on:r})}" aria-pressed="${String(r)}" aria-label="${dp}" data-tooltip="${dp}" ?disabled="${!n||s}" @click="${this._toggleDetail}">${uf}</button>`:m}${this.canUpstream?a`<button type="button" class="${I({"revalidation-upstream":!0,on:o})}" aria-pressed="${String(o)}" aria-label="${up}" data-tooltip="${up}" ?disabled="${this.upstreamDisabled}" @click="${this._toggleUpstream}">${pf}</button>`:m}`}_toggle=()=>{this.dispatchEvent(new CustomEvent("revalidation-change",{detail:{on:l.showRevalidation===!1},bubbles:!0,composed:!0}))};_openConflicts=()=>{this.dispatchEvent(new CustomEvent("revalidation-conflicts-open",{bubbles:!0,composed:!0}))};_toggleDetail=()=>{this.dispatchEvent(new CustomEvent("revalidation-detail-change",{detail:{on:l.revalidationDetailed!==!0},bubbles:!0,composed:!0}))};_toggleUpstream=()=>{this.upstreamDisabled||this.dispatchEvent(new CustomEvent("upstream-only-change",{detail:{on:l.upstreamOnly!==!0},bubbles:!0,composed:!0}))}};customElements.define("revalidation-switch",As);var hf=a`<svg class="trash-icon" viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 4h10M6.5 4V2.5h3V4M5 4l.7 9h4.6L11 4"/></svg>`,Is=class extends D{createRenderRoot(){return this}render(){let e=l.currentView==="bundles"&&l.selectedBundle,t=!l.currentFile&&!e;return a`<button type="button" class="danger" ?disabled="${t}">${hf}<span>Delete current</span></button>`}};customElements.define("sidebar-delete-current",Is);var mf=a`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 6h12v7a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V6Z"/><path d="M2 6l1.6-3.3A1.3 1.3 0 0 1 4.8 2h6.4a1.3 1.3 0 0 1 1.2.7L14 6"/><path d="M8 2v4"/></svg>`,ff=a`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="4" x2="4" y1="2.5" y2="10"/><circle cx="12" cy="4" r="2"/><circle cx="4" cy="12" r="2"/><path d="M12 6a6 6 0 0 1-6 6"/></svg>`,gf={packages:{title:"Show packages",icon:mf,view:"packages"},repositories:{title:"Show repositories",icon:ff,view:"repositories"}},Fs=class extends D{static properties={kind:{type:String},count:{type:Number}};createRenderRoot(){return this}constructor(){super(),this.kind="",this.count=0}render(){if(this.count===0)return m;let e=Se("sidebar-view-button",gf,this.kind);if(!e)return m;let t=l.currentView===e.view;return a`<button type="button" class="${I({"sidebar-view-btn":!0,active:t})}" aria-label="${e.title}">${e.icon}<span class="view-btn-count">${this.count}</span></button>`}};customElements.define("sidebar-view-button",Fs);var bf=["invalid","deleted"],vf={package:{stateKey:"packageSlideTriage"},repository:{stateKey:"repositorySlideTriage"}},Ds=class extends D{static properties={counts:{attribute:!1},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.kind=""}connectedCallback(){super.connectedCallback(),W(this,{role:"group","aria-label":"Triage view"})}render(){let e=Se("slide-triage-tabs",vf,this.kind);if(!e)return m;let t=l[e.stateKey],n=bf.filter(r=>(this.counts[r]??0)>0||t===r);return n.length===0?m:a`${n.map(r=>{let s=t===r,o=this.counts[r]??0;return a`<button type="button" class="${I({"triage-state-btn":!0,[`triage-state-${r}`]:!0,active:s})}" aria-pressed="${String(s)}" @click="${()=>this._toggle(r)}">${r.charAt(0).toUpperCase()+r.slice(1)} (${o})</button>`})}`}_toggle(e){this.dispatchEvent(new CustomEvent("slide-triage-toggle",{detail:{kind:this.kind,value:e},bubbles:!0,composed:!0}))}};customElements.define("slide-triage-tabs",Ds);var yf=[["own","Sources"],["modules","Deps"]],Os=class extends D{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),W(this,{role:"group","aria-label":"Source filter"})}render(){return a`${yf.map(([e,t])=>{let n=l.filterSources.has(e);return a`<button type="button" class="${I({"source-chip":!0,active:n})}" aria-pressed="${String(n)}" @click="${()=>this._toggle(e)}">${t}</button>`})}`}_toggle(e){this.dispatchEvent(new CustomEvent("source-toggle",{detail:{source:e},bubbles:!0,composed:!0}))}};customElements.define("source-filter",Os);var _f=a`<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>`,wf=a`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6h10v4"/></svg>`,kf={findings:{stateKey:"filterInclude",placeholder:"Search findings\u2026"},files:{stateKey:"filesSearch",placeholder:"Search files\u2026"}},Bs=class extends D{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let e=Se("toolbar-search",kf,this.kind);if(!e)return m;let t=l[e.stateKey];return a`${_f} <input type="text" aria-label="${e.placeholder}" placeholder="${e.placeholder}" .value="${j(t)}" @input="${this._onInput}"> ${this.kind==="findings"&&t?this._negateToggle():m}`}_negateToggle(){let e=l.filterIncludeNegate;return a`<button type="button" class="${I({"search-negate-btn":!0,active:e})}" data-tooltip="${e?"Negation on \u2014 click to undo":"Negate: show non-matching findings"}" aria-label="Negate search" aria-pressed="${String(e)}" @click="${this._onToggleNegate}">${wf}</button>`}_onInput=e=>{this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:this.kind,value:e.target.value},bubbles:!0,composed:!0}))};_onToggleNegate=()=>{this.dispatchEvent(new CustomEvent("search-negate-toggle",{bubbles:!0,composed:!0}))}};customElements.define("toolbar-search",Bs);var Ns=class extends D{static properties={options:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.options=[]}render(){let e=[{value:"",label:"All repositories",special:!0,reset:!0},...this.options.map(t=>({value:t??Di,label:t==null?"(no repo)":We(t),special:t==null}))];return a`<repository-selector variant="filter" label="Filter by repository" .options="${e}" .value="${l.filterRepo}" @repository-change="${t=>this.dispatchEvent(new CustomEvent("repo-change",{detail:{value:t.detail.value},bubbles:!0,composed:!0}))}"></repository-selector>`}};customElements.define("repo-filter",Ns);var pp={"":{cls:"included",label:"+ Partial",title:"Confirmed, partial and revalidation rows \u2014 click for full confirmations only"},exclude:{cls:"excluded",label:"\u2212 Partial",title:"Full confirmations only \u2014 click to show the partial ones only"},only:{cls:"only",label:"only Partial",title:"Partial confirmations only \u2014 click to show all of them again"}},zs=class extends D{static properties={options:{attribute:!1},hasPartial:{type:Boolean,attribute:"has-partial"}};createRenderRoot(){return this}constructor(){super(),this.options=[],this.hasPartial=!1}render(){return a`<select class="sort-select" aria-label="Filter by revalidation outcome" .value="${j(l.filterRevalidate)}" @change="${this._onChange}"><option value="" hidden ?selected="${l.filterRevalidate===""}"></option><option value="">Confidence</option>${this.options.map(e=>a`<option value="${e.value}" ?selected="${l.filterRevalidate===e.value}">${e.label}</option>`)}</select> ${this.hasPartial&&l.filterRevalidate==="confirmed"?this._partialChip():m}`}_partialChip(){let e=pp[l.filterPartial]??pp[""];return a`<button type="button" class="${I({"partial-cycle":!0,[e.cls]:!0})}" data-tooltip="${e.title}" @click="${this._onPartial}">${e.label}</button>`}_onPartial=()=>{let e=Ti.indexOf(l.filterPartial),t=Ti[(e+1)%Ti.length];this.dispatchEvent(new CustomEvent("partial-change",{detail:{value:t},bubbles:!0,composed:!0}))};_onChange=e=>{let{value:t}=e.target;t||(e.target.selectedIndex=0),this.dispatchEvent(new CustomEvent("revalidate-change",{detail:{value:t},bubbles:!0,composed:!0}))}};customElements.define("revalidate-filter",zs);var hp=[["none","none","unmarked"],["red","r","red"],["blue","b","blue"],["green","g","green"],["gray","x","gray"]],qs=class extends D{static properties={counts:{attribute:!1},selected:{attribute:!1},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.selected=[],this.kind="findings"}connectedCallback(){super.connectedCallback(),W(this,{role:"group","aria-label":"Filter by mark color"})}render(){let e=this.kind==="graph"?new Set(this.selected):l.filterColors;return hp.some(([n])=>(this.counts[n]??0)||e.has(n))?a`${hp.map(([n,r,s])=>{let o=this.counts[n]??0,c=e.has(n);return a`<button type="button" class="${c?"active":""}" aria-label="${`${s} (${o})`}" aria-pressed="${String(c)}" @click="${()=>this._toggle(n)}"><span class="${`td ${r}`}"></span><span class="count">${o}</span></button>`})}`:m}_toggle(e){this.dispatchEvent(new CustomEvent("color-toggle",{detail:{color:e,kind:this.kind},bubbles:!0,composed:!0}))}};customElements.define("triage-filter",qs);var $f=["inprogress","fixed","invalid","deleted","ignored"],Hs={graph:"graph2-triage-selector",packages:"packages-triage-selector"},xf={inprogress:"In progress"},Sf=i=>xf[i]??i.charAt(0).toUpperCase()+i.slice(1),Us=class extends D{static properties={counts:{attribute:!1},states:{attribute:!1},variant:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.states=null,this.variant=""}connectedCallback(){super.connectedCallback(),W(this,{role:"group","aria-label":"Triage view"})}render(){let e=this.states??$f,t=e.reduce((s,o)=>s+(this.counts[o]??0),0),n=this.variant?Hs[this.variant]:null;this.variant&&n===void 0&&console.warn(`<triage-selector>: unknown variant ${JSON.stringify(this.variant)}; expected one of ${Object.keys(Hs).map(s=>JSON.stringify(s)).join(", ")} or "".`);for(let s of Object.values(Hs))this.classList.toggle(s,s===n);let r=t===0&&!l.shownTriage;return this.classList.toggle("is-empty",r),r?m:a`${e.map(s=>{let o=this.counts[s]??0,c=l.shownTriage===s;if(o===0&&!c)return m;let u=Sf(s);return a`<button type="button" class="${I({"triage-state-btn":!0,[`triage-state-${s}`]:!0,active:c})}" data-triage-show="${s}" aria-pressed="${String(c)}"><span>${u}</span><span class="n">${o}</span></button>`})}`}};customElements.define("triage-selector",Us);var Cf={table:a`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><rect x="3" y="3" width="18" height="18" rx="2"/><line x1="3" x2="21" y1="9" y2="9"/><line x1="3" x2="21" y1="15" y2="15"/><line x1="9" x2="9" y1="3" y2="21"/></svg>`,list:a`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><line x1="3" x2="21" y1="6" y2="6"/><line x1="3" x2="21" y1="12" y2="12"/><line x1="3" x2="21" y1="18" y2="18"/></svg>`,grouped:a`<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><rect x="2" y="1.5" width="12" height="2" rx=".4"/><rect x="5" y="4.4" width="9" height="1.3"/><rect x="5" y="6.2" width="9" height="1.3"/><rect x="2" y="8.5" width="12" height="2" rx=".4"/><rect x="5" y="11.4" width="9" height="1.3"/><rect x="5" y="13.2" width="9" height="1.3"/></svg>`,kanban:a`<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><rect x="1.5" y="2" width="3.8" height="12" rx=".6" fill="none" stroke="currentColor" stroke-width="1"/><rect x="6.1" y="2" width="3.8" height="12" rx=".6" fill="none" stroke="currentColor" stroke-width="1"/><rect x="10.7" y="2" width="3.8" height="12" rx=".6" fill="none" stroke="currentColor" stroke-width="1"/><rect x="2.4" y="3.6" width="2" height="1.4" rx=".2"/><rect x="2.4" y="5.6" width="2" height="1.4" rx=".2"/><rect x="7" y="3.6" width="2" height="1.4" rx=".2"/><rect x="11.6" y="3.6" width="2" height="1.4" rx=".2"/><rect x="11.6" y="5.6" width="2" height="1.4" rx=".2"/><rect x="11.6" y="7.6" width="2" height="1.4" rx=".2"/></svg>`,focus:a`<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><rect x="1.5" y="2.5" width="8.5" height="11" rx=".6" fill="none" stroke="currentColor" stroke-width="1"/><rect x="3" y="4.4" width="5.5" height="1"/><rect x="3" y="6.4" width="5.5" height="1"/><rect x="3" y="8.4" width="3.5" height="1"/><rect x="11.2" y="2.5" width="3.3" height="2.5" rx=".4" fill="currentColor" opacity=".55"/><rect x="11.2" y="5.7" width="3.3" height="2.5" rx=".4" fill="currentColor" opacity=".35"/><rect x="11.2" y="8.9" width="3.3" height="2.5" rx=".4" fill="currentColor" opacity=".22"/></svg>`,graph:a`${J(ea)}`},Ef={table:"Table view (compact rows, click a row to expand)",list:"List view (flat, one card per finding)",grouped:"List view, grouped by file",focus:"Focus view (one finding centered + a queue of next findings)",kanban:"Kanban board, columns grouped by triage status",graph:"Graph view (canvas with imports / exports)"},js=["kanban","focus","table","list","grouped","graph"],Vs=class extends D{static properties={modes:{type:String},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.modes=js.join(","),this.kind="findings"}connectedCallback(){super.connectedCallback(),W(this,{role:"group","aria-label":"View mode"})}render(){let e=this.kind==="files"?l.filesViewMode:l.viewMode,t=this.modes.split(",").map(r=>r.trim()).filter(r=>js.includes(r)),n=t.length>0?t:js;return a`${n.map(r=>a`<button type="button" class="${I({"view-mode-btn":!0,active:e===r})}" aria-label="${Ef[r]}" aria-pressed="${String(e===r)}" @click="${()=>this._select(r,e)}">${Cf[r]}</button>`)}`}_select(e,t){e!==t&&this.dispatchEvent(new CustomEvent("view-mode-change",{detail:{mode:e,kind:this.kind},bubbles:!0,composed:!0}))}};customElements.define("view-mode-buttons",Vs);var mp=i=>{let e=i.lastIndexOf(".");return e>0?i.slice(e).toLowerCase():""};function fp(i,e=""){let t=i.map(s=>s.split("/")),n=[];for(;;){let s=n.length,o=new Set;for(let c of t)c.length>s+1&&n.every((u,d)=>c[d]===u)&&o.add(c[s]);if(o.size!==1)break;n.push(o.values().next().value)}let r=t.map(s=>{let o=0;for(;o<n.length&&s.length>o+1;)o++;let c=e+s.slice(0,o).map(u=>`${u}/`).join("");return s.length>o+1?`${c}${s[o]}/`:`${c}*`});if(new Set(r).size>1){let s=new Map;r.forEach((c,u)=>{if(!c.endsWith("*"))return;let d=s.get(c)??new Set;d.add(mp(t[u].at(-1))),s.set(c,d)});let o=c=>{let u=s.get(c);return u?.size===1&&!u.has("")?`${c}${[...u][0]}`:c};return new Map(i.map((c,u)=>[c,o(r[u])]))}return new Map(i.map((s,o)=>{let c=mp(t[o].at(-1));return[s,c?`*${c}`:"No extension"]}))}var _p=6,gp=14,_n=2,bp=24,ni=4,Tf=1.5,wn=new Map,kn=new Map,vp="treemap",yp=!1;function Rf(i){let e=/^#?([0-9a-f]{6})$/iu.exec(i);if(!e)return"#fff";let t=parseInt(e[1],16),n=t>>16&255,r=t>>8&255,s=t&255;return(.2126*n+.7152*r+.0722*s)/255>.6?"#1a1a1a":"#fff"}function Lf(i,e,t,n){let r=t*t,s=n*n;return Math.max(s*i/r,r/(s*e))}function wp(i,e){let t=[],n=i.filter(h=>h.value>0),{x:r,y:s,w:o,h:c}=e;if(n.length===0||o<=0||c<=0)return t;let u=0;for(let h of n)u+=h.value;let d=o*c/u,p=0;for(;p<n.length&&o>.5&&c>.5;){let h=Math.min(o,c),f=p,b=0,v=0,g=1/0,y=1/0;for(;f<n.length;){let _=n[f].value*d,x=_>v?_:v,S=_<g?_:g,T=Lf(x,S,b+_,h);if(f===p||T<=y)y=T,b+=_,v=x,g=S,f++;else break}let k=b/h;if(o>=c){let _=s;for(let x=p;x<f;x++){let S=x===f-1?s+c-_:n[x].value*d/k;t.push({node:n[x],x:r,y:_,w:k,h:S}),_+=S}r+=k,o-=k}else{let _=r;for(let x=p;x<f;x++){let S=x===f-1?r+o-_:n[x].value*d/k;t.push({node:n[x],x:_,y:s,w:S,h:k}),_+=S}s+=k,c-=k}p=f}return t}function kp(i){for(;i.children&&i.children.size===1;){let e=i.children.values().next().value;if(e.isFile)break;i.name=`${i.name}/${e.name}`,i.children=e.children}if(i.children)for(let e of i.children.values())kp(e)}function $p(i,e,t,n){if(i.path=i.name?e?`${e}/${i.name}`:i.name:e,i.parent=t,i.isFile)return i.count=1,i.value;n.set(i.path,i);let r=0,s=0,o,c;for(let u of i.children.values())r+=$p(u,i.path,i,n),s+=u.count,c===void 0?c=u.pkg:c!==u.pkg&&(c=null),o===void 0?o=u.group:o!==u.group&&(o=null);return i.value=r,i.count=s,i.pkg=c??null,i.group=o??null,r}function Mf(i,e,t,n){let r=new Set(i).size===1?fp(e,t):new Map,s=new Map;return e.forEach((o,c)=>{r.has(o)&&s.set(r.get(o),(s.get(r.get(o))??0)+Math.max(n[c]??0,0))}),{groups:r,ranks:new Map([...s].toSorted((o,c)=>c[1]-o[1]||o[0].localeCompare(c[0])).map(([o],c)=>[o,c]))}}function xp(i,e,t,n,r,s,o){if(n<ni||r<ni)return;if(i.isFile){o.push({kind:"file",node:i,x:e,y:t,w:n,h:r});return}if(!(s<_p&&n>=bp&&r>=bp&&i.children.size>0)){o.push({kind:"agg",node:i,x:e,y:t,w:n,h:r});return}o.push({kind:"dir",node:i,x:e,y:t,w:n,h:r});let u=r>=gp+ni+_n?gp:0,d=e+_n,p=t+u,h=n-_n*2,f=r-u-_n;if(h<ni||f<ni)return;let b=[...i.children.values()].toSorted((v,g)=>g.value-v.value);for(let v of wp(b,{x:d,y:p,w:h,h:f}))xp(v.node,v.x,v.y,v.w,v.h,s+1,o)}function Ks(i,e){let t=i/(e||1)*100;return t>=10?t.toFixed(0):t.toFixed(t>=1?1:2)}function Sp(i,e){if(e<=0||i.isFile||!i.children||i.children.size===0)return 0;let t=1;for(let n of i.children.values()){if(t>=e)break;let r=1+Sp(n,e-1);r>t&&(t=r)}return t}function Pf(i,e,t,n,r,s){let o=Math.min(s-r,Math.PI*2-1e-4),c=r+o,u=o>Math.PI?1:0,d=Math.cos(r),p=Math.sin(r),h=Math.cos(c),f=Math.sin(c),b=v=>v.toFixed(2);return`M${b(i+n*d)} ${b(e+n*p)}A${b(n)} ${b(n)} 0 ${u} 1 ${b(i+n*h)} ${b(e+n*f)}L${b(i+t*h)} ${b(e+t*f)}A${b(t)} ${b(t)} 0 ${u} 0 ${b(i+t*d)} ${b(e+t*p)}Z`}function Af(i,e){let t=Math.max(4,Math.floor(e/6.4));return i.length>t?`${i.slice(0,t-1)}\u2026`:i}var Gs=class extends U{static properties={details:{attribute:!1},_w:{state:!0},_h:{state:!0},_focus:{state:!0},_mode:{state:!0},_reason:{state:!0},_codeOnly:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.details=null,this._w=0,this._h=0,this._root=null,this._focus=[],this._mode=vp,this._reason="",this._codeOnly=yp,this._hasResources=!1,this._reasons=new Map,this._dirByPath=new Map,this._status="loading",this._meta={total:0,prefix:""},this._ro=null,this._plot=null,this._tooltip=null,this._ttCell=null}willUpdate(e){e.has("details")&&(this._reason=kn.get(this.details?.integrity)??""),(e.has("details")||e.has("_reason")||e.has("_codeOnly"))&&this._rebuild()}firstUpdated(){this._plot=this.querySelector(".bundle-treemap-plot"),this._tooltip=this.querySelector(".bundle-treemap-tooltip"),!(!this._plot||typeof ResizeObserver>"u")&&(this._ro=new ResizeObserver(e=>{let t=e[0]?.contentRect;if(!t)return;let n=Math.floor(t.width),r=Math.floor(t.height);(n!==this._w||r!==this._h)&&(this._w=n,this._h=r)}),this._ro.observe(this._plot))}disconnectedCallback(){super.disconnectedCallback(),this._ro&&(this._ro.disconnect(),this._ro=null)}_onPointerMove(e){let t=e.target.closest(".bundle-treemap-node");if(!t||!this._tooltip){this._hideTooltip();return}if(t!==this._ttCell){this._ttCell=t;let n=t.dataset;Xo(a`<div class="bundle-treemap-tt-path">${n.ttPath}</div>${n.ttPkg?a`<div class="bundle-treemap-tt-head"><span class="bundle-treemap-tt-dot" style="${`background:${n.ttColor}`}"></span> <span class="bundle-treemap-tt-pkg">${n.ttPkg}</span></div>`:""}<div class="bundle-treemap-tt-meta">${n.ttMeta}</div>`,this._tooltip)}this._positionTooltip(e.clientX,e.clientY)}_onPointerLeave(){this._hideTooltip()}_positionTooltip(e,t){let n=this._tooltip;if(!n||!this._plot)return;n.classList.add("show");let r=this._plot.getBoundingClientRect(),s=e-r.left,o=t-r.top,c=12,u=s+c;u+n.offsetWidth>r.width-4&&(u=s-n.offsetWidth-c),u<4&&(u=4);let d=o+c;d+n.offsetHeight>r.height-4&&(d=o-n.offsetHeight-c),d<4&&(d=4),n.style.left=`${u}px`,n.style.top=`${d}px`}_hideTooltip(){this._ttCell=null,this._tooltip&&this._tooltip.classList.remove("show")}_rebuild(){if(this._root=null,this._focus=[],this._dirByPath=new Map,this._reasons=new Map,this._hasResources=!1,this._meta={total:0,prefix:""},this._hideTooltip(),!this.details){this._status="loading";return}let e=$a(this.details),t=[...e.keys()].filter(y=>e.get(y)!==null);if(t.length===0){this._status="empty";return}this._reasons=Sa(this.details,t),this._reasons.has(this._reason)||(this._reason="",kn.delete(this.details.integrity));let n=this._reasons.get(this._reason),r=Nt(this.details),s=xa(this.details);this._hasResources=t.some(y=>s.get(y)==="resource"&&e.get(y)>0);let o=this._codeOnly&&this._hasResources,{prefix:c,stripped:u}=ft(t),d=t.map(y=>pt(y,{packageDir:r?.get(y)})),{groups:p,ranks:h}=Mf(d,u,c,t.map(y=>e.get(y))),f={name:"",children:new Map,value:0,isFile:!1},b=0;for(let y=0;y<t.length;y++){if(n&&!n.has(t[y])||o&&s.get(t[y])==="resource")continue;let k=e.get(t[y]);if(k<=0)continue;let _=u[y].split("/"),x=f,S=!1;for(let O=0;O<_.length-1;O++){let A=x.children.get(_[O]);if(A&&A.isFile){S=!0;break}A||(A={name:_[O],children:new Map,value:0,isFile:!1},x.children.set(_[O],A)),x=A}if(S)continue;let T=_.at(-1),F=x.children.get(T);F&&!F.isFile||(F||(F={name:T,isFile:!0,value:0,origPath:t[y],pkg:d[y],group:p.get(u[y])??null,resource:s.get(t[y])==="resource"},x.children.set(T,F)),F.value+=k,b+=k)}if(b===0){this._status="empty";return}for(let y of f.children.values())kp(y);let v=new Map;$p(f,"",null,v),this._groupRanks=h,this._root=f,this._dirByPath=v,this._meta={total:b,prefix:c},this._status="ok";let g=this.details?.integrity?wn.get(this.details.integrity):null;if(g){let y=v.get(g);y?this._focus=this._chainTo(y):wn.delete(this.details.integrity)}}get _focusNode(){return this._focus.length>0?this._focus.at(-1):this._root}_chainTo(e){let t=[];for(let n=e;n&&n!==this._root;n=n.parent)t.push(n);return t.reverse(),t}_rememberFocus(){let e=this.details?.integrity;if(!e)return;let t=this._focus.at(-1)?.path;t?wn.set(e,t):wn.delete(e)}_drillInto(e){!e||e.isFile||!e.children||e.children.size===0||(this._focus=this._chainTo(e),this._rememberFocus(),this._hideTooltip())}_focusTo(e){let t=e<0?[]:this._focus.slice(0,e+1);t.length!==this._focus.length&&(this._focus=t,this._rememberFocus(),this._hideTooltip())}_toggleMode(){this._mode=this._mode==="sunburst"?"treemap":"sunburst",vp=this._mode,this._hideTooltip()}_toggleCode(){this._codeOnly=!this._codeOnly,yp=this._codeOnly}_changeReason(e){this._reason=e.detail.value.replace(/^reason:/u,"");let t=this.details?.integrity;t&&(this._reason?kn.set(t,this._reason):kn.delete(t))}_onPlotClick(e){let t=e.target.closest("[data-treemap-into]");if(!t)return;let n=this._dirByPath.get(t.dataset.treemapInto);n&&this._drillInto(n)}_renderCrumbs(){let e=this._focus,t=e.length===0,n=e.slice(0,-1),r=t?null:e.at(-1);return a`<nav class="bundle-treemap-crumbs" aria-label="Treemap location"><span class="bundle-treemap-crumbs-lead"><button type="button" class="${I({"bundle-treemap-crumb-home":!0,"at-root":t})}" @click="${()=>this._focusTo(-1)}">Source ${this._mode==="sunburst"?"sunburst":"treemap"}</button> ${n.map((s,o)=>a`<span class="bundle-treemap-crumb-sep" aria-hidden="true">›</span><button type="button" class="bundle-treemap-crumb" @click="${()=>this._focusTo(o)}" data-tooltip-truncated data-tooltip="${s.path}">${s.name}</button>`)} </span>${r?a`<span class="bundle-treemap-crumb-sep" aria-hidden="true">›</span><span class="bundle-treemap-crumb-current" aria-current="location" data-tooltip-truncated data-tooltip="${r.path}">${r.name}</span>`:""}</nav>`}_paint(e){if(this._groupRanks?.size>0)return e.group==null?{color:Ua(),label:null,named:!1}:{color:Ha(this._groupRanks.get(e.group)??0),label:e.group,named:!0};let t=e.pkg??pt(e.path);return{color:Mi(t),label:Ke(t),named:e.pkg!=null}}_cell(e){let t=Ks(e.node.value,this._meta.total),n={left:`${e.x}px`,top:`${e.y}px`,width:`${e.w}px`,height:`${e.h}px`},r=`${e.node.count} ${e.node.count===1?"file":"files"}`;if(e.kind==="dir")return a`<div class="bundle-treemap-node bundle-treemap-dir" style="${_e(n)}" data-treemap-into="${e.node.path}" data-tt-path="${`${e.node.path}/`}" data-tt-meta="${`${G(e.node.value)} \xB7 ${r} \xB7 ${t}%`}"><span class="bundle-treemap-dirname">${e.node.name}</span></div>`;let{color:s,label:o}=this._paint(e.node),c=_e({...n,background:s,color:Rf(s)}),u=o??m;return e.kind==="agg"?a`<div class="bundle-treemap-node bundle-treemap-leaf bundle-treemap-agg" style="${c}" data-treemap-into="${e.node.path}" data-tt-path="${`${e.node.path}/`}" data-tt-pkg="${u}" data-tt-color="${s}" data-tt-meta="${`${G(e.node.value)} \xB7 ${r} \xB7 ${t}%`}"><span class="bundle-treemap-label">${e.node.name}/</span></div>`:a`<div class="bundle-treemap-node bundle-treemap-leaf bundle-treemap-file" style="${c}" data-bundle-view-source="${e.node.resource?m:e.node.origPath}" data-tt-path="${e.node.path}" data-tt-pkg="${u}" data-tt-color="${s}" data-tt-meta="${`${G(e.node.value)} \xB7 ${t}% of bundle`}"><span class="bundle-treemap-label">${e.node.name}</span></div>`}_arc(e,t,n){let r=Ks(e.value,n),{color:s,label:o,named:c}=this._paint(e),u=o??m;if(e.isFile)return ye`<path
|
|
50
50
|
class="bundle-treemap-node bundle-treemap-arc"
|
|
51
51
|
d=${t}
|
|
52
52
|
fill=${s}
|
|
@@ -54,7 +54,7 @@ ${w}`)}`;try{window.location.href=C,Ru(Ho)}catch{}return}if(B(i,".mark-fix")){le
|
|
|
54
54
|
data-tt-path=${e.path}
|
|
55
55
|
data-tt-pkg=${u}
|
|
56
56
|
data-tt-color=${s}
|
|
57
|
-
data-tt-meta=${`${G(e.value)} \xB7 ${
|
|
57
|
+
data-tt-meta=${`${G(e.value)} \xB7 ${r}% of bundle`}
|
|
58
58
|
></path>`;let d=`${e.count} ${e.count===1?"file":"files"}`;return ye`<path
|
|
59
59
|
class="bundle-treemap-node bundle-treemap-arc"
|
|
60
60
|
d=${t}
|
|
@@ -63,42 +63,42 @@ ${w}`)}`;try{window.location.href=C,Ru(Ho)}catch{}return}if(B(i,".mark-fix")){le
|
|
|
63
63
|
data-tt-path=${`${e.path}/`}
|
|
64
64
|
data-tt-pkg=${c?u:m}
|
|
65
65
|
data-tt-color=${c?s:m}
|
|
66
|
-
data-tt-meta=${`${G(e.value)} \xB7 ${d} \xB7 ${
|
|
67
|
-
></path>`}_renderSunburst(e){let t=this._w,
|
|
66
|
+
data-tt-meta=${`${G(e.value)} \xB7 ${d} \xB7 ${r}%`}
|
|
67
|
+
></path>`}_renderSunburst(e){let t=this._w,n=this._h,r=t/2,s=n/2,o=Math.min(t,n)/2-6;if(o<30)return m;let c=Sp(e,_p),u=Math.min(Math.max(o*.18,26),o*.45),d=(o-u)/c,p=this._meta.total||1,h=[],f=(k,_,x,S)=>{let T=[...k.children.values()].toSorted((A,z)=>z.value-A.value),F=x-_,O=_;for(let A of T){let z=F*(A.value/k.value),Z=u+(S-1)*d,ne=Z+d;z*ne>=Tf&&(h.push(this._arc(A,Pf(r,s,Z,ne,O,O+z),p)),!A.isFile&&S<c&&A.children.size>0&&f(A,O,O+z,S+1)),O+=z}};f(e,-Math.PI/2,Math.PI*1.5,1);let b=this._focus.length>0,v=Math.max(u-4,10),g=b?ye`<circle
|
|
68
68
|
class="bundle-treemap-node bundle-treemap-center"
|
|
69
|
-
cx=${
|
|
69
|
+
cx=${r} cy=${s} r=${v}
|
|
70
70
|
data-treemap-into=${e.parent.path}
|
|
71
71
|
data-tt-path=${`${e.path}/`}
|
|
72
72
|
data-tt-meta=${`${G(e.value)} \xB7 ${e.count} ${e.count===1?"file":"files"} \xB7 ${Ks(e.value,p)}%`}
|
|
73
|
-
></circle>`:ye`<circle class="bundle-treemap-center" cx=${
|
|
74
|
-
${b?ye`<tspan x=${
|
|
75
|
-
</text>`;return a`<svg class="bundle-treemap-sunburst" width="${t}" height="${
|
|
76
|
-
`)),
|
|
77
|
-
`);return e.at(-1)===""&&e.pop(),e}var
|
|
78
|
-
`),
|
|
73
|
+
></circle>`:ye`<circle class="bundle-treemap-center" cx=${r} cy=${s} r=${v}></circle>`,y=ye`<text class="bundle-treemap-center-label" x=${r} y=${s} text-anchor="middle">
|
|
74
|
+
${b?ye`<tspan x=${r} dy="-0.3em">${Af(e.name,v*2-12)}</tspan><tspan class="bundle-treemap-center-sub" x=${r} dy="1.5em">${G(e.value)}</tspan>`:ye`<tspan x=${r} dy="0.35em">${G(e.value)}</tspan>`}
|
|
75
|
+
</text>`;return a`<svg class="bundle-treemap-sunburst" width="${t}" height="${n}" viewBox="${`0 0 ${t} ${n}`}">${h}${g}${y}</svg>`}render(){let e=this._focusNode,t=this._mode==="sunburst",n=this._status==="ok"&&e&&e.children&&this._w>0&&this._h>0,r=[];if(n&&!t){let u=[...e.children.values()].toSorted((d,p)=>p.value-d.value);for(let d of wp(u,{x:0,y:0,w:this._w,h:this._h}))xp(d.node,d.x,d.y,d.w,d.h,1,r)}let{prefix:s}=this._meta,o=e?e.count:0,c=e?e.value:0;return a`<header class="bundle-treemap-head">${this._renderCrumbs()} <span class="bundle-treemap-head-right"><span class="bundle-treemap-sub">${o} ${o===1?"file":"files"} · ${G(c)}${s?a`· <span class="mono">${s}</span>`:""}</span> ${this._reasons.size>0?a`<bundle-scope-selector compact="compact" .reasons="${[...this._reasons.keys()].map(u=>({id:`reason:${u}`,label:u}))}" .value="${this._reason?`reason:${this._reason}`:""}" label="Filter files" @scope-change="${this._changeReason}"></bundle-scope-selector>`:m} ${this._hasResources?a`<mode-switch compact="compact" label="Code" .checked="${this._codeOnly}" accessible-label="Show code only, without resources" @click="${this._toggleCode}"></mode-switch>`:m}<mode-switch compact="compact" label="Sunburst" .checked="${t}" accessible-label="Toggle sunburst view" @click="${this._toggleMode}"></mode-switch></span></header><div class="bundle-treemap-plot" @click="${this._onPlotClick}" @pointermove="${this._onPointerMove}" @pointerleave="${this._onPointerLeave}">${this._status==="loading"?a`<div class="bundle-treemap-empty">Loading…</div>`:this._status==="empty"?a`<div class="bundle-treemap-empty">${this._codeOnly&&this._hasResources?"No code here, only resources.":"This bundle doesn't carry any source content."}</div>`:t?n?this._renderSunburst(e):m:r.map(u=>this._cell(u))}<div class="bundle-treemap-tooltip"></div></div>`}};customElements.define("bundle-treemap",Gs);function Ws(i){return i===0?"\xB10":`${i>0?"+":"\u2212"}${Math.abs(i).toLocaleString()}`}function Ys(i){return i===0?"\xB10 B":`${i>0?"+":"\u2212"}${G(Math.abs(i))}`}function Rt(i){return i>0?"up":i<0?"down":""}function If(i,e){if(!e)return"";let t=i/e*100;return`${t>0?"+":t<0?"\u2212":"\xB1"}${Math.abs(t).toFixed(1)}%`}function Cp(i){let e=i.totals,t=i.versionUpdates?.totals??{baseDeps:0,otherDeps:0},n=t.baseDeps>0||t.otherDeps>0,r=t.otherDeps-t.baseDeps,s=If(e.byteDelta,e.baseBytes);return a`<div class="bundle-compare-stats">${n?a`<div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Deps</span> <span class="bundle-compare-metric-value">${t.baseDeps.toLocaleString()} → ${t.otherDeps.toLocaleString()}</span> <span class="${`bundle-compare-metric-delta ${Rt(r)}`}">${Ws(r)}</span></div>`:m}<div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Size</span> <span class="bundle-compare-metric-value">${G(e.baseBytes)} → ${G(e.otherBytes)}</span> <span class="${`bundle-compare-metric-delta ${Rt(e.byteDelta)}`}">${Ys(e.byteDelta)}${s?a`${" "}<span class="bundle-compare-pct">(${s})</span>`:m}</span></div>${e.baseLines>0||e.otherLines>0?a`<div class="bundle-compare-metric"><span class="bundle-compare-metric-label">LoC</span> <span class="bundle-compare-metric-value">${e.baseLines.toLocaleString()} → ${e.otherLines.toLocaleString()}</span> <span class="${`bundle-compare-metric-delta ${Rt(e.otherLines-e.baseLines)}`}">${Ws(e.otherLines-e.baseLines)}</span></div>`:m}<div class="bundle-compare-files"><div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Files</span> <span class="bundle-compare-metric-value">${e.baseFiles.toLocaleString()} → ${e.otherFiles.toLocaleString()}</span> <span class="${`bundle-compare-metric-delta ${Rt(e.fileDelta)}`}">${Ws(e.fileDelta)}</span></div><div class="bundle-compare-chips">${e.onlyBaseFiles>0?a`<span class="bundle-compare-chip removed">−${e.onlyBaseFiles.toLocaleString()} removed</span>`:m} ${e.onlyOtherFiles>0?a`<span class="bundle-compare-chip added">+${e.onlyOtherFiles.toLocaleString()} added</span>`:m} ${e.changedFiles>0?a`<span class="bundle-compare-chip changed">${e.changedFiles.toLocaleString()} changed${e.renamedFiles>0?` (${e.renamedFiles.toLocaleString()} renamed)`:""}</span>`:m} <span class="bundle-compare-chip unchanged">${e.unchangedFiles.toLocaleString()} unchanged</span> ${i.resolutions?.totalChanges>0?a`<span class="bundle-compare-chip changed">${i.resolutions.totalChanges.toLocaleString()} repointed ${i.resolutions.totalChanges===1?"resolution":"resolutions"}</span>`:m}</div></div></div>`}var Ff=24;function Ne(i,e=t=>t.id){return i.map(t=>({id:e(t),integrity:e(t),kind:t.format,format:t.format,detail:t.detail,...t.date&&{date:t.date},...t.dateWarning&&{dateWarning:t.dateWarning},filename:t.name,displayLabel:t.displayLabel,size:"\u2014",summary:null}))}function Df(i){if(!i)return m;let e=({name:n="",detail:r=""}={})=>n.length+Math.min(r.length,Ff)*.87+1,t=(i.choices??[]).reduce((n,r)=>Math.max(n,e(r)),Math.max(`Choose a ${i.noun??"bundle"}\u2026`.length,e(i.widest)));return`--compare-select-chars: ${Math.ceil(t)}`}function $n({source:i,label:e="Compare",from:t,to:n,clear:r,swap:s,extras:o=m,comparison:c=null,disabled:u=!1,openLine:d}){let p=i?.noun??"bundle",h=`${p[0].toUpperCase()}${p.slice(1)}`,f=(b,v)=>a`<bundle-selector .bundles="${b.options}" .value="${b.value}" .noun="${p}" .versions="${!!i}" label="${b.label??v}" placeholder="${b.placeholder??`Choose a ${p}\u2026`}" ?disabled="${u}" @bundle-change="${g=>{g.stopPropagation(),b.pick(g.detail.value)}}"></bundle-selector>`;return a`<div class="${i?"bundle-compare-picker is-versions":"bundle-compare-picker"}" style="${Df(i)}" @compare-open-line="${b=>d?.(b.detail)}"><div class="bundle-compare-select-wrap"><span class="bundle-compare-select-hint">${e}</span> ${f(t,`${h} to compare with`)} ${r?a`<button type="button" class="bundle-compare-clear" aria-label="${r.label??"Clear comparison"}" ?disabled="${u}" @click="${r.run}">×</button>`:m}</div><span class="bundle-compare-arrow" aria-hidden="true">→</span><div class="bundle-compare-select-wrap">${f(n,`${h} to compare`)} ${s?a`<button type="button" class="bundle-compare-swap" ?disabled="${u}" @click="${s}" aria-label="${`Swap the two ${p}s`}"><span class="bundle-compare-swap-icon" aria-hidden="true">↔</span>Swap</button>`:m}</div>${o}${c?i?.badges?.(c.base,c.other,c.files)??m:m}</div>`}function xn(i,e=m){return a`<div class="bundle-compare-summary">${Cp(i)}${e}</div>`}function Sn(i,e=m){return a`<header class="bundle-compare-head">${i}${e}</header>`}function Cn(i,e,t=null){let[n,r]=[i,e],s=kr(n,t),o=kr(r,t),c=Zc(s.keys(),o.keys()),u=td(Nt(n),Nt(r),c),p=nd(s,o,k=>pt(k,{packageDir:u?.get(k)}),c,[xr(n),xr(r)]),h=nr(n),f=nr(r),b=(k,_)=>{let x=0;for(let S of _)x+=k.get(S)??0;return x};Object.assign(p.totals,{baseLines:b(h,s.keys()),otherLines:b(f,o.keys())});for(let k of p.files.onlyBase)k.lines=h.get(k.basePath??k.path)??0;for(let k of p.files.onlyOther)k.lines=f.get(k.path)??0;for(let k of p.files.changed)Object.assign(k,{baseLines:h.get(k.basePath??k.path)??0,otherLines:f.get(k.path)??0});p.resolutions=id($r(n,t),$r(r,t),new Map(p.files.changed.filter(k=>k.renamedFrom!=null).map(k=>[k.basePath,k.path])),p.files.basePaths,p.files.root);let v=k=>pt("",{packageDir:k}),g=ir(n,t?s.keys():null,v),y=ir(r,t?o.keys():null,v);return p.versionUpdates=sd(g,y),p.packageRows=rd(p.packages,g,y),p.scope=t??"",p}function En(i,e){let{head:t,from:n,to:r,tail:s}=Yi(i,e);return a`${t}{<span class="bundle-compare-rename-from">${n}</span> → <span class="bundle-compare-rename-to">${r}</span>}${s}`}function Tn({from:i,to:e}){return a`<span class="bundle-compare-rename-from">${i}</span> → <span class="bundle-compare-rename-to">${e}</span>`}function Rn(i){let e=new Map;if(!i)return e;for(let t of i.onlyBase)e.set(t.path,{kind:"removed",basePath:t.basePath,baseBytes:t.bytes,otherBytes:null});for(let t of i.onlyOther)e.set(t.path,{kind:"added",baseBytes:null,otherBytes:t.bytes});for(let t of i.changed){let n={...t.meta?{meta:t.meta}:{}};e.set(t.path,t.renamedFrom==null?{kind:"changed",basePath:t.basePath,baseBytes:t.baseBytes,otherBytes:t.otherBytes,...t.modified===!1?{modified:!1}:{},...n}:{kind:"renamed",basePath:t.basePath,renamedFrom:t.renamedFrom,modified:t.modified,baseBytes:t.baseBytes,otherBytes:t.otherBytes,...n})}return e}function ae(i,e,t,{kind:n,basePath:r=t}){let s=n==="added"?"":K(i).get(r),o=n==="removed"?"":K(e).get(t);return n==="repointed"&&(s=o=o??s),{before:s,after:o}}function Js(i,e,t,n=[]){let r=Rn(t);if(!t)return r;for(let s of n){if(!r.has(s.parent)){let c=Re(K(e).get(s.parent)??K(i).get(s.parent));r.set(s.parent,{kind:"repointed",baseBytes:c,otherBytes:c})}let o=r.get(s.parent);o.repointed=[...o.repointed??[],s]}return r}function Ep(i,e,t){return[...Js(i,e,t.files,t.resolutions?.changed)].map(([n,r])=>({path:n,...r,...ae(i,e,n,r)}))}function Tp(i,{maxBytes:e,maxLines:t}){let n=0,r=0;for(let{before:s,after:o}of i)for(let c of[s,o])if(n+=Re(c)??0,n>=e||(typeof c=="string"&&c!==""&&(r+=(c.match(/\n/gu)?.length??0)+ +!c.endsWith(`
|
|
76
|
+
`)),r>=t))return!1;return!0}function Q(i){if(i==="")return[];let e=i.split(`
|
|
77
|
+
`);return e.at(-1)===""&&e.pop(),e}var Rp=i=>i===""||i.endsWith(`
|
|
78
|
+
`),Lp=i=>i.replace(/[ \t\n\v\f\r]+$/u,"").replaceAll(/[ \t\n\v\f\r]+/gu," ");function Ce(i,e,t=!1){let n=Ka(i,e,{format:"unified",context:0,whitespace:t?"change":"none"});return n?(Va(n)[0]?.blocks??[]).map(({a0:r,a1:s,b0:o,b1:c})=>({a0:r,a1:s,b0:o,b1:c})):[]}function Mp(i,e,t,n=!1){if(!Array.isArray(t))return!1;let r=Q(i),s=Q(e),o=n?(d,p)=>Lp(d)===Lp(p):(d,p)=>d===p,c=0,u=0;for(let d of[...t,{a0:r.length,a1:r.length,b0:s.length,b1:s.length,last:!0}]){let{a0:p,a1:h,b0:f,b1:b}=d??{};if(![p,h,f,b].every(Number.isInteger)||p<c||f<u||h<p||b<f||h>r.length||b>s.length||!d.last&&h===p&&b===f||p-c!==f-u||d.last&&p>c&&!n&&Rp(i)!==Rp(e))return!1;for(;c<p;c++,u++)if(!o(r[c],s[u]))return!1;c=h,u=b}return!0}var Of=3,ze=20,Bf=4;function Mn(i,e,{ignoreWhitespace:t=!1,changes:n=null,marks:r=null}={}){let s=Q(i),o=Q(e),c=n?.blocks??Ce(i,e,t),u={a:i!==""&&!i.endsWith(`
|
|
79
79
|
`),b:e!==""&&!e.endsWith(`
|
|
80
|
-
`)};return{a:s,b:o,blocks:c,...Xs(c,
|
|
80
|
+
`)};return{a:s,b:o,blocks:c,...Xs(c,r),noEol:u,words:new Map}}function Xs(i,e){let t=new Set((e??[]).map(({a0:c,a1:u,b0:d,b1:p})=>`${c},${u},${d},${p}`)),n=new Set,r=0,s=0,o=0;return i.forEach(({a0:c,a1:u,b0:d,b1:p},h)=>{t.has(`${c},${u},${d},${p}`)&&u-c===p-d?(n.add(h),o+=p-d):(r+=p-d,s+=u-c)}),{additions:r,deletions:s,renamed:o,marked:n}}var Nf=2e6,zf=2e4,Ln=i=>{let e=+(i!==""&&!i.endsWith(`
|
|
81
81
|
`));for(let t=i.indexOf(`
|
|
82
82
|
`);t!==-1;t=i.indexOf(`
|
|
83
|
-
`,t+1))e++;return e};function
|
|
84
|
-
`,1)[0])}function Lt(i,e=new Map,{context:t=Ff,split:r=!1}={}){let{a:n,blocks:s}=i,o=[],c=0,u=0;for(let d=0;d<=s.length;d++){let p=s[d],h=(p?p.a0:n.length)-c,f=d===0,b=d===s.length,v=e.get(d),g=f?0:t+(v?.top??0),y=b?0:t+(v?.bottom??0);if(v?.all||h-g-y<Df)for(let _=0;_<h;_++)o.push({kind:"ctx",a:c+_,b:u+_});else{for(let _=0;_<g;_++)o.push({kind:"ctx",a:c+_,b:u+_});o.push({kind:"fold",run:d,a:c+g,b:u+g,count:h-g-y,up:!b,down:!f});for(let _=h-y;_<h;_++)o.push({kind:"ctx",a:c+_,b:u+_})}if(!p)break;let k=to(i,d);if(r)for(let[_,x,S]of k)o.push({kind:"change",change:d,left:_,right:x,paired:S});else{let _=new Map,x=new Map;for(let[S,T,F]of k)F&&(_.set(S,T),x.set(T,S));for(let S=p.a0;S<p.a1;S++)o.push({kind:"del",a:S,change:d,pair:_.get(S)??null});for(let S=p.b0;S<p.b1;S++)o.push({kind:"add",b:S,change:d,pair:x.get(S)??null})}c=p.a1,u=p.b1}return o}function Hf(i,e){return eo(i.a,i.b,e)}function eo(i,e,t){let r=Yc(i.slice(t.a0,t.a1),e.slice(t.b0,t.b1)).map(([c,u])=>[t.a0+c,t.b0+u]),n=[],s=t.a0,o=t.b0;for(let[c,u]of[...r,[t.a1,t.b1]]){for(;s<c||o<u;)n.push([s<c?s++:null,o<u?o++:null,!1]);c<t.a1&&(n.push([c,u,!0]),s=c+1,o=u+1)}return n}function to(i,e){return i.aligned??=new Map,i.aligned.has(e)||i.aligned.set(e,Hf(i,i.blocks[e])),i.aligned.get(e)}function Mp(i,e,t='<mark class="diff-word">',r="</mark>"){if(!e||e.length===0)return i;let n=!1,s="",o=0,c=0,u=()=>{for(;c<e.length&&o>=e[c][1];)n&&(s+=r,n=!1),c++};for(let d=0;d<i.length;){if(u(),i[d]==="<"){let f=i.indexOf(">",d),b=f===-1?i.slice(d):i.slice(d,f+1);s+=n?r+b+t:b,d+=b.length;continue}!n&&c<e.length&&o>=e[c][0]&&(s+=t,n=!0);let p=i[d]==="&"?i.indexOf(";",d):-1,h=p===-1||p-d>10?i[d]:i.slice(d,p+1);s+=h,d+=h.length,o++}return u(),n?s+r:s}function Pp(i,e){if(!e||e.length===0)return[{text:i,marked:!1}];let t=[],r=0;for(let[n,s]of e)n>r&&t.push({text:i.slice(r,n),marked:!1}),s>n&&t.push({text:i.slice(n,s),marked:!0}),r=s;return r<i.length&&t.push({text:i.slice(r),marked:!1}),t}var io=100,Mr=20;function ni(i,e,t=Mr,r=0,n=i.length){let s=[];for(let o=r;o<Math.min(n,i.length)&&s.length<t;o++){let c=e.ranges(i[o]);c.length>0&&s.push({line:o,text:i[o],ranges:c})}return s}var Ap=(i,e,t,r)=>eo(i,e,r);function Uf(i,e,t,r,{split:n=!1,align:s=Ap}={}){return i===e?ni(Q(e),t).map(o=>({...o,side:"b",sign:" "})):i===""?ni(Q(e),t).map(o=>({...o,side:"b",sign:"+"})):e===""?ni(Q(i),t).map(o=>({...o,side:"a",sign:"\u2212"})):Ip(Q(i),Q(e),t,r,n,s)}function Ip(i,e,t,r,n,s){let o=ni(e,t);if(!r)return o.map(h=>({...h,side:"b",sign:null}));let c=(h,f)=>{let[b,v]=h==="a"?["a0","a1"]:["b0","b1"],g=r.length,y=0;for(;y<g;){let k=y+g>>1;r[k][v]<=f?y=k+1:g=k}return y<r.length&&r[y][b]<=f?r[y]:null},u=[];for(let{a0:h,a1:f}of r){if(u.length===Mr)break;u.push(...ni(i,t,Mr-u.length,h,f))}let d=new Map;if(n){let h=new Set([...o.map(({line:f})=>c("b",f)),...u.map(({line:f})=>c("a",f))]);for(let f of h)f&&s(i,e,r,f).forEach(([b,v],g)=>{b!==null&&d.set(`a${b}`,g),v!==null&&d.set(`b${v}`,g)})}let p=h=>{let f=c(h.side,h.line);return f?n?[f.b0,0,d.get(`${h.side}${h.line}`),h.side==="a"?0:1]:h.side==="a"?[f.b0,0,0,h.line]:[h.line,1,0,0]:[h.line,1,0,0]};return[...o.map(h=>({...h,side:"b",sign:c("b",h.line)?"+":" "})),...u.map(h=>({...h,side:"a",sign:"\u2212"}))].toSorted((h,f)=>{let b=p(h),v=p(f);return b[0]-v[0]||b[1]-v[1]||b[2]-v[2]||b[3]-v[3]}).slice(0,Mr)}function Fp(i,e,t,{split:r=!1,align:n=Ap}={}){let s=[],o=0,c=u=>u!==""&&e.ranges(u).length>0;for(let{path:u,before:d,after:p}of i){if(typeof d!="string"||typeof p!="string"||!c(d)&&(d===p||!c(p)))continue;let h;if(d===p||d===""||p==="")h=Uf(d,p,e,null);else{let f=Q(d),b=Q(p),v=t(u,d,p);if(v?.length===0)continue;h=Ip(f,b,e,v,r,n)}if(h.length!==0){if(s.length===io)return{files:s,hits:o,truncated:!0};s.push({path:u,hits:h}),o+=h.length}}return{files:s,hits:o,truncated:!1}}var jf=2,Vf=2,Kf=5e3,Gf=5*6e4,Wf=30,no="The server's diff doesn't match this file as shown.",si=(i,e)=>!!(i?.managedId&&e?.managedId)||!!i?.npm&&!!e?.npm&&i.npm.name===e.npm.name,so=i=>!(i>=400&&i<500&&i!==429),Ee=new Map;function Op(i,e,t){let{before:r,reason:n,reads:s,prettyHash:o,otherPrettyHash:c,ignoringWhitespace:u}=i??{},d=[i,u].map(h=>Array.isArray(h?.blocks)&&Array.isArray(h.marks)?{blocks:h.blocks,marks:h.marks}:null);if(!(i?.hash===e&&i.otherHash===t&&typeof r=="string"&&(n==null||typeof n=="string")&&Array.isArray(s)&&s.every(h=>typeof h=="string")&&d.every(Boolean)&&typeof o=="string"&&typeof c=="string"))return null;let p=d.map(h=>({status:"ready",before:r,...h,reason:n??null,reads:s}));return{status:"ready",before:r,reason:n??null,reads:s,copies:[o,c],settings:p}}var Ar=(i,e,t)=>i.fileHashes?.get(e)??yi(t),Pr=new Set;function oo(i){i&&(Pr.size===0&&setTimeout(()=>{let e=[...Pr];Pr.clear();for(let t of e)t()},Wf),Pr.add(i))}function ao(i,e,t=0){let r=Math.min(Kf*2**t,Gf);return Object.assign(e,{until:Date.now()+r,tries:t+1}),setTimeout(()=>{i.notify?.()},r)?.unref?.(),e}function Bp(){for(let[i,e]of Ee){if(Ee.size<=jf)break;e.ended&&Ee.delete(i)}}async function Yf(i,e,t,r,n){let s=null;try{let o=async({path:c,otherPath:u,hash:d,otherHash:p,status:h,message:f,...b})=>{if(typeof c!="string"||typeof u!="string")return;let v=`${c}\0${u}`,g=()=>(e.diffs.get(v)?.status??"loading")!=="loading";if(g())return;let[y,k]=[K(t).get(c),K(r).get(u)],_=f===void 0?typeof y=="string"&&typeof k=="string"&&Op({...b,hash:d,otherHash:p},await Ar(t,c,y),await Ar(r,u,k)):!so(h)&&{status:"error",message:f,retry:!1};!_||g()||(_.tries=e.diffs.get(v)?.tries,e.diffs.set(v,_),oo(e.notify))};await(t.npm?Pd(t.npm.name,t.npm.version,r.npm.version,o):Md(t.managedId,r.managedId,o,{scope:n}))}catch(o){if(o?.name==="AbortError"){Ee.get(i)===e&&Ee.delete(i);return}s={status:"error",message:o?.message??String(o),retry:so(o?.status)}}Object.assign(e,{ended:!0,rest:s}),s?.retry&&ao(e,s,e.tries),oo(e.notify),Bp()}var ro=0,Dp=[];async function Jf(i){ro<Vf?ro++:await new Promise(e=>{Dp.push(e)});try{return await i()}finally{let e=Dp.shift();e?e():ro--}}async function Xf(i,e,t,r,n,s,o,c,u){let d;try{let[p,h]=await Promise.all([Ar(r,n,s),Ar(o,c,u)]),f={path:n,hash:p,otherPath:c,otherHash:h},b=await Jf(()=>r.npm?Ld(r.npm.name,r.npm.version,o.npm.version,f):Rd(r.managedId,o.managedId,f));d=Op(b,p,h)??{status:"error",message:no,retry:!0},d.tries=t.tries}catch(p){if(p?.name==="AbortError"){i.diffs.get(e)===t&&i.diffs.delete(e);return}d={status:"error",message:p?.message??String(p),retry:so(p?.status)}}i.diffs.get(e)===t&&(d.status==="error"&&d.retry&&ao(i,d,t.tries),i.diffs.set(e,d),oo(i.notify))}function Np(i,e,t,r,n,s,o,c,u,d=!1,p=""){let h=`${i.integrity}\0${r.integrity}\0${p}`,f=Ee.get(h);if(Ee.delete(h),(!f||f.rest?.until!==void 0&&Date.now()>=f.rest.until)&&(f={diffs:f?.diffs??new Map,notify:null,ended:!1,rest:null,tries:f?.rest?.tries},Yf(h,f,i,r,p)),Ee.set(h,f),Bp(),f.notify=c,t!==K(i).get(e)||s!==K(r).get(n))return{status:"error",message:no,retry:!1};let b=`${e}\0${n}`,v=f.diffs.get(b);if(!v&&!f.ended&&!d)return{status:"loading"};if(!v&&f.rest)return f.rest;if(v?.status==="ready"){if(v.copies[0]===u?.[0]&&v.copies[1]===u?.[1])return v.tries=0,v.settings[Number(o)];v=ao(f,{status:"error",message:no,retry:!0},v.tries),f.diffs.set(b,v)}if(v&&!(v.status==="error"&&v.until!==void 0&&Date.now()>=v.until))return v;let g={status:"loading",tries:v?.tries};return f.diffs.set(b,g),Xf(f,b,g,i,e,t,r,n,s),g}function zp(){for(let[i,e]of Ee)if(e.rest?.retry)Ee.delete(i);else for(let[t,r]of e.diffs)r.status==="error"&&r.retry&&e.diffs.delete(t)}var Qf=2,Zf=5e3,eg=5*6e4,tg=new Set(["ts","mts","cts"]),ig=i=>!(i>=400&&i<500&&i!==429),Hp=(i,e)=>`${i??""}\0${e??""}`,Te=new Map,lo=new Map;function Up(){for(let[i,e]of Te){if(Te.size<=Qf)break;e.ended&&Te.delete(i)}}async function qp(i,e,t){if(e===null)return t===null;let r=typeof e=="string"?K(i).get(e):void 0;return typeof r=="string"&&t===await(i.fileHashes?.get(e)??yi(r))}async function rg(i,e,t,r,n){let s=!1,o=new Set;try{let c=async({path:u,hash:d,otherPath:p,otherHash:h})=>{u===void 0||p===void 0||(u??p)===null||await qp(t,u,d)&&await qp(r,p,h)&&o.add(Hp(u,p))};await(t.npm?Id(t.npm.name,t.npm.version,r.npm.version,c):Ad(t.managedId,r.managedId,c,{scope:n}))}catch(c){if(c?.name==="AbortError"){Te.get(i)===e&&Te.delete(i);return}s=ig(c?.status)}if(Object.assign(e,{files:o,ended:!0}),s){let c=lo.get(i)??0;lo.set(i,c+1),setTimeout(()=>{Te.get(i)===e&&(Te.delete(i),e.notify?.())},Math.min(Zf*2**c,eg))?.unref?.()}else lo.delete(i);e.notify?.(),Up()}function jp(i,e,t,{kind:r,basePath:n=t},{before:s,after:o},c,u=""){if(r==="repointed"||!si(i,e))return!1;let d=[r==="added"?null:n,r==="removed"?null:t];if(!d.every(f=>f===null||tg.has(Wi(f)))||d[0]!==null&&s!==K(i).get(n)||d[1]!==null&&o!==K(e).get(t))return!1;let p=`${i.integrity}\0${e.integrity}\0${u}`,h=Te.get(p);return Te.delete(p),h||(h={files:new Set,notify:null,ended:!1},rg(p,h,i,e,u)),Te.set(p,h),Up(),h.notify=c,h.files.has(Hp(...d))}function ng(i,e){let t=e===void 0?"The bundle records no format for it now":`The bundle loads it as ${e}`,r=i===void 0?"no format recorded before":e===void 0?`${i} before`:`as ${i} before`,[n,s]=[en.isResourceFormat(i),en.isResourceFormat(e)];return`${t}, ${r}${n===s?"":n?", carried as data before, run as code now":", run as code before, carried as data now"}`}function oi(i=[],e=!1){return i.map(({field:t,from:r,to:n})=>t==="format"?a`<span class="bundle-compare-code-meta">${e?"format":`${r??"none"} \u2192 ${n??"none"}`}</span>`:a`<span class="${`bundle-compare-code-meta${n?"":" is-dropped"}`}">${t==="executable"?n?"+x":"\u2212x":n?"new entry":"entry"}</span>`)}var Vp=(i=[])=>i.filter(({field:e,to:t})=>e==="format"||t).map(({field:e,from:t,to:r})=>({name:e==="format"?`${t??"none"} \u2192 ${r??"none"}`:e==="executable"?"+x":"new entry",severity:"high"}));function Kp(i=[]){return i.map(({field:e,from:t,to:r})=>e==="format"?`${ng(t,r)}.`:e==="executable"?r?"It is now executable.":"It is no longer executable.":r?"It is now an entry point of the bundle.":"It is no longer an entry point of the bundle.").join(" ")}var Dr=[{kind:"changed",label:"Modified",letter:"M"},{kind:"renamed",label:"Renamed",letter:"\u2192"},{kind:"added",label:"Added",letter:"A"},{kind:"removed",label:"Removed",letter:"D"},{kind:"repointed",label:"Repointed",letter:"R"}],Ir=Object.fromEntries(Dr.map(i=>[i.kind,i])),te=2e3,sg=1e5,og=16*1024*1024,ag=24,Fr=3,lg=300,co=30,Gp=[{mode:"files",label:"Filter files",placeholder:"Filter changed files",icon:Ui},{mode:"code",label:"Search code",placeholder:"Search changed code",icon:ji}],Wp=ze/2,Yp=65536,Jp=new WeakSet,cg={large:"A large diff, not shown yet: the lines it removed aren't searched.",printed:"Shown pretty-printed: its lines as published, unsigned, the lines it removed not searched.",numbered:"Shown pretty-printed: its lines numbered as published."},Xp={"+":{name:"add",label:"Added"},"\u2212":{name:"del",label:"Removed"}," ":{name:"ctx",label:"Unchanged"}},N={layout:"unified",ignoreWhitespace:!1,ignoreRenames:!1,ignoreTypes:!1},Qp=()=>`${N.ignoreWhitespace}\0${N.ignoreRenames}`,Zp="Hide renamed names",eh="Hide type-only changes",th="Hide whitespace changes",ih={mixed:"Whitespace changes are shown: hiding them would hide blanks of more than one kind changing."},uo=(i,e)=>i?.kind==="stasis"?i.bundle?.formats?.get(e):void 0,mo=i=>/\.[cm]?js$/iu.test(i),dg=(i,{ignoreRenames:e}=N)=>e&&mo(i),rh=(i,e,t)=>Fc(i,e,t).category==="minified",nh="A license file",sh=new WeakMap;function ug(i){let e=sh.get(i);if(e)return e;e=new Map;let t=(n,s,o)=>{n&&e.set(n,[...e.get(n)??[],{label:s,note:o}])};if(i?.kind==="stasis")for(let n of i.bundle?.entries??[])t(n,"entry","An entry point of the bundle");let r=i?.npm?.manifest;if(r){let n=new Set(K(i).keys());for(let o of["main","module","types"])typeof r[o]=="string"&&t(bn(r[o],n),o,`package.json "${o}": ${r[o]}`);for(let[o,c]of Object.entries(r.bin??{}))typeof c=="string"&&t(bn(c,n),"bin",`package.json "bin" ${o}: ${c}`);let s=Map.groupBy(typeof r.license=="string"?Vc(r.license,[...n]).filter(o=>o.file):[],o=>o.file);for(let o of n)vn.test(o)&&t(o,"license",s.has(o)?`License: ${s.get(o).map(c=>c.text).join(", ")}`:nh)}else for(let n of K(i).keys())vn.test(n.slice(n.lastIndexOf("/")+1))&&t(n,"license",nh);return sh.set(i,e),e}var pg=/(?:^|\/)package\.json$/u,oh=new WeakMap;function ah(i,e,t){let r=oh.get(i);return r||oh.set(i,r=new Map),r.has(e)||r.set(e,jc(t,K(i).has(`${e.slice(0,-12)}binding.gyp`))),r.get(e)}var hg={unparsed:"the file couldn't be parsed",dynamic:"the file reads names by their spelling (eval or with)",jsx:"the file holds JSX","block-function":"the file declares a function in a block outside strict code",unverified:"the old side with the new names couldn't be checked to read as before"},lh=i=>`Renamed names are hidden, though the file reads ${i.map(e=>`.${e}`).join(", ")}, which a rename may change.`,bo=(i,e,t=N)=>`${i}\0${t.ignoreWhitespace}\0${dg(i,t)}\0${!!t.markRenames}\0${e}`,ch=new Map,po=new Set,dh=new WeakMap;function Or(i){let e=0;for(let t=i.indexOf(`
|
|
83
|
+
`,t+1))e++;return e};function Pp(i,e){if(typeof i!="string"||typeof e!="string")return null;if(i===e)return{additions:0,deletions:0};if(i==="")return{additions:Ln(e),deletions:0};if(e==="")return{additions:0,deletions:Ln(i)};if(i.length+e.length>Nf||Ln(i)+Ln(e)>zf)return null;let t=0,n=0;for(let{a0:r,a1:s,b0:o,b1:c}of Ce(i,e))t+=c-o,n+=s-r;return{additions:t,deletions:n}}var Qs=(i,e,t=Ce(i,e,!0))=>!Mp(i,e,t);function Ap(i,e){let t=Ce(i,e,!0);return{hides:Qs(i,e,t),mixed:Jt(i,e,t)}}var qf=new Set(["module","commonjs","module-typescript","commonjs-typescript","json","solidity","php","shell","rust","java","kotlin","gradle","objc","objcpp","swift","c","cpp","c-header","cpp-header","xml","cmake","pbxproj"]),Hf=/\.(?:[cm]?js|jsx|[cm]?ts|tsx|json5?|jsonc|css|scss|less|html?|xhtml|xml|svg|c|h|cc|cpp|cxx|hh|hpp|hxx|java|kts?|go|rs|cs|swift|php|sh|bash|zsh)$/u,Uf=new Set(["#!/usr/bin/env node","#! /usr/bin/env node","#!/usr/bin/node","#!/usr/local/bin/node","#!/usr/bin/env nodejs","#!/usr/bin/env deno","#!/usr/bin/env bun","#!/bin/sh","#! /bin/sh","#!/bin/sh -e","#!/usr/bin/env sh","#!/bin/bash","#! /bin/bash","#!/bin/bash -e","#!/usr/bin/env bash","#!/bin/zsh","#!/usr/bin/env zsh","#!/bin/dash"]);function Zs(i,e="",t=void 0){return typeof t=="string"?qf.has(t):Hf.test(i.toLowerCase())||typeof e=="string"&&Uf.has(e.split(`
|
|
84
|
+
`,1)[0])}function Lt(i,e=new Map,{context:t=Of,split:n=!1}={}){let{a:r,blocks:s}=i,o=[],c=0,u=0;for(let d=0;d<=s.length;d++){let p=s[d],h=(p?p.a0:r.length)-c,f=d===0,b=d===s.length,v=e.get(d),g=f?0:t+(v?.top??0),y=b?0:t+(v?.bottom??0);if(v?.all||h-g-y<Bf)for(let _=0;_<h;_++)o.push({kind:"ctx",a:c+_,b:u+_});else{for(let _=0;_<g;_++)o.push({kind:"ctx",a:c+_,b:u+_});o.push({kind:"fold",run:d,a:c+g,b:u+g,count:h-g-y,up:!b,down:!f});for(let _=h-y;_<h;_++)o.push({kind:"ctx",a:c+_,b:u+_})}if(!p)break;let k=to(i,d);if(n)for(let[_,x,S]of k)o.push({kind:"change",change:d,left:_,right:x,paired:S});else{let _=new Map,x=new Map;for(let[S,T,F]of k)F&&(_.set(S,T),x.set(T,S));for(let S=p.a0;S<p.a1;S++)o.push({kind:"del",a:S,change:d,pair:_.get(S)??null});for(let S=p.b0;S<p.b1;S++)o.push({kind:"add",b:S,change:d,pair:x.get(S)??null})}c=p.a1,u=p.b1}return o}function jf(i,e){return eo(i.a,i.b,e)}function eo(i,e,t){let n=Qc(i.slice(t.a0,t.a1),e.slice(t.b0,t.b1)).map(([c,u])=>[t.a0+c,t.b0+u]),r=[],s=t.a0,o=t.b0;for(let[c,u]of[...n,[t.a1,t.b1]]){for(;s<c||o<u;)r.push([s<c?s++:null,o<u?o++:null,!1]);c<t.a1&&(r.push([c,u,!0]),s=c+1,o=u+1)}return r}function to(i,e){return i.aligned??=new Map,i.aligned.has(e)||i.aligned.set(e,jf(i,i.blocks[e])),i.aligned.get(e)}function Ip(i,e,t='<mark class="diff-word">',n="</mark>"){if(!e||e.length===0)return i;let r=!1,s="",o=0,c=0,u=()=>{for(;c<e.length&&o>=e[c][1];)r&&(s+=n,r=!1),c++};for(let d=0;d<i.length;){if(u(),i[d]==="<"){let f=i.indexOf(">",d),b=f===-1?i.slice(d):i.slice(d,f+1);s+=r?n+b+t:b,d+=b.length;continue}!r&&c<e.length&&o>=e[c][0]&&(s+=t,r=!0);let p=i[d]==="&"?i.indexOf(";",d):-1,h=p===-1||p-d>10?i[d]:i.slice(d,p+1);s+=h,d+=h.length,o++}return u(),r?s+n:s}function Fp(i,e){if(!e||e.length===0)return[{text:i,marked:!1}];let t=[],n=0;for(let[r,s]of e)r>n&&t.push({text:i.slice(n,r),marked:!1}),s>r&&t.push({text:i.slice(r,s),marked:!0}),n=s;return n<i.length&&t.push({text:i.slice(n),marked:!1}),t}var io=100,Pn=20;function ri(i,e,t=Pn,n=0,r=i.length){let s=[];for(let o=n;o<Math.min(r,i.length)&&s.length<t;o++){let c=e.ranges(i[o]);c.length>0&&s.push({line:o,text:i[o],ranges:c})}return s}var Dp=(i,e,t,n)=>eo(i,e,n);function Vf(i,e,t,n,{split:r=!1,align:s=Dp}={}){return i===e?ri(Q(e),t).map(o=>({...o,side:"b",sign:" "})):i===""?ri(Q(e),t).map(o=>({...o,side:"b",sign:"+"})):e===""?ri(Q(i),t).map(o=>({...o,side:"a",sign:"\u2212"})):Op(Q(i),Q(e),t,n,r,s)}function Op(i,e,t,n,r,s){let o=ri(e,t);if(!n)return o.map(h=>({...h,side:"b",sign:null}));let c=(h,f)=>{let[b,v]=h==="a"?["a0","a1"]:["b0","b1"],g=n.length,y=0;for(;y<g;){let k=y+g>>1;n[k][v]<=f?y=k+1:g=k}return y<n.length&&n[y][b]<=f?n[y]:null},u=[];for(let{a0:h,a1:f}of n){if(u.length===Pn)break;u.push(...ri(i,t,Pn-u.length,h,f))}let d=new Map;if(r){let h=new Set([...o.map(({line:f})=>c("b",f)),...u.map(({line:f})=>c("a",f))]);for(let f of h)f&&s(i,e,n,f).forEach(([b,v],g)=>{b!==null&&d.set(`a${b}`,g),v!==null&&d.set(`b${v}`,g)})}let p=h=>{let f=c(h.side,h.line);return f?r?[f.b0,0,d.get(`${h.side}${h.line}`),h.side==="a"?0:1]:h.side==="a"?[f.b0,0,0,h.line]:[h.line,1,0,0]:[h.line,1,0,0]};return[...o.map(h=>({...h,side:"b",sign:c("b",h.line)?"+":" "})),...u.map(h=>({...h,side:"a",sign:"\u2212"}))].toSorted((h,f)=>{let b=p(h),v=p(f);return b[0]-v[0]||b[1]-v[1]||b[2]-v[2]||b[3]-v[3]}).slice(0,Pn)}function Bp(i,e,t,{split:n=!1,align:r=Dp}={}){let s=[],o=0,c=u=>u!==""&&e.ranges(u).length>0;for(let{path:u,before:d,after:p}of i){if(typeof d!="string"||typeof p!="string"||!c(d)&&(d===p||!c(p)))continue;let h;if(d===p||d===""||p==="")h=Vf(d,p,e,null);else{let f=Q(d),b=Q(p),v=t(u,d,p);if(v?.length===0)continue;h=Op(f,b,e,v,n,r)}if(h.length!==0){if(s.length===io)return{files:s,hits:o,truncated:!0};s.push({path:u,hits:h}),o+=h.length}}return{files:s,hits:o,truncated:!1}}var Kf=2,Gf=2,Wf=5e3,Yf=5*6e4,Jf=30,ro="The server's diff doesn't match this file as shown.",si=(i,e)=>!!(i?.managedId&&e?.managedId)||!!i?.npm&&!!e?.npm&&i.npm.name===e.npm.name,so=i=>!(i>=400&&i<500&&i!==429),Ee=new Map;function zp(i,e,t){let{before:n,reason:r,reads:s,prettyHash:o,otherPrettyHash:c,ignoringWhitespace:u}=i??{},d=[i,u].map(h=>Array.isArray(h?.blocks)&&Array.isArray(h.marks)?{blocks:h.blocks,marks:h.marks}:null);if(!(i?.hash===e&&i.otherHash===t&&typeof n=="string"&&(r==null||typeof r=="string")&&Array.isArray(s)&&s.every(h=>typeof h=="string")&&d.every(Boolean)&&typeof o=="string"&&typeof c=="string"))return null;let p=d.map(h=>({status:"ready",before:n,...h,reason:r??null,reads:s}));return{status:"ready",before:n,reason:r??null,reads:s,copies:[o,c],settings:p}}var In=(i,e,t)=>i.fileHashes?.get(e)??yi(t),An=new Set;function oo(i){i&&(An.size===0&&setTimeout(()=>{let e=[...An];An.clear();for(let t of e)t()},Jf),An.add(i))}function ao(i,e,t=0){let n=Math.min(Wf*2**t,Yf);return Object.assign(e,{until:Date.now()+n,tries:t+1}),setTimeout(()=>{i.notify?.()},n)?.unref?.(),e}function qp(){for(let[i,e]of Ee){if(Ee.size<=Kf)break;e.ended&&Ee.delete(i)}}async function Xf(i,e,t,n,r){let s=null;try{let o=async({path:c,otherPath:u,hash:d,otherHash:p,status:h,message:f,...b})=>{if(typeof c!="string"||typeof u!="string")return;let v=`${c}\0${u}`,g=()=>(e.diffs.get(v)?.status??"loading")!=="loading";if(g())return;let[y,k]=[K(t).get(c),K(n).get(u)],_=f===void 0?typeof y=="string"&&typeof k=="string"&&zp({...b,hash:d,otherHash:p},await In(t,c,y),await In(n,u,k)):!so(h)&&{status:"error",message:f,retry:!1};!_||g()||(_.tries=e.diffs.get(v)?.tries,e.diffs.set(v,_),oo(e.notify))};await(t.npm?Fd(t.npm.name,t.npm.version,n.npm.version,o):Id(t.managedId,n.managedId,o,{scope:r}))}catch(o){if(o?.name==="AbortError"){Ee.get(i)===e&&Ee.delete(i);return}s={status:"error",message:o?.message??String(o),retry:so(o?.status)}}Object.assign(e,{ended:!0,rest:s}),s?.retry&&ao(e,s,e.tries),oo(e.notify),qp()}var no=0,Np=[];async function Qf(i){no<Gf?no++:await new Promise(e=>{Np.push(e)});try{return await i()}finally{let e=Np.shift();e?e():no--}}async function Zf(i,e,t,n,r,s,o,c,u){let d;try{let[p,h]=await Promise.all([In(n,r,s),In(o,c,u)]),f={path:r,hash:p,otherPath:c,otherHash:h},b=await Qf(()=>n.npm?Ad(n.npm.name,n.npm.version,o.npm.version,f):Pd(n.managedId,o.managedId,f));d=zp(b,p,h)??{status:"error",message:ro,retry:!0},d.tries=t.tries}catch(p){if(p?.name==="AbortError"){i.diffs.get(e)===t&&i.diffs.delete(e);return}d={status:"error",message:p?.message??String(p),retry:so(p?.status)}}i.diffs.get(e)===t&&(d.status==="error"&&d.retry&&ao(i,d,t.tries),i.diffs.set(e,d),oo(i.notify))}function Hp(i,e,t,n,r,s,o,c,u,d=!1,p=""){let h=`${i.integrity}\0${n.integrity}\0${p}`,f=Ee.get(h);if(Ee.delete(h),(!f||f.rest?.until!==void 0&&Date.now()>=f.rest.until)&&(f={diffs:f?.diffs??new Map,notify:null,ended:!1,rest:null,tries:f?.rest?.tries},Xf(h,f,i,n,p)),Ee.set(h,f),qp(),f.notify=c,t!==K(i).get(e)||s!==K(n).get(r))return{status:"error",message:ro,retry:!1};let b=`${e}\0${r}`,v=f.diffs.get(b);if(!v&&!f.ended&&!d)return{status:"loading"};if(!v&&f.rest)return f.rest;if(v?.status==="ready"){if(v.copies[0]===u?.[0]&&v.copies[1]===u?.[1])return v.tries=0,v.settings[Number(o)];v=ao(f,{status:"error",message:ro,retry:!0},v.tries),f.diffs.set(b,v)}if(v&&!(v.status==="error"&&v.until!==void 0&&Date.now()>=v.until))return v;let g={status:"loading",tries:v?.tries};return f.diffs.set(b,g),Zf(f,b,g,i,e,t,n,r,s),g}function Up(){for(let[i,e]of Ee)if(e.rest?.retry)Ee.delete(i);else for(let[t,n]of e.diffs)n.status==="error"&&n.retry&&e.diffs.delete(t)}var eg=2,tg=5e3,ig=5*6e4,ng=new Set(["ts","mts","cts"]),rg=i=>!(i>=400&&i<500&&i!==429),Vp=(i,e)=>`${i??""}\0${e??""}`,Te=new Map,lo=new Map;function Kp(){for(let[i,e]of Te){if(Te.size<=eg)break;e.ended&&Te.delete(i)}}async function jp(i,e,t){if(e===null)return t===null;let n=typeof e=="string"?K(i).get(e):void 0;return typeof n=="string"&&t===await(i.fileHashes?.get(e)??yi(n))}async function sg(i,e,t,n,r){let s=!1,o=new Set;try{let c=async({path:u,hash:d,otherPath:p,otherHash:h})=>{u===void 0||p===void 0||(u??p)===null||await jp(t,u,d)&&await jp(n,p,h)&&o.add(Vp(u,p))};await(t.npm?Od(t.npm.name,t.npm.version,n.npm.version,c):Dd(t.managedId,n.managedId,c,{scope:r}))}catch(c){if(c?.name==="AbortError"){Te.get(i)===e&&Te.delete(i);return}s=rg(c?.status)}if(Object.assign(e,{files:o,ended:!0}),s){let c=lo.get(i)??0;lo.set(i,c+1),setTimeout(()=>{Te.get(i)===e&&(Te.delete(i),e.notify?.())},Math.min(tg*2**c,ig))?.unref?.()}else lo.delete(i);e.notify?.(),Kp()}function co(i,e,t,{kind:n,basePath:r=t},{before:s,after:o},c,u=""){if(n==="repointed"||!si(i,e))return!1;let d=[n==="added"?null:r,n==="removed"?null:t];if(!d.every(f=>f===null||ng.has(Wi(f)))||d[0]!==null&&s!==K(i).get(r)||d[1]!==null&&o!==K(e).get(t))return!1;let p=`${i.integrity}\0${e.integrity}\0${u}`,h=Te.get(p);return Te.delete(p),h||(h={files:new Set,notify:null,ended:!1},sg(p,h,i,e,u)),Te.set(p,h),Kp(),h.notify=c,h.files.has(Vp(...d))}function og(i,e){let t=e===void 0?"The bundle records no format for it now":`The bundle loads it as ${e}`,n=i===void 0?"no format recorded before":e===void 0?`${i} before`:`as ${i} before`,[r,s]=[tr.isResourceFormat(i),tr.isResourceFormat(e)];return`${t}, ${n}${r===s?"":r?", carried as data before, run as code now":", run as code before, carried as data now"}`}function oi(i=[],e=!1){return i.map(({field:t,from:n,to:r})=>t==="format"?a`<span class="bundle-compare-code-meta">${e?"format":`${n??"none"} \u2192 ${r??"none"}`}</span>`:a`<span class="${`bundle-compare-code-meta${r?"":" is-dropped"}`}">${t==="executable"?r?"+x":"\u2212x":r?"new entry":"entry"}</span>`)}var Gp=(i=[])=>i.filter(({field:e,to:t})=>e==="format"||t).map(({field:e,from:t,to:n})=>({name:e==="format"?`${t??"none"} \u2192 ${n??"none"}`:e==="executable"?"+x":"new entry",severity:"high"}));function Wp(i=[]){return i.map(({field:e,from:t,to:n})=>e==="format"?`${og(t,n)}.`:e==="executable"?n?"It is now executable.":"It is no longer executable.":n?"It is now an entry point of the bundle.":"It is no longer an entry point of the bundle.").join(" ")}var On=[{kind:"changed",label:"Modified",letter:"M"},{kind:"renamed",label:"Renamed",letter:"\u2192"},{kind:"added",label:"Added",letter:"A"},{kind:"removed",label:"Removed",letter:"D"},{kind:"repointed",label:"Repointed",letter:"R"}],Fn=Object.fromEntries(On.map(i=>[i.kind,i])),te=2e3,ag=1e5,lg=16*1024*1024,cg=24,Dn=3,dg=300,uo=30,Yp=[{mode:"files",label:"Filter files",placeholder:"Filter changed files",icon:Ui},{mode:"code",label:"Search code",placeholder:"Search changed code",icon:ji}],Jp=ze/2,Xp=65536,Qp=new WeakSet,ug={large:"A large diff, not shown yet: the lines it removed aren't searched.",printed:"Shown pretty-printed: its lines as published, unsigned, the lines it removed not searched.",numbered:"Shown pretty-printed: its lines numbered as published."},Zp={"+":{name:"add",label:"Added"},"\u2212":{name:"del",label:"Removed"}," ":{name:"ctx",label:"Unchanged"}},N={layout:"unified",ignoreWhitespace:!1,ignoreRenames:!1,ignoreTypes:!1},eh=()=>`${N.ignoreWhitespace}\0${N.ignoreRenames}`,hh="Hide renamed names",go="Hide type-only changes",mh="Hide whitespace changes",po=()=>`${!!l.bundleSourcePretty}\0${N.ignoreWhitespace}\0${N.ignoreRenames}\0${N.ignoreTypes}`,th=({pretty:i,spacesHidden:e,hiding:t,typesHidden:n})=>[i?.status==="ready"&&"Pretty-print",e&&mh,t&&hh,n&&go].filter(Boolean),ih={mixed:"Whitespace changes are shown: hiding them would hide blanks of more than one kind changing."},ho=(i,e)=>i?.kind==="stasis"?i.bundle?.formats?.get(e):void 0,bo=i=>/\.[cm]?js$/iu.test(i),pg=(i,{ignoreRenames:e}=N)=>e&&bo(i),nh=(i,e,t)=>Bc(i,e,t).category==="minified",rh="A license file",sh=new WeakMap;function hg(i){let e=sh.get(i);if(e)return e;e=new Map;let t=(r,s,o)=>{r&&e.set(r,[...e.get(r)??[],{label:s,note:o}])};if(i?.kind==="stasis")for(let r of i.bundle?.entries??[])t(r,"entry","An entry point of the bundle");let n=i?.npm?.manifest;if(n){let r=new Set(K(i).keys());for(let o of["main","module","types"])typeof n[o]=="string"&&t(br(n[o],r),o,`package.json "${o}": ${n[o]}`);for(let[o,c]of Object.entries(n.bin??{}))typeof c=="string"&&t(br(c,r),"bin",`package.json "bin" ${o}: ${c}`);let s=Map.groupBy(typeof n.license=="string"?Wc(n.license,[...r]).filter(o=>o.file):[],o=>o.file);for(let o of r)vr.test(o)&&t(o,"license",s.has(o)?`License: ${s.get(o).map(c=>c.text).join(", ")}`:rh)}else for(let r of K(i).keys())vr.test(r.slice(r.lastIndexOf("/")+1))&&t(r,"license",rh);return sh.set(i,e),e}var mg=/(?:^|\/)package\.json$/u,oh=new WeakMap;function ah(i,e,t){let n=oh.get(i);return n||oh.set(i,n=new Map),n.has(e)||n.set(e,Gc(t,K(i).has(`${e.slice(0,-12)}binding.gyp`))),n.get(e)}var fg={unparsed:"the file couldn't be parsed",dynamic:"the file reads names by their spelling (eval or with)",jsx:"the file holds JSX","block-function":"the file declares a function in a block outside strict code",unverified:"the old side with the new names couldn't be checked to read as before"},lh=i=>`Renamed names are hidden, though the file reads ${i.map(e=>`.${e}`).join(", ")}, which a rename may change.`,_o=(i,e,t=N)=>`${i}\0${t.ignoreWhitespace}\0${pg(i,t)}\0${!!t.markRenames}\0${e}`,ch=new Map,mo=new Set,dh=new WeakMap;function Bn(i){let e=0;for(let t=i.indexOf(`
|
|
85
85
|
`);t!==-1;t=i.indexOf(`
|
|
86
|
-
`,t+1))e++;return e}var
|
|
86
|
+
`,t+1))e++;return e}var gg=i=>i.length*3<=Gi||i.length<=Gi&&ha(i)<=Gi,Nn=i=>i.printing?.applies?i.pretty??{status:"off"}:null,bg=5,vg=i=>i?i.length>bg?`
|
|
87
87
|
Affects files: ${i.length.toLocaleString()}`:`
|
|
88
88
|
Affects files:
|
|
89
89
|
${i.join(`
|
|
90
|
-
`)}`:"",vo=(i,e)=>a`<span class="bundle-compare-code-counts" aria-label="${`${i} added, ${e} removed lines`}"><span class="add">+${i.toLocaleString()}</span><span class="del">−${e.toLocaleString()}</span></span>`,at=(i,e)=>i.length+e.length>og||Or(i)+Or(e)>sg,uh=i=>i.kind==="repointed"||i.kind==="renamed"&&!i.modified&&!!i.repointed&&!i.meta,fo=i=>Array.isArray(i)?i.some(fo):i?.strings?i.strings.some(e=>e.trim()!=="")||i.values.some(fo):i!=null&&i!==m&&i!==!1&&i!=="",ho=new WeakMap;function hh(i,e){if(ho.has(i))return ho.get(i);let t=new Set;for(let r of e)for(let n=r.lastIndexOf("/");n>0&&!t.has(r.slice(0,n));n=r.lastIndexOf("/",n-1))t.add(r.slice(0,n));return ho.set(i,t),t}function ph(i){let e=K(i);return hh(e,e.keys())}function go(i,e){for(let t of i.files.values())if(t===e)return!0;for(let t of i.dirs.values())if(go(t,e))return!0;return!1}var Mt=class extends U{static properties={base:{attribute:!1},other:{attribute:!1},files:{attribute:!1},scope:{attribute:!1},resolutions:{attribute:!1},baseAlerts:{attribute:!1},otherAlerts:{attribute:!1},alertTags:{attribute:!1},newHosts:{attribute:!1},newHostTag:{attribute:!1},dependencies:{attribute:!1},openDependency:{attribute:!1},dependencyTags:{attribute:!1},extensions:{attribute:!1},baseName:{},otherName:{},path:{},seek:{attribute:!1},_query:{state:!0},_kinds:{state:!0},_mode:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.base=null,this.other=null,this.files=null,this.scope="",this.resolutions=[],this.baseAlerts=null,this.otherAlerts=null,this.alertTags=null,this.newHosts=null,this.newHostTag=null,this.extensions=null,this._treeLimit=300,this._treeRemaining=1/0,this.path=null,this._query="",this._kinds=new Set(Dr.map(e=>e.kind)),this._mode="files",this._blocks=new Map,this._found=null,this._rowless=new Map,this._rowlessCount=0,this._aligned=new WeakMap,this._sought=null,this._soughtRow=null,this._open=new Map,this._models=new Map,this._modelCap=ag,this._counted=new Map,this._countModels=new Map,this._drawnCounts=new Map,this._spaced=new Map,this._shorter=new Map,this._expansions=new Map,this._limits=new Map,this._forced=new Set,this._shownPath=null}willUpdate(e){let t=`${this.base?.integrity}|${this.other?.integrity}`;if((t!==this._pair||e.has("files"))&&(this._pair=t,this._models.clear(),this._spaced.clear(),this._shorter.clear(),this._expansions.clear(),this._limits.clear(),this._forced.clear()),["files","resolutions","base","other"].some(r=>e.has(r))&&(this._entries=Js(this.base,this.other,this.files,this.resolutions??[]),this._counted=new Map,this._countModels=new Map,this._drawnCounts=new Map,this._treeLimit=this.extensions?.treePageSize??1/0,this._blocks.clear(),this._rowless.clear(),this._sought=this._soughtRow=null,this._soughtSettling=!1),e.has("seek")&&this.seek&&!Jp.has(this.seek)){Jp.add(this.seek);let{path:r,line:n,query:s}=this.seek,o=this._entries?.get(r),c=o?ce(this.base,this.other,r,o).after:null,u=typeof c=="string"?Q(c)[n]?.toLowerCase().indexOf(s.toLowerCase())??-1:-1;this._sought={path:r,side:"b",line:n,at:Math.max(u,0),query:s},this._soughtRow=null,this._soughtSettling=!1}}updated(){if(this._current!==this._shownPath){this._shownPath=this._current;let e=this.querySelector(".bundle-compare-diff");e&&(e.scrollTop=0),this.querySelector(".bundle-compare-code-tree .bundle-code-tree-link.current")?.scrollIntoView({block:"nearest"})}this._scrollSought()}_scrollSought(){if(this._sought?.path===this._current&&!this._soughtSettling&&(this._sought=null),!this._soughtRow)return;let{path:e,index:t}=this._soughtRow;this._soughtRow=null;let n=[...this.querySelectorAll(".bundle-compare-diff-table")].find(o=>o.dataset.path===e)?.children[t];if(!n)return;let s=n.closest(".bundle-compare-diff");n.scrollIntoView({block:s&&n.offsetHeight>s.clientHeight/2?"start":"center"}),n.classList.remove("is-sought"),n.offsetWidth,n.classList.add("is-sought"),n.addEventListener("animationend",()=>n.classList.remove("is-sought"),{once:!0})}_shown(e){return this._kinds.has(e.kind)||!!e.modified&&this._kinds.has("changed")||!!e.repointed&&this._kinds.has("repointed")}_modules(){let e=this.base?.kind==="stasis"?this.base.bundle?.modules:null,t=this.other?.kind==="stasis"?this.other.bundle?.modules:null,r={root:this.files?.root,paths:this.files?.basePaths??new Map};return e||t?new Map([...[...e??[]].map(([n,s])=>[Xc(r,n,Object.keys(s.files??{})),s]),...t??[]]):null}_baseDirs(){let e=this.files?.root?this.files.basePaths:null;return e?hh(e,e.values()):ph(this.base)}_format(e){let t=this._entries.get(e),r=Zr(this.base,t?.basePath??e),n=Zr(this.other,e);return[r,n].find(ba)??(t?.kind==="removed"?r:n)}_tree(){let e=[this._entries,`${[...this._kinds].join()}:${!!this.extensions?.fullPaths}`];if(this._treeKey?.[0]===e[0]&&this._treeKey[1]===e[1])return this._treeMemo;let t=[...this._entries.keys()],r=this._modules(),n=Ji(this.files?.root,this.extensions?.fullPaths?"":Ec(ft(t).prefix,r,t)),{prefix:s}=n,o=t.filter(d=>this._shown(this._entries.get(d))),c=d=>s&&d.startsWith(s)?d.slice(s.length):d,u=Ki(o.map(c),o,r);return this._treeKey=e,this._treeMemo={prefix:s,root:n,tree:u,shown:o.length,allOrder:Wt(u)},this._treeMemo}_select(e){!e||e===this._current||this.extensions?.canSelect?.()===!1||this.dispatchEvent(new CustomEvent("compare-code-select",{detail:{path:e},bubbles:!0,composed:!0}))}_reveal(e,t){let r=(t&&e.startsWith(t)?e.slice(t.length):e).split("/");for(let n=1;n<r.length;n++)this._open.set(r.slice(0,n).join("/"),!0)}_railState(){let{prefix:e,root:t,tree:r,shown:n,allOrder:s}=this._tree(),o=Tc(r,this._mode==="files"?this._query:"",e,this.extensions?.fileFilter);return{prefix:e,root:t,tree:r,shown:n,filtered:o,order:o===r?s:o?Wt(o):[],allOrder:s}}_renderRail({prefix:e,root:t,tree:r,shown:n,filtered:s,order:o},c){this._countUntil=null,this._treeRemaining=this.extensions?.treePageSize?this._treeLimit:1/0,this._treeTruncated=!1;let u=this._mode==="code"?m:s?this._renderTree(s,c,0,!!this._query||n<=(this.extensions?.openAllMax??lg)):a`<div class="bundle-code-search-empty">No changed files match.</div>`,d=Object.fromEntries(Dr.map(({kind:h})=>[h,0]));for(let h of this._entries.values())h.kind!=="repointed"&&d[h.kind]++,h.modified&&d.changed++,h.repointed&&d.repointed++;let p=Gp.find(({mode:h})=>h===this._mode);return a`<aside class="bundle-code-rail"><div class="bundle-code-rail-head"><span class="bundle-code-rail-label">${this.extensions?.railLabel??"Changes"}</span> <span class="bundle-code-rail-count">${this._entries.size.toLocaleString()}</span> <span class="bundle-code-rail-actions"><button type="button" class="bundle-code-rail-action" aria-label="${this.extensions?.collapseLabel??"Collapse directories"}" data-tooltip="Collapse directories" ?disabled="${this._mode!=="files"||!!this._query&&!this.extensions?.collapseClearsSearch||r.dirs.size===0}" @click="${()=>this._collapseAll(r)}">${bc}</button></span></div>${t.from?a`<div class="bundle-code-rail-prefix mono" data-tooltip="${`Root moved: ${t.from} \u2192 ${t.to}`}">${Er(t)}</div>`:e?a`<div class="bundle-code-rail-prefix mono" data-tooltip-truncated data-tooltip="${e}">${e}</div>`:m}<div class="bundle-compare-code-filter"><label class="bundle-compare-code-search"><svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true"><circle cx="7" cy="7" r="4.5"/><path d="m10.5 10.5 3.5 3.5"/></svg> <input type="search" placeholder="${this._mode==="files"?this.extensions?.searchPlaceholder??p.placeholder:p.placeholder}" aria-label="${this._mode==="files"?this.extensions?.searchLabel??p.placeholder:p.placeholder}" spellcheck="false" autocomplete="off" .value="${j(this._query)}" @input="${h=>{this._query=h.target.value,this._treeLimit=this.extensions?.treePageSize??1/0}}"> <span class="bundle-code-search-modes" role="tablist">${Gp.map(({mode:h,label:f,icon:b})=>a`<button type="button" class="${I({"bundle-code-search-mode":!0,active:h===this._mode})}" role="tab" aria-selected="${String(h===this._mode)}" aria-label="${f}" data-tooltip="${f}" @click="${()=>{this._mode=h}}">${b}</button>`)}</span></label> ${this.extensions?.filters??a`<div class="bundle-compare-code-kinds" role="group" aria-label="Show changes">${Dr.filter(({kind:h})=>d[h]>0).map(({kind:h,label:f})=>a`<button type="button" class="${`bundle-compare-code-kind ${h}`}" aria-pressed="${String(this._kinds.has(h))}" data-tooltip="${`${this._kinds.has(h)?"Hide":"Show"} ${f.toLowerCase()} files`}" @click="${()=>this._toggleKind(h)}">${f.toLowerCase()}</button>`)}</div>`}</div><div class="bundle-code-rail-body bundle-compare-code-tree">${this._mode==="code"?this._renderSearch(o,c,e):u} ${this._mode==="files"&&this._treeTruncated?a`<button type="button" class="bundle-compare-code-action" @click="${()=>{this._treeLimit+=this.extensions.treePageSize,this.requestUpdate()}}">Show more files</button>`:m}</div>${this.extensions?.footer?.(h=>{this._query="",this._select(h)})??m}</aside><bundle-code-splitter role="separator" tabindex="0" aria-orientation="vertical" aria-label="Resize file tree" data-tooltip="Drag to resize · double-click to reset"></bundle-code-splitter>`}_arrived=0;_renamesAlone=!0;_repaint=()=>{this._arrived++,this.isConnected&&this.requestUpdate()};disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this._countLater),clearTimeout(this._searchLater),this._countLater=this._searchLater=null}render(){let e=this._railState(),t=this._entries.has(this.path)?this.path:e.order[0]??null;t&&t!==this._current&&this._reveal(t,e.prefix),this._current=t,this._order=this.extensions?.filterContent===!1?e.allOrder:e.order;let r=t?a`${this._renderFile(t,this.extensions?.fullPaths?"":e.prefix)}${this.extensions?.fileActions?.(t,!1)??m}`:a`<div class="bundle-code-placeholder">No files differ in this comparison.</div>`;return a`<div class="bundle-code-view bundle-compare-code">${this._renderRail(e,t)}<div class="bundle-code-main">${r}</div></div>`}_toggleKind(e){let t=new Set(this._kinds);t.has(e)?t.delete(e):t.add(e),this._kinds=t}_collapseAll(e){this.extensions?.collapseClearsSearch&&(this._query=""),this._treeLimit=this.extensions?.treePageSize??1/0;let t=r=>{for(let n of r.dirs.values())this._open.set(n.path,!1),t(n)};t(e),this.requestUpdate()}_renderSearch(e,t,r){if(!this._query)return a`<div class="bundle-code-search-hint">Type to search the code of the changed files.</div>`;let{files:n,hits:s,truncated:o,unsigned:c}=this._searchResults(e);if(n.length===0)return a`<div class="bundle-code-search-empty">No matches.</div>`;let u=d=>r&&d.startsWith(r)?d.slice(r.length):d;return a`<div class="bundle-code-search-results bundle-compare-search"><div class="bundle-code-search-summary">${s.toLocaleString()} ${s===1?"hit":"hits"} in ${n.length.toLocaleString()} ${n.length===1?"file":"files"}${o?`, the first ${io}`:""}</div>${le(n,d=>d.path,({path:d,hits:p})=>a`<div class="${I({"bundle-code-search-file":!0,current:d===t})}"><button type="button" class="${`bundle-code-search-file-name bundle-compare-code-name ${this._entries.get(d).kind}`}" data-tooltip-truncated data-tooltip="${d}" @click="${()=>this._select(d)}">${u(d)}</button> ${c.has(d)?a`<p class="bundle-compare-search-note">${cg[c.get(d)]}</p>`:m}<ul class="bundle-code-search-hits">${p.map(h=>a`<li class="bundle-code-search-hit"><button type="button" class="bundle-code-search-hit-link" aria-label="${`${Xp[h.sign]?.label??"Line"} ${h.line+1}${h.side==="a"?" of the old text":""}: ${h.text.trim().slice(0,80)}`}" @click="${()=>this._seek(d,h)}"><span class="bundle-code-search-hit-ln">${h.line+1}</span> <span class="${`bundle-compare-search-sign ${Xp[h.sign]?.name??""}`}" aria-hidden="true">${h.sign??""}</span> <span class="bundle-code-search-hit-text mono">${_d(h.text,h.ranges)}</span></button></li>`)}</ul></div>`)}</div>`}_searchResults(e){let t=Qp(),r=`${this._query}\0${this._forced.size}\0${t}\0${N.layout}\0${!!l.bundleSourcePretty}\0${Nc()}\0${this._rowlessCount}\0${e.join("\0")}`;if(this._found?.key===r&&this._found.entries===this._entries)return this._found.result;let n=null,s=!0,o=new Map,c=(h,f,b)=>{if(o.get(h)==="printed")return null;let v=`${N.ignoreWhitespace}\0${h}`;if(this._blocks.has(v))return this._blocks.get(v);if(!this._forced.has(h)&&at(f,b))return o.set(h,"large"),null;let g=performance.now();if(n??=g+co,g>n)return s=!1,null;let y=N.ignoreWhitespace&&!this._unlisted(h,this._entries.get(h),{before:f,after:b}),k=Ce(f,b,y);return y&&Jt(f,b,k)&&(k=Ce(f,b)),this._blocks.set(v,k),k},u=e.flatMap(h=>{let f=this._entries.get(h);if(!this._searchable(f))return[];let b=ce(this.base,this.other,h,f),{before:v,after:g}=b;if(this._prettyShown(h,f,b)){if(!/\S/u.test(this._query))return[];let y=v!==""&&g!==""&&v!==g;if(y&&this._rowless.get(h)===t)return[];o.set(h,y?"printed":"numbered")}return[{path:h,...b}]}),d=(h,f,b,v)=>{let g=this._aligned.get(b);return g||this._aligned.set(b,g={a:h,b:f,blocks:b}),to(g,b.indexOf(v))},p={...Fp(u,yd(this._query,!1,!1),c,{split:N.layout==="split",align:d}),unsigned:o};return s?this._found={key:r,entries:this._entries,result:p}:this._searchLater??=setTimeout(()=>{this._searchLater=null,this.requestUpdate()}),p}_searchable(e){return e.modified!==!1||uh(e)}_prettyShown(e,t,r){if(!l.bundleSourcePretty)return!1;let n=this._printing(e,t,r);return!!n?.applies&&n.copies.status!=="error"}_noteRowless(e,t){let r=t?Qp():void 0;this._rowless.get(e)!==r&&(r===void 0?this._rowless.delete(e):this._rowless.set(e,r),this._rowlessCount++)}_seek(e,t){this._sought={path:e,side:t.side,line:t.line,at:t.ranges[0]?.[0]??0,query:this._query},e===this._current?this.requestUpdate():this._select(e,!1)}_soughtLine(e,t,r,n){let{side:s,line:o,at:c,query:u}=this._sought;if(r?.status!=="ready")return{side:s,line:o};let d=y=>y.replaceAll(/\s+/gu,""),p=Q(ce(this.base,this.other,e,t)[s==="a"?"before":"after"]??""),h=p.slice(0,o).reduce((y,k)=>y+d(k).length,0)+d(p[o]?.slice(0,c)??"").length,f=d(u).toLowerCase(),b=(y,k)=>{if(!f)return null;let _=0,x=0,S=0,T="";for(let F of y)for(let O=0;O<F.length;O+=Yp){T+=d(F.slice(O,O+Yp)).toLowerCase();for(let z=T.indexOf(f,_);z!==-1;z=T.indexOf(f,_),x++){if(k(x,S+z))return{index:x,start:S+z};_=z+f.length}let A=Math.max(_,T.length-f.length+1);T=T.slice(A),S+=A,_=Math.max(0,_-A)}return null},v=b(p,(y,k)=>k>=h),g=(v&&b(n[s],y=>y===v.index)?.start)??h;for(let y=0;y<n[s].length;y++)if(g-=d(n[s][y]).length,g<0)return{side:s,line:y};return null}_seekRows(e,t,{side:r,line:n},s){let o=h=>r==="b"?(h.kind==="ctx"||h.kind==="add")&&h.b===n||h.kind==="change"&&h.right===n:(h.kind==="ctx"||h.kind==="del")&&h.a===n||h.kind==="change"&&h.left===n,c=this._expansions.get(e)??new Map,u=Lt(t,c,{split:s}),d=u.findIndex(o);if(d===-1){let h=u.find(f=>f.kind==="fold"&&n>=f[r]&&n<f[r]+f.count);if(h){let f=c.get(h.run)??{},b=n-h[r];c=new Map(c).set(h.run,h.down?{...f,top:(f.top??0)+b+1+Wp}:h.up?{...f,bottom:(f.bottom??0)+h.count-b+Wp}:{all:!0}),this._expansions.set(e,c),u=Lt(t,c,{split:s}),d=u.findIndex(o)}}let p=this._limits.get(e)??te;return d>=p&&this._limits.set(e,Math.ceil((d+1)/te)*te),{rows:u,index:d}}_takeTreeRow(e=!1){return this._treeRemaining-- >0?!0:(this._treeTruncated=!0,e)}_renderTree(e,t,r,n){let s=[...e.dirs.entries()].toSorted(Mc),o=[...e.files.entries()].toSorted(([d],[p])=>d.localeCompare(p)),c=s.flatMap(([d,p])=>{let h=Rc(d,p,r),f=p.package,b=f?.ecosystem==="cargo"||f?.ecosystem==="composer"||f?.ecosystem==="soldeer",v=this._query?!0:this._open.get(p.path)??(n||r===0||go(p,t)),g=this._baseDirs().has(p.sourcePath)?ph(this.other).has(p.sourcePath)?null:"removed":"added";if(!this._takeTreeRow(go(p,t)))return[];let y=a`<li class="bundle-code-tree-dir"><details .open="${j(v)}" @toggle="${k=>{let _=k.currentTarget.open;this._open.get(p.path)!==_&&(this._open.set(p.path,_),this.extensions?.treePageSize&&this.requestUpdate())}}"><summary aria-label="${this.extensions?.directoryLabel?.(h.node)??m}"><span class="bundle-code-tree-chevron" aria-hidden="true"></span> ${f?va(f.ecosystem):m} <span class="${I({"bundle-code-tree-dirname":!0,"bundle-code-tree-package":!!f,"bundle-code-tree-package-vendored":b,"bundle-compare-code-name":!0,removed:g==="removed"})}" data-tooltip-truncated data-tooltip="${h.node.sourcePath}">${f?a`<span class="bundle-code-tree-package-name">${f.name}</span>${f.version?a`<span class="bundle-code-tree-package-version">${b?"- ":"@"}${f.version}</span>`:m}`:h.names.map((k,_)=>a`${_>0?a`<span class="bundle-code-tree-separator">/</span>`:m}${k}`)} </span>${f?.variant?a`<span class="bundle-code-tree-variant">variant ${f.variant}</span>`:m} <span class="bundle-compare-code-dir-count" data-tooltip="${`${p.fileCount} changed ${p.fileCount===1?"file":"files"}`}">${this.extensions?.directorySummary?.(h.node)??p.fileCount}</span> ${g?a`<span class="${`bundle-compare-code-letter ${g}`}" data-tooltip="${`${f?"Package":"Directory"} ${g}`}">${Ir[g].letter}</span>`:m}</summary>${v||!this.extensions?.treePageSize?this._renderTree(h.node,t,r+1,n):m}</details></li>`;return[{key:p.path,content:y}]}),u=o.flatMap(([d,p])=>{if(!this._takeTreeRow(p===t))return[];let{kind:h,repointed:f,renamedFrom:b,modified:v}=this._entries.get(p),g=f?`${f.length} repointed ${f.length===1?"import":"imports"}`:"",y=a`<li class="bundle-code-tree-file"><button type="button" class="${I({"bundle-code-tree-link":!0,current:p===t})}" aria-label="${this.extensions?.fileLabel?.(p)??m}" aria-current="${p===t?"true":m}" @click="${()=>this._select(p)}">${this.extensions?.filePrefix?.(p)??m}${Ve(p,this._format(p))}<span class="${`bundle-code-tree-name bundle-compare-code-name ${h}`}" data-tooltip-truncated data-tooltip="${p}">${d}</span> ${this.extensions?.fileSuffix?.(p)??m} ${b?a`<span class="bundle-compare-code-oldname" data-tooltip-truncated data-tooltip="${`Renamed from ${b}`}">← ${Yi(b,p,{extension:!1}).from}</span>`:m} ${this._fileTags(p,this._entries.get(p),!0)} ${this._treeCounts(p,this._entries.get(p))} ${f&&h!=="repointed"?a`<span class="bundle-compare-code-letter repointed" data-tooltip="${g}">R</span>`:m} <span class="${I({"bundle-compare-code-letter":!0,[h]:!0,pure:h==="renamed"&&!v})}" data-tooltip="${h==="repointed"?g:b?`Renamed${v?" and modified":""} from ${b}`:Ir[h].label}">${Ir[h].letter}</span></button></li>`;return[{key:p,content:y}]});return a`<ul class="${I({"bundle-code-tree":!0,root:r===0})}" aria-label="${r===0?this.extensions?.treeLabel??"Changed files":m}" @keydown="${r===0?Lc:m}">${le(c,d=>d.key,d=>d.content)}${le(u,d=>d.key,d=>d.content)}</ul>`}_treeCounts(e,t){if(t.kind==="repointed")return m;let r=this._lineCounts(e,t),n=r&&this._shownCounts(e,t);if(!r||n===void 0)return m;let{additions:s,deletions:o}=n??r,c=r.additions>0||r.deletions>0,u=t.kind==="renamed",d=n?.renamed>0?`
|
|
91
|
-
\u2248${
|
|
92
|
-
As published: +${r.additions.toLocaleString()} \u2212${r.deletions.toLocaleString()}`:null;if(s===0&&o===0){if((u||t.modified===!1)&&!c)return a`<span class="bundle-compare-code-line-counts unchanged" aria-label="No line changes">=</span>`;if(n&&c)return a`<span class="bundle-compare-code-line-counts unchanged" aria-label="${`No line changes with ${n.aside.join(", ")}`}" data-tooltip="${`No line changes with ${p}`}">≈</span>`}let h=n&&(s!==r.additions||o!==r.deletions);return a`<span class="bundle-compare-code-line-counts" aria-label="${`${s} added, ${o} removed lines`}" data-tooltip="${h?`With ${p}`:m}"><span class="${I({add:!0,empty:u&&s===0})}">+${s.toLocaleString()}</span> <span class="${I({del:!0,empty:t.kind==="added"||u&&o===0})}">−${o.toLocaleString()}</span></span>`}_countingState(e,t){return this._fileState(e,t,!0)}_shownCounts(e,t){if(!(l.bundleSourcePretty||N.ignoreWhitespace||N.ignoreRenames||N.ignoreTypes))return null;let r=`${!!l.bundleSourcePretty}\0${N.ignoreWhitespace}\0${N.ignoreRenames}\0${N.ignoreTypes}\0${this._arrived}\0${this._forced.size}`,n=this._drawnCounts.get(e);if(n?.settings===r)return n.counts;let s=performance.now();if(this._countUntil??=s+co,s>this._countUntil){this._countLater??=setTimeout(()=>{this._countLater=null,this.requestUpdate()});return}let{pretty:o,hiding:c,model:u,spacesHidden:d,typesHidden:p}=this._countingState(e,t),h=[o?.status==="ready"&&"Pretty-print",d&&th,c&&Zp,p&&eh].filter(Boolean),f=u&&h.length>0?{additions:u.additions,deletions:u.deletions,renamed:u.renamed,aside:h}:null;return this._drawnCounts.set(e,{settings:r,counts:f}),f}_lineCounts(e,t){if(this._counted.has(e))return this._counted.get(e);let r=performance.now();if(this._countUntil??=r+co,r>this._countUntil)return this._countLater??=setTimeout(()=>{this._countLater=null,this.requestUpdate()}),null;let{before:n,after:s}=ce(this.base,this.other,e,t),o=Rp(n,s);return this._counted.set(e,o),o}_model(e,t,r,n={},s=N.ignoreWhitespace){let o=n.changes?.blocks??n.marks??null,c=this._models.get(e);return this._models.delete(e),c?.before===t&&c.after===r&&c.given===o||(c={model:Lr(t,r,{...n,ignoreWhitespace:s}),before:t,after:r,given:o}),this._models.set(e,c),this._models.size>this._modelCap&&this._models.delete(this._models.keys().next().value),c.model}_counts(e,t,r,n,s){let o=n.changes?.blocks??n.marks??null,c=this._countModels.get(e);if(c?.before===t&&c.after===r&&c.given===o)return c.model;let u=n.changes?.blocks??Ce(t,r,s),d={blocks:u,...Xs(u,n.marks)};return this._countModels.set(e,{model:d,before:t,after:r,given:o}),d}_fileState(e,t,r=!1){let n=ce(this.base,this.other,e,t),s=typeof n.before=="string"&&typeof n.after=="string",o=s&&jp(this.base,this.other,e,t,n,this._repaint,this.scope);if(o&&N.ignoreTypes){let ne={a:[],b:[],blocks:[],additions:0,deletions:0,renamed:0,marked:new Set,noEol:{a:!1,b:!1},words:new Map};return r?{pretty:null,hiding:!1,model:ne,spacesHidden:!1,typesHidden:!0}:{...n,textual:s,large:!1,printing:null,pretty:null,key:null,generated:!1,renamed:!1,warned:[],hiding:!1,changes:null,model:ne,whitespace:null,spacesHidden:!1,types:o,typesHidden:!0}}let c=s&&(!r||l.bundleSourcePretty)?this._printing(e,t,n):null,u=l.bundleSourcePretty&&c?.applies?c.copies:null,{before:d,after:p}=u?.status==="ready"?u:n,h=s&&mo(e)&&mo(t.basePath??e)&&["ready","loading","error"].includes(u?.status)&&this._generated(e,t,n),f=h&&u.status==="ready";!r&&s&&this._sought?.path===e&&!this._forced.has(e)&&at(d,p)&&this._forced.add(e);let b=s&&!this._forced.has(e)&&at(d,p),{basePath:v=e}=t,g=ne=>{let se=f&&!b?Np(this.base,v,n.before,this.other,e,n.after,ne,this._repaint,u.hashes,!r&&this._renamesAlone,this.scope):null,Ft=se?.status==="ready",Ue=Ft&&N.ignoreRenames,Dt=Ft&&!Ue,hi=Ue&&se.reason===null?se.reads:[],mi=Ft&&se.reason===null?se.marks.length>0||N.ignoreRenames&&se.before!==d:N.ignoreRenames&&h,dt=bo(e,u?.status==="ready",{...N,ignoreWhitespace:ne,ignoreRenames:Ue,markRenames:Dt}),je=Ue?se.before:d,Vr=Ue?{changes:{blocks:se.blocks}}:Dt?{marks:se.marks}:{},fi=s&&!b&&(!se||Ft||!N.ignoreRenames)?r?this._counts(dt,je,p,Vr,ne):this._model(dt,je,p,Vr,ne):null;return{key:dt,changes:se,warned:hi,renamed:mi,hiding:Ue,shown:je,model:fi,ignoreWhitespace:ne}},y=this._unlisted(e,t,n),k=g(N.ignoreWhitespace&&!y),_=N.ignoreWhitespace&&!y&&!!k.model&&(k.model.mixed??=Jt(k.shown,p,k.model.blocks));_&&(k=g(!1));let{key:x,changes:S,warned:T,renamed:F,hiding:O,shown:A,model:z}=k;if(r)return{pretty:u,hiding:O,model:z,spacesHidden:k.ignoreWhitespace};u?.status==="ready"&&z?this._noteRowless(e,z.blocks.length===0):z&&(this._blocks.set(`${N.ignoreWhitespace}\0${e}`,z.blocks),this._aligned.set(z.blocks,z));let Z=z&&!y&&!N.ignoreWhitespace?this._whitespaceHidden(`${e}\0${u?.status==="ready"}\0${O}`,A,p):null,re=z===null||y?null:_?"mixed":N.ignoreWhitespace?Qs(A,p,z.blocks)?"hideable":null:Z.hides&&!Z.mixed?"hideable":null;return this._sought?.path===e&&(this._soughtSettling=u?.status==="loading"||N.ignoreRenames&&(S?.status==="loading"||S?.status==="error")),{before:A,after:p,textual:s,large:b,printing:c,pretty:u,key:x,generated:h,renamed:F,warned:T,hiding:O,changes:S,model:z,whitespace:re,spacesHidden:k.ignoreWhitespace,types:o}}_unlisted(e,{basePath:t=e},{before:r,after:n}){return!Zs(e,n,uo(this.other,e))||!Zs(t,r,uo(this.base,t))}_whitespaceHidden(e,t,r){let n=this._spaced.get(e);return n?.before===t&&n.after===r||(n={before:t,after:r,hidden:Lp(t,r)}),this._spaced.delete(e),this._spaced.set(e,n),this._spaced.size>this._modelCap&&this._spaced.delete(this._spaced.keys().next().value),n.hidden}_generated(e,{kind:t,basePath:r=e},{before:n,after:s}){return t!=="repointed"&&si(this.base,this.other)&&rh(this.base,r,n)&&rh(this.other,e,s)}_printing(e,t,r){let{kind:n,basePath:s=e,modified:o}=t,{before:c,after:u}=r;if(n==="repointed"||o===!1||typeof c!="string"||typeof u!="string"||c===u||!si(this.base,this.other))return null;let d=[["base",this.base,s,c],["other",this.other,e,u]];if(!d.every(([,,v,g])=>g===""||Wi(v)!==null&&mg(g)))return null;let p=d.some(([,v,g,y])=>y!==""&&zc(v,v,g,y)),h=d.map(([v,,g,y])=>y===""?{status:"ready",text:y}:qc(this.base,this.other,v,g,y,this._repaint)),f=h.find(v=>v.status==="error")??h.find(v=>v.status==="loading")??{status:"ready",before:h[0].text,after:h[1].text,hashes:h.map(v=>v.hash)},b=!p&&c!==""&&u!==""&&f.status==="ready"&&this._smaller(e,r,f);return{copies:f,minified:p,smaller:b,applies:p||b}}_smaller(e,{before:t,after:r},n){let s=this._shorter.get(e);if(s?.before===t&&s.after===r&&s.printed===n.before&&s.printedAfter===n.after)return s.smaller;let o=(u,d)=>Ce(u,d).reduce((p,{a0:h,a1:f,b0:b,b1:v})=>p+f-h+v-b,0),c=!at(t,r)&&!at(n.before,n.after)&&o(n.before,n.after)<o(t,r);return this._shorter.set(e,{before:t,after:r,printed:n.before,printedAfter:n.after,smaller:c}),c}_fileMessage(e,{kind:t,modified:r,meta:n},{before:s,after:o,textual:c,large:u,model:d,pretty:p,hiding:h,warned:f=[],changes:b,whitespace:v,typesHidden:g=!1}){let y=A=>G(A??0),k=Kp(n),_=`${t==="renamed"?k?"Renamed, its contents the same.":"Renamed without changes.":"The contents are the same."}${k?` ${k}`:""}`;if(c&&r===!1)return a`<div class="bundle-compare-code-message"><p>${_}</p></div>`;if(!c){if(t==="changed"&&r===!1)return a`<div class="bundle-compare-code-message">Binary file, its bytes the same · ${y(Re(o))}. ${k}</div>`;let A=t==="added"?y(Re(o)):t==="removed"?y(Re(s)):`${y(Re(s))} \u2192 ${y(Re(o))}`;return a`<div class="bundle-compare-code-message">Binary file ${t} · ${A}. A text diff is not available.${k?` ${k}`:""}</div>`}if(u)return a`<div class="bundle-compare-code-message"><p>This diff is large (${(Or(s)+Or(o)).toLocaleString()} lines across both sides) and may take a few seconds to compute.</p><button type="button" class="bundle-compare-code-action" @click="${()=>{this._forced.add(e),this.requestUpdate()}}">Show diff</button></div>`;if(g)return a`<div class="bundle-compare-code-message"><p>Only types changed in this file.${k?` ${k}`:""}</p><button type="button" class="bundle-compare-code-action" @click="${()=>this._setTypes(!1)}">Show type-only changes</button></div>`;if(b?.status==="loading"&&N.ignoreRenames)return a`<div class="bundle-compare-code-message" aria-busy="true">Hiding renamed names…</div>`;if(b?.status==="error"&&N.ignoreRenames)return a`<div class="bundle-compare-code-message"><p>Couldn't hide renamed names: ${b.message}</p><button type="button" class="bundle-compare-code-action" @click="${()=>this._setRenames(!1)}">Show renamed names</button></div>`;if(d.blocks.length>0)return null;let x=p?.status==="ready"&&p.before===p.after,S=!x&&N.ignoreWhitespace&&v==="hideable",T=!x&&h,F=[S&&"whitespace",T&&"renamed names"].filter(Boolean),O=x?"No actual code changes in this file.":F.length>0?`Only ${F.join(" and ")} changed in this file.`:null;return a`<div class="bundle-compare-code-message"><p>${O?`${O}${k?` ${k}`:""}`:_}</p>${f.length>0?a`<p>${lh(f)}</p>`:m} ${x?a`<button type="button" class="bundle-compare-code-action" @click="${()=>{Yt(),this.requestUpdate()}}">Show as published</button>`:m} ${S?a`<button type="button" class="bundle-compare-code-action" @click="${()=>this._setWhitespace(!1)}">Show whitespace changes</button>`:m} ${T?a`<button type="button" class="bundle-compare-code-action" @click="${()=>this._setRenames(!1)}">Show renamed names</button>`:m}</div>`}_fileName(e,t,r){let n=s=>r&&s.startsWith(r)?s.slice(r.length):s;return a`<span class="${I({"bundle-compare-code-pill":!0,[t.kind]:!0,pure:t.kind==="renamed"&&!t.modified})}">${Ir[t.kind].label}</span> ${Ve(e,this._format(e))} <span class="bundle-code-main-path mono" data-tooltip-truncated data-tooltip="${t.renamedFrom?`${t.renamedFrom} \u2192 ${e}`:e}">${t.renamedFrom?Cr(n(t.renamedFrom),n(e)):n(e)}</span> ${this._fileTags(e,t)}${this._githubLink(e,t)}`}_fileTags(e,t,r=!1){if(!r)return a`${this._entryTags(e,t)}${this._alertTags(e,t)}${this._runsTags(e,t)}${this._newHostTags(e,t)}${this._flagTags(e,t)}${this._readability(e,t)}${this._installTags(e,t)}${oi(t.meta)}`;let n=[this._alertTags(e,t),this._runsTags(e,t),this._newHostTags(e,t),this._flagTags(e,t,!1),this._treeTag(e,t),this._installTags(e,t,!0),oi(t.meta,!0)];return fo(n)?n:this._flagTags(e,t)}_githubLink(e,{kind:t,basePath:r=e}){let n=t==="removed"?pn(this.base,r):pn(this.other,e);return n?Pc(n):m}_alertTags(e,{kind:t,basePath:r=e}){let n=t==="removed"?this.baseAlerts?.get(r):this.otherAlerts?.get(e);return n?.length>0&&this.alertTags?this.alertTags(n):m}_newHostTags(e,{kind:t}){let r=t==="removed"?null:this.newHosts?.get(e);return r&&this.newHostTag?this.newHostTag(r):m}_runsTags(e,t){return[[rd,nd],[sd,od]].map(([r,n])=>{let{was:s,now:o}=this._reads(e,t,r);return t.kind==="removed"?n(s):n(o,s)})}_entryTags(e,{kind:t,basePath:r=e}){let n=ug(t==="removed"?this.base:this.other).get(t==="removed"?r:e)??[];return[...Map.groupBy(n,({label:o})=>o)].map(([o,c])=>a`<span class="${`bundle-compare-code-entry${o==="license"?" is-license":""}`}" data-tooltip="${c.map(({note:u})=>u).join(" \xB7 ")}">${o}</span>`)}_installTags(e,t,r=!1){if(!pg.test(e))return m;let{kind:n,basePath:s=e}=t,{before:o,after:c}=ce(this.base,this.other,e,t),u=new Map(n==="added"||o===void 0?[]:ah(this.base,s,o)),d=new Map(n==="removed"||c===void 0?[]:ah(this.other,e,c)),p=[...n==="removed"?u:d].map(([h,f])=>{let b=n==="removed"?f:u.get(h),v=b===void 0?", new":b===f?"":`, was: ${b}`;return a`<span class="bundle-compare-code-install" data-tooltip="${`${f}${v}`}">${h}</span>`});if(!r&&n!=="removed")for(let[h,f]of u)d.has(h)||p.push(a`<span class="bundle-compare-code-install is-dropped" data-tooltip="${`No longer run on install: ${f}`}">${h}</span>`);return p}_reads(e,t,r=Ic){let{kind:n,basePath:s=e}=t,{before:o,after:c}=ce(this.base,this.other,e,t);return{was:n==="added"?null:o===void 0?void 0:r(this.base,s,o),now:n==="removed"||c===void 0?null:r(this.other,e,c)}}_readability(e,t){let{was:r,now:n}=this._reads(e,t),s=c=>a`${hn(c)}${Dc(c)}`,o=!r||!n||Ci(r)===Ci(n)&&r.kind===n.kind?s(n??r):a`<span class="bundle-compare-code-readability">${s(r)}<span aria-hidden="true">→</span>${s(n)}</span>`;return a`${mn(n??r)}${o}`}_flagTags(e,t,r=!0){return t.kind==="removed"?fn(this.base,t.basePath??e,t.baseBytes,r):fn(this.other,e,t.otherBytes,r)}_treeTag(e,t){let{was:r,now:n}=this._reads(e,t),s=n??r;if(!s)return m;let o=s.category!=="map"&&Ea.get(Ci(s)).mark;return a`${mn(s,["warn"])}${o?hn(s,!0):m}`}_fileFigures({kind:e,baseBytes:t,otherBytes:r},n){let s=o=>G(o??0);return a`${n?.blocks.length>(n?.marked?.size??0)?vo(n.additions,n.deletions):m} ${n?.renamed>0?a`<span class="bundle-compare-code-renamed" aria-label="${`${n.renamed} lines differing in renamed names alone`}" data-tooltip="Lines differing in renamed names alone, marked">≈${n.renamed}</span>`:m} <span class="bundle-code-main-stats">${e==="added"?s(r):e==="removed"?s(t):`${s(t)} \u2192 ${s(r)}`}</span>`}_highlighted(e,t,r,n=""){if(!r)return null;let s=xi(t,uo(e,t),r);if(!s)return null;let o=`${e.integrity}\0${t}${n?`\0${n}`:""}`,c=ch.get(o);return c?.text===r?c.lines:(po.has(o)||(po.add(o),(async()=>{let u=await yt(r,s),d=typeof u=="string"?Ni(u):null;ch.set(o,{text:r,lines:d?.length===r.split(`
|
|
93
|
-
`).length?d:null}),
|
|
94
|
-
`):[],o=r?this._highlighted(this._textSide(e),e,r):null,c=this._importLines(t,s),u=d=>d||"(empty target)";return a`<section class="bundle-compare-code-repointed" aria-label="Repointed imports"><h4>Repointed ${t.length===1?"import":"imports"} <b>${t.length}</b></h4><ul>${t.map(d=>{let p=c.get(d.specifier),h=`${d.conditions}${d.platform===null?"":` \xB7 Platform: ${d.platform}`}`;return a`<li><div class="bundle-compare-code-repointed-spec"><code data-tooltip-truncated data-tooltip="${d.specifier}">${d.specifier}</code> <span data-tooltip-truncated data-tooltip="${h}">${h}</span></div><div class="bundle-compare-code-repointed-targets"><span class="before"><span>Before</span><code data-tooltip-truncated data-tooltip="${u(d.baseTarget)}">${u(d.baseTarget)}</code></span> <span aria-hidden="true">→</span> <span class="after"><span>After</span><code data-tooltip-truncated data-tooltip="${u(d.otherTarget)}">${u(d.otherTarget)}</code></span></div>${p.slice(0,Fr).map(f=>this._importLine(f,s[f],o?.[f],d.specifier,n))} ${p.length>Fr?a`<span class="bundle-compare-code-repointed-more">and ${p.length-Fr} more ${p.length-Fr===1?"line":"lines"}</span>`:m}</li>`})}</ul></section>`}_importLine(e,t,r,n,s){let o=t.length>240?Math.max(0,t.indexOf(n)-80):0;return a`<button type="button" class="bundle-compare-code-repointed-line bundle-compare-diff-table" ?disabled="${!s}" aria-label="${`Go to line ${e+1}`}" @click="${()=>this._goToLine(e+1)}"><span class="diff-num">${e+1}</span> <code>${t.length<=240&&typeof r=="string"?J(dn(r,!0)):Vi(`${o>0?"\u2026":""}${t.slice(o,o+240)}${t.length>o+240?"\u2026":""}`,!0)}</code></button>`}_goToLine(e){let t=`${this._current}\0source`;e>(this._limits.get(t)??te)&&(this._limits.set(t,Math.ceil(e/te)*te),this.requestUpdate()),this.updateComplete.then(()=>this.querySelector(`.bundle-compare-diff [data-line="${e}"]`)?.scrollIntoView({block:"center"}))}_renderSource(e,t,r,{key:n,pretty:s}){let o=this._model(n,t,t),c={model:o,b:this._highlighted(this._textSide(e),e,t,s?.status==="ready"?"pretty":"")},u=new Set([...this._importLines(r,o.b).values()].flat()),d=`${e}\0source`,p=this._sought?.path===e&&this._sought.key!==n?this._soughtLine(e,this._entries.get(e),s,o):null;this._sought?.path===e&&(this._sought.key=n),p&&p.line<o.b.length&&(p.line>=(this._limits.get(d)??te)&&this._limits.set(d,Math.ceil((p.line+1)/te)*te),this._soughtRow={path:e,index:p.line});let h=this._limits.get(d)??te,f=o.b.length>h?o.b.slice(0,h):o.b;return a`<div class="bundle-compare-diff-table single" data-path="${e}" style="${_e({"--diff-num-width":`${String(o.b.length).length+1}ch`})}" role="table" aria-label="Source">${le(f,(b,v)=>v,(b,v)=>a`<div class="${I({"diff-row":!0,ctx:!0,"is-import":u.has(v)})}" role="row" data-line="${v+1}"><span class="diff-num">${v+1}</span>${this._codeCell(c,"b",v,null)}</div>`)}</div>${o.b.length>f.length?a`<div class="bundle-compare-code-more"><button type="button" class="bundle-compare-code-action" @click="${()=>{this._limits.set(d,h+te),this.requestUpdate()}}">Show ${Math.min(te,o.b.length-f.length).toLocaleString()} more lines</button> <span>${(o.b.length-f.length).toLocaleString()} not shown</span></div>`:m}`}_hides(e,t,r){let n=[e&&["Renames",Zp,N.ignoreRenames,()=>this._setRenames(!N.ignoreRenames)],t&&["Whitespace",th,N.ignoreWhitespace,()=>this._setWhitespace(!N.ignoreWhitespace)],r&&["Type-only",eh,N.ignoreTypes,()=>this._setTypes(!N.ignoreTypes)]].filter(Boolean);return n.length===0?m:a`<span class="bundle-compare-code-hide" role="group" aria-label="Hide"><span class="bundle-compare-code-hide-label" aria-hidden="true">Hide:</span>${n.map(([s,o,c,u])=>a`<mode-switch compact="compact" borderless .checked="${c}" accessible-label="${o}" label="${s}" @click="${u}"></mode-switch>`)}</span>`}_setWhitespace(e){N.ignoreWhitespace=e,this.requestUpdate()}_setTypes(e){N.ignoreTypes=e,this.requestUpdate()}_setRenames(e){N.ignoreRenames=e,e&&zp(),this.requestUpdate()}_renderDiff(e,t,{after:r,before:n,key:s,model:o,pretty:c,changes:u,hiding:d,warned:p=[],whitespace:h=null}){let{kind:f,basePath:b=e}=t,v=N.layout==="split",g=this._sought?.path===e&&this._sought.key!==s?this._soughtLine(e,t,c,o):null;this._sought?.path===e&&(this._sought.key=s);let y=g?this._seekRows(s,o,g,v):null;y?.index>=0&&(this._soughtRow={path:e,index:y.index+(v?1:0)});let k=this._expansions.get(s)??new Map,_=y?.rows??Lt(o,k,{split:v}),x=this._limits.get(s)??te,S=_.length>x?_.slice(0,x):_,T={model:o,a:f==="added"?null:this._highlighted(this.base,b,n,d?`renamed\0${this.other.integrity}\0${e}`:c?.status==="ready"?"pretty":""),b:f==="removed"?null:this._highlighted(this.other,e,r,c?.status==="ready"?"pretty":""),expand:(O,A)=>{let z=new Map(k);z.set(O,A==="all"?{all:!0}:{...z.get(O),[A]:(z.get(O)?.[A]??0)+ze}),this._expansions.set(s,z),this.requestUpdate()}},F=String(Math.max(o.a.length,o.b.length,1)).length;return a`${N.ignoreRenames&&u?.reason?a`<p class="bundle-compare-code-note">Renamed names are shown: ${hg[u.reason]??u.reason}.</p>`:m} ${ih[h]?a`<p class="bundle-compare-code-note">${ih[h]}</p>`:m} ${p.length>0?a`<p class="bundle-compare-code-note">${lh(p)} <button type="button" @click="${()=>this._setRenames(!1)}">Show them marked</button></p>`:m}<div class="${I({"bundle-compare-diff-table":!0,split:v,unified:!v})}" data-path="${e}" style="${_e({"--diff-num-width":`${F+1}ch`})}" role="table" aria-label="Diff">${v?a`<div class="diff-row diff-split-head" role="row"><span class="diff-half">Before<strong data-tooltip-truncated data-tooltip="${this.baseName}">${this.baseName}</strong></span> <span class="diff-half">After<strong data-tooltip-truncated data-tooltip="${this.otherName}">${this.otherName}</strong></span></div>`:m} ${le(S,O=>this._rowKey(O),O=>v?this._splitRow(O,T):this._unifiedRow(O,T))}</div>${_.length>S.length?a`<div class="bundle-compare-code-more"><button type="button" class="bundle-compare-code-action" @click="${()=>{this._limits.set(s,x+te),this.requestUpdate()}}">Show ${Math.min(te,_.length-S.length).toLocaleString()} more rows</button> <span>${(_.length-S.length).toLocaleString()} not shown</span></div>`:m}`}_rowKey(e){return e.kind==="fold"?`f${e.run}:${e.a}`:e.kind==="change"?`c${e.left??""}:${e.right??""}`:`${e.kind}${e.a??""}:${e.b??""}`}_words(e,t,r){if(t==null||r==null)return null;let n=`${t}:${r}`;return e.words.has(n)||e.words.set(n,Wc(e.a[t],e.b[r])),e.words.get(n)}_code(e,t,r,n){let s=n&&!(e.endsWith("\r")&&r?.at(-1)?.[1]===e.length);if(typeof t=="string")return J(dn(Mp(t,r),s));if(r){let o=Pp(e,r);return o.map((c,u)=>{let d=Vi(c.text,s&&u===o.length-1);return c.marked?a`<mark class="diff-word">${d}</mark>`:d})}return Vi(e,s)}_cell(e,t,r,n,s){return r==null?a`<span class="diff-num"></span><span class="diff-sign"></span><span class="diff-code diff-empty"></span>`:a`<span class="diff-num">${r+1}</span><span class="diff-sign">${n}</span>${this._codeCell(e,t,r,s)}`}_noEol(e,t,r){return r!=null&&e.noEol[t]&&r===e[t].length-1}_fold(e,t){let r=e.count<=ze;return a`<div class="diff-row diff-fold" role="row"><span class="diff-fold-actions">${!r&&e.down?a`<button type="button" aria-label="${`Show ${ze} more lines below`}" data-tooltip="${`Show ${ze} more lines`}" @click="${()=>t.expand(e.run,"top")}"><svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 3v9m-4-4 4 4 4-4"/></svg></button>`:m} ${!r&&e.up?a`<button type="button" aria-label="${`Show ${ze} more lines above`}" data-tooltip="${`Show ${ze} more lines`}" @click="${()=>t.expand(e.run,"bottom")}"><svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 13V4M4 8l4-4 4 4"/></svg></button>`:m} <button type="button" aria-label="${`Show all ${e.count} unchanged lines`}" data-tooltip="Show all" @click="${()=>t.expand(e.run,"all")}"><svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m4 6 4-4 4 4M4 10l4 4 4-4"/></svg></button> </span><span class="diff-fold-label">${e.count.toLocaleString()} unchanged ${e.count===1?"line":"lines"} · ${e.b+1}–${e.b+e.count}</span></div>`}_unifiedRow(e,t){let{model:r}=t;if(e.kind==="fold")return this._fold(e,t);if(e.kind==="ctx")return a`<div class="diff-row ctx" role="row"><span class="diff-num">${e.a+1}</span>${this._cell(t,"b",e.b," ",null)}</div>`;let n=e.kind==="del",s=n?this._words(r,e.a,e.pair)?.a:this._words(r,e.pair,e.b)?.b,o=r.marked?.has(e.change);return a`<div class="${`diff-row ${e.kind}${o?" renamed":""}`}" role="row" data-tooltip="${o?"Renamed names alone":m}">${n?a`<span class="diff-num">${e.a+1}</span><span class="diff-num"></span><span class="diff-sign">−</span>${this._codeCell(t,"a",e.a,s)}`:a`<span class="diff-num"></span><span class="diff-num">${e.b+1}</span><span class="diff-sign">+</span>${this._codeCell(t,"b",e.b,s)}`}</div>`}_codeCell(e,t,r,n){let s=e.model[t],o=e[t]?.[r],c=s[r],u=this._noEol(e.model,t,r),d=dh.get(s);d||dh.set(s,d=new Map);let p=d.get(r);return(!p||p.markup!==o||p.ranges!==n||p.noEol!==u)&&d.set(r,p={markup:o,ranges:n,noEol:u,drawn:this._code(c,o,n,!u)}),a`<span class="${I({"diff-code":!0,"diff-long":c.length>Cc})}">${p.drawn}${u?a`<span class="diff-no-eol" data-tooltip="No newline at end of file" aria-label="No newline at end of file">⊘</span>`:m}</span>`}_splitRow(e,t){let{model:r}=t;if(e.kind==="fold")return this._fold(e,t);if(e.kind==="ctx")return a`<div class="diff-row ctx" role="row"><span class="diff-half">${this._cell(t,"a",e.a," ",null)}</span> <span class="diff-half">${this._cell(t,"b",e.b," ",null)}</span></div>`;let n=e.paired?this._words(r,e.left,e.right):null,s=r.marked?.has(e.change);return a`<div class="${`diff-row change${s?" renamed":""}`}" role="row" data-tooltip="${s?"Renamed names alone":m}"><span class="${I({"diff-half":!0,del:e.left!==null,blank:e.left===null})}">${this._cell(t,"a",e.left,"\u2212",n?.a)}</span> <span class="${I({"diff-half":!0,add:e.right!==null,blank:e.right===null})}">${this._cell(t,"b",e.right,"+",n?.b)}</span></div>`}};customElements.define("bundle-compare-code",Mt);var fh=Symbol.for(""),bg=i=>{if(i?.r===fh)return i?._$litStatic$};var yo=(i,...e)=>({_$litStatic$:e.reduce((t,r,n)=>t+(s=>{if(s._$litStatic$!==void 0)return s._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${s}. Use 'unsafeStatic' to pass non-literal values, but
|
|
95
|
-
take care to ensure page security.`)})(
|
|
96
|
-
.baseAlerts=${
|
|
97
|
-
.newHosts=${
|
|
98
|
-
.dependencies=${
|
|
99
|
-
.models=${h?.models??null} .path=${
|
|
100
|
-
@compare-code-select=${b=>{b.stopPropagation(),u(b.detail.path)}}></${f}>`}var yg=400,vh=24,zr=["removed","added","changed"],ue=null;function qe(i){return i.join(", ")}var $o=class extends U{static properties={details:{attribute:!1},integrity:{attribute:!1},request:{attribute:!1},source:{attribute:!1},review:{attribute:!1},_targetIntegrity:{state:!0},_otherDetails:{state:!0},_status:{state:!0},_scope:{state:!0},_fileSort:{state:!0},_pkgSort:{state:!0},_openSections:{state:!0},_mode:{state:!0},_codePath:{state:!0},_codeSeek:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.details=null,this.integrity=null,this.request=null,this.source=null,this._targetIntegrity=null,this._otherDetails=null,this._status="idle",this._scope="",this._fileSort={removed:"name",added:"name",changed:"name"},this._pkgSort={removed:"size",added:"size",changed:"size"},this._openSections=new Set,this._mode="overview",this._codePath=null,this._codeSeek=null,this._diff=null,this._diffKey=null,this._fitBody=null,this._fitObserver=null}connectedCallback(){super.connectedCallback(),this._fitBody&&this._fitObserver?.observe(this._fitBody)}disconnectedCallback(){super.disconnectedCallback(),this._fitObserver?.disconnect()}willUpdate(e){e.has("source")&&this.source&&!e.get("source")&&(this._openSections=new Set([...this._openSections,"files"])),(e.has("_otherDetails")||e.has("details"))&&this._status==="ready"&&!wn(this.details,this._otherDetails).some(t=>t.id===this._scope)&&(this._scope=""),e.has("integrity")&&this._rebase(),(e.has("request")||e.has("integrity"))&&this.integrity&&this.request?.bundle===this.integrity?(this.request.target!==this._targetIntegrity&&this._choose(this.request.target),this._mode=$i(this.request.mode)):e.has("request")&&!e.has("integrity")&&e.get("request")?.bundle===this.integrity&&(this._targetIntegrity&&this._choose(null),this._mode="overview")}updated(){let e=this.querySelector(".bundle-compare-body");e!==this._fitBody&&typeof ResizeObserver=="function"&&(this._fitObserver??=new ResizeObserver(()=>this._fitLists()),this._fitObserver.disconnect(),e&&this._fitObserver.observe(e),this._fitBody=e),this._fitLists()}_fitLists(){let e=this._fitBody;if(!e)return;let t=getComputedStyle(e),r=e.getBoundingClientRect().top+e.clientTop+parseFloat(t.paddingTop)-e.scrollTop,n=f=>{let b=f.getBoundingClientRect();return b.top-r+f.parentElement.getBoundingClientRect().bottom-b.bottom},s=e.querySelector(".bundle-compare-rows--fill");if(s){let f=n(s),b=s.closest(".bundle-compare-section");for(let v=b;v;v=v.nextElementSibling){let g=v.matches("details[open]")&&v.querySelector(":scope > summary"),y=v===b?0:g?g.getBoundingClientRect().bottom+parseFloat(getComputedStyle(g).marginBottom)-v.getBoundingClientRect().top:v.getBoundingClientRect().height;f+=y+parseFloat(getComputedStyle(v).marginBottom)}e.style.setProperty("--compare-fill-around",`${f}px`)}let o=[...e.querySelectorAll(".bundle-compare-rows--scroll:not(.bundle-compare-rows--fill)")];if(o.length===0)return;let c=e.lastElementChild,u=new Map(o.filter(f=>c.contains(f)).map(f=>[f,f.parentElement.getBoundingClientRect().top])),d=Math.max(...u.values()),p=e.clientHeight-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom),h=parseFloat(getComputedStyle(c).marginBottom);for(let f of o)u.get(f)>=d-1?f.style.setProperty("--compare-rest",`${p-n(f)-h}px`):f.style.removeProperty("--compare-rest")}_rebase(){let e=this._baseKey;if(ue&&e&&e!==ue.base&&(ue=null),ue&&e===ue.base){let{target:t}=ue;if(this._scope=ue.scope,this._mode=ue.mode,this._codePath=ue.codePath,ue=null,!t){this._targetIntegrity=null,this._otherDetails=null,this._status="idle";return}this._targetIntegrity=t,this._diff=null,this._diffKey=null;let r=this.source?null:oc(t,n=>!!(n.json||n.bundle));r?(this._otherDetails=r,this._status="ready"):(this._otherDetails=null,this._status="loading",this._loadOther(t));return}this._targetIntegrity=null,this._otherDetails=null,this._status="idle",this._scope="",this._codePath=null,this._diff=null,this._diffKey=null}get _baseKey(){return this.source?this.source.base:this.integrity}_swap(){let e=this._targetIntegrity;e&&e!==this._baseKey&&this._reopen(e,this._baseKey)}_pickBase(e){!e||e===this._baseKey||(e===this._targetIntegrity?this._swap():this._reopen(e,this._targetIntegrity))}_reopen(e,t){if(this.source){ue={base:e,target:t,scope:this._scope,mode:this._mode,codePath:this._codePath},this.source.open(e,t,this._mode);return}if(!Gt(l.bundles??[],this.integrity).some(s=>s.integrity===e))return;ue={base:e,target:t,scope:this._scope,mode:this._mode,codePath:this._codePath};let r=s=>s&&!s.error&&(s.json||s.bundle)&&[e,t].includes(s.integrity),n=[this._otherDetails,this._baseReady?this.details:null].filter(r);this.dispatchEvent(new CustomEvent("bundle-swap",{bubbles:!0,composed:!0,detail:{integrity:e,target:t,bundles:n,mode:this._mode}}))}_nameFor(e){return this.source?this.source.name(e):(l.bundles??[]).find(r=>r.integrity===e)?.name??`${e.slice(0,15)}\u2026`}_pick(e){this._choose(e),this._notify()}_notify(){this.dispatchEvent(new CustomEvent("bundle-compare-change",{bubbles:!0,composed:!0,detail:{base:this.integrity,target:this._targetIntegrity,mode:this._mode}}))}_choose(e){let t=e||null;if(this._targetIntegrity=t,this._otherDetails=null,this._codePath=null,this._diff=null,this._diffKey=null,!t){this._status="idle",this._scope="";return}this._status="loading",this._loadOther(t)}async _loadOther(e){if(this.source){let n;try{n=await this.source.load(e)}catch(s){if(s.name==="AbortError")return;n={error:s.message}}if(this._targetIntegrity!==e)return;this._otherDetails=n,this._status="ready";return}let t=Gt(l.bundles??[],this.integrity).find(n=>n.integrity===e);if(!t){this._status="idle",this._targetIntegrity=null,this._notify();return}let r;try{r=await ac(e,t)}catch(n){if(n.name==="AbortError")return;throw n}this._targetIntegrity===e&&(this._otherDetails=r,this._status="ready")}get _baseReady(){return!!(this.details&&this.details.integrity===this.integrity&&(this.details.json||this.details.bundle))}_openFile(e){this._codePath=e,this._mode="code",this._notify()}_openLine({path:e,line:t,query:r}){this._codeSeek={path:e,line:t-1,query:r},this._openFile(e)}_fileRow(e,t,r,n=e,s=!1,o=void 0,c=e,u=void 0){let d=this.source?.files;return a`<li><button type="button" class="bundle-compare-row bundle-compare-row-link" @click="${()=>this._openFile(e)}">${d?d.icon(e,[[this._otherDetails,c],[this.details,e]]):m}<span class="bundle-compare-row-path mono" data-tooltip-truncated data-tooltip="${n}">${t}</span>${d&&s?d.tag(this.details,e,u):m}${oi(o)}${r}</button></li>`}_group(e,t,r,n,s,o=m,{fill:c=!1,lanes:u=zr,style:d={}}={}){return t.length===0?m:a`<section class="${`bundle-compare-group bundle-compare-${r}`}" style="${_e({"--compare-lane":String(u.indexOf(r)+1),...d})}"><header class="bundle-compare-group-head"><span class="bundle-compare-dot" aria-hidden="true"></span> <span class="bundle-compare-group-title" data-tooltip-truncated data-tooltip="${e}">${e}</span> <span class="bundle-compare-group-count">${t.length}</span> ${o}</header><ul class="${c?"bundle-compare-rows bundle-compare-rows--scroll bundle-compare-rows--fill":"bundle-compare-rows bundle-compare-rows--scroll"}">${le(t,n,s)}</ul></section>`}_sizeCells(e){let t=n=>n==null?"\u2014":G(n),r=n=>`${n.toLocaleString()} LoC`;return e.delta===void 0?a`<span class="bundle-compare-row-size" data-tooltip="${e.lines>0?r(e.lines):m}">${t(e.bytes)}</span>`:a`<span class="${`bundle-compare-row-delta ${e.delta===null?"":Rt(e.delta)}`}" data-tooltip="${`${t(e.baseBytes)} \u2192 ${t(e.otherBytes)}${e.baseLines>0||e.otherLines>0?` \xB7 ${e.baseLines.toLocaleString()} \u2192 ${r(e.otherLines)}`:""}`}">${e.delta===null?"\u2014":Ys(e.delta)}</span>`}_sortActions(e,t,r,n=!1,s=this[e][t]){return a`<span class="bundles-overview-sort" role="group" aria-label="${`${t} ${r} order`}">${[["name","Name"],["size","Size"],...n?[["flags","Flags"]]:[]].map(([o,c])=>a`<button type="button" aria-pressed="${String(s===o)}" @click="${()=>{this[e]={...this[e],[t]:o}}}">${c}</button>`)}</span>`}_fileGroup(e,t,r,n,s){let o=this.source?.files,c=r!=="removed",u=g=>r==="added"?null:{details:this._otherDetails,path:g.basePath??g.path},d=g=>[...c&&o?.flags?o.flags(this.details,g.path,u(g)):[],...Vp(g.meta)],p=t.some(g=>d(g).length>0),h=this._fileSort[r]==="flags"&&!p?"name":this._fileSort[r],f=g=>r==="changed"?Math.abs(g.delta):g.bytes,b=h==="flags"?pd(t,d,g=>g.path):t.toSorted((g,y)=>(h==="size"?f(y)-f(g):0)||g.path.localeCompare(y.path)),v=g=>g.renamedFrom==null?this._fileRow(g.path,n(g.path),this._sizeCells(g),g.path,c,g.meta,g.basePath??g.path,u(g)):this._fileRow(g.path,Cr(n(g.renamedFrom),n(g.path)),this._sizeCells(g),`${g.renamedFrom} \u2192 ${g.path}`,c,g.meta,g.basePath??g.path,u(g));return this._group(e,b,r,g=>g.path,v,this._sortActions("_fileSort",r,"file",p,h),{lanes:s})}_pkgGroup(e,t,r,n){let s=this._pkgSort[r],o=d=>{let p=r==="changed"?d.delta:d.bytes;return p==null?-1:Math.abs(p)},c=t.toSorted((d,p)=>(s==="size"?o(p)-o(d):0)||Ke(d.pkg).localeCompare(Ke(p.pkg))),u=r==="changed"?0:Math.min(vh,Math.max(0,...t.map(d=>qe(d.versions).length)));return this._group(e,c,r,d=>d.pkg,d=>a`<li><div class="bundle-compare-row"><span class="bundle-compare-pkg-dot" style="${_e({background:Mi(d.pkg)})}"></span> <span class="bundle-compare-row-path" data-tooltip-truncated data-tooltip="${Ke(d.pkg)}">${Ke(d.pkg)}</span> ${r==="changed"?this._versionCell(d):u>0?a`<span class="bundle-compare-dep-ver" data-tooltip-truncated data-tooltip="${qe(d.versions)}">${qe(d.versions)}</span>`:m} ${this._sizeCells(r==="changed"?d:{bytes:d.bytes})}</div></li>`,this._sortActions("_pkgSort",r,"package"),{fill:!0,lanes:n,style:u>0?{"--compare-version-width":`${u}ch`}:{}})}_versionCell(e){let t=e.otherVersions,r=e.baseVersions;if(r.join()===t.join())return r.length>0?a`<span class="bundle-compare-dep-ver">${qe(r)}</span>`:m;let n=e.direction??"changed",s=n==="up"?"\u2191":n==="down"?"\u2193":"\xB1";return a`<span class="bundle-compare-ver" aria-label="${`${n==="up"?"Upgraded":n==="down"?"Downgraded":"Changed"}: ${qe(r)||"none"} to ${qe(t)||"none"}`}"><span class="bundle-compare-ver-from">${qe(r)||"\u2014"}</span> <span class="bundle-compare-ver-arrow" aria-hidden="true">→</span> <span class="${`bundle-compare-ver-to ${n}`}">${qe(t)||"\u2014"}</span> <span class="${`bundle-compare-ver-dir ${n}`}" aria-hidden="true">${s}</span></span>`}_depGroup(e,t,r,n){let s=r==="changed"?0:Math.min(vh,Math.max(0,...t.map(u=>u.range.length))),o=u=>a`<span class="bundle-compare-row-path" data-tooltip-truncated data-tooltip="${u.name}">${u.name}</span> ${this.source?.dependencyTags?.(u,r)??m}${u.kind?a`<span class="npm-dependency-kind">${u.kind}</span>`:m} ${r==="changed"?a`<span class="bundle-compare-ver" aria-label="${`Changed: ${u.from} to ${u.to}`}"><span class="bundle-compare-ver-from">${u.from}</span> <span class="bundle-compare-ver-arrow" aria-hidden="true">→</span> <span class="bundle-compare-ver-to changed">${u.to}</span></span>`:a`<span class="bundle-compare-dep-ver" data-tooltip-truncated data-tooltip="${u.range}">${u.range}</span>`}`,c=this.source?.openDependency;return this._group(e,t,r,u=>u.key,u=>a`<li>${c&&u.opens?a`<button type="button" class="bundle-compare-row bundle-compare-row-link" @click="${()=>c(u)}">${o(u)}</button>`:a`<div class="bundle-compare-row">${o(u)}</div>`}</li>`,m,{fill:!0,lanes:n,style:s>0?{"--compare-version-width":`${s}ch`}:{}})}_renderDependencies(e,t,r,n){return n.length===0?m:a`<section class="bundle-compare-section"><h3 class="bundle-compare-section-head">Dependencies</h3>${this._cols(n,a`${this._depGroup(`Removed \xB7 only in ${t}`,e.removed,"removed",n)} ${this._depGroup(`Added \xB7 only in ${r}`,e.added,"added",n)} ${this._depGroup("Changed",e.changed,"changed",n)}`,"dependencies")}</section>`}_renderPackages(e,t,r,n=zr){return e.removed.length===0&&e.added.length===0&&e.changed.length===0?m:a`<section class="bundle-compare-section"><h3 class="bundle-compare-section-head">Packages</h3>${this._cols(n,a`${this._pkgGroup(`Removed \xB7 only in ${t}`,e.removed,"removed",n)} ${this._pkgGroup(`Added \xB7 only in ${r}`,e.added,"added",n)} ${this._pkgGroup("Changed",e.changed,"changed",n)}`,"packages")}</section>`}_cols(e,t,r){let n=e.map(s=>s==="changed"?"minmax(0, 5fr)":"minmax(0, 4fr)").join(" ");return a`<div class="bundle-compare-cols" data-lanes="${e.length}" data-section="${r}" style="${_e({"--compare-lanes":n})}">${t}</div>`}_collapsible(e,t,r,n,s=""){let o=this._openSections.has(e);return a`<details class="bundle-compare-section bundle-compare-collapsible" .open="${j(o)}" @toggle="${c=>this._setSection(e,c.currentTarget.open)}"><summary class="bundle-compare-section-head" @click="${c=>{c.preventDefault(),this._setSection(e,!o)}}">${t} <span class="bundle-compare-section-count">${r.toLocaleString()}</span>${s?a`<span class="bundle-compare-section-note" data-tooltip-truncated data-tooltip="${s}">${s}</span>`:m}</summary>${o?n():m}</details>`}_setSection(e,t){if(t===this._openSections.has(e))return;let r=new Set(this._openSections);t?r.add(e):r.delete(e),this._openSections=r}_renderResolutions(e){if(e.totalChanges===0)return m;let t=e.changed,r=t.slice(0,yg),n=t.length-r.length,s=(u,d="")=>a`<td class="${d}"><code data-tooltip-truncated data-tooltip="${u}">${u}</code></td>`,o=u=>`${u.conditions}${u.platform===null?"":` \xB7 Platform: ${u.platform}`}`,c=r.some(u=>o(u)!=="*");return this._collapsible("resolutions","Import resolutions",t.length,()=>a`<section class="bundle-compare-group bundle-compare-changed bundle-compare-resolutions"><header class="bundle-compare-group-head"><span class="bundle-compare-dot" aria-hidden="true"></span> <span class="bundle-compare-group-title">Repointed</span> <span class="bundle-compare-group-count">${t.length}</span></header><table class="${c?"":"bundle-compare-resolutions--no-context"}"><thead><tr><th>File</th><th>Import</th><th>Before</th><th>After</th>${c?a`<th>Conditions</th>`:m}</tr></thead><tbody>${le(r,u=>u.key,u=>{let d=o(u);return a`<tr><td><button type="button" class="bundle-compare-resolution-parent" data-tooltip-truncated data-tooltip="${u.parent}" @click="${()=>this._openFile(u.parent)}">${u.parent}</button></td>${s(u.specifier)} ${s(u.baseTarget||"(empty target)","bundle-compare-resolution-before")} ${s(u.otherTarget||"(empty target)","bundle-compare-resolution-after")} ${c?a`<td class="bundle-compare-resolution-context"><span data-tooltip-truncated data-tooltip="${d}">${d}</span></td>`:m}</tr>`})}</tbody></table>${n>0?a`<div class="bundle-compare-more">and ${n.toLocaleString()} more…</div>`:m}</section>`)}_diffFor(){let e=`${this.integrity}|${this._targetIntegrity}|${this._scope}`;return(this._diffKey!==e||!this._diff)&&(this._diff=Sr(this._otherDetails,this.details,this._scope),this._diffKey=e),this._diff}_renderSummary(e){return $r(e,a`<div class="bundle-compare-modes" role="tablist" aria-label="Comparison view">${[["overview","Overview"],["code","Code"]].map(([t,r])=>a`<button type="button" role="tab" aria-selected="${String(this._mode===t)}" @click="${()=>{this._mode=t,this._notify()}}">${r}</button>`)}</div>`)}_renderPicker(e,t,r,n){return kr({source:this.source,from:{options:e,value:this._targetIntegrity,pick:s=>this._pick(s)},to:{options:this._baseOptions(),value:this._baseKey,placeholder:this._nameFor(this.integrity),pick:s=>this._pickBase(s)},clear:t?{run:()=>this._pick(null)}:null,swap:t&&this.source?.canSwap?.(this._targetIntegrity)!==!1?()=>this._swap():null,extras:r,comparison:n,openLine:s=>this._openLine(s)})}_baseOptions(){if(this.source)return Ne(this.source.choices??[]);let e=(l.bundles??[]).find(r=>r.integrity===this.integrity),t=Gt(l.bundles??[],this.integrity);return this._bundleOptions(e?[e,...t]:t)}_otherOptions(){return this.source?Ne(this.source.options):this._bundleOptions(Gt(l.bundles??[],this.integrity))}_bundleOptions(e){let t=new Map;for(let r of e)t.set(r.name,(t.get(r.name)??0)+1);return e.map(r=>({id:r.integrity,integrity:r.integrity,kind:r.kind??(r.name.toLowerCase().endsWith(".map")?"sourcemap":"stasis"),summary:r.summary,size:typeof r.size=="number"?G(r.size):"\u2014",filename:t.get(r.name)>1?`${r.name} \xB7 ${r.integrity.slice(7,13)}\u2026`:r.name}))}render(){let e=this._otherOptions(),t=!!this._targetIntegrity&&(!!this.source||e.some(h=>h.integrity===this._targetIntegrity)),r=this._baseReady?wn(this.details,t?this._otherDetails:null):[],n=r.length>0?a`<bundle-scope-selector .reasons="${r}" .value="${this._scope}" label="Compare scope" @scope-change="${h=>{this._scope=h.detail.value}}"></bundle-scope-selector>`:m,s=this.source?.noun??"bundle",o=t&&this._status==="ready"&&this._otherDetails&&(this._otherDetails.json||this._otherDetails.bundle)&&!this._otherDetails.error,c=this._baseReady&&o?{base:this._otherDetails,other:this.details,files:this._diffFor().files}:null,u=e.length>0||this.source?this._renderPicker(e,t,n,c):n,d=this._baseReady&&o?this._mode:"overview",p;return this._baseReady?this.source&&!t&&(this.source.pending||this.source.error||e.length===0)?p=a`<div class="${`bundle-compare-empty${this.source.error?" is-error":""}`}">${this.source.pending?`Loading ${s}s\u2026`:this.source.error??a`No other ${s}s to compare <strong>${this._nameFor(this.integrity)}</strong> with.`}</div>`:e.length===0&&!this.source?p=a`<div class="bundle-compare-empty">No other bundles to compare with. Drop a second <code>.map</code> or <code>.stasis.code.br</code> bundle to diff against this one.</div>`:t?this._status==="loading"||!this._otherDetails?p=a`<div class="bundle-compare-empty">Comparing…</div>`:this._otherDetails.error?p=a`<div class="bundle-compare-empty is-error">Couldn't read the selected ${s}: ${this._otherDetails.error}</div>`:!this._otherDetails.json&&!this._otherDetails.bundle?p=a`<div class="bundle-compare-empty is-error">The selected ${s} couldn't be parsed.</div>`:d!=="code"&&(p=this._renderDiff()):p=a`<div class="bundle-compare-empty">Pick a ${s} above to compare <strong>${this._nameFor(this.integrity)}</strong> against.</div>`:p=a`<div class="bundle-compare-empty">Loading bundle…</div>`,a`<div class="bundle-compare">${xr(u,this._baseReady&&o?this._renderSummary(this._diffFor()):m)} ${d==="code"?Nr({base:this._otherDetails,other:this.details,diff:this._diffFor(),source:this.source,path:this._codePath,seek:this._codeSeek,baseName:this._nameFor(this._targetIntegrity),otherName:this._nameFor(this.integrity),select:h=>{this._codePath=h}}):a`<div class="bundle-compare-body">${p}</div>`}</div>`}_renderDiff(){let e=this._diffFor(),t=this._nameFor(this._targetIntegrity),r=this._nameFor(this.integrity),n=[...e.files.onlyBase.map(y=>y.path),...e.files.onlyOther.map(y=>y.path),...e.files.changed.flatMap(y=>y.renamedFrom==null?[y.path]:[y.path,y.renamedFrom])],s=Ji(e.files.root,ft(n).prefix),{prefix:o}=s,c=y=>o&&y.startsWith(o)?y.slice(o.length):y,u=e.files.onlyBase.length+e.files.onlyOther.length+e.files.changed.length,d={removed:e.files.onlyBase,added:e.files.onlyOther,changed:e.files.changed},p=!e.totals.identical,h=this.source?.dependencies?.(this._otherDetails,this.details)??null,f=zr.filter(y=>(h??e.packageRows)[y].length>0),b=p?zr.filter(y=>d[y].length>0):[],v=b.every(y=>f.includes(y))?f:b,g=p?this.source?.files?.warning(this.details,[...d.added,...d.changed].map(y=>y.path)):m;return a`${h?this._renderDependencies(h,t,r,f):this._renderPackages(e.packageRows,t,r,f)} ${g??m} ${e.totals.identical?e.resolutions.totalChanges>0?a`<div class="bundle-compare-caption">File contents are unchanged; import resolutions differ.</div>`:a`<div class="bundle-compare-identical">These two bundles carry identical files (${e.totals.unchangedFiles.toLocaleString()} ${e.totals.unchangedFiles===1?"file":"files"})${s.from?a`, moved <span class="mono">${Er(s)}</span>`:""}.</div>`:this._collapsible("files","Files",u,()=>this._cols(v,a`${this._fileGroup(`Removed \xB7 only in ${t}`,d.removed,"removed",c,v)} ${this._fileGroup(`Added \xB7 only in ${r}`,d.added,"added",c,v)} ${this._fileGroup("Changed",d.changed,"changed",c,v)}`,"files"),s.from?`${s.from} \u2192 ${s.to}`:o)} ${this._renderResolutions(e.resolutions)}`}};customElements.define("bundle-compare",$o);var xo=class extends Fl{static properties={reviewTitle:{type:String}};render(){return a`<dialog aria-labelledby="discard-review-title" @close="${this._onClose}"><header><h3 id="discard-review-title">Discard unpublished review?</h3></header><p class="lwd-body"><strong>${this.reviewTitle}</strong></p><p class="lwd-note">This permanently deletes this review and all its file verdicts and notes. This cannot be undone.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="danger" @click="${this._onConfirm}">Discard review</button></footer></dialog>`}};customElements.define("discard-review-dialog",xo);function qr(i){return Y("discard-review-dialog",i)}var Pt={...ad,"accept-with-nits":"Accept with nits"},_g=i=>i.revokedAt===null?i.publishedAt===null?"Draft":"Published":"Revoked",wg={accept:"\u2713","accept-with-nits":"\xB7","request-changes":"!",reject:"\xD7"},So=i=>a`<span class="${`npm-review-verdict-icon ${i??"unchecked"}`}" aria-hidden="true">${wg[i]??""}</span>`,At=i=>a`<span class="npm-review-verdict">${So(i)}${Pt[i]??"Not reviewed"}</span>`,ci=i=>a`<span class="${`npm-review-badge ${i.revokedAt===null?i.publishedAt===null?"":"published":"revoked"}`}">${_g(i)}</span>`,Co=i=>a`<time datetime="${new Date(i).toISOString()}">${new Date(i).toLocaleString()}</time>`,Eo=(i,e)=>a`<div class="npm-review-progress" role="progressbar" aria-label="Files checked" aria-valuemin="0" aria-valuemax="${e||1}" aria-valuenow="${i}"><span style="${`width:${e?i/e*100:0}%`}"></span></div>`;function yh(i=[],e=[]){let t=new Set(e);return new Map(i.filter(r=>r.status&&!t.has(r.file)).map(r=>[r.file,{status:r.status,notes:+!!r.comment.trim()}]))}function lt(i){let e=ud(i);if(e.length===0)return m;let t=e.filter(r=>r.bullet);return a`${e.filter(r=>!r.bullet).map(r=>a`<p class="npm-review-note">${r.text}</p>`)} ${t.length>0?a`<ul class="npm-review-note npm-review-note-list">${t.map(r=>a`<li>${r.text}</li>`)}</ul>`:m}`}var li=null,pe=(i,e)=>["ecosystem","package","version","integrity","basePackage","baseVersion","baseIntegrity"].every(t=>i[t]===e[t]);function di(i,e=!1){li={review:i,continueReview:e}}function _h(i){if(!li||!pe(li.review,i))return null;let e=li;return li=null,e}function Ae(i){let e=`${i.package} ${i.version}`;return i.basePackage?i.basePackage===i.package?`${i.package} ${i.baseVersion} -> ${i.version}`:`${i.basePackage} ${i.baseVersion} -> ${e}`:e}var ie=i=>i._blocked||i._loading,wh=i=>i._shownReview?.publishedAt!=null,kg=i=>i.coverage==="full"?"Full":"Partial",Ro=i=>i._error?a`<p class="npm-review-error" role="alert">${i._error}</p>`:m,kh=i=>i._saveBlocked?a`<div class="npm-review-saving" role="status">Saving changes…</div>`:m,To=i=>[i._continuation?.review,...i._reviews].filter(Boolean).toSorted((e,t)=>+(e.publishedAt!==null)-+(t.publishedAt!==null)||(t.publishedAt??t.time)-(e.publishedAt??e.time)),$h=i=>`npm-review-button npm-review-primary npm-review-finalize ${i._allowedVerdicts[0]}`,xh=(i,e,t,r,n=Object.keys(Pt),s=!1)=>a`<div class="npm-review-verdict-options" role="group" aria-label="Verdict">${Object.entries(s?{"":"Not checked",...Pt}:Pt).map(([o,c])=>a`<label class="${`npm-review-verdict-choice ${o||"unchecked"}`}"><input type="radio" name="${i}" aria-label="${c}" value="${o}" .checked="${j(e===o)}" ?disabled="${r||o!==""&&!n.includes(o)}" @change="${()=>t(o)}">${c}</label>`)}</div>`;function $g(i){let e=wh(i),t=i._shownReview,r=i._summary,n=i._canEdit?{label:"Finalize review",run:()=>i._beginPublish(),disabled:!r.checkedFiles}:!e||!i._writable?null:i._activeReview||i._ownPublished.length===0?{label:"Resume your review",run:()=>i._resume()}:t.user===i.session?.id?{label:"Revise review",run:()=>i._change({action:"continue",reviewId:t.id,revision:t.revision})}:null;return a`<div class="npm-review-summary-actions">${e||i._draftStarted?ci(t??{publishedAt:null,revokedAt:null}):m}<div class="npm-review-progress-block"><span>${i._unsaved&&(i._saveBlocked||i._error)?a`<button type="button" class="npm-review-button npm-review-text-button" @click="${()=>i._openPanel("unsaved")}">Unsaved changes</button>`:a`<strong>${r.checkedFiles} of ${r.totalFiles}</strong> files checked`}</span> ${Eo(r.checkedFiles,r.totalFiles)}</div>${n?a`<button type="button" class="${i._canEdit?$h(i):"npm-review-button"}" ?disabled="${ie(i)||n.disabled}" @click="${n.run}">${n.label} ${xe}</button>`:m}</div>`}function xg(i){let e=i.source??hd(i.entry),t=!!(i._target&&i._target!=="(empty)"),r=Ne(e.options,s=>`${i.entry.npm.name}@${s.id}`);t&&!r.some(s=>s.id===i._target)&&r.push(...Ne([{id:i._target,name:i._target,format:"npm"}]));let n=Ne(e.choices);return n.some(s=>s.id===i.entry.npm.version)||n.push(...Ne([{id:i.entry.npm.version,name:i.entry.npm.version,format:"npm"}])),xr(kr({source:e,label:"Review",disabled:ie(i),from:{options:r,value:t?i._target:null,label:"Review base",pick:s=>{i._navigate(s)}},to:{options:n,value:i.entry.npm.version,label:"Version to review",pick:s=>{i._navigateTo({view:"npm",packageName:i.entry.npm.name,packageSpec:s,bundleTab:"review",...i._location(i._target)})}},clear:t?{label:"Clear review base",run:()=>{i._navigate("(empty)")}}:null,openLine:s=>i._openLine(s),comparison:{base:i._base,other:i.details,files:i._diff.files}}),$r(i._diff))}function Sg(i){return a`<div class="npm-review-toolbar"><nav class="npm-review-toolbar-group" aria-label="Review breadcrumbs"><button type="button" class="npm-review-button npm-review-text-button" ?disabled="${ie(i)}" @click="${()=>{i._navigateTo({view:"reviews"})}}">My reviews</button> ${xe}<button type="button" class="npm-review-button npm-review-text-button npm-review-package" aria-haspopup="dialog" ?disabled="${i._blocked}" @click="${()=>i._openPanel("reviews")}"><span>${i.entry.npm.name}@${i.entry.npm.version}</span><span class="npm-review-count">${To(i).length}</span></button></nav>${$g(i)}</div>`}function Cg(i,e=i._file,t=!1){let r=i._editorState(e),n=i._shownReview?.entries.find(c=>c.file===e),s=i._nonTextFiles.includes(e),o=!s&&["accept-with-nits","request-changes","reject"].includes(r.status);return a`<section class="${`npm-review-decision${t?" npm-review-inline-decision":""}`}" aria-label="File decision">${i._canEdit?a`${xh(`file:${e}`,s?"":r.status,c=>{i._setFileStatus(e,c)},ie(i)||s,void 0,!0)} ${s?a`<p class="npm-review-help">Non-text file. Verdicts are not supported yet; this file remains unchecked.</p>`:m} ${o?a`<textarea aria-label="File note" rows="2" maxlength="20000" placeholder="Add a note (optional)…" .value="${j(r.comment)}" ?disabled="${ie(i)}" @input="${c=>i._editFile(e,{comment:c.target.value})}" @blur="${()=>{i._saveFile(e)}}"></textarea>`:m}`:a`${t?m:a`<header><strong>File review</strong><span class="npm-review-muted">${wh(i)?"Frozen":"Read only"}</span></header>`} ${n?.status&&!s?a`${At(n.status)}${lt(n.comment)}`:a`<p class="npm-review-muted">This file was not reviewed.</p>`} ${i._writable?m:a`<p class="npm-review-help">Triage access is required to add a review.</p>`}`}</section>`}function Sh(i,e,t,r,n,s){return a`<fieldset class="npm-review-team-options"><legend>${e}</legend>${t.map(o=>a`<mode-switch label="${o.name}" .checked="${r.has(o.id)}" .disabled="${ie(i)}" @click="${()=>{if(ie(i))return;let c=new Set(r);c.has(o.id)?c.delete(o.id):c.add(o.id),n(c)}}"></mode-switch>`)}${s}</fieldset>`}function Eg(i,e){let t=i._allowedVerdicts,r=Xt(e.entries,i._files,i._nonTextFiles),n=e.entries.filter(s=>s.status&&s.comment.trim()&&!i._nonTextFiles.includes(s.file));return a`<form class="npm-review-publish-form" @submit="${s=>{s.preventDefault(),i._publish()}}"><div class="npm-review-dialog-body"><section class="npm-review-coverage"><div><strong>${kg(r)} review</strong><span>${r.checkedFiles} of ${r.totalFiles} files checked</span></div>${Eo(r.checkedFiles,r.totalFiles)}<p>${r.totalFiles>r.checkedFiles?a`${r.totalFiles-r.checkedFiles} files not checked. <button type="button" class="npm-review-button npm-review-text-button" @click="${()=>{i._unchecked=!0,i._closePanel()}}">View files</button>`:"Every file has a verdict."}</p>${i._needsPackageJson?a`<p class="npm-review-error">Review ${i._files.includes("package.json")?a`<button type="button" class="npm-review-button npm-review-text-button" @click="${()=>{i._closePanel(),i._selectFile("package.json")}}">package.json</button>`:"package.json"} before publishing a partial review.</p>`:m}</section>${n.length>0?a`<section aria-label="File notes"><strong>File notes</strong><ul class="npm-review-publish-notes" tabindex="0" aria-label="Saved file notes">${n.map(s=>a`<li><span class="dependency-review-entry-file">${Ve(s.file)}<span>${s.file}</span></span> ${lt(s.comment)}</li>`)}</ul></section>`:m}<div><strong>Final verdict</strong>${xh("final-verdict",i._finalStatus,s=>{i._finalStatus=s},ie(i),t)}</div>${i._securityLimit==="reject"?a`<p class="npm-review-help">Malware detected. Only Reject is available.</p>`:i._securityLimit==="request-changes"?a`<p class="npm-review-help">Critical vulnerabilities detected.</p>`:m} <label>Final note <span class="npm-review-muted">· optional</span><textarea aria-label="Final comment" rows="3" maxlength="20000" .value="${j(i._finalComment)}" placeholder="Summarize your findings or explain what remains…" ?disabled="${ie(i)}" @input="${s=>{i._finalComment=s.target.value}}"></textarea></label> ${i._unchangedContinuation?a`<p class="npm-review-help">Change a verdict or note to publish a new review.</p>`:m} ${Sh(i,"Publish to teams",i._teams,i._selectedTeams,s=>{i._selectedTeams=s},i._selectedTeams.size>0?m:a`<p class="npm-review-error">${i._teams.length===0?"No teams you belong to have dependency review enabled.":"Select at least one team to publish."}</p>`)} ${Ro(i)}</div><footer class="npm-review-dialog-footer"><p>Publishing freezes your verdicts and notes.<br>You can continue in a new review to make changes.</p><button type="submit" class="${$h(i)}" ?disabled="${ie(i)||!i._canPublish}">Publish to ${i._selectedTeams.size} ${i._selectedTeams.size===1?"team":"teams"} ${xe}</button></footer></form>`}function Tg(i,e){let t=e===i._shownReview,r=e.publishedAt!==null,n=r?e:pe(e,i._context)?Xt(e.entries,i._files,i._nonTextFiles):{checkedFiles:e.entries.filter(p=>p.status).length,totalFiles:null},s=[i._continuation?.review,...i._reviews].some(p=>p?.publishedAt===null&&p.user===i.session?.id&&pe(p,e)),o=e.user===i.session?.id,c=i._teams.filter(p=>!e.teams.some(h=>h.id===p.id)),u=i._additionalTeams.get(e.id)??new Set(c.length===1?c.map(p=>p.id):[]),d=c.filter(p=>u.has(p.id)).map(p=>p.id);return a`<section class="npm-review-entry" aria-current="${String(t)}"><div class="npm-review-history-heading"><strong>${e.userLogin}</strong>${t?a`<span class="npm-review-current">Current</span>`:m}${ci(e)}</div><p class="npm-review-help">${e.basePackage?`${e.basePackage===e.package?e.baseVersion:`${e.basePackage}@${e.baseVersion}`} \u2192 ${e.version}`:"All package files"}</p><div class="npm-review-entry-result">${r?At(e.status):m}<span class="dependency-review-coverage"> ${r?a`${n.coverage==="full"?"Full":a`<span class="dependency-review-partial">Partial</span>`} ·`:m}${n.checkedFiles}${n.totalFiles===null?m:`/${n.totalFiles}`} files checked</span></div><p class="npm-review-help">${e.teams.length>0?`${e.teams.map(p=>p.name).join(", ")} \xB7 `:""}${Co(e.publishedAt??e.time)}</p>${lt(e.comment)}<div class="npm-review-entry-actions"><button type="button" class="npm-review-button" ?disabled="${ie(i)}" @click="${()=>{i._openReview(e)}}">Open ${xe}</button> ${r&&o&&!s&&i._writable?a`<button type="button" class="npm-review-button" aria-label="Revise in a new draft" ?disabled="${ie(i)}" @click="${()=>{i._openReview(e,!0)}}">Revise</button>`:m} ${r&&o&&i._writable&&e.revokedAt===null?a`<button type="button" class="npm-review-button npm-review-danger" ?disabled="${ie(i)}" @click="${()=>i._change({action:"revoke",reviewId:e.id,revision:e.revision})}">Revoke</button>`:m}<review-audit-copy .review="${e}"></review-audit-copy>${!r&&o&&i._writable?a`<button type="button" class="dependency-review-discard" aria-label="Discard review" ?disabled="${ie(i)}" @click="${()=>{i._discard(e)}}">${J(vi)}</button>`:m}</div>${r&&o&&i._writable&&e.revokedAt===null&&c.length>0?a`<details class="npm-review-share"><summary>Publish to more teams</summary>${Sh(i,"Teams",c,u,p=>{i._additionalTeams=new Map(i._additionalTeams).set(e.id,p)},a`<button type="button" class="npm-review-button" ?disabled="${ie(i)||d.length===0}" @click="${()=>i._change({action:"publish",reviewId:e.id,revision:e.revision,teamIds:d})}">Publish to more teams</button>`)}</details>`:m} ${e.revokedAt===null?m:a`<p class="npm-review-help">Revoked ${Co(e.revokedAt)}. Content and team links remain frozen.</p>`}</section>`}function Rg(i){if(!i._panel)return m;let e={publish:"Publish review",reviews:"Reviews",unsaved:"Unsaved changes"};return a`<dialog class="npm-review-dialog" aria-label="${e[i._panel]}" @cancel="${t=>{t.preventDefault(),i._closePanel()}}"><button type="button" class="detail-action npm-review-close" aria-label="Close panel" ?disabled="${i._blocked}" @click="${()=>i._closePanel()}">×</button><header class="npm-review-dialog-head"><h2>${e[i._panel]}</h2><p>${i._panel==="reviews"?`${i.entry.npm.name}@${i.entry.npm.version}`:Ae(i._context)}</p></header>${i._panel==="publish"?Eg(i,i._activeReview):a`<div class="${`npm-review-dialog-body${i._panel==="reviews"?" npm-review-entries":""}`}">${i._panel==="unsaved"?a`${i._dirtyFiles.map(t=>a`<button type="button" class="npm-review-button" @click="${()=>{i._closePanel(),i._selectFile(t)}}">${t} ${xe}</button>`)}`:To(i).map(t=>Tg(i,t))} ${i._panel==="reviews"&&To(i).length===0?a`<p class="npm-review-muted">No reviews yet.</p>`:m}${Ro(i)}</div>`} ${kh(i)}</dialog>`}function Lg(i){let e=i._shownReview?.entries,t=i._files,r=i._nonTextFiles;if(i._treeProgress?.entries!==e||i._treeProgress?.files!==t||i._treeProgress?.nonTextFiles!==r){let c=yh(e,r),u=new Map,d=0;for(let p of i._files){let h=p.split("/"),f=+!!c.get(p)?.status;d+=f;for(let b=1;b<h.length;b++){let v=h.slice(0,b).join("/"),g=u.get(v)??{total:0,checked:0};g.total++,g.checked+=f,u.set(v,g)}}i._treeProgress={entries:e,files:t,nonTextFiles:r,states:c,directories:u,checked:d}}let{states:n,directories:s,checked:o}=i._treeProgress;return{railLabel:"Files",treeLabel:"Review files",collapseLabel:"Collapse folders",searchLabel:"Find a file",searchPlaceholder:"Find a file\u2026",treePageSize:300,filterContent:!1,fullPaths:!0,collapseClearsSearch:!0,canSelect:()=>!i._blocked&&!i._panel,fileFilter:i._unchecked?c=>!n.get(c)?.status:null,fileLabel:c=>`${c}, ${Pt[n.get(c)?.status]??"Not reviewed"}`,filePrefix:c=>So(n.get(c)?.status),fileSuffix:c=>n.get(c)?.notes?a`<span class="npm-review-note-dot" aria-label="Has notes">•</span>`:m,directoryLabel:c=>{let u=s.get(c.sourcePath);return`${c.sourcePath}, ${u?.checked??0} of ${u?.total??0} checked`},directorySummary:c=>{let u=s.get(c.sourcePath);return`${u?.checked??0}/${u?.total??0}`},filters:a`<div class="npm-review-filters" aria-label="Filter review files"><button type="button" class="npm-review-button" aria-pressed="${String(!i._unchecked)}" @click="${()=>{i._unchecked=!1}}">All ${i._files.length}</button> <button type="button" class="npm-review-button" aria-pressed="${String(!!i._unchecked)}" @click="${()=>{i._unchecked=!0}}">Unchecked ${i._files.length-o}</button></div>`,fileActions:(c,u)=>Cg(i,c,u)}}function Ch(i){return i._base?a`${xg(i)}${Sg(i)}${i._panel?m:Ro(i)} ${Nr({base:i._base,other:i.details,diff:i._diff,source:i.source,path:i._path,seek:i._seek,baseName:i._base.npm?`${i._base.npm.name}@${i._base.npm.version}`:"Empty package",otherName:`${i.entry.npm.name}@${i.entry.npm.version}`,select:e=>i._selectFile(e),extensions:Lg(i),mode:i._mode})} <span class="npm-review-announcement" role="status">${i._notice??""}</span>${i._panel?m:kh(i)}${Rg(i)}`:a`<div class="npm-review-empty" role="${i._baseError?"alert":"status"}">${i._baseError??"Loading comparison\u2026"} ${i._baseError?a`<button type="button" class="npm-review-button" @click="${()=>{i._baseKey=null,i._loadBase(i._target,i.request?.resume)}}">Retry</button>`:m}</div>`}var Mg={maxLines:5e4,maxBytes:2*1024*1024},Pg={integrity:"(empty)",kind:"sourcemap",json:{version:3,sources:[],sourcesContent:[]},fileSizes:new Map},Eh=(i,e)=>({ecosystem:"npm",package:i.npm.name,version:i.npm.version,integrity:i.integrity,basePackage:e?.npm?.name??null,baseVersion:e?.npm?.version??null,baseIntegrity:e?.npm?e.integrity:null}),ui=(i,e)=>`${i}@${e??"latest"}`,Lo=class extends U{static properties={entry:{attribute:!1},details:{attribute:!1},request:{attribute:!1},session:{attribute:!1},source:{attribute:!1},_teams:{state:!0},_selectedTeams:{state:!0},_additionalTeams:{state:!0},_reviews:{state:!0},_loading:{state:!0},_error:{state:!0},_saving:{state:!0},_saveBlocked:{state:!0},_file:{state:!0},_seek:{state:!0},_finalStatus:{state:!0},_finalComment:{state:!0},_base:{state:!0},_baseError:{state:!0},_panel:{state:!0},_path:{state:!0},_selectedReview:{state:!0},_unchecked:{state:!0},_notice:{state:!0},_continuation:{state:!0}};createRenderRoot(){return this}constructor(){super(),this._teams=[],this._reviews=[],this._files=[],this._nonTextFiles=[],this._selectedTeams=new Set,this._additionalTeams=new Map,this._editors=new Map,this._file=null,this._path=null,this._loading=!1,this._saving=!1,this._error=null,this._context=null,this._key=null,this._controller=new AbortController,this._mode="code",this._panel=null,this._selectedReview=null,this._unchecked=!1,this._pendingSaves=[],this._saveBlocked=!1}disconnectedCallback(){super.disconnectedCallback(),this._controller.abort(),this._cancelSaves(),this._dismissLoading?.(),this._key=null,this._baseKey=null}updated(){let e=this.querySelector("dialog");e&&!e.open&&e.showModal(),this._rememberBase()}_rememberBase(){l.bundleDetailsTab!=="review"||l.selectedBundle!==this.entry?.integrity||!this._context||!this._activeReview&&this._ownPublished.length===0&&!this._unsaved||(l.npmReview={bundle:this.entry.integrity,...this._context.basePackage?{reviewPackage:this._context.basePackage,reviewSpec:this._context.baseVersion}:{},started:!0,user:this.session?.id})}get _writable(){return["triage","manage","admin"].includes(this.session?.role)&&!this.session?.viewer}get _activeReview(){return this._reviews.find(e=>e.user===this.session?.id&&e.publishedAt===null&&pe(e,this._context))??(this._continuation&&this._continuation.review.user===this.session?.id?this._continuation.review:null)}get _ownPublished(){return this._reviews.filter(e=>e.user===this.session?.id&&e.publishedAt!==null&&pe(e,this._context)).toSorted((e,t)=>t.publishedAt-e.publishedAt)}get _shownReview(){return this._selectedReview?this._reviews.find(e=>e.id===this._selectedReview):this._activeReview??this._ownPublished[0]??null}get _canEdit(){return this._writable&&!this._selectedReview&&(this._activeReview!==null||this._ownPublished.length===0)}_isDirty(e,t){return!this._nonTextFiles.includes(e)&&(t.comment!==(t.edit?.comment??"")||t.status!==(t.edit?.status??""))}get _dirtyFiles(){return[...this._editors].filter(([e,t])=>this._isDirty(e,t)).map(([e])=>e)}get _blocked(){return this._saving||this._saveBlocked}get _unsaved(){return this._pendingSaves.length>0||this._dirtyFiles.length>0}get _draftStarted(){return this._canEdit&&(this._unsaved||this._activeReview&&!this._continuation||this._continuation&&this._publishRevision!=null&&!this._unchangedContinuation)}get _summary(){return Xt(this._shownReview?.entries??[],this._files,this._nonTextFiles)}get _securityLimit(){return this.source?.reviewVerdictLimit?.(this.entry,this._base)??"accept"}get _allowedVerdicts(){let e=new Map((this._shownReview?.entries??[]).map(t=>[t.file,t]));if(this._canEdit)for(let[t,r]of this._editors)e.set(t,{file:t,status:r.status||null});return cd([...e.values()].filter(t=>!this._nonTextFiles.includes(t.file)),this._securityLimit)}get _needsPackageJson(){return dd(this._activeReview?.entries??[],this._files,this._nonTextFiles)}get _unchangedContinuation(){let e=this._continuation?.source;return!!(e&&this._finalStatus===e.status&&this._finalComment===e.comment)}get _canPublish(){return this._canEdit&&this._panel==="publish"&&this._activeReview?.revision===this._publishRevision&&this._summary.checkedFiles>0&&!this._needsPackageJson&&!this._unchangedContinuation&&this._selectedTeams.size>0&&!this._unsaved&&this._allowedVerdicts.includes(this._finalStatus)}_location(e){let t=e&&e!=="(empty)"?yn(e):null;return t?{reviewPackage:t.name,reviewSpec:t.spec}:{}}_navigate(e){return this._navigateTo(_n(this.entry,"review",this._location(e)))}async _navigateTo(e){if(this._blocked||this._loading)return;let t=this._key,r=this._navigation={};this._unsaved&&!await this._saveAll()||t===this._key&&r===this._navigation&&!this._unsaved&&await me?.navigate(e)}async _loadBase(e,t=!1){let r=JSON.stringify([this.entry.integrity,e,this.session?.id,this.session?.role]);if(this._baseKey!==r){this._baseKey=r,this._base=null,this._baseError=null,this._controller.abort(),this._cancelSaves(),this._key=null,this._controller=new AbortController;try{let n=t?await Bd(Eh(this.entry,null),this._controller.signal):null;if(this._baseKey!==r)return;n&&(e=n.basePackage?ui(n.basePackage,n.baseVersion):"(empty)");let s=e==="(empty)"?null:yn(e),o=s?(await Gc(s.name,s.spec??"latest")).details:Pg;if(this._baseKey!==r)return;t&&(n&&di(n),this._target=e,this.request={bundle:this.entry.integrity,...this._location(e)},this._baseKey=JSON.stringify([this.entry.integrity,e,this.session?.id,this.session?.role])),this._base=o,this._ensureContext(o)}catch(n){this._baseKey===r&&(this._baseError=n.message)}}}_ensureContext(e){let t=Eh(this.entry,e),r=JSON.stringify([this.session?.id,this.session?.role,t]);if(r===this._key)return;this._controller.abort(),this._cancelSaves(),this._controller=new AbortController,this._context=t,this._diff=Sr(e,this.details);let n=xp(e,this.details,this._diff);this._files=Wt(Ki(n.map(o=>o.path)));let s=new Set(n.filter(o=>!ld(o.before,o.after)).map(o=>o.path));if(this._nonTextFiles=this._files.filter(o=>s.has(o)),this._mode=Sp(n,Mg)?"diff":"code",this._key=r,this._teams=[],this._reviews=[],this._selectedTeams=new Set,this._additionalTeams=new Map,this._selectedReview=null,this._continuation=null,this._editors.clear(),this._path=this._files[0]??null,this._panel=null,this._notice="",this._resetEditor(this._path),this._saving=!1,this._refresh(!0),l.bundleDetailsTab==="review"&&l.selectedBundle===this.entry.integrity){let o=this._location(e.npm?ui(e.npm.name,e.npm.version):"(empty)");l.npmReview={bundle:this.entry.integrity,...o},this._baseKey=JSON.stringify([this.entry.integrity,e.npm?ui(e.npm.name,e.npm.version):"(empty)",this.session?.id,this.session?.role]),me?.replaceRoute(_n(this.entry,"review",o))}}async _refresh(e=!1){let t=this._key;for(;t===this._key&&this._pendingSaves.length>0;)if((await Promise.all(this._pendingSaves.map(n=>n.promise))).some(n=>!n))return;if(t!==this._key)return;this._dismissLoading?.();let r=this._dismissLoading=Oe("Loading reviews\u2026",{duration:0});this._loading=!0,this._error=null;try{let{reviews:n,teams:s}=await Zt({...this._context,allBases:!0},null,null,this._controller.signal);if(t===this._key){let o=this._unsaved;this._reviews=n,this._teams=s,n.some(d=>d.user===this.session?.id&&d.publishedAt===null&&pe(d,this._context))&&(this._continuation=null),this._rememberBase();let c=_h(this._context),u=c&&n.find(d=>d.id===c.review.id);u?.publishedAt!=null&&(c.continueReview?this._continue(u.id,u.revision):this._selectedReview=u.id),this._selectedTeams=new Set(s.filter(d=>e?s.length===1:this._selectedTeams.has(d.id)).map(d=>d.id)),o||(this._editors.clear(),this._resetEditor(this._file))}}catch(n){t===this._key&&n.name!=="AbortError"&&(this._error=n.message)}finally{r(),t===this._key&&(this._loading=!1)}}_resetEditor(e=null){this._publishRevision=null,this._file=e,this._editorState(e)}_editorState(e){let t=this._canEdit?this._editors.get(e):null;if(!t){let r=this._shownReview?.entries.find(n=>n.file===e&&n.status)??null;t={edit:r,revision:this._activeReview?.revision??null,comment:this._nonTextFiles.includes(e)?"":r?.comment??"",status:this._nonTextFiles.includes(e)?"":r?.status??""},this._canEdit&&this._editors.set(e,t)}return{...t,dirty:this._isDirty(e,t)}}_editFile(e,t){!this._canEdit||this._blocked||(this._resetEditor(e),Object.assign(this._editors.get(e),t),this.requestUpdate())}_setFileStatus(e,t){if(!(this._blocked||this._nonTextFiles.includes(e)))return this._editFile(e,{status:t,...t?{}:{comment:""}}),this._saveFile(e)}_selectFile(e){this._blocked||!this._files.includes(e)||(this._path=e,this._resetEditor(e))}_openLine({path:e,line:t,query:r}){this._blocked||!this._files.includes(e)||(this._seek={path:e,line:t-1,query:r},this._selectFile(e))}_openPanel(e){this._panel=e}async _openReview(e,t=!1){if(this._blocked||this._loading)return;if(pe(e,this._context)){t?this._continue(e.id,e.revision):e.publishedAt===null?this._resume():this._showPublished(e);return}let r=this._key;this._unsaved&&!await this._saveAll()||r!==this._key||(di(e,t),await this._navigate(e.basePackage?ui(e.basePackage,e.baseVersion):"(empty)"))}_closePanel(){this._blocked||(this.querySelector("dialog")?.close(),this._panel=null)}_showPublished(e){this._selectedReview=e.id,this._panel=null,this._file=this._path}_resume(){this._selectedReview=null,this._panel=null,this._resetEditor(this._path)}async _discard(e){if(this._blocked||this._loading||!this._writable||e.user!==this.session.id||e.publishedAt!==null)return;let t=e===this._activeReview,r=this._key,n=this._controller.signal;this._saving=!0,this._error=null;try{let{confirmed:s}=await qr({reviewTitle:Ae(e),signal:n});if(!s||n.aborted||r!==this._key||(await Promise.all(this._pendingSaves.map(c=>c.promise)),n.aborted||r!==this._key||!this._writable)||(e=t?this._activeReview:this._reviews.find(c=>c.id===e.id),!e||e.user!==this.session.id||e.publishedAt!==null))return;let o=e===this._continuation?.review;if(o||await Qi(e.id,e.revision,this.session.csrfToken,n),n.aborted||r!==this._key)return;o||(this._reviews=this._reviews.filter(c=>c.id!==e.id)),pe(e,this._context)&&(this._continuation=null,this._selectedReview=null,this._editors.clear(),this._resetEditor(this._path),this._finalStatus=null,this._finalComment="",this._panel=null,this._ownPublished.length===0&&l.npmReview?.bundle===this.entry.integrity&&delete l.npmReview.started),this._notice="Draft discarded."}catch(s){r===this._key&&s.name!=="AbortError"&&(this._error=s.message)}finally{r===this._key&&(this._saving=!1)}}_continue(e,t){let r=this._reviews.find(n=>n.id===e&&n.revision===t&&n.user===this.session?.id&&n.publishedAt!==null&&pe(n,this._context));return!r||this._activeReview?null:(this._continuation={source:r,review:{...r,publishedAt:null,revokedAt:null,status:null,teams:[]}},this._selectedTeams=new Set(this._teams.length===1?this._teams.map(n=>n.id):[]),this._selectedReview=null,this._panel=null,this._editors.clear(),this._resetEditor(this._path),this._notice="A new draft will be saved when you make a change.",this._activeReview)}async _persistContinuation(e){let t=this._continuation,r=this._key,{review:n}=await Zt(this._context,{action:"continue",reviewId:t.source.id,revision:t.source.revision},this.session.csrfToken,this._controller.signal);return r!==this._key||this._continuation!==t||e&&this._pendingSaves[0]!==e?null:(this._acceptSave(n,{revision:t.source.revision}),n)}_cancelSaves(){for(let e of this._pendingSaves)clearTimeout(e.timer),e.resolve(null);this._pendingSaves=[],this._saveBlocked=!1}_queueSave(e){let t=this._pendingSaves.findLast(n=>n.change.file===e.file);if(t&&t.change.comment===e.comment&&t.change.status===e.status)return t.promise;let r={change:e,slow:!1};return r.promise=new Promise(n=>{r.resolve=n}),r.timer=setTimeout(()=>{r.slow=!0,this._saveBlocked=!0},3e3),this._pendingSaves.push(r),this.requestUpdate(),this._pendingSaves.length===1&&this._flushSaves(),r.promise}_acceptSave(e,t){this._reviews=[...this._reviews.filter(r=>r.id!==e.id),e],this._continuation=null;for(let[r,n]of this._editors)n.revision===t.revision&&(n.revision=e.revision,n.edit=e.entries.find(s=>s.file===r&&s.status)??null);for(let{change:r}of this._pendingSaves.slice(1))r.revision===t.revision&&(r.revision=e.revision,r.reviewId=e.id,r.entryId=e.entries.find(n=>n.file===r.file)?.id??null);this._canEdit&&this._resetEditor(this._file),this._notice="Saved privately.",this._rememberBase()}async _flushSaves(){for(;this._pendingSaves.length>0;){let e=this._pendingSaves[0];this._error=null;try{if(this._continuation){let r=await this._persistContinuation(e);if(!r||this._pendingSaves[0]!==e)return;Object.assign(e.change,{reviewId:r.id,revision:r.revision,entryId:r.entries.find(n=>n.file===e.change.file)?.id??null})}let{review:t}=await Zt(this._context,e.change,this.session.csrfToken,this._controller.signal);if(this._pendingSaves[0]!==e)return;this._acceptSave(t,e.change),clearTimeout(e.timer),this._pendingSaves.shift(),e.resolve(t),this._saveBlocked=this._pendingSaves.some(r=>r.slow),this.requestUpdate()}catch(t){if(this._pendingSaves[0]!==e)return;this._cancelSaves(),t.name!=="AbortError"&&(this._error=t.message),this.requestUpdate();return}}}async _change(e){if(this._blocked||this._pendingSaves.length>0||this._loading||!this._writable)return null;if(e.action==="continue")return this._continue(e.reviewId,e.revision);let t=this._key;this._saving=!0,this._error=null;try{if(e.action==="publish"&&e.finalStatus&&this._continuation){let o=await this._persistContinuation();if(!o)return null;e={...e,reviewId:o.id,revision:o.revision}}let r=this._reviews.find(o=>o.id===e.reviewId)??this._context,n=Object.fromEntries(Object.keys(this._context).map(o=>[o,r[o]])),{review:s}=await Zt(n,e,this.session.csrfToken,this._controller.signal);return t!==this._key?null:(this._reviews=[...this._reviews.filter(o=>o.id!==s.id),s],e.action==="publish"&&e.finalStatus&&pe(s,this._context)&&(this._selectedReview=s.id,this._panel=null,this._editors.clear(),this._notice="Published. Verdicts and notes are now frozen."),this._rememberBase(),s)}catch(r){return t===this._key&&r.name!=="AbortError"&&(this._error=r.message),null}finally{t===this._key&&(this._saving=!1)}}_saveFile(e){if(!this._canEdit||this._saving||this._loading)return null;let t=this._editorState(e),r=this._pendingSaves.some(s=>s.change.file===e),n=this._activeReview;return!t.dirty&&!r?n:!t.status&&!t.comment.trim()&&!t.edit?.id&&!r?(this._editors.delete(e),e===this._file&&this._resetEditor(e),n):this._queueSave({action:"save",reviewId:n?.id??null,revision:t.revision,entryId:t.edit?.id??null,file:e,comment:t.comment,status:this._nonTextFiles.includes(e)?null:t.status||null})}async _saveAll(){let e=this._key;for(;e===this._key&&this._canEdit;){if(this._pendingSaves.length>0){if((await Promise.all(this._pendingSaves.map(r=>r.promise))).some(r=>!r))return!1;continue}let t=this._dirtyFiles;if(t.length===0)return!0;if(!await this._saveFile(t[0]))return!1}return!1}async _beginPublish(){if(!this._canEdit||this._saving||this._loading||this._finalizing||!this._summary.checkedFiles)return;let e=this._key;this._finalizing=!0;try{if(this._unsaved&&!await this._saveAll()||e!==this._key||!this._canEdit||this._unsaved||!this._summary.checkedFiles)return;let t=this._activeReview;if(!t)return;let r=this._allowedVerdicts,n=this._continuation?.source.status;this._finalStatus=r.includes(n)?n:r[0],this._finalComment=t.comment??"",this._publishRevision=t.revision,this._panel="publish"}finally{this._finalizing=!1}}_publish(){if(this._canPublish)return this._change({action:"publish",reviewId:this._activeReview.id,revision:this._publishRevision,teamIds:[...this._selectedTeams],finalStatus:this._finalStatus,finalComment:this._finalComment})}render(){if(!this.entry?.npm||!this.details)return m;let e=this.request?.bundle===this.entry.integrity?this.request:{};return this._target=e.reviewPackage?ui(e.reviewPackage,e.reviewSpec):"(empty)",this._loadBase(this._target,e.resume),Ch(this)}};customElements.define("npm-review",Lo);var Ag=i=>({view:"npm",packageName:i.package,packageSpec:i.version,bundleTab:"review",...i.basePackage===null?{}:{reviewPackage:i.basePackage,reviewSpec:i.baseVersion}}),Ig=i=>{let e=new Date(i);return a`<time datetime="${e.toISOString()}" data-tooltip="${e.toLocaleString()}">${e.toLocaleDateString(void 0,{month:"short",day:"numeric",...e.getFullYear()===new Date().getFullYear()?{}:{year:"numeric"}})} <span>${e.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}</span></time>`},Mo=class extends U{static properties={session:{attribute:!1},_reviews:{state:!0},_loading:{state:!0},_error:{state:!0},_next:{state:!0},_discarding:{state:!0},_expanded:{state:!0}};constructor(){super(),this._reviews=[],this._next=null,this._expanded=new Set,this._controller=new AbortController}createRenderRoot(){return this}disconnectedCallback(){super.disconnectedCallback(),this._controller.abort(),this._dismissLoading?.(),this._key=null}_canDiscard(e){return e.publishedAt===null&&e.user===this.session?.id&&["triage","manage","admin"].includes(this.session?.role)}async _discard(e){if(!this._canDiscard(e)||this._discarding||this._loading)return;let t=this._key,r=this._controller.signal;this._discarding=e.id,this._error=null;try{let{confirmed:n}=await qr({reviewTitle:Ae(e),signal:r});if(!n||r.aborted||t!==this._key||!this._canDiscard(e)||(await Qi(e.id,e.revision,this.session.csrfToken,r),t!==this._key||r.aborted))return;this._reviews=this._reviews.filter(s=>s.id!==e.id)}catch(n){t===this._key&&n.name!=="AbortError"&&(this._error=n.message)}finally{t===this._key&&(this._discarding=null)}}async _load(e=!1){let t=this._key;this._dismissLoading?.();let r=this._dismissLoading=Oe("Loading reviews\u2026",{duration:0});this._loading=!0,this._error=null;try{let{reviews:n,next:s}=await Od(e?this._next:null,this._controller.signal);if(t!==this._key)return;this._reviews=[...new Map([...e?this._reviews:[],...n].map(o=>[o.id,o])).values()],this._next=s}catch(n){t===this._key&&n.name!=="AbortError"&&(this._error=n.message)}finally{r(),t===this._key&&(this._loading=!1)}}_toggleDetails(e){let t=new Set(this._expanded);t.has(e)?t.delete(e):t.add(e),this._expanded=t}_details(e){let t=e.entries.filter(r=>r.status);return a`<section id="${`review-details-${e.id}`}" class="dependency-review-details" aria-label="${`Details for ${Ae(e)}`}">${e.comment?a`<div class="dependency-review-final-note" role="note" aria-label="Final note">${lt(e.comment)}</div>`:m} ${t.length>0?a`<ul class="dependency-review-entries">${t.map(r=>a`<li><span class="dependency-review-entry-file">${Ve(r.file)}<span>${r.file}</span></span> ${At(r.status)}<div>${lt(r.comment)}</div></li>`)}</ul>`:a`<p class="npm-review-muted">No file reviews yet.</p>`}</section>`}_row(e){let t=Ag(e),r=this._expanded.has(e.id),n=e.publishedAt!==null,s=new Set(e.entries.filter(u=>u.status).map(u=>u.file)).size,o=e.entries.filter(u=>u.status&&u.comment.trim()).length+ +!!e.comment.trim(),c=u=>{u.button===0&&!u.metaKey&&!u.ctrlKey&&!u.shiftKey&&!u.altKey&&me?.active&&(u.preventDefault(),di(e),me.navigate(t))};return a`<li class="${`dependency-review-row${r?" is-expanded":""}${e.revokedAt===null?"":" is-revoked"}`}"><div class="dependency-review-row-main"><button type="button" class="dependency-review-expand" aria-expanded="${r}" aria-controls="${`review-details-${e.id}`}" aria-label="${`${r?"Hide":"Show"} details for ${Ae(e)}`}" @click="${()=>this._toggleDetails(e.id)}">${xe}</button><div class="dependency-review-identity"><a class="dependency-review-title" href="${Yr(t)}" @click="${c}">${e.basePackage!==null&&e.basePackage!==e.package?a`<span>${e.basePackage} ${e.baseVersion} →</span>`:m} <strong>${e.package}</strong> <span>${e.basePackage===e.package?`${e.baseVersion} \u2192 `:""}${e.version}</span></a><div class="dependency-review-meta">${Ig(e.publishedAt??e.time)} ${n&&e.teams.length>0?a`<span class="dependency-review-teams">${e.teams.map(u=>u.name).join(", ")}</span>`:m} ${n&&o>0?a`<span class="dependency-review-note-count">${o} ${o===1?"note":"notes"}</span>`:m} ${e.revokedAt===null?m:ci(e)}</div></div><div class="dependency-review-result">${n?At(e.status):a`<span class="dependency-review-checked">${s} ${s===1?"file":"files"} checked</span>`} <span class="dependency-review-coverage">${n?a`${e.coverage==="full"?"Full":a`<span class="dependency-review-partial">Partial</span>`} · ${e.checkedFiles}/${e.totalFiles} files checked`:o?`${o} ${o===1?"note":"notes"}`:"No notes"}</span></div><div class="dependency-review-row-actions"><review-audit-copy .review="${e}"></review-audit-copy>${this._canDiscard(e)?a`<button type="button" class="dependency-review-discard" aria-label="Discard review" ?disabled="${this._loading||!!this._discarding}" @click="${()=>this._discard(e)}">${J(vi)}</button>`:m} <a class="dependency-review-open" href="${Yr(t)}" @click="${c}" aria-label="${`${n?"Open":"Continue"} review for ${Ae(e)}`}"><span aria-hidden="true">→</span></a></div></div>${r?this._details(e):m}</li>`}render(){let e=JSON.stringify([this.session?.id,this.session?.role]);return e!==this._key&&(this._controller.abort(),this._controller=new AbortController,this._key=e,this._reviews=[],this._next=null,this._discarding=null,this._expanded=new Set,this._load()),a`<section class="dependency-review-list"><header><h1>My reviews</h1></header><p>Your private work and the reviews you’ve shared with teams.</p>${this._error?a`<p role="alert">${this._error}</p>`:m} ${!this._loading&&!this._error&&this._reviews.length===0?a`<p>No reviews yet. Open a package’s Review tab to begin.</p>`:m} ${[["Drafts",!1],["Published reviews",!0]].map(([t,r])=>{let n=this._reviews.filter(s=>s.publishedAt!==null===r);return a`<section class="dependency-review-section"><h2>${t}<span class="npm-review-count">${n.length}</span></h2><ol>${n.map(s=>this._row(s))}</ol>${n.length===0&&!this._loading?a`<p class="npm-review-muted">${r?"No published reviews yet.":"No drafts."}</p>`:m}</section>`})} ${this._next?a`<button type="button" class="npm-review-button" ?disabled="${this._loading||!!this._discarding}" @click="${()=>this._load(!0)}">Load more</button>`:m}</section>`}};customElements.define("dependency-review-list",Mo);var Po=class extends U{static properties={review:{attribute:!1},_copied:{state:!0},_error:{state:!0}};createRenderRoot(){return this}disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this._timer)}async _copy(){let e=Sn(this.review);if(e!==null){this._error=!1;try{await navigator.clipboard.writeText(e),this._copied=!0,clearTimeout(this._timer),this._timer=setTimeout(()=>{this._copied=!1},2e3)}catch{this._error=!0}}}render(){return!this.review||Sn(this.review)===null?m:a`<button type="button" class="${`bundle-code-copy-path${this._copied?" copied":""}`}" aria-label="Copy audit Markdown" @click="${()=>this._copy()}">${Hi}</button> ${this._error?a`<span role="alert">Could not copy to the clipboard.</span>`:m}`}};customElements.define("review-audit-copy",Po);var Ao=class extends D{createRenderRoot(){return this}render(){return l.reports.length>0&&l.currentView==="findings"&&l.viewMode!=="graph"&&l.viewMode!=="kanban"?a`<button type="button" class="toolbar-export-btn" aria-label="Download or print report" @click="${this._onClick}">${Zd}</button>`:m}_onClick=()=>{this.dispatchEvent(new CustomEvent("download-requested",{bubbles:!0,composed:!0}))}};customElements.define("download-button",Ao);var He=class extends D{static styles=ut`.preview{position:fixed;inset:auto;margin:0;padding:14px;box-sizing:border-box;width:min(24rem,calc(100vw - 24px));max-height:calc(100vh - 24px);overflow:auto;border:1px solid var(--border);border-radius:var(--ui-radius, 10px);background:var(--bg);color:var(--text);box-shadow:0 8px 28px #00000040;font:13px/1.45 system-ui,sans-serif;text-align:left;white-space:normal;overflow-wrap:anywhere;letter-spacing:normal;cursor:default}.preview.wide{width:min(36rem,calc(100vw - 24px))}@media print{.preview{display:none}}`;constructor(){super(),this.showTimer=null,this.hideTimer=null}connectedCallback(){super.connectedCallback(),ht(this.renderRoot)}disconnectedCallback(){this._hidePreview(),super.disconnectedCallback()}updated(){let e=this.renderRoot.querySelector(".preview");e?e.matches(":popover-open")&&this._positionPreview():this._hidePreview()}_schedulePreview(){clearTimeout(this.hideTimer),clearTimeout(this.showTimer),this.renderRoot.querySelector(".preview")&&(this.showTimer=setTimeout(()=>{if(!this.isConnected)return;let e=this.renderRoot.querySelector(".preview");e&&(Sa(),e.showPopover(),this._positionPreview(),document.addEventListener("keydown",this._previewKeyDown,!0),window.addEventListener("scroll",this._previewScroll,!0),window.addEventListener("resize",this._hidePreview))},150))}_keepPreview(){clearTimeout(this.hideTimer)}_leavePreview(){clearTimeout(this.showTimer),clearTimeout(this.hideTimer),this.hideTimer=setTimeout(()=>{this.renderRoot.querySelector(".preview")?.contains(this.renderRoot.activeElement)||this._hidePreview()},150)}_hidePreview=()=>{clearTimeout(this.showTimer),clearTimeout(this.hideTimer);let e=this.renderRoot?.querySelector(".preview");e?.matches(":popover-open")&&e.hidePopover(),document.removeEventListener("keydown",this._previewKeyDown,!0),window.removeEventListener("scroll",this._previewScroll,!0),window.removeEventListener("resize",this._hidePreview)};_previewKeyDown=e=>{e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),this.renderRoot.querySelector(".preview")?.contains(this.renderRoot.activeElement)&&this.renderRoot.querySelector("[aria-details]").focus({preventScroll:!0}),this._hidePreview())};_previewScroll=e=>{e.composedPath().includes(this.renderRoot.querySelector(".preview"))||this._hidePreview()};_positionPreview(){let e=this.renderRoot.querySelector(".preview"),t=this.renderRoot.querySelector("[aria-details]").getBoundingClientRect(),{width:r,height:n}=e.getBoundingClientRect(),s=8,o=12,c=Math.max(o,Math.min(t.left,window.innerWidth-r-o)),u=t.bottom+s+n<=window.innerHeight-o?t.bottom+s:Math.max(o,t.top-s-n);e.style.left=`${c}px`,e.style.top=`${u}px`}};var Io={open:"Open",draft:"Draft",closed:"Closed",merged:"Merged",completed:"Completed",not_planned:"Not planned",duplicate:"Duplicate",unknown:"Closed"},Fg=a`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="4" cy="3" r="1.75"/><circle cx="4" cy="13" r="1.75"/><circle cx="12" cy="13" r="1.75"/><path d="M4 4.75v6.5M12 11.25V5a2 2 0 0 0-2-2H8m2-2L8 3l2 2"/></svg>`,Dg=a`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="8" cy="8" r="6.25"/><circle cx="8" cy="8" r="1.5" fill="currentColor" stroke="none"/></svg>`,Og=a`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="8" cy="8" r="6.25"/><path d="m5 8 2 2 4-4"/></svg>`,Bg=a`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="8" cy="8" r="6.25"/><path d="m3.5 12.5 9-9"/></svg>`,Ng={completed:Og,not_planned:Bg},Fo=class extends He{static properties={url:{type:String},compact:{type:Boolean,reflect:!0}};static styles=[He.styles,ut`:host{display:inline;word-break:normal}a{color:var(--accent);text-decoration:none;overflow-wrap:anywhere;cursor:default}.status{display:inline-flex;align-items:center;gap:.3em;vertical-align:text-bottom;margin-right:.35em;font-weight:600;white-space:nowrap}svg{flex:none}.open{color:light-dark(#1a7f37,#3fb950)}.draft,.not_planned,.duplicate,.unknown,.unavailable{color:var(--muted)}.closed{color:light-dark(#d1242f,#f85149)}.merged,.completed{color:light-dark(#8250df,#a371f7)}:host(:not([compact])){display:block}:host(:not([compact])) .fix-link{display:flex;align-items:center;gap:.55rem;min-width:0}.link-icon{flex:none;line-height:1}.link-icon svg{display:block}.link-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text);font-weight:500;line-height:1.5}.link-icon.unavailable+.link-title{color:var(--accent)}.ref{min-width:0;max-width:32%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted);font-size:.74rem}.link-status{flex:none;padding:.15rem .4rem;border-radius:999px;background:color-mix(in srgb,currentColor 10%,transparent);font-size:.7rem;font-weight:500;line-height:1.3}:host([compact]){display:inline-flex}:host([compact]) .fix-link{display:inline-flex;align-items:center;justify-content:center;width:100%;height:100%}:host([compact]) .fix-link svg{width:14px;height:14px}:host([compact]) .status{margin:0;font-size:1rem;line-height:1}.preview-header{display:flex;align-items:center;justify-content:space-between;gap:12px}.preview-ref{display:inline-flex;align-items:center;gap:.4rem;min-width:0;color:var(--muted);font-size:12px;line-height:1.4}.preview-ref span{min-width:0}.preview-description{margin-top:8px;white-space:pre-wrap}.preview-title{margin-top:8px;font-size:15px;font-weight:600;line-height:1.4}.preview .preview-header .status{flex:none;margin:0;font-size:12px;line-height:1.4}@media print{:host(:not([compact])) .fix-link{display:block}.link-title,.ref{white-space:normal;overflow:visible;text-overflow:clip;max-width:none}.link-icon{display:inline-block;vertical-align:middle;margin-right:.55rem}.ref,.link-status{margin-left:.55rem}.preview{display:none}}`];constructor(){super(),this.url="",this.compact=!1,this.unsubscribe=null}connectedCallback(){super.connectedCallback(),this.unsubscribe=Rl(()=>this.requestUpdate()),this.hasUpdated&&this.requestUpdate()}disconnectedCallback(){this.unsubscribe?.(),this.unsubscribe=null,super.disconnectedCallback()}updated(e){e.has("url")||e.has("compact")?this._hidePreview():super.updated(e)}render(){if(!wi(this.url))return a`${this.url}`;let e=Cl(this.url),t=!e&&El(this.url),r=e||t,n=Tl.read(this.url);if(!n&&!r){let p=`Open fix link: ${this.url}`;return a`<a class="${this.compact?"fix-link":""}" href="${this.url}" target="_blank" rel="noopener noreferrer" draggable="false" data-tooltip="${this.compact?p:m}" aria-label="${p}">${this.compact?a`<slot></slot>`:this.url}</a>`}let s=n?t&&n.status==="closed"?n.stateReason??"unknown":n.status:"unavailable",o=e?Fg:t?Ng[s]??Dg:null,c=r?`${r.repo}#${r.number}`:"",u=(n?.title.length??0)>40||(n?.description??"").split(/[\r\n]/u).some(p=>p.length>100),d=n?`${Io[s]} ${e?"pull request":"issue"}: ${n.title} (${c})`:r?`Open ${e?"pull request":"issue"}: ${c}`:`Open fix link: ${this.url}`;return a`<a class="fix-link" href="${this.url}" target="_blank" rel="noopener noreferrer" draggable="false" aria-label="${d}" aria-details="${this.compact&&r?"fix-preview":m}" data-tooltip="${this.compact&&!r?d:m}" @mouseenter="${this._schedulePreview}" @mouseleave="${this._leavePreview}" @focus="${this._schedulePreview}" @blur="${this._leavePreview}" @click="${this._hidePreview}">${this.compact?o?a`<span class="${`status ${s}`}">${o}</span>`:a`<slot></slot>`:a`${o?a`<span class="${`link-icon ${s}`}">${o}</span>`:m} <span class="link-title">${n?.title??(c||this.url)}</span> ${n?a`<span class="ref">${c}</span><span class="${`link-status ${s}`}">${Io[s]}</span>`:m}`} </a>${this.compact&&r?a`<a class="${u?"preview wide":"preview"}" id="fix-preview" popover="manual" href="${this.url}" target="_blank" rel="noopener noreferrer" draggable="false" aria-label="${`Open ${e?"pull request":"issue"} ${c} on GitHub`}" @mouseenter="${this._keepPreview}" @mouseleave="${this._leavePreview}" @focusin="${this._keepPreview}" @focusout="${this._leavePreview}" @click="${p=>{p.stopPropagation(),this._hidePreview()}}"><div class="preview-header"><span class="preview-ref">${J(bi)}<span>${c}</span></span> <span class="${`status ${s}`}">${o}${n?Io[s]:e?"Pull request":"Issue"}</span></div>${n?a`<div class="preview-title">${n.title}</div>`:m} ${n?.description?a`<div class="preview-description">${n.description}</div>`:m}</a>`:m}`}};customElements.define("managed-fix-link",Fo);var Do=class extends He{static properties={finding:{attribute:!1},comment:{type:String}};static styles=[He.styles,M(Ei),ut`:host{display:inline-flex}:host([hidden]){display:none!important}button{border:0;padding:0;background:none;color:inherit;font:inherit;cursor:default}.preview-trigger{display:inline-flex;align-items:center;justify-content:center;line-height:0}.preview-trigger:hover{color:var(--accent)}.managed-comment+.managed-comment{margin-top:12px;padding-top:12px;border-top:1px solid var(--border)}.comment-body{white-space:pre-wrap}.comment-body a{color:var(--accent);text-decoration:none}.comment-body a:hover{text-decoration:underline}.preview-footer{display:flex;justify-content:flex-end;margin-top:8px}.edit-hint{color:var(--muted);font-size:12px}.edit-hint:hover{color:var(--accent)}`];constructor(){super(),this.finding=null,this.comment="",this.unsubscribe=null}connectedCallback(){super.connectedCallback(),this._subscribe(),document.addEventListener("managed-comments-reset",this._resetComments),this.hasUpdated&&this.requestUpdate()}disconnectedCallback(){this.unsubscribe?.(),this.unsubscribe=null,document.removeEventListener("managed-comments-reset",this._resetComments),super.disconnectedCallback()}updated(e){this.hidden=!this.renderRoot.querySelector(".preview"),e.has("finding")&&(this._hidePreview(),this._subscribe()),super.updated(e)}_subscribe(){this.unsubscribe?.(),this.unsubscribe=this.finding?.id?mc(this.finding.id,()=>this.requestUpdate()):null}_resetComments=()=>{this._hidePreview(),this.requestUpdate()};_previewClick(e){if(e.target.closest("a, button")){this._hidePreview();return}window.getSelection?.()?.toString()||(e.stopPropagation(),this.renderRoot.querySelector(".preview-trigger").click())}render(){let e=H(),t=e?fc(this.finding):[];if(!(e?t.length>0:!!this.comment))return m;let s=(e?t.map(o=>o.body):[this.comment]).some(o=>o.split(/[\r\n]/u).some(c=>c.length>100));return a`<button type="button" class="preview-trigger mark-comment" aria-label="${e?"View comments":"Edit comment"}" aria-details="comment-preview" @mouseenter="${this._schedulePreview}" @mouseleave="${this._leavePreview}" @focus="${this._schedulePreview}" @blur="${this._leavePreview}" @click="${this._hidePreview}"><slot></slot></button><div class="${s?"preview wide":"preview"}" id="comment-preview" popover="manual" role="region" aria-label="${e?"Comments":"Comment"}" @mouseenter="${this._keepPreview}" @mouseleave="${this._leavePreview}" @focusin="${this._keepPreview}" @focusout="${this._leavePreview}" @click="${this._previewClick}">${e?t.map(o=>Ta(o,un(o.body))):a`<div class="comment-body">${un(this.comment)}</div><div class="preview-footer"><button type="button" class="mark-comment edit-hint">Edit</button></div>`}</div>`}};customElements.define("comment-preview",Do);function Lh(i){if(fa(i))throw new Error("This is a links file, not a report. Wrap report rows in a groups or findings object to compare them.");let e=i;try{let c=JSON.parse(i);Array.isArray(c)&&(e=JSON.stringify({groups:c}))}catch{}let{data:t,reason:r}=la(e);if(!t)throw new Error(r);let n=[],s=new Map,o=0;for(let c of aa(t)){let u=new Set;for(let d of Array.isArray(c)?c:[c])if(!(!d||typeof d!="object"||Array.isArray(d))){if(typeof d.id!="string"||!d.id){o++;continue}u.add(d.id),s.has(d.id)||s.set(d.id,[]),s.get(d.id).push(d)}n.push([...u].toSorted())}return{rows:n,byId:s,missingIds:o}}function zg(i){let e=new Set;for(let t of i){let r=[...new Set(t)].toSorted();for(let n=0;n<r.length;n++)for(let s=n+1;s<r.length;s++)e.add(JSON.stringify([r[n],r[s]]))}return e}function Th(i){let e=new Map,t=n=>{let s=n;for(;e.get(s)!==s;)e.set(s,e.get(e.get(s))),s=e.get(s);return s};for(let n of i){let[s,o]=JSON.parse(n);for(let c of[s,o])e.has(c)||e.set(c,c);e.set(t(s),t(o))}let r=new Map;for(let n of[...e.keys()].toSorted()){let s=t(n);r.has(s)||r.set(s,[]),r.get(s).push(n)}return[...r.values()].toSorted((n,s)=>n[0].localeCompare(s[0]))}function Ie(i,e,t){let r=(i.byId.get(e)??[]).map(n=>t==="verdict"?sa(n)||null:t==="severity"?ra(n)??null:t==="originalSeverity"?n.severity??null:t==="confidence"&&Number.isFinite(n.confidence)?n.confidence:null);return[...new Set(r)].toSorted((n,s)=>String(n).localeCompare(String(s),void 0,{numeric:!0}))}var Rh=(i,e)=>i.length===e.length&&i.every((t,r)=>t===e[r]),Hr=(i,e)=>[...i].filter(t=>!e.has(t)).toSorted();function Mh(i,e){let t=new Set(i.byId.keys()),r=new Set(e.byId.keys()),n=[...t].filter(v=>r.has(v)).toSorted(),s=new Set(n),o=v=>zg(v.rows.map(g=>g.filter(y=>s.has(y)))),c=o(i),u=o(e),d={confirmed:[],refuted:[],otherVerdicts:[],confidence:[],severity:[]};for(let v of n)for(let g of["verdict","confidence","severity"]){let y=Ie(i,v,g),k=Ie(e,v,g),_={id:v,before:y,after:k};if(g==="severity"&&(_.originalBefore=Ie(i,v,"originalSeverity"),_.originalAfter=Ie(e,v,"originalSeverity")),Rh(y,k)&&(g!=="severity"||Rh(_.originalBefore,_.originalAfter)))continue;if(g!=="verdict"){d[g].push(_);continue}let x=k.length===1&&k[0]==="confirmed"?"confirmed":k.length===1&&k[0]==="refuted"?"refuted":"otherVerdicts";d[x].push(_)}let p=Th(Hr(u,c)),h=Th(Hr(c,u)),f=Hr(r,t),b=Hr(t,r);return{before:i,after:e,added:f,removed:b,shared:n,joined:p,split:h,...d,unchanged:f.length===0&&b.length===0&&p.length===0&&h.length===0&&Object.values(d).every(v=>v.length===0)}}var Ph=`dialog{width:min(94vw,1180px);max-width:1180px;height:min(88dvh,960px);max-height:92dvh;margin-block:auto;padding:0;overflow:hidden;background:var(--theme-bar)}dialog[open]{display:flex;flex-direction:column}header{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:1.1rem 1.3rem}header h3{margin-bottom:.25rem;font-size:1.1rem}header p,.muted,.note,.empty{color:var(--muted);font-size:.78rem;line-height:1.5}button,select,input{font:inherit;font-size:.8rem}button,select,.file-button,.search{color:var(--text);background:var(--surface);border:1px solid var(--border);border-radius:var(--ui-radius, 6px);padding:.45rem .65rem}button:not(:disabled):hover,.file-button:hover{background:var(--surface-active)}button:disabled{opacity:.45}button:focus-visible,select:focus-visible,.search:focus-visible,.file-button:focus-within{outline:2px solid var(--accent);outline-offset:2px}.pickers{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:start;gap:1rem;padding:0 1.3rem 1rem;border-bottom:1px solid var(--border)}.picker{min-width:0}.picker>label{display:block;font-size:.72rem;font-weight:600;margin-bottom:.4rem;color:var(--muted)}.picker select{width:100%;text-overflow:ellipsis}.file-picker{display:flex;align-items:center;flex-wrap:wrap;gap:.6rem;margin-top:.55rem}.file-button{position:relative;display:inline-block;font-size:.74rem;padding:.3rem .5rem;overflow:hidden}.file-button input{position:absolute;inset:0;opacity:0;width:100%}.swap{align-self:start;margin-top:1.5rem;font-size:1rem}.results{overflow:auto;min-height:0;padding:1.1rem 1.3rem 1.4rem}.summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.65rem}.summary>div{display:flex;flex-direction:column;gap:.35rem;padding:.8rem 1rem;background:var(--bg);border:1px solid var(--border);border-radius:var(--ui-radius, 7px)}.summary span{font-size:.72rem;color:var(--muted)}.summary strong{font-size:1.15rem;font-variant-numeric:tabular-nums}.positive h4{color:var(--green)}.negative h4,.verdict-confirmed h4,.summary .verdict-confirmed strong{color:var(--critical)}.verdict-refuted h4,.summary .verdict-refuted strong{color:var(--muted)}.change-counts{display:flex;flex-wrap:wrap;gap:.4rem;margin-top:.7rem}.change-counts span{font-size:.7rem;padding:.3rem .5rem;border-radius:5px;background:var(--bg);color:var(--muted)}.results-head{display:flex;align-items:center;flex-wrap:wrap;gap:.75rem;margin-block:1rem}.results-head p{flex:1;font-size:.78rem;color:var(--muted);overflow-wrap:anywhere}.search{width:min(100%,17rem)}.section-title{margin:1.2rem 0 .5rem;font-size:.87rem}.note{margin:-.15rem 0 .6rem}.columns{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.8rem}.change-section{border:1px solid var(--border);border-radius:var(--ui-radius, 7px);overflow:hidden;margin-bottom:.6rem}.change-section h4{display:flex;justify-content:space-between;align-items:center;gap:.5rem;font-size:.78rem;font-weight:600;padding:.65rem .8rem;background:var(--bg)}.count{font-variant-numeric:tabular-nums;font-size:.7rem}ul{list-style:none}li{border-top:1px solid var(--border);padding:.7rem .8rem}.change-row{display:flex;justify-content:space-between;align-items:start;gap:.8rem}.finding{display:flex;flex-direction:column;gap:.2rem;min-width:0;overflow-wrap:anywhere}.finding strong{font-size:.77rem;font-weight:500;line-height:1.4}.finding code,.finding small{color:var(--muted);font-size:.66rem;line-height:1.4}.change-value{display:flex;align-items:center;justify-content:end;flex-wrap:wrap;gap:.3rem;max-width:48%;flex-shrink:0;font-size:.73rem;text-align:end;overflow-wrap:anywhere}.from{color:var(--muted)}.change-value small{width:100%;color:var(--muted);font-size:.67rem}.group-members{display:flex;flex-direction:column;gap:.55rem}.group-shape{display:flex;flex-wrap:wrap;gap:.45rem;margin-top:.7rem;font:.66rem/1.5 monospace;overflow-wrap:anywhere}.group-shape>span{min-width:0}.empty{padding:.7rem .8rem}.more{margin:.5rem .8rem .7rem;font-size:.72rem}.placeholder{padding:4rem 1rem;text-align:center;color:var(--muted);font-size:.85rem}.identical{color:var(--green);font-size:.82rem;padding-block:.5rem}.error,.warning{font-size:.75rem;line-height:1.5;margin-top:.5rem;overflow-wrap:anywhere}.error{color:var(--critical)}.warning{color:var(--yellow)}dialog>.error{padding:0 1.3rem .6rem}@media(width<=650px){.pickers{gap:.5rem;padding-inline:.8rem}.columns{grid-template-columns:minmax(0,1fr);gap:0}.summary{grid-template-columns:repeat(2,minmax(0,1fr))}.summary>div{padding:.6rem}.results-head p{flex-basis:100%}.search{width:100%}header,.results{padding-inline:.8rem}.change-row{flex-wrap:wrap}.change-value{max-width:100%}}
|
|
101
|
-
`;var Oo=()=>({key:"",name:"",report:null,error:"",loading:!1}),ct=(i,e)=>i.map(t=>t===null?"Not supplied":e==="confidence"?`${t}/10`:String(t).replaceAll("_"," ")).join(" / "),Bo=50,No=class extends q{static styles=[...q.styles,M(Ph)];static properties={_names:{state:!0},_sides:{state:!0},_catalogError:{state:!0},_catalogLoading:{state:!0},_diff:{state:!0},_query:{state:!0},_limits:{state:!0}};constructor(){super(),this._names=[],this._sides=[Oo(),Oo()],this._tokens=[0,0],this._catalogError="",this._catalogLoading=!0,this._diff=null,this._query="",this._limits={}}beforeOpen(){this._loadCatalog()}focusInitial(){this.renderRoot.querySelector("select")?.focus()}async _loadCatalog(){try{let e=await gt();if(this._settled)return;this._names=e.filter(n=>ol(n)!==ma);let t=this._names.includes(l.currentFile)?l.currentFile:this._names[0];t&&!this._tokens[0]&&this._select(0,t);let r=this._names.find(n=>n!==t);r&&!this._tokens[1]&&this._select(1,r)}catch(e){this._settled||(this._catalogError=`Couldn't list saved reports: ${e.message}`)}finally{this._settled||(this._catalogLoading=!1)}}_setSide(e,t){this._sides=this._sides.map((s,o)=>o===e?t:s),this._limits={};let[r,n]=this._sides.map(s=>s.report);this._diff=r&&n?Mh(r,n):null}async _select(e,t,r){let n=++this._tokens[e],s={...Oo(),key:r?"":t,name:t,loading:!!t};if(this._setSide(e,s),!!t)try{let o=r?await r.text():await tl(t);if(this._settled||this._tokens[e]!==n)return;this._setSide(e,{...s,loading:!1,report:Lh(o)})}catch(o){!this._settled&&this._tokens[e]===n&&this._setSide(e,{...s,loading:!1,error:`Couldn't read ${t}: ${o.message}`})}}_file(e,t){let r=t.target.files?.[0];t.target.value="",r&&this._select(e,r.name,r)}_swap(){this._sides.some(e=>e.loading)||(this._tokens=this._tokens.map(e=>e+1),this._sides=this._sides.toReversed(),this._setSide(0,this._sides[0]))}_picker(e){let t=this._sides[e],r=e===0?"Before":"After";return a`<section class="picker"><label for="${`report-${e}`}">${r}</label> <select id="${`report-${e}`}" @change="${n=>this._select(e,n.target.value)}"><option value="" .selected="${!t.key}">${t.name&&!t.key?t.name:"Choose a saved report\u2026"}</option>${this._names.map(n=>a`<option value="${n}" .selected="${t.key===n}">${n}</option>`)}</select><div class="file-picker"><label class="file-button">Open file…<input type="file" accept=".json,.md,.markdown" aria-label="${`Open ${r.toLowerCase()} report file`}" @change="${n=>this._file(e,n)}"></label> <span class="muted">${t.loading?"Reading report\u2026":t.report?`${t.report.byId.size.toLocaleString()} unique findings`:"JSON or Markdown"}</span></div>${t.error?a`<p class="error" role="alert">${t.error}</p>`:m} ${t.report?.missingIds?a`<p class="warning">${t.report.missingIds} findings without an id excluded.</p>`:m}</section>`}_finding(e){let t=this._diff.after.byId.get(e)?.[0]??this._diff.before.byId.get(e)?.[0];return a`<span class="finding"><strong>${Bt(t)||e}</strong><code>${e}</code>${t.file?a`<small>${t.file}</small>`:m}</span>`}_matches(e){let t=this._query.trim().toLowerCase();if(!t)return!0;let r=[...this._diff.before.byId.get(e)??[],...this._diff.after.byId.get(e)??[]];return[e,...r.flatMap(n=>[Bt(n),n.file])].filter(Boolean).some(n=>n.toLowerCase().includes(t))}_section(e,t,r,n,s=""){let o=r.filter(u=>(Array.isArray(u)?u:[u.id??u]).some(d=>this._matches(d))),c=this._limits[e]??Bo;return a`<section class="${`change-section ${s}`}" aria-label="${t}"><h4>${t}<span class="count">${this._query.trim()?`${o.length} / `:""}${r.length}</span></h4>${o.length>0?a`<ul>${o.slice(0,c).map(n)}</ul>`:a`<p class="empty">${r.length>0?"No matching findings.":"No changes."}</p>`} ${o.length>c?a`<button class="more" @click="${()=>{this._limits={...this._limits,[e]:c+Bo}}}">Show ${Math.min(Bo,o.length-c)} more (${o.length-c} remaining)</button>`:m}</section>`}_changeRow(e,t){let r=t==="severity"&&JSON.stringify(e.originalBefore)!==JSON.stringify(e.originalAfter);return a`<li class="change-row">${this._finding(e.id)}<span class="change-value"> <span class="from">${ct(e.before,t)}</span><span aria-label="to">→</span><span>${ct(e.after,t)}</span> ${r?a`<small>Original: ${ct(e.originalBefore)} → ${ct(e.originalAfter)}</small>`:m}</span></li>`}_presenceRow(e,t){let r=ct(Ie(t,e,"verdict"));return a`<li class="change-row">${this._finding(e)}<span class="change-value"> <span>${ct(Ie(t,e,"severity"))}</span><span>${ct(Ie(t,e,"confidence"),"confidence")}</span> ${r==="Not supplied"?m:a`<small>${r}</small>`}</span></li>`}_groupRow(e){let t=new Set(e),r=n=>n.rows.map(s=>s.filter(o=>t.has(o))).filter(s=>s.length).map(s=>s.join(", ")).filter((s,o,c)=>c.indexOf(s)===o).join(" | ");return a`<li class="group-row"><div class="group-members">${e.map(n=>this._finding(n))}</div><div class="group-shape"><span class="from">${r(this._diff.before)}</span><span aria-label="to">→</span><span>${r(this._diff.after)}</span></div></li>`}_verdictCount(e,t){return[...e.byId.keys()].filter(r=>Ie(e,r,"verdict").includes(t)).length}_results(){let e=this._diff;return e?a`<div class="summary" aria-label="Comparison summary"><div><span>Unique findings</span><strong>${e.before.byId.size} → ${e.after.byId.size}</strong></div><div><span>In common</span><strong>${e.shared.length}</strong></div><div class="verdict-confirmed"><span>Confirmed</span><strong>${this._verdictCount(e.before,"confirmed")} → ${this._verdictCount(e.after,"confirmed")}</strong></div><div class="verdict-refuted"><span>Refuted</span><strong>${this._verdictCount(e.before,"refuted")} → ${this._verdictCount(e.after,"refuted")}</strong></div></div><div class="change-counts" aria-label="Change counts"><span>${e.added.length} added</span><span>${e.removed.length} removed</span> <span>${e.joined.length} joined</span><span>${e.split.length} split</span> <span>${e.confidence.length} confidence</span><span>${e.severity.length} severity</span></div><div class="results-head"><p>Changes from <strong>${this._sides[0].name}</strong> to <strong>${this._sides[1].name}</strong>.</p><input class="search" type="search" aria-label="Filter comparison findings" placeholder="Filter by id, title or file…" .value="${this._query}" @input="${t=>{this._query=t.target.value,this._limits={}}}"></div>${e.shared.length===0&&(e.before.missingIds||e.after.missingIds)?a`<p class="warning" role="status">No shared ids to compare. Findings without ids cannot be matched.</p>`:e.unchanged?a`<p class="identical" role="status">No differences in finding ids, grouping, verdicts, confidence or severity.</p>`:m}<h3 class="section-title">Findings</h3><div class="columns">${this._section("added","Added",e.added,t=>this._presenceRow(t,e.after),"positive")} ${this._section("removed","Removed",e.removed,t=>this._presenceRow(t,e.before),"negative")}</div><h3 class="section-title">Revalidation</h3><p class="note">Changed verdicts for shared ids, grouped by the after report’s verdict.</p><div class="columns">${this._section("confirmed","Confirmed",e.confirmed,t=>this._changeRow(t,"verdict"),"verdict-confirmed")} ${this._section("refuted","Refuted",e.refuted,t=>this._changeRow(t,"verdict"),"verdict-refuted")}</div>${e.otherVerdicts.length>0?this._section("other","Other verdict changes",e.otherVerdicts,t=>this._changeRow(t,"verdict")):m}<h3 class="section-title">Grouping</h3><p class="note">Only shared ids. Each cluster connects changed pairs; added or removed findings do not count as regrouping.</p><div class="columns">${this._section("joined","Joined",e.joined,t=>this._groupRow(t),"positive")} ${this._section("split","Split",e.split,t=>this._groupRow(t),"negative")}</div><h3 class="section-title">Ratings</h3><p class="note">Shared ids only. Severity includes report corrections; changes to original severity are also shown.</p><div class="columns">${this._section("confidence","Confidence changes",e.confidence,t=>this._changeRow(t,"confidence"))} ${this._section("severity","Severity changes",e.severity,t=>this._changeRow(t,"severity"))}</div>`:a`<p class="placeholder" role="status">${this._sides.some(t=>t.loading)||this._catalogLoading?"Loading reports\u2026":"Choose two saved reports or open two files to compare."}</p>`}render(){return a`<dialog aria-labelledby="compare-title" @close="${this._onClose}"><header><div><h3 id="compare-title">Compare reports</h3><p>Compare findings, grouping and ratings between two reports.</p></div><button aria-label="Close report comparison" @click="${this._onClose}">Close</button></header><div class="pickers">${this._picker(0)}<button class="swap" aria-label="Swap before and after reports" ?disabled="${this._sides.some(e=>e.loading)}" @click="${this._swap}">⇄</button>${this._picker(1)}</div>${this._catalogError?a`<p class="error" role="alert">${this._catalogError} You can still open files directly.</p>`:m}<div class="results">${this._results()}</div></dialog>`}};customElements.define("report-compare-dialog",No);function Ah(){if(H())throw new Error("Report comparison is available in local/E2E mode.");return Y("report-compare-dialog")}function pi(i){let e=new Map;for(let[t,r]of l.triage)r[i]&&e.set(t,r[i]);return e}var Hg={get markers(){return pi("color")},get triageState(){return pi("triage")},get comments(){return pi("comment")},get fixes(){return pi("fix")},get flags(){return pi("flagged")},get(i){let e=l.triage.get(i),t={};return e?.color&&(t.color=e.color),e?.triage&&(t.triage=e.triage),e?.comment&&(t.comment=e.comment),e?.fix&&(t.fix=e.fix),e?.flagged!==void 0&&(t.flagged=e.flagged),t},async set(i,{color:e,triage:t,comment:r,fix:n,flagged:s}={}){if(Ut())throw new Error("DeepView.triage.set: triage is read-only on this page");let o=!1;if(e!==void 0&&(e===null||e===""?X(l.triage,i,{color:void 0})&&(o=!0):l.triage.get(i)?.color!==e&&(X(l.triage,i,{color:e}),o=!0)),t!==void 0)if(t===null||t===""||t===!1)X(l.triage,i,{triage:void 0})&&(o=!0);else if(t==="inprogress"||t==="fixed"||t==="invalid"||t==="deleted"||t==="ignored")l.triage.get(i)?.triage!==t&&(X(l.triage,i,{triage:t}),o=!0);else throw new TypeError(`DeepView.triage.set: unknown triage value ${JSON.stringify(t)} (expected 'inprogress' | 'fixed' | 'invalid' | 'deleted' | 'ignored' | null)`);if(r!==void 0){let c=r?String(r):"";c?l.triage.get(i)?.comment!==c&&(X(l.triage,i,{comment:c}),o=!0):X(l.triage,i,{comment:void 0})&&(o=!0)}if(n!==void 0){let c=n?String(n):"";c?l.triage.get(i)?.fix!==c&&(X(l.triage,i,{fix:c}),o=!0):X(l.triage,i,{fix:void 0})&&(o=!0)}if(s!==void 0){let c=s===null||s===""?void 0:!!s;l.triage.get(i)?.flagged!==c&&(X(l.triage,i,{flagged:c}),o=!0)}return o&&(await ke(),$()),o}};window.DeepView={get reports(){return l.reports.slice()},get groups(){return Vt()},get findings(){return Vt().flat()},get currentFile(){return l.currentFile},get currentWorkspace(){return l.currentWorkspace},triage:Hg,forceManagedMode:qd,setTheme:Gu,get theme(){return Wu()},triageSync:Fi,refresh(){$()},export(){return rp()},compareReports(){return Ah()}};var Ug={default:Je.default,"claude-security":Je["claude-security"],"codex-security":Je["codex-security"],deepsec:Je.deepsec,piolium:Je.piolium,"markdown-generic":Je["markdown-generic"],bundle:Yo,workspace:Jo,links:gi,github:bi};for(let i of document.querySelectorAll(".drop-supported-icon[data-icon]")){let e=Ug[i.dataset.icon];e&&(i.innerHTML=e)}kl($);pl($);wl($);Fi.onStatusChange($);yl(async(i,e)=>{l.currentWorkspace===i?await it(i):l.currentFile&&l.currentFile===e?await tt(e):await fe()});_l(async()=>{await fe(),l.currentView==="bundles"&&$()});jd();Kd();async function Dh(){let i=vl();if(!i)return!1;try{history.replaceState(null,"",location.pathname)}catch{}let e;try{e=await Wd({encoded:i})}catch(r){return alert(`Couldn't open the share-link unlock prompt: ${r.message}`),!1}if(!e)return!1;let t=await ll({id:e.id,name:e.name,privateKey:e.privateKeyBase64});if(t.status==="already-attached")return alert(`This workspace is already attached as "${t.workspace.name}".`),!1;if(t.status==="name-collision"){let r=t.existing?.name;return alert(r?`A workspace named "${r}" already exists. Open the share link again and pick a different name.`:"The shared workspace name is empty or invalid. Ask the sender to re-share with a real name."),!1}return t.workspace?.id?await it(t.workspace.id):await fe(),!0}async function Oh(){let i=ha();if(!i)return!1;try{history.replaceState(null,"",location.pathname)}catch{}let e=await zd(i);return e.ok?!0:(alert(e.reason),!1)}var It=!1;async function Bh(){if(await St(),!It&&!(!H()&&we()&&!Ye())){It=!0;try{await jg()}finally{$a.hidden=!1}}}async function jg(){let i=cn(),e=()=>i===cn()&&!H();if(H()){await fe();return}if(await Ya(),!e()||(al(),await Promise.all([fe(),ul().catch(s=>console.warn("initial linked findings:",s))]),!e())||await Dh()||!e()||await Oh()||!e())return;let n=Wa(fd);if(n)if(n.startsWith("wbs:")||n.startsWith("wrs:"))await Xi(n.slice(4),n.startsWith("wrs:")?"reports":"bundles");else if(n.startsWith("ws:")){let s=n.slice(3);he().some(o=>o.id===s)&&await it(s)}else if(n.startsWith("b:")){let s=n.slice(2),o=s.indexOf(" "),c=o>=0?s.slice(0,o):s,u=o>=0?s.slice(o+1):"",d=ki.has(u)?u:"overview";if((l.bundles??[]).some(p=>p.integrity===c)){let p=he().filter(h=>h.bundles.includes(c));Kt(c,d,{workspaceId:p.length===1?p[0].id:null}),$(),wt(c),await fe()}}else{let s=await gt();if(!e())return;let o=hl(n);o&&s.includes(o.name)&&await tt(o.name,void 0,{workspaceId:o.workspaceId})}}var Ur=!1,Ih=!1;document.addEventListener("managed-client-mode-change",()=>{Ur=!H()&&we()});function Fh(i){Ih||(Ih=!0,queueMicrotask(()=>{alert(i+" This tab will reload to refresh its state. Any unsaved edits in this tab will be lost."),location.reload()}))}Pi(async()=>{if(await St(),H()){$();return}let i=Ur,e=we();if(Ur=e,$(),!It&&Ye()){Bh().catch(t=>console.warn("continueBoot:",t));return}if(It&&e&&!Ye()){Fh("Encryption was just enabled in another tab.");return}It&&i&&!e&&!ja()&&Fh("Encryption was disabled in another tab.")});window.addEventListener("hashchange",()=>{!It||H()||(async()=>{await Dh()||await Oh()})().catch(i=>console.warn("deep-link hashchange:",i))});(async()=>{if(!await Gd()){await St(),Ur=!H()&&we();try{let i=window.matchMedia?.("(display-mode: window-controls-overlay)"),e=()=>{let n=!1;try{n=localStorage.getItem("deepview.sidebarCollapsed")==="1"}catch{}xa.classList.toggle("collapsed",n&&!i?.matches)};e(),i?.addEventListener("change",e);let t=i?.matches;if(window.matchMedia?.("(display-mode: standalone)").matches||t){let n=document.querySelector('meta[name="viewport"]');n&&n.setAttribute("content","width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"),window.addEventListener("wheel",s=>{(s.ctrlKey||s.metaKey)&&s.preventDefault()},{passive:!1}),window.addEventListener("keydown",s=>{(s.ctrlKey||s.metaKey)&&(s.key==="="||s.key==="+"||s.key==="-"||s.key==="0")&&s.preventDefault()})}}catch{}!H()&&we()&&!Ye()||await Bh()}})();
|
|
90
|
+
`)}`:"",wo=(i,e)=>a`<span class="bundle-compare-code-counts" aria-label="${`${i} added, ${e} removed lines`}"><span class="add">+${i.toLocaleString()}</span><span class="del">−${e.toLocaleString()}</span></span>`,at=(i,e)=>i.length+e.length>lg||Bn(i)+Bn(e)>ag,uh=i=>i.kind==="repointed"||i.kind==="renamed"&&!i.modified&&!!i.repointed&&!i.meta,vo=i=>Array.isArray(i)?i.some(vo):i?.strings?i.strings.some(e=>e.trim()!=="")||i.values.some(vo):i!=null&&i!==m&&i!==!1&&i!=="",fo=new WeakMap;function fh(i,e){if(fo.has(i))return fo.get(i);let t=new Set;for(let n of e)for(let r=n.lastIndexOf("/");r>0&&!t.has(n.slice(0,r));r=n.lastIndexOf("/",r-1))t.add(n.slice(0,r));return fo.set(i,t),t}function ph(i){let e=K(i);return fh(e,e.keys())}function yo(i,e){for(let t of i.files.values())if(t===e)return!0;for(let t of i.dirs.values())if(yo(t,e))return!0;return!1}var Mt=class extends U{static properties={base:{attribute:!1},other:{attribute:!1},files:{attribute:!1},scope:{attribute:!1},resolutions:{attribute:!1},baseAlerts:{attribute:!1},otherAlerts:{attribute:!1},alertTags:{attribute:!1},newHosts:{attribute:!1},newHostTag:{attribute:!1},dependencies:{attribute:!1},openDependency:{attribute:!1},dependencyTags:{attribute:!1},extensions:{attribute:!1},baseName:{},otherName:{},path:{},seek:{attribute:!1},_query:{state:!0},_kinds:{state:!0},_mode:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.base=null,this.other=null,this.files=null,this.scope="",this.resolutions=[],this.baseAlerts=null,this.otherAlerts=null,this.alertTags=null,this.newHosts=null,this.newHostTag=null,this.extensions=null,this._treeLimit=300,this._treeRemaining=1/0,this.path=null,this._query="",this._kinds=new Set(On.map(e=>e.kind)),this._mode="files",this._blocks=new Map,this._found=null,this._rowless=new Map,this._rowlessCount=0,this._aligned=new WeakMap,this._sought=null,this._soughtRow=null,this._open=new Map,this._models=new Map,this._modelCap=cg,this._counted=new Map,this._countModels=new Map,this._drawnCounts=new Map,this._drawnTotals=new Map,this._spaced=new Map,this._shorter=new Map,this._expansions=new Map,this._limits=new Map,this._forced=new Set,this._shownPath=null}willUpdate(e){let t=`${this.base?.integrity}|${this.other?.integrity}`;if((t!==this._pair||e.has("files"))&&(this._pair=t,this._models.clear(),this._spaced.clear(),this._shorter.clear(),this._expansions.clear(),this._limits.clear(),this._forced.clear()),["files","resolutions","base","other"].some(n=>e.has(n))&&(this._entries=Js(this.base,this.other,this.files,this.resolutions??[]),this._counted=new Map,this._countModels=new Map,this._drawnCounts=new Map,this._drawnTotals=new Map,this._treeLimit=this.extensions?.treePageSize??1/0,this._blocks.clear(),this._rowless.clear(),this._sought=this._soughtRow=null,this._soughtSettling=!1),e.has("seek")&&this.seek&&!Qp.has(this.seek)){Qp.add(this.seek);let{path:n,line:r,query:s}=this.seek,o=this._entries?.get(n),c=o?ae(this.base,this.other,n,o).after:null,u=typeof c=="string"?Q(c)[r]?.toLowerCase().indexOf(s.toLowerCase())??-1:-1;this._sought={path:n,side:"b",line:r,at:Math.max(u,0),query:s},this._soughtRow=null,this._soughtSettling=!1}}updated(){if(this._current!==this._shownPath){this._shownPath=this._current;let e=this.querySelector(".bundle-compare-diff");e&&(e.scrollTop=0),this.querySelector(".bundle-compare-code-tree .bundle-code-tree-link.current")?.scrollIntoView({block:"nearest"})}this._scrollSought()}_scrollSought(){if(this._sought?.path===this._current&&!this._soughtSettling&&(this._sought=null),!this._soughtRow)return;let{path:e,index:t}=this._soughtRow;this._soughtRow=null;let r=[...this.querySelectorAll(".bundle-compare-diff-table")].find(o=>o.dataset.path===e)?.children[t];if(!r)return;let s=r.closest(".bundle-compare-diff");r.scrollIntoView({block:s&&r.offsetHeight>s.clientHeight/2?"start":"center"}),r.classList.remove("is-sought"),r.offsetWidth,r.classList.add("is-sought"),r.addEventListener("animationend",()=>r.classList.remove("is-sought"),{once:!0})}_shown(e){return this._kinds.has(e.kind)||!!e.modified&&this._kinds.has("changed")||!!e.repointed&&this._kinds.has("repointed")}_modules(){let e=this.base?.kind==="stasis"?this.base.bundle?.modules:null,t=this.other?.kind==="stasis"?this.other.bundle?.modules:null,n={root:this.files?.root,paths:this.files?.basePaths??new Map};return e||t?new Map([...[...e??[]].map(([r,s])=>[ed(n,r,Object.keys(s.files??{})),s]),...t??[]]):null}_baseDirs(){let e=this.files?.root?this.files.basePaths:null;return e?fh(e,e.values()):ph(this.base)}_format(e){let t=this._entries.get(e),n=er(this.base,t?.basePath??e),r=er(this.other,e);return[n,r].find(_a)??(t?.kind==="removed"?n:r)}_tree(){let e=[this._entries,`${[...this._kinds].join()}:${!!this.extensions?.fullPaths}`];if(this._treeKey?.[0]===e[0]&&this._treeKey[1]===e[1])return this._treeMemo;let t=[...this._entries.keys()],n=this._modules(),r=Ji(this.files?.root,this.extensions?.fullPaths?"":Lc(ft(t).prefix,n,t)),{prefix:s}=r,o=t.filter(d=>this._shown(this._entries.get(d))),c=d=>s&&d.startsWith(s)?d.slice(s.length):d,u=Ki(o.map(c),o,n);return this._treeKey=e,this._treeMemo={prefix:s,root:r,tree:u,shown:o.length,allOrder:Wt(u)},this._treeMemo}_select(e){!e||e===this._current||this.extensions?.canSelect?.()===!1||this.dispatchEvent(new CustomEvent("compare-code-select",{detail:{path:e},bubbles:!0,composed:!0}))}_reveal(e,t){let n=(t&&e.startsWith(t)?e.slice(t.length):e).split("/");for(let r=1;r<n.length;r++)this._open.set(n.slice(0,r).join("/"),!0)}_railState(){let{prefix:e,root:t,tree:n,shown:r,allOrder:s}=this._tree(),o=Mc(n,this._mode==="files"?this._query:"",e,this.extensions?.fileFilter);return{prefix:e,root:t,tree:n,shown:r,filtered:o,order:o===n?s:o?Wt(o):[],allOrder:s}}_renderRail({prefix:e,root:t,tree:n,shown:r,filtered:s,order:o},c){this._countUntil=null,this._treeRemaining=this.extensions?.treePageSize?this._treeLimit:1/0,this._treeTruncated=!1;let u=this._mode==="code"?m:s?this._renderTree(s,c,0,!!this._query||r<=(this.extensions?.openAllMax??dg)):a`<div class="bundle-code-search-empty">No changed files match.</div>`,d=Object.fromEntries(On.map(({kind:h})=>[h,0]));for(let h of this._entries.values())h.kind!=="repointed"&&d[h.kind]++,h.modified&&d.changed++,h.repointed&&d.repointed++;let p=Yp.find(({mode:h})=>h===this._mode);return a`<aside class="bundle-code-rail"><div class="bundle-code-rail-head"><span class="bundle-code-rail-label">${this.extensions?.railLabel??"Changes"}</span> <span class="bundle-code-rail-count">${this._entries.size.toLocaleString()}</span> <span class="bundle-code-rail-actions"><button type="button" class="bundle-code-rail-action" aria-label="${this.extensions?.collapseLabel??"Collapse directories"}" data-tooltip="Collapse directories" ?disabled="${this._mode!=="files"||!!this._query&&!this.extensions?.collapseClearsSearch||n.dirs.size===0}" @click="${()=>this._collapseAll(n)}">${_c}</button></span></div>${t.from?a`<div class="bundle-code-rail-prefix mono" data-tooltip="${`Root moved: ${t.from} \u2192 ${t.to}`}">${Tn(t)}</div>`:e?a`<div class="bundle-code-rail-prefix mono" data-tooltip-truncated data-tooltip="${e}">${e}</div>`:m}<div class="bundle-compare-code-filter"><label class="bundle-compare-code-search"><svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true"><circle cx="7" cy="7" r="4.5"/><path d="m10.5 10.5 3.5 3.5"/></svg> <input type="search" placeholder="${this._mode==="files"?this.extensions?.searchPlaceholder??p.placeholder:p.placeholder}" aria-label="${this._mode==="files"?this.extensions?.searchLabel??p.placeholder:p.placeholder}" spellcheck="false" autocomplete="off" .value="${j(this._query)}" @input="${h=>{this._query=h.target.value,this._treeLimit=this.extensions?.treePageSize??1/0}}"> <span class="bundle-code-search-modes" role="tablist">${Yp.map(({mode:h,label:f,icon:b})=>a`<button type="button" class="${I({"bundle-code-search-mode":!0,active:h===this._mode})}" role="tab" aria-selected="${String(h===this._mode)}" aria-label="${f}" data-tooltip="${f}" @click="${()=>{this._mode=h}}">${b}</button>`)}</span></label> ${this.extensions?.filters??a`<div class="bundle-compare-code-kinds" role="group" aria-label="Show changes">${On.filter(({kind:h})=>d[h]>0).map(({kind:h,label:f})=>a`<button type="button" class="${`bundle-compare-code-kind ${h}`}" aria-pressed="${String(this._kinds.has(h))}" data-tooltip="${`${this._kinds.has(h)?"Hide":"Show"} ${f.toLowerCase()} files`}" @click="${()=>this._toggleKind(h)}">${f.toLowerCase()}</button>`)}</div>`}</div><div class="bundle-code-rail-body bundle-compare-code-tree">${this._mode==="code"?this._renderSearch(o,c,e):u} ${this._mode==="files"&&this._treeTruncated?a`<button type="button" class="bundle-compare-code-action" @click="${()=>{this._treeLimit+=this.extensions.treePageSize,this.requestUpdate()}}">Show more files</button>`:m}</div>${this.extensions?.footer?.(h=>{this._query="",this._select(h)})??m}</aside><bundle-code-splitter role="separator" tabindex="0" aria-orientation="vertical" aria-label="Resize file tree" data-tooltip="Drag to resize · double-click to reset"></bundle-code-splitter>`}_arrived=0;_renamesAlone=!0;_repaint=()=>{this._arrived++,this.isConnected&&this.requestUpdate()};disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this._countLater),clearTimeout(this._searchLater),this._countLater=this._searchLater=null}render(){let e=this._railState(),t=this._entries.has(this.path)?this.path:e.order[0]??null;t&&t!==this._current&&this._reveal(t,e.prefix),this._current=t,this._order=this.extensions?.filterContent===!1?e.allOrder:e.order;let n=t?a`${this._renderFile(t,this.extensions?.fullPaths?"":e.prefix)}${this.extensions?.fileActions?.(t,!1)??m}`:a`<div class="bundle-code-placeholder">No files differ in this comparison.</div>`;return a`<div class="bundle-code-view bundle-compare-code">${this._renderRail(e,t)}<div class="bundle-code-main">${n}</div></div>`}_toggleKind(e){let t=new Set(this._kinds);t.has(e)?t.delete(e):t.add(e),this._kinds=t}_collapseAll(e){this.extensions?.collapseClearsSearch&&(this._query=""),this._treeLimit=this.extensions?.treePageSize??1/0;let t=n=>{for(let r of n.dirs.values())this._open.set(r.path,!1),t(r)};t(e),this.requestUpdate()}_renderSearch(e,t,n){if(!this._query)return a`<div class="bundle-code-search-hint">Type to search the code of the changed files.</div>`;let{files:r,hits:s,truncated:o,unsigned:c}=this._searchResults(e);if(r.length===0)return a`<div class="bundle-code-search-empty">No matches.</div>`;let u=d=>n&&d.startsWith(n)?d.slice(n.length):d;return a`<div class="bundle-code-search-results bundle-compare-search"><div class="bundle-code-search-summary">${s.toLocaleString()} ${s===1?"hit":"hits"} in ${r.length.toLocaleString()} ${r.length===1?"file":"files"}${o?`, the first ${io}`:""}</div>${ce(r,d=>d.path,({path:d,hits:p})=>a`<div class="${I({"bundle-code-search-file":!0,current:d===t})}"><button type="button" class="${`bundle-code-search-file-name bundle-compare-code-name ${this._entries.get(d).kind}`}" data-tooltip-truncated data-tooltip="${d}" @click="${()=>this._select(d)}">${u(d)}</button> ${c.has(d)?a`<p class="bundle-compare-search-note">${ug[c.get(d)]}</p>`:m}<ul class="bundle-code-search-hits">${p.map(h=>a`<li class="bundle-code-search-hit"><button type="button" class="bundle-code-search-hit-link" aria-label="${`${Zp[h.sign]?.label??"Line"} ${h.line+1}${h.side==="a"?" of the old text":""}: ${h.text.trim().slice(0,80)}`}" @click="${()=>this._seek(d,h)}"><span class="bundle-code-search-hit-ln">${h.line+1}</span> <span class="${`bundle-compare-search-sign ${Zp[h.sign]?.name??""}`}" aria-hidden="true">${h.sign??""}</span> <span class="bundle-code-search-hit-text mono">${$d(h.text,h.ranges)}</span></button></li>`)}</ul></div>`)}</div>`}_searchResults(e){let t=eh(),n=`${this._query}\0${this._forced.size}\0${t}\0${N.layout}\0${!!l.bundleSourcePretty}\0${Hc()}\0${this._rowlessCount}\0${e.join("\0")}`;if(this._found?.key===n&&this._found.entries===this._entries)return this._found.result;let r=null,s=!0,o=new Map,c=(h,f,b)=>{if(o.get(h)==="printed")return null;let v=`${N.ignoreWhitespace}\0${h}`;if(this._blocks.has(v))return this._blocks.get(v);if(!this._forced.has(h)&&at(f,b))return o.set(h,"large"),null;let g=performance.now();if(r??=g+uo,g>r)return s=!1,null;let y=N.ignoreWhitespace&&!this._unlisted(h,this._entries.get(h),{before:f,after:b}),k=Ce(f,b,y);return y&&Jt(f,b,k)&&(k=Ce(f,b)),this._blocks.set(v,k),k},u=e.flatMap(h=>{let f=this._entries.get(h);if(!this._searchable(f))return[];let b=ae(this.base,this.other,h,f),{before:v,after:g}=b;if(this._prettyShown(h,f,b)){if(!/\S/u.test(this._query))return[];let y=v!==""&&g!==""&&v!==g;if(y&&this._rowless.get(h)===t)return[];o.set(h,y?"printed":"numbered")}return[{path:h,...b}]}),d=(h,f,b,v)=>{let g=this._aligned.get(b);return g||this._aligned.set(b,g={a:h,b:f,blocks:b}),to(g,b.indexOf(v))},p={...Bp(u,kd(this._query,!1,!1),c,{split:N.layout==="split",align:d}),unsigned:o};return s?this._found={key:n,entries:this._entries,result:p}:this._searchLater??=setTimeout(()=>{this._searchLater=null,this.requestUpdate()}),p}_searchable(e){return e.modified!==!1||uh(e)}_prettyShown(e,t,n){if(!l.bundleSourcePretty)return!1;let r=this._printing(e,t,n);return!!r?.applies&&r.copies.status!=="error"}_noteRowless(e,t){let n=t?eh():void 0;this._rowless.get(e)!==n&&(n===void 0?this._rowless.delete(e):this._rowless.set(e,n),this._rowlessCount++)}_seek(e,t){this._sought={path:e,side:t.side,line:t.line,at:t.ranges[0]?.[0]??0,query:this._query},e===this._current?this.requestUpdate():this._select(e,!1)}_soughtLine(e,t,n,r){let{side:s,line:o,at:c,query:u}=this._sought;if(n?.status!=="ready")return{side:s,line:o};let d=y=>y.replaceAll(/\s+/gu,""),p=Q(ae(this.base,this.other,e,t)[s==="a"?"before":"after"]??""),h=p.slice(0,o).reduce((y,k)=>y+d(k).length,0)+d(p[o]?.slice(0,c)??"").length,f=d(u).toLowerCase(),b=(y,k)=>{if(!f)return null;let _=0,x=0,S=0,T="";for(let F of y)for(let O=0;O<F.length;O+=Xp){T+=d(F.slice(O,O+Xp)).toLowerCase();for(let z=T.indexOf(f,_);z!==-1;z=T.indexOf(f,_),x++){if(k(x,S+z))return{index:x,start:S+z};_=z+f.length}let A=Math.max(_,T.length-f.length+1);T=T.slice(A),S+=A,_=Math.max(0,_-A)}return null},v=b(p,(y,k)=>k>=h),g=(v&&b(r[s],y=>y===v.index)?.start)??h;for(let y=0;y<r[s].length;y++)if(g-=d(r[s][y]).length,g<0)return{side:s,line:y};return null}_seekRows(e,t,{side:n,line:r},s){let o=h=>n==="b"?(h.kind==="ctx"||h.kind==="add")&&h.b===r||h.kind==="change"&&h.right===r:(h.kind==="ctx"||h.kind==="del")&&h.a===r||h.kind==="change"&&h.left===r,c=this._expansions.get(e)??new Map,u=Lt(t,c,{split:s}),d=u.findIndex(o);if(d===-1){let h=u.find(f=>f.kind==="fold"&&r>=f[n]&&r<f[n]+f.count);if(h){let f=c.get(h.run)??{},b=r-h[n];c=new Map(c).set(h.run,h.down?{...f,top:(f.top??0)+b+1+Jp}:h.up?{...f,bottom:(f.bottom??0)+h.count-b+Jp}:{all:!0}),this._expansions.set(e,c),u=Lt(t,c,{split:s}),d=u.findIndex(o)}}let p=this._limits.get(e)??te;return d>=p&&this._limits.set(e,Math.ceil((d+1)/te)*te),{rows:u,index:d}}_takeTreeRow(e=!1){return this._treeRemaining-- >0?!0:(this._treeTruncated=!0,e)}_renderTree(e,t,n,r){let s=[...e.dirs.entries()].toSorted(Ic),o=[...e.files.entries()].toSorted(([d],[p])=>d.localeCompare(p)),c=s.flatMap(([d,p])=>{let h=Pc(d,p,n),f=p.package,b=f?.ecosystem==="cargo"||f?.ecosystem==="composer"||f?.ecosystem==="soldeer",v=this._query?!0:this._open.get(p.path)??(r||n===0||yo(p,t)),g=this._baseDirs().has(p.sourcePath)?ph(this.other).has(p.sourcePath)?null:"removed":"added";if(!this._takeTreeRow(yo(p,t)))return[];let y=a`<li class="bundle-code-tree-dir"><details .open="${j(v)}" @toggle="${k=>{let _=k.currentTarget.open;this._open.get(p.path)!==_&&(this._open.set(p.path,_),this.extensions?.treePageSize&&this.requestUpdate())}}"><summary aria-label="${this.extensions?.directoryLabel?.(h.node)??m}"><span class="bundle-code-tree-chevron" aria-hidden="true"></span> ${f?wa(f.ecosystem):m} <span class="${I({"bundle-code-tree-dirname":!0,"bundle-code-tree-package":!!f,"bundle-code-tree-package-vendored":b,"bundle-compare-code-name":!0,removed:g==="removed"})}" data-tooltip-truncated data-tooltip="${h.node.sourcePath}">${f?a`<span class="bundle-code-tree-package-name">${f.name}</span>${f.version?a`<span class="bundle-code-tree-package-version">${b?"- ":"@"}${f.version}</span>`:m}`:h.names.map((k,_)=>a`${_>0?a`<span class="bundle-code-tree-separator">/</span>`:m}${k}`)} </span>${f?.variant?a`<span class="bundle-code-tree-variant">variant ${f.variant}</span>`:m} <span class="bundle-compare-code-dir-count" data-tooltip="${`${p.fileCount} changed ${p.fileCount===1?"file":"files"}`}">${this.extensions?.directorySummary?.(h.node)??p.fileCount}</span> ${g?a`<span class="${`bundle-compare-code-letter ${g}`}" data-tooltip="${`${f?"Package":"Directory"} ${g}`}">${Fn[g].letter}</span>`:m}</summary>${v||!this.extensions?.treePageSize?this._renderTree(h.node,t,n+1,r):m}</details></li>`;return[{key:p.path,content:y}]}),u=o.flatMap(([d,p])=>{if(!this._takeTreeRow(p===t))return[];let{kind:h,repointed:f,renamedFrom:b,modified:v}=this._entries.get(p),g=f?`${f.length} repointed ${f.length===1?"import":"imports"}`:"",y=a`<li class="bundle-code-tree-file"><button type="button" class="${I({"bundle-code-tree-link":!0,current:p===t})}" aria-label="${this.extensions?.fileLabel?.(p)??m}" aria-current="${p===t?"true":m}" @click="${()=>this._select(p)}">${this.extensions?.filePrefix?.(p)??m}${Ve(p,this._format(p))}<span class="${`bundle-code-tree-name bundle-compare-code-name ${h}`}" data-tooltip-truncated data-tooltip="${p}">${d}</span> ${this.extensions?.fileSuffix?.(p)??m} ${b?a`<span class="bundle-compare-code-oldname" data-tooltip-truncated data-tooltip="${`Renamed from ${b}`}">← ${Yi(b,p,{extension:!1}).from}</span>`:m} ${this._fileTags(p,this._entries.get(p),!0)} ${this._treeCounts(p,this._entries.get(p))} ${f&&h!=="repointed"?a`<span class="bundle-compare-code-letter repointed" data-tooltip="${g}">R</span>`:m} <span class="${I({"bundle-compare-code-letter":!0,[h]:!0,pure:h==="renamed"&&!v})}" data-tooltip="${h==="repointed"?g:b?`Renamed${v?" and modified":""} from ${b}`:Fn[h].label}">${Fn[h].letter}</span></button></li>`;return[{key:p,content:y}]});return a`<ul class="${I({"bundle-code-tree":!0,root:n===0})}" aria-label="${n===0?this.extensions?.treeLabel??"Changed files":m}" @keydown="${n===0?Ac:m}">${ce(c,d=>d.key,d=>d.content)}${ce(u,d=>d.key,d=>d.content)}</ul>`}_treeCounts(e,t){if(t.kind==="repointed")return m;let n=this._lineCounts(e,t),r;if(n===null&&this._counted.has(e)?{published:n,shown:r}=this._largeCounts(e,t):r=n&&this._shownCounts(e,t),!(n||r)||r===void 0)return m;let{additions:s,deletions:o}=r??n,c=!n||n.additions>0||n.deletions>0,u=t.kind==="renamed",d=r?.renamed>0?`
|
|
91
|
+
\u2248${r.renamed.toLocaleString()} lines differing in renamed names alone, marked`:"",p=n?`
|
|
92
|
+
As published: +${n.additions.toLocaleString()} \u2212${n.deletions.toLocaleString()}`:"",h=r?`${r.aside.join(", ")}${d}${p}`:null;if(s===0&&o===0){if((u||t.modified===!1)&&!c)return a`<span class="bundle-compare-code-line-counts unchanged" aria-label="No line changes">=</span>`;if(r&&c)return a`<span class="bundle-compare-code-line-counts unchanged" aria-label="${`No line changes with ${r.aside.join(", ")}`}" data-tooltip="${`No line changes with ${h}`}">≈</span>`}let f=r&&(!n||s!==n.additions||o!==n.deletions);return a`<span class="bundle-compare-code-line-counts" aria-label="${`${s} added, ${o} removed lines`}" data-tooltip="${f?`With ${h}`:m}"><span class="${I({add:!0,empty:u&&s===0})}">+${s.toLocaleString()}</span> <span class="${I({del:!0,empty:t.kind==="added"||u&&o===0})}">−${o.toLocaleString()}</span></span>`}_countingState(e,t){return this._fileState(e,t,!0)}_shownCounts(e,t){if(!(l.bundleSourcePretty||N.ignoreWhitespace||N.ignoreRenames||N.ignoreTypes))return null;let n=`${po()}\0${this._arrived}\0${this._forced.size}`,r=this._drawnCounts.get(e);if(r?.settings===n)return r.counts;let s=performance.now();if(this._countUntil??=s+uo,s>this._countUntil){this._countLater??=setTimeout(()=>{this._countLater=null,this.requestUpdate()});return}let o=this._countingState(e,t),{model:c}=o,u=th(o),d=c&&u.length>0?{additions:c.additions,deletions:c.deletions,renamed:c.renamed,aside:u}:null;return this._drawnCounts.set(e,{settings:n,counts:d}),d}_lineCounts(e,t){if(this._counted.has(e))return this._counted.get(e);let n=performance.now();if(this._countUntil??=n+uo,n>this._countUntil)return this._countLater??=setTimeout(()=>{this._countLater=null,this.requestUpdate()}),null;let{before:r,after:s}=ae(this.base,this.other,e,t),o=Pp(r,s);return this._counted.set(e,o),o}_noteDrawn(e,t){let{model:n}=t;return n&&this._drawnTotals.set(e,{settings:po(),counts:{additions:n.additions,deletions:n.deletions,renamed:n.renamed,aside:th(t)}}),t}_largeCounts(e,t){let n=this._drawnTotals.get(e);if(n?.settings===po())return n.counts.aside.length===0?{published:n.counts,shown:null}:{published:null,shown:n.counts};let r=N.ignoreTypes?ae(this.base,this.other,e,t):null;return{published:null,shown:typeof r?.before=="string"&&typeof r.after=="string"&&co(this.base,this.other,e,t,r,this._repaint,this.scope)?{additions:0,deletions:0,renamed:0,aside:[go]}:null}}_model(e,t,n,r={},s=N.ignoreWhitespace){let o=r.changes?.blocks??r.marks??null,c=this._models.get(e);return this._models.delete(e),c?.before===t&&c.after===n&&c.given===o||(c={model:Mn(t,n,{...r,ignoreWhitespace:s}),before:t,after:n,given:o}),this._models.set(e,c),this._models.size>this._modelCap&&this._models.delete(this._models.keys().next().value),c.model}_counts(e,t,n,r,s){let o=r.changes?.blocks??r.marks??null,c=this._countModels.get(e);if(c?.before===t&&c.after===n&&c.given===o)return c.model;let u=r.changes?.blocks??Ce(t,n,s),d={blocks:u,...Xs(u,r.marks)};return this._countModels.set(e,{model:d,before:t,after:n,given:o}),d}_fileState(e,t,n=!1){let r=ae(this.base,this.other,e,t),s=typeof r.before=="string"&&typeof r.after=="string",o=s&&co(this.base,this.other,e,t,r,this._repaint,this.scope);if(o&&N.ignoreTypes){let re={a:[],b:[],blocks:[],additions:0,deletions:0,renamed:0,marked:new Set,noEol:{a:!1,b:!1},words:new Map};return n?{pretty:null,hiding:!1,model:re,spacesHidden:!1,typesHidden:!0}:this._noteDrawn(e,{...r,textual:s,large:!1,printing:null,pretty:null,key:null,generated:!1,renamed:!1,warned:[],hiding:!1,changes:null,model:re,whitespace:null,spacesHidden:!1,types:o,typesHidden:!0})}let c=s&&(!n||l.bundleSourcePretty)?this._printing(e,t,r):null,u=l.bundleSourcePretty&&c?.applies?c.copies:null,{before:d,after:p}=u?.status==="ready"?u:r,h=s&&bo(e)&&bo(t.basePath??e)&&["ready","loading","error"].includes(u?.status)&&this._generated(e,t,r),f=h&&u.status==="ready";!n&&s&&this._sought?.path===e&&!this._forced.has(e)&&at(d,p)&&this._forced.add(e);let b=s&&!this._forced.has(e)&&at(d,p),{basePath:v=e}=t,g=re=>{let se=f&&!b?Hp(this.base,v,r.before,this.other,e,r.after,re,this._repaint,u.hashes,!n&&this._renamesAlone,this.scope):null,Ft=se?.status==="ready",Ue=Ft&&N.ignoreRenames,Dt=Ft&&!Ue,hi=Ue&&se.reason===null?se.reads:[],mi=Ft&&se.reason===null?se.marks.length>0||N.ignoreRenames&&se.before!==d:N.ignoreRenames&&h,dt=_o(e,u?.status==="ready",{...N,ignoreWhitespace:re,ignoreRenames:Ue,markRenames:Dt}),je=Ue?se.before:d,Kn=Ue?{changes:{blocks:se.blocks}}:Dt?{marks:se.marks}:{},fi=s&&!b&&(!se||Ft||!N.ignoreRenames)?n?this._counts(dt,je,p,Kn,re):this._model(dt,je,p,Kn,re):null;return{key:dt,changes:se,warned:hi,renamed:mi,hiding:Ue,shown:je,model:fi,ignoreWhitespace:re}},y=this._unlisted(e,t,r),k=g(N.ignoreWhitespace&&!y),_=N.ignoreWhitespace&&!y&&!!k.model&&(k.model.mixed??=Jt(k.shown,p,k.model.blocks));_&&(k=g(!1));let{key:x,changes:S,warned:T,renamed:F,hiding:O,shown:A,model:z}=k;if(n)return{pretty:u,hiding:O,model:z,spacesHidden:k.ignoreWhitespace};u?.status==="ready"&&z?this._noteRowless(e,z.blocks.length===0):z&&(this._blocks.set(`${N.ignoreWhitespace}\0${e}`,z.blocks),this._aligned.set(z.blocks,z));let Z=z&&!y&&!N.ignoreWhitespace?this._whitespaceHidden(`${e}\0${u?.status==="ready"}\0${O}`,A,p):null,ne=z===null||y?null:_?"mixed":N.ignoreWhitespace?Qs(A,p,z.blocks)?"hideable":null:Z.hides&&!Z.mixed?"hideable":null;return this._sought?.path===e&&(this._soughtSettling=u?.status==="loading"||N.ignoreRenames&&(S?.status==="loading"||S?.status==="error")),this._noteDrawn(e,{before:A,after:p,textual:s,large:b,printing:c,pretty:u,key:x,generated:h,renamed:F,warned:T,hiding:O,changes:S,model:z,whitespace:ne,spacesHidden:k.ignoreWhitespace,types:o})}_unlisted(e,{basePath:t=e},{before:n,after:r}){return!Zs(e,r,ho(this.other,e))||!Zs(t,n,ho(this.base,t))}_whitespaceHidden(e,t,n){let r=this._spaced.get(e);return r?.before===t&&r.after===n||(r={before:t,after:n,hidden:Ap(t,n)}),this._spaced.delete(e),this._spaced.set(e,r),this._spaced.size>this._modelCap&&this._spaced.delete(this._spaced.keys().next().value),r.hidden}_generated(e,{kind:t,basePath:n=e},{before:r,after:s}){return t!=="repointed"&&si(this.base,this.other)&&nh(this.base,n,r)&&nh(this.other,e,s)}_printing(e,t,n){let{kind:r,basePath:s=e,modified:o}=t,{before:c,after:u}=n;if(r==="repointed"||o===!1||typeof c!="string"||typeof u!="string"||c===u||!si(this.base,this.other))return null;let d=[["base",this.base,s,c],["other",this.other,e,u]];if(!d.every(([,,v,g])=>g===""||Wi(v)!==null&&gg(g)))return null;let p=d.some(([,v,g,y])=>y!==""&&Uc(v,v,g,y)),h=d.map(([v,,g,y])=>y===""?{status:"ready",text:y}:jc(this.base,this.other,v,g,y,this._repaint)),f=h.find(v=>v.status==="error")??h.find(v=>v.status==="loading")??{status:"ready",before:h[0].text,after:h[1].text,hashes:h.map(v=>v.hash)},b=!p&&c!==""&&u!==""&&f.status==="ready"&&this._smaller(e,n,f);return{copies:f,minified:p,smaller:b,applies:p||b}}_smaller(e,{before:t,after:n},r){let s=this._shorter.get(e);if(s?.before===t&&s.after===n&&s.printed===r.before&&s.printedAfter===r.after)return s.smaller;let o=(u,d)=>Ce(u,d).reduce((p,{a0:h,a1:f,b0:b,b1:v})=>p+f-h+v-b,0),c=!at(t,n)&&!at(r.before,r.after)&&o(r.before,r.after)<o(t,n);return this._shorter.set(e,{before:t,after:n,printed:r.before,printedAfter:r.after,smaller:c}),c}_fileMessage(e,{kind:t,modified:n,meta:r},{before:s,after:o,textual:c,large:u,model:d,pretty:p,hiding:h,warned:f=[],changes:b,whitespace:v,typesHidden:g=!1}){let y=A=>G(A??0),k=Wp(r),_=`${t==="renamed"?k?"Renamed, its contents the same.":"Renamed without changes.":"The contents are the same."}${k?` ${k}`:""}`;if(c&&n===!1)return a`<div class="bundle-compare-code-message"><p>${_}</p></div>`;if(!c){if(t==="changed"&&n===!1)return a`<div class="bundle-compare-code-message">Binary file, its bytes the same · ${y(Re(o))}. ${k}</div>`;let A=t==="added"?y(Re(o)):t==="removed"?y(Re(s)):`${y(Re(s))} \u2192 ${y(Re(o))}`;return a`<div class="bundle-compare-code-message">Binary file ${t} · ${A}. A text diff is not available.${k?` ${k}`:""}</div>`}if(u)return a`<div class="bundle-compare-code-message"><p>This diff is large (${(Bn(s)+Bn(o)).toLocaleString()} lines across both sides) and may take a few seconds to compute.</p><button type="button" class="bundle-compare-code-action" @click="${()=>{this._forced.add(e),this.requestUpdate()}}">Show diff</button></div>`;if(g)return a`<div class="bundle-compare-code-message"><p>Only types changed in this file.${k?` ${k}`:""}</p><button type="button" class="bundle-compare-code-action" @click="${()=>this._setTypes(!1)}">Show type-only changes</button></div>`;if(b?.status==="loading"&&N.ignoreRenames)return a`<div class="bundle-compare-code-message" aria-busy="true">Hiding renamed names…</div>`;if(b?.status==="error"&&N.ignoreRenames)return a`<div class="bundle-compare-code-message"><p>Couldn't hide renamed names: ${b.message}</p><button type="button" class="bundle-compare-code-action" @click="${()=>this._setRenames(!1)}">Show renamed names</button></div>`;if(d.blocks.length>0)return null;let x=p?.status==="ready"&&p.before===p.after,S=!x&&N.ignoreWhitespace&&v==="hideable",T=!x&&h,F=[S&&"whitespace",T&&"renamed names"].filter(Boolean),O=x?"No actual code changes in this file.":F.length>0?`Only ${F.join(" and ")} changed in this file.`:null;return a`<div class="bundle-compare-code-message"><p>${O?`${O}${k?` ${k}`:""}`:_}</p>${f.length>0?a`<p>${lh(f)}</p>`:m} ${x?a`<button type="button" class="bundle-compare-code-action" @click="${()=>{Yt(),this.requestUpdate()}}">Show as published</button>`:m} ${S?a`<button type="button" class="bundle-compare-code-action" @click="${()=>this._setWhitespace(!1)}">Show whitespace changes</button>`:m} ${T?a`<button type="button" class="bundle-compare-code-action" @click="${()=>this._setRenames(!1)}">Show renamed names</button>`:m}</div>`}_fileName(e,t,n){let r=s=>n&&s.startsWith(n)?s.slice(n.length):s;return a`<span class="${I({"bundle-compare-code-pill":!0,[t.kind]:!0,pure:t.kind==="renamed"&&!t.modified})}">${Fn[t.kind].label}</span> ${Ve(e,this._format(e))} <span class="bundle-code-main-path mono" data-tooltip-truncated data-tooltip="${t.renamedFrom?`${t.renamedFrom} \u2192 ${e}`:e}">${t.renamedFrom?En(r(t.renamedFrom),r(e)):r(e)}</span> ${this._fileTags(e,t)}${this._githubLink(e,t)}`}_fileTags(e,t,n=!1){if(!n)return a`${this._entryTags(e,t)}${this._alertTags(e,t)}${this._runsTags(e,t)}${this._newHostTags(e,t)}${this._flagTags(e,t)}${this._readability(e,t)}${this._installTags(e,t)}${oi(t.meta)}`;let r=[this._alertTags(e,t),this._runsTags(e,t),this._newHostTags(e,t),this._flagTags(e,t,!1),this._treeTag(e,t),this._installTags(e,t,!0),oi(t.meta,!0)];return vo(r)?r:this._flagTags(e,t)}_githubLink(e,{kind:t,basePath:n=e}){let r=t==="removed"?pr(this.base,n):pr(this.other,e);return r?Fc(r):m}_alertTags(e,{kind:t,basePath:n=e}){let r=t==="removed"?this.baseAlerts?.get(n):this.otherAlerts?.get(e);return r?.length>0&&this.alertTags?this.alertTags(r):m}_newHostTags(e,{kind:t}){let n=t==="removed"?null:this.newHosts?.get(e);return n&&this.newHostTag?this.newHostTag(n):m}_runsTags(e,t){return[[od,ad],[ld,cd]].map(([n,r])=>{let{was:s,now:o}=this._reads(e,t,n);return t.kind==="removed"?r(s):r(o,s)})}_entryTags(e,{kind:t,basePath:n=e}){let r=hg(t==="removed"?this.base:this.other).get(t==="removed"?n:e)??[];return[...Map.groupBy(r,({label:o})=>o)].map(([o,c])=>a`<span class="${`bundle-compare-code-entry${o==="license"?" is-license":""}`}" data-tooltip="${c.map(({note:u})=>u).join(" \xB7 ")}">${o}</span>`)}_installTags(e,t,n=!1){if(!mg.test(e))return m;let{kind:r,basePath:s=e}=t,{before:o,after:c}=ae(this.base,this.other,e,t),u=new Map(r==="added"||o===void 0?[]:ah(this.base,s,o)),d=new Map(r==="removed"||c===void 0?[]:ah(this.other,e,c)),p=[...r==="removed"?u:d].map(([h,f])=>{let b=r==="removed"?f:u.get(h),v=b===void 0?", new":b===f?"":`, was: ${b}`;return a`<span class="bundle-compare-code-install" data-tooltip="${`${f}${v}`}">${h}</span>`});if(!n&&r!=="removed")for(let[h,f]of u)d.has(h)||p.push(a`<span class="bundle-compare-code-install is-dropped" data-tooltip="${`No longer run on install: ${f}`}">${h}</span>`);return p}_reads(e,t,n=Oc){let{kind:r,basePath:s=e}=t,{before:o,after:c}=ae(this.base,this.other,e,t);return{was:r==="added"?null:o===void 0?void 0:n(this.base,s,o),now:r==="removed"||c===void 0?null:n(this.other,e,c)}}_readability(e,t){let{was:n,now:r}=this._reads(e,t),s=c=>a`${hr(c)}${Nc(c)}`,o=!n||!r||Ci(n)===Ci(r)&&n.kind===r.kind?s(r??n):a`<span class="bundle-compare-code-readability">${s(n)}<span aria-hidden="true">→</span>${s(r)}</span>`;return a`${mr(r??n)}${o}`}_flagTags(e,t,n=!0){return t.kind==="removed"?fr(this.base,t.basePath??e,t.baseBytes,n):fr(this.other,e,t.otherBytes,n)}_treeTag(e,t){let{was:n,now:r}=this._reads(e,t),s=r??n;if(!s)return m;let o=s.category!=="map"&&La.get(Ci(s)).mark;return a`${mr(s,["warn"])}${o?hr(s,!0):m}`}_fileFigures({kind:e,baseBytes:t,otherBytes:n},r){let s=o=>G(o??0);return a`${r?.blocks.length>(r?.marked?.size??0)?wo(r.additions,r.deletions):m} ${r?.renamed>0?a`<span class="bundle-compare-code-renamed" aria-label="${`${r.renamed} lines differing in renamed names alone`}" data-tooltip="Lines differing in renamed names alone, marked">≈${r.renamed}</span>`:m} <span class="bundle-code-main-stats">${e==="added"?s(n):e==="removed"?s(t):`${s(t)} \u2192 ${s(n)}`}</span>`}_highlighted(e,t,n,r=""){if(!n)return null;let s=xi(t,ho(e,t),n);if(!s)return null;let o=`${e.integrity}\0${t}${r?`\0${r}`:""}`,c=ch.get(o);return c?.text===n?c.lines:(mo.has(o)||(mo.add(o),(async()=>{let u=await yt(n,s),d=typeof u=="string"?Ni(u):null;ch.set(o,{text:n,lines:d?.length===n.split(`
|
|
93
|
+
`).length?d:null}),mo.delete(o),this.isConnected&&this.requestUpdate()})()),null)}_renderFile(e,t){let n=this._entries.get(e),{kind:r}=n,s=this._fileState(e,n),{after:o,before:c,textual:u,model:d}=s,p=uh(n),h=u&&(!p||d?.blocks.length>0),f=this._order.indexOf(e),b=t&&e.startsWith(t)?e.slice(t.length):e,v=r==="repointed"&&c===void 0?a`<div class="bundle-compare-code-message">Neither bundle carries this importer's source.</div>`:p&&d?.blocks.length===0?this._renderSource(e,o,n.repointed,s):this._fileMessage(e,n,s)??this._renderDiff(e,n,s);return a`<header class="bundle-code-main-bar bundle-compare-code-bar"><span class="bundle-code-file-nav"><button type="button" class="focus-code-nav-btn" aria-label="Previous file" data-tooltip="Previous file" ?disabled="${f<=0}" @click="${()=>this._select(this._order[f-1])}">${yc}</button> <button type="button" class="focus-code-nav-btn" aria-label="Next file" data-tooltip="Next file" ?disabled="${f===-1?this._order.length===0:f>=this._order.length-1}" @click="${()=>this._select(this._order[f+1])}">${xe}</button> </span>${this._fileName(e,n,t)} <button type="button" class="bundle-code-copy-path" data-copy-path="${e}" aria-label="Copy file path">${Hi}</button> <span class="bundle-code-main-spacer"></span> ${this._fileFigures(n,d)} ${this._toggles(h,Nn(s),s.renamed,s.whitespace==="hideable",s.types)}</header><div class="bundle-compare-diff" tabindex="0" aria-label="${`Changes in ${b}`}">${this._dependencyChanges(e)} ${n.repointed?this._renderRepointed(e,n.repointed,[o,c].find(g=>typeof g=="string"&&g!=="")??null,u&&!h):m} ${v}</div>`}_toggles(e,t=null,n=!1,r=!1,s=!1){return a`${e?this._hides(n,r,s):m} ${t?a`<button type="button" class="${I({"bundle-compare-code-toggle":!0,"is-loading":t.status==="loading","is-error":t.status==="error"})}" aria-pressed="${String(!!l.bundleSourcePretty)}" aria-busy="${t.status==="loading"?"true":m}" aria-label="Pretty-print" data-tooltip="${`${qc(t)}${vg(t.affects)}`}" @click="${()=>{Yt(),this.requestUpdate()}}">${zc}</button>`:m} ${e?a`<span class="bundles-overview-sort bundle-compare-code-layout" role="group" aria-label="Diff layout">${[["unified","Unified"],["split","Split"]].map(([o,c])=>a`<button type="button" aria-pressed="${String(N.layout===o)}" @click="${()=>{N.layout=o,this.requestUpdate()}}">${c}</button>`)}</span>`:m}`}_importLines(e,t){let n=new Map;for(let{specifier:r}of e){if(n.has(r))continue;let s=["'",'"',"`"].map(o=>`${o}${r}${o}`);n.set(r,t.flatMap((o,c)=>s.some(u=>o.includes(u))?[c]:[]))}return n}_textSide(e){return K(this.other).has(e)?this.other:this.base}_dependencyChanges(e){if(e!=="package.json"||!this.dependencies)return m;let{added:t,changed:n,removed:r}=this.dependencies,s=[...t.map(d=>["added",d]),...n.map(d=>["changed",d]),...r.map(d=>["removed",d])];if(s.length===0)return m;let o=[[t,"new"],[n,"updated"],[r,"removed"]].filter(([d])=>d.length>0).map(([d,p])=>`${d.length} ${p}`),c=Map.groupBy(s.flatMap(([,d])=>d.flags??[]),({label:d})=>d),u=this.openDependency;return a`<section class="bundle-compare-code-deps" aria-label="Dependency changes"><h4>Dependencies <span>${o.join(" \xB7 ")}</span>${[...c].map(([d,p])=>a`<span class="bundle-compare-code-deps-flagged">${p.length} ${d}</span>`)}</h4><ul>${s.map(([d,p])=>{let h=d==="changed"?a`<span class="bundle-compare-code-dep-range">${p.from} → <b>${p.to}</b></span>`:a`<span class="bundle-compare-code-dep-range">${p.range}</span>`,f=a`<span class="bundle-compare-code-dep-name">${p.name}</span>${p.kind?a`<span class="npm-dependency-kind">${p.kind}</span>`:m}${h}${this.dependencyTags?.(p,d)??m}`,b=`${{added:"New",changed:"Updated",removed:"Removed"}[d]}: ${p.name}`;return a`<li>${u&&p.opens?a`<button type="button" class="${`bundle-compare-code-dep is-${d}`}" aria-label="${b}" @click="${()=>u(p)}">${f}</button>`:a`<span class="${`bundle-compare-code-dep is-${d}`}" aria-label="${b}">${f}</span>`}</li>`})}</ul></section>`}_renderRepointed(e,t,n,r){let s=n?n.split(`
|
|
94
|
+
`):[],o=n?this._highlighted(this._textSide(e),e,n):null,c=this._importLines(t,s),u=d=>d||"(empty target)";return a`<section class="bundle-compare-code-repointed" aria-label="Repointed imports"><h4>Repointed ${t.length===1?"import":"imports"} <b>${t.length}</b></h4><ul>${t.map(d=>{let p=c.get(d.specifier),h=`${d.conditions}${d.platform===null?"":` \xB7 Platform: ${d.platform}`}`;return a`<li><div class="bundle-compare-code-repointed-spec"><code data-tooltip-truncated data-tooltip="${d.specifier}">${d.specifier}</code> <span data-tooltip-truncated data-tooltip="${h}">${h}</span></div><div class="bundle-compare-code-repointed-targets"><span class="before"><span>Before</span><code data-tooltip-truncated data-tooltip="${u(d.baseTarget)}">${u(d.baseTarget)}</code></span> <span aria-hidden="true">→</span> <span class="after"><span>After</span><code data-tooltip-truncated data-tooltip="${u(d.otherTarget)}">${u(d.otherTarget)}</code></span></div>${p.slice(0,Dn).map(f=>this._importLine(f,s[f],o?.[f],d.specifier,r))} ${p.length>Dn?a`<span class="bundle-compare-code-repointed-more">and ${p.length-Dn} more ${p.length-Dn===1?"line":"lines"}</span>`:m}</li>`})}</ul></section>`}_importLine(e,t,n,r,s){let o=t.length>240?Math.max(0,t.indexOf(r)-80):0;return a`<button type="button" class="bundle-compare-code-repointed-line bundle-compare-diff-table" ?disabled="${!s}" aria-label="${`Go to line ${e+1}`}" @click="${()=>this._goToLine(e+1)}"><span class="diff-num">${e+1}</span> <code>${t.length<=240&&typeof n=="string"?J(dr(n,!0)):Vi(`${o>0?"\u2026":""}${t.slice(o,o+240)}${t.length>o+240?"\u2026":""}`,!0)}</code></button>`}_goToLine(e){let t=`${this._current}\0source`;e>(this._limits.get(t)??te)&&(this._limits.set(t,Math.ceil(e/te)*te),this.requestUpdate()),this.updateComplete.then(()=>this.querySelector(`.bundle-compare-diff [data-line="${e}"]`)?.scrollIntoView({block:"center"}))}_renderSource(e,t,n,{key:r,pretty:s}){let o=this._model(r,t,t),c={model:o,b:this._highlighted(this._textSide(e),e,t,s?.status==="ready"?"pretty":"")},u=new Set([...this._importLines(n,o.b).values()].flat()),d=`${e}\0source`,p=this._sought?.path===e&&this._sought.key!==r?this._soughtLine(e,this._entries.get(e),s,o):null;this._sought?.path===e&&(this._sought.key=r),p&&p.line<o.b.length&&(p.line>=(this._limits.get(d)??te)&&this._limits.set(d,Math.ceil((p.line+1)/te)*te),this._soughtRow={path:e,index:p.line});let h=this._limits.get(d)??te,f=o.b.length>h?o.b.slice(0,h):o.b;return a`<div class="bundle-compare-diff-table single" data-path="${e}" style="${_e({"--diff-num-width":`${String(o.b.length).length+1}ch`})}" role="table" aria-label="Source">${ce(f,(b,v)=>v,(b,v)=>a`<div class="${I({"diff-row":!0,ctx:!0,"is-import":u.has(v)})}" role="row" data-line="${v+1}"><span class="diff-num">${v+1}</span>${this._codeCell(c,"b",v,null)}</div>`)}</div>${o.b.length>f.length?a`<div class="bundle-compare-code-more"><button type="button" class="bundle-compare-code-action" @click="${()=>{this._limits.set(d,h+te),this.requestUpdate()}}">Show ${Math.min(te,o.b.length-f.length).toLocaleString()} more lines</button> <span>${(o.b.length-f.length).toLocaleString()} not shown</span></div>`:m}`}_hides(e,t,n){let r=[e&&["Renames",hh,N.ignoreRenames,()=>this._setRenames(!N.ignoreRenames)],t&&["Whitespace",mh,N.ignoreWhitespace,()=>this._setWhitespace(!N.ignoreWhitespace)],n&&["Type-only",go,N.ignoreTypes,()=>this._setTypes(!N.ignoreTypes)]].filter(Boolean);return r.length===0?m:a`<span class="bundle-compare-code-hide" role="group" aria-label="Hide"><span class="bundle-compare-code-hide-label" aria-hidden="true">Hide:</span>${r.map(([s,o,c,u])=>a`<mode-switch compact="compact" borderless .checked="${c}" accessible-label="${o}" label="${s}" @click="${u}"></mode-switch>`)}</span>`}_setWhitespace(e){N.ignoreWhitespace=e,this.requestUpdate()}_setTypes(e){N.ignoreTypes=e,this.requestUpdate()}_setRenames(e){N.ignoreRenames=e,e&&Up(),this.requestUpdate()}_renderDiff(e,t,{after:n,before:r,key:s,model:o,pretty:c,changes:u,hiding:d,warned:p=[],whitespace:h=null}){let{kind:f,basePath:b=e}=t,v=N.layout==="split",g=this._sought?.path===e&&this._sought.key!==s?this._soughtLine(e,t,c,o):null;this._sought?.path===e&&(this._sought.key=s);let y=g?this._seekRows(s,o,g,v):null;y?.index>=0&&(this._soughtRow={path:e,index:y.index+(v?1:0)});let k=this._expansions.get(s)??new Map,_=y?.rows??Lt(o,k,{split:v}),x=this._limits.get(s)??te,S=_.length>x?_.slice(0,x):_,T={model:o,a:f==="added"?null:this._highlighted(this.base,b,r,d?`renamed\0${this.other.integrity}\0${e}`:c?.status==="ready"?"pretty":""),b:f==="removed"?null:this._highlighted(this.other,e,n,c?.status==="ready"?"pretty":""),expand:(O,A)=>{let z=new Map(k);z.set(O,A==="all"?{all:!0}:{...z.get(O),[A]:(z.get(O)?.[A]??0)+ze}),this._expansions.set(s,z),this.requestUpdate()}},F=String(Math.max(o.a.length,o.b.length,1)).length;return a`${N.ignoreRenames&&u?.reason?a`<p class="bundle-compare-code-note">Renamed names are shown: ${fg[u.reason]??u.reason}.</p>`:m} ${ih[h]?a`<p class="bundle-compare-code-note">${ih[h]}</p>`:m} ${p.length>0?a`<p class="bundle-compare-code-note">${lh(p)} <button type="button" @click="${()=>this._setRenames(!1)}">Show them marked</button></p>`:m}<div class="${I({"bundle-compare-diff-table":!0,split:v,unified:!v})}" data-path="${e}" style="${_e({"--diff-num-width":`${F+1}ch`})}" role="table" aria-label="Diff">${v?a`<div class="diff-row diff-split-head" role="row"><span class="diff-half">Before<strong data-tooltip-truncated data-tooltip="${this.baseName}">${this.baseName}</strong></span> <span class="diff-half">After<strong data-tooltip-truncated data-tooltip="${this.otherName}">${this.otherName}</strong></span></div>`:m} ${ce(S,O=>this._rowKey(O),O=>v?this._splitRow(O,T):this._unifiedRow(O,T))}</div>${_.length>S.length?a`<div class="bundle-compare-code-more"><button type="button" class="bundle-compare-code-action" @click="${()=>{this._limits.set(s,x+te),this.requestUpdate()}}">Show ${Math.min(te,_.length-S.length).toLocaleString()} more rows</button> <span>${(_.length-S.length).toLocaleString()} not shown</span></div>`:m}`}_rowKey(e){return e.kind==="fold"?`f${e.run}:${e.a}`:e.kind==="change"?`c${e.left??""}:${e.right??""}`:`${e.kind}${e.a??""}:${e.b??""}`}_words(e,t,n){if(t==null||n==null)return null;let r=`${t}:${n}`;return e.words.has(r)||e.words.set(r,Xc(e.a[t],e.b[n])),e.words.get(r)}_code(e,t,n,r){let s=r&&!(e.endsWith("\r")&&n?.at(-1)?.[1]===e.length);if(typeof t=="string")return J(dr(Ip(t,n),s));if(n){let o=Fp(e,n);return o.map((c,u)=>{let d=Vi(c.text,s&&u===o.length-1);return c.marked?a`<mark class="diff-word">${d}</mark>`:d})}return Vi(e,s)}_cell(e,t,n,r,s){return n==null?a`<span class="diff-num"></span><span class="diff-sign"></span><span class="diff-code diff-empty"></span>`:a`<span class="diff-num">${n+1}</span><span class="diff-sign">${r}</span>${this._codeCell(e,t,n,s)}`}_noEol(e,t,n){return n!=null&&e.noEol[t]&&n===e[t].length-1}_fold(e,t){let n=e.count<=ze;return a`<div class="diff-row diff-fold" role="row"><span class="diff-fold-actions">${!n&&e.down?a`<button type="button" aria-label="${`Show ${ze} more lines below`}" data-tooltip="${`Show ${ze} more lines`}" @click="${()=>t.expand(e.run,"top")}"><svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 3v9m-4-4 4 4 4-4"/></svg></button>`:m} ${!n&&e.up?a`<button type="button" aria-label="${`Show ${ze} more lines above`}" data-tooltip="${`Show ${ze} more lines`}" @click="${()=>t.expand(e.run,"bottom")}"><svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 13V4M4 8l4-4 4 4"/></svg></button>`:m} <button type="button" aria-label="${`Show all ${e.count} unchanged lines`}" data-tooltip="Show all" @click="${()=>t.expand(e.run,"all")}"><svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m4 6 4-4 4 4M4 10l4 4 4-4"/></svg></button> </span><span class="diff-fold-label">${e.count.toLocaleString()} unchanged ${e.count===1?"line":"lines"} · ${e.b+1}–${e.b+e.count}</span></div>`}_unifiedRow(e,t){let{model:n}=t;if(e.kind==="fold")return this._fold(e,t);if(e.kind==="ctx")return a`<div class="diff-row ctx" role="row"><span class="diff-num">${e.a+1}</span>${this._cell(t,"b",e.b," ",null)}</div>`;let r=e.kind==="del",s=r?this._words(n,e.a,e.pair)?.a:this._words(n,e.pair,e.b)?.b,o=n.marked?.has(e.change);return a`<div class="${`diff-row ${e.kind}${o?" renamed":""}`}" role="row" data-tooltip="${o?"Renamed names alone":m}">${r?a`<span class="diff-num">${e.a+1}</span><span class="diff-num"></span><span class="diff-sign">−</span>${this._codeCell(t,"a",e.a,s)}`:a`<span class="diff-num"></span><span class="diff-num">${e.b+1}</span><span class="diff-sign">+</span>${this._codeCell(t,"b",e.b,s)}`}</div>`}_codeCell(e,t,n,r){let s=e.model[t],o=e[t]?.[n],c=s[n],u=this._noEol(e.model,t,n),d=dh.get(s);d||dh.set(s,d=new Map);let p=d.get(n);return(!p||p.markup!==o||p.ranges!==r||p.noEol!==u)&&d.set(n,p={markup:o,ranges:r,noEol:u,drawn:this._code(c,o,r,!u)}),a`<span class="${I({"diff-code":!0,"diff-long":c.length>Rc})}">${p.drawn}${u?a`<span class="diff-no-eol" data-tooltip="No newline at end of file" aria-label="No newline at end of file">⊘</span>`:m}</span>`}_splitRow(e,t){let{model:n}=t;if(e.kind==="fold")return this._fold(e,t);if(e.kind==="ctx")return a`<div class="diff-row ctx" role="row"><span class="diff-half">${this._cell(t,"a",e.a," ",null)}</span> <span class="diff-half">${this._cell(t,"b",e.b," ",null)}</span></div>`;let r=e.paired?this._words(n,e.left,e.right):null,s=n.marked?.has(e.change);return a`<div class="${`diff-row change${s?" renamed":""}`}" role="row" data-tooltip="${s?"Renamed names alone":m}"><span class="${I({"diff-half":!0,del:e.left!==null,blank:e.left===null})}">${this._cell(t,"a",e.left,"\u2212",r?.a)}</span> <span class="${I({"diff-half":!0,add:e.right!==null,blank:e.right===null})}">${this._cell(t,"b",e.right,"+",r?.b)}</span></div>`}};customElements.define("bundle-compare-code",Mt);var bh=Symbol.for(""),yg=i=>{if(i?.r===bh)return i?._$litStatic$};var ko=(i,...e)=>({_$litStatic$:e.reduce((t,n,r)=>t+(s=>{if(s._$litStatic$!==void 0)return s._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${s}. Use 'unsafeStatic' to pass non-literal values, but
|
|
95
|
+
take care to ensure page security.`)})(n)+i[r+1],i[0]),r:bh}),gh=new Map,$o=i=>(e,...t)=>{let n=t.length,r,s,o=[],c=[],u,d=0,p=!1;for(;d<n;){for(u=e[d];d<n&&(s=t[d],(r=yg(s))!==void 0);)u+=r+e[++d],p=!0;d!==n&&c.push(s),o.push(u),d++}if(d===n&&o.push(e[n]),p){let h=o.join("$$lit$$");(e=gh.get(h))===void 0&&(o.raw=o,gh.set(h,e=o)),t=c}return i(e,...t)},vh=$o(a),Cx=$o(ye),Ex=$o(Jo);var So=25e3,ai=40,_g=i=>[...i].toSorted(([e],[t])=>e.localeCompare(t));function yh(i,e,t,{resolutions:n=[],max:r=So}={}){let s=new Map,o=Rn(t);if(o.size*2>=r)return{rows:1/0,models:s};let c=new Set(n.map(d=>d.parent).filter(d=>!o.has(d))),u=n.length*2+c.size;for(let[d,p]of _g(o)){u++;let{before:h,after:f}=ae(i,e,d,p);if(p.modified===!1)u++;else if(typeof h=="string"&&typeof f=="string"){if(at(h,f))return{rows:1/0,models:s};let b=Mn(h,f);s.set(d,b),u+=Math.max(Lt(b).length,1)}else u++;if(u>=r)break}return{rows:u,models:s}}var xo=class extends Mt{static properties={...Mt.properties,models:{attribute:!1}};constructor(){super(),this.models=null,this._modelCap=1/0,this._fileLimit=ai}_renamesAlone=!1;willUpdate(e){if(super.willUpdate(e),e.has("models"))for(let[t,n]of this.models??[]){let r=this._entries.get(t);if(!r)continue;let{before:s,after:o}=ae(this.base,this.other,t,r);this._models.set(_o(t,!1,{ignoreWhitespace:!1,ignoreRenames:!1}),{model:n,before:s,after:o,given:null})}e.has("files")&&(this._fileLimit=ai,this._current=this._picked=null),(e.has("path")||e.has("files"))&&this.path&&this.path!==this._current&&(this._goTo=this.path),e.has("files")&&(this._toTop=!0)}updated(){let e=this._goTo&&this._section(this._goTo);if(e)this._picked=this._goTo,e.scrollIntoView({block:"start"});else if(this._toTop){let t=this.querySelector(".bundle-compare-diff");t&&(t.scrollTop=0)}this._goTo=null,this._toTop=!1,this._current!==this._shownPath&&(this._shownPath=this._current,this.querySelector(".bundle-compare-code-tree .bundle-code-tree-link.current")?.scrollIntoView({block:"nearest"})),this._scrollSought()}_select(e,t=!0){!e||this.extensions?.canSelect?.()===!1||(this._current=this._picked=e,this.requestUpdate(),t&&this.updateComplete.then(()=>this._section(e)?.scrollIntoView({block:"start"})),this.dispatchEvent(new CustomEvent("compare-code-select",{detail:{path:e},bubbles:!0,composed:!0})))}_more(){this._fileLimit+=ai,this.requestUpdate()}_searchable(e){return e.modified!==!1&&e.kind!=="repointed"}_countingState(e,t){return this._states?.get(e)??super._countingState(e,t)}_section(e){return[...this.querySelectorAll(".bundle-compare-all-file")].find(t=>t.dataset.path===e)??null}_spy(){this._spying||this.extensions?.canSelect?.()===!1||(this._spying=requestAnimationFrame(()=>{this._spying=0;let e=this.querySelector(".bundle-compare-diff");if(!e||this.extensions?.canSelect?.()===!1)return;this._fileLimit<this._order.length&&e.scrollTop+2*e.clientHeight>=e.scrollHeight&&this._more();let{top:t,bottom:n}=e.getBoundingClientRect(),r=this._picked&&this._section(this._picked)?.getBoundingClientRect();if(r&&r.bottom>t&&r.top<n)return;this._picked=null;let s=null;for(let c of e.querySelectorAll(":scope > .bundle-compare-all-file")){if(c.getBoundingClientRect().top>t+4)break;s=c}let o=s?.dataset.path??this._order[0]??null;o!==this._current&&(this._current=o,this.requestUpdate(),this.dispatchEvent(new CustomEvent("compare-code-select",{detail:{path:o},bubbles:!0,composed:!0})))}))}_fileBody(e,t,n){let r=t.repointed?this._renderRepointed(e,t.repointed,[n.after,n.before].find(o=>typeof o=="string"&&o!=="")??null,!1):m,s=t.kind==="repointed"||t.kind==="renamed"&&!t.modified&&!!t.repointed&&!t.meta&&!(n.model?.blocks.length>0);return a`${this._dependencyChanges(e)}${r}${s?m:this._fileMessage(e,t,n)??this._renderDiff(e,t,n)}`}_fileContent(e,t,n,r){return a`<header class="bundle-code-main-bar bundle-compare-all-file-head">${this._fileName(e,t,r)} <span class="bundle-code-main-spacer"></span> ${this._fileFigures(t,n.model)}</header>${this._fileBody(e,t,n)}`}_layout(e,t){return a`<div class="bundle-code-view bundle-compare-code">${this._renderRail(e,this._current)}<div class="bundle-code-main">${t}</div></div>`}render(){let e=this._railState(),t=this.extensions?.fullPaths?"":e.prefix,n=this.extensions?.filterContent===!1?e.allOrder:e.order;this._order=n,this._goTo&&n.includes(this._goTo)&&(this._current=this._goTo),n.includes(this._current)||(this._current=n[0]??null),this._current&&(this._goTo||this._current!==this._shownPath)&&this._reveal(this._current,e.prefix);let r=n.indexOf(this._current);r>=this._fileLimit&&(this._fileLimit=Math.ceil((r+1)/ai)*ai);let s=n.map(g=>[g,this._entries.get(g)]),o=s.map(([g,y])=>({path:g,entry:y,file:this._fileState(g,y)})),c=o.reduce((g,{file:y})=>g+(y.model?.additions??0),0),u=o.reduce((g,{file:y})=>g+(y.model?.deletions??0),0);this._states=new Map(o.map(({path:g,file:y})=>[g,y]));let d=o.filter(({file:g})=>Nn(g)),p=d.map(({file:g})=>Nn(g)),h=p.filter(g=>g.status==="error"),f=h.length>0?{...h[0],failed:h.length,of:p.length}:p.find(g=>g.status==="loading")??p[0]??null,b=f&&{...f,affects:d.map(({path:g})=>g)},v=o.some(({file:g})=>g.model?.blocks.length>0||g.whitespace||g.hiding||g.types);return this._layout(e,a`<header class="bundle-code-main-bar bundle-compare-code-bar"><span class="bundle-compare-all-title">${s.length.toLocaleString()} ${s.length===1?"file":"files"} changed</span> ${c+u>0?wo(c,u):m} <span class="bundle-code-main-spacer"></span> ${this._toggles(v,b,o.some(({file:g})=>g.renamed),o.some(({file:g})=>g.whitespace==="hideable"),o.some(({file:g})=>g.types))}</header><div class="bundle-compare-diff" tabindex="0" aria-label="Every change" @scroll="${()=>this._spy()}">${s.length===0?a`<div class="bundle-code-placeholder">${this._entries.size===0?"No files differ in this comparison.":"No changed files match."}</div>`:ce(o.slice(0,this._fileLimit),({path:g})=>g,({path:g,entry:y,file:k})=>a`<section class="bundle-compare-all-file" aria-label="${g}" data-path="${g}">${this.extensions?.fileActions?a`<div class="bundle-compare-file-content">${this._fileContent(g,y,k,t)}</div>${this.extensions.fileActions(g,!0)}`:this._fileContent(g,y,k,t)}</section>`)} ${o.length>this._fileLimit?a`<button type="button" class="bundle-compare-code-action bundle-compare-all-more" @click="${()=>this._more()}">Show more files (${(o.length-this._fileLimit).toLocaleString()} remaining)</button>`:m}</div>`)}};customElements.define("bundle-compare-all",xo);function zn({base:i,other:e,diff:t,source:n,path:r,seek:s,baseName:o,otherName:c,select:u,extensions:d=null,mode:p}){let h=p?null:t.combined??=yh(i,e,t.files,{resolutions:t.resolutions?.changed??[]});p??=h.rows<So?"diff":"code";let f=p==="diff"?ko`bundle-compare-all`:ko`bundle-compare-code`;return vh`<${f} .base=${i} .other=${e} .files=${t.files} .scope=${t.scope??""} .resolutions=${t.resolutions?.changed??[]}
|
|
96
|
+
.baseAlerts=${n?.files?.alerts?.(i)??null} .otherAlerts=${n?.files?.alerts?.(e)??null} .alertTags=${n?.files?.alertTags??null}
|
|
97
|
+
.newHosts=${n?.files?.newHosts?.(i,e)??null} .newHostTag=${n?.files?.newHostTag??null}
|
|
98
|
+
.dependencies=${n?.dependencies?.(i,e)??null} .openDependency=${n?.openDependency??null} .dependencyTags=${n?.dependencyTags??null}
|
|
99
|
+
.models=${h?.models??null} .path=${r} .seek=${s} .extensions=${d} baseName=${o} otherName=${c}
|
|
100
|
+
@compare-code-select=${b=>{b.stopPropagation(),u(b.detail.path)}}></${f}>`}var wg=400,_h=24,qn=["removed","added","changed"],ue=null;function qe(i){return i.join(", ")}var Co=class extends U{static properties={details:{attribute:!1},integrity:{attribute:!1},request:{attribute:!1},source:{attribute:!1},review:{attribute:!1},_targetIntegrity:{state:!0},_otherDetails:{state:!0},_status:{state:!0},_scope:{state:!0},_fileSort:{state:!0},_pkgSort:{state:!0},_openSections:{state:!0},_mode:{state:!0},_codePath:{state:!0},_codeSeek:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.details=null,this.integrity=null,this.request=null,this.source=null,this._targetIntegrity=null,this._otherDetails=null,this._status="idle",this._scope="",this._fileSort={removed:"name",added:"name",changed:"name"},this._pkgSort={removed:"size",added:"size",changed:"size"},this._openSections=new Set,this._mode="overview",this._codePath=null,this._codeSeek=null,this._diff=null,this._diffKey=null,this._fitBody=null,this._fitObserver=null}connectedCallback(){super.connectedCallback(),this._fitBody&&this._fitObserver?.observe(this._fitBody)}disconnectedCallback(){super.disconnectedCallback(),this._fitObserver?.disconnect()}willUpdate(e){e.has("source")&&this.source&&!e.get("source")&&(this._openSections=new Set([...this._openSections,"files"])),(e.has("_otherDetails")||e.has("details"))&&this._status==="ready"&&!wr(this.details,this._otherDetails).some(t=>t.id===this._scope)&&(this._scope=""),e.has("integrity")&&this._rebase(),(e.has("request")||e.has("integrity"))&&this.integrity&&this.request?.bundle===this.integrity?(this.request.target!==this._targetIntegrity&&this._choose(this.request.target),this._mode=$i(this.request.mode)):e.has("request")&&!e.has("integrity")&&e.get("request")?.bundle===this.integrity&&(this._targetIntegrity&&this._choose(null),this._mode="overview")}updated(){let e=this.querySelector(".bundle-compare-body");e!==this._fitBody&&typeof ResizeObserver=="function"&&(this._fitObserver??=new ResizeObserver(()=>this._fitLists()),this._fitObserver.disconnect(),e&&this._fitObserver.observe(e),this._fitBody=e),this._fitLists()}_fitLists(){let e=this._fitBody;if(!e)return;let t=getComputedStyle(e),n=e.getBoundingClientRect().top+e.clientTop+parseFloat(t.paddingTop)-e.scrollTop,r=f=>{let b=f.getBoundingClientRect();return b.top-n+f.parentElement.getBoundingClientRect().bottom-b.bottom},s=e.querySelector(".bundle-compare-rows--fill");if(s){let f=r(s),b=s.closest(".bundle-compare-section");for(let v=b;v;v=v.nextElementSibling){let g=v.matches("details[open]")&&v.querySelector(":scope > summary"),y=v===b?0:g?g.getBoundingClientRect().bottom+parseFloat(getComputedStyle(g).marginBottom)-v.getBoundingClientRect().top:v.getBoundingClientRect().height;f+=y+parseFloat(getComputedStyle(v).marginBottom)}e.style.setProperty("--compare-fill-around",`${f}px`)}let o=[...e.querySelectorAll(".bundle-compare-rows--scroll:not(.bundle-compare-rows--fill)")];if(o.length===0)return;let c=e.lastElementChild,u=new Map(o.filter(f=>c.contains(f)).map(f=>[f,f.parentElement.getBoundingClientRect().top])),d=Math.max(...u.values()),p=e.clientHeight-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom),h=parseFloat(getComputedStyle(c).marginBottom);for(let f of o)u.get(f)>=d-1?f.style.setProperty("--compare-rest",`${p-r(f)-h}px`):f.style.removeProperty("--compare-rest")}_rebase(){let e=this._baseKey;if(ue&&e&&e!==ue.base&&(ue=null),ue&&e===ue.base){let{target:t}=ue;if(this._scope=ue.scope,this._mode=ue.mode,this._codePath=ue.codePath,ue=null,!t){this._targetIntegrity=null,this._otherDetails=null,this._status="idle";return}this._targetIntegrity=t,this._diff=null,this._diffKey=null;let n=this.source?null:cc(t,r=>!!(r.json||r.bundle));n?(this._otherDetails=n,this._status="ready"):(this._otherDetails=null,this._status="loading",this._loadOther(t));return}this._targetIntegrity=null,this._otherDetails=null,this._status="idle",this._scope="",this._codePath=null,this._diff=null,this._diffKey=null}get _baseKey(){return this.source?this.source.base:this.integrity}_swap(){let e=this._targetIntegrity;e&&e!==this._baseKey&&this._reopen(e,this._baseKey)}_pickBase(e){!e||e===this._baseKey||(e===this._targetIntegrity?this._swap():this._reopen(e,this._targetIntegrity))}_reopen(e,t){if(this.source){ue={base:e,target:t,scope:this._scope,mode:this._mode,codePath:this._codePath},this.source.open(e,t,this._mode);return}if(!Gt(l.bundles??[],this.integrity).some(s=>s.integrity===e))return;ue={base:e,target:t,scope:this._scope,mode:this._mode,codePath:this._codePath};let n=s=>s&&!s.error&&(s.json||s.bundle)&&[e,t].includes(s.integrity),r=[this._otherDetails,this._baseReady?this.details:null].filter(n);this.dispatchEvent(new CustomEvent("bundle-swap",{bubbles:!0,composed:!0,detail:{integrity:e,target:t,bundles:r,mode:this._mode}}))}_nameFor(e){return this.source?this.source.name(e):(l.bundles??[]).find(n=>n.integrity===e)?.name??`${e.slice(0,15)}\u2026`}_pick(e){this._choose(e),this._notify()}_notify(){this.dispatchEvent(new CustomEvent("bundle-compare-change",{bubbles:!0,composed:!0,detail:{base:this.integrity,target:this._targetIntegrity,mode:this._mode}}))}_choose(e){let t=e||null;if(this._targetIntegrity=t,this._otherDetails=null,this._codePath=null,this._diff=null,this._diffKey=null,!t){this._status="idle",this._scope="";return}this._status="loading",this._loadOther(t)}async _loadOther(e){if(this.source){let r;try{r=await this.source.load(e)}catch(s){if(s.name==="AbortError")return;r={error:s.message}}if(this._targetIntegrity!==e)return;this._otherDetails=r,this._status="ready";return}let t=Gt(l.bundles??[],this.integrity).find(r=>r.integrity===e);if(!t){this._status="idle",this._targetIntegrity=null,this._notify();return}let n;try{n=await dc(e,t)}catch(r){if(r.name==="AbortError")return;throw r}this._targetIntegrity===e&&(this._otherDetails=n,this._status="ready")}get _baseReady(){return!!(this.details&&this.details.integrity===this.integrity&&(this.details.json||this.details.bundle))}_openFile(e){this._codePath=e,this._mode="code",this._notify()}_openLine({path:e,line:t,query:n}){this._codeSeek={path:e,line:t-1,query:n},this._openFile(e)}_fileRow(e,t,n,r=e,s=!1,o=void 0,c=e,u=void 0){let d=this.source?.files;return a`<li><button type="button" class="bundle-compare-row bundle-compare-row-link" @click="${()=>this._openFile(e)}">${d?d.icon(e,[[this._otherDetails,c],[this.details,e]]):m}<span class="bundle-compare-row-path mono" data-tooltip-truncated data-tooltip="${r}">${t}</span>${d&&s?d.tag(this.details,e,u):m}${oi(o)}${n}</button></li>`}_group(e,t,n,r,s,o=m,{fill:c=!1,lanes:u=qn,style:d={}}={}){return t.length===0?m:a`<section class="${`bundle-compare-group bundle-compare-${n}`}" style="${_e({"--compare-lane":String(u.indexOf(n)+1),...d})}"><header class="bundle-compare-group-head"><span class="bundle-compare-dot" aria-hidden="true"></span> <span class="bundle-compare-group-title" data-tooltip-truncated data-tooltip="${e}">${e}</span> <span class="bundle-compare-group-count">${t.length}</span> ${o}</header><ul class="${c?"bundle-compare-rows bundle-compare-rows--scroll bundle-compare-rows--fill":"bundle-compare-rows bundle-compare-rows--scroll"}">${ce(t,r,s)}</ul></section>`}_sizeCells(e){let t=r=>r==null?"\u2014":G(r),n=r=>`${r.toLocaleString()} LoC`;return e.delta===void 0?a`<span class="bundle-compare-row-size" data-tooltip="${e.lines>0?n(e.lines):m}">${t(e.bytes)}</span>`:a`<span class="${`bundle-compare-row-delta ${e.delta===null?"":Rt(e.delta)}`}" data-tooltip="${`${t(e.baseBytes)} \u2192 ${t(e.otherBytes)}${e.baseLines>0||e.otherLines>0?` \xB7 ${e.baseLines.toLocaleString()} \u2192 ${n(e.otherLines)}`:""}`}">${e.delta===null?"\u2014":Ys(e.delta)}</span>`}_sortActions(e,t,n,r=!1,s=this[e][t]){return a`<span class="bundles-overview-sort" role="group" aria-label="${`${t} ${n} order`}">${[["name","Name"],["size","Size"],...r?[["flags","Flags"]]:[]].map(([o,c])=>a`<button type="button" aria-pressed="${String(s===o)}" @click="${()=>{this[e]={...this[e],[t]:o}}}">${c}</button>`)}</span>`}_fileGroup(e,t,n,r,s){let o=this.source?.files,c=n!=="removed",u=g=>n==="added"?null:{details:this._otherDetails,path:g.basePath??g.path},d=g=>[...c&&o?.flags?o.flags(this.details,g.path,u(g)):[],...Gp(g.meta)],p=t.some(g=>d(g).length>0),h=this._fileSort[n]==="flags"&&!p?"name":this._fileSort[n],f=g=>n==="changed"?Math.abs(g.delta):g.bytes,b=h==="flags"?fd(t,d,g=>g.path):t.toSorted((g,y)=>(h==="size"?f(y)-f(g):0)||g.path.localeCompare(y.path)),v=g=>g.renamedFrom==null?this._fileRow(g.path,r(g.path),this._sizeCells(g),g.path,c,g.meta,g.basePath??g.path,u(g)):this._fileRow(g.path,En(r(g.renamedFrom),r(g.path)),this._sizeCells(g),`${g.renamedFrom} \u2192 ${g.path}`,c,g.meta,g.basePath??g.path,u(g));return this._group(e,b,n,g=>g.path,v,this._sortActions("_fileSort",n,"file",p,h),{lanes:s})}_pkgGroup(e,t,n,r){let s=this._pkgSort[n],o=d=>{let p=n==="changed"?d.delta:d.bytes;return p==null?-1:Math.abs(p)},c=t.toSorted((d,p)=>(s==="size"?o(p)-o(d):0)||Ke(d.pkg).localeCompare(Ke(p.pkg))),u=n==="changed"?0:Math.min(_h,Math.max(0,...t.map(d=>qe(d.versions).length)));return this._group(e,c,n,d=>d.pkg,d=>a`<li><div class="bundle-compare-row"><span class="bundle-compare-pkg-dot" style="${_e({background:Mi(d.pkg)})}"></span> <span class="bundle-compare-row-path" data-tooltip-truncated data-tooltip="${Ke(d.pkg)}">${Ke(d.pkg)}</span> ${n==="changed"?this._versionCell(d):u>0?a`<span class="bundle-compare-dep-ver" data-tooltip-truncated data-tooltip="${qe(d.versions)}">${qe(d.versions)}</span>`:m} ${this._sizeCells(n==="changed"?d:{bytes:d.bytes})}</div></li>`,this._sortActions("_pkgSort",n,"package"),{fill:!0,lanes:r,style:u>0?{"--compare-version-width":`${u}ch`}:{}})}_versionCell(e){let t=e.otherVersions,n=e.baseVersions;if(n.join()===t.join())return n.length>0?a`<span class="bundle-compare-dep-ver">${qe(n)}</span>`:m;let r=e.direction??"changed",s=r==="up"?"\u2191":r==="down"?"\u2193":"\xB1";return a`<span class="bundle-compare-ver" aria-label="${`${r==="up"?"Upgraded":r==="down"?"Downgraded":"Changed"}: ${qe(n)||"none"} to ${qe(t)||"none"}`}"><span class="bundle-compare-ver-from">${qe(n)||"\u2014"}</span> <span class="bundle-compare-ver-arrow" aria-hidden="true">→</span> <span class="${`bundle-compare-ver-to ${r}`}">${qe(t)||"\u2014"}</span> <span class="${`bundle-compare-ver-dir ${r}`}" aria-hidden="true">${s}</span></span>`}_depGroup(e,t,n,r){let s=n==="changed"?0:Math.min(_h,Math.max(0,...t.map(u=>u.range.length))),o=u=>a`<span class="bundle-compare-row-path" data-tooltip-truncated data-tooltip="${u.name}">${u.name}</span> ${this.source?.dependencyTags?.(u,n)??m}${u.kind?a`<span class="npm-dependency-kind">${u.kind}</span>`:m} ${n==="changed"?a`<span class="bundle-compare-ver" aria-label="${`Changed: ${u.from} to ${u.to}`}"><span class="bundle-compare-ver-from">${u.from}</span> <span class="bundle-compare-ver-arrow" aria-hidden="true">→</span> <span class="bundle-compare-ver-to changed">${u.to}</span></span>`:a`<span class="bundle-compare-dep-ver" data-tooltip-truncated data-tooltip="${u.range}">${u.range}</span>`}`,c=this.source?.openDependency;return this._group(e,t,n,u=>u.key,u=>a`<li>${c&&u.opens?a`<button type="button" class="bundle-compare-row bundle-compare-row-link" @click="${()=>c(u)}">${o(u)}</button>`:a`<div class="bundle-compare-row">${o(u)}</div>`}</li>`,m,{fill:!0,lanes:r,style:s>0?{"--compare-version-width":`${s}ch`}:{}})}_renderDependencies(e,t,n,r){return r.length===0?m:a`<section class="bundle-compare-section"><h3 class="bundle-compare-section-head">Dependencies</h3>${this._cols(r,a`${this._depGroup(`Removed \xB7 only in ${t}`,e.removed,"removed",r)} ${this._depGroup(`Added \xB7 only in ${n}`,e.added,"added",r)} ${this._depGroup("Changed",e.changed,"changed",r)}`,"dependencies")}</section>`}_renderPackages(e,t,n,r=qn){return e.removed.length===0&&e.added.length===0&&e.changed.length===0?m:a`<section class="bundle-compare-section"><h3 class="bundle-compare-section-head">Packages</h3>${this._cols(r,a`${this._pkgGroup(`Removed \xB7 only in ${t}`,e.removed,"removed",r)} ${this._pkgGroup(`Added \xB7 only in ${n}`,e.added,"added",r)} ${this._pkgGroup("Changed",e.changed,"changed",r)}`,"packages")}</section>`}_cols(e,t,n){let r=e.map(s=>s==="changed"?"minmax(0, 5fr)":"minmax(0, 4fr)").join(" ");return a`<div class="bundle-compare-cols" data-lanes="${e.length}" data-section="${n}" style="${_e({"--compare-lanes":r})}">${t}</div>`}_collapsible(e,t,n,r,s=""){let o=this._openSections.has(e);return a`<details class="bundle-compare-section bundle-compare-collapsible" .open="${j(o)}" @toggle="${c=>this._setSection(e,c.currentTarget.open)}"><summary class="bundle-compare-section-head" @click="${c=>{c.preventDefault(),this._setSection(e,!o)}}">${t} <span class="bundle-compare-section-count">${n.toLocaleString()}</span>${s?a`<span class="bundle-compare-section-note" data-tooltip-truncated data-tooltip="${s}">${s}</span>`:m}</summary>${o?r():m}</details>`}_setSection(e,t){if(t===this._openSections.has(e))return;let n=new Set(this._openSections);t?n.add(e):n.delete(e),this._openSections=n}_renderResolutions(e){if(e.totalChanges===0)return m;let t=e.changed,n=t.slice(0,wg),r=t.length-n.length,s=(u,d="")=>a`<td class="${d}"><code data-tooltip-truncated data-tooltip="${u}">${u}</code></td>`,o=u=>`${u.conditions}${u.platform===null?"":` \xB7 Platform: ${u.platform}`}`,c=n.some(u=>o(u)!=="*");return this._collapsible("resolutions","Import resolutions",t.length,()=>a`<section class="bundle-compare-group bundle-compare-changed bundle-compare-resolutions"><header class="bundle-compare-group-head"><span class="bundle-compare-dot" aria-hidden="true"></span> <span class="bundle-compare-group-title">Repointed</span> <span class="bundle-compare-group-count">${t.length}</span></header><table class="${c?"":"bundle-compare-resolutions--no-context"}"><thead><tr><th>File</th><th>Import</th><th>Before</th><th>After</th>${c?a`<th>Conditions</th>`:m}</tr></thead><tbody>${ce(n,u=>u.key,u=>{let d=o(u);return a`<tr><td><button type="button" class="bundle-compare-resolution-parent" data-tooltip-truncated data-tooltip="${u.parent}" @click="${()=>this._openFile(u.parent)}">${u.parent}</button></td>${s(u.specifier)} ${s(u.baseTarget||"(empty target)","bundle-compare-resolution-before")} ${s(u.otherTarget||"(empty target)","bundle-compare-resolution-after")} ${c?a`<td class="bundle-compare-resolution-context"><span data-tooltip-truncated data-tooltip="${d}">${d}</span></td>`:m}</tr>`})}</tbody></table>${r>0?a`<div class="bundle-compare-more">and ${r.toLocaleString()} more…</div>`:m}</section>`)}_diffFor(){let e=`${this.integrity}|${this._targetIntegrity}|${this._scope}`;return(this._diffKey!==e||!this._diff)&&(this._diff=Cn(this._otherDetails,this.details,this._scope),this._diffKey=e),this._diff}_renderSummary(e){return xn(e,a`<div class="bundle-compare-modes" role="tablist" aria-label="Comparison view">${[["overview","Overview"],["code","Code"]].map(([t,n])=>a`<button type="button" role="tab" aria-selected="${String(this._mode===t)}" @click="${()=>{this._mode=t,this._notify()}}">${n}</button>`)}</div>`)}_renderPicker(e,t,n,r){return $n({source:this.source,from:{options:e,value:this._targetIntegrity,pick:s=>this._pick(s)},to:{options:this._baseOptions(),value:this._baseKey,placeholder:this._nameFor(this.integrity),pick:s=>this._pickBase(s)},clear:t?{run:()=>this._pick(null)}:null,swap:t&&this.source?.canSwap?.(this._targetIntegrity)!==!1?()=>this._swap():null,extras:n,comparison:r,openLine:s=>this._openLine(s)})}_baseOptions(){if(this.source)return Ne(this.source.choices??[]);let e=(l.bundles??[]).find(n=>n.integrity===this.integrity),t=Gt(l.bundles??[],this.integrity);return this._bundleOptions(e?[e,...t]:t)}_otherOptions(){return this.source?Ne(this.source.options):this._bundleOptions(Gt(l.bundles??[],this.integrity))}_bundleOptions(e){let t=new Map;for(let n of e)t.set(n.name,(t.get(n.name)??0)+1);return e.map(n=>({id:n.integrity,integrity:n.integrity,kind:n.kind??(n.name.toLowerCase().endsWith(".map")?"sourcemap":"stasis"),summary:n.summary,size:typeof n.size=="number"?G(n.size):"\u2014",filename:t.get(n.name)>1?`${n.name} \xB7 ${n.integrity.slice(7,13)}\u2026`:n.name}))}render(){let e=this._otherOptions(),t=!!this._targetIntegrity&&(!!this.source||e.some(h=>h.integrity===this._targetIntegrity)),n=this._baseReady?wr(this.details,t?this._otherDetails:null):[],r=n.length>0?a`<bundle-scope-selector .reasons="${n}" .value="${this._scope}" label="Compare scope" @scope-change="${h=>{this._scope=h.detail.value}}"></bundle-scope-selector>`:m,s=this.source?.noun??"bundle",o=t&&this._status==="ready"&&this._otherDetails&&(this._otherDetails.json||this._otherDetails.bundle)&&!this._otherDetails.error,c=this._baseReady&&o?{base:this._otherDetails,other:this.details,files:this._diffFor().files}:null,u=e.length>0||this.source?this._renderPicker(e,t,r,c):r,d=this._baseReady&&o?this._mode:"overview",p;return this._baseReady?this.source&&!t&&(this.source.pending||this.source.error||e.length===0)?p=a`<div class="${`bundle-compare-empty${this.source.error?" is-error":""}`}">${this.source.pending?`Loading ${s}s\u2026`:this.source.error??a`No other ${s}s to compare <strong>${this._nameFor(this.integrity)}</strong> with.`}</div>`:e.length===0&&!this.source?p=a`<div class="bundle-compare-empty">No other bundles to compare with. Drop a second <code>.map</code> or <code>.stasis.code.br</code> bundle to diff against this one.</div>`:t?this._status==="loading"||!this._otherDetails?p=a`<div class="bundle-compare-empty">Comparing…</div>`:this._otherDetails.error?p=a`<div class="bundle-compare-empty is-error">Couldn't read the selected ${s}: ${this._otherDetails.error}</div>`:!this._otherDetails.json&&!this._otherDetails.bundle?p=a`<div class="bundle-compare-empty is-error">The selected ${s} couldn't be parsed.</div>`:d!=="code"&&(p=this._renderDiff()):p=a`<div class="bundle-compare-empty">Pick a ${s} above to compare <strong>${this._nameFor(this.integrity)}</strong> against.</div>`:p=a`<div class="bundle-compare-empty">Loading bundle…</div>`,a`<div class="bundle-compare">${Sn(u,this._baseReady&&o?this._renderSummary(this._diffFor()):m)} ${d==="code"?zn({base:this._otherDetails,other:this.details,diff:this._diffFor(),source:this.source,path:this._codePath,seek:this._codeSeek,baseName:this._nameFor(this._targetIntegrity),otherName:this._nameFor(this.integrity),select:h=>{this._codePath=h}}):a`<div class="bundle-compare-body">${p}</div>`}</div>`}_renderDiff(){let e=this._diffFor(),t=this._nameFor(this._targetIntegrity),n=this._nameFor(this.integrity),r=[...e.files.onlyBase.map(y=>y.path),...e.files.onlyOther.map(y=>y.path),...e.files.changed.flatMap(y=>y.renamedFrom==null?[y.path]:[y.path,y.renamedFrom])],s=Ji(e.files.root,ft(r).prefix),{prefix:o}=s,c=y=>o&&y.startsWith(o)?y.slice(o.length):y,u=e.files.onlyBase.length+e.files.onlyOther.length+e.files.changed.length,d={removed:e.files.onlyBase,added:e.files.onlyOther,changed:e.files.changed},p=!e.totals.identical,h=this.source?.dependencies?.(this._otherDetails,this.details)??null,f=qn.filter(y=>(h??e.packageRows)[y].length>0),b=p?qn.filter(y=>d[y].length>0):[],v=b.every(y=>f.includes(y))?f:b,g=p?this.source?.files?.warning(this.details,[...d.added,...d.changed].map(y=>y.path)):m;return a`${h?this._renderDependencies(h,t,n,f):this._renderPackages(e.packageRows,t,n,f)} ${g??m} ${e.totals.identical?e.resolutions.totalChanges>0?a`<div class="bundle-compare-caption">File contents are unchanged; import resolutions differ.</div>`:a`<div class="bundle-compare-identical">These two bundles carry identical files (${e.totals.unchangedFiles.toLocaleString()} ${e.totals.unchangedFiles===1?"file":"files"})${s.from?a`, moved <span class="mono">${Tn(s)}</span>`:""}.</div>`:this._collapsible("files","Files",u,()=>this._cols(v,a`${this._fileGroup(`Removed \xB7 only in ${t}`,d.removed,"removed",c,v)} ${this._fileGroup(`Added \xB7 only in ${n}`,d.added,"added",c,v)} ${this._fileGroup("Changed",d.changed,"changed",c,v)}`,"files"),s.from?`${s.from} \u2192 ${s.to}`:o)} ${this._renderResolutions(e.resolutions)}`}};customElements.define("bundle-compare",Co);var Eo=class extends Bl{static properties={reviewTitle:{type:String}};render(){return a`<dialog aria-labelledby="discard-review-title" @close="${this._onClose}"><header><h3 id="discard-review-title">Discard unpublished review?</h3></header><p class="lwd-body"><strong>${this.reviewTitle}</strong></p><p class="lwd-note">This permanently deletes this review and all its file verdicts and notes. This cannot be undone.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="danger" @click="${this._onConfirm}">Discard review</button></footer></dialog>`}};customElements.define("discard-review-dialog",Eo);function Hn(i){return Y("discard-review-dialog",i)}var Pt={...dd,"accept-with-nits":"Accept with nits"},kg=i=>i.revokedAt===null?i.publishedAt===null?"Draft":"Published":"Revoked",$g={accept:"\u2713","accept-with-nits":"\xB7","request-changes":"!",reject:"\xD7"},To=i=>a`<span class="${`npm-review-verdict-icon ${i??"unchecked"}`}" aria-hidden="true">${$g[i]??""}</span>`,At=i=>a`<span class="npm-review-verdict">${To(i)}${Pt[i]??"Not reviewed"}</span>`,ci=i=>a`<span class="${`npm-review-badge ${i.revokedAt===null?i.publishedAt===null?"":"published":"revoked"}`}">${kg(i)}</span>`,Ro=i=>a`<time datetime="${new Date(i).toISOString()}">${new Date(i).toLocaleString()}</time>`,Lo=(i,e)=>a`<div class="npm-review-progress" role="progressbar" aria-label="Files checked" aria-valuemin="0" aria-valuemax="${e||1}" aria-valuenow="${i}"><span style="${`width:${e?i/e*100:0}%`}"></span></div>`;function wh(i=[],e=[]){let t=new Set(e);return new Map(i.filter(n=>n.status&&!t.has(n.file)).map(n=>[n.file,{status:n.status,notes:+!!n.comment.trim()}]))}function lt(i){let e=md(i);if(e.length===0)return m;let t=e.filter(n=>n.bullet);return a`${e.filter(n=>!n.bullet).map(n=>a`<p class="npm-review-note">${n.text}</p>`)} ${t.length>0?a`<ul class="npm-review-note npm-review-note-list">${t.map(n=>a`<li>${n.text}</li>`)}</ul>`:m}`}var li=null,pe=(i,e)=>["ecosystem","package","version","integrity","basePackage","baseVersion","baseIntegrity"].every(t=>i[t]===e[t]);function di(i,e=!1){li={review:i,continueReview:e}}function kh(i){if(!li||!pe(li.review,i))return null;let e=li;return li=null,e}function Ae(i){let e=`${i.package} ${i.version}`;return i.basePackage?i.basePackage===i.package?`${i.package} ${i.baseVersion} -> ${i.version}`:`${i.basePackage} ${i.baseVersion} -> ${e}`:e}var ie=i=>i._blocked||i._loading,$h=i=>i._shownReview?.publishedAt!=null,xg=i=>i.coverage==="full"?"Full":"Partial",Po=i=>i._error?a`<p class="npm-review-error" role="alert">${i._error}</p>`:m,xh=i=>i._saveBlocked?a`<div class="npm-review-saving" role="status">Saving changes…</div>`:m,Mo=i=>[i._continuation?.review,...i._reviews].filter(Boolean).toSorted((e,t)=>+(e.publishedAt!==null)-+(t.publishedAt!==null)||(t.publishedAt??t.time)-(e.publishedAt??e.time)),Sh=i=>`npm-review-button npm-review-primary npm-review-finalize ${i._allowedVerdicts[0]}`,Ch=(i,e,t,n,r=Object.keys(Pt),s=!1)=>a`<div class="npm-review-verdict-options" role="group" aria-label="Verdict">${Object.entries(s?{"":"Not checked",...Pt}:Pt).map(([o,c])=>a`<label class="${`npm-review-verdict-choice ${o||"unchecked"}`}"><input type="radio" name="${i}" aria-label="${c}" value="${o}" .checked="${j(e===o)}" ?disabled="${n||o!==""&&!r.includes(o)}" @change="${()=>t(o)}">${c}</label>`)}</div>`;function Sg(i){let e=$h(i),t=i._shownReview,n=i._summary,r=i._canEdit?{label:"Finalize review",run:()=>i._beginPublish(),disabled:!n.checkedFiles}:!e||!i._writable?null:i._activeReview||i._ownPublished.length===0?{label:"Resume your review",run:()=>i._resume()}:t.user===i.session?.id?{label:"Revise review",run:()=>i._change({action:"continue",reviewId:t.id,revision:t.revision})}:null;return a`<div class="npm-review-summary-actions">${e||i._draftStarted?ci(t??{publishedAt:null,revokedAt:null}):m}<div class="npm-review-progress-block"><span>${i._unsaved&&(i._saveBlocked||i._error)?a`<button type="button" class="npm-review-button npm-review-text-button" @click="${()=>i._openPanel("unsaved")}">Unsaved changes</button>`:a`<strong>${n.checkedFiles} of ${n.totalFiles}</strong> files checked`}</span> ${Lo(n.checkedFiles,n.totalFiles)}</div>${r?a`<button type="button" class="${i._canEdit?Sh(i):"npm-review-button"}" ?disabled="${ie(i)||r.disabled}" @click="${r.run}">${r.label} ${xe}</button>`:m}</div>`}function Cg(i){let e=i.source??gd(i.entry),t=!!(i._target&&i._target!=="(empty)"),n=Ne(e.options,s=>`${i.entry.npm.name}@${s.id}`);t&&!n.some(s=>s.id===i._target)&&n.push(...Ne([{id:i._target,name:i._target,format:"npm"}]));let r=Ne(e.choices);return r.some(s=>s.id===i.entry.npm.version)||r.push(...Ne([{id:i.entry.npm.version,name:i.entry.npm.version,format:"npm"}])),Sn($n({source:e,label:"Review",disabled:ie(i),from:{options:n,value:t?i._target:null,label:"Review base",pick:s=>{i._navigate(s)}},to:{options:r,value:i.entry.npm.version,label:"Version to review",pick:s=>{i._navigateTo({view:"npm",packageName:i.entry.npm.name,packageSpec:s,bundleTab:"review",...i._location(i._target)})}},clear:t?{label:"Clear review base",run:()=>{i._navigate("(empty)")}}:null,openLine:s=>i._openLine(s),comparison:{base:i._base,other:i.details,files:i._diff.files}}),xn(i._diff))}function Eg(i){return a`<div class="npm-review-toolbar"><nav class="npm-review-toolbar-group" aria-label="Review breadcrumbs"><button type="button" class="npm-review-button npm-review-text-button" ?disabled="${ie(i)}" @click="${()=>{i._navigateTo({view:"reviews"})}}">My reviews</button> ${xe}<button type="button" class="npm-review-button npm-review-text-button npm-review-package" aria-haspopup="dialog" ?disabled="${i._blocked}" @click="${()=>i._openPanel("reviews")}"><span>${i.entry.npm.name}@${i.entry.npm.version}</span><span class="npm-review-count">${Mo(i).length}</span></button></nav>${Sg(i)}</div>`}function Tg(i,e=i._file,t=!1){let n=i._editorState(e),r=i._shownReview?.entries.find(c=>c.file===e),s=i._nonTextFiles.includes(e),o=!s&&["accept-with-nits","request-changes","reject"].includes(n.status);return a`<section class="${`npm-review-decision${t?" npm-review-inline-decision":""}`}" aria-label="File decision">${i._canEdit?a`${Ch(`file:${e}`,s?"":n.status,c=>{i._setFileStatus(e,c)},ie(i)||s,void 0,!0)} ${s?a`<p class="npm-review-help">Non-text file. Verdicts are not supported yet; this file remains unchecked.</p>`:m} ${o?a`<textarea aria-label="File note" rows="2" maxlength="20000" placeholder="Add a note (optional)…" .value="${j(n.comment)}" ?disabled="${ie(i)}" @input="${c=>i._editFile(e,{comment:c.target.value})}" @blur="${()=>{i._saveFile(e)}}"></textarea>`:m}`:a`${t?m:a`<header><strong>File review</strong><span class="npm-review-muted">${$h(i)?"Frozen":"Read only"}</span></header>`} ${r?.status&&!s?a`${At(r.status)}${lt(r.comment)}`:a`<p class="npm-review-muted">This file was not reviewed.</p>`} ${i._writable?m:a`<p class="npm-review-help">Triage access is required to add a review.</p>`}`}</section>`}function Eh(i,e,t,n,r,s){return a`<fieldset class="npm-review-team-options"><legend>${e}</legend>${t.map(o=>a`<mode-switch label="${o.name}" .checked="${n.has(o.id)}" .disabled="${ie(i)}" @click="${()=>{if(ie(i))return;let c=new Set(n);c.has(o.id)?c.delete(o.id):c.add(o.id),r(c)}}"></mode-switch>`)}${s}</fieldset>`}function Rg(i,e){let t=i._allowedVerdicts,n=Xt(e.entries,i._files,i._nonTextFiles),r=e.entries.filter(s=>s.status&&s.comment.trim()&&!i._nonTextFiles.includes(s.file));return a`<form class="npm-review-publish-form" @submit="${s=>{s.preventDefault(),i._publish()}}"><div class="npm-review-dialog-body"><section class="npm-review-coverage"><div><strong>${xg(n)} review</strong><span>${n.checkedFiles} of ${n.totalFiles} files checked</span></div>${Lo(n.checkedFiles,n.totalFiles)}<p>${n.totalFiles>n.checkedFiles?a`${n.totalFiles-n.checkedFiles} files not checked. <button type="button" class="npm-review-button npm-review-text-button" @click="${()=>{i._unchecked=!0,i._closePanel()}}">View files</button>`:"Every file has a verdict."}</p>${i._needsPackageJson?a`<p class="npm-review-error">Review ${i._files.includes("package.json")?a`<button type="button" class="npm-review-button npm-review-text-button" @click="${()=>{i._closePanel(),i._selectFile("package.json")}}">package.json</button>`:"package.json"} before publishing a partial review.</p>`:m}</section>${r.length>0?a`<section aria-label="File notes"><strong>File notes</strong><ul class="npm-review-publish-notes" tabindex="0" aria-label="Saved file notes">${r.map(s=>a`<li><span class="dependency-review-entry-file">${Ve(s.file)}<span>${s.file}</span></span> ${lt(s.comment)}</li>`)}</ul></section>`:m}<div><strong>Final verdict</strong>${Ch("final-verdict",i._finalStatus,s=>{i._finalStatus=s},ie(i),t)}</div>${i._securityLimit==="reject"?a`<p class="npm-review-help">Malware detected. Only Reject is available.</p>`:i._securityLimit==="request-changes"?a`<p class="npm-review-help">Critical vulnerabilities detected.</p>`:m} <label>Final note <span class="npm-review-muted">· optional</span><textarea aria-label="Final comment" rows="3" maxlength="20000" .value="${j(i._finalComment)}" placeholder="Summarize your findings or explain what remains…" ?disabled="${ie(i)}" @input="${s=>{i._finalComment=s.target.value}}"></textarea></label> ${i._unchangedContinuation?a`<p class="npm-review-help">Change a verdict or note to publish a new review.</p>`:m} ${Eh(i,"Publish to teams",i._teams,i._selectedTeams,s=>{i._selectedTeams=s},i._selectedTeams.size>0?m:a`<p class="npm-review-error">${i._teams.length===0?"No teams you belong to have dependency review enabled.":"Select at least one team to publish."}</p>`)} ${Po(i)}</div><footer class="npm-review-dialog-footer"><p>Publishing freezes your verdicts and notes.<br>You can continue in a new review to make changes.</p><button type="submit" class="${Sh(i)}" ?disabled="${ie(i)||!i._canPublish}">Publish to ${i._selectedTeams.size} ${i._selectedTeams.size===1?"team":"teams"} ${xe}</button></footer></form>`}function Lg(i,e){let t=e===i._shownReview,n=e.publishedAt!==null,r=n?e:pe(e,i._context)?Xt(e.entries,i._files,i._nonTextFiles):{checkedFiles:e.entries.filter(p=>p.status).length,totalFiles:null},s=[i._continuation?.review,...i._reviews].some(p=>p?.publishedAt===null&&p.user===i.session?.id&&pe(p,e)),o=e.user===i.session?.id,c=i._teams.filter(p=>!e.teams.some(h=>h.id===p.id)),u=i._additionalTeams.get(e.id)??new Set(c.length===1?c.map(p=>p.id):[]),d=c.filter(p=>u.has(p.id)).map(p=>p.id);return a`<section class="npm-review-entry" aria-current="${String(t)}"><div class="npm-review-history-heading"><strong>${e.userLogin}</strong>${t?a`<span class="npm-review-current">Current</span>`:m}${ci(e)}</div><p class="npm-review-help">${e.basePackage?`${e.basePackage===e.package?e.baseVersion:`${e.basePackage}@${e.baseVersion}`} \u2192 ${e.version}`:"All package files"}</p><div class="npm-review-entry-result">${n?At(e.status):m}<span class="dependency-review-coverage"> ${n?a`${r.coverage==="full"?"Full":a`<span class="dependency-review-partial">Partial</span>`} ·`:m}${r.checkedFiles}${r.totalFiles===null?m:`/${r.totalFiles}`} files checked</span></div><p class="npm-review-help">${e.teams.length>0?`${e.teams.map(p=>p.name).join(", ")} \xB7 `:""}${Ro(e.publishedAt??e.time)}</p>${lt(e.comment)}<div class="npm-review-entry-actions"><button type="button" class="npm-review-button" ?disabled="${ie(i)}" @click="${()=>{i._openReview(e)}}">Open ${xe}</button> ${n&&o&&!s&&i._writable?a`<button type="button" class="npm-review-button" aria-label="Revise in a new draft" ?disabled="${ie(i)}" @click="${()=>{i._openReview(e,!0)}}">Revise</button>`:m} ${n&&o&&i._writable&&e.revokedAt===null?a`<button type="button" class="npm-review-button npm-review-danger" ?disabled="${ie(i)}" @click="${()=>i._change({action:"revoke",reviewId:e.id,revision:e.revision})}">Revoke</button>`:m}<review-audit-copy .review="${e}"></review-audit-copy>${!n&&o&&i._writable?a`<button type="button" class="dependency-review-discard" aria-label="Discard review" ?disabled="${ie(i)}" @click="${()=>{i._discard(e)}}">${J(vi)}</button>`:m}</div>${n&&o&&i._writable&&e.revokedAt===null&&c.length>0?a`<details class="npm-review-share"><summary>Publish to more teams</summary>${Eh(i,"Teams",c,u,p=>{i._additionalTeams=new Map(i._additionalTeams).set(e.id,p)},a`<button type="button" class="npm-review-button" ?disabled="${ie(i)||d.length===0}" @click="${()=>i._change({action:"publish",reviewId:e.id,revision:e.revision,teamIds:d})}">Publish to more teams</button>`)}</details>`:m} ${e.revokedAt===null?m:a`<p class="npm-review-help">Revoked ${Ro(e.revokedAt)}. Content and team links remain frozen.</p>`}</section>`}function Mg(i){if(!i._panel)return m;let e={publish:"Publish review",reviews:"Reviews",unsaved:"Unsaved changes"};return a`<dialog class="npm-review-dialog" aria-label="${e[i._panel]}" @cancel="${t=>{t.preventDefault(),i._closePanel()}}"><button type="button" class="detail-action npm-review-close" aria-label="Close panel" ?disabled="${i._blocked}" @click="${()=>i._closePanel()}">×</button><header class="npm-review-dialog-head"><h2>${e[i._panel]}</h2><p>${i._panel==="reviews"?`${i.entry.npm.name}@${i.entry.npm.version}`:Ae(i._context)}</p></header>${i._panel==="publish"?Rg(i,i._activeReview):a`<div class="${`npm-review-dialog-body${i._panel==="reviews"?" npm-review-entries":""}`}">${i._panel==="unsaved"?a`${i._dirtyFiles.map(t=>a`<button type="button" class="npm-review-button" @click="${()=>{i._closePanel(),i._selectFile(t)}}">${t} ${xe}</button>`)}`:Mo(i).map(t=>Lg(i,t))} ${i._panel==="reviews"&&Mo(i).length===0?a`<p class="npm-review-muted">No reviews yet.</p>`:m}${Po(i)}</div>`} ${xh(i)}</dialog>`}function Pg(i){let e=i._shownReview?.entries,t=i._files,n=i._nonTextFiles;if(i._treeProgress?.entries!==e||i._treeProgress?.files!==t||i._treeProgress?.nonTextFiles!==n){let c=wh(e,n),u=new Map,d=0;for(let p of i._files){let h=p.split("/"),f=+!!c.get(p)?.status;d+=f;for(let b=1;b<h.length;b++){let v=h.slice(0,b).join("/"),g=u.get(v)??{total:0,checked:0};g.total++,g.checked+=f,u.set(v,g)}}i._treeProgress={entries:e,files:t,nonTextFiles:n,states:c,directories:u,checked:d}}let{states:r,directories:s,checked:o}=i._treeProgress;return{railLabel:"Files",treeLabel:"Review files",collapseLabel:"Collapse folders",searchLabel:"Find a file",searchPlaceholder:"Find a file\u2026",treePageSize:300,filterContent:!1,fullPaths:!0,collapseClearsSearch:!0,canSelect:()=>!i._blocked&&!i._panel,fileFilter:i._unchecked?c=>!r.get(c)?.status:null,fileLabel:c=>`${c}, ${Pt[r.get(c)?.status]??"Not reviewed"}`,filePrefix:c=>To(r.get(c)?.status),fileSuffix:c=>r.get(c)?.notes?a`<span class="npm-review-note-dot" aria-label="Has notes">•</span>`:m,directoryLabel:c=>{let u=s.get(c.sourcePath);return`${c.sourcePath}, ${u?.checked??0} of ${u?.total??0} checked`},directorySummary:c=>{let u=s.get(c.sourcePath);return`${u?.checked??0}/${u?.total??0}`},filters:a`<div class="npm-review-filters" aria-label="Filter review files"><button type="button" class="npm-review-button" aria-pressed="${String(!i._unchecked)}" @click="${()=>{i._unchecked=!1}}">All ${i._files.length}</button> <button type="button" class="npm-review-button" aria-pressed="${String(!!i._unchecked)}" @click="${()=>{i._unchecked=!0}}">Unchecked ${i._files.length-o}</button></div>`,fileActions:(c,u)=>Tg(i,c,u)}}function Th(i){return i._base?a`${Cg(i)}${Eg(i)}${i._panel?m:Po(i)} ${zn({base:i._base,other:i.details,diff:i._diff,source:i.source,path:i._path,seek:i._seek,baseName:i._base.npm?`${i._base.npm.name}@${i._base.npm.version}`:"Empty package",otherName:`${i.entry.npm.name}@${i.entry.npm.version}`,select:e=>i._selectFile(e),extensions:Pg(i),mode:i._mode})} <span class="npm-review-announcement" role="status">${i._notice??""}</span>${i._panel?m:xh(i)}${Mg(i)}`:a`<div class="npm-review-empty" role="${i._baseError?"alert":"status"}">${i._baseError??"Loading comparison\u2026"} ${i._baseError?a`<button type="button" class="npm-review-button" @click="${()=>{i._baseKey=null,i._loadBase(i._target,i.request?.resume)}}">Retry</button>`:m}</div>`}var Ag={maxLines:5e4,maxBytes:2*1024*1024},Ig={integrity:"(empty)",kind:"sourcemap",json:{version:3,sources:[],sourcesContent:[]},fileSizes:new Map},Rh=(i,e)=>({ecosystem:"npm",package:i.npm.name,version:i.npm.version,integrity:i.integrity,basePackage:e?.npm?.name??null,baseVersion:e?.npm?.version??null,baseIntegrity:e?.npm?e.integrity:null}),ui=(i,e)=>`${i}@${e??"latest"}`,Ao=class extends U{static properties={entry:{attribute:!1},details:{attribute:!1},request:{attribute:!1},session:{attribute:!1},source:{attribute:!1},_teams:{state:!0},_selectedTeams:{state:!0},_additionalTeams:{state:!0},_reviews:{state:!0},_loading:{state:!0},_error:{state:!0},_saving:{state:!0},_saveBlocked:{state:!0},_file:{state:!0},_seek:{state:!0},_finalStatus:{state:!0},_finalComment:{state:!0},_base:{state:!0},_baseError:{state:!0},_panel:{state:!0},_path:{state:!0},_selectedReview:{state:!0},_unchecked:{state:!0},_notice:{state:!0},_continuation:{state:!0}};createRenderRoot(){return this}constructor(){super(),this._teams=[],this._reviews=[],this._files=[],this._nonTextFiles=[],this._selectedTeams=new Set,this._additionalTeams=new Map,this._editors=new Map,this._file=null,this._path=null,this._loading=!1,this._saving=!1,this._error=null,this._context=null,this._key=null,this._controller=new AbortController,this._mode="code",this._panel=null,this._selectedReview=null,this._unchecked=!1,this._pendingSaves=[],this._saveBlocked=!1}disconnectedCallback(){super.disconnectedCallback(),this._controller.abort(),this._cancelSaves(),this._dismissLoading?.(),this._key=null,this._baseKey=null}updated(){let e=this.querySelector("dialog");e&&!e.open&&e.showModal(),this._rememberBase()}_rememberBase(){l.bundleDetailsTab!=="review"||l.selectedBundle!==this.entry?.integrity||!this._context||!this._activeReview&&this._ownPublished.length===0&&!this._unsaved||(l.npmReview={bundle:this.entry.integrity,...this._context.basePackage?{reviewPackage:this._context.basePackage,reviewSpec:this._context.baseVersion}:{},started:!0,user:this.session?.id})}get _writable(){return["triage","manage","admin"].includes(this.session?.role)&&!this.session?.viewer}get _activeReview(){return this._reviews.find(e=>e.user===this.session?.id&&e.publishedAt===null&&pe(e,this._context))??(this._continuation&&this._continuation.review.user===this.session?.id?this._continuation.review:null)}get _ownPublished(){return this._reviews.filter(e=>e.user===this.session?.id&&e.publishedAt!==null&&pe(e,this._context)).toSorted((e,t)=>t.publishedAt-e.publishedAt)}get _shownReview(){return this._selectedReview?this._reviews.find(e=>e.id===this._selectedReview):this._activeReview??this._ownPublished[0]??null}get _canEdit(){return this._writable&&!this._selectedReview&&(this._activeReview!==null||this._ownPublished.length===0)}_isDirty(e,t){return!this._nonTextFiles.includes(e)&&(t.comment!==(t.edit?.comment??"")||t.status!==(t.edit?.status??""))}get _dirtyFiles(){return[...this._editors].filter(([e,t])=>this._isDirty(e,t)).map(([e])=>e)}get _blocked(){return this._saving||this._saveBlocked}get _unsaved(){return this._pendingSaves.length>0||this._dirtyFiles.length>0}get _draftStarted(){return this._canEdit&&(this._unsaved||this._activeReview&&!this._continuation||this._continuation&&this._publishRevision!=null&&!this._unchangedContinuation)}get _summary(){return Xt(this._shownReview?.entries??[],this._files,this._nonTextFiles)}get _securityLimit(){return this.source?.reviewVerdictLimit?.(this.entry,this._base)??"accept"}get _allowedVerdicts(){let e=new Map((this._shownReview?.entries??[]).map(t=>[t.file,t]));if(this._canEdit)for(let[t,n]of this._editors)e.set(t,{file:t,status:n.status||null});return pd([...e.values()].filter(t=>!this._nonTextFiles.includes(t.file)),this._securityLimit)}get _needsPackageJson(){return hd(this._activeReview?.entries??[],this._files,this._nonTextFiles)}get _unchangedContinuation(){let e=this._continuation?.source;return!!(e&&this._finalStatus===e.status&&this._finalComment===e.comment)}get _canPublish(){return this._canEdit&&this._panel==="publish"&&this._activeReview?.revision===this._publishRevision&&this._summary.checkedFiles>0&&!this._needsPackageJson&&!this._unchangedContinuation&&this._selectedTeams.size>0&&!this._unsaved&&this._allowedVerdicts.includes(this._finalStatus)}_location(e){let t=e&&e!=="(empty)"?yr(e):null;return t?{reviewPackage:t.name,reviewSpec:t.spec}:{}}_navigate(e){return this._navigateTo(_r(this.entry,"review",this._location(e)))}async _navigateTo(e){if(this._blocked||this._loading)return;let t=this._key,n=this._navigation={};this._unsaved&&!await this._saveAll()||t===this._key&&n===this._navigation&&!this._unsaved&&await me?.navigate(e)}async _loadBase(e,t=!1){let n=JSON.stringify([this.entry.integrity,e,this.session?.id,this.session?.role]);if(this._baseKey!==n){this._baseKey=n,this._base=null,this._baseError=null,this._controller.abort(),this._cancelSaves(),this._key=null,this._controller=new AbortController;try{let r=t?await qd(Rh(this.entry,null),this._controller.signal):null;if(this._baseKey!==n)return;r&&(e=r.basePackage?ui(r.basePackage,r.baseVersion):"(empty)");let s=e==="(empty)"?null:yr(e),o=s?(await Jc(s.name,s.spec??"latest")).details:Ig;if(this._baseKey!==n)return;t&&(r&&di(r),this._target=e,this.request={bundle:this.entry.integrity,...this._location(e)},this._baseKey=JSON.stringify([this.entry.integrity,e,this.session?.id,this.session?.role])),this._base=o,this._ensureContext(o)}catch(r){this._baseKey===n&&(this._baseError=r.message)}}}_ensureContext(e){let t=Rh(this.entry,e),n=JSON.stringify([this.session?.id,this.session?.role,t]);if(n===this._key)return;this._controller.abort(),this._cancelSaves(),this._controller=new AbortController,this._context=t,this._diff=Cn(e,this.details);let r=Ep(e,this.details,this._diff);this._files=Wt(Ki(r.map(o=>o.path)));let s=new Set(r.filter(o=>!ud(o.before,o.after)).map(o=>o.path));if(this._nonTextFiles=this._files.filter(o=>s.has(o)),this._mode=Tp(r,Ag)?"diff":"code",this._key=n,this._teams=[],this._reviews=[],this._selectedTeams=new Set,this._additionalTeams=new Map,this._selectedReview=null,this._continuation=null,this._editors.clear(),this._path=this._files[0]??null,this._panel=null,this._notice="",this._resetEditor(this._path),this._saving=!1,this._refresh(!0),l.bundleDetailsTab==="review"&&l.selectedBundle===this.entry.integrity){let o=this._location(e.npm?ui(e.npm.name,e.npm.version):"(empty)");l.npmReview={bundle:this.entry.integrity,...o},this._baseKey=JSON.stringify([this.entry.integrity,e.npm?ui(e.npm.name,e.npm.version):"(empty)",this.session?.id,this.session?.role]),me?.replaceRoute(_r(this.entry,"review",o))}}async _refresh(e=!1){let t=this._key;for(;t===this._key&&this._pendingSaves.length>0;)if((await Promise.all(this._pendingSaves.map(r=>r.promise))).some(r=>!r))return;if(t!==this._key)return;this._dismissLoading?.();let n=this._dismissLoading=Oe("Loading reviews\u2026",{duration:0});this._loading=!0,this._error=null;try{let{reviews:r,teams:s}=await Zt({...this._context,allBases:!0},null,null,this._controller.signal);if(t===this._key){let o=this._unsaved;this._reviews=r,this._teams=s,r.some(d=>d.user===this.session?.id&&d.publishedAt===null&&pe(d,this._context))&&(this._continuation=null),this._rememberBase();let c=kh(this._context),u=c&&r.find(d=>d.id===c.review.id);u?.publishedAt!=null&&(c.continueReview?this._continue(u.id,u.revision):this._selectedReview=u.id),this._selectedTeams=new Set(s.filter(d=>e?s.length===1:this._selectedTeams.has(d.id)).map(d=>d.id)),o||(this._editors.clear(),this._resetEditor(this._file))}}catch(r){t===this._key&&r.name!=="AbortError"&&(this._error=r.message)}finally{n(),t===this._key&&(this._loading=!1)}}_resetEditor(e=null){this._publishRevision=null,this._file=e,this._editorState(e)}_editorState(e){let t=this._canEdit?this._editors.get(e):null;if(!t){let n=this._shownReview?.entries.find(r=>r.file===e&&r.status)??null;t={edit:n,revision:this._activeReview?.revision??null,comment:this._nonTextFiles.includes(e)?"":n?.comment??"",status:this._nonTextFiles.includes(e)?"":n?.status??""},this._canEdit&&this._editors.set(e,t)}return{...t,dirty:this._isDirty(e,t)}}_editFile(e,t){!this._canEdit||this._blocked||(this._resetEditor(e),Object.assign(this._editors.get(e),t),this.requestUpdate())}_setFileStatus(e,t){if(!(this._blocked||this._nonTextFiles.includes(e)))return this._editFile(e,{status:t,...t?{}:{comment:""}}),this._saveFile(e)}_selectFile(e){this._blocked||!this._files.includes(e)||(this._path=e,this._resetEditor(e))}_openLine({path:e,line:t,query:n}){this._blocked||!this._files.includes(e)||(this._seek={path:e,line:t-1,query:n},this._selectFile(e))}_openPanel(e){this._panel=e}async _openReview(e,t=!1){if(this._blocked||this._loading)return;if(pe(e,this._context)){t?this._continue(e.id,e.revision):e.publishedAt===null?this._resume():this._showPublished(e);return}let n=this._key;this._unsaved&&!await this._saveAll()||n!==this._key||(di(e,t),await this._navigate(e.basePackage?ui(e.basePackage,e.baseVersion):"(empty)"))}_closePanel(){this._blocked||(this.querySelector("dialog")?.close(),this._panel=null)}_showPublished(e){this._selectedReview=e.id,this._panel=null,this._file=this._path}_resume(){this._selectedReview=null,this._panel=null,this._resetEditor(this._path)}async _discard(e){if(this._blocked||this._loading||!this._writable||e.user!==this.session.id||e.publishedAt!==null)return;let t=e===this._activeReview,n=this._key,r=this._controller.signal;this._saving=!0,this._error=null;try{let{confirmed:s}=await Hn({reviewTitle:Ae(e),signal:r});if(!s||r.aborted||n!==this._key||(await Promise.all(this._pendingSaves.map(c=>c.promise)),r.aborted||n!==this._key||!this._writable)||(e=t?this._activeReview:this._reviews.find(c=>c.id===e.id),!e||e.user!==this.session.id||e.publishedAt!==null))return;let o=e===this._continuation?.review;if(o||await Qi(e.id,e.revision,this.session.csrfToken,r),r.aborted||n!==this._key)return;o||(this._reviews=this._reviews.filter(c=>c.id!==e.id)),pe(e,this._context)&&(this._continuation=null,this._selectedReview=null,this._editors.clear(),this._resetEditor(this._path),this._finalStatus=null,this._finalComment="",this._panel=null,this._ownPublished.length===0&&l.npmReview?.bundle===this.entry.integrity&&delete l.npmReview.started),this._notice="Draft discarded."}catch(s){n===this._key&&s.name!=="AbortError"&&(this._error=s.message)}finally{n===this._key&&(this._saving=!1)}}_continue(e,t){let n=this._reviews.find(r=>r.id===e&&r.revision===t&&r.user===this.session?.id&&r.publishedAt!==null&&pe(r,this._context));return!n||this._activeReview?null:(this._continuation={source:n,review:{...n,publishedAt:null,revokedAt:null,status:null,teams:[]}},this._selectedTeams=new Set(this._teams.length===1?this._teams.map(r=>r.id):[]),this._selectedReview=null,this._panel=null,this._editors.clear(),this._resetEditor(this._path),this._notice="A new draft will be saved when you make a change.",this._activeReview)}async _persistContinuation(e){let t=this._continuation,n=this._key,{review:r}=await Zt(this._context,{action:"continue",reviewId:t.source.id,revision:t.source.revision},this.session.csrfToken,this._controller.signal);return n!==this._key||this._continuation!==t||e&&this._pendingSaves[0]!==e?null:(this._acceptSave(r,{revision:t.source.revision}),r)}_cancelSaves(){for(let e of this._pendingSaves)clearTimeout(e.timer),e.resolve(null);this._pendingSaves=[],this._saveBlocked=!1}_queueSave(e){let t=this._pendingSaves.findLast(r=>r.change.file===e.file);if(t&&t.change.comment===e.comment&&t.change.status===e.status)return t.promise;let n={change:e,slow:!1};return n.promise=new Promise(r=>{n.resolve=r}),n.timer=setTimeout(()=>{n.slow=!0,this._saveBlocked=!0},3e3),this._pendingSaves.push(n),this.requestUpdate(),this._pendingSaves.length===1&&this._flushSaves(),n.promise}_acceptSave(e,t){this._reviews=[...this._reviews.filter(n=>n.id!==e.id),e],this._continuation=null;for(let[n,r]of this._editors)r.revision===t.revision&&(r.revision=e.revision,r.edit=e.entries.find(s=>s.file===n&&s.status)??null);for(let{change:n}of this._pendingSaves.slice(1))n.revision===t.revision&&(n.revision=e.revision,n.reviewId=e.id,n.entryId=e.entries.find(r=>r.file===n.file)?.id??null);this._canEdit&&this._resetEditor(this._file),this._notice="Saved privately.",this._rememberBase()}async _flushSaves(){for(;this._pendingSaves.length>0;){let e=this._pendingSaves[0];this._error=null;try{if(this._continuation){let n=await this._persistContinuation(e);if(!n||this._pendingSaves[0]!==e)return;Object.assign(e.change,{reviewId:n.id,revision:n.revision,entryId:n.entries.find(r=>r.file===e.change.file)?.id??null})}let{review:t}=await Zt(this._context,e.change,this.session.csrfToken,this._controller.signal);if(this._pendingSaves[0]!==e)return;this._acceptSave(t,e.change),clearTimeout(e.timer),this._pendingSaves.shift(),e.resolve(t),this._saveBlocked=this._pendingSaves.some(n=>n.slow),this.requestUpdate()}catch(t){if(this._pendingSaves[0]!==e)return;this._cancelSaves(),t.name!=="AbortError"&&(this._error=t.message),this.requestUpdate();return}}}async _change(e){if(this._blocked||this._pendingSaves.length>0||this._loading||!this._writable)return null;if(e.action==="continue")return this._continue(e.reviewId,e.revision);let t=this._key;this._saving=!0,this._error=null;try{if(e.action==="publish"&&e.finalStatus&&this._continuation){let o=await this._persistContinuation();if(!o)return null;e={...e,reviewId:o.id,revision:o.revision}}let n=this._reviews.find(o=>o.id===e.reviewId)??this._context,r=Object.fromEntries(Object.keys(this._context).map(o=>[o,n[o]])),{review:s}=await Zt(r,e,this.session.csrfToken,this._controller.signal);return t!==this._key?null:(this._reviews=[...this._reviews.filter(o=>o.id!==s.id),s],e.action==="publish"&&e.finalStatus&&pe(s,this._context)&&(this._selectedReview=s.id,this._panel=null,this._editors.clear(),this._notice="Published. Verdicts and notes are now frozen."),this._rememberBase(),s)}catch(n){return t===this._key&&n.name!=="AbortError"&&(this._error=n.message),null}finally{t===this._key&&(this._saving=!1)}}_saveFile(e){if(!this._canEdit||this._saving||this._loading)return null;let t=this._editorState(e),n=this._pendingSaves.some(s=>s.change.file===e),r=this._activeReview;return!t.dirty&&!n?r:!t.status&&!t.comment.trim()&&!t.edit?.id&&!n?(this._editors.delete(e),e===this._file&&this._resetEditor(e),r):this._queueSave({action:"save",reviewId:r?.id??null,revision:t.revision,entryId:t.edit?.id??null,file:e,comment:t.comment,status:this._nonTextFiles.includes(e)?null:t.status||null})}async _saveAll(){let e=this._key;for(;e===this._key&&this._canEdit;){if(this._pendingSaves.length>0){if((await Promise.all(this._pendingSaves.map(n=>n.promise))).some(n=>!n))return!1;continue}let t=this._dirtyFiles;if(t.length===0)return!0;if(!await this._saveFile(t[0]))return!1}return!1}async _beginPublish(){if(!this._canEdit||this._saving||this._loading||this._finalizing||!this._summary.checkedFiles)return;let e=this._key;this._finalizing=!0;try{if(this._unsaved&&!await this._saveAll()||e!==this._key||!this._canEdit||this._unsaved||!this._summary.checkedFiles)return;let t=this._activeReview;if(!t)return;let n=this._allowedVerdicts,r=this._continuation?.source.status;this._finalStatus=n.includes(r)?r:n[0],this._finalComment=t.comment??"",this._publishRevision=t.revision,this._panel="publish"}finally{this._finalizing=!1}}_publish(){if(this._canPublish)return this._change({action:"publish",reviewId:this._activeReview.id,revision:this._publishRevision,teamIds:[...this._selectedTeams],finalStatus:this._finalStatus,finalComment:this._finalComment})}render(){if(!this.entry?.npm||!this.details)return m;let e=this.request?.bundle===this.entry.integrity?this.request:{};return this._target=e.reviewPackage?ui(e.reviewPackage,e.reviewSpec):"(empty)",this._loadBase(this._target,e.resume),Th(this)}};customElements.define("npm-review",Ao);var Fg=i=>({view:"npm",packageName:i.package,packageSpec:i.version,bundleTab:"review",...i.basePackage===null?{}:{reviewPackage:i.basePackage,reviewSpec:i.baseVersion}}),Dg=i=>{let e=new Date(i);return a`<time datetime="${e.toISOString()}" data-tooltip="${e.toLocaleString()}">${e.toLocaleDateString(void 0,{month:"short",day:"numeric",...e.getFullYear()===new Date().getFullYear()?{}:{year:"numeric"}})} <span>${e.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}</span></time>`},Io=class extends U{static properties={session:{attribute:!1},_reviews:{state:!0},_loading:{state:!0},_error:{state:!0},_next:{state:!0},_discarding:{state:!0},_expanded:{state:!0}};constructor(){super(),this._reviews=[],this._next=null,this._expanded=new Set,this._controller=new AbortController}createRenderRoot(){return this}disconnectedCallback(){super.disconnectedCallback(),this._controller.abort(),this._dismissLoading?.(),this._key=null}_canDiscard(e){return e.publishedAt===null&&e.user===this.session?.id&&["triage","manage","admin"].includes(this.session?.role)}async _discard(e){if(!this._canDiscard(e)||this._discarding||this._loading)return;let t=this._key,n=this._controller.signal;this._discarding=e.id,this._error=null;try{let{confirmed:r}=await Hn({reviewTitle:Ae(e),signal:n});if(!r||n.aborted||t!==this._key||!this._canDiscard(e)||(await Qi(e.id,e.revision,this.session.csrfToken,n),t!==this._key||n.aborted))return;this._reviews=this._reviews.filter(s=>s.id!==e.id)}catch(r){t===this._key&&r.name!=="AbortError"&&(this._error=r.message)}finally{t===this._key&&(this._discarding=null)}}async _load(e=!1){let t=this._key;this._dismissLoading?.();let n=this._dismissLoading=Oe("Loading reviews\u2026",{duration:0});this._loading=!0,this._error=null;try{let{reviews:r,next:s}=await zd(e?this._next:null,this._controller.signal);if(t!==this._key)return;this._reviews=[...new Map([...e?this._reviews:[],...r].map(o=>[o.id,o])).values()],this._next=s}catch(r){t===this._key&&r.name!=="AbortError"&&(this._error=r.message)}finally{n(),t===this._key&&(this._loading=!1)}}_toggleDetails(e){let t=new Set(this._expanded);t.has(e)?t.delete(e):t.add(e),this._expanded=t}_details(e){let t=e.entries.filter(n=>n.status);return a`<section id="${`review-details-${e.id}`}" class="dependency-review-details" aria-label="${`Details for ${Ae(e)}`}">${e.comment?a`<div class="dependency-review-final-note" role="note" aria-label="Final note">${lt(e.comment)}</div>`:m} ${t.length>0?a`<ul class="dependency-review-entries">${t.map(n=>a`<li><span class="dependency-review-entry-file">${Ve(n.file)}<span>${n.file}</span></span> ${At(n.status)}<div>${lt(n.comment)}</div></li>`)}</ul>`:a`<p class="npm-review-muted">No file reviews yet.</p>`}</section>`}_row(e){let t=Fg(e),n=this._expanded.has(e.id),r=e.publishedAt!==null,s=new Set(e.entries.filter(u=>u.status).map(u=>u.file)).size,o=e.entries.filter(u=>u.status&&u.comment.trim()).length+ +!!e.comment.trim(),c=u=>{u.button===0&&!u.metaKey&&!u.ctrlKey&&!u.shiftKey&&!u.altKey&&me?.active&&(u.preventDefault(),di(e),me.navigate(t))};return a`<li class="${`dependency-review-row${n?" is-expanded":""}${e.revokedAt===null?"":" is-revoked"}`}"><div class="dependency-review-row-main"><button type="button" class="dependency-review-expand" aria-expanded="${n}" aria-controls="${`review-details-${e.id}`}" aria-label="${`${n?"Hide":"Show"} details for ${Ae(e)}`}" @click="${()=>this._toggleDetails(e.id)}">${xe}</button><div class="dependency-review-identity"><a class="dependency-review-title" href="${Jn(t)}" @click="${c}">${e.basePackage!==null&&e.basePackage!==e.package?a`<span>${e.basePackage} ${e.baseVersion} →</span>`:m} <strong>${e.package}</strong> <span>${e.basePackage===e.package?`${e.baseVersion} \u2192 `:""}${e.version}</span></a><div class="dependency-review-meta">${Dg(e.publishedAt??e.time)} ${r&&e.teams.length>0?a`<span class="dependency-review-teams">${e.teams.map(u=>u.name).join(", ")}</span>`:m} ${r&&o>0?a`<span class="dependency-review-note-count">${o} ${o===1?"note":"notes"}</span>`:m} ${e.revokedAt===null?m:ci(e)}</div></div><div class="dependency-review-result">${r?At(e.status):a`<span class="dependency-review-checked">${s} ${s===1?"file":"files"} checked</span>`} <span class="dependency-review-coverage">${r?a`${e.coverage==="full"?"Full":a`<span class="dependency-review-partial">Partial</span>`} · ${e.checkedFiles}/${e.totalFiles} files checked`:o?`${o} ${o===1?"note":"notes"}`:"No notes"}</span></div><div class="dependency-review-row-actions"><review-audit-copy .review="${e}"></review-audit-copy>${this._canDiscard(e)?a`<button type="button" class="dependency-review-discard" aria-label="Discard review" ?disabled="${this._loading||!!this._discarding}" @click="${()=>this._discard(e)}">${J(vi)}</button>`:m} <a class="dependency-review-open" href="${Jn(t)}" @click="${c}" aria-label="${`${r?"Open":"Continue"} review for ${Ae(e)}`}"><span aria-hidden="true">→</span></a></div></div>${n?this._details(e):m}</li>`}render(){let e=JSON.stringify([this.session?.id,this.session?.role]);return e!==this._key&&(this._controller.abort(),this._controller=new AbortController,this._key=e,this._reviews=[],this._next=null,this._discarding=null,this._expanded=new Set,this._load()),a`<section class="dependency-review-list"><header><h1>My reviews</h1></header><p>Your private work and the reviews you’ve shared with teams.</p>${this._error?a`<p role="alert">${this._error}</p>`:m} ${!this._loading&&!this._error&&this._reviews.length===0?a`<p>No reviews yet. Open a package’s Review tab to begin.</p>`:m} ${[["Drafts",!1],["Published reviews",!0]].map(([t,n])=>{let r=this._reviews.filter(s=>s.publishedAt!==null===n);return a`<section class="dependency-review-section"><h2>${t}<span class="npm-review-count">${r.length}</span></h2><ol>${r.map(s=>this._row(s))}</ol>${r.length===0&&!this._loading?a`<p class="npm-review-muted">${n?"No published reviews yet.":"No drafts."}</p>`:m}</section>`})} ${this._next?a`<button type="button" class="npm-review-button" ?disabled="${this._loading||!!this._discarding}" @click="${()=>this._load(!0)}">Load more</button>`:m}</section>`}};customElements.define("dependency-review-list",Io);var Fo=class extends U{static properties={review:{attribute:!1},_copied:{state:!0},_error:{state:!0}};createRenderRoot(){return this}disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this._timer)}async _copy(){let e=Sr(this.review);if(e!==null){this._error=!1;try{await navigator.clipboard.writeText(e),this._copied=!0,clearTimeout(this._timer),this._timer=setTimeout(()=>{this._copied=!1},2e3)}catch{this._error=!0}}}render(){return!this.review||Sr(this.review)===null?m:a`<button type="button" class="${`bundle-code-copy-path${this._copied?" copied":""}`}" aria-label="Copy audit Markdown" @click="${()=>this._copy()}">${Hi}</button> ${this._error?a`<span role="alert">Could not copy to the clipboard.</span>`:m}`}};customElements.define("review-audit-copy",Fo);var Do=class extends D{createRenderRoot(){return this}render(){return l.reports.length>0&&l.currentView==="findings"&&l.viewMode!=="graph"&&l.viewMode!=="kanban"?a`<button type="button" class="toolbar-export-btn" aria-label="Download or print report" @click="${this._onClick}">${iu}</button>`:m}_onClick=()=>{this.dispatchEvent(new CustomEvent("download-requested",{bubbles:!0,composed:!0}))}};customElements.define("download-button",Do);var He=class extends D{static styles=ut`.preview{position:fixed;inset:auto;margin:0;padding:14px;box-sizing:border-box;width:min(24rem,calc(100vw - 24px));max-height:calc(100vh - 24px);overflow:auto;border:1px solid var(--border);border-radius:var(--ui-radius, 10px);background:var(--bg);color:var(--text);box-shadow:0 8px 28px #00000040;font:13px/1.45 system-ui,sans-serif;text-align:left;white-space:normal;overflow-wrap:anywhere;letter-spacing:normal;cursor:default}.preview.wide{width:min(36rem,calc(100vw - 24px))}@media print{.preview{display:none}}`;constructor(){super(),this.showTimer=null,this.hideTimer=null}connectedCallback(){super.connectedCallback(),ht(this.renderRoot)}disconnectedCallback(){this._hidePreview(),super.disconnectedCallback()}updated(){let e=this.renderRoot.querySelector(".preview");e?e.matches(":popover-open")&&this._positionPreview():this._hidePreview()}_schedulePreview(){clearTimeout(this.hideTimer),clearTimeout(this.showTimer),this.renderRoot.querySelector(".preview")&&(this.showTimer=setTimeout(()=>{if(!this.isConnected)return;let e=this.renderRoot.querySelector(".preview");e&&(Ta(),e.showPopover(),this._positionPreview(),document.addEventListener("keydown",this._previewKeyDown,!0),window.addEventListener("scroll",this._previewScroll,!0),window.addEventListener("resize",this._hidePreview))},150))}_keepPreview(){clearTimeout(this.hideTimer)}_leavePreview(){clearTimeout(this.showTimer),clearTimeout(this.hideTimer),this.hideTimer=setTimeout(()=>{this.renderRoot.querySelector(".preview")?.contains(this.renderRoot.activeElement)||this._hidePreview()},150)}_hidePreview=()=>{clearTimeout(this.showTimer),clearTimeout(this.hideTimer);let e=this.renderRoot?.querySelector(".preview");e?.matches(":popover-open")&&e.hidePopover(),document.removeEventListener("keydown",this._previewKeyDown,!0),window.removeEventListener("scroll",this._previewScroll,!0),window.removeEventListener("resize",this._hidePreview)};_previewKeyDown=e=>{e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),this.renderRoot.querySelector(".preview")?.contains(this.renderRoot.activeElement)&&this.renderRoot.querySelector("[aria-details]").focus({preventScroll:!0}),this._hidePreview())};_previewScroll=e=>{e.composedPath().includes(this.renderRoot.querySelector(".preview"))||this._hidePreview()};_positionPreview(){let e=this.renderRoot.querySelector(".preview"),t=this.renderRoot.querySelector("[aria-details]").getBoundingClientRect(),{width:n,height:r}=e.getBoundingClientRect(),s=8,o=12,c=Math.max(o,Math.min(t.left,window.innerWidth-n-o)),u=t.bottom+s+r<=window.innerHeight-o?t.bottom+s:Math.max(o,t.top-s-r);e.style.left=`${c}px`,e.style.top=`${u}px`}};var Oo={open:"Open",draft:"Draft",closed:"Closed",merged:"Merged",completed:"Completed",not_planned:"Not planned",duplicate:"Duplicate",unknown:"Closed"},Og=a`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="4" cy="3" r="1.75"/><circle cx="4" cy="13" r="1.75"/><circle cx="12" cy="13" r="1.75"/><path d="M4 4.75v6.5M12 11.25V5a2 2 0 0 0-2-2H8m2-2L8 3l2 2"/></svg>`,Bg=a`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="8" cy="8" r="6.25"/><circle cx="8" cy="8" r="1.5" fill="currentColor" stroke="none"/></svg>`,Ng=a`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="8" cy="8" r="6.25"/><path d="m5 8 2 2 4-4"/></svg>`,zg=a`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="8" cy="8" r="6.25"/><path d="m3.5 12.5 9-9"/></svg>`,qg={completed:Ng,not_planned:zg},Bo=class extends He{static properties={url:{type:String},compact:{type:Boolean,reflect:!0}};static styles=[He.styles,ut`:host{display:inline;word-break:normal}a{color:var(--accent);text-decoration:none;overflow-wrap:anywhere;cursor:default}.status{display:inline-flex;align-items:center;gap:.3em;vertical-align:text-bottom;margin-right:.35em;font-weight:600;white-space:nowrap}svg{flex:none}.open{color:light-dark(#1a7f37,#3fb950)}.draft,.not_planned,.duplicate,.unknown,.unavailable{color:var(--muted)}.closed{color:light-dark(#d1242f,#f85149)}.merged,.completed{color:light-dark(#8250df,#a371f7)}:host(:not([compact])){display:block}:host(:not([compact])) .fix-link{display:flex;align-items:center;gap:.55rem;min-width:0}.link-icon{flex:none;line-height:1}.link-icon svg{display:block}.link-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text);font-weight:500;line-height:1.5}.link-icon.unavailable+.link-title{color:var(--accent)}.ref{min-width:0;max-width:32%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted);font-size:.74rem}.link-status{flex:none;padding:.15rem .4rem;border-radius:999px;background:color-mix(in srgb,currentColor 10%,transparent);font-size:.7rem;font-weight:500;line-height:1.3}:host([compact]){display:inline-flex}:host([compact]) .fix-link{display:inline-flex;align-items:center;justify-content:center;width:100%;height:100%}:host([compact]) .fix-link svg{width:14px;height:14px}:host([compact]) .status{margin:0;font-size:1rem;line-height:1}.preview-header{display:flex;align-items:center;justify-content:space-between;gap:12px}.preview-ref{display:inline-flex;align-items:center;gap:.4rem;min-width:0;color:var(--muted);font-size:12px;line-height:1.4}.preview-ref span{min-width:0}.preview-description{margin-top:8px;white-space:pre-wrap}.preview-title{margin-top:8px;font-size:15px;font-weight:600;line-height:1.4}.preview .preview-header .status{flex:none;margin:0;font-size:12px;line-height:1.4}@media print{:host(:not([compact])) .fix-link{display:block}.link-title,.ref{white-space:normal;overflow:visible;text-overflow:clip;max-width:none}.link-icon{display:inline-block;vertical-align:middle;margin-right:.55rem}.ref,.link-status{margin-left:.55rem}.preview{display:none}}`];constructor(){super(),this.url="",this.compact=!1,this.unsubscribe=null}connectedCallback(){super.connectedCallback(),this.unsubscribe=Pl(()=>this.requestUpdate()),this.hasUpdated&&this.requestUpdate()}disconnectedCallback(){this.unsubscribe?.(),this.unsubscribe=null,super.disconnectedCallback()}updated(e){e.has("url")||e.has("compact")?this._hidePreview():super.updated(e)}render(){if(!wi(this.url))return a`${this.url}`;let e=Rl(this.url),t=!e&&Ll(this.url),n=e||t,r=Ml.read(this.url);if(!r&&!n){let p=`Open fix link: ${this.url}`;return a`<a class="${this.compact?"fix-link":""}" href="${this.url}" target="_blank" rel="noopener noreferrer" draggable="false" data-tooltip="${this.compact?p:m}" aria-label="${p}">${this.compact?a`<slot></slot>`:this.url}</a>`}let s=r?t&&r.status==="closed"?r.stateReason??"unknown":r.status:"unavailable",o=e?Og:t?qg[s]??Bg:null,c=n?`${n.repo}#${n.number}`:"",u=(r?.title.length??0)>40||(r?.description??"").split(/[\r\n]/u).some(p=>p.length>100),d=r?`${Oo[s]} ${e?"pull request":"issue"}: ${r.title} (${c})`:n?`Open ${e?"pull request":"issue"}: ${c}`:`Open fix link: ${this.url}`;return a`<a class="fix-link" href="${this.url}" target="_blank" rel="noopener noreferrer" draggable="false" aria-label="${d}" aria-details="${this.compact&&n?"fix-preview":m}" data-tooltip="${this.compact&&!n?d:m}" @mouseenter="${this._schedulePreview}" @mouseleave="${this._leavePreview}" @focus="${this._schedulePreview}" @blur="${this._leavePreview}" @click="${this._hidePreview}">${this.compact?o?a`<span class="${`status ${s}`}">${o}</span>`:a`<slot></slot>`:a`${o?a`<span class="${`link-icon ${s}`}">${o}</span>`:m} <span class="link-title">${r?.title??(c||this.url)}</span> ${r?a`<span class="ref">${c}</span><span class="${`link-status ${s}`}">${Oo[s]}</span>`:m}`} </a>${this.compact&&n?a`<a class="${u?"preview wide":"preview"}" id="fix-preview" popover="manual" href="${this.url}" target="_blank" rel="noopener noreferrer" draggable="false" aria-label="${`Open ${e?"pull request":"issue"} ${c} on GitHub`}" @mouseenter="${this._keepPreview}" @mouseleave="${this._leavePreview}" @focusin="${this._keepPreview}" @focusout="${this._leavePreview}" @click="${p=>{p.stopPropagation(),this._hidePreview()}}"><div class="preview-header"><span class="preview-ref">${J(bi)}<span>${c}</span></span> <span class="${`status ${s}`}">${o}${r?Oo[s]:e?"Pull request":"Issue"}</span></div>${r?a`<div class="preview-title">${r.title}</div>`:m} ${r?.description?a`<div class="preview-description">${r.description}</div>`:m}</a>`:m}`}};customElements.define("managed-fix-link",Bo);var No=class extends He{static properties={finding:{attribute:!1},comment:{type:String}};static styles=[He.styles,M(Ei),ut`:host{display:inline-flex}:host([hidden]){display:none!important}button{border:0;padding:0;background:none;color:inherit;font:inherit;cursor:default}.preview-trigger{display:inline-flex;align-items:center;justify-content:center;line-height:0}.preview-trigger:hover{color:var(--accent)}.managed-comment+.managed-comment{margin-top:12px;padding-top:12px;border-top:1px solid var(--border)}.comment-body{white-space:pre-wrap}.comment-body a{color:var(--accent);text-decoration:none}.comment-body a:hover{text-decoration:underline}.preview-footer{display:flex;justify-content:flex-end;margin-top:8px}.edit-hint{color:var(--muted);font-size:12px}.edit-hint:hover{color:var(--accent)}`];constructor(){super(),this.finding=null,this.comment="",this.unsubscribe=null}connectedCallback(){super.connectedCallback(),this._subscribe(),document.addEventListener("managed-comments-reset",this._resetComments),this.hasUpdated&&this.requestUpdate()}disconnectedCallback(){this.unsubscribe?.(),this.unsubscribe=null,document.removeEventListener("managed-comments-reset",this._resetComments),super.disconnectedCallback()}updated(e){this.hidden=!this.renderRoot.querySelector(".preview"),e.has("finding")&&(this._hidePreview(),this._subscribe()),super.updated(e)}_subscribe(){this.unsubscribe?.(),this.unsubscribe=this.finding?.id?bc(this.finding.id,()=>this.requestUpdate()):null}_resetComments=()=>{this._hidePreview(),this.requestUpdate()};_previewClick(e){if(e.target.closest("a, button")){this._hidePreview();return}window.getSelection?.()?.toString()||(e.stopPropagation(),this.renderRoot.querySelector(".preview-trigger").click())}render(){let e=H(),t=e?vc(this.finding):[];if(!(e?t.length>0:!!this.comment))return m;let s=(e?t.map(o=>o.body):[this.comment]).some(o=>o.split(/[\r\n]/u).some(c=>c.length>100));return a`<button type="button" class="preview-trigger mark-comment" aria-label="${e?"View comments":"Edit comment"}" aria-details="comment-preview" @mouseenter="${this._schedulePreview}" @mouseleave="${this._leavePreview}" @focus="${this._schedulePreview}" @blur="${this._leavePreview}" @click="${this._hidePreview}"><slot></slot></button><div class="${s?"preview wide":"preview"}" id="comment-preview" popover="manual" role="region" aria-label="${e?"Comments":"Comment"}" @mouseenter="${this._keepPreview}" @mouseleave="${this._leavePreview}" @focusin="${this._keepPreview}" @focusout="${this._leavePreview}" @click="${this._previewClick}">${e?t.map(o=>Ma(o,ur(o.body))):a`<div class="comment-body">${ur(this.comment)}</div><div class="preview-footer"><button type="button" class="mark-comment edit-hint">Edit</button></div>`}</div>`}};customElements.define("comment-preview",No);function Ph(i){if(va(i))throw new Error("This is a links file, not a report. Wrap report rows in a groups or findings object to compare them.");let e=i;try{let c=JSON.parse(i);Array.isArray(c)&&(e=JSON.stringify({groups:c}))}catch{}let{data:t,reason:n}=ua(e);if(!t)throw new Error(n);let r=[],s=new Map,o=0;for(let c of da(t)){let u=new Set;for(let d of Array.isArray(c)?c:[c])if(!(!d||typeof d!="object"||Array.isArray(d))){if(typeof d.id!="string"||!d.id){o++;continue}u.add(d.id),s.has(d.id)||s.set(d.id,[]),s.get(d.id).push(d)}r.push([...u].toSorted())}return{rows:r,byId:s,missingIds:o}}function Hg(i){let e=new Set;for(let t of i){let n=[...new Set(t)].toSorted();for(let r=0;r<n.length;r++)for(let s=r+1;s<n.length;s++)e.add(JSON.stringify([n[r],n[s]]))}return e}function Lh(i){let e=new Map,t=r=>{let s=r;for(;e.get(s)!==s;)e.set(s,e.get(e.get(s))),s=e.get(s);return s};for(let r of i){let[s,o]=JSON.parse(r);for(let c of[s,o])e.has(c)||e.set(c,c);e.set(t(s),t(o))}let n=new Map;for(let r of[...e.keys()].toSorted()){let s=t(r);n.has(s)||n.set(s,[]),n.get(s).push(r)}return[...n.values()].toSorted((r,s)=>r[0].localeCompare(s[0]))}function Ie(i,e,t){let n=(i.byId.get(e)??[]).map(r=>t==="verdict"?la(r)||null:t==="severity"?oa(r)??null:t==="originalSeverity"?r.severity??null:t==="confidence"&&Number.isFinite(r.confidence)?r.confidence:null);return[...new Set(n)].toSorted((r,s)=>String(r).localeCompare(String(s),void 0,{numeric:!0}))}var Mh=(i,e)=>i.length===e.length&&i.every((t,n)=>t===e[n]),Un=(i,e)=>[...i].filter(t=>!e.has(t)).toSorted();function Ah(i,e){let t=new Set(i.byId.keys()),n=new Set(e.byId.keys()),r=[...t].filter(v=>n.has(v)).toSorted(),s=new Set(r),o=v=>Hg(v.rows.map(g=>g.filter(y=>s.has(y)))),c=o(i),u=o(e),d={confirmed:[],refuted:[],otherVerdicts:[],confidence:[],severity:[]};for(let v of r)for(let g of["verdict","confidence","severity"]){let y=Ie(i,v,g),k=Ie(e,v,g),_={id:v,before:y,after:k};if(g==="severity"&&(_.originalBefore=Ie(i,v,"originalSeverity"),_.originalAfter=Ie(e,v,"originalSeverity")),Mh(y,k)&&(g!=="severity"||Mh(_.originalBefore,_.originalAfter)))continue;if(g!=="verdict"){d[g].push(_);continue}let x=k.length===1&&k[0]==="confirmed"?"confirmed":k.length===1&&k[0]==="refuted"?"refuted":"otherVerdicts";d[x].push(_)}let p=Lh(Un(u,c)),h=Lh(Un(c,u)),f=Un(n,t),b=Un(t,n);return{before:i,after:e,added:f,removed:b,shared:r,joined:p,split:h,...d,unchanged:f.length===0&&b.length===0&&p.length===0&&h.length===0&&Object.values(d).every(v=>v.length===0)}}var Ih=`dialog{width:min(94vw,1180px);max-width:1180px;height:min(88dvh,960px);max-height:92dvh;margin-block:auto;padding:0;overflow:hidden;background:var(--theme-bar)}dialog[open]{display:flex;flex-direction:column}header{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:1.1rem 1.3rem}header h3{margin-bottom:.25rem;font-size:1.1rem}header p,.muted,.note,.empty{color:var(--muted);font-size:.78rem;line-height:1.5}button,select,input{font:inherit;font-size:.8rem}button,select,.file-button,.search{color:var(--text);background:var(--surface);border:1px solid var(--border);border-radius:var(--ui-radius, 6px);padding:.45rem .65rem}button:not(:disabled):hover,.file-button:hover{background:var(--surface-active)}button:disabled{opacity:.45}button:focus-visible,select:focus-visible,.search:focus-visible,.file-button:focus-within{outline:2px solid var(--accent);outline-offset:2px}.pickers{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:start;gap:1rem;padding:0 1.3rem 1rem;border-bottom:1px solid var(--border)}.picker{min-width:0}.picker>label{display:block;font-size:.72rem;font-weight:600;margin-bottom:.4rem;color:var(--muted)}.picker select{width:100%;text-overflow:ellipsis}.file-picker{display:flex;align-items:center;flex-wrap:wrap;gap:.6rem;margin-top:.55rem}.file-button{position:relative;display:inline-block;font-size:.74rem;padding:.3rem .5rem;overflow:hidden}.file-button input{position:absolute;inset:0;opacity:0;width:100%}.swap{align-self:start;margin-top:1.5rem;font-size:1rem}.results{overflow:auto;min-height:0;padding:1.1rem 1.3rem 1.4rem}.summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.65rem}.summary>div{display:flex;flex-direction:column;gap:.35rem;padding:.8rem 1rem;background:var(--bg);border:1px solid var(--border);border-radius:var(--ui-radius, 7px)}.summary span{font-size:.72rem;color:var(--muted)}.summary strong{font-size:1.15rem;font-variant-numeric:tabular-nums}.positive h4{color:var(--green)}.negative h4,.verdict-confirmed h4,.summary .verdict-confirmed strong{color:var(--critical)}.verdict-refuted h4,.summary .verdict-refuted strong{color:var(--muted)}.change-counts{display:flex;flex-wrap:wrap;gap:.4rem;margin-top:.7rem}.change-counts span{font-size:.7rem;padding:.3rem .5rem;border-radius:5px;background:var(--bg);color:var(--muted)}.results-head{display:flex;align-items:center;flex-wrap:wrap;gap:.75rem;margin-block:1rem}.results-head p{flex:1;font-size:.78rem;color:var(--muted);overflow-wrap:anywhere}.search{width:min(100%,17rem)}.section-title{margin:1.2rem 0 .5rem;font-size:.87rem}.note{margin:-.15rem 0 .6rem}.columns{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.8rem}.change-section{border:1px solid var(--border);border-radius:var(--ui-radius, 7px);overflow:hidden;margin-bottom:.6rem}.change-section h4{display:flex;justify-content:space-between;align-items:center;gap:.5rem;font-size:.78rem;font-weight:600;padding:.65rem .8rem;background:var(--bg)}.count{font-variant-numeric:tabular-nums;font-size:.7rem}ul{list-style:none}li{border-top:1px solid var(--border);padding:.7rem .8rem}.change-row{display:flex;justify-content:space-between;align-items:start;gap:.8rem}.finding{display:flex;flex-direction:column;gap:.2rem;min-width:0;overflow-wrap:anywhere}.finding strong{font-size:.77rem;font-weight:500;line-height:1.4}.finding code,.finding small{color:var(--muted);font-size:.66rem;line-height:1.4}.change-value{display:flex;align-items:center;justify-content:end;flex-wrap:wrap;gap:.3rem;max-width:48%;flex-shrink:0;font-size:.73rem;text-align:end;overflow-wrap:anywhere}.from{color:var(--muted)}.change-value small{width:100%;color:var(--muted);font-size:.67rem}.group-members{display:flex;flex-direction:column;gap:.55rem}.group-shape{display:flex;flex-wrap:wrap;gap:.45rem;margin-top:.7rem;font:.66rem/1.5 monospace;overflow-wrap:anywhere}.group-shape>span{min-width:0}.empty{padding:.7rem .8rem}.more{margin:.5rem .8rem .7rem;font-size:.72rem}.placeholder{padding:4rem 1rem;text-align:center;color:var(--muted);font-size:.85rem}.identical{color:var(--green);font-size:.82rem;padding-block:.5rem}.error,.warning{font-size:.75rem;line-height:1.5;margin-top:.5rem;overflow-wrap:anywhere}.error{color:var(--critical)}.warning{color:var(--yellow)}dialog>.error{padding:0 1.3rem .6rem}@media(width<=650px){.pickers{gap:.5rem;padding-inline:.8rem}.columns{grid-template-columns:minmax(0,1fr);gap:0}.summary{grid-template-columns:repeat(2,minmax(0,1fr))}.summary>div{padding:.6rem}.results-head p{flex-basis:100%}.search{width:100%}header,.results{padding-inline:.8rem}.change-row{flex-wrap:wrap}.change-value{max-width:100%}}
|
|
101
|
+
`;var zo=()=>({key:"",name:"",report:null,error:"",loading:!1}),ct=(i,e)=>i.map(t=>t===null?"Not supplied":e==="confidence"?`${t}/10`:String(t).replaceAll("_"," ")).join(" / "),qo=50,Ho=class extends q{static styles=[...q.styles,M(Ih)];static properties={_names:{state:!0},_sides:{state:!0},_catalogError:{state:!0},_catalogLoading:{state:!0},_diff:{state:!0},_query:{state:!0},_limits:{state:!0}};constructor(){super(),this._names=[],this._sides=[zo(),zo()],this._tokens=[0,0],this._catalogError="",this._catalogLoading=!0,this._diff=null,this._query="",this._limits={}}beforeOpen(){this._loadCatalog()}focusInitial(){this.renderRoot.querySelector("select")?.focus()}async _loadCatalog(){try{let e=await gt();if(this._settled)return;this._names=e.filter(r=>cl(r)!==ba);let t=this._names.includes(l.currentFile)?l.currentFile:this._names[0];t&&!this._tokens[0]&&this._select(0,t);let n=this._names.find(r=>r!==t);n&&!this._tokens[1]&&this._select(1,n)}catch(e){this._settled||(this._catalogError=`Couldn't list saved reports: ${e.message}`)}finally{this._settled||(this._catalogLoading=!1)}}_setSide(e,t){this._sides=this._sides.map((s,o)=>o===e?t:s),this._limits={};let[n,r]=this._sides.map(s=>s.report);this._diff=n&&r?Ah(n,r):null}async _select(e,t,n){let r=++this._tokens[e],s={...zo(),key:n?"":t,name:t,loading:!!t};if(this._setSide(e,s),!!t)try{let o=n?await n.text():await rl(t);if(this._settled||this._tokens[e]!==r)return;this._setSide(e,{...s,loading:!1,report:Ph(o)})}catch(o){!this._settled&&this._tokens[e]===r&&this._setSide(e,{...s,loading:!1,error:`Couldn't read ${t}: ${o.message}`})}}_file(e,t){let n=t.target.files?.[0];t.target.value="",n&&this._select(e,n.name,n)}_swap(){this._sides.some(e=>e.loading)||(this._tokens=this._tokens.map(e=>e+1),this._sides=this._sides.toReversed(),this._setSide(0,this._sides[0]))}_picker(e){let t=this._sides[e],n=e===0?"Before":"After";return a`<section class="picker"><label for="${`report-${e}`}">${n}</label> <select id="${`report-${e}`}" @change="${r=>this._select(e,r.target.value)}"><option value="" .selected="${!t.key}">${t.name&&!t.key?t.name:"Choose a saved report\u2026"}</option>${this._names.map(r=>a`<option value="${r}" .selected="${t.key===r}">${r}</option>`)}</select><div class="file-picker"><label class="file-button">Open file…<input type="file" accept=".json,.md,.markdown" aria-label="${`Open ${n.toLowerCase()} report file`}" @change="${r=>this._file(e,r)}"></label> <span class="muted">${t.loading?"Reading report\u2026":t.report?`${t.report.byId.size.toLocaleString()} unique findings`:"JSON or Markdown"}</span></div>${t.error?a`<p class="error" role="alert">${t.error}</p>`:m} ${t.report?.missingIds?a`<p class="warning">${t.report.missingIds} findings without an id excluded.</p>`:m}</section>`}_finding(e){let t=this._diff.after.byId.get(e)?.[0]??this._diff.before.byId.get(e)?.[0];return a`<span class="finding"><strong>${Bt(t)||e}</strong><code>${e}</code>${t.file?a`<small>${t.file}</small>`:m}</span>`}_matches(e){let t=this._query.trim().toLowerCase();if(!t)return!0;let n=[...this._diff.before.byId.get(e)??[],...this._diff.after.byId.get(e)??[]];return[e,...n.flatMap(r=>[Bt(r),r.file])].filter(Boolean).some(r=>r.toLowerCase().includes(t))}_section(e,t,n,r,s=""){let o=n.filter(u=>(Array.isArray(u)?u:[u.id??u]).some(d=>this._matches(d))),c=this._limits[e]??qo;return a`<section class="${`change-section ${s}`}" aria-label="${t}"><h4>${t}<span class="count">${this._query.trim()?`${o.length} / `:""}${n.length}</span></h4>${o.length>0?a`<ul>${o.slice(0,c).map(r)}</ul>`:a`<p class="empty">${n.length>0?"No matching findings.":"No changes."}</p>`} ${o.length>c?a`<button class="more" @click="${()=>{this._limits={...this._limits,[e]:c+qo}}}">Show ${Math.min(qo,o.length-c)} more (${o.length-c} remaining)</button>`:m}</section>`}_changeRow(e,t){let n=t==="severity"&&JSON.stringify(e.originalBefore)!==JSON.stringify(e.originalAfter);return a`<li class="change-row">${this._finding(e.id)}<span class="change-value"> <span class="from">${ct(e.before,t)}</span><span aria-label="to">→</span><span>${ct(e.after,t)}</span> ${n?a`<small>Original: ${ct(e.originalBefore)} → ${ct(e.originalAfter)}</small>`:m}</span></li>`}_presenceRow(e,t){let n=ct(Ie(t,e,"verdict"));return a`<li class="change-row">${this._finding(e)}<span class="change-value"> <span>${ct(Ie(t,e,"severity"))}</span><span>${ct(Ie(t,e,"confidence"),"confidence")}</span> ${n==="Not supplied"?m:a`<small>${n}</small>`}</span></li>`}_groupRow(e){let t=new Set(e),n=r=>r.rows.map(s=>s.filter(o=>t.has(o))).filter(s=>s.length).map(s=>s.join(", ")).filter((s,o,c)=>c.indexOf(s)===o).join(" | ");return a`<li class="group-row"><div class="group-members">${e.map(r=>this._finding(r))}</div><div class="group-shape"><span class="from">${n(this._diff.before)}</span><span aria-label="to">→</span><span>${n(this._diff.after)}</span></div></li>`}_verdictCount(e,t){return[...e.byId.keys()].filter(n=>Ie(e,n,"verdict").includes(t)).length}_results(){let e=this._diff;return e?a`<div class="summary" aria-label="Comparison summary"><div><span>Unique findings</span><strong>${e.before.byId.size} → ${e.after.byId.size}</strong></div><div><span>In common</span><strong>${e.shared.length}</strong></div><div class="verdict-confirmed"><span>Confirmed</span><strong>${this._verdictCount(e.before,"confirmed")} → ${this._verdictCount(e.after,"confirmed")}</strong></div><div class="verdict-refuted"><span>Refuted</span><strong>${this._verdictCount(e.before,"refuted")} → ${this._verdictCount(e.after,"refuted")}</strong></div></div><div class="change-counts" aria-label="Change counts"><span>${e.added.length} added</span><span>${e.removed.length} removed</span> <span>${e.joined.length} joined</span><span>${e.split.length} split</span> <span>${e.confidence.length} confidence</span><span>${e.severity.length} severity</span></div><div class="results-head"><p>Changes from <strong>${this._sides[0].name}</strong> to <strong>${this._sides[1].name}</strong>.</p><input class="search" type="search" aria-label="Filter comparison findings" placeholder="Filter by id, title or file…" .value="${this._query}" @input="${t=>{this._query=t.target.value,this._limits={}}}"></div>${e.shared.length===0&&(e.before.missingIds||e.after.missingIds)?a`<p class="warning" role="status">No shared ids to compare. Findings without ids cannot be matched.</p>`:e.unchanged?a`<p class="identical" role="status">No differences in finding ids, grouping, verdicts, confidence or severity.</p>`:m}<h3 class="section-title">Findings</h3><div class="columns">${this._section("added","Added",e.added,t=>this._presenceRow(t,e.after),"positive")} ${this._section("removed","Removed",e.removed,t=>this._presenceRow(t,e.before),"negative")}</div><h3 class="section-title">Revalidation</h3><p class="note">Changed verdicts for shared ids, grouped by the after report’s verdict.</p><div class="columns">${this._section("confirmed","Confirmed",e.confirmed,t=>this._changeRow(t,"verdict"),"verdict-confirmed")} ${this._section("refuted","Refuted",e.refuted,t=>this._changeRow(t,"verdict"),"verdict-refuted")}</div>${e.otherVerdicts.length>0?this._section("other","Other verdict changes",e.otherVerdicts,t=>this._changeRow(t,"verdict")):m}<h3 class="section-title">Grouping</h3><p class="note">Only shared ids. Each cluster connects changed pairs; added or removed findings do not count as regrouping.</p><div class="columns">${this._section("joined","Joined",e.joined,t=>this._groupRow(t),"positive")} ${this._section("split","Split",e.split,t=>this._groupRow(t),"negative")}</div><h3 class="section-title">Ratings</h3><p class="note">Shared ids only. Severity includes report corrections; changes to original severity are also shown.</p><div class="columns">${this._section("confidence","Confidence changes",e.confidence,t=>this._changeRow(t,"confidence"))} ${this._section("severity","Severity changes",e.severity,t=>this._changeRow(t,"severity"))}</div>`:a`<p class="placeholder" role="status">${this._sides.some(t=>t.loading)||this._catalogLoading?"Loading reports\u2026":"Choose two saved reports or open two files to compare."}</p>`}render(){return a`<dialog aria-labelledby="compare-title" @close="${this._onClose}"><header><div><h3 id="compare-title">Compare reports</h3><p>Compare findings, grouping and ratings between two reports.</p></div><button aria-label="Close report comparison" @click="${this._onClose}">Close</button></header><div class="pickers">${this._picker(0)}<button class="swap" aria-label="Swap before and after reports" ?disabled="${this._sides.some(e=>e.loading)}" @click="${this._swap}">⇄</button>${this._picker(1)}</div>${this._catalogError?a`<p class="error" role="alert">${this._catalogError} You can still open files directly.</p>`:m}<div class="results">${this._results()}</div></dialog>`}};customElements.define("report-compare-dialog",Ho);function Fh(){if(H())throw new Error("Report comparison is available in local/E2E mode.");return Y("report-compare-dialog")}function pi(i){let e=new Map;for(let[t,n]of l.triage)n[i]&&e.set(t,n[i]);return e}var jg={get markers(){return pi("color")},get triageState(){return pi("triage")},get comments(){return pi("comment")},get fixes(){return pi("fix")},get flags(){return pi("flagged")},get(i){let e=l.triage.get(i),t={};return e?.color&&(t.color=e.color),e?.triage&&(t.triage=e.triage),e?.comment&&(t.comment=e.comment),e?.fix&&(t.fix=e.fix),e?.flagged!==void 0&&(t.flagged=e.flagged),t},async set(i,{color:e,triage:t,comment:n,fix:r,flagged:s}={}){if(Ut())throw new Error("DeepView.triage.set: triage is read-only on this page");let o=!1;if(e!==void 0&&(e===null||e===""?X(l.triage,i,{color:void 0})&&(o=!0):l.triage.get(i)?.color!==e&&(X(l.triage,i,{color:e}),o=!0)),t!==void 0)if(t===null||t===""||t===!1)X(l.triage,i,{triage:void 0})&&(o=!0);else if(t==="inprogress"||t==="fixed"||t==="invalid"||t==="deleted"||t==="ignored")l.triage.get(i)?.triage!==t&&(X(l.triage,i,{triage:t}),o=!0);else throw new TypeError(`DeepView.triage.set: unknown triage value ${JSON.stringify(t)} (expected 'inprogress' | 'fixed' | 'invalid' | 'deleted' | 'ignored' | null)`);if(n!==void 0){let c=n?String(n):"";c?l.triage.get(i)?.comment!==c&&(X(l.triage,i,{comment:c}),o=!0):X(l.triage,i,{comment:void 0})&&(o=!0)}if(r!==void 0){let c=r?String(r):"";c?l.triage.get(i)?.fix!==c&&(X(l.triage,i,{fix:c}),o=!0):X(l.triage,i,{fix:void 0})&&(o=!0)}if(s!==void 0){let c=s===null||s===""?void 0:!!s;l.triage.get(i)?.flagged!==c&&(X(l.triage,i,{flagged:c}),o=!0)}return o&&(await ke(),$()),o}};window.DeepView={get reports(){return l.reports.slice()},get groups(){return Vt()},get findings(){return Vt().flat()},get currentFile(){return l.currentFile},get currentWorkspace(){return l.currentWorkspace},triage:jg,forceManagedMode:jd,setTheme:Ju,get theme(){return Xu()},triageSync:Fi,refresh(){$()},export(){return op()},compareReports(){return Fh()}};var Vg={default:Je.default,"claude-security":Je["claude-security"],"codex-security":Je["codex-security"],deepsec:Je.deepsec,piolium:Je.piolium,"markdown-generic":Je["markdown-generic"],bundle:Qo,workspace:Zo,links:gi,github:bi};for(let i of document.querySelectorAll(".drop-supported-icon[data-icon]")){let e=Vg[i.dataset.icon];e&&(i.innerHTML=e)}Sl($);fl($);xl($);Fi.onStatusChange($);kl(async(i,e)=>{l.currentWorkspace===i?await it(i):l.currentFile&&l.currentFile===e?await tt(e):await fe()});$l(async()=>{await fe(),l.currentView==="bundles"&&$()});Gd();Yd();async function Bh(){let i=wl();if(!i)return!1;try{history.replaceState(null,"",location.pathname)}catch{}let e;try{e=await Xd({encoded:i})}catch(n){return alert(`Couldn't open the share-link unlock prompt: ${n.message}`),!1}if(!e)return!1;let t=await ul({id:e.id,name:e.name,privateKey:e.privateKeyBase64});if(t.status==="already-attached")return alert(`This workspace is already attached as "${t.workspace.name}".`),!1;if(t.status==="name-collision"){let n=t.existing?.name;return alert(n?`A workspace named "${n}" already exists. Open the share link again and pick a different name.`:"The shared workspace name is empty or invalid. Ask the sender to re-share with a real name."),!1}return t.workspace?.id?await it(t.workspace.id):await fe(),!0}async function Nh(){let i=ga();if(!i)return!1;try{history.replaceState(null,"",location.pathname)}catch{}let e=await Ud(i);return e.ok?!0:(alert(e.reason),!1)}var It=!1;async function zh(){if(await St(),!It&&!(!H()&&we()&&!Ye())){It=!0;try{await Kg()}finally{Ca.hidden=!1}}}async function Kg(){let i=cr(),e=()=>i===cr()&&!H();if(H()){await fe();return}if(await Qa(),!e()||(dl(),await Promise.all([fe(),ml().catch(s=>console.warn("initial linked findings:",s))]),!e())||await Bh()||!e()||await Nh()||!e())return;let r=Xa(vd);if(r)if(r.startsWith("wbs:")||r.startsWith("wrs:"))await Xi(r.slice(4),r.startsWith("wrs:")?"reports":"bundles");else if(r.startsWith("ws:")){let s=r.slice(3);he().some(o=>o.id===s)&&await it(s)}else if(r.startsWith("b:")){let s=r.slice(2),o=s.indexOf(" "),c=o>=0?s.slice(0,o):s,u=o>=0?s.slice(o+1):"",d=ki.has(u)?u:"overview";if((l.bundles??[]).some(p=>p.integrity===c)){let p=he().filter(h=>h.bundles.includes(c));Kt(c,d,{workspaceId:p.length===1?p[0].id:null}),$(),wt(c),await fe()}}else{let s=await gt();if(!e())return;let o=gl(r);o&&s.includes(o.name)&&await tt(o.name,void 0,{workspaceId:o.workspaceId})}}var jn=!1,Dh=!1;document.addEventListener("managed-client-mode-change",()=>{jn=!H()&&we()});function Oh(i){Dh||(Dh=!0,queueMicrotask(()=>{alert(i+" This tab will reload to refresh its state. Any unsaved edits in this tab will be lost."),location.reload()}))}Pi(async()=>{if(await St(),H()){$();return}let i=jn,e=we();if(jn=e,$(),!It&&Ye()){zh().catch(t=>console.warn("continueBoot:",t));return}if(It&&e&&!Ye()){Oh("Encryption was just enabled in another tab.");return}It&&i&&!e&&!Ga()&&Oh("Encryption was disabled in another tab.")});window.addEventListener("hashchange",()=>{!It||H()||(async()=>{await Bh()||await Nh()})().catch(i=>console.warn("deep-link hashchange:",i))});(async()=>{if(!await Jd()){await St(),jn=!H()&&we();try{let i=window.matchMedia?.("(display-mode: window-controls-overlay)"),e=()=>{let r=!1;try{r=localStorage.getItem("deepview.sidebarCollapsed")==="1"}catch{}Ea.classList.toggle("collapsed",r&&!i?.matches)};e(),i?.addEventListener("change",e);let t=i?.matches;if(window.matchMedia?.("(display-mode: standalone)").matches||t){let r=document.querySelector('meta[name="viewport"]');r&&r.setAttribute("content","width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"),window.addEventListener("wheel",s=>{(s.ctrlKey||s.metaKey)&&s.preventDefault()},{passive:!1}),window.addEventListener("keydown",s=>{(s.ctrlKey||s.metaKey)&&(s.key==="="||s.key==="+"||s.key==="-"||s.key==="0")&&s.preventDefault()})}}catch{}!H()&&we()&&!Ye()||await zh()}})();
|
|
102
102
|
/*! Bundled license information:
|
|
103
103
|
|
|
104
104
|
lit-html/static.js:
|