@preventive/triage 1.0.0-alpha.38 → 1.0.0-alpha.39
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/out/{chunk-FU4MTW7F.js → chunk-45WIN3SW.js} +1 -1
- package/out/{chunk-6Z5XLSPJ.js → chunk-6C76GAXK.js} +1 -1
- package/out/{chunk-5FKRIJGF.js → chunk-7ZKDKGAH.js} +1 -1
- package/out/{chunk-BJKRVROW.js → chunk-JVBB4LZX.js} +1 -1
- package/out/{chunk-DCQX2J3C.js → chunk-QSLWGJBQ.js} +52 -52
- package/out/{chunk-JAKWIZWL.js → chunk-XNGEQO7Y.js} +1 -1
- package/out/chunk-XRWAV3DX.js +7 -0
- package/out/{chunk-SD2WJAXN.js → chunk-XYDGU6BM.js} +13 -10
- package/out/client-managed.js +11 -11
- package/out/client-sync.js +1 -1
- package/out/graph.js +1 -1
- package/out/index.html +5 -5
- package/out/view.js +2 -2
- package/package.json +2 -1
- package/risk/files/readability.js +7 -0
- package/risk/files/runs-code.js +31 -2
- package/risk/files/script.js +6 -4
- package/risk/npm/assess.js +1 -1
- package/risk/npm/compare.js +10 -4
- package/risk/npm/install-scripts.js +3 -2
- package/server-managed/bundle-advisories.ts +6 -1
- package/server-managed/github-app.ts +9 -3
- package/server-managed/github-errors.ts +21 -2
- package/server-managed/http.ts +11 -3
- package/server-managed/repository-risk.ts +9 -4
- package/out/chunk-BYUEDJOM.js +0 -7
- /package/out/{chunk-OJ5DGP5E.js → chunk-TINZZKP5.js} +0 -0
package/out/client-sync.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as sr,b as ar,c as cr,d as lr,e as ur,f as fr,g as he,p as dr,u as Xt,v as gr}from"./chunk-BYUEDJOM.js";import{a as De,b as Oe,d as tr,e as je,f as ge,g as nr,h as rr}from"./chunk-W4J3MGLB.js";import{a as Yt}from"./chunk-GJ4IUCNS.js";import{a as or,b as ir}from"./chunk-PNHBZGDD.js";import{a as oe,c as We}from"./chunk-TUII34K2.js";import"./chunk-OOJM4CTU.js";function Zt(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}var bt=e=>e?`"${e}" `:"";function vt(e,t=""){if(typeof e!="boolean")throw new TypeError(bt(t)+"expected boolean, got type="+typeof e);return e}function Ce(e,t=""){if(typeof e!="number")throw new TypeError(bt(t)+"expected number, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError(bt(t)+"expected integer >= 0, got "+e);return e}function X(e,t,n=""){if(Zt(e)&&(t===void 0||e.length===t))return e;t!==void 0&&Ce(t,"length");let r=Zt(e),o=t!==void 0?` of length ${t}`:"",i=r?`length=${e.length}`:`type=${typeof e}`,s=bt(n)+"expected Uint8Array"+o+", got "+i;throw r?new RangeError(s):new TypeError(s)}var pr=(e,t)=>{if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(t==="object"?"expected valid options object":`"${t}" expected object, got type=${typeof e}`)};function Qt(e,t=!0){if(e.destroyed)throw new Error("hash was destroyed");if(t&&e.finished)throw new Error("digest() was already called")}function yr(e,t){X(e,void 0,"output");let n=t.outputLen;if(!(e.length>=n))throw new RangeError('"output" expected length >= '+n)}function be(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function me(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Mo(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}var Ae=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Uo(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Ko(e){for(let t=0;t<e.length;t++)e[t]=Uo(e[t]);return e}var ke=Ae?e=>e:Ko;function No(e,t){return!e.byteLength||!t.byteLength?!1:e.buffer===t.buffer&&e.byteOffset<t.byteOffset+t.byteLength&&t.byteOffset<e.byteOffset+e.byteLength}function hr(e,t){if(No(e,t)&&e.byteOffset<t.byteOffset)throw new Error("complex overlap of input and output is not supported")}function mr(e,t){return pr(e,"defaults"),pr(t,"opts"),Object.assign(e,t)}function wr(e,t){if(e=X(e),t=X(t),e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function br(e,t,n){let r=t,o=n||(()=>[]),i=(a,u)=>r(u,...o(a)).update(a).digest(),s=r(new Uint8Array(e),...o(new Uint8Array(0)));return i.outputLen=s.outputLen,i.blockLen=s.blockLen,i.create=(a,...u)=>r(a,...u),i}var vr=(e,t)=>{function n(r,...o){if(X(r,void 0,"key"),e.nonceLength!==void 0){let h=o[0];X(h,e.varSizeNonce?void 0:e.nonceLength,"nonce")}let i=e.tagLength,s=e.nonceLength!==void 0?1:0;if(!e.withAAD){for(let h=s;h<o.length;h++)if(Zt(o[h]))throw new Error("AAD not supported")}e.withAAD&&o[s]!==void 0&&X(o[s],void 0,"AAD");let a=t(r,...o),u=(h,b)=>{if(b!==void 0){if(h!==2)throw new Error("cipher output not supported");X(b,void 0,"output")}},d=!1;return{encrypt(h,b){if(d)throw new Error("cannot encrypt() twice with same key + nonce");return d=!0,X(h,void 0,"data"),u(a.encrypt.length,b),a.encrypt(h,b)},decrypt(h,b){if(X(h,void 0,"data"),i&&h.length<i)throw new Error('"ciphertext" expected length >= tagLength='+i);return u(a.decrypt.length,b),a.decrypt(h,b)}}}return Object.assign(n,e),n};function Xe(e,t,n=!0){if(t===void 0)return new Uint8Array(e);if(X(t,e,"output"),n&&!Ze(t))throw new Error("invalid output, must be aligned");return t}function Sr(e,t,n){Ce(e),Ce(t),vt(n);let r=new Uint8Array(16),o=Mo(r);return o.setBigUint64(0,BigInt(t),n),o.setBigUint64(8,BigInt(e),n),r}function Ze(e){return e.byteOffset%4===0}function $e(e){return Uint8Array.from(X(e))}var Tr=e=>Uint8Array.from(e.split(""),t=>t.charCodeAt(0)),Io=ke(be(Tr("expand 16-byte k"))),Do=ke(be(Tr("expand 32-byte k")));function C(e,t){return e<<t|e>>>32-t}var Qe=64,Wo=16,en=2**32-1,kr=Uint32Array.of();function $o(e,t,n,r,o,i,s,a){let u=o.length,d=new Uint8Array(Qe),p=be(d),h=Ae&&Ze(o)&&Ze(i),b=h?be(o):kr,A=h?be(i):kr;if(!Ae){for(let y=0;y<u;s++){if(e(t,n,r,p,s,a),ke(p),s>=en)throw new Error("arx: counter overflow");let x=Math.min(Qe,u-y);for(let k=0,B;k<x;k++)B=y+k,i[B]=o[B]^d[k];y+=x}return}for(let y=0;y<u;s++){if(e(t,n,r,p,s,a),s>=en)throw new Error("arx: counter overflow");let x=Math.min(Qe,u-y);if(h&&x===Qe){let k=y/4;if(y%4!==0)throw new Error("arx: invalid block position");for(let B=0,P;B<Wo;B++)P=k+B,A[P]=b[P]^p[B];y+=Qe;continue}for(let k=0,B;k<x;k++)B=y+k,i[B]=o[B]^d[k];y+=x}}function xr(e,t){let{allowShortKeys:n,extendNonceFn:r,counterLength:o,counterRight:i,rounds:s}=mr({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return Ce(o),Ce(s),vt(i),vt(n),(a,u,d,p,h=0)=>{X(a,void 0,"key"),X(u,void 0,"nonce"),X(d,void 0,"data");let b=d.length,A=p!==void 0;if(p=Xe(b,p,!1),A&&hr(d,p),Ce(h),h<0||h>=en)throw new Error("arx: counter overflow");let y=[],x=a.length,k,B;if(x===32)y.push(k=$e(a)),B=Do;else if(x===16&&n)k=new Uint8Array(32),k.set(a),k.set(a,16),B=Io,y.push(k);else throw X(a,32,"arx key"),new Error("invalid key size");(!Ae||!Ze(u))&&y.push(u=$e(u));let P=be(k);if(r){if(u.length!==24)throw new Error("arx: extended nonce must be 24 bytes");let Q=u.subarray(0,16);if(Ae)r(B,P,be(Q),P);else{let J=ke(Uint32Array.from(B));r(J,P,be(Q),P),me(J),ke(P)}u=u.subarray(16)}else Ae||ke(P);let Z=16-o;if(Z!==u.length)throw new Error(`arx: nonce must be ${Z} or 16 bytes`);if(Z!==12){let Q=new Uint8Array(12);Q.set(u,i?0:12-u.length),u=Q,y.push(u)}let ce=ke(be(u));try{return $o(e,B,P,ce,d,p,h,s),p}finally{me(...y)}}}function ne(e,t){return e[t++]&255|(e[t++]&255)<<8}var tn=class{blockLen=16;outputLen=16;buffer=new Uint8Array(16);r=new Uint16Array(10);h=new Uint16Array(10);pad=new Uint16Array(8);pos=0;finished=!1;destroyed=!1;constructor(t){t=$e(X(t,32,"key"));let n=ne(t,0),r=ne(t,2),o=ne(t,4),i=ne(t,6),s=ne(t,8),a=ne(t,10),u=ne(t,12),d=ne(t,14);this.r[0]=n&8191,this.r[1]=(n>>>13|r<<3)&8191,this.r[2]=(r>>>10|o<<6)&7939,this.r[3]=(o>>>7|i<<9)&8191,this.r[4]=(i>>>4|s<<12)&255,this.r[5]=s>>>1&8190,this.r[6]=(s>>>14|a<<2)&8191,this.r[7]=(a>>>11|u<<5)&8065,this.r[8]=(u>>>8|d<<8)&8191,this.r[9]=d>>>5&127;for(let p=0;p<8;p++)this.pad[p]=ne(t,16+2*p)}process(t,n,r=!1){let o=r?0:2048,{h:i,r:s}=this,a=s[0],u=s[1],d=s[2],p=s[3],h=s[4],b=s[5],A=s[6],y=s[7],x=s[8],k=s[9],B=ne(t,n+0),P=ne(t,n+2),Z=ne(t,n+4),ce=ne(t,n+6),Q=ne(t,n+8),J=ne(t,n+10),Y=ne(t,n+12),q=ne(t,n+14),$=i[0]+(B&8191),F=i[1]+((B>>>13|P<<3)&8191),I=i[2]+((P>>>10|Z<<6)&8191),U=i[3]+((Z>>>7|ce<<9)&8191),D=i[4]+((ce>>>4|Q<<12)&8191),W=i[5]+(Q>>>1&8191),_=i[6]+((Q>>>14|J<<2)&8191),j=i[7]+((J>>>11|Y<<5)&8191),K=i[8]+((Y>>>8|q<<8)&8191),N=i[9]+(q>>>5|o),T=0,z=T+$*a+F*(5*k)+I*(5*x)+U*(5*y)+D*(5*A);T=z>>>13,z&=8191,z+=W*(5*b)+_*(5*h)+j*(5*p)+K*(5*d)+N*(5*u),T+=z>>>13,z&=8191;let G=T+$*u+F*a+I*(5*k)+U*(5*x)+D*(5*y);T=G>>>13,G&=8191,G+=W*(5*A)+_*(5*b)+j*(5*h)+K*(5*p)+N*(5*d),T+=G>>>13,G&=8191;let H=T+$*d+F*u+I*a+U*(5*k)+D*(5*x);T=H>>>13,H&=8191,H+=W*(5*y)+_*(5*A)+j*(5*b)+K*(5*h)+N*(5*p),T+=H>>>13,H&=8191;let le=T+$*p+F*d+I*u+U*a+D*(5*k);T=le>>>13,le&=8191,le+=W*(5*x)+_*(5*y)+j*(5*A)+K*(5*b)+N*(5*h),T+=le>>>13,le&=8191;let we=T+$*h+F*p+I*d+U*u+D*a;T=we>>>13,we&=8191,we+=W*(5*k)+_*(5*x)+j*(5*y)+K*(5*A)+N*(5*b),T+=we>>>13,we&=8191;let g=T+$*b+F*h+I*p+U*d+D*u;T=g>>>13,g&=8191,g+=W*a+_*(5*k)+j*(5*x)+K*(5*y)+N*(5*A),T+=g>>>13,g&=8191;let f=T+$*A+F*b+I*h+U*p+D*d;T=f>>>13,f&=8191,f+=W*u+_*a+j*(5*k)+K*(5*x)+N*(5*y),T+=f>>>13,f&=8191;let l=T+$*y+F*A+I*b+U*h+D*p;T=l>>>13,l&=8191,l+=W*d+_*u+j*a+K*(5*k)+N*(5*x),T+=l>>>13,l&=8191;let w=T+$*x+F*y+I*A+U*b+D*h;T=w>>>13,w&=8191,w+=W*p+_*d+j*u+K*a+N*(5*k),T+=w>>>13,w&=8191;let c=T+$*k+F*x+I*y+U*A+D*b;T=c>>>13,c&=8191,c+=W*h+_*p+j*d+K*u+N*a,T+=c>>>13,c&=8191,T=(T<<2)+T|0,T=T+z|0,z=T&8191,T=T>>>13,G+=T,i[0]=z,i[1]=G,i[2]=H,i[3]=le,i[4]=we,i[5]=g,i[6]=f,i[7]=l,i[8]=w,i[9]=c}finalize(){let{h:t,pad:n}=this,r=new Uint16Array(10),o=t[1]>>>13;t[1]&=8191;for(let a=2;a<10;a++)t[a]+=o,o=t[a]>>>13,t[a]&=8191;t[0]+=o*5,o=t[0]>>>13,t[0]&=8191,t[1]+=o,o=t[1]>>>13,t[1]&=8191,t[2]+=o,r[0]=t[0]+5,o=r[0]>>>13,r[0]&=8191;for(let a=1;a<10;a++)r[a]=t[a]+o,o=r[a]>>>13,r[a]&=8191;r[9]-=8192;let i=(o^1)-1;for(let a=0;a<10;a++)r[a]&=i;i=~i;for(let a=0;a<10;a++)t[a]=t[a]&i|r[a];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let s=t[0]+n[0];t[0]=s&65535;for(let a=1;a<8;a++)s=(t[a]+n[a]|0)+(s>>>16)|0,t[a]=s&65535;me(r)}update(t){Qt(this),X(t),t=$e(t);let{buffer:n,blockLen:r}=this,o=t.length;for(let i=0;i<o;){let s=Math.min(r-this.pos,o-i);if(s===r){for(;r<=o-i;i+=r)this.process(t,i);continue}n.set(t.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===r&&(this.process(n,0,!1),this.pos=0)}return this}destroy(){this.destroyed=!0,me(this.h,this.r,this.buffer,this.pad)}digestInto(t){Qt(this),yr(t,this),this.finished=!0;let{buffer:n,h:r}=this,{pos:o}=this;if(o){for(n[o++]=1;o<16;o++)n[o]=0;this.process(n,0,!0)}this.finalize();let i=0;for(let s=0;s<8;s++)t[i++]=r[s]>>>0,t[i++]=r[s]>>>8}digest(){let{buffer:t,outputLen:n}=this;this.digestInto(t);let r=t.slice(0,n);return this.destroy(),r}},Ar=br(32,e=>new tn(e));function Fo(e,t,n,r,o,i=20){let s=e[0],a=e[1],u=e[2],d=e[3],p=t[0],h=t[1],b=t[2],A=t[3],y=t[4],x=t[5],k=t[6],B=t[7],P=o,Z=n[0],ce=n[1],Q=n[2],J=s,Y=a,q=u,$=d,F=p,I=h,U=b,D=A,W=y,_=x,j=k,K=B,N=P,T=Z,z=ce,G=Q;for(let le=0;le<i;le+=2)J=J+F|0,N=C(N^J,16),W=W+N|0,F=C(F^W,12),J=J+F|0,N=C(N^J,8),W=W+N|0,F=C(F^W,7),Y=Y+I|0,T=C(T^Y,16),_=_+T|0,I=C(I^_,12),Y=Y+I|0,T=C(T^Y,8),_=_+T|0,I=C(I^_,7),q=q+U|0,z=C(z^q,16),j=j+z|0,U=C(U^j,12),q=q+U|0,z=C(z^q,8),j=j+z|0,U=C(U^j,7),$=$+D|0,G=C(G^$,16),K=K+G|0,D=C(D^K,12),$=$+D|0,G=C(G^$,8),K=K+G|0,D=C(D^K,7),J=J+I|0,G=C(G^J,16),j=j+G|0,I=C(I^j,12),J=J+I|0,G=C(G^J,8),j=j+G|0,I=C(I^j,7),Y=Y+U|0,N=C(N^Y,16),K=K+N|0,U=C(U^K,12),Y=Y+U|0,N=C(N^Y,8),K=K+N|0,U=C(U^K,7),q=q+D|0,T=C(T^q,16),W=W+T|0,D=C(D^W,12),q=q+D|0,T=C(T^q,8),W=W+T|0,D=C(D^W,7),$=$+F|0,z=C(z^$,16),_=_+z|0,F=C(F^_,12),$=$+F|0,z=C(z^$,8),_=_+z|0,F=C(F^_,7);let H=0;r[H++]=s+J|0,r[H++]=a+Y|0,r[H++]=u+q|0,r[H++]=d+$|0,r[H++]=p+F|0,r[H++]=h+I|0,r[H++]=b+U|0,r[H++]=A+D|0,r[H++]=y+W|0,r[H++]=x+_|0,r[H++]=k+j|0,r[H++]=B+K|0,r[H++]=P+N|0,r[H++]=Z+T|0,r[H++]=ce+z|0,r[H++]=Q+G|0}var Ho=xr(Fo,{counterRight:!1,counterLength:4,allowShortKeys:!1});var _o=new Uint8Array(16),Er=(e,t)=>{e.update(t);let n=t.length%16;n&&e.update(_o.subarray(n))},zo=new Uint8Array(32);function Rr(e,t,n,r,o){o!==void 0&&X(o,void 0,"AAD");let i=e(t,n,zo),s=Sr(r.length,o?o.length:0,!0),a=Ar.create(i);o&&Er(a,o),Er(a,r),a.update(s);let u=a.digest();return me(i,s),u}var Vo=e=>(t,n,r)=>({encrypt(i,s){let a=i.length;s=Xe(a+16,s,!1),s.set(i);let u=s.subarray(0,-16);e(t,n,u,u,1);let d=Rr(e,t,n,u,r);return s.set(d,a),me(d),s},decrypt(i,s){s=Xe(i.length-16,s,!1);let a=i.subarray(0,-16),u=i.subarray(-16),d=Rr(e,t,n,a,r);if(!wr(u,d))throw me(d),new Error("invalid tag");return s.set(i.subarray(0,-16)),e(t,n,s,s,1),me(d),s}}),Fe=vr({blockSize:64,nonceLength:12,tagLength:16,withAAD:!0},Vo(Ho));var qo="deepview-triage-sync.v1.content-key",Go="deepview-triage-sync.v1.sign-key",Jo="deepview-triage-sync.v1.save",Yo="deepview-triage-sync.v1.subscribe",Xo=12,nn=new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32]),St=null;function Pr(){return St||(St=(async()=>{try{return await crypto.subtle.importKey("raw",new Uint8Array(32),{name:"ChaCha20-Poly1305"},!1,["encrypt","decrypt"]),!0}catch{return!1}})(),St)}async function Br(e,t){let n=Uint8Array.fromBase64(e);if(n.length!==32)throw new Error(`workspace private key must be 32 bytes (got ${n.length})`);let r=await crypto.subtle.importKey("raw",n,"HKDF",!1,["deriveBits"]),o=await crypto.subtle.deriveBits({name:"HKDF",hash:"SHA-256",salt:new Uint8Array,info:oe(t)},r,256);return new Uint8Array(o)}async function Or(e){return await Br(e,qo)}async function kt(e,t){let n=await Br(e,`${Go}|${t}`),r=new Uint8Array(nn.length+32);r.set(nn,0),r.set(n,nn.length);let o=await crypto.subtle.importKey("pkcs8",r,{name:"Ed25519"},!0,["sign"]),i=await crypto.subtle.exportKey("jwk",o),s=i.x;if(delete i.d,s==null)throw new Error("Ed25519 JWK export returned no public key");let a=Uint8Array.fromBase64(s,{alphabet:"base64url"}),u=await crypto.subtle.importKey("pkcs8",r,{name:"Ed25519"},!1,["sign"]);return n.fill(0),r.fill(0),{privateKey:u,publicKey:a,publicKeyB64:s}}function rn({publicKeyB64:e,base:t,keyframe:n,nonceB64:r,ciphertextB64:o}){return oe([Jo,e,t==null?"":String(t),n===!0?"1":"",r,o].join(`
|
|
1
|
+
import{a as sr,b as ar,c as cr,d as lr,e as ur,f as fr,g as he,p as dr,u as Xt,v as gr}from"./chunk-XRWAV3DX.js";import{a as De,b as Oe,d as tr,e as je,f as ge,g as nr,h as rr}from"./chunk-W4J3MGLB.js";import{a as Yt}from"./chunk-GJ4IUCNS.js";import{a as or,b as ir}from"./chunk-PNHBZGDD.js";import{a as oe,c as We}from"./chunk-TUII34K2.js";import"./chunk-OOJM4CTU.js";function Zt(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}var bt=e=>e?`"${e}" `:"";function vt(e,t=""){if(typeof e!="boolean")throw new TypeError(bt(t)+"expected boolean, got type="+typeof e);return e}function Ce(e,t=""){if(typeof e!="number")throw new TypeError(bt(t)+"expected number, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError(bt(t)+"expected integer >= 0, got "+e);return e}function X(e,t,n=""){if(Zt(e)&&(t===void 0||e.length===t))return e;t!==void 0&&Ce(t,"length");let r=Zt(e),o=t!==void 0?` of length ${t}`:"",i=r?`length=${e.length}`:`type=${typeof e}`,s=bt(n)+"expected Uint8Array"+o+", got "+i;throw r?new RangeError(s):new TypeError(s)}var pr=(e,t)=>{if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(t==="object"?"expected valid options object":`"${t}" expected object, got type=${typeof e}`)};function Qt(e,t=!0){if(e.destroyed)throw new Error("hash was destroyed");if(t&&e.finished)throw new Error("digest() was already called")}function yr(e,t){X(e,void 0,"output");let n=t.outputLen;if(!(e.length>=n))throw new RangeError('"output" expected length >= '+n)}function be(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function me(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Mo(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}var Ae=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Uo(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Ko(e){for(let t=0;t<e.length;t++)e[t]=Uo(e[t]);return e}var ke=Ae?e=>e:Ko;function No(e,t){return!e.byteLength||!t.byteLength?!1:e.buffer===t.buffer&&e.byteOffset<t.byteOffset+t.byteLength&&t.byteOffset<e.byteOffset+e.byteLength}function hr(e,t){if(No(e,t)&&e.byteOffset<t.byteOffset)throw new Error("complex overlap of input and output is not supported")}function mr(e,t){return pr(e,"defaults"),pr(t,"opts"),Object.assign(e,t)}function wr(e,t){if(e=X(e),t=X(t),e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function br(e,t,n){let r=t,o=n||(()=>[]),i=(a,u)=>r(u,...o(a)).update(a).digest(),s=r(new Uint8Array(e),...o(new Uint8Array(0)));return i.outputLen=s.outputLen,i.blockLen=s.blockLen,i.create=(a,...u)=>r(a,...u),i}var vr=(e,t)=>{function n(r,...o){if(X(r,void 0,"key"),e.nonceLength!==void 0){let h=o[0];X(h,e.varSizeNonce?void 0:e.nonceLength,"nonce")}let i=e.tagLength,s=e.nonceLength!==void 0?1:0;if(!e.withAAD){for(let h=s;h<o.length;h++)if(Zt(o[h]))throw new Error("AAD not supported")}e.withAAD&&o[s]!==void 0&&X(o[s],void 0,"AAD");let a=t(r,...o),u=(h,b)=>{if(b!==void 0){if(h!==2)throw new Error("cipher output not supported");X(b,void 0,"output")}},d=!1;return{encrypt(h,b){if(d)throw new Error("cannot encrypt() twice with same key + nonce");return d=!0,X(h,void 0,"data"),u(a.encrypt.length,b),a.encrypt(h,b)},decrypt(h,b){if(X(h,void 0,"data"),i&&h.length<i)throw new Error('"ciphertext" expected length >= tagLength='+i);return u(a.decrypt.length,b),a.decrypt(h,b)}}}return Object.assign(n,e),n};function Xe(e,t,n=!0){if(t===void 0)return new Uint8Array(e);if(X(t,e,"output"),n&&!Ze(t))throw new Error("invalid output, must be aligned");return t}function Sr(e,t,n){Ce(e),Ce(t),vt(n);let r=new Uint8Array(16),o=Mo(r);return o.setBigUint64(0,BigInt(t),n),o.setBigUint64(8,BigInt(e),n),r}function Ze(e){return e.byteOffset%4===0}function $e(e){return Uint8Array.from(X(e))}var Tr=e=>Uint8Array.from(e.split(""),t=>t.charCodeAt(0)),Io=ke(be(Tr("expand 16-byte k"))),Do=ke(be(Tr("expand 32-byte k")));function C(e,t){return e<<t|e>>>32-t}var Qe=64,Wo=16,en=2**32-1,kr=Uint32Array.of();function $o(e,t,n,r,o,i,s,a){let u=o.length,d=new Uint8Array(Qe),p=be(d),h=Ae&&Ze(o)&&Ze(i),b=h?be(o):kr,A=h?be(i):kr;if(!Ae){for(let y=0;y<u;s++){if(e(t,n,r,p,s,a),ke(p),s>=en)throw new Error("arx: counter overflow");let x=Math.min(Qe,u-y);for(let k=0,B;k<x;k++)B=y+k,i[B]=o[B]^d[k];y+=x}return}for(let y=0;y<u;s++){if(e(t,n,r,p,s,a),s>=en)throw new Error("arx: counter overflow");let x=Math.min(Qe,u-y);if(h&&x===Qe){let k=y/4;if(y%4!==0)throw new Error("arx: invalid block position");for(let B=0,P;B<Wo;B++)P=k+B,A[P]=b[P]^p[B];y+=Qe;continue}for(let k=0,B;k<x;k++)B=y+k,i[B]=o[B]^d[k];y+=x}}function xr(e,t){let{allowShortKeys:n,extendNonceFn:r,counterLength:o,counterRight:i,rounds:s}=mr({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return Ce(o),Ce(s),vt(i),vt(n),(a,u,d,p,h=0)=>{X(a,void 0,"key"),X(u,void 0,"nonce"),X(d,void 0,"data");let b=d.length,A=p!==void 0;if(p=Xe(b,p,!1),A&&hr(d,p),Ce(h),h<0||h>=en)throw new Error("arx: counter overflow");let y=[],x=a.length,k,B;if(x===32)y.push(k=$e(a)),B=Do;else if(x===16&&n)k=new Uint8Array(32),k.set(a),k.set(a,16),B=Io,y.push(k);else throw X(a,32,"arx key"),new Error("invalid key size");(!Ae||!Ze(u))&&y.push(u=$e(u));let P=be(k);if(r){if(u.length!==24)throw new Error("arx: extended nonce must be 24 bytes");let Q=u.subarray(0,16);if(Ae)r(B,P,be(Q),P);else{let J=ke(Uint32Array.from(B));r(J,P,be(Q),P),me(J),ke(P)}u=u.subarray(16)}else Ae||ke(P);let Z=16-o;if(Z!==u.length)throw new Error(`arx: nonce must be ${Z} or 16 bytes`);if(Z!==12){let Q=new Uint8Array(12);Q.set(u,i?0:12-u.length),u=Q,y.push(u)}let ce=ke(be(u));try{return $o(e,B,P,ce,d,p,h,s),p}finally{me(...y)}}}function ne(e,t){return e[t++]&255|(e[t++]&255)<<8}var tn=class{blockLen=16;outputLen=16;buffer=new Uint8Array(16);r=new Uint16Array(10);h=new Uint16Array(10);pad=new Uint16Array(8);pos=0;finished=!1;destroyed=!1;constructor(t){t=$e(X(t,32,"key"));let n=ne(t,0),r=ne(t,2),o=ne(t,4),i=ne(t,6),s=ne(t,8),a=ne(t,10),u=ne(t,12),d=ne(t,14);this.r[0]=n&8191,this.r[1]=(n>>>13|r<<3)&8191,this.r[2]=(r>>>10|o<<6)&7939,this.r[3]=(o>>>7|i<<9)&8191,this.r[4]=(i>>>4|s<<12)&255,this.r[5]=s>>>1&8190,this.r[6]=(s>>>14|a<<2)&8191,this.r[7]=(a>>>11|u<<5)&8065,this.r[8]=(u>>>8|d<<8)&8191,this.r[9]=d>>>5&127;for(let p=0;p<8;p++)this.pad[p]=ne(t,16+2*p)}process(t,n,r=!1){let o=r?0:2048,{h:i,r:s}=this,a=s[0],u=s[1],d=s[2],p=s[3],h=s[4],b=s[5],A=s[6],y=s[7],x=s[8],k=s[9],B=ne(t,n+0),P=ne(t,n+2),Z=ne(t,n+4),ce=ne(t,n+6),Q=ne(t,n+8),J=ne(t,n+10),Y=ne(t,n+12),q=ne(t,n+14),$=i[0]+(B&8191),F=i[1]+((B>>>13|P<<3)&8191),I=i[2]+((P>>>10|Z<<6)&8191),U=i[3]+((Z>>>7|ce<<9)&8191),D=i[4]+((ce>>>4|Q<<12)&8191),W=i[5]+(Q>>>1&8191),_=i[6]+((Q>>>14|J<<2)&8191),j=i[7]+((J>>>11|Y<<5)&8191),K=i[8]+((Y>>>8|q<<8)&8191),N=i[9]+(q>>>5|o),T=0,z=T+$*a+F*(5*k)+I*(5*x)+U*(5*y)+D*(5*A);T=z>>>13,z&=8191,z+=W*(5*b)+_*(5*h)+j*(5*p)+K*(5*d)+N*(5*u),T+=z>>>13,z&=8191;let G=T+$*u+F*a+I*(5*k)+U*(5*x)+D*(5*y);T=G>>>13,G&=8191,G+=W*(5*A)+_*(5*b)+j*(5*h)+K*(5*p)+N*(5*d),T+=G>>>13,G&=8191;let H=T+$*d+F*u+I*a+U*(5*k)+D*(5*x);T=H>>>13,H&=8191,H+=W*(5*y)+_*(5*A)+j*(5*b)+K*(5*h)+N*(5*p),T+=H>>>13,H&=8191;let le=T+$*p+F*d+I*u+U*a+D*(5*k);T=le>>>13,le&=8191,le+=W*(5*x)+_*(5*y)+j*(5*A)+K*(5*b)+N*(5*h),T+=le>>>13,le&=8191;let we=T+$*h+F*p+I*d+U*u+D*a;T=we>>>13,we&=8191,we+=W*(5*k)+_*(5*x)+j*(5*y)+K*(5*A)+N*(5*b),T+=we>>>13,we&=8191;let g=T+$*b+F*h+I*p+U*d+D*u;T=g>>>13,g&=8191,g+=W*a+_*(5*k)+j*(5*x)+K*(5*y)+N*(5*A),T+=g>>>13,g&=8191;let f=T+$*A+F*b+I*h+U*p+D*d;T=f>>>13,f&=8191,f+=W*u+_*a+j*(5*k)+K*(5*x)+N*(5*y),T+=f>>>13,f&=8191;let l=T+$*y+F*A+I*b+U*h+D*p;T=l>>>13,l&=8191,l+=W*d+_*u+j*a+K*(5*k)+N*(5*x),T+=l>>>13,l&=8191;let w=T+$*x+F*y+I*A+U*b+D*h;T=w>>>13,w&=8191,w+=W*p+_*d+j*u+K*a+N*(5*k),T+=w>>>13,w&=8191;let c=T+$*k+F*x+I*y+U*A+D*b;T=c>>>13,c&=8191,c+=W*h+_*p+j*d+K*u+N*a,T+=c>>>13,c&=8191,T=(T<<2)+T|0,T=T+z|0,z=T&8191,T=T>>>13,G+=T,i[0]=z,i[1]=G,i[2]=H,i[3]=le,i[4]=we,i[5]=g,i[6]=f,i[7]=l,i[8]=w,i[9]=c}finalize(){let{h:t,pad:n}=this,r=new Uint16Array(10),o=t[1]>>>13;t[1]&=8191;for(let a=2;a<10;a++)t[a]+=o,o=t[a]>>>13,t[a]&=8191;t[0]+=o*5,o=t[0]>>>13,t[0]&=8191,t[1]+=o,o=t[1]>>>13,t[1]&=8191,t[2]+=o,r[0]=t[0]+5,o=r[0]>>>13,r[0]&=8191;for(let a=1;a<10;a++)r[a]=t[a]+o,o=r[a]>>>13,r[a]&=8191;r[9]-=8192;let i=(o^1)-1;for(let a=0;a<10;a++)r[a]&=i;i=~i;for(let a=0;a<10;a++)t[a]=t[a]&i|r[a];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let s=t[0]+n[0];t[0]=s&65535;for(let a=1;a<8;a++)s=(t[a]+n[a]|0)+(s>>>16)|0,t[a]=s&65535;me(r)}update(t){Qt(this),X(t),t=$e(t);let{buffer:n,blockLen:r}=this,o=t.length;for(let i=0;i<o;){let s=Math.min(r-this.pos,o-i);if(s===r){for(;r<=o-i;i+=r)this.process(t,i);continue}n.set(t.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===r&&(this.process(n,0,!1),this.pos=0)}return this}destroy(){this.destroyed=!0,me(this.h,this.r,this.buffer,this.pad)}digestInto(t){Qt(this),yr(t,this),this.finished=!0;let{buffer:n,h:r}=this,{pos:o}=this;if(o){for(n[o++]=1;o<16;o++)n[o]=0;this.process(n,0,!0)}this.finalize();let i=0;for(let s=0;s<8;s++)t[i++]=r[s]>>>0,t[i++]=r[s]>>>8}digest(){let{buffer:t,outputLen:n}=this;this.digestInto(t);let r=t.slice(0,n);return this.destroy(),r}},Ar=br(32,e=>new tn(e));function Fo(e,t,n,r,o,i=20){let s=e[0],a=e[1],u=e[2],d=e[3],p=t[0],h=t[1],b=t[2],A=t[3],y=t[4],x=t[5],k=t[6],B=t[7],P=o,Z=n[0],ce=n[1],Q=n[2],J=s,Y=a,q=u,$=d,F=p,I=h,U=b,D=A,W=y,_=x,j=k,K=B,N=P,T=Z,z=ce,G=Q;for(let le=0;le<i;le+=2)J=J+F|0,N=C(N^J,16),W=W+N|0,F=C(F^W,12),J=J+F|0,N=C(N^J,8),W=W+N|0,F=C(F^W,7),Y=Y+I|0,T=C(T^Y,16),_=_+T|0,I=C(I^_,12),Y=Y+I|0,T=C(T^Y,8),_=_+T|0,I=C(I^_,7),q=q+U|0,z=C(z^q,16),j=j+z|0,U=C(U^j,12),q=q+U|0,z=C(z^q,8),j=j+z|0,U=C(U^j,7),$=$+D|0,G=C(G^$,16),K=K+G|0,D=C(D^K,12),$=$+D|0,G=C(G^$,8),K=K+G|0,D=C(D^K,7),J=J+I|0,G=C(G^J,16),j=j+G|0,I=C(I^j,12),J=J+I|0,G=C(G^J,8),j=j+G|0,I=C(I^j,7),Y=Y+U|0,N=C(N^Y,16),K=K+N|0,U=C(U^K,12),Y=Y+U|0,N=C(N^Y,8),K=K+N|0,U=C(U^K,7),q=q+D|0,T=C(T^q,16),W=W+T|0,D=C(D^W,12),q=q+D|0,T=C(T^q,8),W=W+T|0,D=C(D^W,7),$=$+F|0,z=C(z^$,16),_=_+z|0,F=C(F^_,12),$=$+F|0,z=C(z^$,8),_=_+z|0,F=C(F^_,7);let H=0;r[H++]=s+J|0,r[H++]=a+Y|0,r[H++]=u+q|0,r[H++]=d+$|0,r[H++]=p+F|0,r[H++]=h+I|0,r[H++]=b+U|0,r[H++]=A+D|0,r[H++]=y+W|0,r[H++]=x+_|0,r[H++]=k+j|0,r[H++]=B+K|0,r[H++]=P+N|0,r[H++]=Z+T|0,r[H++]=ce+z|0,r[H++]=Q+G|0}var Ho=xr(Fo,{counterRight:!1,counterLength:4,allowShortKeys:!1});var _o=new Uint8Array(16),Er=(e,t)=>{e.update(t);let n=t.length%16;n&&e.update(_o.subarray(n))},zo=new Uint8Array(32);function Rr(e,t,n,r,o){o!==void 0&&X(o,void 0,"AAD");let i=e(t,n,zo),s=Sr(r.length,o?o.length:0,!0),a=Ar.create(i);o&&Er(a,o),Er(a,r),a.update(s);let u=a.digest();return me(i,s),u}var Vo=e=>(t,n,r)=>({encrypt(i,s){let a=i.length;s=Xe(a+16,s,!1),s.set(i);let u=s.subarray(0,-16);e(t,n,u,u,1);let d=Rr(e,t,n,u,r);return s.set(d,a),me(d),s},decrypt(i,s){s=Xe(i.length-16,s,!1);let a=i.subarray(0,-16),u=i.subarray(-16),d=Rr(e,t,n,a,r);if(!wr(u,d))throw me(d),new Error("invalid tag");return s.set(i.subarray(0,-16)),e(t,n,s,s,1),me(d),s}}),Fe=vr({blockSize:64,nonceLength:12,tagLength:16,withAAD:!0},Vo(Ho));var qo="deepview-triage-sync.v1.content-key",Go="deepview-triage-sync.v1.sign-key",Jo="deepview-triage-sync.v1.save",Yo="deepview-triage-sync.v1.subscribe",Xo=12,nn=new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32]),St=null;function Pr(){return St||(St=(async()=>{try{return await crypto.subtle.importKey("raw",new Uint8Array(32),{name:"ChaCha20-Poly1305"},!1,["encrypt","decrypt"]),!0}catch{return!1}})(),St)}async function Br(e,t){let n=Uint8Array.fromBase64(e);if(n.length!==32)throw new Error(`workspace private key must be 32 bytes (got ${n.length})`);let r=await crypto.subtle.importKey("raw",n,"HKDF",!1,["deriveBits"]),o=await crypto.subtle.deriveBits({name:"HKDF",hash:"SHA-256",salt:new Uint8Array,info:oe(t)},r,256);return new Uint8Array(o)}async function Or(e){return await Br(e,qo)}async function kt(e,t){let n=await Br(e,`${Go}|${t}`),r=new Uint8Array(nn.length+32);r.set(nn,0),r.set(n,nn.length);let o=await crypto.subtle.importKey("pkcs8",r,{name:"Ed25519"},!0,["sign"]),i=await crypto.subtle.exportKey("jwk",o),s=i.x;if(delete i.d,s==null)throw new Error("Ed25519 JWK export returned no public key");let a=Uint8Array.fromBase64(s,{alphabet:"base64url"}),u=await crypto.subtle.importKey("pkcs8",r,{name:"Ed25519"},!1,["sign"]);return n.fill(0),r.fill(0),{privateKey:u,publicKey:a,publicKeyB64:s}}function rn({publicKeyB64:e,base:t,keyframe:n,nonceB64:r,ciphertextB64:o}){return oe([Jo,e,t==null?"":String(t),n===!0?"1":"",r,o].join(`
|
|
2
2
|
`))}async function jr(e,t){let n=await crypto.subtle.sign({name:"Ed25519"},e,t);return new Uint8Array(n).toBase64({alphabet:"base64url",omitPadding:!0})}async function Cr(e,t){return await jr(e,rn(t))}async function on(e){let t=rn(e),n=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(n).toBase64({alphabet:"base64url",omitPadding:!0})}function Zo(e,t,n){let r=t==null?"":String(t);return oe([Yo,e,r,n].join(`
|
|
3
3
|
`))}async function Lr(e,t,n,r){return await jr(e,Zo(t,n,r))}async function Mr(e,t,n){try{let r=await crypto.subtle.importKey("raw",e,{name:"Ed25519"},!1,["verify"]),o=Uint8Array.fromBase64(n,{alphabet:"base64url"}),i=rn(t);return await crypto.subtle.verify({name:"Ed25519"},r,o,i)}catch{return!1}}function Qo(){let e=new Uint8Array(Xo);return crypto.getRandomValues(e),e}function sn(e,t){let n=t==null?"":String(t);return oe(`${e}|${n}`)}async function ei(e,t,n){let r=Qo();if(await Pr()){let i=await crypto.subtle.importKey("raw",e,{name:"ChaCha20-Poly1305"},!1,["encrypt"]),s=new Uint8Array(await crypto.subtle.encrypt({name:"ChaCha20-Poly1305",iv:r,additionalData:n},i,t));return{nonce:r,ciphertext:s}}let o=Fe(e,r,n);return{nonce:r,ciphertext:o.encrypt(t)}}async function ti(e,t,n,r){if(await Pr()){let i=await crypto.subtle.importKey("raw",e,{name:"ChaCha20-Poly1305"},!1,["decrypt"]);return new Uint8Array(await crypto.subtle.decrypt({name:"ChaCha20-Poly1305",iv:t,additionalData:r},i,n))}return Fe(e,t,r).decrypt(n)}var ni=64;function ri(e,t){return e<=t?t:2**(32-Math.clz32(e-1))}async function oi(e){let t=oe(JSON.stringify(e)),n=await or(t);if(n.length>1073741820)throw new Error("payload too large");let r=ri(4+n.length,ni),o=new Uint8Array(r);return new DataView(o.buffer,o.byteOffset,o.byteLength).setUint32(0,n.length,!1),o.set(n,4),o}var ii=64*1024*1024;async function si(e){if(e.length<4)throw new Error("plaintext too short");let n=new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(0,!1);if(n+4>e.length)throw new Error("length prefix exceeds buffer");let r=e.subarray(4,4+n),o=await ir(r,{maxBytes:ii});return JSON.parse(We(o))}async function Ur(e,t,n){let r=await oi(t),{nonce:o,ciphertext:i}=await ei(e,r,n);return{nonce:o.toBase64(),ciphertext:i.toBase64()}}async function Kr(e,t,n,r){let o=Uint8Array.fromBase64(t),i=Uint8Array.fromBase64(n),s=await ti(e,o,i,r);return si(s)}var ai="deepview-objstore.v1.content",ci="deepview-objstore.v1.tag",li=`objstore-tag
|
|
4
4
|
`,ui=`objstore-bundle-tag
|
package/out/graph.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as z,C as Ct,a as de,aa as Eo,b as Qt,ba as Pe,fa as ht,la as Bo,ma as Ce,na as Ke,pa as se,qa as Ze,z as Oo}from"./chunk-OJ5DGP5E.js";import{a as Ie}from"./chunk-R5O6FAW4.js";import{b as ie,c as Ao,d as ze}from"./chunk-CMQA4DM6.js";import"./chunk-ZPD5R5RP.js";import"./chunk-V3ME6FI5.js";import{h as $e}from"./chunk-YVZH5SHP.js";import{a as Lo}from"./chunk-4XCDFGDP.js";import"./chunk-3BZ7JERB.js";import{a as Ye}from"./chunk-TZ5KB2Y5.js";import"./chunk-XYFXXB2G.js";import{a as ve}from"./chunk-DIJJNTRH.js";import"./chunk-HIV7SVI7.js";import{j as Yt}from"./chunk-GNXOKIGP.js";import"./chunk-C4Z6ZBXV.js";import{a as Pt,c as I,i as oe,j as ce}from"./chunk-2XUEZHIP.js";import"./chunk-TUII34K2.js";import{f as Ro,g as _o,h as To,i as Fo}from"./chunk-V5O7M2YT.js";import"./chunk-OOJM4CTU.js";var qo=`*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:host{display:grid;grid-template-columns:1fr 300px;grid-template-rows:auto 1fr;grid-template-areas:"topbar right" "stage right";min-height:0;border:1px solid var(--border);border-radius:var(--ui-radius, 8px);overflow:hidden;background:var(--graph-canvas-bg);color:var(--text);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,sans-serif;font-size:12px}.graph2-layout{display:contents}:host([matrix]){grid-template-columns:minmax(0,1fr) 300px}.graph2-topbar{grid-area:topbar;display:flex;flex-direction:column;gap:.5rem;padding:var(--graph-topbar-padding, .6rem .75rem .6rem var(--graph-topbar-left-padding, .75rem));font-size:.825rem;background:var(--surface);backdrop-filter:var(--glass-blur);border-bottom:1px solid var(--graph-divider)}.graph2-topbar-row{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem;padding:0}.graph2-topbar .g2-spacer{flex:1}.graph2-topbar-row-pinned{flex-wrap:nowrap;align-items:flex-start}.graph2-topbar-row-pinned>#g2-fullscreen{margin-top:2px}.g2-topbar-controls{display:flex;flex:1;flex-wrap:wrap;align-items:center;gap:.75rem;min-width:0}.g2-topbar-controls>.g2-reason-scope,.g2-topbar-controls>.g2-issues-switch{margin-left:auto}.g2-topbar-controls>.g2-reason-scope+.g2-issues-switch{margin-left:0}.g2-topbar-controls .g2-path-filter-wrap{flex:1 1 8rem;min-width:0;max-width:12rem}.g2-matrix-controls{display:flex;align-items:center;flex-wrap:wrap;gap:8px;font-size:11px;& button{height:30px;padding:4px 7px;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);background:var(--surface);color:var(--text);font:inherit}& button:hover,button[aria-pressed=true]{background:var(--graph-hover-bg);border-color:var(--muted)}}.graph2-topbar triage-selector{margin-left:auto}.g2-icon-btn{width:28px;height:28px;border-radius:var(--ui-radius, 5px);background:var(--graph-hover-bg);border:1px solid var(--border);color:var(--muted);display:grid;place-items:center;font-family:inherit;&:hover{color:var(--accent);border-color:var(--accent)}}.g2-path-filter-wrap{position:relative;flex:0 0 12rem;padding-right:22px}.g2-path-filter-wrap .g2-path-filter-clear{position:absolute;right:4px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:18px;height:18px;background:transparent;border:0;border-radius:var(--ui-radius, 50%);color:var(--muted);font:400 10px/1 inherit;font-family:inherit;&:hover{color:var(--text);background:var(--surface-active)}}.g2-path-filter:placeholder-shown~.g2-path-filter-clear{display:none}.g2-layout-tabs{display:inline-flex;flex-shrink:0;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);padding:2px;gap:2px;& button{position:relative;display:inline-flex;align-items:center;justify-content:center;border:0;border-radius:var(--ui-radius, 4px);background:transparent;color:var(--muted);font:inherit;font-size:11px;padding:5px 7px}& button[aria-pressed=true]{background:var(--graph-hover-bg);color:var(--text);box-shadow:var(--graph-layout-active-shadow, inset 0 0 0 1px var(--border))}}.g2-reason-scope{--scope-height: 30px}.graph2-right{grid-area:right;border-left:1px solid var(--graph-divider);background:var(--surface);backdrop-filter:var(--glass-blur);display:flex;flex-direction:column;overflow:hidden;padding:14px}.g2-panel-title{font-family:inherit;font-weight:600;font-size:11px;line-height:1;letter-spacing:.14em;text-transform:uppercase;color:var(--muted);opacity:.85;margin:14px 0 8px;display:flex;align-items:baseline;gap:6px;&:first-child{margin-top:0}}.g2-panel-title-row{justify-content:space-between;gap:8px}#g2-top-pkgs-block{margin-top:14px;flex:1 1 0;min-height:0;display:flex;flex-direction:column}.g2-mini-tabs{display:flex;gap:1px;background:var(--graph-mini-tabs-bg, var(--graph-divider));border-radius:var(--ui-radius, 4px);overflow:hidden}.g2-mini-tab{background:transparent;border:0;color:var(--muted);font-family:inherit;font-weight:500;font-size:11px;line-height:1.4;text-transform:none;letter-spacing:0;padding:2px 7px;&:hover{color:var(--text);background:var(--graph-hover-bg)}&.on{background:var(--surface-active);color:var(--accent);text-decoration:var(--graph-mini-tab-active-decoration, none);text-underline-offset:.2em}}.graph2-stage{grid-area:stage;position:relative;background:var(--graph-canvas-bg);overflow:hidden;cursor:default;&:active{cursor:default}& canvas{position:absolute;inset:0;width:100%;height:100%;display:block}}.g2-stage-overlay{position:absolute;top:12px;left:12px;z-index:3;display:flex;flex-direction:column;gap:4px;pointer-events:none;max-width:calc(100% - 60px)}.g2-stage-overlay>*{pointer-events:auto}.g2-stage-stats{position:absolute;bottom:10px;left:12px;z-index:2;display:flex;flex-wrap:wrap;gap:2px 14px;font:500 10px/1.4 ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;color:var(--muted);opacity:.7;text-transform:uppercase;letter-spacing:.06em;pointer-events:none;max-width:calc(100% - 80px);& b{font-weight:600;color:var(--text);opacity:1}}.g2-stage-overlay-tr{position:absolute;top:12px;right:12px;z-index:3;pointer-events:auto}.g2-focus-pkg-btn{width:28px;height:28px;display:grid;place-items:center;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:var(--ui-radius, 6px);color:var(--accent);box-shadow:var(--shadow-glass);&:hover{border-color:var(--accent);background:var(--surface-active)}& svg{display:block}}.g2-back-btn{display:inline-flex;align-items:center;gap:4px;padding:6px 11px;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:var(--ui-radius, 6px);color:var(--accent);font:500 11px/1 inherit;font-family:inherit;box-shadow:var(--shadow-glass);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;align-self:flex-start;&:hover{border-color:var(--accent);background:var(--surface-active)}}.g2-tooltip{position:absolute;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:var(--ui-radius, 7px);padding:9px 11px;pointer-events:none;min-width:170px;max-width:260px;opacity:0;transition:opacity .12s;z-index:10;box-shadow:var(--shadow-glass);&.show{opacity:1}}.g2-tt-path{font:500 11px/1.3 ui-monospace,monospace;color:var(--text);word-break:break-all;margin-bottom:4px}.g2-tt-head{display:flex;align-items:center;gap:6px;margin-bottom:6px;flex-wrap:wrap}.g2-tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.g2-tt-pkg{font-size:10px;color:var(--muted);word-break:break-all}.g2-tooltip .tree-count-chips{margin-top:6px}:host-context(body.theme-light) .graph2-right .tree-count-chip.medium,:host-context(body.theme-light) .g2-tooltip .tree-count-chip.medium{color:#fff}.g2-selection-card{background:var(--graph-hover-bg);border:1px solid var(--border);border-radius:var(--ui-radius, 8px);overflow:hidden}.g2-sel-head{padding:11px 13px;border-bottom:1px solid var(--graph-divider);display:flex;align-items:center;gap:8px}.g2-sel-file-head{padding:11px 13px;border-bottom:1px solid var(--graph-divider);display:flex;flex-direction:column;gap:6px}.g2-sel-path{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;font-weight:600;font-size:12px;line-height:1.3;color:var(--text);word-break:break-all}.g2-sel-pkg-row{display:flex;align-items:center;gap:6px;min-width:0}.g2-sel-pkg{font-size:11px;color:var(--muted);word-break:break-all;min-width:0}.g2-sel-fullpath{padding:7px 13px;border-bottom:1px solid var(--graph-divider);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;font-size:10px;line-height:1.3;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.g2-sel-size{padding:5px 13px 7px;border-bottom:1px solid var(--graph-divider);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;font-size:10px;line-height:1.3;color:var(--muted);font-variant-numeric:tabular-nums}.g2-sel-dot{width:11px;height:11px;border-radius:50%;box-shadow:0 0 0 3px color-mix(in srgb,var(--dot) 22%,transparent);flex-shrink:0}.g2-sel-id{font:600 12px/1 ui-monospace,monospace;color:var(--text);word-break:break-all;flex:1;min-width:0}.g2-sel-grp{font:500 9px/1 ui-monospace,monospace;color:var(--muted);text-transform:uppercase;letter-spacing:.08em;flex-shrink:0}.g2-sel-body{padding:11px 13px}.g2-sel-row{display:flex;justify-content:space-between;gap:12px;font-size:11px;padding:5px 0;border-bottom:1px solid var(--graph-divider);&:last-child{border-bottom:0}.k{color:var(--muted);flex-shrink:0}.v{color:var(--text);font-family:ui-monospace,monospace;word-break:break-all;text-align:right;min-width:0}}.g2-sel-section{padding:9px 13px;border-top:1px solid var(--graph-divider)}.g2-sel-section-label{font-family:inherit;font-weight:600;font-size:11px;line-height:1;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);opacity:.85;margin-bottom:5px}.g2-sel-section-empty{color:var(--muted);opacity:.55;font-size:11px;font-style:italic}.g2-sel-jumps{padding:11px 13px;display:flex;gap:5px;flex-wrap:wrap;border-top:1px solid var(--graph-divider)}.g2-sel-jump{background:var(--surface-active);border:1px solid var(--border);color:var(--accent);border-radius:var(--ui-radius, 4px);padding:2px 8px;font-family:inherit;font-weight:500;font-size:11px;line-height:1.3;&:hover{border-color:var(--accent)}}.g2-sel-file-list{list-style:none;margin:0;padding:0;max-height:110px;overflow:hidden auto;-webkit-app-region:no-drag;app-region:no-drag;&::-webkit-scrollbar{width:4px}&::-webkit-scrollbar-thumb{background:var(--border);border-radius:2px}& li{padding:0}}.g2-sel-file-link{display:flex;align-items:center;gap:6px;width:100%;background:transparent;border:0;border-radius:var(--ui-radius, 3px);padding:2px 6px;min-height:20.5px;font:400 11px/1.4 ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;color:var(--accent);text-align:left;&:hover{background:var(--graph-hover-bg)}.g2-sel-file-dot{width:7px;height:7px;border-radius:50%;flex-shrink:0}.g2-sel-file-path{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}}.g2-empty-state,.g2-sel-section-empty,.g2-dist-empty{cursor:default;user-select:none;-webkit-user-select:none}.g2-empty-state{background:var(--graph-hover-bg);border:1px dashed var(--border);border-radius:var(--ui-radius, 8px);padding:18px 14px;text-align:center;color:var(--muted);font-size:11px;line-height:1.5;& strong{color:var(--text);display:block;margin-bottom:4px;font-weight:500}}.g2-dist-bar{width:100%;height:5px;border-radius:3px;overflow:hidden;display:flex;background:var(--surface-active);margin-bottom:8px;>span{display:block;height:100%}}.g2-dist-list{display:flex;flex-direction:column;gap:0;flex:1 1 0;min-height:0;overflow-y:auto;overscroll-behavior:none;-webkit-app-region:no-drag;app-region:no-drag;scrollbar-gutter:stable;scrollbar-width:thin;scrollbar-color:var(--border) transparent;&::-webkit-scrollbar{width:5px}&::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}}.g2-dist-empty{color:var(--muted);opacity:.55;font-size:10px;font-style:italic;padding:6px 0;text-align:center}@media print{:host{display:none!important}}
|
|
1
|
+
import{$ as z,C as Ct,a as de,aa as Eo,b as Qt,ba as Pe,fa as ht,la as Bo,ma as Ce,na as Ke,pa as se,qa as Ze,z as Oo}from"./chunk-TINZZKP5.js";import{a as Ie}from"./chunk-R5O6FAW4.js";import{b as ie,c as Ao,d as ze}from"./chunk-CMQA4DM6.js";import"./chunk-ZPD5R5RP.js";import"./chunk-V3ME6FI5.js";import{h as $e}from"./chunk-YVZH5SHP.js";import{a as Lo}from"./chunk-4XCDFGDP.js";import"./chunk-3BZ7JERB.js";import{a as Ye}from"./chunk-TZ5KB2Y5.js";import"./chunk-XYFXXB2G.js";import{a as ve}from"./chunk-DIJJNTRH.js";import"./chunk-HIV7SVI7.js";import{j as Yt}from"./chunk-GNXOKIGP.js";import"./chunk-C4Z6ZBXV.js";import{a as Pt,c as I,i as oe,j as ce}from"./chunk-2XUEZHIP.js";import"./chunk-TUII34K2.js";import{f as Ro,g as _o,h as To,i as Fo}from"./chunk-V5O7M2YT.js";import"./chunk-OOJM4CTU.js";var qo=`*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:host{display:grid;grid-template-columns:1fr 300px;grid-template-rows:auto 1fr;grid-template-areas:"topbar right" "stage right";min-height:0;border:1px solid var(--border);border-radius:var(--ui-radius, 8px);overflow:hidden;background:var(--graph-canvas-bg);color:var(--text);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,sans-serif;font-size:12px}.graph2-layout{display:contents}:host([matrix]){grid-template-columns:minmax(0,1fr) 300px}.graph2-topbar{grid-area:topbar;display:flex;flex-direction:column;gap:.5rem;padding:var(--graph-topbar-padding, .6rem .75rem .6rem var(--graph-topbar-left-padding, .75rem));font-size:.825rem;background:var(--surface);backdrop-filter:var(--glass-blur);border-bottom:1px solid var(--graph-divider)}.graph2-topbar-row{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem;padding:0}.graph2-topbar .g2-spacer{flex:1}.graph2-topbar-row-pinned{flex-wrap:nowrap;align-items:flex-start}.graph2-topbar-row-pinned>#g2-fullscreen{margin-top:2px}.g2-topbar-controls{display:flex;flex:1;flex-wrap:wrap;align-items:center;gap:.75rem;min-width:0}.g2-topbar-controls>.g2-reason-scope,.g2-topbar-controls>.g2-issues-switch{margin-left:auto}.g2-topbar-controls>.g2-reason-scope+.g2-issues-switch{margin-left:0}.g2-topbar-controls .g2-path-filter-wrap{flex:1 1 8rem;min-width:0;max-width:12rem}.g2-matrix-controls{display:flex;align-items:center;flex-wrap:wrap;gap:8px;font-size:11px;& button{height:30px;padding:4px 7px;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);background:var(--surface);color:var(--text);font:inherit}& button:hover,button[aria-pressed=true]{background:var(--graph-hover-bg);border-color:var(--muted)}}.graph2-topbar triage-selector{margin-left:auto}.g2-icon-btn{width:28px;height:28px;border-radius:var(--ui-radius, 5px);background:var(--graph-hover-bg);border:1px solid var(--border);color:var(--muted);display:grid;place-items:center;font-family:inherit;&:hover{color:var(--accent);border-color:var(--accent)}}.g2-path-filter-wrap{position:relative;flex:0 0 12rem;padding-right:22px}.g2-path-filter-wrap .g2-path-filter-clear{position:absolute;right:4px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:18px;height:18px;background:transparent;border:0;border-radius:var(--ui-radius, 50%);color:var(--muted);font:400 10px/1 inherit;font-family:inherit;&:hover{color:var(--text);background:var(--surface-active)}}.g2-path-filter:placeholder-shown~.g2-path-filter-clear{display:none}.g2-layout-tabs{display:inline-flex;flex-shrink:0;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);padding:2px;gap:2px;& button{position:relative;display:inline-flex;align-items:center;justify-content:center;border:0;border-radius:var(--ui-radius, 4px);background:transparent;color:var(--muted);font:inherit;font-size:11px;padding:5px 7px}& button[aria-pressed=true]{background:var(--graph-hover-bg);color:var(--text);box-shadow:var(--graph-layout-active-shadow, inset 0 0 0 1px var(--border))}}.g2-reason-scope{--scope-height: 30px}.graph2-right{grid-area:right;border-left:1px solid var(--graph-divider);background:var(--surface);backdrop-filter:var(--glass-blur);display:flex;flex-direction:column;overflow:hidden;padding:14px}.g2-panel-title{font-family:inherit;font-weight:600;font-size:11px;line-height:1;letter-spacing:.14em;text-transform:uppercase;color:var(--muted);opacity:.85;margin:14px 0 8px;display:flex;align-items:baseline;gap:6px;&:first-child{margin-top:0}}.g2-panel-title-row{justify-content:space-between;gap:8px}#g2-top-pkgs-block{margin-top:14px;flex:1 1 0;min-height:0;display:flex;flex-direction:column}.g2-mini-tabs{display:flex;gap:1px;background:var(--graph-mini-tabs-bg, var(--graph-divider));border-radius:var(--ui-radius, 4px);overflow:hidden}.g2-mini-tab{background:transparent;border:0;color:var(--muted);font-family:inherit;font-weight:500;font-size:11px;line-height:1.4;text-transform:none;letter-spacing:0;padding:2px 7px;&:hover{color:var(--text);background:var(--graph-hover-bg)}&.on{background:var(--surface-active);color:var(--accent);text-decoration:var(--graph-mini-tab-active-decoration, none);text-underline-offset:.2em}}.graph2-stage{grid-area:stage;position:relative;background:var(--graph-canvas-bg);overflow:hidden;cursor:default;&:active{cursor:default}& canvas{position:absolute;inset:0;width:100%;height:100%;display:block}}.g2-stage-overlay{position:absolute;top:12px;left:12px;z-index:3;display:flex;flex-direction:column;gap:4px;pointer-events:none;max-width:calc(100% - 60px)}.g2-stage-overlay>*{pointer-events:auto}.g2-stage-stats{position:absolute;bottom:10px;left:12px;z-index:2;display:flex;flex-wrap:wrap;gap:2px 14px;font:500 10px/1.4 ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;color:var(--muted);opacity:.7;text-transform:uppercase;letter-spacing:.06em;pointer-events:none;max-width:calc(100% - 80px);& b{font-weight:600;color:var(--text);opacity:1}}.g2-stage-overlay-tr{position:absolute;top:12px;right:12px;z-index:3;pointer-events:auto}.g2-focus-pkg-btn{width:28px;height:28px;display:grid;place-items:center;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:var(--ui-radius, 6px);color:var(--accent);box-shadow:var(--shadow-glass);&:hover{border-color:var(--accent);background:var(--surface-active)}& svg{display:block}}.g2-back-btn{display:inline-flex;align-items:center;gap:4px;padding:6px 11px;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:var(--ui-radius, 6px);color:var(--accent);font:500 11px/1 inherit;font-family:inherit;box-shadow:var(--shadow-glass);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;align-self:flex-start;&:hover{border-color:var(--accent);background:var(--surface-active)}}.g2-tooltip{position:absolute;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:var(--ui-radius, 7px);padding:9px 11px;pointer-events:none;min-width:170px;max-width:260px;opacity:0;transition:opacity .12s;z-index:10;box-shadow:var(--shadow-glass);&.show{opacity:1}}.g2-tt-path{font:500 11px/1.3 ui-monospace,monospace;color:var(--text);word-break:break-all;margin-bottom:4px}.g2-tt-head{display:flex;align-items:center;gap:6px;margin-bottom:6px;flex-wrap:wrap}.g2-tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.g2-tt-pkg{font-size:10px;color:var(--muted);word-break:break-all}.g2-tooltip .tree-count-chips{margin-top:6px}:host-context(body.theme-light) .graph2-right .tree-count-chip.medium,:host-context(body.theme-light) .g2-tooltip .tree-count-chip.medium{color:#fff}.g2-selection-card{background:var(--graph-hover-bg);border:1px solid var(--border);border-radius:var(--ui-radius, 8px);overflow:hidden}.g2-sel-head{padding:11px 13px;border-bottom:1px solid var(--graph-divider);display:flex;align-items:center;gap:8px}.g2-sel-file-head{padding:11px 13px;border-bottom:1px solid var(--graph-divider);display:flex;flex-direction:column;gap:6px}.g2-sel-path{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;font-weight:600;font-size:12px;line-height:1.3;color:var(--text);word-break:break-all}.g2-sel-pkg-row{display:flex;align-items:center;gap:6px;min-width:0}.g2-sel-pkg{font-size:11px;color:var(--muted);word-break:break-all;min-width:0}.g2-sel-fullpath{padding:7px 13px;border-bottom:1px solid var(--graph-divider);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;font-size:10px;line-height:1.3;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.g2-sel-size{padding:5px 13px 7px;border-bottom:1px solid var(--graph-divider);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;font-size:10px;line-height:1.3;color:var(--muted);font-variant-numeric:tabular-nums}.g2-sel-dot{width:11px;height:11px;border-radius:50%;box-shadow:0 0 0 3px color-mix(in srgb,var(--dot) 22%,transparent);flex-shrink:0}.g2-sel-id{font:600 12px/1 ui-monospace,monospace;color:var(--text);word-break:break-all;flex:1;min-width:0}.g2-sel-grp{font:500 9px/1 ui-monospace,monospace;color:var(--muted);text-transform:uppercase;letter-spacing:.08em;flex-shrink:0}.g2-sel-body{padding:11px 13px}.g2-sel-row{display:flex;justify-content:space-between;gap:12px;font-size:11px;padding:5px 0;border-bottom:1px solid var(--graph-divider);&:last-child{border-bottom:0}.k{color:var(--muted);flex-shrink:0}.v{color:var(--text);font-family:ui-monospace,monospace;word-break:break-all;text-align:right;min-width:0}}.g2-sel-section{padding:9px 13px;border-top:1px solid var(--graph-divider)}.g2-sel-section-label{font-family:inherit;font-weight:600;font-size:11px;line-height:1;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);opacity:.85;margin-bottom:5px}.g2-sel-section-empty{color:var(--muted);opacity:.55;font-size:11px;font-style:italic}.g2-sel-jumps{padding:11px 13px;display:flex;gap:5px;flex-wrap:wrap;border-top:1px solid var(--graph-divider)}.g2-sel-jump{background:var(--surface-active);border:1px solid var(--border);color:var(--accent);border-radius:var(--ui-radius, 4px);padding:2px 8px;font-family:inherit;font-weight:500;font-size:11px;line-height:1.3;&:hover{border-color:var(--accent)}}.g2-sel-file-list{list-style:none;margin:0;padding:0;max-height:110px;overflow:hidden auto;-webkit-app-region:no-drag;app-region:no-drag;&::-webkit-scrollbar{width:4px}&::-webkit-scrollbar-thumb{background:var(--border);border-radius:2px}& li{padding:0}}.g2-sel-file-link{display:flex;align-items:center;gap:6px;width:100%;background:transparent;border:0;border-radius:var(--ui-radius, 3px);padding:2px 6px;min-height:20.5px;font:400 11px/1.4 ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;color:var(--accent);text-align:left;&:hover{background:var(--graph-hover-bg)}.g2-sel-file-dot{width:7px;height:7px;border-radius:50%;flex-shrink:0}.g2-sel-file-path{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}}.g2-empty-state,.g2-sel-section-empty,.g2-dist-empty{cursor:default;user-select:none;-webkit-user-select:none}.g2-empty-state{background:var(--graph-hover-bg);border:1px dashed var(--border);border-radius:var(--ui-radius, 8px);padding:18px 14px;text-align:center;color:var(--muted);font-size:11px;line-height:1.5;& strong{color:var(--text);display:block;margin-bottom:4px;font-weight:500}}.g2-dist-bar{width:100%;height:5px;border-radius:3px;overflow:hidden;display:flex;background:var(--surface-active);margin-bottom:8px;>span{display:block;height:100%}}.g2-dist-list{display:flex;flex-direction:column;gap:0;flex:1 1 0;min-height:0;overflow-y:auto;overscroll-behavior:none;-webkit-app-region:no-drag;app-region:no-drag;scrollbar-gutter:stable;scrollbar-width:thin;scrollbar-color:var(--border) transparent;&::-webkit-scrollbar{width:5px}&::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}}.g2-dist-empty{color:var(--muted);opacity:.55;font-size:10px;font-style:italic;padding:6px 0;text-align:center}@media print{:host{display:none!important}}
|
|
2
2
|
`;var he=`.g2-dist-item{display:grid;grid-template-columns:8px 1fr auto auto;gap:8px;align-items:center;font-size:10px;padding:2px 6px;min-height:20.5px;margin:0 -6px;background:transparent;border:0;border-radius:var(--ui-radius, 4px);font-family:inherit;text-align:left;width:calc(100% + 12px);&:hover{background:var(--graph-hover-bg)}&.on{background:var(--surface-active);.g2-dist-name{color:var(--accent)}}.g2-dist-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.g2-dist-name{color:var(--muted);font-family:ui-monospace,monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.g2-dist-count{font-family:ui-monospace,monospace;color:var(--text)}.g2-dist-pct{font-family:ui-monospace,monospace;color:var(--muted);width:36px;text-align:right;opacity:.85}}
|
|
3
3
|
`;var fe=`.g2-zoom-ctrl{position:absolute;right:12px;bottom:12px;display:flex;flex-direction:column;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:var(--ui-radius, 6px);overflow:hidden;z-index:3;box-shadow:var(--shadow-glass);& button{width:28px;height:28px;margin:0;padding:0;background:transparent;border:0;border-radius:0;color:var(--muted);border-bottom:1px solid var(--graph-divider);display:grid;place-items:center;font-family:inherit;font-size:13px;&:last-child{border-bottom:0}&:hover:not(:disabled){color:var(--accent);background:var(--surface-active)}&:disabled{opacity:.35}}}.g2-zoom-pct{font:500 9px/1 ui-monospace,monospace;color:var(--muted);padding:5px 0;text-align:center;border-bottom:1px solid var(--graph-divider)}.g2-zoom-ctrl .g2-zoom-fit-btn{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;font-weight:600;font-size:9px;line-height:1;letter-spacing:-.02em;text-transform:lowercase}
|
|
4
4
|
`;var Ho=`.tree-count-chips{display:inline-flex;gap:.25rem;flex-wrap:wrap}.tree-count-chip{display:inline-block;font-size:.65rem;font-weight:600;text-transform:uppercase;letter-spacing:.03em;padding:.1rem .4rem;border-radius:3px;line-height:1.3;&.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}}
|
package/out/index.html
CHANGED
|
@@ -21,23 +21,23 @@
|
|
|
21
21
|
<meta name="apple-mobile-web-app-title" content="DeepView" />
|
|
22
22
|
<link rel="preload" href="./view.css" as="style" />
|
|
23
23
|
<link rel="modulepreload" href="./view.js" />
|
|
24
|
-
<link rel="modulepreload" href="./chunk-
|
|
24
|
+
<link rel="modulepreload" href="./chunk-6C76GAXK.js" />
|
|
25
25
|
<link rel="modulepreload" href="./chunk-KEX2ATEW.js" />
|
|
26
|
-
<link rel="modulepreload" href="./chunk-
|
|
26
|
+
<link rel="modulepreload" href="./chunk-QSLWGJBQ.js" />
|
|
27
27
|
<link rel="modulepreload" href="./chunk-2KBF5TZ7.js" />
|
|
28
28
|
<link rel="modulepreload" href="./chunk-K3X5EJBQ.js" />
|
|
29
29
|
<link rel="modulepreload" href="./chunk-CVVJAXVY.js" />
|
|
30
30
|
<link rel="modulepreload" href="./chunk-VIHGO77Y.js" />
|
|
31
31
|
<link rel="modulepreload" href="./chunk-RFZQQXSG.js" />
|
|
32
32
|
<link rel="modulepreload" href="./chunk-F4OMDNEY.js" />
|
|
33
|
-
<link rel="modulepreload" href="./chunk-
|
|
33
|
+
<link rel="modulepreload" href="./chunk-XYDGU6BM.js" />
|
|
34
34
|
<link rel="modulepreload" href="./chunk-UYAXVRVL.js" />
|
|
35
35
|
<link rel="modulepreload" href="./chunk-NRPC74AM.js" />
|
|
36
|
-
<link rel="modulepreload" href="./chunk-
|
|
36
|
+
<link rel="modulepreload" href="./chunk-XRWAV3DX.js" />
|
|
37
37
|
<link rel="modulepreload" href="./chunk-W4J3MGLB.js" />
|
|
38
38
|
<link rel="modulepreload" href="./chunk-GJ4IUCNS.js" />
|
|
39
39
|
<link rel="modulepreload" href="./chunk-PNHBZGDD.js" />
|
|
40
|
-
<link rel="modulepreload" href="./chunk-
|
|
40
|
+
<link rel="modulepreload" href="./chunk-TINZZKP5.js" />
|
|
41
41
|
<link rel="modulepreload" href="./chunk-R5O6FAW4.js" />
|
|
42
42
|
<link rel="modulepreload" href="./chunk-CMQA4DM6.js" />
|
|
43
43
|
<link rel="modulepreload" href="./chunk-ZPD5R5RP.js" />
|
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-6Z5XLSPJ.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-DCQX2J3C.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-F4OMDNEY.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-SD2WJAXN.js";import{f as ga}from"./chunk-UYAXVRVL.js";import"./chunk-NRPC74AM.js";import"./chunk-BYUEDJOM.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-OJ5DGP5E.js";import"./chunk-R5O6FAW4.js";import{b as Sa,d as ht}from"./chunk-CMQA4DM6.js";import{g as ha}from"./chunk-ZPD5R5RP.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-HIV7SVI7.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 zd,d as Tn}from"./chunk-6C76GAXK.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-QSLWGJBQ.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-F4OMDNEY.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-XYDGU6BM.js";import{f as ga}from"./chunk-UYAXVRVL.js";import"./chunk-NRPC74AM.js";import"./chunk-XRWAV3DX.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-TINZZKP5.js";import"./chunk-R5O6FAW4.js";import{b as Sa,d as ht}from"./chunk-CMQA4DM6.js";import{g as ha}from"./chunk-ZPD5R5RP.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-HIV7SVI7.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=`
|
|
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>
|
|
@@ -31,7 +31,7 @@ Use this only if you have lost access to your passkey and have no other way to u
|
|
|
31
31
|
`,xt(e,n=>{n&&(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 r=this._chunks[t];if(!r||r.asked)return;r.asked=!0;let n=ou(this._lines,r.start),s=[...n?this._lines.slice(n[0],n[1]):[],...this._lines.slice(r.start,r.end)].join(`
|
|
32
32
|
`),o=await yt(s,"markdown");if(!this.isConnected)return;let c=o===null?null:Ni(o).slice(n?n[1]-n[0]:0);e.innerHTML=sm(this._lines,r.start,r.end,c?.length===r.end-r.start?c:null),e.classList.remove("evd-pending")}};customElements.define("export-view-dialog",qn);function cu(i){return new Promise(e=>{let t=document.createElement("export-view-dialog");t.markdown=i;let r=()=>{t.remove(),e()};t.addEventListener("resolve",r),t.addEventListener("modal-conflict",r),document.body.append(t)})}var du=`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
33
|
`;var Hn=class extends q{static styles=[...q.styles,M(bt),M(du)];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:"",r=(this.initial??"").length>0,n=this._trimmed,s=wi(n);return a`<dialog @close="${this._onClose}"><header><h3>${r?"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="${n}" 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">${r?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="${!n}" @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",Hn);function uu({initial:i="",finding:e=null,canApplyToGroup:t=!1}={}){return Y("fix-link-dialog",{initial:i,finding:e,canApplyToGroup:t})}var pu=`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 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-JAKWIZWL.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:
|
|
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-XNGEQO7Y.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:
|
|
35
35
|
|
|
36
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
37
|
`;var km="http://www.w3.org/2000/svg",rs=1.5,$m=0;function ge(i,e={}){let t=document.createElementNS(km,i);for(let[r,n]of Object.entries(e))t.setAttribute(r,String(n));return t}function xm(i){let e=document.createElement("div");e.className="screen-crack",e.setAttribute("aria-hidden","true");let t=document.createElement("style");t.textContent=Hu;let r=ge("svg",{viewBox:`0 0 ${i.width} ${i.height}`,preserveAspectRatio:"none"});r.classList.add("screen-crack-svg");let n=ge("defs"),s=`screen-crack-mask-${++$m}`,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"})),n.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}});r.append(n,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,r,f),{overlay:e,glass:p,cracks:c,shards:d,flash:f}}function Sm(i,e,t){for(let r of e.cracks){let n=r.points.map((s,o)=>`${o===0?"M":"L"}${s.x} ${s.y}`).join(" ");for(let s of[!0,!1]){let o=ge("path",{d:n,fill:"none",stroke:s?"rgb(0 0 0 / .55)":"rgb(232 244 255 / .95)","stroke-width":r.width+(s?.8:0),"stroke-linecap":"round","stroke-linejoin":"round"});s&&o.setAttribute("transform","translate(.5 .7)"),o.style.strokeDasharray=`${r.length} ${r.length}`,o.style.strokeDashoffset=String(r.length),i.append(o),t(o,[{strokeDashoffset:String(r.length)},{strokeDashoffset:"0"}],{duration:r.duration*rs,delay:r.delay*rs,easing:"cubic-bezier(.2,.7,.2,1)"})}}}function Uu(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 r=qu(t,e),{overlay:n,glass:s,cracks:o,shards:c,flash:u}=xm(r);document.body.append(n);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),n.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),Sm(o,r,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(...r.cracks.map(T=>T.delay+T.duration))*rs,_=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 re of[T,F])h(re,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 ju=`: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}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@preventive/triage",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.39",
|
|
4
4
|
"description": "Client & relay server for triaging of automated reports",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -356,6 +356,7 @@
|
|
|
356
356
|
"oxc-minify": "^0.152.0",
|
|
357
357
|
"oxc-parser": "^0.152.0",
|
|
358
358
|
"oxfmt": "^0.72.0",
|
|
359
|
+
"semver": "^7.8.5",
|
|
359
360
|
"ws": "^8.22.0"
|
|
360
361
|
},
|
|
361
362
|
"peerDependencies": {
|
|
@@ -51,6 +51,13 @@ const CODE = /\.(?:[cm]?[jt]s|[jt]sx)$/iu
|
|
|
51
51
|
const DECLARATION = /\.d\.[cm]?ts$/iu
|
|
52
52
|
export const npmLargeCode = (path, bytes) => typeof bytes === 'number' && bytes >= NPM_LARGE_CODE && CODE.test(path) && !DECLARATION.test(path)
|
|
53
53
|
|
|
54
|
+
// A code file that isn't text (npmFileReadability's `binary`: not UTF-8, or
|
|
55
|
+
// holding a NUL), by its path and how it reads, a declaration file too: no
|
|
56
|
+
// one can read it in review, yet what reads it by its byte order mark can
|
|
57
|
+
// run it, or type with it, as UTF-16 (a browser's classic script, Windows
|
|
58
|
+
// Script Host, TypeScript).
|
|
59
|
+
export const npmBinaryCode = (path, readability) => readability?.category === 'binary' && CODE.test(path)
|
|
60
|
+
|
|
54
61
|
// A file with a line over UNREADABLE_LINE characters, by how it reads
|
|
55
62
|
// (`now`, npmFileReadability's), `path` its path: an inline source map's line
|
|
56
63
|
// counts for none, and prose and source maps, whose long lines the Long lines
|
package/risk/files/runs-code.js
CHANGED
|
@@ -106,7 +106,7 @@ const READS = new RegExp(String.raw`${JS_STRING_OR_COMMENT.source}|(?<eval>${nam
|
|
|
106
106
|
// text names it (`requires a token in GITHUB_TOKEN`); a command publishing (`npm publish`, `pnpm
|
|
107
107
|
// publish …`, options before it as npm takes them, `npm --tag next publish`)
|
|
108
108
|
// or the registry's who-am-I, a publisher's first step with a token. And the
|
|
109
|
-
// registry
|
|
109
|
+
// registry, where a PUT request is one publishing (REGISTRY_URL).
|
|
110
110
|
// Told first of a string by what any of them says.
|
|
111
111
|
const HOLDS_ANY = /\.(?:npmrc|ssh|aws)|_TOKEN|publish|whoami|registry\./u
|
|
112
112
|
// Before a token's name as a key, its absence told or the token dropped, as
|
|
@@ -118,11 +118,39 @@ const HOLDS_ANY = /\.(?:npmrc|ssh|aws)|_TOKEN|publish|whoami|registry\./u
|
|
|
118
118
|
const KEY_SET = new RegExp(String.raw`^\s{0,4}\]${SET}`, 'u')
|
|
119
119
|
const KEY_ENDS = new RegExp(String.raw`^\s{0,4}\]${ABSENT_ENDS}`, 'mu')
|
|
120
120
|
const KEY_ABSENT = /(?:!|\bdelete\s)[\s(]{0,4}(?:[\p{ID_Continue}$]{1,64}\s{0,4}\??\.\s{0,4}){0,4}[\p{ID_Continue}$]{1,64}\s{0,4}(?:\?\.\s{0,4})?\[\s{0,4}$/u
|
|
121
|
+
// A string's text as JavaScript reads it, its escapes decoded (`\x2f`,
|
|
122
|
+
// `\u002f`, `\u{2f}`, sloppy mode's octal `\057`, `\/`, `\\`, `\n`, `\t`), a
|
|
123
|
+
// line continued (a backslash before a line's end) joined: what a URL in it
|
|
124
|
+
// spells, however its separators are escaped or its lines broken.
|
|
125
|
+
const ESCAPE = /\\(?:x([\da-f]{2})|u([\da-f]{4})|u\{([\da-f]{1,6})\}|([0-3][0-7]{0,2}|[4-7][0-7]?)|(\r\n|[^]))/giu
|
|
126
|
+
const CONTROLS = new Map([['n', '\n'], ['r', '\r'], ['t', '\t'], ['b', '\b'], ['f', '\f'], ['v', '\v']])
|
|
127
|
+
const LINE_ENDS = new Set(['\n', '\r', '\r\n', '\u2028', '\u2029'])
|
|
128
|
+
const unescaped = text => text.replace(ESCAPE, (escape, hex, unit, point, octal, char) => {
|
|
129
|
+
if (char !== undefined) return LINE_ENDS.has(char) ? '' : CONTROLS.get(char) ?? char
|
|
130
|
+
const code = octal === undefined ? Number.parseInt(hex ?? unit ?? point, 16) : Number.parseInt(octal, 8)
|
|
131
|
+
return code <= 0x10_FFFF ? String.fromCodePoint(code) : escape
|
|
132
|
+
})
|
|
133
|
+
// The registry's host in a string, as JavaScript reads it (unescaped) and a
|
|
134
|
+
// URL's parsing does, its tabs and line breaks gone, as a URL's authority: after two slashes, backslashes URLs take for them too, or
|
|
135
|
+
// after an http(s) scheme's colon (its slashes optional there, as URLs take
|
|
136
|
+
// them), its userinfo between, to its last `@` before the URL's path, query or
|
|
137
|
+
// fragment, quotes and all, 256
|
|
138
|
+
// characters at most, as credentials are, so a URL's every start is read
|
|
139
|
+
// in bounded time (`https://registry.npmjs.org/`, `.npmrc`'s
|
|
140
|
+
// `//registry.npmjs.org/`, `https://${token}@registry.npmjs.org/`,
|
|
141
|
+
// `https:\\\\registry.npmjs.org`, `https:\x2f\x2fregistry.npmjs.org`,
|
|
142
|
+
// `https:registry.npmjs.org`); or starting the string, its whole or before its
|
|
143
|
+
// path, port, query or fragment (npm-profile's `'registry.npmjs.org'`, a URL joined,
|
|
144
|
+
// `'https://' + 'registry.npmjs.org/'`). Not in prose, as anywhere else
|
|
145
|
+
// (`registry.npmjs.org</span>`, `asks registry.npmjs.org`, `[registry.npmjs.org]`,
|
|
146
|
+
// `note:registry.npmjs.org`, `user@registry.npmjs.org`, `docs/registry.npmjs.org`).
|
|
147
|
+
const REGISTRY_HOST = String.raw`registry\.(?:npmjs\.org|yarnpkg\.com)`
|
|
148
|
+
const REGISTRY_URL = new RegExp(String.raw`(?:[/\\]{2}|\bhttps?:[/\\]?)(?:[^/\\?#]{0,256}@)?${REGISTRY_HOST}|^(["'\u0060])${REGISTRY_HOST}(?=\1$|[/:?#])`, 'iu')
|
|
149
|
+
const URL_STRIPPED = /[\t\n\r]/gu
|
|
121
150
|
const HOLDS = [
|
|
122
151
|
['credential-files', /(?<![\w$.-])\.(?:npmrc|ssh|aws)(?![\w-])/gu],
|
|
123
152
|
['tokens', new RegExp(String.raw`^["'\u0060]${TOKEN_VAR}["'\u0060]$|(?:\$\{?|%)${TOKEN_VAR}(?![\p{ID_Continue}$])`, 'gu')],
|
|
124
153
|
['publish', /(?<![\w-])(?:npm|pnpm|yarn)(?:\s+-{1,2}\w[\w-]*(?:=\S*|\s+(?!-)\S+)?){0,8}?\s+publish(?![\w-])|\/-\/whoami(?![\w-])/gu],
|
|
125
|
-
['registry', /registry\.(?:npmjs\.org|yarnpkg\.com)/gu],
|
|
126
154
|
]
|
|
127
155
|
// A module a kind loads: vm, child_process, and libnpmpublish, npm's own
|
|
128
156
|
// publishing.
|
|
@@ -222,6 +250,7 @@ function read(code, base, at) {
|
|
|
222
250
|
}
|
|
223
251
|
const held = HOLDS_ANY.test(text) ? HOLDS.flatMap(([kind, holds]) => [...text.matchAll(holds)].map(({ index: within }) => [kind, within])) : []
|
|
224
252
|
for (const [kind, within] of held) if (kind !== 'tokens' || within > 0 || keyed()) at(kind, base + index + within)
|
|
253
|
+
if (text.includes('registry.') && REGISTRY_URL.test(unescaped(text).replace(URL_STRIPPED, ''))) at('registry', base + index)
|
|
225
254
|
for (const [kind, name] of MODULES) if (name.test(string) && loaded(code, index)) at(kind, base + index)
|
|
226
255
|
if (program && ARGUMENTS_BETWEEN.test(code.slice(end, index))) {
|
|
227
256
|
if (PUBLISH.test(string)) at('publish', base + index)
|