@preventive/triage 1.0.0-alpha.12 → 1.0.0-alpha.13

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/view.js CHANGED
@@ -1,90 +1,110 @@
1
- var Ws=globalThis,qs=Ws.ShadowRoot&&(Ws.ShadyCSS===void 0||Ws.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Hp=Symbol(),Up=new WeakMap,Ks=class{constructor(t,r,n){if(this._$cssResult$=!0,n!==Hp)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=r}get styleSheet(){let t=this.o,r=this.t;if(qs&&t===void 0){let n=r!==void 0&&r.length===1;n&&(t=Up.get(r)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&Up.set(r,t))}return t}toString(){return this.cssText}},B=e=>new Ks(typeof e=="string"?e:e+"",void 0,Hp);var Vp=(e,t)=>{if(qs)e.adoptedStyleSheets=t.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet);else for(let r of t){let n=document.createElement("style"),o=Ws.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=r.cssText,e.appendChild(n)}},ol=qs?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let r="";for(let n of t.cssRules)r+=n.cssText;return B(r)})(e):e;var{is:Vv,defineProperty:jv,getOwnPropertyDescriptor:Wv,getOwnPropertyNames:Kv,getOwnPropertySymbols:qv,getPrototypeOf:Gv}=Object,Gs=globalThis,jp=Gs.trustedTypes,Yv=jp?jp.emptyScript:"",Jv=Gs.reactiveElementPolyfillSupport,uo=(e,t)=>e,sl={toAttribute(e,t){switch(t){case Boolean:e=e?Yv:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=e!==null;break;case Number:r=e===null?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},Kp=(e,t)=>!Vv(e,t),Wp={attribute:!0,type:String,converter:sl,reflect:!1,useDefault:!1,hasChanged:Kp};Symbol.metadata??=Symbol("metadata"),Gs.litPropertyMetadata??=new WeakMap;var zt=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,r=Wp){if(r.state&&(r.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((r=Object.create(r)).wrapped=!0),this.elementProperties.set(t,r),!r.noAccessor){let n=Symbol(),o=this.getPropertyDescriptor(t,n,r);o!==void 0&&jv(this.prototype,t,o)}}static getPropertyDescriptor(t,r,n){let{get:o,set:s}=Wv(this.prototype,t)??{get(){return this[r]},set(i){this[r]=i}};return{get:o,set(i){let l=o?.call(this);s?.call(this,i),this.requestUpdate(t,l,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Wp}static _$Ei(){if(this.hasOwnProperty(uo("elementProperties")))return;let t=Gv(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(uo("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(uo("properties"))){let r=this.properties,n=[...Kv(r),...qv(r)];for(let o of n)this.createProperty(o,r[o])}let t=this[Symbol.metadata];if(t!==null){let r=litPropertyMetadata.get(t);if(r!==void 0)for(let[n,o]of r)this.elementProperties.set(n,o)}this._$Eh=new Map;for(let[r,n]of this.elementProperties){let o=this._$Eu(r,n);o!==void 0&&this._$Eh.set(o,r)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let r=[];if(Array.isArray(t)){let n=new Set(t.flat(1/0).reverse());for(let o of n)r.unshift(ol(o))}else t!==void 0&&r.push(ol(t));return r}static _$Eu(t,r){let n=r.attribute;return n===!1?void 0:typeof n=="string"?n:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,r=this.constructor.elementProperties;for(let n of r.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Vp(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,r,n){this._$AK(t,n)}_$ET(t,r){let n=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,n);if(o!==void 0&&n.reflect===!0){let s=(n.converter?.toAttribute!==void 0?n.converter:sl).toAttribute(r,n.type);this._$Em=t,s==null?this.removeAttribute(o):this.setAttribute(o,s),this._$Em=null}}_$AK(t,r){let n=this.constructor,o=n._$Eh.get(t);if(o!==void 0&&this._$Em!==o){let s=n.getPropertyOptions(o),i=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:sl;this._$Em=o;let l=i.fromAttribute(r,s.type);this[o]=l??this._$Ej?.get(o)??l,this._$Em=null}}requestUpdate(t,r,n,o=!1,s){if(t!==void 0){let i=this.constructor;if(o===!1&&(s=this[t]),n??=i.getPropertyOptions(t),!((n.hasChanged??Kp)(s,r)||n.useDefault&&n.reflect&&s===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,n))))return;this.C(t,r,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,r,{useDefault:n,reflect:o,wrapped:s},i){n&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??r??this[t]),s!==!0||i!==void 0)||(this._$AL.has(t)||(this.hasUpdated||n||(r=void 0),this._$AL.set(t,r)),o===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(r){Promise.reject(r)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[o,s]of this._$Ep)this[o]=s;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[o,s]of n){let{wrapped:i}=s,l=this[o];i!==!0||this._$AL.has(o)||l===void 0||this.C(o,void 0,s,l)}}let t=!1,r=this._$AL;try{t=this.shouldUpdate(r),t?(this.willUpdate(r),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(r)):this._$EM()}catch(n){throw t=!1,this._$EM(),n}t&&this._$AE(r)}willUpdate(t){}_$AE(t){this._$EO?.forEach(r=>r.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(r=>this._$ET(r,this[r])),this._$EM()}updated(t){}firstUpdated(t){}};zt.elementStyles=[],zt.shadowRootOptions={mode:"open"},zt[uo("elementProperties")]=new Map,zt[uo("finalized")]=new Map,Jv?.({ReactiveElement:zt}),(Gs.reactiveElementVersions??=[]).push("2.1.2");var al=globalThis,qp=e=>e,Ys=al.trustedTypes,Gp=Ys?Ys.createPolicy("lit-html",{createHTML:e=>e}):void 0,ll="$lit$",Ut=`lit$${Math.random().toFixed(9).slice(2)}$`,cl="?"+Ut,Xv=`<${cl}>`,Hr=document,fo=()=>Hr.createComment(""),ho=e=>e===null||typeof e!="object"&&typeof e!="function",dl=Array.isArray,ef=e=>dl(e)||typeof e?.[Symbol.iterator]=="function",il=`[
2
- \f\r]`,po=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Yp=/-->/g,Jp=/>/g,zr=RegExp(`>|${il}(?:([^\\s"'>=/]+)(${il}*=${il}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Xp=/'/g,Qp=/"/g,tf=/^(?:script|style|textarea|title)$/i,ul=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),d=ul(1),ar=ul(2),OC=ul(3),be=Symbol.for("lit-noChange"),g=Symbol.for("lit-nothing"),Zp=new WeakMap,Ur=Hr.createTreeWalker(Hr,129);function rf(e,t){if(!dl(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Gp!==void 0?Gp.createHTML(t):t}var nf=(e,t)=>{let r=e.length-1,n=[],o,s=t===2?"<svg>":t===3?"<math>":"",i=po;for(let l=0;l<r;l++){let c=e[l],u,p,f=-1,h=0;for(;h<c.length&&(i.lastIndex=h,p=i.exec(c),p!==null);)h=i.lastIndex,i===po?p[1]==="!--"?i=Yp:p[1]!==void 0?i=Jp:p[2]!==void 0?(tf.test(p[2])&&(o=RegExp("</"+p[2],"g")),i=zr):p[3]!==void 0&&(i=zr):i===zr?p[0]===">"?(i=o??po,f=-1):p[1]===void 0?f=-2:(f=i.lastIndex-p[2].length,u=p[1],i=p[3]===void 0?zr:p[3]==='"'?Qp:Xp):i===Qp||i===Xp?i=zr:i===Yp||i===Jp?i=po:(i=zr,o=void 0);let b=i===zr&&e[l+1].startsWith("/>")?" ":"";s+=i===po?c+Xv:f>=0?(n.push(u),c.slice(0,f)+ll+c.slice(f)+Ut+b):c+Ut+(f===-2?l:b)}return[rf(e,s+(e[r]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),n]},go=class e{constructor({strings:t,_$litType$:r},n){let o;this.parts=[];let s=0,i=0,l=t.length-1,c=this.parts,[u,p]=nf(t,r);if(this.el=e.createElement(u,n),Ur.currentNode=this.el.content,r===2||r===3){let f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(o=Ur.nextNode())!==null&&c.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(let f of o.getAttributeNames())if(f.endsWith(ll)){let h=p[i++],b=o.getAttribute(f).split(Ut),m=/([.?@])?(.*)/.exec(h);c.push({type:1,index:s,name:m[2],strings:b,ctor:m[1]==="."?Xs:m[1]==="?"?Qs:m[1]==="@"?Zs:jr}),o.removeAttribute(f)}else f.startsWith(Ut)&&(c.push({type:6,index:s}),o.removeAttribute(f));if(tf.test(o.tagName)){let f=o.textContent.split(Ut),h=f.length-1;if(h>0){o.textContent=Ys?Ys.emptyScript:"";for(let b=0;b<h;b++)o.append(f[b],fo()),Ur.nextNode(),c.push({type:2,index:++s});o.append(f[h],fo())}}}else if(o.nodeType===8)if(o.data===cl)c.push({type:2,index:s});else{let f=-1;for(;(f=o.data.indexOf(Ut,f+1))!==-1;)c.push({type:7,index:s}),f+=Ut.length-1}s++}}static createElement(t,r){let n=Hr.createElement("template");return n.innerHTML=t,n}};function Vr(e,t,r=e,n){if(t===be)return t;let o=n!==void 0?r._$Co?.[n]:r._$Cl,s=ho(t)?void 0:t._$litDirective$;return o?.constructor!==s&&(o?._$AO?.(!1),s===void 0?o=void 0:(o=new s(e),o._$AT(e,r,n)),n!==void 0?(r._$Co??=[])[n]=o:r._$Cl=o),o!==void 0&&(t=Vr(e,o._$AS(e,t.values),o,n)),t}var Js=class{constructor(t,r){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=r}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:r},parts:n}=this._$AD,o=(t?.creationScope??Hr).importNode(r,!0);Ur.currentNode=o;let s=Ur.nextNode(),i=0,l=0,c=n[0];for(;c!==void 0;){if(i===c.index){let u;c.type===2?u=new vn(s,s.nextSibling,this,t):c.type===1?u=new c.ctor(s,c.name,c.strings,this,t):c.type===6&&(u=new ei(s,this,t)),this._$AV.push(u),c=n[++l]}i!==c?.index&&(s=Ur.nextNode(),i++)}return Ur.currentNode=Hr,o}p(t){let r=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(t,n,r),r+=n.strings.length-2):n._$AI(t[r])),r++}},vn=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,r,n,o){this.type=2,this._$AH=g,this._$AN=void 0,this._$AA=t,this._$AB=r,this._$AM=n,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,r=this._$AM;return r!==void 0&&t?.nodeType===11&&(t=r.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,r=this){t=Vr(this,t,r),ho(t)?t===g||t==null||t===""?(this._$AH!==g&&this._$AR(),this._$AH=g):t!==this._$AH&&t!==be&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):ef(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==g&&ho(this._$AH)?this._$AA.nextSibling.data=t:this.T(Hr.createTextNode(t)),this._$AH=t}$(t){let{values:r,_$litType$:n}=t,o=typeof n=="number"?this._$AC(t):(n.el===void 0&&(n.el=go.createElement(rf(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===o)this._$AH.p(r);else{let s=new Js(o,this),i=s.u(this.options);s.p(r),this.T(i),this._$AH=s}}_$AC(t){let r=Zp.get(t.strings);return r===void 0&&Zp.set(t.strings,r=new go(t)),r}k(t){dl(this._$AH)||(this._$AH=[],this._$AR());let r=this._$AH,n,o=0;for(let s of t)o===r.length?r.push(n=new e(this.O(fo()),this.O(fo()),this,this.options)):n=r[o],n._$AI(s),o++;o<r.length&&(this._$AR(n&&n._$AB.nextSibling,o),r.length=o)}_$AR(t=this._$AA.nextSibling,r){for(this._$AP?.(!1,!0,r);t!==this._$AB;){let n=qp(t).nextSibling;qp(t).remove(),t=n}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},jr=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,r,n,o,s){this.type=1,this._$AH=g,this._$AN=void 0,this.element=t,this.name=r,this._$AM=o,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=g}_$AI(t,r=this,n,o){let s=this.strings,i=!1;if(s===void 0)t=Vr(this,t,r,0),i=!ho(t)||t!==this._$AH&&t!==be,i&&(this._$AH=t);else{let l=t,c,u;for(t=s[0],c=0;c<s.length-1;c++)u=Vr(this,l[n+c],r,c),u===be&&(u=this._$AH[c]),i||=!ho(u)||u!==this._$AH[c],u===g?t=g:t!==g&&(t+=(u??"")+s[c+1]),this._$AH[c]=u}i&&!o&&this.j(t)}j(t){t===g?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Xs=class extends jr{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===g?void 0:t}},Qs=class extends jr{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==g)}},Zs=class extends jr{constructor(t,r,n,o,s){super(t,r,n,o,s),this.type=5}_$AI(t,r=this){if((t=Vr(this,t,r,0)??g)===be)return;let n=this._$AH,o=t===g&&n!==g||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,s=t!==g&&(n===g||o);o&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},ei=class{constructor(t,r,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=r,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){Vr(this,t)}},of={M:ll,P:Ut,A:cl,C:1,L:nf,R:Js,D:ef,V:Vr,I:vn,H:jr,N:Qs,U:Zs,B:Xs,F:ei},Qv=al.litHtmlPolyfillSupport;Qv?.(go,vn),(al.litHtmlVersions??=[]).push("3.3.3");var G=(e,t,r)=>{let n=r?.renderBefore??t,o=n._$litPart$;if(o===void 0){let s=r?.renderBefore??null;n._$litPart$=o=new vn(t.insertBefore(fo(),s),s,void 0,r??{})}return o._$AI(e),o};var pl=globalThis,Q=class extends zt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=G(r,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return be}};Q._$litElement$=!0,Q.finalized=!0,pl.litElementHydrateSupport?.({LitElement:Q});var Zv=pl.litElementPolyfillSupport;Zv?.({LitElement:Q});(pl.litElementVersions??=[]).push("4.2.2");var He={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},_t=e=>(...t)=>({_$litDirective$:e,values:t}),at=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,r,n){this._$Ct=t,this._$AM=r,this._$Ci=n}_$AS(t,r){return this.update(t,r)}update(t,r){return this.render(...r)}};var F=_t(class extends at{constructor(e){if(super(e),e.type!==He.ATTRIBUTE||e.name!=="class"||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter(t=>e[t]).join(" ")+" "}update(e,[t]){if(this.st===void 0){this.st=new Set,e.strings!==void 0&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter(n=>n!=="")));for(let n in t)t[n]&&!this.nt?.has(n)&&this.st.add(n);return this.render(t)}let r=e.element.classList;for(let n of this.st)n in t||(r.remove(n),this.st.delete(n));for(let n in t){let o=!!t[n];o===this.st.has(n)||this.nt?.has(n)||(o?(r.add(n),this.st.add(n)):(r.remove(n),this.st.delete(n)))}return be}});var{I:ew}=of,sf=e=>e;var lf=e=>e.strings===void 0,af=()=>document.createComment(""),wn=(e,t,r)=>{let n=e._$AA.parentNode,o=t===void 0?e._$AB:t._$AA;if(r===void 0){let s=n.insertBefore(af(),o),i=n.insertBefore(af(),o);r=new ew(s,i,e,e.options)}else{let s=r._$AB.nextSibling,i=r._$AM,l=i!==e;if(l){let c;r._$AQ?.(e),r._$AM=e,r._$AP!==void 0&&(c=e._$AU)!==i._$AU&&r._$AP(c)}if(s!==o||l){let c=r._$AA;for(;c!==s;){let u=sf(c).nextSibling;sf(n).insertBefore(c,o),c=u}}}return r},lr=(e,t,r=e)=>(e._$AI(t,r),e),tw={},ti=(e,t=tw)=>e._$AH=t,cf=e=>e._$AH,ri=e=>{e._$AR(),e._$AA.remove()};var df=(e,t,r)=>{let n=new Map;for(let o=t;o<=r;o++)n.set(e[o],o);return n},J=_t(class extends at{constructor(e){if(super(e),e.type!==He.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,r){let n;r===void 0?r=t:t!==void 0&&(n=t);let o=[],s=[],i=0;for(let l of e)o[i]=n?n(l,i):i,s[i]=r(l,i),i++;return{values:s,keys:o}}render(e,t,r){return this.dt(e,t,r).values}update(e,[t,r,n]){let o=cf(e),{values:s,keys:i}=this.dt(t,r,n);if(!Array.isArray(o))return this.ut=i,s;let l=this.ut??=[],c=[],u,p,f=0,h=o.length-1,b=0,m=s.length-1;for(;f<=h&&b<=m;)if(o[f]===null)f++;else if(o[h]===null)h--;else if(l[f]===i[b])c[b]=lr(o[f],s[b]),f++,b++;else if(l[h]===i[m])c[m]=lr(o[h],s[m]),h--,m--;else if(l[f]===i[m])c[m]=lr(o[f],s[m]),wn(e,c[m+1],o[f]),f++,m--;else if(l[h]===i[b])c[b]=lr(o[h],s[b]),wn(e,o[f],o[h]),h--,b++;else if(u===void 0&&(u=df(i,b,m),p=df(l,f,h)),u.has(l[f]))if(u.has(l[h])){let v=p.get(i[b]),w=v!==void 0?o[v]:null;if(w===null){let y=wn(e,o[f]);lr(y,s[b]),c[b]=y}else c[b]=lr(w,s[b]),wn(e,o[f],w),o[v]=null;b++}else ri(o[h]),h--;else ri(o[f]),f++;for(;b<=m;){let v=wn(e,c[m+1]);lr(v,s[b]),c[b++]=v}for(;f<=h;){let v=o[f++];v!==null&&ri(v)}return this.ut=i,ti(e,c),be}});var uf="important",rw=" !"+uf,de=_t(class extends at{constructor(e){if(super(e),e.type!==He.ATTRIBUTE||e.name!=="style"||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce((t,r)=>{let n=e[r];return n==null?t:t+`${r=r.includes("-")?r:r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(e,[t]){let{style:r}=e.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let n of this.ft)t[n]==null&&(this.ft.delete(n),n.includes("-")?r.removeProperty(n):r[n]=null);for(let n in t){let o=t[n];if(o!=null){this.ft.add(n);let s=typeof o=="string"&&o.endsWith(rw);n.includes("-")||s?r.setProperty(n,s?o.slice(0,-11):o,s?uf:""):r[n]=o}}return be}});var ml=new WeakMap,gf=Symbol("iteration key");function nw(e){ml.set(e,new Map)}function ow(e,{target:t,key:r,type:n}){n==="iterate"&&(r=gf);let o=ml.get(t),s=o.get(r);s||(s=new Set,o.set(r,s)),s.has(e)||(s.add(e),e.cleaners.push(s))}function sw({target:e,key:t,type:r}){let n=ml.get(e),o=new Set;if(r==="clear"?n.forEach((s,i)=>{fl(o,n,i)}):fl(o,n,t),r==="add"||r==="delete"||r==="clear"){let s=Array.isArray(e)?"length":gf;fl(o,n,s)}return o}function fl(e,t,r){let n=t.get(r);n&&n.forEach(e.add,e)}function mf(e){e.cleaners&&e.cleaners.forEach(iw,e),e.cleaners=[]}function iw(e){e.delete(this)}var kn=[],hl=!1;function aw(e,t,r,n){if(e.unobserved)return Reflect.apply(t,r,n);if(kn.indexOf(e)===-1){mf(e);try{return kn.push(e),Reflect.apply(t,r,n)}finally{kn.pop()}}}function mt(e){let t=kn[kn.length-1];t&&(bf(t,e),ow(t,e))}function cr(e){sw(e).forEach(lw,e)}function lw(e){bf(e,this),typeof e.scheduler=="function"?e.scheduler(e):typeof e.scheduler=="object"?e.scheduler.add(e):e()}function bf(e,t){if(e.debugger&&!hl)try{hl=!0,e.debugger(t)}finally{hl=!1}}function yf(){return kn.length>0}var pf=Symbol("is reaction");function vf(e,t={}){let r=e[pf]?e:function n(){return aw(n,e,this,arguments)};return r.scheduler=t.scheduler,r.debugger=t.debugger,r[pf]=!0,t.lazy||r(),r}function bl(e){e.unobserved||(e.unobserved=!0,mf(e)),typeof e.scheduler=="object"&&e.scheduler.delete(e)}var Ne=new WeakMap,si=new WeakMap,cw=Object.prototype.hasOwnProperty;function oi(e){let t=si.get(e);return yf()&&typeof e=="object"&&e!==null?t||ii(e):t||e}function gl(e,t){let r=e.next;return e.next=()=>{let{done:n,value:o}=r.call(e);return n||(t?o[1]=oi(o[1]):o=oi(o)),{done:n,value:o}},e}var ff={has(e){let t=Ne.get(this),r=Reflect.getPrototypeOf(this);return mt({target:t,key:e,type:"has"}),r.has.apply(t,arguments)},get(e){let t=Ne.get(this),r=Reflect.getPrototypeOf(this);return mt({target:t,key:e,type:"get"}),oi(r.get.apply(t,arguments))},add(e){let t=Ne.get(this),r=Reflect.getPrototypeOf(this),n=r.has.call(t,e),o=r.add.apply(t,arguments);return n||cr({target:t,key:e,value:e,type:"add"}),o},set(e,t){let r=Ne.get(this),n=Reflect.getPrototypeOf(this),o=n.has.call(r,e),s=n.get.call(r,e),i=n.set.apply(r,arguments);return o?t!==s&&cr({target:r,key:e,value:t,oldValue:s,type:"set"}):cr({target:r,key:e,value:t,type:"add"}),i},delete(e){let t=Ne.get(this),r=Reflect.getPrototypeOf(this),n=r.has.call(t,e),o=r.get?r.get.call(t,e):void 0,s=r.delete.apply(t,arguments);return n&&cr({target:t,key:e,oldValue:o,type:"delete"}),s},clear(){let e=Ne.get(this),t=Reflect.getPrototypeOf(this),r=e.size!==0,n=e instanceof Map?new Map(e):new Set(e),o=t.clear.apply(e,arguments);return r&&cr({target:e,oldTarget:n,type:"clear"}),o},forEach(e,...t){let r=Ne.get(this),n=Reflect.getPrototypeOf(this);mt({target:r,type:"iterate"});let o=(s,...i)=>e(oi(s),...i);return n.forEach.call(r,o,...t)},keys(){let e=Ne.get(this),t=Reflect.getPrototypeOf(this);return mt({target:e,type:"iterate"}),t.keys.apply(e,arguments)},values(){let e=Ne.get(this),t=Reflect.getPrototypeOf(this);mt({target:e,type:"iterate"});let r=t.values.apply(e,arguments);return gl(r,!1)},entries(){let e=Ne.get(this),t=Reflect.getPrototypeOf(this);mt({target:e,type:"iterate"});let r=t.entries.apply(e,arguments);return gl(r,!0)},[Symbol.iterator](){let e=Ne.get(this),t=Reflect.getPrototypeOf(this);mt({target:e,type:"iterate"});let r=t[Symbol.iterator].apply(e,arguments);return gl(r,e instanceof Map)},get size(){let e=Ne.get(this),t=Reflect.getPrototypeOf(this);return mt({target:e,type:"iterate"}),Reflect.get(t,"size",e)}},ni={get(e,t,r){return e=cw.call(ff,t)?ff:e,Reflect.get(e,t,r)}},hf=typeof window=="object"?window:Function("return this")(),wf=new Map([[Map,ni],[Set,ni],[WeakMap,ni],[WeakSet,ni],[Object,!1],[Array,!1],[Int8Array,!1],[Uint8Array,!1],[Uint8ClampedArray,!1],[Int16Array,!1],[Uint16Array,!1],[Int32Array,!1],[Uint32Array,!1],[Float32Array,!1],[Float64Array,!1]]);function dw({constructor:e}){return!(typeof e=="function"&&e.name in hf&&hf[e.name]===e)||wf.has(e)}function uw(e){return wf.get(e.constructor)}var kf=Object.prototype.hasOwnProperty,pw=new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(e=>typeof e=="symbol"));function fw(e,t,r){let n=Reflect.get(e,t,r);if(typeof t=="symbol"&&pw.has(t))return n;mt({target:e,key:t,receiver:r,type:"get"});let o=si.get(n);if(yf()&&typeof n=="object"&&n!==null){if(o)return o;let s=Reflect.getOwnPropertyDescriptor(e,t);if(!s||!(s.writable===!1&&s.configurable===!1))return ii(n)}return o||n}function hw(e,t){let r=Reflect.has(e,t);return mt({target:e,key:t,type:"has"}),r}function gw(e){return mt({target:e,type:"iterate"}),Reflect.ownKeys(e)}function mw(e,t,r,n){typeof r=="object"&&r!==null&&(r=Ne.get(r)||r);let o=kf.call(e,t),s=e[t],i=Reflect.set(e,t,r,n);return e!==Ne.get(n)||(o?r!==s&&cr({target:e,key:t,value:r,oldValue:s,receiver:n,type:"set"}):cr({target:e,key:t,value:r,receiver:n,type:"add"})),i}function bw(e,t){let r=kf.call(e,t),n=e[t],o=Reflect.deleteProperty(e,t);return r&&cr({target:e,key:t,oldValue:n,type:"delete"}),o}var yw={get:fw,has:hw,ownKeys:gw,set:mw,deleteProperty:bw};function ii(e={}){return Ne.has(e)||!dw(e)?e:si.get(e)||vw(e)}function vw(e){let t=uw(e)||yw,r=new Proxy(e,t);return si.set(e,r),Ne.set(r,e),nw(e),r}var $f=ii;function yl(e){let t=!0,r=vf(()=>{try{e(t)}finally{t=!1}},{lazy:!0});try{r()}catch(n){throw bl(r),n}return()=>bl(r)}var U=class extends Q{_disposers=[];observes=null;connectedCallback(){super.connectedCallback(),this.bindState()}bindState(){if(this.observes){this._disposers.push(yl(t=>{this.observes(),t||this.requestUpdate()}));return}this._render||(this._render=this.render,this.render=()=>{let t,r=yl(n=>{if(!n){r(),this._dispose===r&&(this._dispose=null),this.updateComplete.then(()=>this.requestUpdate());return}t=this._render()});return this._dispose=r,t}),this._disposers.push(()=>this._dispose&&this._dispose())}disconnectedCallback(){for(super.disconnectedCallback();this._disposers.length>0;)this._disposers.pop()()}};globalThis[Symbol.for("@rray/frontend")]={LitElement:Q,html:d,nothing:g,render:G,unsafeCSS:B,StateElement:U,classMap:F,repeat:J,styleMap:de};var fe=document.querySelector("#drop-zone"),E=document.querySelector("#report"),xf=document.querySelector("app-sidebar");function Ht(e,t){let r=URL.createObjectURL(e),n=document.createElement("span");n.style.display="none",G(d`<a href="${r}" download="${t}"></a>`,n),document.body.append(n),n.firstElementChild.click(),n.remove(),URL.revokeObjectURL(r)}function St(e){return new Error("Another dialog is already open. Close it and try again.",{cause:e})}var ww="solidity-bundle",kw="0.0.0";function $n(e){if(e?.name!==ww)return!1;let t=e.version;return!t||t===kw}function Sf(e){let t=e?.package?.npm,r=t?.version;if(typeof r=="string"&&r&&!$n(t))return r;let n=e?.file;if(!n)return null;let o=/(?:^|\/)node_modules\/\.pnpm\/([^/]+)\/node_modules\//u.exec(n);if(!o)return null;let s=o[1],i=s.indexOf("_");i>0&&(s=s.slice(0,i));let l=s.lastIndexOf("@");return l<=0?null:s.slice(l+1)||null}function ai(){return{keys:new Set,findings:[],files:new Map,reports:new Set,_keyReports:new Map}}function li(e,t,r,n){e.reports.add(r);let o=e._keyReports.get(t);o||e._keyReports.set(t,o=new Set);let s=!o.has(r);return o.add(r),e.keys.has(t)||(e.keys.add(t),e.findings.push(n),e.files.has(n.file)||e.files.set(n.file,[]),e.files.get(n.file).push(n)),s}function ci(e,t,r,n){e._keyReports.delete(t),e.keys.delete(t);let o=e.findings.findIndex(l=>n(l)===t);o>=0&&e.findings.splice(o,1);let s=e.files.get(r);if(!s)return;let i=s.findIndex(l=>n(l)===t);i>=0&&s.splice(i,1),s.length===0&&e.files.delete(r)}function di(e){let t=new Set;for(let r of e._keyReports.values())for(let n of r)t.add(n);e.reports=t}function Cf(e,t,r,n,o){let s=e.byVersion.get(t);s||(s=ai(),e.byVersion.set(t,s)),li(s,n,o,r)}function Ef(e,t,r,n,o,s){let i=e.byVersion.get(t);if(!i)return;let l=i._keyReports.get(r);if(l&&(l.delete(o),l.size===0&&ci(i,r,n,s)),i._keyReports.size===0){e.byVersion.delete(t);return}di(i)}function vl(e,t){if(e===t)return 0;if(e===null)return 1;if(t===null)return-1;let[r,n=""]=_f(e,"-"),[o,s=""]=_f(t,"-"),i=r.split("."),l=o.split("."),c=Math.max(i.length,l.length);for(let u=0;u<c;u++){let p=i[u]??"0",f=l[u]??"0",h=/^\d+$/u.test(p),b=/^\d+$/u.test(f);if(h&&b){let m=Number(f)-Number(p);if(m!==0)return m}else{let m=f.localeCompare(p);if(m!==0)return m}}return n===""&&s!==""?-1:n!==""&&s===""?1:s.localeCompare(n)}function _f(e,t){let r=e.indexOf(t);return r<0?[e,""]:[e.slice(0,r),e.slice(r+1)]}var $w=new TextEncoder,xw=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function te(e){if(typeof e!="string")throw new TypeError(`encodeUtf8 expects a string, got ${typeof e}`);if(!e.isWellFormed())throw new TypeError("encodeUtf8: input contains lone surrogates");return $w.encode(e)}function xe(e){if(!ArrayBuffer.isView(e)&&!(e instanceof ArrayBuffer))throw new TypeError(`decodeUtf8 expects a BufferSource, got ${e===null?"null":typeof e}`);return xw.decode(e)}async function mo(e){let t=new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(t).arrayBuffer())}async function Ct(e,{maxBytes:t}={}){let r=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip"));if(t==null)return new Uint8Array(await new Response(r).arrayBuffer());let n=r.getReader(),o=[],s=0;for(;;){let{value:c,done:u}=await n.read();if(u)break;if(s+=c.length,s>t){try{await n.cancel()}catch{}throw new Error(`gunzipBytes: decompressed size exceeds ${t}-byte cap`)}o.push(c)}let i=new Uint8Array(s),l=0;for(let c of o)i.set(c,l),l+=c.length;return i}async function ui(e){return await mo(te(e))}async function bo(e){return xe(await Ct(e))}async function Af(e){let t=await crypto.subtle.digest("SHA-512",e);return`sha512-${new Uint8Array(t).toBase64()}`}var bt=new Uint8Array([68,86,69,49]),xn=12,_w=32,Sw="deepview-passkey.v1.content-key";function yo(){return!(typeof window>"u"||typeof PublicKeyCredential>"u"||typeof navigator>"u"||!navigator.credentials)}async function Tf(){if(typeof PublicKeyCredential>"u")return!1;let e=PublicKeyCredential.getClientCapabilities;if(typeof e!="function")return null;try{let t=await e.call(PublicKeyCredential);if(!t||typeof t!="object")return null;let r=t["extension:prf"],n=t.prf;return r===!0||n===!0?!0:r===!1||n===!1?!1:null}catch{return null}}function pi(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),t}async function wl(e){if(e.length<32)throw new Error(`PRF output too short (${e.length} bytes; need \u2265 32)`);let t=await crypto.subtle.importKey("raw",e,"HKDF",!1,["deriveBits"]),r=await crypto.subtle.deriveBits({name:"HKDF",hash:"SHA-256",salt:new Uint8Array,info:te(Sw)},t,_w*8);return new Uint8Array(r)}function kl(e){return crypto.subtle.importKey("raw",e,{name:"AES-GCM"},!1,["encrypt","decrypt"])}async function dr(e,t,r){let n=pi(xn),o=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:n,additionalData:r},e,t)),s=new Uint8Array(bt.length+xn+o.length);return s.set(bt,0),s.set(n,bt.length),s.set(o,bt.length+xn),s}async function Wr(e,t,r){if(!qe(t))throw new Error("passkey: missing envelope magic");if(t.length<bt.length+xn+16)throw new Error("passkey: envelope too short");let n=t.subarray(bt.length,bt.length+xn),o=t.subarray(bt.length+xn);return new Uint8Array(await crypto.subtle.decrypt({name:"AES-GCM",iv:n,additionalData:r},e,o))}function qe(e){if(e.length<bt.length)return!1;for(let t=0;t<bt.length;t++)if(e[t]!==bt[t])return!1;return!0}async function If(e){if(!yo())throw new Error("passkey: not supported in this environment");let t=pi(32),r=pi(32),n=await navigator.credentials.create({publicKey:{challenge:t,rp:{name:e.rpName,id:e.rpId},user:{id:e.userId,name:e.userName,displayName:e.userName},pubKeyCredParams:[{type:"public-key",alg:-7},{type:"public-key",alg:-257}],authenticatorSelection:{residentKey:"required",userVerification:"required"},extensions:{prf:{eval:{first:r}}},timeout:e.timeoutMs??12e4},...e.signal?{signal:e.signal}:{}});if(!(n instanceof PublicKeyCredential))throw new Error("passkey: registration returned no credential");let o=new Uint8Array(n.rawId).toBase64({alphabet:"base64url",omitPadding:!0}),s=n.getClientExtensionResults().prf,i=s?.results?.first?new Uint8Array(s.results.first):null;return{credentialId:o,prfSalt:r.toBase64({alphabet:"base64url",omitPadding:!0}),prfOutput:i}}async function $l(e){if(!yo())throw new Error("passkey: not supported in this environment");let t=pi(32),r=Uint8Array.fromBase64(e.credentialId,{alphabet:"base64url"}),n=Uint8Array.fromBase64(e.prfSalt,{alphabet:"base64url"}),o=await navigator.credentials.get({publicKey:{challenge:t,rpId:e.rpId,allowCredentials:[{type:"public-key",id:r}],userVerification:"required",extensions:{prf:{eval:{first:n}}},timeout:e.timeoutMs??12e4},...e.signal?{signal:e.signal}:{}});if(!(o instanceof PublicKeyCredential))throw new Error("passkey: assertion returned no credential");let i=o.getClientExtensionResults().prf?.results?.first;if(!i)throw new Error("passkey: authenticator did not return PRF output (extension unsupported)");return new Uint8Array(i)}var vo=Object.freeze(["deepview.workspaces","deepview.sync.sessions","deepview.sync.userEnabled","deepview.sync.password","deepview.repoUrls","deepview.fileCounts","deepview.lastFile"]),Ve=new Map,hi=!1,Vt=new Map,lt=new Map,fi=new Set;function _n(e){let t=()=>e();return fi.add(t),hi&&queueMicrotask(()=>{if(fi.has(t))try{t()}catch(r){console.warn("secure-storage after-hydrate listener:",r)}}),()=>fi.delete(t)}function Cw(){for(let e of fi)try{e()}catch(t){console.warn("secure-storage after-hydrate listener:",t)}}function gi(e){let t=Bf()??"";return te(`deepview.secure.v1|${t}|${e}`)}function xl(e){try{let t=Uint8Array.fromBase64(e);if(qe(t))return t}catch{}return null}function Ae(e){return Ve.get(e)??null}async function Fe(e,t){if(typeof t!="string")throw new TypeError("secure-storage: value must be a string");if(se()&&!Be())throw new Error(`secure-storage: vault locked, cannot save "${e}"`);if(Ff())throw new Error(`secure-storage: wipe in progress, cannot save "${e}"`);let r=Ve.has(e),n=Ve.get(e);Ve.set(e,t),lt.set(e,t);let o=Vt.get(e)??Promise.resolve(),s=()=>{lt.get(e)===t&&lt.delete(e)},i=o.catch(()=>{}).then(()=>Ew(e,t)).then(()=>s(),l=>{throw s(),Ve.get(e)===t&&(r?Ve.set(e,n):Ve.delete(e)),l});Vt.set(e,i.catch(()=>{})),await i}async function Sn(e){let t=Symbol("secure-storage:removed");Ve.delete(e),lt.set(e,t);let r=Vt.get(e)??Promise.resolve(),n=()=>{try{localStorage.removeItem(e)}catch{}lt.get(e)===t&&(lt.delete(e),Ve.delete(e))},o=r.catch(()=>{}).then(()=>n());Vt.set(e,o.catch(()=>{})),await o}async function Ew(e,t){let r=Be();if(r){let n=await dr(r,te(t),gi(e));localStorage.setItem(e,n.toBase64())}else localStorage.setItem(e,t)}async function ur(){hi||Te(()=>{ur().catch(r=>console.warn("secure-storage rehydrate:",r))}),hi=!0;for(let r of[...Ve.keys()])lt.has(r)||Ve.delete(r);let e=Be(),t=[];for(let r of vo){if(lt.has(r))continue;let n=localStorage.getItem(r);if(n===null)continue;let o=xl(n);if(o){if(!e)continue;try{let s=await Wr(e,o,gi(r));if(lt.has(r))continue;Ve.set(r,xe(s))}catch(s){console.warn(`secure-storage: decrypt failed for "${r}":`,s)}}else Ve.set(r,n),e&&se()&&t.push([r,n])}Cw(),t.length>0&&queueMicrotask(()=>{for(let[r,n]of t)Ve.get(r)===n&&Fe(r,n).catch(o=>{console.warn(`secure-storage: self-heal failed for "${r}":`,o)})})}async function Rf(e,t){let r=Vt.get(e)??Promise.resolve(),n=async()=>{if(lt.has(e))return;let s=localStorage.getItem(e);if(s===null)return;let i=await t(s);i!==null&&(lt.has(e)||(localStorage.setItem(e,i.storageValue),Ve.set(e,i.cacheValue)))},o=r.catch(()=>{}).then(n);Vt.set(e,o.catch(()=>{})),await o}async function _l({seal:e}){for(let t of vo)await Rf(t,async r=>{if(xl(r))return null;let n=Be();return n?{storageValue:(await dr(n,te(r),gi(t))).toBase64(),cacheValue:r}:null})}async function Sl({open:e}){for(let t of vo)await Rf(t,async r=>{let n=xl(r);if(!n)return null;let o=await e(n,gi(t)),s=xe(o);return{storageValue:s,cacheValue:s}})}var Aw="deepview.secure.v1.mutate:";function Cl(e,t){return vo.includes(e)?navigator.locks.request(Aw+e,async()=>{let r=Vt.get(e);r&&await r.catch(()=>{}),await ur();let n=Ae(e),o=await t(n);if(!(o==null||o===n)){if(typeof o!="string")throw new TypeError(`secure-storage: mutate updater for "${e}" must return a string`);await Fe(e,o)}}):Promise.reject(new Error(`secure-storage: mutate() called with non-secure key "${e}"`))}async function Mf(){await Promise.allSettled([...Vt.values()]),lt.clear(),Vt.clear()}typeof window<"u"&&window.addEventListener("storage",e=>{!hi||!e.key||!vo.includes(e.key)||ur().catch(()=>{})});var $o="deepview.passkey.v1",Cn="deepview.passkey.userId",bi="deepview.passkey.cleanDisable",Ze="deepview.passkey.v1.write",Iw="deepview.triage.v1|",Rw="deepview.opfs.v1|",Mw="deepview.bundle.v1|",le=null,Et=null,pr=null,ko=0;function Tl(){return ko>0}var El=0;function Ff(){return El>0}function Kr(){try{let e=localStorage.getItem($o);if(!e)return null;let t=JSON.parse(e);return t&&typeof t=="object"&&t.enabled===!0&&typeof t.credentialId=="string"&&t.credentialId.length>0&&typeof t.prfSalt=="string"&&t.prfSalt.length>0&&typeof t.userId=="string"&&t.userId.length>0?t:null}catch{return null}}function Lf(e){localStorage.setItem($o,JSON.stringify(e))}function Fw(){localStorage.removeItem($o)}function Bw(){try{let t=localStorage.getItem(Cn);if(t){let r=Uint8Array.fromBase64(t,{alphabet:"base64url"});if(r.length===16)return r}}catch{}let e=new Uint8Array(16);crypto.getRandomValues(e);try{localStorage.setItem(Cn,e.toBase64({alphabet:"base64url",omitPadding:!0}))}catch{}return e}function yi(){return typeof location>"u"?"":location.hostname}function se(){return Kr()!==null}function yt(){return le!==null}function At(){return!(!yo()||typeof navigator>"u"||!navigator.locks?.request||!yi())}function Bf(){return Et}function xo(){if(Kr()!==null)return!1;try{return localStorage.getItem(bi)==="1"?!1:localStorage.getItem(Cn)!==null}catch{return!1}}function Be(){return le}function _o(){return te(Iw+(Et??""))}function vi(e){if(typeof e!="string")throw new TypeError("passkey vault: OPFS AAD requires a filename string");return te(Rw+(Et??"")+"|"+e)}function wi(e){if(typeof e!="string")throw new TypeError("passkey vault: bundle AAD requires a slot string");return te(Mw+(Et??"")+"|"+e)}var Al=new Set;function Te(e){return Al.add(e),()=>Al.delete(e)}function En(){for(let e of Al)try{e()}catch(t){console.warn("passkey vault listener:",t)}}async function So({signal:e}={}){let t=Kr();if(!t)return!1;let r;try{r=await $l({credentialId:t.credentialId,prfSalt:t.prfSalt,rpId:t.rpId??yi(),...e?{signal:e}:{}})}catch(o){if(o&&o.name==="NotAllowedError"||o&&o.name==="AbortError")return!1;throw o&&o.message?.includes("PRF")?wo(o):o}if(!r||r.length<32)throw wo();let n=await wl(r);return r.fill(0),navigator.locks.request(Ze,async()=>{let o=Kr();if(!o||o.credentialId!==t.credentialId)throw n.fill(0),new Error("passkey: vault state changed during unlock (another tab wiped or re-enabled it). Reload this page and try again.");return le=await kl(n),n.fill(0),Et=o.userId,pr=o.credentialId,En(),!0})}function wo(e){let t=new Error("Your browser or authenticator doesn't support passkey-derived encryption keys (the WebAuthn PRF extension). Try Chrome 116+, Safari 18+, or Firefox 130+ on a device with a platform authenticator (TouchID / Windows Hello).");return e&&(t.cause=e),t}function Il({migrate:e,userName:t,rpName:r,signal:n,acknowledgeOrphan:o}){if(!yo())throw new Error("passkey: WebAuthn unavailable in this environment");if(xo()&&!o)throw new Error("passkey: a previous vault exists on this device with no metadata. Any data encrypted under the old passkey will be unreadable after a new setup. Call enableEncryption({acknowledgeOrphan: true}) to proceed, or wipeAllVaultData() to start clean first.");let s=yi();return navigator.locks.request(Ze,async()=>{if(se())throw new Error("passkey: encryption is already enabled");if(await Tf()===!1)throw wo();let l=Bw(),c=await If({userName:t||"DeepView user",userId:l,rpName:r||"DeepView",rpId:s,...n?{signal:n}:{}}),u=c.prfOutput;if(!u)try{u=await $l({credentialId:c.credentialId,prfSalt:c.prfSalt,rpId:s,...n?{signal:n}:{}})}catch(m){let v=l.toBase64({alphabet:"base64url",omitPadding:!0});await mi({credentialId:c.credentialId,rpId:s,userId:v}).catch(()=>{});try{localStorage.removeItem(Cn)}catch{}throw m&&m.message?.includes("PRF")?wo(m):m}if(!u||u.length<32){let m=l.toBase64({alphabet:"base64url",omitPadding:!0});await mi({credentialId:c.credentialId,rpId:s,userId:m}).catch(()=>{});try{localStorage.removeItem(Cn)}catch{}throw wo()}let p=await wl(u);u.fill(0);let f=await kl(p);p.fill(0);let h=l.toBase64({alphabet:"base64url",omitPadding:!0}),b={enabled:!0,credentialId:c.credentialId,prfSalt:c.prfSalt,userId:h,rpId:s,createdAt:Date.now()};le=f,Et=h,pr=c.credentialId,Lf(b),typeof e=="function"&&await e({seal:(v,w)=>dr(f,v,w)});try{localStorage.removeItem(bi)}catch{}return En(),!0})}async function Rl({migrate:e}){if(!se())return{disabled:!1,signalAttempted:!1};if(!yt())throw new Error("passkey: must unlock before disabling encryption");ko+=1;try{return await navigator.locks.request(Ze,async()=>{let t=Kr();if(!t)return{disabled:!1,signalAttempted:!1};let r=le;if(!r)return{disabled:!1,signalAttempted:!1};if(Fw(),le=null,pr=null,typeof e=="function"){let o=(s,i)=>Wr(r,s,i);try{await e({open:o})}catch(s){throw Lf(t),le=r,pr=t.credentialId,En(),s}}Et=null;try{localStorage.setItem(bi,"1")}catch{}let n=await mi(t).catch(()=>!1);return En(),{disabled:!0,signalAttempted:n}})}finally{ko-=1}}async function mi({credentialId:e,rpId:t,userId:r}){if(typeof PublicKeyCredential>"u"||!t)return!1;let n=PublicKeyCredential,o=!1;if(typeof n.signalUnknownCredential=="function"){o=!0;try{await n.signalUnknownCredential({rpId:t,credentialId:e})}catch{}}if(typeof n.signalAllAcceptedCredentials=="function"&&r){o=!0;try{await n.signalAllAcceptedCredentials({rpId:t,userId:r,allAcceptedCredentialIds:[]})}catch{}}return o}async function Lw(e,t){try{return await e.removeEntry(t,{recursive:!0}),null}catch(r){return r?.name==="NotFoundError"?null:`${t}: ${r?.message??String(r)}`}}async function Ow(e){let t=[];if(typeof navigator>"u"||!navigator.storage?.getDirectory)return t;let r;try{r=await navigator.storage.getDirectory()}catch(n){return t.push(`storage root: ${n?.message??String(n)}`),t}for(let n of e){let o=await Lw(r,n);o&&t.push(o)}return t}async function Co({refuseIfEnabled:e=!1}={}){ko+=1,El+=1;try{return await navigator.locks.request(Ze,async()=>{if(e&&se())throw new Error("passkey: encryption was just enabled in another tab. Reload this page to unlock instead of wiping.");await Mf();let t=Kr();if(t)try{await mi({credentialId:t.credentialId,rpId:t.rpId??yi(),userId:t.userId})}catch{}try{localStorage.removeItem($o)}catch{}try{localStorage.removeItem(Cn)}catch{}try{localStorage.removeItem(bi)}catch{}for(let n of["deepview.workspaces","deepview.sync.sessions","deepview.sync.userEnabled","deepview.repoUrls","deepview.fileCounts","deepview.lastFile","deepview.triage","deepview.triage.pending","deepview.passkey.firstImportPrompted","deepview.viewMode"])try{localStorage.removeItem(n)}catch{}try{let n=[];for(let o=0;o<localStorage.length;o+=1){let s=localStorage.key(o);s&&s.startsWith("deepview.report:")&&n.push(s)}for(let o of n)try{localStorage.removeItem(o)}catch{}}catch{}le=null,Et=null,pr=null,En();let r=await Ow(["deepview-reports","deepview-bundles"]);if(r.length>0)throw new Error(`passkey: wipe partially succeeded \u2014 localStorage cleared but the following OPFS paths could not be removed: ${r.join("; ")}. Open DevTools \u2192 Application \u2192 Storage \u2192 Origin Private File System to inspect, or use the browser's site-data clear tool to finish.`)})}finally{ko-=1,El-=1}}function Of(e){return le?dr(le,e,_o()):Promise.reject(new Error("passkey: vault locked, cannot seal triage"))}function Pf(e){return le?Wr(le,e,_o()):Promise.reject(new Error("passkey: vault locked, cannot open triage"))}function ki(e,t){return le?dr(le,e,vi(t)):Promise.reject(new Error("passkey: vault locked, cannot seal OPFS file"))}function Nf(e,t){return le?Wr(le,e,vi(t)):Promise.reject(new Error("passkey: vault locked, cannot open OPFS file"))}function Ml(e,t){return le?dr(le,e,wi(t)):Promise.reject(new Error("passkey: vault locked, cannot seal bundle"))}function Fl(e,t){return le?Wr(le,e,wi(t)):Promise.reject(new Error("passkey: vault locked, cannot open bundle"))}typeof window<"u"&&window.addEventListener("storage",e=>{if(e.key!==$o)return;let t=Kr();(!t&&le||t&&le&&t.credentialId!==pr)&&(le=null,Et=null,pr=null),En()});var Ol="__meta__",Pw="deepview-reports",Pl="deepview-bundles",hr="deepview.report:",Df=!1;async function Nl(e,{create:t,warnOnce:r=!1}={}){try{return await(await navigator.storage.getDirectory()).getDirectoryHandle(e,{create:t})}catch(n){return r&&!Df&&(Df=!0,console.warn("OPFS unavailable, falling back to gzipped localStorage (limited quota).",n)),null}}async function xi(e,t){let r=await e.createWritable();try{await r.write(t),await r.close()}catch(n){try{await r.abort(n)}catch{}throw n}}async function Dl(e,t){if(!qe(e))return e;if(!Be())throw new Error(`storage: vault locked, cannot decrypt "${t}"`);return await Nf(e,t)}function _i(e){return e.length===0?!0:e.length>=18&&e[0]===31&&e[1]===139&&e.at(-4)===0&&e.at(-3)===0&&e.at(-2)===0&&e.at(-1)===0}async function zl(e,t){Ao(e)===t&&(console.warn(`storage: report "${e}" is an empty/corrupt on-disk entry \u2014 quarantining, will read as missing`),await navigator.locks.request(Ze,{mode:"exclusive"},async()=>{if(Ao(e)!==t)return;ue(e),ct.delete(e);let r=await gr();if(r)try{await r.removeEntry(e)}catch{}Si(e),ue(e),qr(e,"delete")}))}async function Ul(e,t,r){try{(await t.getFile()).size===0&&await e.removeEntry(r)}catch{}}async function Eo(e,t,r,n,o=()=>{}){if(se()&&!Be())throw o(),new Error(`storage: vault locked, cannot save ${n}`);let s=Be(),i=s?await t(e,r):e;if(Be()!==s)throw o(),new Error(`storage: vault state changed mid-save for ${n}; retry`);return i}function gr(){return Nl(Pw,{create:!0,warnOnce:!0})}function $i(e){try{return localStorage.getItem(hr+e)}catch{return null}}function Si(e){try{localStorage.removeItem(hr+e)}catch{}}function Nw(){let e=[];for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);r&&r.startsWith(hr)&&e.push(r.slice(hr.length))}return e}var ct=new Map,fr=new Map,Bl=new Map;function ue(e){Bl.set(e,(Bl.get(e)??0)+1)}function Ao(e){return Bl.get(e)??0}var Ll=new Set;function Io(e){return Ll.add(e),()=>Ll.delete(e)}function qr(e,t){for(let r of Ll)try{r(e,t)}catch(n){console.warn("storage file-change listener:",n)}}async function ie(){let e=new Set(Nw()),t=await gr();if(t)for await(let[r]of t.entries())e.add(r);return[...e].toSorted()}async function dt(e,t){if(typeof e!="string"||e.includes("\0"))throw new Error("Invalid report name: contains NUL byte or is not a string");if(t==="")throw new Error(`Refusing to save empty report "${e}"`);return ue(e),navigator.locks.request(Ze,{mode:"shared"},async()=>{let r=await gr();if(r){let s=await mo(te(t));s=await Eo(s,ki,e,`"${e}"`,()=>ue(e));let i=await r.getFileHandle(e,{create:!0}),l=await i.createWritable();try{await l.write(s),await l.close()}catch(c){ct.delete(e),ue(e);try{await l.abort(c)}catch{}throw await Ul(r,i,e),c}ct.set(e,t),ue(e),Si(e),qr(e,"save");return}let n=te(t);n=await mo(n),n=await Eo(n,ki,e,`"${e}"`,()=>ue(e));let o=n.toBase64();try{localStorage.setItem(hr+e,o),ct.set(e,t),ue(e),qr(e,"save")}catch(s){throw ue(e),new Error(`localStorage write failed for ${e}: ${s.message}`,{cause:s})}})}async function zf(e,t){let r=$i(e);if(r===null)return null;let n=Uint8Array.fromBase64(r);if(n=await Dl(n,e),_i(n))throw await zl(e,t),new Error(`File not found: ${e}`);return xe(await Ct(n))}async function Le(e){if(ct.has(e))return ct.get(e);if(fr.has(e))return fr.get(e);let t=Ao(e),r=(async()=>{let n=await gr();if(n){let s;try{s=await n.getFileHandle(e)}catch(u){if(u instanceof DOMException&&u.name==="NotFoundError"){let p=await zf(e,t);if(p!==null)return dt(e,p).catch(f=>{console.warn(`storage: stranded-localStorage migration of "${e}" failed:`,f)}),p}throw u}let i=await s.getFile(),l=new Uint8Array(await i.arrayBuffer());if(l=await Dl(l,e),_i(l))throw await zl(e,t),new Error(`File not found: ${e}`);if(l.length>=2&&l[0]===31&&l[1]===139){let u=await Ct(l);return xe(u)}let c=xe(l);return dt(e,c).catch(u=>{console.warn(`storage: legacy-uncompressed migration of "${e}" failed:`,u)}),c}let o=await zf(e,t);if(o===null)throw new Error(`File not found: ${e}`);return o})();fr.set(e,r);try{let n=await r;return Ao(e)===t&&ct.set(e,n),n}finally{fr.delete(e)}}async function Gr(e){let t=Ao(e),r=await gr(),n;if(r){let o=null;try{o=await r.getFileHandle(e)}catch(s){if(!(s instanceof DOMException)||s.name!=="NotFoundError")throw s;let i=$i(e);if(i===null)throw s;n=Uint8Array.fromBase64(i)}if(o){let s=await o.getFile();n=new Uint8Array(await s.arrayBuffer())}}else{let o=$i(e);if(o===null)throw new Error(`File not found: ${e}`);n=Uint8Array.fromBase64(o)}if(n=await Dl(n,e),_i(n))throw await zl(e,t),new Error(`File not found: ${e}`);return n}async function Ro(e,t){if(typeof e!="string"||e.includes("\0"))throw new Error("Invalid report name: contains NUL byte or is not a string");if(_i(t))throw new Error(`Refusing to save empty report bytes for "${e}"`);return ue(e),ct.delete(e),navigator.locks.request(Ze,{mode:"shared"},async()=>{let r=await Eo(t,ki,e,`"${e}"`,()=>ue(e)),n=await gr();if(n){let o=await n.getFileHandle(e,{create:!0}),s=await o.createWritable();try{await s.write(r),await s.close()}catch(i){ue(e);try{await s.abort(i)}catch{}throw await Ul(n,o,e),i}ue(e),Si(e),qr(e,"save");return}try{localStorage.setItem(hr+e,r.toBase64()),ue(e),qr(e,"save")}catch(o){throw ue(e),new Error(`localStorage write failed for ${e}: ${o.message}`,{cause:o})}})}async function An(e){return ue(e),ct.delete(e),fr.delete(e),navigator.locks.request(Ze,{mode:"shared"},async()=>{let t=await gr();if(t){try{await t.removeEntry(e)}catch(r){if(!(r instanceof DOMException)||r.name!=="NotFoundError")throw ue(e),r}Si(e),ue(e),qr(e,"delete");return}localStorage.removeItem(hr+e),ue(e),qr(e,"delete")})}var To="_meta.json";function Mo(){return Nl(Pl,{create:!0})}function Hl(e){return e.replaceAll("/","_")}async function Vl(e){let t;try{let o=await(await e.getFileHandle(To)).getFile();t=new Uint8Array(await o.arrayBuffer())}catch(n){return n instanceof DOMException&&n.name==="NotFoundError"?[]:(console.warn("readBundleMeta: failed to read _meta.json:",n),[])}let r=t;if(qe(t)){if(!Be())return console.warn("readBundleMeta: vault locked, returning empty bundle list"),[];try{r=await Fl(t,Ol)}catch(o){return console.warn("readBundleMeta: decrypt failed (tampering, key mismatch, or vault identity drift):",o),[]}}try{let n=JSON.parse(xe(r));return Array.isArray(n)?n:[]}catch(n){return console.warn("readBundleMeta: JSON.parse failed:",n),[]}}async function Uf(e,t){let r=te(JSON.stringify(t));r=await Eo(r,Ml,Ol,"bundle metadata");try{await e.removeEntry(To)}catch{}let n=await e.getFileHandle(To,{create:!0});await xi(n,r)}var Dw=`${Pl}/${To}`;function Hf(e){return navigator.locks.request(Dw,e)}async function vt(){let e=await Mo();return e?[...await Vl(e)].toSorted((r,n)=>r.name.localeCompare(n.name)):[]}async function Fo(){if(typeof navigator>"u"||!navigator.storage?.getDirectory)return!1;let e=await Nl(Pl,{create:!1});if(!e)return!1;try{for await(let t of e.entries())return!0}catch{}return!1}async function Yr(e,t){let r=await Mo();if(!r)throw new Error(`Cannot save bundle ${e}: OPFS unavailable`);let n=t instanceof Uint8Array?t:te(t),o=await Af(n),s=Hl(o),i=e.toLowerCase().endsWith(".map")?await mo(n):n;return navigator.locks.request(Ze,{mode:"shared"},async()=>{i=await Eo(i,Ml,o,`bundle "${e}"`);try{await r.removeEntry(s)}catch{}let l=await r.getFileHandle(s,{create:!0});await xi(l,i);try{await Hf(async()=>{let c=await Vl(r),u=c.findIndex(p=>p.integrity===o);u>=0?c[u]={integrity:o,name:e}:c.push({integrity:o,name:e}),await Uf(r,c)})}catch(c){try{await r.removeEntry(s)}catch{}throw c}return{integrity:o,name:e}})}async function jl(e){let t=await Mo();if(t)return navigator.locks.request(Ze,{mode:"shared"},async()=>{try{await t.removeEntry(Hl(e))}catch(r){if(!(r instanceof DOMException)||r.name!=="NotFoundError")throw r}await Hf(async()=>{let r=await Vl(t),n=r.filter(o=>o.integrity!==e);n.length!==r.length&&await Uf(t,n)})})}async function jt(e){let t=await Mo();if(!t)throw new Error("OPFS unavailable");let n=await(await t.getFileHandle(Hl(e))).getFile(),o=new Uint8Array(await n.arrayBuffer());if(qe(o)){if(!Be())throw new Error(`storage: vault locked, cannot read bundle "${e}"`);o=await Fl(o,e)}return o.length>=2&&o[0]===31&&o[1]===139?await Ct(o):o}async function zw(e,t){let r=await gr();if(r){let i=null;try{i=await r.getFileHandle(e)}catch(l){if(!(l instanceof DOMException)||l.name!=="NotFoundError")throw l}if(i){let l=await i.getFile(),c=new Uint8Array(await l.arrayBuffer()),u=await t(c);if(u===null)return;ct.delete(e),fr.delete(e),ue(e);let p=await r.getFileHandle(e,{create:!0});try{await xi(p,u)}catch(f){throw await Ul(r,p,e),f}ue(e);return}}let n=$i(e);if(n===null)return;let o=Uint8Array.fromBase64(n),s=await t(o);s!==null&&(ct.delete(e),fr.delete(e),ue(e),localStorage.setItem(hr+e,s.toBase64()),ue(e))}function Vf(e,t){return e.seal?r=>qe(r)?null:e.seal(r,t):r=>qe(r)?e.open(r,t):null}async function jf(e){let t=await ie();for(let r of t)try{await zw(r,Vf(e,vi(r)))}catch(n){if(n instanceof DOMException&&n.name==="NotFoundError")continue;throw n}}var Wl=({seal:e})=>jf({seal:e}),Kl=({open:e})=>jf({open:e});async function Uw(){let e=await Mo();if(!e)return{dir:null,keys:[]};let t=[];for await(let[r]of e.entries())t.push(r);return{dir:e,keys:t}}function Hw(e){return e===To?Ol:e.startsWith("sha512-")?e.replaceAll("_","/"):null}async function Vw(e,t,r){let o=await(await e.getFileHandle(t)).getFile(),s=new Uint8Array(await o.arrayBuffer()),i=await r(s);if(i===null)return;let l=await e.getFileHandle(t,{create:!0});await xi(l,i)}async function Wf(e){let{dir:t,keys:r}=await Uw();if(t)for(let n of r){let o=Hw(n);if(o!==null)try{await Vw(t,n,Vf(e,wi(o)))}catch(s){if(s instanceof DOMException&&s.name==="NotFoundError")continue;throw s}}}var ql=({seal:e})=>Wf({seal:e}),Gl=({open:e})=>Wf({open:e});Te(()=>{ct.clear(),fr.clear()});var Ci="/api/config";var Kf="deepview.sync.serverInfo";function Ei(e){if(e==null||typeof e!="object")return null;let t=e.mode;if(t!=="e2e"&&t!=="managed")return null;let r=null,n=e.managed;if(n!=null&&typeof n=="object"){let o=n.loginPath,s=n.cookieName;typeof o=="string"&&typeof s=="string"&&(r={loginPath:o,cookieName:s})}return{mode:t,managed:r}}function Wt(){try{let e=localStorage.getItem(Kf);return e==null?null:Ei(JSON.parse(e))}catch{return null}}function Yl(e){try{localStorage.setItem(Kf,JSON.stringify(e))}catch{}}function Jl(e,t){return e==null?"first":e===t?"match":"mismatch"}var Ti="deepview.viewMode",Ii="deepview.severityMode",Ai="deepview.repoUrls",jw=new Set(["grouped","list","table","kanban","focus"]),Ww=new Set(["corrected","original"]);function Kw(){try{let e=localStorage.getItem(Ti);return e!==null&&jw.has(e)?e:null}catch{return null}}function qw(){try{let e=localStorage.getItem(Ii);return e!==null&&Ww.has(e)?e:null}catch{return null}}function Ql(e){try{let t=JSON.parse(e||"{}");return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function Ri(){return Ql(Ae(Ai))}function et(e){return e?Ri()[e]??"":""}var Xl=new Set;function Gf(e){return Xl.add(e),()=>{Xl.delete(e)}}function Gw(e){for(let t of Xl)try{t(e)}catch(r){console.warn("repo-url listener:",r)}}function tt(e,t){if(!e)return;let r=Ri();t?r[e]=t:delete r[e],Fe(Ai,JSON.stringify(r)).catch(n=>console.warn("saveRepoUrlFor:",n)),Cl(Ai,n=>{let o=Ql(n);return t?o[e]=t:delete o[e],JSON.stringify(o)}).catch(n=>console.warn("saveRepoUrlFor cross-tab merge:",n)),Gw(e)}async function Yf(e,t){await Cl(Ai,r=>{let n=Ql(r),o=t==="replace"?{...e}:t==="prefer-imported"?{...n,...e}:{...e,...n};return JSON.stringify(o)}),Jf()}var qf=Wt(),a=$f({reports:[],workspaceMerges:[],currentFile:null,currentWorkspace:null,currentView:"findings",bundles:[],selectedBundle:null,bundleDetails:null,bundleDetailsTab:"overview",selectedPackage:null,selectedPackageVersion:null,packageDetailsTab:"overview",packageSlideTriage:null,packageSlideTransient:!1,packagesSearchQuery:"",packagesSortBy:"findings-desc",expandedPackages:new Set,selectedRepository:null,repositoryDetailsTab:"overview",repositorySlideTriage:null,repositorySlideTransient:!1,repositoriesSearchQuery:"",repositoriesSortBy:"findings-desc",bundleSourceFile:null,bundleSourceFindingIdx:null,bundleCodeSearchMode:"files",bundleCodeSearchQuery:"",bundleSearchQuery:"",bundleSearchRegex:!1,bundleSearchCase:!1,bundleSearchContext:!0,filterSeverities:new Set,filterColors:new Set,filterSources:new Set,filterAnalyzer:"",filterModel:"",filterRepo:"",filterConfMin:0,filterConfMax:10,filterInclude:"",filterIncludeNegate:!1,filterComment:"",filterFix:"",filterFlagged:"",repoUrl:"",repoEditing:!1,sortBy:"severity",viewMode:Kw()??"table",severityMode:qw()??"corrected",triage:new Map,shownTriage:null,nextFindingId:0,activeTabByGroup:new Map,tableSelectedGid:null,filesViewMode:"table",filesSearch:"",filesSelectedFile:null,kanbanPopoverGid:null,kanbanExpandedColumn:null,focusGid:null,focusCodeTick:0,serverMode:qf?.mode??"e2e",managed:qf?.managed??null,serverModeMismatch:!1,managedSession:null,managedTeams:[]});function Jf(){a.repoEditing||a.currentFile&&(a.repoUrl=et(a.currentFile))}_n(()=>{Jf()});var Yw=/^## ([A-Z][A-Z_]*)\s*\(\d+\)\s*$/mu;function Jw(e){switch(e.toUpperCase()){case"CRITICAL":return"critical";case"HIGH":return"high";case"MEDIUM":return"medium";case"LOW":return"low";case"HIGH_BUG":return"high_bug";case"BUG":return"bug";case"INFO":case"INFORMATIONAL":return"informational";default:return"medium"}}function Xw(e){if(e)switch(e.toLowerCase()){case"high":return 8;case"medium":return 5;case"low":return 2;default:return}}function Qw(e){return typeof e=="string"?e.replace(/^`(.*)`$/u,"$1"):e}function Tn(e){let t=e.replaceAll(/\r\n?/gu,`
4
- `).trim();if(!Yw.test(t))return null;let r=t.split(/^## ([A-Z][A-Z_]*)\s*\(\d+\)\s*\n/mu),n=[];for(let o=1;o<r.length;o+=2){let s=Jw(r[o]),l=(r[o+1]||"").split(/^### /mu).slice(1);for(let c of l){let u=Zw(c,s);u&&n.push(u)}}return n.length===0?null:{type:"security",source:"deepsec",findings:n}}function Zw(e,t){let r=e.indexOf(`
5
- `),n=(r===-1?e:e.slice(0,r)).trim();if(!n)return null;let o=r===-1?"":e.slice(r+1);o=o.replace(/\n---\s*$/u,"").trim();let s={};for(let v of o.matchAll(/^- \*\*([^:*]+):\*\*\s*(.+)$/gmu))s[v[1].trim().toLowerCase()]=v[2].trim();let i=/^\*\*Recommendation:\*\*\s*/mu.exec(o),l=o,c="";i&&(l=o.slice(0,i.index),c=o.slice(i.index+i[0].length).trim());let u=l.split(`
6
- `).filter(v=>!/^\s*- \*\*/u.test(v)).join(`
1
+ var Zs=globalThis,ti=Zs.ShadowRoot&&(Zs.ShadyCSS===void 0||Zs.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,uf=Symbol(),df=new WeakMap,ei=class{constructor(t,r,n){if(this._$cssResult$=!0,n!==uf)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=r}get styleSheet(){let t=this.o,r=this.t;if(ti&&t===void 0){let n=r!==void 0&&r.length===1;n&&(t=df.get(r)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&df.set(r,t))}return t}toString(){return this.cssText}},F=e=>new ei(typeof e=="string"?e:e+"",void 0,uf);var pf=(e,t)=>{if(ti)e.adoptedStyleSheets=t.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet);else for(let r of t){let n=document.createElement("style"),o=Zs.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=r.cssText,e.appendChild(n)}},bl=ti?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let r="";for(let n of t.cssRules)r+=n.cssText;return F(r)})(e):e;var{is:Rw,defineProperty:Iw,getOwnPropertyDescriptor:Mw,getOwnPropertyNames:Fw,getOwnPropertySymbols:Bw,getPrototypeOf:Lw}=Object,ri=globalThis,ff=ri.trustedTypes,Ow=ff?ff.emptyScript:"",Pw=ri.reactiveElementPolyfillSupport,go=(e,t)=>e,yl={toAttribute(e,t){switch(t){case Boolean:e=e?Ow:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=e!==null;break;case Number:r=e===null?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},mf=(e,t)=>!Rw(e,t),hf={attribute:!0,type:String,converter:yl,reflect:!1,useDefault:!1,hasChanged:mf};Symbol.metadata??=Symbol("metadata"),ri.litPropertyMetadata??=new WeakMap;var jt=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,r=hf){if(r.state&&(r.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((r=Object.create(r)).wrapped=!0),this.elementProperties.set(t,r),!r.noAccessor){let n=Symbol(),o=this.getPropertyDescriptor(t,n,r);o!==void 0&&Iw(this.prototype,t,o)}}static getPropertyDescriptor(t,r,n){let{get:o,set:s}=Mw(this.prototype,t)??{get(){return this[r]},set(i){this[r]=i}};return{get:o,set(i){let l=o?.call(this);s?.call(this,i),this.requestUpdate(t,l,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??hf}static _$Ei(){if(this.hasOwnProperty(go("elementProperties")))return;let t=Lw(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(go("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(go("properties"))){let r=this.properties,n=[...Fw(r),...Bw(r)];for(let o of n)this.createProperty(o,r[o])}let t=this[Symbol.metadata];if(t!==null){let r=litPropertyMetadata.get(t);if(r!==void 0)for(let[n,o]of r)this.elementProperties.set(n,o)}this._$Eh=new Map;for(let[r,n]of this.elementProperties){let o=this._$Eu(r,n);o!==void 0&&this._$Eh.set(o,r)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let r=[];if(Array.isArray(t)){let n=new Set(t.flat(1/0).reverse());for(let o of n)r.unshift(bl(o))}else t!==void 0&&r.push(bl(t));return r}static _$Eu(t,r){let n=r.attribute;return n===!1?void 0:typeof n=="string"?n:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,r=this.constructor.elementProperties;for(let n of r.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return pf(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,r,n){this._$AK(t,n)}_$ET(t,r){let n=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,n);if(o!==void 0&&n.reflect===!0){let s=(n.converter?.toAttribute!==void 0?n.converter:yl).toAttribute(r,n.type);this._$Em=t,s==null?this.removeAttribute(o):this.setAttribute(o,s),this._$Em=null}}_$AK(t,r){let n=this.constructor,o=n._$Eh.get(t);if(o!==void 0&&this._$Em!==o){let s=n.getPropertyOptions(o),i=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:yl;this._$Em=o;let l=i.fromAttribute(r,s.type);this[o]=l??this._$Ej?.get(o)??l,this._$Em=null}}requestUpdate(t,r,n,o=!1,s){if(t!==void 0){let i=this.constructor;if(o===!1&&(s=this[t]),n??=i.getPropertyOptions(t),!((n.hasChanged??mf)(s,r)||n.useDefault&&n.reflect&&s===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,n))))return;this.C(t,r,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,r,{useDefault:n,reflect:o,wrapped:s},i){n&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??r??this[t]),s!==!0||i!==void 0)||(this._$AL.has(t)||(this.hasUpdated||n||(r=void 0),this._$AL.set(t,r)),o===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(r){Promise.reject(r)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[o,s]of this._$Ep)this[o]=s;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[o,s]of n){let{wrapped:i}=s,l=this[o];i!==!0||this._$AL.has(o)||l===void 0||this.C(o,void 0,s,l)}}let t=!1,r=this._$AL;try{t=this.shouldUpdate(r),t?(this.willUpdate(r),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(r)):this._$EM()}catch(n){throw t=!1,this._$EM(),n}t&&this._$AE(r)}willUpdate(t){}_$AE(t){this._$EO?.forEach(r=>r.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(r=>this._$ET(r,this[r])),this._$EM()}updated(t){}firstUpdated(t){}};jt.elementStyles=[],jt.shadowRootOptions={mode:"open"},jt[go("elementProperties")]=new Map,jt[go("finalized")]=new Map,Pw?.({ReactiveElement:jt}),(ri.reactiveElementVersions??=[]).push("2.1.2");var wl=globalThis,gf=e=>e,ni=wl.trustedTypes,bf=ni?ni.createPolicy("lit-html",{createHTML:e=>e}):void 0,kl="$lit$",Wt=`lit$${Math.random().toFixed(9).slice(2)}$`,$l="?"+Wt,Nw=`<${$l}>`,Kr=document,yo=()=>Kr.createComment(""),vo=e=>e===null||typeof e!="object"&&typeof e!="function",xl=Array.isArray,xf=e=>xl(e)||typeof e?.[Symbol.iterator]=="function",vl=`[
2
+ \f\r]`,bo=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,yf=/-->/g,vf=/>/g,jr=RegExp(`>|${vl}(?:([^\\s"'>=/]+)(${vl}*=${vl}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),wf=/'/g,kf=/"/g,_f=/^(?:script|style|textarea|title)$/i,_l=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),d=_l(1),ur=_l(2),qE=_l(3),ke=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),$f=new WeakMap,Wr=Kr.createTreeWalker(Kr,129);function Sf(e,t){if(!xl(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return bf!==void 0?bf.createHTML(t):t}var Cf=(e,t)=>{let r=e.length-1,n=[],o,s=t===2?"<svg>":t===3?"<math>":"",i=bo;for(let l=0;l<r;l++){let c=e[l],u,p,f=-1,h=0;for(;h<c.length&&(i.lastIndex=h,p=i.exec(c),p!==null);)h=i.lastIndex,i===bo?p[1]==="!--"?i=yf:p[1]!==void 0?i=vf:p[2]!==void 0?(_f.test(p[2])&&(o=RegExp("</"+p[2],"g")),i=jr):p[3]!==void 0&&(i=jr):i===jr?p[0]===">"?(i=o??bo,f=-1):p[1]===void 0?f=-2:(f=i.lastIndex-p[2].length,u=p[1],i=p[3]===void 0?jr:p[3]==='"'?kf:wf):i===kf||i===wf?i=jr:i===yf||i===vf?i=bo:(i=jr,o=void 0);let b=i===jr&&e[l+1].startsWith("/>")?" ":"";s+=i===bo?c+Nw:f>=0?(n.push(u),c.slice(0,f)+kl+c.slice(f)+Wt+b):c+Wt+(f===-2?l:b)}return[Sf(e,s+(e[r]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),n]},wo=class e{constructor({strings:t,_$litType$:r},n){let o;this.parts=[];let s=0,i=0,l=t.length-1,c=this.parts,[u,p]=Cf(t,r);if(this.el=e.createElement(u,n),Wr.currentNode=this.el.content,r===2||r===3){let f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(o=Wr.nextNode())!==null&&c.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(let f of o.getAttributeNames())if(f.endsWith(kl)){let h=p[i++],b=o.getAttribute(f).split(Wt),g=/([.?@])?(.*)/.exec(h);c.push({type:1,index:s,name:g[2],strings:b,ctor:g[1]==="."?si:g[1]==="?"?ii:g[1]==="@"?ai:Gr}),o.removeAttribute(f)}else f.startsWith(Wt)&&(c.push({type:6,index:s}),o.removeAttribute(f));if(_f.test(o.tagName)){let f=o.textContent.split(Wt),h=f.length-1;if(h>0){o.textContent=ni?ni.emptyScript:"";for(let b=0;b<h;b++)o.append(f[b],yo()),Wr.nextNode(),c.push({type:2,index:++s});o.append(f[h],yo())}}}else if(o.nodeType===8)if(o.data===$l)c.push({type:2,index:s});else{let f=-1;for(;(f=o.data.indexOf(Wt,f+1))!==-1;)c.push({type:7,index:s}),f+=Wt.length-1}s++}}static createElement(t,r){let n=Kr.createElement("template");return n.innerHTML=t,n}};function qr(e,t,r=e,n){if(t===ke)return t;let o=n!==void 0?r._$Co?.[n]:r._$Cl,s=vo(t)?void 0:t._$litDirective$;return o?.constructor!==s&&(o?._$AO?.(!1),s===void 0?o=void 0:(o=new s(e),o._$AT(e,r,n)),n!==void 0?(r._$Co??=[])[n]=o:r._$Cl=o),o!==void 0&&(t=qr(e,o._$AS(e,t.values),o,n)),t}var oi=class{constructor(t,r){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=r}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:r},parts:n}=this._$AD,o=(t?.creationScope??Kr).importNode(r,!0);Wr.currentNode=o;let s=Wr.nextNode(),i=0,l=0,c=n[0];for(;c!==void 0;){if(i===c.index){let u;c.type===2?u=new _n(s,s.nextSibling,this,t):c.type===1?u=new c.ctor(s,c.name,c.strings,this,t):c.type===6&&(u=new li(s,this,t)),this._$AV.push(u),c=n[++l]}i!==c?.index&&(s=Wr.nextNode(),i++)}return Wr.currentNode=Kr,o}p(t){let r=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(t,n,r),r+=n.strings.length-2):n._$AI(t[r])),r++}},_n=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,r,n,o){this.type=2,this._$AH=m,this._$AN=void 0,this._$AA=t,this._$AB=r,this._$AM=n,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,r=this._$AM;return r!==void 0&&t?.nodeType===11&&(t=r.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,r=this){t=qr(this,t,r),vo(t)?t===m||t==null||t===""?(this._$AH!==m&&this._$AR(),this._$AH=m):t!==this._$AH&&t!==ke&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):xf(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==m&&vo(this._$AH)?this._$AA.nextSibling.data=t:this.T(Kr.createTextNode(t)),this._$AH=t}$(t){let{values:r,_$litType$:n}=t,o=typeof n=="number"?this._$AC(t):(n.el===void 0&&(n.el=wo.createElement(Sf(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===o)this._$AH.p(r);else{let s=new oi(o,this),i=s.u(this.options);s.p(r),this.T(i),this._$AH=s}}_$AC(t){let r=$f.get(t.strings);return r===void 0&&$f.set(t.strings,r=new wo(t)),r}k(t){xl(this._$AH)||(this._$AH=[],this._$AR());let r=this._$AH,n,o=0;for(let s of t)o===r.length?r.push(n=new e(this.O(yo()),this.O(yo()),this,this.options)):n=r[o],n._$AI(s),o++;o<r.length&&(this._$AR(n&&n._$AB.nextSibling,o),r.length=o)}_$AR(t=this._$AA.nextSibling,r){for(this._$AP?.(!1,!0,r);t!==this._$AB;){let n=gf(t).nextSibling;gf(t).remove(),t=n}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},Gr=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,r,n,o,s){this.type=1,this._$AH=m,this._$AN=void 0,this.element=t,this.name=r,this._$AM=o,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=m}_$AI(t,r=this,n,o){let s=this.strings,i=!1;if(s===void 0)t=qr(this,t,r,0),i=!vo(t)||t!==this._$AH&&t!==ke,i&&(this._$AH=t);else{let l=t,c,u;for(t=s[0],c=0;c<s.length-1;c++)u=qr(this,l[n+c],r,c),u===ke&&(u=this._$AH[c]),i||=!vo(u)||u!==this._$AH[c],u===m?t=m:t!==m&&(t+=(u??"")+s[c+1]),this._$AH[c]=u}i&&!o&&this.j(t)}j(t){t===m?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},si=class extends Gr{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===m?void 0:t}},ii=class extends Gr{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==m)}},ai=class extends Gr{constructor(t,r,n,o,s){super(t,r,n,o,s),this.type=5}_$AI(t,r=this){if((t=qr(this,t,r,0)??m)===ke)return;let n=this._$AH,o=t===m&&n!==m||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,s=t!==m&&(n===m||o);o&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},li=class{constructor(t,r,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=r,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){qr(this,t)}},Ef={M:kl,P:Wt,A:$l,C:1,L:Cf,R:oi,D:xf,V:qr,I:_n,H:Gr,N:ii,U:ai,B:si,F:li},Dw=wl.litHtmlPolyfillSupport;Dw?.(wo,_n),(wl.litHtmlVersions??=[]).push("3.3.3");var J=(e,t,r)=>{let n=r?.renderBefore??t,o=n._$litPart$;if(o===void 0){let s=r?.renderBefore??null;n._$litPart$=o=new _n(t.insertBefore(yo(),s),s,void 0,r??{})}return o._$AI(e),o};var Sl=globalThis,Z=class extends jt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=J(r,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return ke}};Z._$litElement$=!0,Z.finalized=!0,Sl.litElementHydrateSupport?.({LitElement:Z});var zw=Sl.litElementPolyfillSupport;zw?.({LitElement:Z});(Sl.litElementVersions??=[]).push("4.2.2");var He={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},At=e=>(...t)=>({_$litDirective$:e,values:t}),dt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,r,n){this._$Ct=t,this._$AM=r,this._$Ci=n}_$AS(t,r){return this.update(t,r)}update(t,r){return this.render(...r)}};var T=At(class extends dt{constructor(e){if(super(e),e.type!==He.ATTRIBUTE||e.name!=="class"||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter(t=>e[t]).join(" ")+" "}update(e,[t]){if(this.st===void 0){this.st=new Set,e.strings!==void 0&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter(n=>n!=="")));for(let n in t)t[n]&&!this.nt?.has(n)&&this.st.add(n);return this.render(t)}let r=e.element.classList;for(let n of this.st)n in t||(r.remove(n),this.st.delete(n));for(let n in t){let o=!!t[n];o===this.st.has(n)||this.nt?.has(n)||(o?(r.add(n),this.st.add(n)):(r.remove(n),this.st.delete(n)))}return ke}});var{I:Uw}=Ef,Af=e=>e;var Rf=e=>e.strings===void 0,Tf=()=>document.createComment(""),Sn=(e,t,r)=>{let n=e._$AA.parentNode,o=t===void 0?e._$AB:t._$AA;if(r===void 0){let s=n.insertBefore(Tf(),o),i=n.insertBefore(Tf(),o);r=new Uw(s,i,e,e.options)}else{let s=r._$AB.nextSibling,i=r._$AM,l=i!==e;if(l){let c;r._$AQ?.(e),r._$AM=e,r._$AP!==void 0&&(c=e._$AU)!==i._$AU&&r._$AP(c)}if(s!==o||l){let c=r._$AA;for(;c!==s;){let u=Af(c).nextSibling;Af(n).insertBefore(c,o),c=u}}}return r},pr=(e,t,r=e)=>(e._$AI(t,r),e),Hw={},ci=(e,t=Hw)=>e._$AH=t,If=e=>e._$AH,di=e=>{e._$AR(),e._$AA.remove()};var Mf=(e,t,r)=>{let n=new Map;for(let o=t;o<=r;o++)n.set(e[o],o);return n},Q=At(class extends dt{constructor(e){if(super(e),e.type!==He.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,r){let n;r===void 0?r=t:t!==void 0&&(n=t);let o=[],s=[],i=0;for(let l of e)o[i]=n?n(l,i):i,s[i]=r(l,i),i++;return{values:s,keys:o}}render(e,t,r){return this.dt(e,t,r).values}update(e,[t,r,n]){let o=If(e),{values:s,keys:i}=this.dt(t,r,n);if(!Array.isArray(o))return this.ut=i,s;let l=this.ut??=[],c=[],u,p,f=0,h=o.length-1,b=0,g=s.length-1;for(;f<=h&&b<=g;)if(o[f]===null)f++;else if(o[h]===null)h--;else if(l[f]===i[b])c[b]=pr(o[f],s[b]),f++,b++;else if(l[h]===i[g])c[g]=pr(o[h],s[g]),h--,g--;else if(l[f]===i[g])c[g]=pr(o[f],s[g]),Sn(e,c[g+1],o[f]),f++,g--;else if(l[h]===i[b])c[b]=pr(o[h],s[b]),Sn(e,o[f],o[h]),h--,b++;else if(u===void 0&&(u=Mf(i,b,g),p=Mf(l,f,h)),u.has(l[f]))if(u.has(l[h])){let w=p.get(i[b]),v=w!==void 0?o[w]:null;if(v===null){let y=Sn(e,o[f]);pr(y,s[b]),c[b]=y}else c[b]=pr(v,s[b]),Sn(e,o[f],v),o[w]=null;b++}else di(o[h]),h--;else di(o[f]),f++;for(;b<=g;){let w=Sn(e,c[g+1]);pr(w,s[b]),c[b++]=w}for(;f<=h;){let w=o[f++];w!==null&&di(w)}return this.ut=i,ci(e,c),ke}});var Ff="important",Vw=" !"+Ff,ue=At(class extends dt{constructor(e){if(super(e),e.type!==He.ATTRIBUTE||e.name!=="style"||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce((t,r)=>{let n=e[r];return n==null?t:t+`${r=r.includes("-")?r:r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(e,[t]){let{style:r}=e.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let n of this.ft)t[n]==null&&(this.ft.delete(n),n.includes("-")?r.removeProperty(n):r[n]=null);for(let n in t){let o=t[n];if(o!=null){this.ft.add(n);let s=typeof o=="string"&&o.endsWith(Vw);n.includes("-")||s?r.setProperty(n,s?o.slice(0,-11):o,s?Ff:""):r[n]=o}}return ke}});var Tl=new WeakMap,Pf=Symbol("iteration key");function jw(e){Tl.set(e,new Map)}function Ww(e,{target:t,key:r,type:n}){n==="iterate"&&(r=Pf);let o=Tl.get(t),s=o.get(r);s||(s=new Set,o.set(r,s)),s.has(e)||(s.add(e),e.cleaners.push(s))}function Kw({target:e,key:t,type:r}){let n=Tl.get(e),o=new Set;if(r==="clear"?n.forEach((s,i)=>{Cl(o,n,i)}):Cl(o,n,t),r==="add"||r==="delete"||r==="clear"){let s=Array.isArray(e)?"length":Pf;Cl(o,n,s)}return o}function Cl(e,t,r){let n=t.get(r);n&&n.forEach(e.add,e)}function Nf(e){e.cleaners&&e.cleaners.forEach(qw,e),e.cleaners=[]}function qw(e){e.delete(this)}var Cn=[],El=!1;function Gw(e,t,r,n){if(e.unobserved)return Reflect.apply(t,r,n);if(Cn.indexOf(e)===-1){Nf(e);try{return Cn.push(e),Reflect.apply(t,r,n)}finally{Cn.pop()}}}function wt(e){let t=Cn[Cn.length-1];t&&(Df(t,e),Ww(t,e))}function fr(e){Kw(e).forEach(Yw,e)}function Yw(e){Df(e,this),typeof e.scheduler=="function"?e.scheduler(e):typeof e.scheduler=="object"?e.scheduler.add(e):e()}function Df(e,t){if(e.debugger&&!El)try{El=!0,e.debugger(t)}finally{El=!1}}function zf(){return Cn.length>0}var Bf=Symbol("is reaction");function Uf(e,t={}){let r=e[Bf]?e:function n(){return Gw(n,e,this,arguments)};return r.scheduler=t.scheduler,r.debugger=t.debugger,r[Bf]=!0,t.lazy||r(),r}function Rl(e){e.unobserved||(e.unobserved=!0,Nf(e)),typeof e.scheduler=="object"&&e.scheduler.delete(e)}var Ne=new WeakMap,fi=new WeakMap,Jw=Object.prototype.hasOwnProperty;function pi(e){let t=fi.get(e);return zf()&&typeof e=="object"&&e!==null?t||hi(e):t||e}function Al(e,t){let r=e.next;return e.next=()=>{let{done:n,value:o}=r.call(e);return n||(t?o[1]=pi(o[1]):o=pi(o)),{done:n,value:o}},e}var Lf={has(e){let t=Ne.get(this),r=Reflect.getPrototypeOf(this);return wt({target:t,key:e,type:"has"}),r.has.apply(t,arguments)},get(e){let t=Ne.get(this),r=Reflect.getPrototypeOf(this);return wt({target:t,key:e,type:"get"}),pi(r.get.apply(t,arguments))},add(e){let t=Ne.get(this),r=Reflect.getPrototypeOf(this),n=r.has.call(t,e),o=r.add.apply(t,arguments);return n||fr({target:t,key:e,value:e,type:"add"}),o},set(e,t){let r=Ne.get(this),n=Reflect.getPrototypeOf(this),o=n.has.call(r,e),s=n.get.call(r,e),i=n.set.apply(r,arguments);return o?t!==s&&fr({target:r,key:e,value:t,oldValue:s,type:"set"}):fr({target:r,key:e,value:t,type:"add"}),i},delete(e){let t=Ne.get(this),r=Reflect.getPrototypeOf(this),n=r.has.call(t,e),o=r.get?r.get.call(t,e):void 0,s=r.delete.apply(t,arguments);return n&&fr({target:t,key:e,oldValue:o,type:"delete"}),s},clear(){let e=Ne.get(this),t=Reflect.getPrototypeOf(this),r=e.size!==0,n=e instanceof Map?new Map(e):new Set(e),o=t.clear.apply(e,arguments);return r&&fr({target:e,oldTarget:n,type:"clear"}),o},forEach(e,...t){let r=Ne.get(this),n=Reflect.getPrototypeOf(this);wt({target:r,type:"iterate"});let o=(s,...i)=>e(pi(s),...i);return n.forEach.call(r,o,...t)},keys(){let e=Ne.get(this),t=Reflect.getPrototypeOf(this);return wt({target:e,type:"iterate"}),t.keys.apply(e,arguments)},values(){let e=Ne.get(this),t=Reflect.getPrototypeOf(this);wt({target:e,type:"iterate"});let r=t.values.apply(e,arguments);return Al(r,!1)},entries(){let e=Ne.get(this),t=Reflect.getPrototypeOf(this);wt({target:e,type:"iterate"});let r=t.entries.apply(e,arguments);return Al(r,!0)},[Symbol.iterator](){let e=Ne.get(this),t=Reflect.getPrototypeOf(this);wt({target:e,type:"iterate"});let r=t[Symbol.iterator].apply(e,arguments);return Al(r,e instanceof Map)},get size(){let e=Ne.get(this),t=Reflect.getPrototypeOf(this);return wt({target:e,type:"iterate"}),Reflect.get(t,"size",e)}},ui={get(e,t,r){return e=Jw.call(Lf,t)?Lf:e,Reflect.get(e,t,r)}},Of=typeof window=="object"?window:Function("return this")(),Hf=new Map([[Map,ui],[Set,ui],[WeakMap,ui],[WeakSet,ui],[Object,!1],[Array,!1],[Int8Array,!1],[Uint8Array,!1],[Uint8ClampedArray,!1],[Int16Array,!1],[Uint16Array,!1],[Int32Array,!1],[Uint32Array,!1],[Float32Array,!1],[Float64Array,!1]]);function Xw({constructor:e}){return!(typeof e=="function"&&e.name in Of&&Of[e.name]===e)||Hf.has(e)}function Qw(e){return Hf.get(e.constructor)}var Vf=Object.prototype.hasOwnProperty,Zw=new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(e=>typeof e=="symbol"));function e0(e,t,r){let n=Reflect.get(e,t,r);if(typeof t=="symbol"&&Zw.has(t))return n;wt({target:e,key:t,receiver:r,type:"get"});let o=fi.get(n);if(zf()&&typeof n=="object"&&n!==null){if(o)return o;let s=Reflect.getOwnPropertyDescriptor(e,t);if(!s||!(s.writable===!1&&s.configurable===!1))return hi(n)}return o||n}function t0(e,t){let r=Reflect.has(e,t);return wt({target:e,key:t,type:"has"}),r}function r0(e){return wt({target:e,type:"iterate"}),Reflect.ownKeys(e)}function n0(e,t,r,n){typeof r=="object"&&r!==null&&(r=Ne.get(r)||r);let o=Vf.call(e,t),s=e[t],i=Reflect.set(e,t,r,n);return e!==Ne.get(n)||(o?r!==s&&fr({target:e,key:t,value:r,oldValue:s,receiver:n,type:"set"}):fr({target:e,key:t,value:r,receiver:n,type:"add"})),i}function o0(e,t){let r=Vf.call(e,t),n=e[t],o=Reflect.deleteProperty(e,t);return r&&fr({target:e,key:t,oldValue:n,type:"delete"}),o}var s0={get:e0,has:t0,ownKeys:r0,set:n0,deleteProperty:o0};function hi(e={}){return Ne.has(e)||!Xw(e)?e:fi.get(e)||i0(e)}function i0(e){let t=Qw(e)||s0,r=new Proxy(e,t);return fi.set(e,r),Ne.set(r,e),jw(e),r}var jf=hi;function Il(e){let t=!0,r=Uf(()=>{try{e(t)}finally{t=!1}},{lazy:!0});try{r()}catch(n){throw Rl(r),n}return()=>Rl(r)}var z=class extends Z{_disposers=[];observes=null;connectedCallback(){super.connectedCallback(),this.bindState()}bindState(){if(this.observes){this._disposers.push(Il(t=>{this.observes(),t||this.requestUpdate()}));return}this._render||(this._render=this.render,this.render=()=>{let t,r=Il(n=>{if(!n){r(),this._dispose===r&&(this._dispose=null),this.updateComplete.then(()=>this.requestUpdate());return}t=this._render()});return this._dispose=r,t}),this._disposers.push(()=>this._dispose&&this._dispose())}disconnectedCallback(){for(super.disconnectedCallback();this._disposers.length>0;)this._disposers.pop()()}};globalThis[Symbol.for("@rray/frontend")]={LitElement:Z,html:d,nothing:m,render:J,unsafeCSS:F,StateElement:z,classMap:T,repeat:Q,styleMap:ue};var ge=document.querySelector("#drop-zone"),C=document.querySelector("#report"),Wf=document.querySelector("app-sidebar");function Kt(e,t){let r=URL.createObjectURL(e),n=document.createElement("span");n.style.display="none",J(d`<a href="${r}" download="${t}"></a>`,n),document.body.append(n),n.firstElementChild.click(),n.remove(),URL.revokeObjectURL(r)}function Tt(e){return new Error("Another dialog is already open. Close it and try again.",{cause:e})}var a0="solidity-bundle",l0="0.0.0";function En(e){if(e?.name!==a0)return!1;let t=e.version;return!t||t===l0}function qf(e){let t=e?.package?.npm,r=t?.version;if(typeof r=="string"&&r&&!En(t))return r;let n=e?.file;if(!n)return null;let o=/(?:^|\/)node_modules\/\.pnpm\/([^/]+)\/node_modules\//u.exec(n);if(!o)return null;let s=o[1],i=s.indexOf("_");i>0&&(s=s.slice(0,i));let l=s.lastIndexOf("@");return l<=0?null:s.slice(l+1)||null}function mi(){return{keys:new Set,findings:[],files:new Map,reports:new Set,_keyReports:new Map}}function gi(e,t,r,n){e.reports.add(r);let o=e._keyReports.get(t);o||e._keyReports.set(t,o=new Set);let s=!o.has(r);return o.add(r),e.keys.has(t)||(e.keys.add(t),e.findings.push(n),e.files.has(n.file)||e.files.set(n.file,[]),e.files.get(n.file).push(n)),s}function bi(e,t,r,n){e._keyReports.delete(t),e.keys.delete(t);let o=e.findings.findIndex(l=>n(l)===t);o>=0&&e.findings.splice(o,1);let s=e.files.get(r);if(!s)return;let i=s.findIndex(l=>n(l)===t);i>=0&&s.splice(i,1),s.length===0&&e.files.delete(r)}function yi(e){let t=new Set;for(let r of e._keyReports.values())for(let n of r)t.add(n);e.reports=t}function Gf(e,t,r,n,o){let s=e.byVersion.get(t);s||(s=mi(),e.byVersion.set(t,s)),gi(s,n,o,r)}function Yf(e,t,r,n,o,s){let i=e.byVersion.get(t);if(!i)return;let l=i._keyReports.get(r);if(l&&(l.delete(o),l.size===0&&bi(i,r,n,s)),i._keyReports.size===0){e.byVersion.delete(t);return}yi(i)}function Ml(e,t){if(e===t)return 0;if(e===null)return 1;if(t===null)return-1;let[r,n=""]=Kf(e,"-"),[o,s=""]=Kf(t,"-"),i=r.split("."),l=o.split("."),c=Math.max(i.length,l.length);for(let u=0;u<c;u++){let p=i[u]??"0",f=l[u]??"0",h=/^\d+$/u.test(p),b=/^\d+$/u.test(f);if(h&&b){let g=Number(f)-Number(p);if(g!==0)return g}else{let g=f.localeCompare(p);if(g!==0)return g}}return n===""&&s!==""?-1:n!==""&&s===""?1:s.localeCompare(n)}function Kf(e,t){let r=e.indexOf(t);return r<0?[e,""]:[e.slice(0,r),e.slice(r+1)]}var c0=new TextEncoder,d0=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function re(e){if(typeof e!="string")throw new TypeError(`encodeUtf8 expects a string, got ${typeof e}`);if(!e.isWellFormed())throw new TypeError("encodeUtf8: input contains lone surrogates");return c0.encode(e)}function Ee(e){if(!ArrayBuffer.isView(e)&&!(e instanceof ArrayBuffer))throw new TypeError(`decodeUtf8 expects a BufferSource, got ${e===null?"null":typeof e}`);return d0.decode(e)}async function ko(e){let t=new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(t).arrayBuffer())}async function Rt(e,{maxBytes:t}={}){let r=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip"));if(t==null)return new Uint8Array(await new Response(r).arrayBuffer());let n=r.getReader(),o=[],s=0;for(;;){let{value:c,done:u}=await n.read();if(u)break;if(s+=c.length,s>t){try{await n.cancel()}catch{}throw new Error(`gunzipBytes: decompressed size exceeds ${t}-byte cap`)}o.push(c)}let i=new Uint8Array(s),l=0;for(let c of o)i.set(c,l),l+=c.length;return i}async function vi(e){return await ko(re(e))}async function $o(e){return Ee(await Rt(e))}async function Jf(e){let t=await crypto.subtle.digest("SHA-512",e);return`sha512-${new Uint8Array(t).toBase64()}`}var kt=new Uint8Array([68,86,69,49]),An=12,u0=32,p0="deepview-passkey.v1.content-key";function xo(){return!(typeof window>"u"||typeof PublicKeyCredential>"u"||typeof navigator>"u"||!navigator.credentials)}async function Xf(){if(typeof PublicKeyCredential>"u")return!1;let e=PublicKeyCredential.getClientCapabilities;if(typeof e!="function")return null;try{let t=await e.call(PublicKeyCredential);if(!t||typeof t!="object")return null;let r=t["extension:prf"],n=t.prf;return r===!0||n===!0?!0:r===!1||n===!1?!1:null}catch{return null}}function wi(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),t}async function Fl(e){if(e.length<32)throw new Error(`PRF output too short (${e.length} bytes; need \u2265 32)`);let t=await crypto.subtle.importKey("raw",e,"HKDF",!1,["deriveBits"]),r=await crypto.subtle.deriveBits({name:"HKDF",hash:"SHA-256",salt:new Uint8Array,info:re(p0)},t,u0*8);return new Uint8Array(r)}function Bl(e){return crypto.subtle.importKey("raw",e,{name:"AES-GCM"},!1,["encrypt","decrypt"])}async function hr(e,t,r){let n=wi(An),o=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:n,additionalData:r},e,t)),s=new Uint8Array(kt.length+An+o.length);return s.set(kt,0),s.set(n,kt.length),s.set(o,kt.length+An),s}async function Yr(e,t,r){if(!Ye(t))throw new Error("passkey: missing envelope magic");if(t.length<kt.length+An+16)throw new Error("passkey: envelope too short");let n=t.subarray(kt.length,kt.length+An),o=t.subarray(kt.length+An);return new Uint8Array(await crypto.subtle.decrypt({name:"AES-GCM",iv:n,additionalData:r},e,o))}function Ye(e){if(e.length<kt.length)return!1;for(let t=0;t<kt.length;t++)if(e[t]!==kt[t])return!1;return!0}async function Qf(e){if(!xo())throw new Error("passkey: not supported in this environment");let t=wi(32),r=wi(32),n=await navigator.credentials.create({publicKey:{challenge:t,rp:{name:e.rpName,id:e.rpId},user:{id:e.userId,name:e.userName,displayName:e.userName},pubKeyCredParams:[{type:"public-key",alg:-7},{type:"public-key",alg:-257}],authenticatorSelection:{residentKey:"required",userVerification:"required"},extensions:{prf:{eval:{first:r}}},timeout:e.timeoutMs??12e4},...e.signal?{signal:e.signal}:{}});if(!(n instanceof PublicKeyCredential))throw new Error("passkey: registration returned no credential");let o=new Uint8Array(n.rawId).toBase64({alphabet:"base64url",omitPadding:!0}),s=n.getClientExtensionResults().prf,i=s?.results?.first?new Uint8Array(s.results.first):null;return{credentialId:o,prfSalt:r.toBase64({alphabet:"base64url",omitPadding:!0}),prfOutput:i}}async function Ll(e){if(!xo())throw new Error("passkey: not supported in this environment");let t=wi(32),r=Uint8Array.fromBase64(e.credentialId,{alphabet:"base64url"}),n=Uint8Array.fromBase64(e.prfSalt,{alphabet:"base64url"}),o=await navigator.credentials.get({publicKey:{challenge:t,rpId:e.rpId,allowCredentials:[{type:"public-key",id:r}],userVerification:"required",extensions:{prf:{eval:{first:n}}},timeout:e.timeoutMs??12e4},...e.signal?{signal:e.signal}:{}});if(!(o instanceof PublicKeyCredential))throw new Error("passkey: assertion returned no credential");let i=o.getClientExtensionResults().prf?.results?.first;if(!i)throw new Error("passkey: authenticator did not return PRF output (extension unsupported)");return new Uint8Array(i)}var _o=Object.freeze(["deepview.workspaces","deepview.sync.sessions","deepview.sync.userEnabled","deepview.sync.password","deepview.repoUrls","deepview.fileCounts","deepview.lastFile"]),Ve=new Map,$i=!1,qt=new Map,ut=new Map,ki=new Set;function Tn(e){let t=()=>e();return ki.add(t),$i&&queueMicrotask(()=>{if(ki.has(t))try{t()}catch(r){console.warn("secure-storage after-hydrate listener:",r)}}),()=>ki.delete(t)}function f0(){for(let e of ki)try{e()}catch(t){console.warn("secure-storage after-hydrate listener:",t)}}function xi(e){let t=rh()??"";return re(`deepview.secure.v1|${t}|${e}`)}function Ol(e){try{let t=Uint8Array.fromBase64(e);if(Ye(t))return t}catch{}return null}function Ie(e){return Ve.get(e)??null}async function Le(e,t){if(typeof t!="string")throw new TypeError("secure-storage: value must be a string");if(ae()&&!Oe())throw new Error(`secure-storage: vault locked, cannot save "${e}"`);if(th())throw new Error(`secure-storage: wipe in progress, cannot save "${e}"`);let r=Ve.has(e),n=Ve.get(e);Ve.set(e,t),ut.set(e,t);let o=qt.get(e)??Promise.resolve(),s=()=>{ut.get(e)===t&&ut.delete(e)},i=o.catch(()=>{}).then(()=>h0(e,t)).then(()=>s(),l=>{throw s(),Ve.get(e)===t&&(r?Ve.set(e,n):Ve.delete(e)),l});qt.set(e,i.catch(()=>{})),await i}async function Rn(e){let t=Symbol("secure-storage:removed");Ve.delete(e),ut.set(e,t);let r=qt.get(e)??Promise.resolve(),n=()=>{try{localStorage.removeItem(e)}catch{}ut.get(e)===t&&(ut.delete(e),Ve.delete(e))},o=r.catch(()=>{}).then(()=>n());qt.set(e,o.catch(()=>{})),await o}async function h0(e,t){let r=Oe();if(r){let n=await hr(r,re(t),xi(e));localStorage.setItem(e,n.toBase64())}else localStorage.setItem(e,t)}async function mr(){$i||Me(()=>{mr().catch(r=>console.warn("secure-storage rehydrate:",r))}),$i=!0;for(let r of[...Ve.keys()])ut.has(r)||Ve.delete(r);let e=Oe(),t=[];for(let r of _o){if(ut.has(r))continue;let n=localStorage.getItem(r);if(n===null)continue;let o=Ol(n);if(o){if(!e)continue;try{let s=await Yr(e,o,xi(r));if(ut.has(r))continue;Ve.set(r,Ee(s))}catch(s){console.warn(`secure-storage: decrypt failed for "${r}":`,s)}}else Ve.set(r,n),e&&ae()&&t.push([r,n])}f0(),t.length>0&&queueMicrotask(()=>{for(let[r,n]of t)Ve.get(r)===n&&Le(r,n).catch(o=>{console.warn(`secure-storage: self-heal failed for "${r}":`,o)})})}async function Zf(e,t){let r=qt.get(e)??Promise.resolve(),n=async()=>{if(ut.has(e))return;let s=localStorage.getItem(e);if(s===null)return;let i=await t(s);i!==null&&(ut.has(e)||(localStorage.setItem(e,i.storageValue),Ve.set(e,i.cacheValue)))},o=r.catch(()=>{}).then(n);qt.set(e,o.catch(()=>{})),await o}async function Pl({seal:e}){for(let t of _o)await Zf(t,async r=>{if(Ol(r))return null;let n=Oe();return n?{storageValue:(await hr(n,re(r),xi(t))).toBase64(),cacheValue:r}:null})}async function Nl({open:e}){for(let t of _o)await Zf(t,async r=>{let n=Ol(r);if(!n)return null;let o=await e(n,xi(t)),s=Ee(o);return{storageValue:s,cacheValue:s}})}var m0="deepview.secure.v1.mutate:";function Dl(e,t){return _o.includes(e)?navigator.locks.request(m0+e,async()=>{let r=qt.get(e);r&&await r.catch(()=>{}),await mr();let n=Ie(e),o=await t(n);if(!(o==null||o===n)){if(typeof o!="string")throw new TypeError(`secure-storage: mutate updater for "${e}" must return a string`);await Le(e,o)}}):Promise.reject(new Error(`secure-storage: mutate() called with non-secure key "${e}"`))}async function eh(){await Promise.allSettled([...qt.values()]),ut.clear(),qt.clear()}typeof window<"u"&&window.addEventListener("storage",e=>{!$i||!e.key||!_o.includes(e.key)||mr().catch(()=>{})});var Eo="deepview.passkey.v1",In="deepview.passkey.userId",Si="deepview.passkey.cleanDisable",tt="deepview.passkey.v1.write",b0="deepview.triage.v1|",y0="deepview.opfs.v1|",v0="deepview.bundle.v1|",de=null,It=null,gr=null,Co=0;function Hl(){return Co>0}var zl=0;function th(){return zl>0}function Jr(){try{let e=localStorage.getItem(Eo);if(!e)return null;let t=JSON.parse(e);return t&&typeof t=="object"&&t.enabled===!0&&typeof t.credentialId=="string"&&t.credentialId.length>0&&typeof t.prfSalt=="string"&&t.prfSalt.length>0&&typeof t.userId=="string"&&t.userId.length>0?t:null}catch{return null}}function nh(e){localStorage.setItem(Eo,JSON.stringify(e))}function w0(){localStorage.removeItem(Eo)}function k0(){try{let t=localStorage.getItem(In);if(t){let r=Uint8Array.fromBase64(t,{alphabet:"base64url"});if(r.length===16)return r}}catch{}let e=new Uint8Array(16);crypto.getRandomValues(e);try{localStorage.setItem(In,e.toBase64({alphabet:"base64url",omitPadding:!0}))}catch{}return e}function Ci(){return typeof location>"u"?"":location.hostname}function ae(){return Jr()!==null}function $t(){return de!==null}function Mt(){return!(!xo()||typeof navigator>"u"||!navigator.locks?.request||!Ci())}function rh(){return It}function Ao(){if(Jr()!==null)return!1;try{return localStorage.getItem(Si)==="1"?!1:localStorage.getItem(In)!==null}catch{return!1}}function Oe(){return de}function To(){return re(b0+(It??""))}function Ei(e){if(typeof e!="string")throw new TypeError("passkey vault: OPFS AAD requires a filename string");return re(y0+(It??"")+"|"+e)}function Ai(e){if(typeof e!="string")throw new TypeError("passkey vault: bundle AAD requires a slot string");return re(v0+(It??"")+"|"+e)}var Ul=new Set;function Me(e){return Ul.add(e),()=>Ul.delete(e)}function Mn(){for(let e of Ul)try{e()}catch(t){console.warn("passkey vault listener:",t)}}async function Ro({signal:e}={}){let t=Jr();if(!t)return!1;let r;try{r=await Ll({credentialId:t.credentialId,prfSalt:t.prfSalt,rpId:t.rpId??Ci(),...e?{signal:e}:{}})}catch(o){if(o&&o.name==="NotAllowedError"||o&&o.name==="AbortError")return!1;throw o&&o.message?.includes("PRF")?So(o):o}if(!r||r.length<32)throw So();let n=await Fl(r);return r.fill(0),navigator.locks.request(tt,async()=>{let o=Jr();if(!o||o.credentialId!==t.credentialId)throw n.fill(0),new Error("passkey: vault state changed during unlock (another tab wiped or re-enabled it). Reload this page and try again.");return de=await Bl(n),n.fill(0),It=o.userId,gr=o.credentialId,Mn(),!0})}function So(e){let t=new Error("Your browser or authenticator doesn't support passkey-derived encryption keys (the WebAuthn PRF extension). Try Chrome 116+, Safari 18+, or Firefox 130+ on a device with a platform authenticator (TouchID / Windows Hello).");return e&&(t.cause=e),t}function Vl({migrate:e,userName:t,rpName:r,signal:n,acknowledgeOrphan:o}){if(!xo())throw new Error("passkey: WebAuthn unavailable in this environment");if(Ao()&&!o)throw new Error("passkey: a previous vault exists on this device with no metadata. Any data encrypted under the old passkey will be unreadable after a new setup. Call enableEncryption({acknowledgeOrphan: true}) to proceed, or wipeAllVaultData() to start clean first.");let s=Ci();return navigator.locks.request(tt,async()=>{if(ae())throw new Error("passkey: encryption is already enabled");if(await Xf()===!1)throw So();let l=k0(),c=await Qf({userName:t||"DeepView user",userId:l,rpName:r||"DeepView",rpId:s,...n?{signal:n}:{}}),u=c.prfOutput;if(!u)try{u=await Ll({credentialId:c.credentialId,prfSalt:c.prfSalt,rpId:s,...n?{signal:n}:{}})}catch(g){let w=l.toBase64({alphabet:"base64url",omitPadding:!0});await _i({credentialId:c.credentialId,rpId:s,userId:w}).catch(()=>{});try{localStorage.removeItem(In)}catch{}throw g&&g.message?.includes("PRF")?So(g):g}if(!u||u.length<32){let g=l.toBase64({alphabet:"base64url",omitPadding:!0});await _i({credentialId:c.credentialId,rpId:s,userId:g}).catch(()=>{});try{localStorage.removeItem(In)}catch{}throw So()}let p=await Fl(u);u.fill(0);let f=await Bl(p);p.fill(0);let h=l.toBase64({alphabet:"base64url",omitPadding:!0}),b={enabled:!0,credentialId:c.credentialId,prfSalt:c.prfSalt,userId:h,rpId:s,createdAt:Date.now()};de=f,It=h,gr=c.credentialId,nh(b),typeof e=="function"&&await e({seal:(w,v)=>hr(f,w,v)});try{localStorage.removeItem(Si)}catch{}return Mn(),!0})}async function jl({migrate:e}){if(!ae())return{disabled:!1,signalAttempted:!1};if(!$t())throw new Error("passkey: must unlock before disabling encryption");Co+=1;try{return await navigator.locks.request(tt,async()=>{let t=Jr();if(!t)return{disabled:!1,signalAttempted:!1};let r=de;if(!r)return{disabled:!1,signalAttempted:!1};if(w0(),de=null,gr=null,typeof e=="function"){let o=(s,i)=>Yr(r,s,i);try{await e({open:o})}catch(s){throw nh(t),de=r,gr=t.credentialId,Mn(),s}}It=null;try{localStorage.setItem(Si,"1")}catch{}let n=await _i(t).catch(()=>!1);return Mn(),{disabled:!0,signalAttempted:n}})}finally{Co-=1}}async function _i({credentialId:e,rpId:t,userId:r}){if(typeof PublicKeyCredential>"u"||!t)return!1;let n=PublicKeyCredential,o=!1;if(typeof n.signalUnknownCredential=="function"){o=!0;try{await n.signalUnknownCredential({rpId:t,credentialId:e})}catch{}}if(typeof n.signalAllAcceptedCredentials=="function"&&r){o=!0;try{await n.signalAllAcceptedCredentials({rpId:t,userId:r,allAcceptedCredentialIds:[]})}catch{}}return o}async function $0(e,t){try{return await e.removeEntry(t,{recursive:!0}),null}catch(r){return r?.name==="NotFoundError"?null:`${t}: ${r?.message??String(r)}`}}async function x0(e){let t=[];if(typeof navigator>"u"||!navigator.storage?.getDirectory)return t;let r;try{r=await navigator.storage.getDirectory()}catch(n){return t.push(`storage root: ${n?.message??String(n)}`),t}for(let n of e){let o=await $0(r,n);o&&t.push(o)}return t}async function Io({refuseIfEnabled:e=!1}={}){Co+=1,zl+=1;try{return await navigator.locks.request(tt,async()=>{if(e&&ae())throw new Error("passkey: encryption was just enabled in another tab. Reload this page to unlock instead of wiping.");await eh();let t=Jr();if(t)try{await _i({credentialId:t.credentialId,rpId:t.rpId??Ci(),userId:t.userId})}catch{}try{localStorage.removeItem(Eo)}catch{}try{localStorage.removeItem(In)}catch{}try{localStorage.removeItem(Si)}catch{}for(let n of["deepview.workspaces","deepview.sync.sessions","deepview.sync.userEnabled","deepview.repoUrls","deepview.fileCounts","deepview.lastFile","deepview.triage","deepview.triage.pending","deepview.passkey.firstImportPrompted","deepview.viewMode"])try{localStorage.removeItem(n)}catch{}try{let n=[];for(let o=0;o<localStorage.length;o+=1){let s=localStorage.key(o);s&&s.startsWith("deepview.report:")&&n.push(s)}for(let o of n)try{localStorage.removeItem(o)}catch{}}catch{}de=null,It=null,gr=null,Mn();let r=await x0(["deepview-reports","deepview-bundles"]);if(r.length>0)throw new Error(`passkey: wipe partially succeeded \u2014 localStorage cleared but the following OPFS paths could not be removed: ${r.join("; ")}. Open DevTools \u2192 Application \u2192 Storage \u2192 Origin Private File System to inspect, or use the browser's site-data clear tool to finish.`)})}finally{Co-=1,zl-=1}}function oh(e){return de?hr(de,e,To()):Promise.reject(new Error("passkey: vault locked, cannot seal triage"))}function sh(e){return de?Yr(de,e,To()):Promise.reject(new Error("passkey: vault locked, cannot open triage"))}function Ti(e,t){return de?hr(de,e,Ei(t)):Promise.reject(new Error("passkey: vault locked, cannot seal OPFS file"))}function ih(e,t){return de?Yr(de,e,Ei(t)):Promise.reject(new Error("passkey: vault locked, cannot open OPFS file"))}function Wl(e,t){return de?hr(de,e,Ai(t)):Promise.reject(new Error("passkey: vault locked, cannot seal bundle"))}function Kl(e,t){return de?Yr(de,e,Ai(t)):Promise.reject(new Error("passkey: vault locked, cannot open bundle"))}typeof window<"u"&&window.addEventListener("storage",e=>{if(e.key!==Eo)return;let t=Jr();(!t&&de||t&&de&&t.credentialId!==gr)&&(de=null,It=null,gr=null),Mn()});var Yl="__meta__",_0="deepview-reports",Jl="deepview-bundles",yr="deepview.report:",ah=!1;async function Xl(e,{create:t,warnOnce:r=!1}={}){try{return await(await navigator.storage.getDirectory()).getDirectoryHandle(e,{create:t})}catch(n){return r&&!ah&&(ah=!0,console.warn("OPFS unavailable, falling back to gzipped localStorage (limited quota).",n)),null}}async function Ii(e,t){let r=await e.createWritable();try{await r.write(t),await r.close()}catch(n){try{await r.abort(n)}catch{}throw n}}async function Ql(e,t){if(!Ye(e))return e;if(!Oe())throw new Error(`storage: vault locked, cannot decrypt "${t}"`);return await ih(e,t)}function Mi(e){return e.length===0?!0:e.length>=18&&e[0]===31&&e[1]===139&&e.at(-4)===0&&e.at(-3)===0&&e.at(-2)===0&&e.at(-1)===0}async function Zl(e,t){Fo(e)===t&&(console.warn(`storage: report "${e}" is an empty/corrupt on-disk entry \u2014 quarantining, will read as missing`),await navigator.locks.request(tt,{mode:"exclusive"},async()=>{if(Fo(e)!==t)return;pe(e),pt.delete(e);let r=await vr();if(r)try{await r.removeEntry(e)}catch{}Fi(e),pe(e),Xr(e,"delete")}))}async function ec(e,t,r){try{(await t.getFile()).size===0&&await e.removeEntry(r)}catch{}}async function Mo(e,t,r,n,o=()=>{}){if(ae()&&!Oe())throw o(),new Error(`storage: vault locked, cannot save ${n}`);let s=Oe(),i=s?await t(e,r):e;if(Oe()!==s)throw o(),new Error(`storage: vault state changed mid-save for ${n}; retry`);return i}function vr(){return Xl(_0,{create:!0,warnOnce:!0})}function Ri(e){try{return localStorage.getItem(yr+e)}catch{return null}}function Fi(e){try{localStorage.removeItem(yr+e)}catch{}}function S0(){let e=[];for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);r&&r.startsWith(yr)&&e.push(r.slice(yr.length))}return e}var pt=new Map,br=new Map,ql=new Map;function pe(e){ql.set(e,(ql.get(e)??0)+1)}function Fo(e){return ql.get(e)??0}var Gl=new Set;function Lo(e){return Gl.add(e),()=>Gl.delete(e)}function Xr(e,t){for(let r of Gl)try{r(e,t)}catch(n){console.warn("storage file-change listener:",n)}}async function ce(){let e=new Set(S0()),t=await vr();if(t)for await(let[r]of t.entries())e.add(r);return[...e].toSorted()}async function ft(e,t){if(typeof e!="string"||e.includes("\0"))throw new Error("Invalid report name: contains NUL byte or is not a string");if(t==="")throw new Error(`Refusing to save empty report "${e}"`);return pe(e),navigator.locks.request(tt,{mode:"shared"},async()=>{let r=await vr();if(r){let s=await ko(re(t));s=await Mo(s,Ti,e,`"${e}"`,()=>pe(e));let i=await r.getFileHandle(e,{create:!0}),l=await i.createWritable();try{await l.write(s),await l.close()}catch(c){pt.delete(e),pe(e);try{await l.abort(c)}catch{}throw await ec(r,i,e),c}pt.set(e,t),pe(e),Fi(e),Xr(e,"save");return}let n=re(t);n=await ko(n),n=await Mo(n,Ti,e,`"${e}"`,()=>pe(e));let o=n.toBase64();try{localStorage.setItem(yr+e,o),pt.set(e,t),pe(e),Xr(e,"save")}catch(s){throw pe(e),new Error(`localStorage write failed for ${e}: ${s.message}`,{cause:s})}})}async function lh(e,t){let r=Ri(e);if(r===null)return null;let n=Uint8Array.fromBase64(r);if(n=await Ql(n,e),Mi(n))throw await Zl(e,t),new Error(`File not found: ${e}`);return Ee(await Rt(n))}async function Pe(e){if(pt.has(e))return pt.get(e);if(br.has(e))return br.get(e);let t=Fo(e),r=(async()=>{let n=await vr();if(n){let s;try{s=await n.getFileHandle(e)}catch(u){if(u instanceof DOMException&&u.name==="NotFoundError"){let p=await lh(e,t);if(p!==null)return ft(e,p).catch(f=>{console.warn(`storage: stranded-localStorage migration of "${e}" failed:`,f)}),p}throw u}let i=await s.getFile(),l=new Uint8Array(await i.arrayBuffer());if(l=await Ql(l,e),Mi(l))throw await Zl(e,t),new Error(`File not found: ${e}`);if(l.length>=2&&l[0]===31&&l[1]===139){let u=await Rt(l);return Ee(u)}let c=Ee(l);return ft(e,c).catch(u=>{console.warn(`storage: legacy-uncompressed migration of "${e}" failed:`,u)}),c}let o=await lh(e,t);if(o===null)throw new Error(`File not found: ${e}`);return o})();br.set(e,r);try{let n=await r;return Fo(e)===t&&pt.set(e,n),n}finally{br.delete(e)}}async function Qr(e){let t=Fo(e),r=await vr(),n;if(r){let o=null;try{o=await r.getFileHandle(e)}catch(s){if(!(s instanceof DOMException)||s.name!=="NotFoundError")throw s;let i=Ri(e);if(i===null)throw s;n=Uint8Array.fromBase64(i)}if(o){let s=await o.getFile();n=new Uint8Array(await s.arrayBuffer())}}else{let o=Ri(e);if(o===null)throw new Error(`File not found: ${e}`);n=Uint8Array.fromBase64(o)}if(n=await Ql(n,e),Mi(n))throw await Zl(e,t),new Error(`File not found: ${e}`);return n}async function Oo(e,t){if(typeof e!="string"||e.includes("\0"))throw new Error("Invalid report name: contains NUL byte or is not a string");if(Mi(t))throw new Error(`Refusing to save empty report bytes for "${e}"`);return pe(e),pt.delete(e),navigator.locks.request(tt,{mode:"shared"},async()=>{let r=await Mo(t,Ti,e,`"${e}"`,()=>pe(e)),n=await vr();if(n){let o=await n.getFileHandle(e,{create:!0}),s=await o.createWritable();try{await s.write(r),await s.close()}catch(i){pe(e);try{await s.abort(i)}catch{}throw await ec(n,o,e),i}pe(e),Fi(e),Xr(e,"save");return}try{localStorage.setItem(yr+e,r.toBase64()),pe(e),Xr(e,"save")}catch(o){throw pe(e),new Error(`localStorage write failed for ${e}: ${o.message}`,{cause:o})}})}async function Fn(e){return pe(e),pt.delete(e),br.delete(e),navigator.locks.request(tt,{mode:"shared"},async()=>{let t=await vr();if(t){try{await t.removeEntry(e)}catch(r){if(!(r instanceof DOMException)||r.name!=="NotFoundError")throw pe(e),r}Fi(e),pe(e),Xr(e,"delete");return}localStorage.removeItem(yr+e),pe(e),Xr(e,"delete")})}var Bo="_meta.json";function Po(){return Xl(Jl,{create:!0})}function tc(e){return e.replaceAll("/","_")}async function rc(e){let t;try{let o=await(await e.getFileHandle(Bo)).getFile();t=new Uint8Array(await o.arrayBuffer())}catch(n){return n instanceof DOMException&&n.name==="NotFoundError"?[]:(console.warn("readBundleMeta: failed to read _meta.json:",n),[])}let r=t;if(Ye(t)){if(!Oe())return console.warn("readBundleMeta: vault locked, returning empty bundle list"),[];try{r=await Kl(t,Yl)}catch(o){return console.warn("readBundleMeta: decrypt failed (tampering, key mismatch, or vault identity drift):",o),[]}}try{let n=JSON.parse(Ee(r));return Array.isArray(n)?n:[]}catch(n){return console.warn("readBundleMeta: JSON.parse failed:",n),[]}}async function ch(e,t){let r=re(JSON.stringify(t));r=await Mo(r,Wl,Yl,"bundle metadata");try{await e.removeEntry(Bo)}catch{}let n=await e.getFileHandle(Bo,{create:!0});await Ii(n,r)}var C0=`${Jl}/${Bo}`;function dh(e){return navigator.locks.request(C0,e)}async function xt(){let e=await Po();return e?[...await rc(e)].toSorted((r,n)=>r.name.localeCompare(n.name)):[]}async function No(){if(typeof navigator>"u"||!navigator.storage?.getDirectory)return!1;let e=await Xl(Jl,{create:!1});if(!e)return!1;try{for await(let t of e.entries())return!0}catch{}return!1}async function Zr(e,t){let r=await Po();if(!r)throw new Error(`Cannot save bundle ${e}: OPFS unavailable`);let n=t instanceof Uint8Array?t:re(t),o=await Jf(n),s=tc(o),i=e.toLowerCase().endsWith(".map")?await ko(n):n;return navigator.locks.request(tt,{mode:"shared"},async()=>{i=await Mo(i,Wl,o,`bundle "${e}"`);try{await r.removeEntry(s)}catch{}let l=await r.getFileHandle(s,{create:!0});await Ii(l,i);try{await dh(async()=>{let c=await rc(r),u=c.findIndex(p=>p.integrity===o);u>=0?c[u]={integrity:o,name:e}:c.push({integrity:o,name:e}),await ch(r,c)})}catch(c){try{await r.removeEntry(s)}catch{}throw c}return{integrity:o,name:e}})}async function nc(e){let t=await Po();if(t)return navigator.locks.request(tt,{mode:"shared"},async()=>{try{await t.removeEntry(tc(e))}catch(r){if(!(r instanceof DOMException)||r.name!=="NotFoundError")throw r}await dh(async()=>{let r=await rc(t),n=r.filter(o=>o.integrity!==e);n.length!==r.length&&await ch(t,n)})})}async function Gt(e){let t=await Po();if(!t)throw new Error("OPFS unavailable");let n=await(await t.getFileHandle(tc(e))).getFile(),o=new Uint8Array(await n.arrayBuffer());if(Ye(o)){if(!Oe())throw new Error(`storage: vault locked, cannot read bundle "${e}"`);o=await Kl(o,e)}return o.length>=2&&o[0]===31&&o[1]===139?await Rt(o):o}async function E0(e,t){let r=await vr();if(r){let i=null;try{i=await r.getFileHandle(e)}catch(l){if(!(l instanceof DOMException)||l.name!=="NotFoundError")throw l}if(i){let l=await i.getFile(),c=new Uint8Array(await l.arrayBuffer()),u=await t(c);if(u===null)return;pt.delete(e),br.delete(e),pe(e);let p=await r.getFileHandle(e,{create:!0});try{await Ii(p,u)}catch(f){throw await ec(r,p,e),f}pe(e);return}}let n=Ri(e);if(n===null)return;let o=Uint8Array.fromBase64(n),s=await t(o);s!==null&&(pt.delete(e),br.delete(e),pe(e),localStorage.setItem(yr+e,s.toBase64()),pe(e))}function uh(e,t){return e.seal?r=>Ye(r)?null:e.seal(r,t):r=>Ye(r)?e.open(r,t):null}async function ph(e){let t=await ce();for(let r of t)try{await E0(r,uh(e,Ei(r)))}catch(n){if(n instanceof DOMException&&n.name==="NotFoundError")continue;throw n}}var oc=({seal:e})=>ph({seal:e}),sc=({open:e})=>ph({open:e});async function A0(){let e=await Po();if(!e)return{dir:null,keys:[]};let t=[];for await(let[r]of e.entries())t.push(r);return{dir:e,keys:t}}function T0(e){return e===Bo?Yl:e.startsWith("sha512-")?e.replaceAll("_","/"):null}async function R0(e,t,r){let o=await(await e.getFileHandle(t)).getFile(),s=new Uint8Array(await o.arrayBuffer()),i=await r(s);if(i===null)return;let l=await e.getFileHandle(t,{create:!0});await Ii(l,i)}async function fh(e){let{dir:t,keys:r}=await A0();if(t)for(let n of r){let o=T0(n);if(o!==null)try{await R0(t,n,uh(e,Ai(o)))}catch(s){if(s instanceof DOMException&&s.name==="NotFoundError")continue;throw s}}}var ic=({seal:e})=>fh({seal:e}),ac=({open:e})=>fh({open:e});Me(()=>{pt.clear(),br.clear()});var Bi="/api/config";var hh="deepview.sync.serverInfo";function Li(e){if(e==null||typeof e!="object")return null;let t=e.mode;if(t!=="e2e"&&t!=="managed")return null;let r=null,n=e.managed;if(n!=null&&typeof n=="object"){let o=n.loginPath,s=n.cookieName;typeof o=="string"&&typeof s=="string"&&(r={loginPath:o,cookieName:s})}return{mode:t,managed:r}}function Yt(){try{let e=localStorage.getItem(hh);return e==null?null:Li(JSON.parse(e))}catch{return null}}function lc(e){try{localStorage.setItem(hh,JSON.stringify(e))}catch{}}function cc(e,t){return e==null?"first":e===t?"match":"mismatch"}var Pi="deepview.viewMode",Ni="deepview.severityMode",Oi="deepview.repoUrls",I0=new Set(["grouped","list","table","kanban","focus"]),M0=new Set(["corrected","original"]);function F0(){try{let e=localStorage.getItem(Pi);return e!==null&&I0.has(e)?e:null}catch{return null}}function B0(){try{let e=localStorage.getItem(Ni);return e!==null&&M0.has(e)?e:null}catch{return null}}function uc(e){try{let t=JSON.parse(e||"{}");return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function Di(){return uc(Ie(Oi))}function rt(e){return e?Di()[e]??"":""}var dc=new Set;function gh(e){return dc.add(e),()=>{dc.delete(e)}}function L0(e){for(let t of dc)try{t(e)}catch(r){console.warn("repo-url listener:",r)}}function nt(e,t){if(!e)return;let r=Di();t?r[e]=t:delete r[e],Le(Oi,JSON.stringify(r)).catch(n=>console.warn("saveRepoUrlFor:",n)),Dl(Oi,n=>{let o=uc(n);return t?o[e]=t:delete o[e],JSON.stringify(o)}).catch(n=>console.warn("saveRepoUrlFor cross-tab merge:",n)),L0(e)}async function bh(e,t){await Dl(Oi,r=>{let n=uc(r),o=t==="replace"?{...e}:t==="prefer-imported"?{...n,...e}:{...e,...n};return JSON.stringify(o)}),yh()}var mh=Yt(),a=jf({reports:[],workspaceMerges:[],currentFile:null,currentWorkspace:null,currentView:"findings",bundles:[],selectedBundle:null,bundleDetails:null,bundleDetailsTab:"overview",selectedPackage:null,selectedPackageVersion:null,packageDetailsTab:"overview",packageSlideTriage:null,packageSlideTransient:!1,packagesSearchQuery:"",packagesSortBy:"findings-desc",expandedPackages:new Set,selectedRepository:null,repositoryDetailsTab:"overview",repositorySlideTriage:null,repositorySlideTransient:!1,repositoriesSearchQuery:"",repositoriesSortBy:"findings-desc",bundleSourceFile:null,bundleSourceFindingIdx:null,bundleCodeSearchMode:"files",bundleCodeSearchQuery:"",bundleSearchQuery:"",bundleSearchRegex:!1,bundleSearchCase:!1,bundleSearchContext:!0,filterSeverities:new Set,filterColors:new Set,filterSources:new Set,filterAnalyzer:"",filterModel:"",filterRepo:"",filterRevalidate:"",filterPartial:"",filterConfMin:0,filterConfMax:10,filterInclude:"",filterIncludeNegate:!1,filterComment:"",filterFix:"",filterFlagged:"",repoUrl:"",repoEditing:!1,sortBy:"severity",viewMode:F0()??"table",severityMode:B0()??"corrected",triage:new Map,shownTriage:null,nextFindingId:0,activeTabByGroup:new Map,tableSelectedGid:null,filesViewMode:"table",filesSearch:"",filesSelectedFile:null,kanbanPopoverGid:null,kanbanExpandedColumn:null,focusGid:null,focusCodeTick:0,codeBlockTick:0,serverMode:mh?.mode??"e2e",managed:mh?.managed??null,serverModeMismatch:!1,managedSession:null,managedTeams:[]});function yh(){a.repoEditing||a.currentFile&&(a.repoUrl=rt(a.currentFile))}Tn(()=>{yh()});var O0=/^## ([A-Z][A-Z_]*)\s*\(\d+\)\s*$/mu;function P0(e){switch(e.toUpperCase()){case"CRITICAL":return"critical";case"HIGH":return"high";case"MEDIUM":return"medium";case"LOW":return"low";case"HIGH_BUG":return"high_bug";case"BUG":return"bug";case"INFO":case"INFORMATIONAL":return"informational";default:return"medium"}}function N0(e){if(e)switch(e.toLowerCase()){case"high":return 8;case"medium":return 5;case"low":return 2;default:return}}function D0(e){return typeof e=="string"?e.replace(/^`(.*)`$/u,"$1"):e}function Bn(e){let t=e.replaceAll(/\r\n?/gu,`
4
+ `).trim();if(!O0.test(t))return null;let r=t.split(/^## ([A-Z][A-Z_]*)\s*\(\d+\)\s*\n/mu),n=[];for(let o=1;o<r.length;o+=2){let s=P0(r[o]),l=(r[o+1]||"").split(/^### /mu).slice(1);for(let c of l){let u=z0(c,s);u&&n.push(u)}}return n.length===0?null:{type:"security",source:"deepsec",findings:n}}function z0(e,t){let r=e.indexOf(`
5
+ `),n=(r===-1?e:e.slice(0,r)).trim();if(!n)return null;let o=r===-1?"":e.slice(r+1);o=o.replace(/\n---\s*$/u,"").trim();let s={};for(let w of o.matchAll(/^- \*\*([^:*]+):\*\*\s*(.+)$/gmu))s[w[1].trim().toLowerCase()]=w[2].trim();let i=/^\*\*Recommendation:\*\*\s*/mu.exec(o),l=o,c="";i&&(l=o.slice(0,i.index),c=o.slice(i.index+i[0].length).trim());let u=l.split(`
6
+ `).filter(w=>!/^\s*- \*\*/u.test(w)).join(`
7
7
  `).replaceAll("**","").trim(),p=n+(u?`
8
8
 
9
- `+u:""),f=Qw(s.file||"unknown"),h=(s.lines||"").split(",").map(v=>v.trim()).find(Boolean)||"?",b={file:f,line:h,severity:t,description:p};c&&(b.recommendation=c.replaceAll("**",""));let m=Xw(s.confidence);return m!==void 0&&(b.confidence=m),s.slug&&(b.slug=s.slug),b}function Zl(e){let t=[],r=-1,n="";for(let o of e.matchAll(/^ {0,3}(```|~~~).*$/gmu))r===-1?(r=o.index,n=o[1]):o[1]===n&&(t.push([r,o.index+o[0].length]),r=-1);return r!==-1&&t.push([r,e.length]),t}function ec(e,t){return e.some(([r,n])=>t>=r&&t<n)}function mr(e,t){let r=Zl(e),n=[...e.matchAll(t)].filter(o=>!ec(r,o.index));return n.map((o,s)=>({heading:o[1],body:e.slice(o.index+o[0].length+1,s+1<n.length?n[s+1].index:e.length)}))}function e0(e){let t=[];for(let r of e.split(`
10
- `)){let n=r.trim();if(!n.startsWith("|")||/^[\s:|-]+$/u.test(n)&&n.includes("-"))continue;let o=n.replace(/^\|/u,"").replace(/\|$/u,"").split("|").map(s=>s.trim());t.push(o)}return t}function Bo(e){let t=e0(e);if(t.length<2)return[];let r=t[0].map(o=>o.toLowerCase()),n=[];for(let o of t.slice(1)){if(o.length===r.length&&o.every((i,l)=>i.toLowerCase()===r[l]))continue;let s={};r.forEach((i,l)=>{i&&(s[i]=o[l]??"")}),n.push(s)}return n}function Xf(e){let t=Object.create(null),r=Object.create(null),n=[],o=null,s="",i=[],l="",c=(p,f,h)=>{!p||p in t||(t[p]=h.trim(),r[p]=f)},u=()=>{o&&c(o,s,i.join(`
9
+ `+u:""),f=D0(s.file||"unknown"),h=(s.lines||"").split(",").map(w=>w.trim()).find(Boolean)||"?",b={file:f,line:h,severity:t,description:p};c&&(b.recommendation=c.replaceAll("**",""));let g=N0(s.confidence);return g!==void 0&&(b.confidence=g),s.slug&&(b.slug=s.slug),b}var U0=/^( *)(```|~~~)/u,H0=/^( *)(?:[-*+]|\d{1,9}[.)]) +(?=\S)/u;function wr(e){let t=[],r=-1,n="",o=0,s=0,i=0;for(let l of e.split(`
10
+ `)){let c=i;i+=l.length+1;let u=U0.exec(l);if(r!==-1){u&&u[2]===n&&u[1].length<=o+3&&(t.push([r,c+l.length]),r=-1);continue}if(u&&u[1].length<=s+3){r=c,n=u[2],o=u[1].length;continue}if(!l.trim())continue;let p=H0.exec(l),f=/^ */u.exec(l)[0].length;p&&p[1].length<=s+3?s=p[0].length:f<s&&(s=0)}return r!==-1&&t.push([r,e.length]),t}function en(e,t){return e.some(([r,n])=>t>=r&&t<n)}function kr(e,t){let r=wr(e),n=[...e.matchAll(t)].filter(o=>!en(r,o.index));return n.map((o,s)=>({heading:o[1],body:e.slice(o.index+o[0].length+1,s+1<n.length?n[s+1].index:e.length)}))}function V0(e){let t=[];for(let r of e.split(`
11
+ `)){let n=r.trim();if(!n.startsWith("|")||/^[\s:|-]+$/u.test(n)&&n.includes("-"))continue;let o=n.replace(/^\|/u,"").replace(/\|$/u,"").split("|").map(s=>s.trim());t.push(o)}return t}function Do(e){let t=V0(e);if(t.length<2)return[];let r=t[0].map(o=>o.toLowerCase()),n=[];for(let o of t.slice(1)){if(o.length===r.length&&o.every((i,l)=>i.toLowerCase()===r[l]))continue;let s={};r.forEach((i,l)=>{i&&(s[i]=o[l]??"")}),n.push(s)}return n}function vh(e){let t=Object.create(null),r=Object.create(null),n=[],o=null,s="",i=[],l="",c=(p,f,h)=>{!p||p in t||(t[p]=h.trim(),r[p]=f)},u=()=>{o&&c(o,s,i.join(`
11
12
  `)),o=null,s="",i=[]};for(let p of e.split(`
12
- `)){let f=/^ {0,3}(```|~~~)/u.exec(p);if(f&&(!l||f[1]===l)){l=l?"":f[1],(o?i:n).push(p);continue}if(l){(o?i:n).push(p);continue}if(!p.trim()){o?u():n.push(p);continue}let h=/^\s*(?:[-*] +)?\*\*([^:*]+):\*\*\s*(.*)$/u.exec(p);if(h){u();let b=h[1].trim(),m=h[2],v;for(;(v=/\s+[·•]\s+\*\*([^:*]+):\*\*\s*/u.exec(m))!==null;)c(b.toLowerCase(),b,m.slice(0,v.index)),b=v[1].trim(),m=m.slice(v.index+v[0].length);o=b.toLowerCase(),s=b,i=[m];continue}if(/^\s*(?:#{1,6} |\||[-=*_]{3,}\s*$)/u.test(p)){u();continue}o?i.push(p):n.push(p)}return u(),{fields:t,labels:r,prose:n.join(`
13
- `).trim()}}function Mi(e){let t=(e||"").trim(),r="",n=/\[([^\]]+)\]\(([^)]+)\)/u.exec(t);n&&(t=n[1].trim(),r=n[2].trim());let o="",s=/#L(\d+)/u.exec(r);s&&(o=s[1]);let c=[...t.matchAll(/`([^`]+)`/gu)].map(f=>f[1].trim()).find(f=>!f.includes("(")&&(f.includes("/")||/\.\w/u.test(f)))??(t.replaceAll("`","").trim().split(/[\s,]+/u).find(Boolean)||""),u=/^(.*?)#L(\d+)(?:-L?\d+)?$/u.exec(c);u&&(c=u[1],o||(o=u[2]));let p=/^(.+):(\d+(?:-\d+)?)$/u.exec(c);return p?(o||(o=p[2]),{file:p[1],line:o,locationLink:r}):{file:c,line:o||"?",locationLink:r}}function tc(e){return e.replaceAll("**","")}var t0=/\\([!-/:-@[-`{-~])/gu;function Fi(e){return typeof e=="string"?e.replace(t0,"$1"):e}function Jr(e){let t=(e||"").trim();return/^[-–—]+$/u.test(t)?"":t}function br(e){switch(((e||"").trim().split(/\s+/u)[0]||"").replaceAll(/[`*]+/gu,"").toUpperCase()){case"CRITICAL":return"critical";case"HIGH":return"high";case"MEDIUM":return"medium";case"LOW":return"low";case"INFO":case"INFORMATIONAL":return"informational";default:return""}}function Lo(e){let t=/^([CHML])-?\d+$/iu.exec((e||"").trim());return t?{C:"critical",H:"high",M:"medium",L:"low"}[t[1].toUpperCase()]:""}function rc(e){let t=/^(critical|high|medium|low|informational|info)(?:[ -](?:severity|risk))?(?:[ -]findings?)?(?:\s*\(\d+\))?$/iu.exec((e||"").trim());return t?br(t[1]):""}function Qf(e){let t=/^(critical|high|medium|low|informational|info)\b/iu.exec((e||"").trim());return t?br(t[1]):""}function Rn(e){return/^variants?\s*(?:\(\d+\))?\s*:?$/iu.test((e||"").trim())}function In(e){let t=/^([CHML]-?\d{1,4}|(?:p|q|b|r|m|l|x|diff)\d{0,4}-\d{2,4})(?:-([A-Za-z0-9][\w-]*))?$/iu.exec(e||"");return t?{id:t[1].toUpperCase(),slug:t[2]||""}:null}function Bi(e){return(e||"").replaceAll("-"," ")}function Mn(e){let t=(e||"").trim(),r=/^\[([^\]]+)\]\([^)]*\)$/u.exec(t),n=r?r[1].trim():t,o=/^\[(.+)\]$/u.exec(n);return(o?o[1].trim():n).toUpperCase()}function nc(e){let t=e,r="",n=/^\[([^\]]+)\]\(([^)]+)\)\s*[:—–-]*\s*(.*)$/u.exec(t);n&&(r=n[2].trim(),t=n[3]?`${n[1].trim()} ${n[3].trim()}`:n[1].trim());let o=/^\[([^\]]+)\] *(.*)$/u.exec(t);if(o){let c=In(o[1].trim());return c?{id:c.id,title:o[2].trim()||Bi(c.slug)||c.id,link:r}:{id:o[1].trim().toUpperCase(),title:o[2].trim(),link:r}}let s=t.search(/\s/u),i=(s===-1?t:t.slice(0,s)).replace(/[:.,—–-]+$/u,""),l=In(i);if(l){let c=(s===-1?"":t.slice(s+1)).replace(/^[:—–-]+\s*/u,"").trim();return{id:l.id,title:c||Bi(l.slug)||l.id,link:r}}return{id:"",title:t.trim(),link:r}}function Zf(e){let t={},r=s=>(/`([^`]+)`/u.exec(s)?.[1]??s.split(/\s+/u)[0]??"").trim(),n=/^\s*(?:[-*] +)?\*\*Target:?\*\*\s*(.*)$/imu.exec(e||"");if(n){let s=r(n[1]);/^[\w.-]+\/[\w.-]+$/u.test(s)&&(t.repo=s)}let o=/^\s*(?:[-*] +)?\*\*Commit[^:*]*:?\*\*\s*(.*)$/imu.exec(e||"");if(o){let s=r(o[1]);/^[0-9a-f]{7,64}$/iu.test(s)&&(t.commitHash=s)}return t}var oc=["key code reference","key code","code reference","location","affected file","file","path"];function eh(e){for(let t of oc)if(e[t])return e[t];return""}function Li(e){return{id:Mn(e.id||""),title:Jr(e.title),severity:Jr(e.severity),pocStatus:Jr(e["poc status"]||e.poc),status:Jr(e.status),parent:Mn(Jr(e.parent||"")),location:Jr(e.location)}}function Oi(e,t=""){let r=br(e.severity)||t||Lo(e.id)||"medium",{file:n,line:o,locationLink:s}=Mi(e.location||""),i={file:n||"unknown",line:o,severity:r,description:tc(e.title||e.id)};return s?i.location=s:i.file==="unknown"&&e.id&&(i.location=`piolium:${e.id}`),e.pocStatus&&(i.pocStatus=e.pocStatus),e.status&&(i.status=e.status),e.parent&&(i.parent=e.parent),i}function sc(e,t,r){let n=[];for(let o of e.split(`
14
- `)){let s=/^\s{0,3}(?:[-*+]|\d{1,3}[.)])\s+(.+)$/u.exec(o);if(!s)continue;let i=s[1].trim();if(/^\*\*[^:*]+:\*\*/u.test(i))continue;let l="",c=/^\[([^\]]+)\]\(([^)]+)\)\s*[:—–-]*\s*(.*)$/u.exec(i);if(c)l=c[2].trim(),i=c[3]?`${c[1].trim()} ${c[3].trim()}`:c[1].trim();else{let y=/^\*\*([^*]+)\*\*\s*[:—–-]*\s*(.*)$/u.exec(i);y&&(i=y[2]?`${y[1].trim()} ${y[2].trim()}`:y[1].trim())}if(/^(?:none\b|no |n\/a\b)/iu.test(i))continue;let u=i.search(/\s/u),p=(u===-1?i:i.slice(0,u)).replace(/[:.,—–-]+$/u,""),f=In(p),h="",b=i;if(f){h=f.id;let y=(u===-1?"":i.slice(u+1)).replace(/^[:—–-]+\s*/u,"").trim(),k=Bi(f.slug);b=k&&y?`${k}
15
-
16
- ${y}`:y||k||f.id}let m=r.get(h),w={file:"unknown",line:"?",severity:br(m?.severity)||t||Lo(h)||"medium",description:tc(b)};h?w.location=`piolium:${h}`:l&&(w.location=l),l.endsWith("report.md")&&(w.reportPath=l),m?.pocStatus&&(w.pocStatus=m.pocStatus),m?.status&&(w.status=m.status),m?.parent&&(w.parent=m.parent),n.push({id:h,finding:w})}return n}function Oo(e,t,r,n=""){let o=[];for(let i of Bo(e)){let l=Li(i);!l.id&&!l.title||(!l.parent&&r&&(l.parent=r),l.id&&!t.has(l.id)&&t.set(l.id,l),o.push({id:l.id,finding:Oi(l,n)}))}if(o.length>0)return o;let s=sc(e,n,t);for(let i of s)r&&!i.finding.parent&&(i.finding.parent=r);return s}var ic=/^### +(.*)$/gmu,Ni=/^#### +(.*)$/gmu,r0=new Set(["technical findings detail","technical findings","detailed findings","findings detail","findings"]);function n0(e){return r0.has(e)||e.startsWith("findings by severity")}var o0=/^(?:summary of findings|deferred|methodolog|executive|conclusion|attack surface|coverage|discoveries|scope|table of contents|contents|appendix|recommendation|remediation)/u;function s0(e){return o0.test(e)}function rh(e){let{id:t}=nc(e);return!!(t&&In(t))}function i0(e){let t=mr(e,ic);return(t.length>0?t:mr(e,Ni)).some(({heading:n})=>rh(n))}function Fn(e){let t=e.replaceAll(/\r\n?/gu,`
17
- `).trim();if(!/^# +Security Audit Report\b/mu.test(t)&&!/^## +Technical Findings Detail\s*$/imu.test(t)&&!/^## +Findings by Severity\b/imu.test(t))return null;let r=c0(t),n=d0(r["summary of findings"]||""),o=Zf(lc(t,/^## +(.*)$/gmu).head),s=[],i=new Set,l=[],c=(p,f)=>{s.push(f),p&&i.add(p)},u=p=>{for(let f of p)c(f.id,f.finding)};for(let[p,f]of Object.entries(r)){let h=rc(p);if(h){u(ac(f,h,n,l));continue}if(n0(p)){u(th(f,n,l));continue}!s0(p)&&i0(f)&&u(th(f,n,l,Qf(p)))}for(let p of l)p.id&&i.has(p.id)||c(p.id,p.finding);for(let p of n.values())i.has(p.id)||c(p.id,Oi(p));if(s.length===0)return null;for(let p of s)o.repo&&(p.repo={github:o.repo}),o.commitHash&&!p.auditedCommit&&(p.auditedCommit=o.commitHash);return{type:"security",source:"piolium",findings:s}}function th(e,t,r,n=""){let o=mr(e,ic);return o.length===0?ac(e,n,t,r):nh(o,t,r,n)}function nh(e,t,r,n){let o=[],s="";for(let{heading:i,body:l}of e){let c=rc(i);if(c){o.push(...ac(l,c,t,r)),s="";continue}if(Rn(i)){o.push(...l0(l,t,s,r,n));continue}let u=a0(i,l,t,r,n);o.push(...u),s=u[0]?.id||s}return o}function a0(e,t,r,n,o=""){let{head:s,subs:i}=lc(t,Ni),l=[],c=Pi(e,s,r,o),u=!!c&&!c.id&&i.some(f=>!Rn(f.heading)&&rh(f.heading));c&&!u&&l.push({id:c.id,finding:c.finding});let p=u?"":c?.id||"";for(let f of i){if(Rn(f.heading)){n.push(...Oo(f.body,r,p,o));continue}let h=Pi(f.heading,f.body,r,o);h&&l.push({id:h.id,finding:h.finding})}return l}function l0(e,t,r,n,o=""){let{head:s,subs:i}=lc(e,Ni);n.push(...Oo(s,t,r,o));let l=[];for(let c of i){if(Rn(c.heading)){n.push(...Oo(c.body,t,"",o));continue}let u=Pi(c.heading,c.body,t,o);u&&l.push({id:u.id,finding:u.finding})}return l}function ac(e,t,r,n){let o=mr(e,ic);if(o.length>0)return nh(o,r,n,t);let s=[],i="";for(let{heading:c,body:u}of mr(e,Ni)){if(Rn(c)){n.push(...Oo(u,r,i,t));continue}let p=Pi(c,u,r,t);p&&(s.push({id:p.id,finding:p.finding}),i=p.id||i)}if(s.length>0)return s;let l=Bo(e).map(Li).filter(c=>c.id||c.title);if(l.length>0){for(let c of l)!c.severity&&t&&(c.severity=t),c.id&&!r.has(c.id)?r.set(c.id,c):c.id||n.push({id:"",finding:Oi(c,t)});return[]}return n.push(...sc(e,t,r)),[]}function Pi(e,t,r,n=""){let o=e.trim();if(!o)return null;let{id:s,title:i,link:l}=nc(o),c=r.get(s);if(!s&&i){for(let L of r.values())if(L.title.toLowerCase()===i.toLowerCase()){s=L.id,c=L;break}}let{fields:u,labels:p,prose:f}=Xf(t),h=br(u.severity)||br(c?.severity)||n||Lo(s)||"medium",{file:b,line:m,locationLink:v}=Mi(eh(u)),w=m;if(w==="?"&&(u.line||u.lines)){let L=/\d+/u.exec(u.line||u.lines);L&&(w=L[0])}let y=/\*\*Variant of:?\*\*\s*\[?([^\]\s)]+)/iu.exec(t),k=f.split(`
18
- `).filter(L=>!/^\s*<a\s[^>]*>\s*<\/a>\s*$/iu.test(L)&&!/\*\*Variant of:?\*\*/iu.test(L)).join(`
19
- `).trim(),C={file:b||"unknown",line:w,severity:h,description:p0(i||s,u,p,k)};v?C.location=v:C.file==="unknown"&&s&&(C.location=`piolium:${s}`);let T=u["poc status"]||u.poc||c?.pocStatus;T&&(C.pocStatus=T);let S=u["detailed report"]||(l.endsWith("report.md")?l:"");S&&(C.reportPath=S),c?.status&&(C.status=c.status);let M=u["variant of"]?Mn(u["variant of"].split(/\s+/u)[0]):"",I=c?.parent||M||(y?Mn(y[1]):"");return I&&(C.parent=I),{id:s,finding:C}}function c0(e){let t=Object.create(null);for(let{heading:r,body:n}of mr(e,/^## +(.*)$/gmu)){let o=r.trim().toLowerCase();o&&(t[o]=o in t?`${t[o]}
20
- ${n}`:n)}return t}function lc(e,t){let r=Zl(e),n=[...e.matchAll(t)].find(o=>!ec(r,o.index));return n?{head:e.slice(0,n.index),subs:mr(e,t)}:{head:e,subs:[]}}function d0(e){let t=new Map;for(let r of Bo(e)){let n=Li(r);n.id&&t.set(n.id,n)}return t}var u0=new Set([...oc,"severity","summary","files","poc","poc status","line","lines","detailed report","proof of concept","evidence","variant of","pattern","status","id","title"]);function p0(e,t,r,n){let o=[e];t.summary&&o.push(t.summary),n&&o.push(n);for(let[s,i]of Object.entries(t))!i||u0.has(s)||o.push(`**${r[s]||s}:** ${i}`);return o.filter(Boolean).join(`
21
-
22
- `)}var f0=new Set(["critical","high","medium","low","high_bug","bug","informational"]);function oh(e){let t=h0(e);if(!t)return null;let{severity:r,description:n,location:o,file:s,line:i}=t;return o?{severity:r,description:n,location:o}:{severity:r,description:n,file:s,line:i}}function h0(e){let t=e.indexOf(`
23
- `),r=(t===-1?e:e.slice(0,t)).trim();if(!r)return null;let n=t===-1?"":e.slice(t+1),{sectionsText:o,metaText:s}=g0(n),i=m0(o),l=b0(s),{file:c,line:u,locationLink:p}=y0(i.location||""),f=(l.severity||"").toLowerCase();return{severity:f0.has(f)?f:"medium",description:v0(r,i),location:p,file:c||"unknown",line:u}}function g0(e){let t=/^---\s*$/mu,r=t.exec(e);if(!r)return{sectionsText:e,metaText:""};let n=e.slice(0,r.index).trim(),o=e.slice(r.index+r[0].length).replace(/^\n/u,""),s=t.exec(o),i=s?o.slice(0,s.index):o;return{sectionsText:n,metaText:i}}function m0(e){let t={},r=e.split(/^## /mu);for(let n=1;n<r.length;n++){let o=r[n],s=o.indexOf(`
24
- `),i=(s===-1?o:o.slice(0,s)).trim().toLowerCase(),l=(s===-1?"":o.slice(s+1)).trim();i&&(t[i]=l)}return t}function b0(e){let t={};for(let r of e.matchAll(/\*\*([^:]+):\*\*\s*(.+)/gu))t[r[1].trim().toLowerCase()]=r[2].trim();return t}function y0(e){let t="",r="?",n="",o=e.match(/\[([^\]]+)\]\(([^)]+)\)/u);if(o){t=o[1].trim(),n=o[2];let i=o[2].match(/#L(\d+)/u);i&&(r=i[1])}else t=e.trim(),n=e.trim();let s=t.match(/^(.+):(\d+)$/u);return s&&(t=s[1],r==="?"&&(r=s[2])),{file:t,line:r,locationLink:n}}function v0(e,t){let r=[e];return t.details&&r.push(t.details),t.impact&&r.push(`Impact: ${t.impact}`),t["reproduction steps"]&&r.push(`Reproduction: ${t["reproduction steps"]}`),w0(r.join(`
25
-
26
- `))}function w0(e){return e.replaceAll("**","")}var k0=new Set(["critical","high","medium","low","high_bug","bug","informational"]);function Bn(e){let t=e.replaceAll(/\r\n?/gu,`
27
- `).trim();if(!t.startsWith("# "))return null;let r=t.split(/^# /mu).filter(s=>s.trim().length>0),n=[];for(let s of r){let i=$0(s);i&&n.push(i)}return n.length===0?null:{type:n.find(s=>s.type)?.type||"analysis",source:"claude-security",findings:n}}function $0(e){let t=e.indexOf(`
28
- `),r=(t===-1?e:e.slice(0,t)).trim();if(!r)return null;let n=t===-1?"":e.slice(t+1),{sectionsText:o,metaText:s}=x0(n),i=_0(o),l=S0(s),c=C0(i.evidence||""),{file:u,line:p,locationLink:f}=ih(i.location||c[0]?.ref||""),h=(l.severity||"").toLowerCase(),b=k0.has(h)?h:"medium",m=A0(r,i,c.length>0),v=i["recommended fix"]||void 0,w={file:u||"unknown",line:p,severity:b,description:m};f&&(w.location=f),c.length>0&&(w.evidence=c.map(E0)),v&&(w.recommendation=v),l.repository&&(w.repo={github:l.repository}),l.branch&&(w.branch=l.branch),l["date created"]&&(w.dateCreated=l["date created"]),l.status&&(w.status=l.status),l.category&&(w.type=l.category.toLowerCase());let y=oh(e);return y&&(w._idBasis=y),w}function x0(e){let t=/^---\s*$/mu,r=t.exec(e);if(!r)return{sectionsText:e,metaText:""};let n=e.slice(0,r.index).trim(),o=e.slice(r.index+r[0].length).replace(/^\n/u,""),s=t.exec(o),i=s?o.slice(0,s.index):o;return{sectionsText:n,metaText:i}}function _0(e){let t={},r=e.split(/^## /mu);for(let n=1;n<r.length;n++){let o=r[n],s=o.indexOf(`
29
- `),i=(s===-1?o:o.slice(0,s)).trim().toLowerCase(),l=(s===-1?"":o.slice(s+1)).trim();i&&(t[i]=l)}return t}function S0(e){let t={};for(let r of e.matchAll(/\*\*([^:]+):\*\*\s*(.+)/gu))t[r[1].trim().toLowerCase()]=r[2].trim();return t}function ih(e){let t="",r="?",n="",o=e.match(/\[([^\]]+)\]\(([^)\s]+)\)/u);if(o){t=o[1].trim(),n=o[2].trim();let i=n.match(/#L(\d+)(?:-L?(\d+))?/u);i&&(r=i[2]?`${i[1]}-${i[2]}`:i[1])}else t=e.trim(),n=e.trim();t=Fi(t.replaceAll("`","")).trim();let s=t.match(/^(.+):(\d+)(?:\s*[-–—]\s*L?(\d+))?$/u);return s&&(t=s[1],r==="?"&&(r=s[3]?`${s[2]}-${s[3]}`:s[2])),{file:t,line:r,locationLink:n}}var sh=/^[ \t]*(?:\d+[.)]|[-*+])\s+/u,ah=/\[[^\]]+\]\([^)\s]+\)/u;function C0(e){let t=[];for(let r of e.split(`
30
- `))sh.test(r)?t.push({ref:r.replace(sh,"").trim(),note:[]}):t.length>0&&r.trim()&&t.at(-1).note.push(r.trim());if(t.length===0){let r=e.split(`
31
- `).map(s=>s.trim()).filter(Boolean),n=r.findIndex(s=>ah.test(s));if(n===-1&&r.length!==1)return[];let o=n===-1?0:n;t.push({ref:r[o],note:r.filter((s,i)=>i!==o)})}return t.filter(r=>r.ref)}function E0({ref:e,note:t}){let{file:r,line:n,locationLink:o}=ih(e),s={file:r||"unknown",line:n};o&&ah.test(e)&&(s.url=o);let i=t.join(`
32
- `);return i&&(s.text=i),s}function A0(e,t,r){let n=[e];return t.details&&n.push(t.details),t.evidence&&!r&&n.push(`**Evidence:**
13
+ `)){let f=/^ {0,3}(```|~~~)/u.exec(p);if(f&&(!l||f[1]===l)){l=l?"":f[1],(o?i:n).push(p);continue}if(l){(o?i:n).push(p);continue}if(!p.trim()){o?u():n.push(p);continue}let h=/^\s*(?:[-*] +)?\*\*([^:*]+):\*\*\s*(.*)$/u.exec(p);if(h){u();let b=h[1].trim(),g=h[2],w;for(;(w=/\s+[·•]\s+\*\*([^:*]+):\*\*\s*/u.exec(g))!==null;)c(b.toLowerCase(),b,g.slice(0,w.index)),b=w[1].trim(),g=g.slice(w.index+w[0].length);o=b.toLowerCase(),s=b,i=[g];continue}if(/^\s*(?:#{1,6} |\||[-=*_]{3,}\s*$)/u.test(p)){u();continue}o?i.push(p):n.push(p)}return u(),{fields:t,labels:r,prose:n.join(`
14
+ `).trim()}}function zi(e){let t=(e||"").trim(),r="",n=/\[([^\]]+)\]\(([^)]+)\)/u.exec(t);n&&(t=n[1].trim(),r=n[2].trim());let o="",s=/#L(\d+)/u.exec(r);s&&(o=s[1]);let c=[...t.matchAll(/`([^`]+)`/gu)].map(f=>f[1].trim()).find(f=>!f.includes("(")&&(f.includes("/")||/\.\w/u.test(f)))??(t.replaceAll("`","").trim().split(/[\s,]+/u).find(Boolean)||""),u=/^(.*?)#L(\d+)(?:-L?\d+)?$/u.exec(c);u&&(c=u[1],o||(o=u[2]));let p=/^(.+):(\d+(?:-\d+)?)$/u.exec(c);return p?(o||(o=p[2]),{file:p[1],line:o,locationLink:r}):{file:c,line:o||"?",locationLink:r}}function pc(e){return e.replaceAll("**","")}var j0=/\\([!-/:-@[-`{-~])/gu;function Ui(e){return typeof e=="string"?e.replace(j0,"$1"):e}function tn(e){let t=(e||"").trim();return/^[-–—]+$/u.test(t)?"":t}function $r(e){switch(((e||"").trim().split(/\s+/u)[0]||"").replaceAll(/[`*]+/gu,"").toUpperCase()){case"CRITICAL":return"critical";case"HIGH":return"high";case"MEDIUM":return"medium";case"LOW":return"low";case"INFO":case"INFORMATIONAL":return"informational";default:return""}}function zo(e){let t=/^([CHML])-?\d+$/iu.exec((e||"").trim());return t?{C:"critical",H:"high",M:"medium",L:"low"}[t[1].toUpperCase()]:""}function fc(e){let t=/^(critical|high|medium|low|informational|info)(?:[ -](?:severity|risk))?(?:[ -]findings?)?(?:\s*\(\d+\))?$/iu.exec((e||"").trim());return t?$r(t[1]):""}function wh(e){let t=/^(critical|high|medium|low|informational|info)\b/iu.exec((e||"").trim());return t?$r(t[1]):""}function On(e){return/^variants?\s*(?:\(\d+\))?\s*:?$/iu.test((e||"").trim())}function Ln(e){let t=/^([CHML]-?\d{1,4}|(?:p|q|b|r|m|l|x|diff)\d{0,4}-\d{2,4})(?:-([A-Za-z0-9][\w-]*))?$/iu.exec(e||"");return t?{id:t[1].toUpperCase(),slug:t[2]||""}:null}function Hi(e){return(e||"").replaceAll("-"," ")}function Pn(e){let t=(e||"").trim(),r=/^\[([^\]]+)\]\([^)]*\)$/u.exec(t),n=r?r[1].trim():t,o=/^\[(.+)\]$/u.exec(n);return(o?o[1].trim():n).toUpperCase()}function hc(e){let t=e,r="",n=/^\[([^\]]+)\]\(([^)]+)\)\s*[:—–-]*\s*(.*)$/u.exec(t);n&&(r=n[2].trim(),t=n[3]?`${n[1].trim()} ${n[3].trim()}`:n[1].trim());let o=/^\[([^\]]+)\] *(.*)$/u.exec(t);if(o){let c=Ln(o[1].trim());return c?{id:c.id,title:o[2].trim()||Hi(c.slug)||c.id,link:r}:{id:o[1].trim().toUpperCase(),title:o[2].trim(),link:r}}let s=t.search(/\s/u),i=(s===-1?t:t.slice(0,s)).replace(/[:.,—–-]+$/u,""),l=Ln(i);if(l){let c=(s===-1?"":t.slice(s+1)).replace(/^[:—–-]+\s*/u,"").trim();return{id:l.id,title:c||Hi(l.slug)||l.id,link:r}}return{id:"",title:t.trim(),link:r}}function kh(e){let t={},r=s=>(/`([^`]+)`/u.exec(s)?.[1]??s.split(/\s+/u)[0]??"").trim(),n=/^\s*(?:[-*] +)?\*\*Target:?\*\*\s*(.*)$/imu.exec(e||"");if(n){let s=r(n[1]);/^[\w.-]+\/[\w.-]+$/u.test(s)&&(t.repo=s)}let o=/^\s*(?:[-*] +)?\*\*Commit[^:*]*:?\*\*\s*(.*)$/imu.exec(e||"");if(o){let s=r(o[1]);/^[0-9a-f]{7,64}$/iu.test(s)&&(t.commitHash=s)}return t}var mc=["key code reference","key code","code reference","location","affected file","file","path"];function $h(e){for(let t of mc)if(e[t])return e[t];return""}function Vi(e){return{id:Pn(e.id||""),title:tn(e.title),severity:tn(e.severity),pocStatus:tn(e["poc status"]||e.poc),status:tn(e.status),parent:Pn(tn(e.parent||"")),location:tn(e.location)}}function ji(e,t=""){let r=$r(e.severity)||t||zo(e.id)||"medium",{file:n,line:o,locationLink:s}=zi(e.location||""),i={file:n||"unknown",line:o,severity:r,description:pc(e.title||e.id)};return s?i.location=s:i.file==="unknown"&&e.id&&(i.location=`piolium:${e.id}`),e.pocStatus&&(i.pocStatus=e.pocStatus),e.status&&(i.status=e.status),e.parent&&(i.parent=e.parent),i}function gc(e,t,r){let n=[];for(let o of e.split(`
15
+ `)){let s=/^\s{0,3}(?:[-*+]|\d{1,3}[.)])\s+(.+)$/u.exec(o);if(!s)continue;let i=s[1].trim();if(/^\*\*[^:*]+:\*\*/u.test(i))continue;let l="",c=/^\[([^\]]+)\]\(([^)]+)\)\s*[:—–-]*\s*(.*)$/u.exec(i);if(c)l=c[2].trim(),i=c[3]?`${c[1].trim()} ${c[3].trim()}`:c[1].trim();else{let y=/^\*\*([^*]+)\*\*\s*[:—–-]*\s*(.*)$/u.exec(i);y&&(i=y[2]?`${y[1].trim()} ${y[2].trim()}`:y[1].trim())}if(/^(?:none\b|no |n\/a\b)/iu.test(i))continue;let u=i.search(/\s/u),p=(u===-1?i:i.slice(0,u)).replace(/[:.,—–-]+$/u,""),f=Ln(p),h="",b=i;if(f){h=f.id;let y=(u===-1?"":i.slice(u+1)).replace(/^[:—–-]+\s*/u,"").trim(),k=Hi(f.slug);b=k&&y?`${k}
16
+
17
+ ${y}`:y||k||f.id}let g=r.get(h),v={file:"unknown",line:"?",severity:$r(g?.severity)||t||zo(h)||"medium",description:pc(b)};h?v.location=`piolium:${h}`:l&&(v.location=l),l.endsWith("report.md")&&(v.reportPath=l),g?.pocStatus&&(v.pocStatus=g.pocStatus),g?.status&&(v.status=g.status),g?.parent&&(v.parent=g.parent),n.push({id:h,finding:v})}return n}function Uo(e,t,r,n=""){let o=[];for(let i of Do(e)){let l=Vi(i);!l.id&&!l.title||(!l.parent&&r&&(l.parent=r),l.id&&!t.has(l.id)&&t.set(l.id,l),o.push({id:l.id,finding:ji(l,n)}))}if(o.length>0)return o;let s=gc(e,n,t);for(let i of s)r&&!i.finding.parent&&(i.finding.parent=r);return s}var bc=/^### +(.*)$/gmu,Ki=/^#### +(.*)$/gmu,W0=new Set(["technical findings detail","technical findings","detailed findings","findings detail","findings"]);function K0(e){return W0.has(e)||e.startsWith("findings by severity")}var q0=/^(?:summary of findings|deferred|methodolog|executive|conclusion|attack surface|coverage|discoveries|scope|table of contents|contents|appendix|recommendation|remediation)/u;function G0(e){return q0.test(e)}function _h(e){let{id:t}=hc(e);return!!(t&&Ln(t))}function Y0(e){let t=kr(e,bc);return(t.length>0?t:kr(e,Ki)).some(({heading:n})=>_h(n))}function Nn(e){let t=e.replaceAll(/\r\n?/gu,`
18
+ `).trim();if(!/^# +Security Audit Report\b/mu.test(t)&&!/^## +Technical Findings Detail\s*$/imu.test(t)&&!/^## +Findings by Severity\b/imu.test(t))return null;let r=Q0(t),n=Z0(r["summary of findings"]||""),o=kh(vc(t,/^## +(.*)$/gmu).head),s=[],i=new Set,l=[],c=(p,f)=>{s.push(f),p&&i.add(p)},u=p=>{for(let f of p)c(f.id,f.finding)};for(let[p,f]of Object.entries(r)){let h=fc(p);if(h){u(yc(f,h,n,l));continue}if(K0(p)){u(xh(f,n,l));continue}!G0(p)&&Y0(f)&&u(xh(f,n,l,wh(p)))}for(let p of l)p.id&&i.has(p.id)||c(p.id,p.finding);for(let p of n.values())i.has(p.id)||c(p.id,ji(p));if(s.length===0)return null;for(let p of s)o.repo&&(p.repo={github:o.repo}),o.commitHash&&!p.auditedCommit&&(p.auditedCommit=o.commitHash);return{type:"security",source:"piolium",findings:s}}function xh(e,t,r,n=""){let o=kr(e,bc);return o.length===0?yc(e,n,t,r):Sh(o,t,r,n)}function Sh(e,t,r,n){let o=[],s="";for(let{heading:i,body:l}of e){let c=fc(i);if(c){o.push(...yc(l,c,t,r)),s="";continue}if(On(i)){o.push(...X0(l,t,s,r,n));continue}let u=J0(i,l,t,r,n);o.push(...u),s=u[0]?.id||s}return o}function J0(e,t,r,n,o=""){let{head:s,subs:i}=vc(t,Ki),l=[],c=Wi(e,s,r,o),u=!!c&&!c.id&&i.some(f=>!On(f.heading)&&_h(f.heading));c&&!u&&l.push({id:c.id,finding:c.finding});let p=u?"":c?.id||"";for(let f of i){if(On(f.heading)){n.push(...Uo(f.body,r,p,o));continue}let h=Wi(f.heading,f.body,r,o);h&&l.push({id:h.id,finding:h.finding})}return l}function X0(e,t,r,n,o=""){let{head:s,subs:i}=vc(e,Ki);n.push(...Uo(s,t,r,o));let l=[];for(let c of i){if(On(c.heading)){n.push(...Uo(c.body,t,"",o));continue}let u=Wi(c.heading,c.body,t,o);u&&l.push({id:u.id,finding:u.finding})}return l}function yc(e,t,r,n){let o=kr(e,bc);if(o.length>0)return Sh(o,r,n,t);let s=[],i="";for(let{heading:c,body:u}of kr(e,Ki)){if(On(c)){n.push(...Uo(u,r,i,t));continue}let p=Wi(c,u,r,t);p&&(s.push({id:p.id,finding:p.finding}),i=p.id||i)}if(s.length>0)return s;let l=Do(e).map(Vi).filter(c=>c.id||c.title);if(l.length>0){for(let c of l)!c.severity&&t&&(c.severity=t),c.id&&!r.has(c.id)?r.set(c.id,c):c.id||n.push({id:"",finding:ji(c,t)});return[]}return n.push(...gc(e,t,r)),[]}function Wi(e,t,r,n=""){let o=e.trim();if(!o)return null;let{id:s,title:i,link:l}=hc(o),c=r.get(s);if(!s&&i){for(let B of r.values())if(B.title.toLowerCase()===i.toLowerCase()){s=B.id,c=B;break}}let{fields:u,labels:p,prose:f}=vh(t),h=$r(u.severity)||$r(c?.severity)||n||zo(s)||"medium",{file:b,line:g,locationLink:w}=zi($h(u)),v=g;if(v==="?"&&(u.line||u.lines)){let B=/\d+/u.exec(u.line||u.lines);B&&(v=B[0])}let y=/\*\*Variant of:?\*\*\s*\[?([^\]\s)]+)/iu.exec(t),k=f.split(`
19
+ `).filter(B=>!/^\s*<a\s[^>]*>\s*<\/a>\s*$/iu.test(B)&&!/\*\*Variant of:?\*\*/iu.test(B)).join(`
20
+ `).trim(),S={file:b||"unknown",line:v,severity:h,description:tk(i||s,u,p,k)};w?S.location=w:S.file==="unknown"&&s&&(S.location=`piolium:${s}`);let M=u["poc status"]||u.poc||c?.pocStatus;M&&(S.pocStatus=M);let _=u["detailed report"]||(l.endsWith("report.md")?l:"");_&&(S.reportPath=_),c?.status&&(S.status=c.status);let R=u["variant of"]?Pn(u["variant of"].split(/\s+/u)[0]):"",O=c?.parent||R||(y?Pn(y[1]):"");return O&&(S.parent=O),{id:s,finding:S}}function Q0(e){let t=Object.create(null);for(let{heading:r,body:n}of kr(e,/^## +(.*)$/gmu)){let o=r.trim().toLowerCase();o&&(t[o]=o in t?`${t[o]}
21
+ ${n}`:n)}return t}function vc(e,t){let r=wr(e),n=[...e.matchAll(t)].find(o=>!en(r,o.index));return n?{head:e.slice(0,n.index),subs:kr(e,t)}:{head:e,subs:[]}}function Z0(e){let t=new Map;for(let r of Do(e)){let n=Vi(r);n.id&&t.set(n.id,n)}return t}var ek=new Set([...mc,"severity","summary","files","poc","poc status","line","lines","detailed report","proof of concept","evidence","variant of","pattern","status","id","title"]);function tk(e,t,r,n){let o=[e];t.summary&&o.push(t.summary),n&&o.push(n);for(let[s,i]of Object.entries(t))!i||ek.has(s)||o.push(`**${r[s]||s}:** ${i}`);return o.filter(Boolean).join(`
22
+
23
+ `)}var rk=new Set(["critical","high","medium","low","high_bug","bug","informational"]);function Ch(e){let t=nk(e);if(!t)return null;let{severity:r,description:n,location:o,file:s,line:i}=t;return o?{severity:r,description:n,location:o}:{severity:r,description:n,file:s,line:i}}function nk(e){let t=e.indexOf(`
24
+ `),r=(t===-1?e:e.slice(0,t)).trim();if(!r)return null;let n=t===-1?"":e.slice(t+1),{sectionsText:o,metaText:s}=ok(n),i=sk(o),l=ik(s),{file:c,line:u,locationLink:p}=ak(i.location||""),f=(l.severity||"").toLowerCase();return{severity:rk.has(f)?f:"medium",description:lk(r,i),location:p,file:c||"unknown",line:u}}function ok(e){let t=/^---\s*$/mu,r=t.exec(e);if(!r)return{sectionsText:e,metaText:""};let n=e.slice(0,r.index).trim(),o=e.slice(r.index+r[0].length).replace(/^\n/u,""),s=t.exec(o),i=s?o.slice(0,s.index):o;return{sectionsText:n,metaText:i}}function sk(e){let t={},r=e.split(/^## /mu);for(let n=1;n<r.length;n++){let o=r[n],s=o.indexOf(`
25
+ `),i=(s===-1?o:o.slice(0,s)).trim().toLowerCase(),l=(s===-1?"":o.slice(s+1)).trim();i&&(t[i]=l)}return t}function ik(e){let t={};for(let r of e.matchAll(/\*\*([^:]+):\*\*\s*(.+)/gu))t[r[1].trim().toLowerCase()]=r[2].trim();return t}function ak(e){let t="",r="?",n="",o=e.match(/\[([^\]]+)\]\(([^)]+)\)/u);if(o){t=o[1].trim(),n=o[2];let i=o[2].match(/#L(\d+)/u);i&&(r=i[1])}else t=e.trim(),n=e.trim();let s=t.match(/^(.+):(\d+)$/u);return s&&(t=s[1],r==="?"&&(r=s[2])),{file:t,line:r,locationLink:n}}function lk(e,t){let r=[e];return t.details&&r.push(t.details),t.impact&&r.push(`Impact: ${t.impact}`),t["reproduction steps"]&&r.push(`Reproduction: ${t["reproduction steps"]}`),ck(r.join(`
26
+
27
+ `))}function ck(e){return e.replaceAll("**","")}var dk=new Set(["critical","high","medium","low","high_bug","bug","informational"]);function Dn(e){let t=e.replaceAll(/\r\n?/gu,`
28
+ `).trim();if(!t.startsWith("# "))return null;let r=t.split(/^# /mu).filter(s=>s.trim().length>0),n=[];for(let s of r){let i=uk(s);i&&n.push(i)}return n.length===0?null:{type:n.find(s=>s.type)?.type||"analysis",source:"claude-security",findings:n}}function uk(e){let t=e.indexOf(`
29
+ `),r=(t===-1?e:e.slice(0,t)).trim();if(!r)return null;let n=t===-1?"":e.slice(t+1),{sectionsText:o,metaText:s}=pk(n),i=fk(o),l=hk(s),c=mk(i.evidence||""),{file:u,line:p,locationLink:f}=Ah(i.location||c[0]?.ref||""),h=(l.severity||"").toLowerCase(),b=dk.has(h)?h:"medium",g=bk(r,i,c.length>0),w=i["recommended fix"]||void 0,v={file:u||"unknown",line:p,severity:b,description:g};f&&(v.location=f),c.length>0&&(v.evidence=c.map(gk)),w&&(v.recommendation=w),l.repository&&(v.repo={github:l.repository}),l.branch&&(v.branch=l.branch),l["date created"]&&(v.dateCreated=l["date created"]),l.status&&(v.status=l.status),l.category&&(v.type=l.category.toLowerCase());let y=Ch(e);return y&&(v._idBasis=y),v}function pk(e){let t=/^---\s*$/mu,r=t.exec(e);if(!r)return{sectionsText:e,metaText:""};let n=e.slice(0,r.index).trim(),o=e.slice(r.index+r[0].length).replace(/^\n/u,""),s=t.exec(o),i=s?o.slice(0,s.index):o;return{sectionsText:n,metaText:i}}function fk(e){let t={},r=e.split(/^## /mu);for(let n=1;n<r.length;n++){let o=r[n],s=o.indexOf(`
30
+ `),i=(s===-1?o:o.slice(0,s)).trim().toLowerCase(),l=(s===-1?"":o.slice(s+1)).trim();i&&(t[i]=l)}return t}function hk(e){let t={};for(let r of e.matchAll(/\*\*([^:]+):\*\*\s*(.+)/gu))t[r[1].trim().toLowerCase()]=r[2].trim();return t}function Ah(e){let t="",r="?",n="",o=e.match(/\[([^\]]+)\]\(([^)\s]+)\)/u);if(o){t=o[1].trim(),n=o[2].trim();let i=n.match(/#L(\d+)(?:-L?(\d+))?/u);i&&(r=i[2]?`${i[1]}-${i[2]}`:i[1])}else t=e.trim(),n=e.trim();t=Ui(t.replaceAll("`","")).trim();let s=t.match(/^(.+):(\d+)(?:\s*[-–—]\s*L?(\d+))?$/u);return s&&(t=s[1],r==="?"&&(r=s[3]?`${s[2]}-${s[3]}`:s[2])),{file:t,line:r,locationLink:n}}var Eh=/^[ \t]*(?:\d+[.)]|[-*+])\s+/u,Th=/\[[^\]]+\]\([^)\s]+\)/u;function mk(e){let t=[];for(let r of e.split(`
31
+ `))Eh.test(r)?t.push({ref:r.replace(Eh,"").trim(),note:[]}):t.length>0&&r.trim()&&t.at(-1).note.push(r.trim());if(t.length===0){let r=e.split(`
32
+ `).map(s=>s.trim()).filter(Boolean),n=r.findIndex(s=>Th.test(s));if(n===-1&&r.length!==1)return[];let o=n===-1?0:n;t.push({ref:r[o],note:r.filter((s,i)=>i!==o)})}return t.filter(r=>r.ref)}function gk({ref:e,note:t}){let{file:r,line:n,locationLink:o}=Ah(e),s={file:r||"unknown",line:n};o&&Th.test(e)&&(s.url=o);let i=t.join(`
33
+ `);return i&&(s.text=i),s}function bk(e,t,r){let n=[e];return t.details&&n.push(t.details),t.evidence&&!r&&n.push(`**Evidence:**
33
34
  ${t.evidence}`),t.impact&&n.push(`**Impact:** ${t.impact}`),t["reproduction steps"]&&n.push(`**Reproduction:** ${t["reproduction steps"]}`),n.join(`
34
35
 
35
- `)}function T0(e){return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}function I0(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(e[r]);return btoa(t)}async function lh(e){let t=typeof e=="string"?te(e):e,r=await crypto.subtle.digest("SHA-512",t);return`sha512-${I0(new Uint8Array(r))}`}async function R0(e){let t=te(JSON.stringify(e)),r=await crypto.subtle.digest("SHA-256",t),n=new Uint8Array(r,0,16);n[6]=n[6]&15|64,n[8]=n[8]&63|128;let o=T0(n);return`${o.slice(0,8)}-${o.slice(8,12)}-${o.slice(12,16)}-${o.slice(16,20)}-${o.slice(20,32)}`}async function Di(e){if(typeof crypto?.subtle?.digest!="function")return null;let t;e._idBasis?t=e._idBasis:e.fileHash?t={severity:e.severity,description:e.description,fileHash:e.fileHash}:e.location?t={severity:e.severity,description:e.description,location:e.location}:t={severity:e.severity,description:e.description,file:e.file,line:e.line};try{return await R0(t)}catch{return null}}function Tt(e){try{return JSON.parse(e)}catch{return Tn(e)??Fn(e)??Bn(e)}}function It(e){let t=[];for(let r of e){let n=Array.isArray(r)?r:[r];for(let o of n)o&&t.push(o)}return t}async function yr(e){let t=e.filter(n=>n&&!n.id);if(t.length===0)return;let r=await Promise.all(t.map(Di));t.forEach((n,o)=>{r[o]&&(n.id=r[o])})}var M0=["type","model","think","effort","exportsMode"];function zi(e,t){if(!t.source)for(let r of M0)e[r]==null&&t[r]!=null&&(e[r]=t[r])}var Xr=new Map,Ln=new Map,On=new Map,Ui=new Map;function F0(e){let t=e?.package?.npm;if(typeof t?.name=="string"&&t.name&&!$n(t))return t.name;if(!e?.file)return null;let r=/(?:^|\/)(?:node_modules|dependencies)\/(@[^/]+\/[^/]+|[^/]+)/gu,n;for(;(n=r.exec(e.file))!==null;)if(n[1]!==".pnpm")return n[1];return null}function B0(e){return typeof e?.file!="string"?!1:/(?:^|\/)(?:node_modules|dependencies)\//u.test(e.file)}function L0(e,t){return typeof e.repo?.github=="string"&&e.repo.github?e.repo.github:typeof e._repoFallback=="string"&&e._repoFallback?e._repoFallback:typeof t=="string"&&t?t:null}var No=new Set,cc=new Set,Po=null,dc=!1;function uc(e){return cc.add(e),()=>cc.delete(e)}function pc(){for(let e of cc)try{e()}catch{}}function Do(e){return Xr.get(e)?.list??[]}function fc(){let e=0;for(let t of Xr.values())e+=t.list.length;return e}function Rt(){return Ln}function Qr(){return On}function zo(e,t){let r=Xr.get(e);if(!r)return[];let n=r.reports.get(vr(t));return n?[...n]:[]}function hc(e,t){let r=Ln.get(e);if(!r)return[];let n=r._keyReports.get(vr(t));return n?[...n]:[]}function gc(e,t){let r=On.get(e);if(!r)return[];let n=r._keyReports.get(vr(t));return n?[...n]:[]}function O0(e){let t=Array.isArray(e?.findings)?e.findings:Array.isArray(e?.groups)?e.groups:null;if(!t)return[];let r=[];for(let n of It(t))zi(n,e),r.push(n);return r}function vr(e){return e.id?`id:${e.id}`:`c:${e.severity??""}|${e.description??""}|${e.file??""}|${e.line??""}`}function mc(e,t,r){let n=Ui.get(e);n||(n={hash:[],pkg:[],repo:[]},Ui.set(e,n)),n[t].push(r)}function P0(e,t,r){let n=Xr.get(e.fileHash);n||(n={keys:new Set,list:[],reports:new Map},Xr.set(e.fileHash,n));let o=n.reports.get(t);o||(o=new Set,n.reports.set(t,o));let s=!o.has(r);return o.add(r),s&&mc(r,"hash",{hash:e.fileHash,key:t}),n.keys.has(t)?s:(n.keys.add(t),n.list.push(e),!0)}function N0(e,t,r){let n=F0(e);if(!n)return!1;let o=Sf(e),s=Ln.get(n);if(s||(s={...ai(),repos:new Set,byVersion:new Map,_repoReports:new Map},Ln.set(n,s)),typeof e.repo?.github=="string"&&e.repo.github){s.repos.add(e.repo.github);let l=s._repoReports.get(e.repo.github);l||s._repoReports.set(e.repo.github,l=new Set),l.add(r)}Cf(s,o,e,t,r);let i=li(s,t,r,e);return mc(r,"pkg",{pkg:n,key:t,file:e.file,version:o}),i}function D0(e,t,r,n){if(B0(e))return!1;let o=L0(e,n);if(!o)return!1;let s=On.get(o);s||(s=ai(),On.set(o,s));let i=li(s,t,r,e);return i&&mc(r,"repo",{repo:o,key:t,file:e.file}),i}function bc(e){let t=Ui.get(e);if(Ui.delete(e),No.delete(e),!t)return!1;let r=!1;for(let{hash:o,key:s}of t.hash){let i=Xr.get(o);if(!i)continue;let l=i.reports.get(s);if(l){if(l.delete(e)&&(r=!0),l.size===0){i.reports.delete(s),i.keys.delete(s);let c=i.list.findIndex(u=>vr(u)===s);c>=0&&i.list.splice(c,1)}i.keys.size===0&&Xr.delete(o)}}let n=new Set;for(let{pkg:o,key:s,file:i,version:l}of t.pkg){let c=Ln.get(o);if(!c)continue;let u=c._keyReports.get(s);if(u){if(u.delete(e)&&(r=!0),u.size===0&&ci(c,s,i,vr),Ef(c,l,s,i,e,vr),!n.has(o)){n.add(o);for(let p of[...c._repoReports.keys()]){let f=c._repoReports.get(p);f?.delete(e)&&f.size===0&&(c._repoReports.delete(p),c.repos.delete(p),r=!0)}}c._keyReports.size===0?Ln.delete(o):di(c)}}for(let{repo:o,key:s,file:i}of t.repo){let l=On.get(o);if(!l)continue;let c=l._keyReports.get(s);c&&(c.delete(e)&&(r=!0),c.size===0&&ci(l,s,i,vr),l._keyReports.size===0?On.delete(o):di(l))}return r}async function z0(e){if(No.has(e))return!1;No.add(e);try{let t=await Le(e),r=Tt(t);if(!r)return!1;let n=O0(r);if(n.length===0)return!1;let o="";try{o=et(e)}catch{}let s=!1;for(let i of n){let l=vr(i);i.fileHash&&P0(i,l,e)&&(s=!0),i.file&&N0(i,l,e)&&(s=!0),i.file&&D0(i,l,e,o)&&(s=!0)}return No.has(e)?s:(bc(e),dc=!0,!1)}catch{return No.delete(e),!1}}function Mt(){return Po||(Po=(async()=>{try{do{dc=!1;let e=await ie();for(let t of e)await z0(t)&&pc()}while(dc)}finally{Po=null}})(),Po)}Io(e=>{bc(e)&&pc()});Gf(e=>{bc(e)&&pc(),Mt().catch(()=>{})});var Uo=new Map,Ho=new Map;function Hi(e,t){if(!e||!t)return!1;let r=!Ho.has(e);Ho.set(e,t);for(let[n,o]of t){if(!o)continue;let s=Uo.get(o);s||(s=new Map,Uo.set(o,s)),s.set(e,n)}return r}function yc(e){let t=Ho.get(e);if(Ho.delete(e),!!t)for(let r of t.values()){let n=Uo.get(r);n&&(n.delete(e),n.size===0&&Uo.delete(r))}}function Zr(e){if(!e)return[];let t=Uo.get(e);if(!t)return[];let r=[];for(let[n,o]of t)r.push({integrity:n,file:o});return r}function vc(e){return Ho.has(e)}var dh="deepview.fileCounts",ch=2,wr=null;function ji(){if(wr)return wr;try{wr=JSON.parse(Ae(dh)||"{}")}catch{wr={}}return wr?.__v!==ch&&(wr={__v:ch}),wr}function wc(){Fe(dh,JSON.stringify(wr)).catch(e=>console.warn("counts persist:",e))}function uh(e){if(e==="__v")return;let t=ji()[e];if(t!==void 0)return typeof t=="number"?{count:t}:t}function jo(e){return uh(e)?.count}function Wo(e){return uh(e)?.source}function rt(e,t,r){let n=ji();n[e]=r?{count:t,source:r}:{count:t},wc()}function Nn(e){let t=ji();delete t[e],wc()}function Ge(e){try{let o=JSON.parse(e);if(o&&Array.isArray(o.findings))return{count:o.findings.length,source:o.source,recognized:!0}}catch{}let t=Tn(e);if(t)return{count:t.findings.length,source:t.source,recognized:!0};let r=Fn(e);if(r)return{count:r.findings.length,source:r.source,recognized:!0};let n=Bn(e);return n?{count:n.findings.length,source:n.source,recognized:!0}:{count:0,recognized:!1}}var Vo=null,Pn=null,Vi=null;function U0(e,t){for(let{names:r,onUpdate:n}of Vi)if(r.has(e))try{n(e,t)}catch(o){console.warn("ensureCounts onUpdate:",o)}}function kc(e,t){if(Vo){t&&Vi.push({names:new Set(e),onUpdate:t});for(let r of e)Pn.add(r);return Vo}return Pn=new Set(e),Vi=t?[{names:new Set(e),onUpdate:t}]:[],Vo=(async()=>{await Promise.resolve();try{let r=ji();for(;Pn.size>0;){let n=Pn.values().next().value;if(Pn.delete(n),r[n]===void 0)try{let o=await Le(n);if(r[n]!==void 0)continue;let{count:s,source:i}=Ge(o);r[n]=i?{count:s,source:i}:{count:s},wc(),U0(n,s)}catch{}}}finally{Vo=null,Pn=null,Vi=null}})(),Vo}var H0=/^\d+$/u;function V0(e){for(let t=0;t<e.length;t++){let r=e.codePointAt(t);if(r<32||r===127)return!0}return!1}var fh=512;function j0(e){return typeof e=="string"&&e.length>0&&e.length<=fh&&!V0(e)}function en(e){return j0(e)&&!H0.test(e)}var W0=3,ph=4,K0=/^[\w-]{4}$/u,q0=/^[\w-]{8}$/u,$c="AAAA",G0={report:`deepview/finding-link/report/v1
36
+ `)}function yk(e){return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}function vk(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(e[r]);return btoa(t)}async function Rh(e){let t=typeof e=="string"?re(e):e,r=await crypto.subtle.digest("SHA-512",t);return`sha512-${vk(new Uint8Array(r))}`}async function wk(e){let t=re(JSON.stringify(e)),r=await crypto.subtle.digest("SHA-256",t),n=new Uint8Array(r,0,16);n[6]=n[6]&15|64,n[8]=n[8]&63|128;let o=yk(n);return`${o.slice(0,8)}-${o.slice(8,12)}-${o.slice(12,16)}-${o.slice(16,20)}-${o.slice(20,32)}`}async function qi(e){if(typeof crypto?.subtle?.digest!="function")return null;let t;e._idBasis?t=e._idBasis:e.fileHash?t={severity:e.severity,description:e.description,fileHash:e.fileHash}:e.location?t={severity:e.severity,description:e.description,location:e.location}:t={severity:e.severity,description:e.description,file:e.file,line:e.line};try{return await wk(t)}catch{return null}}function Ft(e){try{return JSON.parse(e)}catch{return Bn(e)??Nn(e)??Dn(e)}}function Bt(e){let t=[];for(let r of e){let n=Array.isArray(r)?r:[r];for(let o of n)o&&t.push(o)}return t}async function xr(e){let t=e.filter(n=>n&&!n.id);if(t.length===0)return;let r=await Promise.all(t.map(qi));t.forEach((n,o)=>{r[o]&&(n.id=r[o])})}var kk=["type","model","think","effort","exportsMode"];function Gi(e,t){if(!t.source)for(let r of kk)e[r]==null&&t[r]!=null&&(e[r]=t[r])}var $k=/^(?:https?:\/\/)?(?:www\.)?github\.com\/([^/?#]+)\/([^/?#]+?)(?:\.git)?(?:[/?#].*)?$/iu,xk=/^[\w.-]+\/[\w.-]+$/u;function Yi(e){let t=e?.repo?.github;if(typeof t!="string")return null;let r=t.trim().replace(/\/+$/u,"");if(!r)return null;let n=$k.exec(r),o=(n?`${n[1]}/${n[2]}`:r).replace(/\.git$/u,"");return xk.test(o)?o:null}var rn=new Map,zn=new Map,Un=new Map,Ji=new Map;function _k(e){let t=e?.package?.npm;if(typeof t?.name=="string"&&t.name&&!En(t))return t.name;if(!e?.file)return null;let r=/(?:^|\/)(?:node_modules|dependencies)\/(@[^/]+\/[^/]+|[^/]+)/gu,n;for(;(n=r.exec(e.file))!==null;)if(n[1]!==".pnpm")return n[1];return null}function Sk(e){return typeof e?.file!="string"?!1:/(?:^|\/)(?:node_modules|dependencies)\//u.test(e.file)}function Ck(e,t){return typeof e.repo?.github=="string"&&e.repo.github?e.repo.github:typeof e._repoFallback=="string"&&e._repoFallback?e._repoFallback:typeof t=="string"&&t?t:null}var Vo=new Set,wc=new Set,Ho=null,kc=!1;function $c(e){return wc.add(e),()=>wc.delete(e)}function xc(){for(let e of wc)try{e()}catch{}}function jo(e){return rn.get(e)?.list??[]}function _c(){let e=0;for(let t of rn.values())e+=t.list.length;return e}function Lt(){return zn}function nn(){return Un}function Wo(e,t){let r=rn.get(e);if(!r)return[];let n=r.reports.get(_r(t));return n?[...n]:[]}function Sc(e,t){let r=zn.get(e);if(!r)return[];let n=r._keyReports.get(_r(t));return n?[...n]:[]}function Cc(e,t){let r=Un.get(e);if(!r)return[];let n=r._keyReports.get(_r(t));return n?[...n]:[]}function Ek(e){let t=Array.isArray(e?.findings)?e.findings:Array.isArray(e?.groups)?e.groups:null;if(!t)return[];let r=[];for(let n of Bt(t))Gi(n,e),r.push(n);return r}function _r(e){return e.id?`id:${e.id}`:`c:${e.severity??""}|${e.description??""}|${e.file??""}|${e.line??""}`}function Ec(e,t,r){let n=Ji.get(e);n||(n={hash:[],pkg:[],repo:[]},Ji.set(e,n)),n[t].push(r)}function Ak(e,t,r){let n=rn.get(e.fileHash);n||(n={keys:new Set,list:[],reports:new Map},rn.set(e.fileHash,n));let o=n.reports.get(t);o||(o=new Set,n.reports.set(t,o));let s=!o.has(r);return o.add(r),s&&Ec(r,"hash",{hash:e.fileHash,key:t}),n.keys.has(t)?s:(n.keys.add(t),n.list.push(e),!0)}function Tk(e,t,r){let n=_k(e);if(!n)return!1;let o=qf(e),s=zn.get(n);if(s||(s={...mi(),repos:new Set,byVersion:new Map,_repoReports:new Map},zn.set(n,s)),typeof e.repo?.github=="string"&&e.repo.github){s.repos.add(e.repo.github);let l=s._repoReports.get(e.repo.github);l||s._repoReports.set(e.repo.github,l=new Set),l.add(r)}Gf(s,o,e,t,r);let i=gi(s,t,r,e);return Ec(r,"pkg",{pkg:n,key:t,file:e.file,version:o}),i}function Rk(e,t,r,n){if(Sk(e))return!1;let o=Ck(e,n);if(!o)return!1;let s=Un.get(o);s||(s=mi(),Un.set(o,s));let i=gi(s,t,r,e);return i&&Ec(r,"repo",{repo:o,key:t,file:e.file}),i}function Ac(e){let t=Ji.get(e);if(Ji.delete(e),Vo.delete(e),!t)return!1;let r=!1;for(let{hash:o,key:s}of t.hash){let i=rn.get(o);if(!i)continue;let l=i.reports.get(s);if(l){if(l.delete(e)&&(r=!0),l.size===0){i.reports.delete(s),i.keys.delete(s);let c=i.list.findIndex(u=>_r(u)===s);c>=0&&i.list.splice(c,1)}i.keys.size===0&&rn.delete(o)}}let n=new Set;for(let{pkg:o,key:s,file:i,version:l}of t.pkg){let c=zn.get(o);if(!c)continue;let u=c._keyReports.get(s);if(u){if(u.delete(e)&&(r=!0),u.size===0&&bi(c,s,i,_r),Yf(c,l,s,i,e,_r),!n.has(o)){n.add(o);for(let p of[...c._repoReports.keys()]){let f=c._repoReports.get(p);f?.delete(e)&&f.size===0&&(c._repoReports.delete(p),c.repos.delete(p),r=!0)}}c._keyReports.size===0?zn.delete(o):yi(c)}}for(let{repo:o,key:s,file:i}of t.repo){let l=Un.get(o);if(!l)continue;let c=l._keyReports.get(s);c&&(c.delete(e)&&(r=!0),c.size===0&&bi(l,s,i,_r),l._keyReports.size===0?Un.delete(o):yi(l))}return r}async function Ik(e){if(Vo.has(e))return!1;Vo.add(e);try{let t=await Pe(e),r=Ft(t);if(!r)return!1;let n=Ek(r);if(n.length===0)return!1;let o=Yi(r)??"";if(!o)try{o=rt(e)}catch{}let s=!1;for(let i of n){let l=_r(i);i.fileHash&&Ak(i,l,e)&&(s=!0),i.file&&Tk(i,l,e)&&(s=!0),i.file&&Rk(i,l,e,o)&&(s=!0)}return Vo.has(e)?s:(Ac(e),kc=!0,!1)}catch{return Vo.delete(e),!1}}function Ot(){return Ho||(Ho=(async()=>{try{do{kc=!1;let e=await ce();for(let t of e)await Ik(t)&&xc()}while(kc)}finally{Ho=null}})(),Ho)}Lo(e=>{Ac(e)&&xc()});gh(e=>{Ac(e)&&xc(),Ot().catch(()=>{})});var Ko=new Map,qo=new Map;function Xi(e,t){if(!e||!t)return!1;let r=!qo.has(e);qo.set(e,t);for(let[n,o]of t){if(!o)continue;let s=Ko.get(o);s||(s=new Map,Ko.set(o,s)),s.set(e,n)}return r}function Tc(e){let t=qo.get(e);if(qo.delete(e),!!t)for(let r of t.values()){let n=Ko.get(r);n&&(n.delete(e),n.size===0&&Ko.delete(r))}}function on(e){if(!e)return[];let t=Ko.get(e);if(!t)return[];let r=[];for(let[n,o]of t)r.push({integrity:n,file:o});return r}function Rc(e){return qo.has(e)}var Mh="deepview.fileCounts",Ih=2,Sr=null;function Zi(){if(Sr)return Sr;try{Sr=JSON.parse(Ie(Mh)||"{}")}catch{Sr={}}return Sr?.__v!==Ih&&(Sr={__v:Ih}),Sr}function Ic(){Le(Mh,JSON.stringify(Sr)).catch(e=>console.warn("counts persist:",e))}function Fh(e){if(e==="__v")return;let t=Zi()[e];if(t!==void 0)return typeof t=="number"?{count:t}:t}function Yo(e){return Fh(e)?.count}function Jo(e){return Fh(e)?.source}function ot(e,t,r){let n=Zi();n[e]=r?{count:t,source:r}:{count:t},Ic()}function Vn(e){let t=Zi();delete t[e],Ic()}function Je(e){try{let o=JSON.parse(e);if(o&&Array.isArray(o.findings))return{count:o.findings.length,source:o.source,recognized:!0}}catch{}let t=Bn(e);if(t)return{count:t.findings.length,source:t.source,recognized:!0};let r=Nn(e);if(r)return{count:r.findings.length,source:r.source,recognized:!0};let n=Dn(e);return n?{count:n.findings.length,source:n.source,recognized:!0}:{count:0,recognized:!1}}var Go=null,Hn=null,Qi=null;function Mk(e,t){for(let{names:r,onUpdate:n}of Qi)if(r.has(e))try{n(e,t)}catch(o){console.warn("ensureCounts onUpdate:",o)}}function Mc(e,t){if(Go){t&&Qi.push({names:new Set(e),onUpdate:t});for(let r of e)Hn.add(r);return Go}return Hn=new Set(e),Qi=t?[{names:new Set(e),onUpdate:t}]:[],Go=(async()=>{await Promise.resolve();try{let r=Zi();for(;Hn.size>0;){let n=Hn.values().next().value;if(Hn.delete(n),r[n]===void 0)try{let o=await Pe(n);if(r[n]!==void 0)continue;let{count:s,source:i}=Je(o);r[n]=i?{count:s,source:i}:{count:s},Ic(),Mk(n,s)}catch{}}}finally{Go=null,Hn=null,Qi=null}})(),Go}var Fk=/^\d+$/u;function Bk(e){for(let t=0;t<e.length;t++){let r=e.codePointAt(t);if(r<32||r===127)return!0}return!1}var Lh=512;function Lk(e){return typeof e=="string"&&e.length>0&&e.length<=Lh&&!Bk(e)}function sn(e){return Lk(e)&&!Fk.test(e)}var Ok=3,Bh=4,Pk=/^[\w-]{4}$/u,Nk=/^[\w-]{8}$/u,Fc="AAAA",Dk={report:`deepview/finding-link/report/v1
36
37
  `,workspace:`deepview/finding-link/workspace/v1
37
- `},xc=new Map;function hh(e,t){return`${e}\0${t}`}function Y0(e){return typeof e=="string"&&K0.test(e)}async function tn(e,t){let r=G0[e];if(!r||typeof t!="string"||!t)return null;let n=hh(e,t),o=xc.get(n);if(o!==void 0)return o;let s;try{let i=await crypto.subtle.digest("SHA-256",te(r+t));s=new Uint8Array(i).slice(0,W0).toBase64({alphabet:"base64url",omitPadding:!0})}catch{return null}return xc.set(n,s),s}function Wi(e,t){return typeof t!="string"||!t?null:xc.get(hh(e,t))??null}function J0(e,t){let r=[];for(let[n,o]of[["report",e],["workspace",t]]){if(o==null||o===""){r.push($c);continue}if(!Y0(o))throw new TypeError(`encodeFindingRef: ${n} must be a link hint token, not a name`);r.push(o)}return r.every(n=>n===$c)?null:r.join("")}function X0(e){let t=[e.slice(0,ph),e.slice(ph)].map(r=>r===$c?null:r);return{report:t[0],workspace:t[1]}}function gh({id:e,report:t,workspace:r}={}){if(!en(e))throw new TypeError("encodeFindingRef: a persistent finding id is required");let n=[`finding=${encodeURIComponent(e)}`],o=J0(t,r);return o&&n.push(`v=${o}`),n.join("&")}function _c(e){let t=gh(e);return typeof location>"u"?`#${t}`:`${location.origin}${location.pathname}#${t}`}function Ki(e){let t=typeof e=="string"?e:typeof location>"u"?"":location.hash;if(!t)return null;let r=t.replace(/^#/u,"");if(!r)return null;let n={id:null,report:null,workspace:null};for(let o of r.split("&")){let s=o.indexOf("=");if(s<0)continue;let i=o.slice(0,s),l=o.slice(s+1);if(!l)continue;if(i==="v"){if(!q0.test(l))continue;Object.assign(n,X0(l));continue}if(i!=="finding"||l.length>fh*3)continue;let c;try{c=decodeURIComponent(l)}catch{continue}en(c)&&(n.id=c)}return n.id?n:null}function mh(e){if(typeof location>"u")return null;let t;try{t=new URL(e)}catch{return null}if(t.href!==e||t.protocol!==location.protocol||t.host!==location.host||t.username||t.password)return null;let r=Ki(t.hash);return r?{id:r.id,fragment:gh(r)}:null}var Q0=`deepview/workspace-id/v1
38
- `;async function Ko(e){let t=Uint8Array.fromBase64(e),r=te(Q0),n=new Uint8Array(r.length+t.length);n.set(r,0),n.set(t,r.length);let o=new Uint8Array(await crypto.subtle.digest("SHA-256",n)),i=Array.from(o.subarray(0,16),u=>u.toString(16).padStart(2,"0")).join("").split("");i[12]="8";let l=parseInt(i[16],16)&3|8;i[16]=l.toString(16);let c=i.join("");return`${c.slice(0,8)}-${c.slice(8,12)}-${c.slice(12,16)}-${c.slice(16,20)}-${c.slice(20,32)}`}function qo(e){let t=new Set;function r(o){return t.add(o),()=>t.delete(o)}function n(o){for(let s of t)try{s(o)}catch(i){console.warn(`workspace ${e} listener failed:`,i)}}return{on:r,fire:n}}var bh=qo("create"),yh=qo("delete"),vh=qo("privateKey"),wh=qo("report-membership"),kh=qo("bundle-membership"),Z0=bh.on,Sc=yh.on,Cc=vh.on,Ec=wh.on,Ac=kh.on,qi=bh.fire,Tc=yh.fire,Ic=vh.fire,Gi=wh.fire,Yi=kh.fire;var Mc="deepview.workspaces",ek=1;function Go(){try{let e=Ae(Mc);if(!e)return[];let t=JSON.parse(e);return t&&typeof t=="object"&&Array.isArray(t.workspaces)?t.workspaces:Array.isArray(t)?t:[]}catch{return[]}}async function tk(e){await Fe(Mc,JSON.stringify({version:ek,workspaces:e}))}var rk=Mc;function Dn(e){return navigator.locks.request(rk,async()=>{await ur();let t=Go(),r=await e(t);if(r!==!1)return await tk(t),r})}function Yo(e){return{id:e.id,privateKey:e.privateKey,reports:Array.isArray(e.reports)?[...e.reports]:[],bundles:Array.isArray(e.bundles)?[...e.bundles]:[]}}var wt=Go().map(Yo);function Fc(){wt=Go().map(Yo)}function Bc(e){wt=wt.filter(t=>t.id!==e.id),wt.push(Yo(e))}function nk(e,t){let r=Array.isArray(e[t])?[...e[t]]:[],n=wt.find(o=>o.id===e.id);if(n){n[t]=r;return}wt.push(Yo(e))}function ok(e){wt=wt.filter(t=>t.id!==e)}function W(){let e=Go();for(let t of e)Array.isArray(t.reports)||(t.reports=[]),Array.isArray(t.bundles)||(t.bundles=[]);return e}var sk=200;function Ft(e){let t=(e??"").trim();return t&&t.replaceAll(/[\u0000-\u001F\u007F]/gu,"").slice(0,sk)||null}async function Lc(e){let t=Ft(e);if(!t)return null;let r=new Uint8Array(32);crypto.getRandomValues(r);let n=r.toBase64(),o={id:await Ko(n),name:t,privateKey:n,reports:[],bundles:[],createdAt:Date.now()};return await Dn(i=>i.some(l=>l.id===o.id)?!1:(i.push(o),o))?(Bc(o),o):null}async function Oc(e){await Dn(r=>{let n=r.findIndex(o=>o.id===e);return n<0?!1:(r.splice(n,1),!0)})&&(Tc(e),ok(e))}async function Pc(e,t){let r=Ft(t);return!(!r||!await Dn(o=>{let s=o.find(i=>i.id===e);return!s||s.name===r?!1:(s.name=r,s)}))}async function $h(e){let t=await Dn(o=>{let s=o.findIndex(p=>p.id===e.id),i=s>=0?o[s]:null,l=Ft(e.name)??i?.name??"Workspace",c=e.preserveBundles?Array.isArray(i?.bundles)?i.bundles:[]:Array.isArray(e.bundles)?e.bundles:[],u={id:e.id,name:l,privateKey:e.privateKey,reports:Array.isArray(e.reports)?[...new Set(e.reports)]:[],bundles:[...new Set(c)],createdAt:e.createdAt??Date.now()};return s>=0?o[s]=u:o.push(u),{previous:i,next:u}}),{next:r}=t,n=wt.find(o=>o.id===r.id)??null;return n==null?qi(r.id):(n.privateKey!==r.privateKey&&Ic(r.id),Ji(n.reports,r.reports)||Gi(r.id),Ji(n.bundles,r.bundles)||Yi(r.id)),Bc(r),r}async function Nc({id:e,name:t,privateKey:r,createdAt:n}){let o=null;return await Dn(s=>{let i=Ft(t);if(!i)return o={status:"name-collision",existing:null},!1;let l=s.find(p=>p.id===e)??null;if(l)return o={status:"already-attached",workspace:l},!1;let c=s.find(p=>Ft(p.name)===i)??null;if(c)return o={status:"name-collision",existing:c},!1;let u={id:e,name:i,privateKey:r,reports:[],bundles:[],createdAt:n??Date.now()};s.push(u),o={status:"attached",workspace:u}}),o?.status==="attached"&&(qi(o.workspace.id),Bc(o.workspace)),o}function Ji(e,t){let r=new Set(e),n=new Set(t);if(r.size!==n.size)return!1;for(let o of r)if(!n.has(o))return!1;return!0}async function Rc({identifier:e,workspaceId:t,field:r,fire:n,additive:o=!1,from:s=void 0}){let i=await Dn(u=>{if((u.find(m=>Array.isArray(m[r])&&m[r].includes(e))?.id??null)===(t??null))return!1;let f=null;if(t!=null&&(f=u.find(m=>m.id===t)??null,!f))return!1;let h=new Set;if(!o)for(let m of u)s!==void 0&&m.id!==s||(Array.isArray(m[r])||(m[r]=[]),m[r].includes(e)&&(m[r]=m[r].filter(v=>v!==e),h.add(m.id)));if(f&&(Array.isArray(f[r])||(f[r]=[]),f[r].includes(e)||(f[r].push(e),h.add(f.id))),h.size===0)return!1;let b=new Map;for(let m of h){let v=u.find(w=>w.id===m);v&&b.set(m,v)}return{affected:h,snapshot:b}});if(!i)return;let{affected:l,snapshot:c}=i;for(let u of l){n(u);let p=c.get(u);p&&nk(p,r)}}function xh(e,t){return{move:(r,n)=>Rc({identifier:r,workspaceId:n,field:e,fire:t}),add:(r,n)=>Rc({identifier:r,workspaceId:n,field:e,fire:t,additive:!0}),remove:(r,n)=>Rc({identifier:r,field:e,fire:t,from:n})}}var Dc=xh("reports",Gi),zc=xh("bundles",Yi),Jo=Dc.move,Kt=Dc.add,Xo=Dc.remove,Uc=zc.move,rn=zc.add,Hc=zc.remove;function ik(){let e=Go().map(Yo),t=wt,r=new Map(t.map(o=>[o.id,o])),n=new Map(e.map(o=>[o.id,o]));for(let o of r.keys())n.has(o)||Tc(o);for(let[o,s]of n){let i=r.get(o);if(!i){qi(o);continue}i.privateKey!==s.privateKey&&Ic(o),Ji(i.reports,s.reports)||Gi(o),Ji(i.bundles,s.bundles)||Yi(o)}wt=e}_n(()=>{ik()});async function Vc(e){if(!e)return null;let t=W(),n=(await Promise.all(t.map(o=>tn("workspace",o.id)))).indexOf(e);return n===-1?null:t[n]}async function jc(e){if(!e)return null;let t=await ie(),n=(await Promise.all(t.map(o=>tn("report",o)))).indexOf(e);return n===-1?null:t[n]}async function ak(e,t){let r;try{r=await Le(e)}catch{return!1}if(r==null)return!1;let n=Tt(r);if(!Array.isArray(n?.findings))return!1;let o=It(n.findings);if(o.some(i=>i.id===t))return!0;let s=o.filter(i=>!i.id);return s.length===0?!1:(await yr(s),s.some(i=>i.id===t))}async function Wc(e,{skip:t=[]}={}){if(!e)return null;let r=new Set(t),n=(await ie()).filter(o=>!r.has(o));for(let o of n)if(await ak(o,e))return o;return null}function Kc(e){return e?W().filter(t=>t.reports.includes(e)):[]}function qc(e){if(!e)return"";for(let t of e.split(`
39
- `))if(t.trim())return t.trim();return""}function Gc(e){let t=new Set(e.map(n=>n.id)),r=new Map;for(let n of a.reports)for(let o of n.groups)for(let s of o){let i=s.id??String(s._id);if(!(!t.has(i)||r.has(i))&&(r.set(i,{severity:s.severity,file:s.file,line:s.line,description:qc(s.description)}),r.size===t.size))return r}return r}function _h(e){return e==="inprogress"||e==="fixed"||e==="invalid"||e==="deleted"?e:void 0}function _e(e){if(e)return _h(e.triage)??(e.deleted?"deleted":void 0)}function lk(e){return e?!e.color&&!_e(e)&&!e.comment&&!e.fix&&!(e.ignoredReports&&e.ignoredReports.length>0)&&e.flagged===void 0:!0}function qt(e,t,r){let n=e.get(t)?.ignoredReports;return Array.isArray(n)&&n.includes(r)}function Qo(e){if(!e||typeof e!="object")return;let t=e,r={};typeof t.color=="string"&&t.color&&(r.color=t.color);let n=_h(t.triage)??(t.deleted?"deleted":void 0);if(n&&(r.triage=n),typeof t.comment=="string"&&t.comment&&(r.comment=t.comment),typeof t.fix=="string"&&t.fix&&(r.fix=t.fix),typeof t.flagged=="boolean"&&(r.flagged=t.flagged),Array.isArray(t.ignoredReports)){let o=t.ignoredReports.filter(s=>typeof s=="string"&&s.length>0);o.length>0&&(r.ignoredReports=o)}return lk(r)?void 0:r}function ck(e,t){let r=e??[],n=t??[];if(r.length!==n.length)return!1;if(r.length===0)return!0;let o=new Set(r);for(let s of n)if(!o.has(s))return!1;return!0}function dk(e,t){let r=e??{},n=t??{};return(r.color??"")===(n.color??"")&&(_e(r)??"")===(_e(n)??"")&&(r.comment??"")===(n.comment??"")&&(r.fix??"")===(n.fix??"")&&r.flagged===n.flagged&&ck(r.ignoredReports,n.ignoredReports)}function z(e,t,r){let n=e.get(t),o=Qo({...n,...r});return o===void 0?e.delete(t):dk(n,o)?!1:(e.set(t,o),!0)}function he(e,t,r,n){let o=new Set(e.get(t)?.ignoredReports??[]);return n?o.add(r):o.delete(r),z(e,t,{ignoredReports:o.size>0?[...o]:void 0})}var Yc=()=>{};function Ch(e){Yc=typeof e=="function"?e:()=>{}}var Eh=()=>{};function Jc(e){Eh=typeof e=="function"?e:()=>{}}var kr="deepview.triage",Gt="deepview.triage.pending",Bt=/^\d+$/u;async function uk(e){let t=new Blob([e]).stream().pipeThrough(new CompressionStream("deflate"));return new Uint8Array(await new Response(t).arrayBuffer())}async function pk(e){let t=new Blob([e]).stream().pipeThrough(new DecompressionStream("deflate"));return new Uint8Array(await new Response(t).arrayBuffer())}var fk="deepview.triage.save",Sh=0;function Xc(){let e={};for(let[t,r]of a.triage){if(Bt.test(t))continue;let n=Qo(r);n&&(e[t]=n)}return e}function pe(){let e=++Sh,t=Xc(),r=Object.keys(t).length===0,n=r?null:JSON.stringify(t);if(n!=null)try{localStorage.setItem(Gt,n)}catch{}return navigator.locks.request(Ze,{mode:"shared"},async()=>{let o=null,s=null;if(n!=null)try{let i=te(n),l=await uk(i);s=Be(),o=(s?await Of(l):l).toBase64()}catch(i){console.warn("Failed to save triage:",i),Yc();return}await navigator.locks.request(fk,()=>{try{if(e!==Sh)return;if(n!=null&&Be()!==s){queueMicrotask(()=>{pe()});return}if(r)localStorage.removeItem(kr),localStorage.removeItem(Gt);else{localStorage.setItem(kr,o);try{localStorage.removeItem(Gt)}catch{}}}catch(i){console.warn("Failed to save triage:",i)}}),Yc()})}async function Ah(){let e=localStorage.getItem(Gt);if(e)try{return JSON.parse(e)}catch{}let t=localStorage.getItem(kr);if(!t)return null;let r=Uint8Array.fromBase64(t);if(qe(r)){if(!Be())throw new Error("triage: vault locked, cannot decrypt envelope");r=await Pf(r)}let n=await pk(r);return JSON.parse(xe(n))}function Th(e,{replace:t=!1}={}){let r=a.triage;if(t){let n=null,o=localStorage.getItem(Gt);if(o)try{n=JSON.parse(o)}catch{}let s=i=>n!=null&&i in n;for(let i of[...r.keys()]){if(Bt.test(i))continue;let l=e?.[i],c=!e||!(i in e);!(s(i)&&n[i]?.color)&&(c||!l?.color)&&z(r,i,{color:void 0}),!(s(i)&&(n[i]?.triage||n[i]?.deleted))&&!_e(l)&&z(r,i,{triage:void 0}),!(s(i)&&n[i]?.comment)&&(c||typeof l?.comment!="string"||!l.comment)&&z(r,i,{comment:void 0}),!(s(i)&&n[i]?.fix)&&(c||typeof l?.fix!="string"||!l.fix)&&z(r,i,{fix:void 0}),!(s(i)&&n[i]?.flagged!==void 0)&&(c||l?.flagged===void 0)&&z(r,i,{flagged:void 0})}for(let i of[...r.keys()]){if(Bt.test(i))continue;let l=r.get(i)?.ignoredReports;if(!l||l.length===0)continue;let c=e?.[i],u=!!_e(c);for(let p of[...l]){if(s(i)&&Array.isArray(n[i]?.ignoredReports)&&n[i].ignoredReports.includes(p))continue;if(u){he(r,i,p,!1);continue}let f=c?.ignoredReports;(!Array.isArray(f)||!f.includes(p))&&he(r,i,p,!1)}}}if(e)for(let[n,o]of Object.entries(e)){let s=_e(o),i={};if(o&&o.color&&(i.color=o.color),s&&(i.triage=s),o&&typeof o.comment=="string"&&o.comment&&(i.comment=o.comment),o&&typeof o.fix=="string"&&o.fix&&(i.fix=o.fix),o&&typeof o.flagged=="boolean"&&(i.flagged=o.flagged),Object.keys(i).length>0&&z(r,n,i),!s&&o&&Array.isArray(o.ignoredReports)){let l=new Set(r.get(n)?.ignoredReports??[]),c=!1;for(let u of o.ignoredReports)typeof u=="string"&&!l.has(u)&&(l.add(u),c=!0);c&&z(r,n,{ignoredReports:[...l]})}}}async function hk(){try{let e=await Ah();Th(e)}catch(e){console.warn("Failed to load triage:",e)}}async function Ih(){try{let e=await Ah();Th(e,{replace:!0}),Eh()}catch(e){console.warn("Failed to reload triage:",e)}}typeof window<"u"&&window.addEventListener("storage",e=>{e.key!==kr&&e.key!==Gt||Ih()});var Zo=hk();Te(()=>{Ih()});Te(()=>{Be()&&localStorage.getItem(Gt)&&pe()});async function Qc({seal:e}){try{localStorage.removeItem(Gt)}catch{}let t=localStorage.getItem(kr);if(!t)return;let r=Uint8Array.fromBase64(t);if(qe(r))return;let n=await e(r,_o());localStorage.setItem(kr,n.toBase64())}async function Zc({open:e}){try{localStorage.removeItem(Gt)}catch{}let t=localStorage.getItem(kr);if(!t)return;let r=Uint8Array.fromBase64(t);if(!qe(r))return;let n=await e(r,_o());localStorage.setItem(kr,n.toBase64())}var Rh="deepview.lastFile",es=null;function ed(){return es||(es=gk(),es.catch(()=>{es=null})),es}async function gk(){try{await Zo}catch{}let e=await ie(),t=new Set(e),r=new Set(e),n=new Set;for(let o of e){if(!o.toLowerCase().endsWith(".deepseek"))continue;let s=o.slice(0,-9)+".md";if(t.has(s))continue;let i;try{i=await Le(o),await dt(s,i),await An(o)}catch(p){console.warn(`migrate: failed to rename ${o} -> ${s}`,p);continue}t.delete(o),t.add(s),n.add(o);let l=jo(o);if(Nn(o),l===void 0){let{count:p,source:f}=Ge(i);rt(s,p,f)}else{let{source:p}=Ge(i);rt(s,l,p)}let c=et(o);c&&(tt(o,""),tt(s,c));let u=!1;for(let[p,f]of[...a.triage])f.ignoredReports?.includes(o)&&(he(a.triage,p,o,!1),he(a.triage,p,s,!0),u=!0);if(u&&await pe(),Ae(Rh)===o)try{await Fe(Rh,s)}catch{}}for(let o of W())for(let s of o.reports){if(!s.toLowerCase().endsWith(".deepseek")||!n.has(s)&&r.has(s))continue;let i=s.slice(0,-9)+".md";await Xo(s,o.id),await Kt(i,o.id)}}function Mh(){return typeof navigator<"u"&&typeof navigator.storage=="object"&&navigator.storage!==null}async function zn(){if(!Mh()||typeof navigator.storage.persist!="function")return!1;try{return await navigator.storage.persist()===!0}catch{return!1}}async function td(){let e={supported:Mh(),persisted:null,usage:null,quota:null};if(!e.supported)return e;if(typeof navigator.storage.persisted=="function")try{e.persisted=await navigator.storage.persisted()}catch{}if(typeof navigator.storage.estimate=="function")try{let t=await navigator.storage.estimate();typeof t?.usage=="number"&&(e.usage=t.usage),typeof t?.quota=="number"&&(e.quota=t.quota)}catch{}return e}var rd=1;function mk(){let e=Xc(),t=Ri();return{version:rd,exportedAt:new Date().toISOString(),triage:e,repoUrls:t}}function bk(){return`deepview-triage-${new Date().toISOString().replaceAll(/[:.]/gu,"-").slice(0,19)}.json.gz`}async function nd(){let e=mk();return{blob:new Blob([await ui(JSON.stringify(e))]),filename:bk()}}async function od(e){let t;try{t=await bo(new Uint8Array(await e.arrayBuffer()))}catch(n){throw new Error(`Failed to gunzip: ${n.message}`,{cause:n})}let r;try{r=JSON.parse(t)}catch(n){throw new Error(`Failed to parse JSON: ${n.message}`,{cause:n})}if(!r||typeof r!="object")throw new Error("Invalid backup file (not an object)");if(r.version!==rd)throw new Error(`Unsupported backup version: ${r.version} (expected ${rd})`);if(!r.triage||typeof r.triage!="object")throw new Error("Backup is missing the `triage` map");if(!r.repoUrls||typeof r.repoUrls!="object")throw new Error("Backup is missing the `repoUrls` map");return r}async function sd(e,t){if(!["replace","prefer-imported","prefer-current"].includes(t))throw new Error(`Unknown merge mode: ${t}`);if(!e||typeof e!="object")throw new Error("Invalid payload: not an object");if(!e.triage||typeof e.triage!="object"||Array.isArray(e.triage))throw new Error("Invalid payload: missing or non-object `triage`");if(!e.repoUrls||typeof e.repoUrls!="object"||Array.isArray(e.repoUrls))throw new Error("Invalid payload: missing or non-object `repoUrls`");let r=e.triage,n=a.triage;if(t==="replace")for(let l of[...n.keys()])Bt.test(l)||n.delete(l);let o=t==="prefer-current";for(let[l,c]of Object.entries(r)){if(Bt.test(l)||!c||typeof c!="object")continue;typeof c.color=="string"&&c.color&&(!o||!n.get(l)?.color)&&z(n,l,{color:c.color});let u=_e(c);if(u&&(!o||!_e(n.get(l)))&&z(n,l,{triage:u}),typeof c.comment=="string"&&c.comment&&(!o||!n.get(l)?.comment)&&z(n,l,{comment:c.comment}),typeof c.fix=="string"&&c.fix&&(!o||!n.get(l)?.fix)&&z(n,l,{fix:c.fix}),typeof c.flagged=="boolean"&&(!o||n.get(l)?.flagged===void 0)&&z(n,l,{flagged:c.flagged}),Array.isArray(c.ignoredReports)&&!_e(n.get(l)))for(let p of c.ignoredReports)typeof p=="string"&&(o&&qt(n,l,p)||he(n,l,p,!0))}await pe();let s=0,i=null;try{await Yf(e.repoUrls,t),s=Object.keys(e.repoUrls).length}catch(l){console.warn("applyTriageImport: repo-URL import failed:",l),i=l}return{triageEntries:Object.keys(r).length,repoUrls:s,repoUrlError:i}}function yk(e){return e?.name==="NotFoundError"||typeof e?.message=="string"&&e.message.startsWith("File not found:")}async function id(e){let t=new Set;for(let r of e){let n;try{n=await Le(r)}catch(i){if(yk(i))continue;throw new Error(`Failed to read ${r}: ${i.message}`,{cause:i})}if(n==null)continue;let o=Tt(n);if(!Array.isArray(o?.findings))continue;let s=It(o.findings);await yr(s);for(let i of s)i.id&&t.add(i.id)}return t}function vk(){let e=new Set;for(let t of a.triage.keys())Bt.test(t)||e.add(t);return e}async function Xi(e){let t=vk();if(t.size===0)return{orphanedCount:0,sharedCount:0};let r=await id(e),n=new Set;for(let p of t)r.has(p)&&n.add(p);if(n.size===0)return{orphanedCount:0,sharedCount:0};let o=await ie(),s=new Set(e),i=o.filter(p=>!s.has(p)),l=await id(i),c=0,u=0;for(let p of n)l.has(p)?u++:c++;return{orphanedCount:c,sharedCount:u}}async function Qi(){let e=new Set(a.triage.keys()),t=[];for(let[i,l]of a.triage)if(l.ignoredReports)for(let c of l.ignoredReports)t.push({id:i,report:c});let r=await ie(),n=new Set(r),o=await id(r),s=!1;for(let i of e){if(Bt.test(i)||o.has(i))continue;let l=a.triage.get(i);!l||!(l.color||_e(l)||l.comment||l.fix||l.flagged!==void 0)||z(a.triage,i,{color:void 0,triage:void 0,comment:void 0,fix:void 0,flagged:void 0,deleted:void 0})&&(s=!0)}for(let{id:i,report:l}of t)Bt.test(i)||o.has(i)&&n.has(l)||qt(a.triage,i,l)&&he(a.triage,i,l,!1)&&(s=!0);s&&await pe()}var ad=1,xr=16,Fh=12,Bh=1+xr+Fh+16,$r=1+xr+Fh;async function Lh(e,t){let r=await crypto.subtle.importKey("raw",te(e),"PBKDF2",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"PBKDF2",hash:"SHA-256",salt:t,iterations:3e6},r,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}function Oh(e){return!(e instanceof Uint8Array)||e.length<Bh?!1:e[0]===ad}async function Zi(e,t){if(!(e instanceof Uint8Array))throw new TypeError("encryptWithPassword: plaintext Uint8Array required");if(typeof t!="string"||!t)throw new TypeError("encryptWithPassword: password required");let r=new Uint8Array($r+e.length+16);r[0]=ad,crypto.getRandomValues(r.subarray(1,1+xr)),crypto.getRandomValues(r.subarray(1+xr,$r));let n=r.subarray(1,1+xr),o=r.subarray(1+xr,$r),s=await Lh(t,n),i=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:o,additionalData:r.subarray(0,$r)},s,e));return r.set(i,$r),r}async function kk(e,t){if(typeof t!="string"||!t)throw new TypeError("tryDecryptWithPassword: password required");if(!(e instanceof Uint8Array)||e.length<Bh)return{ok:!1,reason:"malformed"};if(e[0]!==ad)return{ok:!1,reason:"malformed"};let r=e.subarray(1,1+xr),n=e.subarray(1+xr,$r),o=e.subarray($r),s=await Lh(t,r),i;try{i=new Uint8Array(await crypto.subtle.decrypt({name:"AES-GCM",iv:n,additionalData:e.subarray(0,$r)},s,o))}catch{return{ok:!1,reason:"wrong-password"}}return{ok:!0,plaintext:i}}async function ea(e,t,r){if(!r||typeof r.malformedMsg!="string"||typeof r.wrongPasswordMsg!="string")throw new TypeError("decryptWithPasswordOrThrow: { malformedMsg, wrongPasswordMsg } strings required");let n=await kk(e,t);if(n.ok)return n.plaintext;throw n.reason==="wrong-password"?new Error(r.wrongPasswordMsg):new Error(r.malformedMsg)}var ts=Oh,Ph=Zi;function Nh(e,t){return ea(e,t,{malformedMsg:"malformed encrypted bundle",wrongPasswordMsg:"wrong password or corrupt bundle"})}var $k=1;async function xk(e){let t=new Set,r=Tt(e);if(!Array.isArray(r?.findings))return t;let n=It(r.findings);await yr(n);for(let o of n)o.id&&t.add(o.id);return t}function Dh(e){return(e??"").replaceAll(/[^a-zA-Z0-9._-]+/gu,"_").replaceAll(/^_+|_+$/gu,"")||"workspace"}async function _k(e){if(!Array.isArray(e)||e.length===0)return[];let t=await vt(),r=new Map(t.map(o=>[o.integrity,o.name])),n=[];for(let o of e){let s=r.get(o);if(!s)continue;let i;try{i=await jt(o)}catch(l){console.warn(`Workspace export: failed to read bundle ${o}: ${l?.message??l}`);continue}n.push({integrity:o,name:s,data:i.toBase64()})}return n}async function Sk(e,{includeBundleBytes:t=!1}={}){let r=[],n=new Set;for(let u of e.reports??[]){let p;try{p=await Le(u)}catch(f){console.warn(`Workspace export: skipping ${u}: ${f?.message??f}`),(f instanceof DOMException&&f.name==="NotFoundError"||typeof f?.message=="string"&&f.message.startsWith("File not found:"))&&await Jo(u,null);continue}r.push({name:u,content:p});for(let f of await xk(p))n.add(f)}let o=new Set(e.reports??[]),s={};for(let[u,p]of a.triage){if(!n.has(u))continue;let f=(p.ignoredReports??[]).filter(b=>o.has(b)),h=Qo({...p,ignoredReports:f});h&&(s[u]=h)}let i={};for(let u of r){let p=et(u.name);p&&(i[u.name]=p)}let l=(e.bundles??[]).filter(u=>typeof u=="string"&&u.length>0),c={version:$k,exportedAt:new Date().toISOString(),workspace:{id:e.id,name:e.name,privateKey:e.privateKey,createdAt:e.createdAt},reports:r,bundles:l,repoUrls:i,triage:s};if(t){let u=await _k(l);u.length>0&&(c.bundleBlobs=u)}return c}async function zh(e,{includeBundleBytes:t=!1}={}){let r=await Sk(e,{includeBundleBytes:t});return{blob:new Blob([await ui(JSON.stringify(r))]),filename:`${Dh(e.name)}.deepview-workspace.json.gz`}}async function Ck(e,t,{includeBundleBytes:r=!1}={}){if(typeof t!="string"||!t)throw new TypeError("buildWorkspaceExportEncrypted: password required");let{blob:n}=await zh(e,{includeBundleBytes:r}),o=new Uint8Array(await n.arrayBuffer()),s=await Ph(o,t);return{blob:new Blob([s],{type:"application/octet-stream"}),filename:`${Dh(e.name)}.deepview-workspace.enc`}}async function ld(e,{password:t,includeBundleBytes:r=!1}={}){return typeof t=="string"&&t?await Ck(e,t,{includeBundleBytes:r}):await zh(e,{includeBundleBytes:r})}var Ek=1,Uh=1024,Hh=1024,ta=200,Kh=100*1024*1024,Ak=Math.ceil(Kh*4/3)+16,Vh=512,jh=64;function Tk(e){if(!e||typeof e!="object")return"payload is not an object";if(e.version!==Ek)return`unsupported export version: ${e.version}`;if(!e.workspace||typeof e.workspace!="object")return"workspace metadata missing";if(typeof e.workspace.id!="string")return"workspace.id must be a string";if(typeof e.workspace.name!="string")return"workspace.name must be a string";if(typeof e.workspace.privateKey!="string")return"workspace.privateKey must be a string";if(e.workspace.createdAt!==void 0&&!Number.isFinite(e.workspace.createdAt))return"workspace.createdAt must be a finite number or omitted";if(!Array.isArray(e.reports))return"reports field must be an array";if(e.reports.length>Hh)return`reports count (${e.reports.length}) exceeds cap (${Hh})`;if(e.bundles!==void 0){if(!Array.isArray(e.bundles))return"bundles field must be an array when present";if(e.bundles.length>Uh)return`bundles count (${e.bundles.length}) exceeds cap (${Uh})`;for(let t of e.bundles){if(typeof t!="string")return"bundles entries must be strings";if(t.length>ta)return`bundle integrity exceeds per-entry length cap (${ta})`}}if(e.bundleBlobs!==void 0){if(!Array.isArray(e.bundleBlobs))return"bundleBlobs field must be an array when present";if(e.bundleBlobs.length>jh)return`bundleBlobs count (${e.bundleBlobs.length}) exceeds cap (${jh})`;for(let t of e.bundleBlobs){if(!t||typeof t!="object"||Array.isArray(t))return"bundleBlobs entries must be objects";if(typeof t.integrity!="string"||t.integrity.length===0)return"bundleBlobs.integrity must be a non-empty string";if(t.integrity.length>ta)return`bundleBlobs.integrity exceeds per-entry length cap (${ta})`;if(typeof t.name!="string"||t.name.length===0)return"bundleBlobs.name must be a non-empty string";if(t.name.length>Vh)return`bundleBlobs.name exceeds per-entry length cap (${Vh})`;if(t.name.includes("\0"))return"bundleBlobs.name cannot contain NUL";if(typeof t.data!="string")return"bundleBlobs.data must be a base64 string";if(t.data.length>Ak)return`bundleBlobs.data exceeds per-blob size cap (${Kh} bytes raw)`}}return null}async function cd(e){return new Uint8Array(await e.arrayBuffer())}async function ra(e,t){if(ts(e)){if(typeof t!="string"||!t)throw new TypeError("parseWorkspaceBundleBytes: password required for encrypted bundle");let n=await Nh(e,t);try{return Wh(await bo(n))}catch(o){throw new Error("wrong password or corrupt bundle",{cause:o})}}let r;try{r=await bo(e)}catch(n){throw new Error(`gzip decompression failed: ${n.message}`,{cause:n})}return Wh(r)}function Wh(e){let t;try{t=JSON.parse(e)}catch(o){throw new Error(`payload is not JSON: ${o.message}`,{cause:o})}let r=Tk(t);if(r===null)return t;let n=r.includes("exceeds cap");throw new Error(n?r:`not a deepview workspace export: ${r}`)}function Ik(e){return _e(e)??null}async function Rk(e){let t=new Map;for(let r of e??[]){if(typeof r?.content!="string")continue;let n=Tt(r.content);if(!n?.findings)continue;let o=It(n.findings);await yr(o);for(let s of o)!s.id||t.has(s.id)||t.set(s.id,{severity:s.severity,file:s.file,line:s.line,description:qc(s.description)})}return t}async function Mk(e,t,r){if(!e||typeof e!="object"||Array.isArray(e))return;let n=a.triage,o=[];for(let[s,i]of Object.entries(e)){if(!i||typeof i!="object")continue;let l=n.get(s)?.color,c=typeof i.color=="string"?i.color:void 0;c&&l&&l!==c?o.push({id:s,property:"color",local:l,imported:c}):c&&c!==l&&z(n,s,{color:c});let u=n.get(s)?.comment??"",p=typeof i.comment=="string"?i.comment:"";p&&u&&u!==p?o.push({id:s,property:"comment",local:u,imported:p}):p&&p!==u&&z(n,s,{comment:p});let f=n.get(s)?.fix??"",h=typeof i.fix=="string"?i.fix:"";h&&f&&f!==h?o.push({id:s,property:"fix",local:f,imported:h}):h&&h!==f&&z(n,s,{fix:h});let b=Ik(i),m=_e(n.get(s))??null;b&&m&&m!==b?o.push({id:s,property:"triage",local:m,imported:b}):b&&!m&&z(n,s,{triage:b,ignoredReports:void 0});let v=n.get(s)?.flagged,w=typeof i.flagged=="boolean"?i.flagged:void 0;w!==void 0&&v!==void 0&&v!==w?o.push({id:s,property:"flagged",local:v?"flagged":"not flagged",imported:w?"flagged":"not flagged"}):w!==void 0&&w!==v&&z(n,s,{flagged:w});let y=Array.isArray(i.ignoredReports)?i.ignoredReports:[];if(!_e(n.get(s)))for(let k of y)typeof k=="string"&&he(n,s,k,!0)}if(o.length>0&&t){let s=await t(o,r??new Map);s&&Fk(o,s)}await pe()}function Fk(e,t){for(let r of e){let n=`${r.id}:${r.property}`;t[n]==="imported"&&Bk(r.id,r.property)===r.local&&(r.property==="color"?z(a.triage,r.id,{color:r.imported}):r.property==="comment"?z(a.triage,r.id,{comment:r.imported}):r.property==="fix"?z(a.triage,r.id,{fix:r.imported}):r.property==="triage"?z(a.triage,r.id,{triage:r.imported,ignoredReports:void 0}):r.property==="flagged"&&z(a.triage,r.id,{flagged:r.imported==="flagged"?!0:r.imported==="not flagged"?!1:void 0}))}}function Bk(e,t){if(t==="color")return a.triage.get(e)?.color;if(t==="triage")return _e(a.triage.get(e))??null;if(t==="comment")return a.triage.get(e)?.comment??"";if(t==="fix")return a.triage.get(e)?.fix??"";if(t==="flagged"){let r=a.triage.get(e)?.flagged;return r===!0?"flagged":r===!1?"not flagged":""}}async function Lk(e){if(Array.isArray(e))for(let t of e){let r;try{r=Uint8Array.fromBase64(t.data)}catch(n){console.warn(`Workspace import: failed to decode bundle ${t.integrity}: ${n?.message??n}`);continue}try{let n=await Yr(t.name,r);n?.integrity!==t.integrity&&console.warn(`Workspace import: bundle ${t.name} integrity mismatch (claimed ${t.integrity}, computed ${n?.integrity})`)}catch(n){console.warn(`Workspace import: failed to save bundle ${t.name}: ${n?.message??n}`)}}}async function dd(e,{conflictResolver:t}={}){let r=[];for(let u of e.reports)if(!(typeof u?.name!="string"||typeof u?.content!="string"))try{await dt(u.name,u.content);let{count:p,source:f}=Ge(u.content);rt(u.name,p,f??Wo(u.name)),r.push(u.name)}catch(p){console.warn(`Workspace import: failed to save ${u.name}: ${p.message}`)}Array.isArray(e.bundleBlobs)&&e.bundleBlobs.length>0&&await Lk(e.bundleBlobs);let o=e.triage&&Object.keys(e.triage).length>0?await Rk(e.reports):new Map;await Mk(e.triage,t,o);let s=Array.isArray(e.bundles),i=s?e.bundles.filter(u=>typeof u=="string"&&u.length>0):[],l=await $h({id:e.workspace.id,name:e.workspace.name,privateKey:e.workspace.privateKey,reports:r,bundles:s?i:void 0,preserveBundles:!s,createdAt:e.workspace.createdAt}),c=new Set(r);if(e.repoUrls&&typeof e.repoUrls=="object")for(let[u,p]of Object.entries(e.repoUrls))!c.has(u)||typeof p!="string"||!p||et(u)||(tt(u,p),a.currentFile===u&&(a.repoUrl=p));return l}async function ud({id:e,name:t,privateKeyBase64:r,password:n}){if(typeof e!="string"||!e)throw new TypeError("encodeShareLink: id required");if(typeof t!="string"||!t)throw new TypeError("encodeShareLink: name required");if(typeof r!="string"||!r)throw new TypeError("encodeShareLink: privateKey required");if(typeof n!="string"||!n)throw new TypeError("encodeShareLink: password required");let s=await Ko(r)===e?{v:1,n:t,k:r}:{v:1,i:e,n:t,k:r};return(await Zi(te(JSON.stringify(s)),n)).toBase64({alphabet:"base64url",omitPadding:!0})}async function pd({encoded:e,password:t}){if(typeof e!="string"||!e)throw new Error("malformed share link");if(typeof t!="string"||!t)throw new TypeError("decodeShareLink: password required");let r;try{r=Uint8Array.fromBase64(e,{alphabet:"base64url"})}catch{throw new Error("malformed share link")}let n=await ea(r,t,{malformedMsg:"malformed share link",wrongPasswordMsg:"wrong password or corrupt link"});try{return await Ok(n)}catch(o){throw new Error("wrong password or corrupt link",{cause:o})}}async function Ok(e){let t=JSON.parse(xe(e));if(!t||typeof t!="object"||typeof t.n!="string"||typeof t.k!="string"||!t.n||!t.k)throw new Error("shape");if(t.i!==void 0&&(typeof t.i!="string"||!t.i))throw new Error("shape");if(typeof t.i=="string"&&t.i.length>256)throw new Error("shape");if(t.n.length>1024)throw new Error("shape");if(Uint8Array.fromBase64(t.k).length!==32)throw new Error("shape");return{id:typeof t.i=="string"?t.i:await Ko(t.k),name:t.n,privateKeyBase64:t.k}}function fd(e){return typeof location>"u"?`#share=${e}`:`${location.origin}${location.pathname}#share=${e}`}function hd(e){let t=typeof e=="string"?e:typeof location>"u"?"":location.hash;if(!t)return null;let r=t.replace(/^#/u,"");if(!r)return null;for(let n of r.split("&")){let o=n.indexOf("=");if(o<0||n.slice(0,o)!=="share")continue;return n.slice(o+1)||null}return null}var Pk={get state(){return a},listWorkspaces:W,addReportToWorkspace:Kt,addBundleToWorkspace:rn,onReportMembershipChanged:Ec,onBundleMembershipChanged:Ac,onWorkspaceDeleted:Sc,onWorkspacePrivateKeyChanged:Cc,analyzeContent:Ge,setCount:rt,gunzipBytes:Ct,listBundles:vt,listFiles:ie,readBundle:jt,readFileBytes:Gr,saveBundle:Yr,saveFileBytes:Ro,saveTriage:pe,getSecureItem:Ae,setSecureItem:Fe,removeSecureItem:Sn,onSecureStorageHydrated:_n};function qh(e){e.installSyncHost(Pk),Ch(()=>e.triageSync.notify())}var K=null,rs=null;function Xh(){try{return Ae("deepview.sync.userEnabled")!=="0"}catch{return!0}}var Qh=!1;function Zh(e){Qh=!!e}function gd(){if(Qh)return!0;try{return Wt()?.mode==="managed"}catch{return!1}}function md(){return rs||(gd()&&!K?Promise.resolve(null):(rs=(async()=>{let e="./client-sync.js";try{let t=await import(e);return qh(t),K=t,Nk(),t}catch(t){throw rs=null,t}})(),rs))}function eg(){return md()}var tg=[];function ns(e){K?e(K):tg.push(e)}function Nk(){let e=tg.splice(0);for(let t of e)try{t(K)}catch(r){console.warn("client-sync: deferred apply failed:",r)}}function nn(e,t){let r={cancelled:!1,unsub:null};return ns(n=>{r.cancelled||(r.unsub=t(n,e))}),()=>{r.cancelled=!0,r.unsub&&r.unsub()}}function bd(e,t){return K?K.isInRemote(e,t):!1}function rg(e,t){return K?K.isBundleInRemote(e,t):!1}var Dk="deepview.objstore-presence.";function ng(e){try{let t=localStorage.getItem(Dk+e);if(!t)return null;let r=JSON.parse(t);return r&&typeof r=="object"?r:null}catch{return null}}function Un(e,t){if(K&&K.isInRemote(e,t))return!0;let r=ng(e);if(!r||typeof r.names!="object")return!1;for(let n of Object.values(r.names))if(n===t)return!0;return!1}function yd(e,t){if(K&&K.isBundleInRemote(e,t))return!0;let r=ng(e);if(!r||typeof r.bundles!="object")return!1;for(let n of Object.values(r.bundles))if(n===t)return!0;return!1}function og(e){return K?K.remoteCount(e):0}function sg(e){return nn(e,(t,r)=>t.onAutoDownloaded(r))}function ig(e){return nn(e,(t,r)=>t.onBundleAutoDownloaded(r))}function ag(e){return nn(e,(t,r)=>t.onChange(r))}var Gh=null,Yh=null,Jh=null,na=[];function lg(e){if(K){K.setRedraw(e);return}Gh=e,ns(t=>{Gh===e&&t.setRedraw(e)})}function cg(e){if(K){K.setAuthenticationResolver(e);return}Yh=e,ns(t=>{Yh===e&&t.setAuthenticationResolver(e)})}function dg(e){if(K){K.setHydrationConflictResolver(e);return}Jh=e,ns(t=>{Jh===e&&t.setHydrationConflictResolver(e)})}async function Jt(e,t){if(!gd()&&!(!Xh()&&!K))return(await md())[e](...t)}function ug(...e){return Jt("fetchFile",e)}function pg(...e){return Jt("fetchBundleFromRemote",e)}function oa(...e){return Jt("putFile",e)}function fg(...e){return Jt("putBundleToRemote",e)}function sa(...e){return Jt("deleteFromRemote",e)}function ia(...e){return Jt("deleteBundleFromRemote",e)}function os(...e){return Jt("openWorkspace",e)}function ss(...e){return Jt("closeWorkspace",e)}function hg(...e){return Jt("recheckRemoteStorage",e)}function Yt(e,t){if(K)return K.triageSync[e](...t);ns(r=>{r.triageSync[e](...t)})}var N={get status(){return K?K.triageSync.status:"off"},get openSessions(){return K?K.triageSync.openSessions:[]},get persistenceDegraded(){return K?K.triageSync.persistenceDegraded:!1},get proxyAuthRequired(){return K?K.triageSync.proxyAuthRequired:!1},setEnabled(e){if(e===!0)return gd()?Promise.resolve(null):md().then(t=>{t.triageSync.setEnabled(!0);let r=na;na=[];for(let n of r)try{t.openWorkspace(n)}catch(o){console.warn(`client-sync: openWorkspace(${n}) failed during re-enable:`,o)}return null}).catch(t=>(console.warn("client-sync: setEnabled load failed:",t),null));if(K){na=K.openWorkspaceIds();for(let t of na)try{K.closeWorkspace(t)}catch(r){console.warn(`client-sync: closeWorkspace(${t}) failed during disable:`,r)}K.triageSync.setEnabled(!1);return}Yt("setEnabled",[e])},isEnabled(){return K?K.triageSync.isEnabled():Xh()},openSession(e){Yt("openSession",[e])},closeSession(e){Yt("closeSession",[e])},refreshSession(e){Yt("refreshSession",[e])},dismissError(e){Yt("dismissError",[e])},setForcedOff(e){Yt("setForcedOff",[e])},setProtocolLocked(e){Yt("setProtocolLocked",[e])},setServerUrl(e){Yt("setServerUrl",[e])},getServerUrl(){return K?K.triageSync.getServerUrl():null},notify(){Yt("notify",[])},onStatusChange(e){return nn(e,(t,r)=>t.triageSync.onStatusChange(r))},onServerInfo(e){return nn(e,(t,r)=>t.triageSync.onServerInfo(r))},onPersistenceDegraded(e){return nn(e,(t,r)=>t.triageSync.onPersistenceDegraded(r))},onProxyAuthRequired(e){return nn(e,(t,r)=>t.triageSync.onProxyAuthRequired(r))}};var is=class extends at{constructor(t){if(super(t),this.it=g,t.type!==He.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===g||t==null)return this._t=void 0,this.it=t;if(t===be)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let r=[t];return r.raw=r,this._t={_$litType$:this.constructor.resultType,strings:r,values:[]}}};is.directiveName="unsafeHTML",is.resultType=1;var ye=_t(is);var as=null;function ls(){return as||(as=(async()=>{let e="./client-managed.js";try{return await import(e)}catch(t){throw as=null,t}})(),as)}async function gg(){return(await ls()).probeSession()}async function mg(){return(await ls()).probeTeams()}async function bg(e){return(await ls()).fetchReport(e)}async function yg(e){return(await ls()).login(e)}async function vg(e){return(await ls()).logout(e)}var cs=null;function ds(){return cs||(cs=(async()=>{let e="./client-admin.js";try{return await import(e)}catch(t){throw cs=null,t}})(),cs)}function wg(){return ds()}function kg(){return ds()}function $g(){return ds()}function xg(){return ds()}function _g(){return ds()}var Sg=`*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:host{width:260px;flex-shrink:0;height:100%;background:var(--surface);backdrop-filter:var(--glass-blur);border-right:1px solid var(--border);display:flex;flex-direction:column;transition:width .15s ease-out;overflow:hidden}:host(.collapsed){width:32px}:host(.empty){display:none}:host(.collapsed) .brand,:host(.collapsed) .sidebar-search,:host(.collapsed) #encryption-toggle,:host(.collapsed) #file-list{display:none}:host(.collapsed) .sidebar-header{padding:.5rem 0;justify-content:center}:host(.collapsed) .sidebar-actions{padding:.35rem 0;justify-content:center}:host(.collapsed) sidebar-delete-current,:host(.collapsed) #storage-status,:host(.collapsed) #sync-status .sync-label{display:none}:host(.collapsed) #sync-status{padding:.25rem;border:0}:host([data-mode="managed"]) #sidebar-toggle{display:none}.sidebar-header{display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem .4rem;.brand{flex:1;min-width:0;display:flex;align-items:baseline;gap:.4rem;font-size:.95rem;font-weight:700;letter-spacing:-.01em;white-space:nowrap;overflow:hidden;user-select:none}.brand-button{background:transparent;border:0;padding:0;margin:0;font:inherit;color:inherit;border-radius:4px;&:focus-visible{outline:2px solid var(--accent);outline-offset:2px}}.brand-tag{font-size:.65rem;font-weight:500;color:var(--muted);text-transform:lowercase;letter-spacing:.02em}}@media(display-mode:window-controls-overlay){.sidebar-header{min-height:env(titlebar-area-height,0px);padding-left:max(.75rem,env(titlebar-area-x,0px));-webkit-app-region:drag;app-region:drag;.brand-button,#encryption-toggle{-webkit-app-region:no-drag;app-region:no-drag}#sidebar-toggle{display:none}}}#sidebar-toggle{flex-shrink:0;width:22px;height:22px;display:grid;place-items:center;background:transparent;color:var(--muted);border:0;border-radius:4px;padding:0;&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}}#encryption-toggle{flex-shrink:0;width:22px;height:22px;display:grid;place-items:center;background:transparent;color:var(--muted);border:0;border-radius:4px;padding:0;&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&.encrypted{color:var(--accent)}&.locked-pending{color:light-dark(#b25b00,#f0a060);outline:1px dashed currentcolor;outline-offset:-2px}}.sidebar-search{display:flex;align-items:center;margin:0 .55rem .25rem;padding:0 .25rem 0 .55rem;background:rgb(from var(--text) r g b / .04);border:1px solid var(--border);border-radius:5px;transition:background .12s,border-color .12s;-webkit-app-region:no-drag;app-region:no-drag;&:has(input:focus){border-color:var(--accent);background:rgb(from var(--text) r g b / .06)}.sidebar-search-icon{flex-shrink:0;color:var(--muted);pointer-events:none;margin-right:.4rem}& input{flex:1;min-width:0;padding:.3rem 0;background:transparent;color:var(--text);border:0;outline:none;font:inherit;font-size:.78rem;&::placeholder{color:var(--muted)}&:focus::placeholder{color:transparent}&::-webkit-search-cancel-button{display:none}}}sidebar-view-button{display:contents}.sidebar-view-btn{position:relative;flex-shrink:0;width:20px;height:20px;display:grid;place-items:center;background:transparent;color:var(--muted);border:0;border-radius:3px;padding:0;margin-left:2px;transition:background .12s,color .12s;sidebar-view-button+sidebar-view-button>&{margin-left:.4rem}sidebar-view-button:last-of-type>&{margin-right:.1rem}& svg{width:14px;height:14px}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .08)}&.active{color:var(--accent);background:rgb(from var(--text) r g b / .1)}.view-btn-count{position:absolute;top:-4px;right:-4px;background:var(--bg);color:var(--muted);font-size:8.5px;font-weight:600;border-radius:999px;padding:0 3px;min-width:11px;text-align:center;line-height:11px;font-variant-numeric:tabular-nums;pointer-events:none}&.active .view-btn-count{color:var(--accent)}}#file-list{list-style:none;flex:1;overflow-y:auto;overscroll-behavior:none;scrollbar-gutter:stable;-webkit-app-region:no-drag;app-region:no-drag;padding:0 .35rem .25rem 0;margin:0;scrollbar-width:thin;scrollbar-color:var(--border) transparent;&::-webkit-scrollbar{width:5px}&::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}}.file-group-header{display:flex;align-items:center;justify-content:space-between;padding:.45rem .35rem .2rem .55rem;font-size:.62rem;font-weight:700;text-transform:uppercase;letter-spacing:.12em;color:var(--muted);user-select:none;&:first-child{padding-top:.25rem}.group-count{font-weight:500;letter-spacing:.04em;color:var(--muted);font-size:.7rem}}.file-group-header.workspace-header .workspace-header-actions{display:flex;align-items:center;gap:.35rem}.workspace-add{width:18px;height:18px;display:grid;place-items:center;background:transparent;color:var(--muted);border:1px solid transparent;border-radius:4px;padding:0;&:hover{color:var(--text);border-color:var(--accent)}}.file-item.workspace-item{display:flex;align-items:stretch;gap:.15rem}.file-item.workspace-item button.file-name{flex:1;min-width:0}.file-item.workspace-item .workspace-count{align-self:center;margin-right:.35rem}.workspace-share,.workspace-export,.workspace-leave{flex-shrink:0;width:22px;align-self:center;height:22px;display:none;place-items:center;background:transparent;color:var(--muted);border:1px solid transparent;border-radius:4px;padding:0;&:hover:not(:disabled){color:var(--text);background:rgb(from var(--text) r g b / .06);border-color:var(--accent)}}.workspace-leave:hover:not(:disabled){color:var(--critical, #f87171);border-color:var(--critical, #f87171)}@media(hover:hover){.file-item.workspace-item:hover .workspace-share,.file-item.workspace-item:hover .workspace-export,.file-item.workspace-item:hover .workspace-leave{display:grid}}.workspace-rename-input{width:100%;box-sizing:border-box;background:var(--surface);color:var(--text);border:1px solid var(--accent);border-radius:3px;padding:0 .25rem;margin:-1px 0;font:inherit;font-size:.76rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;outline:none}.file-item.team-item .team-name{display:flex;align-items:center;gap:.5rem;padding:.2rem .3rem .2rem .55rem;color:var(--text);font-size:.78rem}.file-item.team-item .team-icon{flex-shrink:0;color:var(--muted)}.file-item.team-item .team-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-item{list-style:none;position:relative;&.hidden{display:none}}.file-item.current:after{content:"";position:absolute;left:0;top:50%;transform:translateY(-50%);width:3px;height:18px;background:var(--accent);border-radius:0 2px 2px 0;pointer-events:none}.file-item button.file-name{display:flex;align-items:center;gap:.5rem;width:100%;box-sizing:border-box;padding:.2rem .3rem .2rem .55rem;background:transparent;color:var(--text);border:1px solid transparent;border-radius:0 5px 5px 0;font-family:inherit;font-size:.78rem;text-align:left;&:hover{background:rgb(from var(--text) r g b / .04)}.file-icon{flex-shrink:0;color:var(--muted)}.file-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.76rem;line-height:14.5px}}.file-item .file-count{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;color:var(--muted);opacity:.65;font-size:.68rem;font-weight:500;font-variant-numeric:tabular-nums}.workspace-count-missing{margin-left:2px;opacity:.55;font-style:italic}.file-item.current button.file-name{background:rgb(from var(--text) r g b / .05);border-color:var(--border);.file-icon,.file-count{color:var(--text)}}.file-item.indented button.file-name{padding-left:1.3rem}.file-item.indented:before{content:"";position:absolute;left:.85rem;top:0;bottom:0;width:1px;background:var(--border)}.file-item.bundle-missing>.file-name,.file-item.report-missing>.file-name{display:flex;align-items:center;gap:.5rem;padding:.2rem .3rem .2rem 1.4rem;color:var(--muted);font-size:.78rem;font-style:italic;cursor:help;.file-icon{flex-shrink:0;color:var(--muted);font-style:normal}.file-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.76rem;line-height:14.5px}}:host-context(body.theme-pink) .workspace-rename-input,:host-context(body.theme-pink) .file-item button.file-name .file-label,:host-context(body.theme-pink) .file-item.bundle-missing .file-label,:host-context(body.theme-pink) .file-item.report-missing .file-label{font-family:inherit}.file-item.dragging button.file-name{opacity:.4}.file-item.workspace-item.drag-over button.file-name,.file-item.indented.drag-over button.file-name{background:rgb(from var(--accent) r g b / .12);border-color:var(--accent)}.file-group-header.drag-over{background:rgb(from var(--accent) r g b / .12);border-radius:4px}.sidebar-actions{padding:.35rem .55rem .45rem;border-top:1px solid var(--border);display:flex;gap:.35rem;align-items:center;justify-content:space-between;& button{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:4px;padding:.2rem .5rem;font-size:.72rem;font-family:inherit;-webkit-app-region:no-drag;app-region:no-drag;&:hover{color:var(--text);border-color:var(--accent)}&.danger:hover{color:var(--critical);border-color:var(--critical)}&[disabled]{opacity:.4;border-color:var(--border)!important;color:var(--muted)!important}}}sidebar-delete-current{display:contents}sidebar-delete-current button{display:inline-flex;align-items:center;gap:.35rem;.trash-icon{flex-shrink:0}}#sync-status{display:inline-flex;align-items:center;gap:.35rem;border-color:transparent;&:hover{border-color:var(--accent)}.sync-dot{width:8px;height:8px;border-radius:50%;background:var(--muted);flex-shrink:0;box-shadow:0 0 0 1px rgb(from var(--text) r g b / .15)}&[data-status=online] .sync-dot{background:var(--green)}&[data-status=connecting] .sync-dot{background:var(--medium)}&[data-status=offline] .sync-dot{background:var(--critical)}}#sync-status[data-proxy-auth] .sync-dot{box-shadow:0 0 0 2px var(--accent)}#sync-status[data-degraded] .sync-dot{box-shadow:0 0 0 2px var(--medium)}#sync-status[hidden]{display:none}#storage-status{display:flex;align-items:center;gap:.4rem;margin:.3rem .55rem .45rem;padding:.3rem .55rem;background:rgb(from var(--medium) r g b / .12);border:1px solid rgb(from var(--medium) r g b / .3);border-radius:5px;color:light-dark(#b25b00,#f0a060);font-size:.72rem;font-family:inherit;cursor:pointer;text-align:left;-webkit-app-region:no-drag;app-region:no-drag;&:hover{background:rgb(from var(--medium) r g b / .18);border-color:rgb(from var(--medium) r g b / .5)}.storage-dot{width:7px;height:7px;border-radius:50%;background:var(--medium);flex-shrink:0}}#storage-status[hidden],#auth-status[hidden]{display:none}#auth-status{display:inline-flex;align-items:center}#auth-status[data-authed="1"]{padding:2px;border-color:transparent;border-radius:50%}#auth-status[data-authed="1"]:hover{border-color:var(--accent)}.user-avatar{position:relative;flex-shrink:0;width:22px;height:22px;border-radius:50%;overflow:hidden;background:var(--accent);display:inline-grid;place-items:center;user-select:none}.user-avatar-lg{width:38px;height:38px}.user-avatar-fallback{font-size:.72rem;font-weight:600;line-height:1;color:var(--bg);text-transform:uppercase}.user-avatar-lg .user-avatar-fallback{font-size:1.05rem}.user-avatar img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}.user-avatar img.broken{display:none}.user-menu[popover]{position:fixed;inset:auto;margin:0;min-width:11rem;flex-direction:column;gap:.1rem;background:var(--surface, var(--bg));border:1px solid var(--border);border-radius:6px;padding:.3rem;box-shadow:0 4px 14px #00000047}.user-menu[popover]:not(:popover-open){display:none}.user-menu[popover]:popover-open{display:flex}.user-card{display:flex;align-items:center;gap:.5rem;padding:.3rem .35rem .45rem;border-bottom:1px solid var(--border);margin-bottom:.2rem}.user-id{display:flex;flex-direction:column;min-width:0}.user-login{font-weight:600;font-size:.82rem;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.user-name{font-size:.74rem;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.user-menu-row{display:block;width:100%;text-align:left;background:transparent;border:0;border-radius:4px;padding:.4rem .5rem;font:inherit;font-size:.82rem;color:var(--text)}.user-menu-row:hover{background:rgb(from var(--text) r g b / .08)}.user-menu-group{display:flex;flex-direction:column;gap:.1rem;padding-bottom:.2rem;margin-bottom:.2rem;border-bottom:1px solid var(--border)}.user-menu-group-label{padding:.25rem .5rem .15rem;font-size:.62rem;font-weight:700;text-transform:uppercase;letter-spacing:.1em;color:var(--muted);user-select:none}
40
- `;var Cg=`.file-icon.brand-deepview{.bg{fill:#2563eb}.fg{fill:#fff}}.file-icon.brand-claude{.bg{fill:#d97757}.fg{fill:#fff}}.file-icon.brand-codex{.bg{fill:#fff;stroke:#000;stroke-width:.5}.fg{fill:#000}}.file-icon.brand-vercel{.bg{fill:#000;stroke:#fff;stroke-width:.5}.fg{fill:#fff}}.file-icon.brand-piolium{.bg{fill:#fbb829}.fg{fill:#1c1b19}}
41
- `;var Eg=`*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}dialog{margin-top:5rem;margin-inline:auto;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--text);padding:1.1rem 1.25rem 1rem;max-width:480px;width:min(94vw,480px);box-shadow:0 20px 60px #00000059;&::backdrop{background:rgb(from var(--theme-bar) r g b / .55);backdrop-filter:blur(2px)}}header h3{margin:0 0 .6rem;font-size:1rem;font-weight:600}.nwd-input{display:block;width:100%;box-sizing:border-box;padding:.5rem .65rem;border:1px solid var(--border);border-radius:6px;background:var(--bg, var(--surface));color:var(--text);font:inherit;font-size:.88rem;&: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)}}.nwd-note{margin:.55rem 0 0;color:var(--muted);font-size:.74rem;line-height:1.45}.nwd-intro{margin:0 0 .8rem;color:var(--muted);font-size:.82rem;line-height:1.5}.nwd-actions{display:flex;align-items:center;gap:.4rem;margin-top:.8rem;padding-top:.7rem;border-top:1px solid var(--border)}.nwd-spacer{flex:1}.nwd-actions button{background:transparent;border:1px solid var(--border);color:var(--text);border-radius:5px;padding:.35rem .9rem;font:inherit;font-size:.8rem;&:hover:not(:disabled){border-color:var(--accent);color:var(--accent)}&.primary{background:var(--accent);color:var(--surface);border-color:var(--accent);&:hover:not(:disabled){color:var(--surface);filter:brightness(1.08)}}&.danger{color:var(--critical, #f87171);border-color:var(--border);&:hover:not(:disabled){border-color:var(--critical, #f87171);color:var(--critical, #f87171)}}&:disabled{opacity:.5}}@media(display-mode:window-controls-overlay){dialog{-webkit-app-region:no-drag;app-region:no-drag}}
42
- `;var R=class extends Q{static styles=[B(Eg)];firstUpdated(){this.beforeOpen();let t=this.renderRoot.querySelector("dialog");if(t){try{t.showModal()}catch(r){this._settled=!0,this.dispatchEvent(new CustomEvent("modal-conflict",{detail:{cause:r}}));return}this.focusInitial()}}beforeOpen(){}focusInitial(){(this.renderRoot.querySelector("input, textarea")??this.renderRoot.querySelector("button.primary")??this.renderRoot.querySelector("button"))?.focus()}_finish(t){this._settled||(this._settled=!0,this.renderRoot.querySelector("dialog")?.close(),this.dispatchEvent(new CustomEvent("resolve",{detail:t})))}_onClose=()=>this._finish(null)};function ee(e,t={}){return new Promise(r=>{let n=document.createElement(e);Object.assign(n,t),n.addEventListener("resolve",o=>{n.remove(),r(o.detail)}),document.body.append(n)})}var ut=`dialog{max-width:520px;width:min(94vw,520px)}.wsl-field{display:block;margin-top:.6rem;color:var(--text);font-size:.78rem;>span{display:block;margin-bottom:.25rem;color:var(--muted);font-size:.72rem;text-transform:uppercase;letter-spacing:.04em}}.wsl-ack{display:flex;align-items:flex-start;gap:.5rem;margin-top:.6rem;color:var(--text);font-size:.8rem;line-height:1.4;>input[type=checkbox]{flex:0 0 auto;margin-top:.15rem}>span{flex:1 1 auto}}.wsl-link{display:block;width:100%;box-sizing:border-box;padding:.5rem .65rem;border:1px solid var(--border);border-radius:6px;background:var(--bg, var(--surface));color:var(--text);font:inherit;font-size:.78rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;resize:vertical;word-break:break-all}.wsl-error{margin:.55rem 0 0;color:var(--critical, #f87171);font-size:.74rem;line-height:1.4}.wsl-warning{padding:.55rem .65rem;border:1px solid var(--critical, #f87171);border-radius:6px;background:rgb(from var(--critical, #f87171) r g b / .08)}.wsl-optout{display:flex;align-items:center;gap:.5rem;margin-top:.7rem;color:var(--text);font-size:.78rem}.nwd-input:disabled{opacity:.5}
43
- `;var vd=class extends R{static styles=[...R.styles,B(ut)];static properties={_userName:{state:!0},_busy:{state:!0},_error:{state:!0},_phase:{state:!0},_success:{state:!0},_orphan:{state:!0},_orphanAck:{state:!0},_canCancel:{state:!0}};constructor(){super(),this._userName="",this._busy=!1,this._error="",this._phase="",this._success=!1,this._orphan=!1,this._orphanAck=!1,this._canCancel=!0,this._abortController=null}updated(t){if(t.has("_success")&&this._success){let r=this.renderRoot.querySelector("footer button.primary");r&&r.focus()}}beforeOpen(){typeof location<"u"&&(this._userName=location.hostname||"DeepView"),this._orphan=xo(),this._vaultStateUnsub=Te(()=>{if(this._settled)return;let t=xo();this._orphan&&!t&&se()?(this._error="Encryption was just enabled in another tab. Close this dialog and reload to unlock.",this._busy=!1,this._canCancel=!0):this._orphan!==t&&(this._orphan=t)})}async focusInitial(){await this.updateComplete;let t=this._orphan?'input[data-role="orphan-ack"]':'input[data-role="name"]';this.renderRoot.querySelector(t)?.focus()}disconnectedCallback(){if(super.disconnectedCallback(),this._vaultStateUnsub){try{this._vaultStateUnsub()}catch{}this._vaultStateUnsub=null}}_finish(t){if(!this._settled){if(this._abortController)try{this._abortController.abort()}catch{}super._finish(!!t)}}_onClose=()=>this._finish(this._success);_onCancel=()=>{this._busy&&!this._canCancel||this._finish(!1)};_onDialogCancel=t=>{if(this._busy&&!this._canCancel){t.preventDefault();return}this._finish(!1)};_onNameInput=t=>{this._userName=t.target.value};_onOrphanAckInput=t=>{this._orphanAck=t.target.checked};_onWipeOrphan=async()=>{if(!this._busy&&this._orphanAck){if(se()){this._error="Encryption was just enabled in another tab. Reload this page to unlock.";return}this._busy=!0,this._canCancel=!1,this._error="",this._phase="Clearing previous vault state\u2026";try{await Co({refuseIfEnabled:!0}),location.reload()}catch(t){this._error=`Could not clear previous vault state: ${t?.message??t}`,this._phase=""}finally{this._busy=!1,this._canCancel=!0}}};_onEnable=async()=>{if(!this._busy){if(!At()){this._error="Passkeys are not supported in this browser.";return}this._busy=!0,this._canCancel=!0,this._error="",this._phase="Registering passkey\u2026",this._abortController=new AbortController;try{await Il({userName:this._userName.trim()||"DeepView user",rpName:"DeepView",signal:this._abortController.signal,migrate:async({seal:r})=>{this._canCancel=!1,this._phase="Encrypting workspaces and metadata\u2026",await _l({seal:r}),this._phase="Encrypting triage data\u2026",await Qc({seal:r}),this._phase="Encrypting report files\u2026",await Wl({seal:r}),this._phase="Encrypting bundles\u2026",await ql({seal:r})}})&&(this._success=!0,this._phase="")}catch(t){t?.name==="AbortError"?this._error="":this._error=t?.message??String(t),this._phase=""}finally{this._busy=!1,this._canCancel=!0,this._abortController=null}}};_body(){if(this._orphan)return d`<p class="wsl-error">DeepView found an abandoned passkey setup on this device. The original passkey can no longer be accessed, so any local data still encrypted under it is <strong>unreadable</strong> and cannot be recovered.</p><p class="nwd-note">To enable encryption, DeepView will <strong>permanently delete ALL local DeepView data on this device</strong> — including any plaintext workspaces or reports you may have added after the previous passkey was lost — and then register a fresh passkey. This is irreversible. There is no backup.</p><label class="wsl-ack"><input type="checkbox" data-role="orphan-ack" .checked="${this._orphanAck}" ?disabled="${this._busy}" @change="${this._onOrphanAckInput}"> <span>I understand all local DeepView data on this device will be deleted.</span></label> ${this._phase?d`<p class="nwd-note">${this._phase}</p>`:g} ${this._error?d`<p class="wsl-error">${this._error}</p>`:g}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" ?disabled="${this._busy&&!this._canCancel}" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${this._busy||!this._orphanAck}" @click="${this._onWipeOrphan}">${this._busy?"Working\u2026":"Wipe and continue"}</button></footer>`;if(this._success)return d`<p class="nwd-note"><strong>Encryption is on.</strong> Your triage data and report files are now sealed under your passkey. You'll be asked to unlock with the passkey on every fresh load.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" class="primary" @click="${()=>this._finish(!0)}">Close</button></footer>`;let t=At();return d`<p class="nwd-note">Passkey encryption protects your local triage and report data with a hardware-backed key (TouchID, Windows Hello, security key). Without the passkey, the data on disk is unreadable — even to scripts running on this origin.</p><p class="wsl-error"><strong>If you lose access to this passkey, your data CANNOT be recovered.</strong> DeepView has no backup key, no recovery code, and no escrow. Make sure your passkey is backed up (iCloud Keychain / Google Password Manager sync, or a second registered device) before relying on encryption for important data.</p><p class="nwd-note"><strong>Opt-in.</strong> You can disable encryption later from the lock icon in the sidebar header — the data is rewritten as plaintext and DeepView signals your authenticator to remove the passkey (where supported).</p>${t?g:d`<p class="wsl-error">Your browser doesn't expose the WebAuthn passkey API. Try Chrome, Safari, Edge, or Firefox in a recent version on a device with a platform authenticator.</p>`} <label class="wsl-field"><span>Passkey label</span> <input type="text" class="nwd-input" data-role="name" placeholder="DeepView" maxlength="200" .value="${this._userName}" @input="${this._onNameInput}"></label> ${this._phase?d`<p class="nwd-note">${this._phase}</p>`:g} ${this._error?d`<p class="wsl-error">${this._error}</p>`:g}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" ?disabled="${this._busy&&!this._canCancel}" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!t||this._busy}" @click="${this._onEnable}">${this._busy?"Working\u2026":"Enable encryption"}</button></footer>`}render(){return d`<dialog @close="${this._onClose}" @cancel="${this._onDialogCancel}"><header><h3>${this._success?"Encryption enabled":this._orphan?"Previous passkey setup detected":"Enable passkey encryption"}</h3></header>${this._body()}</dialog>`}};customElements.define("passkey-setup-dialog",vd);function aa(){return ee("passkey-setup-dialog")}var wd=class extends R{static styles=[...R.styles,B(ut)];static properties={_busy:{state:!0},_error:{state:!0}};constructor(){super(),this._busy=!1,this._error="",this._abortController=null}_finish(t){if(!this._settled){if(this._abortController)try{this._abortController.abort()}catch{}super._finish(!!t)}}_onCancel=()=>this._finish(!1);_onUnlock=async()=>{if(!this._busy){this._busy=!0,this._error="",this._abortController=new AbortController;try{if(await So({signal:this._abortController.signal})){this._finish(!0);return}this._error=""}catch(t){this._error=t?.message??String(t)}finally{this._busy=!1,this._abortController=null}}};render(){return d`<dialog @close="${this._onClose}"><header><h3>Unlock your data</h3></header><p class="nwd-note">Your triage data and report files are encrypted with a passkey on this device. Unlock to load them.</p>${this._error?d`<p class="wsl-error">${this._error}</p>`:g}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">${this._busy?"Cancel":"Later"}</button> <button type="button" class="primary" ?disabled="${this._busy}" @click="${this._onUnlock}">${this._busy?"Waiting\u2026":"Unlock with passkey"}</button></footer></dialog>`}};customElements.define("passkey-unlock-dialog",wd);function la(){return ee("passkey-unlock-dialog")}var Ag=d`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="8" width="10" height="6" rx="1"/><path d="M5 8V5.5a3 3 0 0 1 6 0V8"/></svg>`,jk=d`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="8" width="10" height="6" rx="1"/><path d="M5 8V5a3 3 0 0 1 6 -0.5"/></svg>`,Ie=null;function kd(){if(!Ie)return;if(!At()){Ie.hidden=!0;return}let e=se();if(!e&&a.serverMode==="managed"){Ie.hidden=!0;return}Ie.hidden=!1;let t=yt();Ie.classList.toggle("encrypted",e&&t),Ie.classList.toggle("locked-pending",e&&!t),e&&t?(Ie.title="Encryption on \u2014 click to disable",Ie.setAttribute("aria-label","Disable encryption"),G(Ag,Ie)):e?(Ie.title="Encryption on, locked \u2014 click to unlock",Ie.setAttribute("aria-label","Unlock encrypted data"),G(Ag,Ie)):(Ie.title="Encryption off \u2014 click to enable",Ie.setAttribute("aria-label","Enable encryption"),G(jk,Ie))}async function Wk(){if(confirm(`Disable encryption?
38
+ `},Bc=new Map;function Oh(e,t){return`${e}\0${t}`}function zk(e){return typeof e=="string"&&Pk.test(e)}async function an(e,t){let r=Dk[e];if(!r||typeof t!="string"||!t)return null;let n=Oh(e,t),o=Bc.get(n);if(o!==void 0)return o;let s;try{let i=await crypto.subtle.digest("SHA-256",re(r+t));s=new Uint8Array(i).slice(0,Ok).toBase64({alphabet:"base64url",omitPadding:!0})}catch{return null}return Bc.set(n,s),s}function ea(e,t){return typeof t!="string"||!t?null:Bc.get(Oh(e,t))??null}function Uk(e,t){let r=[];for(let[n,o]of[["report",e],["workspace",t]]){if(o==null||o===""){r.push(Fc);continue}if(!zk(o))throw new TypeError(`encodeFindingRef: ${n} must be a link hint token, not a name`);r.push(o)}return r.every(n=>n===Fc)?null:r.join("")}function Hk(e){let t=[e.slice(0,Bh),e.slice(Bh)].map(r=>r===Fc?null:r);return{report:t[0],workspace:t[1]}}function Ph({id:e,report:t,workspace:r}={}){if(!sn(e))throw new TypeError("encodeFindingRef: a persistent finding id is required");let n=[`finding=${encodeURIComponent(e)}`],o=Uk(t,r);return o&&n.push(`v=${o}`),n.join("&")}function Lc(e){let t=Ph(e);return typeof location>"u"?`#${t}`:`${location.origin}${location.pathname}#${t}`}function ta(e){let t=typeof e=="string"?e:typeof location>"u"?"":location.hash;if(!t)return null;let r=t.replace(/^#/u,"");if(!r)return null;let n={id:null,report:null,workspace:null};for(let o of r.split("&")){let s=o.indexOf("=");if(s<0)continue;let i=o.slice(0,s),l=o.slice(s+1);if(!l)continue;if(i==="v"){if(!Nk.test(l))continue;Object.assign(n,Hk(l));continue}if(i!=="finding"||l.length>Lh*3)continue;let c;try{c=decodeURIComponent(l)}catch{continue}sn(c)&&(n.id=c)}return n.id?n:null}function Nh(e){if(typeof location>"u")return null;let t;try{t=new URL(e)}catch{return null}if(t.href!==e||t.protocol!==location.protocol||t.host!==location.host||t.username||t.password)return null;let r=ta(t.hash);return r?{id:r.id,fragment:Ph(r)}:null}var Vk=`deepview/workspace-id/v1
39
+ `;async function Xo(e){let t=Uint8Array.fromBase64(e),r=re(Vk),n=new Uint8Array(r.length+t.length);n.set(r,0),n.set(t,r.length);let o=new Uint8Array(await crypto.subtle.digest("SHA-256",n)),i=Array.from(o.subarray(0,16),u=>u.toString(16).padStart(2,"0")).join("").split("");i[12]="8";let l=parseInt(i[16],16)&3|8;i[16]=l.toString(16);let c=i.join("");return`${c.slice(0,8)}-${c.slice(8,12)}-${c.slice(12,16)}-${c.slice(16,20)}-${c.slice(20,32)}`}function Qo(e){let t=new Set;function r(o){return t.add(o),()=>t.delete(o)}function n(o){for(let s of t)try{s(o)}catch(i){console.warn(`workspace ${e} listener failed:`,i)}}return{on:r,fire:n}}var Dh=Qo("create"),zh=Qo("delete"),Uh=Qo("privateKey"),Hh=Qo("report-membership"),Vh=Qo("bundle-membership"),jk=Dh.on,Oc=zh.on,Pc=Uh.on,Nc=Hh.on,Dc=Vh.on,ra=Dh.fire,zc=zh.fire,Uc=Uh.fire,na=Hh.fire,oa=Vh.fire;var Vc="deepview.workspaces",Wk=1;function Zo(){try{let e=Ie(Vc);if(!e)return[];let t=JSON.parse(e);return t&&typeof t=="object"&&Array.isArray(t.workspaces)?t.workspaces:Array.isArray(t)?t:[]}catch{return[]}}async function Kk(e){await Le(Vc,JSON.stringify({version:Wk,workspaces:e}))}var qk=Vc;function jn(e){return navigator.locks.request(qk,async()=>{await mr();let t=Zo(),r=await e(t);if(r!==!1)return await Kk(t),r})}function es(e){return{id:e.id,privateKey:e.privateKey,reports:Array.isArray(e.reports)?[...e.reports]:[],bundles:Array.isArray(e.bundles)?[...e.bundles]:[]}}var _t=Zo().map(es);function jc(){_t=Zo().map(es)}function Wc(e){_t=_t.filter(t=>t.id!==e.id),_t.push(es(e))}function Gk(e,t){let r=Array.isArray(e[t])?[...e[t]]:[],n=_t.find(o=>o.id===e.id);if(n){n[t]=r;return}_t.push(es(e))}function Yk(e){_t=_t.filter(t=>t.id!==e)}function K(){let e=Zo();for(let t of e)Array.isArray(t.reports)||(t.reports=[]),Array.isArray(t.bundles)||(t.bundles=[]);return e}var Jk=200;function Pt(e){let t=(e??"").trim();return t&&t.replaceAll(/[\u0000-\u001F\u007F]/gu,"").slice(0,Jk)||null}async function Kc(e){let t=Pt(e);if(!t)return null;let r=new Uint8Array(32);crypto.getRandomValues(r);let n=r.toBase64(),o={id:await Xo(n),name:t,privateKey:n,reports:[],bundles:[],createdAt:Date.now()};return await jn(i=>i.some(l=>l.id===o.id)?!1:(i.push(o),o))?(Wc(o),o):null}async function qc(e){await jn(r=>{let n=r.findIndex(o=>o.id===e);return n<0?!1:(r.splice(n,1),!0)})&&(zc(e),Yk(e))}async function Gc(e,t){let r=Pt(t);return!(!r||!await jn(o=>{let s=o.find(i=>i.id===e);return!s||s.name===r?!1:(s.name=r,s)}))}async function jh(e){let t=await jn(o=>{let s=o.findIndex(p=>p.id===e.id),i=s>=0?o[s]:null,l=Pt(e.name)??i?.name??"Workspace",c=e.preserveBundles?Array.isArray(i?.bundles)?i.bundles:[]:Array.isArray(e.bundles)?e.bundles:[],u={id:e.id,name:l,privateKey:e.privateKey,reports:Array.isArray(e.reports)?[...new Set(e.reports)]:[],bundles:[...new Set(c)],createdAt:e.createdAt??Date.now()};return s>=0?o[s]=u:o.push(u),{previous:i,next:u}}),{next:r}=t,n=_t.find(o=>o.id===r.id)??null;return n==null?ra(r.id):(n.privateKey!==r.privateKey&&Uc(r.id),sa(n.reports,r.reports)||na(r.id),sa(n.bundles,r.bundles)||oa(r.id)),Wc(r),r}async function Yc({id:e,name:t,privateKey:r,createdAt:n}){let o=null;return await jn(s=>{let i=Pt(t);if(!i)return o={status:"name-collision",existing:null},!1;let l=s.find(p=>p.id===e)??null;if(l)return o={status:"already-attached",workspace:l},!1;let c=s.find(p=>Pt(p.name)===i)??null;if(c)return o={status:"name-collision",existing:c},!1;let u={id:e,name:i,privateKey:r,reports:[],bundles:[],createdAt:n??Date.now()};s.push(u),o={status:"attached",workspace:u}}),o?.status==="attached"&&(ra(o.workspace.id),Wc(o.workspace)),o}function sa(e,t){let r=new Set(e),n=new Set(t);if(r.size!==n.size)return!1;for(let o of r)if(!n.has(o))return!1;return!0}async function Hc({identifier:e,workspaceId:t,field:r,fire:n,additive:o=!1,from:s=void 0}){let i=await jn(u=>{if((u.find(g=>Array.isArray(g[r])&&g[r].includes(e))?.id??null)===(t??null))return!1;let f=null;if(t!=null&&(f=u.find(g=>g.id===t)??null,!f))return!1;let h=new Set;if(!o)for(let g of u)s!==void 0&&g.id!==s||(Array.isArray(g[r])||(g[r]=[]),g[r].includes(e)&&(g[r]=g[r].filter(w=>w!==e),h.add(g.id)));if(f&&(Array.isArray(f[r])||(f[r]=[]),f[r].includes(e)||(f[r].push(e),h.add(f.id))),h.size===0)return!1;let b=new Map;for(let g of h){let w=u.find(v=>v.id===g);w&&b.set(g,w)}return{affected:h,snapshot:b}});if(!i)return;let{affected:l,snapshot:c}=i;for(let u of l){n(u);let p=c.get(u);p&&Gk(p,r)}}function Wh(e,t){return{move:(r,n)=>Hc({identifier:r,workspaceId:n,field:e,fire:t}),add:(r,n)=>Hc({identifier:r,workspaceId:n,field:e,fire:t,additive:!0}),remove:(r,n)=>Hc({identifier:r,field:e,fire:t,from:n})}}var Jc=Wh("reports",na),Xc=Wh("bundles",oa),ts=Jc.move,Jt=Jc.add,rs=Jc.remove,Qc=Xc.move,ln=Xc.add,Zc=Xc.remove;function Xk(){let e=Zo().map(es),t=_t,r=new Map(t.map(o=>[o.id,o])),n=new Map(e.map(o=>[o.id,o]));for(let o of r.keys())n.has(o)||zc(o);for(let[o,s]of n){let i=r.get(o);if(!i){ra(o);continue}i.privateKey!==s.privateKey&&Uc(o),sa(i.reports,s.reports)||na(o),sa(i.bundles,s.bundles)||oa(o)}_t=e}Tn(()=>{Xk()});async function ed(e){if(!e)return null;let t=K(),n=(await Promise.all(t.map(o=>an("workspace",o.id)))).indexOf(e);return n===-1?null:t[n]}async function td(e){if(!e)return null;let t=await ce(),n=(await Promise.all(t.map(o=>an("report",o)))).indexOf(e);return n===-1?null:t[n]}async function Qk(e,t){let r;try{r=await Pe(e)}catch{return!1}if(r==null)return!1;let n=Ft(r);if(!Array.isArray(n?.findings))return!1;let o=Bt(n.findings);if(o.some(i=>i.id===t))return!0;let s=o.filter(i=>!i.id);return s.length===0?!1:(await xr(s),s.some(i=>i.id===t))}async function rd(e,{skip:t=[]}={}){if(!e)return null;let r=new Set(t),n=(await ce()).filter(o=>!r.has(o));for(let o of n)if(await Qk(o,e))return o;return null}function nd(e){return e?K().filter(t=>t.reports.includes(e)):[]}function od(e){if(!e)return"";for(let t of e.split(`
40
+ `))if(t.trim())return t.trim();return""}function sd(e){let t=new Set(e.map(n=>n.id)),r=new Map;for(let n of a.reports)for(let o of n.groups)for(let s of o){let i=s.id??String(s._id);if(!(!t.has(i)||r.has(i))&&(r.set(i,{severity:s.severity,file:s.file,line:s.line,description:od(s.description)}),r.size===t.size))return r}return r}function Kh(e){return e==="inprogress"||e==="fixed"||e==="invalid"||e==="deleted"?e:void 0}function Ae(e){if(e)return Kh(e.triage)??(e.deleted?"deleted":void 0)}function Zk(e){return e?!e.color&&!Ae(e)&&!e.comment&&!e.fix&&!(e.ignoredReports&&e.ignoredReports.length>0)&&e.flagged===void 0:!0}function Xt(e,t,r){let n=e.get(t)?.ignoredReports;return Array.isArray(n)&&n.includes(r)}function ns(e){if(!e||typeof e!="object")return;let t=e,r={};typeof t.color=="string"&&t.color&&(r.color=t.color);let n=Kh(t.triage)??(t.deleted?"deleted":void 0);if(n&&(r.triage=n),typeof t.comment=="string"&&t.comment&&(r.comment=t.comment),typeof t.fix=="string"&&t.fix&&(r.fix=t.fix),typeof t.flagged=="boolean"&&(r.flagged=t.flagged),Array.isArray(t.ignoredReports)){let o=t.ignoredReports.filter(s=>typeof s=="string"&&s.length>0);o.length>0&&(r.ignoredReports=o)}return Zk(r)?void 0:r}function e$(e,t){let r=e??[],n=t??[];if(r.length!==n.length)return!1;if(r.length===0)return!0;let o=new Set(r);for(let s of n)if(!o.has(s))return!1;return!0}function t$(e,t){let r=e??{},n=t??{};return(r.color??"")===(n.color??"")&&(Ae(r)??"")===(Ae(n)??"")&&(r.comment??"")===(n.comment??"")&&(r.fix??"")===(n.fix??"")&&r.flagged===n.flagged&&e$(r.ignoredReports,n.ignoredReports)}function U(e,t,r){let n=e.get(t),o=ns({...n,...r});return o===void 0?e.delete(t):t$(n,o)?!1:(e.set(t,o),!0)}function be(e,t,r,n){let o=new Set(e.get(t)?.ignoredReports??[]);return n?o.add(r):o.delete(r),U(e,t,{ignoredReports:o.size>0?[...o]:void 0})}var id=()=>{};function Gh(e){id=typeof e=="function"?e:()=>{}}var Yh=()=>{};function ad(e){Yh=typeof e=="function"?e:()=>{}}var Cr="deepview.triage",Qt="deepview.triage.pending",Nt=/^\d+$/u;async function r$(e){let t=new Blob([e]).stream().pipeThrough(new CompressionStream("deflate"));return new Uint8Array(await new Response(t).arrayBuffer())}async function n$(e){let t=new Blob([e]).stream().pipeThrough(new DecompressionStream("deflate"));return new Uint8Array(await new Response(t).arrayBuffer())}var o$="deepview.triage.save",qh=0;function ld(){let e={};for(let[t,r]of a.triage){if(Nt.test(t))continue;let n=ns(r);n&&(e[t]=n)}return e}function fe(){let e=++qh,t=ld(),r=Object.keys(t).length===0,n=r?null:JSON.stringify(t);if(n!=null)try{localStorage.setItem(Qt,n)}catch{}return navigator.locks.request(tt,{mode:"shared"},async()=>{let o=null,s=null;if(n!=null)try{let i=re(n),l=await r$(i);s=Oe(),o=(s?await oh(l):l).toBase64()}catch(i){console.warn("Failed to save triage:",i),id();return}await navigator.locks.request(o$,()=>{try{if(e!==qh)return;if(n!=null&&Oe()!==s){queueMicrotask(()=>{fe()});return}if(r)localStorage.removeItem(Cr),localStorage.removeItem(Qt);else{localStorage.setItem(Cr,o);try{localStorage.removeItem(Qt)}catch{}}}catch(i){console.warn("Failed to save triage:",i)}}),id()})}async function Jh(){let e=localStorage.getItem(Qt);if(e)try{return JSON.parse(e)}catch{}let t=localStorage.getItem(Cr);if(!t)return null;let r=Uint8Array.fromBase64(t);if(Ye(r)){if(!Oe())throw new Error("triage: vault locked, cannot decrypt envelope");r=await sh(r)}let n=await n$(r);return JSON.parse(Ee(n))}function Xh(e,{replace:t=!1}={}){let r=a.triage;if(t){let n=null,o=localStorage.getItem(Qt);if(o)try{n=JSON.parse(o)}catch{}let s=i=>n!=null&&i in n;for(let i of[...r.keys()]){if(Nt.test(i))continue;let l=e?.[i],c=!e||!(i in e);!(s(i)&&n[i]?.color)&&(c||!l?.color)&&U(r,i,{color:void 0}),!(s(i)&&(n[i]?.triage||n[i]?.deleted))&&!Ae(l)&&U(r,i,{triage:void 0}),!(s(i)&&n[i]?.comment)&&(c||typeof l?.comment!="string"||!l.comment)&&U(r,i,{comment:void 0}),!(s(i)&&n[i]?.fix)&&(c||typeof l?.fix!="string"||!l.fix)&&U(r,i,{fix:void 0}),!(s(i)&&n[i]?.flagged!==void 0)&&(c||l?.flagged===void 0)&&U(r,i,{flagged:void 0})}for(let i of[...r.keys()]){if(Nt.test(i))continue;let l=r.get(i)?.ignoredReports;if(!l||l.length===0)continue;let c=e?.[i],u=!!Ae(c);for(let p of[...l]){if(s(i)&&Array.isArray(n[i]?.ignoredReports)&&n[i].ignoredReports.includes(p))continue;if(u){be(r,i,p,!1);continue}let f=c?.ignoredReports;(!Array.isArray(f)||!f.includes(p))&&be(r,i,p,!1)}}}if(e)for(let[n,o]of Object.entries(e)){let s=Ae(o),i={};if(o&&o.color&&(i.color=o.color),s&&(i.triage=s),o&&typeof o.comment=="string"&&o.comment&&(i.comment=o.comment),o&&typeof o.fix=="string"&&o.fix&&(i.fix=o.fix),o&&typeof o.flagged=="boolean"&&(i.flagged=o.flagged),Object.keys(i).length>0&&U(r,n,i),!s&&o&&Array.isArray(o.ignoredReports)){let l=new Set(r.get(n)?.ignoredReports??[]),c=!1;for(let u of o.ignoredReports)typeof u=="string"&&!l.has(u)&&(l.add(u),c=!0);c&&U(r,n,{ignoredReports:[...l]})}}}async function s$(){try{let e=await Jh();Xh(e)}catch(e){console.warn("Failed to load triage:",e)}}async function Qh(){try{let e=await Jh();Xh(e,{replace:!0}),Yh()}catch(e){console.warn("Failed to reload triage:",e)}}typeof window<"u"&&window.addEventListener("storage",e=>{e.key!==Cr&&e.key!==Qt||Qh()});var os=s$();Me(()=>{Qh()});Me(()=>{Oe()&&localStorage.getItem(Qt)&&fe()});async function cd({seal:e}){try{localStorage.removeItem(Qt)}catch{}let t=localStorage.getItem(Cr);if(!t)return;let r=Uint8Array.fromBase64(t);if(Ye(r))return;let n=await e(r,To());localStorage.setItem(Cr,n.toBase64())}async function dd({open:e}){try{localStorage.removeItem(Qt)}catch{}let t=localStorage.getItem(Cr);if(!t)return;let r=Uint8Array.fromBase64(t);if(!Ye(r))return;let n=await e(r,To());localStorage.setItem(Cr,n.toBase64())}var Zh="deepview.lastFile",ss=null;function ud(){return ss||(ss=i$(),ss.catch(()=>{ss=null})),ss}async function i$(){try{await os}catch{}let e=await ce(),t=new Set(e),r=new Set(e),n=new Set;for(let o of e){if(!o.toLowerCase().endsWith(".deepseek"))continue;let s=o.slice(0,-9)+".md";if(t.has(s))continue;let i;try{i=await Pe(o),await ft(s,i),await Fn(o)}catch(p){console.warn(`migrate: failed to rename ${o} -> ${s}`,p);continue}t.delete(o),t.add(s),n.add(o);let l=Yo(o);if(Vn(o),l===void 0){let{count:p,source:f}=Je(i);ot(s,p,f)}else{let{source:p}=Je(i);ot(s,l,p)}let c=rt(o);c&&(nt(o,""),nt(s,c));let u=!1;for(let[p,f]of[...a.triage])f.ignoredReports?.includes(o)&&(be(a.triage,p,o,!1),be(a.triage,p,s,!0),u=!0);if(u&&await fe(),Ie(Zh)===o)try{await Le(Zh,s)}catch{}}for(let o of K())for(let s of o.reports){if(!s.toLowerCase().endsWith(".deepseek")||!n.has(s)&&r.has(s))continue;let i=s.slice(0,-9)+".md";await rs(s,o.id),await Jt(i,o.id)}}function em(){return typeof navigator<"u"&&typeof navigator.storage=="object"&&navigator.storage!==null}async function Wn(){if(!em()||typeof navigator.storage.persist!="function")return!1;try{return await navigator.storage.persist()===!0}catch{return!1}}async function pd(){let e={supported:em(),persisted:null,usage:null,quota:null};if(!e.supported)return e;if(typeof navigator.storage.persisted=="function")try{e.persisted=await navigator.storage.persisted()}catch{}if(typeof navigator.storage.estimate=="function")try{let t=await navigator.storage.estimate();typeof t?.usage=="number"&&(e.usage=t.usage),typeof t?.quota=="number"&&(e.quota=t.quota)}catch{}return e}var fd=1;function a$(){let e=ld(),t=Di();return{version:fd,exportedAt:new Date().toISOString(),triage:e,repoUrls:t}}function l$(){return`deepview-triage-${new Date().toISOString().replaceAll(/[:.]/gu,"-").slice(0,19)}.json.gz`}async function hd(){let e=a$();return{blob:new Blob([await vi(JSON.stringify(e))]),filename:l$()}}async function md(e){let t;try{t=await $o(new Uint8Array(await e.arrayBuffer()))}catch(n){throw new Error(`Failed to gunzip: ${n.message}`,{cause:n})}let r;try{r=JSON.parse(t)}catch(n){throw new Error(`Failed to parse JSON: ${n.message}`,{cause:n})}if(!r||typeof r!="object")throw new Error("Invalid backup file (not an object)");if(r.version!==fd)throw new Error(`Unsupported backup version: ${r.version} (expected ${fd})`);if(!r.triage||typeof r.triage!="object")throw new Error("Backup is missing the `triage` map");if(!r.repoUrls||typeof r.repoUrls!="object")throw new Error("Backup is missing the `repoUrls` map");return r}async function gd(e,t){if(!["replace","prefer-imported","prefer-current"].includes(t))throw new Error(`Unknown merge mode: ${t}`);if(!e||typeof e!="object")throw new Error("Invalid payload: not an object");if(!e.triage||typeof e.triage!="object"||Array.isArray(e.triage))throw new Error("Invalid payload: missing or non-object `triage`");if(!e.repoUrls||typeof e.repoUrls!="object"||Array.isArray(e.repoUrls))throw new Error("Invalid payload: missing or non-object `repoUrls`");let r=e.triage,n=a.triage;if(t==="replace")for(let l of[...n.keys()])Nt.test(l)||n.delete(l);let o=t==="prefer-current";for(let[l,c]of Object.entries(r)){if(Nt.test(l)||!c||typeof c!="object")continue;typeof c.color=="string"&&c.color&&(!o||!n.get(l)?.color)&&U(n,l,{color:c.color});let u=Ae(c);if(u&&(!o||!Ae(n.get(l)))&&U(n,l,{triage:u}),typeof c.comment=="string"&&c.comment&&(!o||!n.get(l)?.comment)&&U(n,l,{comment:c.comment}),typeof c.fix=="string"&&c.fix&&(!o||!n.get(l)?.fix)&&U(n,l,{fix:c.fix}),typeof c.flagged=="boolean"&&(!o||n.get(l)?.flagged===void 0)&&U(n,l,{flagged:c.flagged}),Array.isArray(c.ignoredReports)&&!Ae(n.get(l)))for(let p of c.ignoredReports)typeof p=="string"&&(o&&Xt(n,l,p)||be(n,l,p,!0))}await fe();let s=0,i=null;try{await bh(e.repoUrls,t),s=Object.keys(e.repoUrls).length}catch(l){console.warn("applyTriageImport: repo-URL import failed:",l),i=l}return{triageEntries:Object.keys(r).length,repoUrls:s,repoUrlError:i}}function c$(e){return e?.name==="NotFoundError"||typeof e?.message=="string"&&e.message.startsWith("File not found:")}async function bd(e){let t=new Set;for(let r of e){let n;try{n=await Pe(r)}catch(i){if(c$(i))continue;throw new Error(`Failed to read ${r}: ${i.message}`,{cause:i})}if(n==null)continue;let o=Ft(n);if(!Array.isArray(o?.findings))continue;let s=Bt(o.findings);await xr(s);for(let i of s)i.id&&t.add(i.id)}return t}function d$(){let e=new Set;for(let t of a.triage.keys())Nt.test(t)||e.add(t);return e}async function ia(e){let t=d$();if(t.size===0)return{orphanedCount:0,sharedCount:0};let r=await bd(e),n=new Set;for(let p of t)r.has(p)&&n.add(p);if(n.size===0)return{orphanedCount:0,sharedCount:0};let o=await ce(),s=new Set(e),i=o.filter(p=>!s.has(p)),l=await bd(i),c=0,u=0;for(let p of n)l.has(p)?u++:c++;return{orphanedCount:c,sharedCount:u}}async function aa(){let e=new Set(a.triage.keys()),t=[];for(let[i,l]of a.triage)if(l.ignoredReports)for(let c of l.ignoredReports)t.push({id:i,report:c});let r=await ce(),n=new Set(r),o=await bd(r),s=!1;for(let i of e){if(Nt.test(i)||o.has(i))continue;let l=a.triage.get(i);!l||!(l.color||Ae(l)||l.comment||l.fix||l.flagged!==void 0)||U(a.triage,i,{color:void 0,triage:void 0,comment:void 0,fix:void 0,flagged:void 0,deleted:void 0})&&(s=!0)}for(let{id:i,report:l}of t)Nt.test(i)||o.has(i)&&n.has(l)||Xt(a.triage,i,l)&&be(a.triage,i,l,!1)&&(s=!0);s&&await fe()}var yd=1,Ar=16,tm=12,rm=1+Ar+tm+16,Er=1+Ar+tm;async function nm(e,t){let r=await crypto.subtle.importKey("raw",re(e),"PBKDF2",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"PBKDF2",hash:"SHA-256",salt:t,iterations:3e6},r,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}function om(e){return!(e instanceof Uint8Array)||e.length<rm?!1:e[0]===yd}async function la(e,t){if(!(e instanceof Uint8Array))throw new TypeError("encryptWithPassword: plaintext Uint8Array required");if(typeof t!="string"||!t)throw new TypeError("encryptWithPassword: password required");let r=new Uint8Array(Er+e.length+16);r[0]=yd,crypto.getRandomValues(r.subarray(1,1+Ar)),crypto.getRandomValues(r.subarray(1+Ar,Er));let n=r.subarray(1,1+Ar),o=r.subarray(1+Ar,Er),s=await nm(t,n),i=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:o,additionalData:r.subarray(0,Er)},s,e));return r.set(i,Er),r}async function p$(e,t){if(typeof t!="string"||!t)throw new TypeError("tryDecryptWithPassword: password required");if(!(e instanceof Uint8Array)||e.length<rm)return{ok:!1,reason:"malformed"};if(e[0]!==yd)return{ok:!1,reason:"malformed"};let r=e.subarray(1,1+Ar),n=e.subarray(1+Ar,Er),o=e.subarray(Er),s=await nm(t,r),i;try{i=new Uint8Array(await crypto.subtle.decrypt({name:"AES-GCM",iv:n,additionalData:e.subarray(0,Er)},s,o))}catch{return{ok:!1,reason:"wrong-password"}}return{ok:!0,plaintext:i}}async function ca(e,t,r){if(!r||typeof r.malformedMsg!="string"||typeof r.wrongPasswordMsg!="string")throw new TypeError("decryptWithPasswordOrThrow: { malformedMsg, wrongPasswordMsg } strings required");let n=await p$(e,t);if(n.ok)return n.plaintext;throw n.reason==="wrong-password"?new Error(r.wrongPasswordMsg):new Error(r.malformedMsg)}var is=om,sm=la;function im(e,t){return ca(e,t,{malformedMsg:"malformed encrypted bundle",wrongPasswordMsg:"wrong password or corrupt bundle"})}var f$=1;async function h$(e){let t=new Set,r=Ft(e);if(!Array.isArray(r?.findings))return t;let n=Bt(r.findings);await xr(n);for(let o of n)o.id&&t.add(o.id);return t}function am(e){return(e??"").replaceAll(/[^a-zA-Z0-9._-]+/gu,"_").replaceAll(/^_+|_+$/gu,"")||"workspace"}async function m$(e){if(!Array.isArray(e)||e.length===0)return[];let t=await xt(),r=new Map(t.map(o=>[o.integrity,o.name])),n=[];for(let o of e){let s=r.get(o);if(!s)continue;let i;try{i=await Gt(o)}catch(l){console.warn(`Workspace export: failed to read bundle ${o}: ${l?.message??l}`);continue}n.push({integrity:o,name:s,data:i.toBase64()})}return n}async function g$(e,{includeBundleBytes:t=!1}={}){let r=[],n=new Set;for(let u of e.reports??[]){let p;try{p=await Pe(u)}catch(f){console.warn(`Workspace export: skipping ${u}: ${f?.message??f}`),(f instanceof DOMException&&f.name==="NotFoundError"||typeof f?.message=="string"&&f.message.startsWith("File not found:"))&&await ts(u,null);continue}r.push({name:u,content:p});for(let f of await h$(p))n.add(f)}let o=new Set(e.reports??[]),s={};for(let[u,p]of a.triage){if(!n.has(u))continue;let f=(p.ignoredReports??[]).filter(b=>o.has(b)),h=ns({...p,ignoredReports:f});h&&(s[u]=h)}let i={};for(let u of r){let p=rt(u.name);p&&(i[u.name]=p)}let l=(e.bundles??[]).filter(u=>typeof u=="string"&&u.length>0),c={version:f$,exportedAt:new Date().toISOString(),workspace:{id:e.id,name:e.name,privateKey:e.privateKey,createdAt:e.createdAt},reports:r,bundles:l,repoUrls:i,triage:s};if(t){let u=await m$(l);u.length>0&&(c.bundleBlobs=u)}return c}async function lm(e,{includeBundleBytes:t=!1}={}){let r=await g$(e,{includeBundleBytes:t});return{blob:new Blob([await vi(JSON.stringify(r))]),filename:`${am(e.name)}.deepview-workspace.json.gz`}}async function b$(e,t,{includeBundleBytes:r=!1}={}){if(typeof t!="string"||!t)throw new TypeError("buildWorkspaceExportEncrypted: password required");let{blob:n}=await lm(e,{includeBundleBytes:r}),o=new Uint8Array(await n.arrayBuffer()),s=await sm(o,t);return{blob:new Blob([s],{type:"application/octet-stream"}),filename:`${am(e.name)}.deepview-workspace.enc`}}async function vd(e,{password:t,includeBundleBytes:r=!1}={}){return typeof t=="string"&&t?await b$(e,t,{includeBundleBytes:r}):await lm(e,{includeBundleBytes:r})}var y$=1,cm=1024,dm=1024,da=200,hm=100*1024*1024,v$=Math.ceil(hm*4/3)+16,um=512,pm=64;function w$(e){if(!e||typeof e!="object")return"payload is not an object";if(e.version!==y$)return`unsupported export version: ${e.version}`;if(!e.workspace||typeof e.workspace!="object")return"workspace metadata missing";if(typeof e.workspace.id!="string")return"workspace.id must be a string";if(typeof e.workspace.name!="string")return"workspace.name must be a string";if(typeof e.workspace.privateKey!="string")return"workspace.privateKey must be a string";if(e.workspace.createdAt!==void 0&&!Number.isFinite(e.workspace.createdAt))return"workspace.createdAt must be a finite number or omitted";if(!Array.isArray(e.reports))return"reports field must be an array";if(e.reports.length>dm)return`reports count (${e.reports.length}) exceeds cap (${dm})`;if(e.bundles!==void 0){if(!Array.isArray(e.bundles))return"bundles field must be an array when present";if(e.bundles.length>cm)return`bundles count (${e.bundles.length}) exceeds cap (${cm})`;for(let t of e.bundles){if(typeof t!="string")return"bundles entries must be strings";if(t.length>da)return`bundle integrity exceeds per-entry length cap (${da})`}}if(e.bundleBlobs!==void 0){if(!Array.isArray(e.bundleBlobs))return"bundleBlobs field must be an array when present";if(e.bundleBlobs.length>pm)return`bundleBlobs count (${e.bundleBlobs.length}) exceeds cap (${pm})`;for(let t of e.bundleBlobs){if(!t||typeof t!="object"||Array.isArray(t))return"bundleBlobs entries must be objects";if(typeof t.integrity!="string"||t.integrity.length===0)return"bundleBlobs.integrity must be a non-empty string";if(t.integrity.length>da)return`bundleBlobs.integrity exceeds per-entry length cap (${da})`;if(typeof t.name!="string"||t.name.length===0)return"bundleBlobs.name must be a non-empty string";if(t.name.length>um)return`bundleBlobs.name exceeds per-entry length cap (${um})`;if(t.name.includes("\0"))return"bundleBlobs.name cannot contain NUL";if(typeof t.data!="string")return"bundleBlobs.data must be a base64 string";if(t.data.length>v$)return`bundleBlobs.data exceeds per-blob size cap (${hm} bytes raw)`}}return null}async function wd(e){return new Uint8Array(await e.arrayBuffer())}async function ua(e,t){if(is(e)){if(typeof t!="string"||!t)throw new TypeError("parseWorkspaceBundleBytes: password required for encrypted bundle");let n=await im(e,t);try{return fm(await $o(n))}catch(o){throw new Error("wrong password or corrupt bundle",{cause:o})}}let r;try{r=await $o(e)}catch(n){throw new Error(`gzip decompression failed: ${n.message}`,{cause:n})}return fm(r)}function fm(e){let t;try{t=JSON.parse(e)}catch(o){throw new Error(`payload is not JSON: ${o.message}`,{cause:o})}let r=w$(t);if(r===null)return t;let n=r.includes("exceeds cap");throw new Error(n?r:`not a deepview workspace export: ${r}`)}function k$(e){return Ae(e)??null}async function $$(e){let t=new Map;for(let r of e??[]){if(typeof r?.content!="string")continue;let n=Ft(r.content);if(!n?.findings)continue;let o=Bt(n.findings);await xr(o);for(let s of o)!s.id||t.has(s.id)||t.set(s.id,{severity:s.severity,file:s.file,line:s.line,description:od(s.description)})}return t}async function x$(e,t,r){if(!e||typeof e!="object"||Array.isArray(e))return;let n=a.triage,o=[];for(let[s,i]of Object.entries(e)){if(!i||typeof i!="object")continue;let l=n.get(s)?.color,c=typeof i.color=="string"?i.color:void 0;c&&l&&l!==c?o.push({id:s,property:"color",local:l,imported:c}):c&&c!==l&&U(n,s,{color:c});let u=n.get(s)?.comment??"",p=typeof i.comment=="string"?i.comment:"";p&&u&&u!==p?o.push({id:s,property:"comment",local:u,imported:p}):p&&p!==u&&U(n,s,{comment:p});let f=n.get(s)?.fix??"",h=typeof i.fix=="string"?i.fix:"";h&&f&&f!==h?o.push({id:s,property:"fix",local:f,imported:h}):h&&h!==f&&U(n,s,{fix:h});let b=k$(i),g=Ae(n.get(s))??null;b&&g&&g!==b?o.push({id:s,property:"triage",local:g,imported:b}):b&&!g&&U(n,s,{triage:b,ignoredReports:void 0});let w=n.get(s)?.flagged,v=typeof i.flagged=="boolean"?i.flagged:void 0;v!==void 0&&w!==void 0&&w!==v?o.push({id:s,property:"flagged",local:w?"flagged":"not flagged",imported:v?"flagged":"not flagged"}):v!==void 0&&v!==w&&U(n,s,{flagged:v});let y=Array.isArray(i.ignoredReports)?i.ignoredReports:[];if(!Ae(n.get(s)))for(let k of y)typeof k=="string"&&be(n,s,k,!0)}if(o.length>0&&t){let s=await t(o,r??new Map);s&&_$(o,s)}await fe()}function _$(e,t){for(let r of e){let n=`${r.id}:${r.property}`;t[n]==="imported"&&S$(r.id,r.property)===r.local&&(r.property==="color"?U(a.triage,r.id,{color:r.imported}):r.property==="comment"?U(a.triage,r.id,{comment:r.imported}):r.property==="fix"?U(a.triage,r.id,{fix:r.imported}):r.property==="triage"?U(a.triage,r.id,{triage:r.imported,ignoredReports:void 0}):r.property==="flagged"&&U(a.triage,r.id,{flagged:r.imported==="flagged"?!0:r.imported==="not flagged"?!1:void 0}))}}function S$(e,t){if(t==="color")return a.triage.get(e)?.color;if(t==="triage")return Ae(a.triage.get(e))??null;if(t==="comment")return a.triage.get(e)?.comment??"";if(t==="fix")return a.triage.get(e)?.fix??"";if(t==="flagged"){let r=a.triage.get(e)?.flagged;return r===!0?"flagged":r===!1?"not flagged":""}}async function C$(e){if(Array.isArray(e))for(let t of e){let r;try{r=Uint8Array.fromBase64(t.data)}catch(n){console.warn(`Workspace import: failed to decode bundle ${t.integrity}: ${n?.message??n}`);continue}try{let n=await Zr(t.name,r);n?.integrity!==t.integrity&&console.warn(`Workspace import: bundle ${t.name} integrity mismatch (claimed ${t.integrity}, computed ${n?.integrity})`)}catch(n){console.warn(`Workspace import: failed to save bundle ${t.name}: ${n?.message??n}`)}}}async function kd(e,{conflictResolver:t}={}){let r=[];for(let u of e.reports)if(!(typeof u?.name!="string"||typeof u?.content!="string"))try{await ft(u.name,u.content);let{count:p,source:f}=Je(u.content);ot(u.name,p,f??Jo(u.name)),r.push(u.name)}catch(p){console.warn(`Workspace import: failed to save ${u.name}: ${p.message}`)}Array.isArray(e.bundleBlobs)&&e.bundleBlobs.length>0&&await C$(e.bundleBlobs);let o=e.triage&&Object.keys(e.triage).length>0?await $$(e.reports):new Map;await x$(e.triage,t,o);let s=Array.isArray(e.bundles),i=s?e.bundles.filter(u=>typeof u=="string"&&u.length>0):[],l=await jh({id:e.workspace.id,name:e.workspace.name,privateKey:e.workspace.privateKey,reports:r,bundles:s?i:void 0,preserveBundles:!s,createdAt:e.workspace.createdAt}),c=new Set(r);if(e.repoUrls&&typeof e.repoUrls=="object")for(let[u,p]of Object.entries(e.repoUrls))!c.has(u)||typeof p!="string"||!p||rt(u)||(nt(u,p),a.currentFile===u&&(a.repoUrl=p));return l}async function $d({id:e,name:t,privateKeyBase64:r,password:n}){if(typeof e!="string"||!e)throw new TypeError("encodeShareLink: id required");if(typeof t!="string"||!t)throw new TypeError("encodeShareLink: name required");if(typeof r!="string"||!r)throw new TypeError("encodeShareLink: privateKey required");if(typeof n!="string"||!n)throw new TypeError("encodeShareLink: password required");let s=await Xo(r)===e?{v:1,n:t,k:r}:{v:1,i:e,n:t,k:r};return(await la(re(JSON.stringify(s)),n)).toBase64({alphabet:"base64url",omitPadding:!0})}async function xd({encoded:e,password:t}){if(typeof e!="string"||!e)throw new Error("malformed share link");if(typeof t!="string"||!t)throw new TypeError("decodeShareLink: password required");let r;try{r=Uint8Array.fromBase64(e,{alphabet:"base64url"})}catch{throw new Error("malformed share link")}let n=await ca(r,t,{malformedMsg:"malformed share link",wrongPasswordMsg:"wrong password or corrupt link"});try{return await E$(n)}catch(o){throw new Error("wrong password or corrupt link",{cause:o})}}async function E$(e){let t=JSON.parse(Ee(e));if(!t||typeof t!="object"||typeof t.n!="string"||typeof t.k!="string"||!t.n||!t.k)throw new Error("shape");if(t.i!==void 0&&(typeof t.i!="string"||!t.i))throw new Error("shape");if(typeof t.i=="string"&&t.i.length>256)throw new Error("shape");if(t.n.length>1024)throw new Error("shape");if(Uint8Array.fromBase64(t.k).length!==32)throw new Error("shape");return{id:typeof t.i=="string"?t.i:await Xo(t.k),name:t.n,privateKeyBase64:t.k}}function _d(e){return typeof location>"u"?`#share=${e}`:`${location.origin}${location.pathname}#share=${e}`}function Sd(e){let t=typeof e=="string"?e:typeof location>"u"?"":location.hash;if(!t)return null;let r=t.replace(/^#/u,"");if(!r)return null;for(let n of r.split("&")){let o=n.indexOf("=");if(o<0||n.slice(0,o)!=="share")continue;return n.slice(o+1)||null}return null}var A$={get state(){return a},listWorkspaces:K,addReportToWorkspace:Jt,addBundleToWorkspace:ln,onReportMembershipChanged:Nc,onBundleMembershipChanged:Dc,onWorkspaceDeleted:Oc,onWorkspacePrivateKeyChanged:Pc,analyzeContent:Je,setCount:ot,gunzipBytes:Rt,listBundles:xt,listFiles:ce,readBundle:Gt,readFileBytes:Qr,saveBundle:Zr,saveFileBytes:Oo,saveTriage:fe,getSecureItem:Ie,setSecureItem:Le,removeSecureItem:Rn,onSecureStorageHydrated:Tn};function mm(e){e.installSyncHost(A$),Gh(()=>e.triageSync.notify())}var q=null,as=null;function vm(){try{return Ie("deepview.sync.userEnabled")!=="0"}catch{return!0}}var wm=!1;function km(e){wm=!!e}function Cd(){if(wm)return!0;try{return Yt()?.mode==="managed"}catch{return!1}}function Ed(){return as||(Cd()&&!q?Promise.resolve(null):(as=(async()=>{let e="./client-sync.js";try{let t=await import(e);return mm(t),q=t,T$(),t}catch(t){throw as=null,t}})(),as))}function $m(){return Ed()}var xm=[];function ls(e){q?e(q):xm.push(e)}function T$(){let e=xm.splice(0);for(let t of e)try{t(q)}catch(r){console.warn("client-sync: deferred apply failed:",r)}}function cn(e,t){let r={cancelled:!1,unsub:null};return ls(n=>{r.cancelled||(r.unsub=t(n,e))}),()=>{r.cancelled=!0,r.unsub&&r.unsub()}}function Ad(e,t){return q?q.isInRemote(e,t):!1}function _m(e,t){return q?q.isBundleInRemote(e,t):!1}var R$="deepview.objstore-presence.";function Sm(e){try{let t=localStorage.getItem(R$+e);if(!t)return null;let r=JSON.parse(t);return r&&typeof r=="object"?r:null}catch{return null}}function Kn(e,t){if(q&&q.isInRemote(e,t))return!0;let r=Sm(e);if(!r||typeof r.names!="object")return!1;for(let n of Object.values(r.names))if(n===t)return!0;return!1}function Td(e,t){if(q&&q.isBundleInRemote(e,t))return!0;let r=Sm(e);if(!r||typeof r.bundles!="object")return!1;for(let n of Object.values(r.bundles))if(n===t)return!0;return!1}function Cm(e){return q?q.remoteCount(e):0}function Em(e){return cn(e,(t,r)=>t.onAutoDownloaded(r))}function Am(e){return cn(e,(t,r)=>t.onBundleAutoDownloaded(r))}function Tm(e){return cn(e,(t,r)=>t.onChange(r))}var gm=null,bm=null,ym=null,pa=[];function Rm(e){if(q){q.setRedraw(e);return}gm=e,ls(t=>{gm===e&&t.setRedraw(e)})}function Im(e){if(q){q.setAuthenticationResolver(e);return}bm=e,ls(t=>{bm===e&&t.setAuthenticationResolver(e)})}function Mm(e){if(q){q.setHydrationConflictResolver(e);return}ym=e,ls(t=>{ym===e&&t.setHydrationConflictResolver(e)})}async function er(e,t){if(!Cd()&&!(!vm()&&!q))return(await Ed())[e](...t)}function Fm(...e){return er("fetchFile",e)}function Bm(...e){return er("fetchBundleFromRemote",e)}function fa(...e){return er("putFile",e)}function Lm(...e){return er("putBundleToRemote",e)}function ha(...e){return er("deleteFromRemote",e)}function ma(...e){return er("deleteBundleFromRemote",e)}function cs(...e){return er("openWorkspace",e)}function ds(...e){return er("closeWorkspace",e)}function Om(...e){return er("recheckRemoteStorage",e)}function Zt(e,t){if(q)return q.triageSync[e](...t);ls(r=>{r.triageSync[e](...t)})}var N={get status(){return q?q.triageSync.status:"off"},get openSessions(){return q?q.triageSync.openSessions:[]},get persistenceDegraded(){return q?q.triageSync.persistenceDegraded:!1},get proxyAuthRequired(){return q?q.triageSync.proxyAuthRequired:!1},setEnabled(e){if(e===!0)return Cd()?Promise.resolve(null):Ed().then(t=>{t.triageSync.setEnabled(!0);let r=pa;pa=[];for(let n of r)try{t.openWorkspace(n)}catch(o){console.warn(`client-sync: openWorkspace(${n}) failed during re-enable:`,o)}return null}).catch(t=>(console.warn("client-sync: setEnabled load failed:",t),null));if(q){pa=q.openWorkspaceIds();for(let t of pa)try{q.closeWorkspace(t)}catch(r){console.warn(`client-sync: closeWorkspace(${t}) failed during disable:`,r)}q.triageSync.setEnabled(!1);return}Zt("setEnabled",[e])},isEnabled(){return q?q.triageSync.isEnabled():vm()},openSession(e){Zt("openSession",[e])},closeSession(e){Zt("closeSession",[e])},refreshSession(e){Zt("refreshSession",[e])},dismissError(e){Zt("dismissError",[e])},setForcedOff(e){Zt("setForcedOff",[e])},setProtocolLocked(e){Zt("setProtocolLocked",[e])},setServerUrl(e){Zt("setServerUrl",[e])},getServerUrl(){return q?q.triageSync.getServerUrl():null},notify(){Zt("notify",[])},onStatusChange(e){return cn(e,(t,r)=>t.triageSync.onStatusChange(r))},onServerInfo(e){return cn(e,(t,r)=>t.triageSync.onServerInfo(r))},onPersistenceDegraded(e){return cn(e,(t,r)=>t.triageSync.onPersistenceDegraded(r))},onProxyAuthRequired(e){return cn(e,(t,r)=>t.triageSync.onProxyAuthRequired(r))}};var us=class extends dt{constructor(t){if(super(t),this.it=m,t.type!==He.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===m||t==null)return this._t=void 0,this.it=t;if(t===ke)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let r=[t];return r.raw=r,this._t={_$litType$:this.constructor.resultType,strings:r,values:[]}}};us.directiveName="unsafeHTML",us.resultType=1;var ye=At(us);var ps=null;function fs(){return ps||(ps=(async()=>{let e="./client-managed.js";try{return await import(e)}catch(t){throw ps=null,t}})(),ps)}async function Pm(){return(await fs()).probeSession()}async function Nm(){return(await fs()).probeTeams()}async function Dm(e){return(await fs()).fetchReport(e)}async function zm(e){return(await fs()).login(e)}async function Um(e){return(await fs()).logout(e)}var hs=null;function ms(){return hs||(hs=(async()=>{let e="./client-admin.js";try{return await import(e)}catch(t){throw hs=null,t}})(),hs)}function Hm(){return ms()}function Vm(){return ms()}function jm(){return ms()}function Wm(){return ms()}function Km(){return ms()}var qm=`*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:host{width:260px;flex-shrink:0;height:100%;background:var(--surface);backdrop-filter:var(--glass-blur);border-right:1px solid var(--border);display:flex;flex-direction:column;transition:width .15s ease-out;overflow:hidden}:host(.collapsed){width:32px}:host(.empty){display:none}:host(.collapsed) .brand,:host(.collapsed) .sidebar-search,:host(.collapsed) #encryption-toggle,:host(.collapsed) #file-list{display:none}:host(.collapsed) .sidebar-header{padding:.5rem 0;justify-content:center}:host(.collapsed) .sidebar-actions{padding:.35rem 0;justify-content:center}:host(.collapsed) sidebar-delete-current,:host(.collapsed) #storage-status,:host(.collapsed) #sync-status .sync-label{display:none}:host(.collapsed) #sync-status{padding:.25rem;border:0}:host([data-mode="managed"]) #sidebar-toggle{display:none}.sidebar-header{display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem .4rem;.brand{flex:1;min-width:0;display:flex;align-items:baseline;gap:.4rem;font-size:.95rem;font-weight:700;letter-spacing:-.01em;white-space:nowrap;overflow:hidden;user-select:none}.brand-button{background:transparent;border:0;padding:0;margin:0;font:inherit;color:inherit;border-radius:4px;&:focus-visible{outline:2px solid var(--accent);outline-offset:2px}}.brand-tag{font-size:.65rem;font-weight:500;color:var(--muted);text-transform:lowercase;letter-spacing:.02em}}@media(display-mode:window-controls-overlay){.sidebar-header{min-height:env(titlebar-area-height,0px);padding-left:max(.75rem,env(titlebar-area-x,0px));-webkit-app-region:drag;app-region:drag;.brand-button,#encryption-toggle{-webkit-app-region:no-drag;app-region:no-drag}#sidebar-toggle{display:none}}}#sidebar-toggle{flex-shrink:0;width:22px;height:22px;display:grid;place-items:center;background:transparent;color:var(--muted);border:0;border-radius:4px;padding:0;&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}}#encryption-toggle{flex-shrink:0;width:22px;height:22px;display:grid;place-items:center;background:transparent;color:var(--muted);border:0;border-radius:4px;padding:0;&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&.encrypted{color:var(--accent)}&.locked-pending{color:light-dark(#b25b00,#f0a060);outline:1px dashed currentcolor;outline-offset:-2px}}.sidebar-search{display:flex;align-items:center;margin:0 .55rem .25rem;padding:0 .25rem 0 .55rem;background:rgb(from var(--text) r g b / .04);border:1px solid var(--border);border-radius:5px;transition:background .12s,border-color .12s;-webkit-app-region:no-drag;app-region:no-drag;&:has(input:focus){border-color:var(--accent);background:rgb(from var(--text) r g b / .06)}.sidebar-search-icon{flex-shrink:0;color:var(--muted);pointer-events:none;margin-right:.4rem}& input{flex:1;min-width:0;padding:.3rem 0;background:transparent;color:var(--text);border:0;outline:none;font:inherit;font-size:.78rem;&::placeholder{color:var(--muted)}&:focus::placeholder{color:transparent}&::-webkit-search-cancel-button{display:none}}}sidebar-view-button{display:contents}.sidebar-view-btn{position:relative;flex-shrink:0;width:20px;height:20px;display:grid;place-items:center;background:transparent;color:var(--muted);border:0;border-radius:3px;padding:0;margin-left:2px;transition:background .12s,color .12s;sidebar-view-button+sidebar-view-button>&{margin-left:.4rem}sidebar-view-button:last-of-type>&{margin-right:.1rem}& svg{width:14px;height:14px}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .08)}&.active{color:var(--accent);background:rgb(from var(--text) r g b / .1)}.view-btn-count{position:absolute;top:-4px;right:-4px;background:var(--bg);color:var(--muted);font-size:8.5px;font-weight:600;border-radius:999px;padding:0 3px;min-width:11px;text-align:center;line-height:11px;font-variant-numeric:tabular-nums;pointer-events:none}&.active .view-btn-count{color:var(--accent)}}#file-list{list-style:none;flex:1;overflow-y:auto;overscroll-behavior:none;scrollbar-gutter:stable;-webkit-app-region:no-drag;app-region:no-drag;padding:0 .35rem .25rem 0;margin:0;scrollbar-width:thin;scrollbar-color:var(--border) transparent;&::-webkit-scrollbar{width:5px}&::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}}.file-group-header{display:flex;align-items:center;justify-content:space-between;padding:.45rem .35rem .2rem .55rem;font-size:.62rem;font-weight:700;text-transform:uppercase;letter-spacing:.12em;color:var(--muted);user-select:none;&:first-child{padding-top:.25rem}.group-count{font-weight:500;letter-spacing:.04em;color:var(--muted);font-size:.7rem}}.file-group-header.workspace-header .workspace-header-actions{display:flex;align-items:center;gap:.35rem}.workspace-add{width:18px;height:18px;display:grid;place-items:center;background:transparent;color:var(--muted);border:1px solid transparent;border-radius:4px;padding:0;&:hover{color:var(--text);border-color:var(--accent)}}.file-item.workspace-item{display:flex;align-items:stretch;gap:.15rem}.file-item.workspace-item button.file-name{flex:1;min-width:0}.file-item.workspace-item .workspace-count{align-self:center;margin-right:.35rem}.workspace-share,.workspace-export,.workspace-leave{flex-shrink:0;width:22px;align-self:center;height:22px;display:none;place-items:center;background:transparent;color:var(--muted);border:1px solid transparent;border-radius:4px;padding:0;&:hover:not(:disabled){color:var(--text);background:rgb(from var(--text) r g b / .06);border-color:var(--accent)}}.workspace-leave:hover:not(:disabled){color:var(--critical, #f87171);border-color:var(--critical, #f87171)}@media(hover:hover){.file-item.workspace-item:hover .workspace-share,.file-item.workspace-item:hover .workspace-export,.file-item.workspace-item:hover .workspace-leave{display:grid}}.workspace-rename-input{width:100%;box-sizing:border-box;background:var(--surface);color:var(--text);border:1px solid var(--accent);border-radius:3px;padding:0 .25rem;margin:-1px 0;font:inherit;font-size:.76rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;outline:none}.file-item.team-item .team-name{display:flex;align-items:center;gap:.5rem;padding:.2rem .3rem .2rem .55rem;color:var(--text);font-size:.78rem}.file-item.team-item .team-icon{flex-shrink:0;color:var(--muted)}.file-item.team-item .team-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-item{list-style:none;position:relative;&.hidden{display:none}}.file-item.current:after{content:"";position:absolute;left:0;top:50%;transform:translateY(-50%);width:3px;height:18px;background:var(--accent);border-radius:0 2px 2px 0;pointer-events:none}.file-item button.file-name{display:flex;align-items:center;gap:.5rem;width:100%;box-sizing:border-box;padding:.2rem .3rem .2rem .55rem;background:transparent;color:var(--text);border:1px solid transparent;border-radius:0 5px 5px 0;font-family:inherit;font-size:.78rem;text-align:left;&:hover{background:rgb(from var(--text) r g b / .04)}.file-icon{flex-shrink:0;color:var(--muted)}.file-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.76rem;line-height:14.5px}}.file-item .file-count{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;color:var(--muted);opacity:.65;font-size:.68rem;font-weight:500;font-variant-numeric:tabular-nums}.workspace-count-missing{margin-left:2px;opacity:.55;font-style:italic}.file-item.current button.file-name{background:rgb(from var(--text) r g b / .05);border-color:var(--border);.file-icon,.file-count{color:var(--text)}}.file-item.indented button.file-name{padding-left:1.3rem}.file-item.indented:before{content:"";position:absolute;left:.85rem;top:0;bottom:0;width:1px;background:var(--border)}.file-item.bundle-missing>.file-name,.file-item.report-missing>.file-name{display:flex;align-items:center;gap:.5rem;padding:.2rem .3rem .2rem 1.4rem;color:var(--muted);font-size:.78rem;font-style:italic;cursor:help;.file-icon{flex-shrink:0;color:var(--muted);font-style:normal}.file-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.76rem;line-height:14.5px}}:host-context(body.theme-pink) .workspace-rename-input,:host-context(body.theme-pink) .file-item button.file-name .file-label,:host-context(body.theme-pink) .file-item.bundle-missing .file-label,:host-context(body.theme-pink) .file-item.report-missing .file-label{font-family:inherit}.file-item.dragging button.file-name{opacity:.4}.file-item.workspace-item.drag-over button.file-name,.file-item.indented.drag-over button.file-name{background:rgb(from var(--accent) r g b / .12);border-color:var(--accent)}.file-group-header.drag-over{background:rgb(from var(--accent) r g b / .12);border-radius:4px}.sidebar-actions{padding:.35rem .55rem .45rem;border-top:1px solid var(--border);display:flex;gap:.35rem;align-items:center;justify-content:space-between;& button{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:4px;padding:.2rem .5rem;font-size:.72rem;font-family:inherit;-webkit-app-region:no-drag;app-region:no-drag;&:hover{color:var(--text);border-color:var(--accent)}&.danger:hover{color:var(--critical);border-color:var(--critical)}&[disabled]{opacity:.4;border-color:var(--border)!important;color:var(--muted)!important}}}sidebar-delete-current{display:contents}sidebar-delete-current button{display:inline-flex;align-items:center;gap:.35rem;.trash-icon{flex-shrink:0}}#sync-status{display:inline-flex;align-items:center;gap:.35rem;border-color:transparent;&:hover{border-color:var(--accent)}.sync-dot{width:8px;height:8px;border-radius:50%;background:var(--muted);flex-shrink:0;box-shadow:0 0 0 1px rgb(from var(--text) r g b / .15)}&[data-status=online] .sync-dot{background:var(--green)}&[data-status=connecting] .sync-dot{background:var(--medium)}&[data-status=offline] .sync-dot{background:var(--critical)}}#sync-status[data-proxy-auth] .sync-dot{box-shadow:0 0 0 2px var(--accent)}#sync-status[data-degraded] .sync-dot{box-shadow:0 0 0 2px var(--medium)}#sync-status[hidden]{display:none}#storage-status{display:flex;align-items:center;gap:.4rem;margin:.3rem .55rem .45rem;padding:.3rem .55rem;background:rgb(from var(--medium) r g b / .12);border:1px solid rgb(from var(--medium) r g b / .3);border-radius:5px;color:light-dark(#b25b00,#f0a060);font-size:.72rem;font-family:inherit;cursor:pointer;text-align:left;-webkit-app-region:no-drag;app-region:no-drag;&:hover{background:rgb(from var(--medium) r g b / .18);border-color:rgb(from var(--medium) r g b / .5)}.storage-dot{width:7px;height:7px;border-radius:50%;background:var(--medium);flex-shrink:0}}#storage-status[hidden],#auth-status[hidden]{display:none}#auth-status{display:inline-flex;align-items:center}#auth-status[data-authed="1"]{padding:2px;border-color:transparent;border-radius:50%}#auth-status[data-authed="1"]:hover{border-color:var(--accent)}.user-avatar{position:relative;flex-shrink:0;width:22px;height:22px;border-radius:50%;overflow:hidden;background:var(--accent);display:inline-grid;place-items:center;user-select:none}.user-avatar-lg{width:38px;height:38px}.user-avatar-fallback{font-size:.72rem;font-weight:600;line-height:1;color:var(--bg);text-transform:uppercase}.user-avatar-lg .user-avatar-fallback{font-size:1.05rem}.user-avatar img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}.user-avatar img.broken{display:none}.user-menu[popover]{position:fixed;inset:auto;margin:0;min-width:11rem;flex-direction:column;gap:.1rem;background:var(--surface, var(--bg));border:1px solid var(--border);border-radius:6px;padding:.3rem;box-shadow:0 4px 14px #00000047}.user-menu[popover]:not(:popover-open){display:none}.user-menu[popover]:popover-open{display:flex}.user-card{display:flex;align-items:center;gap:.5rem;padding:.3rem .35rem .45rem;border-bottom:1px solid var(--border);margin-bottom:.2rem}.user-id{display:flex;flex-direction:column;min-width:0}.user-login{font-weight:600;font-size:.82rem;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.user-name{font-size:.74rem;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.user-menu-row{display:block;width:100%;text-align:left;background:transparent;border:0;border-radius:4px;padding:.4rem .5rem;font:inherit;font-size:.82rem;color:var(--text)}.user-menu-row:hover{background:rgb(from var(--text) r g b / .08)}.user-menu-group{display:flex;flex-direction:column;gap:.1rem;padding-bottom:.2rem;margin-bottom:.2rem;border-bottom:1px solid var(--border)}.user-menu-group-label{padding:.25rem .5rem .15rem;font-size:.62rem;font-weight:700;text-transform:uppercase;letter-spacing:.1em;color:var(--muted);user-select:none}
41
+ `;var Gm=`.file-icon.brand-deepview{.bg{fill:#2563eb}.fg{fill:#fff}}.file-icon.brand-claude{.bg{fill:#d97757}.fg{fill:#fff}}.file-icon.brand-codex{.bg{fill:#fff;stroke:#000;stroke-width:.5}.fg{fill:#000}}.file-icon.brand-vercel{.bg{fill:#000;stroke:#fff;stroke-width:.5}.fg{fill:#fff}}.file-icon.brand-piolium{.bg{fill:#fbb829}.fg{fill:#1c1b19}}
42
+ `;var Ym=`*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}dialog{margin-top:5rem;margin-inline:auto;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--text);padding:1.1rem 1.25rem 1rem;max-width:480px;width:min(94vw,480px);box-shadow:0 20px 60px #00000059;&::backdrop{background:rgb(from var(--theme-bar) r g b / .55);backdrop-filter:blur(2px)}}header h3{margin:0 0 .6rem;font-size:1rem;font-weight:600}.nwd-input{display:block;width:100%;box-sizing:border-box;padding:.5rem .65rem;border:1px solid var(--border);border-radius:6px;background:var(--bg, var(--surface));color:var(--text);font:inherit;font-size:.88rem;&: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)}}.nwd-note{margin:.55rem 0 0;color:var(--muted);font-size:.74rem;line-height:1.45}.nwd-intro{margin:0 0 .8rem;color:var(--muted);font-size:.82rem;line-height:1.5}.nwd-actions{display:flex;align-items:center;gap:.4rem;margin-top:.8rem;padding-top:.7rem;border-top:1px solid var(--border)}.nwd-spacer{flex:1}.nwd-actions button{background:transparent;border:1px solid var(--border);color:var(--text);border-radius:5px;padding:.35rem .9rem;font:inherit;font-size:.8rem;&:hover:not(:disabled){border-color:var(--accent);color:var(--accent)}&.primary{background:var(--accent);color:var(--surface);border-color:var(--accent);&:hover:not(:disabled){color:var(--surface);filter:brightness(1.08)}}&.danger{color:var(--critical, #f87171);border-color:var(--border);&:hover:not(:disabled){border-color:var(--critical, #f87171);color:var(--critical, #f87171)}}&:disabled{opacity:.5}}@media(display-mode:window-controls-overlay){dialog{-webkit-app-region:no-drag;app-region:no-drag}}
43
+ `;var I=class extends Z{static styles=[F(Ym)];firstUpdated(){this.beforeOpen();let t=this.renderRoot.querySelector("dialog");if(t){try{t.showModal()}catch(r){this._settled=!0,this.dispatchEvent(new CustomEvent("modal-conflict",{detail:{cause:r}}));return}this.focusInitial()}}beforeOpen(){}focusInitial(){(this.renderRoot.querySelector("input, textarea")??this.renderRoot.querySelector("button.primary")??this.renderRoot.querySelector("button"))?.focus()}_finish(t){this._settled||(this._settled=!0,this.renderRoot.querySelector("dialog")?.close(),this.dispatchEvent(new CustomEvent("resolve",{detail:t})))}_onClose=()=>this._finish(null)};function te(e,t={}){return new Promise(r=>{let n=document.createElement(e);Object.assign(n,t),n.addEventListener("resolve",o=>{n.remove(),r(o.detail)}),document.body.append(n)})}var ht=`dialog{max-width:520px;width:min(94vw,520px)}.wsl-field{display:block;margin-top:.6rem;color:var(--text);font-size:.78rem;>span{display:block;margin-bottom:.25rem;color:var(--muted);font-size:.72rem;text-transform:uppercase;letter-spacing:.04em}}.wsl-ack{display:flex;align-items:flex-start;gap:.5rem;margin-top:.6rem;color:var(--text);font-size:.8rem;line-height:1.4;>input[type=checkbox]{flex:0 0 auto;margin-top:.15rem}>span{flex:1 1 auto}}.wsl-link{display:block;width:100%;box-sizing:border-box;padding:.5rem .65rem;border:1px solid var(--border);border-radius:6px;background:var(--bg, var(--surface));color:var(--text);font:inherit;font-size:.78rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;resize:vertical;word-break:break-all}.wsl-error{margin:.55rem 0 0;color:var(--critical, #f87171);font-size:.74rem;line-height:1.4}.wsl-warning{padding:.55rem .65rem;border:1px solid var(--critical, #f87171);border-radius:6px;background:rgb(from var(--critical, #f87171) r g b / .08)}.wsl-optout{display:flex;align-items:center;gap:.5rem;margin-top:.7rem;color:var(--text);font-size:.78rem}.nwd-input:disabled{opacity:.5}
44
+ `;var Rd=class extends I{static styles=[...I.styles,F(ht)];static properties={_userName:{state:!0},_busy:{state:!0},_error:{state:!0},_phase:{state:!0},_success:{state:!0},_orphan:{state:!0},_orphanAck:{state:!0},_canCancel:{state:!0}};constructor(){super(),this._userName="",this._busy=!1,this._error="",this._phase="",this._success=!1,this._orphan=!1,this._orphanAck=!1,this._canCancel=!0,this._abortController=null}updated(t){if(t.has("_success")&&this._success){let r=this.renderRoot.querySelector("footer button.primary");r&&r.focus()}}beforeOpen(){typeof location<"u"&&(this._userName=location.hostname||"DeepView"),this._orphan=Ao(),this._vaultStateUnsub=Me(()=>{if(this._settled)return;let t=Ao();this._orphan&&!t&&ae()?(this._error="Encryption was just enabled in another tab. Close this dialog and reload to unlock.",this._busy=!1,this._canCancel=!0):this._orphan!==t&&(this._orphan=t)})}async focusInitial(){await this.updateComplete;let t=this._orphan?'input[data-role="orphan-ack"]':'input[data-role="name"]';this.renderRoot.querySelector(t)?.focus()}disconnectedCallback(){if(super.disconnectedCallback(),this._vaultStateUnsub){try{this._vaultStateUnsub()}catch{}this._vaultStateUnsub=null}}_finish(t){if(!this._settled){if(this._abortController)try{this._abortController.abort()}catch{}super._finish(!!t)}}_onClose=()=>this._finish(this._success);_onCancel=()=>{this._busy&&!this._canCancel||this._finish(!1)};_onDialogCancel=t=>{if(this._busy&&!this._canCancel){t.preventDefault();return}this._finish(!1)};_onNameInput=t=>{this._userName=t.target.value};_onOrphanAckInput=t=>{this._orphanAck=t.target.checked};_onWipeOrphan=async()=>{if(!this._busy&&this._orphanAck){if(ae()){this._error="Encryption was just enabled in another tab. Reload this page to unlock.";return}this._busy=!0,this._canCancel=!1,this._error="",this._phase="Clearing previous vault state\u2026";try{await Io({refuseIfEnabled:!0}),location.reload()}catch(t){this._error=`Could not clear previous vault state: ${t?.message??t}`,this._phase=""}finally{this._busy=!1,this._canCancel=!0}}};_onEnable=async()=>{if(!this._busy){if(!Mt()){this._error="Passkeys are not supported in this browser.";return}this._busy=!0,this._canCancel=!0,this._error="",this._phase="Registering passkey\u2026",this._abortController=new AbortController;try{await Vl({userName:this._userName.trim()||"DeepView user",rpName:"DeepView",signal:this._abortController.signal,migrate:async({seal:r})=>{this._canCancel=!1,this._phase="Encrypting workspaces and metadata\u2026",await Pl({seal:r}),this._phase="Encrypting triage data\u2026",await cd({seal:r}),this._phase="Encrypting report files\u2026",await oc({seal:r}),this._phase="Encrypting bundles\u2026",await ic({seal:r})}})&&(this._success=!0,this._phase="")}catch(t){t?.name==="AbortError"?this._error="":this._error=t?.message??String(t),this._phase=""}finally{this._busy=!1,this._canCancel=!0,this._abortController=null}}};_body(){if(this._orphan)return d`<p class="wsl-error">DeepView found an abandoned passkey setup on this device. The original passkey can no longer be accessed, so any local data still encrypted under it is <strong>unreadable</strong> and cannot be recovered.</p><p class="nwd-note">To enable encryption, DeepView will <strong>permanently delete ALL local DeepView data on this device</strong> — including any plaintext workspaces or reports you may have added after the previous passkey was lost — and then register a fresh passkey. This is irreversible. There is no backup.</p><label class="wsl-ack"><input type="checkbox" data-role="orphan-ack" .checked="${this._orphanAck}" ?disabled="${this._busy}" @change="${this._onOrphanAckInput}"> <span>I understand all local DeepView data on this device will be deleted.</span></label> ${this._phase?d`<p class="nwd-note">${this._phase}</p>`:m} ${this._error?d`<p class="wsl-error">${this._error}</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" ?disabled="${this._busy&&!this._canCancel}" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${this._busy||!this._orphanAck}" @click="${this._onWipeOrphan}">${this._busy?"Working\u2026":"Wipe and continue"}</button></footer>`;if(this._success)return d`<p class="nwd-note"><strong>Encryption is on.</strong> Your triage data and report files are now sealed under your passkey. You'll be asked to unlock with the passkey on every fresh load.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" class="primary" @click="${()=>this._finish(!0)}">Close</button></footer>`;let t=Mt();return d`<p class="nwd-note">Passkey encryption protects your local triage and report data with a hardware-backed key (TouchID, Windows Hello, security key). Without the passkey, the data on disk is unreadable — even to scripts running on this origin.</p><p class="wsl-error"><strong>If you lose access to this passkey, your data CANNOT be recovered.</strong> DeepView has no backup key, no recovery code, and no escrow. Make sure your passkey is backed up (iCloud Keychain / Google Password Manager sync, or a second registered device) before relying on encryption for important data.</p><p class="nwd-note"><strong>Opt-in.</strong> You can disable encryption later from the lock icon in the sidebar header — the data is rewritten as plaintext and DeepView signals your authenticator to remove the passkey (where supported).</p>${t?m:d`<p class="wsl-error">Your browser doesn't expose the WebAuthn passkey API. Try Chrome, Safari, Edge, or Firefox in a recent version on a device with a platform authenticator.</p>`} <label class="wsl-field"><span>Passkey label</span> <input type="text" class="nwd-input" data-role="name" placeholder="DeepView" maxlength="200" .value="${this._userName}" @input="${this._onNameInput}"></label> ${this._phase?d`<p class="nwd-note">${this._phase}</p>`:m} ${this._error?d`<p class="wsl-error">${this._error}</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" ?disabled="${this._busy&&!this._canCancel}" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!t||this._busy}" @click="${this._onEnable}">${this._busy?"Working\u2026":"Enable encryption"}</button></footer>`}render(){return d`<dialog @close="${this._onClose}" @cancel="${this._onDialogCancel}"><header><h3>${this._success?"Encryption enabled":this._orphan?"Previous passkey setup detected":"Enable passkey encryption"}</h3></header>${this._body()}</dialog>`}};customElements.define("passkey-setup-dialog",Rd);function ga(){return te("passkey-setup-dialog")}var Id=class extends I{static styles=[...I.styles,F(ht)];static properties={_busy:{state:!0},_error:{state:!0}};constructor(){super(),this._busy=!1,this._error="",this._abortController=null}_finish(t){if(!this._settled){if(this._abortController)try{this._abortController.abort()}catch{}super._finish(!!t)}}_onCancel=()=>this._finish(!1);_onUnlock=async()=>{if(!this._busy){this._busy=!0,this._error="",this._abortController=new AbortController;try{if(await Ro({signal:this._abortController.signal})){this._finish(!0);return}this._error=""}catch(t){this._error=t?.message??String(t)}finally{this._busy=!1,this._abortController=null}}};render(){return d`<dialog @close="${this._onClose}"><header><h3>Unlock your data</h3></header><p class="nwd-note">Your triage data and report files are encrypted with a passkey on this device. Unlock to load them.</p>${this._error?d`<p class="wsl-error">${this._error}</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">${this._busy?"Cancel":"Later"}</button> <button type="button" class="primary" ?disabled="${this._busy}" @click="${this._onUnlock}">${this._busy?"Waiting\u2026":"Unlock with passkey"}</button></footer></dialog>`}};customElements.define("passkey-unlock-dialog",Id);function ba(){return te("passkey-unlock-dialog")}var Jm=d`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="8" width="10" height="6" rx="1"/><path d="M5 8V5.5a3 3 0 0 1 6 0V8"/></svg>`,L$=d`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="8" width="10" height="6" rx="1"/><path d="M5 8V5a3 3 0 0 1 6 -0.5"/></svg>`,Fe=null;function Md(){if(!Fe)return;if(!Mt()){Fe.hidden=!0;return}let e=ae();if(!e&&a.serverMode==="managed"){Fe.hidden=!0;return}Fe.hidden=!1;let t=$t();Fe.classList.toggle("encrypted",e&&t),Fe.classList.toggle("locked-pending",e&&!t),e&&t?(Fe.title="Encryption on \u2014 click to disable",Fe.setAttribute("aria-label","Disable encryption"),J(Jm,Fe)):e?(Fe.title="Encryption on, locked \u2014 click to unlock",Fe.setAttribute("aria-label","Unlock encrypted data"),J(Jm,Fe)):(Fe.title="Encryption off \u2014 click to enable",Fe.setAttribute("aria-label","Enable encryption"),J(L$,Fe))}async function O$(){if(confirm(`Disable encryption?
44
45
 
45
46
  Your local triage and report data will be rewritten as plaintext.
46
47
 
47
- IMPORTANT: DeepView cannot directly delete your passkey. Most browsers / password managers require you to remove the entry manually after disabling. You can re-enable encryption later.`))try{(await Rl({migrate:async({open:t})=>{await Sl({open:t}),await Zc({open:t}),await Kl({open:t}),await Gl({open:t})}}))?.disabled&&alert(`Encryption disabled. Your data is now plaintext.
48
+ IMPORTANT: DeepView cannot directly delete your passkey. Most browsers / password managers require you to remove the entry manually after disabling. You can re-enable encryption later.`))try{(await jl({migrate:async({open:t})=>{await Nl({open:t}),await dd({open:t}),await sc({open:t}),await ac({open:t})}}))?.disabled&&alert(`Encryption disabled. Your data is now plaintext.
48
49
 
49
50
  To complete cleanup, remove the DeepView passkey from your password manager / OS settings:
50
51
  \u2022 macOS / iOS: Settings \u2192 Passwords
51
52
  \u2022 Windows: Settings \u2192 Accounts \u2192 Sign-in options \u2192 Passkeys
52
53
  \u2022 Chrome: chrome://settings/passkeys
53
- \u2022 Hardware security key: use the vendor's management tool`)}catch(e){alert(`Could not disable encryption: ${e?.message??e}`)}}async function Kk(){await aa()}function Tg(){kd()}function Ig(e){if(!e||e===Ie)return;Ie=e;let t=!1;Ie.addEventListener("click",async()=>{if(!t){t=!0;try{if(!se()){await Kk();return}if(!yt()){await la();return}await Wk()}finally{t=!1}}}),Te(kd),kd()}var Rg=`.spd-list{margin:0 0 .8rem 1.15rem;color:var(--muted);font-size:.82rem;line-height:1.5;& li{margin:.3rem 0}& strong{color:var(--text);font-weight:600}}.spd-denied{color:light-dark(#b25b00,#f0a060);font-size:.78rem}code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.92em}
54
- `;function xd(){let e=navigator.userAgent;return/AppleWebKit/u.test(e)&&!/Chrome\/|Chromium|Edg\/|OPR\/|Android/u.test(e)?"webkit":/Firefox\//u.test(e)?"firefox":"chromium"}var $d=class extends R{static styles=[...R.styles,B(Rg)];static properties={_retryDenied:{state:!0}};constructor(){super(),this._retryDenied=!1}focusInitial(){this.renderRoot.querySelector("button.primary")?.focus()}_onConfirm=()=>this._finish(null);_onRetry=async()=>{if(await zn()){this._finish("granted");return}this._retryDenied=!0};_chromiumBody(){let t=location.hostname==="localhost"?d`Plain <code>localhost</code> can never qualify — for local testing open the app via <code>127.0.0.1</code> instead.`:g;return d`<p class="nwd-intro">Chromium-based browsers (Chrome, Edge, Brave, …) never show a prompt — persistence is granted silently, and only to sites the browser considers important. Any of these qualifies it:</p><ul class="spd-list"><li><strong>Install the app</strong> — the install icon at the right end of the address bar, or the browser menu's Install entry.</li><li><strong>Bookmark</strong> this page.</li><li>Keep using the site — regular visits raise its engagement score.</li></ul><p class="nwd-note">The browser re-evaluates on every request, so after any of the above press <strong>Try again</strong>.${t}</p>`}_firefoxBody(){return d`<p class="nwd-intro">Firefox asks with a permission prompt. A dismissed or blocked prompt is remembered, and the site can't re-ask until the old answer is cleared:</p><ol class="spd-list"><li>Click the permissions icon next to the address bar.</li><li>Clear the <strong>Store Data in Persistent Storage</strong> entry if it's blocked.</li><li>Press <strong>Try again</strong> below and choose <strong>Allow</strong>.</li></ol>`}_webkitBody(){return d`<p class="nwd-intro">Safari — and every iOS browser — additionally deletes a site's storage after <strong>7 days</strong> of browser use without interacting with the site, and no permission exempts a normal tab. Installing the app is what does:</p><ul class="spd-list"><li>On iPhone / iPad: open the <strong>Share</strong> menu, choose <strong>Add to Home Screen</strong>, and use the app from that icon.</li><li>In Safari on macOS: choose <strong>File → Add to Dock…</strong> and use the app from the Dock.</li><li>Installed web apps are exempt from the 7-day cleanup. Otherwise, use the site at least once a week.</li></ul>`}render(){let t=xd(),r=t==="webkit"?this._webkitBody():t==="firefox"?this._firefoxBody():this._chromiumBody();return d`<dialog @close="${this._onClose}"><header><h3>Protect stored data</h3></header><p class="nwd-intro">Reports, bundles and triage live in the browser's <strong>best-effort storage</strong> — the browser is allowed to delete all of it at once under disk pressure or after long inactivity, without asking. The persistent-storage request that would prevent this was just declined.</p>${r}<footer class="nwd-actions">${this._retryDenied?d`<span class="spd-denied" role="status">Still not granted.</span>`:g} <span class="nwd-spacer"></span> ${t==="webkit"?g:d`<button type="button" @click="${this._onRetry}">Try again</button>`} <button type="button" class="primary" @click="${this._onConfirm}">Got it</button></footer></dialog>`}};customElements.define("storage-persist-dialog",$d);function Mg(){return new Promise(e=>{let t=document.createElement("storage-persist-dialog"),r=n=>{t.remove(),e(n)};t.addEventListener("resolve",n=>r(n.detail)),t.addEventListener("modal-conflict",()=>r(null)),document.body.append(t)})}var Ot=null,Lt=null,Cd=!1,ca=!1,_d=0;function Sd(){return xd()==="webkit"}function Fg(e){return e>=1e9?`${(e/1e9).toFixed(1)} GB`:e>=1e6?`${(e/1e6).toFixed(1)} MB`:e>=1e3?`${(e/1e3).toFixed(1)} kB`:`${e} B`}function Gk(){if(!Ot)return;if(!Lt||Lt.persisted!==!1||!Cd){Ot.hidden=!0;return}Ot.hidden=!1;let e=Lt.usage===null||Lt.quota===null?"":` Using ${Fg(Lt.usage)} of ${Fg(Lt.quota)}.`;Ot.querySelector(".storage-label").textContent="Storage at risk",Ot.title="Reports, bundles and triage are in best-effort storage \u2014 the browser may delete them all under disk pressure or after long inactivity. "+(Sd()?"Click for how to protect them (on Safari and iOS browsers this needs the app installed to the Home Screen or Dock).":"Click to request persistent storage \u2014 if the browser declines, instructions for enabling it follow.")+e}function Lg(e,t){let r=t?" (user gesture)":"";if(e){console.info(`storage: persistent-storage request granted${r}`);return}let n=!Sd()&&location.hostname==="localhost"?" Note: plain localhost can NEVER pass \u2014 Chromium keys site importance by registerable domain (IP literals excepted) and localhost has none; for local testing use 127.0.0.1 instead.":"";console.info(`storage: persistent-storage request not granted${r} \u2014 `+(Sd()?"Safari ties persistence to install state; add the app to the Home Screen / Dock.":"Chromium-based browsers never prompt and silently deny origins they don't consider important; installing the app, bookmarking it, allowing notifications, or regular use flips the heuristic (re-evaluated on every request). Firefox shows a prompt instead.")+n)}async function da(){if(!Ot)return;let[e,t]=await Promise.all([td(),(async()=>{try{return(await ie()).length>0||await Fo()}catch{return!1}})()]);Lt=e,Cd=t,Gk()}function Ed(){!Ot||_d||(_d=setTimeout(()=>{_d=0,da()},1e3))}async function Bg(){if(ca||(await da(),Lt?.persisted!==!1||!Cd||ca))return;ca=!0;let e=await zn();Lg(e,!1),await da()}async function Yk(){if(Lt&&Lt.persisted===!1){ca=!0;let e=await zn();Lg(e,!0),e||await Mg()}await da()}function Og(e){Ot=e,Ot&&(Ot.addEventListener("click",()=>{Yk()}),Io((t,r)=>{Ed(),r==="save"&&Bg()}),Bg())}var us='<path class="bg" d="M3 2h6l4 4v8H3z"/><path fill="rgba(0,0,0,.18)" d="M9 2v4h4Z"/>',ne={default:`<svg class="file-icon brand-deepview" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true">${us}<path class="fg" d="M7.843 6.719c-1.605 0-2.926 1.292-3.477 1.947.466.58 1.872 2.024 3.496 2.024s2.907-1.292 3.486-2.005c-.627-.703-1.88-1.966-3.505-1.966m.019 3.857c-1.51 0-2.802-1.263-3.353-1.9.55-.617 1.814-1.852 3.334-1.852 1.51 0 2.698 1.12 3.335 1.852-.533.618-1.787 1.9-3.316 1.9m-.019-3.42c-.826 0-1.577.694-1.577 1.596 0 .789.599 1.577 1.577 1.577.893 0 1.587-.684 1.587-1.577-.01-.779-.627-1.596-1.587-1.596m0 3.069a1.476 1.476 0 0 1-1.482-1.473c0-.722.599-1.491 1.482-1.491.846 0 1.482.693 1.492 1.491 0 .808-.618 1.473-1.492 1.473m.01-2.727c-.637 0-1.264.532-1.264 1.244 0 .627.475 1.235 1.245 1.245.684 0 1.254-.522 1.254-1.244 0-.58-.475-1.236-1.235-1.245m-.02 2.403a1.167 1.167 0 0 1-1.149-1.159c0-.532.456-1.14 1.169-1.149.56 0 1.149.427 1.159 1.15 0 .636-.485 1.158-1.179 1.158m-.769-1.833c-.19.238-.275.494-.237.864l.74.057zm1.026-.294c-.295-.057-.665 0-.912.228l.323.607zm.133.047-.38.56.988.114c-.057-.275-.323-.579-.608-.674m-.124.741.456.912c.21-.209.352-.484.314-.836zm-1.225.504a.97.97 0 0 0 .57.617l.399-.551zm.713.664c.313.076.636.01.845-.161l-.295-.618zm-.637 1.55c0 .028-.028.066-.066.066h-.59c-.028 0-.066-.028-.066-.066s.029-.066.067-.066h.579c.048 0 .076.028.076.066m.712 0c0 .028-.028.066-.066.066h-.437c-.028 0-.066-.028-.066-.066s.028-.066.066-.066h.437c.038 0 .066.028.066.066m.666 0c0 .028-.029.066-.067.066h-.37c-.029 0-.067-.028-.067-.066s.029-.066.067-.066h.37c.038 0 .067.028.067.066m-1.672.351c0 .029-.029.067-.067.067h-.295c-.028 0-.066-.028-.066-.066 0-.029.029-.067.067-.067h.294c.038 0 .066.028.066.066m.694 0c0 .029-.028.067-.066.067h-.409c-.028 0-.066-.028-.066-.066 0-.029.028-.067.066-.067h.399c.038 0 .076.028.076.066m.732 0c0 .029-.029.067-.067.067h-.465c-.029 0-.067-.028-.067-.066 0-.029.029-.067.067-.067h.465c.038 0 .067.028.067.066m-1.093.371a.065.065 0 0 1-.067.066h-.627c-.028 0-.075-.028-.066-.066 0-.028.029-.066.067-.066h.627c.038 0 .066.028.066.066m.684 0a.065.065 0 0 1-.066.066h-.39c-.028 0-.076-.028-.066-.066 0-.028.028-.066.066-.066h.39c.038 0 .066.028.066.066M5.088 6.263c-.019-.105-.114-.19-.237-.19s-.257.104-.257.237.105.238.247.238c.105 0 .218-.076.238-.18h.864v.826l.095-.048V6.31c0-.028-.019-.057-.048-.057h-.902zm-.237.19c-.076 0-.143-.066-.143-.143s.066-.142.143-.142.142.066.142.143c.01.076-.066.142-.143.142m2.89-.323H6.38l.418-.475v-.332a.255.255 0 0 0 .218-.248c0-.123-.114-.256-.256-.256s-.266.114-.266.257c0 .123.095.228.209.247v.284l-.456.523v.893l.095-.047v-.742h1.396c.029 0 .067-.009.067-.057 0-.028-.019-.047-.067-.047m-1.13-1.054c0-.076.066-.152.152-.152s.152.066.152.151c0 .076-.066.152-.152.152s-.152-.066-.152-.152m-.836 5.264h-.874c-.019-.105-.114-.219-.247-.219s-.256.105-.256.257c0 .132.114.275.266.275.104 0 .218-.076.237-.19h.827v.608l-.257.285a.3.3 0 0 0-.095-.019c-.133 0-.256.105-.256.228 0 .133.104.238.237.238.124 0 .247-.105.247-.238a.23.23 0 0 0-.057-.152l.285-.304v-.712c0-.029-.019-.058-.057-.058m-1.121.219a.16.16 0 0 1-.152-.161c0-.077.066-.162.152-.162s.152.066.152.152-.066.171-.152.171m.713 1.14c-.076 0-.143-.066-.143-.143s.066-.133.143-.133.142.067.142.143c0 .066-.066.133-.143.133m5.472-1.377a.24.24 0 0 0-.237.208h-1.13c-.029 0-.038.02-.038.048v.712l-.323.39h-.029a.245.245 0 0 0-.247.247c0 .133.114.256.247.256s.247-.113.247-.256a.26.26 0 0 0-.123-.219l.313-.38v-.674h1.083c.019.105.114.2.238.2.133 0 .266-.105.266-.257 0-.133-.105-.276-.266-.276m-1.758 1.767a.15.15 0 0 1-.143-.152c0-.075.067-.142.143-.142s.152.066.152.143a.15.15 0 0 1-.152.151m1.758-1.33a.15.15 0 0 1-.143-.152.147.147 0 0 1 .294.001.15.15 0 0 1-.152.151M8.917 5.55h-.399a.075.075 0 0 1-.076-.076c0-.028.029-.066.067-.066h.418c.028 0 .066.028.066.066s-.038.076-.076.076m.742 0H9.22c-.038 0-.067-.028-.067-.076 0-.028.029-.066.067-.066h.437c.038 0 .066.028.066.066s-.028.076-.066.076m.883 0h-.598c-.029 0-.067-.028-.067-.076 0-.028.029-.066.067-.066h.598c.028 0 .066.028.066.066s-.028.076-.066.076m-1.282.4h-.741c-.038 0-.076-.029-.076-.067s.028-.076.066-.076h.75c.039 0 .067.038.067.076 0 .029-.028.067-.066.067m.797 0h-.503c-.038 0-.076-.029-.076-.067s.028-.066.066-.066h.513c.038 0 .067.028.067.066 0 .029-.029.067-.067.067m.476 0h-.19c-.039 0-.067-.029-.067-.067s.028-.066.066-.066h.2c.028 0 .066.028.066.066 0 .029-.028.067-.075.067m-1.682.398h-.332c-.039 0-.077-.028-.077-.066s.029-.066.067-.066h.342c.038 0 .076.028.076.066s-.028.066-.076.066m.789 0h-.494c-.038 0-.067-.028-.067-.066s.029-.066.067-.066h.494c.038 0 .066.028.066.066s-.028.066-.066.066m.893 0h-.599c-.038 0-.076-.028-.076-.066s.028-.066.066-.066h.618c.028 0 .066.028.066.066s-.028.066-.076.066m.418.305a.69.69 0 0 0-.674.712c0 .086.019.18.048.257l.085.066c-.028-.085-.057-.171-.057-.304 0-.285.228-.646.598-.646.295 0 .599.228.599.636a.58.58 0 0 1-.599.59.8.8 0 0 1-.237-.048l.123.114a.4.4 0 0 0 .114.01c.39 0 .684-.276.684-.666 0-.313-.266-.712-.684-.722m.353.552-.019-.01-.161.19-.143-.01-.057-.047-.019-.133.19-.2a.28.28 0 0 0-.361.077c-.076.095-.076.209-.038.351l-.247.304.171.152.266-.266c.142.038.285.019.38-.095a.31.31 0 0 0 .038-.313"/></svg>`,"claude-security":`<svg class="file-icon brand-claude" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true">${us}<path class="fg" d="m5.875 10.154 1.376-.772.023-.067-.023-.037h-.067l-.23-.015-.787-.02-.681-.03-.661-.035-.166-.035-.156-.205.016-.103.14-.094.2.018.442.03.665.046.481.028.714.075h.113l.016-.047-.039-.028-.03-.028-.687-.466-.744-.492-.39-.284-.21-.143-.106-.135-.046-.294.19-.21.258.017.065.018.26.2.557.43.726.535.106.089.042-.03.006-.022-.048-.08-.395-.713-.422-.726-.187-.301-.05-.18a1 1 0 0 1-.03-.213l.218-.296.12-.039.29.039.123.106.18.413.293.65.453.884.133.262.07.242.027.075h.046v-.043l.038-.497.069-.611.067-.787.023-.221.11-.266.218-.143.17.081.14.2-.02.13-.083.54-.163.846-.106.567h.062l.07-.07.287-.382.482-.602.213-.239.248-.264.159-.125h.301l.221.329-.099.34-.31.393-.256.333-.369.496-.23.397.021.032.055-.006.832-.177.45-.081.537-.092.243.113.026.115-.096.236-.573.141-.673.135-1.003.237-.012.01.014.017.452.042.193.01h.473l.88.066.23.153.138.186-.023.141-.354.181-.478-.113-1.116-.266-.383-.096h-.053v.032l.32.312.584.528.731.68.037.168-.094.133-.099-.014-.643-.484-.248-.218-.561-.472H9.08v.05l.129.189.684 1.027.035.315-.05.103-.177.062-.194-.036-.4-.561-.413-.632-.333-.567-.041.023-.197 2.116-.092.108-.212.082-.177-.135-.094-.218.094-.43.113-.561.092-.447.083-.554.05-.184-.004-.013-.04.006-.418.574-.636.858-.503.539-.12.048-.21-.108.02-.193.117-.172.696-.886.42-.549.27-.317-.001-.046h-.016l-1.85 1.201-.328.042-.142-.132.018-.218.067-.071.556-.383Z"/></svg>`,"codex-security":`<svg class="file-icon brand-codex" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true">${us}<path class="fg" d="M11.04 8.364a1.72 1.72 0 0 0-.152-1.432 1.8 1.8 0 0 0-1.925-.846 1.8 1.8 0 0 0-.778-.498 1.8 1.8 0 0 0-.927-.05 1.8 1.8 0 0 0-.827.414 1.77 1.77 0 0 0-.507.767 1.8 1.8 0 0 0-.683.297 1.75 1.75 0 0 0-.499.549 1.75 1.75 0 0 0 .22 2.07 1.72 1.72 0 0 0 .151 1.432 1.8 1.8 0 0 0 1.926.846 1.77 1.77 0 0 0 1.333.587c.78 0 1.47-.496 1.707-1.227a1.8 1.8 0 0 0 .684-.298 1.75 1.75 0 0 0 .499-.548 1.75 1.75 0 0 0-.222-2.063m-2.667 3.678a1.33 1.33 0 0 1-.851-.304l.042-.024 1.413-.804a.23.23 0 0 0 .116-.199V8.747l.597.34q.01.005.011.015v1.629a1.323 1.323 0 0 1-1.328 1.31m-2.857-1.203a1.3 1.3 0 0 1-.158-.879l.042.025 1.414.805a.23.23 0 0 0 .23 0l1.729-.982v.68a.02.02 0 0 1-.01.018l-1.431.814a1.34 1.34 0 0 1-1.816-.48m-.372-3.037a1.32 1.32 0 0 1 .7-.574v1.656a.22.22 0 0 0 .114.197l1.72.979-.598.34a.02.02 0 0 1-.021 0L5.63 9.587a1.304 1.304 0 0 1-.487-1.791zm4.907 1.125L8.327 7.94l.596-.34a.02.02 0 0 1 .02 0l1.43.814a1.3 1.3 0 0 1 .512.528 1.3 1.3 0 0 1-.118 1.4 1.33 1.33 0 0 1-.595.436V9.122a.23.23 0 0 0-.12-.195m.594-.881-.042-.025-1.411-.812a.23.23 0 0 0-.232 0l-1.727.983v-.68a.02.02 0 0 1 .008-.018l1.429-.813a1.34 1.34 0 0 1 1.425.061 1.3 1.3 0 0 1 .55 1.298zM6.908 9.252l-.597-.34a.02.02 0 0 1-.012-.016V7.271c0-.249.073-.493.209-.703s.329-.378.557-.483a1.35 1.35 0 0 1 1.415.18l-.042.023-1.413.804a.23.23 0 0 0-.116.2zm.324-.69.77-.438.77.438v.875l-.768.437-.77-.437z"/></svg>`,deepsec:`<svg class="file-icon brand-vercel" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true">${us}<path class="fg" d="m8 5.97 3.5 6.062h-7Z"/></svg>`,piolium:`<svg class="file-icon brand-piolium" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true">${us}<path class="fg" d="M8 6.4 5.6 7.2v2.3c0 1.6 1 2.7 2.4 3.3 1.4-.6 2.4-1.7 2.4-3.3V7.2Z"/></svg>`};function nt(e){let t=Wo(e);if(t==="deepsec")return"deepsec";if(t==="piolium")return"piolium";if(t==="claude-security")return"claude-security";let r=e.toLowerCase();return r.endsWith(".codex")?"codex-security":r.endsWith(".md")?"claude-security":"default"}function De(e){return e.toLowerCase().endsWith(".codex")?e.slice(0,-6).replaceAll("__","/"):e}var Pg=globalThis[Symbol.for("@rray/frontend")];if(!Pg)throw new Error("@rray/frontend global not installed; view.js must run before lazy bundles import this wrapper");var{LitElement:C6,html:Ad,nothing:Ng,unsafeCSS:E6,render:A6,StateElement:T6,classMap:I6,repeat:R6,styleMap:M6}=Pg;var ve={critical:6,high:5,medium:4,low:3,high_bug:2,bug:1,informational:0},we=["critical","high","medium","low","high_bug","bug","informational"];function Hg(e){return e!=null&&e in ve?e:null}function Xt(e){return Hg(e?.correctedSeverity)??e?.severity}function Qt(e){let t=Hg(e?.correctedSeverity);return t!=null&&t!==e?.severity}function re(e,t){return t==="original"?e?.severity:Xt(e)}function ua(e){let t=e?._correctedByReport;return t&&new Set(Object.values(t).map(n=>n?.severity)).size>1?t:null}function pa(e){return new RegExp(`(^|/)${e}/`,"u")}function Vg(e){return new RegExp(`^(?:.*/)?${e}/(?:@[^/]+/[^/]+|[^/]+)/(.*)$`,"u")}var Jk=pa("node_modules"),Xk=pa("vendor"),ps="node_modules",jg=pa(ps),Wg=Vg(ps);function Qk(e){e!==ps&&(ps=e,jg=pa(e),Wg=Vg(e))}function Kg(e){let t=!1,r=!1,n=o=>(!t&&Jk.test(o)&&(t=!0),!r&&Xk.test(o)&&(r=!0),t);e:for(let o of e){for(let s of o.groups??[])for(let i of s)if(n(i.file))break e;if(o.tree){for(let s of Object.keys(o.tree))if(n(s))break e}}Qk(t?"node_modules":r?"vendor":"dependencies")}function qg(){return ps}function _r(e){return jg.test(e)}function oe(e){return typeof e!="number"||!Number.isFinite(e)?null:`${e.toLocaleString()} B`}function ot(e){if(e.length<=1)return{prefix:"",stripped:[...e]};let t=e.map(i=>i.split("/")),r=Math.min(...t.map(i=>i.length)),n=0;for(let i=0;i<r-1&&t.every(l=>l[i]===t[0][i]);i++)n=i+1;if(n>0&&t[0][n-1].startsWith("@")&&n--,n>0&&t[0][n-1]==="node_modules"&&n--,n===0)return{prefix:"",stripped:[...e]};let o=`${t[0].slice(0,n).join("/")}/`,s=t.map(i=>i.slice(n).join("/"));return{prefix:o,stripped:s}}function Zk(e){return e.match(Wg)?.[1]??e}function pt(e,t){if(!e)return e;let r=e;t?.exportsMode==="isolate"&&(r=r.replace(/^\((?:[^()]|\([^()]*\))*\): \[export:\s*\w+\] /u,""),r=r.replace(/^\[export:\s*\w+\] /u,""));let n=[t?.exportName,t?.methodName].filter(Boolean);for(let o of n){let s=o.replaceAll(/[.*+?^${}()|[\]\\]/gu,"\\$&");r=r.replaceAll(new RegExp(`\\[export:\\s*${s}\\]\\s*`,"gu"),"")}for(let o of n){let s=o.replaceAll(/[.*+?^${}()|[\]\\]/gu,"\\$&");r=r.replace(new RegExp(`^\\(\`?${s}\`?\\): `,"u"),"")}return r}function on(e){let t=e?.exportName,r=e?.methodName;return t&&r&&t!==r?`${t}.${r}`:t||r||""}function Gg(e){return[e.file,e.description,Hn(e),e.recommendation,e.confidenceReason,e.discoveredIn,e.repo?.github].filter(Boolean).join(`
55
- `).toLowerCase()}function fs(e){return e&&e.replace(/^[^/]+\//u,"").replace(/^claude-/u,"").replaceAll("-"," ")}function sn(e){return[e.type,fs(e.model),e.effort,e.exportsMode].filter(Boolean).join(" \xB7 ")}function fa(e){if(e.length===0)return"";let t=e[0];for(let r=1;r<e.length;r++){for(;t&&!e[r].startsWith(t);)t=t.slice(0,-1);if(!t)return""}return t}function Yg(e){if(!e)return null;let t=e.trim().replace(/\/$/u,"");return t?/^https?:\/\//iu.test(t)?t:/^github\.com\//iu.test(t)?`https://${t}`:`https://github.com/${t}`:null}var e$=/^(?:@[\w.-]+\/)?[\w.-]+@[^/\s@]+$/u;function t$(e){return e$.test(e||"")}function r$(e,t,r){if(t$(e))return null;if(t)return`https://github.com/${t}/blob/HEAD/${Zk(e)}`;if(_r(e))return null;let n=Yg(r);return n?`${n}/blob/HEAD/${e}`:null}function Id(e,t){let r=e?.file??"",n=an(e,t);return n?Ad`<a href="${n$(n)}" target="_blank" rel="noopener">${r}</a>`:r}function n$(e){return e.replace(/#L\d+(?:-L?\d+)?$/u,"")}function Pt(e){if(typeof e!="string"||e.length===0)return!1;try{let t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function an(e,t){if(!e)return null;if(Pt(e.location))return e.location;let r=r$(e.file,e.repo?.github,t);if(!r)return null;let n=parseInt(e.line,10);return Number.isFinite(n)?`${r}#L${n}`:r}var o$=/^(?:\s+\S|[-*+] |\d+[.)] |>|#{1,6} |\||`{3}|~{3})/u;function hs(e){return e&&e.split(/(\n{2,})/u).map(t=>{if(/^\n+$/u.test(t))return t;let r=t.split(`
56
- `);return r.some(n=>o$.test(n))?t:r.map(n=>n.trim()).filter(Boolean).join(" ")}).join("")}var s$=/^\*\*([^*\n]+):\*\*[ \t]*/u;function Jg(e){let t=[];for(let r of(e||"").split(/\n{2,}/u)){if(!r.trim())continue;let n=s$.exec(r);if(n){t.push({label:n[1].trim(),body:r.slice(n[0].length).trim()});continue}let o=t.at(-1);o&&o.label===null?o.body+=`
57
-
58
- ${r}`:t.push({label:null,body:r})}return t}function Xg(e,t,r){return an({file:e?.file,line:e?.line,location:e?.url,repo:t?.repo},r)}function Rd(e){return Number.isFinite(parseInt(e?.line,10))?`${e.file}:${e.line}`:e?.file??""}function Hn(e){let t=Array.isArray(e?.evidence)?e.evidence:[];if(t.length===0)return"";let r=["**Evidence:**"];return t.forEach((n,o)=>{let s=Rd(n);if(r.push(`${o+1}. ${n.url?`[${s}](${n.url})`:s}`),n.text)for(let i of n.text.split(`
59
- `))r.push(` ${i}`)}),r.join(`
60
- `)}function Qg(e){let t=/^\[([^\]]+)\]\(([^)\s]+)\)$/u.exec(e);return!t||!Pt(t[2])?null:{label:Fi(t[1].trim())||t[2],url:t[2]}}function Zg(e,t){let r=parseInt(e?.line,10);if(!Number.isFinite(r))return Ng;let n=an(e,t),o=`line ${r}`;return n?Ad`<a href="${n}" target="_blank" rel="noopener">${o}</a>`:o}function em(e,t){return!e||!t?null:`${/^https?:/iu.test(e)?e.replace(/\/$/u,""):`https://github.com/${e}`}/commit/${t}`}function tm(e,t){let r=[];t&&r.push(`Repo: ${t}`),e.file&&r.push(`File: ${e.file}`),e.line!==void 0&&e.line!==null&&e.line!==""&&r.push(`Line: ${e.line}`),e.description&&r.push(`Description: ${e.description}`);let n=Hn(e);return n&&r.push(n),e.confidence!==void 0&&e.confidence!==null&&r.push(`Confidence: ${e.confidence}/10`),r.join(`
61
- `)}function rm(e,{title:t,body:r}={}){let n=Yg(e);if(!n)return null;let o;try{o=new URL(n).host.toLowerCase()}catch{return null}if(o!=="github.com")return null;let s=new URLSearchParams;t&&s.set("title",t),r&&s.set("body",r);let i=s.toString();return i?`${n}/issues/new?${i}`:`${n}/issues/new`}var i$=/^[a-zA-Z\d](?:-?[a-zA-Z\d])*$/u,a$=/^[a-zA-Z\d._-]+$/u,l$=/^[1-9]\d{0,9}$/u,c$=/^[a-fA-F\d]{7,40}$/u,d$=/^#[\w-]+$/u,Dg=/^GHSA(?:-[0-9a-z]{4}){3}$/u;function zg(e){return e.length<=39&&i$.test(e)}function Ug(e){return e.length<=100&&e!=="."&&e!==".."&&a$.test(e)}function u$(e){let t;try{t=new URL(e)}catch{return null}if(t.href!==e||t.protocol!=="https:"||t.hostname.toLowerCase()!=="github.com"||t.port||t.username||t.password)return null;let r=t.pathname.split("/");if(r.at(-1)===""&&r.pop(),r.length===3&&r[1]==="advisories"){let p=r[2];return Dg.test(p)?{url:`https://github.com/advisories/${p}`,label:p}:null}if(r.length===6&&r[3]==="security"&&r[4]==="advisories"){let[,p,f,,,h]=r;return!zg(p)||!Ug(f)||!Dg.test(h)?null:{url:`https://github.com/${p}/${f}/security/advisories/${h}`,label:h}}if(r.length!==5)return null;let[,n,o,s,i]=r;if(!zg(n)||!Ug(o))return null;let l;if(s==="issues"||s==="pull"){if(!l$.test(i))return null;l=`${n}/${o}#${i}`}else if(s==="commit"){if(!c$.test(i))return null;l=`${n}/${o}@${i.slice(0,7)}`}else return null;let c=d$.test(t.hash)?t.hash:"";return{url:`https://github.com/${n}/${o}/${s}/${i}${c}`,label:l}}var p$=/^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/u;function f$(e){let t=mh(e);if(!t)return null;let r=p$.test(t.id)?`finding ${t.id.slice(0,8)}`:"finding";return{url:`#${t.fragment}`,label:r,self:!0}}var Td=/https?:\/\/[^\s<>"'`(){}[\]|\\^]+/giu,h$=new Set([")",".",",","!","?",";",":","'",'"',"*","]","}",">"]);function g$(e){let t=e.length;for(;t>0&&h$.has(e[t-1]);)t--;return t===e.length?e:e.slice(0,t)}function nm(e){if(typeof e!="string"||e.length===0)return[];let t=[],r=0;Td.lastIndex=0;let n;for(;(n=Td.exec(e))!==null;){let o=g$(n[0]),s=o?u$(o)??f$(o):null;s&&(n.index>r&&t.push(e.slice(r,n.index)),t.push(s),r=n.index+o.length,Td.lastIndex=r)}return r<e.length&&t.push(e.slice(r)),t}var Sr="\0",ln="",Cr="";function gs(e){return fs(e.model)||null}function Md(e){if(a.filterAnalyzer){let t=e._analyzer??null,r=a.filterAnalyzer===Sr?null:a.filterAnalyzer;if(t!==r)return!1}if(a.filterModel){let t=gs(e),r=a.filterModel===Cr?null:a.filterModel;if(t!==r)return!1}return!0}function Fd(e){return typeof e.repo?.github=="string"&&e.repo.github?e.repo.github:typeof e._repoFallback=="string"&&e._repoFallback?e._repoFallback:null}function Vn(){a.filterSeverities=new Set,a.filterColors=new Set,a.filterSources=new Set,a.filterAnalyzer="",a.filterModel="",a.filterRepo="",a.filterConfMin=0,a.filterConfMax=10,a.filterInclude="",a.filterIncludeNegate=!1,a.filterComment="",a.filterFix="",a.filterFlagged="";let e=a.reports.some(t=>t.groups.some(r=>r.some(n=>n.priority!==void 0)));a.sortBy=e?"priority-desc":"severity"}function m$(e){let t=a.filterInclude.toLowerCase();if(a.filterSeverities.size>0&&!a.filterSeverities.has(re(e,a.severityMode)))return!1;if(a.filterColors.size>0){let r=a.triage.get(D(e))?.color??"none";if(!a.filterColors.has(r))return!1}if(a.filterSources.size===1){let r=a.filterSources.has("own");if(r&&_r(e.file)||!r&&!_r(e.file))return!1}if(!Md(e))return!1;if(a.filterRepo){let r=Fd(e),n=a.filterRepo===ln?null:a.filterRepo;if(r!==n)return!1}if(e.confidence===void 0){if(e.critical===!0){if(a.filterConfMax<10)return!1}else if(a.filterConfMin>0)return!1}else if(e.confidence<a.filterConfMin||a.filterConfMax<10&&e.confidence>a.filterConfMax)return!1;if(t){let r=a.triage.get(D(e)),n=Gg(e).includes(t)||(r?.comment??"").toLowerCase().includes(t)||(r?.fix??"").toLowerCase().includes(t);return a.filterIncludeNegate?!n:n}return!0}function b$(e){if(!a.filterComment&&!a.filterFix&&!a.filterFlagged)return!0;let t=r=>e.some(n=>r(a.triage.get(D(n))));if(a.filterComment){let r=t(n=>!!n?.comment);if(a.filterComment==="with"?!r:r)return!1}if(a.filterFix){let r=t(n=>!!n?.fix);if(a.filterFix==="with"?!r:r)return!1}if(a.filterFlagged){let r=t(n=>n?.flagged===!0);if(a.filterFlagged==="with"?!r:r)return!1}return!0}function Er(e){return e.filter(t=>t.some(m$)&&b$(t))}function om(e,t,r){return(n,o)=>{let s=n[e]??r,i=o[e]??r;return(t==="desc"?i-s:s-i)||n.file.localeCompare(o.file)}}function im(e){let t=e==="desc"?-1:11;return(r,n)=>{let o=r.confidence===void 0&&r.critical===!0,s=n.confidence===void 0&&n.critical===!0,i=r.confidence??(o?10:t),l=n.confidence??(s?10:t);return(e==="desc"?l-i:i-l)||(o===s?0:o?-1:1)||r.file.localeCompare(n.file)}}var sm=im("desc"),y$={severity:(e,t)=>(ve[re(t,a.severityMode)]||0)-(ve[re(e,a.severityMode)]||0)||sm(e,t)||parseInt(e.line,10)-parseInt(t.line,10),"confidence-desc":sm,"confidence-asc":im("asc"),"priority-desc":om("priority","desc",-1),"priority-asc":om("priority","asc",11)};function am(e){let t=y$[a.sortBy];return t?e.map(r=>({p:cn(r),g:r})).toSorted((r,n)=>t(r.p,n.p)).map(r=>r.g):[...e]}function D(e){return e.id??String(e._id)}function Se(e){return D(e[0])}function Bd(e){return Array.isArray(e)?e:[e]}function ha(e){return e?._reportName??""}function jn(e){return qt(a.triage,D(e),ha(e))}function Wn(e){return e.length<=1?e:[...e].toSorted((t,r)=>{let n=a.triage.get(D(t))?.color?1:0,o=a.triage.get(D(r))?.color?1:0;if(n!==o)return o-n;let s=ve[re(t,a.severityMode)]||0,i=ve[re(r,a.severityMode)]||0;if(s!==i)return i-s;let l=t.confidence??-1;return(r.confidence??-1)-l})}function cn(e){return e.length===1?e[0]:Wn(e)[0]}function v$(e){let t=a.triage.get(D(e));return!!t?.comment||!!t?.fix||t?.flagged===!0}function ze(e){if(e.length===1)return e[0];let t=a.activeTabByGroup.get(Se(e));if(t){let o=e.find(s=>D(s)===t);if(o)return o}let r=Wn(e),n=r;if(a.filterAnalyzer||a.filterModel){let o=r.filter(Md);o.length>0&&(n=o)}return n.find(v$)??n[0]}function ga(e){for(let t of Rt().values())if(t.files.has(e.file))return t.repos&&t.repos.size===1?[...t.repos][0]:null;return e.repo?.github??e._repoFallback??a.repoUrl??null}function ge(e){let t=0,r=!1,n,o=!1,s=!1,i,l=!1,c=null,u=!1,p=!0;for(let v of e){let w=a.triage.get(D(v)),y=w?.triage??(jn(v)?"ignored":void 0),k=w?.color;k===void 0&&y===void 0||(t++,k!==void 0&&(o?k!==n&&(r=!0):(o=!0,n=k)),l?y!==i&&(s=!0):(l=!0,i=y),y?(c===null&&(c=y),y==="ignored"?p=!1:u=!0):p=!1)}let f=r||s,h=!f&&o?n:null,b=t>0&&p,m=!f&&c!==null?c:null;return{hasConflict:f,commonColor:h,anyTriage:u,allTriaged:b,commonTriage:m,isInProgress:m==="inprogress",isFixed:m==="fixed",isInvalid:m==="invalid",isDeleted:m==="deleted",isIgnored:m==="ignored"}}function kt(){let e=a.reports.flatMap(c=>c.groups),t=a.workspaceMerges;if(!t||t.length===0)return e;let r=e.map((c,u)=>u),n=c=>{let u=c;for(;r[u]!==u;)u=r[u];for(;r[c]!==u;){let p=r[c];r[c]=u,c=p}return u},o=(c,u)=>{let p=n(c),f=n(u);p!==f&&(r[p]=f)},s=new Map;for(let c=0;c<e.length;c++)for(let u of e[c])u.id&&s.set(u.id,c);for(let c of t){let u=-1;for(let p of c){let f=s.get(p);f!==void 0&&(u===-1?u=f:o(u,f))}}let i=new Set,l=[];for(let c=0;c<e.length;c++){let u=n(c);if(i.has(u))continue;i.add(u);let p=[];for(let y=c;y<e.length;y++)n(y)===u&&p.push(...e[y]);let f=new Set(p.map(y=>y.id).filter(Boolean)),h=[],b=new Set;for(let y of t)for(let k of y)b.has(k)||f.has(k)&&(h.push(k),b.add(k));if(h.length===0){l.push(p);continue}let m=new Map;for(let y of p)y.id&&!m.has(y.id)&&m.set(y.id,y);let v=new Set,w=[];for(let y of h){let k=m.get(y);k&&(w.push(k),v.add(k))}for(let y of p)v.has(y)||w.push(y);l.push(w)}return l}function Ar(e){for(let t of kt())if(Se(t)===e)return t;return null}var Od={"claude-security":"Claude Security","codex-security":"Codex Security",deepsec:"DeepSec",piolium:"Piolium"};function lm(e){return e==null?"(none)":Od[e]??e}function cm(e){return e??"(no model)"}var Ld=class extends U{static properties={analyzers:{attribute:!1},models:{attribute:!1},groups:{attribute:!1},_open:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.analyzers=[],this.models=[],this.groups=[],this._open=!1}render(){let t=this.analyzers.length>1,r=this.models.length>1;if(!t&&!r)return g;let n=a.filterAnalyzer===""?void 0:a.filterAnalyzer===Sr?null:a.filterAnalyzer,o=a.filterModel===""?void 0:a.filterModel===Cr?null:a.filterModel,s=new Map,i=new Map;for(let f of this.groups){let h=new Set,b=new Set;for(let m of f){let v=m._analyzer??null,w=gs(m);(o===void 0||w===o)&&h.add(v),(n===void 0||v===n)&&b.add(w)}for(let m of h)s.set(m,(s.get(m)??0)+1);for(let m of b)i.set(m,(i.get(m)??0)+1)}let l=n===void 0?null:lm(n),c=o===void 0?null:cm(o),u=l!=null&&c!=null?`${l} \xB7 ${c}`:l??c??(t?"All analyzers":"All models"),p=l!=null||c!=null;return d`<button type="button" class="${F({"analyzer-btn":!0,active:p})}" popovertarget="analyzer-select-menu" popovertargetaction="toggle" title="Filter by analyzer / model" aria-label="${`Filter by analyzer / model: ${u}`}"><span class="analyzer-btn-label">${u}</span> <svg viewBox="0 0 12 12" width="11" height="11" aria-hidden="true"><path d="M2 4l4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg></button><div popover="auto" id="analyzer-select-menu" class="analyzer-menu" @beforetoggle="${this._onToggle}">${t?this._column({dim:"analyzer",heading:"Analyzer",allLabel:"All analyzers",values:this.analyzers,sentinel:Sr,labelOf:lm,counts:s,current:a.filterAnalyzer}):g} ${t&&r?d`<div class="analyzer-menu-sep"></div>`:g} ${r?this._column({dim:"model",heading:"Model",allLabel:"All models",values:this.models,sentinel:Cr,labelOf:cm,counts:i,current:a.filterModel}):g}</div>`}_column({dim:t,heading:r,allLabel:n,values:o,sentinel:s,labelOf:i,counts:l,current:c}){return d`<div class="analyzer-menu-col" role="group" aria-label="${`Filter by ${t}`}"><div class="analyzer-menu-head">${r}</div><button type="button" aria-pressed="${String(c==="")}" class="${F({"analyzer-menu-item":!0,active:c===""})}" @click="${()=>this._pick(t,"")}"><span class="analyzer-menu-label">${n}</span></button> ${o.map(u=>{let p=u??s,f=l.get(u)??0,h=c===p;return d`<button type="button" aria-pressed="${String(h)}" class="${F({"analyzer-menu-item":!0,active:h,zero:f===0})}" @click="${()=>this._pick(t,p)}"><span class="analyzer-menu-label">${i(u)}</span><span class="analyzer-menu-count">${f}</span></button>`})}</div>`}_pick(t,r){let n=t==="analyzer"?a.filterAnalyzer:a.filterModel,o=r!==""&&n===r?"":r;this.dispatchEvent(new CustomEvent("analyzer-change",{detail:{analyzer:t==="analyzer"?o:a.filterAnalyzer,model:t==="model"?o:a.filterModel},bubbles:!0,composed:!0}))}_onToggle=t=>{this._open=t.newState==="open",this._open&&this._position()};_position(){let t=this.querySelector(".analyzer-menu"),r=this.querySelector(".analyzer-btn");if(!t||!r)return;let n=r.getBoundingClientRect(),o=t.offsetWidth||240,s=t.offsetHeight||200,i=4,l=n.left;l+o>window.innerWidth-4&&(l=window.innerWidth-o-4),l<4&&(l=4);let c=n.bottom+i;c+s>window.innerHeight-4&&n.top>s+i&&(c=n.top-s-i),t.style.top=`${c}px`,t.style.left=`${l}px`}updated(){this._open&&this.querySelector(".analyzer-menu")?.matches(":popover-open")&&this._position()}};customElements.define("analyzer-select",Ld);function je(e){return e==="informational"?"info":e.replaceAll("_"," ")}function Pd(e,{variant:t="full"}={}){let r=a.severityMode,n=re(e,r),o=d`<span class="${`badge ${n}`}">${je(n)}</span>`,s=Qt(e),i=t==="tab"?null:ua(e);if(!s&&!i)return o;let l=i?`Corrected severity varies across reports \u2014 ${Object.entries(i).map(([C,T])=>`${C||"(this report)"}: ${je(T.severity)}`).join("; ")}`:null,c=i?d`<span class="badge-varies" title="${l}" aria-label="${l}">varies</span>`:g;if(!s)return d`<span class="${`badge-pair badge-pair-${t}`}">${o}${c}</span>`;let u=e.severity,p=Xt(e),f=e.correctedSeverityReason,h=(ve[p]??0)>(ve[u]??0),b=h?"up":"down",m=h?"\u25B2":"\u25BC",v=r!=="original",w=(v?`Corrected ${b} from ${je(u)}`:`Original severity \u2014 corrected ${b} to ${je(p)}`)+(f?` \u2014 ${f}`:""),y=`Severity ${je(n)}; ${v?`corrected ${b} from ${je(u)}`:`original, corrected to ${je(p)}`}${f?`; reason: ${f}`:""}`;if(t==="tab")return d`<span class="badge-pair badge-pair-tab" title="${w}" aria-label="${y}">${o}<span class="${`badge-corr-mark ${b}`}" aria-hidden="true">${m}</span></span>`;let k=v?u:p;return d`<span class="${`badge-pair badge-pair-${t}`}" title="${w}" aria-label="${y}">${o}<span class="badge-orig-wrap"><span class="${`badge-arrow ${b}`}" aria-hidden="true">${m}</span>${v?d`<span class="badge-pre" aria-hidden="true">was</span>`:g}<span class="${`badge-orig ${k}${v?" struck":""}`}">${je(k)}</span></span>${c}</span>`}function ma(e){if(!e)return"";for(let t of e.split(`
62
- `))if(t.trim())return t.trim();return""}function w$(e){if(!e)return{title:"",body:""};let t=e.indexOf(`
63
- `);if(t<0)return{title:"",body:e};let r=e.slice(t+1).replace(/^\s+/u,"");return r?{title:e.slice(0,t).trim(),body:r}:{title:"",body:e}}var dm=/\[[^\]\n]+\]\([^)\s]+\)|\*\*[^*\n]+\*\*|"[^"\n]+"|`[^`\n]+`/gu;function Nt(e){if(!e)return e;dm.lastIndex=0;let t=[],r=0,n;for(;(n=dm.exec(e))!==null;){n.index>r&&t.push(e.slice(r,n.index));let o=n[0].codePointAt(0);if(o===91){let s=Qg(n[0]);t.push(s?d`<a href="${s.url}" target="_blank" rel="noopener noreferrer" title="${s.url}">${s.label}</a>`:n[0])}else if(o===42)t.push(d`<strong>${n[0].slice(2,-2)}</strong>`);else{let s=o===96?"inline-code":"inline-quote";t.push(d`<span class="${s}">${n[0]}</span>`)}r=n.index+n[0].length}return r===0?e:(r<e.length&&t.push(e.slice(r)),t)}function k$(e){return nm(e).map(t=>typeof t=="string"?t:t.self?d`<a class="comment-self-ref" href="${t.url}" title="Show this finding">${t.label}</a>`:d`<a href="${t.url}" target="_blank" rel="noopener noreferrer" title="${t.url}">${t.label}</a>`)}function um(e,t,r="section"){return d`<div class="${r}"><div class="section-label">${e}</div>${t?d`<div class="section-body">${Nt(hs(t))}</div>`:g}</div>`}function $$(e){let t=Array.isArray(e.evidence)?e.evidence:[];if(t.length===0)return g;let r=e._repoFallback??a.repoUrl;return d`<div class="evidence"><div class="section-label">Evidence</div><ol class="evidence-list">${t.map(n=>{let o=Rd(n),s=Xg(n,e,r);return d`<li>${s?d`<a class="evidence-ref" href="${s}" target="_blank" rel="noopener" title="${s}">${o}</a>`:d`<span class="evidence-ref">${o}</span>`} ${n.text?d`<div class="evidence-note">${Nt(hs(n.text))}</div>`:g}</li>`})}</ol></div>`}function x$(e){let t=an(e,e._repoFallback??a.repoUrl),r=parseInt(e.line,10),n=Number.isFinite(r)?`${e.file}:${e.line}`:e.file;return t?d`<a href="${t}" target="_blank" rel="noopener">${n}</a>`:n}function _$(e,t){if(!t)return g;let r=t.slice(0,7),n=em(e,t);return n?d`<a href="${n}" target="_blank" rel="noopener" title="${t}">${r}</a>`:d`<span title="${t}">${r}</span>`}var ba=d`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><path class="bubble" d="M2.5 3h11a.5.5 0 0 1 .5.5v6.5a.5.5 0 0 1-.5.5H8.4l-3 2.6V10.5H2.5a.5.5 0 0 1-.5-.5V3.5a.5.5 0 0 1 .5-.5z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,ms=d`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><path class="wrench" d="M10.4 2.6a3 3 0 0 0-3.6 4.5L2 12l2 2 4.9-4.8a3 3 0 0 0 4.5-3.6l-1.8 1.8-1.5-.4-.4-1.5z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,S$=d`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><rect x="3" y="2.5" width="8" height="10" rx="1" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/><rect x="5.5" y="5" width="8" height="9" rx="1" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,C$=d`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"><path d="M6.2 11.2H4.8a3.2 3.2 0 0 1 0-6.4h1.4"/><path d="M9.8 4.8h1.4a3.2 3.2 0 0 1 0 6.4H9.8"/><path d="M5.6 8h4.8"/></g></svg>`,E$=d`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><g stroke="currentColor" stroke-width="1.2" stroke-linecap="round" fill="none"><line x1="8" y1="1.8" x2="8" y2="14.2"/><line x1="1.8" y1="8" x2="14.2" y2="8"/><line x1="3.6" y1="3.6" x2="12.4" y2="12.4"/><line x1="12.4" y1="3.6" x2="3.6" y2="12.4"/></g></svg>`,A$=d`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><circle cx="8" cy="8" r="6" fill="none" stroke="currentColor" stroke-width="1.2"/><circle cx="8" cy="8" r="1.7" fill="currentColor"/></svg>`,ya=d`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><path class="flag-cloth" d="M5 1.5h6v13l-3-2.7-3 2.7z" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linejoin="round"/></svg>`;function T$(e,t=!1){let r=a.triage.get(e)?.flagged===!0,n=r?"Remove flag":"Flag this finding";return d`<button type="button" class="${F({"mark-flag":!0,flagged:r})}" data-flag-toggle="${e}" title="${n}" aria-label="${n}" aria-pressed="${String(r)}">${ya}${t?d`<span class="mark-btn-label">${r?"Flagged":"Flag"}</span>`:g}</button>`}function I$(e){let t=ma(e.description)||e.file||"Security finding";return t.length>120?`${t.slice(0,119)}\u2026`:t}function R$(e){let t=an(e,e._repoFallback??a.repoUrl),r=parseInt(e.line,10),n=Number.isFinite(r)?`${e.file}:${e.line}`:e.file,o=[];e.file&&o.push(`File: ${t?`[${n}](${t})`:n}`),e.description&&o.push(e.description);let s=Hn(e);return s&&o.push(s),e.confidence!==void 0&&e.confidence!==null&&o.push(`Confidence: ${e.confidence}/10`),o.join(`
64
-
65
- `)}function M$(e){if(!a.currentWorkspace)return g;let t=e[0]?._reportName;if(!t)return g;let r=ne[nt(t)]??ne.default;return d`<span class="report-chip" title="${t}">${ye(r)}<span class="report-chip-label">${De(t)}</span></span>`}function pm(e,t,r,n,o=null){let s=M$(e),i=D(n),l=a.triage.get(i),c=l?.color??null,u=l?.comment??"",p=l?.fix??"",f=u?`Edit comment: ${u}`:"Add comment",h=p?`Edit fix link: ${p}`:"Add fix link (PR URL, etc.)",b=o==="focus",m=u?"Edit comment":"Comment",v=p?"Edit fix link":"Fix link",w=d`<button type="button" class="${F({"mark-comment":!0,"has-comment":u})}" title="${f}" aria-label="${f}">${ba}${b?d`<span class="mark-btn-label">${m}</span>`:g}</button>`,y=d`<button type="button" class="${F({"mark-fix":!0,"has-fix":p})}" title="${h}" aria-label="${h}">${ms}${b?d`<span class="mark-btn-label">${v}</span>`:g}</button>`,k=T$(i,b),C=d`<button type="button" class="mark-copy" title="Copy file, line, description, confidence to clipboard" aria-label="Copy finding details to clipboard">${S$}${b?d`<span class="mark-btn-label">Copy</span>`:g}</button>`,T=en(i)?d`<button type="button" class="mark-link" title="Copy a link to this finding" aria-label="Copy a link to this finding">${C$}${b?d`<span class="mark-btn-label">Link</span>`:g}</button>`:g,S=ga(n),M=rm(S,{title:I$(n),body:R$(n)}),I=M?d`<a class="mark-issue" href="${M}" target="_blank" rel="noopener" title="Create a pre-filled GitHub issue for this finding" aria-label="Create a GitHub issue for this finding">${A$}${b?d`<span class="mark-btn-label">Issue</span>`:g}</a>`:g,L=d`<button type="button" class="mark-claude" title="Open in Claude Code (claude://) with a confirm-and-fix prompt" aria-label="Open finding in Claude Code">${E$}${b?d`<span class="mark-btn-label">Claude</span>`:g}</button>`,j=d`<color-marker .selected="${c}"></color-marker>`,Ce=r.hasConflict?"change triage state (colors mismatch \u2014 acts per-tab)":t.length>1?"change triage state for the whole group":"change triage state";return d`${s}<span class="mark-action-group">${w}${y}${k}</span><span class="mark-action-group">${C}${T}${I}${L}</span>${j}${B$(e,Ce,o,r,n)}`}function F$(e){if(e.newState!=="open")return;let t=e.currentTarget,n=t.getRootNode().querySelector?.(`[popovertarget="${t.id}"]`);if(!n)return;let o=n.getBoundingClientRect(),s=t.offsetWidth||110,i=t.offsetHeight||100,l=4,c=o.right-s;c<4&&(c=4),c+s>window.innerWidth-4&&(c=window.innerWidth-s-4);let u=o.bottom+l;u+i>window.innerHeight-4&&o.top>i+l&&(u=o.top-i-l),t.style.top=`${u}px`,t.style.left=`${c}px`}function B$(e,t,r,n,o){let s=D(e[0]),i=D(o),l=n.hasConflict?a.triage.get(i)?.triage??(jn(o)?"ignored":null):n.commonTriage,c={inprogress:"In progress",fixed:"Fixed",invalid:"Invalid",deleted:"Deleted",ignored:"Ignored"},u={inprogress:"In progress",fixed:"Fixed",invalid:"Invalid",deleted:"Delete",ignored:"Ignore"},p=!!a.shownTriage,f=p?c[a.shownTriage]:null,h=["inprogress","fixed","invalid","deleted","ignored"],b=r==="focus",m;b?m=h.map(y=>({key:y,label:u[y]})):p?m=[{key:"restore",label:"Restore"},...h.filter(y=>y!==a.shownTriage).map(y=>({key:y,label:u[y]}))]:m=h.map(y=>({key:y,label:u[y]}));let v=["mark-triage-menu"];p&&v.push("with-label",`triage-state-${a.shownTriage}`);let w=`triage-menu-${s.replaceAll(/[^A-Za-z0-9_-]/gu,"_")}`;return d`<div class="triage-menu-wrap"><button type="button" class="${v.join(" ")}" popovertarget="${w}" popovertargetaction="toggle" title="${t}" aria-label="${t}">${f?d`<span class="mark-triage-label">${f}</span>`:g} <svg viewBox="0 0 12 12" width="11" height="11" aria-hidden="true"><path d="M2 4l4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg></button><div popover="auto" id="${w}" class="triage-menu" data-gid="${s}" role="menu" @beforetoggle="${F$}">${m.map(y=>d`<button type="button" class="${F({"triage-menu-item":!0,[`triage-menu-${y.key}`]:!0,active:l===y.key})}" data-triage-action="${y.key}" role="menuitem">${y.label}</button>`)}</div></div>`}function L$(e){let t=!!e?.comment,r=!!e?.fix,n=e?.flagged===!0;return!t&&!r&&!n?g:d`<span class="tab-marks">${t?d`<span class="has-comment" title="Has a comment">${ba}</span>`:g}${r?d`<span class="has-fix" title="Has a fix link">${ms}</span>`:g}${n?d`<span class="flagged" title="Flagged">${ya}</span>`:g}</span>`}function fm(e,t){let r=D(e),n=a.triage.get(r),o=n?.color,s=n?.triage,i=jn(e),l=["tab"];return t&&l.push("active"),o&&l.push(`tab-mark-${o}`),s?l.push(`tab-${s}`):i&&l.push("tab-ignored"),d`<button type="button" class="${l.join(" ")}" data-tid="${r}"><span class="tab-label">${Pd(e,{variant:"tab"})} ${e.confidence===void 0?g:d`<span class="tab-conf">${e.confidence}/10</span>`}${L$(n)}</span></button>`}function O$(e){if(a.viewMode==="table"||a.viewMode==="focus"){let t=e.confidence*10;return d`<div class="${`conf-ring ${re(e,a.severityMode)}`}"><svg viewBox="0 0 36 36" aria-hidden="true"><circle class="conf-ring-track" cx="18" cy="18" r="15.9155"/><circle class="conf-ring-arc" cx="18" cy="18" r="15.9155" style="${`stroke-dasharray: ${t} 100`}"></circle></svg> <span>${e.confidence}<small>/10</small></span></div><div class="value-label">Confidence</div>`}return d`<div class="conf-score"><strong>${e.confidence}</strong>/10</div><div class="value-label">Confidence</div>`}var P$=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/iu;function N$(e){if($n(e))return g;let t=e?.name;if(typeof t!="string"||!P$.test(t))return g;let r=e?.version,n=typeof r=="string"&&r.length>0,o=n?`https://www.npmjs.com/package/${t}/v/${encodeURIComponent(r)}`:`https://www.npmjs.com/package/${t}`,s=n?`${t}@${r}`:t;return d`<span class="line-num"><a class="npm-link" href="${o}" target="_blank" rel="noopener noreferrer" title="${`Open ${s} on npmjs.com`}">npm: ${s}</a></span>`}function D$(e,t,r=0,n=1,o=null){let s=D(e),i=a.triage.get(s),l=i?.comment??"",c=i?.fix??"",u=an(e,e._repoFallback??a.repoUrl),p=parseInt(e.line,10),f=Number.isFinite(p)?`${e.file}:${e.line}`:e.file,h=u?d`<a href="${u}" target="_blank" rel="noopener">${f}</a>`:f,b=on(e),m=b?d`<span class="line-num">${h}, ${b}</span>`:d`<span class="line-num">${h}</span>`,v=sn(e),w=o==="focus"?N$(e.package?.npm):g,y=g;if(o!=="focus"&&e.fileHash&&Array.isArray(e._bundleHashes)&&e._bundleHashes.length>0){let L=new Set(e._bundleHashes),j=Zr(e.fileHash).find(({integrity:Ce})=>L.has(Ce));j&&(y=d`<button type="button" class="finding-code-btn" data-finding-code-bundle="${j.integrity}" data-finding-code-file="${j.file}" data-finding-code-line="${e.line??""}" title="${`Open ${j.file} in bundle source viewer`}">Code</button>`)}let{title:k,body:C}=w$(pt(e.description,e)),T=Jg(C),S=T.findIndex(L=>L.label!==null),M=S===-1?T:T.slice(0,S),I=S===-1?[]:T.slice(S);return d`<div class="${F({"tab-body":!0,active:t})}" data-tid="${s}">${n>1?d`<div class="print-case-label">${r+1} of ${n}</div>`:g}<div class="finding-left">${Pd(e,{variant:"full"})}<div class="value-label">Severity</div>${e.confidence===void 0?g:O$(e)} ${y}</div><div><div class="line-row">${m} ${w} ${e.discoveredIn?d`<span class="line-num discovered-in">(found analyzing ${e.discoveredIn})</span>`:g} ${v?d`<span class="run-meta">${v}</span>`:g}</div>${k?d`<div class="desc-title">${k}</div>`:g} ${M.map(L=>d`<div class="desc">${Nt(hs(L.body))}</div>`)} ${$$(e)} ${I.map(L=>L.label===null?d`<div class="desc">${Nt(hs(L.body))}</div>`:um(L.label,L.body))} ${e.recommendation?um("Recommendation",pt(e.recommendation,e),"recommendation"):g} ${e.confidenceReason?d`<div class="conf-reason">${Nt(pt(e.confidenceReason,e))}</div>`:g} ${Qt(e)&&e.correctedSeverityReason?d`<div class="severity-reason"><span class="severity-reason-label">Severity correction:</span> ${Nt(e.correctedSeverityReason)}</div>`:g} ${l?d`<div class="comment-block"><span class="comment-label">Comment:</span> ${k$(l)}</div>`:g} ${c?d`<div class="fix-block"><span class="fix-label">Fix:</span> ${Pt(c)?d`<a href="${c}" target="_blank" rel="noopener noreferrer">${c}</a>`:c}</div>`:g}</div></div>`}function Kn(e){return Se(e)}function hm(e){let t=ge(e),r=Wn(e),n=e.some(s=>s.critical||re(s,a.severityMode)==="critical"),o=["finding"];return n&&o.push("is-critical"),t.hasConflict?o.push("has-conflict"):t.commonColor&&o.push(`mark-${t.commonColor}`),a.shownTriage&&o.push(`triage-${a.shownTriage}`),r.length>1&&o.push("multi-case"),o}function gm(e,t={}){let{context:r=null}=t,n=ge(e),o=Wn(e),s=ze(e),i=D(s),l=s.commitHash?d`<div class="commit-ref">introduced in ${_$(s.repo?.github,s.commitHash)}</div>`:g,c=a.currentWorkspace&&l!==g;return d`${o.map((u,p)=>D$(u,D(u)===i,p,o.length,r))} ${c?d`<div class="marks-commit-row">${l}</div>`:g}<div class="marks"><div class="marks-left">${c?g:l} ${o.length>1?d`<div class="tabs">${o.map(u=>fm(u,D(u)===i))}</div>`:g}</div>${pm(e,o,n,s,r)}</div>`}function dn(e){return Se(e)}function mm(e){let t=ge(e),r=e.some(o=>o.critical||re(o,a.severityMode)==="critical"),n=[];return r&&n.push("is-critical"),t.hasConflict?n.push("has-conflict"):t.commonColor&&n.push(`mark-${t.commonColor}`),a.shownTriage&&n.push(`triage-${a.shownTriage}`),n}function bm(e){let t=ge(e),r=Wn(e),n=ze(e),o=D(n),s=n,i=ma(pt(s.description,s)),l=sn(s),c=on(s),u=c?`, ${c}`:"";return d`<div class="row-score">${Pd(s,{variant:"compact"})} ${s.confidence===void 0?g:d`<span class="row-conf"><strong>${s.confidence}</strong>/10</span>`}</div><div class="row-body"><div class="title-row"><span class="title">${i}</span> ${l?d`<span class="row-type">${l}</span>`:g}</div><div class="meta-row"><span class="row-loc">${x$(s)}${u}</span><div class="marks">${pm(e,r,t,n)}</div></div>${r.length>1?d`<div class="tabs-row"><div class="tabs">${r.map(p=>fm(p,D(p)===o))}</div></div>`:g}</div>`}function bs(e){return"tree-"+e.replaceAll(/[^\w-]+/gu,"_")}var vm=()=>Object.fromEntries(we.map(e=>[e,0]));function Nd(e,t){let r=new Map;for(let n of e)for(let o of n){r.has(o.file)||r.set(o.file,vm());let s=r.get(o.file),i=re(o,t);s[i]!==void 0&&s[i]++}return r}function Dd(e){let t=null;for(let r of e)if(r?.tree){t||(t={});for(let n of Object.keys(r.tree)){let o=r.tree[n];if(!t[n]){t[n]={...o,imports:[...o.imports??[]]};continue}let s=new Set(t[n].imports);for(let i of o.imports??[])s.has(i)||(s.add(i),t[n].imports.push(i));t[n].size==null&&o.size!=null&&(t[n].size=o.size)}}return t}function va(e,t){let r=new Map;for(let n of Object.keys(e)){let o=new Set,s=[...(e[n].imports??[]).filter(l=>e[l])];for(;s.length>0;){let l=s.pop();if(!o.has(l)){o.add(l);for(let c of e[l]?.imports??[])e[c]&&s.push(c)}}let i=vm();for(let l of o){let c=t.get(l);if(c)for(let u of we)i[u]+=c[u]??0}r.set(n,i)}return r}function zd(e,t,r){let n=t.get(e),o=r.get(e);return ym(n)>0||ym(o)>0}function ym(e){if(!e)return 0;let t=0;for(let r of we)t+=e[r]??0;return t}function wm(e){if(!e)return g;let t=Zr(e)[0];return t?d`<button type="button" class="tree-code-btn" data-finding-code-bundle="${t.integrity}" data-finding-code-file="${t.file}" title="${`Open ${t.file} in bundle source viewer`}">Code</button>`:g}function km(e,t){let r=Object.keys(e).toSorted(),n=new Map;for(let p of r)for(let f of e[p].imports??[]){let h=n.get(f)??[];h.push(p),n.set(f,h)}let o=a.filesSearch.trim().toLowerCase(),s=o?r.filter(p=>p.toLowerCase().includes(o)):r,i=p=>e[p]?d`<a href="${`#${bs(p)}`}"><span class="name">${p}</span></a>`:d`<span class="name">${p}</span>`,l=p=>{let f=t.get(p);if(!f)return null;let h=we.filter(b=>(f[b]??0)>0);return h.length===0?null:d`<span class="tree-count-chips">${h.map(b=>d`<span class="${`tree-count-chip ${b}`}">${f[b]} ${b.replaceAll("_"," ")}</span>`)}</span>`},c=p=>{let f=t.get(p);return f?we.reduce((h,b)=>h+(f[b]??0),0):0},u=d`<div class="tree-toolbar"><view-mode-buttons modes="table,list" kind="files"></view-mode-buttons><div class="search-row"><toolbar-search kind="files"></toolbar-search><span class="result-count">${s.length} of ${r.length}</span></div></div>`;if(a.filesViewMode==="table"){let p=a.filesSelectedFile&&e[a.filesSelectedFile]&&s.includes(a.filesSelectedFile)?a.filesSelectedFile:null;return d`<div class="${p?"tree-view tree-view-table with-details":"tree-view tree-view-table"}">${u}<div class="${p?"tree-table-layout open":"tree-table-layout"}"><div class="tree-table-list">${s.length===0?d`<div class="tree-table-empty">No files match the search.</div>`:g} ${s.map(b=>{let m=c(b),v=b===p,w=oe(e[b]?.size);return d`<div class="${`tree-table-row${v?" selected":""}${m===0?" clean":""}`}" data-tree-select="${b}"><span class="tree-table-name">${b}</span> ${l(b)??d`<span class="tree-table-clean-marker">—</span>`} ${w?d`<span class="tree-table-size">${w}</span>`:g}</div>`})}</div>${p?d`<aside class="tree-table-details" id="tree-table-details"><header class="tree-table-details-bar"><span class="tree-table-details-label">Details</span> <button type="button" class="tree-table-details-close" data-tree-deselect title="Close details" aria-label="Close details">×</button></header><div class="tree-table-details-body">${z$(e[p],p,n.get(p)??[],i)}</div></aside>`:g}</div></div>`}return d`<div class="tree-view">${u} ${s.length===0?d`<div class="tree-table-empty">No files match the search.</div>`:g} ${s.map(p=>{let f=e[p],h=n.get(p)??[],b=oe(f?.size);return d`<section class="tree-file" id="${bs(p)}"><div class="tree-file-header"><span class="name">${p}</span> ${l(p)} ${b?d`<span class="tree-file-size">${b}</span>`:g} ${wm(f.fileHash)}</div>${f.fileHash||f.treeHash?d`<div class="tree-hashes hashes">${f.fileHash?d`<div class="tree-hash">file: ${f.fileHash}</div>`:g} ${f.treeHash?d`<div class="tree-hash">tree: ${f.treeHash}</div>`:g}</div>`:g} ${f.imports?.length>0?d`<div class="tree-section"><span class="tree-section-label">imports</span><ul>${f.imports.map(m=>d`<li>${i(m)}</li>`)}</ul></div>`:g} ${h.length>0?d`<div class="tree-section"><span class="tree-section-label">imported by</span><ul>${h.map(m=>d`<li>${i(m)}</li>`)}</ul></div>`:g} ${f.exports?.length>0?d`<div class="tree-section"><span class="tree-section-label">exports</span><ul>${f.exports.map(m=>d`<li><span class="name">${m}</span></li>`)}</ul></div>`:g}</section>`})}</div>`}function z$(e,t,r,n){let o=oe(e?.size);return d`<div class="tree-detail-name"><span class="name">${t}</span> ${o?d`<span class="tree-detail-size">${o}</span>`:g} ${wm(e.fileHash)}</div>${e.fileHash||e.treeHash?d`<div class="tree-hashes hashes">${e.fileHash?d`<div class="tree-hash">file: ${e.fileHash}</div>`:g} ${e.treeHash?d`<div class="tree-hash">tree: ${e.treeHash}</div>`:g}</div>`:g} ${e.imports?.length>0?d`<div class="tree-section"><span class="tree-section-label">imports</span><ul>${e.imports.map(s=>d`<li>${n(s)}</li>`)}</ul></div>`:g} ${r.length>0?d`<div class="tree-section"><span class="tree-section-label">imported by</span><ul>${r.map(s=>d`<li>${n(s)}</li>`)}</ul></div>`:g} ${e.exports?.length>0?d`<div class="tree-section"><span class="tree-section-label">exports</span><ul>${e.exports.map(s=>d`<li><span class="name">${s}</span></li>`)}</ul></div>`:g}`}function U$(){return{showAll:!1,splitOwnDirs:!1,packagesView:!1,selected:null,focusedPkg:null,topPkgsTab:"issues",edgeOpacity:.22,nodeSize:1,showLabels:!1,selectedSeverities:new Set,selectedColors:new Set,pathFilter:"",hidden:new Set,solo:null,graphState:null,layoutCache:null}}var Tr=U$(),A=new Proxy(Tr,{get(e,t){return Tr[t]},set(e,t,r){return Tr[t]=r,!0},has(e,t){return t in Tr},deleteProperty(e,t){return delete Tr[t]},ownKeys(){return Reflect.ownKeys(Tr)},getOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(Tr,t)}});function Re(){A.graphState?._cleanup&&A.graphState._cleanup(),A.graphState=null}function $m(){return Tr}var ys=null,xm=null;function qn(){return xm}function H$(){return ys||(ys=(async()=>{let e="./graph.js";try{let t=await import(e);return t._swapGraph2Impl($m()),xm=t,t}catch(t){throw ys=null,t}})(),ys)}async function Ud(e,t,r,n,o){try{let s=await H$(),i=s.buildGraphFromPrep(t);G(d`<graph-layout .graph="${i}" .options="${r}"></graph-layout>`,e);let l=e.querySelector("graph-layout");return await l.updateComplete,n(),o(),s.attachGraph2Interaction(e,i,n,o),l}catch(s){let i=s instanceof Error?s.message:String(s);return e.textContent=`Graph failed to load: ${i}`,null}}function We(e){let t=new Map;if(!e)return t;if(e.kind==="stasis"){if(!e.bundle)return t;for(let[r,n]of e.bundle.sources)typeof n=="string"&&t.set(r,n)}else if(e.kind==="sourcemap"){if(!e.json)return t;let r=e.json.sources??[],n=e.json.sourcesContent??[];for(let o=0;o<r.length;o++)typeof n[o]=="string"&&t.set(r[o],n[o])}return t}function Ir(e){if(e?.kind!=="stasis"||!e.bundle?.modules)return null;let t=new Map;for(let[r,n]of e.bundle.modules)for(let o of Object.keys(n.files))t.set(r==="."?o:`${r}/${o}`,r);return t}function vs(e){let t=new Map;if(e?.kind!=="stasis"||!e.bundle?.modules)return t;for(let[r,n]of e.bundle.modules){if(!r.includes("node_modules")||!n?.name||typeof n.version!="string"||!n.version)continue;let o=t.get(n.name);o||(o=new Set,t.set(n.name,o)),o.add(n.version)}return t}var ws=null,ks=null;function V$(){return ws||(ws=(async()=>{let e="./terminal.js";try{return await import(e)}catch(t){throw ws=null,t}})(),ws)}function j$(e){let t=We(e);if(t.size===0)return t;let r=[...t.keys()],{stripped:n}=ot(r),o=new Map;for(let s=0;s<r.length;s++)o.set(n[s],t.get(r[s]));return o}async function _m(e,t){let r=t?.integrity??"";(!ks||ks.integrity!==r)&&(ks={integrity:r,promise:W$(t,r)});try{let n=await ks.promise;return!e.isConnected||e.contains(n)||e.replaceChildren(n),n}catch(n){ks=null;let o=n instanceof Error?n.message:String(n);return e.textContent=`Terminal failed to load: ${o}`,null}}async function W$(e,t){return(await V$()).createTerminalElement(j$(e),t)}function Cm(e){if(!e)return null;let t=qg(),r=new RegExp(`^(?:.*/)?${t}/(@[^/]+/[^/]+|[^/]+)`,"u"),n=e.match(r);if(n)return n[1];let o=e.indexOf("/");return o>0?e.slice(0,o):"/"}var K$=["#4e9af1","#f28e2b","#59a14f","#e15759","#76b7b2","#edc948","#b07aa1","#ff9da7","#9c755f","#5cd1e5","#f1ce63","#d37295","#a0cbe8","#86bcb6","#8cd17d","#b6992d","#499894","#e15759","#e879c7","#d4a6c8"],Sm=["#2f8aef","#d2691e","#2ea043","#e63946","#2e9a92","#b88817","#9560e8","#d24a9c","#8a5d40","#0891b2","#a07a14","#c14e8e","#1f7ad0","#549b94","#3fb95f","#a07a14","#2a8278","#cb2c40","#c026d3","#965f93"];function q$(){if(typeof document>"u")return!1;let e=document.body?.classList;return!!e&&(e.contains("theme-light")||e.contains("theme-pink"))}var Hd=new Map;function Ye(e){let t=q$()?Sm:K$,n=`${t===Sm?"l":"d"}:${e??"__own__"}`;if(Hd.has(n))return Hd.get(n);let o=e??"__own__",s=0;for(let u of o)s=s*37+u.codePointAt(0)|0;let l=((s%t.length+t.length)%t.length*7+3)%t.length,c=t[l];return Hd.set(n,c),c}var Vd=(e,t,r)=>{for(let n of t)if(n[0]===e)return(0,n[1])();return r?.()};var Gn='<svg class="file-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2 2 5v6l6 3 6-3V5L8 2Z"/><path d="M2 5l6 3 6-3"/><path d="M8 8v6"/></svg>',wa='<svg class="file-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2.5" y="4" width="11" height="9" rx="1.2"/><path d="M6 4V3h4v1"/></svg>';var Em="@preventive/triage";function jd(e,t){let r=e.toLowerCase(),n="",o=r;if(r.startsWith("@")){let i=r.indexOf("/");i>0&&(n=r.slice(0,i),o=r.slice(i+1))}return`pkg:npm/${n?`${encodeURIComponent(n)}/`:""}${encodeURIComponent(o)}@${encodeURIComponent(t)}`}function ka(e){let t=/^(.*?)\.stasis\.(?:code|resources)\.br$/u.exec(e);return t?t[1]:e.replace(/\.[^.]+$/u,"")||e}function Am(e){let t=[];if(e?.kind!=="stasis"||!e.bundle?.modules)return t;let r=new Map;for(let[n,o]of e.bundle.modules){if(!o?.name||typeof o.version!="string"||!o.version)continue;let s=`${o.name}@${o.version}`,i=r.get(s);if(i!==void 0){n==="."&&(t[i].dir=".");continue}r.set(s,t.length),t.push({name:o.name,version:o.version,dir:n})}return t}function Tm(e){if(e?.kind!=="stasis"||!e.bundle?.modules)return!1;for(let[,t]of e.bundle.modules)if(t?.name&&typeof t.version=="string"&&t.version)return!0;return!1}function Im(e,t){let r=e.find(s=>s.dir===".")??null,n=r?e.filter(s=>s!==r):e;return{root:r?{name:r.name,version:r.version,purl:jd(r.name,r.version)}:{name:ka(t?.name??"bundle"),version:null,purl:null},rest:n}}function Rm(e){return e??globalThis.crypto.randomUUID()}function Mm(e,t,{now:r=new Date,uuid:n}={}){let o=Am(e),{root:s,rest:i}=Im(o,t),l={type:"application","bom-ref":s.purl??`application:${s.name}`,name:s.name};s.version&&(l.version=s.version),s.purl&&(l.purl=s.purl);let c={bomFormat:"CycloneDX",specVersion:"1.5",serialNumber:`urn:uuid:${Rm(n)}`,version:1,metadata:{timestamp:r.toISOString(),tools:{components:[{type:"application",name:Em}]},component:l},components:i.map(u=>{let p=jd(u.name,u.version);return{type:"library","bom-ref":p,name:u.name,version:u.version,purl:p}})};return`${JSON.stringify(c,null,2)}
66
- `}function G$(e){return{referenceCategory:"PACKAGE-MANAGER",referenceType:"purl",referenceLocator:e}}function Fm(e,t,{now:r=new Date,uuid:n}={}){let o=Am(e),{root:s,rest:i}=Im(o,t),l=ka(t?.name??"bundle"),c=r.toISOString().replace(/\.\d{3}Z$/u,"Z"),u=(m,v,w,y)=>{let k={SPDXID:m,name:v,downloadLocation:"NOASSERTION",filesAnalyzed:!1,licenseConcluded:"NOASSERTION",licenseDeclared:"NOASSERTION",copyrightText:"NOASSERTION"};return w&&(k.versionInfo=w),y&&(k.externalRefs=[G$(y)]),k},p="SPDXRef-Package-root",f=[u(p,s.name,s.version,s.purl)],h=[{spdxElementId:"SPDXRef-DOCUMENT",relationshipType:"DESCRIBES",relatedSpdxElement:p}];i.forEach((m,v)=>{let w=`SPDXRef-Package-${v+1}`;f.push(u(w,m.name,m.version,jd(m.name,m.version))),h.push({spdxElementId:p,relationshipType:"DEPENDS_ON",relatedSpdxElement:w})});let b={spdxVersion:"SPDX-2.3",dataLicense:"CC0-1.0",SPDXID:"SPDXRef-DOCUMENT",name:l,documentNamespace:`https://spdx.org/spdxdocs/${encodeURIComponent(l)}-${Rm(n)}`,creationInfo:{created:c,creators:[`Tool: ${Em}`]},packages:f,relationships:h};return`${JSON.stringify(b,null,2)}
67
- `}function Y$(e,t){let r=t?"gu":"giu",n=t?"g":"gi";try{return{re:new RegExp(e,r)}}catch{try{return{re:new RegExp(e,n)}}catch(o){return{error:o.message}}}}function Wd(e,t,r){if(t){let s=Y$(e,r);if(s.error)return{error:s.error};let{re:i}=s;return{ranges(l){i.lastIndex=0;let c=[],u;for(;(u=i.exec(l))!==null;){if(u[0].length===0){i.lastIndex++;continue}if(c.push([u.index,u.index+u[0].length]),c.length>=50)break}return c}}}let n=r?e:e.toLowerCase(),o=n.length;return{ranges(s){let i=r?s:s.toLowerCase(),l=[],c=0,u;for(;(u=i.indexOf(n,c))!==-1&&(l.push([u,u+o]),c=u+o,!(l.length>=50)););return l}}}function J$(e,t){let r=[...e.keys()].toSorted(),n=[],o=0,s=!1;for(let i of r){let l=e.get(i);if(typeof l!="string")continue;let c=l.split(`
68
- `),u=[];for(let p=0;p<c.length;p++){let f=t.ranges(c[p]);if(f.length!==0&&(u.push({ln:p+1,ranges:f}),o++,o>=5e3)){s=!0;break}}if(u.length>0&&n.push({path:i,lines:c,hits:u}),s)break;if(n.length>=500){s=!0;break}}return{fileResults:n,totalHits:o,truncated:s}}function X$(e,t){let r=[],n=0;for(let{path:o,lines:s,hits:i}of e.fileResults){let l=[];for(let{ln:c}of i){let u=t.ranges(s[c-1]);u.length!==0&&(l.push({ln:c,ranges:u}),n++)}l.length>0&&r.push({path:o,lines:s,hits:l})}return{fileResults:r,totalHits:n,truncated:!1}}var Je={tag:null,useRegex:!1,caseSensitive:!1,entries:[]};function Bm(e,t,r,n,o){if(!r)return{fileResults:[],totalHits:0,truncated:!1};let s=Wd(r,n,o);if(s.error)return{error:s.error};(Je.tag!==e||Je.useRegex!==n||Je.caseSensitive!==o)&&(Je.tag=e,Je.useRegex=n,Je.caseSensitive=o,Je.entries.length=0);let i=n||o?f=>f:f=>f.toLowerCase(),l=i(r),c=null,u=-1;for(let f=0;f<Je.entries.length;f++){let h=Je.entries[f],b=i(h.query);if(b===l)return Je.entries.splice(f,1),Je.entries.unshift(h),h.result;n||h.result.truncated||b.length<=u||!l.includes(b)||(c=h.result,u=b.length)}let p=c?X$(c,s):J$(t,s);return Je.entries.unshift({query:r,result:p}),Je.entries.length>8&&Je.entries.pop(),p}function ft(e,{splitOwnDirs:t=!0,packageDir:r=null}={}){let n=/(?:^|\/)(?:node_modules|dependencies)\/(@[^/]+\/[^/]+|[^/]+)/gu,o;for(;(o=n.exec(e))!==null;)if(o[1]!==".pnpm")return o[1];if(r&&r!=="."&&!r.includes("node_modules"))return r;if(t){let s=e.indexOf("/");if(s>0)return e.slice(0,s)}return"__own__"}function Lm(e,t=null){let r=new Set;for(let n of e){let o=t?.(n)??null;if(ft(n,{splitOwnDirs:!1,packageDir:o})==="__own__"&&(r.add(ft(n,{splitOwnDirs:!0,packageDir:o})),r.size>1))return!0}return!1}var $a=null;function Q$(){return $a||($a=(async()=>await import("./prism.js"))(),$a)}var Z$={js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"jsx",ts:"typescript",mts:"typescript",cts:"typescript",tsx:"tsx",json:"json",css:"css",html:"markup",htm:"markup",xml:"markup",svg:"markup",yml:"yaml",yaml:"yaml",sh:"bash",bash:"bash",md:"markdown",markdown:"markdown",sol:"solidity",php:"php",phtml:"php",rs:"rust"};function xa(e){if(typeof e!="string")return null;let t=e.lastIndexOf(".");return t<0?null:Z$[e.slice(t+1).toLowerCase()]??null}async function _a(e,t){if(!t)return null;try{return(await Q$()).highlight(e,t)}catch{return null}}var ke=`.lwd-body{margin:.2rem 0 .55rem;color:var(--text);font-size:.86rem;line-height:1.5}.lwd-empty{margin:.2rem 0 .55rem;color:var(--muted);font-size:.78rem}.lwd-note{margin:.2rem 0 .65rem;padding:.55rem .7rem;border:1px solid var(--border);border-radius:6px;background:rgb(from var(--text) r g b / .03);color:var(--muted);font-size:.78rem;line-height:1.45}.lwd-choice{margin:.2rem 0 .65rem;padding:.55rem .7rem .6rem;border:1px solid var(--border);border-radius:6px;background:rgb(from var(--text) r g b / .03);& legend{padding:0 .35rem;color:var(--text);font-size:.78rem;font-weight:500;& strong{font-weight:600}}}.lwd-option{display:flex;align-items:flex-start;gap:.5rem;padding:.3rem .15rem;& input[type=radio]{margin:.15rem 0 0;accent-color:var(--accent)}.lwd-option-text{display:flex;flex-direction:column;gap:.1rem;min-width:0}.lwd-option-title{color:var(--text);font-size:.82rem;line-height:1.35}.lwd-option-hint{color:var(--muted);font-size:.72rem;line-height:1.4}}.lwd-list{margin:0;padding-left:1.1rem;color:var(--muted);font-size:.76rem;line-height:1.5;& li+li{margin-top:.2rem}& strong{color:var(--text);font-weight:600}}.lwd-kind-tag{display:inline-block;vertical-align:middle;margin-left:.3rem;padding:0 .35rem;border:1px solid var(--border);border-radius:3px;background:rgb(from var(--text) r g b / .04);color:var(--muted);font-size:.62rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em}.lwd-rename-input{margin-top:.2rem}.lwd-rename-error{margin:.25rem 0 0;color:var(--critical, #f87171);font-size:.72rem;line-height:1.35}
69
- `;var Kd=class extends R{static styles=[...R.styles,B(ke)];static properties={reportName:{type:String},workspaceNames:{type:Array},existingNames:{type:Object},_choice:{state:!0},_newName:{state:!0}};constructor(){super(),this.reportName="",this.workspaceNames=[],this.existingNames=new Set,this._choice="replace",this._newName=""}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_onClose=()=>this._finish({action:"cancel"});_onCancel=()=>this._finish({action:"cancel"});_onChoiceChange=t=>{this._choice=t.target.value};_onNewNameInput=t=>{this._newName=t.target.value};_onNewNameKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._onConfirm())};_onConfirm=()=>{if(this._choice==="rename"){let t=(this._newName??"").trim();if(!this._isRenameValid(t))return;this._finish({action:"rename",newName:t});return}this._finish({action:"replace"})};_replaceHint(){let t=this.workspaceNames.length;if(t===0)return d`<span class="lwd-option-hint">The local file will be overwritten.</span>`;let r=t===1?d`workspace <strong>"${this.workspaceNames[0]}"</strong>`:d`<strong>${t}</strong> workspaces (${this.workspaceNames.join(", ")})`;return d`<span class="lwd-option-hint">The local file will be overwritten. When sync is online, the new bytes are also uploaded to ${r} so the cloud copy matches.</span>`}_renameValidationTpl(t){return t?t===this.reportName?d`<p class="lwd-rename-error">Pick a name different from the original.</p>`:t.includes("\0")?d`<p class="lwd-rename-error">The new name cannot contain a NUL byte.</p>`:t.includes("/")||t.includes("\\")?d`<p class="lwd-rename-error">The new name cannot contain "/" or "\\".</p>`:this.existingNames.has(t)?d`<p class="lwd-rename-error">A file named "${t}" already exists — pick something else.</p>`:g:d`<p class="lwd-rename-error">Enter a new name.</p>`}_isRenameValid(t){return t.length>0&&t!==this.reportName&&!t.includes("\0")&&!t.includes("/")&&!t.includes("\\")&&!this.existingNames.has(t)}render(){let t=this._choice==="rename",r=(this._newName??"").trim(),n=t&&!this._isRenameValid(r),o=t?"Rename":"Replace",s=t?"primary":"danger",i=this.workspaceNames.length>0?d`<span class="lwd-option-hint">Saved as an unfiled report — the renamed copy isn't added to any workspace.</span>`:g;return d`<dialog @close="${this._onClose}"><header><h3>Import conflict</h3></header><p class="lwd-body"><strong>"${this.reportName}"</strong> already exists with different content.</p><fieldset class="lwd-choice"><legend>What should happen?</legend><label class="lwd-option"><input type="radio" name="icd-choice" value="replace" ?checked="${this._choice==="replace"}" @change="${this._onChoiceChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Replace</span> ${this._replaceHint()}</span></label> <label class="lwd-option"><input type="radio" name="icd-choice" value="rename" ?checked="${this._choice==="rename"}" @change="${this._onChoiceChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Rename to</span> <input type="text" class="nwd-input lwd-rename-input" maxlength="200" .value="${this._newName}" ?disabled="${!t}" @input="${this._onNewNameInput}" @keydown="${this._onNewNameKeydown}" @focus="${()=>{this._choice="rename"}}"> ${i} ${t?this._renameValidationTpl(r):g}</span></label></fieldset><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="${s}" ?disabled="${n}" @click="${this._onConfirm}">${o}</button></footer></dialog>`}};customElements.define("import-conflict-dialog",Kd);function Om({name:e,workspaceNames:t,existingNames:r}={}){let n=r instanceof Set?r:new Set(r??[]);return new Promise(o=>{let s=document.createElement("import-conflict-dialog");Object.assign(s,{reportName:e??"",workspaceNames:Array.isArray(t)?t:[],existingNames:n,_newName:tx(e??"",n)}),s.addEventListener("resolve",i=>{s.remove(),o(i.detail)}),s.addEventListener("modal-conflict",()=>{s.remove(),o({action:"cancel"})}),document.body.append(s)})}function tx(e,t){if(typeof e!="string"||e.length===0)return"";let r=e.lastIndexOf("."),n=r>0?e.slice(0,r):e,o=r>0?e.slice(r):"",s=n.replace(/-\d+$/u,"");for(let i=2;i<1e3;i++){let l=`${s}-${i}${o}`;if(!t.has(l))return l}return""}var rx=new Set(["module","commonjs","json","module-typescript","commonjs-typescript"]),nx=new Set(["solidity","php","shell","rust"]),ox=new Set(["java","kotlin","gradle","objc","objcpp","swift","c","cpp","c-header","cpp-header","ruby","cmake","podspec","podfile","podfile-lock","template","xml","env","fastlane","pbxproj"]),sx=new Set(["resource","resource:base64"]),Dm=new Set(["stat:file","stat:directory"]),zm=new Set([...rx,...nx,...ox,...sx,"patch","directory",...Dm]),qd=e=>Dm.has(e),Pm=e=>e==="directory"||e==="stat:directory"?"directory":"file";function ix(e,t,r){if(e===t)return e;let n=qd(e),o=qd(t);if(n!==o&&Pm(e)===Pm(t))return n?t:e;throw new Error(`format conflict for '${r}' ('${t}' vs '${e}')`)}function Yn(e,t){return t===""?e:e==="."?t:`${e}/${t}`}function Um(e,{scope:t="full"}={}){let r=new Set;for(let[n,{files:o}]of e)if(!(t!=="full"&&!Qn(n)))for(let s of Object.keys(o))r.add(Yn(n,s));return r}function ax(e,{what:t,files:r,formats:n,scope:o}){if(ht(e))return"escapes the root";if(o!=="full"&&!Qn(e))return`is outside node_modules, which a '${o}'-scope ${t} does not record`;if(!r.has(e))return`names no file the ${t} records`;let s=n.get(e);return s==="directory"?"is a directory capture, not a file":qd(s)?`is a payload-free '${s}' record, not a file`:null}function Hm(e,{what:t,files:r,formats:n,scope:o}){for(let s of e){let i=ax(s,{what:t,files:r,formats:n,scope:o});H(i===null,`${t}: executable entry '${s}' ${i}`)}}function Vm(e,{what:t,files:r,formats:n,scope:o="full"}){if(e===void 0)return new Set;let s=`${t}: executable`;H(Array.isArray(e),`${s} must be an array of file paths`);let i=new Set;for(let l of e)H(typeof l=="string"&&l!=="",`${s} entry must be a non-empty string`),H(!i.has(l),`${s} entry '${l}' is listed twice`),i.add(l);return Hm(i,{what:t,files:r,formats:n,scope:o}),i}function jm(e,{what:t,modules:r,formats:n,scope:o}){if(e.size!==0)return Hm(e,{what:t,files:Um(r,{scope:o}),formats:n,scope:o}),Sa(e)}function H(e,t){if(!e)throw new Error(t)}function Jn(e,t){let[r,n]=[e.split("/"),t.split("/")];for(;r.length>0&&r[0]===n[0];)r.shift(),n.shift();if(r.length===0&&n.length===0)return 0;if(r.length<2)return n.length<2&&r>n?1:-1;if(n.length<2)return 1;if(r[0]==="*")return-1;if(n[0]==="*"||r[0]==="node_modules")return 1;if(n[0]==="node_modules")return-1;let[o,s]=[r,n].map(i=>i.join(String.fromCodePoint(0)));if(o<s)return-1;if(o>s)return 1;throw new Error("Unreachable")}var xs=e=>e&&[null,Object.prototype].includes(Object.getPrototypeOf(e)),Xn=e=>Object.setPrototypeOf(Object.fromEntries(e),null),Sa=e=>[...e].toSorted((t,r)=>Jn(t,r)),$s=(e,{sorted:t=!0}={})=>{if(!t){let r=Object.create(null);for(let[n,o]of e)r[n]=o instanceof Map?$s(o,{sorted:t}):o;return r}return Xn([...e].toSorted((r,n)=>Jn(r[0],n[0])).map(([r,n])=>[r,n instanceof Map?$s(n,{sorted:t}):n]))},Gd=e=>new Map(Object.entries(e).map(([t,r])=>[t,xs(r)?Gd(r):r]));function ht(e){if(e.startsWith("/"))return!0;let t=0;for(let r of e.split("/"))if(!(r==="."||r==="")){if(r!=="..")t++;else if(--t<0)return!0}return!1}function lx(e,t){let r=e instanceof Map;if(r!==t instanceof Map)return!1;if(!r)return e===t;if(e.size!==t.size)return!1;for(let[n,o]of e)if(t.get(n)!==o)return!1;return!0}var Nm=e=>e instanceof Map?`{${[...e].map(([t,r])=>`${t}: ${r}`).join(", ")}}`:e;function Wm(e,t,r){let n=new Map,o=s=>{for(let[i,l]of s){let c=n.get(i);c===void 0&&n.set(i,c=new Map);for(let[u,p]of l){let f=c.get(u);f===void 0&&c.set(u,f=new Map);for(let[h,b]of p)f.has(h)?H(lx(f.get(h),b),`${r}: import '${h}' from '${u}' resolves differently ('${Nm(f.get(h))}' vs '${Nm(b)}')`):f.set(h,b instanceof Map?new Map(b):b)}}};return o(e),o(t),n}function Km(e,t,r){let n=new Map,o=s=>{for(let[i,l]of s){let c=n.get(i);if(c===void 0){n.set(i,l);continue}try{n.set(i,ix(l,c,i))}catch(u){throw new Error(`${r}: ${u.message}`,{cause:u})}}};return o(e),o(t),n}function qm(e,t,r,n){if(e.size===0)return new Set(t);let o=Um(r,{scope:n}),s=new Set(t);for(let i of e)o.has(i)||s.add(i);return s}function Gm(e,t,r){let n=new Map,o=s=>{for(let[i,l]of s){let c=n.get(i);if(c===void 0){n.set(i,{name:l.name,version:l.version,...l.ecosystem===void 0?{}:{ecosystem:l.ecosystem},files:Object.assign(Object.create(null),l.files)});continue}H(c.name===l.name,`${r}: module '${i}' name mismatch ('${c.name}' vs '${l.name}')`),H(c.version===l.version,`${r}: module '${i}' version mismatch ('${c.version}' vs '${l.version}')`),H(c.ecosystem===l.ecosystem,`${r}: module '${i}' ecosystem mismatch ('${c.ecosystem??"(none)"}' vs '${l.ecosystem??"(none)"}')`);for(let[u,p]of Object.entries(l.files))Object.hasOwn(c.files,u)?H(c.files[u]===p,`${r}: content mismatch for '${Yn(i,u)}'`):c.files[u]=p}};return o(e),o(t),n}function Qn(e){return e.split("/").includes("node_modules")}function cx(e){let t="node_modules/",r=e.length;for(;(r=e.lastIndexOf(t,r-1))!==-1;)if(r===0||e[r-1]==="/")return r;return-1}function Ym(e){let t="node_modules/",r=cx(e);if(r===-1)return null;let n=r+t.length,o=e.slice(n).split("/"),s=o[0].startsWith("@")?2:1;if(o.length<=s||o.slice(0,s).some(l=>!l))return null;let i=o.slice(0,s).join("/");return{dir:e.slice(0,n)+i,rel:o.slice(s).join("/"),name:i}}var Rr=1,Jm=0,Xm=({name:e,version:t,ecosystem:r,files:n})=>(H(r===void 0||typeof r=="string"),{name:e,version:t,...r===void 0?{}:{ecosystem:r},files:Xn(Object.entries(n))}),dx=e=>Ym(e)??{dir:".",rel:e,name:null},Qm=(e,t)=>{if(e===void 0)return t;if(t===void 0)return e;let r={};for(let n of[e,t])for(let[o,s]of Object.entries(n))r[o]=Sa(new Set([...r[o]??[],...s]));return r},Ca=class e{static VERSION=Rr;version=Rr;config;entries;modules;formats;imports;executable;reason;constructor({config:t={scope:"full"},entries:r,modules:n,formats:o,imports:s,executable:i,reason:l,version:c=Rr}={}){H([Jm,Rr].includes(c)),H(["node_modules","full"].includes(t.scope)),this.version=c,this.config=t,this.entries=r??new Set,this.modules=n??new Map,this.formats=o??new Map,this.imports=s??new Map,this.executable=i??new Set,this.reason=l}get sources(){let t=new Map;for(let[r,{files:n}]of this.modules)for(let[o,s]of Object.entries(n))t.set(Yn(r,o),s);return t}static isResourceFormat(t){return t==="resource"||t==="resource:base64"||t==="directory"}get hasCode(){for(let[t,{files:r}]of this.modules)for(let n of Object.keys(r))if(!e.isResourceFormat(this.formats.get(Yn(t,n))))return!0;return!1}static parse(t){let r=JSON.parse(t);H(r.version===Rr||r.version===Jm),H(["node_modules","full"].includes(r.config?.scope)),H(xs(r.formats)),H(xs(r.imports));let n=new Map;for(let[u,p]of Object.entries(r.formats)){H(!ht(u)),H(zm.has(p),`unknown format '${p}' for ${u}`);let f=u===""?".":u;H(!n.has(f),`duplicate format key '${f}'`),n.set(f,p)}let o=new Map,s=new Set;if(r.version===Rr){let u=r.config.scope==="full";if(r.modules!==void 0){H(typeof r.modules=="object"&&r.modules!==null);for(let[p,f]of Object.entries(r.modules))H(Qn(p)),H(!ht(p)),H(f?.name&&f.version&&f.files),o.set(p,Xm(f))}if(u){H(r.sources&&typeof r.sources=="object");for(let[p,f]of Object.entries(r.sources))H(!Qn(p)),H(!ht(p)),H(f?.name&&f.version&&f.files),o.set(p,Xm(f));H(r.entries===void 0||Array.isArray(r.entries)),s=new Set(r.entries)}else H(r.entries===void 0),H(r.sources===void 0);for(let[,{files:p}]of o)for(let f of Object.keys(p))H(!ht(f))}else{H(r.sources);for(let[u,p]of Object.entries(r.sources)){H(!ht(u));let{dir:f,rel:h,name:b}=dx(u);H(!ht(f)&&!ht(h)),o.has(f)||o.set(f,{name:b,version:null,files:Object.create(null)}),o.get(f).files[h]=p}}let i=new Set;for(let[u,{files:p}]of o)for(let f of Object.keys(p)){let h=Yn(u,f);H(!i.has(h),`duplicate file key '${h}' across bundle buckets`),i.add(h)}let l=Gd(r.imports),c=u=>{if(typeof u=="string"){H(!ht(u));return}H(u instanceof Map&&u.size>0,"import target must be a file or a non-empty {platform: file} map");for(let[p,f]of u)H(typeof p=="string"&&p.length>0&&!p.includes("/"),`invalid platform key '${p}'`),H(typeof f=="string"),H(!ht(f))};for(let[,u]of l){H(u instanceof Map);for(let[p,f]of u){H(!ht(p)),H(f instanceof Map);for(let[,h]of f)c(h)}}return new e({version:r.version,config:r.config,entries:s,modules:o,formats:n,imports:l,executable:r.version===Rr?Vm(r.executable,{what:"bundle",files:i,formats:n,scope:r.config.scope}):new Set,reason:xs(r.reason)?r.reason:void 0})}#e(){let t=[],r=[];for(let[n,{name:o,version:s,ecosystem:i,files:l}]of this.modules){if(Object.keys(l).length===0)continue;let c=Qn(n);c&&H(o&&s&&l);let u=Xn(Object.entries(l).toSorted((f,h)=>Jn(f[0],h[0])));(c?t:r).push([n,{name:o,version:s,...i===void 0?{}:{ecosystem:i},files:u}])}return t.sort((n,o)=>Jn(n[0],o[0])),r.sort((n,o)=>Jn(n[0],o[0])),{modules:Xn(t),sources:Xn(r)}}serialize(){let t=Sa(this.entries),{modules:r,sources:n}=this.#e(),o=$s(this.formats),s=$s(this.imports),i={version:Rr,config:this.config};this.config.scope==="full"&&Object.assign(i,{entries:t,sources:n}),Object.assign(i,{modules:r,formats:o,imports:s});let l=jm(this.executable,{what:"bundle",modules:this.modules,formats:this.formats,scope:this.config.scope});return l!==void 0&&(i.executable=l),this.reason!==void 0&&(i.reason=this.reason),JSON.stringify(i,void 0,2)}withReason(t){let r=[...this.sources.keys()];return new e({version:this.version,config:this.config,entries:this.entries,modules:this.modules,formats:this.formats,imports:this.imports,executable:this.executable,reason:Qm(this.reason,{[t]:r})})}merge(t){return H(this.config.scope===t.config.scope,`bundle merge: scope mismatch ('${this.config.scope}' vs '${t.config.scope}')`),new e({config:{scope:this.config.scope},entries:new Set([...this.entries,...t.entries]),modules:Gm(this.modules,t.modules,"bundle merge"),formats:Km(this.formats,t.formats,"bundle merge"),imports:Wm(this.imports,t.imports,"bundle merge"),executable:qm(this.executable,t.executable,t.modules,this.config.scope),reason:Qm(this.reason,t.reason)})}};var Ea=null,Aa=null,Ta=null;function ux(){for(let e of["br","brotli"])try{return new DecompressionStream(e),e}catch{}return null}async function px(e,t){let r=new Blob([t]).stream().pipeThrough(new DecompressionStream(e));return new Uint8Array(await new Response(r).arrayBuffer())}async function fx(){if("serviceWorker"in navigator)try{let e=await navigator.serviceWorker.getRegistrations();for(let t of e){let r=t.active?.scriptURL??t.installing?.scriptURL??t.waiting?.scriptURL;r&&r.endsWith("/brotli-sw.js")&&await t.unregister()}}catch{}}function hx(){return Ta||(Ta=(async()=>await import("./brotli-fallback.js"))(),Ta)}async function gx(){await fx();let e=ux();return e?(Ea={kind:"native",format:e},Ea):(Ea={kind:"fallback"},Ea)}function Zm(){return Aa||(Aa=gx(),Aa)}async function eb(e){let t=await Zm();return t.kind==="native"?px(t.format,e):(await hx()).brotliDecompress(e)}Zm().catch(()=>{});async function Zn(e,t){try{let r=await jt(e),n=t.name.toLowerCase().endsWith(".map"),o=n?"sourcemap":"stasis";try{if(n){let l=JSON.parse(xe(r));return{integrity:e,kind:o,size:r.byteLength,json:l}}let s=xe(await eb(r)),i=Ca.parse(s);return{integrity:e,kind:o,size:r.byteLength,bundle:i}}catch(s){return{integrity:e,kind:o,size:r.byteLength,error:s.message}}}catch(r){return{integrity:e,error:r.message,size:0}}}function mx(e){!e?.json&&!e?.bundle||(async()=>{try{let t=await Jd(e);if(Hi(e.integrity,t),a.selectedBundle!==e.integrity)return;e.fileHashes=t,x()}catch{}})()}async function Yd(e){if(vc(e))return;let t=(a.bundles??[]).find(n=>n.integrity===e);if(!t)return;let r=await Zn(e,t);if(!(!r?.json&&!r?.bundle))try{let n=await Jd(r);Hi(e,n)}catch{}}async function Zt(e){let t=(a.bundles??[]).find(n=>n.integrity===e);if(!t)return;let r=await Zn(e,t);a.selectedBundle===e&&(a.bundleDetails=r,x(),mx(r),Mt().catch(()=>{}))}var bx=["finding_url","repository","title","description","severity","configured_scan_id","relevant_paths"];function yx(e){let t=[],r=[],n="",o=!1,s=e.length;for(let i=0;i<s;i++){let l=e[i];o?l==='"'?e[i+1]==='"'?(n+='"',i++):o=!1:n+=l:l==='"'?o=!0:l===","?(r.push(n),n=""):l===`
54
+ \u2022 Hardware security key: use the vendor's management tool`)}catch(e){alert(`Could not disable encryption: ${e?.message??e}`)}}async function P$(){await ga()}function Xm(){Md()}function Qm(e){if(!e||e===Fe)return;Fe=e;let t=!1;Fe.addEventListener("click",async()=>{if(!t){t=!0;try{if(!ae()){await P$();return}if(!$t()){await ba();return}await O$()}finally{t=!1}}}),Me(Md),Md()}var Zm=`.spd-list{margin:0 0 .8rem 1.15rem;color:var(--muted);font-size:.82rem;line-height:1.5;& li{margin:.3rem 0}& strong{color:var(--text);font-weight:600}}.spd-denied{color:light-dark(#b25b00,#f0a060);font-size:.78rem}code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.92em}
55
+ `;function Bd(){let e=navigator.userAgent;return/AppleWebKit/u.test(e)&&!/Chrome\/|Chromium|Edg\/|OPR\/|Android/u.test(e)?"webkit":/Firefox\//u.test(e)?"firefox":"chromium"}var Fd=class extends I{static styles=[...I.styles,F(Zm)];static properties={_retryDenied:{state:!0}};constructor(){super(),this._retryDenied=!1}focusInitial(){this.renderRoot.querySelector("button.primary")?.focus()}_onConfirm=()=>this._finish(null);_onRetry=async()=>{if(await Wn()){this._finish("granted");return}this._retryDenied=!0};_chromiumBody(){let t=location.hostname==="localhost"?d`Plain <code>localhost</code> can never qualify — for local testing open the app via <code>127.0.0.1</code> instead.`:m;return d`<p class="nwd-intro">Chromium-based browsers (Chrome, Edge, Brave, …) never show a prompt — persistence is granted silently, and only to sites the browser considers important. Any of these qualifies it:</p><ul class="spd-list"><li><strong>Install the app</strong> — the install icon at the right end of the address bar, or the browser menu's Install entry.</li><li><strong>Bookmark</strong> this page.</li><li>Keep using the site — regular visits raise its engagement score.</li></ul><p class="nwd-note">The browser re-evaluates on every request, so after any of the above press <strong>Try again</strong>.${t}</p>`}_firefoxBody(){return d`<p class="nwd-intro">Firefox asks with a permission prompt. A dismissed or blocked prompt is remembered, and the site can't re-ask until the old answer is cleared:</p><ol class="spd-list"><li>Click the permissions icon next to the address bar.</li><li>Clear the <strong>Store Data in Persistent Storage</strong> entry if it's blocked.</li><li>Press <strong>Try again</strong> below and choose <strong>Allow</strong>.</li></ol>`}_webkitBody(){return d`<p class="nwd-intro">Safari — and every iOS browser — additionally deletes a site's storage after <strong>7 days</strong> of browser use without interacting with the site, and no permission exempts a normal tab. Installing the app is what does:</p><ul class="spd-list"><li>On iPhone / iPad: open the <strong>Share</strong> menu, choose <strong>Add to Home Screen</strong>, and use the app from that icon.</li><li>In Safari on macOS: choose <strong>File → Add to Dock…</strong> and use the app from the Dock.</li><li>Installed web apps are exempt from the 7-day cleanup. Otherwise, use the site at least once a week.</li></ul>`}render(){let t=Bd(),r=t==="webkit"?this._webkitBody():t==="firefox"?this._firefoxBody():this._chromiumBody();return d`<dialog @close="${this._onClose}"><header><h3>Protect stored data</h3></header><p class="nwd-intro">Reports, bundles and triage live in the browser's <strong>best-effort storage</strong> — the browser is allowed to delete all of it at once under disk pressure or after long inactivity, without asking. The persistent-storage request that would prevent this was just declined.</p>${r}<footer class="nwd-actions">${this._retryDenied?d`<span class="spd-denied" role="status">Still not granted.</span>`:m} <span class="nwd-spacer"></span> ${t==="webkit"?m:d`<button type="button" @click="${this._onRetry}">Try again</button>`} <button type="button" class="primary" @click="${this._onConfirm}">Got it</button></footer></dialog>`}};customElements.define("storage-persist-dialog",Fd);function eg(){return new Promise(e=>{let t=document.createElement("storage-persist-dialog"),r=n=>{t.remove(),e(n)};t.addEventListener("resolve",n=>r(n.detail)),t.addEventListener("modal-conflict",()=>r(null)),document.body.append(t)})}var zt=null,Dt=null,Pd=!1,ya=!1,Ld=0;function Od(){return Bd()==="webkit"}function tg(e){return e>=1e9?`${(e/1e9).toFixed(1)} GB`:e>=1e6?`${(e/1e6).toFixed(1)} MB`:e>=1e3?`${(e/1e3).toFixed(1)} kB`:`${e} B`}function D$(){if(!zt)return;if(!Dt||Dt.persisted!==!1||!Pd){zt.hidden=!0;return}zt.hidden=!1;let e=Dt.usage===null||Dt.quota===null?"":` Using ${tg(Dt.usage)} of ${tg(Dt.quota)}.`;zt.querySelector(".storage-label").textContent="Storage at risk",zt.title="Reports, bundles and triage are in best-effort storage \u2014 the browser may delete them all under disk pressure or after long inactivity. "+(Od()?"Click for how to protect them (on Safari and iOS browsers this needs the app installed to the Home Screen or Dock).":"Click to request persistent storage \u2014 if the browser declines, instructions for enabling it follow.")+e}function ng(e,t){let r=t?" (user gesture)":"";if(e){console.info(`storage: persistent-storage request granted${r}`);return}let n=!Od()&&location.hostname==="localhost"?" Note: plain localhost can NEVER pass \u2014 Chromium keys site importance by registerable domain (IP literals excepted) and localhost has none; for local testing use 127.0.0.1 instead.":"";console.info(`storage: persistent-storage request not granted${r} \u2014 `+(Od()?"Safari ties persistence to install state; add the app to the Home Screen / Dock.":"Chromium-based browsers never prompt and silently deny origins they don't consider important; installing the app, bookmarking it, allowing notifications, or regular use flips the heuristic (re-evaluated on every request). Firefox shows a prompt instead.")+n)}async function va(){if(!zt)return;let[e,t]=await Promise.all([pd(),(async()=>{try{return(await ce()).length>0||await No()}catch{return!1}})()]);Dt=e,Pd=t,D$()}function Nd(){!zt||Ld||(Ld=setTimeout(()=>{Ld=0,va()},1e3))}async function rg(){if(ya||(await va(),Dt?.persisted!==!1||!Pd||ya))return;ya=!0;let e=await Wn();ng(e,!1),await va()}async function z$(){if(Dt&&Dt.persisted===!1){ya=!0;let e=await Wn();ng(e,!0),e||await eg()}await va()}function og(e){zt=e,zt&&(zt.addEventListener("click",()=>{z$()}),Lo((t,r)=>{Nd(),r==="save"&&rg()}),rg())}var gs='<path class="bg" d="M3 2h6l4 4v8H3z"/><path fill="rgba(0,0,0,.18)" d="M9 2v4h4Z"/>',se={default:`<svg class="file-icon brand-deepview" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true">${gs}<path class="fg" d="M7.843 6.719c-1.605 0-2.926 1.292-3.477 1.947.466.58 1.872 2.024 3.496 2.024s2.907-1.292 3.486-2.005c-.627-.703-1.88-1.966-3.505-1.966m.019 3.857c-1.51 0-2.802-1.263-3.353-1.9.55-.617 1.814-1.852 3.334-1.852 1.51 0 2.698 1.12 3.335 1.852-.533.618-1.787 1.9-3.316 1.9m-.019-3.42c-.826 0-1.577.694-1.577 1.596 0 .789.599 1.577 1.577 1.577.893 0 1.587-.684 1.587-1.577-.01-.779-.627-1.596-1.587-1.596m0 3.069a1.476 1.476 0 0 1-1.482-1.473c0-.722.599-1.491 1.482-1.491.846 0 1.482.693 1.492 1.491 0 .808-.618 1.473-1.492 1.473m.01-2.727c-.637 0-1.264.532-1.264 1.244 0 .627.475 1.235 1.245 1.245.684 0 1.254-.522 1.254-1.244 0-.58-.475-1.236-1.235-1.245m-.02 2.403a1.167 1.167 0 0 1-1.149-1.159c0-.532.456-1.14 1.169-1.149.56 0 1.149.427 1.159 1.15 0 .636-.485 1.158-1.179 1.158m-.769-1.833c-.19.238-.275.494-.237.864l.74.057zm1.026-.294c-.295-.057-.665 0-.912.228l.323.607zm.133.047-.38.56.988.114c-.057-.275-.323-.579-.608-.674m-.124.741.456.912c.21-.209.352-.484.314-.836zm-1.225.504a.97.97 0 0 0 .57.617l.399-.551zm.713.664c.313.076.636.01.845-.161l-.295-.618zm-.637 1.55c0 .028-.028.066-.066.066h-.59c-.028 0-.066-.028-.066-.066s.029-.066.067-.066h.579c.048 0 .076.028.076.066m.712 0c0 .028-.028.066-.066.066h-.437c-.028 0-.066-.028-.066-.066s.028-.066.066-.066h.437c.038 0 .066.028.066.066m.666 0c0 .028-.029.066-.067.066h-.37c-.029 0-.067-.028-.067-.066s.029-.066.067-.066h.37c.038 0 .067.028.067.066m-1.672.351c0 .029-.029.067-.067.067h-.295c-.028 0-.066-.028-.066-.066 0-.029.029-.067.067-.067h.294c.038 0 .066.028.066.066m.694 0c0 .029-.028.067-.066.067h-.409c-.028 0-.066-.028-.066-.066 0-.029.028-.067.066-.067h.399c.038 0 .076.028.076.066m.732 0c0 .029-.029.067-.067.067h-.465c-.029 0-.067-.028-.067-.066 0-.029.029-.067.067-.067h.465c.038 0 .067.028.067.066m-1.093.371a.065.065 0 0 1-.067.066h-.627c-.028 0-.075-.028-.066-.066 0-.028.029-.066.067-.066h.627c.038 0 .066.028.066.066m.684 0a.065.065 0 0 1-.066.066h-.39c-.028 0-.076-.028-.066-.066 0-.028.028-.066.066-.066h.39c.038 0 .066.028.066.066M5.088 6.263c-.019-.105-.114-.19-.237-.19s-.257.104-.257.237.105.238.247.238c.105 0 .218-.076.238-.18h.864v.826l.095-.048V6.31c0-.028-.019-.057-.048-.057h-.902zm-.237.19c-.076 0-.143-.066-.143-.143s.066-.142.143-.142.142.066.142.143c.01.076-.066.142-.143.142m2.89-.323H6.38l.418-.475v-.332a.255.255 0 0 0 .218-.248c0-.123-.114-.256-.256-.256s-.266.114-.266.257c0 .123.095.228.209.247v.284l-.456.523v.893l.095-.047v-.742h1.396c.029 0 .067-.009.067-.057 0-.028-.019-.047-.067-.047m-1.13-1.054c0-.076.066-.152.152-.152s.152.066.152.151c0 .076-.066.152-.152.152s-.152-.066-.152-.152m-.836 5.264h-.874c-.019-.105-.114-.219-.247-.219s-.256.105-.256.257c0 .132.114.275.266.275.104 0 .218-.076.237-.19h.827v.608l-.257.285a.3.3 0 0 0-.095-.019c-.133 0-.256.105-.256.228 0 .133.104.238.237.238.124 0 .247-.105.247-.238a.23.23 0 0 0-.057-.152l.285-.304v-.712c0-.029-.019-.058-.057-.058m-1.121.219a.16.16 0 0 1-.152-.161c0-.077.066-.162.152-.162s.152.066.152.152-.066.171-.152.171m.713 1.14c-.076 0-.143-.066-.143-.143s.066-.133.143-.133.142.067.142.143c0 .066-.066.133-.143.133m5.472-1.377a.24.24 0 0 0-.237.208h-1.13c-.029 0-.038.02-.038.048v.712l-.323.39h-.029a.245.245 0 0 0-.247.247c0 .133.114.256.247.256s.247-.113.247-.256a.26.26 0 0 0-.123-.219l.313-.38v-.674h1.083c.019.105.114.2.238.2.133 0 .266-.105.266-.257 0-.133-.105-.276-.266-.276m-1.758 1.767a.15.15 0 0 1-.143-.152c0-.075.067-.142.143-.142s.152.066.152.143a.15.15 0 0 1-.152.151m1.758-1.33a.15.15 0 0 1-.143-.152.147.147 0 0 1 .294.001.15.15 0 0 1-.152.151M8.917 5.55h-.399a.075.075 0 0 1-.076-.076c0-.028.029-.066.067-.066h.418c.028 0 .066.028.066.066s-.038.076-.076.076m.742 0H9.22c-.038 0-.067-.028-.067-.076 0-.028.029-.066.067-.066h.437c.038 0 .066.028.066.066s-.028.076-.066.076m.883 0h-.598c-.029 0-.067-.028-.067-.076 0-.028.029-.066.067-.066h.598c.028 0 .066.028.066.066s-.028.076-.066.076m-1.282.4h-.741c-.038 0-.076-.029-.076-.067s.028-.076.066-.076h.75c.039 0 .067.038.067.076 0 .029-.028.067-.066.067m.797 0h-.503c-.038 0-.076-.029-.076-.067s.028-.066.066-.066h.513c.038 0 .067.028.067.066 0 .029-.029.067-.067.067m.476 0h-.19c-.039 0-.067-.029-.067-.067s.028-.066.066-.066h.2c.028 0 .066.028.066.066 0 .029-.028.067-.075.067m-1.682.398h-.332c-.039 0-.077-.028-.077-.066s.029-.066.067-.066h.342c.038 0 .076.028.076.066s-.028.066-.076.066m.789 0h-.494c-.038 0-.067-.028-.067-.066s.029-.066.067-.066h.494c.038 0 .066.028.066.066s-.028.066-.066.066m.893 0h-.599c-.038 0-.076-.028-.076-.066s.028-.066.066-.066h.618c.028 0 .066.028.066.066s-.028.066-.076.066m.418.305a.69.69 0 0 0-.674.712c0 .086.019.18.048.257l.085.066c-.028-.085-.057-.171-.057-.304 0-.285.228-.646.598-.646.295 0 .599.228.599.636a.58.58 0 0 1-.599.59.8.8 0 0 1-.237-.048l.123.114a.4.4 0 0 0 .114.01c.39 0 .684-.276.684-.666 0-.313-.266-.712-.684-.722m.353.552-.019-.01-.161.19-.143-.01-.057-.047-.019-.133.19-.2a.28.28 0 0 0-.361.077c-.076.095-.076.209-.038.351l-.247.304.171.152.266-.266c.142.038.285.019.38-.095a.31.31 0 0 0 .038-.313"/></svg>`,"claude-security":`<svg class="file-icon brand-claude" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true">${gs}<path class="fg" d="m5.875 10.154 1.376-.772.023-.067-.023-.037h-.067l-.23-.015-.787-.02-.681-.03-.661-.035-.166-.035-.156-.205.016-.103.14-.094.2.018.442.03.665.046.481.028.714.075h.113l.016-.047-.039-.028-.03-.028-.687-.466-.744-.492-.39-.284-.21-.143-.106-.135-.046-.294.19-.21.258.017.065.018.26.2.557.43.726.535.106.089.042-.03.006-.022-.048-.08-.395-.713-.422-.726-.187-.301-.05-.18a1 1 0 0 1-.03-.213l.218-.296.12-.039.29.039.123.106.18.413.293.65.453.884.133.262.07.242.027.075h.046v-.043l.038-.497.069-.611.067-.787.023-.221.11-.266.218-.143.17.081.14.2-.02.13-.083.54-.163.846-.106.567h.062l.07-.07.287-.382.482-.602.213-.239.248-.264.159-.125h.301l.221.329-.099.34-.31.393-.256.333-.369.496-.23.397.021.032.055-.006.832-.177.45-.081.537-.092.243.113.026.115-.096.236-.573.141-.673.135-1.003.237-.012.01.014.017.452.042.193.01h.473l.88.066.23.153.138.186-.023.141-.354.181-.478-.113-1.116-.266-.383-.096h-.053v.032l.32.312.584.528.731.68.037.168-.094.133-.099-.014-.643-.484-.248-.218-.561-.472H9.08v.05l.129.189.684 1.027.035.315-.05.103-.177.062-.194-.036-.4-.561-.413-.632-.333-.567-.041.023-.197 2.116-.092.108-.212.082-.177-.135-.094-.218.094-.43.113-.561.092-.447.083-.554.05-.184-.004-.013-.04.006-.418.574-.636.858-.503.539-.12.048-.21-.108.02-.193.117-.172.696-.886.42-.549.27-.317-.001-.046h-.016l-1.85 1.201-.328.042-.142-.132.018-.218.067-.071.556-.383Z"/></svg>`,"codex-security":`<svg class="file-icon brand-codex" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true">${gs}<path class="fg" d="M11.04 8.364a1.72 1.72 0 0 0-.152-1.432 1.8 1.8 0 0 0-1.925-.846 1.8 1.8 0 0 0-.778-.498 1.8 1.8 0 0 0-.927-.05 1.8 1.8 0 0 0-.827.414 1.77 1.77 0 0 0-.507.767 1.8 1.8 0 0 0-.683.297 1.75 1.75 0 0 0-.499.549 1.75 1.75 0 0 0 .22 2.07 1.72 1.72 0 0 0 .151 1.432 1.8 1.8 0 0 0 1.926.846 1.77 1.77 0 0 0 1.333.587c.78 0 1.47-.496 1.707-1.227a1.8 1.8 0 0 0 .684-.298 1.75 1.75 0 0 0 .499-.548 1.75 1.75 0 0 0-.222-2.063m-2.667 3.678a1.33 1.33 0 0 1-.851-.304l.042-.024 1.413-.804a.23.23 0 0 0 .116-.199V8.747l.597.34q.01.005.011.015v1.629a1.323 1.323 0 0 1-1.328 1.31m-2.857-1.203a1.3 1.3 0 0 1-.158-.879l.042.025 1.414.805a.23.23 0 0 0 .23 0l1.729-.982v.68a.02.02 0 0 1-.01.018l-1.431.814a1.34 1.34 0 0 1-1.816-.48m-.372-3.037a1.32 1.32 0 0 1 .7-.574v1.656a.22.22 0 0 0 .114.197l1.72.979-.598.34a.02.02 0 0 1-.021 0L5.63 9.587a1.304 1.304 0 0 1-.487-1.791zm4.907 1.125L8.327 7.94l.596-.34a.02.02 0 0 1 .02 0l1.43.814a1.3 1.3 0 0 1 .512.528 1.3 1.3 0 0 1-.118 1.4 1.33 1.33 0 0 1-.595.436V9.122a.23.23 0 0 0-.12-.195m.594-.881-.042-.025-1.411-.812a.23.23 0 0 0-.232 0l-1.727.983v-.68a.02.02 0 0 1 .008-.018l1.429-.813a1.34 1.34 0 0 1 1.425.061 1.3 1.3 0 0 1 .55 1.298zM6.908 9.252l-.597-.34a.02.02 0 0 1-.012-.016V7.271c0-.249.073-.493.209-.703s.329-.378.557-.483a1.35 1.35 0 0 1 1.415.18l-.042.023-1.413.804a.23.23 0 0 0-.116.2zm.324-.69.77-.438.77.438v.875l-.768.437-.77-.437z"/></svg>`,deepsec:`<svg class="file-icon brand-vercel" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true">${gs}<path class="fg" d="m8 5.97 3.5 6.062h-7Z"/></svg>`,piolium:`<svg class="file-icon brand-piolium" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true">${gs}<path class="fg" d="M8 6.4 5.6 7.2v2.3c0 1.6 1 2.7 2.4 3.3 1.4-.6 2.4-1.7 2.4-3.3V7.2Z"/></svg>`};function st(e){let t=Jo(e);if(t==="deepsec")return"deepsec";if(t==="piolium")return"piolium";if(t==="claude-security")return"claude-security";let r=e.toLowerCase();return r.endsWith(".codex")?"codex-security":r.endsWith(".md")?"claude-security":"default"}function De(e){return e.toLowerCase().endsWith(".codex")?e.slice(0,-6).replaceAll("__","/"):e}var sg=globalThis[Symbol.for("@rray/frontend")];if(!sg)throw new Error("@rray/frontend global not installed; view.js must run before lazy bundles import this wrapper");var{LitElement:P5,html:Dd,nothing:ig,unsafeCSS:N5,render:D5,StateElement:z5,classMap:U5,repeat:H5,styleMap:V5}=sg;var $e={critical:6,high:5,medium:4,low:3,high_bug:2,bug:1,informational:0},xe=["critical","high","medium","low","high_bug","bug","informational"];function hg(e){return e!=null&&e in $e?e:null}function tr(e){return hg(e?.correctedSeverity)??e?.severity}function rr(e){let t=hg(e?.correctedSeverity);return t!=null&&t!==e?.severity}function ne(e,t){return t==="original"?e?.severity:tr(e)}function wa(e){let t=e?._correctedByReport;return t&&new Set(Object.values(t).map(n=>n?.severity)).size>1?t:null}var U$=["revalidation","refuted","unreachable","confirmed","partial","unknown"],H$=new Set(U$);function mt(e){let t=typeof e?.revalidate=="string"?e.revalidate.trim().toLowerCase():"";return H$.has(t)?t:""}function Hd(e){let t=mt(e);return t&&t!=="revalidation"?t:null}function ka(e){return mt(e)==="revalidation"}var V$=new Set(["refuted","unreachable"]);function Vd(e){return V$.has(mt(e))}var mg=[{value:"confirmed",label:"Confirmed",kinds:["confirmed","partial","revalidation"]},{value:"unreachable",label:"Unreachable",kinds:["unreachable"]},{value:"refuted",label:"Refuted",kinds:["refuted"]}];function jd(e){return mg.find(t=>t.value===e)?.kinds??null}var $a=["","exclude","only"];function gg(e,t){let r=jd(e);return r?.includes("partial")?t==="only"?["partial"]:t==="exclude"?["confirmed"]:r:r}function bg(e){let t=new Set(e);return mg.filter(r=>r.kinds.some(n=>t.has(n)))}function xa(e){return new RegExp(`(^|/)${e}/`,"u")}function yg(e){return new RegExp(`^(?:.*/)?${e}/(?:@[^/]+/[^/]+|[^/]+)/(.*)$`,"u")}var j$=xa("node_modules"),W$=xa("vendor"),bs="node_modules",vg=xa(bs),wg=yg(bs);function K$(e){e!==bs&&(bs=e,vg=xa(e),wg=yg(e))}function kg(e){let t=!1,r=!1,n=o=>(!t&&j$.test(o)&&(t=!0),!r&&W$.test(o)&&(r=!0),t);e:for(let o of e){for(let s of o.groups??[])for(let i of s)if(n(i.file))break e;if(o.tree){for(let s of Object.keys(o.tree))if(n(s))break e}}K$(t?"node_modules":r?"vendor":"dependencies")}function $g(){return bs}function Tr(e){return vg.test(e)}function ie(e){return typeof e!="number"||!Number.isFinite(e)?null:`${e.toLocaleString()} B`}function it(e){if(e.length<=1)return{prefix:"",stripped:[...e]};let t=e.map(i=>i.split("/")),r=Math.min(...t.map(i=>i.length)),n=0;for(let i=0;i<r-1&&t.every(l=>l[i]===t[0][i]);i++)n=i+1;if(n>0&&t[0][n-1].startsWith("@")&&n--,n>0&&t[0][n-1]==="node_modules"&&n--,n===0)return{prefix:"",stripped:[...e]};let o=`${t[0].slice(0,n).join("/")}/`,s=t.map(i=>i.slice(n).join("/"));return{prefix:o,stripped:s}}function q$(e){return e.match(wg)?.[1]??e}function Te(e,t){if(!e)return e;let r=e;t?.exportsMode==="isolate"&&(r=r.replace(/^\((?:[^()]|\([^()]*\))*\): \[export:\s*\w+\] /u,""),r=r.replace(/^\[export:\s*\w+\] /u,""));let n=[t?.exportName,t?.methodName].filter(Boolean);for(let o of n){let s=o.replaceAll(/[.*+?^${}()|[\]\\]/gu,"\\$&");r=r.replaceAll(new RegExp(`\\[export:\\s*${s}\\]\\s*`,"gu"),"")}for(let o of n){let s=o.replaceAll(/[.*+?^${}()|[\]\\]/gu,"\\$&");r=r.replace(new RegExp(`^\\(\`?${s}\`?\\): `,"u"),"")}return r}function dn(e){let t=e?.exportName,r=e?.methodName;return t&&r&&t!==r?`${t}.${r}`:t||r||""}function xg(e){return[e.file,e.title,e.description,e.impact,e.reproduction,ws(e),e.recommendation,e.confidenceReason,Hd(e),e.revalidateVerdict,e.revalidateRecommendation,e.discoveredIn,e.repo?.github].filter(Boolean).join(`
56
+ `).toLowerCase()}function ys(e){return e&&e.replace(/^[^/]+\//u,"").replace(/^claude-/u,"").replaceAll("-"," ")}function un(e){return[e.type,ka(e)?"revalidate":"",ys(e.model),e.effort,e.exportsMode].filter(Boolean).join(" \xB7 ")}function _a(e){if(e.length===0)return"";let t=e[0];for(let r=1;r<e.length;r++){for(;t&&!e[r].startsWith(t);)t=t.slice(0,-1);if(!t)return""}return t}function _g(e){if(!e)return null;let t=e.trim().replace(/\/$/u,"");return t?/^https?:\/\//iu.test(t)?t:/^github\.com\//iu.test(t)?`https://${t}`:`https://github.com/${t}`:null}var G$=/^(?:@[\w.-]+\/)?[\w.-]+@[^/\s@]+$/u;function Y$(e){return G$.test(e||"")}function J$(e,t,r){if(Y$(e))return null;if(t)return`https://github.com/${t}/blob/HEAD/${q$(e)}`;if(Tr(e))return null;let n=_g(r);return n?`${n}/blob/HEAD/${e}`:null}function Wd(e,t){let r=e?.file??"",n=pn(e,t);return n?Dd`<a href="${X$(n)}" target="_blank" rel="noopener">${r}</a>`:r}function X$(e){return e.replace(/#L\d+(?:-L?\d+)?$/u,"")}function Ut(e){if(typeof e!="string"||e.length===0)return!1;try{let t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function pn(e,t){if(!e)return null;if(Ut(e.location))return e.location;let r=J$(e.file,e.repo?.github,t);if(!r)return null;let n=parseInt(e.line,10);return Number.isFinite(n)?`${r}#L${n}`:r}var Q$=/^(?:\s+\S|[-*+] |\d+[.)] |>|#{1,6} |\||`{3}|~{3})/u;function Sg(e){return e.split(/(\n{2,})/u).map(t=>{if(/^\n+$/u.test(t))return t;let r=t.split(`
57
+ `);return r.some(n=>Q$.test(n))?t:r.map(n=>n.trim()).filter(Boolean).join(" ")}).join("")}function ag(e,t,r){let n=t?/^\n*/u.exec(e)[0]:"",o=e.slice(n.length),s=r?/\n*$/u.exec(o)[0]:"";return n+Sg(o.slice(0,o.length-s.length))+s}function qn(e){if(!e)return e;let t=wr(e);if(t.length===0)return Sg(e);let r=[],n=0;for(let[o,s]of t)o>n&&r.push(ag(e.slice(n,o),n>0,!0)),r.push(e.slice(o,s)),n=s;return n<e.length&&r.push(ag(e.slice(n),!0,!1)),r.join("")}var Z$=/^\*\*([^*\n]+):\*\*[ \t]*/u;function ex(e){let t=wr(e);if(t.length===0)return e.split(/\n{2,}/u);let r=[],n=0;for(let o of e.matchAll(/\n{2,}/gu))en(t,o.index)||(r.push(e.slice(n,o.index)),n=o.index+o[0].length);return r.push(e.slice(n)),r}function Cg(e){let t=[];for(let r of ex(e||"")){if(!r.trim())continue;let n=Z$.exec(r);if(n){t.push({label:n[1].trim(),body:r.slice(n[0].length).trim()});continue}let o=t.at(-1);o&&o.label===null?o.body+=`
58
+
59
+ ${r}`:t.push({label:null,body:r})}return t}var lg=/^( *)(`{3,}|~{3,})(.*)$/u,tx=/^[a-z0-9+#._-]{1,20}$/u;function Eg(e,t){let r=0;for(;r<t&&e[r]===" ";)r++;return e.slice(r)}function rx(e){let t=e.split(`
60
+ `),r=lg.exec(t[0]),n=(r?.[2]??"```").slice(0,3),o=(r?.[3]??"").trim().split(/\s+/u)[0].toLowerCase(),i=!!(t.length>1?lg.exec(t.at(-1)):null)?.[2].startsWith(n),l=r?.[1].length??0,c=t.slice(1,i?-1:void 0);return{lang:tx.test(o)?o:"",code:(l>0?c.map(u=>Eg(u,l)):c).join(`
61
+ `)}}function Kd(e){let t=wr(e||"");if(t.length===0)return[e];let r=[],n=0,o=(s,i)=>{let l=(i?s.replace(/^\n+/u,""):s).replace(/\n+$/u,"");l&&r.push(l)};for(let[s,i]of t)s>n&&o(e.slice(n,s),n>0),r.push(rx(e.slice(s,i))),n=i;return n<e.length&&o(e.slice(n),!0),r}var zd=/^( *)(?:[-*+]|(\d{1,9})[.)]) +(?=\S)/u,cg=/^ {0,3}([-*_])(?: *\1){2,} *$/u;function nx(e){return/^ */u.exec(e)[0].length}function dg(e){let t=e.length;for(;t>0&&!e[t-1].trim();)t--;return e.slice(0,t).join(`
62
+ `)}function Ag(e){let t=typeof e=="string"?e:"";if(!t)return[e];let r=wr(t),n=t.split(`
63
+ `),o=[],s=0;for(let f of n)o.push(s),s+=f.length+1;let i=f=>!en(r,o[f])&&!cg.test(n[f])&&zd.test(n[f]),l=[],c=0,u=0,p=f=>{let h=n.slice(c,f).join(`
64
+ `).replace(/^\n+/u,"").replace(/\n+$/u,"");h.trim()&&l.push(h)};for(;u<n.length;){if(!i(u)){u++;continue}p(u);let f=zd.exec(n[u]),h=!!f[2],b=[],g=null,w=!1;for(;u<n.length;){let v=n[u];if(!en(r,o[u])){if(!v.trim()){g.lines.push(""),w=!0,u++;continue}let y=nx(v),k=cg.test(v)?null:zd.exec(v);if(k&&(!g||y<g.column)){if(!!k[2]!==h)break;g&&b.push(dg(g.lines)),g={column:k[0].length,lines:[v.slice(k[0].length)]},w=!1,u++;continue}if(y<g.column&&w)break}g.lines.push(Eg(v,g.column)),w=!1,u++}g&&b.push(dg(g.lines)),l.push({ordered:h,start:h?Number(f[2]):null,items:b}),c=u}return l.length===0?[e]:(p(n.length),l)}function ox(e){if(!e)return"";for(let t of e.split(`
65
+ `))if(t.trim())return t.trim();return""}function vs(e){return(typeof e?.title=="string"?e.title.trim():"")||ox(Te(e?.description,e))}function Gn(e){let t=Te(e?.description,e)||"",r=typeof e?.title=="string"?e.title.trim():"";if(r){let s=t.trim(),i=s.indexOf(`
66
+ `);return(i<0?s:s.slice(0,i)).trim()!==r?{title:r,body:s}:{title:r,body:i<0?"":s.slice(i+1).replace(/^\s+/u,"")}}if(!t)return{title:"",body:""};let n=t.indexOf(`
67
+ `);if(n<0)return{title:"",body:t};if(typeof Kd(t)[0]!="string")return{title:"",body:t};let o=t.slice(n+1).replace(/^\s+/u,"");return o?{title:t.slice(0,n).trim(),body:o}:{title:"",body:t}}function Sa(e){let t=typeof e?.title=="string"?e.title.trim():"";if(!t)return Te(e?.description,e)||"";let{body:r}=Gn(e);return r?`${t}
68
+
69
+ ${r}`:t}function Tg(e,t,r){return pn({file:e?.file,line:e?.line,location:e?.url,repo:t?.repo},r)}function Ca(e){return Number.isFinite(parseInt(e?.line,10))?`${e.file}:${e.line}`:e?.file??""}function qd(e){let t=r=>typeof r=="string"?r:"";return`${t(e?.observation)}
70
+ ${t(e?.text)}`.trim()}function Rg(e,{spaced:t=!1}={}){let r=Array.isArray(e?.evidence)?e.evidence:[];return r.length===0?"":r.map((n,o)=>{let s=Ca(n),i=[`${o+1}. ${n.url?`[${s}](${n.url})`:s}`],l=qd(n);if(l)for(let c of l.split(`
71
+ `))i.push(` ${c}`);return i.join(`
72
+ `)}).join(t?`
73
+
74
+ `:`
75
+ `)}function ws(e){let t=Rg(e);return t?`**Evidence:**
76
+ ${t}`:""}function Ig(e){let t=/^\[([^\]]+)\]\(([^)\s]+)\)$/u.exec(e);return!t||!Ut(t[2])?null:{label:Ui(t[1].trim())||t[2],url:t[2]}}function Mg(e,t){let r=parseInt(e?.line,10);if(!Number.isFinite(r))return ig;let n=pn(e,t),o=`line ${r}`;return n?Dd`<a href="${n}" target="_blank" rel="noopener">${o}</a>`:o}function Fg(e,t){return!e||!t?null:`${/^https?:/iu.test(e)?e.replace(/\/$/u,""):`https://github.com/${e}`}/commit/${t}`}var sx=[["Impact","impact"],["Reproduction","reproduction"],["Recommendation","recommendation"],["Confidence reason","confidenceReason"],["Revalidation verdict","revalidateVerdict"],["Revalidation recommendation","revalidateRecommendation"]];function Bg(e,t){let r=[];t&&r.push(`Repo: ${t}`);let n=Ca(e);n&&r.push(`Location: ${n}`),e?.confidence!==void 0&&e?.confidence!==null&&r.push(`Confidence: ${e.confidence}/10`);let o=mt(e);o&&r.push(`Revalidation: ${o}`);let s=[];r.length>0&&s.push(r.join(`
77
+ `));let{title:i,body:l}=Gn(e);i&&s.push(`# ${i}`),l&&s.push(l.trim());let c=Rg(e,{spaced:!0});c&&s.push(`# Evidence
78
+
79
+ ${c}`);for(let[u,p]of sx){let f=Te(e?.[p],e)?.trim();f&&s.push(`# ${u}
80
+
81
+ ${f}`)}return s.join(`
82
+
83
+ `)}function Lg(e,{title:t,body:r}={}){let n=_g(e);if(!n)return null;let o;try{o=new URL(n).host.toLowerCase()}catch{return null}if(o!=="github.com")return null;let s=new URLSearchParams;t&&s.set("title",t),r&&s.set("body",r);let i=s.toString();return i?`${n}/issues/new?${i}`:`${n}/issues/new`}var ix=/^[a-zA-Z\d](?:-?[a-zA-Z\d])*$/u,ax=/^[a-zA-Z\d._-]+$/u,lx=/^[1-9]\d{0,9}$/u,cx=/^[a-fA-F\d]{7,40}$/u,dx=/^#[\w-]+$/u,ug=/^GHSA(?:-[0-9a-z]{4}){3}$/u;function pg(e){return e.length<=39&&ix.test(e)}function fg(e){return e.length<=100&&e!=="."&&e!==".."&&ax.test(e)}function ux(e){let t;try{t=new URL(e)}catch{return null}if(t.href!==e||t.protocol!=="https:"||t.hostname.toLowerCase()!=="github.com"||t.port||t.username||t.password)return null;let r=t.pathname.split("/");if(r.at(-1)===""&&r.pop(),r.length===3&&r[1]==="advisories"){let p=r[2];return ug.test(p)?{url:`https://github.com/advisories/${p}`,label:p}:null}if(r.length===6&&r[3]==="security"&&r[4]==="advisories"){let[,p,f,,,h]=r;return!pg(p)||!fg(f)||!ug.test(h)?null:{url:`https://github.com/${p}/${f}/security/advisories/${h}`,label:h}}if(r.length!==5)return null;let[,n,o,s,i]=r;if(!pg(n)||!fg(o))return null;let l;if(s==="issues"||s==="pull"){if(!lx.test(i))return null;l=`${n}/${o}#${i}`}else if(s==="commit"){if(!cx.test(i))return null;l=`${n}/${o}@${i.slice(0,7)}`}else return null;let c=dx.test(t.hash)?t.hash:"";return{url:`https://github.com/${n}/${o}/${s}/${i}${c}`,label:l}}var px=/^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/u;function fx(e){let t=Nh(e);if(!t)return null;let r=px.test(t.id)?`finding ${t.id.slice(0,8)}`:"finding";return{url:`#${t.fragment}`,label:r,self:!0}}var Ud=/https?:\/\/[^\s<>"'`(){}[\]|\\^]+/giu,hx=new Set([")",".",",","!","?",";",":","'",'"',"*","]","}",">"]);function mx(e){let t=e.length;for(;t>0&&hx.has(e[t-1]);)t--;return t===e.length?e:e.slice(0,t)}function Og(e){if(typeof e!="string"||e.length===0)return[];let t=[],r=0;Ud.lastIndex=0;let n;for(;(n=Ud.exec(e))!==null;){let o=mx(n[0]),s=o?ux(o)??fx(o):null;s&&(n.index>r&&t.push(e.slice(r,n.index)),t.push(s),r=n.index+o.length,Ud.lastIndex=r)}return r<e.length&&t.push(e.slice(r)),t}var Rr="\0",fn="",Ir="";function ks(e){return ys(e.model)||null}function Gd(e){if(a.filterAnalyzer){let t=e._analyzer??null,r=a.filterAnalyzer===Rr?null:a.filterAnalyzer;if(t!==r)return!1}if(a.filterModel){let t=ks(e),r=a.filterModel===Ir?null:a.filterModel;if(t!==r)return!1}return!0}function Yd(e){return typeof e.repo?.github=="string"&&e.repo.github?e.repo.github:typeof e._repoFallback=="string"&&e._repoFallback?e._repoFallback:null}function Yn(){a.filterSeverities=new Set,a.filterColors=new Set,a.filterSources=new Set,a.filterAnalyzer="",a.filterModel="",a.filterRepo="",a.filterConfMin=0,a.filterConfMax=10,a.filterInclude="",a.filterIncludeNegate=!1,a.filterComment="",a.filterFix="",a.filterFlagged="",a.filterRevalidate="",a.filterPartial="";let e=a.reports.some(t=>t.groups.some(r=>r.some(n=>n.priority!==void 0)));a.sortBy=e?"priority-desc":"severity"}function gx(e,t){return e.some(r=>{let n=Vd(r)?0:r.confidence;return n===void 0?r.critical===!0||t===0:n>=t})}function Dg(e,t){let r=e.filter(o=>gx(o,t));if(r.length===0||!r.every(o=>o.some(s=>mt(s))))return"";let n=new Set(jd("confirmed"));return e.some(o=>o.some(s=>n.has(mt(s))))?"confirmed":""}function bx(e){let t=a.filterInclude.toLowerCase();if(a.filterSeverities.size>0&&!a.filterSeverities.has(ne(e,a.severityMode)))return!1;if(a.filterColors.size>0){let r=a.triage.get(D(e))?.color??"none";if(!a.filterColors.has(r))return!1}if(a.filterSources.size===1){let r=a.filterSources.has("own");if(r&&Tr(e.file)||!r&&!Tr(e.file))return!1}if(!Gd(e))return!1;if(a.filterRepo){let r=Yd(e),n=a.filterRepo===fn?null:a.filterRepo;if(r!==n)return!1}if(a.filterRevalidate){let r=gg(a.filterRevalidate,a.filterPartial);if(r&&!r.includes(mt(e)))return!1}if(!a.filterRevalidate){let r=Vd(e)?0:e.confidence;if(r===void 0){if(e.critical===!0){if(a.filterConfMax<10)return!1}else if(a.filterConfMin>0)return!1}else if(r<a.filterConfMin||a.filterConfMax<10&&r>a.filterConfMax)return!1}if(t){let r=a.triage.get(D(e)),n=xg(e).includes(t)||(r?.comment??"").toLowerCase().includes(t)||(r?.fix??"").toLowerCase().includes(t);return a.filterIncludeNegate?!n:n}return!0}function yx(e){if(!a.filterComment&&!a.filterFix&&!a.filterFlagged)return!0;let t=r=>e.some(n=>r(a.triage.get(D(n))));if(a.filterComment){let r=t(n=>!!n?.comment);if(a.filterComment==="with"?!r:r)return!1}if(a.filterFix){let r=t(n=>!!n?.fix);if(a.filterFix==="with"?!r:r)return!1}if(a.filterFlagged){let r=t(n=>n?.flagged===!0);if(a.filterFlagged==="with"?!r:r)return!1}return!0}function Mr(e){return e.filter(t=>t.some(bx)&&yx(t))}function Pg(e,t,r){return(n,o)=>{let s=n[e]??r,i=o[e]??r;return(t==="desc"?i-s:s-i)||n.file.localeCompare(o.file)}}function zg(e){let t=e==="desc"?-1:11;return(r,n)=>{let o=r.confidence===void 0&&r.critical===!0,s=n.confidence===void 0&&n.critical===!0,i=r.confidence??(o?10:t),l=n.confidence??(s?10:t);return(e==="desc"?l-i:i-l)||(o===s?0:o?-1:1)||r.file.localeCompare(n.file)}}var Ng=zg("desc"),vx={severity:(e,t)=>($e[ne(t,a.severityMode)]||0)-($e[ne(e,a.severityMode)]||0)||Ng(e,t)||parseInt(e.line,10)-parseInt(t.line,10),"confidence-desc":Ng,"confidence-asc":zg("asc"),"priority-desc":Pg("priority","desc",-1),"priority-asc":Pg("priority","asc",11)};function Ug(e){let t=vx[a.sortBy];return t?e.map(r=>({p:hn(r),g:r})).toSorted((r,n)=>t(r.p,n.p)).map(r=>r.g):[...e]}function D(e){return e.id??String(e._id)}function Re(e){return D(e[0])}function Jd(e){return Array.isArray(e)?e:[e]}function Ea(e){return e?._reportName??""}function Jn(e){return Xt(a.triage,D(e),Ea(e))}function Xn(e){return e.length<=1?e:[...e].toSorted((t,r)=>{let n=ka(t)?1:0,o=ka(r)?1:0;if(n!==o)return o-n;let s=a.triage.get(D(t))?.color?1:0,i=a.triage.get(D(r))?.color?1:0;if(s!==i)return i-s;let l=$e[ne(t,a.severityMode)]||0,c=$e[ne(r,a.severityMode)]||0;if(l!==c)return c-l;let u=t.confidence??-1;return(r.confidence??-1)-u})}function hn(e){return e.length===1?e[0]:Xn(e)[0]}function wx(e){let t=a.triage.get(D(e));return!!t?.comment||!!t?.fix||t?.flagged===!0}function ze(e){if(e.length===1)return e[0];let t=a.activeTabByGroup.get(Re(e));if(t){let o=e.find(s=>D(s)===t);if(o)return o}let r=Xn(e),n=r;if(a.filterAnalyzer||a.filterModel){let o=r.filter(Gd);o.length>0&&(n=o)}return n.find(wx)??n[0]}function Ht(e){return e?._repoFallback||a.repoUrl||""}function Aa(e){for(let t of Lt().values())if(t.files.has(e.file))return t.repos&&t.repos.size===1?[...t.repos][0]:null;return e.repo?.github||Ht(e)||null}function ve(e){let t=0,r=!1,n,o=!1,s=!1,i,l=!1,c=null,u=!1,p=!0;for(let w of e){let v=a.triage.get(D(w)),y=v?.triage??(Jn(w)?"ignored":void 0),k=v?.color;k===void 0&&y===void 0||(t++,k!==void 0&&(o?k!==n&&(r=!0):(o=!0,n=k)),l?y!==i&&(s=!0):(l=!0,i=y),y?(c===null&&(c=y),y==="ignored"?p=!1:u=!0):p=!1)}let f=r||s,h=!f&&o?n:null,b=t>0&&p,g=!f&&c!==null?c:null;return{hasConflict:f,commonColor:h,anyTriage:u,allTriaged:b,commonTriage:g,isInProgress:g==="inprogress",isFixed:g==="fixed",isInvalid:g==="invalid",isDeleted:g==="deleted",isIgnored:g==="ignored"}}function St(){let e=a.reports.flatMap(c=>c.groups),t=a.workspaceMerges;if(!t||t.length===0)return e;let r=e.map((c,u)=>u),n=c=>{let u=c;for(;r[u]!==u;)u=r[u];for(;r[c]!==u;){let p=r[c];r[c]=u,c=p}return u},o=(c,u)=>{let p=n(c),f=n(u);p!==f&&(r[p]=f)},s=new Map;for(let c=0;c<e.length;c++)for(let u of e[c])u.id&&s.set(u.id,c);for(let c of t){let u=-1;for(let p of c){let f=s.get(p);f!==void 0&&(u===-1?u=f:o(u,f))}}let i=new Set,l=[];for(let c=0;c<e.length;c++){let u=n(c);if(i.has(u))continue;i.add(u);let p=[];for(let y=c;y<e.length;y++)n(y)===u&&p.push(...e[y]);let f=new Set(p.map(y=>y.id).filter(Boolean)),h=[],b=new Set;for(let y of t)for(let k of y)b.has(k)||f.has(k)&&(h.push(k),b.add(k));if(h.length===0){l.push(p);continue}let g=new Map;for(let y of p)y.id&&!g.has(y.id)&&g.set(y.id,y);let w=new Set,v=[];for(let y of h){let k=g.get(y);k&&(v.push(k),w.add(k))}for(let y of p)w.has(y)||v.push(y);l.push(v)}return l}function Fr(e){for(let t of St())if(Re(t)===e)return t;return null}var Qd={"claude-security":"Claude Security","codex-security":"Codex Security",deepsec:"DeepSec",piolium:"Piolium"};function Hg(e){return e==null?"(none)":Qd[e]??e}function Vg(e){return e??"(no model)"}var Xd=class extends z{static properties={analyzers:{attribute:!1},models:{attribute:!1},groups:{attribute:!1},_open:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.analyzers=[],this.models=[],this.groups=[],this._open=!1}render(){let t=this.analyzers.length>1,r=this.models.length>1;if(!t&&!r)return m;let n=a.filterAnalyzer===""?void 0:a.filterAnalyzer===Rr?null:a.filterAnalyzer,o=a.filterModel===""?void 0:a.filterModel===Ir?null:a.filterModel,s=new Map,i=new Map;for(let f of this.groups){let h=new Set,b=new Set;for(let g of f){let w=g._analyzer??null,v=ks(g);(o===void 0||v===o)&&h.add(w),(n===void 0||w===n)&&b.add(v)}for(let g of h)s.set(g,(s.get(g)??0)+1);for(let g of b)i.set(g,(i.get(g)??0)+1)}let l=n===void 0?null:Hg(n),c=o===void 0?null:Vg(o),u=l!=null&&c!=null?`${l} \xB7 ${c}`:l??c??(t?"All analyzers":"All models"),p=l!=null||c!=null;return d`<button type="button" class="${T({"analyzer-btn":!0,active:p})}" popovertarget="analyzer-select-menu" popovertargetaction="toggle" title="Filter by analyzer / model" aria-label="${`Filter by analyzer / model: ${u}`}"><span class="analyzer-btn-label">${u}</span> <svg viewBox="0 0 12 12" width="11" height="11" aria-hidden="true"><path d="M2 4l4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg></button><div popover="auto" id="analyzer-select-menu" class="analyzer-menu" @beforetoggle="${this._onToggle}">${t?this._column({dim:"analyzer",heading:"Analyzer",allLabel:"All analyzers",values:this.analyzers,sentinel:Rr,labelOf:Hg,counts:s,current:a.filterAnalyzer}):m} ${t&&r?d`<div class="analyzer-menu-sep"></div>`:m} ${r?this._column({dim:"model",heading:"Model",allLabel:"All models",values:this.models,sentinel:Ir,labelOf:Vg,counts:i,current:a.filterModel}):m}</div>`}_column({dim:t,heading:r,allLabel:n,values:o,sentinel:s,labelOf:i,counts:l,current:c}){return d`<div class="analyzer-menu-col" role="group" aria-label="${`Filter by ${t}`}"><div class="analyzer-menu-head">${r}</div><button type="button" aria-pressed="${String(c==="")}" class="${T({"analyzer-menu-item":!0,active:c===""})}" @click="${()=>this._pick(t,"")}"><span class="analyzer-menu-label">${n}</span></button> ${o.map(u=>{let p=u??s,f=l.get(u)??0,h=c===p;return d`<button type="button" aria-pressed="${String(h)}" class="${T({"analyzer-menu-item":!0,active:h,zero:f===0})}" @click="${()=>this._pick(t,p)}"><span class="analyzer-menu-label">${i(u)}</span><span class="analyzer-menu-count">${f}</span></button>`})}</div>`}_pick(t,r){let n=t==="analyzer"?a.filterAnalyzer:a.filterModel,o=r!==""&&n===r?"":r;this.dispatchEvent(new CustomEvent("analyzer-change",{detail:{analyzer:t==="analyzer"?o:a.filterAnalyzer,model:t==="model"?o:a.filterModel},bubbles:!0,composed:!0}))}_onToggle=t=>{this._open=t.newState==="open",this._open&&this._position()};_position(){let t=this.querySelector(".analyzer-menu"),r=this.querySelector(".analyzer-btn");if(!t||!r)return;let n=r.getBoundingClientRect(),o=t.offsetWidth||240,s=t.offsetHeight||200,i=4,l=n.left;l+o>window.innerWidth-4&&(l=window.innerWidth-o-4),l<4&&(l=4);let c=n.bottom+i;c+s>window.innerHeight-4&&n.top>s+i&&(c=n.top-s-i),t.style.top=`${c}px`,t.style.left=`${l}px`}updated(){this._open&&this.querySelector(".analyzer-menu")?.matches(":popover-open")&&this._position()}};customElements.define("analyzer-select",Xd);var Ra=["type","model","effort","exportsMode"],Ta=["security","correctness"],kx=["max","xhigh","high","medium","low","minimal"],$x=["list","isolate"];function jg(e,t){if(t==null)return e.length+1;let r=e.indexOf(t);return r===-1?e.length:r}var xx={type:e=>{if(e==="terminal")return Ta.length+2;if(e==null)return Ta.length+1;let t=Ta.indexOf(e);return t===-1?Ta.length:t},model:e=>e==null?1:0,effort:e=>jg(kx,e),exportsMode:e=>jg($x,e)};function _x(e,t,r){for(let n of r){let o=xx[n],s=o(e[n])-o(t[n]);if(s!==0)return s;let i=String(e[n]??"").localeCompare(String(t[n]??""));if(i!==0)return i}return 0}function Wg(e,t,{typePrefix:r=!0}={}){return e==="type"?r?`analyzer: ${t??"null"}`:`${t??"null"}`:t??null}function Sx(e,t){let r=t.filter(s=>s!=="exportsMode"),n=[],o=new Map;for(let s of e){if(s.exportsMode==null){n.push({...s});continue}let i=r.map(u=>s[u]??"").join("|"),l=o.get(i);if(l){l.exportsMode=`${l.exportsMode}+${s.exportsMode}`;continue}let c={...s};o.set(i,c),n.push(c)}return n}function Kg(e,t=Ra){let r=new Map;for(let h of e){let b={};for(let w of t)b[w]=w==="model"?ys(h.model)??null:h[w]??null;let g=t.map(w=>b[w]??"").join("|");r.has(g)||r.set(g,b)}let n=[...r.values()].toSorted((h,b)=>_x(h,b,t));if(n.length===0)return[];let o={};for(let h of t)o[h]=new Set(n.map(b=>b[h])).size===1;let s=t.filter(h=>!o[h]),i=s.includes("exportsMode")?Sx(n,t):n,l=i.length>2&&s.includes("type")&&s.length>1,c=["model","effort"].filter(h=>t.includes(h)&&o[h]),u=[...c,...t.filter(h=>!c.includes(h))],p=[],f=!1;for(let h of u)if(o[h]){let b=Wg(h,i[0][h]);b!=null&&p.push(b)}else if(!f){for(let b of i){let g=s.map(w=>Wg(w,b[w],{typePrefix:!l})).filter(w=>w!=null);g.length>0&&p.push(g.join(" \xB7 "))}f=!0}return p}var Ia=null;function Cx(){return Ia||(Ia=(async()=>await import("./prism.js"))(),Ia)}var Ex={js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"jsx",ts:"typescript",mts:"typescript",cts:"typescript",tsx:"tsx",json:"json",css:"css",html:"markup",htm:"markup",xml:"markup",svg:"markup",yml:"yaml",yaml:"yaml",sh:"bash",bash:"bash",md:"markdown",markdown:"markdown",sol:"solidity",php:"php",phtml:"php",rs:"rust"};function Ma(e){if(typeof e!="string")return null;let t=e.lastIndexOf(".");return t<0?null:Ex[e.slice(t+1).toLowerCase()]??null}var Ax={__proto__:null,js:"javascript",javascript:"javascript",mjs:"javascript",cjs:"javascript",node:"javascript",jsx:"jsx",ts:"typescript",typescript:"typescript",mts:"typescript",cts:"typescript",tsx:"tsx",json:"json",css:"css",html:"markup",htm:"markup",xml:"markup",svg:"markup",markup:"markup",yaml:"yaml",yml:"yaml",sh:"bash",bash:"bash",shell:"bash",zsh:"bash",console:"bash",md:"markdown",markdown:"markdown",sol:"solidity",solidity:"solidity",rs:"rust",rust:"rust",php:"php",phtml:"php"};function qg(e){return typeof e!="string"?null:Ax[e.toLowerCase()]??null}async function Qn(e,t){if(!t)return null;try{return(await Cx()).highlight(e,t)}catch{return null}}var Zd=new Map,eu=new Set,tu=!1;function Tx(){tu||(tu=!0,queueMicrotask(()=>{tu=!1,a.codeBlockTick++,x()}))}function Gg(e,t){let r=qg(t);if(!r||!e)return null;let n=`${r}\0${e}`;return Zd.has(n)?Zd.get(n):(eu.has(n)||(eu.add(n),(async()=>{let o=await Qn(e,r);Zd.set(n,o??null),eu.delete(n),Tx()})()),null)}function je(e){return e==="informational"?"info":e.replaceAll("_"," ")}function ru(e,{variant:t="full"}={}){let r=a.severityMode,n=ne(e,r),o=d`<span class="${`badge ${n}`}">${je(n)}</span>`,s=rr(e),i=t==="tab"?null:wa(e);if(!s&&!i)return o;let l=i?`Corrected severity varies across reports \u2014 ${Object.entries(i).map(([S,M])=>`${S||"(this report)"}: ${je(M.severity)}`).join("; ")}`:null,c=i?d`<span class="badge-varies" title="${l}" aria-label="${l}">varies</span>`:m;if(!s)return d`<span class="${`badge-pair badge-pair-${t}`}">${o}${c}</span>`;let u=e.severity,p=tr(e),f=e.correctedSeverityReason,h=($e[p]??0)>($e[u]??0),b=h?"up":"down",g=h?"\u25B2":"\u25BC",w=r!=="original",v=(w?`Corrected ${b} from ${je(u)}`:`Original severity \u2014 corrected ${b} to ${je(p)}`)+(f?` \u2014 ${f}`:""),y=`Severity ${je(n)}; ${w?`corrected ${b} from ${je(u)}`:`original, corrected to ${je(p)}`}${f?`; reason: ${f}`:""}`;if(t==="tab")return d`<span class="badge-pair badge-pair-tab" title="${v}" aria-label="${y}">${o}<span class="${`badge-corr-mark ${b}`}" aria-hidden="true">${g}</span></span>`;let k=w?u:p;return d`<span class="${`badge-pair badge-pair-${t}`}" title="${v}" aria-label="${y}">${o}<span class="badge-orig-wrap"><span class="${`badge-arrow ${b}`}" aria-hidden="true">${g}</span>${w?d`<span class="badge-pre" aria-hidden="true">was</span>`:m}<span class="${`badge-orig ${k}${w?" struck":""}`}">${je(k)}</span></span>${c}</span>`}var Yg=/\[[^\]\n]+\]\([^)\s]+\)|\*\*[^*\n]+\*\*|"[^"\n]+"|`[^`\n]+`/gu;function xs(e){Yg.lastIndex=0;let t=[],r=0,n;for(;(n=Yg.exec(e))!==null;){n.index>r&&t.push(e.slice(r,n.index));let o=n[0].codePointAt(0);if(o===91){let s=Ig(n[0]);t.push(s?d`<a href="${s.url}" target="_blank" rel="noopener noreferrer" title="${s.url}">${s.label}</a>`:n[0])}else o===42?t.push(d`<strong>${n[0].slice(2,-2)}</strong>`):o===96?t.push(d`<span class="inline-code">${n[0].slice(1,-1)}</span>`):t.push(d`<span class="inline-quote">${n[0]}</span>`);r=n.index+n[0].length}return r===0?e:(r<e.length&&t.push(e.slice(r)),t)}function Rx({lang:e,code:t}){a.codeBlockTick;let r=Gg(t,e);return d`<div class="code-block" data-lang="${e||m}">${e?d`<div class="code-block-lang">${e}</div>`:m}<pre><code>${r?ye(r):t}</code></pre></div>`}function Ix(e,{wrap:t=!1}={}){let r=e.split(/\n{2,}/u).filter(n=>n.trim());return r.length<2?t?d`<div class="para">${xs(e)}</div>`:xs(e):r.map(n=>d`<div class="para">${xs(n)}</div>`)}function Mx({ordered:e,start:t,items:r}){let n=r.map(o=>d`<li>${gt(o)}</li>`);return e?d`<ol class="md-list" start="${t>1?t:m}">${n}</ol>`:d`<ul class="md-list">${n}</ul>`}function gt(e,{paragraphs:t=!0}={}){if(!e)return e;let r=t?Ag(e):[e],n=r.length>1,o=i=>t?Ix(i,{wrap:n}):xs(i),s=i=>{let l=Kd(i);return l.length===1&&typeof l[0]=="string"?o(l[0]):l.map(c=>typeof c=="string"?o(c):Rx(c))};return r.length===1&&typeof r[0]=="string"?s(r[0]):r.map(i=>typeof i=="string"?s(i):Mx(i))}function Fx(e){return Og(e).map(t=>typeof t=="string"?t:t.self?d`<a class="comment-self-ref" href="${t.url}" title="Show this finding">${t.label}</a>`:d`<a href="${t.url}" target="_blank" rel="noopener noreferrer" title="${t.url}">${t.label}</a>`)}function Bx(e){let t=Hd(e);return t?d`<span class="${`revalidate-stamp ${t}`}">${t}</span><div class="value-label">Revalidation</div>`:m}function Lx(e){let t=Te(e.revalidateVerdict,e);return t?d`<div class="revalidate-verdict">${gt(qn(t))}</div>`:m}function $s(e,t,r="section",{collapsible:n=!1}={}){let o=t?d`<div class="section-body">${gt(qn(t))}</div>`:m;return!n||!t?d`<div class="${r}"><div class="section-label">${e}</div>${o}</div>`:d`<details class="${r}"><summary class="section-label">${e}</summary>${o}</details>`}function Ox(e){let t=Array.isArray(e.evidence)?e.evidence:[];if(t.length===0)return m;let r=Ht(e);return d`<details class="evidence"><summary class="section-label">Evidence<span class="evidence-count">(${t.length})</span></summary><ol class="evidence-list">${t.map(n=>{let o=Ca(n),s=Tg(n,e,r),i=qd(n);return d`<li>${s?d`<a class="evidence-ref" href="${s}" target="_blank" rel="noopener" title="${s}">${o}</a>`:d`<span class="evidence-ref">${o}</span>`} ${i?d`<div class="evidence-note">${gt(qn(i))}</div>`:m}</li>`})}</ol></details>`}function Px(e){let t=pn(e,Ht(e)),r=parseInt(e.line,10),n=Number.isFinite(r)?`${e.file}:${e.line}`:e.file;return t?d`<a href="${t}" target="_blank" rel="noopener">${n}</a>`:n}function Nx(e,t){if(!t)return m;let r=t.slice(0,7),n=Fg(e,t);return n?d`<a href="${n}" target="_blank" rel="noopener" title="${t}">${r}</a>`:d`<span title="${t}">${r}</span>`}var Fa=d`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><path class="bubble" d="M2.5 3h11a.5.5 0 0 1 .5.5v6.5a.5.5 0 0 1-.5.5H8.4l-3 2.6V10.5H2.5a.5.5 0 0 1-.5-.5V3.5a.5.5 0 0 1 .5-.5z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,_s=d`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><path class="wrench" d="M10.4 2.6a3 3 0 0 0-3.6 4.5L2 12l2 2 4.9-4.8a3 3 0 0 0 4.5-3.6l-1.8 1.8-1.5-.4-.4-1.5z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,Dx=d`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><rect x="3" y="2.5" width="8" height="10" rx="1" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/><rect x="5.5" y="5" width="8" height="9" rx="1" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,zx=d`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"><path d="M6.2 11.2H4.8a3.2 3.2 0 0 1 0-6.4h1.4"/><path d="M9.8 4.8h1.4a3.2 3.2 0 0 1 0 6.4H9.8"/><path d="M5.6 8h4.8"/></g></svg>`,Ux=d`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><g stroke="currentColor" stroke-width="1.2" stroke-linecap="round" fill="none"><line x1="8" y1="1.8" x2="8" y2="14.2"/><line x1="1.8" y1="8" x2="14.2" y2="8"/><line x1="3.6" y1="3.6" x2="12.4" y2="12.4"/><line x1="12.4" y1="3.6" x2="3.6" y2="12.4"/></g></svg>`,Hx=d`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><circle cx="8" cy="8" r="6" fill="none" stroke="currentColor" stroke-width="1.2"/><circle cx="8" cy="8" r="1.7" fill="currentColor"/></svg>`,Ba=d`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><path class="flag-cloth" d="M5 1.5h6v13l-3-2.7-3 2.7z" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linejoin="round"/></svg>`;function Vx(e,t=!1){let r=a.triage.get(e)?.flagged===!0,n=r?"Remove flag":"Flag this finding";return d`<button type="button" class="${T({"mark-flag":!0,flagged:r})}" data-flag-toggle="${e}" title="${n}" aria-label="${n}" aria-pressed="${String(r)}">${Ba}${t?d`<span class="mark-btn-label">${r?"Flagged":"Flag"}</span>`:m}</button>`}function jx(e){let t=vs(e)||e.file||"Security finding";return t.length>120?`${t.slice(0,119)}\u2026`:t}function Wx(e){let t=pn(e,Ht(e)),r=parseInt(e.line,10),n=Number.isFinite(r)?`${e.file}:${e.line}`:e.file,o=[];e.file&&o.push(`File: ${t?`[${n}](${t})`:n}`),e.description&&o.push(e.description);let s=ws(e);return s&&o.push(s),e.confidence!==void 0&&e.confidence!==null&&o.push(`Confidence: ${e.confidence}/10`),o.join(`
84
+
85
+ `)}function Kx(e){if(!a.currentWorkspace)return m;let t=e[0]?._reportName;if(!t)return m;let r=se[st(t)]??se.default;return d`<span class="report-chip" title="${t}">${ye(r)}<span class="report-chip-label">${De(t)}</span></span>`}function Jg(e,t,r,n,o=null){let s=Kx(e),i=D(n),l=a.triage.get(i),c=l?.color??null,u=l?.comment??"",p=l?.fix??"",f=u?`Edit comment: ${u}`:"Add comment",h=p?`Edit fix link: ${p}`:"Add fix link (PR URL, etc.)",b=o==="focus",g=u?"Edit comment":"Comment",w=p?"Edit fix link":"Fix link",v=d`<button type="button" class="${T({"mark-comment":!0,"has-comment":u})}" title="${f}" aria-label="${f}">${Fa}${b?d`<span class="mark-btn-label">${g}</span>`:m}</button>`,y=d`<button type="button" class="${T({"mark-fix":!0,"has-fix":p})}" title="${h}" aria-label="${h}">${_s}${b?d`<span class="mark-btn-label">${w}</span>`:m}</button>`,k=Vx(i,b),S=d`<button type="button" class="mark-copy" title="Copy file, line, description, confidence to clipboard" aria-label="Copy finding details to clipboard">${Dx}${b?d`<span class="mark-btn-label">Copy</span>`:m}</button>`,M=sn(i)?d`<button type="button" class="mark-link" title="Copy a link to this finding" aria-label="Copy a link to this finding">${zx}${b?d`<span class="mark-btn-label">Link</span>`:m}</button>`:m,_=Aa(n),R=Lg(_,{title:jx(n),body:Wx(n)}),O=R?d`<a class="mark-issue" href="${R}" target="_blank" rel="noopener" title="Create a pre-filled GitHub issue for this finding" aria-label="Create a GitHub issue for this finding">${Hx}${b?d`<span class="mark-btn-label">Issue</span>`:m}</a>`:m,B=d`<button type="button" class="mark-claude" title="Open in Claude Code (claude://) with a confirm-and-fix prompt" aria-label="Open finding in Claude Code">${Ux}${b?d`<span class="mark-btn-label">Claude</span>`:m}</button>`,V=d`<color-marker .selected="${c}"></color-marker>`,le=r.hasConflict?"change triage state (colors mismatch \u2014 acts per-tab)":t.length>1?"change triage state for the whole group":"change triage state";return d`${s}<span class="mark-action-group">${v}${y}${k}</span><span class="mark-action-group">${S}${M}${O}${B}</span>${V}${Gx(e,le,o,r,n)}`}function qx(e){if(e.newState!=="open")return;let t=e.currentTarget,n=t.getRootNode().querySelector?.(`[popovertarget="${t.id}"]`);if(!n)return;let o=n.getBoundingClientRect(),s=t.offsetWidth||110,i=t.offsetHeight||100,l=4,c=o.right-s;c<4&&(c=4),c+s>window.innerWidth-4&&(c=window.innerWidth-s-4);let u=o.bottom+l;u+i>window.innerHeight-4&&o.top>i+l&&(u=o.top-i-l),t.style.top=`${u}px`,t.style.left=`${c}px`}function Gx(e,t,r,n,o){let s=D(e[0]),i=D(o),l=n.hasConflict?a.triage.get(i)?.triage??(Jn(o)?"ignored":null):n.commonTriage,c={inprogress:"In progress",fixed:"Fixed",invalid:"Invalid",deleted:"Deleted",ignored:"Ignored"},u={inprogress:"In progress",fixed:"Fixed",invalid:"Invalid",deleted:"Delete",ignored:"Ignore"},p=!!a.shownTriage,f=p?c[a.shownTriage]:null,h=["inprogress","fixed","invalid","deleted","ignored"],b=r==="focus",g;b?g=h.map(y=>({key:y,label:u[y]})):p?g=[{key:"restore",label:"Restore"},...h.filter(y=>y!==a.shownTriage).map(y=>({key:y,label:u[y]}))]:g=h.map(y=>({key:y,label:u[y]}));let w=["mark-triage-menu"];p&&w.push("with-label",`triage-state-${a.shownTriage}`);let v=`triage-menu-${s.replaceAll(/[^A-Za-z0-9_-]/gu,"_")}`;return d`<div class="triage-menu-wrap"><button type="button" class="${w.join(" ")}" popovertarget="${v}" popovertargetaction="toggle" title="${t}" aria-label="${t}">${f?d`<span class="mark-triage-label">${f}</span>`:m} <svg viewBox="0 0 12 12" width="11" height="11" aria-hidden="true"><path d="M2 4l4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg></button><div popover="auto" id="${v}" class="triage-menu" data-gid="${s}" role="menu" @beforetoggle="${qx}">${g.map(y=>d`<button type="button" class="${T({"triage-menu-item":!0,[`triage-menu-${y.key}`]:!0,active:l===y.key})}" data-triage-action="${y.key}" role="menuitem">${y.label}</button>`)}</div></div>`}function Yx(e){let t=!!e?.comment,r=!!e?.fix,n=e?.flagged===!0;return!t&&!r&&!n?m:d`<span class="tab-marks">${t?d`<span class="has-comment" title="Has a comment">${Fa}</span>`:m}${r?d`<span class="has-fix" title="Has a fix link">${_s}</span>`:m}${n?d`<span class="flagged" title="Flagged">${Ba}</span>`:m}</span>`}function Xg(e,t){let r=D(e),n=a.triage.get(r),o=n?.color,s=n?.triage,i=Jn(e),l=["tab"];return t&&l.push("active"),o&&l.push(`tab-mark-${o}`),s?l.push(`tab-${s}`):i&&l.push("tab-ignored"),d`<button type="button" class="${l.join(" ")}" data-tid="${r}"><span class="tab-label">${ru(e,{variant:"tab"})} ${e.confidence===void 0?m:d`<span class="tab-conf">${e.confidence}/10</span>`}${Yx(n)}</span></button>`}function Jx(e){if(a.viewMode==="table"||a.viewMode==="focus"){let t=e.confidence*10;return d`<div class="${`conf-ring ${ne(e,a.severityMode)}`}"><svg viewBox="0 0 36 36" aria-hidden="true"><circle class="conf-ring-track" cx="18" cy="18" r="15.9155"/><circle class="conf-ring-arc" cx="18" cy="18" r="15.9155" style="${`stroke-dasharray: ${t} 100`}"></circle></svg> <span>${e.confidence}<small>/10</small></span></div><div class="value-label">Confidence</div>`}return d`<div class="conf-score"><strong>${e.confidence}</strong>/10</div><div class="value-label">Confidence</div>`}var Xx=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/iu;function Qx(e){if(En(e))return m;let t=e?.name;if(typeof t!="string"||!Xx.test(t))return m;let r=e?.version,n=typeof r=="string"&&r.length>0,o=n?`https://www.npmjs.com/package/${t}/v/${encodeURIComponent(r)}`:`https://www.npmjs.com/package/${t}`,s=n?`${t}@${r}`:t;return d`<span class="line-num"><a class="npm-link" href="${o}" target="_blank" rel="noopener noreferrer" title="${`Open ${s} on npmjs.com`}">npm: ${s}</a></span>`}function Zx(e,t,r=0,n=1,o=null){let s=D(e),i=a.triage.get(s),l=i?.comment??"",c=i?.fix??"",u=pn(e,Ht(e)),p=parseInt(e.line,10),f=Number.isFinite(p)?`${e.file}:${e.line}`:e.file,h=u?d`<a href="${u}" target="_blank" rel="noopener">${f}</a>`:f,b=dn(e),g=b?d`<span class="line-num">${h}, ${b}</span>`:d`<span class="line-num">${h}</span>`,w=un(e),v=String(e.discoveredIn??"").trim(),y=v===String(e.file??"").trim()?"":v,k=o==="focus"?Qx(e.package?.npm):m,S=m;if(o!=="focus"&&e.fileHash&&Array.isArray(e._bundleHashes)&&e._bundleHashes.length>0){let le=new Set(e._bundleHashes),Y=on(e.fileHash).find(({integrity:qe})=>le.has(qe));Y&&(S=d`<button type="button" class="finding-code-btn" data-finding-code-bundle="${Y.integrity}" data-finding-code-file="${Y.file}" data-finding-code-line="${e.line??""}" title="${`Open ${Y.file} in bundle source viewer`}">Code</button>`)}let{title:M,body:_}=Gn(e),R=Cg(_),O=R.findIndex(le=>le.label!==null),B=O===-1?R:R.slice(0,O),V=O===-1?[]:R.slice(O);return d`<div class="${T({"tab-body":!0,active:t})}" data-tid="${s}">${n>1?d`<div class="print-case-label">${r+1} of ${n}</div>`:m}<div class="finding-left">${ru(e,{variant:"full"})}<div class="value-label">Severity</div>${e.confidence===void 0?m:Jx(e)} ${Bx(e)} ${S}</div><div><div class="line-row">${g} ${k} ${y?d`<span class="line-num discovered-in">(found analyzing ${y})</span>`:m} ${w?d`<span class="run-meta">${w}</span>`:m}</div>${M?d`<div class="desc-title">${xs(M)}</div>`:m} ${B.map(le=>d`<div class="desc">${gt(qn(le.body))}</div>`)} ${Ox(e)} ${V.map(le=>le.label===null?d`<div class="desc">${gt(qn(le.body))}</div>`:$s(le.label,le.body))} ${e.impact?$s("Impact",Te(e.impact,e)):m} ${e.reproduction?$s("Reproduction",Te(e.reproduction,e),"section",{collapsible:!0}):m} ${e.recommendation?$s("Recommendation",Te(e.recommendation,e),"recommendation",{collapsible:!0}):m} ${e.confidenceReason?d`<div class="conf-reason">${gt(Te(e.confidenceReason,e))}</div>`:m} ${Lx(e)} ${e.revalidateRecommendation?$s("Revalidation recommendation",Te(e.revalidateRecommendation,e),"recommendation",{collapsible:!0}):m} ${rr(e)&&e.correctedSeverityReason?d`<div class="severity-reason"><span class="severity-reason-label">Severity correction:</span> ${gt(e.correctedSeverityReason)}</div>`:m} ${l?d`<div class="comment-block"><span class="comment-label">Comment:</span> ${Fx(l)}</div>`:m} ${c?d`<div class="fix-block"><span class="fix-label">Fix:</span> ${Ut(c)?d`<a href="${c}" target="_blank" rel="noopener noreferrer">${c}</a>`:c}</div>`:m}</div></div>`}function Zn(e){return Re(e)}function Qg(e){let t=ve(e),r=Xn(e),n=e.some(s=>s.critical||ne(s,a.severityMode)==="critical"),o=["finding"];return n&&o.push("is-critical"),t.hasConflict?o.push("has-conflict"):t.commonColor&&o.push(`mark-${t.commonColor}`),a.shownTriage&&o.push(`triage-${a.shownTriage}`),r.length>1&&o.push("multi-case"),o}function Zg(e,t={}){let{context:r=null}=t,n=ve(e),o=Xn(e),s=ze(e),i=D(s),l=s.commitHash?d`<div class="commit-ref">introduced in ${Nx(s.repo?.github,s.commitHash)}</div>`:m,c=a.currentWorkspace&&l!==m;return d`${o.map((u,p)=>Zx(u,D(u)===i,p,o.length,r))} ${c?d`<div class="marks-commit-row">${l}</div>`:m}<div class="marks"><div class="marks-left">${c?m:l} ${o.length>1?d`<div class="tabs">${o.map(u=>Xg(u,D(u)===i))}</div>`:m}</div>${Jg(e,o,n,s,r)}</div>`}function mn(e){return Re(e)}function eb(e){let t=ve(e),r=e.some(o=>o.critical||ne(o,a.severityMode)==="critical"),n=[];return r&&n.push("is-critical"),t.hasConflict?n.push("has-conflict"):t.commonColor&&n.push(`mark-${t.commonColor}`),a.shownTriage&&n.push(`triage-${a.shownTriage}`),n}function tb(e){let t=ve(e),r=Xn(e),n=ze(e),o=D(n),s=n,i=vs(s),l=un(s),c=dn(s),u=c?`, ${c}`:"";return d`<div class="row-score">${ru(s,{variant:"compact"})} ${s.confidence===void 0?m:d`<span class="row-conf"><strong>${s.confidence}</strong>/10</span>`}</div><div class="row-body"><div class="title-row"><span class="title">${i}</span> ${l?d`<span class="row-type">${l}</span>`:m}</div><div class="meta-row"><span class="row-loc">${Px(s)}${u}</span><div class="marks">${Jg(e,r,t,n)}</div></div>${r.length>1?d`<div class="tabs-row"><div class="tabs">${r.map(p=>Xg(p,D(p)===o))}</div></div>`:m}</div>`}function Ss(e){return"tree-"+e.replaceAll(/[^\w-]+/gu,"_")}var nb=()=>Object.fromEntries(xe.map(e=>[e,0]));function nu(e,t){let r=new Map;for(let n of e)for(let o of n){r.has(o.file)||r.set(o.file,nb());let s=r.get(o.file),i=ne(o,t);s[i]!==void 0&&s[i]++}return r}function ou(e){let t=null;for(let r of e)if(r?.tree){t||(t={});for(let n of Object.keys(r.tree)){let o=r.tree[n];if(!t[n]){t[n]={...o,imports:[...o.imports??[]]};continue}let s=new Set(t[n].imports);for(let i of o.imports??[])s.has(i)||(s.add(i),t[n].imports.push(i));t[n].size==null&&o.size!=null&&(t[n].size=o.size)}}return t}function La(e,t){let r=new Map;for(let n of Object.keys(e)){let o=new Set,s=[...(e[n].imports??[]).filter(l=>e[l])];for(;s.length>0;){let l=s.pop();if(!o.has(l)){o.add(l);for(let c of e[l]?.imports??[])e[c]&&s.push(c)}}let i=nb();for(let l of o){let c=t.get(l);if(c)for(let u of xe)i[u]+=c[u]??0}r.set(n,i)}return r}function su(e,t,r){let n=t.get(e),o=r.get(e);return rb(n)>0||rb(o)>0}function rb(e){if(!e)return 0;let t=0;for(let r of xe)t+=e[r]??0;return t}function ob(e){if(!e)return m;let t=on(e)[0];return t?d`<button type="button" class="tree-code-btn" data-finding-code-bundle="${t.integrity}" data-finding-code-file="${t.file}" title="${`Open ${t.file} in bundle source viewer`}">Code</button>`:m}function sb(e,t){let r=Object.keys(e).toSorted(),n=new Map;for(let p of r)for(let f of e[p].imports??[]){let h=n.get(f)??[];h.push(p),n.set(f,h)}let o=a.filesSearch.trim().toLowerCase(),s=o?r.filter(p=>p.toLowerCase().includes(o)):r,i=p=>e[p]?d`<a href="${`#${Ss(p)}`}"><span class="name">${p}</span></a>`:d`<span class="name">${p}</span>`,l=p=>{let f=t.get(p);if(!f)return null;let h=xe.filter(b=>(f[b]??0)>0);return h.length===0?null:d`<span class="tree-count-chips">${h.map(b=>d`<span class="${`tree-count-chip ${b}`}">${f[b]} ${b.replaceAll("_"," ")}</span>`)}</span>`},c=p=>{let f=t.get(p);return f?xe.reduce((h,b)=>h+(f[b]??0),0):0},u=d`<div class="tree-toolbar"><view-mode-buttons modes="table,list" kind="files"></view-mode-buttons><div class="search-row"><toolbar-search kind="files"></toolbar-search><span class="result-count">${s.length} of ${r.length}</span></div></div>`;if(a.filesViewMode==="table"){let p=a.filesSelectedFile&&e[a.filesSelectedFile]&&s.includes(a.filesSelectedFile)?a.filesSelectedFile:null;return d`<div class="${p?"tree-view tree-view-table with-details":"tree-view tree-view-table"}">${u}<div class="${p?"tree-table-layout open":"tree-table-layout"}"><div class="tree-table-list">${s.length===0?d`<div class="tree-table-empty">No files match the search.</div>`:m} ${s.map(b=>{let g=c(b),w=b===p,v=ie(e[b]?.size);return d`<div class="${`tree-table-row${w?" selected":""}${g===0?" clean":""}`}" data-tree-select="${b}"><span class="tree-table-name">${b}</span> ${l(b)??d`<span class="tree-table-clean-marker">—</span>`} ${v?d`<span class="tree-table-size">${v}</span>`:m}</div>`})}</div>${p?d`<aside class="tree-table-details" id="tree-table-details"><header class="tree-table-details-bar"><span class="tree-table-details-label">Details</span> <button type="button" class="tree-table-details-close" data-tree-deselect title="Close details" aria-label="Close details">×</button></header><div class="tree-table-details-body">${e1(e[p],p,n.get(p)??[],i)}</div></aside>`:m}</div></div>`}return d`<div class="tree-view">${u} ${s.length===0?d`<div class="tree-table-empty">No files match the search.</div>`:m} ${s.map(p=>{let f=e[p],h=n.get(p)??[],b=ie(f?.size);return d`<section class="tree-file" id="${Ss(p)}"><div class="tree-file-header"><span class="name">${p}</span> ${l(p)} ${b?d`<span class="tree-file-size">${b}</span>`:m} ${ob(f.fileHash)}</div>${f.fileHash||f.treeHash?d`<div class="tree-hashes hashes">${f.fileHash?d`<div class="tree-hash">file: ${f.fileHash}</div>`:m} ${f.treeHash?d`<div class="tree-hash">tree: ${f.treeHash}</div>`:m}</div>`:m} ${f.imports?.length>0?d`<div class="tree-section"><span class="tree-section-label">imports</span><ul>${f.imports.map(g=>d`<li>${i(g)}</li>`)}</ul></div>`:m} ${h.length>0?d`<div class="tree-section"><span class="tree-section-label">imported by</span><ul>${h.map(g=>d`<li>${i(g)}</li>`)}</ul></div>`:m} ${f.exports?.length>0?d`<div class="tree-section"><span class="tree-section-label">exports</span><ul>${f.exports.map(g=>d`<li><span class="name">${g}</span></li>`)}</ul></div>`:m}</section>`})}</div>`}function e1(e,t,r,n){let o=ie(e?.size);return d`<div class="tree-detail-name"><span class="name">${t}</span> ${o?d`<span class="tree-detail-size">${o}</span>`:m} ${ob(e.fileHash)}</div>${e.fileHash||e.treeHash?d`<div class="tree-hashes hashes">${e.fileHash?d`<div class="tree-hash">file: ${e.fileHash}</div>`:m} ${e.treeHash?d`<div class="tree-hash">tree: ${e.treeHash}</div>`:m}</div>`:m} ${e.imports?.length>0?d`<div class="tree-section"><span class="tree-section-label">imports</span><ul>${e.imports.map(s=>d`<li>${n(s)}</li>`)}</ul></div>`:m} ${r.length>0?d`<div class="tree-section"><span class="tree-section-label">imported by</span><ul>${r.map(s=>d`<li>${n(s)}</li>`)}</ul></div>`:m} ${e.exports?.length>0?d`<div class="tree-section"><span class="tree-section-label">exports</span><ul>${e.exports.map(s=>d`<li><span class="name">${s}</span></li>`)}</ul></div>`:m}`}function t1(){return{showAll:!1,splitOwnDirs:!1,packagesView:!1,selected:null,focusedPkg:null,topPkgsTab:"issues",edgeOpacity:.22,nodeSize:1,showLabels:!1,selectedSeverities:new Set,selectedColors:new Set,pathFilter:"",hidden:new Set,solo:null,graphState:null,layoutCache:null}}var Br=t1(),A=new Proxy(Br,{get(e,t){return Br[t]},set(e,t,r){return Br[t]=r,!0},has(e,t){return t in Br},deleteProperty(e,t){return delete Br[t]},ownKeys(){return Reflect.ownKeys(Br)},getOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(Br,t)}});function Be(){A.graphState?._cleanup&&A.graphState._cleanup(),A.graphState=null}function ib(){return Br}var Cs=null,ab=null;function eo(){return ab}function r1(){return Cs||(Cs=(async()=>{let e="./graph.js";try{let t=await import(e);return t._swapGraph2Impl(ib()),ab=t,t}catch(t){throw Cs=null,t}})(),Cs)}async function iu(e,t,r,n,o){try{let s=await r1(),i=s.buildGraphFromPrep(t);J(d`<graph-layout .graph="${i}" .options="${r}"></graph-layout>`,e);let l=e.querySelector("graph-layout");return await l.updateComplete,n(),o(),s.attachGraph2Interaction(e,i,n,o),l}catch(s){let i=s instanceof Error?s.message:String(s);return e.textContent=`Graph failed to load: ${i}`,null}}function We(e){let t=new Map;if(!e)return t;if(e.kind==="stasis"){if(!e.bundle)return t;for(let[r,n]of e.bundle.sources)typeof n=="string"&&t.set(r,n)}else if(e.kind==="sourcemap"){if(!e.json)return t;let r=e.json.sources??[],n=e.json.sourcesContent??[];for(let o=0;o<r.length;o++)typeof n[o]=="string"&&t.set(r[o],n[o])}return t}function Lr(e){if(e?.kind!=="stasis"||!e.bundle?.modules)return null;let t=new Map;for(let[r,n]of e.bundle.modules)for(let o of Object.keys(n.files))t.set(r==="."?o:`${r}/${o}`,r);return t}function Es(e){let t=new Map;if(e?.kind!=="stasis"||!e.bundle?.modules)return t;for(let[r,n]of e.bundle.modules){if(!r.includes("node_modules")||!n?.name||typeof n.version!="string"||!n.version)continue;let o=t.get(n.name);o||(o=new Set,t.set(n.name,o)),o.add(n.version)}return t}var As=null,Ts=null;function n1(){return As||(As=(async()=>{let e="./terminal.js";try{return await import(e)}catch(t){throw As=null,t}})(),As)}function o1(e){let t=We(e);if(t.size===0)return t;let r=[...t.keys()],{stripped:n}=it(r),o=new Map;for(let s=0;s<r.length;s++)o.set(n[s],t.get(r[s]));return o}async function lb(e,t){let r=t?.integrity??"";(!Ts||Ts.integrity!==r)&&(Ts={integrity:r,promise:s1(t,r)});try{let n=await Ts.promise;return!e.isConnected||e.contains(n)||e.replaceChildren(n),n}catch(n){Ts=null;let o=n instanceof Error?n.message:String(n);return e.textContent=`Terminal failed to load: ${o}`,null}}async function s1(e,t){return(await n1()).createTerminalElement(o1(e),t)}function db(e){if(!e)return null;let t=$g(),r=new RegExp(`^(?:.*/)?${t}/(@[^/]+/[^/]+|[^/]+)`,"u"),n=e.match(r);if(n)return n[1];let o=e.indexOf("/");return o>0?e.slice(0,o):"/"}var i1=["#4e9af1","#f28e2b","#59a14f","#e15759","#76b7b2","#edc948","#b07aa1","#ff9da7","#9c755f","#5cd1e5","#f1ce63","#d37295","#a0cbe8","#86bcb6","#8cd17d","#b6992d","#499894","#e15759","#e879c7","#d4a6c8"],cb=["#2f8aef","#d2691e","#2ea043","#e63946","#2e9a92","#b88817","#9560e8","#d24a9c","#8a5d40","#0891b2","#a07a14","#c14e8e","#1f7ad0","#549b94","#3fb95f","#a07a14","#2a8278","#cb2c40","#c026d3","#965f93"];function a1(){if(typeof document>"u")return!1;let e=document.body?.classList;return!!e&&(e.contains("theme-light")||e.contains("theme-pink"))}var au=new Map;function Xe(e){let t=a1()?cb:i1,n=`${t===cb?"l":"d"}:${e??"__own__"}`;if(au.has(n))return au.get(n);let o=e??"__own__",s=0;for(let u of o)s=s*37+u.codePointAt(0)|0;let l=((s%t.length+t.length)%t.length*7+3)%t.length,c=t[l];return au.set(n,c),c}var lu=(e,t,r)=>{for(let n of t)if(n[0]===e)return(0,n[1])();return r?.()};var to='<svg class="file-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2 2 5v6l6 3 6-3V5L8 2Z"/><path d="M2 5l6 3 6-3"/><path d="M8 8v6"/></svg>',Oa='<svg class="file-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2.5" y="4" width="11" height="9" rx="1.2"/><path d="M6 4V3h4v1"/></svg>';var ub="@preventive/triage";function cu(e,t){let r=e.toLowerCase(),n="",o=r;if(r.startsWith("@")){let i=r.indexOf("/");i>0&&(n=r.slice(0,i),o=r.slice(i+1))}return`pkg:npm/${n?`${encodeURIComponent(n)}/`:""}${encodeURIComponent(o)}@${encodeURIComponent(t)}`}function Pa(e){let t=/^(.*?)\.stasis\.(?:code|resources)\.br$/u.exec(e);return t?t[1]:e.replace(/\.[^.]+$/u,"")||e}function pb(e){let t=[];if(e?.kind!=="stasis"||!e.bundle?.modules)return t;let r=new Map;for(let[n,o]of e.bundle.modules){if(!o?.name||typeof o.version!="string"||!o.version)continue;let s=`${o.name}@${o.version}`,i=r.get(s);if(i!==void 0){n==="."&&(t[i].dir=".");continue}r.set(s,t.length),t.push({name:o.name,version:o.version,dir:n})}return t}function fb(e){if(e?.kind!=="stasis"||!e.bundle?.modules)return!1;for(let[,t]of e.bundle.modules)if(t?.name&&typeof t.version=="string"&&t.version)return!0;return!1}function hb(e,t){let r=e.find(s=>s.dir===".")??null,n=r?e.filter(s=>s!==r):e;return{root:r?{name:r.name,version:r.version,purl:cu(r.name,r.version)}:{name:Pa(t?.name??"bundle"),version:null,purl:null},rest:n}}function mb(e){return e??globalThis.crypto.randomUUID()}function gb(e,t,{now:r=new Date,uuid:n}={}){let o=pb(e),{root:s,rest:i}=hb(o,t),l={type:"application","bom-ref":s.purl??`application:${s.name}`,name:s.name};s.version&&(l.version=s.version),s.purl&&(l.purl=s.purl);let c={bomFormat:"CycloneDX",specVersion:"1.5",serialNumber:`urn:uuid:${mb(n)}`,version:1,metadata:{timestamp:r.toISOString(),tools:{components:[{type:"application",name:ub}]},component:l},components:i.map(u=>{let p=cu(u.name,u.version);return{type:"library","bom-ref":p,name:u.name,version:u.version,purl:p}})};return`${JSON.stringify(c,null,2)}
86
+ `}function l1(e){return{referenceCategory:"PACKAGE-MANAGER",referenceType:"purl",referenceLocator:e}}function bb(e,t,{now:r=new Date,uuid:n}={}){let o=pb(e),{root:s,rest:i}=hb(o,t),l=Pa(t?.name??"bundle"),c=r.toISOString().replace(/\.\d{3}Z$/u,"Z"),u=(g,w,v,y)=>{let k={SPDXID:g,name:w,downloadLocation:"NOASSERTION",filesAnalyzed:!1,licenseConcluded:"NOASSERTION",licenseDeclared:"NOASSERTION",copyrightText:"NOASSERTION"};return v&&(k.versionInfo=v),y&&(k.externalRefs=[l1(y)]),k},p="SPDXRef-Package-root",f=[u(p,s.name,s.version,s.purl)],h=[{spdxElementId:"SPDXRef-DOCUMENT",relationshipType:"DESCRIBES",relatedSpdxElement:p}];i.forEach((g,w)=>{let v=`SPDXRef-Package-${w+1}`;f.push(u(v,g.name,g.version,cu(g.name,g.version))),h.push({spdxElementId:p,relationshipType:"DEPENDS_ON",relatedSpdxElement:v})});let b={spdxVersion:"SPDX-2.3",dataLicense:"CC0-1.0",SPDXID:"SPDXRef-DOCUMENT",name:l,documentNamespace:`https://spdx.org/spdxdocs/${encodeURIComponent(l)}-${mb(n)}`,creationInfo:{created:c,creators:[`Tool: ${ub}`]},packages:f,relationships:h};return`${JSON.stringify(b,null,2)}
87
+ `}function c1(e,t){let r=t?"gu":"giu",n=t?"g":"gi";try{return{re:new RegExp(e,r)}}catch{try{return{re:new RegExp(e,n)}}catch(o){return{error:o.message}}}}function du(e,t,r){if(t){let s=c1(e,r);if(s.error)return{error:s.error};let{re:i}=s;return{ranges(l){i.lastIndex=0;let c=[],u;for(;(u=i.exec(l))!==null;){if(u[0].length===0){i.lastIndex++;continue}if(c.push([u.index,u.index+u[0].length]),c.length>=50)break}return c}}}let n=r?e:e.toLowerCase(),o=n.length;return{ranges(s){let i=r?s:s.toLowerCase(),l=[],c=0,u;for(;(u=i.indexOf(n,c))!==-1&&(l.push([u,u+o]),c=u+o,!(l.length>=50)););return l}}}function d1(e,t){let r=[...e.keys()].toSorted(),n=[],o=0,s=!1;for(let i of r){let l=e.get(i);if(typeof l!="string")continue;let c=l.split(`
88
+ `),u=[];for(let p=0;p<c.length;p++){let f=t.ranges(c[p]);if(f.length!==0&&(u.push({ln:p+1,ranges:f}),o++,o>=5e3)){s=!0;break}}if(u.length>0&&n.push({path:i,lines:c,hits:u}),s)break;if(n.length>=500){s=!0;break}}return{fileResults:n,totalHits:o,truncated:s}}function u1(e,t){let r=[],n=0;for(let{path:o,lines:s,hits:i}of e.fileResults){let l=[];for(let{ln:c}of i){let u=t.ranges(s[c-1]);u.length!==0&&(l.push({ln:c,ranges:u}),n++)}l.length>0&&r.push({path:o,lines:s,hits:l})}return{fileResults:r,totalHits:n,truncated:!1}}var Qe={tag:null,useRegex:!1,caseSensitive:!1,entries:[]};function yb(e,t,r,n,o){if(!r)return{fileResults:[],totalHits:0,truncated:!1};let s=du(r,n,o);if(s.error)return{error:s.error};(Qe.tag!==e||Qe.useRegex!==n||Qe.caseSensitive!==o)&&(Qe.tag=e,Qe.useRegex=n,Qe.caseSensitive=o,Qe.entries.length=0);let i=n||o?f=>f:f=>f.toLowerCase(),l=i(r),c=null,u=-1;for(let f=0;f<Qe.entries.length;f++){let h=Qe.entries[f],b=i(h.query);if(b===l)return Qe.entries.splice(f,1),Qe.entries.unshift(h),h.result;n||h.result.truncated||b.length<=u||!l.includes(b)||(c=h.result,u=b.length)}let p=c?u1(c,s):d1(t,s);return Qe.entries.unshift({query:r,result:p}),Qe.entries.length>8&&Qe.entries.pop(),p}function bt(e,{splitOwnDirs:t=!0,packageDir:r=null}={}){let n=/(?:^|\/)(?:node_modules|dependencies)\/(@[^/]+\/[^/]+|[^/]+)/gu,o;for(;(o=n.exec(e))!==null;)if(o[1]!==".pnpm")return o[1];if(r&&r!=="."&&!r.includes("node_modules"))return r;if(t){let s=e.indexOf("/");if(s>0)return e.slice(0,s)}return"__own__"}function vb(e,t=null){let r=new Set;for(let n of e){let o=t?.(n)??null;if(bt(n,{splitOwnDirs:!1,packageDir:o})==="__own__"&&(r.add(bt(n,{splitOwnDirs:!0,packageDir:o})),r.size>1))return!0}return!1}var _e=`.lwd-body{margin:.2rem 0 .55rem;color:var(--text);font-size:.86rem;line-height:1.5}.lwd-empty{margin:.2rem 0 .55rem;color:var(--muted);font-size:.78rem}.lwd-note{margin:.2rem 0 .65rem;padding:.55rem .7rem;border:1px solid var(--border);border-radius:6px;background:rgb(from var(--text) r g b / .03);color:var(--muted);font-size:.78rem;line-height:1.45}.lwd-choice{margin:.2rem 0 .65rem;padding:.55rem .7rem .6rem;border:1px solid var(--border);border-radius:6px;background:rgb(from var(--text) r g b / .03);& legend{padding:0 .35rem;color:var(--text);font-size:.78rem;font-weight:500;& strong{font-weight:600}}}.lwd-option{display:flex;align-items:flex-start;gap:.5rem;padding:.3rem .15rem;& input[type=radio]{margin:.15rem 0 0;accent-color:var(--accent)}.lwd-option-text{display:flex;flex-direction:column;gap:.1rem;min-width:0}.lwd-option-title{color:var(--text);font-size:.82rem;line-height:1.35}.lwd-option-hint{color:var(--muted);font-size:.72rem;line-height:1.4}}.lwd-list{margin:0;padding-left:1.1rem;color:var(--muted);font-size:.76rem;line-height:1.5;& li+li{margin-top:.2rem}& strong{color:var(--text);font-weight:600}}.lwd-kind-tag{display:inline-block;vertical-align:middle;margin-left:.3rem;padding:0 .35rem;border:1px solid var(--border);border-radius:3px;background:rgb(from var(--text) r g b / .04);color:var(--muted);font-size:.62rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em}.lwd-rename-input{margin-top:.2rem}.lwd-rename-error{margin:.25rem 0 0;color:var(--critical, #f87171);font-size:.72rem;line-height:1.35}
89
+ `;var uu=class extends I{static styles=[...I.styles,F(_e)];static properties={reportName:{type:String},workspaceNames:{type:Array},existingNames:{type:Object},_choice:{state:!0},_newName:{state:!0}};constructor(){super(),this.reportName="",this.workspaceNames=[],this.existingNames=new Set,this._choice="replace",this._newName=""}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_onClose=()=>this._finish({action:"cancel"});_onCancel=()=>this._finish({action:"cancel"});_onChoiceChange=t=>{this._choice=t.target.value};_onNewNameInput=t=>{this._newName=t.target.value};_onNewNameKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._onConfirm())};_onConfirm=()=>{if(this._choice==="rename"){let t=(this._newName??"").trim();if(!this._isRenameValid(t))return;this._finish({action:"rename",newName:t});return}this._finish({action:"replace"})};_replaceHint(){let t=this.workspaceNames.length;if(t===0)return d`<span class="lwd-option-hint">The local file will be overwritten.</span>`;let r=t===1?d`workspace <strong>"${this.workspaceNames[0]}"</strong>`:d`<strong>${t}</strong> workspaces (${this.workspaceNames.join(", ")})`;return d`<span class="lwd-option-hint">The local file will be overwritten. When sync is online, the new bytes are also uploaded to ${r} so the cloud copy matches.</span>`}_renameValidationTpl(t){return t?t===this.reportName?d`<p class="lwd-rename-error">Pick a name different from the original.</p>`:t.includes("\0")?d`<p class="lwd-rename-error">The new name cannot contain a NUL byte.</p>`:t.includes("/")||t.includes("\\")?d`<p class="lwd-rename-error">The new name cannot contain "/" or "\\".</p>`:this.existingNames.has(t)?d`<p class="lwd-rename-error">A file named "${t}" already exists — pick something else.</p>`:m:d`<p class="lwd-rename-error">Enter a new name.</p>`}_isRenameValid(t){return t.length>0&&t!==this.reportName&&!t.includes("\0")&&!t.includes("/")&&!t.includes("\\")&&!this.existingNames.has(t)}render(){let t=this._choice==="rename",r=(this._newName??"").trim(),n=t&&!this._isRenameValid(r),o=t?"Rename":"Replace",s=t?"primary":"danger",i=this.workspaceNames.length>0?d`<span class="lwd-option-hint">Saved as an unfiled report — the renamed copy isn't added to any workspace.</span>`:m;return d`<dialog @close="${this._onClose}"><header><h3>Import conflict</h3></header><p class="lwd-body"><strong>"${this.reportName}"</strong> already exists with different content.</p><fieldset class="lwd-choice"><legend>What should happen?</legend><label class="lwd-option"><input type="radio" name="icd-choice" value="replace" ?checked="${this._choice==="replace"}" @change="${this._onChoiceChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Replace</span> ${this._replaceHint()}</span></label> <label class="lwd-option"><input type="radio" name="icd-choice" value="rename" ?checked="${this._choice==="rename"}" @change="${this._onChoiceChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Rename to</span> <input type="text" class="nwd-input lwd-rename-input" maxlength="200" .value="${this._newName}" ?disabled="${!t}" @input="${this._onNewNameInput}" @keydown="${this._onNewNameKeydown}" @focus="${()=>{this._choice="rename"}}"> ${i} ${t?this._renameValidationTpl(r):m}</span></label></fieldset><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="${s}" ?disabled="${n}" @click="${this._onConfirm}">${o}</button></footer></dialog>`}};customElements.define("import-conflict-dialog",uu);function wb({name:e,workspaceNames:t,existingNames:r}={}){let n=r instanceof Set?r:new Set(r??[]);return new Promise(o=>{let s=document.createElement("import-conflict-dialog");Object.assign(s,{reportName:e??"",workspaceNames:Array.isArray(t)?t:[],existingNames:n,_newName:f1(e??"",n)}),s.addEventListener("resolve",i=>{s.remove(),o(i.detail)}),s.addEventListener("modal-conflict",()=>{s.remove(),o({action:"cancel"})}),document.body.append(s)})}function f1(e,t){if(typeof e!="string"||e.length===0)return"";let r=e.lastIndexOf("."),n=r>0?e.slice(0,r):e,o=r>0?e.slice(r):"",s=n.replace(/-\d+$/u,"");for(let i=2;i<1e3;i++){let l=`${s}-${i}${o}`;if(!t.has(l))return l}return""}var h1=new Set(["module","commonjs","json","module-typescript","commonjs-typescript"]),m1=new Set(["solidity","php","shell","rust"]),g1=new Set(["java","kotlin","gradle","objc","objcpp","swift","c","cpp","c-header","cpp-header","ruby","cmake","podspec","podfile","podfile-lock","template","xml","env","fastlane","pbxproj"]),b1=new Set(["resource","resource:base64"]),xb=new Set(["stat:file","stat:directory"]),_b=new Set([...h1,...m1,...g1,...b1,"patch","directory",...xb]),pu=e=>xb.has(e),kb=e=>e==="directory"||e==="stat:directory"?"directory":"file";function y1(e,t,r){if(e===t)return e;let n=pu(e),o=pu(t);if(n!==o&&kb(e)===kb(t))return n?t:e;throw new Error(`format conflict for '${r}' ('${t}' vs '${e}')`)}function ro(e,t){return t===""?e:e==="."?t:`${e}/${t}`}function Sb(e,{scope:t="full"}={}){let r=new Set;for(let[n,{files:o}]of e)if(!(t!=="full"&&!so(n)))for(let s of Object.keys(o))r.add(ro(n,s));return r}function v1(e,{what:t,files:r,formats:n,scope:o}){if(yt(e))return"escapes the root";if(o!=="full"&&!so(e))return`is outside node_modules, which a '${o}'-scope ${t} does not record`;if(!r.has(e))return`names no file the ${t} records`;let s=n.get(e);return s==="directory"?"is a directory capture, not a file":pu(s)?`is a payload-free '${s}' record, not a file`:null}function Cb(e,{what:t,files:r,formats:n,scope:o}){for(let s of e){let i=v1(s,{what:t,files:r,formats:n,scope:o});H(i===null,`${t}: executable entry '${s}' ${i}`)}}function Eb(e,{what:t,files:r,formats:n,scope:o="full"}){if(e===void 0)return new Set;let s=`${t}: executable`;H(Array.isArray(e),`${s} must be an array of file paths`);let i=new Set;for(let l of e)H(typeof l=="string"&&l!=="",`${s} entry must be a non-empty string`),H(!i.has(l),`${s} entry '${l}' is listed twice`),i.add(l);return Cb(i,{what:t,files:r,formats:n,scope:o}),i}function Ab(e,{what:t,modules:r,formats:n,scope:o}){if(e.size!==0)return Cb(e,{what:t,files:Sb(r,{scope:o}),formats:n,scope:o}),Na(e)}function H(e,t){if(!e)throw new Error(t)}function no(e,t){let[r,n]=[e.split("/"),t.split("/")];for(;r.length>0&&r[0]===n[0];)r.shift(),n.shift();if(r.length===0&&n.length===0)return 0;if(r.length<2)return n.length<2&&r>n?1:-1;if(n.length<2)return 1;if(r[0]==="*")return-1;if(n[0]==="*"||r[0]==="node_modules")return 1;if(n[0]==="node_modules")return-1;let[o,s]=[r,n].map(i=>i.join(String.fromCodePoint(0)));if(o<s)return-1;if(o>s)return 1;throw new Error("Unreachable")}var Is=e=>e&&[null,Object.prototype].includes(Object.getPrototypeOf(e)),oo=e=>Object.setPrototypeOf(Object.fromEntries(e),null),Na=e=>[...e].toSorted((t,r)=>no(t,r)),Rs=(e,{sorted:t=!0}={})=>{if(!t){let r=Object.create(null);for(let[n,o]of e)r[n]=o instanceof Map?Rs(o,{sorted:t}):o;return r}return oo([...e].toSorted((r,n)=>no(r[0],n[0])).map(([r,n])=>[r,n instanceof Map?Rs(n,{sorted:t}):n]))},fu=e=>new Map(Object.entries(e).map(([t,r])=>[t,Is(r)?fu(r):r]));function yt(e){if(e.startsWith("/"))return!0;let t=0;for(let r of e.split("/"))if(!(r==="."||r==="")){if(r!=="..")t++;else if(--t<0)return!0}return!1}function w1(e,t){let r=e instanceof Map;if(r!==t instanceof Map)return!1;if(!r)return e===t;if(e.size!==t.size)return!1;for(let[n,o]of e)if(t.get(n)!==o)return!1;return!0}var $b=e=>e instanceof Map?`{${[...e].map(([t,r])=>`${t}: ${r}`).join(", ")}}`:e;function Tb(e,t,r){let n=new Map,o=s=>{for(let[i,l]of s){let c=n.get(i);c===void 0&&n.set(i,c=new Map);for(let[u,p]of l){let f=c.get(u);f===void 0&&c.set(u,f=new Map);for(let[h,b]of p)f.has(h)?H(w1(f.get(h),b),`${r}: import '${h}' from '${u}' resolves differently ('${$b(f.get(h))}' vs '${$b(b)}')`):f.set(h,b instanceof Map?new Map(b):b)}}};return o(e),o(t),n}function Rb(e,t,r){let n=new Map,o=s=>{for(let[i,l]of s){let c=n.get(i);if(c===void 0){n.set(i,l);continue}try{n.set(i,y1(l,c,i))}catch(u){throw new Error(`${r}: ${u.message}`,{cause:u})}}};return o(e),o(t),n}function Ib(e,t,r,n){if(e.size===0)return new Set(t);let o=Sb(r,{scope:n}),s=new Set(t);for(let i of e)o.has(i)||s.add(i);return s}function Mb(e,t,r){let n=new Map,o=s=>{for(let[i,l]of s){let c=n.get(i);if(c===void 0){n.set(i,{name:l.name,version:l.version,...l.ecosystem===void 0?{}:{ecosystem:l.ecosystem},files:Object.assign(Object.create(null),l.files)});continue}H(c.name===l.name,`${r}: module '${i}' name mismatch ('${c.name}' vs '${l.name}')`),H(c.version===l.version,`${r}: module '${i}' version mismatch ('${c.version}' vs '${l.version}')`),H(c.ecosystem===l.ecosystem,`${r}: module '${i}' ecosystem mismatch ('${c.ecosystem??"(none)"}' vs '${l.ecosystem??"(none)"}')`);for(let[u,p]of Object.entries(l.files))Object.hasOwn(c.files,u)?H(c.files[u]===p,`${r}: content mismatch for '${ro(i,u)}'`):c.files[u]=p}};return o(e),o(t),n}function so(e){return e.split("/").includes("node_modules")}function k1(e){let t="node_modules/",r=e.length;for(;(r=e.lastIndexOf(t,r-1))!==-1;)if(r===0||e[r-1]==="/")return r;return-1}function Fb(e){let t="node_modules/",r=k1(e);if(r===-1)return null;let n=r+t.length,o=e.slice(n).split("/"),s=o[0].startsWith("@")?2:1;if(o.length<=s||o.slice(0,s).some(l=>!l))return null;let i=o.slice(0,s).join("/");return{dir:e.slice(0,n)+i,rel:o.slice(s).join("/"),name:i}}var Or=1,Bb=0,Lb=({name:e,version:t,ecosystem:r,files:n})=>(H(r===void 0||typeof r=="string"),{name:e,version:t,...r===void 0?{}:{ecosystem:r},files:oo(Object.entries(n))}),$1=e=>Fb(e)??{dir:".",rel:e,name:null},Ob=(e,t)=>{if(e===void 0)return t;if(t===void 0)return e;let r={};for(let n of[e,t])for(let[o,s]of Object.entries(n))r[o]=Na(new Set([...r[o]??[],...s]));return r},Da=class e{static VERSION=Or;version=Or;config;entries;modules;formats;imports;executable;reason;constructor({config:t={scope:"full"},entries:r,modules:n,formats:o,imports:s,executable:i,reason:l,version:c=Or}={}){H([Bb,Or].includes(c)),H(["node_modules","full"].includes(t.scope)),this.version=c,this.config=t,this.entries=r??new Set,this.modules=n??new Map,this.formats=o??new Map,this.imports=s??new Map,this.executable=i??new Set,this.reason=l}get sources(){let t=new Map;for(let[r,{files:n}]of this.modules)for(let[o,s]of Object.entries(n))t.set(ro(r,o),s);return t}static isResourceFormat(t){return t==="resource"||t==="resource:base64"||t==="directory"}get hasCode(){for(let[t,{files:r}]of this.modules)for(let n of Object.keys(r))if(!e.isResourceFormat(this.formats.get(ro(t,n))))return!0;return!1}static parse(t){let r=JSON.parse(t);H(r.version===Or||r.version===Bb),H(["node_modules","full"].includes(r.config?.scope)),H(Is(r.formats)),H(Is(r.imports));let n=new Map;for(let[u,p]of Object.entries(r.formats)){H(!yt(u)),H(_b.has(p),`unknown format '${p}' for ${u}`);let f=u===""?".":u;H(!n.has(f),`duplicate format key '${f}'`),n.set(f,p)}let o=new Map,s=new Set;if(r.version===Or){let u=r.config.scope==="full";if(r.modules!==void 0){H(typeof r.modules=="object"&&r.modules!==null);for(let[p,f]of Object.entries(r.modules))H(so(p)),H(!yt(p)),H(f?.name&&f.version&&f.files),o.set(p,Lb(f))}if(u){H(r.sources&&typeof r.sources=="object");for(let[p,f]of Object.entries(r.sources))H(!so(p)),H(!yt(p)),H(f?.name&&f.version&&f.files),o.set(p,Lb(f));H(r.entries===void 0||Array.isArray(r.entries)),s=new Set(r.entries)}else H(r.entries===void 0),H(r.sources===void 0);for(let[,{files:p}]of o)for(let f of Object.keys(p))H(!yt(f))}else{H(r.sources);for(let[u,p]of Object.entries(r.sources)){H(!yt(u));let{dir:f,rel:h,name:b}=$1(u);H(!yt(f)&&!yt(h)),o.has(f)||o.set(f,{name:b,version:null,files:Object.create(null)}),o.get(f).files[h]=p}}let i=new Set;for(let[u,{files:p}]of o)for(let f of Object.keys(p)){let h=ro(u,f);H(!i.has(h),`duplicate file key '${h}' across bundle buckets`),i.add(h)}let l=fu(r.imports),c=u=>{if(typeof u=="string"){H(!yt(u));return}H(u instanceof Map&&u.size>0,"import target must be a file or a non-empty {platform: file} map");for(let[p,f]of u)H(typeof p=="string"&&p.length>0&&!p.includes("/"),`invalid platform key '${p}'`),H(typeof f=="string"),H(!yt(f))};for(let[,u]of l){H(u instanceof Map);for(let[p,f]of u){H(!yt(p)),H(f instanceof Map);for(let[,h]of f)c(h)}}return new e({version:r.version,config:r.config,entries:s,modules:o,formats:n,imports:l,executable:r.version===Or?Eb(r.executable,{what:"bundle",files:i,formats:n,scope:r.config.scope}):new Set,reason:Is(r.reason)?r.reason:void 0})}#e(){let t=[],r=[];for(let[n,{name:o,version:s,ecosystem:i,files:l}]of this.modules){if(Object.keys(l).length===0)continue;let c=so(n);c&&H(o&&s&&l);let u=oo(Object.entries(l).toSorted((f,h)=>no(f[0],h[0])));(c?t:r).push([n,{name:o,version:s,...i===void 0?{}:{ecosystem:i},files:u}])}return t.sort((n,o)=>no(n[0],o[0])),r.sort((n,o)=>no(n[0],o[0])),{modules:oo(t),sources:oo(r)}}serialize(){let t=Na(this.entries),{modules:r,sources:n}=this.#e(),o=Rs(this.formats),s=Rs(this.imports),i={version:Or,config:this.config};this.config.scope==="full"&&Object.assign(i,{entries:t,sources:n}),Object.assign(i,{modules:r,formats:o,imports:s});let l=Ab(this.executable,{what:"bundle",modules:this.modules,formats:this.formats,scope:this.config.scope});return l!==void 0&&(i.executable=l),this.reason!==void 0&&(i.reason=this.reason),JSON.stringify(i,void 0,2)}withReason(t){let r=[...this.sources.keys()];return new e({version:this.version,config:this.config,entries:this.entries,modules:this.modules,formats:this.formats,imports:this.imports,executable:this.executable,reason:Ob(this.reason,{[t]:r})})}merge(t){return H(this.config.scope===t.config.scope,`bundle merge: scope mismatch ('${this.config.scope}' vs '${t.config.scope}')`),new e({config:{scope:this.config.scope},entries:new Set([...this.entries,...t.entries]),modules:Mb(this.modules,t.modules,"bundle merge"),formats:Rb(this.formats,t.formats,"bundle merge"),imports:Tb(this.imports,t.imports,"bundle merge"),executable:Ib(this.executable,t.executable,t.modules,this.config.scope),reason:Ob(this.reason,t.reason)})}};var za=null,Ua=null,Ha=null;function x1(){for(let e of["br","brotli"])try{return new DecompressionStream(e),e}catch{}return null}async function _1(e,t){let r=new Blob([t]).stream().pipeThrough(new DecompressionStream(e));return new Uint8Array(await new Response(r).arrayBuffer())}async function S1(){if("serviceWorker"in navigator)try{let e=await navigator.serviceWorker.getRegistrations();for(let t of e){let r=t.active?.scriptURL??t.installing?.scriptURL??t.waiting?.scriptURL;r&&r.endsWith("/brotli-sw.js")&&await t.unregister()}}catch{}}function C1(){return Ha||(Ha=(async()=>await import("./brotli-fallback.js"))(),Ha)}async function E1(){await S1();let e=x1();return e?(za={kind:"native",format:e},za):(za={kind:"fallback"},za)}function Pb(){return Ua||(Ua=E1(),Ua)}async function Nb(e){let t=await Pb();return t.kind==="native"?_1(t.format,e):(await C1()).brotliDecompress(e)}Pb().catch(()=>{});async function io(e,t){try{let r=await Gt(e),n=t.name.toLowerCase().endsWith(".map"),o=n?"sourcemap":"stasis";try{if(n){let l=JSON.parse(Ee(r));return{integrity:e,kind:o,size:r.byteLength,json:l}}let s=Ee(await Nb(r)),i=Da.parse(s);return{integrity:e,kind:o,size:r.byteLength,bundle:i}}catch(s){return{integrity:e,kind:o,size:r.byteLength,error:s.message}}}catch(r){return{integrity:e,error:r.message,size:0}}}function A1(e){!e?.json&&!e?.bundle||(async()=>{try{let t=await mu(e);if(Xi(e.integrity,t),a.selectedBundle!==e.integrity)return;e.fileHashes=t,x()}catch{}})()}async function hu(e){if(Rc(e))return;let t=(a.bundles??[]).find(n=>n.integrity===e);if(!t)return;let r=await io(e,t);if(!(!r?.json&&!r?.bundle))try{let n=await mu(r);Xi(e,n)}catch{}}async function nr(e){let t=(a.bundles??[]).find(n=>n.integrity===e);if(!t)return;let r=await io(e,t);a.selectedBundle===e&&(a.bundleDetails=r,x(),A1(r),Ot().catch(()=>{}))}var T1=["finding_url","repository","title","description","severity","configured_scan_id","relevant_paths"];function R1(e){let t=[],r=[],n="",o=!1,s=e.length;for(let i=0;i<s;i++){let l=e[i];o?l==='"'?e[i+1]==='"'?(n+='"',i++):o=!1:n+=l:l==='"'?o=!0:l===","?(r.push(n),n=""):l===`
70
90
  `||l==="\r"?(r.push(n),t.push(r),r=[],n="",l==="\r"&&e[i+1]===`
71
- `&&i++):n+=l}for((n!==""||r.length>0)&&(r.push(n),t.push(r));t.length>0&&t.at(-1).length===1&&t.at(-1)[0]==="";)t.pop();return t}function tb(e){let t=yx(e);if(t.length<2)throw new Error("Codex CSV: empty or missing header row");let r=t[0],n=l=>r.indexOf(l);for(let l of bx)if(n(l)===-1)throw new Error(`Codex CSV: missing required column "${l}"`);let o={finding_url:n("finding_url"),repository:n("repository"),title:n("title"),description:n("description"),severity:n("severity"),detected_at:n("detected_at"),committed_at:n("committed_at"),configured_scan_id:n("configured_scan_id"),commit_hash:n("commit_hash"),relevant_paths:n("relevant_paths")},s=new Map;for(let l=1;l<t.length;l++){let c=t[l];if(c.length===1&&c[0]==="")continue;let u=c[o.configured_scan_id];u&&(s.has(u)||s.set(u,[]),s.get(u).push(c))}if(s.size===0)throw new Error("Codex CSV: no rows with a configured_scan_id");let i=[];for(let[l,c]of s){let u=new Set(c.map(m=>m[o.repository]).filter(Boolean));if(u.size>1)throw new Error(`Codex CSV: scan ${l} contains multiple repositories: ${[...u].join(", ")}`);let p=[...u][0]||"unknown-repo",f=l.replace(/^[^:]+:/u,""),h=`${p}:${f}`,b=c.map(m=>vx(m,o));i.push({displayName:h,data:{type:"security",source:"codex-security",findings:b}})}return i}function vx(e,t){let r=(e[t.relevant_paths]||"").split(" | ").map(c=>c.trim()).find(Boolean)||"unknown",n="?",o=e[t.title]||"",s=e[t.description]||"",i=o&&s?`${o}
91
+ `&&i++):n+=l}for((n!==""||r.length>0)&&(r.push(n),t.push(r));t.length>0&&t.at(-1).length===1&&t.at(-1)[0]==="";)t.pop();return t}function Db(e){let t=R1(e);if(t.length<2)throw new Error("Codex CSV: empty or missing header row");let r=t[0],n=l=>r.indexOf(l);for(let l of T1)if(n(l)===-1)throw new Error(`Codex CSV: missing required column "${l}"`);let o={finding_url:n("finding_url"),repository:n("repository"),title:n("title"),description:n("description"),severity:n("severity"),detected_at:n("detected_at"),committed_at:n("committed_at"),configured_scan_id:n("configured_scan_id"),commit_hash:n("commit_hash"),relevant_paths:n("relevant_paths")},s=new Map;for(let l=1;l<t.length;l++){let c=t[l];if(c.length===1&&c[0]==="")continue;let u=c[o.configured_scan_id];u&&(s.has(u)||s.set(u,[]),s.get(u).push(c))}if(s.size===0)throw new Error("Codex CSV: no rows with a configured_scan_id");let i=[];for(let[l,c]of s){let u=new Set(c.map(g=>g[o.repository]).filter(Boolean));if(u.size>1)throw new Error(`Codex CSV: scan ${l} contains multiple repositories: ${[...u].join(", ")}`);let p=[...u][0]||"unknown-repo",f=l.replace(/^[^:]+:/u,""),h=`${p}:${f}`,b=c.map(g=>I1(g,o));i.push({displayName:h,data:{type:"security",source:"codex-security",findings:b}})}return i}function I1(e,t){let r=(e[t.relevant_paths]||"").split(" | ").map(c=>c.trim()).find(Boolean)||"unknown",n="?",o=e[t.title]||"",s=e[t.description]||"",i=o&&s?`${o}
72
92
 
73
- ${s}`:o||s,l={id:e[t.finding_url],file:r,line:n,severity:(e[t.severity]||"medium").toLowerCase(),description:i,repo:{github:e[t.repository]}};return t.commit_hash!==-1&&e[t.commit_hash]&&(l.commitHash=e[t.commit_hash]),t.detected_at!==-1&&e[t.detected_at]&&(l.detectedAt=e[t.detected_at]),t.committed_at!==-1&&e[t.committed_at]&&(l.committedAt=e[t.committed_at]),l}var eo=`.conflict-sev{display:inline-block;padding:1px .4rem;border-radius:3px;font-size:.62rem;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:#fff;flex-shrink:0;&.sev-critical{background:var(--critical)}&.sev-high{background:var(--high)}&.sev-medium{background:var(--medium)}&.sev-low{background:var(--low)}&.sev-high_bug{background:var(--high-bug)}&.sev-bug{background:var(--bug)}&.sev-informational{background:var(--info)}}
74
- `;var rb=`dialog{max-width:720px;width:min(94vw,720px)}header h3{margin:0 0 .25rem}header p{margin:0 0 .75rem;color:var(--muted);font-size:.82rem}.bulk{display:flex;gap:.4rem;margin-bottom:.7rem;padding-bottom:.7rem;border-bottom:1px solid var(--border)}.bulk button,.actions button{background:transparent;border:1px solid var(--border);color:var(--text);border-radius:5px;padding:.3rem .8rem;font:inherit;font-size:.78rem;&:hover{border-color:var(--accent);color:var(--accent)}&.primary{background:var(--accent);color:var(--surface);border-color:var(--accent)}&.primary:hover{filter:brightness(1.08)}}.list{list-style:none;margin:0;padding:0;max-height:60vh;overflow-y:auto;overscroll-behavior:none;-webkit-app-region:no-drag;app-region:no-drag;display:flex;flex-direction:column;gap:.5rem}.card{border:1px solid var(--border);border-radius:6px;padding:.55rem .7rem .6rem;background:rgb(from var(--text) r g b / .02)}.card-head{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}.id{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.68rem;color:var(--muted);padding:1px .3rem;background:rgb(from var(--text) r g b / .05);border-radius:3px}.desc{font-size:.78rem;color:var(--muted);margin-bottom:.55rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rows{display:flex;flex-direction:column;gap:.35rem}.row{display:grid;grid-template-columns:5rem 1fr 1fr;align-items:stretch;gap:.4rem}.row-label{color:var(--muted);font-size:.72rem;text-transform:uppercase;letter-spacing:.08em;align-self:center}.choice{position:relative;display:flex;flex-direction:column;gap:.15rem;padding:.35rem .5rem;border:1px solid var(--border);border-radius:5px;min-width:0;&:has(input:checked){border-color:var(--accent);background:rgb(from var(--accent) r g b / .07)}&:has(input:focus-visible){outline:2px solid var(--accent);outline-offset:1px}}.choice input[type=radio]{position:absolute;opacity:0;pointer-events:none}.choice-label{font-size:.68rem;color:var(--muted);text-transform:uppercase;letter-spacing:.08em}.choice:has(input:checked) .choice-label{color:var(--accent)}.choice-value{font-size:.82rem;min-width:0}.flag-badge{font-size:.82rem;color:var(--muted)}.flag-badge.on{color:var(--accent);font-weight:600}.color{display:inline-flex;align-items:center;gap:.35rem}.color-dot{width:12px;height:12px;border-radius:50%;box-shadow:0 0 0 1px rgb(from var(--text) r g b / .2);flex-shrink:0;&.marker-red{background:var(--marker-red)}&.marker-blue{background:var(--marker-blue)}&.marker-green{background:var(--marker-green)}&.marker-gray{background:var(--marker-gray)}}.color-name{text-transform:capitalize}.comment-text{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;color:var(--text);white-space:pre-wrap;overflow-wrap:anywhere;& em{color:var(--muted);font-style:italic}}.fix-text{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;word-break:break-all;& a{color:var(--accent);text-decoration:none}& a:hover{text-decoration:underline}}.actions{display:flex;justify-content:flex-end;gap:.4rem;margin-top:.8rem;padding-top:.7rem;border-top:1px solid var(--border)}
75
- `;function to(e){if(!e)return g;let t=e.replaceAll("_"," ");return d`<span class="${`conflict-sev sev-${e}`}">${t}</span>`}function $x(e){return`bundle-${e.slice(7,19)}\u2026`}function st(e){return e.kind==="bundle"?e.label??$x(e.identifier):e.identifier}function xx(e){return e?d`<span class="color"><span class="${`color-dot marker-${e}`}"></span> <span class="color-name">${e}</span></span>`:d`<em>none</em>`}function _x(e){return d`<span class="comment-text">${e||d`<em>empty</em>`}</span>`}function Sx(e){return e?Pt(e)?d`<span class="fix-text"><a href="${e}" target="_blank" rel="noopener noreferrer">${e}</a></span>`:d`<span class="fix-text">${e}</span>`:d`<span class="comment-text"><em>empty</em></span>`}function Cx(e){return e?d`<span class="${`triage triage-${e}`}">${e}</span>`:d`<em>none</em>`}function Ex(e){return e?d`<span class="${`flag-badge${e==="flagged"?" on":""}`}">${e}</span>`:d`<em>none</em>`}function nb(e,t){return e==="color"?xx(t):e==="comment"?_x(t):e==="fix"?Sx(t):e==="triage"?Cx(t):e==="flagged"?Ex(t):d`${String(t)}`}function Ax(e,t){let r=e?.file?e.line?`${e.file}:${e.line}`:e.file:"";return d`<div class="card-head">${to(e?.severity)} ${r?d`<span class="loc" title="${r}">${r}</span>`:g} <code class="id" title="${t}">${t.slice(0,8)}…</code></div>${e?.description?d`<div class="desc" title="${e.description}">${e.description}</div>`:g}`}var sb={title:"Triage conflicts",intro:"disagree with your local triage on",trailingNote:"",applyButton:"Apply",importedSideLabel:"Apply imported"},ob={color:0,comment:1,fix:2,triage:3,flagged:4},Tx={color:"Color",comment:"Comment",fix:"Fix",triage:"Triage state",flagged:"Flag"},Xd=class extends R{static styles=[...R.styles,B(eo),B(rb)];static properties={conflicts:{attribute:!1},findingLookup:{attribute:!1},labels:{attribute:!1},_settled:{state:!0}};constructor(){super(),this.conflicts=[],this.findingLookup=new Map,this.labels={...sb},this._settled=!1}focusInitial(){}_blockEscClose=t=>t.preventDefault();_onClick=t=>{let r=t.target.closest("[data-bulk]");if(!r)return;let n=r.dataset.bulk;for(let o of this.renderRoot.querySelectorAll(`input[type="radio"][value="${n}"]`))o.checked=!0};_onSubmit=t=>{t.preventDefault();let r={};for(let n of this.conflicts){let o=`${n.id}:${n.property}`,s=this.renderRoot.querySelector(`input[name="conflict-${CSS.escape(o)}"]:checked`);s&&(r[o]=s.value)}this._finish(r)};render(){let t=this.labels,r=new Map;for(let p of this.conflicts)r.has(p.id)||r.set(p.id,[]),r.get(p.id).push(p);for(let p of r.values())p.sort((f,h)=>(ob[f.property]??99)-(ob[h.property]??99));let n=this.conflicts.filter(p=>p.property==="color").length,o=this.conflicts.filter(p=>p.property==="comment").length,s=this.conflicts.filter(p=>p.property==="fix").length,i=this.conflicts.filter(p=>p.property==="triage").length,l=this.conflicts.filter(p=>p.property==="flagged").length,c=[n?`${n} color${n===1?"":"s"}`:"",o?`${o} comment${o===1?"":"s"}`:"",s?`${s} fix${s===1?"":"es"}`:"",i?`${i} triage state${i===1?"":"s"}`:"",l?`${l} flag${l===1?"":"s"}`:""].filter(Boolean).join(", "),u=`${r.size} finding${r.size===1?"":"s"}`;return d`<dialog @click="${this._onClick}" @cancel="${this._blockEscClose}" @close="${this._onClose}"><header><h3>${t.title}</h3><p>${u} ${t.intro} ${c}.${t.trailingNote?` ${t.trailingNote}`:""}</p><div class="bulk"><button type="button" data-bulk="local">Keep all current</button> <button type="button" data-bulk="imported">${t.importedSideLabel} (all)</button></div></header><form @submit="${this._onSubmit}"><ul class="list">${[...r.entries()].map(([p,f])=>d`<li class="card" data-id="${p}">${Ax(this.findingLookup.get(p),p)}<div class="rows">${f.map(h=>{let b=`${h.id}:${h.property}`,m=`conflict-${b}`;return d`<div class="row" data-key="${b}"><span class="row-label">${Tx[h.property]??h.property}</span> <label class="choice"><input type="radio" name="${m}" value="local" required> <span class="choice-label">Keep current</span> <span class="choice-value">${nb(h.property,h.local)}</span></label> <label class="choice"><input type="radio" name="${m}" value="imported" required> <span class="choice-label">${t.importedSideLabel}</span> <span class="choice-value">${nb(h.property,h.imported)}</span></label></div>`})}</div></li>`)}</ul><footer class="actions"><button type="submit" class="primary">${t.applyButton}</button></footer></form></dialog>`}};customElements.define("triage-conflict-dialog",Xd);function Ia(e,t,r={}){return new Promise((n,o)=>{let s=document.createElement("triage-conflict-dialog");s.conflicts=e,s.findingLookup=t,s.labels={...sb,...r},s.addEventListener("resolve",i=>{s.remove(),n(i.detail)}),s.addEventListener("modal-conflict",i=>{s.remove(),o(St(i.detail?.cause))}),document.body.append(s)})}var Qd=class extends R{static styles=[...R.styles,B(ut)];static properties={_password:{state:!0},_busy:{state:!0},_error:{state:!0},_settled:{state:!0}};constructor(){super(),this._password="",this._busy=!1,this._error="",this._settled=!1,this._tryPassword=null}_finish(t){this._settled||(this._password="",this._tryPassword=null,super._finish(t))}_onClose=()=>this._finish(null);_onCancel=()=>this._finish(null);_onPasswordInput=t=>{this._password=t.target.value,this._error=""};_onUnlock=async()=>{if(!(!this._password||this._busy)){this._busy=!0,this._error="";try{let t=await this._tryPassword(this._password);if(this._settled)return;this._finish(t)}catch(t){if(this._settled)return;this._error=t?.message??String(t)}finally{this._busy=!1}}};_onKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._onUnlock())};render(){return d`<dialog @close="${this._onClose}"><header><h3>Unlock encrypted workspace</h3></header><p class="nwd-note">This workspace bundle is password-protected. Enter the password the sender shared with you separately to decrypt and import it.</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-bundle-unlock" maxlength="1024" .value="${this._password}" @input="${this._onPasswordInput}" @keydown="${this._onKeydown}"></label> ${this._error?d`<p class="wsl-error" role="alert">${this._error}</p>`:g}<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></dialog>`}};customElements.define("workspace-unlock-bundle-dialog",Qd);function ib({tryPassword:e}={}){if(typeof e!="function")throw new TypeError("openWorkspaceUnlockBundleDialog: tryPassword required");return new Promise((t,r)=>{let n=document.createElement("workspace-unlock-bundle-dialog");n._tryPassword=e,n.addEventListener("resolve",o=>{n.remove(),t(o.detail)}),n.addEventListener("modal-conflict",o=>{n._tryPassword=null,n.remove(),r(St(o.detail?.cause))}),document.body.append(n)})}async function ab(e){let t=await cd(e),r;if(ts(t)){if(r=await ib({tryPassword:o=>ra(t,o)}),!r)return null}else r=await ra(t);let n=await dd(r,{conflictResolver:async(o,s)=>{try{return await Ia(o,s,{title:"Triage conflicts on import",intro:"disagree with your local triage on",trailingNote:"Reports and non-conflicting triage were already merged; pick which side to keep for these disagreements.",importedSideLabel:"Apply imported"})}catch{let i=o.length;return alert(`Imported ${e.name}. Kept your local triage on ${i} conflicting entr${i===1?"y":"ies"} because another dialog is open \u2014 re-drop the file to pick again.`),null}}});return(a.currentFile||a.currentWorkspace)&&x(),n}var cb="deepview.passkey.firstImportPrompted";function Ix(){try{return localStorage.getItem(cb)==="1"}catch{return!1}}function lb(){try{localStorage.setItem(cb,"1")}catch{}}async function Zd(){if(se()||!At()||Ix())return;if(!confirm(`Encrypt your DeepView data with a passkey?
93
+ ${s}`:o||s,l={id:e[t.finding_url],file:r,line:n,severity:(e[t.severity]||"medium").toLowerCase(),description:i,repo:{github:e[t.repository]}};return t.commit_hash!==-1&&e[t.commit_hash]&&(l.commitHash=e[t.commit_hash]),t.detected_at!==-1&&e[t.detected_at]&&(l.detectedAt=e[t.detected_at]),t.committed_at!==-1&&e[t.committed_at]&&(l.committedAt=e[t.committed_at]),l}var ao=`.conflict-sev{display:inline-block;padding:1px .4rem;border-radius:3px;font-size:.62rem;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:#fff;flex-shrink:0;&.sev-critical{background:var(--critical)}&.sev-high{background:var(--high)}&.sev-medium{background:var(--medium)}&.sev-low{background:var(--low)}&.sev-high_bug{background:var(--high-bug)}&.sev-bug{background:var(--bug)}&.sev-informational{background:var(--info)}}
94
+ `;var zb=`dialog{max-width:720px;width:min(94vw,720px)}header h3{margin:0 0 .25rem}header p{margin:0 0 .75rem;color:var(--muted);font-size:.82rem}.bulk{display:flex;gap:.4rem;margin-bottom:.7rem;padding-bottom:.7rem;border-bottom:1px solid var(--border)}.bulk button,.actions button{background:transparent;border:1px solid var(--border);color:var(--text);border-radius:5px;padding:.3rem .8rem;font:inherit;font-size:.78rem;&:hover{border-color:var(--accent);color:var(--accent)}&.primary{background:var(--accent);color:var(--surface);border-color:var(--accent)}&.primary:hover{filter:brightness(1.08)}}.list{list-style:none;margin:0;padding:0;max-height:60vh;overflow-y:auto;overscroll-behavior:none;-webkit-app-region:no-drag;app-region:no-drag;display:flex;flex-direction:column;gap:.5rem}.card{border:1px solid var(--border);border-radius:6px;padding:.55rem .7rem .6rem;background:rgb(from var(--text) r g b / .02)}.card-head{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}.id{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.68rem;color:var(--muted);padding:1px .3rem;background:rgb(from var(--text) r g b / .05);border-radius:3px}.desc{font-size:.78rem;color:var(--muted);margin-bottom:.55rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rows{display:flex;flex-direction:column;gap:.35rem}.row{display:grid;grid-template-columns:5rem 1fr 1fr;align-items:stretch;gap:.4rem}.row-label{color:var(--muted);font-size:.72rem;text-transform:uppercase;letter-spacing:.08em;align-self:center}.choice{position:relative;display:flex;flex-direction:column;gap:.15rem;padding:.35rem .5rem;border:1px solid var(--border);border-radius:5px;min-width:0;&:has(input:checked){border-color:var(--accent);background:rgb(from var(--accent) r g b / .07)}&:has(input:focus-visible){outline:2px solid var(--accent);outline-offset:1px}}.choice input[type=radio]{position:absolute;opacity:0;pointer-events:none}.choice-label{font-size:.68rem;color:var(--muted);text-transform:uppercase;letter-spacing:.08em}.choice:has(input:checked) .choice-label{color:var(--accent)}.choice-value{font-size:.82rem;min-width:0}.flag-badge{font-size:.82rem;color:var(--muted)}.flag-badge.on{color:var(--accent);font-weight:600}.color{display:inline-flex;align-items:center;gap:.35rem}.color-dot{width:12px;height:12px;border-radius:50%;box-shadow:0 0 0 1px rgb(from var(--text) r g b / .2);flex-shrink:0;&.marker-red{background:var(--marker-red)}&.marker-blue{background:var(--marker-blue)}&.marker-green{background:var(--marker-green)}&.marker-gray{background:var(--marker-gray)}}.color-name{text-transform:capitalize}.comment-text{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;color:var(--text);white-space:pre-wrap;overflow-wrap:anywhere;& em{color:var(--muted);font-style:italic}}.fix-text{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;word-break:break-all;& a{color:var(--accent);text-decoration:none}& a:hover{text-decoration:underline}}.actions{display:flex;justify-content:flex-end;gap:.4rem;margin-top:.8rem;padding-top:.7rem;border-top:1px solid var(--border)}
95
+ `;function lo(e){if(!e)return m;let t=e.replaceAll("_"," ");return d`<span class="${`conflict-sev sev-${e}`}">${t}</span>`}function B1(e){return`bundle-${e.slice(7,19)}\u2026`}function at(e){return e.kind==="bundle"?e.label??B1(e.identifier):e.identifier}function L1(e){return e?d`<span class="color"><span class="${`color-dot marker-${e}`}"></span> <span class="color-name">${e}</span></span>`:d`<em>none</em>`}function O1(e){return d`<span class="comment-text">${e||d`<em>empty</em>`}</span>`}function P1(e){return e?Ut(e)?d`<span class="fix-text"><a href="${e}" target="_blank" rel="noopener noreferrer">${e}</a></span>`:d`<span class="fix-text">${e}</span>`:d`<span class="comment-text"><em>empty</em></span>`}function N1(e){return e?d`<span class="${`triage triage-${e}`}">${e}</span>`:d`<em>none</em>`}function D1(e){return e?d`<span class="${`flag-badge${e==="flagged"?" on":""}`}">${e}</span>`:d`<em>none</em>`}function Ub(e,t){return e==="color"?L1(t):e==="comment"?O1(t):e==="fix"?P1(t):e==="triage"?N1(t):e==="flagged"?D1(t):d`${String(t)}`}function z1(e,t){let r=e?.file?e.line?`${e.file}:${e.line}`:e.file:"";return d`<div class="card-head">${lo(e?.severity)} ${r?d`<span class="loc" title="${r}">${r}</span>`:m} <code class="id" title="${t}">${t.slice(0,8)}…</code></div>${e?.description?d`<div class="desc" title="${e.description}">${e.description}</div>`:m}`}var Vb={title:"Triage conflicts",intro:"disagree with your local triage on",trailingNote:"",applyButton:"Apply",importedSideLabel:"Apply imported"},Hb={color:0,comment:1,fix:2,triage:3,flagged:4},U1={color:"Color",comment:"Comment",fix:"Fix",triage:"Triage state",flagged:"Flag"},gu=class extends I{static styles=[...I.styles,F(ao),F(zb)];static properties={conflicts:{attribute:!1},findingLookup:{attribute:!1},labels:{attribute:!1},_settled:{state:!0}};constructor(){super(),this.conflicts=[],this.findingLookup=new Map,this.labels={...Vb},this._settled=!1}focusInitial(){}_blockEscClose=t=>t.preventDefault();_onClick=t=>{let r=t.target.closest("[data-bulk]");if(!r)return;let n=r.dataset.bulk;for(let o of this.renderRoot.querySelectorAll(`input[type="radio"][value="${n}"]`))o.checked=!0};_onSubmit=t=>{t.preventDefault();let r={};for(let n of this.conflicts){let o=`${n.id}:${n.property}`,s=this.renderRoot.querySelector(`input[name="conflict-${CSS.escape(o)}"]:checked`);s&&(r[o]=s.value)}this._finish(r)};render(){let t=this.labels,r=new Map;for(let p of this.conflicts)r.has(p.id)||r.set(p.id,[]),r.get(p.id).push(p);for(let p of r.values())p.sort((f,h)=>(Hb[f.property]??99)-(Hb[h.property]??99));let n=this.conflicts.filter(p=>p.property==="color").length,o=this.conflicts.filter(p=>p.property==="comment").length,s=this.conflicts.filter(p=>p.property==="fix").length,i=this.conflicts.filter(p=>p.property==="triage").length,l=this.conflicts.filter(p=>p.property==="flagged").length,c=[n?`${n} color${n===1?"":"s"}`:"",o?`${o} comment${o===1?"":"s"}`:"",s?`${s} fix${s===1?"":"es"}`:"",i?`${i} triage state${i===1?"":"s"}`:"",l?`${l} flag${l===1?"":"s"}`:""].filter(Boolean).join(", "),u=`${r.size} finding${r.size===1?"":"s"}`;return d`<dialog @click="${this._onClick}" @cancel="${this._blockEscClose}" @close="${this._onClose}"><header><h3>${t.title}</h3><p>${u} ${t.intro} ${c}.${t.trailingNote?` ${t.trailingNote}`:""}</p><div class="bulk"><button type="button" data-bulk="local">Keep all current</button> <button type="button" data-bulk="imported">${t.importedSideLabel} (all)</button></div></header><form @submit="${this._onSubmit}"><ul class="list">${[...r.entries()].map(([p,f])=>d`<li class="card" data-id="${p}">${z1(this.findingLookup.get(p),p)}<div class="rows">${f.map(h=>{let b=`${h.id}:${h.property}`,g=`conflict-${b}`;return d`<div class="row" data-key="${b}"><span class="row-label">${U1[h.property]??h.property}</span> <label class="choice"><input type="radio" name="${g}" value="local" required> <span class="choice-label">Keep current</span> <span class="choice-value">${Ub(h.property,h.local)}</span></label> <label class="choice"><input type="radio" name="${g}" value="imported" required> <span class="choice-label">${t.importedSideLabel}</span> <span class="choice-value">${Ub(h.property,h.imported)}</span></label></div>`})}</div></li>`)}</ul><footer class="actions"><button type="submit" class="primary">${t.applyButton}</button></footer></form></dialog>`}};customElements.define("triage-conflict-dialog",gu);function Va(e,t,r={}){return new Promise((n,o)=>{let s=document.createElement("triage-conflict-dialog");s.conflicts=e,s.findingLookup=t,s.labels={...Vb,...r},s.addEventListener("resolve",i=>{s.remove(),n(i.detail)}),s.addEventListener("modal-conflict",i=>{s.remove(),o(Tt(i.detail?.cause))}),document.body.append(s)})}var bu=class extends I{static styles=[...I.styles,F(ht)];static properties={_password:{state:!0},_busy:{state:!0},_error:{state:!0},_settled:{state:!0}};constructor(){super(),this._password="",this._busy=!1,this._error="",this._settled=!1,this._tryPassword=null}_finish(t){this._settled||(this._password="",this._tryPassword=null,super._finish(t))}_onClose=()=>this._finish(null);_onCancel=()=>this._finish(null);_onPasswordInput=t=>{this._password=t.target.value,this._error=""};_onUnlock=async()=>{if(!(!this._password||this._busy)){this._busy=!0,this._error="";try{let t=await this._tryPassword(this._password);if(this._settled)return;this._finish(t)}catch(t){if(this._settled)return;this._error=t?.message??String(t)}finally{this._busy=!1}}};_onKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._onUnlock())};render(){return d`<dialog @close="${this._onClose}"><header><h3>Unlock encrypted workspace</h3></header><p class="nwd-note">This workspace bundle is password-protected. Enter the password the sender shared with you separately to decrypt and import it.</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-bundle-unlock" maxlength="1024" .value="${this._password}" @input="${this._onPasswordInput}" @keydown="${this._onKeydown}"></label> ${this._error?d`<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></dialog>`}};customElements.define("workspace-unlock-bundle-dialog",bu);function jb({tryPassword:e}={}){if(typeof e!="function")throw new TypeError("openWorkspaceUnlockBundleDialog: tryPassword required");return new Promise((t,r)=>{let n=document.createElement("workspace-unlock-bundle-dialog");n._tryPassword=e,n.addEventListener("resolve",o=>{n.remove(),t(o.detail)}),n.addEventListener("modal-conflict",o=>{n._tryPassword=null,n.remove(),r(Tt(o.detail?.cause))}),document.body.append(n)})}async function Wb(e){let t=await wd(e),r;if(is(t)){if(r=await jb({tryPassword:o=>ua(t,o)}),!r)return null}else r=await ua(t);let n=await kd(r,{conflictResolver:async(o,s)=>{try{return await Va(o,s,{title:"Triage conflicts on import",intro:"disagree with your local triage on",trailingNote:"Reports and non-conflicting triage were already merged; pick which side to keep for these disagreements.",importedSideLabel:"Apply imported"})}catch{let i=o.length;return alert(`Imported ${e.name}. Kept your local triage on ${i} conflicting entr${i===1?"y":"ies"} because another dialog is open \u2014 re-drop the file to pick again.`),null}}});return(a.currentFile||a.currentWorkspace)&&x(),n}var qb="deepview.passkey.firstImportPrompted";function H1(){try{return localStorage.getItem(qb)==="1"}catch{return!1}}function Kb(){try{localStorage.setItem(qb,"1")}catch{}}async function yu(){if(ae()||!Mt()||H1())return;if(!confirm(`Encrypt your DeepView data with a passkey?
76
96
 
77
97
  Your triage notes, workspaces, and report files are stored on this device. Encryption locks them under a passkey (TouchID, Windows Hello, security key) so scripts running here can't read them without the passkey.
78
98
 
79
- You can change this anytime from the lock icon in the sidebar header.`)){lb();return}await aa(),se()&&lb()}var db=Zd;var eu=class extends R{static styles=[...R.styles,B(ke)];static properties={workspaceId:{type:String},items:{type:Array},_running:{state:!0},_errors:{state:!0},_done:{state:!0},_settled:{state:!0}};constructor(){super(),this.workspaceId="",this.items=[],this._running=!1,this._errors=[],this._done=!1,this._settled=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="download"]')?.focus()}_onClose=()=>this._finish({downloaded:[],failed:[]});_onCancel=()=>this._finish({downloaded:[],failed:[]});_onDownload=async()=>{if(this._running)return;this._running=!0,this._errors=[];let t=[],r=[];for(let n of this.items)try{if(n.kind==="bundle"){let l=await pg(this.workspaceId,n.identifier);if(!l.ok){let c=l.reason??"unknown";r.push({kind:"bundle",identifier:n.identifier,reason:c}),this._errors=[...this._errors,{label:st(n),reason:c}];continue}await rn(n.identifier,this.workspaceId),t.push({kind:"bundle",identifier:n.identifier});continue}let o=await ug(this.workspaceId,n.identifier);if(!o){r.push({kind:"report",identifier:n.identifier,reason:"not found in remote"}),this._errors=[...this._errors,{label:st(n),reason:"not found in remote"}];continue}let s;try{s=xe(await Ct(o.content))}catch{let l="remote payload is not gzipped UTF-8";r.push({kind:"report",identifier:n.identifier,reason:l}),this._errors=[...this._errors,{label:st(n),reason:l}];continue}let i=Ge(s);if(!i.recognized){let l="remote payload is not a recognized report format";r.push({kind:"report",identifier:n.identifier,reason:l}),this._errors=[...this._errors,{label:st(n),reason:l}];continue}await Ro(n.identifier,o.content),rt(n.identifier,i.count,i.source),await Kt(n.identifier,this.workspaceId),t.push({kind:"report",identifier:n.identifier})}catch(o){let s=o?.message??String(o);r.push({kind:n.kind,identifier:n.identifier,reason:s}),this._errors=[...this._errors,{label:st(n),reason:s}]}if(this._running=!1,this._done=!0,t.some(n=>n.kind==="report"))try{a.currentWorkspace===this.workspaceId&&await $t(this.workspaceId)}catch{}r.length===0&&this._finish({downloaded:t,failed:r})};_errorsSection(){return this._errors.length===0?g:d`<ul class="lwd-list" role="alert">${this._errors.map(t=>d`<li><strong>${t.label}</strong> — ${t.reason}</li>`)}</ul>`}render(){let t=this.items.length,r=t===1,n=this.items.filter(u=>u.kind==="report").length,o=t-n,s="items";o===0?s=r?"report":"reports":n===0&&(s=r?"bundle":"bundles");let i=r?d`Download <strong>"${st(this.items[0])}"</strong> from the workspace's remote inventory?`:d`Download <strong>${t}</strong> remote ${s} into this workspace?`,l=r?g:d`<ul class="lwd-list">${this.items.map(u=>d`<li>${st(u)}${u.kind==="bundle"?d`<span class="lwd-kind-tag">bundle</span>`:g}</li>`)}</ul>`,c=this._running?r?"Downloading\u2026":`Downloading ${t} ${s}\u2026`:r?"Download":`Download ${t}`;return d`<dialog @close="${this._onClose}"><header><h3>Download from remote</h3></header><p class="lwd-body">${i}</p>${l} ${this._errorsSection()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}" ?disabled="${this._running}">${this._done&&this._errors.length>0?"Close":"Cancel"}</button> ${this._done&&this._errors.length>0?g:d`<button type="button" data-role="download" @click="${this._onDownload}" ?disabled="${this._running||t===0}">${c}</button>`}</footer></dialog>`}};customElements.define("sync-download-dialog",eu);function Ra({workspaceId:e,items:t}={}){return ee("sync-download-dialog",{workspaceId:e??"",items:Array.isArray(t)?[...t]:[]})}var Mr="deepview.lastFile",_s=new Set(["overview","graph","treemap","compare","advisories","issues","code","search","terminal"]);function Fr(e,t="overview"){let r=t&&t!=="overview"&&_s.has(t)?` ${t}`:"";Fe(Mr,`b:${e}${r}`).catch(()=>{})}var un=0,me=e=>e!==un;function tu(e){let t=pb(e.toLowerCase());return t.endsWith(".map")?"sourcemap":t==="stasis.code.br"||t.endsWith(".stasis.code.br")?"stasis":null}function pb(e){return e.replace(/ \(\d+\)(?=\.[^.]*$)/u,"")}async function ub({name:e,content:t,existingNames:r}){if(!r.has(e))return await dt(e,t),r.add(e),{name:e,content:t};let n;try{n=await Le(e)}catch(l){if(!(l instanceof DOMException&&l.name==="NotFoundError"||typeof l?.message=="string"&&l.message.startsWith("File not found:")))throw l;return await dt(e,t),r.add(e),{name:e,content:t}}if(n===t)return{name:e,content:t};let s=W().filter(l=>Array.isArray(l.reports)&&l.reports.includes(e)).filter(l=>Un(l.id,e)),i=await Om({name:e,workspaceNames:s.map(l=>l.name),existingNames:r});if(i.action==="cancel")return null;if(i.action==="rename"){let l=i.newName;return await dt(l,t),r.add(l),{name:l,content:t}}return await dt(e,t),s.length>0&&await Rx(e,s),{name:e,content:t}}async function Rx(e,t){let r;try{r=await Gr(e)}catch(n){console.warn(`Import: failed to read freshly-saved "${e}" for cloud sync:`,n);return}for(let n of t)try{await os(n.id);let o=await oa(n.id,e,r);o&&o.ok===!1&&console.warn(`Import: failed to upload "${e}" to workspace "${n.name}" (${n.id}): ${o.reason??"unknown"}`)}catch(o){console.warn(`Import: failed to upload "${e}" to workspace "${n.name}" (${n.id}):`,o)}}async function ru(e){if(a.serverMode==="managed")return;await db();let t=null,r=null,n=new Set,o=new Set(await ie());for(let s of e)try{let i=pb(s.name.toLowerCase());if(i.endsWith(".gz")||i.endsWith(".deepview-workspace.enc")){await ab(s);try{let u=await ie();o.clear();for(let p of u)o.add(p)}catch(u){console.warn("Import: failed to refresh existingNames after workspace import:",u)}continue}if(tu(s.name)){let u=new Uint8Array(await s.arrayBuffer()),{integrity:p}=await Yr(s.name,u);r=p,n.add(p);continue}let c=await s.text();if(i.endsWith(".csv")){let u=tb(c);for(let{displayName:p,data:f}of u){let h=p.replaceAll("/","__")+".codex",b=JSON.stringify(f),{count:m,source:v}=Ge(b),w=await ub({name:h,content:b,existingNames:o});w&&(rt(w.name,m,v),t={name:w.name,content:w.content})}}else{let u=Ge(c);if(!u.recognized)throw new Error("not a recognized DeepView, DeepSec, Piolium, Claude Security, or Codex report");let p=await ub({name:s.name,content:c,existingNames:o});if(!p)continue;rt(p.name,u.count,u.source),t={name:p.name,content:p.content}}}catch(i){alert(`Failed to load ${s.name}: ${i.message}`)}await V();for(let s of n)Yd(s).catch(()=>{});t?await Xe(t.name,t.content):r&&(a.currentView="bundles",a.selectedBundle=r,a.bundleDetails=null,a.bundleDetailsTab="overview",a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.bundleCodeSearchQuery="",a.bundleCodeSearchMode="files",a.bundleSearchQuery="",a.bundleSearchRegex=!1,a.bundleSearchCase=!1,a.bundleSearchContext=!0,a.shownTriage=null,A.showAll=!0,Fr(r),x(),await V(),Zt(r))}async function Xe(e,t){let r=++un,n=new Set(W().filter(o=>Array.isArray(o.reports)&&o.reports.includes(e)).map(o=>o.id));for(let o of N.openSessions)o&&!n.has(o.workspaceId)&&(N.closeSession(o.workspaceId),ss(o.workspaceId));if(a.reports=[],a.workspaceMerges=[],a.currentFile=e,a.currentWorkspace=null,(a.currentView==="bundles"||a.currentView==="packages"||a.currentView==="repositories")&&(a.currentView="findings"),a.repoUrl=et(e),a.repoEditing=!1,A.selected=null,A.focusedPkg=null,A.layoutCache=null,A.solo=null,A.hidden.clear(),A.pathFilter="",Re(),Fe(Mr,e).catch(()=>{}),t===void 0){try{t=await Le(e)}catch(o){if(me(r))return;if(o&&o.message?.includes("vault locked")){if(await la()&&!me(r)){await Xe(e);return}me(r)||(a.currentFile=null,await V());return}if(o instanceof DOMException&&o.name==="NotFoundError"||typeof o?.message=="string"&&o.message.startsWith("File not found:")){let i=W().find(l=>Array.isArray(l.reports)&&l.reports.includes(e)&&Un(l.id,e));if(i)try{if(await os(i.id),me(r))return;let l=await Ra({workspaceId:i.id,items:[{kind:"report",identifier:e}]});if(me(r))return;if(l?.downloaded?.some(c=>c.kind==="report"&&c.identifier===e)){await Xe(e);return}}catch(l){if(console.warn(`Re-download prompt for missing "${e}" failed:`,l),me(r))return}me(r)||(a.currentFile=null,await V());return}alert(`Failed to read ${e}: ${o.message}`),a.currentFile=null,await V();return}if(me(r))return}if(await ou(e,t,r),!me(r)){for(let o of n)N.openSession(o),N.refreshSession(o),os(o);await V()}}async function $t(e){let t=W().find(o=>o.id===e);if(!t)return;let r=++un;for(let o of N.openSessions)o&&o.workspaceId!==e&&(N.closeSession(o.workspaceId),ss(o.workspaceId));(a.currentView==="bundles"||a.currentView==="packages"||a.currentView==="repositories")&&(a.currentView="findings"),tn("workspace",e),a.reports=[],a.workspaceMerges=[],a.currentFile=null,a.currentWorkspace=e,a.repoUrl="",a.repoEditing=!1,A.selected=null,A.focusedPkg=null,A.layoutCache=null,A.solo=null,A.hidden.clear(),A.pathFilter="",Re(),Fe(Mr,`ws:${e}`).catch(()=>{}),t.reports.length===0&&(E.classList.remove("active"),G(g,E),fe.classList.remove("hidden"));let n=t.reports.map(o=>Le(o).catch(()=>null));for(let o=0;o<t.reports.length;o++){let s=await n[o];if(me(r))return;if(s!==null&&(await ou(t.reports[o],s,r),me(r)))return}N.openSession(e),N.refreshSession(e),os(e),await V()}async function fb({triage:e="keep",deleteFromRemoteWorkspaceIds:t=[]}={}){if(!a.currentFile)return;let r=++un,n=a.currentFile;Nn(n),tt(n,"");for(let o of t)try{let s=await sa(o,n);if(me(r))return;s&&s.ok===!1&&s.reason!=="not-found"&&console.warn(`Failed to delete '${n}' from workspace ${o} remote: ${s.reason}`)}catch(s){console.warn(`Failed to delete '${n}' from workspace ${o} remote:`,s)}if(await An(n),!me(r)&&(await Jo(n,null),!me(r))){if(e==="wipe"){try{await Qi()}catch(o){console.warn("Skipped orphan-triage GC:",o)}if(me(r))return}me(r)||(nu(),await V())}}function nu(){a.currentFile=null,a.currentWorkspace=null,a.selectedBundle=null,a.bundleDetails=null,a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.reports=[],a.workspaceMerges=[],a.repoUrl="",a.repoEditing=!1,a.shownTriage=null,a.currentView="findings",A.selected=null,A.focusedPkg=null,A.layoutCache=null,A.solo=null,A.hidden.clear(),A.pathFilter="",Re(),Sn(Mr),E.classList.remove("active"),G(g,E),fe.classList.remove("hidden"),document.title="DeepView"}async function hb(){++un;for(let e of N.openSessions)e&&(N.closeSession(e.workspaceId),ss(e.workspaceId));nu(),await V()}async function gb({deleteFromRemoteWorkspaceIds:e=[]}={}){if(!a.selectedBundle)return;let t=++un,r=a.selectedBundle;for(let o of e)try{let s=await ia(o,r);if(me(t))return;s&&s.ok===!1&&s.reason!=="not-found"&&console.warn(`Failed to delete bundle from workspace ${o} remote: ${s.reason}`)}catch(s){console.warn(`Failed to delete bundle from workspace ${o} remote:`,s)}if(await jl(r),me(t)||(await Uc(r,null),me(t)))return;a.selectedBundle=null,a.bundleDetails=null,a.bundleSourceFile=null,a.bundleSourceFindingIdx=null;let n=Ae(Mr);typeof n=="string"&&(n===`b:${r}`||n.startsWith(`b:${r} `))&&Sn(Mr),yc(r),a.bundles=await vt(),!me(t)&&(x(),await V())}async function mb(e,t="detach",{triage:r="keep"}={}){let n=W().find(l=>l.id===e);if(!n)return;++un;let o=Array.isArray(n.reports)?[...n.reports]:[];if(N.closeSession(e),ss(e),t==="delete"){for(let l of o){try{await An(l)}catch{}Nn(l),tt(l,"")}if(r==="wipe")try{await Qi()}catch(l){console.warn("Skipped orphan-triage GC:",l)}}let s=a.currentWorkspace===e,i=t==="delete"&&a.currentFile!=null&&o.includes(a.currentFile);(s||i)&&nu(),await Oc(e),await V()}async function ou(e,t,r=null){let n=()=>r!==null&&me(r);tn("report",e);try{if(await Zo,n())return;let o;try{o=JSON.parse(t)}catch(v){if(o=Tn(t)??Fn(t)??Bn(t),!o)throw new Error(`Not JSON, and not a recognized markdown format. (JSON error: ${v.message})`,{cause:v})}let s=a.reports.length===0,i=new Set,l=new Map,c=new Map;for(let v=0;v<a.reports.length;v++){let w=a.reports[v];for(let y=0;y<w.groups.length;y++){let k=w.groups[y],C=`${v}:${y}`;for(let T of k)T.id&&(i.add(T.id),l.set(T.id,C),c.has(T.id)||c.set(T.id,T))}}let u=(v,w,y)=>{!v||!y.correctedSeverity&&!v.correctedSeverity||(v._correctedByReport||(v._correctedByReport={[v._reportName??""]:{severity:Xt(v),reason:v.correctedSeverityReason}}),v._correctedByReport[w??""]={severity:Xt(y),reason:y.correctedSeverityReason})},p=o.findings||[],f=p.flatMap(Bd).filter(v=>!v.id);if(f.length>0){let v=await Promise.all(f.map(Di));if(n())return;f.forEach((w,y)=>{v[y]&&(w.id=v[y])})}let h=et(e),b=[],m=0;for(let v of p){let w=Bd(v);if(w.length===0)continue;let y=w.filter(I=>I.id&&i.has(I.id)),k=w.filter(I=>!I.id||!i.has(I.id)),C=new Set;for(let I of y){let L=l.get(I.id);L!==void 0&&C.add(L)}let T=w.filter(I=>I.id).map(I=>I.id);if(k.length===0){C.size>1&&a.workspaceMerges.push(new Set(T));for(let I of y)u(c.get(I.id),e,I);m+=y.length;continue}let S=[];for(let I of k){I.id&&i.add(I.id);let L={...I,_id:a.nextFindingId++,_repoFallback:h,_reportName:e,_bundleHashes:o.bundleHashes??[]};zi(L,o),L._analyzer=o.source??L.type??null,L.id&&!c.has(L.id)&&c.set(L.id,L),S.push(L)}if(y.length>0){m+=y.length,a.workspaceMerges.push(new Set(T));for(let I of y)u(c.get(I.id),e,I)}let M=`${a.reports.length}:${b.length}`;for(let I of k)I.id&&l.set(I.id,M);b.push(S)}if(m>0&&console.log(`${e}: skipped ${m} duplicate finding${m===1?"":"s"}`),a.reports.push({type:o.type||"analysis",source:o.source??null,fileName:e,groups:b,tree:o.tree??null,bundleHashes:o.bundleHashes??[]}),Array.isArray(o.bundleHashes)&&o.bundleHashes.length>0){let v=new Set((a.bundles??[]).map(w=>w.integrity));for(let w of o.bundleHashes)v.has(w)&&Yd(w).catch(()=>{})}if(s)if(Vn(),b.some(w=>w.some(y=>y.confidence!==void 0))){let w=k=>b.reduce((C,T)=>C+(T.some(S=>S.confidence!==void 0&&S.confidence>=k)?1:0),0),y;for(w(6)<=25?y=6:w(7)<=25?y=7:y=8;y>0&&w(y-1)===w(y);)y--;a.filterConfMin=y}else a.filterConfMin=0;x()}catch(o){alert(`Failed to parse ${e}: ${o.message}`)}}window.__loadFile=(e,t)=>ou(e,t);window.__setFilters=({severities:e,confMin:t}={})=>{e!=null&&(a.filterSeverities=new Set(e)),t!==void 0&&(a.filterConfMin=t),x()};document.addEventListener("keydown",e=>{e.key==="Escape"&&document.body.classList.contains("report-fullscreen")&&document.body.classList.remove("report-fullscreen")});document.addEventListener("dragover",e=>e.preventDefault());document.addEventListener("drop",e=>{e.preventDefault(),!e.target.closest("#drop-zone")&&ru(e.dataTransfer.files)});fe.addEventListener("dragover",e=>{e.preventDefault(),fe.classList.add("hover")});fe.addEventListener("dragleave",()=>fe.classList.remove("hover"));fe.addEventListener("drop",e=>{e.preventDefault(),fe.classList.remove("hover"),ru(e.dataTransfer.files)});var Dt=null;function Mx(){Dt||(Dt=document.createElement("input"),Dt.type="file",Dt.multiple=!0,Dt.hidden=!0,Dt.addEventListener("change",()=>{let e=Dt.files;e&&e.length>0&&ru(e),Dt.value=""}),document.body.append(Dt)),Dt.click()}fe.addEventListener("click",e=>{e.target.closest(".drop-prompt-action")&&Mx()});var er=new Map,bb="deepview.advisories.proxyConsent";function yb(){try{return localStorage.getItem(bb)==="1"}catch{return!1}}function vb(){try{localStorage.setItem(bb,"1")}catch{}}function Fx(e){return vs(e)}function Bx(e){if(!e||e.kind!=="stasis"||!e.bundle)return!1;for(let[t,r]of e.bundle.modules)if(t.includes("node_modules")&&r?.name&&typeof r.version=="string"&&r.version)return!0;return!1}function wb(e,t){return!e||tu(e.name)!=="stasis"?!1:!t||t.integrity!==e.integrity?!0:Bx(t)}function Lx(e){let t=Object.create(null);for(let[r,n]of e)t[r]=[...n].toSorted();return t}async function su(e,t){if(!e?.integrity||er.has(e.integrity)||!yb())return;let r=Fx(e);if(r.size===0){er.set(e.integrity,{state:"ok",byPackage:new Map,query:r});return}er.set(e.integrity,{state:"loading",query:r});let n=e.integrity;try{let o=await fetch("/api/npm-advisories",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Lx(r))});if(!o.ok){let l=`HTTP ${o.status}`;try{let c=await o.json();c&&typeof c.error=="string"&&c.error&&(l=`${c.error} (HTTP ${o.status})`)}catch{}er.set(n,{state:"error",reason:l,query:r}),t();return}let s=await o.json(),i=new Map;if(s&&typeof s=="object")for(let[l,c]of Object.entries(s)){if(!Array.isArray(c))continue;let u=c.filter(p=>p&&typeof p=="object"&&typeof p.title=="string"&&typeof p.severity=="string");u.length>0&&i.set(l,u)}er.set(n,{state:"ok",byPackage:i,query:r})}catch(o){er.set(n,{state:"error",reason:o?.message??"fetch-failed",query:r})}t()}async function kb(e,t){e?.integrity&&er.get(e.integrity)?.state==="error"&&(er.delete(e.integrity),await su(e,t))}var Ox={critical:0,high:1,moderate:2,low:3,info:4};function Ma(e){return Ox[e]??999}function Px(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Nx(){let e=typeof window>"u"?"":window.location.host;return d`<div class="bundle-advisories-consent"><div class="bundle-advisories-consent-card"><p class="bundle-advisories-consent-text">This bundle's dependency names and versions will be sent to the npm registry through a same-origin proxy (<span class="mono">${e}</span> → <span class="mono">registry.npmjs.org</span>) to look up published security advisories.</p><button type="button" class="bundle-advisories-consent-btn" data-advisories-consent>Confirm</button><p class="bundle-advisories-consent-note">This preference will be saved and reused for other bundles.</p></div></div>`}function $b(e){if(!e)return d`<div class="bundle-advisories-empty">Bundle not loaded yet.</div>`;if(e.kind!=="stasis"||!e.bundle)return d`<div class="bundle-advisories-empty">Advisories are only available for stasis bundles.</div>`;if(!yb())return Nx();let t=er.get(e.integrity);if(!t||t.state==="loading")return d`<div class="bundle-advisories-empty">Loading advisories from npm registry…</div>`;if(t.state==="error")return d`<div class="bundle-advisories-empty is-error"><span>Failed to fetch advisories: ${t.reason}</span> <button type="button" class="bundle-advisories-retry" data-advisories-retry>Retry</button></div>`;let r=t.query.size,n=t.byPackage.size;if(n===0)return d`<div class="bundle-advisories"><div class="bundle-advisories-summary">No advisories for the ${r} ${r===1?"package":"packages"} in this bundle.</div></div>`;let o=[...t.byPackage.entries()].toSorted(([i,l],[c,u])=>{let p=Math.min(...l.map(h=>Ma(h.severity))),f=Math.min(...u.map(h=>Ma(h.severity)));return p!==f?p-f:i.localeCompare(c)}),s=[...t.byPackage.values()].reduce((i,l)=>i+l.length,0);return d`<div class="bundle-advisories"><div class="bundle-advisories-summary">${s} ${s===1?"advisory":"advisories"} across ${n} of ${r} ${r===1?"package":"packages"}</div><ul class="bundle-advisories-list">${o.map(([i,l])=>Dx(i,l,t.query.get(i)))}</ul></div>`}function Dx(e,t,r){let n=[...t].toSorted((s,i)=>{let l=Ma(s.severity)-Ma(i.severity);return l!==0?l:(s.title??"").localeCompare(i.title??"")}),o=r?[...r].toSorted():[];return d`<li class="bundle-advisories-section"><div class="bundle-advisories-section-header"><span class="bundle-advisories-section-name">${e}</span> ${o.length>0?d`<span class="bundle-advisories-section-versions">${o.map(s=>d`<span class="bundle-advisories-version-chip">${s}</span>`)}</span>`:g} <span class="bundle-advisories-section-count">${n.length} ${n.length===1?"advisory":"advisories"}</span></div><ul class="bundle-advisories-rows">${n.map(s=>Vx(s))}</ul></li>`}function zx(e){if(typeof e!="string")return null;let t=/\/(GHSA-[a-z0-9-]+)(?:[/?#]|$)/iu.exec(e);return t?t[1]:null}var Ux=d`<svg class="bundle-advisory-ghsa-icon" viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 13L13 3"/><path d="M5 3h8v8"/></svg>`;function Hx(e){let t=/^CWE-(\d+)$/u.exec(e);if(!t)return d`<span>${e}</span>`;let r=`https://cwe.mitre.org/data/definitions/${t[1]}.html`;return d`<a class="bundle-advisory-cwe" href="${r}" target="_blank" rel="noopener noreferrer">${e}</a>`}function Vx(e){let t=e.severity,r=e.title,n=typeof e?.cvss?.score=="number"?e.cvss.score.toFixed(1):"",o=typeof e?.cvss?.vectorString=="string"&&e.cvss.vectorString?e.cvss.vectorString:"",s=typeof e.vulnerable_versions=="string"?e.vulnerable_versions:null,i=typeof e.url=="string"&&/^https?:\/\//iu.test(e.url)?e.url:null,l=zx(i),c=Array.isArray(e.cwe)?e.cwe.filter(p=>typeof p=="string"):[],u=l&&i?d`<a class="bundle-advisory-ghsa" href="${i}" target="_blank" rel="noopener noreferrer">${l}${Ux}</a>`:l?d`<span class="bundle-advisory-ghsa">${l}</span>`:g;return d`<li class="bundle-advisory-row"><div class="bundle-advisory-rail"><span class="${`bundle-advisory-severity sev-${t}`}">${Px(t)}</span> ${n?d`<span class="bundle-advisory-cvss-score">CVSS <span class="mono">${n}</span></span>`:g}</div><div class="bundle-advisory-body"><div class="bundle-advisory-header"><span class="bundle-advisory-title">${r}</span> ${u}</div><div class="bundle-advisory-subrow"><div class="bundle-advisory-meta">${s?d`<span>Affected <span class="mono">${s}</span></span>`:g} ${c.length>0?d`<span class="bundle-advisory-cwes">${c.map((p,f)=>d`${f===0?"":", "}${Hx(p)}`)}</span>`:g}</div>${o?d`<div class="bundle-advisory-cvss-vector mono">${o}</div>`:g}</div></div></li>`}var Cs=null;function jx(e){let t=new Map;if(!e||e.kind!=="stasis"||!e.bundle)return t;for(let r of e.bundle.imports.values())for(let[n,o]of r){t.has(n)||t.set(n,new Set);for(let s of o.values())typeof s=="string"&&t.get(n).add(s)}return t}function Wx(e){let t=We(e),r=jx(e),n=[...t.keys()],{stripped:o}=ot(n),s=new Map(n.map((l,c)=>[l,o[c]])),i={};for(let[l,c]of t){let u=s.get(l),p=r.get(l);i[u]={imports:p?[...p].map(f=>s.get(f)).filter(Boolean):[],size:new TextEncoder().encode(c).byteLength}}return{tree:i,origToStripped:s}}async function Jd(e){let t=We(e),r=new Map;for(let[n,o]of t)r.set(n,await lh(o));return r}function Cb(e){let t={inprogress:0,fixed:0,invalid:0,deleted:0};if(!e?.fileHashes)return t;let r=new Set;for(let n of e.fileHashes.values())if(!r.has(n)){r.add(n);for(let o of Do(n)){let s=a.triage.get(D(o))?.triage;s&&t[s]!==void 0&&t[s]++}}return t}function ro(e,t="graph"){if(!e||e.size===0)return new Map;let r=new Map;for(let[n,o]of e){let s=Do(o);if(s.length===0)continue;let i=s.filter(c=>{let u=a.triage.get(D(c))?.triage??null;return t==="issues"?u!=="invalid"&&u!=="deleted":u===a.shownTriage});if(i.length===0)continue;r.has(n)||r.set(n,[]);let l=r.get(n);for(let c of i)l.push(c)}return r}function Eb(e){let{tree:t,origToStripped:r}=Wx(e),n=Object.keys(t);if(n.length===0)return null;let o=null;if(e.fileHashes&&e.fileHashes.size>0){o=new Map;for(let[S,M]of e.fileHashes){let I=r.get(S);I!==void 0&&o.set(I,M)}}let s=ro(o),i=new Map,l=new Map,c=new Map,u=new Map;for(let[S,M]of s){let I={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0},L=new Set,j=new Set,Ce=[];for(let ae of M){I[ae.severity]=(I[ae.severity]||0)+1,L.add(ae.severity);let Qe=a.triage.get(D(ae))?.color??"none";j.add(Qe),Ce.push({severity:ae.severity,color:Qe})}i.set(S,I),l.set(S,L),c.set(S,j),u.set(S,Ce)}let p=va(t,i),f=new Map;for(let[S,M]of r)f.set(M,S);let h=Ir(e),b=h?new Map([...r].map(([S,M])=>[M,h.get(S)])):null,m=b?S=>b.get(S):null,v=Lm(n,m),w=A.splitOwnDirs&&v,y=S=>ft(S,{splitOwnDirs:w,packageDir:m?.(S)}),k=new Set;for(let S of n)if(k.add(y(S)),k.size>=3)break;let C=k.size>=3,T=n;if(A.focusedPkg){let S=n.filter(M=>y(M)===A.focusedPkg);S.length>0?T=S:A.focusedPkg=null}return A.selected&&!Object.hasOwn(t,A.selected)&&(A.selected=null),{treeData:t,files:T,ownCounts:i,transitiveCounts:p,severitySets:l,colorSets:c,fileFindings:u,options:{pkgOf:y},strippedToOrig:f,canSplitOwnDirs:v,canPackagesView:C}}function Ba(){if(!Cs)return;let e=qn();e&&e.refreshSidebar(Cs,{isBundleContext:!0})}function La(){if(!Cs)return;let e=qn();e&&e.refreshTopPkgs(Cs)}function Ab(e){Cs=e}function Kx(e){let t=new Map,r=0;for(let{path:o,size:s,pkgDir:i}of e){if(typeof s!="number"||s<=0)continue;let l=ft(o,{packageDir:i});t.set(l,(t.get(l)??0)+s),r+=s}if(r===0)return g;let n=[...t.entries()].toSorted((o,s)=>s[1]-o[1]);return d`<div class="bundles-dist"><div class="bundles-dist-bar" aria-hidden="true">${J(n,([o])=>o,([o,s])=>d`<span class="bundles-dist-seg" style="${de({flexGrow:s,background:Ye(o)})}" data-tooltip="${o==="__own__"?g:`${o}: ${oe(s)}`}"></span>`)}</div><ul class="bundles-dist-list">${J(n,([o])=>o,([o,s])=>{let i=(s/r*100).toFixed(1),l=o==="__own__"?"own source":o,c=Ye(o);return d`<li><span class="bundles-dist-dot" style="${de({background:c})}"></span> <span class="bundles-dist-pkg" data-tooltip="${o==="__own__"?g:o}">${l}</span> <span class="bundles-dist-bar-row" aria-hidden="true"><span class="bundles-dist-bar-fill" style="${de({width:`${i}%`,background:c})}"></span> </span><span class="bundles-dist-size">${oe(s)}</span> <span class="bundles-dist-percent">${i}%</span></li>`})}</ul></div>`}function xb(e,t,r,n,o,s){let{prefix:i,stripped:l}=ot(r),c=S=>o?.get(r[S]),u=new Set;for(let S=0;S<l.length;S++)u.add(ft(l[S],{packageDir:c(S)}));let p=l.map((S,M)=>M).toSorted((S,M)=>l[S].localeCompare(l[M])),f=l.map((S,M)=>({path:S,size:n[M],pkgDir:c(M)})),h=Kx(f),b=h===g?d`<p class="bundles-overview-col-empty">No size information for this bundle's sources.</p>`:h,m={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0},v=0,w=new Map;if(a.bundleDetails?.fileHashes){let S=ro(a.bundleDetails.fileHashes,"issues");for(let M of S.values())for(let I of M){m[I.severity]!==void 0&&m[I.severity]++,v++;for(let L of zo(I.fileHash,I))w.set(L,(w.get(L)??0)+1)}}let y=[...w.keys()].toSorted(),k=we.filter(S=>m[S]>0).map(S=>d`<span class="${`tree-count-chip ${S}`}">${m[S]} ${S.replaceAll("_"," ")}</span>`),C=r.length>0?d`<ul class="bundles-sources-list">${p.map(S=>{let M=r[S],I=l[S],L=n[S];return d`<li><button type="button" class="bundles-source-row" data-bundle-view-source="${M}" data-tooltip="${M}"><span class="bundles-source-path">${I}</span> ${L==null?g:d`<span class="bundles-source-size">${oe(L)}</span>`}</button></li>`})}</ul>`:d`<p class="bundles-overview-col-empty">No source files in this bundle.</p>`,T=y.length>0?d`<ul class="bundles-reports-list">${y.map(S=>{let M=ne[nt(S)]??ne.default,I=w.get(S)??0;return d`<li><button type="button" class="report-chip bundles-report-chip" data-tooltip="${S}" data-bundle-issue-report="${S}">${ye(M)}<span class="report-chip-label">${De(S)}</span> <span class="bundles-report-count">${I} ${I===1?"issue":"issues"}</span></button></li>`})}</ul>`:d`<p class="bundles-overview-col-empty">No matching reports indexed yet.</p>`;return d`<div class="bundles-overview"><div class="bundles-overview-summary"><div class="bundles-detail-meta-row">${e}<dl class="bundles-detail-meta">${t}<dt>Sources</dt><dd>${r.length}</dd>${i?d`<dt>Prefix</dt><dd class="mono">${i}</dd>`:g}</dl>${s??g}</div>${v>0?d`<div class="bundles-issue-summary tree-count-chips">${k}</div>`:g}</div><div class="bundles-overview-columns"><section class="bundles-overview-col"><header class="bundles-overview-col-head">Packages <span class="bundles-overview-col-count">${u.size}</span></header><div class="bundles-overview-col-body">${b}</div></section><section class="bundles-overview-col"><header class="bundles-overview-col-head">Files <span class="bundles-overview-col-count">${r.length}</span></header><div class="bundles-overview-col-body bundles-overview-col-body--list">${C}</div></section>${y.length>0?d`<section class="bundles-overview-col"><header class="bundles-overview-col-head">Reports <span class="bundles-overview-col-count">${y.length}</span></header><div class="bundles-overview-col-body bundles-overview-col-body--list">${T}</div></section>`:g}</div></div>`}var iu=new Map,au=new Set,qx=d`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><rect x="3" y="2.5" width="8" height="10" rx="1" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/><rect x="5.5" y="5" width="8" height="9" rx="1" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,tr=null;function Es(){queueMicrotask(()=>{document.querySelector(".bundle-code-rail-body .bundle-code-tree-link.current")?.scrollIntoView({block:"nearest"})})}function pn(e){for(let t of we)for(let r of e)if(r.severity===t)return t;return e[0]?.severity??null}function cu(e,t,r,n,o=null){let s=e.split(`
80
- `).length,i=String(s).length,l=xa(t),c=`${r??""}\0${t}`;l&&!iu.has(c)&&!au.has(c)&&(au.add(c),(async()=>{let p=await _a(e,l);iu.set(c,p??null),au.delete(c),a.bundleSourceFile===t&&x()})());let u=iu.get(c);return d`<div class="bundle-source-lines" style="${de({"--lineno-width":`${i}ch`})}"><aside class="bundle-source-lineno-col" aria-hidden="true">${Array.from({length:s},(p,f)=>{let h=f+1,b=n.get(h),m=b?pn(b.map(w=>w.f)):null,v=b&&a.bundleSourceFindingIdx!=null&&b.some(w=>w.idx===a.bundleSourceFindingIdx);return d`<div class="${F({"bundle-source-lineno-row":!0,"is-match":o?.has(h)??!1})}" data-line="${h}">${b?d`<button type="button" class="${F({"bundle-source-dot":!0,[`sev-${m}`]:!0,active:v})}" data-bundle-source-finding="${b[0].idx}" title="${`${b.length} ${b.length===1?"issue":"issues"} on line ${h}`}" aria-label="${`${b.length} issues on line ${h}`}"></button>`:d`<span class="bundle-source-dot-placeholder"></span>`} <span class="bundle-source-lineno-num">${h}</span></div>`})}</aside><pre class="bundle-source-code"><code class="${l?`language-${l}`:""}">${typeof u=="string"?ye(u):e}</code></pre></div>`}function du(e){let t=a.bundleSourceFindingIdx;if(t==null)return g;let r=e[t];if(!r)return g;let n=r.fileHash?zo(r.fileHash,r):[],o=a.triage.get(D(r))?.triage,s=o==="fixed"?"Fixed":o==="inprogress"?"In progress":null,i=sn(r),l=Rb(r.line);return d`<aside class="bundle-source-panel"><header class="bundle-source-panel-bar"><span class="${`bundle-source-panel-sev sev-${r.severity}`}">${r.severity.replaceAll("_"," ")}</span> ${s?d`<span class="${`bundle-source-panel-triage triage-${o}`}">${s}</span>`:g} <button type="button" class="bundle-source-panel-close" data-action="bundle-source-panel-close" title="Close (Esc)" aria-label="Close finding details">×</button></header><div class="bundle-source-panel-body">${l||i?d`<div class="bundle-source-panel-line-row">${l?d`<span class="bundle-source-panel-line">${l}</span>`:g} ${i?d`<span class="bundle-source-panel-meta" title="${i}">${i}</span>`:g}</div>`:g}<div class="bundle-source-panel-desc">${Nt(r.description??"")}</div>${n.length>0?d`<div class="bundle-source-panel-reports"><div class="bundle-source-panel-reports-label">Reported by</div>${n.map(c=>{let u=ne[nt(c)]??ne.default;return d`<button type="button" class="report-chip bundle-source-panel-report" title="${c}" data-bundle-issue-report="${c}">${ye(u)}<span class="report-chip-label">${De(c)}</span></button>`})}</div>`:g}</div></aside>`}function uu(e,t,r){let n=[],o=new Map;if(typeof r=="string"&&e?.fileHashes){let i=ro(e.fileHashes,"issues").get(t)??[];for(let l=0;l<i.length;l++){let c=i[l];n.push(c);let u=parseInt(c.line,10);Number.isFinite(u)&&u>0&&(o.has(u)||o.set(u,[]),o.get(u).push({f:c,idx:l}))}}return{fileFindings:n,lineFindings:o}}function Tb(){let e=a.bundleSourceFile;if(!e)return g;if(a.bundleDetailsTab==="code"||a.bundleDetailsTab==="search")return g;let r=We(a.bundleDetails).get(e),{fileFindings:n,lineFindings:o}=uu(a.bundleDetails,e,r);return d`<div class="bundle-source-overlay"><div class="${F({"bundle-source-modal":!0,"with-panel":a.bundleSourceFindingIdx!=null})}"><header class="bundle-source-bar"><div class="bundle-source-title" title="${e}">${e}</div><button type="button" class="bundle-source-close" data-action="bundle-source-close" title="Close source viewer (Esc)" aria-label="Close source viewer">×</button></header><div class="bundle-source-body"><div class="bundle-source-code-wrap">${typeof r=="string"?cu(r,e,a.bundleDetails?.integrity,o):d`<div class="bundle-source-empty">Source content not bundled.</div>`}</div>${du(n)}</div></div></div>`}function Ib(e){let t={name:"",files:new Map,dirs:new Map};for(let r of e){let n=r.split("/"),o=t;for(let s=0;s<n.length-1;s++){let i=n[s],l=o.dirs.get(i);l||(l={name:i,files:new Map,dirs:new Map},o.dirs.set(i,l)),o=l}o.files.set(n.at(-1),r)}return t}var Fa=new Map,_b=null;function Gx(e,t){let r=0,n=null;if(!t||t.size===0)return{count:r,worst:n};let o=s=>{for(let i of s.files.values()){let l=t.get(i);if(!l||l.length===0)continue;r+=l.length;let c=pn(l);(n===null||(ve[c]??0)>(ve[n]??0))&&(n=c)}for(let i of s.dirs.values())o(i)};return o(e),{count:r,worst:n}}function lu(e,t,r=0,n=null,o="",s=!1){let i=[...e.dirs.entries()].toSorted(([f],[h])=>f.localeCompare(h)),l=[...e.files.entries()].toSorted(([f],[h])=>f.localeCompare(h)),c=f=>{if(!t)return!1;for(let h of f.files.values())if(h===t)return!0;for(let h of f.dirs.values())if(c(h))return!0;return!1},u=(f,h)=>s?!0:Fa.has(f)?Fa.get(f):r===0||c(h),p=f=>h=>{Fa.set(f,!h.currentTarget.parentElement.open)};return d`<ul class="${F({"bundle-code-tree":!0,root:r===0})}">${J(i,([f])=>`${o}/${f}`,([f,h])=>{let b=o?`${o}/${f}`:f,m=Gx(h,n);return d`<li class="bundle-code-tree-dir"><details ?open="${u(b,h)}"><summary @click="${p(b)}"><span class="bundle-code-tree-dirname">${f}</span> ${m.count>0?d`<span class="${`bundle-code-tree-count sev-${m.worst}`}" title="${`${m.count} ${m.count===1?"issue":"issues"} inside`}">${m.count}</span>`:g}</summary>${lu(h,t,r+1,n,b,s)}</details></li>`})} ${J(l,([,f])=>f,([f,h])=>{let b=n?.get(h),m=b&&b.length>0?pn(b):null,v=b?.length??0;return d`<li class="bundle-code-tree-file"><button type="button" class="${F({"bundle-code-tree-link":!0,current:h===t})}" data-bundle-view-source="${h}" title="${h}"><span class="bundle-code-tree-name">${f}</span> ${v>0?d`<span class="${`bundle-code-tree-count sev-${m}`}" title="${`${v} ${v===1?"issue":"issues"}`}">${v}</span>`:g}</button></li>`})}</ul>`}function Yx(e,t,r,n,o=""){if(!r)return lu(e,t,0,n);let s=r.toLowerCase(),i=[],l=h=>{for(let[,b]of h.dirs)l(b);for(let[,b]of h.files)(o&&b.startsWith(o)?b.slice(o.length):b).toLowerCase().includes(s)&&i.push(b)};if(l(e),i.length===0)return d`<div class="bundle-code-search-empty">No files match.</div>`;let c=o?i.map(h=>h.startsWith(o)?h.slice(o.length):h):i,u=new Map;for(let h=0;h<i.length;h++)u.set(c[h],i[h]);let p=Ib(c),f=h=>{let b=new Map;for(let[m,v]of h.files)b.set(m,u.get(v)??v);h.files=b;for(let m of h.dirs.values())f(m)};return f(p),lu(p,t,0,n,"",!0)}function Jx(e,t,r,n=""){if(!t)return d`<div class="bundle-code-search-hint">Type to search across every source in this bundle.</div>`;let o=t.toLowerCase(),s=20,i=100,l=[],c=0;for(let[u,p]of e){if(typeof p!="string")continue;let f=[],h=p.split(`
81
- `);for(let b=0;b<h.length;b++){let m=h[b];if(m.toLowerCase().includes(o)&&(f.push({ln:b+1,text:m}),c++,f.length>=s))break}if(f.length>0&&l.push({path:u,hits:f}),l.length>=i)break}return l.length===0?d`<div class="bundle-code-search-empty">No matches.</div>`:d`<div class="bundle-code-search-results"><div class="bundle-code-search-summary">${c} ${c===1?"hit":"hits"} in ${l.length} ${l.length===1?"file":"files"}</div>${l.map(({path:u,hits:p})=>{let f=n&&u.startsWith(n)?u.slice(n.length):u;return d`<div class="${F({"bundle-code-search-file":!0,current:u===r})}"><button type="button" class="bundle-code-search-file-name" data-bundle-view-source="${u}" title="${u}">${f}</button><ul class="bundle-code-search-hits">${p.map(h=>d`<li class="bundle-code-search-hit"><button type="button" class="bundle-code-search-hit-link" data-bundle-view-source="${u}" data-bundle-view-line="${h.ln}" data-bundle-view-scroll-block="start" title="${`${u}:${h.ln}`}"><span class="bundle-code-search-hit-ln">${h.ln}</span> <span class="bundle-code-search-hit-text mono">${h.text.slice(0,200)}</span></button></li>`)}</ul></div>`})}</div>`}function Xx(e,t,r,n=""){if(!e.fileHashes)return d`<div class="bundle-code-search-empty">Computing file hashes…</div>`;let o=ro(e.fileHashes,"issues");if(o.size===0)return d`<div class="bundle-code-search-empty">No issues match this bundle's files.</div>`;let s=t.toLowerCase(),i=[];for(let[l,c]of o)for(let u=0;u<c.length;u++){let p=c[u],f=p.description??"";s&&!l.toLowerCase().includes(s)&&!p.severity.includes(s)&&!p.severity.replaceAll("_"," ").includes(s)&&!f.toLowerCase().includes(s)||i.push({file:l,finding:p,fileIdx:u})}return i.sort((l,c)=>{let u=ve[l.finding.severity]??0,p=ve[c.finding.severity]??0;return p!==u?p-u:l.file.localeCompare(c.file)}),i.length===0?d`<div class="bundle-code-search-empty">No matches.</div>`:d`<div class="bundle-code-search-results"><div class="bundle-code-search-summary">${i.length} ${i.length===1?"issue":"issues"}</div><ul class="bundle-code-search-issues">${i.map(({file:l,finding:c,fileIdx:u})=>{let p=c.severity,f=n&&l.startsWith(n)?l.slice(n.length):l,h=l===r&&a.bundleSourceFindingIdx===u;return d`<li class="${F({"bundle-code-search-issue":!0,current:h})}"><button type="button" class="bundle-code-search-issue-link" data-bundle-view-source="${l}" data-bundle-view-finding-idx="${u}" data-bundle-view-line="${c.line??""}" title="${l}"><div class="bundle-code-search-issue-row"><span class="${`bundle-code-search-issue-sev sev-${p}`}">${p.replaceAll("_"," ")}</span> <span class="bundle-code-search-issue-path mono">${f}${c.line?`:${c.line}`:""}</span></div><div class="bundle-code-search-issue-desc">${Nt(c.description??"")}</div></button></li>`})}</ul></div>`}function Sb(e,t,r){let n=null,o=-1,s=0;for(let[c,u]of r){if(typeof t.get(c)!="string")continue;let p=ve[pn(u)]??0;(p>o||p===o&&u.length>s||p===o&&u.length===s&&(n===null||c.localeCompare(n)<0))&&(n=c,o=p,s=u.length)}if(n)return n;if(e.kind==="stasis"&&e.bundle){for(let c of e.bundle.entries)if(typeof t.get(c)=="string")return c}let i=null,l=-1;for(let[c,u]of t)typeof u=="string"&&u.length>l&&(i=c,l=u.length);return i}function Qx(e){if(!e||!e.json&&!e.bundle)return g;let t=We(e);if(t.size===0)return d`<div class="bundle-code-empty">This bundle doesn't carry any source content.</div>`;_b!==a.selectedBundle&&(Fa.clear(),_b=a.selectedBundle);let r=[...t.keys()].toSorted(),{prefix:n,stripped:o}=ot(r),s=new Map;for(let y=0;y<r.length;y++)s.set(o[y],r[y]);let i=Ib(o),l=y=>{let k=new Map;for(let[C,T]of y.files)k.set(C,s.get(T)??T);y.files=k;for(let C of y.dirs.values())l(C)};l(i);let c=e.fileHashes?ro(e.fileHashes,"issues"):new Map,u=a.bundleSourceFile;if(tr&&(tr.bundle!==a.selectedBundle||u&&u!==tr.path)&&(tr=null),!u)u=Sb(e,t,c),u&&(a.bundleSourceFile=u,tr={bundle:a.selectedBundle,path:u,hadIssues:c.size>0},Es());else if(tr&&!tr.hadIssues&&c.size>0){tr.hadIssues=!0;let y=Sb(e,t,c);y&&y!==u&&(u=y,a.bundleSourceFile=y,a.bundleSourceFindingIdx=null,tr.path=y,Es())}let p=u?t.get(u):null,{fileFindings:f,lineFindings:h}=uu(e,u,p),m=c.size>0?["files","code","issues"]:["files","code"],v=m.includes(a.bundleCodeSearchMode)?a.bundleCodeSearchMode:"files",w=a.bundleCodeSearchQuery;return d`<div class="bundle-code-view"><aside class="bundle-code-rail"><div class="bundle-code-rail-head"><span class="bundle-code-rail-label">Files</span> <span class="bundle-code-rail-count">${r.length}</span></div>${n?d`<div class="bundle-code-rail-prefix mono" title="${n}">${n}</div>`:g}<bundle-code-search .modes="${m}"></bundle-code-search><div class="bundle-code-rail-body">${Vd(v,[["files",()=>Yx(i,u,w,c,n)],["code",()=>Jx(t,w,u,n)],["issues",()=>Xx(e,w,u,n)]])}</div></aside><div class="${F({"bundle-code-main":!0,"with-panel":a.bundleSourceFindingIdx!=null})}">${u?Zx(e,u,p,f,h):d`<div class="bundle-code-placeholder">Pick a file from the tree to view its source.</div>`}</div></div>`}function Zx(e,t,r,n,o){let s=typeof r=="string"?r.split(`
82
- `).length:0,i=typeof r=="string"?new TextEncoder().encode(r).byteLength:0,l=n.map((c,u)=>({idx:u,line:parseInt(c.line,10)||0})).toSorted((c,u)=>c.line-u.line||c.idx-u.idx);return d`<header class="bundle-code-main-bar"><span class="bundle-code-main-path mono" title="${t}">${t}</span> <button type="button" class="bundle-code-copy-path" data-copy-path="${t}" title="Copy file path" aria-label="Copy file path">${qx}</button> <span class="bundle-code-main-spacer"></span> ${typeof r=="string"?d`<span class="bundle-code-main-stats">${s.toLocaleString()} ${s===1?"line":"lines"} · ${oe(i)}</span>`:g} ${n.length>0?d`<span class="bundle-code-main-issues" data-bundle-code-issue-order="${JSON.stringify(l)}"><span class="${`bundle-code-tree-count sev-${pn(n)}`}" title="${`${n.length} ${n.length===1?"issue":"issues"} in this file`}">${n.length}</span> <button type="button" class="bundle-code-issue-step" data-bundle-code-issue-step="-1" title="Previous issue" aria-label="Previous issue">‹</button> <button type="button" class="bundle-code-issue-step" data-bundle-code-issue-step="1" title="Next issue" aria-label="Next issue">›</button></span>`:g}</header><div class="bundle-code-main-body"><div class="bundle-source-code-wrap">${typeof r=="string"?cu(r,t,e.integrity,o):d`<div class="bundle-source-empty">Source content not bundled.</div>`}</div>${du(n)}</div>`}var e1=400;function t1(e){return e<=5?8:e<=15?6:e<=40?4:e<=120?3:2}function r1(e,t,r){let n=[];for(let o of e){let s=Math.max(1,o.ln-r),i=Math.min(t,o.ln+r),l=n.at(-1);l&&s<=l.end+1?l.end=Math.max(l.end,i):n.push({start:s,end:i})}return n}function n1(e,t,r){if(e.length<=r)return{text:e,ranges:t,clipped:!1};let n=t.length>0?t[0][0]:0,o=n>r-60?Math.max(0,n-60):0,s=e.slice(o,o+r);if(o===0)return{text:s,ranges:t,clipped:!1};let i=[];for(let[l,c]of t){let u=l-o,p=c-o;p<=0||u>=s.length||i.push([Math.max(0,u),Math.min(s.length,p)])}return{text:s,ranges:i,clipped:!0}}function o1(e,t){if(t.length===0)return e;let r=[],n=0;for(let[o,s]of t){let i=Math.max(n,Math.min(o,e.length)),l=Math.max(i,Math.min(s,e.length));l<=i||(i>n&&r.push(e.slice(n,i)),r.push(d`<mark class="bundle-search-mark">${e.slice(i,l)}</mark>`),n=l)}return n<e.length&&r.push(e.slice(n)),r}function s1(e,t,r){let n=n1(e,r??[],e1);return d`<div class="${F({"bundle-search-line":!0,"is-match":r!=null})}"><span class="bundle-search-lineno">${t}</span> <span class="bundle-search-code">${n.clipped?d`<span class="bundle-search-clip">…</span>`:g}${o1(n.text,n.ranges)}</span></div>`}function i1(e,t,r,n,o){let{start:s,end:i}=r,l=s;for(let p=s;p<=i;p++)if(n.has(p)){l=p;break}let c=String(i).length,u=[];for(let p=s;p<=i;p++)u.push(s1(t[p-1]??"",p,n.get(p)??null));return d`${o?d`<div class="bundle-search-gap" aria-hidden="true"></div>`:g} <button type="button" class="bundle-search-snippet" style="${de({"--bundle-search-lineno-w":`${c}ch`})}" data-bundle-view-source="${e}" data-bundle-view-line="${l}" data-bundle-view-scroll-block="center" title="${`${e}:${l}`}">${u}</button>`}function a1(e,t,r){let{path:n,lines:o,hits:s}=e,i=t&&n.startsWith(t)?n.slice(t.length):n,l=r1(s,o.length,r),c=new Map(s.map(f=>[f.ln,f.ranges])),u=s[0].ln,p=n===a.bundleSourceFile;return d`<section class="${F({"bundle-search-file":!0,current:p})}"><header class="bundle-search-file-head"><button type="button" class="bundle-search-file-name mono" data-bundle-view-source="${n}" data-bundle-view-line="${u}" data-bundle-view-scroll-block="center" title="${n}">${i}</button> <span class="bundle-search-file-count">${s.length} ${s.length===1?"match":"matches"}</span></header><div class="bundle-search-snippets">${l.map((f,h)=>i1(n,o,f,c,h>0))}</div></section>`}function l1(e,t,r,n,o,s){if(!r)return d`<div class="bundle-search-results"><div class="bundle-search-hint">Search across every source in this bundle. Each match shows the surrounding lines for context — fewer matches get more context. Toggle <span class="bundle-search-hint-kbd">Aa</span> for case-sensitive and <span class="bundle-search-hint-kbd">.*</span> for regular-expression matching.</div></div>`;let i=Bm(e.integrity??"",t,r,n,o);if(i.error)return d`<div class="bundle-search-results"><div class="bundle-search-error"><span class="bundle-search-error-label">Invalid regular expression</span> <span class="bundle-search-error-msg mono">${i.error}</span></div></div>`;let{fileResults:l,totalHits:c,truncated:u}=i,p=[...t.keys()].toSorted(),{prefix:f}=ot(p);if(l.length===0)return d`<div class="bundle-search-results"><div class="bundle-search-empty">No matches.</div></div>`;let h=s?t1(c):0,b=l.length;return d`<div class="bundle-search-results"><div class="bundle-search-summary"><span>${c}${u?"+":""} ${c===1?"match":"matches"} in ${b}${u?"+":""} ${b===1?"file":"files"}</span> ${f?d`<span class="bundle-search-summary-prefix mono" title="${f}">${f}</span>`:g} ${u?d`<span class="bundle-search-summary-more">results capped — refine to narrow</span>`:g}</div>${J(l,m=>m.path,m=>a1(m,f,h))}</div>`}function c1(e,t,r,n){if(!t||typeof e!="string")return null;let o=Wd(t,r,n);if(o.error)return null;let s=new Set,i=e.split(`
83
- `);for(let l=0;l<i.length;l++)o.ranges(i[l]).length>0&&s.add(l+1);return s}function d1(e,t,r){let n=a.bundleSourceFile;if(!n)return g;let o=t.get(n),{fileFindings:s,lineFindings:i}=uu(e,n,o);return d`<aside class="bundle-search-side"><header class="bundle-source-bar"><div class="bundle-source-title" title="${n}">${n}</div><button type="button" class="bundle-source-close" data-action="bundle-source-close" title="Close source viewer (Esc)" aria-label="Close source viewer">×</button></header><div class="bundle-source-body"><div class="bundle-source-code-wrap">${typeof o=="string"?cu(o,n,e.integrity,i,r):d`<div class="bundle-source-empty">Source content not bundled.</div>`}</div>${du(s)}</div></aside>`}function u1(e){if(!e||!e.json&&!e.bundle)return g;let t=We(e);if(t.size===0)return d`<div class="bundle-search-view"><div class="bundle-code-empty">This bundle doesn't carry any source content.</div></div>`;let r=a.bundleSearchQuery,n=a.bundleSearchRegex,o=a.bundleSearchCase,s=null;if(a.bundleSourceFile){let l=c1(t.get(a.bundleSourceFile),r,n,o);l&&l.size===0?(a.bundleSourceFile=null,a.bundleSourceFindingIdx=null):s=l}let i=a.bundleSearchContext;return d`<div class="bundle-search-view"><div class="bundle-search-bar-row"><bundle-search></bundle-search><button type="button" class="${F({"bundle-search-context-toggle":!0,on:i})}" data-bundle-search-context aria-pressed="${String(i)}" aria-label="Toggle context lines"><span>Context</span><span class="bundle-search-switch" aria-hidden="true"></span></button></div><div class="bundle-search-main">${l1(e,t,r,n,o,i)} ${d1(e,t,s)}</div></div>`}function p1(e){let t=wb(e,a.bundleDetails);a.bundleDetailsTab==="advisories"&&!t&&(a.bundleDetailsTab="overview");let r=(a.bundles?.length??0)>=2;a.bundleDetailsTab==="compare"&&!r&&(a.bundleDetailsTab="overview");let n=a.bundleDetailsTab,o=n==="overview",s=a.bundleDetails,i=!!(s&&s.integrity===e.integrity),l=i&&!s.error&&!!(s.json||s.bundle);return n==="advisories"&&t&&l&&su(s,x).catch(()=>{}),d`<div class="bundles-view bundles-slide-view"><header class="bundles-slide-bar"><span class="bundles-slide-icon" aria-hidden="true">${ye(Gn)}</span><div class="bundles-slide-title"><div class="bundles-slide-name">${e.name}</div></div><div class="bundles-slide-tabs" role="tablist">${t?d`<button type="button" class="${F({"bundles-tab":!0,active:n==="advisories"})}" data-bundle-tab="advisories" aria-selected="${String(n==="advisories")}" role="tab">Advisories</button>`:g} <button type="button" class="${F({"bundles-tab":!0,active:n==="issues"})}" data-bundle-tab="issues" aria-selected="${String(n==="issues")}" role="tab">Issues</button> <button type="button" class="${F({"bundles-tab":!0,active:n==="terminal"})}" data-bundle-tab="terminal" aria-selected="${String(n==="terminal")}" role="tab">Terminal</button> <button type="button" class="${F({"bundles-tab":!0,active:n==="treemap"})}" data-bundle-tab="treemap" aria-selected="${String(n==="treemap")}" role="tab">Treemap</button> <button type="button" class="${F({"bundles-tab":!0,active:n==="graph"})}" data-bundle-tab="graph" aria-selected="${String(n==="graph")}" role="tab">Graph</button> <button type="button" class="${F({"bundles-tab":!0,active:n==="code"})}" data-bundle-tab="code" aria-selected="${String(n==="code")}" role="tab">Code</button> <button type="button" class="${F({"bundles-tab":!0,active:n==="search"})}" data-bundle-tab="search" aria-selected="${String(n==="search")}" role="tab">Search</button> ${r?d`<button type="button" class="${F({"bundles-tab":!0,active:n==="compare"})}" data-bundle-tab="compare" aria-selected="${String(n==="compare")}" role="tab">Compare</button>`:g} <button type="button" class="${F({"bundles-tab":!0,active:o})}" data-bundle-tab="overview" aria-selected="${String(o)}" role="tab">Overview</button></div></header><div class="${F({"bundles-slide-body":!0,"bundles-slide-body-overview":o})}">${o?y1(e,s):l?Vd(n,[["terminal",()=>d`<div id="bundle-terminal-slot" class="bundle-terminal-slot"></div>`],["graph",()=>d`<div id="bundle-graph-slot" class="bundle-graph-slot"></div>`],["treemap",()=>d`<bundle-treemap .details="${s}"></bundle-treemap>`],["code",()=>Qx(s)],["search",()=>u1(s)],["compare",()=>d`<bundle-compare .details="${s}" .integrity="${e.integrity}"></bundle-compare>`],["issues",()=>h1(s)],["advisories",()=>$b(s)]]):i?d`<div class="${F({"bundles-slide-placeholder":!0,"is-error":!!s.error})}">${s.error?`Failed to parse: ${s.error}`:"Bundle contents not parsed."}</div>`:d`<div class="bundles-slide-placeholder">Loading bundle…</div>`}</div></div>`}function f1(e,t={}){if(!e)return g;let r=[];if(e.fileHash&&(r=zo(e.fileHash,e)),r.length===0&&t.bucketKey&&(t.kind==="package"?r=hc(t.bucketKey,e):t.kind==="repository"&&(r=gc(t.bucketKey,e))),r.length===0)return g;let n=r.slice(0,2),o=r.length-n.length;return d`<div class="bundle-issue-reports">${n.map(s=>{let i=ne[nt(s)]??ne.default;return d`<button type="button" class="report-chip" title="${s}" data-bundle-issue-report="${s}">${ye(i)}<span class="report-chip-label">${De(s)}</span></button>`})} ${o>0?d`<span class="bundle-issue-reports-more">, and ${o} more…</span>`:g}</div>`}function Rb(e){if(e==null||e==="")return"";let t=String(e),r=t.indexOf("-");if(r>0){let o=parseInt(t.slice(0,r),10),s=parseInt(t.slice(r+1),10);return Number.isFinite(o)&&Number.isFinite(s)&&s>o?`Lines ${o}-${s}`:Number.isFinite(o)?`Line ${o}`:""}let n=parseInt(t,10);return Number.isFinite(n)?`Line ${n}`:""}function Ss(e,t){return d`<div class="bundle-issues-empty"><p class="bundle-issues-empty-primary">${e}</p>${t?d`<p class="bundle-issues-empty-hint">${t}</p>`:g}</div>`}function h1(e){if(!e||!e.json&&!e.bundle)return g;if(!e.fileHashes)return Ss("Computing file hashes\u2026","Hashing this bundle's sources so findings from your reports can be matched against them.");if(e.fileHashes.size===0)return Ss("This bundle doesn't carry any source content.","Issues are matched by source-file hash, so a bundle without inline sources has nothing to match findings against.");let t=ro(e.fileHashes,"issues");if(t.size===0){let r=fc();if(r===0)return Ss("No issues match this bundle's files.","Issues are analyzer findings matched to this bundle by source-file hash. No hash-carrying findings are indexed yet \u2014 hash matching needs the analyzer's native JSON reports; drop one and any matches will appear here automatically.");let n=0;for(let o of e.fileHashes.values())n+=Do(o).length;return n>0?Ss("All matching issues are dismissed.",`${n} ${n===1?"finding matches":"findings match"} this bundle's files, but every one is triaged invalid or deleted.`):Ss("No issues match this bundle's files.",`None of the ${r.toLocaleString()} indexed ${r===1?"finding":"findings"} reference a source file in this bundle \u2014 matching compares exact file hashes, so findings from a different build of the same project won't line up.`)}return As(t,{kind:"bundle"})}function As(e,{kind:t,bucketKey:r}={}){let n=[...e.keys()],{prefix:o,stripped:s}=ot(n),i=new Map(n.map((u,p)=>[u,s[p]])),l=[...e.entries()].toSorted(([u,p],[f,h])=>{let b=ve[pn(p)]??0,m=ve[pn(h)]??0;return m!==b?m-b:(i.get(u)??u).localeCompare(i.get(f)??f)}),c=[...e.values()].reduce((u,p)=>u+p.length,0);return d`<div class="bundle-issues"><div class="bundle-issues-summary">${c} ${c===1?"issue":"issues"} across ${e.size} ${e.size===1?"file":"files"} ${o?d`<span class="mono">${o}</span>`:g}</div><ul class="bundle-issues-list">${J(l,([u])=>u,([u,p])=>{let f=i.get(u)??u,h=[...p].toSorted((m,v)=>{let w=ve[m.severity]??0,y=ve[v.severity]??0;if(y!==w)return y-w;let k=parseInt(m.line,10)||0,C=parseInt(v.line,10)||0;return k-C}),b=t==="repository"&&r?`${/^https?:/iu.test(r)?r.replace(/\/$/u,""):`https://github.com/${r}`}/blob/HEAD/${u}`:null;return d`<li class="bundle-issues-file-group"><header class="bundle-issues-file-header">${t==="bundle"?d`<button type="button" class="bundle-issues-file-name mono" data-bundle-view-source="${u}" title="${u}">${f}</button>`:b?d`<a class="bundle-issues-file-name bundle-issues-file-name-link mono" href="${b}" target="_blank" rel="noopener" title="${u}">${f}</a>`:d`<span class="bundle-issues-file-name bundle-issues-file-name-static mono" title="${u}">${f}</span>`} <span class="bundle-issues-file-count">${p.length} ${p.length===1?"issue":"issues"}</span></header><ul class="bundle-issues-findings">${J(h,m=>m.id??`${u}\0${m.line??""}\0${m.severity??""}\0${m.description??""}`,m=>{let v=p.indexOf(m),w=m.severity,y=a.triage.get(D(m))?.triage,k=y==="fixed"||y==="invalid"||y==="deleted"?y.toUpperCase():y==="inprogress"?"In progress":null,C=d`<div class="bundle-issues-finding-head"><span class="${`bundle-issue-sev sev-${w}`}">${w.replaceAll("_"," ")}</span> ${(()=>{let T=Rb(m.line);return T?d`<span class="bundle-issues-finding-line">${T}</span>`:g})()} ${k?d`<span class="${`bundle-issues-finding-triage triage-${y}`}">${k}</span>`:g} <span class="bundle-issues-finding-spacer"></span> ${f1(m,{kind:t,bucketKey:r})}</div><div class="bundle-issues-finding-desc">${Nt(m.description??"")}</div>`;return d`<li class="bundle-issues-finding">${t==="bundle"?d`<button type="button" class="bundle-issues-finding-link" data-bundle-view-source="${u}" data-bundle-view-finding-idx="${v}" data-bundle-view-line="${m.line??""}" title="${u}">${C}</button>`:d`<div class="bundle-issues-finding-link bundle-issues-finding-static" title="${u}">${C}</div>`}</li>`})}</ul></li>`})}</ul></div>`}function Mb(e){let t=a.selectedBundle,r=t?e.find(n=>n.integrity===t):null;return r?p1(r):d`<div class="bundles-view bundles-view-empty"><p class="bundles-empty-hint">${e.length===0?d`No bundles yet. Drop a <code>.map</code> sourcemap or a <code>.stasis.code.br</code> bundle to start.`:"Pick a bundle from the sidebar to open it."}</p></div>`}var g1=d`<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2v8"/><path d="m4.5 7 3.5 3.5L11.5 7"/><path d="M2.5 13h11"/></svg>`,m1=d`<svg viewBox="0 0 24 24" width="12" height="12" fill="currentColor" aria-hidden="true"><path d="M0 0v24H8.222l2.089-2.373 2.09-2.374V13.2H18.978l2.51-2.488L24 8.223V0H12zm5.2 5.2h13.791L12.2 12c-3.735 3.74-6.838 6.8-6.896 6.8-.057 0-.104-3.06-.104-6.8zm8.4 8.8v10H24V14h-5.2z"/></svg>`;function b1(e,t){let r=Tm(t);return d`<div class="bundles-overview-exports"><div class="bundles-overview-exports-row"><button type="button" class="bundles-download-btn" data-bundle-download="${e.integrity}">${g1}<span>Download bundle</span></button> ${r?d`<div class="bundles-export-pair"><button type="button" class="bundles-download-btn" data-bundle-export-sbom="cyclonedx" title="Export a CycloneDX SBOM (.cdx.json)">CycloneDX</button> <button type="button" class="bundles-download-btn" data-bundle-export-sbom="spdx" title="Export an SPDX SBOM (.spdx.json)">${m1}<span>SPDX</span></button></div>`:g}</div></div>`}function y1(e,t){let r=d`<dl class="bundles-detail-meta"><dt>Name</dt><dd>${e.name}</dd><dt>Integrity</dt><dd class="mono">${e.integrity}</dd>${t&&t.integrity===e.integrity?d`<dt>Size</dt><dd>${oe(t.size)}</dd>`:g}</dl>`,n=b1(e,t);if(!t||t.integrity!==e.integrity)return d`<div class="bundles-overview"><div class="bundles-overview-summary"><div class="bundles-detail-meta-row">${r}${n}</div></div></div>`;if(t.error)return d`<div class="bundles-overview"><div class="bundles-overview-summary"><div class="bundles-detail-meta-row">${r}${n}</div></div><div class="bundles-overview-placeholder is-error">Failed to parse: ${t.error}</div></div>`;if(t.kind==="sourcemap"&&t.json){let o=t.json,s=o.sources??[],i=o.sourcesContent??[],l=s.map((u,p)=>typeof i[p]=="string"?new TextEncoder().encode(i[p]).byteLength:null),c=d`<dt>Version</dt><dd>${String(o.version??"?")}</dd>${o.file?d`<dt>Output</dt><dd class="mono">${o.file}</dd>`:g} ${o.sourceRoot?d`<dt>Source root</dt><dd class="mono">${o.sourceRoot}</dd>`:g} ${o.names?d`<dt>Names</dt><dd>${o.names.length}</dd>`:g}`;return xb(r,c,s,l,null,n)}if(t.kind==="stasis"&&t.bundle){let o=t.bundle,s=o.sources,i=[...s.keys()],l=new Set;for(let f of o.imports.keys()){let h=f.replace(/\s*\(with: .*\)\s*$/u,"");for(let b of h.split(", "))l.add(b)}let c=[...l].toSorted(),u=i.map(f=>{let h=s.get(f);return typeof h=="string"?new TextEncoder().encode(h).byteLength:null}),p=d`<dt>Version</dt><dd>${String(o.version)}</dd>${c.length>0?d`<dt>Resolution kinds</dt><dd>${c.join(", ")}</dd>`:g}`;return xb(r,p,i,u,Ir(t),n)}return d`<div class="bundles-overview"><div class="bundles-overview-summary"><div class="bundles-detail-meta-row">${r}${n}</div></div><div class="bundles-overview-placeholder">Bundle contents not parsed.</div></div>`}function Fb(){Mt().catch(()=>{});let e=Rt(),t={inprogress:0,fixed:0,invalid:0,deleted:0},r=[];for(let[h,b]of e){let m=[],v=[],w=new Map,y=new Set;for(let[k,C]of b.byVersion){let T=[],S=new Map;for(let M of C.findings){let I=a.triage.get(D(M))?.triage??null;I==="inprogress"?t.inprogress++:I==="fixed"?t.fixed++:I==="invalid"?t.invalid++:I==="deleted"&&t.deleted++,I===a.shownTriage&&(T.push(M),S.has(M.file)||S.set(M.file,[]),S.get(M.file).push(M))}if(T.length!==0){m.push([k,{findings:T,files:S,reports:C.reports}]);for(let M of T)v.push(M),w.has(M.file)||w.set(M.file,[]),w.get(M.file).push(M);for(let M of C.reports)y.add(M)}}m.length!==0&&(m.sort(([k],[C])=>vl(k,C)),r.push([h,{findings:v,files:w,reports:y,versions:m}]))}let n=a.selectedPackage,o=n?r.find(([h])=>h===n)??null:null,s=null;if(o){let h=o[1].versions,b=a.selectedPackageVersion;s=h.find(([m])=>m===b)??null,!s&&h.length===1&&(s=h[0])}let i=s?s[1]:o?o[1]:null;if(o&&a.packageDetailsTab==="issues")return S1(o[0],i,s?s[0]:void 0);let l=a.packagesSearchQuery.trim().toLowerCase(),c=l?r.filter(([h])=>h.toLowerCase().includes(l)):r.slice();x1(c,a.packagesSortBy);let u=r.reduce((h,[,b])=>h+b.findings.length,0),p=new Set;for(let[,h]of r)for(let b of h.reports)p.add(b);let f=o?"packages-layout open":"packages-layout";return d`<div class="${F({"packages-view":!0,"with-details":!!o})}"><header class="page-head"><div class="page-title"><h1>Packages</h1><div class="meta-row"><span>${c.length===r.length?d`${r.length} ${r.length===1?"package":"packages"}`:d`${c.length} of ${r.length} ${r.length===1?"package":"packages"}`}</span> ${u>0?d`<span>${u} ${u===1?"finding":"findings"} across ${p.size} ${p.size===1?"report":"reports"}</span>`:g}</div></div>${k1(t)}</header>${r.length===0?d`<p style="color:var(--muted)">${e.size===0?"Indexing reports\u2026 this view populates as the OPFS scan finishes.":a.shownTriage?`No ${a.shownTriage} findings in any package.`:"No untriaged findings in any package."}</p>`:c.length===0?d`<p style="color:var(--muted)">No packages match "${a.packagesSearchQuery}".</p>`:d`<div class="${f}"><ul class="packages-list">${J(v1(c),w1,h=>C1(h,n,a.selectedPackageVersion))}</ul>${o?d`<aside class="packages-details" id="packages-details"><header class="packages-details-bar"><span class="packages-details-label">Details</span> <button type="button" class="packages-details-close" data-deselect-package title="Close details" aria-label="Close details">×</button></header><div class="packages-details-body">${T1(o[0],i,s?s[0]:void 0)}</div></aside>`:g}</div>`}</div>`}function v1(e){let t=[];for(let[r,n]of e){let o=n.versions;if(o.length<=1){let[c,u]=o[0];t.push({kind:"single",pkg:r,version:c,bucket:u,totalVersions:1});continue}let[s,i]=o[0],l=a.expandedPackages.has(r);if(t.push({kind:"latest",pkg:r,version:s,bucket:i,totalVersions:o.length,expanded:l}),l)for(let c=1;c<o.length;c++){let[u,p]=o[c];t.push({kind:"other",pkg:r,version:u,bucket:p,totalVersions:o.length})}}return t}function w1(e){return e.version===null?`${e.kind}:${e.pkg}`:`${e.kind}:${e.pkg}@${e.version}`}function k1(e){return d`<div class="packages-toolbar"><entity-search kind="packages"></entity-search><entity-sort kind="packages"></entity-sort><triage-selector variant="packages" .counts="${e}" .states="${$1}"></triage-selector></div>`}var $1=["inprogress","fixed","invalid","deleted"];function x1(e,t){let r=t==="name-asc"?(n,o)=>n[0].localeCompare(o[0]):t==="files-desc"?(n,o)=>o[1].files.size-n[1].files.size||n[0].localeCompare(o[0]):t==="reports-desc"?(n,o)=>o[1].reports.size-n[1].reports.size||n[0].localeCompare(o[0]):(n,o)=>o[1].findings.length-n[1].findings.length||n[0].localeCompare(o[0]);e.sort(r)}function _1(e,t){let r={live:0,invalid:0,deleted:0};if(!e)return r;let n=t===void 0?e.files.values():e.byVersion.get(t)?.files.values()??[].values();for(let o of n)for(let s of o){let i=a.triage.get(D(s))?.triage??null;i==="invalid"?r.invalid++:i==="deleted"?r.deleted++:r.live++}return r}function S1(e,t,r){let n=Rt().get(e),o=_1(n,r),s=a.packageSlideTriage??"live",i=n?Bb(n,e,s,r):new Map,l=[...i.values()].reduce((f,h)=>f+h.length,0),c=s==="live"?l===1?"issue":"issues":l===1?`${s} issue`:`${s} issues`,u=s==="live"?"No live issues for this package.":`No ${s} issues for this package.`,p=typeof r=="string"?` @ ${r}`:"";return d`<div class="packages-view packages-slide-view"><header class="bundles-slide-bar"><button type="button" class="bundles-slide-back" data-action="package-slide-back" title="Back to packages" aria-label="Back to packages">← Back</button><div class="bundles-slide-title"><div class="bundles-slide-name">${e}${p}</div><div class="bundles-slide-integrity">${l} ${c} · ${t.files.size} ${t.files.size===1?"file":"files"} · ${t.reports.size} ${t.reports.size===1?"report":"reports"}</div></div><slide-triage-tabs kind="package" .counts="${o}"></slide-triage-tabs></header><div class="bundles-slide-body">${i.size===0?d`<div class="bundle-issues-empty">${u}</div>`:As(i,{kind:"package",bucketKey:e})}</div></div>`}function C1(e,t,r){let{kind:n,pkg:o,version:s,bucket:i}=e,l={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0};for(let m of i.findings){let v=re(m,a.severityMode);l[v]!==void 0&&l[v]++}let c=we.filter(m=>l[m]>0),u=Ye(o),f={selected:o===t&&E1(e,r),"packages-row-latest":n==="latest","packages-row-other":n==="other"},h=s===null?"":s,b=s===null?`Open issues for ${o}`:`Open issues for ${o}@${s}`;return d`<li class="${F(f)}" data-select-package="${o}" data-select-package-version="${h}"><span class="packages-dot" style="${de({background:u})}"></span><div class="packages-row-text"><div class="packages-name-line"><span class="packages-name">${o}${s===null?g:d`<span class="packages-version">@${s}</span>`} </span>${n==="latest"?A1(o,e.expanded,e.totalVersions-1):g}</div><span class="packages-row-meta">${i.findings.length} ${i.findings.length===1?"finding":"findings"} · ${i.files.size} ${i.files.size===1?"file":"files"} · ${i.reports.size} ${i.reports.size===1?"report":"reports"}</span></div>${c.length>0?d`<div class="packages-row-chips">${c.map(m=>d`<span class="${`tree-count-chip ${m}`}" title="${m.replaceAll("_"," ")}">${l[m]}</span>`)}</div>`:g} <button type="button" class="packages-row-issues" data-package-row-issues="${o}" data-package-row-issues-version="${h}" aria-label="${b}">Issues →</button></li>`}function E1(e,t){return e.kind==="single"?!0:e.version===t}function A1(e,t,r){let n=t?"Hide":`+${r} ${r===1?"version":"versions"}`;return d`<button type="button" class="${F({"packages-row-expand":!0,expanded:t})}" data-package-expand="${e}" aria-expanded="${String(t)}" aria-label="${t?`Hide older versions of ${e}`:`Show older versions of ${e}`}" title="${t?"Hide older versions":`Show older versions (${r})`}"><span class="packages-row-expand-chevron" aria-hidden="true"></span> <span class="packages-row-expand-label">${n}</span></button>`}function T1(e,t,r){let n=Rt().get(e),s=[...(n?Bb(n,e,"live",r):new Map).values()].reduce((i,l)=>i+l.length,0);return d`<div class="bundles-tabs" role="tablist"><button type="button" class="bundles-tab active" data-package-tab="overview" aria-selected="true" role="tab">Overview</button> <span class="bundles-tabs-spacer"></span> ${s>0?d`<button type="button" class="bundles-tab bundles-tab-action" data-package-tab="issues">Issues (${s}) →</button>`:g}</div>${I1(e,t,r)}`}function Bb(e,t,r="live",n){let o=new Map,s=n===void 0?e.files:e.byVersion.get(n)?.files??new Map;for(let[i,l]of s){let c=l.filter(f=>{let h=a.triage.get(D(f))?.triage??null;return r==="invalid"?h==="invalid":r==="deleted"?h==="deleted":h!=="invalid"&&h!=="deleted"});if(c.length===0)continue;let u=Lb(t,i);o.has(u)||o.set(u,[]);let p=o.get(u);for(let f of c)p.push(f)}return o}function I1(e,t,r){let n={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0};for(let f of t.findings){let h=re(f,a.severityMode);n[h]!==void 0&&n[h]++}let o=we.filter(f=>n[f]>0),s=[...t.files.entries()].toSorted(([f,h],[b,m])=>m.length!==h.length?m.length-h.length:f.localeCompare(b)),i=[...t.reports].toSorted((f,h)=>f.localeCompare(h)),c=Rt().get(e)?.repos,u=c&&c.size===1?[...c][0]:null,p=u?/^https?:/iu.test(u)?u:`https://github.com/${u}`:null;return d`<dl class="packages-detail-meta"><dt>Package</dt><dd class="mono">${e}</dd>${r?d`<dt>Version</dt><dd class="mono">${r}</dd>`:g} ${p?d`<dt>Repository</dt><dd class="mono"><a href="${p}" target="_blank" rel="noopener">${u}</a></dd>`:g}<dt>Findings</dt><dd>${t.findings.length}</dd><dt>Files</dt><dd>${t.files.size}</dd><dt>Reports</dt><dd>${t.reports.size}</dd></dl>${o.length>0?d`<div class="packages-detail-chips">${o.map(f=>d`<span class="${`tree-count-chip ${f}`}">${n[f]} ${f.replaceAll("_"," ")}</span>`)}</div>`:g}<h3 class="packages-detail-section">Reports</h3><ul class="packages-detail-reports">${i.map(f=>{let h=ne[nt(f)]??ne.default;return d`<li><button type="button" class="packages-detail-report" title="${f}" data-package-report="${f}">${ye(h)}<span class="packages-detail-report-label">${De(f)}</span></button></li>`})}</ul><h3 class="packages-detail-section">Files</h3><ul class="packages-detail-files">${s.map(([f,h])=>{let b=Lb(e,f);return d`<li class="packages-detail-file"><span class="packages-detail-file-path mono" title="${f}">${b}</span> <span class="packages-detail-file-count">${h.length}</span></li>`})}</ul>`}function Lb(e,t){for(let r of["node_modules","dependencies"]){let n=`${r}/${e}/`,o=t.indexOf(n);if(o>=0)return t.slice(o+n.length)}return t.startsWith(`${e}/`)?t.slice(e.length+1):t}function gt(e){if(!e)return"";let t=e.match(/github\.com\/([^/?#]+\/[^/?#]+?)(?:\.git)?(?:[/?#]|$)/iu);return t?t[1]:e}function Ob(){Mt().catch(()=>{});let e=Qr(),t={inprogress:0,fixed:0,invalid:0,deleted:0},r=[];for(let[p,f]of e){let h=[],b=new Map;for(let m of f.findings){let v=a.triage.get(D(m))?.triage??null;v==="inprogress"?t.inprogress++:v==="fixed"?t.fixed++:v==="invalid"?t.invalid++:v==="deleted"&&t.deleted++,v===a.shownTriage&&(h.push(m),b.has(m.file)||b.set(m.file,[]),b.get(m.file).push(m))}h.length>0&&r.push([p,{findings:h,files:b,reports:f.reports}])}let n=a.selectedRepository,o=n?r.find(([p])=>p===n)??null:null;if(o&&a.repositoryDetailsTab==="issues")return L1(o[0],o[1]);let s=a.repositoriesSearchQuery.trim().toLowerCase(),i=s?r.filter(([p])=>p.toLowerCase().includes(s)||gt(p).toLowerCase().includes(s)):r.slice();F1(i,a.repositoriesSortBy);let l=r.reduce((p,[,f])=>p+f.findings.length,0),c=new Set;for(let[,p]of r)for(let f of p.reports)c.add(f);let u=o?"packages-layout open":"packages-layout";return d`<div class="${F({"packages-view":!0,"with-details":!!o})}"><header class="page-head"><div class="page-title"><h1>Repositories</h1><div class="meta-row"><span>${i.length===r.length?d`${r.length} ${r.length===1?"repository":"repositories"}`:d`${i.length} of ${r.length} ${r.length===1?"repository":"repositories"}`}</span> ${l>0?d`<span>${l} ${l===1?"finding":"findings"} across ${c.size} ${c.size===1?"report":"reports"}</span>`:g}</div></div>${R1(t)}</header>${r.length===0?d`<p style="color:var(--muted)">${e.size===0?"Indexing reports\u2026 this view populates as the OPFS scan finishes.":a.shownTriage?`No ${a.shownTriage} findings in any repository.`:"No untriaged findings in any repository."}</p>`:i.length===0?d`<p style="color:var(--muted)">No repositories match "${a.repositoriesSearchQuery}".</p>`:d`<div class="${u}"><ul class="packages-list">${J(i,([p])=>p,([p,f])=>O1(p,f,p===n))}</ul>${o?d`<aside class="packages-details" id="repositories-details"><header class="packages-details-bar"><span class="packages-details-label">Details</span> <button type="button" class="packages-details-close" data-deselect-repository title="Close details" aria-label="Close details">×</button></header><div class="packages-details-body">${P1(o[0],o[1])}</div></aside>`:g}</div>`}</div>`}function R1(e){return d`<div class="packages-toolbar"><entity-search kind="repositories"></entity-search><entity-sort kind="repositories"></entity-sort><triage-selector variant="packages" .counts="${e}" .states="${M1}"></triage-selector></div>`}var M1=["inprogress","fixed","invalid","deleted"];function F1(e,t){let r=t==="name-asc"?(n,o)=>gt(n[0]).localeCompare(gt(o[0])):t==="files-desc"?(n,o)=>o[1].files.size-n[1].files.size||gt(n[0]).localeCompare(gt(o[0])):t==="reports-desc"?(n,o)=>o[1].reports.size-n[1].reports.size||gt(n[0]).localeCompare(gt(o[0])):(n,o)=>o[1].findings.length-n[1].findings.length||gt(n[0]).localeCompare(gt(o[0]));e.sort(r)}function B1(e){let t={live:0,invalid:0,deleted:0};if(!e)return t;for(let r of e.files.values())for(let n of r){let o=a.triage.get(D(n))?.triage??null;o==="invalid"?t.invalid++:o==="deleted"?t.deleted++:t.live++}return t}function L1(e,t){let r=Qr().get(e),n=B1(r),o=a.repositorySlideTriage??"live",s=r?Pb(r,o):new Map,i=[...s.values()].reduce((u,p)=>u+p.length,0),l=o==="live"?i===1?"issue":"issues":i===1?`${o} issue`:`${o} issues`,c=o==="live"?"No live issues for this repository.":`No ${o} issues for this repository.`;return d`<div class="packages-view packages-slide-view"><header class="bundles-slide-bar"><button type="button" class="bundles-slide-back" data-action="repository-slide-back" title="Back to repositories" aria-label="Back to repositories">← Back</button><div class="bundles-slide-title"><div class="bundles-slide-name">${gt(e)}</div><div class="bundles-slide-integrity">${i} ${l} · ${t.files.size} ${t.files.size===1?"file":"files"} · ${t.reports.size} ${t.reports.size===1?"report":"reports"}</div></div><slide-triage-tabs kind="repository" .counts="${n}"></slide-triage-tabs></header><div class="bundles-slide-body">${s.size===0?d`<div class="bundle-issues-empty">${c}</div>`:As(s,{kind:"repository",bucketKey:e})}</div></div>`}function O1(e,t,r){let n={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0};for(let l of t.findings){let c=re(l,a.severityMode);n[c]!==void 0&&n[c]++}let o=we.filter(l=>n[l]>0),s=Ye(e),i=gt(e);return d`<li class="${r?"selected":""}" data-select-repository="${e}"><span class="packages-dot" style="${de({background:s})}"></span><div class="packages-row-text"><span class="packages-name">${i}</span> <span class="packages-row-meta">${t.findings.length} ${t.findings.length===1?"finding":"findings"} · ${t.files.size} ${t.files.size===1?"file":"files"} · ${t.reports.size} ${t.reports.size===1?"report":"reports"}</span></div>${o.length>0?d`<div class="packages-row-chips">${o.map(l=>d`<span class="${`tree-count-chip ${l}`}" title="${l.replaceAll("_"," ")}">${n[l]}</span>`)}</div>`:g} <button type="button" class="packages-row-issues" data-repository-row-issues="${e}" aria-label="${`Open issues for ${i}`}">Issues →</button></li>`}function P1(e,t){let r=Qr().get(e),o=[...(r?Pb(r):new Map).values()].reduce((s,i)=>s+i.length,0);return d`<div class="bundles-tabs" role="tablist"><button type="button" class="bundles-tab active" data-repository-tab="overview" aria-selected="true" role="tab">Overview</button> <span class="bundles-tabs-spacer"></span> ${o>0?d`<button type="button" class="bundles-tab bundles-tab-action" data-repository-tab="issues">Issues (${o}) →</button>`:g}</div>${N1(e,t)}`}function Pb(e,t="live"){let r=new Map;for(let[n,o]of e.files){let s=o.filter(i=>{let l=a.triage.get(D(i))?.triage??null;return t==="invalid"?l==="invalid":t==="deleted"?l==="deleted":l!=="invalid"&&l!=="deleted"});s.length>0&&r.set(n,s)}return r}function N1(e,t){let r={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0};for(let l of t.findings){let c=re(l,a.severityMode);r[c]!==void 0&&r[c]++}let n=we.filter(l=>r[l]>0),o=[...t.files.entries()].toSorted(([l,c],[u,p])=>p.length!==c.length?p.length-c.length:l.localeCompare(u)),s=[...t.reports].toSorted((l,c)=>l.localeCompare(c)),i=/^https?:/iu.test(e)?e:`https://github.com/${e}`;return d`<dl class="packages-detail-meta"><dt>Repository</dt><dd class="mono"><a href="${i}" target="_blank" rel="noopener">${gt(e)}</a></dd><dt>Findings</dt><dd>${t.findings.length}</dd><dt>Files</dt><dd>${t.files.size}</dd><dt>Reports</dt><dd>${t.reports.size}</dd></dl>${n.length>0?d`<div class="packages-detail-chips">${n.map(l=>d`<span class="${`tree-count-chip ${l}`}">${r[l]} ${l.replaceAll("_"," ")}</span>`)}</div>`:g}<h3 class="packages-detail-section">Reports</h3><ul class="packages-detail-reports">${s.map(l=>{let c=ne[nt(l)]??ne.default;return d`<li><button type="button" class="packages-detail-report" title="${l}" data-package-report="${l}">${ye(c)}<span class="packages-detail-report-label">${De(l)}</span></button></li>`})}</ul><h3 class="packages-detail-section">Files</h3><ul class="packages-detail-files">${o.map(([l,c])=>d`<li class="packages-detail-file"><span class="packages-detail-file-path mono" title="${l}">${l}</span> <span class="packages-detail-file-count">${c.length}</span></li>`)}</ul>`}var Ts=new Map,Is=new Map,pu=new Set;function D1(e,t,r){let n=`${e}\0${t}`;if(Is.has(n)||pu.has(n))return;let o=xa(t);if(!o){Is.set(n,null);return}pu.add(n),(async()=>{let s=await _a(r,o);Is.set(n,s??null),pu.delete(n),a.focusCodeTick++,queueMicrotask(x)})()}async function z1(e){let t=Ts.get(e);if(t&&(t.loading||t.sources))return;let r=(a.bundles??[]).find(n=>n.integrity===e);if(r){Ts.set(e,{sources:null,loading:!0,error:null});try{let n=await Zn(e,r),o=We(n);Ts.set(e,{sources:o,loading:!1,error:n.error??null})}catch(n){Ts.set(e,{sources:null,loading:!1,error:n.message})}a.focusCodeTick++,queueMicrotask(x),queueMicrotask(()=>{let n=E.querySelector(".focus-code-line-active");n&&n.scrollIntoView({block:"center",behavior:"instant"})})}}function Nb(e){if(!e)return null;let t=ze(e);if(!t.fileHash||!Array.isArray(t._bundleHashes)||t._bundleHashes.length===0)return null;let r=new Set(t._bundleHashes),n=Zr(t.fileHash).find(({integrity:u})=>r.has(u));if(!n)return null;let o=Ts.get(n.integrity);if(!o)return z1(n.integrity),{loading:!0};if(o.loading)return{loading:!0};if(!o.sources)return null;let s=o.sources.get(n.file);if(typeof s!="string")return null;D1(n.integrity,n.file,s);let i=`${n.integrity}\0${n.file}`,l=Is.has(i)?Is.get(i):void 0,c=parseInt(t.line,10);return{content:s,file:n.file,integrity:n.integrity,line:Number.isFinite(c)?c:null,highlighted:l,loading:!1}}var fu=class extends R{static styles=[...R.styles,B(ke)];static properties={workspaceId:{type:String},items:{type:Array},_uploading:{state:!0},_errors:{state:!0},_done:{state:!0},_settled:{state:!0}};constructor(){super(),this.workspaceId="",this.items=[],this._uploading=!1,this._errors=[],this._done=!1,this._settled=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="upload"]')?.focus()}_onClose=()=>this._finish({uploaded:[],failed:[]});_onCancel=()=>this._finish({uploaded:[],failed:[]});_onUpload=async()=>{if(this._uploading)return;this._uploading=!0,this._errors=[];let t=[],r=[];for(let n of this.items)try{let o;if(n.kind==="bundle")o=await fg(this.workspaceId,n.identifier);else{let s=await Gr(n.identifier);o=await oa(this.workspaceId,n.identifier,s)}if(o.ok)t.push({kind:n.kind,identifier:n.identifier});else{let s=o.reason??"unknown";r.push({kind:n.kind,identifier:n.identifier,reason:s}),this._errors=[...this._errors,{label:st(n),reason:s}]}}catch(o){let s=o?.message??String(o);r.push({kind:n.kind,identifier:n.identifier,reason:s}),this._errors=[...this._errors,{label:st(n),reason:s}]}this._uploading=!1,this._done=!0,r.length===0&&this._finish({uploaded:t,failed:r})};_errorsSection(){return this._errors.length===0?g:d`<ul class="lwd-list" role="alert">${this._errors.map(t=>d`<li><strong>${t.label}</strong> — ${t.reason}</li>`)}</ul>`}render(){let t=this.items.length,r=t===1,n=this.items.filter(u=>u.kind==="report").length,o=t-n,s="items";o===0?s=r?"report":"reports":n===0&&(s=r?"bundle":"bundles");let i=r?d`Upload <strong>"${st(this.items[0])}"</strong> to the workspace's remote inventory?`:d`Upload <strong>${t}</strong> local ${s} to the workspace's remote inventory?`,l=r?g:d`<ul class="lwd-list">${this.items.map(u=>d`<li>${st(u)}${u.kind==="bundle"?d`<span class="lwd-kind-tag">bundle</span>`:g}</li>`)}</ul>`,c=this._uploading?r?"Uploading\u2026":`Uploading ${t} ${s}\u2026`:r?"Upload":`Upload ${t}`;return d`<dialog @close="${this._onClose}"><header><h3>Upload to remote</h3></header><p class="lwd-body">${i}</p>${l}<p class="nwd-note">End-to-end encrypted with the workspace key — only workspace members can decrypt the uploaded content.</p>${this._errorsSection()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}" ?disabled="${this._uploading}">${this._done&&this._errors.length>0?"Close":"Cancel"}</button> ${this._done&&this._errors.length>0?g:d`<button type="button" data-role="upload" @click="${this._onUpload}" ?disabled="${this._uploading||t===0}">${c}</button>`}</footer></dialog>`}};customElements.define("sync-upload-dialog",fu);function Db({workspaceId:e,items:t}={}){return ee("sync-upload-dialog",{workspaceId:e??"",items:Array.isArray(t)?[...t]:[]})}var zb=`.rec-list{margin:.2rem 0 .55rem;padding:0;list-style:none;max-height:320px;overflow-y:auto}.rec-row{display:flex;align-items:center;gap:.5rem;padding:.28rem .15rem;font-size:.8rem;line-height:1.4;border-bottom:1px solid rgb(from var(--text) r g b / .06)}.rec-row:last-child{border-bottom:none}.rec-label{flex:1 1 auto;min-width:0;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rec-status{flex:0 0 auto;padding:0 .4rem;border-radius:4px;font-size:.68rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em}.rec-status-checking{color:var(--muted)}.rec-status-good{color:var(--ok, #16a34a)}.rec-status-reuploaded{color:var(--accent, #2563eb)}.rec-status-failed,.rec-status-check-failed{color:var(--warning, #d97706)}.rec-status-missing{color:var(--critical, #dc2626)}.rec-summary{margin:.1rem 0 .2rem;color:var(--muted);font-size:.76rem;line-height:1.45}.rec-error{margin:.3rem 0 .2rem;color:var(--critical, #f87171);font-size:.76rem;line-height:1.4}
84
- `;var H1={checking:"checking\u2026",good:"available",reuploaded:"re-uploaded",failed:"re-upload failed","check-failed":"check failed",missing:"missing"},hu=class extends R{static styles=[...R.styles,B(ke),B(zb)];static properties={workspaceId:{type:String},cloudCount:{type:Number},localFileNames:{type:Array},localBundles:{type:Array},_rows:{state:!0},_running:{state:!0},_ran:{state:!0},_error:{state:!0},_settled:{state:!0}};constructor(){super(),this.workspaceId="",this.cloudCount=0,this.localFileNames=[],this.localBundles=[],this._rows=[],this._running=!1,this._ran=!1,this._error=null,this._settled=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="recheck"]')?.focus()}_result(){return{items:this._rows,counts:this._counts()}}_onClose=()=>this._finish(this._ran?this._result():null);_onCancel=()=>this._finish(this._ran?this._result():null);_counts(){let t={good:0,reuploaded:0,failed:0,"check-failed":0,missing:0};for(let r of this._rows)r.status in t&&(t[r.status]+=1);return t}_onRecheck=async()=>{if(!this._running){this._running=!0,this._error=null,this._rows=[];try{let{items:t}=await hg(this.workspaceId,{onList:r=>{this._rows=r},onItem:r=>{this._rows=this._rows.map(n=>n.resourceTag===r.resourceTag?r:n)}});this._rows=t}catch(t){this._error=t?.message??String(t)}finally{this._running=!1,this._ran=!0}}};_downloadableItems(){let t=new Set(this.localFileNames),r=new Set(this.localBundles),n=[];for(let o of this._rows)o.status!=="good"||!o.identifier||(o.kind==="report"&&!t.has(o.identifier)?n.push({kind:"report",identifier:o.identifier}):o.kind==="bundle"&&!r.has(o.identifier)&&n.push({kind:"bundle",identifier:o.identifier,label:o.label}));return n}_onDownload=async()=>{let t=this._downloadableItems();t.length!==0&&await Ra({workspaceId:this.workspaceId,items:t})};_rowsSection(){return this._rows.length===0?this._running?d`<p class="lwd-body">Fetching remote listing…</p>`:g:d`<ul class="rec-list">${this._rows.map(t=>d`<li class="rec-row"><span class="rec-label">${t.label}${t.kind==="bundle"?d`<span class="lwd-kind-tag">bundle</span>`:g}</span> <span class="${`rec-status rec-status-${t.status}`}" title="${t.detail??g}">${H1[t.status]??t.status}</span></li>`)}</ul>`}_summarySection(){if(!this._ran||this._rows.length===0)return g;let t=this._counts(),r=[];return t.good&&r.push(`${t.good} available`),t.reuploaded&&r.push(`${t.reuploaded} re-uploaded`),t.failed&&r.push(`${t.failed} failed`),t["check-failed"]&&r.push(`${t["check-failed"]} check failed`),t.missing&&r.push(`${t.missing} missing`),r.length>0?d`<p class="rec-summary" role="status" aria-live="polite">${r.join(" \xB7 ")}</p>`:g}render(){let t=this.cloudCount===1?"":"s",r=this._ran?g:d`<p class="lwd-body">Re-check ${this.cloudCount>0?d`the <strong>${this.cloudCount}</strong>`:g}remote object${t} for this workspace. Each is re-fetched from the relay; any whose bytes are missing are re-uploaded from a matching local copy.</p>`,n=this._ran&&this._rows.length===0&&!this._error?d`<p class="lwd-empty">No remote objects to check.</p>`:g,o=this._ran?this._downloadableItems().length:0;return d`<dialog @close="${this._onClose}"><header><h3>Re-check cloud storage</h3></header>${r} ${this._rowsSection()} ${n} ${this._summarySection()} ${this._error?d`<p class="rec-error" role="alert">${this._error}</p>`:g}<footer class="nwd-actions"><span class="nwd-spacer"></span> ${o>0?d`<button type="button" data-role="download" @click="${this._onDownload}" ?disabled="${this._running}">Download ${o} not stored locally</button>`:g} <button type="button" data-role="cancel" @click="${this._onCancel}" ?disabled="${this._running}">${this._ran?"Close":"Cancel"}</button> <button type="button" data-role="recheck" @click="${this._onRecheck}" ?disabled="${this._running}">${this._running?"Re-checking\u2026":this._ran?"Re-check again":"Re-check"}</button></footer></dialog>`}};customElements.define("objstore-recovery-dialog",hu);function Ub({workspaceId:e,cloudCount:t,localFileNames:r,localBundles:n}={}){return ee("objstore-recovery-dialog",{workspaceId:e??"",cloudCount:typeof t=="number"?t:0,localFileNames:Array.isArray(r)?[...r]:[],localBundles:Array.isArray(n)?[...n]:[]})}function bu(){let e=Dd(a.reports);if(!e)return null;let t=Object.keys(e),n=kt().filter(p=>ge(p).commonTriage===a.shownTriage),o=Nd(n,a.severityMode),s=va(e,o),i=new Map,l=new Map,c=new Map;for(let p of n)for(let f of p){let h=re(f,a.severityMode);i.has(f.file)||i.set(f.file,new Set),i.get(f.file).add(h);let b=a.triage.get(D(f))?.color??"none";l.has(f.file)||l.set(f.file,new Set),l.get(f.file).add(b),c.has(f.file)||c.set(f.file,[]),c.get(f.file).push({severity:h,color:b})}let u;return A.focusedPkg?(u=t.filter(p=>(Cm(p)??"__own__")===A.focusedPkg),A.showAll||(u=u.filter(p=>zd(p,o,s)))):u=A.showAll?t:t.filter(p=>zd(p,o,s)),{prep:{treeData:e,files:u,ownCounts:o,transitiveCounts:s,severitySets:i,colorSets:l,fileFindings:c},findingCounts:o}}function yu(){let e=qn();if(!e)return;let t=bu();t&&e.refreshSidebar(t.prep,{isBundleContext:a.currentView==="bundles"})}function vu(){let e=qn();if(!e)return;let t=bu();t&&e.refreshTopPkgs(t.prep)}var V1={"claude-security":"Claude Security findings","codex-security":"Codex Security findings",deepsec:"DeepSec findings",piolium:"Piolium findings"};function j1(e,t){return a.currentWorkspace?t?d`<repo-chip url="${t}"></repo-chip>`:g:e?d`<repo-chip url="${a.repoUrl}" editable ?editing="${a.repoEditing}" ?empty="${!a.repoUrl}"></repo-chip>`:t?d`<repo-chip url="${t}"></repo-chip>`:g}var mu=["type","model","effort","exportsMode"];function Hb(e,t,{typePrefix:r=!0}={}){return e==="type"?r?`analyzer: ${t??"null"}`:`${t??"null"}`:t??null}function W1(e,t=mu){let r=new Map;for(let f of e){let h={};for(let m of t)h[m]=m==="model"?fs(f.model)??null:f[m]??null;let b=t.map(m=>h[m]??"").join("|");r.has(b)||r.set(b,h)}let n=[...r.values()];if(n.length===0)return[];let o={};for(let f of t)o[f]=new Set(n.map(h=>h[f])).size===1;let s=t.filter(f=>!o[f]),i=n.length>2&&s.includes("type")&&s.length>1,l=["model","effort"].filter(f=>t.includes(f)&&o[f]),c=[...l,...t.filter(f=>!l.includes(f))],u=[],p=!1;for(let f of c)if(o[f]){let h=Hb(f,n[0][f]);h!=null&&u.push(h)}else if(!p){for(let h of n){let b=s.map(m=>Hb(m,h[m],{typePrefix:!i})).filter(m=>m!=null);b.length>0&&u.push(b.join(" \xB7 "))}p=!0}return u}function K1(e,t,r,n,o){let s=e.length,i=new Set(a.reports.map(j=>j.source)),l=i.size===1?[...i][0]:null,c=a.currentWorkspace?W().find(j=>j.id===a.currentWorkspace):null,u=c?`Workspace: ${c.name}`:l?V1[l]:"Findings",p=l&&ne[l]?l:"default",f=ye(ne[p]),h=d`<svg class="file-icon" viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"/><path d="M14 3v6h6"/></svg>`,b=g;t.length===1?b=d`<span class="file-chip" data-copy-report="${t[0]}" title="Copy report name">${f}<span>${t[0]}</span></span>`:t.length>1&&(b=d`<span class="file-chip" data-copy-report="${t.join(`
85
- `)}" title="Copy report names">${h}<span>${t.length} reports</span></span>`);let m=a.reports.flatMap(j=>j.groups.flat()),w=`${s} ${`finding${s===1?"":"s"}`}`,k=l||a.currentWorkspace?mu.filter(j=>j!=="type"):mu,C=W1(m,k),T=g;if(s>0){let j={};for(let ae of e){let Qe=re(cn(ae),a.severityMode);Qe&&(j[Qe]=(j[Qe]||0)+1)}let Ce=we.filter(ae=>j[ae]>0);Ce.length>0&&(T=d`<span class="status-bar" aria-hidden="true">${Ce.map(ae=>{let Qe=`${j[ae]} ${ae.replaceAll("_"," ")}`;return d`<span class="${`status-seg sev-${ae}`}" style="${de({flexGrow:j[ae]})}" title="${Qe}"></span>`})}</span>`)}let S=j1(r,n),M=d`<span class="sep" aria-hidden="true"></span>`,I=a.currentView==="files",L=(o??0)>1?d`<button type="button" class="${F({"files-toggle-btn":!0,active:I})}" data-action="toggle-files" title="${I?"exit files view":"show files"}" aria-pressed="${String(I)}">${`Files: ${o}`}</button>`:g;return d`<header class="page-head"><div class="page-title"><h1>${u}${b}${S}${L}${q1()}</h1><div class="meta-row"><span>${w}</span> ${T} ${C.length>0?d`${M}${C.map(j=>d`<span class="tag">${j}</span>`)}`:g}</div></div></header>`}function q1(){if(N.status!=="online")return g;if(a.currentView!=="findings"&&a.currentView!=="files")return g;let e=Y1();if(!e)return g;let{workspaceId:t,fileNames:r,mode:n}=e;if(n==="single"){let w=r[0],y=bd(t,w)?"cloud":"local";return G1({status:y,label:y,title:y==="cloud"?"Synced to remote":"Local only \u2014 click to upload",onClick:y==="local"?()=>Vb({workspaceId:t,items:[{kind:"report",identifier:w}]}):null})}let o=W().find(w=>w.id===t),s=o&&Array.isArray(o.bundles)?o.bundles:[],i=og(t),l=r.filter(w=>!bd(t,w)),c=s.filter(w=>!rg(t,w)),u=[...l.map(w=>({kind:"report",identifier:w})),...c.map(w=>({kind:"bundle",identifier:w}))];if(i===0&&u.length===0)return g;let p=i>0,f=u.length>0,h=[i>0?`${i} in cloud`:null,u.length>0?`${u.length} local-only`:null,i>0?'click "cloud" to re-check storage':null,u.length>0?`click "local" to upload ${u.length}`:null].filter(Boolean).join(" \u2014 "),b=i===0?g:d`<button type="button" class="sync-badge-chunk cloud" aria-label="${`re-check ${i} cloud object${i===1?"":"s"}`}" @click="${w=>{w.stopPropagation(),Ub({workspaceId:t,cloudCount:i,localFileNames:r,localBundles:s})}}">${Jb()}<span>${i} cloud</span></button>`,m=u.length===0?g:d`<button type="button" class="sync-badge-chunk local" aria-label="${`${u.length} items not yet uploaded \u2014 open upload dialog`}" @click="${w=>{w.stopPropagation(),Vb({workspaceId:t,items:u})}}">${Yb()}<span>${u.length} local</span></button>`,v=i>0&&u.length>0?d`<span class="sync-badge-divider" aria-hidden="true"></span>`:g;return d`<div class="${`report-sync-badge${p||f?" report-sync-badge-clickable":""}`}" data-status="mixed" title="${h}">${b}${v}${m}</div>`}function G1({status:e,label:t,title:r,onClick:n}){let o=e==="cloud"?Jb():Yb(),s=d`<span class="sync-badge-label">${t}</span>`;return typeof n!="function"?d`<span class="report-sync-badge" data-status="${e}" title="${r}" aria-label="${`report sync status: ${t}`}">${o}${s}</span>`:d`<button type="button" class="report-sync-badge report-sync-badge-clickable" data-status="${e}" title="${r}" aria-label="${`report sync status: ${t}`}" @click="${n}">${o}${s}</button>`}function Yb(){return d`<svg class="sync-badge-icon" viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2" y="14" width="20" height="8" rx="2" ry="2"/><line x1="6" y1="18" x2="6.01" y2="18"/><line x1="10" y1="18" x2="10.01" y2="18"/><path d="M6 14V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v10"/></svg>`}function Jb(){return d`<svg class="sync-badge-icon" viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M17.5 19a4.5 4.5 0 1 0-1-8.9A6 6 0 0 0 5.07 13.5 4 4 0 0 0 6 21h11.5z"/></svg>`}async function Vb({workspaceId:e,items:t}){let r=t.filter(n=>n.kind==="bundle");if(r.length>0){let n=await vt(),o=new Map(n.map(s=>[s.integrity,s.name]));for(let s of r){let i=o.get(s.identifier);i&&(s.label=i)}}await Db({workspaceId:e,items:t})}function Y1(){if(a.currentWorkspace)return{mode:"workspace",workspaceId:a.currentWorkspace,fileNames:a.reports.map(e=>e.fileName).filter(e=>typeof e=="string")};if(a.currentFile){let e=W().find(t=>Array.isArray(t.reports)&&t.reports.includes(a.currentFile));return e?{mode:"single",workspaceId:e.id,fileNames:[a.currentFile]}:null}return null}function J1(e){return Object.values(e).some(r=>r>0)||a.filterSeverities.size>0?d`<severity-chips .counts="${e}"></severity-chips>`:g}function X1(e){return Object.values(e).some(r=>r>0)||a.filterColors.size>0?d`<triage-filter .counts="${e}"></triage-filter>`:g}function Q1(e,t,r,n,o,s,i,l){let{showSource:c,showConfidence:u,showPriority:p,showGraphMode:f,showFileSort:h,kanbanMode:b,showRepo:m,hasComment:v,hasFix:w,hasFlagged:y,showSeverityMode:k}=s;return d`<div class="toolbar"><div class="toolbar-row"><view-mode-buttons modes="${f?"table,list,grouped,focus,kanban,graph":"table,list,grouped,focus,kanban"}"></view-mode-buttons><findings-sort ?show-file="${h}" ?show-confidence="${u}" ?show-priority="${p}"></findings-sort>${c?d`<div class="sep"></div><source-filter></source-filter>`:g} ${v||w||y||a.filterComment||a.filterFix||a.filterFlagged?d`<div class="sep"></div><annotation-filter .hasComment="${v}" .hasFix="${w}" .hasFlagged="${y}"></annotation-filter>`:g} ${u?d`<div class="sep"></div><conf-filter></conf-filter>`:g} ${b?g:d`<triage-selector .counts="${r}"></triage-selector>`}</div><div class="toolbar-row sev-row">${k?d`<severity-mode-switch></severity-mode-switch><div class="sep"></div>`:g} ${J1(n)} ${i.analyzers.length>1||i.models.length>1?d`<analyzer-select .analyzers="${i.analyzers}" .models="${i.models}" .groups="${i.groups}"></analyzer-select>`:g} ${m&&l.length>1?d`<repo-filter .options="${l}"></repo-filter>`:g} ${X1(o)}<div class="search-row"><toolbar-search kind="findings"></toolbar-search><span class="result-count">${e} of ${t}</span></div></div></div>`}function gu(e,t){return e.map(r=>({p:cn(r),g:r})).toSorted((r,n)=>t(r.p,n.p)).map(r=>r.g)}var jb=(e,t)=>e.file.localeCompare(t.file)||parseInt(e.line,10)-parseInt(t.line,10),Oa=null,Wb=0,no=null,Pa=new Map;function Rs(e,t=!1,r=null){let n=Kn(e);return Pa.set(n,{group:e,inGroup:t}),t?r?d`<finding-card data-gid="${n}" in-group context="${r}"></finding-card>`:d`<finding-card data-gid="${n}" in-group></finding-card>`:r?d`<finding-card data-gid="${n}" context="${r}"></finding-card>`:d`<finding-card data-gid="${n}"></finding-card>`}var Z1=d`<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 2H2v4M10 2h4v4M14 10v4h-4M6 14H2v-4"/></svg>`,e_=d`<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 2v4H2M10 2v4h4M10 14v-4h4M6 14v-4H2"/></svg>`,t_={critical:"C",high:"H",medium:"M",low:"L",high_bug:"H",bug:"B",informational:"i"};function Kb(e,t={}){let{variant:r="kanban",active:n=!1}=t,o=ge(e),s=ze(e),i=ma(pt(s.description,s))||"(untitled finding)",l=r==="kanban",c={"kanban-card":!0,"has-conflict":o.hasConflict,"focus-side-card":!l,active:n};!o.hasConflict&&o.commonColor&&(c[`mark-${o.commonColor}`]=!0);let u=parseInt(s.line,10),p=Number.isFinite(u)?`:${u}`:"",f=re(s,a.severityMode),h=t_[f]??"?",b=Qt(s)&&a.severityMode!=="original",m=a.triage.get(D(s)),v=m?.flagged===!0,w=m?.fix??"",y=m?.comment??"",k=g;l&&w?k=Pt(w)?d`<a class="kanban-action kanban-fix-link" href="${w}" target="_blank" rel="noopener noreferrer" draggable="false" title="${`Open fix link: ${w}`}" aria-label="${`Open fix link: ${w}`}">${ms}</a>`:d`<button type="button" class="kanban-action mark-fix" title="${`Edit fix link: ${w}`}" aria-label="${`Edit fix link: ${w}`}">${ms}</button>`:l&&y&&(k=d`<button type="button" class="kanban-action mark-comment" title="${`Edit comment: ${y}`}" aria-label="${`Edit comment: ${y}`}">${ba}</button>`);let C=d`<div class="kanban-badge-col"><span class="${`kanban-badge sev-${f}`}" title="${b?`${je(f)} \u2014 corrected from ${je(s.severity)}`:je(f)}" aria-label="${b?`Severity ${je(f)}, corrected from ${je(s.severity)}`:`Severity ${je(f)}`}">${h}${b?"*":""}</span> ${v?d`<span class="kanban-flag" title="Flagged" aria-label="Flagged">${ya}</span>`:g} ${k}</div><span class="kanban-title">${i}</span><div class="kanban-meta"><span class="kanban-loc">${s.file}${p}</span> ${s.confidence===void 0||s.confidence===null?g:d`<span class="kanban-conf" title="${`Confidence ${s.confidence}/10`}">${s.confidence}</span>`}</div>`;return l?d`<div class="${F(c)}" data-gid="${Se(e)}" data-kanban-source draggable="true" role="button" tabindex="0" aria-current="${n?"true":"false"}" aria-label="${`Open details for ${i}`}">${C}</div>`:d`<div class="${F(c)}" data-gid="${Se(e)}" data-focus-select role="button" tabindex="0" aria-current="${n?"true":"false"}" aria-label="${`Focus on ${i}`}">${C}</div>`}function r_(e){let{content:t,line:r,highlighted:n}=e,o=t.split(`
86
- `).length,s=String(o).length;return d`<div class="focus-code-lines" style="${de({"--lineno-width":`${s}ch`})}"><aside class="focus-code-gutter" aria-hidden="true">${Array.from({length:o},(i,l)=>{let c=l+1;return d`<div class="${F({"focus-code-lineno":!0,"focus-code-line-active":c===r})}" data-focus-code-line="${c}">${c}</div>`})}</aside><pre class="focus-code-source"><code>${typeof n=="string"?ye(n):t}</code></pre></div>`}function n_(e){if(!e)return g;let t=ge(e),r={"kanban-detail-modal":!0,"has-conflict":t.hasConflict};return!t.hasConflict&&t.commonColor&&(r[`mark-${t.commonColor}`]=!0),d`<div class="kanban-detail-backdrop"><div class="kanban-detail-dim"></div><div class="${F(r)}" role="dialog" aria-modal="true"><button type="button" class="kanban-detail-close" title="Close details" aria-label="Close details">×</button><div class="kanban-detail-body">${Rs(e,!1,"kanban-detail")}</div></div></div>`}function o_(e){if(a.viewMode==="table"){let r=a.sortBy==="file"?gu(e,jb):e;if(r.length===0)return g;let n=a.tableSelectedGid?r.find(s=>Se(s)===a.tableSelectedGid):null;return Oa=r,d`<div class="${n?"findings-table-layout open":"findings-table-layout"}"><div class="findings-table-list"><div class="finding-table-slot"></div></div>${n?d`<aside class="findings-table-details" id="findings-table-details"><header class="findings-table-details-bar"><span class="findings-table-details-label">Details</span> <button type="button" class="findings-table-details-close" data-table-deselect title="Close details" aria-label="Close details">×</button></header><div class="findings-table-details-body">${Rs(n)}</div></aside>`:g}</div>`}if(a.viewMode==="focus"){if(e.length===0)return g;let r=a.focusGid?e.findIndex(c=>Se(c)===a.focusGid):-1;r<0&&(r=Math.min(Wb,e.length-1),r<0&&(r=0)),Wb=r;let n=e[r];a.focusCodeTick;let o=Nb(n),s=o?"focus-main with-code":"focus-main",i=r===0,l=r===e.length-1;return d`<div class="focus-view"><div class="${s}"><div class="focus-pane focus-pane-card"><div class="focus-card-wrapper">${Rs(n,!1,"focus")}</div></div>${o?d`<div class="focus-pane focus-pane-code">${o.loading?d`<div class="focus-code-empty">Loading source…</div>`:d`<header class="focus-code-bar" title="${o.file}"><span class="focus-code-file">${o.file}</span> ${o.line?d`<span class="focus-code-line">:${o.line}</span>`:g}</header><div class="focus-code-body">${r_(o)}</div>`}</div>`:g}</div><aside class="focus-sidebar" aria-label="Up next"><div class="focus-sidebar-header"><span class="label">Up next</span><div class="focus-nav"><button type="button" class="focus-nav-btn" data-focus-nav="prev" ?disabled="${i}" title="Previous finding (←)" aria-label="Previous finding"><svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 3 5 8l5 5"/></svg></button> <span class="count">${r+1} / ${e.length}</span> <button type="button" class="focus-nav-btn" data-focus-nav="next" ?disabled="${l}" title="Next finding (→)" aria-label="Next finding"><svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 3 11 8l-5 5"/></svg></button></div></div><div class="focus-sidebar-body">${J(e,c=>Se(c),c=>Kb(c,{variant:"focus",active:Se(c)===Se(n)}))}</div></aside></div>`}if(a.viewMode==="kanban"){let r=[{key:"untriaged",label:"Untriaged",target:"untriaged"},{key:"inprogress",label:"In progress",target:"inprogress"},{key:"fixed",label:"Fixed",target:"fixed"},{key:"invalid",label:"Invalid",target:"invalid"},{key:"deleted",label:"Deleted",target:"deleted"},{key:"ignored",label:"Ignored",target:"ignored"}],n=new Map(r.map(c=>[c.key,[]]));for(let c of e){let p=ge(c).commonTriage??"untriaged",f=n.get(p);f&&f.push(c)}let o=r.some(c=>c.key===a.kanbanExpandedColumn)?a.kanbanExpandedColumn:null,s=o?r.filter(c=>c.key===o):r,i={"--kanban-cols":String(r.length)},l=a.kanbanPopoverGid?e.find(c=>Se(c)===a.kanbanPopoverGid):null;return d`<div class="kanban-board" style="${de(i)}">${J(s,c=>c.key,c=>{let u=n.get(c.key),p=c.key===o;return d`<div class="${`kanban-column kanban-column-${c.key}${p?" expanded":""}`}" data-kanban-target="${c.target}"><div class="kanban-column-header"><span class="label">${c.label}</span> <span class="count">${u.length}</span> <button type="button" class="kanban-expand" data-kanban-expand="${c.key}" aria-pressed="${p}" title="${p?"Show all columns":`Show only ${c.label}`}" aria-label="${p?"Show all columns":`Show only ${c.label}`}">${p?e_:Z1}</button></div><div class="kanban-column-body">${u.length===0?d`<div class="kanban-empty">No ${c.label.toLowerCase()} findings.</div>`:J(u,f=>Se(f),f=>Kb(f,{active:Se(f)===a.kanbanPopoverGid}))}</div></div>`})}</div>${n_(l)}`}if(a.viewMode==="grouped"){let r=new Map;for(let o of e){let s=cn(o).file;r.has(s)||r.set(s,[]),r.get(s).push(o)}let n=a.sortBy==="file"?[...r.keys()].toSorted():[...r.keys()];return d`${J(n,o=>o,o=>{let s=a.sortBy==="file"?gu(r.get(o),(l,c)=>parseInt(l.line,10)-parseInt(c.line,10)):r.get(o),i=cn(s[0]);return d`<div class="file-group"><div class="file-header"><span>${Id(i,i?._repoFallback??a.repoUrl)}</span> <span class="count">${s.length}</span></div><div class="file-body">${J(s,l=>Kn(l),l=>Rs(l))}</div></div>`})}`}let t=a.sortBy==="file"?gu(e,jb):e;return d`${J(t,r=>Kn(r),r=>{let n=ze(r),o=Zg(n,n._repoFallback??a.repoUrl),s=sn(n),i=on(n),l=r.length>1;return d`<div class="${F({"flat-group":!0,"multi-case":l})}"><div class="flat-group-loc"><span class="file">${Id(n,n._repoFallback??a.repoUrl)}</span> ${o===g?g:d`<span class="line-num">${o}</span>`} ${i?d`<span class="meta">${i}</span>`:g} ${s?d`<span class="run-meta">${s}</span>`:g}</div>${Rs(r,!0)}</div>`})}`}function s_(){let e=document.querySelector("#bundle-source-overlay-slot");e&&G(Tb(),e)}var qb=null;function x(){let e=qb;if(qb=a.currentView,e!==null&&e!==a.currentView&&typeof document.startViewTransition=="function"&&!matchMedia("(prefers-reduced-motion: reduce)").matches){document.startViewTransition(()=>Gb());return}Gb()}function Gb(){if(s_(),Kg(a.reports),a.currentView==="bundles")if((a.bundles??[]).length===0)a.currentView="findings";else{let $=document.querySelector("#bundles-slot");if((!$||!E.contains($)||E.firstElementChild!==$)&&(E.innerHTML='<div id="bundles-slot"></div>',$=document.querySelector("#bundles-slot")),$&&G(Mb(a.bundles),$),a.selectedBundle&&a.bundleDetailsTab==="graph"&&a.bundleDetails&&(a.bundleDetails.json||a.bundleDetails.bundle)){let P=document.querySelector("#bundle-graph-slot");if(P){let ce=Eb(a.bundleDetails);if(ce){Ab(ce);let js={hideAllFiles:!0,triageCounts:Cb(a.bundleDetails),triageStates:["inprogress","fixed","invalid","deleted"],showSplitOwnDirs:ce.canSplitOwnDirs,showPackagesView:ce.canPackagesView};Ud(P,ce,js,Ba,La)}}}if(a.selectedBundle&&a.bundleDetailsTab==="terminal"&&a.bundleDetails&&(a.bundleDetails.json||a.bundleDetails.bundle)){let P=document.querySelector("#bundle-terminal-slot");P&&_m(P,a.bundleDetails)}E.classList.add("active"),fe.classList.add("hidden"),document.title="DeepView \u2014 bundles";return}if(a.currentView==="packages"){let $=document.querySelector("#packages-slot");(!$||!E.contains($)||E.firstElementChild!==$)&&(E.innerHTML='<div id="packages-slot"></div>',$=document.querySelector("#packages-slot")),$&&G(Fb(),$),E.classList.add("active"),fe.classList.add("hidden"),document.title="DeepView \u2014 packages";return}if(a.currentView==="repositories"){let $=document.querySelector("#repositories-slot");(!$||!E.contains($)||E.firstElementChild!==$)&&(E.innerHTML='<div id="repositories-slot"></div>',$=document.querySelector("#repositories-slot")),$&&G(Ob(),$),E.classList.add("active"),fe.classList.add("hidden"),document.title="DeepView \u2014 repositories";return}if(a.currentView==="admin-users"){let $=document.querySelector("#admin-users-slot");(!$||!E.contains($)||E.firstElementChild!==$)&&(E.innerHTML='<div id="admin-users-slot"></div>',$=document.querySelector("#admin-users-slot")),$&&!$.firstElementChild&&$.append(document.createElement("managed-admin-users")),E.classList.add("active"),fe.classList.add("hidden"),document.title="DeepView \u2014 users";return}if(a.currentView==="manage-repos"){let $=document.querySelector("#manage-repos-slot");(!$||!E.contains($)||E.firstElementChild!==$)&&(E.innerHTML='<div id="manage-repos-slot"></div>',$=document.querySelector("#manage-repos-slot")),$&&!$.firstElementChild&&$.append(document.createElement("managed-admin-repos")),E.classList.add("active"),fe.classList.add("hidden"),document.title="DeepView \u2014 repositories";return}if(a.currentView==="manage-reports"){let $=document.querySelector("#manage-reports-slot");(!$||!E.contains($)||E.firstElementChild!==$)&&(E.innerHTML='<div id="manage-reports-slot"></div>',$=document.querySelector("#manage-reports-slot")),$&&!$.firstElementChild&&$.append(document.createElement("managed-admin-reports")),E.classList.add("active"),fe.classList.add("hidden"),document.title="DeepView \u2014 reports";return}if(a.currentView==="manage-bundles"){let $=document.querySelector("#manage-bundles-slot");(!$||!E.contains($)||E.firstElementChild!==$)&&(E.innerHTML='<div id="manage-bundles-slot"></div>',$=document.querySelector("#manage-bundles-slot")),$&&!$.firstElementChild&&$.append(document.createElement("managed-admin-bundles")),E.classList.add("active"),fe.classList.add("hidden"),document.title="DeepView \u2014 bundles";return}if(a.currentView==="manage-teams"){let $=document.querySelector("#manage-teams-slot");(!$||!E.contains($)||E.firstElementChild!==$)&&(E.innerHTML='<div id="manage-teams-slot"></div>',$=document.querySelector("#manage-teams-slot")),$&&!$.firstElementChild&&$.append(document.createElement("managed-admin-teams")),E.classList.add("active"),fe.classList.add("hidden"),document.title="DeepView \u2014 teams";return}if(a.reports.length===0)return;let e=kt(),t=a.viewMode==="kanban",r={inprogress:0,fixed:0,invalid:0,deleted:0,ignored:0},n=[];for(let $ of e){let P=ge($).commonTriage;P&&r[P]++,(t||P===a.shownTriage)&&n.push($)}let o=!1,s=!1,i=!1,l=!1;for(let $ of e)for(let P of $){Qt(P)&&(l=!0);let ce=a.triage.get(D(P));ce&&(ce.comment&&(o=!0),ce.fix&&(s=!0),ce.flagged===!0&&(i=!0))}let u=[...new Set(a.reports.map($=>$.type))].join(", "),p=a.reports.map($=>$.fileName),f={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0},h={red:0,blue:0,green:0,gray:0,none:0};for(let $ of n){if($.length===1){let Pe=$[0],js=re(Pe,a.severityMode);f[js]=(f[js]||0)+1;let zp=a.triage.get(D(Pe))?.color??"none";h[zp]=(h[zp]||0)+1;continue}let P=new Set($.map(Pe=>re(Pe,a.severityMode)));for(let Pe of P)f[Pe]=(f[Pe]||0)+1;let ce=new Set($.map(Pe=>a.triage.get(D(Pe))?.color??"none"));for(let Pe of ce)h[Pe]=(h[Pe]||0)+1}let b=n.length>0&&n.every($=>$.every(P=>P.confidence!==void 0||P.critical===!0)),m=e.some($=>$.some(P=>P.priority!==void 0)),v=e.some($=>$.some(P=>_r(P.file))),w=!1,y=!1,k;e:for(let $ of e)for(let P of $)if(!y)y=!0,k=P.file;else if(P.file!==k){w=!0;break e}let C=e.some($=>$.some(P=>!P.repo?.github&&!_r(P.file))),T=new Set;for(let $ of e)for(let P of $)!_r(P.file)&&P.repo?.github&&T.add(P.repo.github);let S=T.size===1?[...T][0]:null,M=new Set,I=new Set;for(let $ of e)for(let P of $)M.add(P._analyzer??null),I.add(gs(P));let L=Object.keys(Od),j=[...M].toSorted(($,P)=>{let ce=$==null?1/0:L.indexOf($)===-1?L.length:L.indexOf($),Pe=P==null?1/0:L.indexOf(P)===-1?L.length:L.indexOf(P);return ce!==Pe?ce-Pe:String($??"").localeCompare(String(P??""))}),Ce=[...I].toSorted(($,P)=>$==null&&P==null?0:$==null?1:P==null?-1:$.localeCompare(P));if(a.filterAnalyzer){let $=a.filterAnalyzer===Sr?null:a.filterAnalyzer;(!M.has($)||M.size<2)&&(a.filterAnalyzer="")}if(a.filterModel){let $=a.filterModel===Cr?null:a.filterModel;(!I.has($)||I.size<2)&&(a.filterModel="")}let ae=new Set;for(let $ of e)for(let P of $)ae.add(Fd(P));let Qe=[...ae].toSorted(($,P)=>$==null&&P==null?0:$==null?1:P==null?-1:$.localeCompare(P));if(a.filterRepo){let $=a.filterRepo===ln?null:a.filterRepo;ae.has($)||(a.filterRepo="")}!v&&a.filterSources.size>0&&a.filterSources.clear(),b||(a.filterConfMin=0,a.filterConfMax=10,(a.sortBy==="confidence-desc"||a.sortBy==="confidence-asc")&&(a.sortBy="severity")),!m&&(a.sortBy==="priority-desc"||a.sortBy==="priority-asc")&&(a.sortBy="severity"),!w&&a.sortBy==="file"&&(a.sortBy="severity");let Nr=am(Er(n)),rr=Dd(a.reports),nl=rr?Object.keys(rr).length:0,Dr=nl>1;!Dr&&a.currentView==="files"&&(a.currentView="findings"),!Dr&&a.viewMode==="graph"&&(a.viewMode="table");let bn=K1(e,p,C,S,nl);if(a.currentView==="files"){let $=Nd(e,a.severityMode),P=document.querySelector("#header-slot"),ce=document.querySelector("#tree-view-slot");(!P||!ce||!E.contains(P)||!E.contains(ce))&&(E.innerHTML='<div id="header-slot"></div><div id="tree-view-slot"></div>',P=document.querySelector("#header-slot"),ce=document.querySelector("#tree-view-slot")),P&&G(bn,P),ce&&G(km(rr,$),ce),E.classList.add("active"),fe.classList.add("hidden"),document.title=`DeepView \u2014 ${u||"no analyzer"}`;return}let yn=a.viewMode==="table"&&a.tableSelectedGid&&Nr.some($=>Se($)===a.tableSelectedGid),xt=null;a.viewMode==="graph"&&rr&&(xt=bu(),xt||(a.viewMode="table"));let nr=!!xt,or="findings-content";yn&&(or+=" with-details"),nr&&(or+=" with-graph"),t&&(or+=" with-kanban"),a.viewMode==="focus"&&(or+=" with-focus");let lo=g,sr=g,co=g;Oa=null,Pa.clear(),nr||(lo=Q1(Nr.length,n.length,r,f,h,{showSource:v,showConfidence:b,showPriority:m,showGraphMode:Dr,showFileSort:w,kanbanMode:t,showRepo:!!a.currentWorkspace,hasComment:o,hasFix:s,hasFlagged:i,showSeverityMode:l||a.severityMode==="original"},{analyzers:j,models:Ce,groups:n},Qe),a.shownTriage&&n.length===0?sr=d`<p style="color:var(--muted);margin:1rem 0">No ${a.shownTriage} findings.</p>`:Nr.length===0&&n.length>0?sr=d`<p style="color:var(--muted);margin:1rem 0">No findings match the current filters.</p>`:n.length===0&&(sr=e.length>0?d`<p style="color:var(--green)">All ${u} issues triaged.</p>`:d`<p style="color:var(--green)">No ${u} issues found.</p>`),co=o_(Nr));let _=document.querySelector("#header-slot"),O=E.querySelector(":scope > .findings-content"),q=O&&O.querySelector(":scope > #findings-graph-slot"),X=O&&O.querySelector(":scope > #findings-body-slot"),it=O&&(q?"graph":X?"body":null)===(nr?"graph":"body");if(!_||!O||!E.contains(_)||!E.contains(O)||!it){let $=nr?'<div id="findings-graph-slot"></div>':'<div id="toolbar-slot"></div><div id="empty-state-slot"></div><div id="findings-body-slot"></div>';E.innerHTML=`<div id="header-slot"></div><div class="${or}">${$}</div>`,_=document.querySelector("#header-slot"),O=E.querySelector(":scope > .findings-content")}else O.className!==or&&(O.className=or);_&&G(bn,_);let Oe=document.querySelector("#toolbar-slot");Oe&&G(lo,Oe);let ir=document.querySelector("#empty-state-slot");ir&&G(sr,ir);let Dp=document.querySelector("#findings-body-slot");if(Dp&&G(co,Dp),xt){let $=document.querySelector("#findings-graph-slot");if($){let ce={extraTopRow:d`<view-mode-buttons modes="table,list,grouped,focus,kanban,graph"></view-mode-buttons>`,triageCounts:r,triageStates:["inprogress","fixed","invalid","deleted","ignored"]};Ud($,xt.prep,ce,yu,vu)}}if(Oa){let $=E.querySelector(".finding-table-slot");$&&(no||(no=document.createElement("finding-table")),no.items=Oa,no.selectedGid=a.tableSelectedGid,no.parentNode!==$&&$.append(no))}if(Pa.size>0)for(let $ of E.querySelectorAll("finding-card")){let P=Pa.get($.dataset.gid);P&&($.group=P.group)}E.classList.add("active"),fe.classList.add("hidden"),document.title=`DeepView \u2014 ${u||"no analyzer"}`}var wu=class extends R{static styles=[...R.styles,B(ut)];static properties={workspace:{attribute:!1},_password:{state:!0},_confirm:{state:!0},_noPassword:{state:!0},_includeBundleBytes:{state:!0},_busy:{state:!0},_error:{state:!0},_settled:{state:!0}};constructor(){super(),this.workspace=null,this._password="",this._confirm="",this._noPassword=!1,this._includeBundleBytes=!1,this._busy=!1,this._error="",this._settled=!1}_finish(t){this._settled||(this._password="",this._confirm="",this.workspace=null,super._finish(t))}_onClose=()=>this._finish(null);_onCancel=()=>this._finish(null);_onPasswordInput=t=>{this._password=t.target.value,this._error=""};_onConfirmInput=t=>{this._confirm=t.target.value,this._error=""};_onNoPasswordToggle=t=>{this._noPassword=t.target.checked,this._error="",this._noPassword&&(this._password="",this._confirm="")};_onIncludeBundleBytesToggle=t=>{this._includeBundleBytes=t.target.checked,this._error=""};_canExport(){return this._busy?!1:this._noPassword?!0:(this._password??"").length>0&&this._password===this._confirm}_onExport=async()=>{if(this._canExport()){if(!this.workspace){this._error="No workspace selected.";return}this._busy=!0,this._error="";try{let{blob:t,filename:r}=await ld(this.workspace,{password:this._noPassword?void 0:this._password,includeBundleBytes:this._includeBundleBytes});if(this._settled)return;Ht(t,r),this._finish({ok:!0})}catch(t){if(this._settled)return;this._error=t?.message??String(t)}finally{this._busy=!1}}};_onKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._onExport())};_body(){let t=!this._password||!this._confirm||this._password===this._confirm,r=Array.isArray(this.workspace?.bundles)?this.workspace.bundles.length:0;return d`<p class="nwd-note">The export file carries this workspace's reports, triage state, comments, fixes, references to attached bundles (integrities only by default), and its private key. Encrypting the file with a password ensures only those with the password can attach the workspace after download.</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-export-pw" maxlength="1024" ?disabled="${this._noPassword}" .value="${this._password}" @input="${this._onPasswordInput}" @keydown="${this._onKeydown}"></label> <label class="wsl-field"><span>Confirm 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-export-pw-confirm" maxlength="1024" ?disabled="${this._noPassword}" .value="${this._confirm}" @input="${this._onConfirmInput}" @keydown="${this._onKeydown}"></label> <label class="wsl-optout"><input type="checkbox" .checked="${this._noPassword}" @change="${this._onNoPasswordToggle}"> <span>Export without password (not recommended)</span></label> ${r>0?d`<label class="wsl-optout"><input type="checkbox" .checked="${this._includeBundleBytes}" @change="${this._onIncludeBundleBytesToggle}"> <span>Include bundle bytes (${r} bundle${r===1?"":"s"}; significantly larger file)</span></label>`:g} ${this._noPassword?d`<p class="wsl-error wsl-warning">Anyone who obtains this file can attach the workspace and read every report, triage decision, comment, and fix. Only opt out when you control where the file goes.</p>`:g} ${this._error?d`<p class="wsl-error" role="alert">${this._error}</p>`:g} ${!this._noPassword&&!t?d`<p class="wsl-error" role="alert">Passwords don't match.</p>`:g}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!this._canExport()}" @click="${this._onExport}">${this._busy?"Exporting\u2026":this._noPassword?"Export without password":"Export"}</button></footer>`}render(){return d`<dialog @close="${this._onClose}"><header><h3>Export workspace</h3></header>${this._body()}</dialog>`}};customElements.define("workspace-export-dialog",wu);function Xb({workspace:e}={}){return new Promise((t,r)=>{let n=document.createElement("workspace-export-dialog");n.workspace=e??null,n.addEventListener("resolve",o=>{n.remove(),t(o.detail)}),n.addEventListener("modal-conflict",o=>{n.workspace=null,n.remove(),r(St(o.detail?.cause))}),document.body.append(n)})}async function Qb(e){await Xb({workspace:e})}var ku=class extends R{static properties={_value:{state:!0}};constructor(){super(),this._value=""}_onInput=t=>{this._value=t.target.value};_onCreate=()=>{let t=(this._value??"").trim();t&&this._finish(t)};_onCancel=()=>this._finish(null);_onKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._onCreate())};render(){let t=(this._value??"").trim().length>0;return d`<dialog @close="${this._onClose}"><header><h3>New workspace</h3></header><input type="text" class="nwd-input" placeholder="Workspace name" maxlength="200" .value="${this._value}" @input="${this._onInput}" @keydown="${this._onKeydown}"><p class="nwd-note">Workspace triage is synchronized by default over an end-to-end encrypted channel. Triage on unattached reports stays local to this browser.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!t}" @click="${this._onCreate}">Create</button></footer></dialog>`}};customElements.define("new-workspace-dialog",ku);function Zb(){return ee("new-workspace-dialog")}var $u=class extends R{static styles=[...R.styles,B(ke)];static properties={workspaceName:{type:String},reportCount:{type:Number},bundleCount:{type:Number},orphanedTriage:{type:Number},sharedTriage:{type:Number},_mode:{state:!0},_triage:{state:!0},_settled:{state:!0}};constructor(){super(),this.workspaceName="",this.reportCount=0,this.bundleCount=0,this.orphanedTriage=0,this.sharedTriage=0,this._mode="detach",this._triage="keep",this._settled=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(t){if(this._settled)return;let r=this.reportCount>0?this._mode:"detach",n=r==="delete"&&this.orphanedTriage>0?this._triage:"keep";super._finish({confirmed:!!t,mode:r,triage:n})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);_onModeChange=t=>{this._mode=t.target.value};_onTriageChange=t=>{this._triage=t.target.value};_triageSection(){if(this._mode!=="delete"||this.reportCount===0)return"";let t=this.orphanedTriage,r=this.sharedTriage;return t===0&&r===0?d`<p class="lwd-note">No local triage is attached to ${this.reportCount===1?"this report":"these reports"}.</p>`:t===0?d`<p class="lwd-note">Local triage on ${this.reportCount===1?"this report":"these reports"} is also attached to ${r===1?"a report":"reports"} you're keeping. Nothing will be orphaned.</p>`:d`<fieldset class="lwd-choice"><legend><strong>${t}</strong> ${t===1?"triage entry won't":"triage entries won't"} be reachable from any remaining report. What should happen ${t===1?"to it":"to them"}?</legend><label class="lwd-option"><input type="radio" name="lwd-triage" value="keep" ?checked="${this._triage==="keep"}" @change="${this._onTriageChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Keep</span> <span class="lwd-option-hint">Reapplied automatically if a matching report is imported later.</span></span></label> <label class="lwd-option"><input type="radio" name="lwd-triage" value="wipe" ?checked="${this._triage==="wipe"}" @change="${this._onTriageChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Wipe</span> <span class="lwd-option-hint">Drop the orphaned triage from this browser.</span></span></label></fieldset>`}render(){let t=this.reportCount,r=this.bundleCount,n=t>0,o=t===1?"report":"reports",s=t===1?"it":"them",i=t===1?"stays":"stay",l=t===1?"is removed":"are removed",c=r>0?d`<p class="lwd-note">${r===1?"One bundle is":`${r} bundles are`} also attached. ${r===1?"It":"They"} will become unfiled — the bundle bytes stay on this device either way (delete bundles manually from the Bundles list if you want them gone).</p>`:"",u=n?d`<fieldset class="lwd-choice"><legend>What should happen to the <strong>${t}</strong> attached ${o}?</legend><label class="lwd-option"><input type="radio" name="lwd-mode" value="detach" ?checked="${this._mode==="detach"}" @change="${this._onModeChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Move ${s} out of the workspace</span> <span class="lwd-option-hint">The ${o} ${i} in this browser as unattached ${o}.</span></span></label> <label class="lwd-option"><input type="radio" name="lwd-mode" value="delete" ?checked="${this._mode==="delete"}" @change="${this._onModeChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Delete ${s} along with the workspace</span> <span class="lwd-option-hint">The ${o} ${l} from this browser.</span></span></label></fieldset>`:r>0?d`<p class="lwd-empty">No reports are attached to this workspace (only bundles, see below).</p>`:d`<p class="lwd-empty">No reports are attached to this workspace.</p>`;return d`<dialog @close="${this._onClose}"><header><h3>Leave workspace</h3></header><p class="lwd-body">Leave workspace <strong>"${this.workspaceName}"</strong> on this device?</p>${u} ${c} ${this._triageSection()}<ul class="lwd-list"><li>Workspace synchronization data stays on the sync server — peers (and your other devices) keep their copy.</li></ul><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="danger" @click="${this._onConfirm}">Leave</button></footer></dialog>`}};customElements.define("leave-workspace-dialog",$u);function ey({name:e,reportCount:t,bundleCount:r,triageImpact:n}={}){return ee("leave-workspace-dialog",{workspaceName:e??"",reportCount:t??0,bundleCount:r??0,orphanedTriage:n?.orphanedCount??0,sharedTriage:n?.sharedCount??0})}var xu=class extends R{static styles=[...R.styles,B(ut)];static properties={workspaceId:{type:String},initialName:{type:String},privateKeyBase64:{type:String},_name:{state:!0},_password:{state:!0},_confirm:{state:!0},_url:{state:!0},_busy:{state:!0},_error:{state:!0},_copied:{state:!0},_settled:{state:!0}};constructor(){super(),this.workspaceId="",this.initialName="",this.privateKeyBase64="",this._name="",this._password="",this._confirm="",this._url="",this._busy=!1,this._error="",this._copied=!1,this._settled=!1}beforeOpen(){this._name=this.initialName}focusInitial(){this.renderRoot.querySelector('input[data-role="name"]')?.focus()}_finish(){this._settled||(this._copiedTimer&&(clearTimeout(this._copiedTimer),this._copiedTimer=null),this._password="",this._confirm="",this._url="",this.privateKeyBase64="",super._finish(null))}_onClose=()=>this._finish();_onCancel=()=>this._finish();_onNameInput=t=>{this._name=t.target.value};_onPasswordInput=t=>{this._password=t.target.value,this._error=""};_onConfirmInput=t=>{this._confirm=t.target.value,this._error=""};_canGenerate(){return(this._name??"").trim().length>0&&(this._password??"").length>0&&this._password===this._confirm&&!this._busy}_onGenerate=async()=>{if(this._canGenerate()){this._busy=!0,this._error="";try{let t=await ud({id:this.workspaceId,name:this._name.trim(),privateKeyBase64:this.privateKeyBase64,password:this._password});if(this._settled)return;this._url=fd(t),this._password="",this._confirm=""}catch(t){if(this._settled)return;this._error=t?.message??String(t)}finally{this._busy=!1}}};_onCopy=async()=>{if(this._url){this._error="";try{if(await navigator.clipboard.writeText(this._url),this._settled)return;this._copied=!0,this._copiedTimer&&clearTimeout(this._copiedTimer),this._copiedTimer=setTimeout(()=>{this._copied=!1,this._copiedTimer=null},1500)}catch{if(this._settled)return;this._error="Copy failed \u2014 select the link and copy it manually."}}};_onKeydown=t=>{t.key==="Enter"&&!this._url&&(t.preventDefault(),this._onGenerate())};_body(){return this._url?d`<p class="nwd-note">Anyone with the link <strong>and</strong> the password can attach this workspace. Share them through separate channels.</p><label class="wsl-field"><span>Share link</span> <textarea class="wsl-link" readonly="readonly" rows="3" @focus="${t=>t.target.select()}">${this._url}</textarea></label> ${this._error?d`<p class="wsl-error" role="alert">${this._error}</p>`:g}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Close</button> <button type="button" class="primary" @click="${this._onCopy}">${this._copied?"Copied":"Copy link"}</button></footer>`:d`<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> <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-pw" maxlength="1024" .value="${this._password}" @input="${this._onPasswordInput}" @keydown="${this._onKeydown}"></label> <label class="wsl-field"><span>Confirm 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-pw-confirm" maxlength="1024" .value="${this._confirm}" @input="${this._onConfirmInput}" @keydown="${this._onKeydown}"></label><p class="nwd-note">The link carries the workspace's identity (id, name, and private key) so the recipient joins the same sync chain. Triage, reports, and comments aren't in the link itself — they sync over once the recipient joins. The link decrypts with the password above; without it the link is useless.</p>${this._error?d`<p class="wsl-error" role="alert">${this._error}</p>`:g} ${this._password&&this._confirm&&this._password!==this._confirm?d`<p class="wsl-error" role="alert">Passwords don't match.</p>`:g}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!this._canGenerate()}" @click="${this._onGenerate}">${this._busy?"Generating\u2026":"Generate link"}</button></footer>`}render(){return d`<dialog @close="${this._onClose}"><header><h3>${this._url?"Workspace share link":"Share workspace by link"}</h3></header>${this._body()}</dialog>`}};customElements.define("workspace-share-link-dialog",xu);function ty({id:e,name:t,privateKeyBase64:r}={}){return new Promise((n,o)=>{let s=document.createElement("workspace-share-link-dialog");s.workspaceId=e??"",s.initialName=t??"",s.privateKeyBase64=r??"",s.addEventListener("resolve",()=>{s.remove(),n()}),s.addEventListener("modal-conflict",i=>{s.privateKeyBase64="",s.remove(),o(St(i.detail?.cause))}),document.body.append(s)})}var _u=class extends R{static styles=[...R.styles,B(ke)];static properties={reportName:{type:String},orphanedTriage:{type:Number},sharedTriage:{type:Number},inRemote:{type:Boolean},_triage:{state:!0}};constructor(){super(),this.reportName="",this.orphanedTriage=0,this.sharedTriage=0,this.inRemote=!1,this._triage="keep"}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(t){if(this._settled)return;let r=this.orphanedTriage>0?this._triage:"keep";super._finish({confirmed:!!t,triage:r})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);_onTriageChange=t=>{this._triage=t.target.value};_remoteNotice(){return this.inRemote?d`<p class="lwd-note">This report is also stored in the workspace's <strong>remote</strong> inventory and will be removed from there too. Newly synced workspace members won't see it; members who already downloaded it keep their local copy (and could re-upload).</p>`:g}_triageSection(){let t=this.orphanedTriage,r=this.sharedTriage;return t===0&&r===0?d`<p class="lwd-note">No local triage is attached to this report.</p>`:t===0?d`<p class="lwd-note">Local triage on this report is also attached to ${r===1?"a report":"reports"} you're keeping. Nothing will be orphaned.</p>`:d`<fieldset class="lwd-choice"><legend><strong>${t}</strong> ${t===1?"triage entry won't":"triage entries won't"} be reachable from any remaining report. What should happen ${t===1?"to it":"to them"}?</legend><label class="lwd-option"><input type="radio" name="drd-triage" value="keep" ?checked="${this._triage==="keep"}" @change="${this._onTriageChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Keep</span> <span class="lwd-option-hint">Reapplied automatically if a matching report is imported later.</span></span></label> <label class="lwd-option"><input type="radio" name="drd-triage" value="wipe" ?checked="${this._triage==="wipe"}" @change="${this._onTriageChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Wipe</span> <span class="lwd-option-hint">Drop the orphaned triage from this browser.</span></span></label></fieldset>`}render(){return d`<dialog @close="${this._onClose}"><header><h3>Delete report</h3></header><p class="lwd-body">Delete <strong>"${this.reportName}"</strong>?</p>${this._remoteNotice()} ${this._triageSection()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="danger" @click="${this._onConfirm}">Delete</button></footer></dialog>`}};customElements.define("delete-report-dialog",_u);function ry({name:e,triageImpact:t,inRemote:r}={}){return ee("delete-report-dialog",{reportName:e??"",orphanedTriage:t?.orphanedCount??0,sharedTriage:t?.sharedCount??0,inRemote:!!r})}var Su=class extends R{static styles=[...R.styles,B(ke)];static properties={bundleName:{type:String},inRemote:{type:Boolean}};constructor(){super(),this.bundleName="",this.inRemote=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(t){this._settled||super._finish({confirmed:!!t})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);_remoteNotice(){return this.inRemote?d`<p class="lwd-note">This bundle is also stored in the workspace's <strong>remote</strong> inventory and will be removed from there too. Newly synced workspace members won't see it; members who already downloaded it keep their local copy (and could re-upload).</p>`:g}render(){return d`<dialog @close="${this._onClose}"><header><h3>Delete bundle</h3></header><p class="lwd-body">Delete <strong>"${this.bundleName}"</strong>?</p>${this._remoteNotice()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="danger" @click="${this._onConfirm}">Delete</button></footer></dialog>`}};customElements.define("delete-bundle-dialog",Su);function ny({name:e,inRemote:t}={}){return ee("delete-bundle-dialog",{bundleName:e??"",inRemote:!!t})}var Cu=class extends R{static styles=[...R.styles,B(ke)];static properties={bundleName:{type:String},workspaceName:{type:String}};constructor(){super(),this.bundleName="",this.workspaceName=""}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(t){this._settled||super._finish({confirmed:!!t})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);render(){return d`<dialog @close="${this._onClose}"><header><h3>Detach bundle</h3></header><p class="lwd-body">Detach <strong>"${this.bundleName}"</strong> from workspace <strong>"${this.workspaceName}"</strong>?</p><p class="lwd-note">This bundle is also stored in the workspace's <strong>remote</strong> inventory and will be removed from there too. Newly synced workspace members won't see it; members who already downloaded it keep their local copy (and could re-upload). The bundle bytes stay on this device — drop it onto another workspace to attach it there.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="danger" @click="${this._onConfirm}">Detach</button></footer></dialog>`}};customElements.define("detach-bundle-dialog",Cu);function oy({name:e,workspaceName:t}={}){return ee("detach-bundle-dialog",{bundleName:e??"",workspaceName:t??""})}var Eu=class extends R{static styles=[...R.styles,B(ke)];static properties={reportName:{type:String},workspaceName:{type:String}};constructor(){super(),this.reportName="",this.workspaceName=""}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(t){this._settled||super._finish({confirmed:!!t})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);render(){return d`<dialog @close="${this._onClose}"><header><h3>Detach report</h3></header><p class="lwd-body">Detach <strong>"${this.reportName}"</strong> from workspace <strong>"${this.workspaceName}"</strong>?</p><p class="lwd-note">This report is also stored in the workspace's <strong>remote</strong> inventory and will be removed from there too. Newly synced workspace members won't see it; members who already downloaded it keep their local copy (and could re-upload). The report bytes stay on this device — drop it onto another workspace to attach it there.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="danger" @click="${this._onConfirm}">Detach</button></footer></dialog>`}};customElements.define("detach-report-dialog",Eu);function sy({name:e,workspaceName:t}={}){return ee("detach-report-dialog",{reportName:e??"",workspaceName:t??""})}var Au=class extends R{focusInitial(){this.renderRoot.querySelector("button.primary")?.focus()}_onConfirm=()=>this._finish(!0);render(){return d`<dialog @close="${this._onClose}"><header><h3>Changes might not be saved</h3></header><p class="nwd-intro">Triage works in this tab, but this browser <strong>can't save its sync state right now</strong> — so changes that haven't reached the server could be lost if you reload the page.</p><p class="nwd-intro">This usually means the browser's storage is full, or another tab is running a newer version of the app (to avoid overwriting that newer version's data, this tab has paused saving).</p><p class="nwd-note">Free up space if storage is full, and close or reload other tabs of this app to the same version. This notice clears on its own once saving works again.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" class="primary" @click="${this._onConfirm}">Got it</button></footer></dialog>`}};customElements.define("persistence-degraded-dialog",Au);function iy(){return new Promise(e=>{let t=document.createElement("persistence-degraded-dialog"),r=n=>{t.remove(),e({shown:n})};t.addEventListener("resolve",()=>r(!0)),t.addEventListener("modal-conflict",()=>r(!1)),document.body.append(t)})}var Tu=class extends R{focusInitial(){this.renderRoot.querySelector("button.primary")?.focus()}_onReload=()=>this._finish("reload");render(){return d`<dialog @close="${this._onClose}"><header><h3>Sign in to keep syncing</h3></header><p class="nwd-intro">Triage can't reach the sync server — the connection is being redirected to an <strong>authentication proxy</strong> (for example Cloudflare Access). This usually means your access session has expired.</p><p class="nwd-note">Reload the page to sign in again. Your triage is saved on this device, so reloading won't lose anything — or keep working offline and reload later.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onClose}">Not now</button> <button type="button" class="primary" @click="${this._onReload}">Reload page</button></footer></dialog>`}};customElements.define("proxy-auth-dialog",Tu);function ay(){return new Promise(e=>{let t=document.createElement("proxy-auth-dialog"),r=(n,o)=>{t.remove(),e({shown:n,reload:o})};t.addEventListener("resolve",n=>r(!0,n.detail==="reload")),t.addEventListener("modal-conflict",()=>r(!1,!1)),document.body.append(t)})}var Br;function i_(){return Br||(Br=document.createElement("div"),Br.id="styled-tooltip",document.body.append(Br),Br)}var fn=null,Ms=null,uy=0,py=0,ly=!1;function a_(){ly||(ly=!0,document.addEventListener("mousemove",e=>{uy=e.clientX,py=e.clientY},{passive:!0}))}a_();var l_=100,c_=14,d_=8,cy=8;function u_(e,{placement:t="cursor"}={}){let r=i_();if(fn===e)return;let n=e.dataset.tooltip??"";if(n){if(r.textContent=n,t==="right"){let o=e.getBoundingClientRect();r.style.top=`${Math.round(o.top+o.height/2)}px`,r.style.left=`${Math.round(o.right+d_)}px`,r.style.transform="translateY(-50%)"}else{r.style.transform="none",r.style.top=`${py+c_}px`,r.style.left="0px",r.classList.add("visible");let o=r.offsetWidth,s=window.innerWidth-o-cy,i=Math.max(cy,Math.min(uy,s));r.style.left=`${Math.round(i)}px`}r.classList.add("visible"),fn=e}}function Fs(){clearTimeout(Ms),Ms=null,Br&&Br.classList.remove("visible"),fn=null}function Iu(e,{gate:t,placement:r}={}){t&&!t(e)||(clearTimeout(Ms),Ms=setTimeout(()=>{u_(e,{placement:r})},l_))}var dy=!1;function fy(){dy||(dy=!0,document.body.addEventListener("mouseover",e=>{let t=e.target.closest("[data-tooltip]");!t||t===fn||(Fs(),Iu(t))}),document.body.addEventListener("mouseout",e=>{!fn&&!Ms||fn&&fn.contains(e.relatedTarget)||Fs()}))}var gn=null,Y=null,Na=null;fy();function p_(){return Rt().size}function f_(){return Qr().size}var Bs=typeof location>"u"||location.hostname.endsWith(".github.io")?"":`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/api/sync`,Nu="application/x-deepview-report",Bu="application/x-deepview-source-ws",Ls="application/x-deepview-bundle",Da=!1,za=!1,h_={default:"Reports","claude-security":"Claude Security","codex-security":"Codex Security",deepsec:"DeepSec",piolium:"Piolium"},hy=["default","claude-security","codex-security","deepsec","piolium"],hn="";function gy(e,t={}){let n=`file-item${e===a.currentFile&&(a.currentView==="findings"||a.currentView==="files")?" current":""}${t.indented?" indented":""}`,o=De(e),s=jo(e),i=ne[nt(e)]??ne.default;return d`<li class="${n}" data-file="${e}" data-workspace-id="${t.workspaceId??g}" draggable="true"><button type="button" class="file-name" data-tooltip="${o}">${ye(i)}<span class="file-label">${o}</span>${s===void 0?g:d`<span class="file-count">${s}</span>`}</button></li>`}function yy(e,t={}){let r=`file-group-header${t.dropTarget?" default-reports":""}`;return d`<li class="${r}" data-default-reports="${t.dropTarget?"true":g}"><span class="group-label">${e}</span></li>`}var g_=d`<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M8 3.5v9M3.5 8h9"/></svg>`;function m_(){let e=a.serverMode==="managed"?g:d`<span class="workspace-header-actions"><button type="button" class="workspace-add" data-action="new-workspace" title="Create a new workspace" aria-label="Create a new workspace">${g_}</button></span>`;return d`<li class="file-group-header workspace-header"><span class="group-label">Workspaces</span>${e}</li>`}function b_(){if(a.serverMode!=="managed")return g;let e=Array.isArray(a.managedTeams)?a.managedTeams:[];return e.length===0?g:d`${yy("Teams")} ${J(e,t=>t.id,t=>d`<li class="file-item team-item"><span class="team-name">${S_}<span class="team-label">${t.name}</span></span></li>${J(Array.isArray(t.reports)?t.reports:[],r=>r.id,r=>y_(r))}`)}`}function y_(e){return d`<li class="file-item indented team-report-item"><button type="button" class="file-name" data-tooltip="${e.filename}" @click="${()=>{v_(e)}}">${ye(ne.default)}<span class="file-label">${e.filename}</span></button></li>`}async function v_(e){let t=await bg(e.id);if(t==null){console.warn("managed: could not load team report",e.id);return}await Xe(e.filename,t)}function w_(){return d`<li class="file-group-header bundles-header" data-default-bundles="true"><span class="group-label">Bundles</span></li>`}var k_=d`${ye(Gn)}`;function my(e,t={}){let{integrity:r,name:n}=e,o=a.selectedBundle===r&&a.currentView==="bundles",i=`file-item bundle-item${t.workspaceId!=null?" indented":""}${o?" current":""}`;return d`<li class="${i}" data-bundle-integrity="${r}" data-workspace-id="${t.workspaceId??g}" draggable="true"><button type="button" class="file-name" data-tooltip="${`${n}
87
- ${r}`}">${k_}<span class="file-label">${n}</span></button></li>`}function $_(e,t){let r=e.slice(0,15);return d`<li class="file-item indented bundle-item bundle-missing" data-bundle-integrity="${e}" data-workspace-id="${t}" data-tooltip="Bundle bytes not on this device — drop the matching bundle to attach."><span class="file-name"><span class="file-icon" aria-hidden="true">?</span><span class="file-label"><em>missing · ${r}…</em></span></span></li>`}function x_(e,t){return d`<li class="file-item indented report-missing" data-workspace-id="${t}" data-tooltip="Report not on this device — it re-downloads automatically if a workspace member has uploaded it."><span class="file-name"><span class="file-icon" aria-hidden="true">?</span><span class="file-label"><em>missing · ${De(e)}</em></span></span></li>`}var __=d`${ye(wa)}`,S_=d`<svg class="team-icon" viewBox="0 0 16 16" width="13" height="13" fill="currentColor" aria-hidden="true"><path d="M5.5 8a2.25 2.25 0 1 0 0-4.5 2.25 2.25 0 0 0 0 4.5Zm0 1C3.2 9 1.75 10.2 1.75 11.6V13h7.5v-1.4C9.25 10.2 7.8 9 5.5 9Zm5.25-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm.25 1c-.43 0-.83.05-1.2.15.86.62 1.45 1.5 1.45 2.45V13h3.25v-1.3C14.5 10.1 13.15 9 11 9Z"/></svg>`,C_=d`<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2v8M5 7l3 3 3-3M3 13h10"/></svg>`,E_=d`<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 3H4v10h5"/><path d="M7 8h7M11 5l3 3-3 3"/></svg>`,A_=d`<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 9.5L9 7.5"/><path d="M9.5 5.5L10.5 4.5a2.1 2.1 0 1 1 3 3l-1 1"/><path d="M6.5 11.5L5.5 12.5a2.1 2.1 0 1 1-3-3l1-1"/></svg>`;function T_(e){let r=`file-item workspace-item${a.currentWorkspace===e.id&&(a.currentView==="findings"||a.currentView==="files")?" current":""}`;return d`<li class="${r}" data-workspace-id="${e.id}"><button type="button" class="file-name">${__}<span class="file-label" .textContent="${e.name}"></span></button><button type="button" class="workspace-share" data-action="share-workspace" title="Share by link" aria-label="Share workspace by link">${A_}</button><button type="button" class="workspace-export" data-action="export-workspace" title="Export workspace" aria-label="Export workspace">${C_}</button><button type="button" class="workspace-leave" data-action="leave-workspace" title="Leave workspace" aria-label="Leave workspace">${E_}</button></li>`}function oo(e){return hn?De(e).toLowerCase().includes(hn):!0}var Ru=(e,t)=>De(e).localeCompare(De(t));async function V(){await ed(),Mt().catch(()=>{});let e=await ie(),t=W(),r=await vt();if(a.bundles=r,Ed(),!Y)return;gn.classList.remove("empty");let n=new Set(e),o=new Set;for(let h of t)for(let b of h.reports)n.has(b)&&o.add(b);let s=new Map(r.map(h=>[h.integrity,h])),i=new Set;for(let h of t)for(let b of h.bundles)s.has(b)&&i.add(b);let l=new Map;for(let h of hy)l.set(h,[]);for(let h of e){if(o.has(h)||!oo(h))continue;let b=nt(h);l.has(b)||l.set(b,[]),l.get(b).push(h)}let c=t.filter(h=>!hn||h.name.toLowerCase().includes(hn)||h.reports.some(b=>oo(b))?!0:h.bundles.some(b=>{let m=s.get(b);return m&&oo(m.name)})),u=r.filter(h=>!i.has(h.integrity)&&oo(h.name));G(d`${b_()} ${a.serverMode==="managed"&&t.length===0?g:m_()} ${J(c,h=>h.id,h=>{let b=[],m=[];for(let y of h.reports)oo(y)&&(n.has(y)?b.push(y):m.push(y));b.sort(Ru),m.sort(Ru);let v=[],w=[];for(let y of h.bundles){let k=s.get(y);k?(!hn||oo(k.name))&&v.push(k):hn||w.push(y)}return d`${T_(h)} ${b.map(y=>gy(y,{indented:!0,workspaceId:h.id}))} ${m.map(y=>x_(y,h.id))} ${v.map(y=>my(y,{workspaceId:h.id}))} ${w.map(y=>$_(y,h.id))}`})} ${hy.map(h=>{let b=(l.get(h)??[]).toSorted(Ru),m=h==="default";return b.length===0&&!(m&&Da)?null:d`${yy(h_[h]??h,{dropTarget:m})} ${b.map(v=>gy(v))}`})} ${u.length>0||za?w_():null} ${J(u,h=>h.integrity,h=>my(h))}`,Na);let p=Y.querySelector('sidebar-view-button[kind="packages"]');p&&(p.count=p_());let f=Y.querySelector('sidebar-view-button[kind="repositories"]');f&&(f.count=f_()),Lr(),kc(e,()=>{V()})}Te(()=>{V()});async function I_(e){if(e.target.closest('[data-action="go-home"]')){await hb();return}let t=e.target.closest(".file-item[data-bundle-integrity]");if(t){if(t.classList.contains("bundle-missing"))return;let c=t.dataset.bundleIntegrity;if(a.selectedBundle===c&&a.currentView==="bundles")return;a.currentView="bundles",a.selectedBundle=c,a.bundleDetails=null,a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.bundleCodeSearchQuery="",a.bundleCodeSearchMode="files",a.bundleSearchQuery="",a.bundleSearchRegex=!1,a.bundleSearchCase=!1,a.bundleSearchContext=!0,a.bundleDetailsTab="overview",A.showAll=!0,a.shownTriage=null,Fr(c),x(),V(),Zt(c);return}let r=e.target.closest("sidebar-view-button");if(r){let c=r.getAttribute("kind");(c==="packages"||c==="repositories")&&(a.currentView=c,x(),V());return}if(e.target.closest('[data-action="new-workspace"]')){if(a.serverMode==="managed")return;let c=await Zb();c&&(await Zd(),await Lc(c),V());return}let n=e.target.closest('[data-action="share-workspace"]');if(n){let c=n.closest("[data-workspace-id]"),u=c?W().find(p=>p.id===c.dataset.workspaceId):null;u&&ty({id:u.id,name:u.name,privateKeyBase64:u.privateKey}).catch(p=>alert(`Failed to open share dialog: ${p.message}`));return}let o=e.target.closest('[data-action="export-workspace"]');if(o){let c=o.closest("[data-workspace-id]"),u=c?W().find(p=>p.id===c.dataset.workspaceId):null;u&&Qb(u).catch(p=>alert(`Failed to open export dialog: ${p.message}`));return}let s=e.target.closest('[data-action="leave-workspace"]');if(s){let c=s.closest("[data-workspace-id]"),u=c?W().find(v=>v.id===c.dataset.workspaceId):null;if(!u)return;let p=Array.isArray(u.reports)?u.reports:[],f;try{f=await Xi(p)}catch(v){alert(`Couldn't read reports to analyze triage impact: ${v.message}`);return}let{confirmed:h,mode:b,triage:m}=await ey({name:u.name,reportCount:p.length,bundleCount:u.bundles.length,triageImpact:f});if(!h)return;if(!W().some(v=>v.id===u.id)){alert(`Workspace "${u.name}" was removed elsewhere; nothing to leave.`);return}try{await mb(u.id,b,{triage:m})}catch(v){alert(`Failed to leave workspace: ${v.message}`)}return}let i=e.target.closest(".file-item.workspace-item[data-workspace-id]");if(i){let c=i.dataset.workspaceId,u=a.currentView==="findings"||a.currentView==="files";c&&(c!==a.currentWorkspace||!u)&&$t(c);return}let l=e.target.closest(".file-item[data-file]");if(l){let c=l.dataset.file;c&&(c!==a.currentFile||a.currentView!=="findings")&&Xe(c);return}if(e.target.closest("sidebar-delete-current")){if(a.currentView==="bundles"&&a.selectedBundle){let m=a.selectedBundle,v=(a.bundles??[]).find(k=>k.integrity===m)?.name??m,w=W().filter(k=>Array.isArray(k.bundles)&&k.bundles.includes(m)).filter(k=>yd(k.id,m)).map(k=>k.id),{confirmed:y}=await ny({name:v,inRemote:w.length>0});if(!y)return;if(a.selectedBundle!==m){alert(`Active bundle changed during confirmation; aborting delete of "${v}".`);return}try{await gb({deleteFromRemoteWorkspaceIds:w})}catch(k){alert(`Failed to delete bundle: ${k.message}`)}return}if(!a.currentFile)return;let c=a.currentFile,u;try{u=await Xi([c])}catch(m){alert(`Couldn't read reports to analyze triage impact: ${m.message}`);return}let p=W().filter(m=>Array.isArray(m.reports)&&m.reports.includes(c)).filter(m=>Un(m.id,c)).map(m=>m.id),f=p.length>0,{confirmed:h,triage:b}=await ry({name:c,triageImpact:u,inRemote:f});if(!h)return;if(a.currentFile!==c){alert(`Active report changed during confirmation; aborting delete of "${c}".`);return}try{await fb({triage:b,deleteFromRemoteWorkspaceIds:p})}catch(m){alert(`Failed to delete report: ${m.message}`)}return}if(e.target.closest("#sync-status")){if(a.serverModeMismatch)return;N.status==="error"?N.dismissError():N.status==="off"?(!N.getServerUrl()&&Bs&&N.setServerUrl(Bs),N.setEnabled(!0)):N.setEnabled(!1);return}if(e.target.closest('[data-action="admin-users"]')){Y?.querySelector("#user-menu")?.hidePopover?.(),W_();return}if(e.target.closest('[data-action="manage-repos"]')){Y?.querySelector("#user-menu")?.hidePopover?.(),K_();return}if(e.target.closest('[data-action="manage-reports"]')){Y?.querySelector("#user-menu")?.hidePopover?.(),q_();return}if(e.target.closest('[data-action="manage-bundles"]')){Y?.querySelector("#user-menu")?.hidePopover?.(),G_();return}if(e.target.closest('[data-action="manage-teams"]')){Y?.querySelector("#user-menu")?.hidePopover?.(),Y_();return}if(e.target.closest('[data-action="managed-logout"]')){vg(a.managedSession?.csrfToken);return}if(e.target.closest("#auth-status")){a.managedSession==null&&yg(a.managed?.loginPath);return}if(e.target.closest("#sidebar-toggle")){if(a.serverMode==="managed")return;gn.classList.toggle("collapsed");try{localStorage.setItem("deepview.sidebarCollapsed",gn.classList.contains("collapsed")?"1":"0")}catch{}}}function R_(e){let t=e.target.closest("[data-tooltip]");if(!t){Fs();return}Iu(t,{placement:"right",gate:r=>{let n=r.querySelector(".file-label");return!n||(r.dataset.tooltip??"")!==n.textContent?!0:n.scrollWidth>n.clientWidth}})}function M_(e){let t=e.target.closest("[data-tooltip]"),r=e.relatedTarget?.closest?.("[data-tooltip]")??null;t&&t===r||Fs()}function F_(e){hn=e.target.value.trim().toLowerCase(),V()}var B_={off:"Sync off",online:"Online",offline:"Offline",connecting:"Connecting\u2026",error:"Sync error"};function L_(){return N.getServerUrl()||Bs?W().length>0:!1}function vy(){let e=Y?.querySelector("#auth-status");if(!e)return;e.hidden=!1;let t=Y?.querySelector("#user-menu"),r=a.managedSession;if(r==null){e.dataset.authed="0",e.removeAttribute("popovertarget"),e.setAttribute("aria-label","Log in"),G(d`Log in`,e),t&&G(g,t);return}let n=(r.login[0]??"?").toUpperCase();e.dataset.authed="1",e.setAttribute("popovertarget","user-menu"),e.setAttribute("aria-label",`Account: ${r.login}`),G(by(n,r.id),e),t&&G(d`<div class="user-card">${by(n,r.id,!0)} <span class="user-id"><span class="user-login">${r.login}</span> ${r.name?d`<span class="user-name">${r.name}</span>`:g}</span></div>${r.role==="admin"||r.role==="manage"?d`<div class="user-menu-group" role="group" aria-label="Manage"><div class="user-menu-group-label">Manage</div>${r.role==="admin"?d`<button type="button" class="user-menu-row" data-action="admin-users">Users</button>`:g} <button type="button" class="user-menu-row" data-action="manage-repos">Repositories</button> <button type="button" class="user-menu-row" data-action="manage-reports">Reports</button> <button type="button" class="user-menu-row" data-action="manage-bundles">Bundles</button> <button type="button" class="user-menu-row" data-action="manage-teams">Teams</button></div>`:g} <button type="button" class="user-menu-row" data-action="managed-logout">Log out</button>`,t)}function by(e,t,r=!1){let n=`/api/avatar/${encodeURIComponent(t)}`;return d`<span class="${r?"user-avatar user-avatar-lg":"user-avatar"}"><span class="user-avatar-fallback">${e}</span> <img alt="" src="${n}" @error="${O_}"></span>`}function O_(e){e.currentTarget.classList.add("broken")}function P_(){let e=Y?.querySelector(".brand-tag");e&&(e.textContent=a.serverMode)}function N_(){gn&&(gn.dataset.mode=a.serverMode),a.serverMode==="managed"&&gn?.classList.remove("collapsed"),Tg()}function Lr(e){let t=Y?.querySelector("#sync-status");if(!t)return;if(P_(),N_(),a.serverModeMismatch){let u=Y?.querySelector("#auth-status");u&&(u.hidden=!0),N.setForcedOff(!0),N.setProtocolLocked(!0),t.hidden=!1,t.dataset.status="paused",t.title="This server speaks a different sync protocol than this app is set up for. Switching isn\u2019t supported yet.";let p=t.querySelector(".sync-label");p&&(p.textContent="Sync paused");return}if(a.serverMode==="managed"){t.hidden=!0,N.setForcedOff(!0),vy();return}if(a.serverMode==="standalone"){t.hidden=!0;let u=Y?.querySelector("#auth-status");u&&(u.hidden=!0);return}let r=Y?.querySelector("#auth-status");r&&(r.hidden=!0);let n=L_(),o=Wt()!=null;if(n&&o&&N.isEnabled()&&eg().catch(u=>{console.warn("sync: load failed",u)}),n&&o&&!N.getServerUrl()&&Bs&&N.isEnabled()&&N.setServerUrl(Bs),N.setForcedOff(!n),!n){t.hidden=!0;return}t.hidden=!1;let s=e??N.status;t.dataset.status=s;let i=N.persistenceDegraded;t.toggleAttribute("data-degraded",i);let l=N.proxyAuthRequired;t.toggleAttribute("data-proxy-auth",l),t.title=i?"Not saving to this browser right now (storage may be full, or another tab is on a newer version). Changes that haven\u2019t synced could be lost on reload.":l?"Can\u2019t reach the sync server \u2014 the connection is being redirected to a sign-in proxy (e.g. Cloudflare Access). Reload the page to sign in again.":"";let c=t.querySelector(".sync-label");c&&(c.textContent=B_[s]??"")}N.onStatusChange(Lr);var Mu=!1,Lu=!1;async function wy(){if(!N.persistenceDegraded||Lu||Mu)return;Mu=!0;let{shown:e}=await iy();if(Mu=!1,e){Lu=!0;return}N.persistenceDegraded&&setTimeout(wy,1500)}N.onPersistenceDegraded(e=>{Lr(),e?wy():Lu=!1});var Fu=!1,Ou=!1;async function ky(){if(!N.proxyAuthRequired||Ou||Fu)return;Fu=!0;let{shown:e,reload:t}=await ay();if(Fu=!1,!e){N.proxyAuthRequired&&setTimeout(ky,1500);return}Ou=!0,t&&location.reload()}N.onProxyAuthRequired(e=>{Lr(),e?ky():Ou=!1});function D_(e){let t=e.target.closest(".file-item.workspace-item");if(!t)return;let r=t.querySelector(".file-label");if(!r||r.querySelector("input"))return;let n=t.dataset.workspaceId,o=W().find(c=>c.id===n);if(!o)return;e.preventDefault();let s=document.createElement("input");s.type="text",s.value=o.name,s.className="workspace-rename-input",r.textContent="",r.append(s),s.focus(),s.select();let i=!1,l=async c=>{i||(i=!0,c&&await Pc(n,s.value),V())};s.addEventListener("keydown",c=>{c.key==="Enter"?(c.preventDefault(),l(!0)):c.key==="Escape"&&(c.preventDefault(),l(!1))}),s.addEventListener("blur",()=>l(!0)),s.addEventListener("click",c=>c.stopPropagation()),s.addEventListener("dblclick",c=>c.stopPropagation())}function Ua(){for(let e of Y.querySelectorAll(".drag-over"))e.classList.remove("drag-over")}function $y(e){return e.dataTransfer.types.includes(Nu)||e.dataTransfer.types.includes(Ls)}function z_(e){let t=e.target.closest(".file-item[data-bundle-integrity]");if(t){if(t.classList.contains("bundle-missing")){e.preventDefault();return}let n=t.dataset.bundleIntegrity;e.dataTransfer.effectAllowed="move",e.dataTransfer.setData(Ls,n),e.dataTransfer.setData(Bu,t.dataset.workspaceId??""),e.dataTransfer.setData("text/plain",n),t.classList.add("dragging"),za=!0,V();return}let r=e.target.closest(".file-item[data-file]");r&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData(Nu,r.dataset.file),e.dataTransfer.setData(Bu,r.dataset.workspaceId??""),e.dataTransfer.setData("text/plain",r.dataset.file),r.classList.add("dragging"),Da=!0,V())}function U_(){for(let e of Y.querySelectorAll(".dragging"))e.classList.remove("dragging");Ua(),(Da||za)&&(Da=!1,za=!1,V())}function H_(e){if(!$y(e))return;e.preventDefault();let t=e.target.closest("[data-workspace-id]"),r=Y.querySelector(".dragging")?.closest("[data-workspace-id]")?.dataset.workspaceId??null,s=t&&r&&t.dataset.workspaceId===r||!t&&!r;if(e.dataTransfer.dropEffect=s?"none":"move",Ua(),!s)if(t){let i=t.dataset.workspaceId;for(let l of Y.querySelectorAll(`[data-workspace-id="${CSS.escape(i)}"]`))l.classList.contains("dragging")||l.classList.add("drag-over")}else{let l=e.dataTransfer.types.includes(Ls)?"[data-default-bundles]":"[data-default-reports]",c=Y.querySelector(l);c&&c.classList.add("drag-over")}}function V_(e){Y.contains(e.relatedTarget)||Ua()}async function j_(e){if(!$y(e))return;e.preventDefault(),e.stopPropagation(),Ua();let t=e.target.closest("[data-workspace-id]"),r=t?t.dataset.workspaceId:null,n=e.dataTransfer.getData(Bu)||null;if(e.dataTransfer.types.includes(Ls)){let s=e.dataTransfer.getData(Ls);if(!s)return;if(n&&n!==r&&yd(n,s)){let i=(a.bundles??[]).find(u=>u.integrity===s)?.name??s,l=W().find(u=>u.id===n),{confirmed:c}=await oy({name:i,workspaceName:l?.name??""});if(!c)return;try{await ia(n,s)}catch(u){console.warn(`Failed to remove '${i}' from source workspace ${n} remote:`,u)}}r&&await rn(s,r),n&&n!==r&&await Hc(s,n),V();return}let o=e.dataTransfer.getData(Nu);if(o){if(n&&n!==r&&Un(n,o)){let s=W().find(l=>l.id===n),{confirmed:i}=await sy({name:o,workspaceName:s?.name??""});if(!i)return;try{await sa(n,o)}catch(l){console.warn(`Failed to remove '${o}' from source workspace ${n} remote:`,l)}}r&&await Kt(o,r),n&&n!==r&&await Xo(o,n),V()}}function xy(e){let t=Wt();if(Jl(t?t.mode:null,e.mode)==="mismatch"){a.serverModeMismatch=!0,N.setForcedOff(!0),N.setProtocolLocked(!0),console.warn(`sync: server is '${e.mode}' but this client is bound to '${t?.mode}' \u2014 refusing to switch (migration not yet supported)`),Lr(N.status);return}a.serverModeMismatch=!1,N.setProtocolLocked(!1);let n=a.serverMode!==e.mode;a.serverMode=e.mode,a.managed=e.managed,Yl(e),Lr(N.status),n&&V(),e.mode==="managed"&&_y()}async function _y(){try{a.managedSession=await gg(),vy(),a.managedTeams=a.managedSession==null?[]:await mg(),V()}catch(e){console.warn("managed: session probe failed:",e)}}async function W_(){try{await wg()}catch(e){console.warn("admin: bundle load failed:",e);return}a.currentView="admin-users",x(),V()}async function K_(){try{await kg()}catch(e){console.warn("admin: repos bundle load failed:",e);return}a.currentView="manage-repos",x(),V()}async function q_(){try{await $g()}catch(e){console.warn("admin: reports bundle load failed:",e);return}a.currentView="manage-reports",x(),V()}async function G_(){try{await xg()}catch(e){console.warn("admin: bundles bundle load failed:",e);return}a.currentView="manage-bundles",x(),V()}async function Y_(){try{await _g()}catch(e){console.warn("admin: teams bundle load failed:",e);return}a.currentView="manage-teams",x(),V()}async function J_(){if(Wt())return;let e=0,t=null;try{let r=await fetch(Ci,{credentials:"same-origin",headers:{accept:"application/json"}});e=r.status,r.ok&&(t=Ei(await r.json()))}catch{}if(t){xy(t);return}e===404&&(a.serverMode="standalone",Zh(!0),Lr(N.status),V())}function X_(){let e=Y?.querySelector("#user-menu"),t=Y?.querySelector("#auth-status");!e||!t||e.addEventListener("beforetoggle",r=>{if(r.newState!=="open")return;let n=t.getBoundingClientRect();e.style.left=`${Math.round(n.left)}px`,e.style.bottom=`${Math.round(window.innerHeight-n.top+6)}px`,e.style.top="auto",e.style.right="auto"})}function Q_(e){gn=e,Y=e.renderRoot,Na=Y.querySelector("#file-list"),Ig(Y.querySelector("#encryption-toggle")),Og(Y.querySelector("#storage-status")),Y.addEventListener("click",I_),Y.addEventListener("dblclick",D_),Y.addEventListener("dragstart",z_),Y.addEventListener("dragend",U_),Y.addEventListener("dragover",H_),Y.addEventListener("dragleave",V_),Y.addEventListener("drop",j_),Na.addEventListener("mouseover",R_),Na.addEventListener("mouseout",M_),Y.querySelector("#sidebar-search-input")?.addEventListener("input",F_),X_(),Lr(N.status),V(),N.onServerInfo(xy),J_(),a.serverMode==="managed"&&_y()}var Pu=class extends Q{static styles=[B(Cg),B(Sg)];render(){return d`<div class="sidebar-header"><h2 class="brand"><button class="brand-button" type="button" data-action="go-home"><span class="brand-name">DeepView</span></button> <span class="brand-tag">dev</span></h2><button id="encryption-toggle" type="button" hidden></button> <button id="sidebar-toggle" type="button" title="toggle sidebar" aria-label="toggle sidebar"><svg viewBox="0 0 16 16" width="14" height="14" fill="currentColor" aria-hidden="true"><path d="M2 4h12v1.5H2zM2 7.25h12v1.5H2zM2 10.5h12V12H2z"/></svg></button></div><div class="sidebar-search"><svg class="sidebar-search-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="6.5" cy="6.5" r="4.5"/><path d="M9.7 9.7L13 13" stroke-linecap="round"/></svg> <input id="sidebar-search-input" type="search" placeholder="Search reports..." autocomplete="off"><sidebar-view-button kind="packages"></sidebar-view-button><sidebar-view-button kind="repositories"></sidebar-view-button></div><ul id="file-list"></ul><button id="storage-status" type="button" hidden><span class="storage-dot" aria-hidden="true"></span> <span class="storage-label"></span></button><div class="sidebar-actions"><sidebar-delete-current></sidebar-delete-current><button id="sync-status" type="button" data-status="off"><span class="sync-dot" aria-hidden="true"></span> <span class="sync-label">Sync off</span></button> <button id="auth-status" type="button" hidden></button></div><div id="user-menu" popover class="user-menu"></div>`}firstUpdated(){Q_(this)}};customElements.define("app-sidebar",Pu);function Sy(e){if(!e)return null;let t=D(e);if(!en(t))return null;let r=e._reportName||a.currentFile||"";return _c({id:t,report:Wi("report",r),workspace:Wi("workspace",a.currentWorkspace??"")})}function Ha(e){for(let t of kt())for(let r of t)if(D(r)===e)return{group:t,finding:r};return null}function Cy(e,t){a.currentView="findings",a.viewMode==="graph"&&(a.viewMode="table",Re());let r=ge(e).commonTriage;if(a.shownTriage=r,a.viewMode==="kanban"){let o=r??"untriaged";a.kanbanExpandedColumn!==null&&a.kanbanExpandedColumn!==o&&(a.kanbanExpandedColumn=null)}if(Er([e]).length===0){let o=a.sortBy;Vn(),a.sortBy=o}let n=Se(e);return e.length>1&&a.activeTabByGroup.set(n,t),a.viewMode==="table"?a.tableSelectedGid=n:a.viewMode==="focus"?a.focusGid=n:a.viewMode==="kanban"&&(a.kanbanPopoverGid=n),n}var Z_=1600,Va="link-target",eS="Couldn't find that finding in any of your reports. Import the report it came from, then open the link again.",ja=null;function tS(e){ja!==null&&clearTimeout(ja);for(let t of document.querySelectorAll(`.${Va}`))t.classList.remove(Va);e.classList.add(Va),ja=setTimeout(()=>{e.classList.remove(Va),ja=null},Z_)}async function rS(e){let t=CSS.escape(e);if(a.viewMode==="table"){let r=E.querySelector("finding-table");if(r){try{await r.updateComplete}catch{}for(let n of r.shadowRoot?.querySelectorAll("finding-row")??[])if(n.group&&dn(n.group)===e)return n}}if(a.viewMode==="kanban"){let r=E.querySelector(`.kanban-card[data-gid="${t}"]`);if(r)return r}return E.querySelector(`finding-card[data-gid="${t}"]`)??E.querySelector(`[data-gid="${t}"]`)}async function Ey(e){let t=Kc(e);if(t.length===1){a.currentWorkspace!==t[0].id&&await $t(t[0].id);return}a.currentFile!==e&&await Xe(e)}async function nS({report:e,workspace:t}){let r=await Vc(t);if(r&&r.id!==a.currentWorkspace)return await $t(r.id),!0;let n=await jc(e);return!n||a.currentFile===n||(a.currentWorkspace?W().find(s=>s.id===a.currentWorkspace):null)?.reports.includes(n)?!1:(await Ey(n),!0)}async function oS(e){let t=a.reports.map(n=>n.fileName).filter(Boolean),r=await Wc(e,{skip:t});return r?(await Ey(r),!0):!1}async function Ay(e){if(!e?.id)return{ok:!1,reason:"This link is missing a finding id."};let t=Ha(e.id);if(!t&&await nS(e)&&(t=Ha(e.id)),!t&&await oS(e.id)&&(t=Ha(e.id)),!t)return{ok:!1,reason:eS};let r=Cy(t.group,e.id);x();let n=await rS(r);return n?(n.scrollIntoView({block:"center",behavior:"smooth"}),tS(n),{ok:!0}):{ok:!0}}var Ty={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 Iy(){dg(async(e,t,r)=>{let n=Gc(e);try{return await Ia(e,n,Ty[r]??Ty.attach)}catch{let o=e.length;return alert(`${r==="attach"?"A report attach":"A workspace sync"} had ${o} triage disagreement${o===1?"":"s"} with your local view. Kept your local values because another dialog is open. ${r==="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 Du=class extends R{static properties={retry:{type:Boolean},_value:{state:!0}};constructor(){super(),this.retry=!1,this._value=""}_finish(t){this._value="",super._finish(t)}_onCancel=()=>this._finish(null);_onInput=t=>{this._value=t.target.value};_onSubmit=()=>{let t=this._value??"";t&&this._finish(t)};_onKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._onSubmit())};render(){let t=(this._value??"").length>0,r=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 d`<dialog @close="${this._onClose}"><header><h3>Sync server password</h3></header><p class="nwd-intro">${r}</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="${!t}" @click="${this._onSubmit}">${this.retry?"Retry":"Authenticate"}</button></footer></dialog>`}};customElements.define("sync-auth-dialog",Du);function Ry({retry:e=!1}={}){return ee("sync-auth-dialog",{retry:!!e})}function My(){cg(async({retry:e})=>{try{return await Ry({retry:e})}catch(t){return console.warn("Sync auth dialog failed to open:",t),null}})}var Wa="https://triage.space/",sS=[{hostname:"deepaudit.dev",pathPrefix:"/",supportsSync:!0},{hostname:"chalker.github.io",pathPrefix:"/deepview/",supportsSync:!1}];function iS(){for(let e of sS)if(location.hostname===e.hostname&&location.pathname.startsWith(e.pathPrefix))return e;return null}var aS=["deepview.triage","deepview.triage.pending"],lS="deepview.repoUrls";function cS(){try{for(let e of aS)if(localStorage.getItem(e))return!0}catch{return!0}try{let e=localStorage.getItem(lS);if(e){let t=JSON.parse(e);if(t&&typeof t=="object"&&Object.keys(t).length>0)return!0}}catch{return!0}return!1}async function dS(){if(cS())return!0;let e=[];try{e=await ie()}catch{return!0}if(e.length>0)return!0;try{if(W().length>0)return!0}catch{return!0}try{return await Fo()}catch{return!0}}var zu=class extends Q{static properties={supportsSync:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.supportsSync=!1}firstUpdated(){let t=this.querySelector("dialog");t&&t.showModal();let r=this.querySelector("button.om-stay");r&&r.focus()}_finish(t){if(this._settled)return;this._settled=!0;let r=this.querySelector("dialog");r&&r.close(),this.dispatchEvent(new CustomEvent("resolve",{detail:t}))}_onClose=()=>this._finish(!1);_onStay=()=>this._finish(!1);_onMigrate=()=>this._finish(!0);render(){let t=()=>d`<a class="om-link" href="${Wa}" target="_blank" rel="noopener noreferrer">${Wa}</a>`;return d`<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 ${t()}.</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 ${t()}.</p>${this.supportsSync?d`<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 ${t()}. 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>`:d`<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 ${t()}.</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",zu);function uS(e){return new Promise(t=>{let r=document.createElement("origin-migration-dialog");r.supportsSync=e.supportsSync,r.addEventListener("resolve",n=>{r.remove(),t(!!n.detail)}),document.body.append(r)})}async function Fy(){let e=iS();return e?await dS()?await uS(e)?(location.assign(Wa),!0):!1:(location.replace(Wa),!0):!1}var Uu=class extends R{static styles=[...R.styles,B(ut)];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(t){t.has("_stage")&&this._focusActiveInput()}_focusActiveInput(){if(this._stage==="password")this.renderRoot.querySelector('input[type="password"]')?.focus();else if(this._stage==="name"){let t=this.renderRoot.querySelector('input[data-role="name"]');t&&(t.focus(),t.select())}}_finish(t){this._settled||(this._decoded=null,this._password="",this.encoded="",super._finish(t))}_onClose=()=>this._finish(null);_onCancel=()=>this._finish(null);_onPasswordInput=t=>{this._password=t.target.value,this._error=""};_onNameInput=t=>{this._name=t.target.value};_onUnlock=async()=>{if(!(!this._password||this._busy)){this._busy=!0,this._error="";try{let t=await pd({encoded:this.encoded,password:this._password});if(this._settled)return;let r=W().find(n=>n.id===t.id)??null;this._decoded=t,this._existingById=r,this._name=t.name,this._password="",this._stage="name"}catch(t){if(this._settled)return;this._error=t?.message??String(t)}finally{this._busy=!1}}};_onAttach=()=>{if(!this._decoded)return;let t=Ft(this._name);if(!t)return;let r=W().find(n=>n.id===this._decoded.id)??null;if(r){this._existingById=r;return}this._nameCollision(t)||this._finish({id:this._decoded.id,name:t,privateKeyBase64:this._decoded.privateKeyBase64})};_nameCollision(t){if(!t||!this._decoded)return null;for(let r of W())if(r.id!==this._decoded.id&&Ft(r.name)===t)return r;return null}_onKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._stage==="password"?this._onUnlock():this._stage==="name"&&this._onAttach())};_passwordStage(){return d`<p class="nwd-note">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?d`<p class="wsl-error" role="alert">${this._error}</p>`:g}<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 t=this._existingById;return d`<p class="nwd-note">This workspace is already attached as <strong>"${t?.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 t=Ft(this._name),r=this._nameCollision(t),n=!!t&&!r;return d`<p class="nwd-note">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> ${r?d`<p class="wsl-error" role="alert">A workspace named "${t}" already exists on this device. Pick a different name.</p>`:g}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!n}" @click="${this._onAttach}">Attach</button></footer>`}render(){let t=this._stage==="password"?"Attach shared workspace":this._existingById?"Workspace already attached":"Name the workspace";return d`<dialog @close="${this._onClose}"><header><h3>${t}</h3></header>${this._stage==="password"?this._passwordStage():this._nameStage()}</dialog>`}};customElements.define("workspace-unlock-link-dialog",Uu);function By({encoded:e}={}){return new Promise((t,r)=>{let n=document.createElement("workspace-unlock-link-dialog");n.encoded=e??"",n.addEventListener("resolve",o=>{n.remove(),t(o.detail)}),n.addEventListener("modal-conflict",o=>{n.encoded="",n.remove(),r(St(o.detail?.cause))}),document.body.append(n)})}var Ke=null,Ka=!1,Os=null;function pS(e){if(!e)return"Could not unlock. Try again.";switch(e.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 r=e.message??String(e);return r.length>200?r.slice(0,197)+"\u2026":r}}}function fS(){if(Ke)return Ke;Ke=document.createElement("div"),Ke.id="lock-overlay",Ke.setAttribute("role","dialog"),Ke.setAttribute("aria-modal","true"),Ke.setAttribute("aria-label","Unlock DeepView"),Ke.innerHTML=`
99
+ You can change this anytime from the lock icon in the sidebar header.`)){Kb();return}await ga(),ae()&&Kb()}var Gb=yu;var vu=class extends I{static styles=[...I.styles,F(_e)];static properties={workspaceId:{type:String},items:{type:Array},_running:{state:!0},_errors:{state:!0},_done:{state:!0},_settled:{state:!0}};constructor(){super(),this.workspaceId="",this.items=[],this._running=!1,this._errors=[],this._done=!1,this._settled=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="download"]')?.focus()}_onClose=()=>this._finish({downloaded:[],failed:[]});_onCancel=()=>this._finish({downloaded:[],failed:[]});_onDownload=async()=>{if(this._running)return;this._running=!0,this._errors=[];let t=[],r=[];for(let n of this.items)try{if(n.kind==="bundle"){let l=await Bm(this.workspaceId,n.identifier);if(!l.ok){let c=l.reason??"unknown";r.push({kind:"bundle",identifier:n.identifier,reason:c}),this._errors=[...this._errors,{label:at(n),reason:c}];continue}await ln(n.identifier,this.workspaceId),t.push({kind:"bundle",identifier:n.identifier});continue}let o=await Fm(this.workspaceId,n.identifier);if(!o){r.push({kind:"report",identifier:n.identifier,reason:"not found in remote"}),this._errors=[...this._errors,{label:at(n),reason:"not found in remote"}];continue}let s;try{s=Ee(await Rt(o.content))}catch{let l="remote payload is not gzipped UTF-8";r.push({kind:"report",identifier:n.identifier,reason:l}),this._errors=[...this._errors,{label:at(n),reason:l}];continue}let i=Je(s);if(!i.recognized){let l="remote payload is not a recognized report format";r.push({kind:"report",identifier:n.identifier,reason:l}),this._errors=[...this._errors,{label:at(n),reason:l}];continue}await Oo(n.identifier,o.content),ot(n.identifier,i.count,i.source),await Jt(n.identifier,this.workspaceId),t.push({kind:"report",identifier:n.identifier})}catch(o){let s=o?.message??String(o);r.push({kind:n.kind,identifier:n.identifier,reason:s}),this._errors=[...this._errors,{label:at(n),reason:s}]}if(this._running=!1,this._done=!0,t.some(n=>n.kind==="report"))try{a.currentWorkspace===this.workspaceId&&await Ct(this.workspaceId)}catch{}r.length===0&&this._finish({downloaded:t,failed:r})};_errorsSection(){return this._errors.length===0?m:d`<ul class="lwd-list" role="alert">${this._errors.map(t=>d`<li><strong>${t.label}</strong> — ${t.reason}</li>`)}</ul>`}render(){let t=this.items.length,r=t===1,n=this.items.filter(u=>u.kind==="report").length,o=t-n,s="items";o===0?s=r?"report":"reports":n===0&&(s=r?"bundle":"bundles");let i=r?d`Download <strong>"${at(this.items[0])}"</strong> from the workspace's remote inventory?`:d`Download <strong>${t}</strong> remote ${s} into this workspace?`,l=r?m:d`<ul class="lwd-list">${this.items.map(u=>d`<li>${at(u)}${u.kind==="bundle"?d`<span class="lwd-kind-tag">bundle</span>`:m}</li>`)}</ul>`,c=this._running?r?"Downloading\u2026":`Downloading ${t} ${s}\u2026`:r?"Download":`Download ${t}`;return d`<dialog @close="${this._onClose}"><header><h3>Download from remote</h3></header><p class="lwd-body">${i}</p>${l} ${this._errorsSection()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}" ?disabled="${this._running}">${this._done&&this._errors.length>0?"Close":"Cancel"}</button> ${this._done&&this._errors.length>0?m:d`<button type="button" data-role="download" @click="${this._onDownload}" ?disabled="${this._running||t===0}">${c}</button>`}</footer></dialog>`}};customElements.define("sync-download-dialog",vu);function ja({workspaceId:e,items:t}={}){return te("sync-download-dialog",{workspaceId:e??"",items:Array.isArray(t)?[...t]:[]})}var Pr="deepview.lastFile",Ms=new Set(["overview","graph","treemap","compare","advisories","issues","code","search","terminal"]);function Nr(e,t="overview"){let r=t&&t!=="overview"&&Ms.has(t)?` ${t}`:"";Le(Pr,`b:${e}${r}`).catch(()=>{})}var gn=0,we=e=>e!==gn;function wu(e){let t=Jb(e.toLowerCase());return t.endsWith(".map")?"sourcemap":t==="stasis.code.br"||t.endsWith(".stasis.code.br")?"stasis":null}function Jb(e){return e.replace(/ \(\d+\)(?=\.[^.]*$)/u,"")}async function Yb({name:e,content:t,existingNames:r}){if(!r.has(e))return await ft(e,t),r.add(e),{name:e,content:t};let n;try{n=await Pe(e)}catch(l){if(!(l instanceof DOMException&&l.name==="NotFoundError"||typeof l?.message=="string"&&l.message.startsWith("File not found:")))throw l;return await ft(e,t),r.add(e),{name:e,content:t}}if(n===t)return{name:e,content:t};let s=K().filter(l=>Array.isArray(l.reports)&&l.reports.includes(e)).filter(l=>Kn(l.id,e)),i=await wb({name:e,workspaceNames:s.map(l=>l.name),existingNames:r});if(i.action==="cancel")return null;if(i.action==="rename"){let l=i.newName;return await ft(l,t),r.add(l),{name:l,content:t}}return await ft(e,t),s.length>0&&await V1(e,s),{name:e,content:t}}async function V1(e,t){let r;try{r=await Qr(e)}catch(n){console.warn(`Import: failed to read freshly-saved "${e}" for cloud sync:`,n);return}for(let n of t)try{await cs(n.id);let o=await fa(n.id,e,r);o&&o.ok===!1&&console.warn(`Import: failed to upload "${e}" to workspace "${n.name}" (${n.id}): ${o.reason??"unknown"}`)}catch(o){console.warn(`Import: failed to upload "${e}" to workspace "${n.name}" (${n.id}):`,o)}}async function ku(e){if(a.serverMode==="managed")return;await Gb();let t=null,r=null,n=new Set,o=new Set(await ce());for(let s of e)try{let i=Jb(s.name.toLowerCase());if(i.endsWith(".gz")||i.endsWith(".deepview-workspace.enc")){await Wb(s);try{let u=await ce();o.clear();for(let p of u)o.add(p)}catch(u){console.warn("Import: failed to refresh existingNames after workspace import:",u)}continue}if(wu(s.name)){let u=new Uint8Array(await s.arrayBuffer()),{integrity:p}=await Zr(s.name,u);r=p,n.add(p);continue}let c=await s.text();if(i.endsWith(".csv")){let u=Db(c);for(let{displayName:p,data:f}of u){let h=p.replaceAll("/","__")+".codex",b=JSON.stringify(f),{count:g,source:w}=Je(b),v=await Yb({name:h,content:b,existingNames:o});v&&(ot(v.name,g,w),t={name:v.name,content:v.content})}}else{let u=Je(c);if(!u.recognized)throw new Error("not a recognized DeepView, DeepSec, Piolium, Claude Security, or Codex report");let p=await Yb({name:s.name,content:c,existingNames:o});if(!p)continue;ot(p.name,u.count,u.source),t={name:p.name,content:p.content}}}catch(i){alert(`Failed to load ${s.name}: ${i.message}`)}await j();for(let s of n)hu(s).catch(()=>{});t?await Ze(t.name,t.content):r&&(a.currentView="bundles",a.selectedBundle=r,a.bundleDetails=null,a.bundleDetailsTab="overview",a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.bundleCodeSearchQuery="",a.bundleCodeSearchMode="files",a.bundleSearchQuery="",a.bundleSearchRegex=!1,a.bundleSearchCase=!1,a.bundleSearchContext=!0,a.shownTriage=null,A.showAll=!0,Nr(r),x(),await j(),nr(r))}async function Ze(e,t){let r=++gn,n=new Set(K().filter(o=>Array.isArray(o.reports)&&o.reports.includes(e)).map(o=>o.id));for(let o of N.openSessions)o&&!n.has(o.workspaceId)&&(N.closeSession(o.workspaceId),ds(o.workspaceId));if(a.reports=[],a.workspaceMerges=[],a.currentFile=e,a.currentWorkspace=null,(a.currentView==="bundles"||a.currentView==="packages"||a.currentView==="repositories")&&(a.currentView="findings"),a.repoUrl=rt(e),a.repoEditing=!1,A.selected=null,A.focusedPkg=null,A.layoutCache=null,A.solo=null,A.hidden.clear(),A.pathFilter="",Be(),Le(Pr,e).catch(()=>{}),t===void 0){try{t=await Pe(e)}catch(o){if(we(r))return;if(o&&o.message?.includes("vault locked")){if(await ba()&&!we(r)){await Ze(e);return}we(r)||(a.currentFile=null,await j());return}if(o instanceof DOMException&&o.name==="NotFoundError"||typeof o?.message=="string"&&o.message.startsWith("File not found:")){let i=K().find(l=>Array.isArray(l.reports)&&l.reports.includes(e)&&Kn(l.id,e));if(i)try{if(await cs(i.id),we(r))return;let l=await ja({workspaceId:i.id,items:[{kind:"report",identifier:e}]});if(we(r))return;if(l?.downloaded?.some(c=>c.kind==="report"&&c.identifier===e)){await Ze(e);return}}catch(l){if(console.warn(`Re-download prompt for missing "${e}" failed:`,l),we(r))return}we(r)||(a.currentFile=null,await j());return}alert(`Failed to read ${e}: ${o.message}`),a.currentFile=null,await j();return}if(we(r))return}if(await xu(e,t,r),!we(r)){for(let o of n)N.openSession(o),N.refreshSession(o),cs(o);await j()}}async function Ct(e){let t=K().find(o=>o.id===e);if(!t)return;let r=++gn;for(let o of N.openSessions)o&&o.workspaceId!==e&&(N.closeSession(o.workspaceId),ds(o.workspaceId));(a.currentView==="bundles"||a.currentView==="packages"||a.currentView==="repositories")&&(a.currentView="findings"),an("workspace",e),a.reports=[],a.workspaceMerges=[],a.currentFile=null,a.currentWorkspace=e,a.repoUrl="",a.repoEditing=!1,A.selected=null,A.focusedPkg=null,A.layoutCache=null,A.solo=null,A.hidden.clear(),A.pathFilter="",Be(),Le(Pr,`ws:${e}`).catch(()=>{}),t.reports.length===0&&(C.classList.remove("active"),J(m,C),ge.classList.remove("hidden"));let n=t.reports.map(o=>Pe(o).catch(()=>null));for(let o=0;o<t.reports.length;o++){let s=await n[o];if(we(r))return;if(s!==null&&(await xu(t.reports[o],s,r),we(r)))return}N.openSession(e),N.refreshSession(e),cs(e),await j()}async function Xb({triage:e="keep",deleteFromRemoteWorkspaceIds:t=[]}={}){if(!a.currentFile)return;let r=++gn,n=a.currentFile;Vn(n),nt(n,"");for(let o of t)try{let s=await ha(o,n);if(we(r))return;s&&s.ok===!1&&s.reason!=="not-found"&&console.warn(`Failed to delete '${n}' from workspace ${o} remote: ${s.reason}`)}catch(s){console.warn(`Failed to delete '${n}' from workspace ${o} remote:`,s)}if(await Fn(n),!we(r)&&(await ts(n,null),!we(r))){if(e==="wipe"){try{await aa()}catch(o){console.warn("Skipped orphan-triage GC:",o)}if(we(r))return}we(r)||($u(),await j())}}function $u(){a.currentFile=null,a.currentWorkspace=null,a.selectedBundle=null,a.bundleDetails=null,a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.reports=[],a.workspaceMerges=[],a.repoUrl="",a.repoEditing=!1,a.shownTriage=null,a.currentView="findings",A.selected=null,A.focusedPkg=null,A.layoutCache=null,A.solo=null,A.hidden.clear(),A.pathFilter="",Be(),Rn(Pr),C.classList.remove("active"),J(m,C),ge.classList.remove("hidden"),document.title="DeepView"}async function Qb(){++gn;for(let e of N.openSessions)e&&(N.closeSession(e.workspaceId),ds(e.workspaceId));$u(),await j()}async function Zb({deleteFromRemoteWorkspaceIds:e=[]}={}){if(!a.selectedBundle)return;let t=++gn,r=a.selectedBundle;for(let o of e)try{let s=await ma(o,r);if(we(t))return;s&&s.ok===!1&&s.reason!=="not-found"&&console.warn(`Failed to delete bundle from workspace ${o} remote: ${s.reason}`)}catch(s){console.warn(`Failed to delete bundle from workspace ${o} remote:`,s)}if(await nc(r),we(t)||(await Qc(r,null),we(t)))return;a.selectedBundle=null,a.bundleDetails=null,a.bundleSourceFile=null,a.bundleSourceFindingIdx=null;let n=Ie(Pr);typeof n=="string"&&(n===`b:${r}`||n.startsWith(`b:${r} `))&&Rn(Pr),Tc(r),a.bundles=await xt(),!we(t)&&(x(),await j())}async function ey(e,t="detach",{triage:r="keep"}={}){let n=K().find(l=>l.id===e);if(!n)return;++gn;let o=Array.isArray(n.reports)?[...n.reports]:[];if(N.closeSession(e),ds(e),t==="delete"){for(let l of o){try{await Fn(l)}catch{}Vn(l),nt(l,"")}if(r==="wipe")try{await aa()}catch(l){console.warn("Skipped orphan-triage GC:",l)}}let s=a.currentWorkspace===e,i=t==="delete"&&a.currentFile!=null&&o.includes(a.currentFile);(s||i)&&$u(),await qc(e),await j()}async function xu(e,t,r=null){let n=()=>r!==null&&we(r);an("report",e);try{if(await os,n())return;let o;try{o=JSON.parse(t)}catch(v){if(o=Bn(t)??Nn(t)??Dn(t),!o)throw new Error(`Not JSON, and not a recognized markdown format. (JSON error: ${v.message})`,{cause:v})}let s=a.reports.length===0,i=new Set,l=new Map,c=new Map;for(let v=0;v<a.reports.length;v++){let y=a.reports[v];for(let k=0;k<y.groups.length;k++){let S=y.groups[k],M=`${v}:${k}`;for(let _ of S)_.id&&(i.add(_.id),l.set(_.id,M),c.has(_.id)||c.set(_.id,_))}}let u=(v,y,k)=>{!v||!k.correctedSeverity&&!v.correctedSeverity||(v._correctedByReport||(v._correctedByReport={[v._reportName??""]:{severity:tr(v),reason:v.correctedSeverityReason}}),v._correctedByReport[y??""]={severity:tr(k),reason:k.correctedSeverityReason})},p=o.findings||[],f=p.flatMap(Jd).filter(v=>!v.id);if(f.length>0){let v=await Promise.all(f.map(qi));if(n())return;f.forEach((y,k)=>{v[k]&&(y.id=v[k])})}let h=Yi(o),b=h??rt(e),g=[],w=0;for(let v of p){let y=Jd(v);if(y.length===0)continue;let k=y.filter(B=>B.id&&i.has(B.id)),S=y.filter(B=>!B.id||!i.has(B.id)),M=new Set;for(let B of k){let V=l.get(B.id);V!==void 0&&M.add(V)}let _=y.filter(B=>B.id).map(B=>B.id);if(S.length===0){M.size>1&&a.workspaceMerges.push(new Set(_));for(let B of k)u(c.get(B.id),e,B);w+=k.length;continue}let R=[];for(let B of S){B.id&&i.add(B.id);let V={...B,_id:a.nextFindingId++,_repoFallback:b,_reportName:e,_bundleHashes:o.bundleHashes??[]};Gi(V,o),V._analyzer=o.source??V.type??null,V.id&&!c.has(V.id)&&c.set(V.id,V),R.push(V)}if(k.length>0){w+=k.length,a.workspaceMerges.push(new Set(_));for(let B of k)u(c.get(B.id),e,B)}let O=`${a.reports.length}:${g.length}`;for(let B of S)B.id&&l.set(B.id,O);g.push(R)}if(w>0&&console.log(`${e}: skipped ${w} duplicate finding${w===1?"":"s"}`),a.reports.push({type:o.type||"analysis",source:o.source??null,fileName:e,groups:g,repo:h,tree:o.tree??null,bundleHashes:o.bundleHashes??[]}),Array.isArray(o.bundleHashes)&&o.bundleHashes.length>0){let v=new Set((a.bundles??[]).map(y=>y.integrity));for(let y of o.bundleHashes)v.has(y)&&hu(y).catch(()=>{})}if(s){if(Yn(),g.some(y=>y.some(k=>k.confidence!==void 0))){let y=S=>g.reduce((M,_)=>M+(_.some(R=>R.confidence!==void 0&&R.confidence>=S)?1:0),0),k;for(y(6)<=25?k=6:y(7)<=25?k=7:k=8;k>0&&y(k-1)===y(k);)k--;a.filterConfMin=k}else a.filterConfMin=0;a.filterRevalidate=Dg(g,a.filterConfMin)}x()}catch(o){alert(`Failed to parse ${e}: ${o.message}`)}}window.__loadFile=(e,t)=>xu(e,t);window.__setFilters=({severities:e,confMin:t}={})=>{e!=null&&(a.filterSeverities=new Set(e)),t!==void 0&&(a.filterConfMin=t),x()};document.addEventListener("keydown",e=>{e.key==="Escape"&&document.body.classList.contains("report-fullscreen")&&document.body.classList.remove("report-fullscreen")});document.addEventListener("dragover",e=>e.preventDefault());document.addEventListener("drop",e=>{e.preventDefault(),!e.target.closest("#drop-zone")&&ku(e.dataTransfer.files)});ge.addEventListener("dragover",e=>{e.preventDefault(),ge.classList.add("hover")});ge.addEventListener("dragleave",()=>ge.classList.remove("hover"));ge.addEventListener("drop",e=>{e.preventDefault(),ge.classList.remove("hover"),ku(e.dataTransfer.files)});var Vt=null;function j1(){Vt||(Vt=document.createElement("input"),Vt.type="file",Vt.multiple=!0,Vt.hidden=!0,Vt.addEventListener("change",()=>{let e=Vt.files;e&&e.length>0&&ku(e),Vt.value=""}),document.body.append(Vt)),Vt.click()}ge.addEventListener("click",e=>{e.target.closest(".drop-prompt-action")&&j1()});var or=new Map,ty="deepview.advisories.proxyConsent";function ry(){try{return localStorage.getItem(ty)==="1"}catch{return!1}}function ny(){try{localStorage.setItem(ty,"1")}catch{}}function W1(e){return Es(e)}function K1(e){if(!e||e.kind!=="stasis"||!e.bundle)return!1;for(let[t,r]of e.bundle.modules)if(t.includes("node_modules")&&r?.name&&typeof r.version=="string"&&r.version)return!0;return!1}function oy(e,t){return!e||wu(e.name)!=="stasis"?!1:!t||t.integrity!==e.integrity?!0:K1(t)}function q1(e){let t=Object.create(null);for(let[r,n]of e)t[r]=[...n].toSorted();return t}async function _u(e,t){if(!e?.integrity||or.has(e.integrity)||!ry())return;let r=W1(e);if(r.size===0){or.set(e.integrity,{state:"ok",byPackage:new Map,query:r});return}or.set(e.integrity,{state:"loading",query:r});let n=e.integrity;try{let o=await fetch("/api/npm-advisories",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(q1(r))});if(!o.ok){let l=`HTTP ${o.status}`;try{let c=await o.json();c&&typeof c.error=="string"&&c.error&&(l=`${c.error} (HTTP ${o.status})`)}catch{}or.set(n,{state:"error",reason:l,query:r}),t();return}let s=await o.json(),i=new Map;if(s&&typeof s=="object")for(let[l,c]of Object.entries(s)){if(!Array.isArray(c))continue;let u=c.filter(p=>p&&typeof p=="object"&&typeof p.title=="string"&&typeof p.severity=="string");u.length>0&&i.set(l,u)}or.set(n,{state:"ok",byPackage:i,query:r})}catch(o){or.set(n,{state:"error",reason:o?.message??"fetch-failed",query:r})}t()}async function sy(e,t){e?.integrity&&or.get(e.integrity)?.state==="error"&&(or.delete(e.integrity),await _u(e,t))}var G1={critical:0,high:1,moderate:2,low:3,info:4};function Wa(e){return G1[e]??999}function Y1(e){return e.charAt(0).toUpperCase()+e.slice(1)}function J1(){let e=typeof window>"u"?"":window.location.host;return d`<div class="bundle-advisories-consent"><div class="bundle-advisories-consent-card"><p class="bundle-advisories-consent-text">This bundle's dependency names and versions will be sent to the npm registry through a same-origin proxy (<span class="mono">${e}</span> → <span class="mono">registry.npmjs.org</span>) to look up published security advisories.</p><button type="button" class="bundle-advisories-consent-btn" data-advisories-consent>Confirm</button><p class="bundle-advisories-consent-note">This preference will be saved and reused for other bundles.</p></div></div>`}function iy(e){if(!e)return d`<div class="bundle-advisories-empty">Bundle not loaded yet.</div>`;if(e.kind!=="stasis"||!e.bundle)return d`<div class="bundle-advisories-empty">Advisories are only available for stasis bundles.</div>`;if(!ry())return J1();let t=or.get(e.integrity);if(!t||t.state==="loading")return d`<div class="bundle-advisories-empty">Loading advisories from npm registry…</div>`;if(t.state==="error")return d`<div class="bundle-advisories-empty is-error"><span>Failed to fetch advisories: ${t.reason}</span> <button type="button" class="bundle-advisories-retry" data-advisories-retry>Retry</button></div>`;let r=t.query.size,n=t.byPackage.size;if(n===0)return d`<div class="bundle-advisories"><div class="bundle-advisories-summary">No advisories for the ${r} ${r===1?"package":"packages"} in this bundle.</div></div>`;let o=[...t.byPackage.entries()].toSorted(([i,l],[c,u])=>{let p=Math.min(...l.map(h=>Wa(h.severity))),f=Math.min(...u.map(h=>Wa(h.severity)));return p!==f?p-f:i.localeCompare(c)}),s=[...t.byPackage.values()].reduce((i,l)=>i+l.length,0);return d`<div class="bundle-advisories"><div class="bundle-advisories-summary">${s} ${s===1?"advisory":"advisories"} across ${n} of ${r} ${r===1?"package":"packages"}</div><ul class="bundle-advisories-list">${o.map(([i,l])=>X1(i,l,t.query.get(i)))}</ul></div>`}function X1(e,t,r){let n=[...t].toSorted((s,i)=>{let l=Wa(s.severity)-Wa(i.severity);return l!==0?l:(s.title??"").localeCompare(i.title??"")}),o=r?[...r].toSorted():[];return d`<li class="bundle-advisories-section"><div class="bundle-advisories-section-header"><span class="bundle-advisories-section-name">${e}</span> ${o.length>0?d`<span class="bundle-advisories-section-versions">${o.map(s=>d`<span class="bundle-advisories-version-chip">${s}</span>`)}</span>`:m} <span class="bundle-advisories-section-count">${n.length} ${n.length===1?"advisory":"advisories"}</span></div><ul class="bundle-advisories-rows">${n.map(s=>t_(s))}</ul></li>`}function Q1(e){if(typeof e!="string")return null;let t=/\/(GHSA-[a-z0-9-]+)(?:[/?#]|$)/iu.exec(e);return t?t[1]:null}var Z1=d`<svg class="bundle-advisory-ghsa-icon" viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 13L13 3"/><path d="M5 3h8v8"/></svg>`;function e_(e){let t=/^CWE-(\d+)$/u.exec(e);if(!t)return d`<span>${e}</span>`;let r=`https://cwe.mitre.org/data/definitions/${t[1]}.html`;return d`<a class="bundle-advisory-cwe" href="${r}" target="_blank" rel="noopener noreferrer">${e}</a>`}function t_(e){let t=e.severity,r=e.title,n=typeof e?.cvss?.score=="number"?e.cvss.score.toFixed(1):"",o=typeof e?.cvss?.vectorString=="string"&&e.cvss.vectorString?e.cvss.vectorString:"",s=typeof e.vulnerable_versions=="string"?e.vulnerable_versions:null,i=typeof e.url=="string"&&/^https?:\/\//iu.test(e.url)?e.url:null,l=Q1(i),c=Array.isArray(e.cwe)?e.cwe.filter(p=>typeof p=="string"):[],u=l&&i?d`<a class="bundle-advisory-ghsa" href="${i}" target="_blank" rel="noopener noreferrer">${l}${Z1}</a>`:l?d`<span class="bundle-advisory-ghsa">${l}</span>`:m;return d`<li class="bundle-advisory-row"><div class="bundle-advisory-rail"><span class="${`bundle-advisory-severity sev-${t}`}">${Y1(t)}</span> ${n?d`<span class="bundle-advisory-cvss-score">CVSS <span class="mono">${n}</span></span>`:m}</div><div class="bundle-advisory-body"><div class="bundle-advisory-header"><span class="bundle-advisory-title">${r}</span> ${u}</div><div class="bundle-advisory-subrow"><div class="bundle-advisory-meta">${s?d`<span>Affected <span class="mono">${s}</span></span>`:m} ${c.length>0?d`<span class="bundle-advisory-cwes">${c.map((p,f)=>d`${f===0?"":", "}${e_(p)}`)}</span>`:m}</div>${o?d`<div class="bundle-advisory-cvss-vector mono">${o}</div>`:m}</div></div></li>`}var Bs=null;function r_(e){let t=new Map;if(!e||e.kind!=="stasis"||!e.bundle)return t;for(let r of e.bundle.imports.values())for(let[n,o]of r){t.has(n)||t.set(n,new Set);for(let s of o.values())typeof s=="string"&&t.get(n).add(s)}return t}function n_(e){let t=We(e),r=r_(e),n=[...t.keys()],{stripped:o}=it(n),s=new Map(n.map((l,c)=>[l,o[c]])),i={};for(let[l,c]of t){let u=s.get(l),p=r.get(l);i[u]={imports:p?[...p].map(f=>s.get(f)).filter(Boolean):[],size:new TextEncoder().encode(c).byteLength}}return{tree:i,origToStripped:s}}async function mu(e){let t=We(e),r=new Map;for(let[n,o]of t)r.set(n,await Rh(o));return r}function dy(e){let t={inprogress:0,fixed:0,invalid:0,deleted:0};if(!e?.fileHashes)return t;let r=new Set;for(let n of e.fileHashes.values())if(!r.has(n)){r.add(n);for(let o of jo(n)){let s=a.triage.get(D(o))?.triage;s&&t[s]!==void 0&&t[s]++}}return t}function co(e,t="graph"){if(!e||e.size===0)return new Map;let r=new Map;for(let[n,o]of e){let s=jo(o);if(s.length===0)continue;let i=s.filter(c=>{let u=a.triage.get(D(c))?.triage??null;return t==="issues"?u!=="invalid"&&u!=="deleted":u===a.shownTriage});if(i.length===0)continue;r.has(n)||r.set(n,[]);let l=r.get(n);for(let c of i)l.push(c)}return r}function uy(e){let{tree:t,origToStripped:r}=n_(e),n=Object.keys(t);if(n.length===0)return null;let o=null;if(e.fileHashes&&e.fileHashes.size>0){o=new Map;for(let[_,R]of e.fileHashes){let O=r.get(_);O!==void 0&&o.set(O,R)}}let s=co(o),i=new Map,l=new Map,c=new Map,u=new Map;for(let[_,R]of s){let O={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0},B=new Set,V=new Set,le=[];for(let Y of R){O[Y.severity]=(O[Y.severity]||0)+1,B.add(Y.severity);let qe=a.triage.get(D(Y))?.color??"none";V.add(qe),le.push({severity:Y.severity,color:qe})}i.set(_,O),l.set(_,B),c.set(_,V),u.set(_,le)}let p=La(t,i),f=new Map;for(let[_,R]of r)f.set(R,_);let h=Lr(e),b=h?new Map([...r].map(([_,R])=>[R,h.get(_)])):null,g=b?_=>b.get(_):null,w=vb(n,g),v=A.splitOwnDirs&&w,y=_=>bt(_,{splitOwnDirs:v,packageDir:g?.(_)}),k=new Set;for(let _ of n)if(k.add(y(_)),k.size>=3)break;let S=k.size>=3,M=n;if(A.focusedPkg){let _=n.filter(R=>y(R)===A.focusedPkg);_.length>0?M=_:A.focusedPkg=null}return A.selected&&!Object.hasOwn(t,A.selected)&&(A.selected=null),{treeData:t,files:M,ownCounts:i,transitiveCounts:p,severitySets:l,colorSets:c,fileFindings:u,options:{pkgOf:y},strippedToOrig:f,canSplitOwnDirs:w,canPackagesView:S}}function qa(){if(!Bs)return;let e=eo();e&&e.refreshSidebar(Bs,{isBundleContext:!0})}function Ga(){if(!Bs)return;let e=eo();e&&e.refreshTopPkgs(Bs)}function py(e){Bs=e}function o_(e){let t=new Map,r=0;for(let{path:o,size:s,pkgDir:i}of e){if(typeof s!="number"||s<=0)continue;let l=bt(o,{packageDir:i});t.set(l,(t.get(l)??0)+s),r+=s}if(r===0)return m;let n=[...t.entries()].toSorted((o,s)=>s[1]-o[1]);return d`<div class="bundles-dist"><div class="bundles-dist-bar" aria-hidden="true">${Q(n,([o])=>o,([o,s])=>d`<span class="bundles-dist-seg" style="${ue({flexGrow:s,background:Xe(o)})}" data-tooltip="${o==="__own__"?m:`${o}: ${ie(s)}`}"></span>`)}</div><ul class="bundles-dist-list">${Q(n,([o])=>o,([o,s])=>{let i=(s/r*100).toFixed(1),l=o==="__own__"?"own source":o,c=Xe(o);return d`<li><span class="bundles-dist-dot" style="${ue({background:c})}"></span> <span class="bundles-dist-pkg" data-tooltip="${o==="__own__"?m:o}">${l}</span> <span class="bundles-dist-bar-row" aria-hidden="true"><span class="bundles-dist-bar-fill" style="${ue({width:`${i}%`,background:c})}"></span> </span><span class="bundles-dist-size">${ie(s)}</span> <span class="bundles-dist-percent">${i}%</span></li>`})}</ul></div>`}function ay(e,t,r,n,o,s){let{prefix:i,stripped:l}=it(r),c=_=>o?.get(r[_]),u=new Set;for(let _=0;_<l.length;_++)u.add(bt(l[_],{packageDir:c(_)}));let p=l.map((_,R)=>R).toSorted((_,R)=>l[_].localeCompare(l[R])),f=l.map((_,R)=>({path:_,size:n[R],pkgDir:c(R)})),h=o_(f),b=h===m?d`<p class="bundles-overview-col-empty">No size information for this bundle's sources.</p>`:h,g={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0},w=0,v=new Map;if(a.bundleDetails?.fileHashes){let _=co(a.bundleDetails.fileHashes,"issues");for(let R of _.values())for(let O of R){g[O.severity]!==void 0&&g[O.severity]++,w++;for(let B of Wo(O.fileHash,O))v.set(B,(v.get(B)??0)+1)}}let y=[...v.keys()].toSorted(),k=xe.filter(_=>g[_]>0).map(_=>d`<span class="${`tree-count-chip ${_}`}">${g[_]} ${_.replaceAll("_"," ")}</span>`),S=r.length>0?d`<ul class="bundles-sources-list">${p.map(_=>{let R=r[_],O=l[_],B=n[_];return d`<li><button type="button" class="bundles-source-row" data-bundle-view-source="${R}" data-tooltip="${R}"><span class="bundles-source-path">${O}</span> ${B==null?m:d`<span class="bundles-source-size">${ie(B)}</span>`}</button></li>`})}</ul>`:d`<p class="bundles-overview-col-empty">No source files in this bundle.</p>`,M=y.length>0?d`<ul class="bundles-reports-list">${y.map(_=>{let R=se[st(_)]??se.default,O=v.get(_)??0;return d`<li><button type="button" class="report-chip bundles-report-chip" data-tooltip="${_}" data-bundle-issue-report="${_}">${ye(R)}<span class="report-chip-label">${De(_)}</span> <span class="bundles-report-count">${O} ${O===1?"issue":"issues"}</span></button></li>`})}</ul>`:d`<p class="bundles-overview-col-empty">No matching reports indexed yet.</p>`;return d`<div class="bundles-overview"><div class="bundles-overview-summary"><div class="bundles-detail-meta-row">${e}<dl class="bundles-detail-meta">${t}<dt>Sources</dt><dd>${r.length}</dd>${i?d`<dt>Prefix</dt><dd class="mono">${i}</dd>`:m}</dl>${s??m}</div>${w>0?d`<div class="bundles-issue-summary tree-count-chips">${k}</div>`:m}</div><div class="bundles-overview-columns"><section class="bundles-overview-col"><header class="bundles-overview-col-head">Packages <span class="bundles-overview-col-count">${u.size}</span></header><div class="bundles-overview-col-body">${b}</div></section><section class="bundles-overview-col"><header class="bundles-overview-col-head">Files <span class="bundles-overview-col-count">${r.length}</span></header><div class="bundles-overview-col-body bundles-overview-col-body--list">${S}</div></section>${y.length>0?d`<section class="bundles-overview-col"><header class="bundles-overview-col-head">Reports <span class="bundles-overview-col-count">${y.length}</span></header><div class="bundles-overview-col-body bundles-overview-col-body--list">${M}</div></section>`:m}</div></div>`}var Su=new Map,Cu=new Set,s_=d`<svg viewBox="0 0 16 16" width="11" height="11" aria-hidden="true"><rect x="3" y="2.5" width="8" height="10" rx="1" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/><rect x="5.5" y="5" width="8" height="9" rx="1" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,sr=null;function Ls(){queueMicrotask(()=>{document.querySelector(".bundle-code-rail-body .bundle-code-tree-link.current")?.scrollIntoView({block:"nearest"})})}function bn(e){for(let t of xe)for(let r of e)if(r.severity===t)return t;return e[0]?.severity??null}function Au(e,t,r,n,o=null){let s=e.split(`
100
+ `).length,i=String(s).length,l=Ma(t),c=`${r??""}\0${t}`;l&&!Su.has(c)&&!Cu.has(c)&&(Cu.add(c),(async()=>{let p=await Qn(e,l);Su.set(c,p??null),Cu.delete(c),a.bundleSourceFile===t&&x()})());let u=Su.get(c);return d`<div class="bundle-source-lines" style="${ue({"--lineno-width":`${i}ch`})}"><aside class="bundle-source-lineno-col" aria-hidden="true">${Array.from({length:s},(p,f)=>{let h=f+1,b=n.get(h),g=b?bn(b.map(v=>v.f)):null,w=b&&a.bundleSourceFindingIdx!=null&&b.some(v=>v.idx===a.bundleSourceFindingIdx);return d`<div class="${T({"bundle-source-lineno-row":!0,"is-match":o?.has(h)??!1})}" data-line="${h}">${b?d`<button type="button" class="${T({"bundle-source-dot":!0,[`sev-${g}`]:!0,active:w})}" data-bundle-source-finding="${b[0].idx}" title="${`${b.length} ${b.length===1?"issue":"issues"} on line ${h}`}" aria-label="${`${b.length} issues on line ${h}`}"></button>`:d`<span class="bundle-source-dot-placeholder"></span>`} <span class="bundle-source-lineno-num">${h}</span></div>`})}</aside><pre class="bundle-source-code"><code class="${l?`language-${l}`:""}">${typeof u=="string"?ye(u):e}</code></pre></div>`}function Tu(e){let t=a.bundleSourceFindingIdx;if(t==null)return m;let r=e[t];if(!r)return m;let n=r.fileHash?Wo(r.fileHash,r):[],o=a.triage.get(D(r))?.triage,s=o==="fixed"?"Fixed":o==="inprogress"?"In progress":null,i=un(r),l=my(r.line);return d`<aside class="bundle-source-panel"><header class="bundle-source-panel-bar"><span class="${`bundle-source-panel-sev sev-${r.severity}`}">${r.severity.replaceAll("_"," ")}</span> ${s?d`<span class="${`bundle-source-panel-triage triage-${o}`}">${s}</span>`:m} <button type="button" class="bundle-source-panel-close" data-action="bundle-source-panel-close" title="Close (Esc)" aria-label="Close finding details">×</button></header><div class="bundle-source-panel-body">${l||i?d`<div class="bundle-source-panel-line-row">${l?d`<span class="bundle-source-panel-line">${l}</span>`:m} ${i?d`<span class="bundle-source-panel-meta" title="${i}">${i}</span>`:m}</div>`:m}<div class="bundle-source-panel-desc">${gt(Sa(r),{paragraphs:!1})}</div>${n.length>0?d`<div class="bundle-source-panel-reports"><div class="bundle-source-panel-reports-label">Reported by</div>${n.map(c=>{let u=se[st(c)]??se.default;return d`<button type="button" class="report-chip bundle-source-panel-report" title="${c}" data-bundle-issue-report="${c}">${ye(u)}<span class="report-chip-label">${De(c)}</span></button>`})}</div>`:m}</div></aside>`}function Ru(e,t,r){let n=[],o=new Map;if(typeof r=="string"&&e?.fileHashes){let i=co(e.fileHashes,"issues").get(t)??[];for(let l=0;l<i.length;l++){let c=i[l];n.push(c);let u=parseInt(c.line,10);Number.isFinite(u)&&u>0&&(o.has(u)||o.set(u,[]),o.get(u).push({f:c,idx:l}))}}return{fileFindings:n,lineFindings:o}}function fy(){let e=a.bundleSourceFile;if(!e)return m;if(a.bundleDetailsTab==="code"||a.bundleDetailsTab==="search")return m;let r=We(a.bundleDetails).get(e),{fileFindings:n,lineFindings:o}=Ru(a.bundleDetails,e,r);return d`<div class="bundle-source-overlay"><div class="${T({"bundle-source-modal":!0,"with-panel":a.bundleSourceFindingIdx!=null})}"><header class="bundle-source-bar"><div class="bundle-source-title" title="${e}">${e}</div><button type="button" class="bundle-source-close" data-action="bundle-source-close" title="Close source viewer (Esc)" aria-label="Close source viewer">×</button></header><div class="bundle-source-body"><div class="bundle-source-code-wrap">${typeof r=="string"?Au(r,e,a.bundleDetails?.integrity,o):d`<div class="bundle-source-empty">Source content not bundled.</div>`}</div>${Tu(n)}</div></div></div>`}function hy(e){let t={name:"",files:new Map,dirs:new Map};for(let r of e){let n=r.split("/"),o=t;for(let s=0;s<n.length-1;s++){let i=n[s],l=o.dirs.get(i);l||(l={name:i,files:new Map,dirs:new Map},o.dirs.set(i,l)),o=l}o.files.set(n.at(-1),r)}return t}var Ka=new Map,ly=null;function i_(e,t){let r=0,n=null;if(!t||t.size===0)return{count:r,worst:n};let o=s=>{for(let i of s.files.values()){let l=t.get(i);if(!l||l.length===0)continue;r+=l.length;let c=bn(l);(n===null||($e[c]??0)>($e[n]??0))&&(n=c)}for(let i of s.dirs.values())o(i)};return o(e),{count:r,worst:n}}function Eu(e,t,r=0,n=null,o="",s=!1){let i=[...e.dirs.entries()].toSorted(([f],[h])=>f.localeCompare(h)),l=[...e.files.entries()].toSorted(([f],[h])=>f.localeCompare(h)),c=f=>{if(!t)return!1;for(let h of f.files.values())if(h===t)return!0;for(let h of f.dirs.values())if(c(h))return!0;return!1},u=(f,h)=>s?!0:Ka.has(f)?Ka.get(f):r===0||c(h),p=f=>h=>{Ka.set(f,!h.currentTarget.parentElement.open)};return d`<ul class="${T({"bundle-code-tree":!0,root:r===0})}">${Q(i,([f])=>`${o}/${f}`,([f,h])=>{let b=o?`${o}/${f}`:f,g=i_(h,n);return d`<li class="bundle-code-tree-dir"><details ?open="${u(b,h)}"><summary @click="${p(b)}"><span class="bundle-code-tree-dirname">${f}</span> ${g.count>0?d`<span class="${`bundle-code-tree-count sev-${g.worst}`}" title="${`${g.count} ${g.count===1?"issue":"issues"} inside`}">${g.count}</span>`:m}</summary>${Eu(h,t,r+1,n,b,s)}</details></li>`})} ${Q(l,([,f])=>f,([f,h])=>{let b=n?.get(h),g=b&&b.length>0?bn(b):null,w=b?.length??0;return d`<li class="bundle-code-tree-file"><button type="button" class="${T({"bundle-code-tree-link":!0,current:h===t})}" data-bundle-view-source="${h}" title="${h}"><span class="bundle-code-tree-name">${f}</span> ${w>0?d`<span class="${`bundle-code-tree-count sev-${g}`}" title="${`${w} ${w===1?"issue":"issues"}`}">${w}</span>`:m}</button></li>`})}</ul>`}function a_(e,t,r,n,o=""){if(!r)return Eu(e,t,0,n);let s=r.toLowerCase(),i=[],l=h=>{for(let[,b]of h.dirs)l(b);for(let[,b]of h.files)(o&&b.startsWith(o)?b.slice(o.length):b).toLowerCase().includes(s)&&i.push(b)};if(l(e),i.length===0)return d`<div class="bundle-code-search-empty">No files match.</div>`;let c=o?i.map(h=>h.startsWith(o)?h.slice(o.length):h):i,u=new Map;for(let h=0;h<i.length;h++)u.set(c[h],i[h]);let p=hy(c),f=h=>{let b=new Map;for(let[g,w]of h.files)b.set(g,u.get(w)??w);h.files=b;for(let g of h.dirs.values())f(g)};return f(p),Eu(p,t,0,n,"",!0)}function l_(e,t,r,n=""){if(!t)return d`<div class="bundle-code-search-hint">Type to search across every source in this bundle.</div>`;let o=t.toLowerCase(),s=20,i=100,l=[],c=0;for(let[u,p]of e){if(typeof p!="string")continue;let f=[],h=p.split(`
101
+ `);for(let b=0;b<h.length;b++){let g=h[b];if(g.toLowerCase().includes(o)&&(f.push({ln:b+1,text:g}),c++,f.length>=s))break}if(f.length>0&&l.push({path:u,hits:f}),l.length>=i)break}return l.length===0?d`<div class="bundle-code-search-empty">No matches.</div>`:d`<div class="bundle-code-search-results"><div class="bundle-code-search-summary">${c} ${c===1?"hit":"hits"} in ${l.length} ${l.length===1?"file":"files"}</div>${l.map(({path:u,hits:p})=>{let f=n&&u.startsWith(n)?u.slice(n.length):u;return d`<div class="${T({"bundle-code-search-file":!0,current:u===r})}"><button type="button" class="bundle-code-search-file-name" data-bundle-view-source="${u}" title="${u}">${f}</button><ul class="bundle-code-search-hits">${p.map(h=>d`<li class="bundle-code-search-hit"><button type="button" class="bundle-code-search-hit-link" data-bundle-view-source="${u}" data-bundle-view-line="${h.ln}" data-bundle-view-scroll-block="start" title="${`${u}:${h.ln}`}"><span class="bundle-code-search-hit-ln">${h.ln}</span> <span class="bundle-code-search-hit-text mono">${h.text.slice(0,200)}</span></button></li>`)}</ul></div>`})}</div>`}function c_(e,t,r,n=""){if(!e.fileHashes)return d`<div class="bundle-code-search-empty">Computing file hashes…</div>`;let o=co(e.fileHashes,"issues");if(o.size===0)return d`<div class="bundle-code-search-empty">No issues match this bundle's files.</div>`;let s=t.toLowerCase(),i=[];for(let[l,c]of o)for(let u=0;u<c.length;u++){let p=c[u],f=p.description??"";s&&!l.toLowerCase().includes(s)&&!p.severity.includes(s)&&!p.severity.replaceAll("_"," ").includes(s)&&!f.toLowerCase().includes(s)||i.push({file:l,finding:p,fileIdx:u})}return i.sort((l,c)=>{let u=$e[l.finding.severity]??0,p=$e[c.finding.severity]??0;return p!==u?p-u:l.file.localeCompare(c.file)}),i.length===0?d`<div class="bundle-code-search-empty">No matches.</div>`:d`<div class="bundle-code-search-results"><div class="bundle-code-search-summary">${i.length} ${i.length===1?"issue":"issues"}</div><ul class="bundle-code-search-issues">${i.map(({file:l,finding:c,fileIdx:u})=>{let p=c.severity,f=n&&l.startsWith(n)?l.slice(n.length):l,h=l===r&&a.bundleSourceFindingIdx===u;return d`<li class="${T({"bundle-code-search-issue":!0,current:h})}"><button type="button" class="bundle-code-search-issue-link" data-bundle-view-source="${l}" data-bundle-view-finding-idx="${u}" data-bundle-view-line="${c.line??""}" title="${l}"><div class="bundle-code-search-issue-row"><span class="${`bundle-code-search-issue-sev sev-${p}`}">${p.replaceAll("_"," ")}</span> <span class="bundle-code-search-issue-path mono">${f}${c.line?`:${c.line}`:""}</span></div><div class="bundle-code-search-issue-desc">${gt(Sa(c),{paragraphs:!1})}</div></button></li>`})}</ul></div>`}function cy(e,t,r){let n=null,o=-1,s=0;for(let[c,u]of r){if(typeof t.get(c)!="string")continue;let p=$e[bn(u)]??0;(p>o||p===o&&u.length>s||p===o&&u.length===s&&(n===null||c.localeCompare(n)<0))&&(n=c,o=p,s=u.length)}if(n)return n;if(e.kind==="stasis"&&e.bundle){for(let c of e.bundle.entries)if(typeof t.get(c)=="string")return c}let i=null,l=-1;for(let[c,u]of t)typeof u=="string"&&u.length>l&&(i=c,l=u.length);return i}function d_(e){if(!e||!e.json&&!e.bundle)return m;let t=We(e);if(t.size===0)return d`<div class="bundle-code-empty">This bundle doesn't carry any source content.</div>`;ly!==a.selectedBundle&&(Ka.clear(),ly=a.selectedBundle);let r=[...t.keys()].toSorted(),{prefix:n,stripped:o}=it(r),s=new Map;for(let y=0;y<r.length;y++)s.set(o[y],r[y]);let i=hy(o),l=y=>{let k=new Map;for(let[S,M]of y.files)k.set(S,s.get(M)??M);y.files=k;for(let S of y.dirs.values())l(S)};l(i);let c=e.fileHashes?co(e.fileHashes,"issues"):new Map,u=a.bundleSourceFile;if(sr&&(sr.bundle!==a.selectedBundle||u&&u!==sr.path)&&(sr=null),!u)u=cy(e,t,c),u&&(a.bundleSourceFile=u,sr={bundle:a.selectedBundle,path:u,hadIssues:c.size>0},Ls());else if(sr&&!sr.hadIssues&&c.size>0){sr.hadIssues=!0;let y=cy(e,t,c);y&&y!==u&&(u=y,a.bundleSourceFile=y,a.bundleSourceFindingIdx=null,sr.path=y,Ls())}let p=u?t.get(u):null,{fileFindings:f,lineFindings:h}=Ru(e,u,p),g=c.size>0?["files","code","issues"]:["files","code"],w=g.includes(a.bundleCodeSearchMode)?a.bundleCodeSearchMode:"files",v=a.bundleCodeSearchQuery;return d`<div class="bundle-code-view"><aside class="bundle-code-rail"><div class="bundle-code-rail-head"><span class="bundle-code-rail-label">Files</span> <span class="bundle-code-rail-count">${r.length}</span></div>${n?d`<div class="bundle-code-rail-prefix mono" title="${n}">${n}</div>`:m}<bundle-code-search .modes="${g}"></bundle-code-search><div class="bundle-code-rail-body">${lu(w,[["files",()=>a_(i,u,v,c,n)],["code",()=>l_(t,v,u,n)],["issues",()=>c_(e,v,u,n)]])}</div></aside><div class="${T({"bundle-code-main":!0,"with-panel":a.bundleSourceFindingIdx!=null})}">${u?u_(e,u,p,f,h):d`<div class="bundle-code-placeholder">Pick a file from the tree to view its source.</div>`}</div></div>`}function u_(e,t,r,n,o){let s=typeof r=="string"?r.split(`
102
+ `).length:0,i=typeof r=="string"?new TextEncoder().encode(r).byteLength:0,l=n.map((c,u)=>({idx:u,line:parseInt(c.line,10)||0})).toSorted((c,u)=>c.line-u.line||c.idx-u.idx);return d`<header class="bundle-code-main-bar"><span class="bundle-code-main-path mono" title="${t}">${t}</span> <button type="button" class="bundle-code-copy-path" data-copy-path="${t}" title="Copy file path" aria-label="Copy file path">${s_}</button> <span class="bundle-code-main-spacer"></span> ${typeof r=="string"?d`<span class="bundle-code-main-stats">${s.toLocaleString()} ${s===1?"line":"lines"} · ${ie(i)}</span>`:m} ${n.length>0?d`<span class="bundle-code-main-issues" data-bundle-code-issue-order="${JSON.stringify(l)}"><span class="${`bundle-code-tree-count sev-${bn(n)}`}" title="${`${n.length} ${n.length===1?"issue":"issues"} in this file`}">${n.length}</span> <button type="button" class="bundle-code-issue-step" data-bundle-code-issue-step="-1" title="Previous issue" aria-label="Previous issue">‹</button> <button type="button" class="bundle-code-issue-step" data-bundle-code-issue-step="1" title="Next issue" aria-label="Next issue">›</button></span>`:m}</header><div class="bundle-code-main-body"><div class="bundle-source-code-wrap">${typeof r=="string"?Au(r,t,e.integrity,o):d`<div class="bundle-source-empty">Source content not bundled.</div>`}</div>${Tu(n)}</div>`}var p_=400;function f_(e){return e<=5?8:e<=15?6:e<=40?4:e<=120?3:2}function h_(e,t,r){let n=[];for(let o of e){let s=Math.max(1,o.ln-r),i=Math.min(t,o.ln+r),l=n.at(-1);l&&s<=l.end+1?l.end=Math.max(l.end,i):n.push({start:s,end:i})}return n}function m_(e,t,r){if(e.length<=r)return{text:e,ranges:t,clipped:!1};let n=t.length>0?t[0][0]:0,o=n>r-60?Math.max(0,n-60):0,s=e.slice(o,o+r);if(o===0)return{text:s,ranges:t,clipped:!1};let i=[];for(let[l,c]of t){let u=l-o,p=c-o;p<=0||u>=s.length||i.push([Math.max(0,u),Math.min(s.length,p)])}return{text:s,ranges:i,clipped:!0}}function g_(e,t){if(t.length===0)return e;let r=[],n=0;for(let[o,s]of t){let i=Math.max(n,Math.min(o,e.length)),l=Math.max(i,Math.min(s,e.length));l<=i||(i>n&&r.push(e.slice(n,i)),r.push(d`<mark class="bundle-search-mark">${e.slice(i,l)}</mark>`),n=l)}return n<e.length&&r.push(e.slice(n)),r}function b_(e,t,r){let n=m_(e,r??[],p_);return d`<div class="${T({"bundle-search-line":!0,"is-match":r!=null})}"><span class="bundle-search-lineno">${t}</span> <span class="bundle-search-code">${n.clipped?d`<span class="bundle-search-clip">…</span>`:m}${g_(n.text,n.ranges)}</span></div>`}function y_(e,t,r,n,o){let{start:s,end:i}=r,l=s;for(let p=s;p<=i;p++)if(n.has(p)){l=p;break}let c=String(i).length,u=[];for(let p=s;p<=i;p++)u.push(b_(t[p-1]??"",p,n.get(p)??null));return d`${o?d`<div class="bundle-search-gap" aria-hidden="true"></div>`:m} <button type="button" class="bundle-search-snippet" style="${ue({"--bundle-search-lineno-w":`${c}ch`})}" data-bundle-view-source="${e}" data-bundle-view-line="${l}" data-bundle-view-scroll-block="center" title="${`${e}:${l}`}">${u}</button>`}function v_(e,t,r){let{path:n,lines:o,hits:s}=e,i=t&&n.startsWith(t)?n.slice(t.length):n,l=h_(s,o.length,r),c=new Map(s.map(f=>[f.ln,f.ranges])),u=s[0].ln,p=n===a.bundleSourceFile;return d`<section class="${T({"bundle-search-file":!0,current:p})}"><header class="bundle-search-file-head"><button type="button" class="bundle-search-file-name mono" data-bundle-view-source="${n}" data-bundle-view-line="${u}" data-bundle-view-scroll-block="center" title="${n}">${i}</button> <span class="bundle-search-file-count">${s.length} ${s.length===1?"match":"matches"}</span></header><div class="bundle-search-snippets">${l.map((f,h)=>y_(n,o,f,c,h>0))}</div></section>`}function w_(e,t,r,n,o,s){if(!r)return d`<div class="bundle-search-results"><div class="bundle-search-hint">Search across every source in this bundle. Each match shows the surrounding lines for context — fewer matches get more context. Toggle <span class="bundle-search-hint-kbd">Aa</span> for case-sensitive and <span class="bundle-search-hint-kbd">.*</span> for regular-expression matching.</div></div>`;let i=yb(e.integrity??"",t,r,n,o);if(i.error)return d`<div class="bundle-search-results"><div class="bundle-search-error"><span class="bundle-search-error-label">Invalid regular expression</span> <span class="bundle-search-error-msg mono">${i.error}</span></div></div>`;let{fileResults:l,totalHits:c,truncated:u}=i,p=[...t.keys()].toSorted(),{prefix:f}=it(p);if(l.length===0)return d`<div class="bundle-search-results"><div class="bundle-search-empty">No matches.</div></div>`;let h=s?f_(c):0,b=l.length;return d`<div class="bundle-search-results"><div class="bundle-search-summary"><span>${c}${u?"+":""} ${c===1?"match":"matches"} in ${b}${u?"+":""} ${b===1?"file":"files"}</span> ${f?d`<span class="bundle-search-summary-prefix mono" title="${f}">${f}</span>`:m} ${u?d`<span class="bundle-search-summary-more">results capped — refine to narrow</span>`:m}</div>${Q(l,g=>g.path,g=>v_(g,f,h))}</div>`}function k_(e,t,r,n){if(!t||typeof e!="string")return null;let o=du(t,r,n);if(o.error)return null;let s=new Set,i=e.split(`
103
+ `);for(let l=0;l<i.length;l++)o.ranges(i[l]).length>0&&s.add(l+1);return s}function $_(e,t,r){let n=a.bundleSourceFile;if(!n)return m;let o=t.get(n),{fileFindings:s,lineFindings:i}=Ru(e,n,o);return d`<aside class="bundle-search-side"><header class="bundle-source-bar"><div class="bundle-source-title" title="${n}">${n}</div><button type="button" class="bundle-source-close" data-action="bundle-source-close" title="Close source viewer (Esc)" aria-label="Close source viewer">×</button></header><div class="bundle-source-body"><div class="bundle-source-code-wrap">${typeof o=="string"?Au(o,n,e.integrity,i,r):d`<div class="bundle-source-empty">Source content not bundled.</div>`}</div>${Tu(s)}</div></aside>`}function x_(e){if(!e||!e.json&&!e.bundle)return m;let t=We(e);if(t.size===0)return d`<div class="bundle-search-view"><div class="bundle-code-empty">This bundle doesn't carry any source content.</div></div>`;let r=a.bundleSearchQuery,n=a.bundleSearchRegex,o=a.bundleSearchCase,s=null;if(a.bundleSourceFile){let l=k_(t.get(a.bundleSourceFile),r,n,o);l&&l.size===0?(a.bundleSourceFile=null,a.bundleSourceFindingIdx=null):s=l}let i=a.bundleSearchContext;return d`<div class="bundle-search-view"><div class="bundle-search-bar-row"><bundle-search></bundle-search><button type="button" class="${T({"bundle-search-context-toggle":!0,on:i})}" data-bundle-search-context aria-pressed="${String(i)}" aria-label="Toggle context lines"><span>Context</span><span class="bundle-search-switch" aria-hidden="true"></span></button></div><div class="bundle-search-main">${w_(e,t,r,n,o,i)} ${$_(e,t,s)}</div></div>`}function __(e){let t=oy(e,a.bundleDetails);a.bundleDetailsTab==="advisories"&&!t&&(a.bundleDetailsTab="overview");let r=(a.bundles?.length??0)>=2;a.bundleDetailsTab==="compare"&&!r&&(a.bundleDetailsTab="overview");let n=a.bundleDetailsTab,o=n==="overview",s=a.bundleDetails,i=!!(s&&s.integrity===e.integrity),l=i&&!s.error&&!!(s.json||s.bundle);return n==="advisories"&&t&&l&&_u(s,x).catch(()=>{}),d`<div class="bundles-view bundles-slide-view"><header class="bundles-slide-bar"><span class="bundles-slide-icon" aria-hidden="true">${ye(to)}</span><div class="bundles-slide-title"><div class="bundles-slide-name">${e.name}</div></div><div class="bundles-slide-tabs" role="tablist">${t?d`<button type="button" class="${T({"bundles-tab":!0,active:n==="advisories"})}" data-bundle-tab="advisories" aria-selected="${String(n==="advisories")}" role="tab">Advisories</button>`:m} <button type="button" class="${T({"bundles-tab":!0,active:n==="issues"})}" data-bundle-tab="issues" aria-selected="${String(n==="issues")}" role="tab">Issues</button> <button type="button" class="${T({"bundles-tab":!0,active:n==="terminal"})}" data-bundle-tab="terminal" aria-selected="${String(n==="terminal")}" role="tab">Terminal</button> <button type="button" class="${T({"bundles-tab":!0,active:n==="treemap"})}" data-bundle-tab="treemap" aria-selected="${String(n==="treemap")}" role="tab">Treemap</button> <button type="button" class="${T({"bundles-tab":!0,active:n==="graph"})}" data-bundle-tab="graph" aria-selected="${String(n==="graph")}" role="tab">Graph</button> <button type="button" class="${T({"bundles-tab":!0,active:n==="code"})}" data-bundle-tab="code" aria-selected="${String(n==="code")}" role="tab">Code</button> <button type="button" class="${T({"bundles-tab":!0,active:n==="search"})}" data-bundle-tab="search" aria-selected="${String(n==="search")}" role="tab">Search</button> ${r?d`<button type="button" class="${T({"bundles-tab":!0,active:n==="compare"})}" data-bundle-tab="compare" aria-selected="${String(n==="compare")}" role="tab">Compare</button>`:m} <button type="button" class="${T({"bundles-tab":!0,active:o})}" data-bundle-tab="overview" aria-selected="${String(o)}" role="tab">Overview</button></div></header><div class="${T({"bundles-slide-body":!0,"bundles-slide-body-overview":o})}">${o?R_(e,s):l?lu(n,[["terminal",()=>d`<div id="bundle-terminal-slot" class="bundle-terminal-slot"></div>`],["graph",()=>d`<div id="bundle-graph-slot" class="bundle-graph-slot"></div>`],["treemap",()=>d`<bundle-treemap .details="${s}"></bundle-treemap>`],["code",()=>d_(s)],["search",()=>x_(s)],["compare",()=>d`<bundle-compare .details="${s}" .integrity="${e.integrity}"></bundle-compare>`],["issues",()=>C_(s)],["advisories",()=>iy(s)]]):i?d`<div class="${T({"bundles-slide-placeholder":!0,"is-error":!!s.error})}">${s.error?`Failed to parse: ${s.error}`:"Bundle contents not parsed."}</div>`:d`<div class="bundles-slide-placeholder">Loading bundle…</div>`}</div></div>`}function S_(e,t={}){if(!e)return m;let r=[];if(e.fileHash&&(r=Wo(e.fileHash,e)),r.length===0&&t.bucketKey&&(t.kind==="package"?r=Sc(t.bucketKey,e):t.kind==="repository"&&(r=Cc(t.bucketKey,e))),r.length===0)return m;let n=r.slice(0,2),o=r.length-n.length;return d`<div class="bundle-issue-reports">${n.map(s=>{let i=se[st(s)]??se.default;return d`<button type="button" class="report-chip" title="${s}" data-bundle-issue-report="${s}">${ye(i)}<span class="report-chip-label">${De(s)}</span></button>`})} ${o>0?d`<span class="bundle-issue-reports-more">, and ${o} more…</span>`:m}</div>`}function my(e){if(e==null||e==="")return"";let t=String(e),r=t.indexOf("-");if(r>0){let o=parseInt(t.slice(0,r),10),s=parseInt(t.slice(r+1),10);return Number.isFinite(o)&&Number.isFinite(s)&&s>o?`Lines ${o}-${s}`:Number.isFinite(o)?`Line ${o}`:""}let n=parseInt(t,10);return Number.isFinite(n)?`Line ${n}`:""}function Fs(e,t){return d`<div class="bundle-issues-empty"><p class="bundle-issues-empty-primary">${e}</p>${t?d`<p class="bundle-issues-empty-hint">${t}</p>`:m}</div>`}function C_(e){if(!e||!e.json&&!e.bundle)return m;if(!e.fileHashes)return Fs("Computing file hashes\u2026","Hashing this bundle's sources so findings from your reports can be matched against them.");if(e.fileHashes.size===0)return Fs("This bundle doesn't carry any source content.","Issues are matched by source-file hash, so a bundle without inline sources has nothing to match findings against.");let t=co(e.fileHashes,"issues");if(t.size===0){let r=_c();if(r===0)return Fs("No issues match this bundle's files.","Issues are analyzer findings matched to this bundle by source-file hash. No hash-carrying findings are indexed yet \u2014 hash matching needs the analyzer's native JSON reports; drop one and any matches will appear here automatically.");let n=0;for(let o of e.fileHashes.values())n+=jo(o).length;return n>0?Fs("All matching issues are dismissed.",`${n} ${n===1?"finding matches":"findings match"} this bundle's files, but every one is triaged invalid or deleted.`):Fs("No issues match this bundle's files.",`None of the ${r.toLocaleString()} indexed ${r===1?"finding":"findings"} reference a source file in this bundle \u2014 matching compares exact file hashes, so findings from a different build of the same project won't line up.`)}return Os(t,{kind:"bundle"})}function Os(e,{kind:t,bucketKey:r}={}){let n=[...e.keys()],{prefix:o,stripped:s}=it(n),i=new Map(n.map((u,p)=>[u,s[p]])),l=[...e.entries()].toSorted(([u,p],[f,h])=>{let b=$e[bn(p)]??0,g=$e[bn(h)]??0;return g!==b?g-b:(i.get(u)??u).localeCompare(i.get(f)??f)}),c=[...e.values()].reduce((u,p)=>u+p.length,0);return d`<div class="bundle-issues"><div class="bundle-issues-summary">${c} ${c===1?"issue":"issues"} across ${e.size} ${e.size===1?"file":"files"} ${o?d`<span class="mono">${o}</span>`:m}</div><ul class="bundle-issues-list">${Q(l,([u])=>u,([u,p])=>{let f=i.get(u)??u,h=[...p].toSorted((g,w)=>{let v=$e[g.severity]??0,y=$e[w.severity]??0;if(y!==v)return y-v;let k=parseInt(g.line,10)||0,S=parseInt(w.line,10)||0;return k-S}),b=t==="repository"&&r?`${/^https?:/iu.test(r)?r.replace(/\/$/u,""):`https://github.com/${r}`}/blob/HEAD/${u}`:null;return d`<li class="bundle-issues-file-group"><header class="bundle-issues-file-header">${t==="bundle"?d`<button type="button" class="bundle-issues-file-name mono" data-bundle-view-source="${u}" title="${u}">${f}</button>`:b?d`<a class="bundle-issues-file-name bundle-issues-file-name-link mono" href="${b}" target="_blank" rel="noopener" title="${u}">${f}</a>`:d`<span class="bundle-issues-file-name bundle-issues-file-name-static mono" title="${u}">${f}</span>`} <span class="bundle-issues-file-count">${p.length} ${p.length===1?"issue":"issues"}</span></header><ul class="bundle-issues-findings">${Q(h,g=>g.id??`${u}\0${g.line??""}\0${g.severity??""}\0${g.description??""}`,g=>{let w=p.indexOf(g),v=g.severity,y=a.triage.get(D(g))?.triage,k=y==="fixed"||y==="invalid"||y==="deleted"?y.toUpperCase():y==="inprogress"?"In progress":null,S=d`<div class="bundle-issues-finding-head"><span class="${`bundle-issue-sev sev-${v}`}">${v.replaceAll("_"," ")}</span> ${(()=>{let M=my(g.line);return M?d`<span class="bundle-issues-finding-line">${M}</span>`:m})()} ${k?d`<span class="${`bundle-issues-finding-triage triage-${y}`}">${k}</span>`:m} <span class="bundle-issues-finding-spacer"></span> ${S_(g,{kind:t,bucketKey:r})}</div><div class="bundle-issues-finding-desc">${gt(Sa(g),{paragraphs:!1})}</div>`;return d`<li class="bundle-issues-finding">${t==="bundle"?d`<button type="button" class="bundle-issues-finding-link" data-bundle-view-source="${u}" data-bundle-view-finding-idx="${w}" data-bundle-view-line="${g.line??""}" title="${u}">${S}</button>`:d`<div class="bundle-issues-finding-link bundle-issues-finding-static" title="${u}">${S}</div>`}</li>`})}</ul></li>`})}</ul></div>`}function gy(e){let t=a.selectedBundle,r=t?e.find(n=>n.integrity===t):null;return r?__(r):d`<div class="bundles-view bundles-view-empty"><p class="bundles-empty-hint">${e.length===0?d`No bundles yet. Drop a <code>.map</code> sourcemap or a <code>.stasis.code.br</code> bundle to start.`:"Pick a bundle from the sidebar to open it."}</p></div>`}var E_=d`<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2v8"/><path d="m4.5 7 3.5 3.5L11.5 7"/><path d="M2.5 13h11"/></svg>`,A_=d`<svg viewBox="0 0 24 24" width="12" height="12" fill="currentColor" aria-hidden="true"><path d="M0 0v24H8.222l2.089-2.373 2.09-2.374V13.2H18.978l2.51-2.488L24 8.223V0H12zm5.2 5.2h13.791L12.2 12c-3.735 3.74-6.838 6.8-6.896 6.8-.057 0-.104-3.06-.104-6.8zm8.4 8.8v10H24V14h-5.2z"/></svg>`;function T_(e,t){let r=fb(t);return d`<div class="bundles-overview-exports"><div class="bundles-overview-exports-row"><button type="button" class="bundles-download-btn" data-bundle-download="${e.integrity}">${E_}<span>Download bundle</span></button> ${r?d`<div class="bundles-export-pair"><button type="button" class="bundles-download-btn" data-bundle-export-sbom="cyclonedx" title="Export a CycloneDX SBOM (.cdx.json)">CycloneDX</button> <button type="button" class="bundles-download-btn" data-bundle-export-sbom="spdx" title="Export an SPDX SBOM (.spdx.json)">${A_}<span>SPDX</span></button></div>`:m}</div></div>`}function R_(e,t){let r=d`<dl class="bundles-detail-meta"><dt>Name</dt><dd>${e.name}</dd><dt>Integrity</dt><dd class="mono">${e.integrity}</dd>${t&&t.integrity===e.integrity?d`<dt>Size</dt><dd>${ie(t.size)}</dd>`:m}</dl>`,n=T_(e,t);if(!t||t.integrity!==e.integrity)return d`<div class="bundles-overview"><div class="bundles-overview-summary"><div class="bundles-detail-meta-row">${r}${n}</div></div></div>`;if(t.error)return d`<div class="bundles-overview"><div class="bundles-overview-summary"><div class="bundles-detail-meta-row">${r}${n}</div></div><div class="bundles-overview-placeholder is-error">Failed to parse: ${t.error}</div></div>`;if(t.kind==="sourcemap"&&t.json){let o=t.json,s=o.sources??[],i=o.sourcesContent??[],l=s.map((u,p)=>typeof i[p]=="string"?new TextEncoder().encode(i[p]).byteLength:null),c=d`<dt>Version</dt><dd>${String(o.version??"?")}</dd>${o.file?d`<dt>Output</dt><dd class="mono">${o.file}</dd>`:m} ${o.sourceRoot?d`<dt>Source root</dt><dd class="mono">${o.sourceRoot}</dd>`:m} ${o.names?d`<dt>Names</dt><dd>${o.names.length}</dd>`:m}`;return ay(r,c,s,l,null,n)}if(t.kind==="stasis"&&t.bundle){let o=t.bundle,s=o.sources,i=[...s.keys()],l=new Set;for(let f of o.imports.keys()){let h=f.replace(/\s*\(with: .*\)\s*$/u,"");for(let b of h.split(", "))l.add(b)}let c=[...l].toSorted(),u=i.map(f=>{let h=s.get(f);return typeof h=="string"?new TextEncoder().encode(h).byteLength:null}),p=d`<dt>Version</dt><dd>${String(o.version)}</dd>${c.length>0?d`<dt>Resolution kinds</dt><dd>${c.join(", ")}</dd>`:m}`;return ay(r,p,i,u,Lr(t),n)}return d`<div class="bundles-overview"><div class="bundles-overview-summary"><div class="bundles-detail-meta-row">${r}${n}</div></div><div class="bundles-overview-placeholder">Bundle contents not parsed.</div></div>`}function by(){Ot().catch(()=>{});let e=Lt(),t={inprogress:0,fixed:0,invalid:0,deleted:0},r=[];for(let[h,b]of e){let g=[],w=[],v=new Map,y=new Set;for(let[k,S]of b.byVersion){let M=[],_=new Map;for(let R of S.findings){let O=a.triage.get(D(R))?.triage??null;O==="inprogress"?t.inprogress++:O==="fixed"?t.fixed++:O==="invalid"?t.invalid++:O==="deleted"&&t.deleted++,O===a.shownTriage&&(M.push(R),_.has(R.file)||_.set(R.file,[]),_.get(R.file).push(R))}if(M.length!==0){g.push([k,{findings:M,files:_,reports:S.reports}]);for(let R of M)w.push(R),v.has(R.file)||v.set(R.file,[]),v.get(R.file).push(R);for(let R of S.reports)y.add(R)}}g.length!==0&&(g.sort(([k],[S])=>Ml(k,S)),r.push([h,{findings:w,files:v,reports:y,versions:g}]))}let n=a.selectedPackage,o=n?r.find(([h])=>h===n)??null:null,s=null;if(o){let h=o[1].versions,b=a.selectedPackageVersion;s=h.find(([g])=>g===b)??null,!s&&h.length===1&&(s=h[0])}let i=s?s[1]:o?o[1]:null;if(o&&a.packageDetailsTab==="issues")return P_(o[0],i,s?s[0]:void 0);let l=a.packagesSearchQuery.trim().toLowerCase(),c=l?r.filter(([h])=>h.toLowerCase().includes(l)):r.slice();L_(c,a.packagesSortBy);let u=r.reduce((h,[,b])=>h+b.findings.length,0),p=new Set;for(let[,h]of r)for(let b of h.reports)p.add(b);let f=o?"packages-layout open":"packages-layout";return d`<div class="${T({"packages-view":!0,"with-details":!!o})}"><header class="page-head"><div class="page-title"><h1>Packages</h1><div class="meta-row"><span>${c.length===r.length?d`${r.length} ${r.length===1?"package":"packages"}`:d`${c.length} of ${r.length} ${r.length===1?"package":"packages"}`}</span> ${u>0?d`<span>${u} ${u===1?"finding":"findings"} across ${p.size} ${p.size===1?"report":"reports"}</span>`:m}</div></div>${F_(t)}</header>${r.length===0?d`<p style="color:var(--muted)">${e.size===0?"Indexing reports\u2026 this view populates as the OPFS scan finishes.":a.shownTriage?`No ${a.shownTriage} findings in any package.`:"No untriaged findings in any package."}</p>`:c.length===0?d`<p style="color:var(--muted)">No packages match "${a.packagesSearchQuery}".</p>`:d`<div class="${f}"><ul class="packages-list">${Q(I_(c),M_,h=>N_(h,n,a.selectedPackageVersion))}</ul>${o?d`<aside class="packages-details" id="packages-details"><header class="packages-details-bar"><span class="packages-details-label">Details</span> <button type="button" class="packages-details-close" data-deselect-package title="Close details" aria-label="Close details">×</button></header><div class="packages-details-body">${U_(o[0],i,s?s[0]:void 0)}</div></aside>`:m}</div>`}</div>`}function I_(e){let t=[];for(let[r,n]of e){let o=n.versions;if(o.length<=1){let[c,u]=o[0];t.push({kind:"single",pkg:r,version:c,bucket:u,totalVersions:1});continue}let[s,i]=o[0],l=a.expandedPackages.has(r);if(t.push({kind:"latest",pkg:r,version:s,bucket:i,totalVersions:o.length,expanded:l}),l)for(let c=1;c<o.length;c++){let[u,p]=o[c];t.push({kind:"other",pkg:r,version:u,bucket:p,totalVersions:o.length})}}return t}function M_(e){return e.version===null?`${e.kind}:${e.pkg}`:`${e.kind}:${e.pkg}@${e.version}`}function F_(e){return d`<div class="packages-toolbar"><entity-search kind="packages"></entity-search><entity-sort kind="packages"></entity-sort><triage-selector variant="packages" .counts="${e}" .states="${B_}"></triage-selector></div>`}var B_=["inprogress","fixed","invalid","deleted"];function L_(e,t){let r=t==="name-asc"?(n,o)=>n[0].localeCompare(o[0]):t==="files-desc"?(n,o)=>o[1].files.size-n[1].files.size||n[0].localeCompare(o[0]):t==="reports-desc"?(n,o)=>o[1].reports.size-n[1].reports.size||n[0].localeCompare(o[0]):(n,o)=>o[1].findings.length-n[1].findings.length||n[0].localeCompare(o[0]);e.sort(r)}function O_(e,t){let r={live:0,invalid:0,deleted:0};if(!e)return r;let n=t===void 0?e.files.values():e.byVersion.get(t)?.files.values()??[].values();for(let o of n)for(let s of o){let i=a.triage.get(D(s))?.triage??null;i==="invalid"?r.invalid++:i==="deleted"?r.deleted++:r.live++}return r}function P_(e,t,r){let n=Lt().get(e),o=O_(n,r),s=a.packageSlideTriage??"live",i=n?yy(n,e,s,r):new Map,l=[...i.values()].reduce((f,h)=>f+h.length,0),c=s==="live"?l===1?"issue":"issues":l===1?`${s} issue`:`${s} issues`,u=s==="live"?"No live issues for this package.":`No ${s} issues for this package.`,p=typeof r=="string"?` @ ${r}`:"";return d`<div class="packages-view packages-slide-view"><header class="bundles-slide-bar"><button type="button" class="bundles-slide-back" data-action="package-slide-back" title="Back to packages" aria-label="Back to packages">← Back</button><div class="bundles-slide-title"><div class="bundles-slide-name">${e}${p}</div><div class="bundles-slide-integrity">${l} ${c} · ${t.files.size} ${t.files.size===1?"file":"files"} · ${t.reports.size} ${t.reports.size===1?"report":"reports"}</div></div><slide-triage-tabs kind="package" .counts="${o}"></slide-triage-tabs></header><div class="bundles-slide-body">${i.size===0?d`<div class="bundle-issues-empty">${u}</div>`:Os(i,{kind:"package",bucketKey:e})}</div></div>`}function N_(e,t,r){let{kind:n,pkg:o,version:s,bucket:i}=e,l={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0};for(let g of i.findings){let w=ne(g,a.severityMode);l[w]!==void 0&&l[w]++}let c=xe.filter(g=>l[g]>0),u=Xe(o),f={selected:o===t&&D_(e,r),"packages-row-latest":n==="latest","packages-row-other":n==="other"},h=s===null?"":s,b=s===null?`Open issues for ${o}`:`Open issues for ${o}@${s}`;return d`<li class="${T(f)}" data-select-package="${o}" data-select-package-version="${h}"><span class="packages-dot" style="${ue({background:u})}"></span><div class="packages-row-text"><div class="packages-name-line"><span class="packages-name">${o}${s===null?m:d`<span class="packages-version">@${s}</span>`} </span>${n==="latest"?z_(o,e.expanded,e.totalVersions-1):m}</div><span class="packages-row-meta">${i.findings.length} ${i.findings.length===1?"finding":"findings"} · ${i.files.size} ${i.files.size===1?"file":"files"} · ${i.reports.size} ${i.reports.size===1?"report":"reports"}</span></div>${c.length>0?d`<div class="packages-row-chips">${c.map(g=>d`<span class="${`tree-count-chip ${g}`}" title="${g.replaceAll("_"," ")}">${l[g]}</span>`)}</div>`:m} <button type="button" class="packages-row-issues" data-package-row-issues="${o}" data-package-row-issues-version="${h}" aria-label="${b}">Issues →</button></li>`}function D_(e,t){return e.kind==="single"?!0:e.version===t}function z_(e,t,r){let n=t?"Hide":`+${r} ${r===1?"version":"versions"}`;return d`<button type="button" class="${T({"packages-row-expand":!0,expanded:t})}" data-package-expand="${e}" aria-expanded="${String(t)}" aria-label="${t?`Hide older versions of ${e}`:`Show older versions of ${e}`}" title="${t?"Hide older versions":`Show older versions (${r})`}"><span class="packages-row-expand-chevron" aria-hidden="true"></span> <span class="packages-row-expand-label">${n}</span></button>`}function U_(e,t,r){let n=Lt().get(e),s=[...(n?yy(n,e,"live",r):new Map).values()].reduce((i,l)=>i+l.length,0);return d`<div class="bundles-tabs" role="tablist"><button type="button" class="bundles-tab active" data-package-tab="overview" aria-selected="true" role="tab">Overview</button> <span class="bundles-tabs-spacer"></span> ${s>0?d`<button type="button" class="bundles-tab bundles-tab-action" data-package-tab="issues">Issues (${s}) →</button>`:m}</div>${H_(e,t,r)}`}function yy(e,t,r="live",n){let o=new Map,s=n===void 0?e.files:e.byVersion.get(n)?.files??new Map;for(let[i,l]of s){let c=l.filter(f=>{let h=a.triage.get(D(f))?.triage??null;return r==="invalid"?h==="invalid":r==="deleted"?h==="deleted":h!=="invalid"&&h!=="deleted"});if(c.length===0)continue;let u=vy(t,i);o.has(u)||o.set(u,[]);let p=o.get(u);for(let f of c)p.push(f)}return o}function H_(e,t,r){let n={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0};for(let f of t.findings){let h=ne(f,a.severityMode);n[h]!==void 0&&n[h]++}let o=xe.filter(f=>n[f]>0),s=[...t.files.entries()].toSorted(([f,h],[b,g])=>g.length!==h.length?g.length-h.length:f.localeCompare(b)),i=[...t.reports].toSorted((f,h)=>f.localeCompare(h)),c=Lt().get(e)?.repos,u=c&&c.size===1?[...c][0]:null,p=u?/^https?:/iu.test(u)?u:`https://github.com/${u}`:null;return d`<dl class="packages-detail-meta"><dt>Package</dt><dd class="mono">${e}</dd>${r?d`<dt>Version</dt><dd class="mono">${r}</dd>`:m} ${p?d`<dt>Repository</dt><dd class="mono"><a href="${p}" target="_blank" rel="noopener">${u}</a></dd>`:m}<dt>Findings</dt><dd>${t.findings.length}</dd><dt>Files</dt><dd>${t.files.size}</dd><dt>Reports</dt><dd>${t.reports.size}</dd></dl>${o.length>0?d`<div class="packages-detail-chips">${o.map(f=>d`<span class="${`tree-count-chip ${f}`}">${n[f]} ${f.replaceAll("_"," ")}</span>`)}</div>`:m}<h3 class="packages-detail-section">Reports</h3><ul class="packages-detail-reports">${i.map(f=>{let h=se[st(f)]??se.default;return d`<li><button type="button" class="packages-detail-report" title="${f}" data-package-report="${f}">${ye(h)}<span class="packages-detail-report-label">${De(f)}</span></button></li>`})}</ul><h3 class="packages-detail-section">Files</h3><ul class="packages-detail-files">${s.map(([f,h])=>{let b=vy(e,f);return d`<li class="packages-detail-file"><span class="packages-detail-file-path mono" title="${f}">${b}</span> <span class="packages-detail-file-count">${h.length}</span></li>`})}</ul>`}function vy(e,t){for(let r of["node_modules","dependencies"]){let n=`${r}/${e}/`,o=t.indexOf(n);if(o>=0)return t.slice(o+n.length)}return t.startsWith(`${e}/`)?t.slice(e.length+1):t}function vt(e){if(!e)return"";let t=e.match(/github\.com\/([^/?#]+\/[^/?#]+?)(?:\.git)?(?:[/?#]|$)/iu);return t?t[1]:e}function wy(){Ot().catch(()=>{});let e=nn(),t={inprogress:0,fixed:0,invalid:0,deleted:0},r=[];for(let[p,f]of e){let h=[],b=new Map;for(let g of f.findings){let w=a.triage.get(D(g))?.triage??null;w==="inprogress"?t.inprogress++:w==="fixed"?t.fixed++:w==="invalid"?t.invalid++:w==="deleted"&&t.deleted++,w===a.shownTriage&&(h.push(g),b.has(g.file)||b.set(g.file,[]),b.get(g.file).push(g))}h.length>0&&r.push([p,{findings:h,files:b,reports:f.reports}])}let n=a.selectedRepository,o=n?r.find(([p])=>p===n)??null:null;if(o&&a.repositoryDetailsTab==="issues")return q_(o[0],o[1]);let s=a.repositoriesSearchQuery.trim().toLowerCase(),i=s?r.filter(([p])=>p.toLowerCase().includes(s)||vt(p).toLowerCase().includes(s)):r.slice();W_(i,a.repositoriesSortBy);let l=r.reduce((p,[,f])=>p+f.findings.length,0),c=new Set;for(let[,p]of r)for(let f of p.reports)c.add(f);let u=o?"packages-layout open":"packages-layout";return d`<div class="${T({"packages-view":!0,"with-details":!!o})}"><header class="page-head"><div class="page-title"><h1>Repositories</h1><div class="meta-row"><span>${i.length===r.length?d`${r.length} ${r.length===1?"repository":"repositories"}`:d`${i.length} of ${r.length} ${r.length===1?"repository":"repositories"}`}</span> ${l>0?d`<span>${l} ${l===1?"finding":"findings"} across ${c.size} ${c.size===1?"report":"reports"}</span>`:m}</div></div>${V_(t)}</header>${r.length===0?d`<p style="color:var(--muted)">${e.size===0?"Indexing reports\u2026 this view populates as the OPFS scan finishes.":a.shownTriage?`No ${a.shownTriage} findings in any repository.`:"No untriaged findings in any repository."}</p>`:i.length===0?d`<p style="color:var(--muted)">No repositories match "${a.repositoriesSearchQuery}".</p>`:d`<div class="${u}"><ul class="packages-list">${Q(i,([p])=>p,([p,f])=>G_(p,f,p===n))}</ul>${o?d`<aside class="packages-details" id="repositories-details"><header class="packages-details-bar"><span class="packages-details-label">Details</span> <button type="button" class="packages-details-close" data-deselect-repository title="Close details" aria-label="Close details">×</button></header><div class="packages-details-body">${Y_(o[0],o[1])}</div></aside>`:m}</div>`}</div>`}function V_(e){return d`<div class="packages-toolbar"><entity-search kind="repositories"></entity-search><entity-sort kind="repositories"></entity-sort><triage-selector variant="packages" .counts="${e}" .states="${j_}"></triage-selector></div>`}var j_=["inprogress","fixed","invalid","deleted"];function W_(e,t){let r=t==="name-asc"?(n,o)=>vt(n[0]).localeCompare(vt(o[0])):t==="files-desc"?(n,o)=>o[1].files.size-n[1].files.size||vt(n[0]).localeCompare(vt(o[0])):t==="reports-desc"?(n,o)=>o[1].reports.size-n[1].reports.size||vt(n[0]).localeCompare(vt(o[0])):(n,o)=>o[1].findings.length-n[1].findings.length||vt(n[0]).localeCompare(vt(o[0]));e.sort(r)}function K_(e){let t={live:0,invalid:0,deleted:0};if(!e)return t;for(let r of e.files.values())for(let n of r){let o=a.triage.get(D(n))?.triage??null;o==="invalid"?t.invalid++:o==="deleted"?t.deleted++:t.live++}return t}function q_(e,t){let r=nn().get(e),n=K_(r),o=a.repositorySlideTriage??"live",s=r?ky(r,o):new Map,i=[...s.values()].reduce((u,p)=>u+p.length,0),l=o==="live"?i===1?"issue":"issues":i===1?`${o} issue`:`${o} issues`,c=o==="live"?"No live issues for this repository.":`No ${o} issues for this repository.`;return d`<div class="packages-view packages-slide-view"><header class="bundles-slide-bar"><button type="button" class="bundles-slide-back" data-action="repository-slide-back" title="Back to repositories" aria-label="Back to repositories">← Back</button><div class="bundles-slide-title"><div class="bundles-slide-name">${vt(e)}</div><div class="bundles-slide-integrity">${i} ${l} · ${t.files.size} ${t.files.size===1?"file":"files"} · ${t.reports.size} ${t.reports.size===1?"report":"reports"}</div></div><slide-triage-tabs kind="repository" .counts="${n}"></slide-triage-tabs></header><div class="bundles-slide-body">${s.size===0?d`<div class="bundle-issues-empty">${c}</div>`:Os(s,{kind:"repository",bucketKey:e})}</div></div>`}function G_(e,t,r){let n={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0};for(let l of t.findings){let c=ne(l,a.severityMode);n[c]!==void 0&&n[c]++}let o=xe.filter(l=>n[l]>0),s=Xe(e),i=vt(e);return d`<li class="${r?"selected":""}" data-select-repository="${e}"><span class="packages-dot" style="${ue({background:s})}"></span><div class="packages-row-text"><span class="packages-name">${i}</span> <span class="packages-row-meta">${t.findings.length} ${t.findings.length===1?"finding":"findings"} · ${t.files.size} ${t.files.size===1?"file":"files"} · ${t.reports.size} ${t.reports.size===1?"report":"reports"}</span></div>${o.length>0?d`<div class="packages-row-chips">${o.map(l=>d`<span class="${`tree-count-chip ${l}`}" title="${l.replaceAll("_"," ")}">${n[l]}</span>`)}</div>`:m} <button type="button" class="packages-row-issues" data-repository-row-issues="${e}" aria-label="${`Open issues for ${i}`}">Issues →</button></li>`}function Y_(e,t){let r=nn().get(e),o=[...(r?ky(r):new Map).values()].reduce((s,i)=>s+i.length,0);return d`<div class="bundles-tabs" role="tablist"><button type="button" class="bundles-tab active" data-repository-tab="overview" aria-selected="true" role="tab">Overview</button> <span class="bundles-tabs-spacer"></span> ${o>0?d`<button type="button" class="bundles-tab bundles-tab-action" data-repository-tab="issues">Issues (${o}) →</button>`:m}</div>${J_(e,t)}`}function ky(e,t="live"){let r=new Map;for(let[n,o]of e.files){let s=o.filter(i=>{let l=a.triage.get(D(i))?.triage??null;return t==="invalid"?l==="invalid":t==="deleted"?l==="deleted":l!=="invalid"&&l!=="deleted"});s.length>0&&r.set(n,s)}return r}function J_(e,t){let r={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0};for(let l of t.findings){let c=ne(l,a.severityMode);r[c]!==void 0&&r[c]++}let n=xe.filter(l=>r[l]>0),o=[...t.files.entries()].toSorted(([l,c],[u,p])=>p.length!==c.length?p.length-c.length:l.localeCompare(u)),s=[...t.reports].toSorted((l,c)=>l.localeCompare(c)),i=/^https?:/iu.test(e)?e:`https://github.com/${e}`;return d`<dl class="packages-detail-meta"><dt>Repository</dt><dd class="mono"><a href="${i}" target="_blank" rel="noopener">${vt(e)}</a></dd><dt>Findings</dt><dd>${t.findings.length}</dd><dt>Files</dt><dd>${t.files.size}</dd><dt>Reports</dt><dd>${t.reports.size}</dd></dl>${n.length>0?d`<div class="packages-detail-chips">${n.map(l=>d`<span class="${`tree-count-chip ${l}`}">${r[l]} ${l.replaceAll("_"," ")}</span>`)}</div>`:m}<h3 class="packages-detail-section">Reports</h3><ul class="packages-detail-reports">${s.map(l=>{let c=se[st(l)]??se.default;return d`<li><button type="button" class="packages-detail-report" title="${l}" data-package-report="${l}">${ye(c)}<span class="packages-detail-report-label">${De(l)}</span></button></li>`})}</ul><h3 class="packages-detail-section">Files</h3><ul class="packages-detail-files">${o.map(([l,c])=>d`<li class="packages-detail-file"><span class="packages-detail-file-path mono" title="${l}">${l}</span> <span class="packages-detail-file-count">${c.length}</span></li>`)}</ul>`}var Ps=new Map,Ns=new Map,Iu=new Set;function X_(e,t,r){let n=`${e}\0${t}`;if(Ns.has(n)||Iu.has(n))return;let o=Ma(t);if(!o){Ns.set(n,null);return}Iu.add(n),(async()=>{let s=await Qn(r,o);Ns.set(n,s??null),Iu.delete(n),a.focusCodeTick++,queueMicrotask(x)})()}async function Q_(e){let t=Ps.get(e);if(t&&(t.loading||t.sources))return;let r=(a.bundles??[]).find(n=>n.integrity===e);if(r){Ps.set(e,{sources:null,loading:!0,error:null});try{let n=await io(e,r),o=We(n);Ps.set(e,{sources:o,loading:!1,error:n.error??null})}catch(n){Ps.set(e,{sources:null,loading:!1,error:n.message})}a.focusCodeTick++,queueMicrotask(x),queueMicrotask(()=>{let n=C.querySelector(".focus-code-line-active");n&&n.scrollIntoView({block:"center",behavior:"instant"})})}}function $y(e){if(!e)return null;let t=ze(e);if(!t.fileHash||!Array.isArray(t._bundleHashes)||t._bundleHashes.length===0)return null;let r=new Set(t._bundleHashes),n=on(t.fileHash).find(({integrity:u})=>r.has(u));if(!n)return null;let o=Ps.get(n.integrity);if(!o)return Q_(n.integrity),{loading:!0};if(o.loading)return{loading:!0};if(!o.sources)return null;let s=o.sources.get(n.file);if(typeof s!="string")return null;X_(n.integrity,n.file,s);let i=`${n.integrity}\0${n.file}`,l=Ns.has(i)?Ns.get(i):void 0,c=parseInt(t.line,10);return{content:s,file:n.file,integrity:n.integrity,line:Number.isFinite(c)?c:null,highlighted:l,loading:!1}}var Mu=class extends I{static styles=[...I.styles,F(_e)];static properties={workspaceId:{type:String},items:{type:Array},_uploading:{state:!0},_errors:{state:!0},_done:{state:!0},_settled:{state:!0}};constructor(){super(),this.workspaceId="",this.items=[],this._uploading=!1,this._errors=[],this._done=!1,this._settled=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="upload"]')?.focus()}_onClose=()=>this._finish({uploaded:[],failed:[]});_onCancel=()=>this._finish({uploaded:[],failed:[]});_onUpload=async()=>{if(this._uploading)return;this._uploading=!0,this._errors=[];let t=[],r=[];for(let n of this.items)try{let o;if(n.kind==="bundle")o=await Lm(this.workspaceId,n.identifier);else{let s=await Qr(n.identifier);o=await fa(this.workspaceId,n.identifier,s)}if(o.ok)t.push({kind:n.kind,identifier:n.identifier});else{let s=o.reason??"unknown";r.push({kind:n.kind,identifier:n.identifier,reason:s}),this._errors=[...this._errors,{label:at(n),reason:s}]}}catch(o){let s=o?.message??String(o);r.push({kind:n.kind,identifier:n.identifier,reason:s}),this._errors=[...this._errors,{label:at(n),reason:s}]}this._uploading=!1,this._done=!0,r.length===0&&this._finish({uploaded:t,failed:r})};_errorsSection(){return this._errors.length===0?m:d`<ul class="lwd-list" role="alert">${this._errors.map(t=>d`<li><strong>${t.label}</strong> — ${t.reason}</li>`)}</ul>`}render(){let t=this.items.length,r=t===1,n=this.items.filter(u=>u.kind==="report").length,o=t-n,s="items";o===0?s=r?"report":"reports":n===0&&(s=r?"bundle":"bundles");let i=r?d`Upload <strong>"${at(this.items[0])}"</strong> to the workspace's remote inventory?`:d`Upload <strong>${t}</strong> local ${s} to the workspace's remote inventory?`,l=r?m:d`<ul class="lwd-list">${this.items.map(u=>d`<li>${at(u)}${u.kind==="bundle"?d`<span class="lwd-kind-tag">bundle</span>`:m}</li>`)}</ul>`,c=this._uploading?r?"Uploading\u2026":`Uploading ${t} ${s}\u2026`:r?"Upload":`Upload ${t}`;return d`<dialog @close="${this._onClose}"><header><h3>Upload to remote</h3></header><p class="lwd-body">${i}</p>${l}<p class="nwd-note">End-to-end encrypted with the workspace key — only workspace members can decrypt the uploaded content.</p>${this._errorsSection()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}" ?disabled="${this._uploading}">${this._done&&this._errors.length>0?"Close":"Cancel"}</button> ${this._done&&this._errors.length>0?m:d`<button type="button" data-role="upload" @click="${this._onUpload}" ?disabled="${this._uploading||t===0}">${c}</button>`}</footer></dialog>`}};customElements.define("sync-upload-dialog",Mu);function xy({workspaceId:e,items:t}={}){return te("sync-upload-dialog",{workspaceId:e??"",items:Array.isArray(t)?[...t]:[]})}var _y=`.rec-list{margin:.2rem 0 .55rem;padding:0;list-style:none;max-height:320px;overflow-y:auto}.rec-row{display:flex;align-items:center;gap:.5rem;padding:.28rem .15rem;font-size:.8rem;line-height:1.4;border-bottom:1px solid rgb(from var(--text) r g b / .06)}.rec-row:last-child{border-bottom:none}.rec-label{flex:1 1 auto;min-width:0;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rec-status{flex:0 0 auto;padding:0 .4rem;border-radius:4px;font-size:.68rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em}.rec-status-checking{color:var(--muted)}.rec-status-good{color:var(--ok, #16a34a)}.rec-status-reuploaded{color:var(--accent, #2563eb)}.rec-status-failed,.rec-status-check-failed{color:var(--warning, #d97706)}.rec-status-missing{color:var(--critical, #dc2626)}.rec-summary{margin:.1rem 0 .2rem;color:var(--muted);font-size:.76rem;line-height:1.45}.rec-error{margin:.3rem 0 .2rem;color:var(--critical, #f87171);font-size:.76rem;line-height:1.4}
104
+ `;var eS={checking:"checking\u2026",good:"available",reuploaded:"re-uploaded",failed:"re-upload failed","check-failed":"check failed",missing:"missing"},Fu=class extends I{static styles=[...I.styles,F(_e),F(_y)];static properties={workspaceId:{type:String},cloudCount:{type:Number},localFileNames:{type:Array},localBundles:{type:Array},_rows:{state:!0},_running:{state:!0},_ran:{state:!0},_error:{state:!0},_settled:{state:!0}};constructor(){super(),this.workspaceId="",this.cloudCount=0,this.localFileNames=[],this.localBundles=[],this._rows=[],this._running=!1,this._ran=!1,this._error=null,this._settled=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="recheck"]')?.focus()}_result(){return{items:this._rows,counts:this._counts()}}_onClose=()=>this._finish(this._ran?this._result():null);_onCancel=()=>this._finish(this._ran?this._result():null);_counts(){let t={good:0,reuploaded:0,failed:0,"check-failed":0,missing:0};for(let r of this._rows)r.status in t&&(t[r.status]+=1);return t}_onRecheck=async()=>{if(!this._running){this._running=!0,this._error=null,this._rows=[];try{let{items:t}=await Om(this.workspaceId,{onList:r=>{this._rows=r},onItem:r=>{this._rows=this._rows.map(n=>n.resourceTag===r.resourceTag?r:n)}});this._rows=t}catch(t){this._error=t?.message??String(t)}finally{this._running=!1,this._ran=!0}}};_downloadableItems(){let t=new Set(this.localFileNames),r=new Set(this.localBundles),n=[];for(let o of this._rows)o.status!=="good"||!o.identifier||(o.kind==="report"&&!t.has(o.identifier)?n.push({kind:"report",identifier:o.identifier}):o.kind==="bundle"&&!r.has(o.identifier)&&n.push({kind:"bundle",identifier:o.identifier,label:o.label}));return n}_onDownload=async()=>{let t=this._downloadableItems();t.length!==0&&await ja({workspaceId:this.workspaceId,items:t})};_rowsSection(){return this._rows.length===0?this._running?d`<p class="lwd-body">Fetching remote listing…</p>`:m:d`<ul class="rec-list">${this._rows.map(t=>d`<li class="rec-row"><span class="rec-label">${t.label}${t.kind==="bundle"?d`<span class="lwd-kind-tag">bundle</span>`:m}</span> <span class="${`rec-status rec-status-${t.status}`}" title="${t.detail??m}">${eS[t.status]??t.status}</span></li>`)}</ul>`}_summarySection(){if(!this._ran||this._rows.length===0)return m;let t=this._counts(),r=[];return t.good&&r.push(`${t.good} available`),t.reuploaded&&r.push(`${t.reuploaded} re-uploaded`),t.failed&&r.push(`${t.failed} failed`),t["check-failed"]&&r.push(`${t["check-failed"]} check failed`),t.missing&&r.push(`${t.missing} missing`),r.length>0?d`<p class="rec-summary" role="status" aria-live="polite">${r.join(" \xB7 ")}</p>`:m}render(){let t=this.cloudCount===1?"":"s",r=this._ran?m:d`<p class="lwd-body">Re-check ${this.cloudCount>0?d`the <strong>${this.cloudCount}</strong>`:m}remote object${t} for this workspace. Each is re-fetched from the relay; any whose bytes are missing are re-uploaded from a matching local copy.</p>`,n=this._ran&&this._rows.length===0&&!this._error?d`<p class="lwd-empty">No remote objects to check.</p>`:m,o=this._ran?this._downloadableItems().length:0;return d`<dialog @close="${this._onClose}"><header><h3>Re-check cloud storage</h3></header>${r} ${this._rowsSection()} ${n} ${this._summarySection()} ${this._error?d`<p class="rec-error" role="alert">${this._error}</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> ${o>0?d`<button type="button" data-role="download" @click="${this._onDownload}" ?disabled="${this._running}">Download ${o} not stored locally</button>`:m} <button type="button" data-role="cancel" @click="${this._onCancel}" ?disabled="${this._running}">${this._ran?"Close":"Cancel"}</button> <button type="button" data-role="recheck" @click="${this._onRecheck}" ?disabled="${this._running}">${this._running?"Re-checking\u2026":this._ran?"Re-check again":"Re-check"}</button></footer></dialog>`}};customElements.define("objstore-recovery-dialog",Fu);function Sy({workspaceId:e,cloudCount:t,localFileNames:r,localBundles:n}={}){return te("objstore-recovery-dialog",{workspaceId:e??"",cloudCount:typeof t=="number"?t:0,localFileNames:Array.isArray(r)?[...r]:[],localBundles:Array.isArray(n)?[...n]:[]})}function Lu(){let e=ou(a.reports);if(!e)return null;let t=Object.keys(e),n=St().filter(p=>ve(p).commonTriage===a.shownTriage),o=nu(n,a.severityMode),s=La(e,o),i=new Map,l=new Map,c=new Map;for(let p of n)for(let f of p){let h=ne(f,a.severityMode);i.has(f.file)||i.set(f.file,new Set),i.get(f.file).add(h);let b=a.triage.get(D(f))?.color??"none";l.has(f.file)||l.set(f.file,new Set),l.get(f.file).add(b),c.has(f.file)||c.set(f.file,[]),c.get(f.file).push({severity:h,color:b})}let u;return A.focusedPkg?(u=t.filter(p=>(db(p)??"__own__")===A.focusedPkg),A.showAll||(u=u.filter(p=>su(p,o,s)))):u=A.showAll?t:t.filter(p=>su(p,o,s)),{prep:{treeData:e,files:u,ownCounts:o,transitiveCounts:s,severitySets:i,colorSets:l,fileFindings:c},findingCounts:o}}function Ou(){let e=eo();if(!e)return;let t=Lu();t&&e.refreshSidebar(t.prep,{isBundleContext:a.currentView==="bundles"})}function Pu(){let e=eo();if(!e)return;let t=Lu();t&&e.refreshTopPkgs(t.prep)}var tS={"claude-security":"Claude Security findings","codex-security":"Codex Security findings",deepsec:"DeepSec findings",piolium:"Piolium findings"};function rS(e,t,r){return r?d`<repo-chip url="${r}"></repo-chip>`:a.currentWorkspace?t?d`<repo-chip url="${t}"></repo-chip>`:m:e?d`<repo-chip url="${a.repoUrl}" editable ?editing="${a.repoEditing}" ?empty="${!a.repoUrl}"></repo-chip>`:t?d`<repo-chip url="${t}"></repo-chip>`:m}function nS(e,t,r,n,o){let s=e.length,i=new Set(a.reports.map(Y=>Y.source)),l=i.size===1?[...i][0]:null,c=a.currentWorkspace?K().find(Y=>Y.id===a.currentWorkspace):null,u=c?`Workspace: ${c.name}`:l?tS[l]:"Findings",p=l&&se[l]?l:"default",f=ye(se[p]),h=d`<svg class="file-icon" viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"/><path d="M14 3v6h6"/></svg>`,b=m;t.length===1?b=d`<span class="file-chip" data-copy-report="${t[0]}" title="Copy report name">${f}<span>${t[0]}</span></span>`:t.length>1&&(b=d`<span class="file-chip" data-copy-report="${t.join(`
105
+ `)}" title="Copy report names">${h}<span>${t.length} reports</span></span>`);let g=a.reports.flatMap(Y=>Y.groups.flat()),v=`${s} ${`finding${s===1?"":"s"}`}`,k=l||a.currentWorkspace?Ra.filter(Y=>Y!=="type"):Ra,S=Kg(g,k),M=m;if(s>0){let Y={};for(let et of e){let lt=ne(hn(et),a.severityMode);lt&&(Y[lt]=(Y[lt]||0)+1)}let qe=xe.filter(et=>Y[et]>0);qe.length>0&&(M=d`<span class="status-bar" aria-hidden="true">${qe.map(et=>{let lt=`${Y[et]} ${et.replaceAll("_"," ")}`;return d`<span class="${`status-seg sev-${et}`}" style="${ue({flexGrow:Y[et]})}" title="${lt}"></span>`})}</span>`)}let _=new Set(a.reports.map(Y=>Y.repo??null)),R=_.size===1?[..._][0]:null,O=rS(r,n,R),B=d`<span class="sep" aria-hidden="true"></span>`,V=a.currentView==="files",le=(o??0)>1?d`<button type="button" class="${T({"files-toggle-btn":!0,active:V})}" data-action="toggle-files" title="${V?"exit files view":"show files"}" aria-pressed="${String(V)}">${`Files: ${o}`}</button>`:m;return d`<header class="page-head"><div class="page-title"><h1>${u}${b}${O}${le}${oS()}</h1><div class="meta-row"><span>${v}</span> ${M} ${S.length>0?d`${B}${S.map(Y=>d`<span class="tag">${Y}</span>`)}`:m}</div></div></header>`}function oS(){if(N.status!=="online")return m;if(a.currentView!=="findings"&&a.currentView!=="files")return m;let e=iS();if(!e)return m;let{workspaceId:t,fileNames:r,mode:n}=e;if(n==="single"){let v=r[0],y=Ad(t,v)?"cloud":"local";return sS({status:y,label:y,title:y==="cloud"?"Synced to remote":"Local only \u2014 click to upload",onClick:y==="local"?()=>Cy({workspaceId:t,items:[{kind:"report",identifier:v}]}):null})}let o=K().find(v=>v.id===t),s=o&&Array.isArray(o.bundles)?o.bundles:[],i=Cm(t),l=r.filter(v=>!Ad(t,v)),c=s.filter(v=>!_m(t,v)),u=[...l.map(v=>({kind:"report",identifier:v})),...c.map(v=>({kind:"bundle",identifier:v}))];if(i===0&&u.length===0)return m;let p=i>0,f=u.length>0,h=[i>0?`${i} in cloud`:null,u.length>0?`${u.length} local-only`:null,i>0?'click "cloud" to re-check storage':null,u.length>0?`click "local" to upload ${u.length}`:null].filter(Boolean).join(" \u2014 "),b=i===0?m:d`<button type="button" class="sync-badge-chunk cloud" aria-label="${`re-check ${i} cloud object${i===1?"":"s"}`}" @click="${v=>{v.stopPropagation(),Sy({workspaceId:t,cloudCount:i,localFileNames:r,localBundles:s})}}">${Fy()}<span>${i} cloud</span></button>`,g=u.length===0?m:d`<button type="button" class="sync-badge-chunk local" aria-label="${`${u.length} items not yet uploaded \u2014 open upload dialog`}" @click="${v=>{v.stopPropagation(),Cy({workspaceId:t,items:u})}}">${My()}<span>${u.length} local</span></button>`,w=i>0&&u.length>0?d`<span class="sync-badge-divider" aria-hidden="true"></span>`:m;return d`<div class="${`report-sync-badge${p||f?" report-sync-badge-clickable":""}`}" data-status="mixed" title="${h}">${b}${w}${g}</div>`}function sS({status:e,label:t,title:r,onClick:n}){let o=e==="cloud"?Fy():My(),s=d`<span class="sync-badge-label">${t}</span>`;return typeof n!="function"?d`<span class="report-sync-badge" data-status="${e}" title="${r}" aria-label="${`report sync status: ${t}`}">${o}${s}</span>`:d`<button type="button" class="report-sync-badge report-sync-badge-clickable" data-status="${e}" title="${r}" aria-label="${`report sync status: ${t}`}" @click="${n}">${o}${s}</button>`}function My(){return d`<svg class="sync-badge-icon" viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2" y="14" width="20" height="8" rx="2" ry="2"/><line x1="6" y1="18" x2="6.01" y2="18"/><line x1="10" y1="18" x2="10.01" y2="18"/><path d="M6 14V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v10"/></svg>`}function Fy(){return d`<svg class="sync-badge-icon" viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M17.5 19a4.5 4.5 0 1 0-1-8.9A6 6 0 0 0 5.07 13.5 4 4 0 0 0 6 21h11.5z"/></svg>`}async function Cy({workspaceId:e,items:t}){let r=t.filter(n=>n.kind==="bundle");if(r.length>0){let n=await xt(),o=new Map(n.map(s=>[s.integrity,s.name]));for(let s of r){let i=o.get(s.identifier);i&&(s.label=i)}}await xy({workspaceId:e,items:t})}function iS(){if(a.currentWorkspace)return{mode:"workspace",workspaceId:a.currentWorkspace,fileNames:a.reports.map(e=>e.fileName).filter(e=>typeof e=="string")};if(a.currentFile){let e=K().find(t=>Array.isArray(t.reports)&&t.reports.includes(a.currentFile));return e?{mode:"single",workspaceId:e.id,fileNames:[a.currentFile]}:null}return null}function aS(e){return Object.values(e).some(r=>r>0)||a.filterSeverities.size>0?d`<severity-chips .counts="${e}"></severity-chips>`:m}function lS(e){return Object.values(e).some(r=>r>0)||a.filterColors.size>0?d`<triage-filter .counts="${e}"></triage-filter>`:m}function cS(e,t,r,n,o,s,i,l){let{showSource:c,showConfidence:u,showPriority:p,showGraphMode:f,showFileSort:h,kanbanMode:b,showRepo:g,hasComment:w,hasFix:v,hasFlagged:y,showSeverityMode:k,revalidateOptions:S,hasPartialKind:M}=s;return d`<div class="toolbar"><div class="toolbar-row"><view-mode-buttons modes="${f?"table,list,grouped,focus,kanban,graph":"table,list,grouped,focus,kanban"}"></view-mode-buttons><findings-sort ?show-file="${h}" ?show-confidence="${u}" ?show-priority="${p}"></findings-sort>${c?d`<source-filter></source-filter>`:m} ${w||v||y||a.filterComment||a.filterFix||a.filterFlagged?d`<annotation-filter .hasComment="${w}" .hasFix="${v}" .hasFlagged="${y}"></annotation-filter>`:m} ${u||S.length>0?d`<conf-filter ?range-disabled="${!u}" .revalidateOptions="${S}" ?has-partial="${M}"></conf-filter>`:m} ${b?m:d`<triage-selector .counts="${r}"></triage-selector>`}</div><div class="toolbar-row sev-row">${k?d`<severity-mode-switch></severity-mode-switch>`:m} ${aS(n)} ${i.analyzers.length>1||i.models.length>1?d`<analyzer-select .analyzers="${i.analyzers}" .models="${i.models}" .groups="${i.groups}"></analyzer-select>`:m} ${g&&l.length>1?d`<repo-filter .options="${l}"></repo-filter>`:m} ${lS(o)}<div class="search-row"><toolbar-search kind="findings"></toolbar-search><span class="result-count">${e} of ${t}</span></div></div></div>`}function Bu(e,t){return e.map(r=>({p:hn(r),g:r})).toSorted((r,n)=>t(r.p,n.p)).map(r=>r.g)}var Ey=(e,t)=>e.file.localeCompare(t.file)||parseInt(e.line,10)-parseInt(t.line,10),Ya=null,Ay=0,uo=null,Ja=new Map;function Ds(e,t=!1,r=null){let n=Zn(e);return Ja.set(n,{group:e,inGroup:t}),t?r?d`<finding-card data-gid="${n}" in-group context="${r}"></finding-card>`:d`<finding-card data-gid="${n}" in-group></finding-card>`:r?d`<finding-card data-gid="${n}" context="${r}"></finding-card>`:d`<finding-card data-gid="${n}"></finding-card>`}var dS=d`<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 2H2v4M10 2h4v4M14 10v4h-4M6 14H2v-4"/></svg>`,uS=d`<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 2v4H2M10 2v4h4M10 14v-4h4M6 14v-4H2"/></svg>`,pS={critical:"C",high:"H",medium:"M",low:"L",high_bug:"H",bug:"B",informational:"i"};function Ty(e,t={}){let{variant:r="kanban",active:n=!1}=t,o=ve(e),s=ze(e),i=vs(s)||"(untitled finding)",l=r==="kanban",c={"kanban-card":!0,"has-conflict":o.hasConflict,"focus-side-card":!l,active:n};!o.hasConflict&&o.commonColor&&(c[`mark-${o.commonColor}`]=!0);let u=parseInt(s.line,10),p=Number.isFinite(u)?`:${u}`:"",f=ne(s,a.severityMode),h=pS[f]??"?",b=rr(s)&&a.severityMode!=="original",g=a.triage.get(D(s)),w=g?.flagged===!0,v=g?.fix??"",y=g?.comment??"",k=m;l&&v?k=Ut(v)?d`<a class="kanban-action kanban-fix-link" href="${v}" target="_blank" rel="noopener noreferrer" draggable="false" title="${`Open fix link: ${v}`}" aria-label="${`Open fix link: ${v}`}">${_s}</a>`:d`<button type="button" class="kanban-action mark-fix" title="${`Edit fix link: ${v}`}" aria-label="${`Edit fix link: ${v}`}">${_s}</button>`:l&&y&&(k=d`<button type="button" class="kanban-action mark-comment" title="${`Edit comment: ${y}`}" aria-label="${`Edit comment: ${y}`}">${Fa}</button>`);let S=d`<div class="kanban-badge-col"><span class="${`kanban-badge sev-${f}`}" title="${b?`${je(f)} \u2014 corrected from ${je(s.severity)}`:je(f)}" aria-label="${b?`Severity ${je(f)}, corrected from ${je(s.severity)}`:`Severity ${je(f)}`}">${h}${b?"*":""}</span> ${w?d`<span class="kanban-flag" title="Flagged" aria-label="Flagged">${Ba}</span>`:m} ${k}</div><span class="kanban-title">${i}</span><div class="kanban-meta"><span class="kanban-loc">${s.file}${p}</span> ${s.confidence===void 0||s.confidence===null?m:d`<span class="kanban-conf" title="${`Confidence ${s.confidence}/10`}">${s.confidence}</span>`}</div>`;return l?d`<div class="${T(c)}" data-gid="${Re(e)}" data-kanban-source draggable="true" role="button" tabindex="0" aria-current="${n?"true":"false"}" aria-label="${`Open details for ${i}`}">${S}</div>`:d`<div class="${T(c)}" data-gid="${Re(e)}" data-focus-select role="button" tabindex="0" aria-current="${n?"true":"false"}" aria-label="${`Focus on ${i}`}">${S}</div>`}function fS(e){let{content:t,line:r,highlighted:n}=e,o=t.split(`
106
+ `).length,s=String(o).length;return d`<div class="focus-code-lines" style="${ue({"--lineno-width":`${s}ch`})}"><aside class="focus-code-gutter" aria-hidden="true">${Array.from({length:o},(i,l)=>{let c=l+1;return d`<div class="${T({"focus-code-lineno":!0,"focus-code-line-active":c===r})}" data-focus-code-line="${c}">${c}</div>`})}</aside><pre class="focus-code-source"><code>${typeof n=="string"?ye(n):t}</code></pre></div>`}function hS(e){if(!e)return m;let t=ve(e),r={"kanban-detail-modal":!0,"has-conflict":t.hasConflict};return!t.hasConflict&&t.commonColor&&(r[`mark-${t.commonColor}`]=!0),d`<div class="kanban-detail-backdrop"><div class="kanban-detail-dim"></div><div class="${T(r)}" role="dialog" aria-modal="true"><button type="button" class="kanban-detail-close" title="Close details" aria-label="Close details">×</button><div class="kanban-detail-body">${Ds(e,!1,"kanban-detail")}</div></div></div>`}function mS(e){if(a.viewMode==="table"){let r=a.sortBy==="file"?Bu(e,Ey):e;if(r.length===0)return m;let n=a.tableSelectedGid?r.find(s=>Re(s)===a.tableSelectedGid):null;return Ya=r,d`<div class="${n?"findings-table-layout open":"findings-table-layout"}"><div class="findings-table-list"><div class="finding-table-slot"></div></div>${n?d`<aside class="findings-table-details" id="findings-table-details"><header class="findings-table-details-bar"><span class="findings-table-details-label">Details</span> <button type="button" class="findings-table-details-close" data-table-deselect title="Close details" aria-label="Close details">×</button></header><div class="findings-table-details-body">${Ds(n)}</div></aside>`:m}</div>`}if(a.viewMode==="focus"){if(e.length===0)return m;let r=a.focusGid?e.findIndex(c=>Re(c)===a.focusGid):-1;r<0&&(r=Math.min(Ay,e.length-1),r<0&&(r=0)),Ay=r;let n=e[r];a.focusCodeTick;let o=$y(n),s=o?"focus-main with-code":"focus-main",i=r===0,l=r===e.length-1;return d`<div class="focus-view"><div class="${s}"><div class="focus-pane focus-pane-card"><div class="focus-card-wrapper">${Ds(n,!1,"focus")}</div></div>${o?d`<div class="focus-pane focus-pane-code">${o.loading?d`<div class="focus-code-empty">Loading source…</div>`:d`<header class="focus-code-bar" title="${o.file}"><span class="focus-code-file">${o.file}</span> ${o.line?d`<span class="focus-code-line">:${o.line}</span>`:m}</header><div class="focus-code-body">${fS(o)}</div>`}</div>`:m}</div><aside class="focus-sidebar" aria-label="Up next"><div class="focus-sidebar-header"><span class="label">Up next</span><div class="focus-nav"><button type="button" class="focus-nav-btn" data-focus-nav="prev" ?disabled="${i}" title="Previous finding (←)" aria-label="Previous finding"><svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 3 5 8l5 5"/></svg></button> <span class="count">${r+1} / ${e.length}</span> <button type="button" class="focus-nav-btn" data-focus-nav="next" ?disabled="${l}" title="Next finding (→)" aria-label="Next finding"><svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 3 11 8l-5 5"/></svg></button></div></div><div class="focus-sidebar-body">${Q(e,c=>Re(c),c=>Ty(c,{variant:"focus",active:Re(c)===Re(n)}))}</div></aside></div>`}if(a.viewMode==="kanban"){let r=[{key:"untriaged",label:"Untriaged",target:"untriaged"},{key:"inprogress",label:"In progress",target:"inprogress"},{key:"fixed",label:"Fixed",target:"fixed"},{key:"invalid",label:"Invalid",target:"invalid"},{key:"deleted",label:"Deleted",target:"deleted"},{key:"ignored",label:"Ignored",target:"ignored"}],n=new Map(r.map(c=>[c.key,[]]));for(let c of e){let p=ve(c).commonTriage??"untriaged",f=n.get(p);f&&f.push(c)}let o=r.some(c=>c.key===a.kanbanExpandedColumn)?a.kanbanExpandedColumn:null,s=o?r.filter(c=>c.key===o):r,i={"--kanban-cols":String(r.length)},l=a.kanbanPopoverGid?e.find(c=>Re(c)===a.kanbanPopoverGid):null;return d`<div class="kanban-board" style="${ue(i)}">${Q(s,c=>c.key,c=>{let u=n.get(c.key),p=c.key===o;return d`<div class="${`kanban-column kanban-column-${c.key}${p?" expanded":""}`}" data-kanban-target="${c.target}"><div class="kanban-column-header"><span class="label">${c.label}</span> <span class="count">${u.length}</span> <button type="button" class="kanban-expand" data-kanban-expand="${c.key}" aria-pressed="${p}" title="${p?"Show all columns":`Show only ${c.label}`}" aria-label="${p?"Show all columns":`Show only ${c.label}`}">${p?uS:dS}</button></div><div class="kanban-column-body">${u.length===0?d`<div class="kanban-empty">No ${c.label.toLowerCase()} findings.</div>`:Q(u,f=>Re(f),f=>Ty(f,{active:Re(f)===a.kanbanPopoverGid}))}</div></div>`})}</div>${hS(l)}`}if(a.viewMode==="grouped"){let r=new Map;for(let o of e){let s=hn(o).file;r.has(s)||r.set(s,[]),r.get(s).push(o)}let n=a.sortBy==="file"?[...r.keys()].toSorted():[...r.keys()];return d`${Q(n,o=>o,o=>{let s=a.sortBy==="file"?Bu(r.get(o),(l,c)=>parseInt(l.line,10)-parseInt(c.line,10)):r.get(o),i=hn(s[0]);return d`<div class="file-group"><div class="file-header"><span>${Wd(i,Ht(i))}</span> <span class="count">${s.length}</span></div><div class="file-body">${Q(s,l=>Zn(l),l=>Ds(l))}</div></div>`})}`}let t=a.sortBy==="file"?Bu(e,Ey):e;return d`${Q(t,r=>Zn(r),r=>{let n=ze(r),o=Mg(n,Ht(n)),s=un(n),i=dn(n),l=r.length>1;return d`<div class="${T({"flat-group":!0,"multi-case":l})}"><div class="flat-group-loc"><span class="file">${Wd(n,Ht(n))}</span> ${o===m?m:d`<span class="line-num">${o}</span>`} ${i?d`<span class="meta">${i}</span>`:m} ${s?d`<span class="run-meta">${s}</span>`:m}</div>${Ds(r,!0)}</div>`})}`}function gS(){let e=document.querySelector("#bundle-source-overlay-slot");e&&J(fy(),e)}var Ry=null;function x(){let e=Ry;if(Ry=a.currentView,e!==null&&e!==a.currentView&&typeof document.startViewTransition=="function"&&!matchMedia("(prefers-reduced-motion: reduce)").matches){document.startViewTransition(()=>Iy());return}Iy()}function Iy(){if(gS(),kg(a.reports),a.currentView==="bundles")if((a.bundles??[]).length===0)a.currentView="findings";else{let $=document.querySelector("#bundles-slot");if((!$||!C.contains($)||C.firstElementChild!==$)&&(C.innerHTML='<div id="bundles-slot"></div>',$=document.querySelector("#bundles-slot")),$&&J(gy(a.bundles),$),a.selectedBundle&&a.bundleDetailsTab==="graph"&&a.bundleDetails&&(a.bundleDetails.json||a.bundleDetails.bundle)){let L=document.querySelector("#bundle-graph-slot");if(L){let he=uy(a.bundleDetails);if(he){py(he);let Qs={hideAllFiles:!0,triageCounts:dy(a.bundleDetails),triageStates:["inprogress","fixed","invalid","deleted"],showSplitOwnDirs:he.canSplitOwnDirs,showPackagesView:he.canPackagesView};iu(L,he,Qs,qa,Ga)}}}if(a.selectedBundle&&a.bundleDetailsTab==="terminal"&&a.bundleDetails&&(a.bundleDetails.json||a.bundleDetails.bundle)){let L=document.querySelector("#bundle-terminal-slot");L&&lb(L,a.bundleDetails)}C.classList.add("active"),ge.classList.add("hidden"),document.title="DeepView \u2014 bundles";return}if(a.currentView==="packages"){let $=document.querySelector("#packages-slot");(!$||!C.contains($)||C.firstElementChild!==$)&&(C.innerHTML='<div id="packages-slot"></div>',$=document.querySelector("#packages-slot")),$&&J(by(),$),C.classList.add("active"),ge.classList.add("hidden"),document.title="DeepView \u2014 packages";return}if(a.currentView==="repositories"){let $=document.querySelector("#repositories-slot");(!$||!C.contains($)||C.firstElementChild!==$)&&(C.innerHTML='<div id="repositories-slot"></div>',$=document.querySelector("#repositories-slot")),$&&J(wy(),$),C.classList.add("active"),ge.classList.add("hidden"),document.title="DeepView \u2014 repositories";return}if(a.currentView==="admin-users"){let $=document.querySelector("#admin-users-slot");(!$||!C.contains($)||C.firstElementChild!==$)&&(C.innerHTML='<div id="admin-users-slot"></div>',$=document.querySelector("#admin-users-slot")),$&&!$.firstElementChild&&$.append(document.createElement("managed-admin-users")),C.classList.add("active"),ge.classList.add("hidden"),document.title="DeepView \u2014 users";return}if(a.currentView==="manage-repos"){let $=document.querySelector("#manage-repos-slot");(!$||!C.contains($)||C.firstElementChild!==$)&&(C.innerHTML='<div id="manage-repos-slot"></div>',$=document.querySelector("#manage-repos-slot")),$&&!$.firstElementChild&&$.append(document.createElement("managed-admin-repos")),C.classList.add("active"),ge.classList.add("hidden"),document.title="DeepView \u2014 repositories";return}if(a.currentView==="manage-reports"){let $=document.querySelector("#manage-reports-slot");(!$||!C.contains($)||C.firstElementChild!==$)&&(C.innerHTML='<div id="manage-reports-slot"></div>',$=document.querySelector("#manage-reports-slot")),$&&!$.firstElementChild&&$.append(document.createElement("managed-admin-reports")),C.classList.add("active"),ge.classList.add("hidden"),document.title="DeepView \u2014 reports";return}if(a.currentView==="manage-bundles"){let $=document.querySelector("#manage-bundles-slot");(!$||!C.contains($)||C.firstElementChild!==$)&&(C.innerHTML='<div id="manage-bundles-slot"></div>',$=document.querySelector("#manage-bundles-slot")),$&&!$.firstElementChild&&$.append(document.createElement("managed-admin-bundles")),C.classList.add("active"),ge.classList.add("hidden"),document.title="DeepView \u2014 bundles";return}if(a.currentView==="manage-teams"){let $=document.querySelector("#manage-teams-slot");(!$||!C.contains($)||C.firstElementChild!==$)&&(C.innerHTML='<div id="manage-teams-slot"></div>',$=document.querySelector("#manage-teams-slot")),$&&!$.firstElementChild&&$.append(document.createElement("managed-admin-teams")),C.classList.add("active"),ge.classList.add("hidden"),document.title="DeepView \u2014 teams";return}if(a.reports.length===0)return;let e=St(),t=a.viewMode==="kanban",r={inprogress:0,fixed:0,invalid:0,deleted:0,ignored:0},n=[];for(let $ of e){let L=ve($).commonTriage;L&&r[L]++,(t||L===a.shownTriage)&&n.push($)}let o=!1,s=!1,i=!1,l=!1,c=new Set;for(let $ of e)for(let L of $){rr(L)&&(l=!0);let he=mt(L);he&&c.add(he);let me=a.triage.get(D(L));me&&(me.comment&&(o=!0),me.fix&&(s=!0),me.flagged===!0&&(i=!0))}let p=[...new Set(a.reports.map($=>$.type))].join(", "),f=a.reports.map($=>$.fileName),h={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0},b={red:0,blue:0,green:0,gray:0,none:0};for(let $ of n){if($.length===1){let me=$[0],Qs=ne(me,a.severityMode);h[Qs]=(h[Qs]||0)+1;let cf=a.triage.get(D(me))?.color??"none";b[cf]=(b[cf]||0)+1;continue}let L=new Set($.map(me=>ne(me,a.severityMode)));for(let me of L)h[me]=(h[me]||0)+1;let he=new Set($.map(me=>a.triage.get(D(me))?.color??"none"));for(let me of he)b[me]=(b[me]||0)+1}let g=n.length>0&&n.every($=>$.every(L=>L.confidence!==void 0||L.critical===!0)),w=e.some($=>$.some(L=>L.priority!==void 0)),v=e.some($=>$.some(L=>Tr(L.file))),y=!1,k=!1,S;e:for(let $ of e)for(let L of $)if(!k)k=!0,S=L.file;else if(L.file!==S){y=!0;break e}let M=e.some($=>$.some(L=>!L.repo?.github&&!Tr(L.file))),_=new Set;for(let $ of e)for(let L of $)!Tr(L.file)&&L.repo?.github&&_.add(L.repo.github);let R=_.size===1?[..._][0]:null,O=new Set,B=new Set;for(let $ of e)for(let L of $)O.add(L._analyzer??null),B.add(ks(L));let V=Object.keys(Qd),le=[...O].toSorted(($,L)=>{let he=$==null?1/0:V.indexOf($)===-1?V.length:V.indexOf($),me=L==null?1/0:V.indexOf(L)===-1?V.length:V.indexOf(L);return he!==me?he-me:String($??"").localeCompare(String(L??""))}),Y=[...B].toSorted(($,L)=>$==null&&L==null?0:$==null?1:L==null?-1:$.localeCompare(L));if(a.filterAnalyzer){let $=a.filterAnalyzer===Rr?null:a.filterAnalyzer;(!O.has($)||O.size<2)&&(a.filterAnalyzer="")}if(a.filterModel){let $=a.filterModel===Ir?null:a.filterModel;(!B.has($)||B.size<2)&&(a.filterModel="")}let qe=new Set;for(let $ of e)for(let L of $)qe.add(Yd(L));let et=[...qe].toSorted(($,L)=>$==null&&L==null?0:$==null?1:L==null?-1:$.localeCompare(L));if(a.filterRepo){let $=a.filterRepo===fn?null:a.filterRepo;qe.has($)||(a.filterRepo="")}let lt=bg(c);a.filterRevalidate&&!lt.some($=>$.value===a.filterRevalidate)&&(a.filterRevalidate="");let gl=c.has("partial");gl||(a.filterPartial=""),!v&&a.filterSources.size>0&&a.filterSources.clear(),g||(a.filterConfMin=0,a.filterConfMax=10,(a.sortBy==="confidence-desc"||a.sortBy==="confidence-asc")&&(a.sortBy="severity")),!w&&(a.sortBy==="priority-desc"||a.sortBy==="priority-asc")&&(a.sortBy="severity"),!y&&a.sortBy==="file"&&(a.sortBy="severity");let ir=Ug(Mr(n)),ar=ou(a.reports),Vr=ar?Object.keys(ar).length:0,lr=Vr>1;!lr&&a.currentView==="files"&&(a.currentView="findings"),!lr&&a.viewMode==="graph"&&(a.viewMode="table");let $n=nS(e,f,M,R,Vr);if(a.currentView==="files"){let $=nu(e,a.severityMode),L=document.querySelector("#header-slot"),he=document.querySelector("#tree-view-slot");(!L||!he||!C.contains(L)||!C.contains(he))&&(C.innerHTML='<div id="header-slot"></div><div id="tree-view-slot"></div>',L=document.querySelector("#header-slot"),he=document.querySelector("#tree-view-slot")),L&&J($n,L),he&&J(sb(ar,$),he),C.classList.add("active"),ge.classList.add("hidden"),document.title=`DeepView \u2014 ${p||"no analyzer"}`;return}let of=a.viewMode==="table"&&a.tableSelectedGid&&ir.some($=>Re($)===a.tableSelectedGid),cr=null;a.viewMode==="graph"&&ar&&(cr=Lu(),cr||(a.viewMode="table"));let dr=!!cr,Et="findings-content";of&&(Et+=" with-details"),dr&&(Et+=" with-graph"),t&&(Et+=" with-kanban"),a.viewMode==="focus"&&(Et+=" with-focus");let E=m,P=m,W=m;Ya=null,Ja.clear(),dr||(E=cS(ir.length,n.length,r,h,b,{showSource:v,showConfidence:g,showPriority:w,showGraphMode:lr,showFileSort:y,kanbanMode:t,showRepo:!!a.currentWorkspace,hasComment:o,revalidateOptions:lt,hasPartialKind:gl,hasFix:s,hasFlagged:i,showSeverityMode:l||a.severityMode==="original"},{analyzers:le,models:Y,groups:n},et),a.shownTriage&&n.length===0?P=d`<p style="color:var(--muted);margin:1rem 0">No ${a.shownTriage} findings.</p>`:ir.length===0&&n.length>0&&!t?P=d`<p style="color:var(--muted);margin:1rem 0">No findings match the current filters.</p>`:n.length===0&&(P=e.length>0?d`<p style="color:var(--green)">All ${p} issues triaged.</p>`:d`<p style="color:var(--green)">No ${p} issues found.</p>`),W=mS(ir));let G=document.querySelector("#header-slot"),oe=C.querySelector(":scope > .findings-content"),Ce=oe&&oe.querySelector(":scope > #findings-graph-slot"),ct=oe&&oe.querySelector(":scope > #findings-body-slot"),Aw=oe&&(Ce?"graph":ct?"body":null)===(dr?"graph":"body");if(!G||!oe||!C.contains(G)||!C.contains(oe)||!Aw){let $=dr?'<div id="findings-graph-slot"></div>':'<div id="toolbar-slot"></div><div id="empty-state-slot"></div><div id="findings-body-slot"></div>';C.innerHTML=`<div id="header-slot"></div><div class="${Et}">${$}</div>`,G=document.querySelector("#header-slot"),oe=C.querySelector(":scope > .findings-content")}else oe.className!==Et&&(oe.className=Et);G&&J($n,G);let sf=document.querySelector("#toolbar-slot");sf&&J(E,sf);let af=document.querySelector("#empty-state-slot");af&&J(P,af);let lf=document.querySelector("#findings-body-slot");if(lf&&J(W,lf),cr){let $=document.querySelector("#findings-graph-slot");if($){let he={extraTopRow:d`<view-mode-buttons modes="table,list,grouped,focus,kanban,graph"></view-mode-buttons>`,triageCounts:r,triageStates:["inprogress","fixed","invalid","deleted","ignored"]};iu($,cr.prep,he,Ou,Pu)}}if(Ya){let $=C.querySelector(".finding-table-slot");$&&(uo||(uo=document.createElement("finding-table")),uo.items=Ya,uo.selectedGid=a.tableSelectedGid,uo.parentNode!==$&&$.append(uo))}if(Ja.size>0)for(let $ of C.querySelectorAll("finding-card")){let L=Ja.get($.dataset.gid);L&&($.group=L.group)}C.classList.add("active"),ge.classList.add("hidden"),document.title=`DeepView \u2014 ${p||"no analyzer"}`}var Nu=class extends I{static styles=[...I.styles,F(ht)];static properties={workspace:{attribute:!1},_password:{state:!0},_confirm:{state:!0},_noPassword:{state:!0},_includeBundleBytes:{state:!0},_busy:{state:!0},_error:{state:!0},_settled:{state:!0}};constructor(){super(),this.workspace=null,this._password="",this._confirm="",this._noPassword=!1,this._includeBundleBytes=!1,this._busy=!1,this._error="",this._settled=!1}_finish(t){this._settled||(this._password="",this._confirm="",this.workspace=null,super._finish(t))}_onClose=()=>this._finish(null);_onCancel=()=>this._finish(null);_onPasswordInput=t=>{this._password=t.target.value,this._error=""};_onConfirmInput=t=>{this._confirm=t.target.value,this._error=""};_onNoPasswordToggle=t=>{this._noPassword=t.target.checked,this._error="",this._noPassword&&(this._password="",this._confirm="")};_onIncludeBundleBytesToggle=t=>{this._includeBundleBytes=t.target.checked,this._error=""};_canExport(){return this._busy?!1:this._noPassword?!0:(this._password??"").length>0&&this._password===this._confirm}_onExport=async()=>{if(this._canExport()){if(!this.workspace){this._error="No workspace selected.";return}this._busy=!0,this._error="";try{let{blob:t,filename:r}=await vd(this.workspace,{password:this._noPassword?void 0:this._password,includeBundleBytes:this._includeBundleBytes});if(this._settled)return;Kt(t,r),this._finish({ok:!0})}catch(t){if(this._settled)return;this._error=t?.message??String(t)}finally{this._busy=!1}}};_onKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._onExport())};_body(){let t=!this._password||!this._confirm||this._password===this._confirm,r=Array.isArray(this.workspace?.bundles)?this.workspace.bundles.length:0;return d`<p class="nwd-note">The export file carries this workspace's reports, triage state, comments, fixes, references to attached bundles (integrities only by default), and its private key. Encrypting the file with a password ensures only those with the password can attach the workspace after download.</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-export-pw" maxlength="1024" ?disabled="${this._noPassword}" .value="${this._password}" @input="${this._onPasswordInput}" @keydown="${this._onKeydown}"></label> <label class="wsl-field"><span>Confirm 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-export-pw-confirm" maxlength="1024" ?disabled="${this._noPassword}" .value="${this._confirm}" @input="${this._onConfirmInput}" @keydown="${this._onKeydown}"></label> <label class="wsl-optout"><input type="checkbox" .checked="${this._noPassword}" @change="${this._onNoPasswordToggle}"> <span>Export without password (not recommended)</span></label> ${r>0?d`<label class="wsl-optout"><input type="checkbox" .checked="${this._includeBundleBytes}" @change="${this._onIncludeBundleBytesToggle}"> <span>Include bundle bytes (${r} bundle${r===1?"":"s"}; significantly larger file)</span></label>`:m} ${this._noPassword?d`<p class="wsl-error wsl-warning">Anyone who obtains this file can attach the workspace and read every report, triage decision, comment, and fix. Only opt out when you control where the file goes.</p>`:m} ${this._error?d`<p class="wsl-error" role="alert">${this._error}</p>`:m} ${!this._noPassword&&!t?d`<p class="wsl-error" role="alert">Passwords don't match.</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._canExport()}" @click="${this._onExport}">${this._busy?"Exporting\u2026":this._noPassword?"Export without password":"Export"}</button></footer>`}render(){return d`<dialog @close="${this._onClose}"><header><h3>Export workspace</h3></header>${this._body()}</dialog>`}};customElements.define("workspace-export-dialog",Nu);function By({workspace:e}={}){return new Promise((t,r)=>{let n=document.createElement("workspace-export-dialog");n.workspace=e??null,n.addEventListener("resolve",o=>{n.remove(),t(o.detail)}),n.addEventListener("modal-conflict",o=>{n.workspace=null,n.remove(),r(Tt(o.detail?.cause))}),document.body.append(n)})}async function Ly(e){await By({workspace:e})}var Du=class extends I{static properties={_value:{state:!0}};constructor(){super(),this._value=""}_onInput=t=>{this._value=t.target.value};_onCreate=()=>{let t=(this._value??"").trim();t&&this._finish(t)};_onCancel=()=>this._finish(null);_onKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._onCreate())};render(){let t=(this._value??"").trim().length>0;return d`<dialog @close="${this._onClose}"><header><h3>New workspace</h3></header><input type="text" class="nwd-input" placeholder="Workspace name" maxlength="200" .value="${this._value}" @input="${this._onInput}" @keydown="${this._onKeydown}"><p class="nwd-note">Workspace triage is synchronized by default over an end-to-end encrypted channel. Triage on unattached reports stays local to this browser.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!t}" @click="${this._onCreate}">Create</button></footer></dialog>`}};customElements.define("new-workspace-dialog",Du);function Oy(){return te("new-workspace-dialog")}var zu=class extends I{static styles=[...I.styles,F(_e)];static properties={workspaceName:{type:String},reportCount:{type:Number},bundleCount:{type:Number},orphanedTriage:{type:Number},sharedTriage:{type:Number},_mode:{state:!0},_triage:{state:!0},_settled:{state:!0}};constructor(){super(),this.workspaceName="",this.reportCount=0,this.bundleCount=0,this.orphanedTriage=0,this.sharedTriage=0,this._mode="detach",this._triage="keep",this._settled=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(t){if(this._settled)return;let r=this.reportCount>0?this._mode:"detach",n=r==="delete"&&this.orphanedTriage>0?this._triage:"keep";super._finish({confirmed:!!t,mode:r,triage:n})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);_onModeChange=t=>{this._mode=t.target.value};_onTriageChange=t=>{this._triage=t.target.value};_triageSection(){if(this._mode!=="delete"||this.reportCount===0)return"";let t=this.orphanedTriage,r=this.sharedTriage;return t===0&&r===0?d`<p class="lwd-note">No local triage is attached to ${this.reportCount===1?"this report":"these reports"}.</p>`:t===0?d`<p class="lwd-note">Local triage on ${this.reportCount===1?"this report":"these reports"} is also attached to ${r===1?"a report":"reports"} you're keeping. Nothing will be orphaned.</p>`:d`<fieldset class="lwd-choice"><legend><strong>${t}</strong> ${t===1?"triage entry won't":"triage entries won't"} be reachable from any remaining report. What should happen ${t===1?"to it":"to them"}?</legend><label class="lwd-option"><input type="radio" name="lwd-triage" value="keep" ?checked="${this._triage==="keep"}" @change="${this._onTriageChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Keep</span> <span class="lwd-option-hint">Reapplied automatically if a matching report is imported later.</span></span></label> <label class="lwd-option"><input type="radio" name="lwd-triage" value="wipe" ?checked="${this._triage==="wipe"}" @change="${this._onTriageChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Wipe</span> <span class="lwd-option-hint">Drop the orphaned triage from this browser.</span></span></label></fieldset>`}render(){let t=this.reportCount,r=this.bundleCount,n=t>0,o=t===1?"report":"reports",s=t===1?"it":"them",i=t===1?"stays":"stay",l=t===1?"is removed":"are removed",c=r>0?d`<p class="lwd-note">${r===1?"One bundle is":`${r} bundles are`} also attached. ${r===1?"It":"They"} will become unfiled — the bundle bytes stay on this device either way (delete bundles manually from the Bundles list if you want them gone).</p>`:"",u=n?d`<fieldset class="lwd-choice"><legend>What should happen to the <strong>${t}</strong> attached ${o}?</legend><label class="lwd-option"><input type="radio" name="lwd-mode" value="detach" ?checked="${this._mode==="detach"}" @change="${this._onModeChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Move ${s} out of the workspace</span> <span class="lwd-option-hint">The ${o} ${i} in this browser as unattached ${o}.</span></span></label> <label class="lwd-option"><input type="radio" name="lwd-mode" value="delete" ?checked="${this._mode==="delete"}" @change="${this._onModeChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Delete ${s} along with the workspace</span> <span class="lwd-option-hint">The ${o} ${l} from this browser.</span></span></label></fieldset>`:r>0?d`<p class="lwd-empty">No reports are attached to this workspace (only bundles, see below).</p>`:d`<p class="lwd-empty">No reports are attached to this workspace.</p>`;return d`<dialog @close="${this._onClose}"><header><h3>Leave workspace</h3></header><p class="lwd-body">Leave workspace <strong>"${this.workspaceName}"</strong> on this device?</p>${u} ${c} ${this._triageSection()}<ul class="lwd-list"><li>Workspace synchronization data stays on the sync server — peers (and your other devices) keep their copy.</li></ul><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="danger" @click="${this._onConfirm}">Leave</button></footer></dialog>`}};customElements.define("leave-workspace-dialog",zu);function Py({name:e,reportCount:t,bundleCount:r,triageImpact:n}={}){return te("leave-workspace-dialog",{workspaceName:e??"",reportCount:t??0,bundleCount:r??0,orphanedTriage:n?.orphanedCount??0,sharedTriage:n?.sharedCount??0})}var Uu=class extends I{static styles=[...I.styles,F(ht)];static properties={workspaceId:{type:String},initialName:{type:String},privateKeyBase64:{type:String},_name:{state:!0},_password:{state:!0},_confirm:{state:!0},_url:{state:!0},_busy:{state:!0},_error:{state:!0},_copied:{state:!0},_settled:{state:!0}};constructor(){super(),this.workspaceId="",this.initialName="",this.privateKeyBase64="",this._name="",this._password="",this._confirm="",this._url="",this._busy=!1,this._error="",this._copied=!1,this._settled=!1}beforeOpen(){this._name=this.initialName}focusInitial(){this.renderRoot.querySelector('input[data-role="name"]')?.focus()}_finish(){this._settled||(this._copiedTimer&&(clearTimeout(this._copiedTimer),this._copiedTimer=null),this._password="",this._confirm="",this._url="",this.privateKeyBase64="",super._finish(null))}_onClose=()=>this._finish();_onCancel=()=>this._finish();_onNameInput=t=>{this._name=t.target.value};_onPasswordInput=t=>{this._password=t.target.value,this._error=""};_onConfirmInput=t=>{this._confirm=t.target.value,this._error=""};_canGenerate(){return(this._name??"").trim().length>0&&(this._password??"").length>0&&this._password===this._confirm&&!this._busy}_onGenerate=async()=>{if(this._canGenerate()){this._busy=!0,this._error="";try{let t=await $d({id:this.workspaceId,name:this._name.trim(),privateKeyBase64:this.privateKeyBase64,password:this._password});if(this._settled)return;this._url=_d(t),this._password="",this._confirm=""}catch(t){if(this._settled)return;this._error=t?.message??String(t)}finally{this._busy=!1}}};_onCopy=async()=>{if(this._url){this._error="";try{if(await navigator.clipboard.writeText(this._url),this._settled)return;this._copied=!0,this._copiedTimer&&clearTimeout(this._copiedTimer),this._copiedTimer=setTimeout(()=>{this._copied=!1,this._copiedTimer=null},1500)}catch{if(this._settled)return;this._error="Copy failed \u2014 select the link and copy it manually."}}};_onKeydown=t=>{t.key==="Enter"&&!this._url&&(t.preventDefault(),this._onGenerate())};_body(){return this._url?d`<p class="nwd-note">Anyone with the link <strong>and</strong> the password can attach this workspace. Share them through separate channels.</p><label class="wsl-field"><span>Share link</span> <textarea class="wsl-link" readonly="readonly" rows="3" @focus="${t=>t.target.select()}">${this._url}</textarea></label> ${this._error?d`<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}">Close</button> <button type="button" class="primary" @click="${this._onCopy}">${this._copied?"Copied":"Copy link"}</button></footer>`:d`<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> <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-pw" maxlength="1024" .value="${this._password}" @input="${this._onPasswordInput}" @keydown="${this._onKeydown}"></label> <label class="wsl-field"><span>Confirm 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-pw-confirm" maxlength="1024" .value="${this._confirm}" @input="${this._onConfirmInput}" @keydown="${this._onKeydown}"></label><p class="nwd-note">The link carries the workspace's identity (id, name, and private key) so the recipient joins the same sync chain. Triage, reports, and comments aren't in the link itself — they sync over once the recipient joins. The link decrypts with the password above; without it the link is useless.</p>${this._error?d`<p class="wsl-error" role="alert">${this._error}</p>`:m} ${this._password&&this._confirm&&this._password!==this._confirm?d`<p class="wsl-error" role="alert">Passwords don't match.</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._canGenerate()}" @click="${this._onGenerate}">${this._busy?"Generating\u2026":"Generate link"}</button></footer>`}render(){return d`<dialog @close="${this._onClose}"><header><h3>${this._url?"Workspace share link":"Share workspace by link"}</h3></header>${this._body()}</dialog>`}};customElements.define("workspace-share-link-dialog",Uu);function Ny({id:e,name:t,privateKeyBase64:r}={}){return new Promise((n,o)=>{let s=document.createElement("workspace-share-link-dialog");s.workspaceId=e??"",s.initialName=t??"",s.privateKeyBase64=r??"",s.addEventListener("resolve",()=>{s.remove(),n()}),s.addEventListener("modal-conflict",i=>{s.privateKeyBase64="",s.remove(),o(Tt(i.detail?.cause))}),document.body.append(s)})}var Hu=class extends I{static styles=[...I.styles,F(_e)];static properties={reportName:{type:String},orphanedTriage:{type:Number},sharedTriage:{type:Number},inRemote:{type:Boolean},_triage:{state:!0}};constructor(){super(),this.reportName="",this.orphanedTriage=0,this.sharedTriage=0,this.inRemote=!1,this._triage="keep"}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(t){if(this._settled)return;let r=this.orphanedTriage>0?this._triage:"keep";super._finish({confirmed:!!t,triage:r})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);_onTriageChange=t=>{this._triage=t.target.value};_remoteNotice(){return this.inRemote?d`<p class="lwd-note">This report is also stored in the workspace's <strong>remote</strong> inventory and will be removed from there too. Newly synced workspace members won't see it; members who already downloaded it keep their local copy (and could re-upload).</p>`:m}_triageSection(){let t=this.orphanedTriage,r=this.sharedTriage;return t===0&&r===0?d`<p class="lwd-note">No local triage is attached to this report.</p>`:t===0?d`<p class="lwd-note">Local triage on this report is also attached to ${r===1?"a report":"reports"} you're keeping. Nothing will be orphaned.</p>`:d`<fieldset class="lwd-choice"><legend><strong>${t}</strong> ${t===1?"triage entry won't":"triage entries won't"} be reachable from any remaining report. What should happen ${t===1?"to it":"to them"}?</legend><label class="lwd-option"><input type="radio" name="drd-triage" value="keep" ?checked="${this._triage==="keep"}" @change="${this._onTriageChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Keep</span> <span class="lwd-option-hint">Reapplied automatically if a matching report is imported later.</span></span></label> <label class="lwd-option"><input type="radio" name="drd-triage" value="wipe" ?checked="${this._triage==="wipe"}" @change="${this._onTriageChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Wipe</span> <span class="lwd-option-hint">Drop the orphaned triage from this browser.</span></span></label></fieldset>`}render(){return d`<dialog @close="${this._onClose}"><header><h3>Delete report</h3></header><p class="lwd-body">Delete <strong>"${this.reportName}"</strong>?</p>${this._remoteNotice()} ${this._triageSection()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="danger" @click="${this._onConfirm}">Delete</button></footer></dialog>`}};customElements.define("delete-report-dialog",Hu);function Dy({name:e,triageImpact:t,inRemote:r}={}){return te("delete-report-dialog",{reportName:e??"",orphanedTriage:t?.orphanedCount??0,sharedTriage:t?.sharedCount??0,inRemote:!!r})}var Vu=class extends I{static styles=[...I.styles,F(_e)];static properties={bundleName:{type:String},inRemote:{type:Boolean}};constructor(){super(),this.bundleName="",this.inRemote=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(t){this._settled||super._finish({confirmed:!!t})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);_remoteNotice(){return this.inRemote?d`<p class="lwd-note">This bundle is also stored in the workspace's <strong>remote</strong> inventory and will be removed from there too. Newly synced workspace members won't see it; members who already downloaded it keep their local copy (and could re-upload).</p>`:m}render(){return d`<dialog @close="${this._onClose}"><header><h3>Delete bundle</h3></header><p class="lwd-body">Delete <strong>"${this.bundleName}"</strong>?</p>${this._remoteNotice()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="danger" @click="${this._onConfirm}">Delete</button></footer></dialog>`}};customElements.define("delete-bundle-dialog",Vu);function zy({name:e,inRemote:t}={}){return te("delete-bundle-dialog",{bundleName:e??"",inRemote:!!t})}var ju=class extends I{static styles=[...I.styles,F(_e)];static properties={bundleName:{type:String},workspaceName:{type:String}};constructor(){super(),this.bundleName="",this.workspaceName=""}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(t){this._settled||super._finish({confirmed:!!t})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);render(){return d`<dialog @close="${this._onClose}"><header><h3>Detach bundle</h3></header><p class="lwd-body">Detach <strong>"${this.bundleName}"</strong> from workspace <strong>"${this.workspaceName}"</strong>?</p><p class="lwd-note">This bundle is also stored in the workspace's <strong>remote</strong> inventory and will be removed from there too. Newly synced workspace members won't see it; members who already downloaded it keep their local copy (and could re-upload). The bundle bytes stay on this device — drop it onto another workspace to attach it there.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="danger" @click="${this._onConfirm}">Detach</button></footer></dialog>`}};customElements.define("detach-bundle-dialog",ju);function Uy({name:e,workspaceName:t}={}){return te("detach-bundle-dialog",{bundleName:e??"",workspaceName:t??""})}var Wu=class extends I{static styles=[...I.styles,F(_e)];static properties={reportName:{type:String},workspaceName:{type:String}};constructor(){super(),this.reportName="",this.workspaceName=""}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(t){this._settled||super._finish({confirmed:!!t})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);render(){return d`<dialog @close="${this._onClose}"><header><h3>Detach report</h3></header><p class="lwd-body">Detach <strong>"${this.reportName}"</strong> from workspace <strong>"${this.workspaceName}"</strong>?</p><p class="lwd-note">This report is also stored in the workspace's <strong>remote</strong> inventory and will be removed from there too. Newly synced workspace members won't see it; members who already downloaded it keep their local copy (and could re-upload). The report bytes stay on this device — drop it onto another workspace to attach it there.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="danger" @click="${this._onConfirm}">Detach</button></footer></dialog>`}};customElements.define("detach-report-dialog",Wu);function Hy({name:e,workspaceName:t}={}){return te("detach-report-dialog",{reportName:e??"",workspaceName:t??""})}var Ku=class extends I{focusInitial(){this.renderRoot.querySelector("button.primary")?.focus()}_onConfirm=()=>this._finish(!0);render(){return d`<dialog @close="${this._onClose}"><header><h3>Changes might not be saved</h3></header><p class="nwd-intro">Triage works in this tab, but this browser <strong>can't save its sync state right now</strong> — so changes that haven't reached the server could be lost if you reload the page.</p><p class="nwd-intro">This usually means the browser's storage is full, or another tab is running a newer version of the app (to avoid overwriting that newer version's data, this tab has paused saving).</p><p class="nwd-note">Free up space if storage is full, and close or reload other tabs of this app to the same version. This notice clears on its own once saving works again.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" class="primary" @click="${this._onConfirm}">Got it</button></footer></dialog>`}};customElements.define("persistence-degraded-dialog",Ku);function Vy(){return new Promise(e=>{let t=document.createElement("persistence-degraded-dialog"),r=n=>{t.remove(),e({shown:n})};t.addEventListener("resolve",()=>r(!0)),t.addEventListener("modal-conflict",()=>r(!1)),document.body.append(t)})}var qu=class extends I{focusInitial(){this.renderRoot.querySelector("button.primary")?.focus()}_onReload=()=>this._finish("reload");render(){return d`<dialog @close="${this._onClose}"><header><h3>Sign in to keep syncing</h3></header><p class="nwd-intro">Triage can't reach the sync server — the connection is being redirected to an <strong>authentication proxy</strong> (for example Cloudflare Access). This usually means your access session has expired.</p><p class="nwd-note">Reload the page to sign in again. Your triage is saved on this device, so reloading won't lose anything — or keep working offline and reload later.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onClose}">Not now</button> <button type="button" class="primary" @click="${this._onReload}">Reload page</button></footer></dialog>`}};customElements.define("proxy-auth-dialog",qu);function jy(){return new Promise(e=>{let t=document.createElement("proxy-auth-dialog"),r=(n,o)=>{t.remove(),e({shown:n,reload:o})};t.addEventListener("resolve",n=>r(!0,n.detail==="reload")),t.addEventListener("modal-conflict",()=>r(!1,!1)),document.body.append(t)})}var Dr;function bS(){return Dr||(Dr=document.createElement("div"),Dr.id="styled-tooltip",document.body.append(Dr),Dr)}var yn=null,zs=null,Gy=0,Yy=0,Wy=!1;function yS(){Wy||(Wy=!0,document.addEventListener("mousemove",e=>{Gy=e.clientX,Yy=e.clientY},{passive:!0}))}yS();var vS=100,wS=14,kS=8,Ky=8;function $S(e,{placement:t="cursor"}={}){let r=bS();if(yn===e)return;let n=e.dataset.tooltip??"";if(n){if(r.textContent=n,t==="right"){let o=e.getBoundingClientRect();r.style.top=`${Math.round(o.top+o.height/2)}px`,r.style.left=`${Math.round(o.right+kS)}px`,r.style.transform="translateY(-50%)"}else{r.style.transform="none",r.style.top=`${Yy+wS}px`,r.style.left="0px",r.classList.add("visible");let o=r.offsetWidth,s=window.innerWidth-o-Ky,i=Math.max(Ky,Math.min(Gy,s));r.style.left=`${Math.round(i)}px`}r.classList.add("visible"),yn=e}}function Us(){clearTimeout(zs),zs=null,Dr&&Dr.classList.remove("visible"),yn=null}function Gu(e,{gate:t,placement:r}={}){t&&!t(e)||(clearTimeout(zs),zs=setTimeout(()=>{$S(e,{placement:r})},vS))}var qy=!1;function Jy(){qy||(qy=!0,document.body.addEventListener("mouseover",e=>{let t=e.target.closest("[data-tooltip]");!t||t===yn||(Us(),Gu(t))}),document.body.addEventListener("mouseout",e=>{!yn&&!zs||yn&&yn.contains(e.relatedTarget)||Us()}))}var wn=null,X=null,Xa=null;Jy();function xS(){return Lt().size}function _S(){return nn().size}var Hs=typeof location>"u"||location.hostname.endsWith(".github.io")?"":`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/api/sync`,rp="application/x-deepview-report",Qu="application/x-deepview-source-ws",Vs="application/x-deepview-bundle",Qa=!1,Za=!1,SS={default:"Reports","claude-security":"Claude Security","codex-security":"Codex Security",deepsec:"DeepSec",piolium:"Piolium"},Xy=["default","claude-security","codex-security","deepsec","piolium"],vn="";function Qy(e,t={}){let n=`file-item${e===a.currentFile&&(a.currentView==="findings"||a.currentView==="files")?" current":""}${t.indented?" indented":""}`,o=De(e),s=Yo(e),i=se[st(e)]??se.default;return d`<li class="${n}" data-file="${e}" data-workspace-id="${t.workspaceId??m}" draggable="true"><button type="button" class="file-name" data-tooltip="${o}">${ye(i)}<span class="file-label">${o}</span>${s===void 0?m:d`<span class="file-count">${s}</span>`}</button></li>`}function tv(e,t={}){let r=`file-group-header${t.dropTarget?" default-reports":""}`;return d`<li class="${r}" data-default-reports="${t.dropTarget?"true":m}"><span class="group-label">${e}</span></li>`}var CS=d`<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M8 3.5v9M3.5 8h9"/></svg>`;function ES(){let e=a.serverMode==="managed"?m:d`<span class="workspace-header-actions"><button type="button" class="workspace-add" data-action="new-workspace" title="Create a new workspace" aria-label="Create a new workspace">${CS}</button></span>`;return d`<li class="file-group-header workspace-header"><span class="group-label">Workspaces</span>${e}</li>`}function AS(){if(a.serverMode!=="managed")return m;let e=Array.isArray(a.managedTeams)?a.managedTeams:[];return e.length===0?m:d`${tv("Teams")} ${Q(e,t=>t.id,t=>d`<li class="file-item team-item"><span class="team-name">${OS}<span class="team-label">${t.name}</span></span></li>${Q(Array.isArray(t.reports)?t.reports:[],r=>r.id,r=>TS(r))}`)}`}function TS(e){return d`<li class="file-item indented team-report-item"><button type="button" class="file-name" data-tooltip="${e.filename}" @click="${()=>{RS(e)}}">${ye(se.default)}<span class="file-label">${e.filename}</span></button></li>`}async function RS(e){let t=await Dm(e.id);if(t==null){console.warn("managed: could not load team report",e.id);return}await Ze(e.filename,t)}function IS(){return d`<li class="file-group-header bundles-header" data-default-bundles="true"><span class="group-label">Bundles</span></li>`}var MS=d`${ye(to)}`;function Zy(e,t={}){let{integrity:r,name:n}=e,o=a.selectedBundle===r&&a.currentView==="bundles",i=`file-item bundle-item${t.workspaceId!=null?" indented":""}${o?" current":""}`;return d`<li class="${i}" data-bundle-integrity="${r}" data-workspace-id="${t.workspaceId??m}" draggable="true"><button type="button" class="file-name" data-tooltip="${`${n}
107
+ ${r}`}">${MS}<span class="file-label">${n}</span></button></li>`}function FS(e,t){let r=e.slice(0,15);return d`<li class="file-item indented bundle-item bundle-missing" data-bundle-integrity="${e}" data-workspace-id="${t}" data-tooltip="Bundle bytes not on this device — drop the matching bundle to attach."><span class="file-name"><span class="file-icon" aria-hidden="true">?</span><span class="file-label"><em>missing · ${r}…</em></span></span></li>`}function BS(e,t){return d`<li class="file-item indented report-missing" data-workspace-id="${t}" data-tooltip="Report not on this device — it re-downloads automatically if a workspace member has uploaded it."><span class="file-name"><span class="file-icon" aria-hidden="true">?</span><span class="file-label"><em>missing · ${De(e)}</em></span></span></li>`}var LS=d`${ye(Oa)}`,OS=d`<svg class="team-icon" viewBox="0 0 16 16" width="13" height="13" fill="currentColor" aria-hidden="true"><path d="M5.5 8a2.25 2.25 0 1 0 0-4.5 2.25 2.25 0 0 0 0 4.5Zm0 1C3.2 9 1.75 10.2 1.75 11.6V13h7.5v-1.4C9.25 10.2 7.8 9 5.5 9Zm5.25-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm.25 1c-.43 0-.83.05-1.2.15.86.62 1.45 1.5 1.45 2.45V13h3.25v-1.3C14.5 10.1 13.15 9 11 9Z"/></svg>`,PS=d`<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2v8M5 7l3 3 3-3M3 13h10"/></svg>`,NS=d`<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 3H4v10h5"/><path d="M7 8h7M11 5l3 3-3 3"/></svg>`,DS=d`<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 9.5L9 7.5"/><path d="M9.5 5.5L10.5 4.5a2.1 2.1 0 1 1 3 3l-1 1"/><path d="M6.5 11.5L5.5 12.5a2.1 2.1 0 1 1-3-3l1-1"/></svg>`;function zS(e){let r=`file-item workspace-item${a.currentWorkspace===e.id&&(a.currentView==="findings"||a.currentView==="files")?" current":""}`;return d`<li class="${r}" data-workspace-id="${e.id}"><button type="button" class="file-name">${LS}<span class="file-label" .textContent="${e.name}"></span></button><button type="button" class="workspace-share" data-action="share-workspace" title="Share by link" aria-label="Share workspace by link">${DS}</button><button type="button" class="workspace-export" data-action="export-workspace" title="Export workspace" aria-label="Export workspace">${PS}</button><button type="button" class="workspace-leave" data-action="leave-workspace" title="Leave workspace" aria-label="Leave workspace">${NS}</button></li>`}function po(e){return vn?De(e).toLowerCase().includes(vn):!0}var Yu=(e,t)=>De(e).localeCompare(De(t));async function j(){await ud(),Ot().catch(()=>{});let e=await ce(),t=K(),r=await xt();if(a.bundles=r,Nd(),!X)return;wn.classList.remove("empty");let n=new Set(e),o=new Set;for(let h of t)for(let b of h.reports)n.has(b)&&o.add(b);let s=new Map(r.map(h=>[h.integrity,h])),i=new Set;for(let h of t)for(let b of h.bundles)s.has(b)&&i.add(b);let l=new Map;for(let h of Xy)l.set(h,[]);for(let h of e){if(o.has(h)||!po(h))continue;let b=st(h);l.has(b)||l.set(b,[]),l.get(b).push(h)}let c=t.filter(h=>!vn||h.name.toLowerCase().includes(vn)||h.reports.some(b=>po(b))?!0:h.bundles.some(b=>{let g=s.get(b);return g&&po(g.name)})),u=r.filter(h=>!i.has(h.integrity)&&po(h.name));J(d`${AS()} ${a.serverMode==="managed"&&t.length===0?m:ES()} ${Q(c,h=>h.id,h=>{let b=[],g=[];for(let y of h.reports)po(y)&&(n.has(y)?b.push(y):g.push(y));b.sort(Yu),g.sort(Yu);let w=[],v=[];for(let y of h.bundles){let k=s.get(y);k?(!vn||po(k.name))&&w.push(k):vn||v.push(y)}return d`${zS(h)} ${b.map(y=>Qy(y,{indented:!0,workspaceId:h.id}))} ${g.map(y=>BS(y,h.id))} ${w.map(y=>Zy(y,{workspaceId:h.id}))} ${v.map(y=>FS(y,h.id))}`})} ${Xy.map(h=>{let b=(l.get(h)??[]).toSorted(Yu),g=h==="default";return b.length===0&&!(g&&Qa)?null:d`${tv(SS[h]??h,{dropTarget:g})} ${b.map(w=>Qy(w))}`})} ${u.length>0||Za?IS():null} ${Q(u,h=>h.integrity,h=>Zy(h))}`,Xa);let p=X.querySelector('sidebar-view-button[kind="packages"]');p&&(p.count=xS());let f=X.querySelector('sidebar-view-button[kind="repositories"]');f&&(f.count=_S()),zr(),Mc(e,()=>{j()})}Me(()=>{j()});async function US(e){if(e.target.closest('[data-action="go-home"]')){await Qb();return}let t=e.target.closest(".file-item[data-bundle-integrity]");if(t){if(t.classList.contains("bundle-missing"))return;let c=t.dataset.bundleIntegrity;if(a.selectedBundle===c&&a.currentView==="bundles")return;a.currentView="bundles",a.selectedBundle=c,a.bundleDetails=null,a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.bundleCodeSearchQuery="",a.bundleCodeSearchMode="files",a.bundleSearchQuery="",a.bundleSearchRegex=!1,a.bundleSearchCase=!1,a.bundleSearchContext=!0,a.bundleDetailsTab="overview",A.showAll=!0,a.shownTriage=null,Nr(c),x(),j(),nr(c);return}let r=e.target.closest("sidebar-view-button");if(r){let c=r.getAttribute("kind");(c==="packages"||c==="repositories")&&(a.currentView=c,x(),j());return}if(e.target.closest('[data-action="new-workspace"]')){if(a.serverMode==="managed")return;let c=await Oy();c&&(await yu(),await Kc(c),j());return}let n=e.target.closest('[data-action="share-workspace"]');if(n){let c=n.closest("[data-workspace-id]"),u=c?K().find(p=>p.id===c.dataset.workspaceId):null;u&&Ny({id:u.id,name:u.name,privateKeyBase64:u.privateKey}).catch(p=>alert(`Failed to open share dialog: ${p.message}`));return}let o=e.target.closest('[data-action="export-workspace"]');if(o){let c=o.closest("[data-workspace-id]"),u=c?K().find(p=>p.id===c.dataset.workspaceId):null;u&&Ly(u).catch(p=>alert(`Failed to open export dialog: ${p.message}`));return}let s=e.target.closest('[data-action="leave-workspace"]');if(s){let c=s.closest("[data-workspace-id]"),u=c?K().find(w=>w.id===c.dataset.workspaceId):null;if(!u)return;let p=Array.isArray(u.reports)?u.reports:[],f;try{f=await ia(p)}catch(w){alert(`Couldn't read reports to analyze triage impact: ${w.message}`);return}let{confirmed:h,mode:b,triage:g}=await Py({name:u.name,reportCount:p.length,bundleCount:u.bundles.length,triageImpact:f});if(!h)return;if(!K().some(w=>w.id===u.id)){alert(`Workspace "${u.name}" was removed elsewhere; nothing to leave.`);return}try{await ey(u.id,b,{triage:g})}catch(w){alert(`Failed to leave workspace: ${w.message}`)}return}let i=e.target.closest(".file-item.workspace-item[data-workspace-id]");if(i){let c=i.dataset.workspaceId,u=a.currentView==="findings"||a.currentView==="files";c&&(c!==a.currentWorkspace||!u)&&Ct(c);return}let l=e.target.closest(".file-item[data-file]");if(l){let c=l.dataset.file;c&&(c!==a.currentFile||a.currentView!=="findings")&&Ze(c);return}if(e.target.closest("sidebar-delete-current")){if(a.currentView==="bundles"&&a.selectedBundle){let g=a.selectedBundle,w=(a.bundles??[]).find(k=>k.integrity===g)?.name??g,v=K().filter(k=>Array.isArray(k.bundles)&&k.bundles.includes(g)).filter(k=>Td(k.id,g)).map(k=>k.id),{confirmed:y}=await zy({name:w,inRemote:v.length>0});if(!y)return;if(a.selectedBundle!==g){alert(`Active bundle changed during confirmation; aborting delete of "${w}".`);return}try{await Zb({deleteFromRemoteWorkspaceIds:v})}catch(k){alert(`Failed to delete bundle: ${k.message}`)}return}if(!a.currentFile)return;let c=a.currentFile,u;try{u=await ia([c])}catch(g){alert(`Couldn't read reports to analyze triage impact: ${g.message}`);return}let p=K().filter(g=>Array.isArray(g.reports)&&g.reports.includes(c)).filter(g=>Kn(g.id,c)).map(g=>g.id),f=p.length>0,{confirmed:h,triage:b}=await Dy({name:c,triageImpact:u,inRemote:f});if(!h)return;if(a.currentFile!==c){alert(`Active report changed during confirmation; aborting delete of "${c}".`);return}try{await Xb({triage:b,deleteFromRemoteWorkspaceIds:p})}catch(g){alert(`Failed to delete report: ${g.message}`)}return}if(e.target.closest("#sync-status")){if(a.serverModeMismatch)return;N.status==="error"?N.dismissError():N.status==="off"?(!N.getServerUrl()&&Hs&&N.setServerUrl(Hs),N.setEnabled(!0)):N.setEnabled(!1);return}if(e.target.closest('[data-action="admin-users"]')){X?.querySelector("#user-menu")?.hidePopover?.(),rC();return}if(e.target.closest('[data-action="manage-repos"]')){X?.querySelector("#user-menu")?.hidePopover?.(),nC();return}if(e.target.closest('[data-action="manage-reports"]')){X?.querySelector("#user-menu")?.hidePopover?.(),oC();return}if(e.target.closest('[data-action="manage-bundles"]')){X?.querySelector("#user-menu")?.hidePopover?.(),sC();return}if(e.target.closest('[data-action="manage-teams"]')){X?.querySelector("#user-menu")?.hidePopover?.(),iC();return}if(e.target.closest('[data-action="managed-logout"]')){Um(a.managedSession?.csrfToken);return}if(e.target.closest("#auth-status")){a.managedSession==null&&zm(a.managed?.loginPath);return}if(e.target.closest("#sidebar-toggle")){if(a.serverMode==="managed")return;wn.classList.toggle("collapsed");try{localStorage.setItem("deepview.sidebarCollapsed",wn.classList.contains("collapsed")?"1":"0")}catch{}}}function HS(e){let t=e.target.closest("[data-tooltip]");if(!t){Us();return}Gu(t,{placement:"right",gate:r=>{let n=r.querySelector(".file-label");return!n||(r.dataset.tooltip??"")!==n.textContent?!0:n.scrollWidth>n.clientWidth}})}function VS(e){let t=e.target.closest("[data-tooltip]"),r=e.relatedTarget?.closest?.("[data-tooltip]")??null;t&&t===r||Us()}function jS(e){vn=e.target.value.trim().toLowerCase(),j()}var WS={off:"Sync off",online:"Online",offline:"Offline",connecting:"Connecting\u2026",error:"Sync error"};function KS(){return N.getServerUrl()||Hs?K().length>0:!1}function rv(){let e=X?.querySelector("#auth-status");if(!e)return;e.hidden=!1;let t=X?.querySelector("#user-menu"),r=a.managedSession;if(r==null){e.dataset.authed="0",e.removeAttribute("popovertarget"),e.setAttribute("aria-label","Log in"),J(d`Log in`,e),t&&J(m,t);return}let n=(r.login[0]??"?").toUpperCase();e.dataset.authed="1",e.setAttribute("popovertarget","user-menu"),e.setAttribute("aria-label",`Account: ${r.login}`),J(ev(n,r.id),e),t&&J(d`<div class="user-card">${ev(n,r.id,!0)} <span class="user-id"><span class="user-login">${r.login}</span> ${r.name?d`<span class="user-name">${r.name}</span>`:m}</span></div>${r.role==="admin"||r.role==="manage"?d`<div class="user-menu-group" role="group" aria-label="Manage"><div class="user-menu-group-label">Manage</div>${r.role==="admin"?d`<button type="button" class="user-menu-row" data-action="admin-users">Users</button>`:m} <button type="button" class="user-menu-row" data-action="manage-repos">Repositories</button> <button type="button" class="user-menu-row" data-action="manage-reports">Reports</button> <button type="button" class="user-menu-row" data-action="manage-bundles">Bundles</button> <button type="button" class="user-menu-row" data-action="manage-teams">Teams</button></div>`:m} <button type="button" class="user-menu-row" data-action="managed-logout">Log out</button>`,t)}function ev(e,t,r=!1){let n=`/api/avatar/${encodeURIComponent(t)}`;return d`<span class="${r?"user-avatar user-avatar-lg":"user-avatar"}"><span class="user-avatar-fallback">${e}</span> <img alt="" src="${n}" @error="${qS}"></span>`}function qS(e){e.currentTarget.classList.add("broken")}function GS(){let e=X?.querySelector(".brand-tag");e&&(e.textContent=a.serverMode)}function YS(){wn&&(wn.dataset.mode=a.serverMode),a.serverMode==="managed"&&wn?.classList.remove("collapsed"),Xm()}function zr(e){let t=X?.querySelector("#sync-status");if(!t)return;if(GS(),YS(),a.serverModeMismatch){let u=X?.querySelector("#auth-status");u&&(u.hidden=!0),N.setForcedOff(!0),N.setProtocolLocked(!0),t.hidden=!1,t.dataset.status="paused",t.title="This server speaks a different sync protocol than this app is set up for. Switching isn\u2019t supported yet.";let p=t.querySelector(".sync-label");p&&(p.textContent="Sync paused");return}if(a.serverMode==="managed"){t.hidden=!0,N.setForcedOff(!0),rv();return}if(a.serverMode==="standalone"){t.hidden=!0;let u=X?.querySelector("#auth-status");u&&(u.hidden=!0);return}let r=X?.querySelector("#auth-status");r&&(r.hidden=!0);let n=KS(),o=Yt()!=null;if(n&&o&&N.isEnabled()&&$m().catch(u=>{console.warn("sync: load failed",u)}),n&&o&&!N.getServerUrl()&&Hs&&N.isEnabled()&&N.setServerUrl(Hs),N.setForcedOff(!n),!n){t.hidden=!0;return}t.hidden=!1;let s=e??N.status;t.dataset.status=s;let i=N.persistenceDegraded;t.toggleAttribute("data-degraded",i);let l=N.proxyAuthRequired;t.toggleAttribute("data-proxy-auth",l),t.title=i?"Not saving to this browser right now (storage may be full, or another tab is on a newer version). Changes that haven\u2019t synced could be lost on reload.":l?"Can\u2019t reach the sync server \u2014 the connection is being redirected to a sign-in proxy (e.g. Cloudflare Access). Reload the page to sign in again.":"";let c=t.querySelector(".sync-label");c&&(c.textContent=WS[s]??"")}N.onStatusChange(zr);var Ju=!1,Zu=!1;async function nv(){if(!N.persistenceDegraded||Zu||Ju)return;Ju=!0;let{shown:e}=await Vy();if(Ju=!1,e){Zu=!0;return}N.persistenceDegraded&&setTimeout(nv,1500)}N.onPersistenceDegraded(e=>{zr(),e?nv():Zu=!1});var Xu=!1,ep=!1;async function ov(){if(!N.proxyAuthRequired||ep||Xu)return;Xu=!0;let{shown:e,reload:t}=await jy();if(Xu=!1,!e){N.proxyAuthRequired&&setTimeout(ov,1500);return}ep=!0,t&&location.reload()}N.onProxyAuthRequired(e=>{zr(),e?ov():ep=!1});function JS(e){let t=e.target.closest(".file-item.workspace-item");if(!t)return;let r=t.querySelector(".file-label");if(!r||r.querySelector("input"))return;let n=t.dataset.workspaceId,o=K().find(c=>c.id===n);if(!o)return;e.preventDefault();let s=document.createElement("input");s.type="text",s.value=o.name,s.className="workspace-rename-input",r.textContent="",r.append(s),s.focus(),s.select();let i=!1,l=async c=>{i||(i=!0,c&&await Gc(n,s.value),j())};s.addEventListener("keydown",c=>{c.key==="Enter"?(c.preventDefault(),l(!0)):c.key==="Escape"&&(c.preventDefault(),l(!1))}),s.addEventListener("blur",()=>l(!0)),s.addEventListener("click",c=>c.stopPropagation()),s.addEventListener("dblclick",c=>c.stopPropagation())}function el(){for(let e of X.querySelectorAll(".drag-over"))e.classList.remove("drag-over")}function sv(e){return e.dataTransfer.types.includes(rp)||e.dataTransfer.types.includes(Vs)}function XS(e){let t=e.target.closest(".file-item[data-bundle-integrity]");if(t){if(t.classList.contains("bundle-missing")){e.preventDefault();return}let n=t.dataset.bundleIntegrity;e.dataTransfer.effectAllowed="move",e.dataTransfer.setData(Vs,n),e.dataTransfer.setData(Qu,t.dataset.workspaceId??""),e.dataTransfer.setData("text/plain",n),t.classList.add("dragging"),Za=!0,j();return}let r=e.target.closest(".file-item[data-file]");r&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData(rp,r.dataset.file),e.dataTransfer.setData(Qu,r.dataset.workspaceId??""),e.dataTransfer.setData("text/plain",r.dataset.file),r.classList.add("dragging"),Qa=!0,j())}function QS(){for(let e of X.querySelectorAll(".dragging"))e.classList.remove("dragging");el(),(Qa||Za)&&(Qa=!1,Za=!1,j())}function ZS(e){if(!sv(e))return;e.preventDefault();let t=e.target.closest("[data-workspace-id]"),r=X.querySelector(".dragging")?.closest("[data-workspace-id]")?.dataset.workspaceId??null,s=t&&r&&t.dataset.workspaceId===r||!t&&!r;if(e.dataTransfer.dropEffect=s?"none":"move",el(),!s)if(t){let i=t.dataset.workspaceId;for(let l of X.querySelectorAll(`[data-workspace-id="${CSS.escape(i)}"]`))l.classList.contains("dragging")||l.classList.add("drag-over")}else{let l=e.dataTransfer.types.includes(Vs)?"[data-default-bundles]":"[data-default-reports]",c=X.querySelector(l);c&&c.classList.add("drag-over")}}function eC(e){X.contains(e.relatedTarget)||el()}async function tC(e){if(!sv(e))return;e.preventDefault(),e.stopPropagation(),el();let t=e.target.closest("[data-workspace-id]"),r=t?t.dataset.workspaceId:null,n=e.dataTransfer.getData(Qu)||null;if(e.dataTransfer.types.includes(Vs)){let s=e.dataTransfer.getData(Vs);if(!s)return;if(n&&n!==r&&Td(n,s)){let i=(a.bundles??[]).find(u=>u.integrity===s)?.name??s,l=K().find(u=>u.id===n),{confirmed:c}=await Uy({name:i,workspaceName:l?.name??""});if(!c)return;try{await ma(n,s)}catch(u){console.warn(`Failed to remove '${i}' from source workspace ${n} remote:`,u)}}r&&await ln(s,r),n&&n!==r&&await Zc(s,n),j();return}let o=e.dataTransfer.getData(rp);if(o){if(n&&n!==r&&Kn(n,o)){let s=K().find(l=>l.id===n),{confirmed:i}=await Hy({name:o,workspaceName:s?.name??""});if(!i)return;try{await ha(n,o)}catch(l){console.warn(`Failed to remove '${o}' from source workspace ${n} remote:`,l)}}r&&await Jt(o,r),n&&n!==r&&await rs(o,n),j()}}function iv(e){let t=Yt();if(cc(t?t.mode:null,e.mode)==="mismatch"){a.serverModeMismatch=!0,N.setForcedOff(!0),N.setProtocolLocked(!0),console.warn(`sync: server is '${e.mode}' but this client is bound to '${t?.mode}' \u2014 refusing to switch (migration not yet supported)`),zr(N.status);return}a.serverModeMismatch=!1,N.setProtocolLocked(!1);let n=a.serverMode!==e.mode;a.serverMode=e.mode,a.managed=e.managed,lc(e),zr(N.status),n&&j(),e.mode==="managed"&&av()}async function av(){try{a.managedSession=await Pm(),rv(),a.managedTeams=a.managedSession==null?[]:await Nm(),j()}catch(e){console.warn("managed: session probe failed:",e)}}async function rC(){try{await Hm()}catch(e){console.warn("admin: bundle load failed:",e);return}a.currentView="admin-users",x(),j()}async function nC(){try{await Vm()}catch(e){console.warn("admin: repos bundle load failed:",e);return}a.currentView="manage-repos",x(),j()}async function oC(){try{await jm()}catch(e){console.warn("admin: reports bundle load failed:",e);return}a.currentView="manage-reports",x(),j()}async function sC(){try{await Wm()}catch(e){console.warn("admin: bundles bundle load failed:",e);return}a.currentView="manage-bundles",x(),j()}async function iC(){try{await Km()}catch(e){console.warn("admin: teams bundle load failed:",e);return}a.currentView="manage-teams",x(),j()}async function aC(){if(Yt())return;let e=0,t=null;try{let r=await fetch(Bi,{credentials:"same-origin",headers:{accept:"application/json"}});e=r.status,r.ok&&(t=Li(await r.json()))}catch{}if(t){iv(t);return}e===404&&(a.serverMode="standalone",km(!0),zr(N.status),j())}function lC(){let e=X?.querySelector("#user-menu"),t=X?.querySelector("#auth-status");!e||!t||e.addEventListener("beforetoggle",r=>{if(r.newState!=="open")return;let n=t.getBoundingClientRect();e.style.left=`${Math.round(n.left)}px`,e.style.bottom=`${Math.round(window.innerHeight-n.top+6)}px`,e.style.top="auto",e.style.right="auto"})}function cC(e){wn=e,X=e.renderRoot,Xa=X.querySelector("#file-list"),Qm(X.querySelector("#encryption-toggle")),og(X.querySelector("#storage-status")),X.addEventListener("click",US),X.addEventListener("dblclick",JS),X.addEventListener("dragstart",XS),X.addEventListener("dragend",QS),X.addEventListener("dragover",ZS),X.addEventListener("dragleave",eC),X.addEventListener("drop",tC),Xa.addEventListener("mouseover",HS),Xa.addEventListener("mouseout",VS),X.querySelector("#sidebar-search-input")?.addEventListener("input",jS),lC(),zr(N.status),j(),N.onServerInfo(iv),aC(),a.serverMode==="managed"&&av()}var tp=class extends Z{static styles=[F(Gm),F(qm)];render(){return d`<div class="sidebar-header"><h2 class="brand"><button class="brand-button" type="button" data-action="go-home"><span class="brand-name">DeepView</span></button> <span class="brand-tag">dev</span></h2><button id="encryption-toggle" type="button" hidden></button> <button id="sidebar-toggle" type="button" title="toggle sidebar" aria-label="toggle sidebar"><svg viewBox="0 0 16 16" width="14" height="14" fill="currentColor" aria-hidden="true"><path d="M2 4h12v1.5H2zM2 7.25h12v1.5H2zM2 10.5h12V12H2z"/></svg></button></div><div class="sidebar-search"><svg class="sidebar-search-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="6.5" cy="6.5" r="4.5"/><path d="M9.7 9.7L13 13" stroke-linecap="round"/></svg> <input id="sidebar-search-input" type="search" placeholder="Search reports..." autocomplete="off"><sidebar-view-button kind="packages"></sidebar-view-button><sidebar-view-button kind="repositories"></sidebar-view-button></div><ul id="file-list"></ul><button id="storage-status" type="button" hidden><span class="storage-dot" aria-hidden="true"></span> <span class="storage-label"></span></button><div class="sidebar-actions"><sidebar-delete-current></sidebar-delete-current><button id="sync-status" type="button" data-status="off"><span class="sync-dot" aria-hidden="true"></span> <span class="sync-label">Sync off</span></button> <button id="auth-status" type="button" hidden></button></div><div id="user-menu" popover class="user-menu"></div>`}firstUpdated(){cC(this)}};customElements.define("app-sidebar",tp);function lv(e){if(!e)return null;let t=D(e);if(!sn(t))return null;let r=e._reportName||a.currentFile||"";return Lc({id:t,report:ea("report",r),workspace:ea("workspace",a.currentWorkspace??"")})}function tl(e){for(let t of St())for(let r of t)if(D(r)===e)return{group:t,finding:r};return null}function cv(e,t){if(a.currentView="findings",a.viewMode==="graph"&&(a.viewMode="table",Be()),a.viewMode==="kanban"){let n=ve(e).commonTriage??"untriaged";a.kanbanExpandedColumn!==null&&a.kanbanExpandedColumn!==n&&(a.kanbanExpandedColumn=null)}if(Mr([e]).length===0){let n=a.sortBy;Yn(),a.sortBy=n}let r=Re(e);return e.length>1&&a.activeTabByGroup.set(r,t),a.viewMode==="table"?a.tableSelectedGid=r:a.viewMode==="focus"?a.focusGid=r:a.viewMode==="kanban"&&(a.kanbanPopoverGid=r),r}var dC=1600,rl="link-target",uC="Couldn't find that finding in any of your reports. Import the report it came from, then open the link again.",nl=null;function pC(e){nl!==null&&clearTimeout(nl);for(let t of document.querySelectorAll(`.${rl}`))t.classList.remove(rl);e.classList.add(rl),nl=setTimeout(()=>{e.classList.remove(rl),nl=null},dC)}async function fC(e){let t=CSS.escape(e);if(a.viewMode==="table"){let r=C.querySelector("finding-table");if(r){try{await r.updateComplete}catch{}for(let n of r.shadowRoot?.querySelectorAll("finding-row")??[])if(n.group&&mn(n.group)===e)return n}}if(a.viewMode==="kanban"){let r=C.querySelector(`.kanban-card[data-gid="${t}"]`);if(r)return r}return C.querySelector(`finding-card[data-gid="${t}"]`)??C.querySelector(`[data-gid="${t}"]`)}async function dv(e){let t=nd(e);if(t.length===1){a.currentWorkspace!==t[0].id&&await Ct(t[0].id);return}a.currentFile!==e&&await Ze(e)}async function hC({report:e,workspace:t}){let r=await ed(t);if(r&&r.id!==a.currentWorkspace)return await Ct(r.id),!0;let n=await td(e);return!n||a.currentFile===n||(a.currentWorkspace?K().find(s=>s.id===a.currentWorkspace):null)?.reports.includes(n)?!1:(await dv(n),!0)}async function mC(e){let t=a.reports.map(n=>n.fileName).filter(Boolean),r=await rd(e,{skip:t});return r?(await dv(r),!0):!1}async function uv(e){if(!e?.id)return{ok:!1,reason:"This link is missing a finding id."};let t=tl(e.id);if(!t&&await hC(e)&&(t=tl(e.id)),!t&&await mC(e.id)&&(t=tl(e.id)),!t)return{ok:!1,reason:uC};let r=cv(t.group,e.id);x();let n=await fC(r);return n?(n.scrollIntoView({block:"center",behavior:"smooth"}),pC(n),{ok:!0}):{ok:!0}}var pv={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 fv(){Mm(async(e,t,r)=>{let n=sd(e);try{return await Va(e,n,pv[r]??pv.attach)}catch{let o=e.length;return alert(`${r==="attach"?"A report attach":"A workspace sync"} had ${o} triage disagreement${o===1?"":"s"} with your local view. Kept your local values because another dialog is open. ${r==="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 np=class extends I{static properties={retry:{type:Boolean},_value:{state:!0}};constructor(){super(),this.retry=!1,this._value=""}_finish(t){this._value="",super._finish(t)}_onCancel=()=>this._finish(null);_onInput=t=>{this._value=t.target.value};_onSubmit=()=>{let t=this._value??"";t&&this._finish(t)};_onKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._onSubmit())};render(){let t=(this._value??"").length>0,r=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 d`<dialog @close="${this._onClose}"><header><h3>Sync server password</h3></header><p class="nwd-intro">${r}</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="${!t}" @click="${this._onSubmit}">${this.retry?"Retry":"Authenticate"}</button></footer></dialog>`}};customElements.define("sync-auth-dialog",np);function hv({retry:e=!1}={}){return te("sync-auth-dialog",{retry:!!e})}function mv(){Im(async({retry:e})=>{try{return await hv({retry:e})}catch(t){return console.warn("Sync auth dialog failed to open:",t),null}})}var ol="https://triage.space/",gC=[{hostname:"deepaudit.dev",pathPrefix:"/",supportsSync:!0},{hostname:"chalker.github.io",pathPrefix:"/deepview/",supportsSync:!1}];function bC(){for(let e of gC)if(location.hostname===e.hostname&&location.pathname.startsWith(e.pathPrefix))return e;return null}var yC=["deepview.triage","deepview.triage.pending"],vC="deepview.repoUrls";function wC(){try{for(let e of yC)if(localStorage.getItem(e))return!0}catch{return!0}try{let e=localStorage.getItem(vC);if(e){let t=JSON.parse(e);if(t&&typeof t=="object"&&Object.keys(t).length>0)return!0}}catch{return!0}return!1}async function kC(){if(wC())return!0;let e=[];try{e=await ce()}catch{return!0}if(e.length>0)return!0;try{if(K().length>0)return!0}catch{return!0}try{return await No()}catch{return!0}}var op=class extends Z{static properties={supportsSync:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.supportsSync=!1}firstUpdated(){let t=this.querySelector("dialog");t&&t.showModal();let r=this.querySelector("button.om-stay");r&&r.focus()}_finish(t){if(this._settled)return;this._settled=!0;let r=this.querySelector("dialog");r&&r.close(),this.dispatchEvent(new CustomEvent("resolve",{detail:t}))}_onClose=()=>this._finish(!1);_onStay=()=>this._finish(!1);_onMigrate=()=>this._finish(!0);render(){let t=()=>d`<a class="om-link" href="${ol}" target="_blank" rel="noopener noreferrer">${ol}</a>`;return d`<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 ${t()}.</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 ${t()}.</p>${this.supportsSync?d`<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 ${t()}. 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>`:d`<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 ${t()}.</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",op);function $C(e){return new Promise(t=>{let r=document.createElement("origin-migration-dialog");r.supportsSync=e.supportsSync,r.addEventListener("resolve",n=>{r.remove(),t(!!n.detail)}),document.body.append(r)})}async function gv(){let e=bC();return e?await kC()?await $C(e)?(location.assign(ol),!0):!1:(location.replace(ol),!0):!1}var sp=class extends I{static styles=[...I.styles,F(ht)];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(t){t.has("_stage")&&this._focusActiveInput()}_focusActiveInput(){if(this._stage==="password")this.renderRoot.querySelector('input[type="password"]')?.focus();else if(this._stage==="name"){let t=this.renderRoot.querySelector('input[data-role="name"]');t&&(t.focus(),t.select())}}_finish(t){this._settled||(this._decoded=null,this._password="",this.encoded="",super._finish(t))}_onClose=()=>this._finish(null);_onCancel=()=>this._finish(null);_onPasswordInput=t=>{this._password=t.target.value,this._error=""};_onNameInput=t=>{this._name=t.target.value};_onUnlock=async()=>{if(!(!this._password||this._busy)){this._busy=!0,this._error="";try{let t=await xd({encoded:this.encoded,password:this._password});if(this._settled)return;let r=K().find(n=>n.id===t.id)??null;this._decoded=t,this._existingById=r,this._name=t.name,this._password="",this._stage="name"}catch(t){if(this._settled)return;this._error=t?.message??String(t)}finally{this._busy=!1}}};_onAttach=()=>{if(!this._decoded)return;let t=Pt(this._name);if(!t)return;let r=K().find(n=>n.id===this._decoded.id)??null;if(r){this._existingById=r;return}this._nameCollision(t)||this._finish({id:this._decoded.id,name:t,privateKeyBase64:this._decoded.privateKeyBase64})};_nameCollision(t){if(!t||!this._decoded)return null;for(let r of K())if(r.id!==this._decoded.id&&Pt(r.name)===t)return r;return null}_onKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._stage==="password"?this._onUnlock():this._stage==="name"&&this._onAttach())};_passwordStage(){return d`<p class="nwd-note">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?d`<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 t=this._existingById;return d`<p class="nwd-note">This workspace is already attached as <strong>"${t?.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 t=Pt(this._name),r=this._nameCollision(t),n=!!t&&!r;return d`<p class="nwd-note">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> ${r?d`<p class="wsl-error" role="alert">A workspace named "${t}" already exists on this device. Pick a different name.</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!n}" @click="${this._onAttach}">Attach</button></footer>`}render(){let t=this._stage==="password"?"Attach shared workspace":this._existingById?"Workspace already attached":"Name the workspace";return d`<dialog @close="${this._onClose}"><header><h3>${t}</h3></header>${this._stage==="password"?this._passwordStage():this._nameStage()}</dialog>`}};customElements.define("workspace-unlock-link-dialog",sp);function bv({encoded:e}={}){return new Promise((t,r)=>{let n=document.createElement("workspace-unlock-link-dialog");n.encoded=e??"",n.addEventListener("resolve",o=>{n.remove(),t(o.detail)}),n.addEventListener("modal-conflict",o=>{n.encoded="",n.remove(),r(Tt(o.detail?.cause))}),document.body.append(n)})}var Ke=null,sl=!1,js=null;function xC(e){if(!e)return"Could not unlock. Try again.";switch(e.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 r=e.message??String(e);return r.length>200?r.slice(0,197)+"\u2026":r}}}function _C(){if(Ke)return Ke;Ke=document.createElement("div"),Ke.id="lock-overlay",Ke.setAttribute("role","dialog"),Ke.setAttribute("aria-modal","true"),Ke.setAttribute("aria-label","Unlock DeepView"),Ke.innerHTML=`
88
108
  <div class="lock-overlay-card">
89
109
  <div class="lock-overlay-icon" aria-hidden="true">
90
110
  <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>
@@ -101,31 +121,31 @@ ${r}`}">${k_}<span class="file-label">${n}</span></button></li>`}function $_(e,t
101
121
  <a href="#" class="lock-overlay-wipe">Wipe local data and start over</a>
102
122
  </p>
103
123
  </div>
104
- `;let e=Ke.querySelector("button"),t=Ke.querySelector(".lock-overlay-error");return e.addEventListener("click",async()=>{if(!Ka){Ka=!0,t.hidden=!0,t.textContent="",e.disabled=!0,e.textContent="Waiting\u2026",Os=new AbortController;try{let n=await So({signal:Os.signal})}catch(n){let o=pS(n);t.textContent=o,t.hidden=!o}finally{Ka=!1,Os=null,e.disabled=!1,e.textContent="Unlock with passkey"}}}),Ke.querySelector(".lock-overlay-wipe").addEventListener("click",async n=>{if(n.preventDefault(),!Ka&&confirm(`Wipe ALL local DeepView data and start over?
124
+ `;let e=Ke.querySelector("button"),t=Ke.querySelector(".lock-overlay-error");return e.addEventListener("click",async()=>{if(!sl){sl=!0,t.hidden=!0,t.textContent="",e.disabled=!0,e.textContent="Waiting\u2026",js=new AbortController;try{let n=await Ro({signal:js.signal})}catch(n){let o=xC(n);t.textContent=o,t.hidden=!o}finally{sl=!1,js=null,e.disabled=!1,e.textContent="Unlock with passkey"}}}),Ke.querySelector(".lock-overlay-wipe").addEventListener("click",async n=>{if(n.preventDefault(),!sl&&confirm(`Wipe ALL local DeepView data and start over?
105
125
 
106
126
  This deletes your encrypted triage, all reports, and the passkey registration on this device. The data CANNOT be recovered after this \u2014 there is no backup.
107
127
 
108
- Use this only if you have lost access to your passkey and have no other way to unlock.`)&&confirm("Really wipe everything? This cannot be undone.")){try{await Co()}catch(o){alert(`Wipe failed: ${o?.message??o}. Try again or clear localStorage manually via DevTools.`);return}location.reload()}}),document.body.append(Ke),Ke}function hS(){return At()?se()&&!yt():!1}function Ly(){if(hS()){let e=fS();e.hidden=!1;let t=e.querySelector("button");t&&t.focus()}else if(Ke&&(Ke.hidden=!0,Os))try{Os.abort()}catch{}}Te(Ly);Ly();var Oy=`dialog{max-width:640px;width:min(94vw,640px)}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}textarea{display:block;width:100%;box-sizing:border-box;min-height:9rem;max-height:50vh;resize:vertical;padding:.55rem .65rem;border:1px solid var(--border);border-radius:6px;background:var(--bg, var(--surface));color:var(--text);font:inherit;font-size:.88rem;line-height:1.4;&: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)}}
109
- `;var Hu=class extends R{static styles=[...R.styles,B(eo),B(Oy)];static properties={initial:{attribute:!1},finding:{attribute:!1},_value:{state:!0}};constructor(){super(),this.initial="",this.finding=null,this._value=""}beforeOpen(){this._value=this.initial??""}focusInitial(){let t=this.renderRoot.querySelector("textarea");if(!t)return;t.focus();let r=t.value.length;try{t.setSelectionRange(r,r)}catch{}}_onInput=t=>{this._value=t.target.value};_onSave=()=>{let t=(this._value??"").trim(),r=(this.initial??"").trim();if(t===r){this._finish(null);return}this._finish(t)};_onClear=()=>this._finish("");_onCancel=()=>this._finish(null);_onKeydown=t=>{t.key==="Enter"&&(t.ctrlKey||t.metaKey)&&(t.preventDefault(),this._onSave())};render(){let t=this.finding??{},r=t.file?t.line?`${t.file}:${t.line}`:t.file:"",n=(this.initial??"").length>0;return d`<dialog @close="${this._onClose}"><header><h3>${n?"Edit comment":"Add comment"}</h3><div class="finding">${to(re(t,a.severityMode))} ${r?d`<span class="loc" title="${r}">${r}</span>`:g}</div>${t.description?d`<div class="desc" title="${t.description}">${t.description}</div>`:g}</header><textarea rows="6" placeholder="Write your notes here. Markdown is not rendered. Ctrl/⌘+Enter to save, Esc to cancel." .value="${this._value}" @input="${this._onInput}" @keydown="${this._onKeydown}"></textarea><footer class="nwd-actions">${n?d`<button type="button" class="danger" @click="${this._onClear}">Clear</button>`:g} <span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" @click="${this._onSave}">Save</button></footer></dialog>`}};customElements.define("comment-dialog",Hu);function Py({initial:e="",finding:t=null}={}){return ee("comment-dialog",{initial:e,finding:t})}var Vu=class extends R{static styles=[...R.styles,B(ke)];static properties={bundleName:{type:String},encrypted:{type:Boolean}};constructor(){super(),this.bundleName="",this.encrypted=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(t){this._settled||super._finish({confirmed:!!t})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);_securityNote(){return this.encrypted?d`<p class="lwd-note">The bundle is saved <strong>unencrypted</strong> — even though your vault keeps its stored copy encrypted — and the file contains <strong>all of the bundle's related sources</strong>. Anyone with access to the downloaded file can read every bundled source, so store or share it with care.</p>`:d`<p class="lwd-note">The downloaded file is <strong>unencrypted</strong> and contains <strong>all of the bundle's related sources</strong>. Anyone with access to it can read every bundled source, so store or share it with care.</p>`}render(){return d`<dialog @close="${this._onClose}"><header><h3>Download bundle</h3></header><p class="lwd-body">Download <strong>"${this.bundleName}"</strong> to disk?</p>${this._securityNote()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" @click="${this._onConfirm}">Download</button></footer></dialog>`}};customElements.define("download-bundle-dialog",Vu);function Ny({name:e,encrypted:t}={}){return ee("download-bundle-dialog",{bundleName:e??"",encrypted:!!t})}var mS={critical:"Critical",high:"High",medium:"Medium",low:"Low",high_bug:"High bug",bug:"Bug",informational:"Informational"},bS={red:"Red",blue:"Blue",green:"Green",gray:"Gray",none:"Unmarked"},yS={inprogress:"In progress",fixed:"Fixed",invalid:"Invalid",deleted:"Deleted",ignored:"Ignored"};function vS(e){return we.filter(t=>e.has(t)).map(t=>mS[t]??t).join(", ")}function wS(){let e=[];if(a.filterSeverities.size>0&&e.push({label:"Severity",value:vS(a.filterSeverities)}),a.filterColors.size>0&&e.push({label:"Marks",value:[...a.filterColors].map(t=>bS[t]??t).join(", ")}),a.filterSources.size===1&&e.push({label:"Source",value:a.filterSources.has("own")?"Sources only":"Dependencies only"}),a.filterAnalyzer&&e.push({label:"Analyzer",value:a.filterAnalyzer===Sr?"(none)":a.filterAnalyzer}),a.filterModel&&e.push({label:"Model",value:a.filterModel===Cr?"(none)":a.filterModel}),a.filterRepo&&e.push({label:"Repository",value:a.filterRepo===ln?"(no repo)":a.filterRepo}),a.filterConfMin>0||a.filterConfMax<10){let t;a.filterConfMin>0&&a.filterConfMax<10?t=`${a.filterConfMin}\u2013${a.filterConfMax}`:a.filterConfMin>0?t=`\u2265 ${a.filterConfMin}`:t=`\u2264 ${a.filterConfMax}`,e.push({label:"Confidence",value:t})}a.filterInclude&&e.push({label:a.filterIncludeNegate?"Excluding":"Search",value:`"${a.filterInclude}"`});for(let[t,r]of[["filterComment","comment"],["filterFix","fix"],["filterFlagged","flag"]]){let n=a[t];n&&e.push({label:"Annotation",value:`${n==="with"?"With":"Without"} ${r}`})}return e}function kS(e){return(e==="download"?a.reports.flatMap(r=>r.groups??[]):kt()).filter(r=>ge(r).commonTriage===a.shownTriage)}function Dy(e){let t=kS(e),r=t.length,n=Er(t).length;return{included:n,total:r,excluded:r-n,filters:wS(),bucketLabel:a.shownTriage?yS[a.shownTriage]??a.shownTriage:null,focusedOnly:e==="print"&&a.viewMode==="focus"}}var zy=`.ecd-count{margin:0;font-size:1.02rem;color:var(--text);& strong{color:var(--accent);font-weight:700}}.ecd-excluded{margin:.25rem 0 0;color:var(--muted);font-size:.82rem}.ecd-filters{margin:.9rem 0 0;display:grid;grid-template-columns:auto minmax(0,1fr);gap:.3rem .7rem;font-size:.82rem}.ecd-filters dt{color:var(--muted);font-weight:600;white-space:nowrap}.ecd-filters dd{color:var(--text);overflow-wrap:anywhere}.ecd-filters-label{margin:.9rem 0 0;font-size:.76rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--muted)}.ecd-filters-label+.ecd-filters{margin-top:.35rem}
110
- `;var ju=class extends R{static styles=[...R.styles,B(zy)];static properties={mode:{type:String},included:{type:Number},excluded:{type:Number},total:{type:Number},filters:{attribute:!1},bucketLabel:{type:String},focusedOnly:{type:Boolean}};constructor(){super(),this.mode="print",this.included=0,this.excluded=0,this.total=0,this.filters=[],this.bucketLabel=null,this.focusedOnly=!1}focusInitial(){let t=this.included===0?'button[data-role="cancel"]':"button.primary";this.renderRoot.querySelector(t)?.focus()}_finish(t){this._settled||super._finish({confirmed:!!t})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);_countSection(){if(this.total===0)return d`<p class="ecd-count">No findings to ${this.mode==="print"?"print":"download"}.</p>`;if(this.focusedOnly&&this.included>0)return d`<p class="ecd-count">Only the <strong>focused</strong> finding will be printed.</p><p class="ecd-excluded">Focus mode prints just the finding you're viewing. Switch to the list or grouped view to print all ${this.included} matching ${this.included===1?"finding":"findings"}.</p>`;let r=this.excluded===0&&this.filters.length===0?d`All <strong>${this.included}</strong> ${this.included===1?"finding":"findings"} included.`:d`<strong>${this.included}</strong> of ${this.total} ${this.total===1?"finding":"findings"} included.`;return d`<p class="ecd-count">${r}</p>${this.excluded>0?d`<p class="ecd-excluded">${this.excluded} filtered out and ${this.mode==="print"?"won't be printed":"won't be downloaded"}.</p>`:g}`}_filtersSection(){return this.filters.length===0?d`<p class="ecd-filters-label">No filters active — the full ${this.bucketLabel?`${this.bucketLabel.toLowerCase()} `:""}set is included.</p>`:d`<p class="ecd-filters-label">Active filters</p><dl class="ecd-filters">${this.filters.map(t=>d`<dt>${t.label}</dt><dd>${t.value}</dd>`)}</dl>`}render(){let t=this.mode==="print",r=t?"Print report":"Download report",n=this.focusedOnly?"You're in focus mode \u2014 printing outputs just the finding you're focused on.":t?"Prints only the findings matching your current filters \u2014 the same set shown on screen. Use the toolbar to change the selection first.":"Downloads a Markdown file of the findings matching your current filters \u2014 the same set shown on screen. Use the toolbar to change the selection first.";return d`<dialog @close="${this._onClose}"><header><h3>${r}</h3></header><p class="nwd-intro">${n}</p>${this._countSection()} ${this.bucketLabel?d`<p class="nwd-note">Scoped to the <strong>${this.bucketLabel}</strong> list — live findings are not included.</p>`:g} ${this._filtersSection()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${this.included===0}" @click="${this._onConfirm}">${t?"Print":"Download"}</button></footer></dialog>`}};customElements.define("export-confirm-dialog",ju);function Wu(e){let t=Dy(e);return new Promise(r=>{let n=document.createElement("export-confirm-dialog");Object.assign(n,{mode:e,included:t.included,excluded:t.excluded,total:t.total,filters:t.filters,bucketLabel:t.bucketLabel,focusedOnly:t.focusedOnly});let o=s=>{n.remove(),r({confirmed:s})};n.addEventListener("resolve",s=>o(!!s.detail?.confirmed)),n.addEventListener("modal-conflict",()=>o(!1)),document.body.append(n)})}var Uy=`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: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: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}
111
- `;var Ku=class extends R{static styles=[...R.styles,B(eo),B(Uy)];static properties={initial:{attribute:!1},finding:{attribute:!1},_value:{state:!0}};constructor(){super(),this.initial="",this.finding=null,this._value=""}beforeOpen(){this._value=this.initial??""}focusInitial(){let t=this.renderRoot.querySelector('input[type="url"]');if(t){t.focus();try{t.select()}catch{}}}_onInput=t=>{this._value=t.target.value};_onSave=()=>{let t=(this._value??"").trim(),r=(this.initial??"").trim();if(t===r){this._finish(null);return}this._finish(t)};_onClear=()=>this._finish("");_onCancel=()=>this._finish(null);_onKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._onSave())};render(){let t=this.finding??{},r=t.file?t.line?`${t.file}:${t.line}`:t.file:"",n=(this.initial??"").length>0,o=(this._value??"").trim(),s=Pt(o);return d`<dialog @close="${this._onClose}"><header><h3>${n?"Edit fix link":"Add fix link"}</h3><div class="finding">${to(re(t,a.severityMode))} ${r?d`<span class="loc" title="${r}">${r}</span>`:g}</div>${t.description?d`<div class="desc" title="${t.description}">${t.description}</div>`:g}</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?d`<a class="open" href="${o}" target="_blank" rel="noopener noreferrer" title="Open in a new tab">Open ↗</a>`:g}</div><p class="hint">PR URL, issue link, commit, or any free-form reference. Enter to save, Esc to cancel.</p><footer class="nwd-actions">${n?d`<button type="button" class="danger" @click="${this._onClear}">Clear</button>`:g} <span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" @click="${this._onSave}">Save</button></footer></dialog>`}};customElements.define("fix-link-dialog",Ku);function Hy({initial:e="",finding:t=null}={}){return ee("fix-link-dialog",{initial:e,finding:t})}var _S={critical:"Critical",high:"High",medium:"Medium",low:"Low",high_bug:"High Bug",bug:"Bug",informational:"Informational"},SS=["critical","high","medium","low","high_bug","bug","informational"];function qu(e){return _S[e]??e}function Vy(e){let t=SS.indexOf(e);return t===-1?999:t}function jy(e){let t=parseInt(e.line,10);return Number.isFinite(t)?`${e.file}:${t}`:e.file}function CS(e){let t=D(e),r=a.triage.get(t),n=r?.triage,o=jn(e),s=r?.color,i=r?.comment??"",l=pt(e.description??"",e),c=on(e),p=[c?`### ${jy(e)} - ${c}`:`### ${jy(e)}`,""],f=[];if(Qt(e)){let b=ua(e)?", varies across reports":"";f.push(`**Severity:** ${qu(Xt(e))} (corrected from ${qu(e.severity)}${b})`)}e.confidence!==void 0&&f.push(`**Confidence:** ${e.confidence}/10`),n?f.push(`**Triage:** ${n}`):o&&f.push("**Ignored**"),s&&f.push(`**Mark:** ${s}`),r?.flagged===!0&&f.push("**Flagged**"),f.length>0&&(p.push(f.join(", ")),p.push("")),l&&(p.push(l.trim()),p.push(""));let h=Hn(e);return h&&(p.push(h),p.push("")),e.recommendation&&(p.push(`**Recommendation:** ${pt(e.recommendation,e).trim()}`),p.push("")),e.confidenceReason&&(p.push(`**Confidence reason:** ${pt(e.confidenceReason,e).trim()}`),p.push("")),Qt(e)&&e.correctedSeverityReason&&(p.push(`**Severity correction:** ${e.correctedSeverityReason.trim()}`),p.push("")),e.fix&&(p.push(`**Fix:** ${pt(e.fix,e).trim()}`),p.push("")),i&&(p.push(`**Comment:** ${i.trim()}`),p.push("")),p.join(`
112
- `)}function ES(e){let t=(e.groups??[]).filter(r=>ge(r).commonTriage===a.shownTriage);return Er(t)}function AS(e,t){let r=t.flat(),n=[`# ${e.fileName}`,""];if(e.source&&(n.push(`**Source:** ${e.source}`),n.push("")),n.push(`**Findings:** ${r.length}`),n.push(""),r.length===0)return n.join(`
113
- `);let o=new Map;for(let i of r){let l=Xt(i)??"informational";o.has(l)||o.set(l,[]),o.get(l).push(i)}let s=[...o.keys()].toSorted((i,l)=>Vy(i)-Vy(l));for(let i of s){let l=o.get(i);n.push(`## ${qu(i)} (${l.length})`),n.push("");for(let c of l)n.push(CS(c))}return n.join(`
128
+ Use this only if you have lost access to your passkey and have no other way to unlock.`)&&confirm("Really wipe everything? This cannot be undone.")){try{await Io()}catch(o){alert(`Wipe failed: ${o?.message??o}. Try again or clear localStorage manually via DevTools.`);return}location.reload()}}),document.body.append(Ke),Ke}function SC(){return Mt()?ae()&&!$t():!1}function yv(){if(SC()){let e=_C();e.hidden=!1;let t=e.querySelector("button");t&&t.focus()}else if(Ke&&(Ke.hidden=!0,js))try{js.abort()}catch{}}Me(yv);yv();var vv=`dialog{max-width:640px;width:min(94vw,640px)}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}textarea{display:block;width:100%;box-sizing:border-box;min-height:9rem;max-height:50vh;resize:vertical;padding:.55rem .65rem;border:1px solid var(--border);border-radius:6px;background:var(--bg, var(--surface));color:var(--text);font:inherit;font-size:.88rem;line-height:1.4;&: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)}}
129
+ `;var ip=class extends I{static styles=[...I.styles,F(ao),F(vv)];static properties={initial:{attribute:!1},finding:{attribute:!1},_value:{state:!0}};constructor(){super(),this.initial="",this.finding=null,this._value=""}beforeOpen(){this._value=this.initial??""}focusInitial(){let t=this.renderRoot.querySelector("textarea");if(!t)return;t.focus();let r=t.value.length;try{t.setSelectionRange(r,r)}catch{}}_onInput=t=>{this._value=t.target.value};_onSave=()=>{let t=(this._value??"").trim(),r=(this.initial??"").trim();if(t===r){this._finish(null);return}this._finish(t)};_onClear=()=>this._finish("");_onCancel=()=>this._finish(null);_onKeydown=t=>{t.key==="Enter"&&(t.ctrlKey||t.metaKey)&&(t.preventDefault(),this._onSave())};render(){let t=this.finding??{},r=t.file?t.line?`${t.file}:${t.line}`:t.file:"",n=(this.initial??"").length>0;return d`<dialog @close="${this._onClose}"><header><h3>${n?"Edit comment":"Add comment"}</h3><div class="finding">${lo(ne(t,a.severityMode))} ${r?d`<span class="loc" title="${r}">${r}</span>`:m}</div>${t.description?d`<div class="desc" title="${t.description}">${t.description}</div>`:m}</header><textarea rows="6" placeholder="Write your notes here. Markdown is not rendered. Ctrl/⌘+Enter to save, Esc to cancel." .value="${this._value}" @input="${this._onInput}" @keydown="${this._onKeydown}"></textarea><footer class="nwd-actions">${n?d`<button type="button" class="danger" @click="${this._onClear}">Clear</button>`:m} <span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" @click="${this._onSave}">Save</button></footer></dialog>`}};customElements.define("comment-dialog",ip);function wv({initial:e="",finding:t=null}={}){return te("comment-dialog",{initial:e,finding:t})}var ap=class extends I{static styles=[...I.styles,F(_e)];static properties={bundleName:{type:String},encrypted:{type:Boolean}};constructor(){super(),this.bundleName="",this.encrypted=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(t){this._settled||super._finish({confirmed:!!t})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);_securityNote(){return this.encrypted?d`<p class="lwd-note">The bundle is saved <strong>unencrypted</strong> — even though your vault keeps its stored copy encrypted — and the file contains <strong>all of the bundle's related sources</strong>. Anyone with access to the downloaded file can read every bundled source, so store or share it with care.</p>`:d`<p class="lwd-note">The downloaded file is <strong>unencrypted</strong> and contains <strong>all of the bundle's related sources</strong>. Anyone with access to it can read every bundled source, so store or share it with care.</p>`}render(){return d`<dialog @close="${this._onClose}"><header><h3>Download bundle</h3></header><p class="lwd-body">Download <strong>"${this.bundleName}"</strong> to disk?</p>${this._securityNote()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" @click="${this._onConfirm}">Download</button></footer></dialog>`}};customElements.define("download-bundle-dialog",ap);function kv({name:e,encrypted:t}={}){return te("download-bundle-dialog",{bundleName:e??"",encrypted:!!t})}var EC={critical:"Critical",high:"High",medium:"Medium",low:"Low",high_bug:"High bug",bug:"Bug",informational:"Informational"},AC={red:"Red",blue:"Blue",green:"Green",gray:"Gray",none:"Unmarked"},TC={inprogress:"In progress",fixed:"Fixed",invalid:"Invalid",deleted:"Deleted",ignored:"Ignored"};function RC(e){return xe.filter(t=>e.has(t)).map(t=>EC[t]??t).join(", ")}function IC(){let e=[];if(a.filterSeverities.size>0&&e.push({label:"Severity",value:RC(a.filterSeverities)}),a.filterColors.size>0&&e.push({label:"Marks",value:[...a.filterColors].map(t=>AC[t]??t).join(", ")}),a.filterSources.size===1&&e.push({label:"Source",value:a.filterSources.has("own")?"Sources only":"Dependencies only"}),a.filterAnalyzer&&e.push({label:"Analyzer",value:a.filterAnalyzer===Rr?"(none)":a.filterAnalyzer}),a.filterModel&&e.push({label:"Model",value:a.filterModel===Ir?"(none)":a.filterModel}),a.filterRepo&&e.push({label:"Repository",value:a.filterRepo===fn?"(no repo)":a.filterRepo}),a.filterConfMin>0||a.filterConfMax<10){let t;a.filterConfMin>0&&a.filterConfMax<10?t=`${a.filterConfMin}\u2013${a.filterConfMax}`:a.filterConfMin>0?t=`\u2265 ${a.filterConfMin}`:t=`\u2264 ${a.filterConfMax}`,e.push({label:"Confidence",value:t})}a.filterInclude&&e.push({label:a.filterIncludeNegate?"Excluding":"Search",value:`"${a.filterInclude}"`});for(let[t,r]of[["filterComment","comment"],["filterFix","fix"],["filterFlagged","flag"]]){let n=a[t];n&&e.push({label:"Annotation",value:`${n==="with"?"With":"Without"} ${r}`})}return e}function MC(e){return(e==="download"?a.reports.flatMap(r=>r.groups??[]):St()).filter(r=>ve(r).commonTriage===a.shownTriage)}function $v(e){let t=MC(e),r=t.length,n=Mr(t).length;return{included:n,total:r,excluded:r-n,filters:IC(),bucketLabel:a.shownTriage?TC[a.shownTriage]??a.shownTriage:null,focusedOnly:e==="print"&&a.viewMode==="focus"}}var xv=`.ecd-count{margin:0;font-size:1.02rem;color:var(--text);& strong{color:var(--accent);font-weight:700}}.ecd-excluded{margin:.25rem 0 0;color:var(--muted);font-size:.82rem}.ecd-filters{margin:.9rem 0 0;display:grid;grid-template-columns:auto minmax(0,1fr);gap:.3rem .7rem;font-size:.82rem}.ecd-filters dt{color:var(--muted);font-weight:600;white-space:nowrap}.ecd-filters dd{color:var(--text);overflow-wrap:anywhere}.ecd-filters-label{margin:.9rem 0 0;font-size:.76rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--muted)}.ecd-filters-label+.ecd-filters{margin-top:.35rem}
130
+ `;var lp=class extends I{static styles=[...I.styles,F(xv)];static properties={mode:{type:String},included:{type:Number},excluded:{type:Number},total:{type:Number},filters:{attribute:!1},bucketLabel:{type:String},focusedOnly:{type:Boolean}};constructor(){super(),this.mode="print",this.included=0,this.excluded=0,this.total=0,this.filters=[],this.bucketLabel=null,this.focusedOnly=!1}focusInitial(){let t=this.included===0?'button[data-role="cancel"]':"button.primary";this.renderRoot.querySelector(t)?.focus()}_finish(t){this._settled||super._finish({confirmed:!!t})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);_countSection(){if(this.total===0)return d`<p class="ecd-count">No findings to ${this.mode==="print"?"print":"download"}.</p>`;if(this.focusedOnly&&this.included>0)return d`<p class="ecd-count">Only the <strong>focused</strong> finding will be printed.</p><p class="ecd-excluded">Focus mode prints just the finding you're viewing. Switch to the list or grouped view to print all ${this.included} matching ${this.included===1?"finding":"findings"}.</p>`;let r=this.excluded===0&&this.filters.length===0?d`All <strong>${this.included}</strong> ${this.included===1?"finding":"findings"} included.`:d`<strong>${this.included}</strong> of ${this.total} ${this.total===1?"finding":"findings"} included.`;return d`<p class="ecd-count">${r}</p>${this.excluded>0?d`<p class="ecd-excluded">${this.excluded} filtered out and ${this.mode==="print"?"won't be printed":"won't be downloaded"}.</p>`:m}`}_filtersSection(){return this.filters.length===0?d`<p class="ecd-filters-label">No filters active — the full ${this.bucketLabel?`${this.bucketLabel.toLowerCase()} `:""}set is included.</p>`:d`<p class="ecd-filters-label">Active filters</p><dl class="ecd-filters">${this.filters.map(t=>d`<dt>${t.label}</dt><dd>${t.value}</dd>`)}</dl>`}render(){let t=this.mode==="print",r=t?"Print report":"Download report",n=this.focusedOnly?"You're in focus mode \u2014 printing outputs just the finding you're focused on.":t?"Prints only the findings matching your current filters \u2014 the same set shown on screen. Use the toolbar to change the selection first.":"Downloads a Markdown file of the findings matching your current filters \u2014 the same set shown on screen. Use the toolbar to change the selection first.";return d`<dialog @close="${this._onClose}"><header><h3>${r}</h3></header><p class="nwd-intro">${n}</p>${this._countSection()} ${this.bucketLabel?d`<p class="nwd-note">Scoped to the <strong>${this.bucketLabel}</strong> list — live findings are not included.</p>`:m} ${this._filtersSection()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${this.included===0}" @click="${this._onConfirm}">${t?"Print":"Download"}</button></footer></dialog>`}};customElements.define("export-confirm-dialog",lp);function cp(e){let t=$v(e);return new Promise(r=>{let n=document.createElement("export-confirm-dialog");Object.assign(n,{mode:e,included:t.included,excluded:t.excluded,total:t.total,filters:t.filters,bucketLabel:t.bucketLabel,focusedOnly:t.focusedOnly});let o=s=>{n.remove(),r({confirmed:s})};n.addEventListener("resolve",s=>o(!!s.detail?.confirmed)),n.addEventListener("modal-conflict",()=>o(!1)),document.body.append(n)})}var _v=`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: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: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}
131
+ `;var dp=class extends I{static styles=[...I.styles,F(ao),F(_v)];static properties={initial:{attribute:!1},finding:{attribute:!1},_value:{state:!0}};constructor(){super(),this.initial="",this.finding=null,this._value=""}beforeOpen(){this._value=this.initial??""}focusInitial(){let t=this.renderRoot.querySelector('input[type="url"]');if(t){t.focus();try{t.select()}catch{}}}_onInput=t=>{this._value=t.target.value};_onSave=()=>{let t=(this._value??"").trim(),r=(this.initial??"").trim();if(t===r){this._finish(null);return}this._finish(t)};_onClear=()=>this._finish("");_onCancel=()=>this._finish(null);_onKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._onSave())};render(){let t=this.finding??{},r=t.file?t.line?`${t.file}:${t.line}`:t.file:"",n=(this.initial??"").length>0,o=(this._value??"").trim(),s=Ut(o);return d`<dialog @close="${this._onClose}"><header><h3>${n?"Edit fix link":"Add fix link"}</h3><div class="finding">${lo(ne(t,a.severityMode))} ${r?d`<span class="loc" title="${r}">${r}</span>`:m}</div>${t.description?d`<div class="desc" title="${t.description}">${t.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?d`<a class="open" href="${o}" target="_blank" rel="noopener noreferrer" title="Open in a new tab">Open ↗</a>`:m}</div><p class="hint">PR URL, issue link, commit, or any free-form reference. Enter to save, Esc to cancel.</p><footer class="nwd-actions">${n?d`<button type="button" class="danger" @click="${this._onClear}">Clear</button>`:m} <span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" @click="${this._onSave}">Save</button></footer></dialog>`}};customElements.define("fix-link-dialog",dp);function Sv({initial:e="",finding:t=null}={}){return te("fix-link-dialog",{initial:e,finding:t})}var LC={critical:"Critical",high:"High",medium:"Medium",low:"Low",high_bug:"High Bug",bug:"Bug",informational:"Informational"},OC=["critical","high","medium","low","high_bug","bug","informational"];function up(e){return LC[e]??e}function Cv(e){let t=OC.indexOf(e);return t===-1?999:t}function Ev(e){let t=parseInt(e.line,10);return Number.isFinite(t)?`${e.file}:${t}`:e.file}function PC(e){let t=D(e),r=a.triage.get(t),n=r?.triage,o=Jn(e),s=r?.color,i=r?.comment??"",{title:l,body:c}=Gn(e),u=dn(e),f=[u?`### ${Ev(e)} - ${u}`:`### ${Ev(e)}`,""],h=[];if(rr(e)){let w=wa(e)?", varies across reports":"";h.push(`**Severity:** ${up(tr(e))} (corrected from ${up(e.severity)}${w})`)}e.confidence!==void 0&&h.push(`**Confidence:** ${e.confidence}/10`);let b=mt(e);b&&h.push(`**Revalidation:** ${b}`),n?h.push(`**Triage:** ${n}`):o&&h.push("**Ignored**"),s&&h.push(`**Mark:** ${s}`),r?.flagged===!0&&h.push("**Flagged**"),h.length>0&&(f.push(h.join(", ")),f.push("")),l&&(f.push(l),f.push("")),c&&(f.push(c.trim()),f.push(""));let g=ws(e);return g&&(f.push(g),f.push("")),e.impact&&(f.push(`**Impact:** ${Te(e.impact,e).trim()}`),f.push("")),e.reproduction&&(f.push(`**Reproduction:** ${Te(e.reproduction,e).trim()}`),f.push("")),e.recommendation&&(f.push(`**Recommendation:** ${Te(e.recommendation,e).trim()}`),f.push("")),e.confidenceReason&&(f.push(`**Confidence reason:** ${Te(e.confidenceReason,e).trim()}`),f.push("")),e.revalidateVerdict&&(f.push(`**Revalidation verdict:** ${Te(e.revalidateVerdict,e).trim()}`),f.push("")),e.revalidateRecommendation&&(f.push(`**Revalidation recommendation:** ${Te(e.revalidateRecommendation,e).trim()}`),f.push("")),rr(e)&&e.correctedSeverityReason&&(f.push(`**Severity correction:** ${e.correctedSeverityReason.trim()}`),f.push("")),e.fix&&(f.push(`**Fix:** ${Te(e.fix,e).trim()}`),f.push("")),i&&(f.push(`**Comment:** ${i.trim()}`),f.push("")),f.join(`
132
+ `)}function NC(e){let t=(e.groups??[]).filter(r=>ve(r).commonTriage===a.shownTriage);return Mr(t)}function DC(e,t){let r=t.flat(),n=[`# ${e.fileName}`,""];if(e.source&&(n.push(`**Source:** ${e.source}`),n.push("")),n.push(`**Findings:** ${r.length}`),n.push(""),r.length===0)return n.join(`
133
+ `);let o=new Map;for(let i of r){let l=tr(i)??"informational";o.has(l)||o.set(l,[]),o.get(l).push(i)}let s=[...o.keys()].toSorted((i,l)=>Cv(i)-Cv(l));for(let i of s){let l=o.get(i);n.push(`## ${up(i)} (${l.length})`),n.push("");for(let c of l)n.push(PC(c))}return n.join(`
114
134
  `).trimEnd()+`
115
- `}function TS(e){let t=[];for(let r of e){let n=ES(r);n.length!==0&&t.push(AS(r,n))}return t.join(`
135
+ `}function zC(e){let t=[];for(let r of e){let n=NC(r);n.length!==0&&t.push(DC(r,n))}return t.join(`
116
136
  ---
117
137
 
118
- `)}function IS(e){let t=e.map(n=>n.fileName),r="";return t.length===1?r=t[0]:t.length>1&&(r=fa(t)),r=r.replace(/\.json$/u,""),`${r||"deepview-report"}.md`}function Wy(e){if(e.length===0)return;let t=TS(e),r=new Blob([t],{type:"text/markdown;charset=utf-8"});Ht(r,IS(e))}uc(()=>{a.currentView==="bundles"&&a.selectedBundle?x():a.currentView==="packages"?x():a.currentView==="repositories"?x():(a.currentView==="findings"||a.currentView==="files")&&V().catch(()=>{})});function Ky(){a.currentView==="bundles"&&a.bundleDetailsTab==="graph"?Ba():yu()}function Ga(){a.currentView==="bundles"&&a.bundleDetailsTab==="graph"?La():vu()}function so(){let e=document.querySelector(".bundle-source-code-wrap"),t=e?.scrollTop??0,r=e?.scrollLeft??0;x();let n=document.querySelector(".bundle-source-code-wrap");n&&(n.scrollTop=t,n.scrollLeft=r)}function Ps(e){let r=document.querySelector(e)?.scrollTop??0;x();let n=document.querySelector(e);n&&(n.scrollTop=r)}function Or(){a.viewMode==="table"?Ps(".findings-table-list"):x()}var Gu=0;function RS(){Gu||(Gu=requestAnimationFrame(()=>{Gu=0,x()}))}function Z(e,t){for(let r of e.composedPath())if(r?.matches?.(t))return r;return null}function qy(e){let r=Z(e,"[data-gid]")?.dataset?.gid,n=r?Ar(r):null;if(!n)return null;let o=ze(n);return tm(o,ga(o))}E.addEventListener("click",e=>{let t=Z(e,"[data-finding-code-bundle]");if(t){let _=t.dataset.findingCodeBundle,O=t.dataset.findingCodeFile,q=t.dataset.findingCodeLine,X=q?parseInt(q,10):null;a.bundleSourceFile=O||null,a.bundleSourceFindingIdx=null,(a.bundleDetailsTab==="code"||a.bundleDetailsTab==="search")&&(a.bundleDetailsTab="overview");let $e=()=>{Number.isFinite(X)&&queueMicrotask(()=>{let Ee=document.querySelector(`.bundle-source-lineno-row[data-line="${X}"]`);Ee&&Ee.scrollIntoView({block:"start",behavior:"instant"})})};if(a.selectedBundle===_&&a.bundleDetails?.integrity===_){x(),$e();return}a.selectedBundle=_,a.bundleDetails=null,x(),(async()=>(await Zt(_),$e()))();return}let r=e.target.closest("[data-package-expand]");if(r){let _=r.dataset.packageExpand;a.expandedPackages.has(_)?a.expandedPackages.delete(_):a.expandedPackages.add(_),x();return}let n=e.target.closest("[data-package-row-issues]");if(n){let _=n.dataset.packageRowIssues,O=n.dataset.packageRowIssuesVersion;a.selectedPackage=_,a.selectedPackageVersion=O||null,a.packageDetailsTab="issues",a.packageSlideTriage=null,a.packageSlideTransient=!0,x();return}let o=e.target.closest("[data-repository-row-issues]");if(o){let _=o.dataset.repositoryRowIssues;a.selectedRepository=_,a.repositoryDetailsTab="issues",a.repositorySlideTriage=null,a.repositorySlideTransient=!0,x();return}let s=e.target.closest("[data-select-package]");if(s){let _=s.dataset.selectPackage,O=s.dataset.selectPackageVersion??"",q=O===""?null:O;if(a.selectedPackage===_&&a.selectedPackageVersion===q)return;a.selectedPackage=_,a.selectedPackageVersion=q,a.packageDetailsTab="overview",a.packageSlideTriage=null,a.packageSlideTransient=!1,x();return}if(e.target.closest("[data-deselect-package]")){a.selectedPackage=null,a.selectedPackageVersion=null,x();return}let i=e.target.closest("[data-package-tab]");if(i){let _=i.dataset.packageTab;(_==="overview"||_==="issues")&&a.packageDetailsTab!==_&&(a.packageDetailsTab=_,x());return}if(e.target.closest('[data-action="package-slide-back"]')){a.packageDetailsTab="overview",a.packageSlideTriage=null,a.packageSlideTransient&&(a.selectedPackage=null,a.selectedPackageVersion=null,a.packageSlideTransient=!1),x();return}let l=e.target.closest("[data-package-report]");if(l){let _=l.dataset.packageReport;_&&Xe(_);return}let c=e.target.closest("[data-select-repository]");if(c){let _=c.dataset.selectRepository;if(a.selectedRepository===_)return;a.selectedRepository=_,a.repositoryDetailsTab="overview",a.repositorySlideTriage=null,a.repositorySlideTransient=!1,x();return}if(e.target.closest("[data-deselect-repository]")){a.selectedRepository=null,x();return}let u=e.target.closest("[data-repository-tab]");if(u){let _=u.dataset.repositoryTab;(_==="overview"||_==="issues")&&a.repositoryDetailsTab!==_&&(a.repositoryDetailsTab=_,x());return}if(e.target.closest('[data-action="repository-slide-back"]')){a.repositoryDetailsTab="overview",a.repositorySlideTriage=null,a.repositorySlideTransient&&(a.selectedRepository=null,a.repositorySlideTransient=!1),x();return}let p=e.target.closest("[data-bundle-tab]");if(p){let _=p.dataset.bundleTab;if(_s.has(_)){if(_===a.bundleDetailsTab){a.selectedBundle&&Fr(a.selectedBundle,_);return}a.bundleDetailsTab==="graph"&&_!=="graph"&&Re(),a.bundleDetailsTab=_,a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.selectedBundle&&Fr(a.selectedBundle,_),x(),_==="code"&&Es()}return}let f=e.target.closest("[data-bundle-download]");if(f){let _=f.dataset.bundleDownload,O=(a.bundles??[]).find(q=>q.integrity===_);if(!O)return;(async()=>{let{confirmed:q}=await Ny({name:O.name,encrypted:se()});if(q)try{let X=await jt(_);Ht(new Blob([X],{type:"application/octet-stream"}),O.name)}catch(X){alert(`Failed to download bundle: ${X.message}`)}})();return}let h=e.target.closest("[data-bundle-export-sbom]");if(h){let _=h.dataset.bundleExportSbom,O=a.bundleDetails,q=(a.bundles??[]).find(X=>X.integrity===a.selectedBundle);if(!q||!O||O.integrity!==q.integrity)return;try{let X=_==="cyclonedx",$e=X?Mm(O,q):Fm(O,q),Ee=`${ka(q.name)}.${X?"cdx":"spdx"}.json`;Ht(new Blob([$e],{type:"application/json"}),Ee)}catch(X){alert(`Failed to export ${_==="cyclonedx"?"CycloneDX":"SPDX"}: ${X.message}`)}return}if(Z(e,"[data-bundle-search-context]")){a.bundleSearchContext=!a.bundleSearchContext,Ps(".bundle-search-results");return}if(e.target.closest("[data-advisories-consent]")){vb(),x();return}if(e.target.closest("[data-advisories-retry]")){kb(a.bundleDetails,x).catch(()=>{}),x();return}let m=e.target.closest("[data-bundle-issue-report]");if(m){let _=m.dataset.bundleIssueReport;_&&Xe(_);return}if(e.target.classList?.contains("bundle-source-overlay")||e.target.closest('[data-action="bundle-source-close"]')){a.bundleSourceFile&&(a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,x());return}if(e.target.closest('[data-action="bundle-source-panel-close"]')){a.bundleSourceFindingIdx!=null&&(a.bundleSourceFindingIdx=null,so());return}let v=e.target.closest("[data-bundle-source-finding]");if(v){let _=parseInt(v.dataset.bundleSourceFinding,10);Number.isFinite(_)&&(a.bundleSourceFindingIdx=a.bundleSourceFindingIdx===_?null:_,so());return}let w=e.target.closest("[data-bundle-code-issue-step]");if(w){let _=w.closest("[data-bundle-code-issue-order]"),O=null;try{O=JSON.parse(_?.dataset.bundleCodeIssueOrder??"null")}catch{}if(Array.isArray(O)&&O.length>0){let q=w.dataset.bundleCodeIssueStep==="-1"?-1:1,X=O.findIndex(Ee=>Ee.idx===a.bundleSourceFindingIdx),$e=X===-1?q>0?O[0]:O.at(-1):O[(X+q+O.length)%O.length];a.bundleSourceFindingIdx=$e.idx,so(),$e.line>0&&queueMicrotask(()=>{let Ee=document.querySelector(`.bundle-source-lineno-row[data-line="${$e.line}"]`);Ee&&Ee.scrollIntoView({block:"center",behavior:"smooth"})})}return}let y=Z(e,"[data-bundle-view-source]");if(y){let _=y.dataset.bundleViewSource;if(!_)return;let O=y.dataset.bundleViewFindingIdx,q=O===void 0?null:parseInt(O,10),X=y.dataset.bundleViewLine,$e=X?parseInt(X,10):null,Ee=a.bundleSourceFile!==_;if(a.bundleSourceFile=_,Number.isFinite(q)?a.bundleSourceFindingIdx=q:Ee&&(a.bundleSourceFindingIdx=null),y.closest(".bundle-code-rail")?Ps(".bundle-code-rail-body"):y.closest(".bundle-search-results")?Ps(".bundle-search-results"):y.closest(".bundles-slide-body")?Ps(".bundles-slide-body"):x(),Number.isFinite($e)){let it=y.dataset.bundleViewScrollBlock||"center";queueMicrotask(()=>{let Oe=document.querySelector(`.bundle-source-lineno-row[data-line="${$e}"]`);Oe&&Oe.scrollIntoView({block:it,behavior:"smooth"})})}return}if(e.target.closest('[data-action="toggle-files"]')){a.currentView==="files"?a.currentView="findings":(a.viewMode==="graph"&&Re(),a.currentView="files"),document.body.classList.remove("report-fullscreen"),x();return}let C=Z(e,"[data-g2-pkg]");if(C){let _=C.dataset.g2Pkg;A.solo=A.solo===_?null:_,A.solo&&(A.selected=null),Ky(),Ga(),A.graphState?.requestDraw?.();return}let T=Z(e,"[data-g2-select]");if(T){A.selected=T.dataset.g2Select,Ky(),A.graphState?.requestDraw?.();return}let S=Z(e,"[data-g2-top-pkgs]");if(S){A.topPkgsTab=S.dataset.g2TopPkgs,Ga();return}let M=Z(e,"[data-g2-jump-findings]");if(M){if(a.currentView==="bundles"){a.bundleDetailsTab==="graph"&&Re(),a.bundleDetailsTab="issues",a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.selectedBundle&&Fr(a.selectedBundle,"issues"),x();return}Vn(),a.filterConfMin=0,a.filterInclude=M.dataset.g2JumpFindings,a.currentView="findings",a.viewMode==="graph"&&(a.viewMode="table"),Re(),x();return}let I=Z(e,"[data-g2-jump-file]");if(I){let _=I.dataset.g2JumpFile;a.currentView="files",Re(),x(),requestAnimationFrame(()=>{let O=document.querySelector(`#${bs(_)}`);O&&O.scrollIntoView({behavior:"smooth",block:"start"})});return}if(Z(e,"#g2-path-filter-clear")){A.pathFilter="";let _=document.querySelector("graph-layout")?.shadowRoot?.querySelector("#g2-path-filter");_&&(_.value=""),A.graphState?.requestDraw?.();return}if(Z(e,"#g2-fullscreen")){document.body.classList.toggle("report-fullscreen");return}if(Z(e,"[data-g2-show-all]")){A.showAll=!A.showAll,A.layoutCache=null,A.selected=null,Re(),x();return}if(Z(e,"[data-g2-split-own]")){A.splitOwnDirs=!A.splitOwnDirs,A.layoutCache=null,A.solo=null,A.focusedPkg=null,A.packagesView&&(A.selected=null),Re(),x();return}if(Z(e,"[data-g2-packages-view]")){A.packagesView=!A.packagesView,A.layoutCache=null,A.selected=null,A.focusedPkg=null,Re(),x();return}let ae=Z(e,".graph2-triage-selector [data-triage-show]");if(ae){let _=ae.dataset.triageShow;a.shownTriage=a.shownTriage===_?null:_,A.layoutCache=null,A.selected=null,Re(),x();return}let Qe=Z(e,"[data-g2-focus-pkg]");if(Qe){A.focusedPkg=Qe.dataset.g2FocusPkg,A.layoutCache=null,Re(),x();return}if(Z(e,"#g2-back-to-full")){A.focusedPkg=null,A.layoutCache=null,A.packagesView&&(A.selected=null),Re(),x();return}let Nr=Z(e,".tab");if(Nr&&Z(e,".tabs")){let O=Z(e,"[data-gid]").dataset.gid,q=Nr.dataset.tid;a.activeTabByGroup.set(O,q),Or();return}let rr=Z(e,"[data-triage-action]");if(rr){let _=rr.closest(".triage-menu"),O=_?.dataset.gid;if(!O)return;let q=Ar(O);if(!q)return;let X=rr.dataset.triageAction;if(!["inprogress","fixed","invalid","deleted","ignored","restore"].includes(X))return;let Ee=ge(q).hasConflict?[ze(q)]:q;for(let it of Ee){let Oe=D(it),ir=ha(it);X==="restore"?(z(a.triage,Oe,{triage:void 0}),he(a.triage,Oe,ir,!1)):X==="ignored"?qt(a.triage,Oe,ir)?he(a.triage,Oe,ir,!1):(z(a.triage,Oe,{triage:void 0}),he(a.triage,Oe,ir,!0)):a.triage.get(Oe)?.triage===X?z(a.triage,Oe,{triage:void 0}):(z(a.triage,Oe,{triage:X}),he(a.triage,Oe,ir,!1))}try{_.hidePopover()}catch{}pe(),Or();return}if(Z(e,".mark-comment")){let O=Z(e,"[data-gid]").dataset.gid,q=Ar(O);if(!q)return;let X=ze(q),$e=D(X),Ee=a.triage.get($e)?.comment??"";Py({initial:Ee,finding:X}).then(it=>(it===null||(z(a.triage,$e,{comment:it||void 0}),pe(),Or()),null)).catch(()=>{});return}let Dr=Z(e,".mark-copy");if(Dr){let _=qy(e);if(_===null)return;try{navigator.clipboard.writeText(_).then(()=>(Dr.classList.add("copied"),setTimeout(()=>Dr.classList.remove("copied"),1e3),null)).catch(()=>{})}catch{}return}let bn=Z(e,".mark-link");if(bn){let _=Z(e,"[data-gid]"),O=_?Ar(_.dataset.gid):null;if(!O)return;let q=Sy(ze(O));if(!q)return;try{navigator.clipboard.writeText(q).then(()=>(bn.classList.add("copied"),setTimeout(()=>bn.classList.remove("copied"),1e3),null)).catch(()=>{})}catch{}return}let yn=Z(e,"[data-copy-report]");if(yn){let _=yn.dataset.copyReport;try{navigator.clipboard.writeText(_).then(()=>(yn.classList.add("copied"),setTimeout(()=>yn.classList.remove("copied"),1e3),null)).catch(()=>{})}catch{}return}let xt=Z(e,"[data-copy-path]");if(xt){let _=xt.dataset.copyPath;try{navigator.clipboard.writeText(_).then(()=>(xt.classList.add("copied"),setTimeout(()=>xt.classList.remove("copied"),1e3),null)).catch(()=>{})}catch{}return}let nr=Z(e,".mark-claude");if(nr){let _=qy(e);if(_===null)return;let O=`claude://code/new?q=${encodeURIComponent(`Confirm and fix:
119
-
120
- ${_}`)}`;try{window.location.href=O,nr.classList.add("copied"),setTimeout(()=>nr.classList.remove("copied"),1e3)}catch{}return}if(Z(e,".mark-fix")){let O=Z(e,"[data-gid]").dataset.gid,q=Ar(O);if(!q)return;let X=ze(q),$e=D(X),Ee=a.triage.get($e)?.fix??"";Hy({initial:Ee,finding:X}).then(it=>(it===null||(z(a.triage,$e,{fix:it||void 0}),pe(),Or()),null)).catch(()=>{});return}let lo=Z(e,"[data-flag-toggle]");if(lo){let _=lo.dataset.flagToggle,O=a.triage.get(_)?.flagged;z(a.triage,_,{flagged:O!==!0}),pe(),Or();return}let sr=e.target.closest("[data-triage-show]");if(sr&&!sr.closest(".graph2-triage-selector")){let _=sr.dataset.triageShow;a.shownTriage=a.shownTriage===_?null:_,x();return}if(e.target.closest("[data-table-deselect]")){a.tableSelectedGid=null,Or();return}let co=e.target.closest("[data-tree-select]");if(co){let _=co.dataset.treeSelect;a.filesSelectedFile=a.filesSelectedFile===_?null:_,x();return}e.target.closest("[data-tree-deselect]")&&(a.filesSelectedFile=null,x())});var Gy=document.querySelector("#bundle-source-overlay-slot");Gy&&Gy.addEventListener("click",e=>{if(e.target.classList?.contains("bundle-source-overlay")||e.target.closest('[data-action="bundle-source-close"]')){a.bundleSourceFile&&(a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,x());return}if(e.target.closest('[data-action="bundle-source-panel-close"]')){a.bundleSourceFindingIdx!=null&&(a.bundleSourceFindingIdx=null,so());return}let t=e.target.closest("[data-bundle-source-finding]");if(t){let r=parseInt(t.dataset.bundleSourceFinding,10);Number.isFinite(r)&&(a.bundleSourceFindingIdx=a.bundleSourceFindingIdx===r?null:r,so())}});E.addEventListener("row-select",e=>{let t=e.detail?.gid;t&&(a.tableSelectedGid=a.tableSelectedGid===t?null:t,Or())});var Ya="application/x-deepview-kanban-gid";function MS(e,t){let n=ge(e).hasConflict?[ze(e)]:e;for(let o of n){let s=D(o),i=ha(o);t==="untriaged"?(z(a.triage,s,{triage:void 0}),he(a.triage,s,i,!1)):t==="ignored"?(z(a.triage,s,{triage:void 0}),he(a.triage,s,i,!0)):(z(a.triage,s,{triage:t}),he(a.triage,s,i,!1))}}function Ju(){for(let e of E.querySelectorAll(".kanban-card.dragging"))e.classList.remove("dragging");for(let e of E.querySelectorAll(".kanban-column.drag-over"))e.classList.remove("drag-over")}E.addEventListener("dragstart",e=>{let t=e.target.closest?.(".kanban-card[data-kanban-source]");if(!t||!e.dataTransfer)return;let r=t.dataset.gid;r&&(e.dataTransfer.setData(Ya,r),e.dataTransfer.setData("text/plain",r),e.dataTransfer.effectAllowed="move",t.classList.add("dragging"))});E.addEventListener("dragend",()=>{Ju()});E.addEventListener("dragover",e=>{if(!e.dataTransfer?.types.includes(Ya))return;let t=e.target.closest?.(".kanban-column[data-kanban-target]");if(t&&(e.preventDefault(),e.dataTransfer.dropEffect="move",!t.classList.contains("drag-over"))){for(let r of E.querySelectorAll(".kanban-column.drag-over"))r!==t&&r.classList.remove("drag-over");t.classList.add("drag-over")}});E.addEventListener("dragleave",e=>{let t=e.target.closest?.(".kanban-column[data-kanban-target]");t&&(t.contains(e.relatedTarget)||t.classList.remove("drag-over"))});E.addEventListener("drop",e=>{if(!e.dataTransfer?.types.includes(Ya))return;let t=e.target.closest?.(".kanban-column[data-kanban-target]");if(!t){Ju();return}e.preventDefault();let r=e.dataTransfer.getData(Ya),n=t.dataset.kanbanTarget;if(Ju(),!r||!n)return;let o=Ar(r);!o||(ge(o).commonTriage??"untriaged")===n||(MS(o,n),x(),queueMicrotask(pe))});var Yu=!1;function mn(e){return e?E.querySelector(`.kanban-card[data-gid="${CSS.escape(e)}"]`):null}function qa(e){let t=e??E.querySelector(".kanban-card");if(!t)return;let r=t.getBoundingClientRect();r.width<=0||r.height<=0||(document.documentElement.style.setProperty("--kanban-clip-card-w",`${Math.floor(r.width)}px`),document.documentElement.style.setProperty("--kanban-clip-card-h",`${Math.floor(r.height)}px`))}function Ns(e){let t=a.kanbanPopoverGid;if(t===e)return;let r=t===null&&e!==null,n=t!==null&&e===null;if(!document.startViewTransition||!r&&!n){a.kanbanPopoverGid=e,x();return}if(Yu)return;Yu=!0;let o=r?"kanban-opening":"kanban-closing";document.documentElement.classList.add(o);let s=u=>{u&&(u.style.viewTransitionName=""),document.documentElement.classList.remove(o),Yu=!1};if(r){let u=mn(e);u?(qa(u),u.style.viewTransitionName="kanban-detail-modal",u.getBoundingClientRect()):qa(),a.kanbanPopoverGid=e;let p=document.startViewTransition(()=>{x(),u&&(u.style.viewTransitionName="")}),f=setTimeout(()=>s(u),600);(async()=>{try{await p.finished}catch{}clearTimeout(f),s(u)})();return}qa(),a.kanbanPopoverGid=e;let i=null,l=document.startViewTransition(()=>{x(),i=mn(t),i&&(qa(i),i.style.viewTransitionName="kanban-detail-modal")}),c=setTimeout(()=>s(i??mn(t)),600);(async()=>{try{await l.finished}catch{}clearTimeout(c),s(i??mn(t))})()}function FS(e){let t=mn(a.kanbanPopoverGid),r=t?.closest(".kanban-column");if(!r)return;let n=[...r.querySelectorAll(".kanban-card[data-kanban-source]")],o=n.indexOf(t);if(o<0)return;let s=Math.min(Math.max(o+e,0),n.length-1);if(s===o)return;let i=n[s].dataset.gid;if(!i)return;Ns(i);let l=mn(i);l&&(l.focus({preventScroll:!0}),l.scrollIntoView({block:"nearest",behavior:"instant"}))}E.addEventListener("click",e=>{if(e.target.closest?.(".kanban-detail-close")){Ns(null);return}let t=e.target.closest?.("[data-kanban-expand]");if(t){let n=t.dataset.kanbanExpand,o=a.kanbanExpandedColumn===n?null:n;a.kanbanExpandedColumn=o,o&&a.kanbanPopoverGid&&mn(a.kanbanPopoverGid)?.closest(".kanban-column")?.dataset.kanbanTarget!==o&&(a.kanbanPopoverGid=null),x();return}if(e.target.closest?.(".kanban-action"))return;let r=e.target.closest?.(".kanban-card[data-kanban-source]");if(r){if(window.getSelection?.()?.toString())return;let n=r.dataset.gid;if(!n)return;Ns(a.kanbanPopoverGid===n?null:n);return}e.target.closest?.(".kanban-detail-modal")||a.kanbanPopoverGid&&Ns(null)});document.addEventListener("keydown",e=>{if(e.key==="Escape"){if(a.kanbanPopoverGid){Ns(null);return}a.viewMode!=="kanban"||a.kanbanExpandedColumn===null||(a.kanbanExpandedColumn=null,x())}});function Yy(e){if(!e||a.focusGid===e)return;a.focusGid=e,x();let t=E.querySelector(".focus-side-card.active");t&&t.scrollIntoView({block:"nearest",behavior:"instant"});let r=E.querySelector(".focus-code-line-active");r&&r.scrollIntoView({block:"center",behavior:"instant"})}function Jy(e){let t=E.querySelectorAll(".focus-side-card[data-focus-select]");if(t.length===0)return;let r=-1;for(let s=0;s<t.length;s++)if(t[s].classList.contains("active")){r=s;break}let n=r<0?e>0?0:t.length-1:Math.min(Math.max(r+e,0),t.length-1);if(n===r)return;let o=t[n].dataset.gid;o&&Yy(o)}E.addEventListener("click",e=>{let t=e.target.closest?.("[data-focus-nav]");if(t){Jy(t.dataset.focusNav==="next"?1:-1);return}let r=e.target.closest?.(".focus-side-card[data-focus-select]");if(!r||window.getSelection?.()?.toString())return;let n=r.dataset.gid;n&&Yy(n)});function BS(e){if(document.querySelector("dialog[open]"))return!0;for(let t of e.composedPath()){if(!t||t.nodeType!==1)continue;let r=t.tagName;if(r==="INPUT"||r==="TEXTAREA"||r==="SELECT"||r==="DIALOG"&&t.open||t.isContentEditable)return!0}return!1}document.addEventListener("keydown",e=>{if(a.currentView!=="findings")return;let t=a.viewMode==="focus",r=a.viewMode==="kanban"&&a.kanbanPopoverGid!==null;if(!t&&!r||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||BS(e))return;let n=0;if(e.key==="ArrowRight")n=1;else if(e.key==="ArrowLeft")n=-1;else return;e.preventDefault(),t?Jy(n):FS(n)});E.addEventListener("mark-color",e=>{let t=Z(e,"[data-gid]");if(!t)return;let r=t.dataset.gid,n=Ar(r);if(!n)return;let o=D(ze(n)),s=e.detail?.color;if(!s)return;a.triage.get(o)?.color===s?z(a.triage,o,{color:void 0}):z(a.triage,o,{color:s}),pe(),Or()});var Pr=null,Xu=null;function Xy(){if(Pr!==null||a.reports.length===0)return;Pr=a.viewMode,Xu=document.title,a.viewMode==="table"&&(a.viewMode="list",x());let e=a.reports.map(r=>r.fileName),t="";e.length===1?t=e[0]:e.length>1&&(t=fa(e)),t=t.replace(/\.json$/u,""),t&&(document.title=t)}function Qy(){Pr!==null&&(a.viewMode!==Pr&&(a.viewMode=Pr,x()),document.title=Xu,Pr=null,Xu=null)}window.addEventListener("beforeprint",Xy);window.addEventListener("afterprint",Qy);document.addEventListener("print-requested",async()=>{if(a.reports.length===0||Pr!==null)return;let{confirmed:e}=await Wu("print");if(e&&Pr===null){Xy();try{await Promise.all([...E.querySelectorAll("finding-card")].map(t=>t.updateComplete)),window.print()}catch(t){throw Qy(),t}}});document.addEventListener("download-requested",async()=>{if(a.reports.length===0)return;let{confirmed:e}=await Wu("download");e&&Wy(a.reports)});E.addEventListener("analyzer-change",e=>{a.filterAnalyzer=e.detail.analyzer,a.filterModel=e.detail.model,x()});E.addEventListener("repo-change",e=>{a.filterRepo=e.detail.value,x()});E.addEventListener("bundle-search-mode-change",e=>{let t=e.detail?.mode;t!=="files"&&t!=="code"&&t!=="issues"||(a.bundleCodeSearchMode=t,x(),t==="files"&&Es())});E.addEventListener("bundle-search-regex-toggle",()=>{a.bundleSearchRegex=!a.bundleSearchRegex,x()});E.addEventListener("bundle-search-case-toggle",()=>{a.bundleSearchCase=!a.bundleSearchCase,x()});E.addEventListener("bundle-swap",e=>{let t=e.detail?.integrity;!t||!(a.bundles??[]).some(r=>r.integrity===t)||(a.currentView="bundles",a.selectedBundle=t,a.bundleDetails=null,a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.bundleCodeSearchQuery="",a.bundleCodeSearchMode="files",a.bundleSearchQuery="",a.bundleSearchRegex=!1,a.bundleSearchCase=!1,a.bundleSearchContext=!0,a.bundleDetailsTab="compare",A.showAll=!0,a.shownTriage=null,Fr(t,"compare"),x(),V(),Zt(t))});E.addEventListener("sort-change",e=>{let{kind:t,value:r}=e.detail;if(t==="findings")a.sortBy=r;else if(t==="packages")a.packagesSortBy=r;else if(t==="repositories")a.repositoriesSortBy=r;else return;x()});E.addEventListener("range-change",e=>{e.target.id==="conf-range"&&(a.filterConfMin=e.detail.low,a.filterConfMax=e.detail.high,x())});E.addEventListener("input",e=>{let t=e.composedPath()[0],r=t?.id,n=t?.value;r==="g2-path-filter"&&(A.pathFilter=n,A.graphState?.requestDraw?.())});E.addEventListener("search-input",e=>{if(!e.detail)return;let{kind:t,value:r}=e.detail;if(t==="findings")a.filterInclude=r,r||(a.filterIncludeNegate=!1);else if(t==="files")a.filesSearch=r;else if(t==="packages")a.packagesSearchQuery=r;else if(t==="repositories")a.repositoriesSearchQuery=r;else if(t==="bundle-code")a.bundleCodeSearchQuery=r;else if(t==="bundle-search"){a.bundleSearchQuery=r,RS();return}else return;x()});E.addEventListener("search-negate-toggle",()=>{a.filterIncludeNegate=!a.filterIncludeNegate,x()});E.addEventListener("severity-toggle",e=>{let t=e.detail.severity;if(e.detail.kind==="graph"){A.selectedSeverities.has(t)?A.selectedSeverities.delete(t):A.selectedSeverities.add(t),e.composedPath()[0].selected=[...A.selectedSeverities],A.graphState?.requestDraw?.(),Ga();return}a.filterSeverities.has(t)?a.filterSeverities.delete(t):a.filterSeverities.add(t),x()});E.addEventListener("color-toggle",e=>{let t=e.detail.color;if(e.detail.kind==="graph"){A.selectedColors.has(t)?A.selectedColors.delete(t):A.selectedColors.add(t),e.composedPath()[0].selected=[...A.selectedColors],A.graphState?.requestDraw?.(),Ga();return}a.filterColors.has(t)?a.filterColors.delete(t):a.filterColors.add(t),x()});E.addEventListener("source-toggle",e=>{let t=e.detail.source,r=a.filterSources.has(t);a.filterSources.clear(),r||a.filterSources.add(t),x()});E.addEventListener("annotation-filter-toggle",e=>{let t=e.detail?.key,r=n=>n===""?"with":n==="with"?"without":"";if(t==="comment")a.filterComment=r(a.filterComment);else if(t==="fix")a.filterFix=r(a.filterFix);else if(t==="flag")a.filterFlagged=r(a.filterFlagged);else return;x()});E.addEventListener("slide-triage-toggle",e=>{let{kind:t,value:r}=e.detail;if(t==="package")a.packageSlideTriage=a.packageSlideTriage===r?null:r;else if(t==="repository")a.repositorySlideTriage=a.repositorySlideTriage===r?null:r;else return;x()});E.addEventListener("view-mode-change",e=>{if(e.detail.kind==="files"){a.filesViewMode=e.detail.mode,x();return}a.viewMode=e.detail.mode;try{localStorage.setItem(Ti,a.viewMode)}catch{}a.viewMode!=="kanban"&&(a.kanbanPopoverGid=null),a.viewMode!=="focus"&&(a.focusGid=null),x()});E.addEventListener("severity-mode-change",e=>{let t=e.detail?.mode;if(!(t!=="corrected"&&t!=="original")){a.severityMode=t;try{localStorage.setItem(Ii,t)}catch{}x()}});E.addEventListener("repo-edit-start",()=>{a.repoEditing=!0,x()});E.addEventListener("repo-input",e=>{a.repoUrl=e.detail.url,tt(a.currentFile,a.repoUrl)});E.addEventListener("repo-commit",e=>{a.repoUrl=e.detail.url,tt(a.currentFile,a.repoUrl),a.repoEditing=!1,x()});E.addEventListener("repo-cancel",e=>{a.repoUrl=e.detail.url,tt(a.currentFile,a.repoUrl),a.repoEditing=!1,x()});document.addEventListener("keydown",e=>{if(e.key==="Escape"){if(a.bundleSourceFindingIdx!=null){a.bundleSourceFindingIdx=null,so();return}if(a.bundleSourceFile){if(a.currentView==="bundles"&&a.bundleDetailsTab==="code")return;a.bundleSourceFile=null,x()}}});var Zy=`:host{position:absolute;top:.5rem;right:.5rem;z-index:1000;width:30px;height:30px;background:transparent;color:var(--muted);border:0;border-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: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}}
121
- `;var Qu="deepview.theme",io=Object.freeze(["dark","light","green","pink"]),OS={dark:{base:"#1a1a1b",dim:"#0a0a0a"},light:{base:"#f6f6fa",dim:"#646464"},green:{base:"#0a140a",dim:"#050a05"},pink:{base:"#ffe4ee",dim:"#a3727f"}},PS="\u2600",NS="\u263E",Zu="deepview-theme-changed",Ja="dark",tp=!1;function DS(){try{let e=localStorage.getItem(Qu);return io.includes(e)?e:"dark"}catch{return"dark"}}function Ds(e){io.includes(e)||(e="dark"),Ja=e;for(let r of io)r!=="dark"&&document.body.classList.remove(`theme-${r}`);e!=="dark"&&document.body.classList.add(`theme-${e}`);try{e==="dark"?localStorage.removeItem(Qu):localStorage.setItem(Qu,e)}catch{}let t=document.querySelector('meta[name="theme-color"]');if(t){let{base:r,dim:n}=OS[e];t.setAttribute("content",tp?n:r)}window.dispatchEvent(new CustomEvent(Zu,{detail:{theme:e}}))}Ds(DS());window.addEventListener("beforeprint",()=>{tp=!0,Ds(Ja)});window.addEventListener("afterprint",()=>{tp=!1,Ds(Ja)});function ev(e){if(!io.includes(e))throw new TypeError(`DeepView.setTheme: unknown theme ${JSON.stringify(e)} (expected one of ${io.map(t=>JSON.stringify(t)).join(", ")})`);Ds(e)}function tv(){return Ja}var rv=io,ep=class extends Q{static properties={_light:{state:!0}};static styles=B(Zy);constructor(){super(),this._light=document.body.classList.contains("theme-light")}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("tabindex")||(this.tabIndex=0),this.hasAttribute("aria-label")||this.setAttribute("aria-label","toggle theme"),this.hasAttribute("title")||this.setAttribute("title","toggle light/dark theme"),this.addEventListener("click",this._toggle),this.addEventListener("keydown",this._onKeydown),window.addEventListener(Zu,this._onThemeChanged)}disconnectedCallback(){window.removeEventListener(Zu,this._onThemeChanged),this.removeEventListener("click",this._toggle),this.removeEventListener("keydown",this._onKeydown),super.disconnectedCallback()}_onThemeChanged=()=>{this._light=document.body.classList.contains("theme-light")};_toggle=()=>{let t=document.body.classList.contains("theme-light");Ds(t?"dark":"light")};_onKeydown=t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this._toggle())};render(){return d`${this._light?NS:PS}`}};customElements.define("theme-toggle",ep);var nv=`:host{display:block}.row{display:grid;grid-template-columns:5.5rem minmax(0,1fr);gap:.2rem .85rem;padding:.25rem .7rem;font-size:.8rem;border-bottom:1px solid var(--border);transition:background .12s}:host(:last-child) .row{border-bottom:none}:host(:hover) .row{background:rgb(from var(--text) r g b / .04)}:host(.mark-red) .row{background:var(--mark-red-bg)}:host(.mark-blue) .row{background:var(--mark-blue-bg)}:host(.mark-green) .row{background:var(--mark-green-bg)}:host(.mark-gray) .row{background:var(--mark-gray-bg)}:host(.has-conflict) .row{outline:2px dashed var(--accent);outline-offset:-2px}:host(.triage-fixed),:host(.triage-invalid),:host(.triage-deleted),:host(.triage-ignored){opacity:.75}:host(.selected) .row{outline:2px solid var(--accent);outline-offset:-2px}:host(.link-target) .row{animation:link-target-flash 1.6s ease-out}@keyframes link-target-flash{0%,30%{box-shadow:inset 0 0 0 2px var(--accent)}to{box-shadow:inset 0 0 0 2px rgb(from var(--accent) r g b / 0)}}@media(prefers-reduced-motion:reduce){:host(.link-target) .row{animation:none;box-shadow:inset 0 0 0 2px var(--accent)}}:host(:first-of-type) .row{border-top-left-radius:6px;border-top-right-radius:6px}:host(:last-of-type) .row{border-bottom-left-radius:6px;border-bottom-right-radius:6px}.row-score{grid-column:1;grid-row:1 / 3;align-self:center;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.2rem;font-variant-numeric:tabular-nums;.badge{min-width:4.4rem;text-align:center}.row-conf{color:var(--muted);font-size:.72rem;user-select:none;& strong{color:var(--text);font-size:.8rem}}}.row-body{display:contents}.title-row{grid-column:2;grid-row:1;min-width:0;display:flex;align-items:baseline;gap:.5rem;.title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500;user-select:none}.row-type{color:var(--muted);font-size:.68rem;flex-shrink:0}}.meta-row{grid-column:2;grid-row:2;min-width:0;display:flex;align-items:center;gap:.55rem;.row-loc{color:var(--muted);font-size:.72rem;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;& a{color:inherit}& a:hover{color:var(--accent)}}.marks{display:flex;gap:.35rem;align-items:center;flex-shrink:0;user-select:none}}.tabs-row{grid-column:2;grid-row:3;min-width:0;.tabs{display:flex;gap:.25rem;flex-wrap:wrap}}.badge,.tabs,.tab,.row-type{cursor:default;user-select:none}.badge{display:inline-block;font-size:.7rem;font-weight:600;text-transform:uppercase;padding:.15rem .45rem;border-radius:3px;letter-spacing:.03em;line-height:1;&.critical{background:var(--critical);color:#fff}&.high{background:var(--high);color:#fff}&.medium{background:var(--medium);color:#000}&.low{background:var(--low);color:var(--badge-low-text)}&.high_bug{background:var(--high-bug);color:#fff}&.bug{background:var(--bug);color:#fff}&.informational{background:var(--info);color:#fff}}.badge-pair{display:inline-flex;align-items:center;gap:.25rem}.badge-pair-full,.badge-pair-compact{flex-direction:column;gap:.15rem}.badge-orig-wrap{display:inline-flex;align-items:center;gap:.15rem;line-height:1}.badge-arrow,.badge-corr-mark{font-size:.6rem;line-height:1;color:var(--muted)}.badge-arrow.up,.badge-corr-mark.up{color:var(--high)}.badge-pre{font-size:.55rem;text-transform:uppercase;letter-spacing:.03em;color:var(--muted)}.badge-orig{display:inline-block;font-size:.58rem;font-weight:600;text-transform:uppercase;padding:.08rem .3rem;border-radius:3px;letter-spacing:.03em;line-height:1;background:transparent;color:var(--muted);border:1px solid var(--border);&.struck{text-decoration:line-through;text-decoration-thickness:1px}&.critical{border-color:rgb(from var(--critical) r g b / .55)}&.high{border-color:rgb(from var(--high) r g b / .55)}&.medium{border-color:rgb(from var(--medium) r g b / .55)}&.low{border-color:rgb(from var(--low) r g b / .55)}&.high_bug{border-color:rgb(from var(--high-bug) r g b / .55)}&.bug{border-color:rgb(from var(--bug) r g b / .55)}&.informational{border-color:rgb(from var(--info) r g b / .55)}}.badge-varies{font-size:.55rem;font-weight:600;text-transform:uppercase;letter-spacing:.03em;padding:.08rem .3rem;border-radius:3px;line-height:1;background:transparent;color:var(--muted);border:1px dashed var(--border)}.tab{background:transparent;color:var(--text);border:1px solid var(--border);border-radius:4px;padding:.2rem .5rem;font-size:.75rem;line-height:1.3;display:inline-flex;align-items:center;gap:.35rem;font-family:inherit;&:hover{border-color:var(--accent)}&.active{border-color:var(--accent);background:var(--surface-active)}&.tab-mark-red{background:var(--mark-red-bg);border-color:var(--mark-red-tab-border)}&.tab-mark-blue{background:var(--mark-blue-bg);border-color:var(--mark-blue-tab-border)}&.tab-mark-green{background:var(--mark-green-bg);border-color:var(--mark-green-tab-border)}&.tab-mark-gray{background:var(--mark-gray-bg);border-color:var(--mark-gray-tab-border)}&.tab-mark-red.active,&.tab-mark-blue.active,&.tab-mark-green.active,&.tab-mark-gray.active{border-color:var(--text)}&.tab-deleted .tab-label{text-decoration:line-through;opacity:.6}&.tab-inprogress .tab-label:after{content:" \\25d0";opacity:.6}&.tab-fixed .tab-label{opacity:.65}&.tab-fixed .tab-label:after{content:" \\2713";opacity:.6}&.tab-invalid .tab-label{opacity:.65}&.tab-invalid .tab-label:after{content:" \\2298";opacity:.6}&.tab-ignored .tab-label{opacity:.55}&.tab-ignored .tab-label:after{content:" \\1f441";opacity:.6;font-size:.7em}.tab-conf{color:var(--muted);font-size:.7rem}&.tab-mark-red .tab-conf,&.tab-mark-blue .tab-conf,&.tab-mark-green .tab-conf,&.tab-mark-gray .tab-conf{color:var(--text)}.tab-marks{display:inline-flex;align-items:center;gap:.15rem;margin-left:.25rem;vertical-align:middle;color:var(--accent)}.tab-marks svg{display:block}.tab-marks .has-comment .bubble,.tab-marks .has-fix .wrench,.tab-marks .flagged .flag-cloth{fill:var(--accent);fill-opacity:.15}}.report-chip{display:inline-flex;align-items:center;gap:.3rem;padding:0 .35rem;height:1.4rem;border:1px solid var(--border);border-radius:3px;color:var(--muted);font-size:.72rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;margin-right:.65rem;max-width:12rem;min-width:0;.report-chip-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.file-icon{flex-shrink:0}.brand-deepview{.bg{fill:#2563eb}.fg{fill:#fff}}.brand-claude{.bg{fill:#d97757}.fg{fill:#fff}}.brand-codex{.bg{fill:#fff;stroke:#000;stroke-width:.5}.fg{fill:#000}}.brand-vercel{.bg{fill:#000;stroke:#fff;stroke-width:.5}.fg{fill:#fff}}.brand-piolium{.bg{fill:#fbb829}.fg{fill:#1c1b19}}}.mark-action-group{display:inline-flex;border:1px solid var(--border);border-radius:3px;overflow:hidden;margin-right:.25rem;flex-shrink:0}.mark-comment,.mark-fix,.mark-flag,.mark-copy,.mark-link,.mark-issue,.mark-claude{background:transparent;border:0;color:var(--muted);padding:0 .25rem;height:1.4rem;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--accent);background:var(--surface-active)}}.mark-issue{text-decoration:none}.mark-comment.has-comment,.mark-fix.has-fix,.mark-flag.flagged{color:var(--accent)}.mark-flag svg{display:block}.mark-copy.copied,.mark-link.copied,.mark-claude.copied{color:var(--green, #4ade80);background:color-mix(in srgb,var(--green, #4ade80) 14%,transparent)}.mark-comment.has-comment .bubble,.mark-fix.has-fix .wrench,.mark-flag.flagged .flag-cloth{fill:var(--accent);fill-opacity:.15}.mark-x{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:3px;padding:0 .35rem;font-size:.85rem;line-height:1.1;margin-left:.25rem;&:hover{color:var(--critical);border-color:var(--critical)}}.triage-menu-wrap{position:relative;display:inline-flex;margin-left:.25rem;flex-shrink:0}.mark-triage-menu{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:3px;padding:0 .3rem;height:1.5rem;display:inline-flex;align-items:center;justify-content:center;gap:.25rem;font:inherit}.mark-triage-menu:hover{color:var(--text);border-color:var(--accent)}.mark-triage-menu.open{border-color:var(--accent);color:var(--text)}.mark-triage-menu.with-label{padding:0 .35rem 0 .5rem;font-size:.72rem;height:1.5rem}.mark-triage-menu .mark-triage-label{text-transform:uppercase;letter-spacing:.05em;font-weight:600}.mark-triage-menu.triage-state-deleted{border-color:var(--critical);color:var(--critical)}.mark-triage-menu.triage-state-fixed{border-color:var(--green, #4ade80);color:var(--green, #4ade80)}.mark-triage-menu.triage-state-inprogress{border-color:var(--warning, #d97706);color:var(--warning, #d97706)}.mark-triage-menu.triage-state-invalid{border-color:var(--muted);color:var(--text)}.mark-triage-menu.triage-state-ignored{border-color:var(--accent, #2563eb);color:var(--accent, #2563eb)}.triage-menu[popover]{position:fixed;inset:auto;margin:0;min-width:7rem;background:var(--bg);border:1px solid var(--border);border-radius:4px;padding:.25rem;box-shadow:0 4px 12px #00000040;display:flex;flex-direction:column;gap:1px;-webkit-app-region:no-drag;app-region:no-drag}.triage-menu[popover]:not(:popover-open){display:none}.triage-menu[popover]:popover-open{display:flex}.triage-menu-item{background:transparent;border:0;padding:.35rem .5rem;font-size:.78rem;color:var(--text);text-align:left;border-radius:3px;font-family:inherit}.triage-menu-item:hover{background:var(--surface)}.triage-menu-item.active:before{content:"\\2713 ";color:var(--accent)}.triage-menu-inprogress:hover{color:var(--warning, #d97706)}.triage-menu-fixed:hover{color:var(--green, #4ade80)}.triage-menu-invalid:hover{color:var(--muted)}.triage-menu-deleted:hover{color:var(--critical)}.mark-restore{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:3px;padding:0 .45rem;font-size:.75rem;line-height:1.3;margin-left:.25rem;&:hover{color:var(--green);border-color:var(--green)}}.line-num{color:var(--muted);font-size:.75rem}.line-num a{color:inherit}.line-num a:hover{color:var(--accent)}@media print{:host(:hover) .row,:host(.mark-red) .row,:host(.mark-blue) .row,:host(.mark-green) .row,:host(.mark-gray) .row{background:transparent!important}:host(.triage-fixed),:host(.triage-invalid),:host(.triage-deleted),:host(.triage-ignored){opacity:1}:host(.selected) .row,:host(.has-conflict) .row{outline:none!important}:host(.link-target) .row{animation:none;box-shadow:none!important}.row{break-inside:avoid}.marks,.mark-x,.mark-restore{display:none!important}.badge{-webkit-print-color-adjust:exact;print-color-adjust:exact;&.critical{background:#a30b0f!important;color:#fff!important}&.high{background:#b8400a!important;color:#fff!important}&.medium{background:#855107!important;color:#fff!important}&.low{background:#374151!important;color:#fff!important}&.high_bug{background:#7a3e0c!important;color:#fff!important}&.bug{background:#4d4538!important;color:#fff!important}&.informational{background:#0550ae!important;color:#fff!important}}.badge-orig{background:transparent!important;color:#555!important;border-color:#999!important}.badge-varies{color:#555!important;border-color:#999!important}.badge-arrow,.badge-corr-mark,.badge-pre{color:#555!important}a,.line-num,.line-num a{color:inherit}}
122
- `;var US=["is-critical","mark-red","mark-blue","mark-green","mark-gray","has-conflict","triage-inprogress","triage-fixed","triage-invalid","triage-deleted","triage-ignored","selected"],rp=class extends U{static properties={group:{attribute:!1},selected:{type:Boolean}};static styles=B(nv);constructor(){super(),this.group=null,this.selected=!1}render(){if(!this.group)return d``;this.dataset.gid=dn(this.group);let t=new Set(mm(this.group));this.selected&&t.add("selected");for(let r of US)this.classList.toggle(r,t.has(r));return d`<div class="row">${bm(this.group)}</div>`}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._onClick),this.hasUpdated&&this.requestUpdate()}disconnectedCallback(){this.removeEventListener("click",this._onClick),super.disconnectedCallback()}_onClick=t=>{t.composedPath().some(n=>n?.matches?.("a, button, label"))||this.dataset.gid&&this.dispatchEvent(new CustomEvent("row-select",{detail:{gid:this.dataset.gid},bubbles:!0,composed:!0}))}};customElements.define("finding-row",rp);var ov=`:host{display:block;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:6px;overflow:hidden;box-shadow:var(--shadow-glass);margin-bottom:1rem;max-width:1200px}@media not print{finding-row{content-visibility:auto;contain-intrinsic-size:auto 3.2rem}}
123
- `;var np=class extends Q{static properties={items:{attribute:!1},selectedGid:{attribute:!1}};static styles=B(ov);constructor(){super(),this.items=[],this.selectedGid=null}render(){return d`${J(this.items??[],t=>dn(t),t=>d`<finding-row .group="${t}" ?selected="${dn(t)===this.selectedGid}"></finding-row>`)}`}};customElements.define("finding-table",np);var sv=`:host{display:block}:host(.hidden){display:none}:host(.triage-fixed),:host(.triage-invalid),:host(.triage-deleted),:host(.triage-ignored){opacity:.75}.card{padding:.5rem .75rem;border-bottom:1px solid var(--border);font-size:.875rem}:host(:last-child) .card{border-bottom:none}:host(.mark-red) .card{background:var(--mark-red-bg)}:host(.mark-blue) .card{background:var(--mark-blue-bg)}:host(.mark-green) .card{background:var(--mark-green-bg)}:host(.mark-gray) .card{background:var(--mark-gray-bg)}:host(.has-conflict) .card{outline:2px dashed var(--accent);outline-offset:-2px}:host(.link-target) .card{animation:link-target-flash 1.6s ease-out}@keyframes link-target-flash{0%,30%{box-shadow:inset 0 0 0 2px var(--accent)}to{box-shadow:inset 0 0 0 2px rgb(from var(--accent) r g b / 0)}}@media(prefers-reduced-motion:reduce){:host(.link-target) .card{animation:none;box-shadow:inset 0 0 0 2px var(--accent)}}:host([in-group]) .line-row{display:none}@media not print{:host([in-group]) .line-row+*{margin-top:0}:host([in-group]) .line-row+:is(.conf-reason,.severity-reason){padding-top:0;border-top:0}}.tabs{display:flex;gap:.25rem;flex-wrap:wrap}.marks-left{display:flex;align-items:center;gap:.5rem;margin-right:auto;flex-wrap:wrap}.commit-ref{color:var(--muted);font-size:.8rem;& a{color:var(--accent);font-family:ui-monospace,SFMono-Regular,Menlo,monospace}& a:hover{text-decoration:underline}& span{font-family:ui-monospace,SFMono-Regular,Menlo,monospace}}.marks-commit-row{margin-top:.4rem;padding-left:4.75rem}.tab-body{display:none;grid-template-columns:auto 1fr;gap:.25rem .75rem;&.active{display:grid}}.desc-title{grid-column:2;font-size:1.08em;font-weight:600;letter-spacing:-.005em;line-height:1.35;color:var(--text)}.desc{grid-column:2;white-space:pre-wrap;font-size:.96em;line-height:1.6;color:rgb(from var(--text) r g b / .82);margin-top:.4rem}.section,.evidence,.recommendation{grid-column:2;margin-top:.55rem;font-size:.92em}.section-label{display:flex;align-items:center;gap:.3rem;color:var(--muted);font-weight:600;font-size:.62rem;text-transform:uppercase;letter-spacing:.06em;&:before{content:"";flex:none;width:2px;height:.58rem;margin-left:calc((2px + .3rem)*-1);border-radius:1px;background:currentcolor;opacity:.75;-webkit-print-color-adjust:exact;print-color-adjust:exact}}.section-body{white-space:pre-wrap;line-height:1.55;color:rgb(from var(--text) r g b / .82);margin-top:.1rem}.recommendation .section-label,.recommendation .section-body{color:var(--green)}.conf-reason{grid-column:2;white-space:pre-wrap;font-size:.92em;font-style:italic;color:var(--muted);margin-top:.6rem;padding-top:.55rem;border-top:1px dashed var(--border)}.evidence-list{margin:.25rem 0 0;padding-left:1.6rem;display:flex;flex-direction:column;gap:.4rem;& li::marker{color:var(--muted);font-size:.9em}}.evidence-ref{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.92em;overflow-wrap:anywhere;color:var(--accent);text-decoration:none;&:hover{text-decoration:underline}}span.evidence-ref{color:var(--muted)}.evidence-note{white-space:pre-wrap;line-height:1.5;color:rgb(from var(--text) r g b / .78);margin-top:.1rem}.desc a,.section-body a,.conf-reason a{color:var(--accent);text-decoration:none;&:hover{text-decoration:underline}}.inline-quote{background:rgb(from var(--accent) r g b / .1);padding:1px;border-radius:3px;color:var(--text)}.inline-code{background:var(--surface-active);border-radius:3px;border:1px solid var(--border);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.9em;color:var(--text)}.line-row{display:flex;justify-content:space-between;align-items:baseline;gap:.5rem;flex-wrap:wrap}.run-meta{color:var(--muted);font-size:.65rem}.finding-code-btn{display:inline-block;margin-top:.35rem;padding:.1rem .45rem;background:transparent;border:1px solid var(--border);border-radius:999px;color:var(--muted);font:inherit;font-size:.65rem;font-weight:500;white-space:nowrap}.finding-code-btn:hover{border-color:var(--accent);color:var(--accent)}.marks{display:flex;gap:.35rem;justify-content:flex-end;margin-top:.4rem;align-items:center;padding-left:4.75rem;user-select:none}.finding-left{align-self:start;text-align:center;min-width:4rem;.value-label:last-child{margin-bottom:0}}.conf-score{font-size:.75rem;color:var(--muted);margin-top:.3rem;& strong{color:var(--text);font-size:.85rem}}.conf-ring{--col: var(--muted);position:relative;width:3rem;height:3rem;margin:.7rem auto .15rem;display:flex;align-items:center;justify-content:center;& svg{position:absolute;inset:0;width:100%;height:100%;transform:rotate(-90deg)}& circle{fill:none;stroke-width:4}.conf-ring-track{stroke:var(--border)}.conf-ring-arc{stroke:var(--col);stroke-linecap:round}& span{position:relative;z-index:1;font-size:.8rem;font-weight:700;color:var(--text);font-variant-numeric:tabular-nums}& small{font-size:.55rem;color:var(--muted);font-weight:500}&.critical{--col: var(--critical)}&.high{--col: var(--high)}&.medium{--col: var(--medium)}&.low{--col: var(--low)}&.high_bug{--col: var(--high-bug)}&.bug{--col: var(--bug)}&.informational{--col: var(--info)}}.value-label{display:block;font-size:.45rem;color:var(--muted);text-transform:uppercase;letter-spacing:.04em;margin-top:.1rem;margin-bottom:.3rem;font-weight:500}.print-case-label{display:none}.badge,.tabs,.tab,.value-label,.run-meta,.conf-ring{cursor:default;user-select:none}.badge{display:inline-block;font-size:.7rem;font-weight:600;text-transform:uppercase;padding:.15rem .45rem;border-radius:3px;letter-spacing:.03em;line-height:1;&.critical{background:var(--critical);color:#fff}&.high{background:var(--high);color:#fff}&.medium{background:var(--medium);color:#000}&.low{background:var(--low);color:var(--badge-low-text)}&.high_bug{background:var(--high-bug);color:#fff}&.bug{background:var(--bug);color:#fff}&.informational{background:var(--info);color:#fff}}.badge-pair{display:inline-flex;align-items:center;gap:.25rem}.badge-pair-full,.badge-pair-compact{flex-direction:column;gap:.15rem}.badge-orig-wrap{display:inline-flex;align-items:center;gap:.15rem;line-height:1}.badge-arrow,.badge-corr-mark{font-size:.6rem;line-height:1;color:var(--muted)}.badge-arrow.up,.badge-corr-mark.up{color:var(--high)}.badge-pre{font-size:.55rem;text-transform:uppercase;letter-spacing:.03em;color:var(--muted)}.badge-orig{display:inline-block;font-size:.58rem;font-weight:600;text-transform:uppercase;padding:.08rem .3rem;border-radius:3px;letter-spacing:.03em;line-height:1;background:transparent;color:var(--muted);border:1px solid var(--border);&.struck{text-decoration:line-through;text-decoration-thickness:1px}&.critical{border-color:rgb(from var(--critical) r g b / .55)}&.high{border-color:rgb(from var(--high) r g b / .55)}&.medium{border-color:rgb(from var(--medium) r g b / .55)}&.low{border-color:rgb(from var(--low) r g b / .55)}&.high_bug{border-color:rgb(from var(--high-bug) r g b / .55)}&.bug{border-color:rgb(from var(--bug) r g b / .55)}&.informational{border-color:rgb(from var(--info) r g b / .55)}}.badge-varies{font-size:.55rem;font-weight:600;text-transform:uppercase;letter-spacing:.03em;padding:.08rem .3rem;border-radius:3px;line-height:1;background:transparent;color:var(--muted);border:1px dashed var(--border)}.severity-reason{margin-top:.4rem;padding-top:.35rem;border-top:1px dashed var(--border);font-size:.82em;font-style:italic;color:var(--muted)}.severity-reason-label{font-style:normal;font-weight:600;text-transform:uppercase;font-size:.85em;letter-spacing:.04em;margin-right:.35rem}.tab{background:transparent;color:var(--text);border:1px solid var(--border);border-radius:4px;padding:.2rem .5rem;font-size:.75rem;line-height:1.3;display:inline-flex;align-items:center;gap:.35rem;font-family:inherit;&:hover{border-color:var(--accent)}&.active{border-color:var(--accent);background:var(--surface-active)}&.tab-mark-red{background:var(--mark-red-bg);border-color:var(--mark-red-tab-border)}&.tab-mark-blue{background:var(--mark-blue-bg);border-color:var(--mark-blue-tab-border)}&.tab-mark-green{background:var(--mark-green-bg);border-color:var(--mark-green-tab-border)}&.tab-mark-gray{background:var(--mark-gray-bg);border-color:var(--mark-gray-tab-border)}&.tab-mark-red.active,&.tab-mark-blue.active,&.tab-mark-green.active,&.tab-mark-gray.active{border-color:var(--text)}&.tab-deleted .tab-label{text-decoration:line-through;opacity:.6}&.tab-inprogress .tab-label:after{content:" \\25d0";opacity:.6}&.tab-fixed .tab-label{opacity:.65}&.tab-fixed .tab-label:after{content:" \\2713";opacity:.6}&.tab-invalid .tab-label{opacity:.65}&.tab-invalid .tab-label:after{content:" \\2298";opacity:.6}&.tab-ignored .tab-label{opacity:.55}&.tab-ignored .tab-label:after{content:" \\1f441";opacity:.6;font-size:.7em}.tab-conf{color:var(--muted);font-size:.7rem}&.tab-mark-red .tab-conf,&.tab-mark-blue .tab-conf,&.tab-mark-green .tab-conf,&.tab-mark-gray .tab-conf{color:var(--text)}.tab-marks{display:inline-flex;align-items:center;gap:.15rem;margin-left:.25rem;vertical-align:middle;color:var(--accent)}.tab-marks svg{display:block}.tab-marks .has-comment .bubble,.tab-marks .has-fix .wrench,.tab-marks .flagged .flag-cloth{fill:var(--accent);fill-opacity:.15}}.report-chip{display:inline-flex;align-items:center;gap:.3rem;padding:0 .35rem;height:1.4rem;border:1px solid var(--border);border-radius:3px;color:var(--muted);font-size:.72rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;margin-right:.65rem;max-width:16rem;min-width:0;.report-chip-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.file-icon{flex-shrink:0}.brand-deepview{.bg{fill:#2563eb}.fg{fill:#fff}}.brand-claude{.bg{fill:#d97757}.fg{fill:#fff}}.brand-codex{.bg{fill:#fff;stroke:#000;stroke-width:.5}.fg{fill:#000}}.brand-vercel{.bg{fill:#000;stroke:#fff;stroke-width:.5}.fg{fill:#fff}}.brand-piolium{.bg{fill:#fbb829}.fg{fill:#1c1b19}}}.mark-action-group{display:inline-flex;border:1px solid var(--border);border-radius:3px;overflow:hidden;margin-right:.25rem;flex-shrink:0}.mark-comment,.mark-fix,.mark-flag,.mark-copy,.mark-link,.mark-issue,.mark-claude{background:transparent;border:0;color:var(--muted);padding:0 .25rem;height:1.4rem;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--accent);background:var(--surface-active)}}.mark-issue{text-decoration:none}.mark-comment.has-comment,.mark-fix.has-fix,.mark-flag.flagged{color:var(--accent)}.mark-flag svg{display:block}.mark-copy.copied,.mark-link.copied,.mark-claude.copied{color:var(--green, #4ade80);background:color-mix(in srgb,var(--green, #4ade80) 14%,transparent)}.mark-comment.has-comment .bubble,.mark-fix.has-fix .wrench,.mark-flag.flagged .flag-cloth{fill:var(--accent);fill-opacity:.15}.mark-x{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:3px;padding:0 .35rem;font-size:.85rem;line-height:1.1;margin-left:.25rem;&:hover{color:var(--critical);border-color:var(--critical)}}.triage-menu-wrap{position:relative;display:inline-flex;margin-left:.25rem;flex-shrink:0}.mark-triage-menu{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:3px;padding:0 .3rem;height:1.5rem;display:inline-flex;align-items:center;justify-content:center;gap:.25rem;font:inherit}.mark-triage-menu:hover{color:var(--text);border-color:var(--accent)}.mark-triage-menu.open{border-color:var(--accent);color:var(--text)}.mark-triage-menu.with-label{padding:0 .35rem 0 .5rem;font-size:.72rem;height:1.5rem}.mark-triage-menu .mark-triage-label{text-transform:uppercase;letter-spacing:.05em;font-weight:600}.mark-triage-menu.triage-state-deleted{border-color:var(--critical);color:var(--critical)}.mark-triage-menu.triage-state-fixed{border-color:var(--green, #4ade80);color:var(--green, #4ade80)}.mark-triage-menu.triage-state-inprogress{border-color:var(--warning, #d97706);color:var(--warning, #d97706)}.mark-triage-menu.triage-state-invalid{border-color:var(--muted);color:var(--text)}.mark-triage-menu.triage-state-ignored{border-color:var(--accent, #2563eb);color:var(--accent, #2563eb)}.triage-menu[popover]{position:fixed;inset:auto;margin:0;min-width:7rem;background:var(--bg);border:1px solid var(--border);border-radius:4px;padding:.25rem;box-shadow:0 4px 12px #00000040;display:flex;flex-direction:column;gap:1px;-webkit-app-region:no-drag;app-region:no-drag}.triage-menu[popover]:not(:popover-open){display:none}.triage-menu[popover]:popover-open{display:flex}.triage-menu-item{background:transparent;border:0;padding:.35rem .5rem;font-size:.78rem;color:var(--text);text-align:left;border-radius:3px;font-family:inherit}.triage-menu-item:hover{background:var(--surface)}.triage-menu-item.active:before{content:"\\2713 ";color:var(--accent)}.triage-menu-inprogress:hover{color:var(--warning, #d97706)}.triage-menu-fixed:hover{color:var(--green, #4ade80)}.triage-menu-invalid:hover{color:var(--muted)}.triage-menu-deleted:hover{color:var(--critical)}:host([context="focus"]) .triage-menu-wrap>.mark-triage-menu{display:none}:host([context="focus"]) .triage-menu-wrap{display:inline-flex}:host([context="focus"]) .triage-menu[popover]{position:static;inset:auto;display:inline-flex!important;flex-flow:row wrap;margin:0;padding:0;background:transparent;border:0;border-radius:0;box-shadow:none;min-width:0;gap:.25rem}:host([context="focus"]) .triage-menu-item{background:transparent;border:1px solid var(--border);padding:.2rem .5rem;border-radius:3px;font-size:.72rem;font-weight:500;text-transform:uppercase;letter-spacing:.04em}:host([context="focus"]) .triage-menu-item.active{background:rgb(from var(--accent) r g b / .12);border-color:var(--accent);color:var(--accent)}:host([context="focus"]) .triage-menu-item:hover{background:var(--surface-active)}:host([context="focus"]) .triage-menu-inprogress.active{background:rgb(from var(--warning, #d97706) r g b / .12);border-color:var(--warning, #d97706);color:var(--warning, #d97706)}:host([context="focus"]) .triage-menu-fixed.active{background:rgb(from var(--green, #4ade80) r g b / .12);border-color:var(--green, #4ade80);color:var(--green, #4ade80)}:host([context="focus"]) .triage-menu-deleted.active{background:rgb(from var(--critical) r g b / .12);border-color:var(--critical);color:var(--critical)}:host([context="focus"]) .triage-menu-item.active:before{content:"";margin:0}:host([context="focus"]) .marks{gap:.5rem;margin-top:.65rem;padding-left:0;padding-top:.55rem;border-top:1px solid var(--border);flex-wrap:wrap}:host([context="focus"]) .marks-commit-row{padding-left:0}:host([context="focus"]) .mark-comment,:host([context="focus"]) .mark-fix,:host([context="focus"]) .mark-flag,:host([context="focus"]) .mark-copy,:host([context="focus"]) .mark-link,:host([context="focus"]) .mark-issue,:host([context="focus"]) .mark-claude{height:1.75rem;padding:0 .55rem;gap:.35rem;display:inline-flex;align-items:center;font-size:.72rem}:host([context="focus"]) .mark-btn-label{color:inherit;font-weight:500;letter-spacing:.02em}:host([context="focus"].mark-red) .card{background:color-mix(in srgb,var(--mark-red-bg) 15%,var(--bg))}:host([context="focus"].mark-blue) .card{background:color-mix(in srgb,var(--mark-blue-bg) 15%,var(--bg))}:host([context="focus"].mark-green) .card{background:color-mix(in srgb,var(--mark-green-bg) 15%,var(--bg))}:host([context="focus"].mark-gray) .card{background:color-mix(in srgb,var(--mark-gray-bg) 15%,var(--bg))}.comment-block,.fix-block{margin-top:.5rem;padding:.35rem .55rem;border-left:3px solid var(--accent);background:rgb(from var(--accent) r g b / .08);border-radius:0 4px 4px 0;font-size:.82rem;color:var(--text)}.comment-block{white-space:pre-wrap;& a{color:var(--accent);text-decoration:none}& a:hover{text-decoration:underline}& a.comment-self-ref{text-decoration:underline dotted;text-underline-offset:2px}& a.comment-self-ref:hover{text-decoration:underline solid}}.fix-block{word-break:break-all;& a{color:var(--accent);text-decoration:none}& a:hover{text-decoration:underline}}.comment-label,.fix-label{color:var(--muted);font-weight:600;margin-right:.35rem}.mark-restore{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:3px;padding:0 .45rem;font-size:.75rem;line-height:1.3;margin-left:.25rem;&:hover{color:var(--green);border-color:var(--green)}}.line-num{color:var(--muted);font-size:.8rem}.line-num a{color:inherit}.line-num a:hover{color:var(--accent)}.npm-link{display:inline-block;padding:0 .4rem;border:1px solid var(--border);border-radius:3px;font-size:.72rem;font-weight:500;color:var(--muted);text-decoration:none}.npm-link:hover{border-color:var(--accent);color:var(--accent)}@media print{.card{break-inside:avoid;padding:.45rem .25rem}.finding-code-btn,.mark-copy,.mark-link,.mark-issue,.mark-claude{display:none!important}.npm-link{border:0;padding:0}:host(.triage-fixed),:host(.triage-invalid),:host(.triage-deleted),:host(.triage-ignored){opacity:1}:host(.link-target) .card{animation:none;box-shadow:none!important}:host(.multi-case) .card:before{content:"Multiple reports of one finding";display:block;font-size:.7rem;font-weight:700;color:#555;text-transform:uppercase;letter-spacing:.06em;border-bottom:1px solid #bbb;padding-bottom:.2rem;margin-bottom:.35rem;-webkit-print-color-adjust:exact;print-color-adjust:exact}.marks,.tabs{display:none!important}.tab-body{display:grid!important}.tab-body+.tab-body{margin-top:.5rem;padding-top:.5rem;border-top:1px dashed #999}:host([in-group].multi-case) .tab-body .line-row{display:flex}:host([in-group]:not(.multi-case)) .line-row+*{margin-top:0}:host([in-group]:not(.multi-case)) .line-row+.conf-reason{padding-top:0;border-top:0}.line-row .discovered-in{flex-basis:100%;order:99}.print-case-label{display:block;grid-column:1 / -1;font-size:.65rem;font-weight:600;color:#555;background:#eee;padding:.1rem .35rem;border-radius:3px;margin-bottom:.25rem;letter-spacing:.04em;-webkit-print-color-adjust:exact;print-color-adjust:exact}.value-label{color:#777}.badge{-webkit-print-color-adjust:exact;print-color-adjust:exact;&.critical{background:#a30b0f!important;color:#fff!important}&.high{background:#b8400a!important;color:#fff!important}&.medium{background:#855107!important;color:#fff!important}&.low{background:#374151!important;color:#fff!important}&.high_bug{background:#7a3e0c!important;color:#fff!important}&.bug{background:#4d4538!important;color:#fff!important}&.informational{background:#0550ae!important;color:#fff!important}}.badge-orig{background:transparent!important;color:#555!important;border-color:#999!important}.badge-varies{color:#555!important;border-color:#999!important}.badge-arrow,.badge-corr-mark,.badge-pre,.severity-reason{color:#555!important}a,.line-num,.line-num a,.desc a,.section-body a,.conf-reason a,.evidence-ref{color:inherit}.inline-code{border:0;background:transparent;padding:0}}
124
- `;var jS=["finding","is-critical","mark-red","mark-blue","mark-green","mark-gray","has-conflict","triage-inprogress","triage-fixed","triage-invalid","triage-deleted","triage-ignored","multi-case"],op=class extends U{static properties={group:{attribute:!1},inGroup:{type:Boolean,attribute:"in-group",reflect:!0},context:{type:String,reflect:!0}};static styles=B(sv);constructor(){super(),this.group=null,this.inGroup=!1,this.context=null}render(){if(!this.group)return d``;this.dataset.gid=Kn(this.group);let t=new Set(hm(this.group));for(let r of jS)this.classList.toggle(r,t.has(r));return d`<div class="card">${gm(this.group,{context:this.context})}</div>`}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.requestUpdate()}};customElements.define("finding-card",op);var iv=`:host{display:inline-flex;gap:4px;align-items:center;flex-shrink:0}button{width:14px;height:14px;user-select:none;padding:0;background:transparent;border:1.5px solid currentcolor;border-radius:50%;opacity:.55;transition:opacity .12s,transform .12s}button:hover{opacity:1;transform:scale(1.12)}button.active{background:currentcolor;opacity:1;box-shadow:0 0 0 2px var(--surface),0 0 0 3px currentcolor}.color-red{color:var(--marker-red)}.color-blue{color:var(--marker-blue)}.color-green{color:var(--marker-green)}.color-gray{color:var(--marker-gray)}
125
- `;var KS=["red","blue","green","gray"],sp=class extends Q{static properties={selected:{type:String}};static styles=B(iv);constructor(){super(),this.selected=null}render(){return d`${KS.map(t=>d`<button type="button" class="${`color-${t}${this.selected===t?" active":""}`}" data-color="${t}" title="${`mark ${t}`}" @click="${this._onClick}"></button>`)}`}_onClick=t=>{let r=t.currentTarget.dataset.color;this.dispatchEvent(new CustomEvent("mark-color",{detail:{color:r},bubbles:!0,composed:!0}))}};customElements.define("color-marker",sp);var ip=class extends U{createRenderRoot(){return this}render(){let t=a.filterConfMin,r=a.filterConfMax;return d`<span class="conf-range-label">Confidence</span><range-slider id="conf-range" min="0" max="10" step="1" low="${t}" high="${r}" aria-label="Confidence range"></range-slider><conf-range-mirror id="conf-range-vals" class="conf-vals" for="conf-range" .low="${t}" .high="${r}"></conf-range-mirror>`}};customElements.define("conf-filter",ip);var Me=_t(class extends at{constructor(e){if(super(e),e.type!==He.PROPERTY&&e.type!==He.ATTRIBUTE&&e.type!==He.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!lf(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[t]){if(t===be||t===g)return t;let r=e.element,n=e.name;if(e.type===He.PROPERTY){if(t===r[n])return be}else if(e.type===He.BOOLEAN_ATTRIBUTE){if(!!t===r.hasAttribute(n))return be}else if(e.type===He.ATTRIBUTE&&r.getAttribute(n)===t+"")return be;return ti(e),t}});var av={files:"Filter files\u2026",code:"Search code\u2026",issues:"Search issues\u2026"},lv={files:"Filter files",code:"Search code",issues:"Search issues"},qS=d`<svg class="bundle-code-search-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="6.5" cy="6.5" r="4.5"/><path d="M9.7 9.7L13 13" stroke-linecap="round"/></svg>`,GS={files:d`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 4.5a1 1 0 0 1 1-1h3.2l1.3 1.5H13a1 1 0 0 1 1 1V12a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4.5Z"/></svg>`,code:d`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5.5 4.5L2 8l3.5 3.5"/><path d="M10.5 4.5L14 8l-3.5 3.5"/></svg>`,issues:d`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.3" aria-hidden="true"><circle cx="8" cy="8" r="6"/><path d="M8 4.8v3.6" stroke-linecap="round"/><circle cx="8" cy="11" r=".7" fill="currentColor" stroke="none"/></svg>`},ap=class extends U{static properties={modes:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.modes=[]}render(){let t=a.bundleCodeSearchQuery,r=a.bundleCodeSearchMode,n=this.modes.includes(r)?r:"files",o=av[n]??av.files;return d`${qS} <input type="text" class="bundle-code-search-input" placeholder="${o}" aria-label="${o}" .value="${Me(t)}" @input="${this._onInput}"> ${t?d`<button type="button" class="bundle-code-search-clear" title="Clear search" aria-label="Clear search" @click="${this._onClear}">×</button>`:g} ${this.modes.length>0?d`<span class="bundle-code-search-modes" role="tablist">${this.modes.map(s=>d`<button type="button" class="${F({"bundle-code-search-mode":!0,active:n===s})}" role="tab" aria-selected="${String(n===s)}" title="${lv[s]??s}" aria-label="${lv[s]??s}" @click="${()=>this._selectMode(s)}">${GS[s]??g}</button>`)}</span>`:g}`}_onInput=t=>{this._dispatchInput(t.target.value)};_onClear=()=>{this._dispatchInput("")};_dispatchInput(t){this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:"bundle-code",value:t},bubbles:!0,composed:!0}))}_selectMode(t){this.dispatchEvent(new CustomEvent("bundle-search-mode-change",{detail:{mode:t},bubbles:!0,composed:!0}))}};customElements.define("bundle-code-search",ap);var YS=d`<svg class="bundle-search-icon" viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="6.5" cy="6.5" r="4.5"/><path d="M9.7 9.7L13 13" stroke-linecap="round"/></svg>`,lp=class extends U{createRenderRoot(){return this}render(){let t=a.bundleSearchQuery,r=a.bundleSearchRegex,n=a.bundleSearchCase,o=r?"Search by regular expression\u2026":"Search all source\u2026";return d`${YS} <input type="text" class="bundle-search-input" placeholder="${o}" aria-label="${o}" spellcheck="false" autocapitalize="off" autocomplete="off" .value="${Me(t)}" @input="${this._onInput}"> ${t?d`<button type="button" class="bundle-search-clear" title="Clear search" aria-label="Clear search" @click="${this._onClear}">×</button>`:g} <span class="bundle-search-mods"><button type="button" class="${F({"bundle-search-mod":!0,active:n})}" title="${n?"Case-sensitive on \u2014 click to ignore case":"Match case"}" aria-label="Match case" aria-pressed="${String(n)}" @click="${this._onToggleCase}">Aa</button> <button type="button" class="${F({"bundle-search-mod":!0,active:r})}" title="${r?"Regular expression on \u2014 click for plain text":"Match by regular expression"}" aria-label="Match by regular expression" aria-pressed="${String(r)}" @click="${this._onToggleRegex}">.*</button></span>`}_onInput=t=>{this._dispatchInput(t.target.value)};_onClear=()=>{this._dispatchInput("")};_dispatchInput(t){this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:"bundle-search",value:t},bubbles:!0,composed:!0}))}_onToggleRegex=()=>{this.dispatchEvent(new CustomEvent("bundle-search-regex-toggle",{bubbles:!0,composed:!0}))};_onToggleCase=()=>{this.dispatchEvent(new CustomEvent("bundle-search-case-toggle",{bubbles:!0,composed:!0}))}};customElements.define("bundle-search",lp);var cv={packages:{stateKey:"packagesSearchQuery",label:"Filter packages"},repositories:{stateKey:"repositoriesSearchQuery",label:"Filter repositories"}},cp=class extends U{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let t=cv[this.kind];return t?d`<input type="search" class="packages-search" placeholder="${`${t.label}\u2026`}" aria-label="${t.label}" .value="${Me(a[t.stateKey])}" @input="${this._onInput}">`:(console.warn(`<entity-search>: unknown kind ${JSON.stringify(this.kind)}; expected one of ${Object.keys(cv).map(r=>JSON.stringify(r)).join(", ")}.`),g)}_onInput=t=>{this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:this.kind,value:t.target.value},bubbles:!0,composed:!0}))}};customElements.define("entity-search",cp);var JS=[["findings-desc","Findings \u2193"],["files-desc","Files \u2193"],["reports-desc","Reports \u2193"],["name-asc","Name A\u2192Z"]],dv={packages:{stateKey:"packagesSortBy",aria:"Sort packages"},repositories:{stateKey:"repositoriesSortBy",aria:"Sort repositories"}},dp=class extends U{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let t=dv[this.kind];return t?d`<select class="packages-sort" aria-label="${t.aria}" .value="${Me(a[t.stateKey])}" @change="${this._onChange}">${JS.map(([r,n])=>d`<option value="${r}">${n}</option>`)}</select>`:(console.warn(`<entity-sort>: unknown kind ${JSON.stringify(this.kind)}; expected one of ${Object.keys(dv).map(r=>JSON.stringify(r)).join(", ")}.`),g)}_onChange=t=>{this.dispatchEvent(new CustomEvent("sort-change",{detail:{kind:this.kind,value:t.target.value},bubbles:!0,composed:!0}))}};customElements.define("entity-sort",dp);var up=class extends U{static properties={showFile:{type:Boolean,attribute:"show-file"},showConfidence:{type:Boolean,attribute:"show-confidence"},showPriority:{type:Boolean,attribute:"show-priority"}};createRenderRoot(){return this}constructor(){super(),this.showFile=!1,this.showConfidence=!1,this.showPriority=!1}render(){let t=(r,n)=>d`<option value="${r}">${n}</option>`;return d`<select class="sort-select" aria-label="Sort findings" .value="${Me(a.sortBy)}" @change="${this._onChange}">${t("severity","Severity \u2193")} ${this.showFile?t("file","File \u2191"):g} ${this.showConfidence?d`${t("confidence-desc","Confidence \u2193")}${t("confidence-asc","Confidence \u2191")}`:g} ${this.showPriority?d`${t("priority-desc","Priority \u2193")}${t("priority-asc","Priority \u2191")}`:g}</select>`}_onChange=t=>{this.dispatchEvent(new CustomEvent("sort-change",{detail:{kind:"findings",value:t.target.value},bubbles:!0,composed:!0}))}};customElements.define("findings-sort",up);var uv=`:host{display:inline-flex;align-items:center;width:8.5rem;height:16px;--rs-thumb-size: 14px;--rs-track-height: 3px;--rs-rail: rgb(from currentcolor r g b / .25);--rs-fill: var(--accent, currentColor)}.track-wrap{position:relative;flex:1;height:var(--rs-thumb-size)}.track{position:absolute;left:0;right:0;top:50%;height:var(--rs-track-height);transform:translateY(-50%);border-radius:99px;background:linear-gradient(to right,var(--rs-rail) 0,var(--rs-rail) var(--low, 0%),var(--rs-fill) var(--low, 0%),var(--rs-fill) var(--high, 100%),var(--rs-rail) var(--high, 100%))}input[type=range]{appearance:none;-webkit-appearance:none;position:absolute;left:0;right:0;top:0;width:100%;height:var(--rs-thumb-size);background:transparent;pointer-events:none;margin:0;padding:0;outline:none}input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;pointer-events:auto;width:var(--rs-thumb-size);height:var(--rs-thumb-size);border-radius:50%;background:var(--rs-fill);border:0;box-shadow:0 1px 3px #00000080}input[type=range]::-moz-range-thumb{pointer-events:auto;width:var(--rs-thumb-size);height:var(--rs-thumb-size);border-radius:50%;background:var(--rs-fill);border:0;box-shadow:0 1px 3px #00000080}input[type=range]::-webkit-slider-runnable-track{background:transparent;height:var(--rs-thumb-size)}
126
- `;var pp=class extends Q{static properties={min:{type:Number},max:{type:Number},step:{type:Number},low:{type:Number},high:{type:Number}};static styles=B(uv);constructor(){super(),this.min=0,this.max=100,this.step=1,this.low=0,this.high=100}willUpdate(){this.low<this.min&&(this.low=this.min),this.high>this.max&&(this.high=this.max),this.low>this.high&&(this.low=this.high)}render(){let t=this.max-this.min||1,r=(this.low-this.min)/t*100,n=(this.high-this.min)/t*100;return d`<div class="track-wrap" style="${`--low:${r}%;--high:${n}%`}"><div class="track"></div><input type="range" min="${this.min}" max="${this.max}" step="${this.step}" @input="${this._onInput}" @change="${this._onChange}"> <input type="range" min="${this.min}" max="${this.max}" step="${this.step}" @input="${this._onInput}" @change="${this._onChange}"></div>`}firstUpdated(){this._inputs=[...this.renderRoot.querySelectorAll('input[type="range"]')],this._inputs[0].value=this.low,this._inputs[1].value=this.high}updated(t){if(!this._inputs||!(t.has("low")||t.has("high")))return;let r=this._inputs.map(i=>Number(i.value)),n=r[0]>r[1],o=n?1:0,s=n?0:1;this.low!==r[o]&&(this._inputs[o].value=this.low),this.high!==r[s]&&(this._inputs[s].value=this.high)}_onInput=()=>{let t=Number(this._inputs[0].value),r=Number(this._inputs[1].value);this.low=Math.min(t,r),this.high=Math.max(t,r),this._emit("range-input")};_onChange=()=>{this._emit("range-change")};_emit(t){this.dispatchEvent(new CustomEvent(t,{detail:{low:this.low,high:this.high},bubbles:!0,composed:!0}))}};customElements.define("range-slider",pp);var fp=class extends Q{static properties={low:{type:Number},high:{type:Number},for:{type:String}};createRenderRoot(){return this}constructor(){super(),this.low=0,this.high=10,this.for="conf-range",this._dragging=!1,this._liveLow=0,this._liveHigh=10}connectedCallback(){super.connectedCallback(),document.addEventListener("range-input",this._onRangeInput),document.addEventListener("range-change",this._onRangeChange)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("range-input",this._onRangeInput),document.removeEventListener("range-change",this._onRangeChange)}willUpdate(t){this._dragging&&(t.has("low")&&this.low!==this._liveLow&&(this.low=this._liveLow),t.has("high")&&this.high!==this._liveHigh&&(this.high=this._liveHigh))}_onRangeInput=t=>{t.target?.id===this.for&&(this._dragging=!0,this._liveLow=t.detail.low,this._liveHigh=t.detail.high,this.low=t.detail.low,this.high=t.detail.high)};_onRangeChange=t=>{t.target?.id===this.for&&(this._dragging=!1)};render(){return d`<span>${this.low}</span><span class="dash">–</span><span>${this.high}</span>`}};customElements.define("conf-range-mirror",fp);var pv=`dialog{max-width:560px;width:min(94vw,560px)}header h3{margin:0 0 .25rem}header p{margin:0 0 .9rem;color:var(--muted);font-size:.82rem}hr{border:0;border-top:1px solid var(--border);margin:.9rem 0}.section h4{margin:0 0 .25rem;font-size:.82rem;font-weight:600;text-transform:uppercase;letter-spacing:.08em;color:var(--muted)}.section p{margin:0 0 .55rem;color:var(--muted);font-size:.78rem}.section button{background:transparent;border:1px solid var(--border);color:var(--text);border-radius:5px;padding:.35rem .9rem;font:inherit;font-size:.8rem;&:hover{border-color:var(--accent);color:var(--accent)}&.primary{background:var(--accent);color:var(--surface);border-color:var(--accent)}&.primary:hover{filter:brightness(1.08)}&:disabled{opacity:.5}}input[type=file]{display:block;color:var(--text);font:inherit;font-size:.78rem;margin-bottom:.5rem}.error{margin:.5rem 0;padding:.4rem .6rem;border:1px solid var(--critical, #f87171);border-radius:5px;background:rgb(from var(--critical, #f87171) r g b / .07);color:var(--text);font-size:.78rem}.summary{margin:.5rem 0;font-size:.82rem;& strong{color:var(--text)}.meta{margin-left:.4rem;color:var(--muted);font-size:.74rem}}.mode{border:1px solid var(--border);border-radius:6px;padding:.55rem .7rem;margin:.55rem 0 .7rem;display:flex;flex-direction:column;gap:.35rem}.mode legend{padding:0 .35rem;font-size:.68rem;color:var(--muted);text-transform:uppercase;letter-spacing:.08em}.mode label{display:flex;align-items:flex-start;gap:.5rem;font-size:.82rem;& em{color:var(--muted);font-style:normal;font-size:.74rem}}.status{margin:.8rem 0 0;padding:.4rem .6rem;border-radius:5px;font-size:.78rem;&.status-ok{border:1px solid var(--accent);background:rgb(from var(--accent) r g b / .08);color:var(--text)}&.status-err{border:1px solid var(--critical, #f87171);background:rgb(from var(--critical, #f87171) r g b / .07);color:var(--text)}}.actions{display:flex;justify-content:flex-end;gap:.4rem;margin-top:.8rem;padding-top:.7rem;border-top:1px solid var(--border)}.actions button{background:transparent;border:1px solid var(--border);color:var(--text);border-radius:5px;padding:.3rem .8rem;font:inherit;font-size:.78rem;&:hover{border-color:var(--accent);color:var(--accent)}}
127
- `;var hp=class extends R{static styles=[...R.styles,B(pv)];static properties={parsed:{state:!0},parseError:{state:!0},mode:{state:!0},busy:{state:!0},status:{state:!0}};constructor(){super(),this.parsed=null,this.parseError=null,this.mode="prefer-current",this.busy=!1,this.status=null}focusInitial(){this.renderRoot.querySelector("button.primary")?.focus()}async _onDownload(){this.busy=!0,this.status=null;try{let{blob:t,filename:r}=await nd();Ht(t,r),this.status={kind:"ok",text:`Downloaded ${r}`}}catch(t){this.status={kind:"err",text:`Export failed: ${t.message}`}}finally{this.busy=!1}}async _onFile(t){let r=t.target.files?.[0];if(this.parsed=null,this.parseError=null,this.status=null,!!r)try{this.parsed=await od(r)}catch(n){this.parseError=n.message}}_onMode(t){this.mode=t.target.value}async _onApply(){if(!(!this.parsed||this.busy)){this.busy=!0,this.status=null;try{let t=await sd(this.parsed,this.mode);x(),this.status=t.repoUrlError?{kind:"err",text:`Applied ${t.triageEntries} triage entries (${this.mode}), but saving repo URLs failed: ${t.repoUrlError.message}`}:{kind:"ok",text:`Applied ${t.triageEntries} triage entries and ${t.repoUrls} repo URLs (${this.mode}).`},this.parsed=null;let r=this.renderRoot.querySelector('input[type="file"]');r&&(r.value="")}catch(t){this.status={kind:"err",text:`Import failed: ${t.message}`}}finally{this.busy=!1}}}render(){let t=this.parsed;return d`<dialog @close="${this._onClose}"><header><h3>Triage backup</h3><p>Bundles every triage entry (markers, triage states, comments, fixes, per-report ignores) and all saved repo URLs into a single gzipped JSON file.</p></header><section class="section"><h4>Export</h4><p>Download the current triage + repo-URL set as a portable backup.</p><button type="button" class="primary" @click="${this._onDownload}" ?disabled="${this.busy}">${this.busy?"Working\u2026":"Download backup"}</button></section><hr><section class="section"><h4>Import</h4><p>Pick a previously-exported backup. Nothing is applied until you click Apply.</p><input type="file" accept=".gz,application/gzip" @change="${this._onFile}" ?disabled="${this.busy}"> ${this.parseError?d`<div class="error">Failed to parse: ${this.parseError}</div>`:g} ${t?d`<div class="summary">Found <strong>${Object.keys(t.triage).length}</strong> triage entries and <strong>${Object.keys(t.repoUrls).length}</strong> repo URLs. ${t.exportedAt?d`<span class="meta">Exported ${t.exportedAt}.</span>`:g}</div><fieldset class="mode"><legend>Merge mode</legend><label><input type="radio" name="te-mode" value="prefer-current" .checked="${this.mode==="prefer-current"}" @change="${this._onMode}"> <span>Merge — keep current on conflict <em>(safest, only fills gaps)</em></span></label> <label><input type="radio" name="te-mode" value="prefer-imported" .checked="${this.mode==="prefer-imported"}" @change="${this._onMode}"> <span>Merge — prefer imported on conflict <em>(overwrites where both have a value)</em></span></label> <label><input type="radio" name="te-mode" value="replace" .checked="${this.mode==="replace"}" @change="${this._onMode}"> <span>Replace all <em>(drops every current persisted entry first — destructive)</em></span></label></fieldset><button type="button" class="primary" @click="${this._onApply}" ?disabled="${this.busy}">${this.busy?"Applying\u2026":"Apply import"}</button>`:g}</section>${this.status?d`<div class="${`status status-${this.status.kind}`}">${this.status.text}</div>`:g}<footer class="actions"><button type="button" @click="${this._onClose}">Close</button></footer></dialog>`}};customElements.define("triage-export-dialog",hp);function fv(){return ee("triage-export-dialog")}var hv=`:host{display:inline-block;vertical-align:middle;position:relative}.chip{display:inline-flex;align-items:center;gap:.375rem;cursor:default;user-select:none;position:relative;min-height:24px;box-sizing:border-box;padding:.125rem .375rem .125rem .5rem;background:var(--surface);border:1px solid var(--border);border-radius:999px;color:var(--text);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.72rem;font-weight:500}.chip svg{color:var(--muted);flex-shrink:0}.chip.empty:hover{border-color:var(--accent)}.chip.empty .label{color:var(--muted);font-style:italic}.chip.readonly{padding-right:.5rem}.chip.copied:after{content:"Copied";position:absolute;inset:0;display:grid;place-items:center;background:var(--surface);backdrop-filter:var(--glass-blur);border-radius:999px;color:var(--text);font-weight:400;white-space:nowrap;pointer-events:none}.edit-btn{width:18px;height:18px;display:grid;place-items:center;padding:0;margin-left:.125rem;background:transparent;border:0;border-radius:4px;color:var(--muted)}.edit-btn:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}.chip[inert]{visibility:hidden;min-width:19rem}input{position:absolute;inset:0;box-sizing:border-box;padding:0 .55rem;background:var(--surface);border:1px solid var(--accent);border-radius:999px;color:var(--text);font:inherit;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.72rem;font-weight:400;outline:none}@media print{.chip{color:#000!important;border:0!important}.chip svg{color:#000!important}.edit-btn,input{display:none!important}}
128
- `;function Xa(e){if(!e)return"";let t=e.match(/github\.com\/([^/?#]+\/[^/?#]+?)(?:\.git)?(?:[/?#]|$)/iu);return t?t[1]:e}var gp=d`<svg viewBox="0 0 16 16" width="12" height="12" fill="currentColor" aria-hidden="true"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>`,gv=d`<svg viewBox="0 0 16 16" width="11" height="11" fill="currentColor" aria-hidden="true"><path d="M11.013 1.427a1.75 1.75 0 0 1 2.474 0l1.086 1.086a1.75 1.75 0 0 1 0 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 0 1-.927-.928l.929-3.25c.082-.286.235-.547.445-.758l8.61-8.61z"/></svg>`,mp=class extends Q{static properties={url:{type:String},editable:{type:Boolean,reflect:!0},editing:{type:Boolean,reflect:!0},_copied:{state:!0}};static styles=B(hv);constructor(){super(),this.url="",this.editable=!1,this.editing=!1,this._copied=!1,this._opener=""}render(){if(this.editable&&this.editing){let t=!!this.url,r=t?Xa(this.url):"Set repo";return d`<span class="${t?"chip":"chip empty"}" aria-hidden="true" inert>${gp} <span class="label">${r}</span> <button type="button" class="edit-btn">${gv}</button> </span><input type="text" .value="${Me(this.url)}" placeholder="user/repo or https://github.com/user/repo" @input="${this._onInput}" @focus="${this._onFocus}" @keydown="${this._onKeydown}" @blur="${this._onBlur}">`}if(this.editable){let t=!!this.url,r=t?Xa(this.url):"Set repo",n=t?this._copied?"chip copied":"chip":"chip empty";return d`<span class="${n}" @click="${t?null:this._onEdit}">${gp} ${t?this._slugLabel(r):d`<span class="label">${r}</span>`} <button type="button" class="edit-btn" title="Edit repo URL" aria-label="Edit repo URL" @click="${this._onEdit}">${gv}</button></span>`}if(this.url){let t=this._copied?"chip readonly copied":"chip readonly";return d`<span class="${t}" title="Repo from findings (read-only)">${gp} ${this._slugLabel(Xa(this.url))}</span>`}return g}_slugLabel(t){return d`<span class="label" title="Copy repo name" @click="${this._onCopyLabel}">${t}</span>`}updated(t){if(t.has("editing")&&this.editing){let r=this.renderRoot.querySelector("input");r&&(r.focus(),r.select())}}_onEdit=t=>{t&&t.stopPropagation(),this._emit("repo-edit-start")};_onCopyLabel=t=>{t&&t.stopPropagation();let r=Xa(this.url);if(r)try{navigator.clipboard.writeText(r).then(()=>(this._copied=!0,setTimeout(()=>{this._copied=!1},1e3),null)).catch(()=>{})}catch{}};_onFocus=t=>{this._opener=t.target.value};_onInput=t=>{this.url=t.target.value,this._emit("repo-input",{url:this.url})};_onKeydown=t=>{t.key==="Enter"?(t.preventDefault(),this._emit("repo-commit",{url:this.url})):t.key==="Escape"&&(t.preventDefault(),this.url=this._opener,this._emit("repo-cancel",{url:this._opener}))};_onBlur=()=>{this.editing&&this._emit("repo-commit",{url:this.url})};_emit(t,r){this.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0}))}};customElements.define("repo-chip",mp);function Ue(e,t){for(let[r,n]of Object.entries(t))e.hasAttribute(r)||e.setAttribute(r,n)}var eC=d`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path class="bubble" d="M2.5 3h11a.5.5 0 0 1 .5.5v6.5a.5.5 0 0 1-.5.5H8.4l-3 2.6V10.5H2.5a.5.5 0 0 1-.5-.5V3.5a.5.5 0 0 1 .5-.5z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,tC=d`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path class="wrench" d="M10.4 2.6a3 3 0 0 0-3.6 4.5L2 12l2 2 4.9-4.8a3 3 0 0 0 4.5-3.6l-1.8 1.8-1.5-.4-.4-1.5z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,rC=d`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path class="flag-cloth" d="M5 1.5h6v13l-3-2.7-3 2.7z" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linejoin="round"/></svg>`,nC=[{key:"comment",glyph:eC,label:"commented",stateKey:"filterComment",hasKey:"hasComment"},{key:"fix",glyph:tC,label:"fixed",stateKey:"filterFix",hasKey:"hasFix"},{key:"flag",glyph:rC,label:"flagged",stateKey:"filterFlagged",hasKey:"hasFlagged"}],bp=class extends U{static properties={hasComment:{attribute:!1},hasFix:{attribute:!1},hasFlagged:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.hasComment=!1,this.hasFix=!1,this.hasFlagged=!1}connectedCallback(){super.connectedCallback(),Ue(this,{role:"group","aria-label":"Annotation filter"})}render(){let t=nC.filter(r=>this[r.hasKey]||a[r.stateKey]);return t.length===0?g:d`${t.map(r=>{let n=a[r.stateKey],o=n==="with"?`Showing only ${r.label} findings \u2014 click to exclude them`:n==="without"?`Excluding ${r.label} findings \u2014 click to clear`:`Show only ${r.label} findings`;return d`<button type="button" class="${F({"annotation-chip":!0,"sel-with":n==="with","sel-without":n==="without"})}" title="${o}" aria-label="${o}" aria-pressed="${String(n!=="")}" @click="${()=>this._toggle(r.key)}">${r.glyph}</button>`})}`}_toggle(t){this.dispatchEvent(new CustomEvent("annotation-filter-toggle",{detail:{key:t},bubbles:!0,composed:!0}))}};customElements.define("annotation-filter",bp);var oC=[["critical","Critical"],["high","High"],["medium","Medium"],["low","Low"],["high_bug","High bug"],["bug","Bug"],["informational","Info"]],yp=class extends U{static properties={counts:{attribute:!1},selected:{attribute:!1},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.selected=[],this.kind="findings"}connectedCallback(){super.connectedCallback(),Ue(this,{role:"group","aria-label":"Filter by severity"})}render(){let t=this.kind==="graph"?new Set(this.selected):a.filterSeverities,r=oC.filter(([n])=>(this.counts[n]??0)||t.has(n));return r.length===0?g:d`${r.map(([n,o])=>{let s=this.counts[n]??0,i=t.has(n);return d`<button type="button" class="${F({"sev-chip":!0,[n]:!0,active:i})}" aria-pressed="${String(i)}" @click="${()=>this._toggle(n)}"><span class="sd"></span><span class="name">${o}</span><span class="n">${s}</span></button>`})}`}_toggle(t){this.dispatchEvent(new CustomEvent("severity-toggle",{detail:{severity:t,kind:this.kind},bubbles:!0,composed:!0}))}};customElements.define("severity-chips",yp);var sC=[["corrected","Corrected","Show corrected severities (application-specific re-ratings)"],["original","Original","Show the original analyzer severities"]],vp=class extends U{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Ue(this,{role:"group","aria-label":"Severity display mode"})}render(){let t=a.severityMode;return d`<span class="severity-mode-label">Severity</span><span class="severity-mode-chips">${sC.map(([r,n,o])=>{let s=t===r;return d`<button type="button" class="${F({"severity-mode-chip":!0,active:s})}" aria-pressed="${String(s)}" title="${o}" @click="${()=>this._select(r)}">${n}</button>`})}</span>`}_select(t){t!==a.severityMode&&this.dispatchEvent(new CustomEvent("severity-mode-change",{detail:{mode:t},bubbles:!0,composed:!0}))}};customElements.define("severity-mode-switch",vp);var iC=d`<svg class="trash-icon" viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 4h10M6.5 4V2.5h3V4M5 4l.7 9h4.6L11 4"/></svg>`,wp=class extends U{createRenderRoot(){return this}render(){let t=a.currentView==="bundles"&&a.selectedBundle,r=!a.currentFile&&!t;return d`<button type="button" class="danger" ?disabled="${r}">${iC}<span>Delete current</span></button>`}};customElements.define("sidebar-delete-current",wp);var aC=d`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 6h12v7a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V6Z"/><path d="M2 6l1.6-3.3A1.3 1.3 0 0 1 4.8 2h6.4a1.3 1.3 0 0 1 1.2.7L14 6"/><path d="M8 2v4"/></svg>`,lC=d`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="4" x2="4" y1="2.5" y2="10"/><circle cx="12" cy="4" r="2"/><circle cx="4" cy="12" r="2"/><path d="M12 6a6 6 0 0 1-6 6"/></svg>`,mv={packages:{title:"Show packages",icon:aC,view:"packages"},repositories:{title:"Show repositories",icon:lC,view:"repositories"}},kp=class extends U{static properties={kind:{type:String},count:{type:Number}};createRenderRoot(){return this}constructor(){super(),this.kind="",this.count=0}render(){if(this.count===0)return g;let t=mv[this.kind];if(!t)return console.warn(`<sidebar-view-button>: unknown kind ${JSON.stringify(this.kind)}; expected one of ${Object.keys(mv).map(n=>JSON.stringify(n)).join(", ")}.`),g;let r=a.currentView===t.view;return d`<button type="button" class="${F({"sidebar-view-btn":!0,active:r})}" title="${t.title}" aria-label="${t.title}">${t.icon}<span class="view-btn-count">${this.count}</span></button>`}};customElements.define("sidebar-view-button",kp);var cC=["invalid","deleted"],bv={package:{stateKey:"packageSlideTriage"},repository:{stateKey:"repositorySlideTriage"}},$p=class extends U{static properties={counts:{attribute:!1},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.kind=""}connectedCallback(){super.connectedCallback(),Ue(this,{role:"group","aria-label":"Triage view"})}render(){let t=bv[this.kind];if(!t)return console.warn(`<slide-triage-tabs>: unknown kind ${JSON.stringify(this.kind)}; expected one of ${Object.keys(bv).map(o=>JSON.stringify(o)).join(", ")}.`),g;let r=a[t.stateKey],n=cC.filter(o=>(this.counts[o]??0)>0||r===o);return n.length===0?g:d`${n.map(o=>{let s=r===o,i=this.counts[o]??0;return d`<button type="button" class="${F({"triage-state-btn":!0,[`triage-state-${o}`]:!0,active:s})}" title="${s?`Exit ${o} view`:`Show ${o} (${i})`}" aria-pressed="${String(s)}" @click="${()=>this._toggle(o)}">${o.charAt(0).toUpperCase()+o.slice(1)} (${i})</button>`})}`}_toggle(t){this.dispatchEvent(new CustomEvent("slide-triage-toggle",{detail:{kind:this.kind,value:t},bubbles:!0,composed:!0}))}};customElements.define("slide-triage-tabs",$p);var dC=[["own","Sources"],["modules","Dependencies"]],xp=class extends U{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Ue(this,{role:"group","aria-label":"Source filter"})}render(){return d`${dC.map(([t,r])=>{let n=a.filterSources.has(t);return d`<button type="button" class="${F({"source-chip":!0,active:n})}" aria-pressed="${String(n)}" @click="${()=>this._toggle(t)}">${r}</button>`})}`}_toggle(t){this.dispatchEvent(new CustomEvent("source-toggle",{detail:{source:t},bubbles:!0,composed:!0}))}};customElements.define("source-filter",xp);var uC=d`<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>`,pC=d`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6h10v4"/></svg>`,yv={findings:{stateKey:"filterInclude",placeholder:"Search findings\u2026"},files:{stateKey:"filesSearch",placeholder:"Search files\u2026"}},_p=class extends U{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let t=yv[this.kind];if(!t)return console.warn(`<toolbar-search>: unknown kind ${JSON.stringify(this.kind)}; expected one of ${Object.keys(yv).map(n=>JSON.stringify(n)).join(", ")}.`),g;let r=a[t.stateKey];return d`${uC} <input type="text" aria-label="${t.placeholder}" placeholder="${t.placeholder}" .value="${Me(r)}" @input="${this._onInput}"> ${this.kind==="findings"&&r?this._negateToggle():g}`}_negateToggle(){let t=a.filterIncludeNegate;return d`<button type="button" class="${F({"search-negate-btn":!0,active:t})}" title="${t?"Negation on \u2014 click to undo":"Negate: show non-matching findings"}" aria-label="Negate search" aria-pressed="${String(t)}" @click="${this._onToggleNegate}">${pC}</button>`}_onInput=t=>{this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:this.kind,value:t.target.value},bubbles:!0,composed:!0}))};_onToggleNegate=()=>{this.dispatchEvent(new CustomEvent("search-negate-toggle",{bubbles:!0,composed:!0}))}};customElements.define("toolbar-search",_p);function fC(e){if(!e)return"";let t=e.match(/github\.com\/([^/?#]+\/[^/?#]+?)(?:\.git)?(?:[/?#]|$)/iu);return t?t[1]:e}var Sp=class extends U{static properties={options:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.options=[]}render(){return d`<select class="sort-select" aria-label="Filter by repository" .value="${Me(a.filterRepo)}" @change="${this._onChange}"><option value="">All repositories</option>${this.options.map(t=>{let r=t??ln,n=t==null?"(no repo)":fC(t);return d`<option value="${r}">${n}</option>`})}</select>`}_onChange=t=>{this.dispatchEvent(new CustomEvent("repo-change",{detail:{value:t.target.value},bubbles:!0,composed:!0}))}};customElements.define("repo-filter",Sp);var vv=[["none","none","unmarked"],["red","r","red"],["blue","b","blue"],["green","g","green"],["gray","x","gray"]],Cp=class extends U{static properties={counts:{attribute:!1},selected:{attribute:!1},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.selected=[],this.kind="findings"}connectedCallback(){super.connectedCallback(),Ue(this,{role:"group","aria-label":"Filter by mark color"})}render(){let t=this.kind==="graph"?new Set(this.selected):a.filterColors;return vv.some(([n])=>(this.counts[n]??0)||t.has(n))?d`${vv.map(([n,o,s])=>{let i=this.counts[n]??0,l=t.has(n);return d`<button type="button" class="${l?"active":""}" title="${`${s} (${i})`}" aria-pressed="${String(l)}" @click="${()=>this._toggle(n)}"><span class="${`td ${o}`}"></span><span class="count">${i}</span></button>`})}`:g}_toggle(t){this.dispatchEvent(new CustomEvent("color-toggle",{detail:{color:t,kind:this.kind},bubbles:!0,composed:!0}))}};customElements.define("triage-filter",Cp);var hC=["inprogress","fixed","invalid","deleted","ignored"],Ep={graph:"graph2-triage-selector",packages:"packages-triage-selector"},gC={inprogress:"In progress"},mC=e=>gC[e]??e.charAt(0).toUpperCase()+e.slice(1),Ap=class extends U{static properties={counts:{attribute:!1},states:{attribute:!1},variant:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.states=null,this.variant=""}connectedCallback(){super.connectedCallback(),Ue(this,{role:"group","aria-label":"Triage view"})}render(){let t=this.states??hC,r=t.reduce((s,i)=>s+(this.counts[i]??0),0),n=this.variant?Ep[this.variant]:null;this.variant&&n===void 0&&console.warn(`<triage-selector>: unknown variant ${JSON.stringify(this.variant)}; expected one of ${Object.keys(Ep).map(s=>JSON.stringify(s)).join(", ")} or "".`);for(let s of Object.values(Ep))this.classList.toggle(s,s===n);let o=r===0&&!a.shownTriage;return this.classList.toggle("is-empty",o),o?g:d`${t.map(s=>{let i=this.counts[s]??0,l=a.shownTriage===s;if(i===0&&!l)return g;let c=mC(s);return d`<button type="button" class="${F({"triage-state-btn":!0,[`triage-state-${s}`]:!0,active:l})}" data-triage-show="${s}" title="${l?`Exit ${c.toLowerCase()} view`:`Show ${c.toLowerCase()} (${i})`}" aria-pressed="${String(l)}">${c} (${i})</button>`})}`}};customElements.define("triage-selector",Ap);var bC={table:d`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><rect x="3" y="3" width="18" height="18" rx="2"/><line x1="3" x2="21" y1="9" y2="9"/><line x1="3" x2="21" y1="15" y2="15"/><line x1="9" x2="9" y1="3" y2="21"/></svg>`,list:d`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><line x1="3" x2="21" y1="6" y2="6"/><line x1="3" x2="21" y1="12" y2="12"/><line x1="3" x2="21" y1="18" y2="18"/></svg>`,grouped:d`<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><rect x="2" y="1.5" width="12" height="2" rx=".4"/><rect x="5" y="4.4" width="9" height="1.3"/><rect x="5" y="6.2" width="9" height="1.3"/><rect x="2" y="8.5" width="12" height="2" rx=".4"/><rect x="5" y="11.4" width="9" height="1.3"/><rect x="5" y="13.2" width="9" height="1.3"/></svg>`,kanban:d`<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><rect x="1.5" y="2" width="3.8" height="12" rx=".6" fill="none" stroke="currentColor" stroke-width="1"/><rect x="6.1" y="2" width="3.8" height="12" rx=".6" fill="none" stroke="currentColor" stroke-width="1"/><rect x="10.7" y="2" width="3.8" height="12" rx=".6" fill="none" stroke="currentColor" stroke-width="1"/><rect x="2.4" y="3.6" width="2" height="1.4" rx=".2"/><rect x="2.4" y="5.6" width="2" height="1.4" rx=".2"/><rect x="7" y="3.6" width="2" height="1.4" rx=".2"/><rect x="11.6" y="3.6" width="2" height="1.4" rx=".2"/><rect x="11.6" y="5.6" width="2" height="1.4" rx=".2"/><rect x="11.6" y="7.6" width="2" height="1.4" rx=".2"/></svg>`,focus:d`<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><rect x="1.5" y="2.5" width="8.5" height="11" rx=".6" fill="none" stroke="currentColor" stroke-width="1"/><rect x="3" y="4.4" width="5.5" height="1"/><rect x="3" y="6.4" width="5.5" height="1"/><rect x="3" y="8.4" width="3.5" height="1"/><rect x="11.2" y="2.5" width="3.3" height="2.5" rx=".4" fill="currentColor" opacity=".55"/><rect x="11.2" y="5.7" width="3.3" height="2.5" rx=".4" fill="currentColor" opacity=".35"/><rect x="11.2" y="8.9" width="3.3" height="2.5" rx=".4" fill="currentColor" opacity=".22"/></svg>`,graph:d`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" aria-hidden="true"><line x1="4.5" y1="4.5" x2="11.5" y2="6.5"/><line x1="4.5" y1="4.5" x2="6.5" y2="11.5"/><line x1="11.5" y1="6.5" x2="6.5" y2="11.5"/><circle cx="4.5" cy="4.5" r="2" fill="currentColor"/><circle cx="11.5" cy="6.5" r="2" fill="currentColor"/><circle cx="6.5" cy="11.5" r="2" fill="currentColor"/></svg>`},wv={table:"Table view (compact rows, click a row to expand)",list:"List view (flat, one card per finding)",grouped:"List view, grouped by file",focus:"Focus view (one finding centered + a queue of next findings)",kanban:"Kanban board, columns grouped by triage status",graph:"Graph view (canvas with imports / exports)"},Tp=["table","list","grouped","focus","kanban","graph"],Ip=class extends U{static properties={modes:{type:String},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.modes=Tp.join(","),this.kind="findings"}connectedCallback(){super.connectedCallback(),Ue(this,{role:"group","aria-label":"View mode"})}render(){let t=this.kind==="files"?a.filesViewMode:a.viewMode,r=this.modes.split(",").map(o=>o.trim()).filter(o=>Tp.includes(o)),n=r.length>0?r:Tp;return d`${n.map(o=>d`<button type="button" class="${F({"view-mode-btn":!0,active:t===o})}" title="${wv[o]}" aria-label="${wv[o]}" aria-pressed="${String(t===o)}" @click="${()=>this._select(o,t)}">${bC[o]}</button>`)}`}_select(t,r){t!==r&&this.dispatchEvent(new CustomEvent("view-mode-change",{detail:{mode:t,kind:this.kind},bubbles:!0,composed:!0}))}};customElements.define("view-mode-buttons",Ip);var _v=6,kv=14,Qa=2,$v=24,zs=4,yC=1.5,Za=new Map,xv="treemap";function vC(e){let t=/^#?([0-9a-f]{6})$/iu.exec(e);if(!t)return"#fff";let r=parseInt(t[1],16),n=r>>16&255,o=r>>8&255,s=r&255;return(.2126*n+.7152*o+.0722*s)/255>.6?"#1a1a1a":"#fff"}function wC(e,t,r,n){let o=r*r,s=n*n;return Math.max(s*e/o,o/(s*t))}function Sv(e,t){let r=[],n=e.filter(f=>f.value>0),{x:o,y:s,w:i,h:l}=t;if(n.length===0||i<=0||l<=0)return r;let c=0;for(let f of n)c+=f.value;let u=i*l/c,p=0;for(;p<n.length&&i>.5&&l>.5;){let f=Math.min(i,l),h=p,b=0,m=0,v=1/0,w=1/0;for(;h<n.length;){let k=n[h].value*u,C=k>m?k:m,T=k<v?k:v,S=wC(C,T,b+k,f);if(h===p||S<=w)w=S,b+=k,m=C,v=T,h++;else break}let y=b/f;if(i>=l){let k=s;for(let C=p;C<h;C++){let T=C===h-1?s+l-k:n[C].value*u/y;r.push({node:n[C],x:o,y:k,w:y,h:T}),k+=T}o+=y,i-=y}else{let k=o;for(let C=p;C<h;C++){let T=C===h-1?o+i-k:n[C].value*u/y;r.push({node:n[C],x:k,y:s,w:T,h:y}),k+=T}s+=y,l-=y}p=h}return r}function Cv(e){for(;e.children&&e.children.size===1;){let t=e.children.values().next().value;if(t.isFile)break;e.name=`${e.name}/${t.name}`,e.children=t.children}if(e.children)for(let t of e.children.values())Cv(t)}function Ev(e,t,r,n){if(e.path=e.name?t?`${t}/${e.name}`:e.name:t,e.parent=r,e.isFile)return e.count=1,e.value;n.set(e.path,e);let o=0,s=0,i;for(let l of e.children.values())o+=Ev(l,e.path,e,n),s+=l.count,i===void 0?i=l.pkg:i!==l.pkg&&(i=null);return e.value=o,e.count=s,e.pkg=i??null,o}function Av(e,t,r,n,o,s,i){if(n<zs||o<zs)return;if(e.isFile){i.push({kind:"file",node:e,x:t,y:r,w:n,h:o});return}if(!(s<_v&&n>=$v&&o>=$v&&e.children.size>0)){i.push({kind:"agg",node:e,x:t,y:r,w:n,h:o});return}i.push({kind:"dir",node:e,x:t,y:r,w:n,h:o});let c=o>=kv+zs+Qa?kv:0,u=t+Qa,p=r+c,f=n-Qa*2,h=o-c-Qa;if(f<zs||h<zs)return;let b=[...e.children.values()].toSorted((m,v)=>v.value-m.value);for(let m of Sv(b,{x:u,y:p,w:f,h}))Av(m.node,m.x,m.y,m.w,m.h,s+1,i)}function Rp(e,t){let r=e/(t||1)*100;return r>=10?r.toFixed(0):r.toFixed(r>=1?1:2)}function Tv(e,t){if(t<=0||e.isFile||!e.children||e.children.size===0)return 0;let r=1;for(let n of e.children.values()){if(r>=t)break;let o=1+Tv(n,t-1);o>r&&(r=o)}return r}function kC(e,t,r,n,o,s){let i=Math.min(s-o,Math.PI*2-1e-4),l=o+i,c=i>Math.PI?1:0,u=Math.cos(o),p=Math.sin(o),f=Math.cos(l),h=Math.sin(l),b=m=>m.toFixed(2);return`M${b(e+n*u)} ${b(t+n*p)}A${b(n)} ${b(n)} 0 ${c} 1 ${b(e+n*f)} ${b(t+n*h)}L${b(e+r*f)} ${b(t+r*h)}A${b(r)} ${b(r)} 0 ${c} 0 ${b(e+r*u)} ${b(t+r*p)}Z`}function $C(e,t){let r=Math.max(4,Math.floor(t/6.4));return e.length>r?`${e.slice(0,r-1)}\u2026`:e}var Mp=class extends Q{static properties={details:{attribute:!1},_w:{state:!0},_h:{state:!0},_focus:{state:!0},_mode:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.details=null,this._w=0,this._h=0,this._root=null,this._focus=[],this._mode=xv,this._dirByPath=new Map,this._status="loading",this._meta={files:0,total:0,prefix:""},this._ro=null,this._plot=null,this._tooltip=null,this._ttCell=null,this._onPointerMove=this._onPointerMove.bind(this),this._onPointerLeave=this._onPointerLeave.bind(this),this._onPlotClick=this._onPlotClick.bind(this)}willUpdate(t){t.has("details")&&this._rebuild()}firstUpdated(){this._plot=this.querySelector(".bundle-treemap-plot"),this._tooltip=this.querySelector(".bundle-treemap-tooltip"),!(!this._plot||typeof ResizeObserver>"u")&&(this._ro=new ResizeObserver(t=>{let r=t[0]?.contentRect;if(!r)return;let n=Math.floor(r.width),o=Math.floor(r.height);(n!==this._w||o!==this._h)&&(this._w=n,this._h=o)}),this._ro.observe(this._plot))}disconnectedCallback(){super.disconnectedCallback(),this._ro&&(this._ro.disconnect(),this._ro=null)}_onPointerMove(t){let r=t.target.closest(".bundle-treemap-node");if(!r||!this._tooltip){this._hideTooltip();return}if(r!==this._ttCell){this._ttCell=r;let n=r.dataset;G(d`<div class="bundle-treemap-tt-path">${n.ttPath}</div>${n.ttPkg?d`<div class="bundle-treemap-tt-head"><span class="bundle-treemap-tt-dot" style="${`background:${n.ttColor}`}"></span> <span class="bundle-treemap-tt-pkg">${n.ttPkg}</span></div>`:""}<div class="bundle-treemap-tt-meta">${n.ttMeta}</div>`,this._tooltip)}this._positionTooltip(t.clientX,t.clientY)}_onPointerLeave(){this._hideTooltip()}_positionTooltip(t,r){let n=this._tooltip;if(!n||!this._plot)return;n.classList.add("show");let o=this._plot.getBoundingClientRect(),s=t-o.left,i=r-o.top,l=12,c=s+l;c+n.offsetWidth>o.width-4&&(c=s-n.offsetWidth-l),c<4&&(c=4);let u=i+l;u+n.offsetHeight>o.height-4&&(u=i-n.offsetHeight-l),u<4&&(u=4),n.style.left=`${c}px`,n.style.top=`${u}px`}_hideTooltip(){this._ttCell=null,this._tooltip&&this._tooltip.classList.remove("show")}_rebuild(){if(this._root=null,this._focus=[],this._dirByPath=new Map,this._meta={files:0,total:0,prefix:""},!this.details){this._status="loading";return}let t=We(this.details);if(!t||t.size===0){this._status="empty";return}let r=[...t.keys()],n=Ir(this.details),{prefix:o,stripped:s}=ot(r),i=new TextEncoder,l={name:"",children:new Map,value:0,isFile:!1},c=0,u=0;for(let h=0;h<r.length;h++){let b=t.get(r[h]),m=typeof b=="string"?i.encode(b).byteLength:0;if(m<=0)continue;let v=s[h].split("/"),w=l,y=!1;for(let T=0;T<v.length-1;T++){let S=w.children.get(v[T]);if(S&&S.isFile){y=!0;break}S||(S={name:v[T],children:new Map,value:0,isFile:!1},w.children.set(v[T],S)),w=S}if(y)continue;let k=v.at(-1),C=w.children.get(k);if(!(C&&!C.isFile)){if(!C){let T=ft(s[h],{packageDir:n?.get(r[h])});C={name:k,isFile:!0,value:0,origPath:r[h],pkg:T},w.children.set(k,C)}C.value+=m,c+=m,u++}}if(c===0){this._status="empty";return}for(let h of l.children.values())Cv(h);let p=new Map;Ev(l,"",null,p),this._root=l,this._dirByPath=p,this._meta={files:u,total:c,prefix:o},this._status="ok";let f=this.details?.integrity?Za.get(this.details.integrity):null;if(f){let h=p.get(f);h?this._focus=this._chainTo(h):Za.delete(this.details.integrity)}}get _focusNode(){return this._focus.length>0?this._focus.at(-1):this._root}_chainTo(t){let r=[];for(let n=t;n&&n!==this._root;n=n.parent)r.push(n);return r.reverse(),r}_rememberFocus(){let t=this.details?.integrity;if(!t)return;let r=this._focus.at(-1)?.path;r?Za.set(t,r):Za.delete(t)}_drillInto(t){!t||t.isFile||!t.children||t.children.size===0||(this._focus=this._chainTo(t),this._rememberFocus(),this._hideTooltip())}_focusTo(t){let r=t<0?[]:this._focus.slice(0,t+1);r.length!==this._focus.length&&(this._focus=r,this._rememberFocus(),this._hideTooltip())}_toggleMode(){this._mode=this._mode==="sunburst"?"treemap":"sunburst",xv=this._mode,this._hideTooltip()}_onPlotClick(t){let r=t.target.closest("[data-treemap-into]");if(!r)return;let n=this._dirByPath.get(r.dataset.treemapInto);n&&this._drillInto(n)}_renderCrumbs(){let t=this._focus,r=t.length===0,n=t.slice(0,-1),o=r?null:t.at(-1);return d`<nav class="bundle-treemap-crumbs" aria-label="Treemap location"><span class="bundle-treemap-crumbs-lead"><button type="button" class="${F({"bundle-treemap-crumb-home":!0,"at-root":r})}" @click="${()=>this._focusTo(-1)}">Source ${this._mode==="sunburst"?"sunburst":"treemap"}</button> ${n.map((s,i)=>d`<span class="bundle-treemap-crumb-sep" aria-hidden="true">›</span><button type="button" class="bundle-treemap-crumb" @click="${()=>this._focusTo(i)}" title="${s.path}">${s.name}</button>`)} </span>${o?d`<span class="bundle-treemap-crumb-sep" aria-hidden="true">›</span><span class="bundle-treemap-crumb-current" aria-current="location" title="${o.path}">${o.name}</span>`:""}</nav>`}_cell(t){let r=Rp(t.node.value,this._meta.total),n={left:`${t.x}px`,top:`${t.y}px`,width:`${t.w}px`,height:`${t.h}px`},o=`${t.node.count} ${t.node.count===1?"file":"files"}`;if(t.kind==="dir")return d`<div class="bundle-treemap-node bundle-treemap-dir" style="${de(n)}" data-treemap-into="${t.node.path}" data-tt-path="${`${t.node.path}/`}" data-tt-meta="${`${oe(t.node.value)} \xB7 ${o} \xB7 ${r}%`}"><span class="bundle-treemap-dirname">${t.node.name}</span></div>`;let s=t.node.pkg??ft(t.node.path),i=Ye(s),l=de({...n,background:i,color:vC(i)}),c=s==="__own__"?"own source":s;return t.kind==="agg"?d`<div class="bundle-treemap-node bundle-treemap-leaf bundle-treemap-agg" style="${l}" data-treemap-into="${t.node.path}" data-tt-path="${`${t.node.path}/`}" data-tt-pkg="${c}" data-tt-color="${i}" data-tt-meta="${`${oe(t.node.value)} \xB7 ${o} \xB7 ${r}%`}"><span class="bundle-treemap-label">${t.node.name}/</span></div>`:d`<div class="bundle-treemap-node bundle-treemap-leaf bundle-treemap-file" style="${l}" data-bundle-view-source="${t.node.origPath}" data-tt-path="${t.node.path}" data-tt-pkg="${c}" data-tt-color="${i}" data-tt-meta="${`${oe(t.node.value)} \xB7 ${r}% of bundle`}"><span class="bundle-treemap-label">${t.node.name}</span></div>`}_arc(t,r,n){let o=Rp(t.value,n),s=t.pkg??ft(t.path),i=Ye(s),l=s==="__own__"?"own source":s;if(t.isFile)return ar`<path class="bundle-treemap-node bundle-treemap-arc" d="${r}" fill="${i}" data-bundle-view-source="${t.origPath}" data-tt-path="${t.path}" data-tt-pkg="${l}" data-tt-color="${i}" data-tt-meta="${`${oe(t.value)} \xB7 ${o}% of bundle`}"></path>`;let c=`${t.count} ${t.count===1?"file":"files"}`;return ar`<path class="bundle-treemap-node bundle-treemap-arc" d="${r}" fill="${i}" data-treemap-into="${t.path}" data-tt-path="${`${t.path}/`}" data-tt-pkg="${t.pkg?l:g}" data-tt-color="${t.pkg?i:g}" data-tt-meta="${`${oe(t.value)} \xB7 ${c} \xB7 ${o}%`}"></path>`}_renderSunburst(t){let r=this._w,n=this._h,o=r/2,s=n/2,i=Math.min(r,n)/2-6;if(i<30)return g;let l=Tv(t,_v),c=Math.min(Math.max(i*.18,26),i*.45),u=(i-c)/l,p=this._meta.total||1,f=[],h=(y,k,C,T)=>{let S=[...y.children.values()].toSorted((L,j)=>j.value-L.value),M=C-k,I=k;for(let L of S){let j=M*(L.value/y.value),Ce=c+(T-1)*u,ae=Ce+u;j*ae>=yC&&(f.push(this._arc(L,kC(o,s,Ce,ae,I,I+j),p)),!L.isFile&&T<l&&L.children.size>0&&h(L,I,I+j,T+1)),I+=j}};h(t,-Math.PI/2,Math.PI*1.5,1);let b=this._focus.length>0,m=Math.max(c-4,10),v=b?ar`<circle class="bundle-treemap-node bundle-treemap-center" cx="${o}" cy="${s}" r="${m}" data-treemap-into="${t.parent.path}" data-tt-path="${`${t.path}/`}" data-tt-meta="${`${oe(t.value)} \xB7 ${t.count} ${t.count===1?"file":"files"} \xB7 ${Rp(t.value,p)}%`}"></circle>`:ar`<circle class="bundle-treemap-center" cx="${o}" cy="${s}" r="${m}"></circle>`,w=ar`<text class="bundle-treemap-center-label" x="${o}" y="${s}" text-anchor="middle">${b?ar`<tspan x="${o}" dy="-0.3em">${$C(t.name,m*2-12)}</tspan><tspan class="bundle-treemap-center-sub" x="${o}" dy="1.5em">${oe(t.value)}</tspan>`:ar`<tspan x="${o}" dy="0.35em">${oe(t.value)}</tspan>`}</text>`;return d`<svg class="bundle-treemap-sunburst" width="${r}" height="${n}" viewBox="${`0 0 ${r} ${n}`}">${f}${v}${w}</svg>`}render(){let t=this._focusNode,r=this._mode==="sunburst",n=this._status==="ok"&&t&&t.children&&this._w>0&&this._h>0,o=[];if(n&&!r){let p=[...t.children.values()].toSorted((f,h)=>h.value-f.value);for(let f of Sv(p,{x:0,y:0,w:this._w,h:this._h}))Av(f.node,f.x,f.y,f.w,f.h,1,o)}let{files:s,total:i,prefix:l}=this._meta,c=this._status==="ok"&&t?t.count:s,u=this._status==="ok"&&t?t.value:i;return d`<header class="bundle-treemap-head">${this._renderCrumbs()} <span class="bundle-treemap-head-right"><span class="bundle-treemap-sub">${c} ${c===1?"file":"files"} · ${oe(u)}${l?d`· <span class="mono">${l}</span>`:""}</span> <button type="button" class="${F({"bundle-treemap-mode-toggle":!0,on:r})}" aria-pressed="${String(r)}" aria-label="Toggle sunburst view" @click="${this._toggleMode}"><span>Sunburst</span><span class="bundle-treemap-switch" aria-hidden="true"></span></button></span></header><div class="bundle-treemap-plot" @click="${this._onPlotClick}" @pointermove="${this._onPointerMove}" @pointerleave="${this._onPointerLeave}">${this._status==="loading"?d`<div class="bundle-treemap-empty">Loading…</div>`:this._status==="empty"?d`<div class="bundle-treemap-empty">This bundle doesn't carry any source content.</div>`:r?n?this._renderSunburst(t):g:o.map(p=>this._cell(p))}<div class="bundle-treemap-tooltip"></div></div>`}};customElements.define("bundle-treemap",Mp);var xC=new TextEncoder;function el(e){return typeof e=="string"?xC.encode(e).byteLength:0}function Iv(e){return(t,r)=>Math.abs(r.delta)-Math.abs(t.delta)||t[e].localeCompare(r[e])}function tl(e){return(t,r)=>r.bytes-t.bytes||t[e].localeCompare(r[e])}function _C(){return{baseBytes:0,otherBytes:0,onlyBaseFiles:0,onlyOtherFiles:0,changedFiles:0}}function Mv(e,t,r){let n=[],o=[],s=[],i=0,l=0,c=0,u=0,p=0,f=0,h=new Map,b=k=>{let C=r(k),T=h.get(C);return T||(T=_C(),h.set(C,T)),T},m=new Set([...e.keys(),...t.keys()]);for(let k of m){let C=e.has(k),T=t.has(k),S=b(k);if(C&&T){let M=e.get(k),I=t.get(k),L=el(M),j=M===I?L:el(I);if(i+=L,l+=j,S.baseBytes+=L,S.otherBytes+=j,M===I)f++;else{let Ce=j-L;s.push({path:k,baseBytes:L,otherBytes:j,delta:Ce}),p+=Ce,S.changedFiles++}}else if(C){let M=el(e.get(k));i+=M,c+=M,S.baseBytes+=M,S.onlyBaseFiles++,n.push({path:k,bytes:M})}else{let M=el(t.get(k));l+=M,u+=M,S.otherBytes+=M,S.onlyOtherFiles++,o.push({path:k,bytes:M})}}let v=[],w=[],y=[];for(let[k,C]of h){let T=C.baseBytes>0||C.onlyBaseFiles>0||C.changedFiles>0,S=C.otherBytes>0||C.onlyOtherFiles>0||C.changedFiles>0,M=C.onlyBaseFiles+C.onlyOtherFiles+C.changedFiles;T&&!S?v.push({pkg:k,bytes:C.baseBytes}):S&&!T?w.push({pkg:k,bytes:C.otherBytes}):(M>0||C.baseBytes!==C.otherBytes)&&y.push({pkg:k,baseBytes:C.baseBytes,otherBytes:C.otherBytes,delta:C.otherBytes-C.baseBytes})}return n.sort(tl("path")),o.sort(tl("path")),s.sort(Iv("path")),v.sort(tl("pkg")),w.sort(tl("pkg")),y.sort(Iv("pkg")),{totals:{baseFiles:e.size,baseBytes:i,otherFiles:t.size,otherBytes:l,onlyBaseFiles:n.length,onlyBaseBytes:c,onlyOtherFiles:o.length,onlyOtherBytes:u,changedFiles:s.length,changedDelta:p,unchangedFiles:f,fileDelta:t.size-e.size,byteDelta:l-i,identical:n.length===0&&o.length===0&&s.length===0},files:{onlyBase:n,onlyOther:o,changed:s},packages:{onlyBase:v,onlyOther:w,changed:y}}}function Rv(e){let r=String(e).trim().split("+",1)[0],n=r.indexOf("-");return n===-1?{core:r,pre:""}:{core:r.slice(0,n),pre:r.slice(n+1)}}function Us(e,t){if(e===t)return 0;let r=Rv(e),n=Rv(t),o=r.core.split("."),s=n.core.split(".");for(let c=0;c<Math.max(o.length,s.length);c++){let u=Number(o[c]??0),p=Number(s[c]??0);if(Number.isNaN(u)||Number.isNaN(p))return e<t?-1:1;if(u!==p)return u<p?-1:1}if(r.pre===n.pre)return 0;if(!r.pre)return 1;if(!n.pre)return-1;let i=r.pre.split("."),l=n.pre.split(".");for(let c=0;c<Math.max(i.length,l.length);c++){let u=i[c],p=l[c];if(u===void 0)return-1;if(p===void 0)return 1;if(u===p)continue;let f=/^\d+$/u.test(u),h=/^\d+$/u.test(p);return f&&h?Number(u)<Number(p)?-1:1:f!==h?f?-1:1:u<p?-1:1}return 0}function SC(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function CC(e,t){let r=Us(t.at(-1),e.at(-1));return r>0?"up":r<0?"down":"changed"}function Fv(e,t){let r=[],n=[],o=[],s=new Set([...e.keys(),...t.keys()]);for(let l of s){let c=e.get(l),u=t.get(l);if(c&&u){let p=[...c].toSorted(Us),f=[...u].toSorted(Us);if(SC(p,f))continue;r.push({pkg:l,baseVersions:p,otherVersions:f,direction:CC(p,f)})}else c?o.push({pkg:l,versions:[...c].toSorted(Us)}):n.push({pkg:l,versions:[...u].toSorted(Us)})}let i=(l,c)=>l.pkg.localeCompare(c.pkg);return r.sort(i),n.sort(i),o.sort(i),{updated:r,added:n,removed:o,totals:{baseDeps:e.size,otherDeps:t.size}}}var rl=400,Hs=null;function Fp(e){return e===0?"\xB10 B":`${e>0?"+":"\u2212"}${Math.abs(e).toLocaleString()} B`}function Bv(e){return e===0?"\xB10":`${e>0?"+":"\u2212"}${Math.abs(e).toLocaleString()}`}function Bp(e){return e>0?"up":e<0?"down":""}function EC(e,t){if(!t)return"";let r=e/t*100;return`${r>0?"+":r<0?"\u2212":"\xB1"}${Math.abs(r).toFixed(1)}%`}function Lv(e){return e==="__own__"?"own source":e}function Lp(e){return e.join(", ")}var Op=class extends Q{static properties={details:{attribute:!1},integrity:{attribute:!1},_targetIntegrity:{state:!0},_otherDetails:{state:!0},_status:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.details=null,this.integrity=null,this._targetIntegrity=null,this._otherDetails=null,this._status="idle",this._diff=null,this._diffKey=null}willUpdate(t){if(t.has("integrity")){if(Hs&&this.integrity===Hs.base){let r=Hs.target;Hs=null,this._targetIntegrity=r,this._otherDetails=null,this._status="loading",this._diff=null,this._diffKey=null,this._loadOther(r);return}this._targetIntegrity=null,this._otherDetails=null,this._status="idle",this._diff=null,this._diffKey=null}}_swap(){let t=this._targetIntegrity;!t||t===this.integrity||(a.bundles??[]).some(r=>r.integrity===t)&&(Hs={base:t,target:this.integrity},this.dispatchEvent(new CustomEvent("bundle-swap",{bubbles:!0,composed:!0,detail:{integrity:t}})))}_nameFor(t){return(a.bundles??[]).find(n=>n.integrity===t)?.name??`${t.slice(0,15)}\u2026`}_onPick(t){let r=t.target.value||null;if(this._targetIntegrity=r,this._otherDetails=null,this._diff=null,this._diffKey=null,!r){this._status="idle";return}this._status="loading",this._loadOther(r)}async _loadOther(t){let r=(a.bundles??[]).find(o=>o.integrity===t);if(!r){this._status="idle",this._targetIntegrity=null;return}let n=await Zn(t,r);this._targetIntegrity===t&&(this._otherDetails=n,this._status="ready")}get _baseReady(){return!!(this.details&&this.details.integrity===this.integrity&&(this.details.json||this.details.bundle))}_fileRow(t,r,n,o){let s=d`<span class="bundle-compare-row-path mono">${r}</span>${o}`;return n?d`<li><button type="button" class="bundle-compare-row bundle-compare-row-link" data-bundle-view-source="${t}" title="${t}">${s}</button></li>`:d`<li><div class="bundle-compare-row" title="${t}">${s}</div></li>`}_fileGroup(t,r,n,o,s){if(r.length===0)return g;let i=r.slice(0,rl),l=r.length-i.length;return d`<section class="${`bundle-compare-group bundle-compare-${n}`}"><header class="bundle-compare-group-head"><span class="bundle-compare-dot" aria-hidden="true"></span> <span class="bundle-compare-group-title">${t}</span> <span class="bundle-compare-group-count">${r.length}</span></header><ul class="bundle-compare-rows">${J(i,c=>c.path,c=>{let u=c.delta===void 0?d`<span class="bundle-compare-row-size">${oe(c.bytes)}</span>`:d`<span class="bundle-compare-row-size">${oe(c.baseBytes)} → ${oe(c.otherBytes)}</span> <span class="${`bundle-compare-row-delta ${c.delta>0?"up":c.delta<0?"down":""}`}">${Fp(c.delta)}</span>`;return this._fileRow(c.path,s(c.path),o,u)})}</ul>${l>0?d`<div class="bundle-compare-more">and ${l.toLocaleString()} more…</div>`:g}</section>`}_pkgGroup(t,r,n){if(r.length===0)return g;let o=r.slice(0,rl),s=r.length-o.length;return d`<section class="${`bundle-compare-group bundle-compare-${n}`}"><header class="bundle-compare-group-head"><span class="bundle-compare-dot" aria-hidden="true"></span> <span class="bundle-compare-group-title">${t}</span> <span class="bundle-compare-group-count">${r.length}</span></header><ul class="bundle-compare-rows">${J(o,i=>i.pkg,i=>{let l=i.delta===void 0?d`<span class="bundle-compare-row-size">${oe(i.bytes)}</span>`:d`<span class="bundle-compare-row-size">${oe(i.baseBytes)} → ${oe(i.otherBytes)}</span> <span class="${`bundle-compare-row-delta ${i.delta>0?"up":i.delta<0?"down":""}`}">${Fp(i.delta)}</span>`;return d`<li><div class="bundle-compare-row" title="${Lv(i.pkg)}"><span class="bundle-compare-pkg-dot" style="${de({background:Ye(i.pkg)})}"></span> <span class="bundle-compare-row-path">${Lv(i.pkg)}</span> ${l}</div></li>`})}</ul>${s>0?d`<div class="bundle-compare-more">and ${s.toLocaleString()} more…</div>`:g}</section>`}_versionRow(t){let r=t.direction==="up"?"\u2191":t.direction==="down"?"\u2193":"\xB1",n=t.direction==="up"?"Upgraded":t.direction==="down"?"Downgraded":"Changed";return d`<li><div class="bundle-compare-row" title="${`${t.pkg} \xB7 ${n}`}"><span class="bundle-compare-pkg-dot" style="${de({background:Ye(t.pkg)})}"></span> <span class="bundle-compare-row-path">${t.pkg}</span> <span class="bundle-compare-ver"><span class="bundle-compare-ver-from">${Lp(t.baseVersions)}</span> <span class="bundle-compare-ver-arrow" aria-hidden="true">→</span> <span class="${`bundle-compare-ver-to ${t.direction}`}">${Lp(t.otherVersions)}</span> <span class="${`bundle-compare-ver-dir ${t.direction}`}" aria-hidden="true">${r}</span></span></div></li>`}_depGroup(t,r,n){if(r.length===0)return g;let o=r.slice(0,rl),s=r.length-o.length;return d`<section class="${`bundle-compare-group bundle-compare-${n}`}"><header class="bundle-compare-group-head"><span class="bundle-compare-dot" aria-hidden="true"></span> <span class="bundle-compare-group-title">${t}</span> <span class="bundle-compare-group-count">${r.length}</span></header><ul class="bundle-compare-rows">${J(o,i=>i.pkg,i=>d`<li><div class="bundle-compare-row" title="${i.pkg}"><span class="bundle-compare-pkg-dot" style="${de({background:Ye(i.pkg)})}"></span> <span class="bundle-compare-row-path">${i.pkg}</span> <span class="bundle-compare-dep-ver">${Lp(i.versions)}</span></div></li>`)}</ul>${s>0?d`<div class="bundle-compare-more">and ${s.toLocaleString()} more…</div>`:g}</section>`}_renderVersionUpdates(t,r,n){let{updated:o,added:s,removed:i}=t;if(o.length===0&&s.length===0&&i.length===0)return g;let l=o.slice(0,rl),c=o.length-l.length;return d`<section class="bundle-compare-section"><h3 class="bundle-compare-section-head">Dependency updates</h3>${o.length>0?d`<div class="bundle-compare-ver-changes"><header class="bundle-compare-group-head"><span class="bundle-compare-group-title">Updated</span> <span class="bundle-compare-group-count">${o.length}</span></header><ul class="bundle-compare-rows">${J(l,u=>u.pkg,u=>this._versionRow(u))}</ul>${c>0?d`<div class="bundle-compare-more">and ${c.toLocaleString()} more…</div>`:g}</div>`:g} ${s.length>0||i.length>0?d`<div class="bundle-compare-cols">${this._depGroup(`Removed \xB7 only in ${r}`,i,"removed")} ${this._depGroup(`Added \xB7 only in ${n}`,s,"added")}</div>`:g}</section>`}_diffFor(){let t=`${this.integrity}|${this._targetIntegrity}`;if(this._diffKey!==t||!this._diff){let r=We(this.details),n=We(this._otherDetails),{prefix:o}=ot([...r.keys(),...n.keys()]),s=Ir(this.details),i=Ir(this._otherDetails),l=s||i?new Map([...s??[],...i??[]]):null,c=u=>ft(o&&u.startsWith(o)?u.slice(o.length):u,{packageDir:l?.get(u)});this._diff=Mv(r,n,c),this._diff.versionUpdates=Fv(vs(this.details),vs(this._otherDetails)),this._diffKey=t}return this._diff}_renderSummary(t){let r=t.totals,n=t.versionUpdates.totals,o=n.baseDeps>0||n.otherDeps>0,s=n.otherDeps-n.baseDeps;return d`<div class="bundle-compare-summary"><div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Files</span> <span class="bundle-compare-metric-value">${r.baseFiles.toLocaleString()} → ${r.otherFiles.toLocaleString()}</span> <span class="${`bundle-compare-metric-delta ${Bp(r.fileDelta)}`}">${Bv(r.fileDelta)}</span></div><div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Size</span> <span class="bundle-compare-metric-value">${oe(r.baseBytes)} → ${oe(r.otherBytes)}</span> <span class="${`bundle-compare-metric-delta ${Bp(r.byteDelta)}`}">${Fp(r.byteDelta)}${(()=>{let i=EC(r.byteDelta,r.baseBytes);return i?d`${" "}<span class="bundle-compare-pct">(${i})</span>`:g})()}</span></div>${o?d`<div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Deps</span> <span class="bundle-compare-metric-value">${n.baseDeps.toLocaleString()} → ${n.otherDeps.toLocaleString()}</span> <span class="${`bundle-compare-metric-delta ${Bp(s)}`}">${Bv(s)}</span></div>`:g}<div class="bundle-compare-chips"><span class="bundle-compare-chip removed">−${r.onlyBaseFiles.toLocaleString()} removed</span> <span class="bundle-compare-chip added">+${r.onlyOtherFiles.toLocaleString()} added</span> <span class="bundle-compare-chip changed">${r.changedFiles.toLocaleString()} changed</span> <span class="bundle-compare-chip unchanged">${r.unchangedFiles.toLocaleString()} unchanged</span></div></div>`}_renderPicker(t,r){let n=this._nameFor(this.integrity);return d`<div class="bundle-compare-picker"><span class="bundle-compare-base" title="${n}">${n}</span> <span class="bundle-compare-arrow" aria-hidden="true">→</span> <label class="bundle-compare-select-wrap"><span class="bundle-compare-select-hint">Compare with</span> <select class="bundle-compare-select" .value="${Me(this._targetIntegrity??"")}" @change="${o=>this._onPick(o)}" aria-label="Bundle to compare with"><option value="">Choose a bundle…</option>${t.map(o=>d`<option value="${o.integrity}">${o.label}</option>`)}</select></label> ${r?d`<button type="button" class="bundle-compare-swap" @click="${()=>this._swap()}" aria-label="Swap the two bundles"><span class="bundle-compare-swap-icon" aria-hidden="true">↔</span>Swap</button>`:g}</div>`}_otherOptions(){let t=(a.bundles??[]).filter(n=>n.integrity!==this.integrity),r=new Map;for(let n of t)r.set(n.name,(r.get(n.name)??0)+1);return t.map(n=>({integrity:n.integrity,label:r.get(n.name)>1?`${n.name} \xB7 ${n.integrity.slice(7,13)}\u2026`:n.name}))}render(){let t=this._otherOptions(),r=!!this._targetIntegrity&&t.some(i=>i.integrity===this._targetIntegrity),n=t.length>0?this._renderPicker(t,r):g,o=r&&this._status==="ready"&&this._otherDetails&&(this._otherDetails.json||this._otherDetails.bundle)&&!this._otherDetails.error,s;return this._baseReady?t.length===0?s=d`<div class="bundle-compare-empty">No other bundles to compare with. Drop a second <code>.map</code> or <code>.stasis.code.br</code> bundle to diff against this one.</div>`:r?this._status==="loading"||!this._otherDetails?s=d`<div class="bundle-compare-empty">Comparing…</div>`:this._otherDetails.error?s=d`<div class="bundle-compare-empty is-error">Couldn't read the selected bundle: ${this._otherDetails.error}</div>`:!this._otherDetails.json&&!this._otherDetails.bundle?s=d`<div class="bundle-compare-empty is-error">The selected bundle couldn't be parsed.</div>`:s=this._renderDiff():s=d`<div class="bundle-compare-empty">Pick a bundle above to compare against <strong>${this._nameFor(this.integrity)}</strong>.</div>`:s=d`<div class="bundle-compare-empty">Loading bundle…</div>`,d`<div class="bundle-compare"><header class="bundle-compare-head">${n} ${this._baseReady&&o?this._renderSummary(this._diffFor()):g}</header><div class="bundle-compare-body">${s}</div></div>`}_renderDiff(){let t=this._diffFor(),r=this._nameFor(this._targetIntegrity),n=this._nameFor(this.integrity),o=[...t.files.onlyBase.map(p=>p.path),...t.files.onlyOther.map(p=>p.path),...t.files.changed.map(p=>p.path)],{prefix:s,stripped:i}=ot(o),l=new Map;for(let p=0;p<o.length;p++)l.set(o[p],i[p]);let c=p=>l.get(p)??p,u=t.packages.onlyOther.length>0||t.packages.onlyBase.length>0||t.packages.changed.length>0;return d`<div class="bundle-compare-caption">Changes from <strong>${n}</strong> to <strong>${r}</strong> ${s?d`· <span class="mono">${s}</span>`:g}</div>${this._renderVersionUpdates(t.versionUpdates,n,r)} ${t.totals.identical?d`<div class="bundle-compare-identical">These two bundles carry identical sources (${t.totals.unchangedFiles.toLocaleString()} ${t.totals.unchangedFiles===1?"file":"files"}).</div>`:d`${u?d`<section class="bundle-compare-section"><h3 class="bundle-compare-section-head">Packages</h3><div class="bundle-compare-cols">${this._pkgGroup(`Removed \xB7 only in ${n}`,t.packages.onlyBase,"removed")} ${this._pkgGroup(`Added \xB7 only in ${r}`,t.packages.onlyOther,"added")} ${this._pkgGroup("Changed size",t.packages.changed,"changed")}</div></section>`:g}<section class="bundle-compare-section"><h3 class="bundle-compare-section-head">Files</h3><div class="bundle-compare-cols bundle-compare-cols--files">${this._fileGroup(`Removed \xB7 only in ${n}`,t.files.onlyBase,"removed",!0,c)} ${this._fileGroup(`Added \xB7 only in ${r}`,t.files.onlyOther,"added",!1,c)} ${this._fileGroup("Changed",t.files.changed,"changed",!0,c)}</div></section>`}`}};customElements.define("bundle-compare",Op);var AC=d`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M6 9V2h12v7"/><path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"/><rect x="6" y="14" width="12" height="8"/></svg>`,Pp=class extends U{createRenderRoot(){return this}render(){return a.reports.length>0&&a.currentView==="findings"&&a.viewMode!=="graph"&&a.viewMode!=="kanban"?d`<button type="button" title="print this report" aria-label="print" @click="${this._onClick}">${AC}</button>`:g}_onClick=()=>{this.dispatchEvent(new CustomEvent("print-requested",{bubbles:!0,composed:!0}))}};customElements.define("print-button",Pp);var TC=d`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/></svg>`,Np=class extends U{createRenderRoot(){return this}render(){return a.reports.length>0&&a.currentView==="findings"&&a.viewMode!=="graph"&&a.viewMode!=="kanban"?d`<button type="button" title="download this report" aria-label="download" @click="${this._onClick}">${TC}</button>`:g}_onClick=()=>{this.dispatchEvent(new CustomEvent("download-requested",{bubbles:!0,composed:!0}))}};customElements.define("download-button",Np);function Vs(e){let t=new Map;for(let[r,n]of a.triage)n[e]&&t.set(r,n[e]);return t}var IC={get markers(){return Vs("color")},get triageState(){return Vs("triage")},get comments(){return Vs("comment")},get fixes(){return Vs("fix")},get flags(){return Vs("flagged")},get(e){let t=a.triage.get(e),r={};return t?.color&&(r.color=t.color),t?.triage&&(r.triage=t.triage),t?.comment&&(r.comment=t.comment),t?.fix&&(r.fix=t.fix),t?.flagged!==void 0&&(r.flagged=t.flagged),r},async set(e,{color:t,triage:r,comment:n,fix:o,flagged:s}={}){let i=!1;if(t!==void 0&&(t===null||t===""?z(a.triage,e,{color:void 0})&&(i=!0):a.triage.get(e)?.color!==t&&(z(a.triage,e,{color:t}),i=!0)),r!==void 0)if(r===null||r===""||r===!1)z(a.triage,e,{triage:void 0})&&(i=!0);else if(r==="inprogress"||r==="fixed"||r==="invalid"||r==="deleted")a.triage.get(e)?.triage!==r&&(z(a.triage,e,{triage:r}),i=!0);else throw new TypeError(`DeepView.triage.set: unknown triage value ${JSON.stringify(r)} (expected 'inprogress' | 'fixed' | 'invalid' | 'deleted' | null)`);if(n!==void 0){let l=n?String(n):"";l?a.triage.get(e)?.comment!==l&&(z(a.triage,e,{comment:l}),i=!0):z(a.triage,e,{comment:void 0})&&(i=!0)}if(o!==void 0){let l=o?String(o):"";l?a.triage.get(e)?.fix!==l&&(z(a.triage,e,{fix:l}),i=!0):z(a.triage,e,{fix:void 0})&&(i=!0)}if(s!==void 0){let l=s===null||s===""?void 0:!!s;a.triage.get(e)?.flagged!==l&&(z(a.triage,e,{flagged:l}),i=!0)}return i&&(await pe(),x()),i}};window.DeepView={get reports(){return a.reports.slice()},get groups(){return kt()},get findings(){return kt().flat()},get currentFile(){return a.currentFile},get currentWorkspace(){return a.currentWorkspace},triage:IC,themes:rv,setTheme:ev,get theme(){return tv()},triageSync:N,refresh(){x()},export(){return fv()}};var RC={default:ne.default,"claude-security":ne["claude-security"],"codex-security":ne["codex-security"],deepsec:ne.deepsec,piolium:ne.piolium,bundle:Gn,workspace:wa};for(let e of document.querySelectorAll(".drop-supported-icon[data-icon]")){let t=RC[e.dataset.icon];t&&(e.innerHTML=t)}lg(x);Jc(x);ag(x);N.onStatusChange(x);sg(async(e,t)=>{a.currentWorkspace===e?await $t(e):a.currentFile&&a.currentFile===t?await Xe(t):await V()});ig(async()=>{await V(),a.currentView==="bundles"&&x()});Iy();My();async function Dv(){let e=hd();if(!e)return!1;try{history.replaceState(null,"",location.pathname)}catch{}let t;try{t=await By({encoded:e})}catch(n){return alert(`Couldn't open the share-link unlock prompt: ${n.message}`),!1}if(!t)return!1;let r=await Nc({id:t.id,name:t.name,privateKey:t.privateKeyBase64});if(r.status==="already-attached")return alert(`This workspace is already attached as "${r.workspace.name}".`),!1;if(r.status==="name-collision"){let n=r.existing?.name;return alert(n?`A workspace named "${n}" already exists. Open the share link again and pick a different name.`:"The shared workspace name is empty or invalid. Ask the sender to re-share with a real name."),!1}return r.workspace?.id?await $t(r.workspace.id):await V(),!0}async function zv(){let e=Ki();if(!e)return!1;try{history.replaceState(null,"",location.pathname)}catch{}let t=await Ay(e);return t.ok?!0:(alert(t.reason),!1)}var ao=!1;async function Uv(){if(ao||(ao=!0,await ur(),Fc(),await V(),await Dv())||await zv())return;let r=Ae(Mr);if(r)if(r.startsWith("ws:")){let n=r.slice(3);W().some(o=>o.id===n)&&await $t(n)}else if(r.startsWith("b:")){let n=r.slice(2),o=n.indexOf(" "),s=o>=0?n.slice(0,o):n,i=o>=0?n.slice(o+1):"",l=_s.has(i)?i:"overview";(a.bundles??[]).some(c=>c.integrity===s)&&(a.currentView="bundles",a.selectedBundle=s,a.bundleDetails=null,a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.bundleCodeSearchQuery="",a.bundleCodeSearchMode="files",a.bundleSearchQuery="",a.bundleSearchRegex=!1,a.bundleSearchCase=!1,a.bundleSearchContext=!0,a.bundleDetailsTab=l,a.shownTriage=null,A.showAll=!0,x(),Zt(s))}else(await ie()).includes(r)&&await Xe(r)}var Ov=se(),Pv=!1;function Nv(e){Pv||(Pv=!0,queueMicrotask(()=>{alert(e+" This tab will reload to refresh its state. Any unsaved edits in this tab will be lost."),location.reload()}))}Te(()=>{let e=Ov,t=se();if(Ov=t,x(),!ao&&yt()){Uv().catch(r=>console.warn("continueBoot:",r));return}if(ao&&t&&!yt()){Nv("Encryption was just enabled in another tab.");return}ao&&e&&!t&&!Tl()&&Nv("Encryption was disabled in another tab.")});window.addEventListener("hashchange",()=>{ao&&(async()=>{await Dv()||await zv()})().catch(e=>console.warn("deep-link hashchange:",e))});(async()=>{if(!await Fy()){try{let e=window.matchMedia?.("(display-mode: window-controls-overlay)").matches;if(!e&&a.serverMode!=="managed"&&localStorage.getItem("deepview.sidebarCollapsed")==="1"&&xf.classList.add("collapsed"),window.matchMedia?.("(display-mode: standalone)").matches||e){let r=document.querySelector('meta[name="viewport"]');r&&r.setAttribute("content","width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"),window.addEventListener("wheel",n=>{(n.ctrlKey||n.metaKey)&&n.preventDefault()},{passive:!1}),window.addEventListener("keydown",n=>{(n.ctrlKey||n.metaKey)&&(n.key==="="||n.key==="+"||n.key==="-"||n.key==="0")&&n.preventDefault()})}}catch{}se()&&!yt()||await Uv()}})();
138
+ `)}function UC(e){let t=e.map(n=>n.fileName),r="";return t.length===1?r=t[0]:t.length>1&&(r=_a(t)),r=r.replace(/\.json$/u,""),`${r||"deepview-report"}.md`}function Av(e){if(e.length===0)return;let t=zC(e),r=new Blob([t],{type:"text/markdown;charset=utf-8"});Kt(r,UC(e))}$c(()=>{a.currentView==="bundles"&&a.selectedBundle?x():a.currentView==="packages"?x():a.currentView==="repositories"?x():(a.currentView==="findings"||a.currentView==="files")&&j().catch(()=>{})});function Tv(){a.currentView==="bundles"&&a.bundleDetailsTab==="graph"?qa():Ou()}function al(){a.currentView==="bundles"&&a.bundleDetailsTab==="graph"?Ga():Pu()}function fo(){let e=document.querySelector(".bundle-source-code-wrap"),t=e?.scrollTop??0,r=e?.scrollLeft??0;x();let n=document.querySelector(".bundle-source-code-wrap");n&&(n.scrollTop=t,n.scrollLeft=r)}function Ws(e){let r=document.querySelector(e)?.scrollTop??0;x();let n=document.querySelector(e);n&&(n.scrollTop=r)}function Ur(){a.viewMode==="table"?Ws(".findings-table-list"):x()}var pp=0;function HC(){pp||(pp=requestAnimationFrame(()=>{pp=0,x()}))}function ee(e,t){for(let r of e.composedPath())if(r?.matches?.(t))return r;return null}function Rv(e){let r=ee(e,"[data-gid]")?.dataset?.gid,n=r?Fr(r):null;if(!n)return null;let o=ze(n);return Bg(o,Aa(o))}C.addEventListener("click",e=>{let t=ee(e,"[data-finding-code-bundle]");if(t){let E=t.dataset.findingCodeBundle,P=t.dataset.findingCodeFile,W=t.dataset.findingCodeLine,G=W?parseInt(W,10):null;a.bundleSourceFile=P||null,a.bundleSourceFindingIdx=null,(a.bundleDetailsTab==="code"||a.bundleDetailsTab==="search")&&(a.bundleDetailsTab="overview");let oe=()=>{Number.isFinite(G)&&queueMicrotask(()=>{let Ce=document.querySelector(`.bundle-source-lineno-row[data-line="${G}"]`);Ce&&Ce.scrollIntoView({block:"start",behavior:"instant"})})};if(a.selectedBundle===E&&a.bundleDetails?.integrity===E){x(),oe();return}a.selectedBundle=E,a.bundleDetails=null,x(),(async()=>(await nr(E),oe()))();return}let r=e.target.closest("[data-package-expand]");if(r){let E=r.dataset.packageExpand;a.expandedPackages.has(E)?a.expandedPackages.delete(E):a.expandedPackages.add(E),x();return}let n=e.target.closest("[data-package-row-issues]");if(n){let E=n.dataset.packageRowIssues,P=n.dataset.packageRowIssuesVersion;a.selectedPackage=E,a.selectedPackageVersion=P||null,a.packageDetailsTab="issues",a.packageSlideTriage=null,a.packageSlideTransient=!0,x();return}let o=e.target.closest("[data-repository-row-issues]");if(o){let E=o.dataset.repositoryRowIssues;a.selectedRepository=E,a.repositoryDetailsTab="issues",a.repositorySlideTriage=null,a.repositorySlideTransient=!0,x();return}let s=e.target.closest("[data-select-package]");if(s){let E=s.dataset.selectPackage,P=s.dataset.selectPackageVersion??"",W=P===""?null:P;if(a.selectedPackage===E&&a.selectedPackageVersion===W)return;a.selectedPackage=E,a.selectedPackageVersion=W,a.packageDetailsTab="overview",a.packageSlideTriage=null,a.packageSlideTransient=!1,x();return}if(e.target.closest("[data-deselect-package]")){a.selectedPackage=null,a.selectedPackageVersion=null,x();return}let i=e.target.closest("[data-package-tab]");if(i){let E=i.dataset.packageTab;(E==="overview"||E==="issues")&&a.packageDetailsTab!==E&&(a.packageDetailsTab=E,x());return}if(e.target.closest('[data-action="package-slide-back"]')){a.packageDetailsTab="overview",a.packageSlideTriage=null,a.packageSlideTransient&&(a.selectedPackage=null,a.selectedPackageVersion=null,a.packageSlideTransient=!1),x();return}let l=e.target.closest("[data-package-report]");if(l){let E=l.dataset.packageReport;E&&Ze(E);return}let c=e.target.closest("[data-select-repository]");if(c){let E=c.dataset.selectRepository;if(a.selectedRepository===E)return;a.selectedRepository=E,a.repositoryDetailsTab="overview",a.repositorySlideTriage=null,a.repositorySlideTransient=!1,x();return}if(e.target.closest("[data-deselect-repository]")){a.selectedRepository=null,x();return}let u=e.target.closest("[data-repository-tab]");if(u){let E=u.dataset.repositoryTab;(E==="overview"||E==="issues")&&a.repositoryDetailsTab!==E&&(a.repositoryDetailsTab=E,x());return}if(e.target.closest('[data-action="repository-slide-back"]')){a.repositoryDetailsTab="overview",a.repositorySlideTriage=null,a.repositorySlideTransient&&(a.selectedRepository=null,a.repositorySlideTransient=!1),x();return}let p=e.target.closest("[data-bundle-tab]");if(p){let E=p.dataset.bundleTab;if(Ms.has(E)){if(E===a.bundleDetailsTab){a.selectedBundle&&Nr(a.selectedBundle,E);return}a.bundleDetailsTab==="graph"&&E!=="graph"&&Be(),a.bundleDetailsTab=E,a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.selectedBundle&&Nr(a.selectedBundle,E),x(),E==="code"&&Ls()}return}let f=e.target.closest("[data-bundle-download]");if(f){let E=f.dataset.bundleDownload,P=(a.bundles??[]).find(W=>W.integrity===E);if(!P)return;(async()=>{let{confirmed:W}=await kv({name:P.name,encrypted:ae()});if(W)try{let G=await Gt(E);Kt(new Blob([G],{type:"application/octet-stream"}),P.name)}catch(G){alert(`Failed to download bundle: ${G.message}`)}})();return}let h=e.target.closest("[data-bundle-export-sbom]");if(h){let E=h.dataset.bundleExportSbom,P=a.bundleDetails,W=(a.bundles??[]).find(G=>G.integrity===a.selectedBundle);if(!W||!P||P.integrity!==W.integrity)return;try{let G=E==="cyclonedx",oe=G?gb(P,W):bb(P,W),Ce=`${Pa(W.name)}.${G?"cdx":"spdx"}.json`;Kt(new Blob([oe],{type:"application/json"}),Ce)}catch(G){alert(`Failed to export ${E==="cyclonedx"?"CycloneDX":"SPDX"}: ${G.message}`)}return}if(ee(e,"[data-bundle-search-context]")){a.bundleSearchContext=!a.bundleSearchContext,Ws(".bundle-search-results");return}if(e.target.closest("[data-advisories-consent]")){ny(),x();return}if(e.target.closest("[data-advisories-retry]")){sy(a.bundleDetails,x).catch(()=>{}),x();return}let g=e.target.closest("[data-bundle-issue-report]");if(g){let E=g.dataset.bundleIssueReport;E&&Ze(E);return}if(e.target.classList?.contains("bundle-source-overlay")||e.target.closest('[data-action="bundle-source-close"]')){a.bundleSourceFile&&(a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,x());return}if(e.target.closest('[data-action="bundle-source-panel-close"]')){a.bundleSourceFindingIdx!=null&&(a.bundleSourceFindingIdx=null,fo());return}let w=e.target.closest("[data-bundle-source-finding]");if(w){let E=parseInt(w.dataset.bundleSourceFinding,10);Number.isFinite(E)&&(a.bundleSourceFindingIdx=a.bundleSourceFindingIdx===E?null:E,fo());return}let v=e.target.closest("[data-bundle-code-issue-step]");if(v){let E=v.closest("[data-bundle-code-issue-order]"),P=null;try{P=JSON.parse(E?.dataset.bundleCodeIssueOrder??"null")}catch{}if(Array.isArray(P)&&P.length>0){let W=v.dataset.bundleCodeIssueStep==="-1"?-1:1,G=P.findIndex(Ce=>Ce.idx===a.bundleSourceFindingIdx),oe=G===-1?W>0?P[0]:P.at(-1):P[(G+W+P.length)%P.length];a.bundleSourceFindingIdx=oe.idx,fo(),oe.line>0&&queueMicrotask(()=>{let Ce=document.querySelector(`.bundle-source-lineno-row[data-line="${oe.line}"]`);Ce&&Ce.scrollIntoView({block:"center",behavior:"smooth"})})}return}let y=ee(e,"[data-bundle-view-source]");if(y){let E=y.dataset.bundleViewSource;if(!E)return;let P=y.dataset.bundleViewFindingIdx,W=P===void 0?null:parseInt(P,10),G=y.dataset.bundleViewLine,oe=G?parseInt(G,10):null,Ce=a.bundleSourceFile!==E;if(a.bundleSourceFile=E,Number.isFinite(W)?a.bundleSourceFindingIdx=W:Ce&&(a.bundleSourceFindingIdx=null),y.closest(".bundle-code-rail")?Ws(".bundle-code-rail-body"):y.closest(".bundle-search-results")?Ws(".bundle-search-results"):y.closest(".bundles-slide-body")?Ws(".bundles-slide-body"):x(),Number.isFinite(oe)){let ct=y.dataset.bundleViewScrollBlock||"center";queueMicrotask(()=>{let Ge=document.querySelector(`.bundle-source-lineno-row[data-line="${oe}"]`);Ge&&Ge.scrollIntoView({block:ct,behavior:"smooth"})})}return}if(e.target.closest('[data-action="toggle-files"]')){a.currentView==="files"?a.currentView="findings":(a.viewMode==="graph"&&Be(),a.currentView="files"),document.body.classList.remove("report-fullscreen"),x();return}let S=ee(e,"[data-g2-pkg]");if(S){let E=S.dataset.g2Pkg;A.solo=A.solo===E?null:E,A.solo&&(A.selected=null),Tv(),al(),A.graphState?.requestDraw?.();return}let M=ee(e,"[data-g2-select]");if(M){A.selected=M.dataset.g2Select,Tv(),A.graphState?.requestDraw?.();return}let _=ee(e,"[data-g2-top-pkgs]");if(_){A.topPkgsTab=_.dataset.g2TopPkgs,al();return}let R=ee(e,"[data-g2-jump-findings]");if(R){if(a.currentView==="bundles"){a.bundleDetailsTab==="graph"&&Be(),a.bundleDetailsTab="issues",a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.selectedBundle&&Nr(a.selectedBundle,"issues"),x();return}Yn(),a.filterConfMin=0,a.filterInclude=R.dataset.g2JumpFindings,a.currentView="findings",a.viewMode==="graph"&&(a.viewMode="table"),Be(),x();return}let O=ee(e,"[data-g2-jump-file]");if(O){let E=O.dataset.g2JumpFile;a.currentView="files",Be(),x(),requestAnimationFrame(()=>{let P=document.querySelector(`#${Ss(E)}`);P&&P.scrollIntoView({behavior:"smooth",block:"start"})});return}if(ee(e,"#g2-path-filter-clear")){A.pathFilter="";let E=document.querySelector("graph-layout")?.shadowRoot?.querySelector("#g2-path-filter");E&&(E.value=""),A.graphState?.requestDraw?.();return}if(ee(e,"#g2-fullscreen")){document.body.classList.toggle("report-fullscreen");return}if(ee(e,"[data-g2-show-all]")){A.showAll=!A.showAll,A.layoutCache=null,A.selected=null,Be(),x();return}if(ee(e,"[data-g2-split-own]")){A.splitOwnDirs=!A.splitOwnDirs,A.layoutCache=null,A.solo=null,A.focusedPkg=null,A.packagesView&&(A.selected=null),Be(),x();return}if(ee(e,"[data-g2-packages-view]")){A.packagesView=!A.packagesView,A.layoutCache=null,A.selected=null,A.focusedPkg=null,Be(),x();return}let Y=ee(e,".graph2-triage-selector [data-triage-show]");if(Y){let E=Y.dataset.triageShow;a.shownTriage=a.shownTriage===E?null:E,A.layoutCache=null,A.selected=null,Be(),x();return}let qe=ee(e,"[data-g2-focus-pkg]");if(qe){A.focusedPkg=qe.dataset.g2FocusPkg,A.layoutCache=null,Be(),x();return}if(ee(e,"#g2-back-to-full")){A.focusedPkg=null,A.layoutCache=null,A.packagesView&&(A.selected=null),Be(),x();return}let et=ee(e,".tab");if(et&&ee(e,".tabs")){let P=ee(e,"[data-gid]").dataset.gid,W=et.dataset.tid;a.activeTabByGroup.set(P,W),Ur();return}let lt=ee(e,"[data-triage-action]");if(lt){let E=lt.closest(".triage-menu"),P=E?.dataset.gid;if(!P)return;let W=Fr(P);if(!W)return;let G=lt.dataset.triageAction;if(!["inprogress","fixed","invalid","deleted","ignored","restore"].includes(G))return;let Ce=ve(W).hasConflict?[ze(W)]:W;for(let ct of Ce){let Ge=D(ct),xn=Ea(ct);G==="restore"?(U(a.triage,Ge,{triage:void 0}),be(a.triage,Ge,xn,!1)):G==="ignored"?Xt(a.triage,Ge,xn)?be(a.triage,Ge,xn,!1):(U(a.triage,Ge,{triage:void 0}),be(a.triage,Ge,xn,!0)):a.triage.get(Ge)?.triage===G?U(a.triage,Ge,{triage:void 0}):(U(a.triage,Ge,{triage:G}),be(a.triage,Ge,xn,!1))}try{E.hidePopover()}catch{}fe(),Ur();return}if(ee(e,".mark-comment")){let P=ee(e,"[data-gid]").dataset.gid,W=Fr(P);if(!W)return;let G=ze(W),oe=D(G),Ce=a.triage.get(oe)?.comment??"";wv({initial:Ce,finding:G}).then(ct=>(ct===null||(U(a.triage,oe,{comment:ct||void 0}),fe(),Ur()),null)).catch(()=>{});return}let ir=ee(e,".mark-copy");if(ir){let E=Rv(e);if(E===null)return;try{navigator.clipboard.writeText(E).then(()=>(ir.classList.add("copied"),setTimeout(()=>ir.classList.remove("copied"),1e3),null)).catch(()=>{})}catch{}return}let ar=ee(e,".mark-link");if(ar){let E=ee(e,"[data-gid]"),P=E?Fr(E.dataset.gid):null;if(!P)return;let W=lv(ze(P));if(!W)return;try{navigator.clipboard.writeText(W).then(()=>(ar.classList.add("copied"),setTimeout(()=>ar.classList.remove("copied"),1e3),null)).catch(()=>{})}catch{}return}let Vr=ee(e,"[data-copy-report]");if(Vr){let E=Vr.dataset.copyReport;try{navigator.clipboard.writeText(E).then(()=>(Vr.classList.add("copied"),setTimeout(()=>Vr.classList.remove("copied"),1e3),null)).catch(()=>{})}catch{}return}let lr=ee(e,"[data-copy-path]");if(lr){let E=lr.dataset.copyPath;try{navigator.clipboard.writeText(E).then(()=>(lr.classList.add("copied"),setTimeout(()=>lr.classList.remove("copied"),1e3),null)).catch(()=>{})}catch{}return}let $n=ee(e,".mark-claude");if($n){let E=Rv(e);if(E===null)return;let P=`claude://code/new?q=${encodeURIComponent(`Confirm and fix:
139
+
140
+ ${E}`)}`;try{window.location.href=P,$n.classList.add("copied"),setTimeout(()=>$n.classList.remove("copied"),1e3)}catch{}return}if(ee(e,".mark-fix")){let P=ee(e,"[data-gid]").dataset.gid,W=Fr(P);if(!W)return;let G=ze(W),oe=D(G),Ce=a.triage.get(oe)?.fix??"";Sv({initial:Ce,finding:G}).then(ct=>(ct===null||(U(a.triage,oe,{fix:ct||void 0}),fe(),Ur()),null)).catch(()=>{});return}let cr=ee(e,"[data-flag-toggle]");if(cr){let E=cr.dataset.flagToggle,P=a.triage.get(E)?.flagged;U(a.triage,E,{flagged:P!==!0}),fe(),Ur();return}let dr=e.target.closest("[data-triage-show]");if(dr&&!dr.closest(".graph2-triage-selector")){let E=dr.dataset.triageShow;a.shownTriage=a.shownTriage===E?null:E,x();return}if(e.target.closest("[data-table-deselect]")){a.tableSelectedGid=null,Ur();return}let Et=e.target.closest("[data-tree-select]");if(Et){let E=Et.dataset.treeSelect;a.filesSelectedFile=a.filesSelectedFile===E?null:E,x();return}e.target.closest("[data-tree-deselect]")&&(a.filesSelectedFile=null,x())});var Iv=document.querySelector("#bundle-source-overlay-slot");Iv&&Iv.addEventListener("click",e=>{if(e.target.classList?.contains("bundle-source-overlay")||e.target.closest('[data-action="bundle-source-close"]')){a.bundleSourceFile&&(a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,x());return}if(e.target.closest('[data-action="bundle-source-panel-close"]')){a.bundleSourceFindingIdx!=null&&(a.bundleSourceFindingIdx=null,fo());return}let t=e.target.closest("[data-bundle-source-finding]");if(t){let r=parseInt(t.dataset.bundleSourceFinding,10);Number.isFinite(r)&&(a.bundleSourceFindingIdx=a.bundleSourceFindingIdx===r?null:r,fo())}});C.addEventListener("row-select",e=>{let t=e.detail?.gid;t&&(a.tableSelectedGid=a.tableSelectedGid===t?null:t,Ur())});var ll="application/x-deepview-kanban-gid";function VC(e,t){let n=ve(e).hasConflict?[ze(e)]:e;for(let o of n){let s=D(o),i=Ea(o);t==="untriaged"?(U(a.triage,s,{triage:void 0}),be(a.triage,s,i,!1)):t==="ignored"?(U(a.triage,s,{triage:void 0}),be(a.triage,s,i,!0)):(U(a.triage,s,{triage:t}),be(a.triage,s,i,!1))}}function hp(){for(let e of C.querySelectorAll(".kanban-card.dragging"))e.classList.remove("dragging");for(let e of C.querySelectorAll(".kanban-column.drag-over"))e.classList.remove("drag-over")}C.addEventListener("dragstart",e=>{let t=e.target.closest?.(".kanban-card[data-kanban-source]");if(!t||!e.dataTransfer)return;let r=t.dataset.gid;r&&(e.dataTransfer.setData(ll,r),e.dataTransfer.setData("text/plain",r),e.dataTransfer.effectAllowed="move",t.classList.add("dragging"))});C.addEventListener("dragend",()=>{hp()});C.addEventListener("dragover",e=>{if(!e.dataTransfer?.types.includes(ll))return;let t=e.target.closest?.(".kanban-column[data-kanban-target]");if(t&&(e.preventDefault(),e.dataTransfer.dropEffect="move",!t.classList.contains("drag-over"))){for(let r of C.querySelectorAll(".kanban-column.drag-over"))r!==t&&r.classList.remove("drag-over");t.classList.add("drag-over")}});C.addEventListener("dragleave",e=>{let t=e.target.closest?.(".kanban-column[data-kanban-target]");t&&(t.contains(e.relatedTarget)||t.classList.remove("drag-over"))});C.addEventListener("drop",e=>{if(!e.dataTransfer?.types.includes(ll))return;let t=e.target.closest?.(".kanban-column[data-kanban-target]");if(!t){hp();return}e.preventDefault();let r=e.dataTransfer.getData(ll),n=t.dataset.kanbanTarget;if(hp(),!r||!n)return;let o=Fr(r);!o||(ve(o).commonTriage??"untriaged")===n||(VC(o,n),x(),queueMicrotask(fe))});var fp=!1;function kn(e){return e?C.querySelector(`.kanban-card[data-gid="${CSS.escape(e)}"]`):null}function il(e){let t=e??C.querySelector(".kanban-card");if(!t)return;let r=t.getBoundingClientRect();r.width<=0||r.height<=0||(document.documentElement.style.setProperty("--kanban-clip-card-w",`${Math.floor(r.width)}px`),document.documentElement.style.setProperty("--kanban-clip-card-h",`${Math.floor(r.height)}px`))}function Ks(e){let t=a.kanbanPopoverGid;if(t===e)return;let r=t===null&&e!==null,n=t!==null&&e===null;if(!document.startViewTransition||!r&&!n){a.kanbanPopoverGid=e,x();return}if(fp)return;fp=!0;let o=r?"kanban-opening":"kanban-closing";document.documentElement.classList.add(o);let s=u=>{u&&(u.style.viewTransitionName=""),document.documentElement.classList.remove(o),fp=!1};if(r){let u=kn(e);u?(il(u),u.style.viewTransitionName="kanban-detail-modal",u.getBoundingClientRect()):il(),a.kanbanPopoverGid=e;let p=document.startViewTransition(()=>{x(),u&&(u.style.viewTransitionName="")}),f=setTimeout(()=>s(u),600);(async()=>{try{await p.finished}catch{}clearTimeout(f),s(u)})();return}il(),a.kanbanPopoverGid=e;let i=null,l=document.startViewTransition(()=>{x(),i=kn(t),i&&(il(i),i.style.viewTransitionName="kanban-detail-modal")}),c=setTimeout(()=>s(i??kn(t)),600);(async()=>{try{await l.finished}catch{}clearTimeout(c),s(i??kn(t))})()}function jC(e){let t=kn(a.kanbanPopoverGid),r=t?.closest(".kanban-column");if(!r)return;let n=[...r.querySelectorAll(".kanban-card[data-kanban-source]")],o=n.indexOf(t);if(o<0)return;let s=Math.min(Math.max(o+e,0),n.length-1);if(s===o)return;let i=n[s].dataset.gid;if(!i)return;Ks(i);let l=kn(i);l&&(l.focus({preventScroll:!0}),l.scrollIntoView({block:"nearest",behavior:"instant"}))}C.addEventListener("click",e=>{if(e.target.closest?.(".kanban-detail-close")){Ks(null);return}let t=e.target.closest?.("[data-kanban-expand]");if(t){let n=t.dataset.kanbanExpand,o=a.kanbanExpandedColumn===n?null:n;a.kanbanExpandedColumn=o,o&&a.kanbanPopoverGid&&kn(a.kanbanPopoverGid)?.closest(".kanban-column")?.dataset.kanbanTarget!==o&&(a.kanbanPopoverGid=null),x();return}if(e.target.closest?.(".kanban-action"))return;let r=e.target.closest?.(".kanban-card[data-kanban-source]");if(r){if(window.getSelection?.()?.toString())return;let n=r.dataset.gid;if(!n)return;Ks(a.kanbanPopoverGid===n?null:n);return}e.target.closest?.(".kanban-detail-modal")||a.kanbanPopoverGid&&Ks(null)});document.addEventListener("keydown",e=>{if(e.key==="Escape"){if(a.kanbanPopoverGid){Ks(null);return}a.viewMode!=="kanban"||a.kanbanExpandedColumn===null||(a.kanbanExpandedColumn=null,x())}});function Mv(e){if(!e||a.focusGid===e)return;a.focusGid=e,x();let t=C.querySelector(".focus-side-card.active");t&&t.scrollIntoView({block:"nearest",behavior:"instant"});let r=C.querySelector(".focus-code-line-active");r&&r.scrollIntoView({block:"center",behavior:"instant"})}function Fv(e){let t=C.querySelectorAll(".focus-side-card[data-focus-select]");if(t.length===0)return;let r=-1;for(let s=0;s<t.length;s++)if(t[s].classList.contains("active")){r=s;break}let n=r<0?e>0?0:t.length-1:Math.min(Math.max(r+e,0),t.length-1);if(n===r)return;let o=t[n].dataset.gid;o&&Mv(o)}C.addEventListener("click",e=>{let t=e.target.closest?.("[data-focus-nav]");if(t){Fv(t.dataset.focusNav==="next"?1:-1);return}let r=e.target.closest?.(".focus-side-card[data-focus-select]");if(!r||window.getSelection?.()?.toString())return;let n=r.dataset.gid;n&&Mv(n)});function WC(e){if(document.querySelector("dialog[open]"))return!0;for(let t of e.composedPath()){if(!t||t.nodeType!==1)continue;let r=t.tagName;if(r==="INPUT"||r==="TEXTAREA"||r==="SELECT"||r==="DIALOG"&&t.open||t.isContentEditable)return!0}return!1}document.addEventListener("keydown",e=>{if(a.currentView!=="findings")return;let t=a.viewMode==="focus",r=a.viewMode==="kanban"&&a.kanbanPopoverGid!==null;if(!t&&!r||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||WC(e))return;let n=0;if(e.key==="ArrowRight")n=1;else if(e.key==="ArrowLeft")n=-1;else return;e.preventDefault(),t?Fv(n):jC(n)});C.addEventListener("mark-color",e=>{let t=ee(e,"[data-gid]");if(!t)return;let r=t.dataset.gid,n=Fr(r);if(!n)return;let o=D(ze(n)),s=e.detail?.color;if(!s)return;a.triage.get(o)?.color===s?U(a.triage,o,{color:void 0}):U(a.triage,o,{color:s}),fe(),Ur()});var Hr=null,mp=null;function Bv(){if(Hr!==null||a.reports.length===0)return;Hr=a.viewMode,mp=document.title,a.viewMode==="table"&&(a.viewMode="list",x());let e=a.reports.map(r=>r.fileName),t="";e.length===1?t=e[0]:e.length>1&&(t=_a(e)),t=t.replace(/\.json$/u,""),t&&(document.title=t)}function Lv(){Hr!==null&&(a.viewMode!==Hr&&(a.viewMode=Hr,x()),document.title=mp,Hr=null,mp=null)}window.addEventListener("beforeprint",Bv);window.addEventListener("afterprint",Lv);document.addEventListener("print-requested",async()=>{if(a.reports.length===0||Hr!==null)return;let{confirmed:e}=await cp("print");if(e&&Hr===null){Bv();try{await Promise.all([...C.querySelectorAll("finding-card")].map(t=>t.updateComplete)),window.print()}catch(t){throw Lv(),t}}});document.addEventListener("download-requested",async()=>{if(a.reports.length===0)return;let{confirmed:e}=await cp("download");e&&Av(a.reports)});C.addEventListener("analyzer-change",e=>{a.filterAnalyzer=e.detail.analyzer,a.filterModel=e.detail.model,x()});C.addEventListener("repo-change",e=>{a.filterRepo=e.detail.value,x()});C.addEventListener("revalidate-change",e=>{a.filterRevalidate=e.detail.value,x()});C.addEventListener("partial-change",e=>{a.filterPartial=e.detail.value,x()});C.addEventListener("bundle-search-mode-change",e=>{let t=e.detail?.mode;t!=="files"&&t!=="code"&&t!=="issues"||(a.bundleCodeSearchMode=t,x(),t==="files"&&Ls())});C.addEventListener("bundle-search-regex-toggle",()=>{a.bundleSearchRegex=!a.bundleSearchRegex,x()});C.addEventListener("bundle-search-case-toggle",()=>{a.bundleSearchCase=!a.bundleSearchCase,x()});C.addEventListener("bundle-swap",e=>{let t=e.detail?.integrity;!t||!(a.bundles??[]).some(r=>r.integrity===t)||(a.currentView="bundles",a.selectedBundle=t,a.bundleDetails=null,a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.bundleCodeSearchQuery="",a.bundleCodeSearchMode="files",a.bundleSearchQuery="",a.bundleSearchRegex=!1,a.bundleSearchCase=!1,a.bundleSearchContext=!0,a.bundleDetailsTab="compare",A.showAll=!0,a.shownTriage=null,Nr(t,"compare"),x(),j(),nr(t))});C.addEventListener("sort-change",e=>{let{kind:t,value:r}=e.detail;if(t==="findings")a.sortBy=r;else if(t==="packages")a.packagesSortBy=r;else if(t==="repositories")a.repositoriesSortBy=r;else return;x()});C.addEventListener("range-change",e=>{e.target.id==="conf-range"&&(a.filterConfMin=e.detail.low,a.filterConfMax=e.detail.high,x())});C.addEventListener("input",e=>{let t=e.composedPath()[0],r=t?.id,n=t?.value;r==="g2-path-filter"&&(A.pathFilter=n,A.graphState?.requestDraw?.())});C.addEventListener("search-input",e=>{if(!e.detail)return;let{kind:t,value:r}=e.detail;if(t==="findings")a.filterInclude=r,r||(a.filterIncludeNegate=!1);else if(t==="files")a.filesSearch=r;else if(t==="packages")a.packagesSearchQuery=r;else if(t==="repositories")a.repositoriesSearchQuery=r;else if(t==="bundle-code")a.bundleCodeSearchQuery=r;else if(t==="bundle-search"){a.bundleSearchQuery=r,HC();return}else return;x()});C.addEventListener("search-negate-toggle",()=>{a.filterIncludeNegate=!a.filterIncludeNegate,x()});C.addEventListener("severity-toggle",e=>{let t=e.detail.severity;if(e.detail.kind==="graph"){A.selectedSeverities.has(t)?A.selectedSeverities.delete(t):A.selectedSeverities.add(t),e.composedPath()[0].selected=[...A.selectedSeverities],A.graphState?.requestDraw?.(),al();return}a.filterSeverities.has(t)?a.filterSeverities.delete(t):a.filterSeverities.add(t),x()});C.addEventListener("color-toggle",e=>{let t=e.detail.color;if(e.detail.kind==="graph"){A.selectedColors.has(t)?A.selectedColors.delete(t):A.selectedColors.add(t),e.composedPath()[0].selected=[...A.selectedColors],A.graphState?.requestDraw?.(),al();return}a.filterColors.has(t)?a.filterColors.delete(t):a.filterColors.add(t),x()});C.addEventListener("source-toggle",e=>{let t=e.detail.source,r=a.filterSources.has(t);a.filterSources.clear(),r||a.filterSources.add(t),x()});C.addEventListener("annotation-filter-toggle",e=>{let t=e.detail?.key,r=n=>n===""?"with":n==="with"?"without":"";if(t==="comment")a.filterComment=r(a.filterComment);else if(t==="fix")a.filterFix=r(a.filterFix);else if(t==="flag")a.filterFlagged=r(a.filterFlagged);else return;x()});C.addEventListener("slide-triage-toggle",e=>{let{kind:t,value:r}=e.detail;if(t==="package")a.packageSlideTriage=a.packageSlideTriage===r?null:r;else if(t==="repository")a.repositorySlideTriage=a.repositorySlideTriage===r?null:r;else return;x()});C.addEventListener("view-mode-change",e=>{if(e.detail.kind==="files"){a.filesViewMode=e.detail.mode,x();return}a.viewMode=e.detail.mode;try{localStorage.setItem(Pi,a.viewMode)}catch{}a.viewMode!=="kanban"&&(a.kanbanPopoverGid=null),a.viewMode!=="focus"&&(a.focusGid=null),x()});C.addEventListener("severity-mode-change",e=>{let t=e.detail?.mode;if(!(t!=="corrected"&&t!=="original")){a.severityMode=t;try{localStorage.setItem(Ni,t)}catch{}x()}});C.addEventListener("repo-edit-start",()=>{a.repoEditing=!0,x()});C.addEventListener("repo-input",e=>{a.repoUrl=e.detail.url,nt(a.currentFile,a.repoUrl)});C.addEventListener("repo-commit",e=>{a.repoUrl=e.detail.url,nt(a.currentFile,a.repoUrl),a.repoEditing=!1,x()});C.addEventListener("repo-cancel",e=>{a.repoUrl=e.detail.url,nt(a.currentFile,a.repoUrl),a.repoEditing=!1,x()});document.addEventListener("keydown",e=>{if(e.key==="Escape"){if(a.bundleSourceFindingIdx!=null){a.bundleSourceFindingIdx=null,fo();return}if(a.bundleSourceFile){if(a.currentView==="bundles"&&a.bundleDetailsTab==="code")return;a.bundleSourceFile=null,x()}}});var Ov=`:host{position:absolute;top:.5rem;right:.5rem;z-index:1000;width:30px;height:30px;background:transparent;color:var(--muted);border:0;border-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: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}}
141
+ `;var gp="deepview.theme",ho=Object.freeze(["dark","light","green","pink"]),qC={dark:{base:"#1a1a1b",dim:"#0a0a0a"},light:{base:"#f6f6fa",dim:"#646464"},green:{base:"#0a140a",dim:"#050a05"},pink:{base:"#ffe4ee",dim:"#a3727f"}},GC="\u2600",YC="\u263E",bp="deepview-theme-changed",cl="dark",vp=!1;function JC(){try{let e=localStorage.getItem(gp);return ho.includes(e)?e:"dark"}catch{return"dark"}}function qs(e){ho.includes(e)||(e="dark"),cl=e;for(let r of ho)r!=="dark"&&document.body.classList.remove(`theme-${r}`);e!=="dark"&&document.body.classList.add(`theme-${e}`);try{e==="dark"?localStorage.removeItem(gp):localStorage.setItem(gp,e)}catch{}let t=document.querySelector('meta[name="theme-color"]');if(t){let{base:r,dim:n}=qC[e];t.setAttribute("content",vp?n:r)}window.dispatchEvent(new CustomEvent(bp,{detail:{theme:e}}))}qs(JC());window.addEventListener("beforeprint",()=>{vp=!0,qs(cl)});window.addEventListener("afterprint",()=>{vp=!1,qs(cl)});function Pv(e){if(!ho.includes(e))throw new TypeError(`DeepView.setTheme: unknown theme ${JSON.stringify(e)} (expected one of ${ho.map(t=>JSON.stringify(t)).join(", ")})`);qs(e)}function Nv(){return cl}var Dv=ho,yp=class extends Z{static properties={_light:{state:!0}};static styles=F(Ov);constructor(){super(),this._light=document.body.classList.contains("theme-light")}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("tabindex")||(this.tabIndex=0),this.hasAttribute("aria-label")||this.setAttribute("aria-label","toggle theme"),this.hasAttribute("title")||this.setAttribute("title","toggle light/dark theme"),this.addEventListener("click",this._toggle),this.addEventListener("keydown",this._onKeydown),window.addEventListener(bp,this._onThemeChanged)}disconnectedCallback(){window.removeEventListener(bp,this._onThemeChanged),this.removeEventListener("click",this._toggle),this.removeEventListener("keydown",this._onKeydown),super.disconnectedCallback()}_onThemeChanged=()=>{this._light=document.body.classList.contains("theme-light")};_toggle=()=>{let t=document.body.classList.contains("theme-light");qs(t?"dark":"light")};_onKeydown=t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this._toggle())};render(){return d`${this._light?YC:GC}`}};customElements.define("theme-toggle",yp);var zv=`:host{display:block}.row{display:grid;grid-template-columns:5.5rem minmax(0,1fr);gap:.2rem .85rem;padding:.25rem .7rem;font-size:.8rem;border-bottom:1px solid var(--border);transition:background .12s}:host(:last-child) .row{border-bottom:none}:host(:hover) .row{background:rgb(from var(--text) r g b / .04)}:host(.mark-red) .row{background:var(--mark-red-bg)}:host(.mark-blue) .row{background:var(--mark-blue-bg)}:host(.mark-green) .row{background:var(--mark-green-bg)}:host(.mark-gray) .row{background:var(--mark-gray-bg)}:host(.has-conflict) .row{outline:2px dashed var(--accent);outline-offset:-2px}:host(.triage-fixed),:host(.triage-invalid),:host(.triage-deleted),:host(.triage-ignored){opacity:.75}:host(.selected) .row{outline:2px solid var(--accent);outline-offset:-2px}:host(.link-target) .row{animation:link-target-flash 1.6s ease-out}@keyframes link-target-flash{0%,30%{box-shadow:inset 0 0 0 2px var(--accent)}to{box-shadow:inset 0 0 0 2px rgb(from var(--accent) r g b / 0)}}@media(prefers-reduced-motion:reduce){:host(.link-target) .row{animation:none;box-shadow:inset 0 0 0 2px var(--accent)}}:host(:first-of-type) .row{border-top-left-radius:6px;border-top-right-radius:6px}:host(:last-of-type) .row{border-bottom-left-radius:6px;border-bottom-right-radius:6px}.row-score{grid-column:1;grid-row:1 / 3;align-self:center;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.2rem;font-variant-numeric:tabular-nums;.badge{min-width:4.4rem;text-align:center}.row-conf{color:var(--muted);font-size:.72rem;user-select:none;& strong{color:var(--text);font-size:.8rem}}}.row-body{display:contents}.title-row{grid-column:2;grid-row:1;min-width:0;display:flex;align-items:baseline;gap:.5rem;.title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500;user-select:none}.row-type{color:var(--muted);font-size:.68rem;flex-shrink:0}}.meta-row{grid-column:2;grid-row:2;min-width:0;display:flex;align-items:center;gap:.55rem;.row-loc{color:var(--muted);font-size:.72rem;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;& a{color:inherit}& a:hover{color:var(--accent)}}.marks{display:flex;gap:.35rem;align-items:center;flex-shrink:0;user-select:none}}.tabs-row{grid-column:2;grid-row:3;min-width:0;.tabs{display:flex;gap:.25rem;flex-wrap:wrap}}.badge,.tabs,.tab,.row-type{cursor:default;user-select:none}.badge{display:inline-block;font-size:.7rem;font-weight:600;text-transform:uppercase;padding:.15rem .45rem;border-radius:3px;letter-spacing:.03em;line-height:1;&.critical{background:var(--critical);color:#fff}&.high{background:var(--high);color:#fff}&.medium{background:var(--medium);color:#000}&.low{background:var(--low);color:var(--badge-low-text)}&.high_bug{background:var(--high-bug);color:#fff}&.bug{background:var(--bug);color:#fff}&.informational{background:var(--info);color:#fff}}.badge-pair{display:inline-flex;align-items:center;gap:.25rem}.badge-pair-full,.badge-pair-compact{flex-direction:column;gap:.15rem}.badge-orig-wrap{display:inline-flex;align-items:center;gap:.15rem;line-height:1}.badge-arrow,.badge-corr-mark{font-size:.6rem;line-height:1;color:var(--muted)}.badge-arrow.up,.badge-corr-mark.up{color:var(--high)}.badge-pre{font-size:.55rem;text-transform:uppercase;letter-spacing:.03em;color:var(--muted)}.badge-orig{display:inline-block;font-size:.58rem;font-weight:600;text-transform:uppercase;padding:.08rem .3rem;border-radius:3px;letter-spacing:.03em;line-height:1;background:transparent;color:var(--muted);border:1px solid var(--border);&.struck{text-decoration:line-through;text-decoration-thickness:1px}&.critical{border-color:rgb(from var(--critical) r g b / .55)}&.high{border-color:rgb(from var(--high) r g b / .55)}&.medium{border-color:rgb(from var(--medium) r g b / .55)}&.low{border-color:rgb(from var(--low) r g b / .55)}&.high_bug{border-color:rgb(from var(--high-bug) r g b / .55)}&.bug{border-color:rgb(from var(--bug) r g b / .55)}&.informational{border-color:rgb(from var(--info) r g b / .55)}}.badge-varies{font-size:.55rem;font-weight:600;text-transform:uppercase;letter-spacing:.03em;padding:.08rem .3rem;border-radius:3px;line-height:1;background:transparent;color:var(--muted);border:1px dashed var(--border)}.tab{background:transparent;color:var(--text);border:1px solid var(--border);border-radius:4px;padding:.2rem .5rem;font-size:.75rem;line-height:1.3;display:inline-flex;align-items:center;gap:.35rem;font-family:inherit;&:hover{border-color:var(--accent)}&.active{border-color:var(--accent);background:var(--surface-active)}&.tab-mark-red{background:var(--mark-red-bg);border-color:var(--mark-red-tab-border)}&.tab-mark-blue{background:var(--mark-blue-bg);border-color:var(--mark-blue-tab-border)}&.tab-mark-green{background:var(--mark-green-bg);border-color:var(--mark-green-tab-border)}&.tab-mark-gray{background:var(--mark-gray-bg);border-color:var(--mark-gray-tab-border)}&.tab-mark-red.active,&.tab-mark-blue.active,&.tab-mark-green.active,&.tab-mark-gray.active{border-color:var(--text)}&.tab-deleted .tab-label{text-decoration:line-through;opacity:.6}&.tab-inprogress .tab-label:after{content:" \\25d0";opacity:.6}&.tab-fixed .tab-label{opacity:.65}&.tab-fixed .tab-label:after{content:" \\2713";opacity:.6}&.tab-invalid .tab-label{opacity:.65}&.tab-invalid .tab-label:after{content:" \\2298";opacity:.6}&.tab-ignored .tab-label{opacity:.55}&.tab-ignored .tab-label:after{content:" \\1f441";opacity:.6;font-size:.7em}.tab-conf{color:var(--muted);font-size:.7rem}&.tab-mark-red .tab-conf,&.tab-mark-blue .tab-conf,&.tab-mark-green .tab-conf,&.tab-mark-gray .tab-conf{color:var(--text)}.tab-marks{display:inline-flex;align-items:center;gap:.15rem;margin-left:.25rem;vertical-align:middle;color:var(--accent)}.tab-marks svg{display:block}.tab-marks .has-comment .bubble,.tab-marks .has-fix .wrench,.tab-marks .flagged .flag-cloth{fill:var(--accent);fill-opacity:.15}}.report-chip{display:inline-flex;align-items:center;gap:.3rem;padding:0 .35rem;height:1.4rem;border:1px solid var(--border);border-radius:3px;color:var(--muted);font-size:.72rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;margin-right:.65rem;max-width:12rem;min-width:0;.report-chip-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.file-icon{flex-shrink:0}.brand-deepview{.bg{fill:#2563eb}.fg{fill:#fff}}.brand-claude{.bg{fill:#d97757}.fg{fill:#fff}}.brand-codex{.bg{fill:#fff;stroke:#000;stroke-width:.5}.fg{fill:#000}}.brand-vercel{.bg{fill:#000;stroke:#fff;stroke-width:.5}.fg{fill:#fff}}.brand-piolium{.bg{fill:#fbb829}.fg{fill:#1c1b19}}}.mark-action-group{display:inline-flex;border:1px solid var(--border);border-radius:3px;overflow:hidden;margin-right:.25rem;flex-shrink:0}.mark-comment,.mark-fix,.mark-flag,.mark-copy,.mark-link,.mark-issue,.mark-claude{background:transparent;border:0;color:var(--muted);padding:0 .25rem;height:1.4rem;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--accent);background:var(--surface-active)}}.mark-issue{text-decoration:none}.mark-comment.has-comment,.mark-fix.has-fix,.mark-flag.flagged{color:var(--accent)}.mark-flag svg{display:block}.mark-copy.copied,.mark-link.copied,.mark-claude.copied{color:var(--green, #4ade80);background:color-mix(in srgb,var(--green, #4ade80) 14%,transparent)}.mark-comment.has-comment .bubble,.mark-fix.has-fix .wrench,.mark-flag.flagged .flag-cloth{fill:var(--accent);fill-opacity:.15}.mark-x{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:3px;padding:0 .35rem;font-size:.85rem;line-height:1.1;margin-left:.25rem;&:hover{color:var(--critical);border-color:var(--critical)}}.triage-menu-wrap{position:relative;display:inline-flex;margin-left:.25rem;flex-shrink:0}.mark-triage-menu{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:3px;padding:0 .3rem;height:1.5rem;display:inline-flex;align-items:center;justify-content:center;gap:.25rem;font:inherit}.mark-triage-menu:hover{color:var(--text);border-color:var(--accent)}.mark-triage-menu.open{border-color:var(--accent);color:var(--text)}.mark-triage-menu.with-label{padding:0 .35rem 0 .5rem;font-size:.72rem;height:1.5rem}.mark-triage-menu .mark-triage-label{text-transform:uppercase;letter-spacing:.05em;font-weight:600}.mark-triage-menu.triage-state-deleted{border-color:var(--critical);color:var(--critical)}.mark-triage-menu.triage-state-fixed{border-color:var(--green, #4ade80);color:var(--green, #4ade80)}.mark-triage-menu.triage-state-inprogress{border-color:var(--warning, #d97706);color:var(--warning, #d97706)}.mark-triage-menu.triage-state-invalid{border-color:var(--muted);color:var(--text)}.mark-triage-menu.triage-state-ignored{border-color:var(--accent, #2563eb);color:var(--accent, #2563eb)}.triage-menu[popover]{position:fixed;inset:auto;margin:0;min-width:7rem;background:var(--bg);border:1px solid var(--border);border-radius:4px;padding:.25rem;box-shadow:0 4px 12px #00000040;display:flex;flex-direction:column;gap:1px;-webkit-app-region:no-drag;app-region:no-drag}.triage-menu[popover]:not(:popover-open){display:none}.triage-menu[popover]:popover-open{display:flex}.triage-menu-item{background:transparent;border:0;padding:.35rem .5rem;font-size:.78rem;color:var(--text);text-align:left;border-radius:3px;font-family:inherit}.triage-menu-item:hover{background:var(--surface)}.triage-menu-item.active:before{content:"\\2713 ";color:var(--accent)}.triage-menu-inprogress:hover{color:var(--warning, #d97706)}.triage-menu-fixed:hover{color:var(--green, #4ade80)}.triage-menu-invalid:hover{color:var(--muted)}.triage-menu-deleted:hover{color:var(--critical)}.mark-restore{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:3px;padding:0 .45rem;font-size:.75rem;line-height:1.3;margin-left:.25rem;&:hover{color:var(--green);border-color:var(--green)}}.line-num{color:var(--muted);font-size:.75rem}.line-num a{color:inherit}.line-num a:hover{color:var(--accent)}@media print{:host(:hover) .row,:host(.mark-red) .row,:host(.mark-blue) .row,:host(.mark-green) .row,:host(.mark-gray) .row{background:transparent!important}:host(.triage-fixed),:host(.triage-invalid),:host(.triage-deleted),:host(.triage-ignored){opacity:1}:host(.selected) .row,:host(.has-conflict) .row{outline:none!important}:host(.link-target) .row{animation:none;box-shadow:none!important}.row{break-inside:avoid}.marks,.mark-x,.mark-restore{display:none!important}.badge{-webkit-print-color-adjust:exact;print-color-adjust:exact;&.critical{background:#a30b0f!important;color:#fff!important}&.high{background:#b8400a!important;color:#fff!important}&.medium{background:#855107!important;color:#fff!important}&.low{background:#374151!important;color:#fff!important}&.high_bug{background:#7a3e0c!important;color:#fff!important}&.bug{background:#4d4538!important;color:#fff!important}&.informational{background:#0550ae!important;color:#fff!important}}.badge-orig{background:transparent!important;color:#555!important;border-color:#999!important}.badge-varies{color:#555!important;border-color:#999!important}.badge-arrow,.badge-corr-mark,.badge-pre{color:#555!important}a,.line-num,.line-num a{color:inherit}}
142
+ `;var QC=["is-critical","mark-red","mark-blue","mark-green","mark-gray","has-conflict","triage-inprogress","triage-fixed","triage-invalid","triage-deleted","triage-ignored","selected"],wp=class extends z{static properties={group:{attribute:!1},selected:{type:Boolean}};static styles=F(zv);constructor(){super(),this.group=null,this.selected=!1}render(){if(!this.group)return d``;this.dataset.gid=mn(this.group);let t=new Set(eb(this.group));this.selected&&t.add("selected");for(let r of QC)this.classList.toggle(r,t.has(r));return d`<div class="row">${tb(this.group)}</div>`}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._onClick),this.hasUpdated&&this.requestUpdate()}disconnectedCallback(){this.removeEventListener("click",this._onClick),super.disconnectedCallback()}_onClick=t=>{t.composedPath().some(n=>n?.matches?.("a, button, label"))||this.dataset.gid&&this.dispatchEvent(new CustomEvent("row-select",{detail:{gid:this.dataset.gid},bubbles:!0,composed:!0}))}};customElements.define("finding-row",wp);var Uv=`:host{display:block;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:6px;overflow:hidden;box-shadow:var(--shadow-glass);margin-bottom:1rem;max-width:1200px}@media not print{finding-row{content-visibility:auto;contain-intrinsic-size:auto 3.2rem}}
143
+ `;var kp=class extends Z{static properties={items:{attribute:!1},selectedGid:{attribute:!1}};static styles=F(Uv);constructor(){super(),this.items=[],this.selectedGid=null}render(){return d`${Q(this.items??[],t=>mn(t),t=>d`<finding-row .group="${t}" ?selected="${mn(t)===this.selectedGid}"></finding-row>`)}`}};customElements.define("finding-table",kp);var Hv=`:host{display:block}:host(.hidden){display:none}:host(.triage-fixed),:host(.triage-invalid),:host(.triage-deleted),:host(.triage-ignored){opacity:.75}.card{padding:.5rem .75rem;border-bottom:1px solid var(--border);font-size:.875rem}:host(:last-child) .card{border-bottom:none}:host(.mark-red) .card{background:var(--mark-red-bg)}:host(.mark-blue) .card{background:var(--mark-blue-bg)}:host(.mark-green) .card{background:var(--mark-green-bg)}:host(.mark-gray) .card{background:var(--mark-gray-bg)}:host(.has-conflict) .card{outline:2px dashed var(--accent);outline-offset:-2px}:host(.link-target) .card{animation:link-target-flash 1.6s ease-out}@keyframes link-target-flash{0%,30%{box-shadow:inset 0 0 0 2px var(--accent)}to{box-shadow:inset 0 0 0 2px rgb(from var(--accent) r g b / 0)}}@media(prefers-reduced-motion:reduce){:host(.link-target) .card{animation:none;box-shadow:inset 0 0 0 2px var(--accent)}}:host([in-group]) .line-row{display:none}@media not print{:host([in-group]) .line-row+*{margin-top:0}:host([in-group]) .line-row+:is(.conf-reason,.revalidate-verdict,.severity-reason){padding-top:0;border-top:0}}.tabs{display:flex;gap:.25rem;flex-wrap:wrap}.marks-left{display:flex;align-items:center;gap:.5rem;margin-right:auto;flex-wrap:wrap}.commit-ref{color:var(--muted);font-size:.8rem;& a{color:var(--accent);font-family:ui-monospace,SFMono-Regular,Menlo,monospace}& a:hover{text-decoration:underline}& span{font-family:ui-monospace,SFMono-Regular,Menlo,monospace}}.marks-commit-row{margin-top:.4rem;padding-left:4.75rem}.tab-body{display:none;grid-template-columns:auto 1fr;gap:.25rem .75rem;&.active{display:grid}}.tab-body>:not(.finding-left){min-width:0;overflow-wrap:break-word}.desc-title{grid-column:2;font-size:1.08em;font-weight:600;letter-spacing:-.005em;line-height:1.35;color:var(--text)}.desc{grid-column:2;white-space:pre-wrap;font-size:.96em;line-height:1.6;color:rgb(from var(--text) r g b / .82);margin-top:.4rem}.section,.evidence,.recommendation{grid-column:2;margin-top:.55rem;font-size:.92em}.section-label{display:flex;align-items:center;gap:.3rem;color:var(--muted);font-weight:600;font-size:.62rem;text-transform:uppercase;letter-spacing:.06em;&:before{content:"";flex:none;width:2px;height:.58rem;margin-left:calc((2px + .3rem)*-1);border-radius:1px;background:currentcolor;opacity:.75;-webkit-print-color-adjust:exact;print-color-adjust:exact}}summary.section-label{cursor:pointer;list-style:none;&::-webkit-details-marker{display:none}&:after{content:"";flex:none;width:.3rem;height:.3rem;margin-left:.05rem;border-right:1.5px solid currentcolor;border-bottom:1.5px solid currentcolor;transform:translateY(-1px) rotate(-45deg);transition:transform .12s;opacity:.8}}details[open]>summary.section-label:after{transform:translateY(-2px) rotate(45deg)}.evidence-count{font-weight:500;opacity:.8}.section-body{white-space:pre-wrap;line-height:1.55;color:rgb(from var(--text) r g b / .82);margin-top:.1rem}.para+.para{margin-top:.5lh}.md-list{margin:0;padding-inline-start:1.2em}.md-list li+li{margin-top:.25lh}.para+.md-list,.md-list+.para,.md-list+.md-list{margin-top:.5lh}.md-list li::marker{color:rgb(from currentcolor r g b / .45)}.recommendation .section-label,.recommendation .section-body{color:var(--green)}.conf-reason,.revalidate-verdict{grid-column:2;white-space:pre-wrap;font-size:.92em;font-style:italic;color:var(--muted);margin-top:.6rem;padding-top:.55rem;border-top:1px dashed var(--border)}.revalidate-stamp{display:inline-block;margin-top:.1rem;font-size:.55rem;font-weight:600;line-height:1;text-transform:uppercase;letter-spacing:.03em;padding:.14rem .3rem;border-radius:3px;background:transparent;color:var(--muted);border:1px solid var(--border);white-space:nowrap;&.confirmed{color:var(--critical);border-color:rgb(from var(--critical) r g b / .55)}&.partial{color:var(--yellow);border-color:rgb(from var(--yellow) r g b / .55)}&.unknown{color:var(--warning);border-color:rgb(from var(--warning) r g b / .55)}}.evidence-list{margin:.25rem 0 0;padding-left:1.6rem;display:flex;flex-direction:column;gap:.15rem;& li::marker{color:var(--muted);font-size:.9em}& li:has(.evidence-note):not(:last-child){margin-bottom:.3rem}}.evidence-ref{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.92em;overflow-wrap:anywhere;color:var(--accent);text-decoration:none;&:hover{text-decoration:underline}}span.evidence-ref{color:var(--muted)}.evidence-note{white-space:pre-wrap;line-height:1.5;color:rgb(from var(--text) r g b / .78);margin-top:.1rem}.desc-title a,.desc a,.section-body a,.conf-reason a,.revalidate-verdict a{color:var(--accent);text-decoration:none;&:hover{text-decoration:underline}}.inline-quote{background:rgb(from var(--accent) r g b / .1);padding:1px;border-radius:3px;color:var(--text)}.inline-code{background:var(--surface-active);border-radius:3px;border:1px solid var(--border);padding:0 .25em;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.9em;color:var(--text)}.code-block{white-space:normal;margin:.5rem 0;border:1px solid var(--border);border-radius:4px;background:rgb(from var(--text) r g b / .05);overflow:hidden;width:fit-content;max-width:100%;.code-block-lang{padding:.15rem .5rem;border-bottom:1px solid var(--border);color:var(--muted);font-size:.62rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em}& pre{margin:0;padding:.45rem .6rem;overflow-x:auto;white-space:pre;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.85em;line-height:1.5;color:var(--text)}& code{font:inherit}.token.comment,.token.prolog,.token.cdata{color:var(--code-comment);font-style:italic}.token.punctuation{color:var(--muted)}.token.string,.token.attr-value,.token.char,.token.regex{color:var(--code-string)}.token.number,.token.boolean,.token.constant,.token.symbol{color:var(--code-number)}.token.keyword,.token.builtin,.token.important,.token.atrule{color:var(--code-keyword)}.token.function,.token.class-name,.token.tag{color:var(--code-function)}.token.operator,.token.entity,.token.url,.token.attr-name,.token.selector{color:var(--code-operator)}.token.variable,.token.property,.token.parameter{color:var(--code-variable)}.token.deleted{color:var(--code-deleted)}.token.inserted{color:var(--code-inserted)}.token.italic{font-style:italic}.token.bold{font-weight:700}}.line-row{display:flex;justify-content:space-between;align-items:baseline;gap:.5rem;flex-wrap:wrap}.run-meta{color:var(--muted);font-size:.65rem}.finding-code-btn{display:inline-block;margin-top:.35rem;padding:.1rem .45rem;background:transparent;border:1px solid var(--border);border-radius:999px;color:var(--muted);font:inherit;font-size:.65rem;font-weight:500;white-space:nowrap}.finding-code-btn:hover{border-color:var(--accent);color:var(--accent)}.marks{display:flex;gap:.35rem;justify-content:flex-end;margin-top:.4rem;align-items:center;padding-left:4.75rem;user-select:none}.finding-left{align-self:start;text-align:center;min-width:4rem;.value-label:last-child{margin-bottom:0}}.conf-score{font-size:.75rem;color:var(--muted);margin-top:.3rem;& strong{color:var(--text);font-size:.85rem}}.conf-ring{--col: var(--muted);position:relative;width:3rem;height:3rem;margin:.7rem auto .15rem;display:flex;align-items:center;justify-content:center;& svg{position:absolute;inset:0;width:100%;height:100%;transform:rotate(-90deg)}& circle{fill:none;stroke-width:4}.conf-ring-track{stroke:var(--border)}.conf-ring-arc{stroke:var(--col);stroke-linecap:round}& span{position:relative;z-index:1;font-size:.8rem;font-weight:700;color:var(--text);font-variant-numeric:tabular-nums}& small{font-size:.55rem;color:var(--muted);font-weight:500}&.critical{--col: var(--critical)}&.high{--col: var(--high)}&.medium{--col: var(--medium)}&.low{--col: var(--low)}&.high_bug{--col: var(--high-bug)}&.bug{--col: var(--bug)}&.informational{--col: var(--info)}}.value-label{display:block;font-size:.45rem;color:var(--muted);text-transform:uppercase;letter-spacing:.04em;margin-top:.1rem;margin-bottom:.3rem;font-weight:500}.print-case-label{display:none}.badge,.tabs,.tab,.value-label,.run-meta,.conf-ring{cursor:default;user-select:none}.badge{display:inline-block;font-size:.7rem;font-weight:600;text-transform:uppercase;padding:.15rem .45rem;border-radius:3px;letter-spacing:.03em;line-height:1;&.critical{background:var(--critical);color:#fff}&.high{background:var(--high);color:#fff}&.medium{background:var(--medium);color:#000}&.low{background:var(--low);color:var(--badge-low-text)}&.high_bug{background:var(--high-bug);color:#fff}&.bug{background:var(--bug);color:#fff}&.informational{background:var(--info);color:#fff}}.badge-pair{display:inline-flex;align-items:center;gap:.25rem}.badge-pair-full,.badge-pair-compact{flex-direction:column;gap:.15rem}.badge-orig-wrap{display:inline-flex;align-items:center;gap:.15rem;line-height:1}.badge-arrow,.badge-corr-mark{font-size:.6rem;line-height:1;color:var(--muted)}.badge-arrow.up,.badge-corr-mark.up{color:var(--high)}.badge-pre{font-size:.55rem;text-transform:uppercase;letter-spacing:.03em;color:var(--muted)}.badge-orig{display:inline-block;font-size:.58rem;font-weight:600;text-transform:uppercase;padding:.08rem .3rem;border-radius:3px;letter-spacing:.03em;line-height:1;background:transparent;color:var(--muted);border:1px solid var(--border);&.struck{text-decoration:line-through;text-decoration-thickness:1px}&.critical{border-color:rgb(from var(--critical) r g b / .55)}&.high{border-color:rgb(from var(--high) r g b / .55)}&.medium{border-color:rgb(from var(--medium) r g b / .55)}&.low{border-color:rgb(from var(--low) r g b / .55)}&.high_bug{border-color:rgb(from var(--high-bug) r g b / .55)}&.bug{border-color:rgb(from var(--bug) r g b / .55)}&.informational{border-color:rgb(from var(--info) r g b / .55)}}.badge-varies{font-size:.55rem;font-weight:600;text-transform:uppercase;letter-spacing:.03em;padding:.08rem .3rem;border-radius:3px;line-height:1;background:transparent;color:var(--muted);border:1px dashed var(--border)}.severity-reason{margin-top:.4rem;padding-top:.35rem;border-top:1px dashed var(--border);font-size:.82em;font-style:italic;color:var(--muted)}.severity-reason-label{font-style:normal;font-weight:600;text-transform:uppercase;font-size:.85em;letter-spacing:.04em;margin-right:.35rem}.tab{background:transparent;color:var(--text);border:1px solid var(--border);border-radius:4px;padding:.2rem .5rem;font-size:.75rem;line-height:1.3;display:inline-flex;align-items:center;gap:.35rem;font-family:inherit;&:hover{border-color:var(--accent)}&.active{border-color:var(--accent);background:var(--surface-active)}&.tab-mark-red{background:var(--mark-red-bg);border-color:var(--mark-red-tab-border)}&.tab-mark-blue{background:var(--mark-blue-bg);border-color:var(--mark-blue-tab-border)}&.tab-mark-green{background:var(--mark-green-bg);border-color:var(--mark-green-tab-border)}&.tab-mark-gray{background:var(--mark-gray-bg);border-color:var(--mark-gray-tab-border)}&.tab-mark-red.active,&.tab-mark-blue.active,&.tab-mark-green.active,&.tab-mark-gray.active{border-color:var(--text)}&.tab-deleted .tab-label{text-decoration:line-through;opacity:.6}&.tab-inprogress .tab-label:after{content:" \\25d0";opacity:.6}&.tab-fixed .tab-label{opacity:.65}&.tab-fixed .tab-label:after{content:" \\2713";opacity:.6}&.tab-invalid .tab-label{opacity:.65}&.tab-invalid .tab-label:after{content:" \\2298";opacity:.6}&.tab-ignored .tab-label{opacity:.55}&.tab-ignored .tab-label:after{content:" \\1f441";opacity:.6;font-size:.7em}.tab-conf{color:var(--muted);font-size:.7rem}&.tab-mark-red .tab-conf,&.tab-mark-blue .tab-conf,&.tab-mark-green .tab-conf,&.tab-mark-gray .tab-conf{color:var(--text)}.tab-marks{display:inline-flex;align-items:center;gap:.15rem;margin-left:.25rem;vertical-align:middle;color:var(--accent)}.tab-marks svg{display:block}.tab-marks .has-comment .bubble,.tab-marks .has-fix .wrench,.tab-marks .flagged .flag-cloth{fill:var(--accent);fill-opacity:.15}}.report-chip{display:inline-flex;align-items:center;gap:.3rem;padding:0 .35rem;height:1.4rem;border:1px solid var(--border);border-radius:3px;color:var(--muted);font-size:.72rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;margin-right:.65rem;max-width:16rem;min-width:0;.report-chip-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.file-icon{flex-shrink:0}.brand-deepview{.bg{fill:#2563eb}.fg{fill:#fff}}.brand-claude{.bg{fill:#d97757}.fg{fill:#fff}}.brand-codex{.bg{fill:#fff;stroke:#000;stroke-width:.5}.fg{fill:#000}}.brand-vercel{.bg{fill:#000;stroke:#fff;stroke-width:.5}.fg{fill:#fff}}.brand-piolium{.bg{fill:#fbb829}.fg{fill:#1c1b19}}}.mark-action-group{display:inline-flex;border:1px solid var(--border);border-radius:3px;overflow:hidden;margin-right:.25rem;flex-shrink:0}.mark-comment,.mark-fix,.mark-flag,.mark-copy,.mark-link,.mark-issue,.mark-claude{background:transparent;border:0;color:var(--muted);padding:0 .25rem;height:1.4rem;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--accent);background:var(--surface-active)}}.mark-issue{text-decoration:none}.mark-comment.has-comment,.mark-fix.has-fix,.mark-flag.flagged{color:var(--accent)}.mark-flag svg{display:block}.mark-copy.copied,.mark-link.copied,.mark-claude.copied{color:var(--green, #4ade80);background:color-mix(in srgb,var(--green, #4ade80) 14%,transparent)}.mark-comment.has-comment .bubble,.mark-fix.has-fix .wrench,.mark-flag.flagged .flag-cloth{fill:var(--accent);fill-opacity:.15}.mark-x{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:3px;padding:0 .35rem;font-size:.85rem;line-height:1.1;margin-left:.25rem;&:hover{color:var(--critical);border-color:var(--critical)}}.triage-menu-wrap{position:relative;display:inline-flex;margin-left:.25rem;flex-shrink:0}.mark-triage-menu{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:3px;padding:0 .3rem;height:1.5rem;display:inline-flex;align-items:center;justify-content:center;gap:.25rem;font:inherit}.mark-triage-menu:hover{color:var(--text);border-color:var(--accent)}.mark-triage-menu.open{border-color:var(--accent);color:var(--text)}.mark-triage-menu.with-label{padding:0 .35rem 0 .5rem;font-size:.72rem;height:1.5rem}.mark-triage-menu .mark-triage-label{text-transform:uppercase;letter-spacing:.05em;font-weight:600}.mark-triage-menu.triage-state-deleted{border-color:var(--critical);color:var(--critical)}.mark-triage-menu.triage-state-fixed{border-color:var(--green, #4ade80);color:var(--green, #4ade80)}.mark-triage-menu.triage-state-inprogress{border-color:var(--warning, #d97706);color:var(--warning, #d97706)}.mark-triage-menu.triage-state-invalid{border-color:var(--muted);color:var(--text)}.mark-triage-menu.triage-state-ignored{border-color:var(--accent, #2563eb);color:var(--accent, #2563eb)}.triage-menu[popover]{position:fixed;inset:auto;margin:0;min-width:7rem;background:var(--bg);border:1px solid var(--border);border-radius:4px;padding:.25rem;box-shadow:0 4px 12px #00000040;display:flex;flex-direction:column;gap:1px;-webkit-app-region:no-drag;app-region:no-drag}.triage-menu[popover]:not(:popover-open){display:none}.triage-menu[popover]:popover-open{display:flex}.triage-menu-item{background:transparent;border:0;padding:.35rem .5rem;font-size:.78rem;color:var(--text);text-align:left;border-radius:3px;font-family:inherit}.triage-menu-item:hover{background:var(--surface)}.triage-menu-item.active:before{content:"\\2713 ";color:var(--accent)}.triage-menu-inprogress:hover{color:var(--warning, #d97706)}.triage-menu-fixed:hover{color:var(--green, #4ade80)}.triage-menu-invalid:hover{color:var(--muted)}.triage-menu-deleted:hover{color:var(--critical)}:host([context="focus"]) .triage-menu-wrap>.mark-triage-menu{display:none}:host([context="focus"]) .triage-menu-wrap{display:inline-flex}:host([context="focus"]) .triage-menu[popover]{position:static;inset:auto;display:inline-flex!important;flex-flow:row wrap;margin:0;padding:0;background:transparent;border:0;border-radius:0;box-shadow:none;min-width:0;gap:.25rem}:host([context="focus"]) .triage-menu-item{background:transparent;border:1px solid var(--border);padding:.2rem .5rem;border-radius:3px;font-size:.72rem;font-weight:500;text-transform:uppercase;letter-spacing:.04em}:host([context="focus"]) .triage-menu-item.active{background:rgb(from var(--accent) r g b / .12);border-color:var(--accent);color:var(--accent)}:host([context="focus"]) .triage-menu-item:hover{background:var(--surface-active)}:host([context="focus"]) .triage-menu-inprogress.active{background:rgb(from var(--warning, #d97706) r g b / .12);border-color:var(--warning, #d97706);color:var(--warning, #d97706)}:host([context="focus"]) .triage-menu-fixed.active{background:rgb(from var(--green, #4ade80) r g b / .12);border-color:var(--green, #4ade80);color:var(--green, #4ade80)}:host([context="focus"]) .triage-menu-deleted.active{background:rgb(from var(--critical) r g b / .12);border-color:var(--critical);color:var(--critical)}:host([context="focus"]) .triage-menu-item.active:before{content:"";margin:0}:host([context="focus"]) .marks{gap:.5rem;margin-top:.65rem;padding-left:0;padding-top:.55rem;border-top:1px solid var(--border);flex-wrap:wrap}:host([context="focus"]) .marks-commit-row{padding-left:0}:host([context="focus"]) .mark-comment,:host([context="focus"]) .mark-fix,:host([context="focus"]) .mark-flag,:host([context="focus"]) .mark-copy,:host([context="focus"]) .mark-link,:host([context="focus"]) .mark-issue,:host([context="focus"]) .mark-claude{height:1.75rem;padding:0 .55rem;gap:.35rem;display:inline-flex;align-items:center;font-size:.72rem}:host([context="focus"]) .mark-btn-label{color:inherit;font-weight:500;letter-spacing:.02em}:host([context="focus"].mark-red) .card{background:color-mix(in srgb,var(--mark-red-bg) 15%,var(--bg))}:host([context="focus"].mark-blue) .card{background:color-mix(in srgb,var(--mark-blue-bg) 15%,var(--bg))}:host([context="focus"].mark-green) .card{background:color-mix(in srgb,var(--mark-green-bg) 15%,var(--bg))}:host([context="focus"].mark-gray) .card{background:color-mix(in srgb,var(--mark-gray-bg) 15%,var(--bg))}.comment-block,.fix-block{margin-top:.5rem;padding:.35rem .55rem;border-left:3px solid var(--accent);background:rgb(from var(--accent) r g b / .08);border-radius:0 4px 4px 0;font-size:.82rem;color:var(--text)}.comment-block{white-space:pre-wrap;& a{color:var(--accent);text-decoration:none}& a:hover{text-decoration:underline}& a.comment-self-ref{text-decoration:underline dotted;text-underline-offset:2px}& a.comment-self-ref:hover{text-decoration:underline solid}}.fix-block{word-break:break-all;& a{color:var(--accent);text-decoration:none}& a:hover{text-decoration:underline}}.comment-label,.fix-label{color:var(--muted);font-weight:600;margin-right:.35rem}.mark-restore{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:3px;padding:0 .45rem;font-size:.75rem;line-height:1.3;margin-left:.25rem;&:hover{color:var(--green);border-color:var(--green)}}.line-num{color:var(--muted);font-size:.8rem}.line-num a{color:inherit}.line-num a:hover{color:var(--accent)}.npm-link{display:inline-block;padding:0 .4rem;border:1px solid var(--border);border-radius:3px;font-size:.72rem;font-weight:500;color:var(--muted);text-decoration:none}.npm-link:hover{border-color:var(--accent);color:var(--accent)}@media print{.card{break-inside:avoid;padding:.45rem .25rem}.finding-code-btn,.mark-copy,.mark-link,.mark-issue,.mark-claude{display:none!important}.npm-link{border:0;padding:0}:host(.triage-fixed),:host(.triage-invalid),:host(.triage-deleted),:host(.triage-ignored){opacity:1}:host(.link-target) .card{animation:none;box-shadow:none!important}:host(.multi-case) .card:before{content:"Multiple reports of one finding";display:block;font-size:.7rem;font-weight:700;color:#555;text-transform:uppercase;letter-spacing:.06em;border-bottom:1px solid #bbb;padding-bottom:.2rem;margin-bottom:.35rem;-webkit-print-color-adjust:exact;print-color-adjust:exact}.marks,.tabs{display:none!important}.tab-body{display:grid!important}.tab-body+.tab-body{margin-top:.5rem;padding-top:.5rem;border-top:1px dashed #999}:host([in-group].multi-case) .tab-body .line-row{display:flex}:host([in-group]:not(.multi-case)) .line-row+*{margin-top:0}:host([in-group]:not(.multi-case)) .line-row+.conf-reason{padding-top:0;border-top:0}.line-row .discovered-in{flex-basis:100%;order:99}.print-case-label{display:block;grid-column:1 / -1;font-size:.65rem;font-weight:600;color:#555;background:#eee;padding:.1rem .35rem;border-radius:3px;margin-bottom:.25rem;letter-spacing:.04em;-webkit-print-color-adjust:exact;print-color-adjust:exact}.value-label{color:#777}.badge{-webkit-print-color-adjust:exact;print-color-adjust:exact;&.critical{background:#a30b0f!important;color:#fff!important}&.high{background:#b8400a!important;color:#fff!important}&.medium{background:#855107!important;color:#fff!important}&.low{background:#374151!important;color:#fff!important}&.high_bug{background:#7a3e0c!important;color:#fff!important}&.bug{background:#4d4538!important;color:#fff!important}&.informational{background:#0550ae!important;color:#fff!important}}.badge-orig{background:transparent!important;color:#555!important;border-color:#999!important}.badge-varies,.revalidate-stamp{color:#555!important;border-color:#999!important}.badge-arrow,.badge-corr-mark,.badge-pre,.severity-reason{color:#555!important}a,.line-num,.line-num a,.desc-title a,.desc a,.section-body a,.conf-reason a,.revalidate-verdict a,.evidence-ref{color:inherit}details:not([open])>:not(summary){display:block}details::details-content{content-visibility:visible}summary.section-label{cursor:auto;&:after{display:none}}.inline-code{border:0;background:transparent}.code-block{background:transparent;border-color:#bbb;.code-block-lang{color:#555;border-bottom-color:#bbb}& pre{white-space:pre-wrap;overflow:visible}.token{color:#333!important}.token.comment,.token.prolog,.token.cdata{color:#666!important}}}
144
+ `;var tE=["finding","is-critical","mark-red","mark-blue","mark-green","mark-gray","has-conflict","triage-inprogress","triage-fixed","triage-invalid","triage-deleted","triage-ignored","multi-case"],$p=class extends z{static properties={group:{attribute:!1},inGroup:{type:Boolean,attribute:"in-group",reflect:!0},context:{type:String,reflect:!0}};static styles=F(Hv);constructor(){super(),this.group=null,this.inGroup=!1,this.context=null}render(){if(!this.group)return d``;this.dataset.gid=Zn(this.group);let t=new Set(Qg(this.group));for(let r of tE)this.classList.toggle(r,t.has(r));return d`<div class="card">${Zg(this.group,{context:this.context})}</div>`}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.requestUpdate()}};customElements.define("finding-card",$p);var Vv=`:host{display:inline-flex;gap:4px;align-items:center;flex-shrink:0}button{width:14px;height:14px;user-select:none;padding:0;background:transparent;border:1.5px solid currentcolor;border-radius:50%;opacity:.55;transition:opacity .12s,transform .12s}button:hover{opacity:1;transform:scale(1.12)}button.active{background:currentcolor;opacity:1;box-shadow:0 0 0 2px var(--surface),0 0 0 3px currentcolor}.color-red{color:var(--marker-red)}.color-blue{color:var(--marker-blue)}.color-green{color:var(--marker-green)}.color-gray{color:var(--marker-gray)}
145
+ `;var nE=["red","blue","green","gray"],xp=class extends Z{static properties={selected:{type:String}};static styles=F(Vv);constructor(){super(),this.selected=null}render(){return d`${nE.map(t=>d`<button type="button" class="${`color-${t}${this.selected===t?" active":""}`}" data-color="${t}" title="${`mark ${t}`}" @click="${this._onClick}"></button>`)}`}_onClick=t=>{let r=t.currentTarget.dataset.color;this.dispatchEvent(new CustomEvent("mark-color",{detail:{color:r},bubbles:!0,composed:!0}))}};customElements.define("color-marker",xp);var _p=class extends z{static properties={rangeDisabled:{type:Boolean,attribute:"range-disabled"},revalidateOptions:{attribute:!1},hasPartial:{type:Boolean,attribute:"has-partial"}};createRenderRoot(){return this}constructor(){super(),this.rangeDisabled=!1,this.revalidateOptions=[],this.hasPartial=!1}render(){let t=a.filterConfMin,r=a.filterConfMax,n=this.revalidateOptions??[],o=this.rangeDisabled,s=!o&&n.length>0&&!!a.filterRevalidate,i=o?"No confidence range: some findings on screen carry no confidence score":m;return d`<span class="${T({"conf-range-label":!0,replaced:s,disabled:o})}">Confidence</span> <span class="${T({"conf-range":!0,replaced:s,disabled:o})}" title="${i}" ?inert="${o||s}"><range-slider id="conf-range" min="0" max="10" step="1" low="${t}" high="${r}" aria-label="Confidence range"></range-slider><conf-range-mirror id="conf-range-vals" class="conf-vals" for="conf-range" .low="${t}" .high="${r}"></conf-range-mirror></span>${n.length>0?d`<revalidate-filter class="${T({replaces:s})}" .options="${n}" ?has-partial="${this.hasPartial}"></revalidate-filter>`:m}`}};customElements.define("conf-filter",_p);var Se=At(class extends dt{constructor(e){if(super(e),e.type!==He.PROPERTY&&e.type!==He.ATTRIBUTE&&e.type!==He.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!Rf(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[t]){if(t===ke||t===m)return t;let r=e.element,n=e.name;if(e.type===He.PROPERTY){if(t===r[n])return ke}else if(e.type===He.BOOLEAN_ATTRIBUTE){if(!!t===r.hasAttribute(n))return ke}else if(e.type===He.ATTRIBUTE&&r.getAttribute(n)===t+"")return ke;return ci(e),t}});var jv={files:"Filter files\u2026",code:"Search code\u2026",issues:"Search issues\u2026"},Wv={files:"Filter files",code:"Search code",issues:"Search issues"},oE=d`<svg class="bundle-code-search-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="6.5" cy="6.5" r="4.5"/><path d="M9.7 9.7L13 13" stroke-linecap="round"/></svg>`,sE={files:d`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 4.5a1 1 0 0 1 1-1h3.2l1.3 1.5H13a1 1 0 0 1 1 1V12a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4.5Z"/></svg>`,code:d`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5.5 4.5L2 8l3.5 3.5"/><path d="M10.5 4.5L14 8l-3.5 3.5"/></svg>`,issues:d`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.3" aria-hidden="true"><circle cx="8" cy="8" r="6"/><path d="M8 4.8v3.6" stroke-linecap="round"/><circle cx="8" cy="11" r=".7" fill="currentColor" stroke="none"/></svg>`},Sp=class extends z{static properties={modes:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.modes=[]}render(){let t=a.bundleCodeSearchQuery,r=a.bundleCodeSearchMode,n=this.modes.includes(r)?r:"files",o=jv[n]??jv.files;return d`${oE} <input type="text" class="bundle-code-search-input" placeholder="${o}" aria-label="${o}" .value="${Se(t)}" @input="${this._onInput}"> ${t?d`<button type="button" class="bundle-code-search-clear" title="Clear search" aria-label="Clear search" @click="${this._onClear}">×</button>`:m} ${this.modes.length>0?d`<span class="bundle-code-search-modes" role="tablist">${this.modes.map(s=>d`<button type="button" class="${T({"bundle-code-search-mode":!0,active:n===s})}" role="tab" aria-selected="${String(n===s)}" title="${Wv[s]??s}" aria-label="${Wv[s]??s}" @click="${()=>this._selectMode(s)}">${sE[s]??m}</button>`)}</span>`:m}`}_onInput=t=>{this._dispatchInput(t.target.value)};_onClear=()=>{this._dispatchInput("")};_dispatchInput(t){this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:"bundle-code",value:t},bubbles:!0,composed:!0}))}_selectMode(t){this.dispatchEvent(new CustomEvent("bundle-search-mode-change",{detail:{mode:t},bubbles:!0,composed:!0}))}};customElements.define("bundle-code-search",Sp);var iE=d`<svg class="bundle-search-icon" viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="6.5" cy="6.5" r="4.5"/><path d="M9.7 9.7L13 13" stroke-linecap="round"/></svg>`,Cp=class extends z{createRenderRoot(){return this}render(){let t=a.bundleSearchQuery,r=a.bundleSearchRegex,n=a.bundleSearchCase,o=r?"Search by regular expression\u2026":"Search all source\u2026";return d`${iE} <input type="text" class="bundle-search-input" placeholder="${o}" aria-label="${o}" spellcheck="false" autocapitalize="off" autocomplete="off" .value="${Se(t)}" @input="${this._onInput}"> ${t?d`<button type="button" class="bundle-search-clear" title="Clear search" aria-label="Clear search" @click="${this._onClear}">×</button>`:m} <span class="bundle-search-mods"><button type="button" class="${T({"bundle-search-mod":!0,active:n})}" title="${n?"Case-sensitive on \u2014 click to ignore case":"Match case"}" aria-label="Match case" aria-pressed="${String(n)}" @click="${this._onToggleCase}">Aa</button> <button type="button" class="${T({"bundle-search-mod":!0,active:r})}" title="${r?"Regular expression on \u2014 click for plain text":"Match by regular expression"}" aria-label="Match by regular expression" aria-pressed="${String(r)}" @click="${this._onToggleRegex}">.*</button></span>`}_onInput=t=>{this._dispatchInput(t.target.value)};_onClear=()=>{this._dispatchInput("")};_dispatchInput(t){this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:"bundle-search",value:t},bubbles:!0,composed:!0}))}_onToggleRegex=()=>{this.dispatchEvent(new CustomEvent("bundle-search-regex-toggle",{bubbles:!0,composed:!0}))};_onToggleCase=()=>{this.dispatchEvent(new CustomEvent("bundle-search-case-toggle",{bubbles:!0,composed:!0}))}};customElements.define("bundle-search",Cp);var Kv={packages:{stateKey:"packagesSearchQuery",label:"Filter packages"},repositories:{stateKey:"repositoriesSearchQuery",label:"Filter repositories"}},Ep=class extends z{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let t=Kv[this.kind];return t?d`<input type="search" class="packages-search" placeholder="${`${t.label}\u2026`}" aria-label="${t.label}" .value="${Se(a[t.stateKey])}" @input="${this._onInput}">`:(console.warn(`<entity-search>: unknown kind ${JSON.stringify(this.kind)}; expected one of ${Object.keys(Kv).map(r=>JSON.stringify(r)).join(", ")}.`),m)}_onInput=t=>{this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:this.kind,value:t.target.value},bubbles:!0,composed:!0}))}};customElements.define("entity-search",Ep);var aE=[["findings-desc","Findings \u2193"],["files-desc","Files \u2193"],["reports-desc","Reports \u2193"],["name-asc","Name A\u2192Z"]],qv={packages:{stateKey:"packagesSortBy",aria:"Sort packages"},repositories:{stateKey:"repositoriesSortBy",aria:"Sort repositories"}},Ap=class extends z{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let t=qv[this.kind];return t?d`<select class="packages-sort" aria-label="${t.aria}" .value="${Se(a[t.stateKey])}" @change="${this._onChange}">${aE.map(([r,n])=>d`<option value="${r}" ?selected="${a[t.stateKey]===r}">${n}</option>`)}</select>`:(console.warn(`<entity-sort>: unknown kind ${JSON.stringify(this.kind)}; expected one of ${Object.keys(qv).map(r=>JSON.stringify(r)).join(", ")}.`),m)}_onChange=t=>{this.dispatchEvent(new CustomEvent("sort-change",{detail:{kind:this.kind,value:t.target.value},bubbles:!0,composed:!0}))}};customElements.define("entity-sort",Ap);var Tp=class extends z{static properties={showFile:{type:Boolean,attribute:"show-file"},showConfidence:{type:Boolean,attribute:"show-confidence"},showPriority:{type:Boolean,attribute:"show-priority"}};createRenderRoot(){return this}constructor(){super(),this.showFile=!1,this.showConfidence=!1,this.showPriority=!1}render(){let t=(r,n)=>d`<option value="${r}" ?selected="${a.sortBy===r}">${n}</option>`;return d`<select class="sort-select" aria-label="Sort findings" .value="${Se(a.sortBy)}" @change="${this._onChange}">${t("severity","Severity \u2193")} ${this.showFile?t("file","File \u2191"):m} ${this.showConfidence?d`${t("confidence-desc","Confidence \u2193")}${t("confidence-asc","Confidence \u2191")}`:m} ${this.showPriority?d`${t("priority-desc","Priority \u2193")}${t("priority-asc","Priority \u2191")}`:m}</select>`}_onChange=t=>{this.dispatchEvent(new CustomEvent("sort-change",{detail:{kind:"findings",value:t.target.value},bubbles:!0,composed:!0}))}};customElements.define("findings-sort",Tp);var Gv=`:host{display:inline-flex;align-items:center;width:8.5rem;height:16px;--rs-thumb-size: 14px;--rs-track-height: 3px;--rs-rail: rgb(from currentcolor r g b / .25);--rs-fill: var(--accent, currentColor)}.track-wrap{position:relative;flex:1;height:var(--rs-thumb-size)}.track{position:absolute;left:0;right:0;top:50%;height:var(--rs-track-height);transform:translateY(-50%);border-radius:99px;background:linear-gradient(to right,var(--rs-rail) 0,var(--rs-rail) var(--low, 0%),var(--rs-fill) var(--low, 0%),var(--rs-fill) var(--high, 100%),var(--rs-rail) var(--high, 100%))}input[type=range]{appearance:none;-webkit-appearance:none;position:absolute;left:0;right:0;top:0;width:100%;height:var(--rs-thumb-size);background:transparent;pointer-events:none;margin:0;padding:0;outline:none}input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;pointer-events:auto;width:var(--rs-thumb-size);height:var(--rs-thumb-size);border-radius:50%;background:var(--rs-fill);border:0;box-shadow:0 1px 3px #00000080}input[type=range]::-moz-range-thumb{pointer-events:auto;width:var(--rs-thumb-size);height:var(--rs-thumb-size);border-radius:50%;background:var(--rs-fill);border:0;box-shadow:0 1px 3px #00000080}input[type=range]::-webkit-slider-runnable-track{background:transparent;height:var(--rs-thumb-size)}
146
+ `;var Rp=class extends Z{static properties={min:{type:Number},max:{type:Number},step:{type:Number},low:{type:Number},high:{type:Number}};static styles=F(Gv);constructor(){super(),this.min=0,this.max=100,this.step=1,this.low=0,this.high=100}willUpdate(){this.low<this.min&&(this.low=this.min),this.high>this.max&&(this.high=this.max),this.low>this.high&&(this.low=this.high)}render(){let t=this.max-this.min||1,r=(this.low-this.min)/t*100,n=(this.high-this.min)/t*100;return d`<div class="track-wrap" style="${`--low:${r}%;--high:${n}%`}"><div class="track"></div><input type="range" min="${this.min}" max="${this.max}" step="${this.step}" @input="${this._onInput}" @change="${this._onChange}"> <input type="range" min="${this.min}" max="${this.max}" step="${this.step}" @input="${this._onInput}" @change="${this._onChange}"></div>`}firstUpdated(){this._inputs=[...this.renderRoot.querySelectorAll('input[type="range"]')],this._inputs[0].value=this.low,this._inputs[1].value=this.high}updated(t){if(!this._inputs||!(t.has("low")||t.has("high")))return;let r=this._inputs.map(i=>Number(i.value)),n=r[0]>r[1],o=n?1:0,s=n?0:1;this.low!==r[o]&&(this._inputs[o].value=this.low),this.high!==r[s]&&(this._inputs[s].value=this.high)}_onInput=()=>{let t=Number(this._inputs[0].value),r=Number(this._inputs[1].value);this.low=Math.min(t,r),this.high=Math.max(t,r),this._emit("range-input")};_onChange=()=>{this._emit("range-change")};_emit(t){this.dispatchEvent(new CustomEvent(t,{detail:{low:this.low,high:this.high},bubbles:!0,composed:!0}))}};customElements.define("range-slider",Rp);var Ip=class extends Z{static properties={low:{type:Number},high:{type:Number},for:{type:String}};createRenderRoot(){return this}constructor(){super(),this.low=0,this.high=10,this.for="conf-range",this._dragging=!1,this._liveLow=0,this._liveHigh=10}connectedCallback(){super.connectedCallback(),document.addEventListener("range-input",this._onRangeInput),document.addEventListener("range-change",this._onRangeChange)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("range-input",this._onRangeInput),document.removeEventListener("range-change",this._onRangeChange)}willUpdate(t){this._dragging&&(t.has("low")&&this.low!==this._liveLow&&(this.low=this._liveLow),t.has("high")&&this.high!==this._liveHigh&&(this.high=this._liveHigh))}_onRangeInput=t=>{t.target?.id===this.for&&(this._dragging=!0,this._liveLow=t.detail.low,this._liveHigh=t.detail.high,this.low=t.detail.low,this.high=t.detail.high)};_onRangeChange=t=>{t.target?.id===this.for&&(this._dragging=!1)};render(){return d`<span>${this.low}</span><span class="dash">–</span><span>${this.high}</span>`}};customElements.define("conf-range-mirror",Ip);var Yv=`dialog{max-width:560px;width:min(94vw,560px)}header h3{margin:0 0 .25rem}header p{margin:0 0 .9rem;color:var(--muted);font-size:.82rem}hr{border:0;border-top:1px solid var(--border);margin:.9rem 0}.section h4{margin:0 0 .25rem;font-size:.82rem;font-weight:600;text-transform:uppercase;letter-spacing:.08em;color:var(--muted)}.section p{margin:0 0 .55rem;color:var(--muted);font-size:.78rem}.section button{background:transparent;border:1px solid var(--border);color:var(--text);border-radius:5px;padding:.35rem .9rem;font:inherit;font-size:.8rem;&:hover{border-color:var(--accent);color:var(--accent)}&.primary{background:var(--accent);color:var(--surface);border-color:var(--accent)}&.primary:hover{filter:brightness(1.08)}&:disabled{opacity:.5}}input[type=file]{display:block;color:var(--text);font:inherit;font-size:.78rem;margin-bottom:.5rem}.error{margin:.5rem 0;padding:.4rem .6rem;border:1px solid var(--critical, #f87171);border-radius:5px;background:rgb(from var(--critical, #f87171) r g b / .07);color:var(--text);font-size:.78rem}.summary{margin:.5rem 0;font-size:.82rem;& strong{color:var(--text)}.meta{margin-left:.4rem;color:var(--muted);font-size:.74rem}}.mode{border:1px solid var(--border);border-radius:6px;padding:.55rem .7rem;margin:.55rem 0 .7rem;display:flex;flex-direction:column;gap:.35rem}.mode legend{padding:0 .35rem;font-size:.68rem;color:var(--muted);text-transform:uppercase;letter-spacing:.08em}.mode label{display:flex;align-items:flex-start;gap:.5rem;font-size:.82rem;& em{color:var(--muted);font-style:normal;font-size:.74rem}}.status{margin:.8rem 0 0;padding:.4rem .6rem;border-radius:5px;font-size:.78rem;&.status-ok{border:1px solid var(--accent);background:rgb(from var(--accent) r g b / .08);color:var(--text)}&.status-err{border:1px solid var(--critical, #f87171);background:rgb(from var(--critical, #f87171) r g b / .07);color:var(--text)}}.actions{display:flex;justify-content:flex-end;gap:.4rem;margin-top:.8rem;padding-top:.7rem;border-top:1px solid var(--border)}.actions button{background:transparent;border:1px solid var(--border);color:var(--text);border-radius:5px;padding:.3rem .8rem;font:inherit;font-size:.78rem;&:hover{border-color:var(--accent);color:var(--accent)}}
147
+ `;var Mp=class extends I{static styles=[...I.styles,F(Yv)];static properties={parsed:{state:!0},parseError:{state:!0},mode:{state:!0},busy:{state:!0},status:{state:!0}};constructor(){super(),this.parsed=null,this.parseError=null,this.mode="prefer-current",this.busy=!1,this.status=null}focusInitial(){this.renderRoot.querySelector("button.primary")?.focus()}async _onDownload(){this.busy=!0,this.status=null;try{let{blob:t,filename:r}=await hd();Kt(t,r),this.status={kind:"ok",text:`Downloaded ${r}`}}catch(t){this.status={kind:"err",text:`Export failed: ${t.message}`}}finally{this.busy=!1}}async _onFile(t){let r=t.target.files?.[0];if(this.parsed=null,this.parseError=null,this.status=null,!!r)try{this.parsed=await md(r)}catch(n){this.parseError=n.message}}_onMode(t){this.mode=t.target.value}async _onApply(){if(!(!this.parsed||this.busy)){this.busy=!0,this.status=null;try{let t=await gd(this.parsed,this.mode);x(),this.status=t.repoUrlError?{kind:"err",text:`Applied ${t.triageEntries} triage entries (${this.mode}), but saving repo URLs failed: ${t.repoUrlError.message}`}:{kind:"ok",text:`Applied ${t.triageEntries} triage entries and ${t.repoUrls} repo URLs (${this.mode}).`},this.parsed=null;let r=this.renderRoot.querySelector('input[type="file"]');r&&(r.value="")}catch(t){this.status={kind:"err",text:`Import failed: ${t.message}`}}finally{this.busy=!1}}}render(){let t=this.parsed;return d`<dialog @close="${this._onClose}"><header><h3>Triage backup</h3><p>Bundles every triage entry (markers, triage states, comments, fixes, per-report ignores) and all saved repo URLs into a single gzipped JSON file.</p></header><section class="section"><h4>Export</h4><p>Download the current triage + repo-URL set as a portable backup.</p><button type="button" class="primary" @click="${this._onDownload}" ?disabled="${this.busy}">${this.busy?"Working\u2026":"Download backup"}</button></section><hr><section class="section"><h4>Import</h4><p>Pick a previously-exported backup. Nothing is applied until you click Apply.</p><input type="file" accept=".gz,application/gzip" @change="${this._onFile}" ?disabled="${this.busy}"> ${this.parseError?d`<div class="error">Failed to parse: ${this.parseError}</div>`:m} ${t?d`<div class="summary">Found <strong>${Object.keys(t.triage).length}</strong> triage entries and <strong>${Object.keys(t.repoUrls).length}</strong> repo URLs. ${t.exportedAt?d`<span class="meta">Exported ${t.exportedAt}.</span>`:m}</div><fieldset class="mode"><legend>Merge mode</legend><label><input type="radio" name="te-mode" value="prefer-current" .checked="${this.mode==="prefer-current"}" @change="${this._onMode}"> <span>Merge — keep current on conflict <em>(safest, only fills gaps)</em></span></label> <label><input type="radio" name="te-mode" value="prefer-imported" .checked="${this.mode==="prefer-imported"}" @change="${this._onMode}"> <span>Merge — prefer imported on conflict <em>(overwrites where both have a value)</em></span></label> <label><input type="radio" name="te-mode" value="replace" .checked="${this.mode==="replace"}" @change="${this._onMode}"> <span>Replace all <em>(drops every current persisted entry first — destructive)</em></span></label></fieldset><button type="button" class="primary" @click="${this._onApply}" ?disabled="${this.busy}">${this.busy?"Applying\u2026":"Apply import"}</button>`:m}</section>${this.status?d`<div class="${`status status-${this.status.kind}`}">${this.status.text}</div>`:m}<footer class="actions"><button type="button" @click="${this._onClose}">Close</button></footer></dialog>`}};customElements.define("triage-export-dialog",Mp);function Jv(){return te("triage-export-dialog")}var Xv=`:host{display:inline-block;vertical-align:middle;position:relative}.chip{display:inline-flex;align-items:center;gap:.375rem;cursor:default;user-select:none;position:relative;min-height:24px;box-sizing:border-box;padding:.125rem .375rem .125rem .5rem;background:var(--surface);border:1px solid var(--border);border-radius:999px;color:var(--text);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.72rem;font-weight:500}.chip svg{color:var(--muted);flex-shrink:0}.chip.empty:hover{border-color:var(--accent)}.chip.empty .label{color:var(--muted);font-style:italic}.chip.readonly{padding-right:.5rem}.chip.copied:after{content:"Copied";position:absolute;inset:0;display:grid;place-items:center;background:var(--surface);backdrop-filter:var(--glass-blur);border-radius:999px;color:var(--text);font-weight:400;white-space:nowrap;pointer-events:none}.edit-btn{width:18px;height:18px;display:grid;place-items:center;padding:0;margin-left:.125rem;background:transparent;border:0;border-radius:4px;color:var(--muted)}.edit-btn:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}.chip[inert]{visibility:hidden;min-width:19rem}input{position:absolute;inset:0;box-sizing:border-box;padding:0 .55rem;background:var(--surface);border:1px solid var(--accent);border-radius:999px;color:var(--text);font:inherit;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.72rem;font-weight:400;outline:none}@media print{.chip{color:#000!important;border:0!important}.chip svg{color:#000!important}.edit-btn,input{display:none!important}}
148
+ `;function dl(e){if(!e)return"";let t=e.match(/github\.com\/([^/?#]+\/[^/?#]+?)(?:\.git)?(?:[/?#]|$)/iu);return t?t[1]:e}var Fp=d`<svg viewBox="0 0 16 16" width="12" height="12" fill="currentColor" aria-hidden="true"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>`,Qv=d`<svg viewBox="0 0 16 16" width="11" height="11" fill="currentColor" aria-hidden="true"><path d="M11.013 1.427a1.75 1.75 0 0 1 2.474 0l1.086 1.086a1.75 1.75 0 0 1 0 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 0 1-.927-.928l.929-3.25c.082-.286.235-.547.445-.758l8.61-8.61z"/></svg>`,Bp=class extends Z{static properties={url:{type:String},editable:{type:Boolean,reflect:!0},editing:{type:Boolean,reflect:!0},_copied:{state:!0}};static styles=F(Xv);constructor(){super(),this.url="",this.editable=!1,this.editing=!1,this._copied=!1,this._opener=""}render(){if(this.editable&&this.editing){let t=!!this.url,r=t?dl(this.url):"Set repo";return d`<span class="${t?"chip":"chip empty"}" aria-hidden="true" inert>${Fp} <span class="label">${r}</span> <button type="button" class="edit-btn">${Qv}</button> </span><input type="text" .value="${Se(this.url)}" placeholder="user/repo or https://github.com/user/repo" @input="${this._onInput}" @focus="${this._onFocus}" @keydown="${this._onKeydown}" @blur="${this._onBlur}">`}if(this.editable){let t=!!this.url,r=t?dl(this.url):"Set repo",n=t?this._copied?"chip copied":"chip":"chip empty";return d`<span class="${n}" @click="${t?null:this._onEdit}">${Fp} ${t?this._slugLabel(r):d`<span class="label">${r}</span>`} <button type="button" class="edit-btn" title="Edit repo URL" aria-label="Edit repo URL" @click="${this._onEdit}">${Qv}</button></span>`}if(this.url){let t=this._copied?"chip readonly copied":"chip readonly";return d`<span class="${t}" title="Repo from findings (read-only)">${Fp} ${this._slugLabel(dl(this.url))}</span>`}return m}_slugLabel(t){return d`<span class="label" title="Copy repo name" @click="${this._onCopyLabel}">${t}</span>`}updated(t){if(t.has("editing")&&this.editing){let r=this.renderRoot.querySelector("input");r&&(r.focus(),r.select())}}_onEdit=t=>{t&&t.stopPropagation(),this._emit("repo-edit-start")};_onCopyLabel=t=>{t&&t.stopPropagation();let r=dl(this.url);if(r)try{navigator.clipboard.writeText(r).then(()=>(this._copied=!0,setTimeout(()=>{this._copied=!1},1e3),null)).catch(()=>{})}catch{}};_onFocus=t=>{this._opener=t.target.value};_onInput=t=>{this.url=t.target.value,this._emit("repo-input",{url:this.url})};_onKeydown=t=>{t.key==="Enter"?(t.preventDefault(),this._emit("repo-commit",{url:this.url})):t.key==="Escape"&&(t.preventDefault(),this.url=this._opener,this._emit("repo-cancel",{url:this._opener}))};_onBlur=()=>{this.editing&&this._emit("repo-commit",{url:this.url})};_emit(t,r){this.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0}))}};customElements.define("repo-chip",Bp);function Ue(e,t){for(let[r,n]of Object.entries(t))e.hasAttribute(r)||e.setAttribute(r,n)}var uE=d`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path class="bubble" d="M2.5 3h11a.5.5 0 0 1 .5.5v6.5a.5.5 0 0 1-.5.5H8.4l-3 2.6V10.5H2.5a.5.5 0 0 1-.5-.5V3.5a.5.5 0 0 1 .5-.5z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,pE=d`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path class="wrench" d="M10.4 2.6a3 3 0 0 0-3.6 4.5L2 12l2 2 4.9-4.8a3 3 0 0 0 4.5-3.6l-1.8 1.8-1.5-.4-.4-1.5z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,fE=d`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path class="flag-cloth" d="M5 1.5h6v13l-3-2.7-3 2.7z" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linejoin="round"/></svg>`,hE=[{key:"comment",glyph:uE,label:"commented",stateKey:"filterComment",hasKey:"hasComment"},{key:"fix",glyph:pE,label:"fixed",stateKey:"filterFix",hasKey:"hasFix"},{key:"flag",glyph:fE,label:"flagged",stateKey:"filterFlagged",hasKey:"hasFlagged"}],Lp=class extends z{static properties={hasComment:{attribute:!1},hasFix:{attribute:!1},hasFlagged:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.hasComment=!1,this.hasFix=!1,this.hasFlagged=!1}connectedCallback(){super.connectedCallback(),Ue(this,{role:"group","aria-label":"Annotation filter"})}render(){let t=hE.filter(r=>this[r.hasKey]||a[r.stateKey]);return t.length===0?m:d`${t.map(r=>{let n=a[r.stateKey],o=n==="with"?`Showing only ${r.label} findings \u2014 click to exclude them`:n==="without"?`Excluding ${r.label} findings \u2014 click to clear`:`Show only ${r.label} findings`;return d`<button type="button" class="${T({"annotation-chip":!0,"sel-with":n==="with","sel-without":n==="without"})}" title="${o}" aria-label="${o}" aria-pressed="${String(n!=="")}" @click="${()=>this._toggle(r.key)}">${r.glyph}</button>`})}`}_toggle(t){this.dispatchEvent(new CustomEvent("annotation-filter-toggle",{detail:{key:t},bubbles:!0,composed:!0}))}};customElements.define("annotation-filter",Lp);var mE=[["critical","Critical"],["high","High"],["medium","Medium"],["low","Low"],["high_bug","High bug"],["bug","Bug"],["informational","Info"]],Op=class extends z{static properties={counts:{attribute:!1},selected:{attribute:!1},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.selected=[],this.kind="findings"}connectedCallback(){super.connectedCallback(),Ue(this,{role:"group","aria-label":"Filter by severity"})}render(){let t=this.kind==="graph"?new Set(this.selected):a.filterSeverities,r=mE.filter(([n])=>(this.counts[n]??0)||t.has(n));return r.length===0?m:d`${r.map(([n,o])=>{let s=this.counts[n]??0,i=t.has(n);return d`<button type="button" class="${T({"sev-chip":!0,[n]:!0,active:i})}" aria-pressed="${String(i)}" @click="${()=>this._toggle(n)}"><span class="sd"></span><span class="name">${o}</span><span class="n">${s}</span></button>`})}`}_toggle(t){this.dispatchEvent(new CustomEvent("severity-toggle",{detail:{severity:t,kind:this.kind},bubbles:!0,composed:!0}))}};customElements.define("severity-chips",Op);var gE=[["corrected","Corrected","Show corrected severities (application-specific re-ratings)"],["original","Original","Show the original analyzer severities"]],Pp=class extends z{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Ue(this,{role:"group","aria-label":"Severity display mode"})}render(){let t=a.severityMode;return d`<span class="severity-mode-label">Severity</span><span class="severity-mode-chips">${gE.map(([r,n,o])=>{let s=t===r;return d`<button type="button" class="${T({"severity-mode-chip":!0,active:s})}" aria-pressed="${String(s)}" title="${o}" @click="${()=>this._select(r)}">${n}</button>`})}</span>`}_select(t){t!==a.severityMode&&this.dispatchEvent(new CustomEvent("severity-mode-change",{detail:{mode:t},bubbles:!0,composed:!0}))}};customElements.define("severity-mode-switch",Pp);var bE=d`<svg class="trash-icon" viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 4h10M6.5 4V2.5h3V4M5 4l.7 9h4.6L11 4"/></svg>`,Np=class extends z{createRenderRoot(){return this}render(){let t=a.currentView==="bundles"&&a.selectedBundle,r=!a.currentFile&&!t;return d`<button type="button" class="danger" ?disabled="${r}">${bE}<span>Delete current</span></button>`}};customElements.define("sidebar-delete-current",Np);var yE=d`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 6h12v7a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V6Z"/><path d="M2 6l1.6-3.3A1.3 1.3 0 0 1 4.8 2h6.4a1.3 1.3 0 0 1 1.2.7L14 6"/><path d="M8 2v4"/></svg>`,vE=d`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="4" x2="4" y1="2.5" y2="10"/><circle cx="12" cy="4" r="2"/><circle cx="4" cy="12" r="2"/><path d="M12 6a6 6 0 0 1-6 6"/></svg>`,Zv={packages:{title:"Show packages",icon:yE,view:"packages"},repositories:{title:"Show repositories",icon:vE,view:"repositories"}},Dp=class extends z{static properties={kind:{type:String},count:{type:Number}};createRenderRoot(){return this}constructor(){super(),this.kind="",this.count=0}render(){if(this.count===0)return m;let t=Zv[this.kind];if(!t)return console.warn(`<sidebar-view-button>: unknown kind ${JSON.stringify(this.kind)}; expected one of ${Object.keys(Zv).map(n=>JSON.stringify(n)).join(", ")}.`),m;let r=a.currentView===t.view;return d`<button type="button" class="${T({"sidebar-view-btn":!0,active:r})}" title="${t.title}" aria-label="${t.title}">${t.icon}<span class="view-btn-count">${this.count}</span></button>`}};customElements.define("sidebar-view-button",Dp);var wE=["invalid","deleted"],ew={package:{stateKey:"packageSlideTriage"},repository:{stateKey:"repositorySlideTriage"}},zp=class extends z{static properties={counts:{attribute:!1},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.kind=""}connectedCallback(){super.connectedCallback(),Ue(this,{role:"group","aria-label":"Triage view"})}render(){let t=ew[this.kind];if(!t)return console.warn(`<slide-triage-tabs>: unknown kind ${JSON.stringify(this.kind)}; expected one of ${Object.keys(ew).map(o=>JSON.stringify(o)).join(", ")}.`),m;let r=a[t.stateKey],n=wE.filter(o=>(this.counts[o]??0)>0||r===o);return n.length===0?m:d`${n.map(o=>{let s=r===o,i=this.counts[o]??0;return d`<button type="button" class="${T({"triage-state-btn":!0,[`triage-state-${o}`]:!0,active:s})}" title="${s?`Exit ${o} view`:`Show ${o} (${i})`}" aria-pressed="${String(s)}" @click="${()=>this._toggle(o)}">${o.charAt(0).toUpperCase()+o.slice(1)} (${i})</button>`})}`}_toggle(t){this.dispatchEvent(new CustomEvent("slide-triage-toggle",{detail:{kind:this.kind,value:t},bubbles:!0,composed:!0}))}};customElements.define("slide-triage-tabs",zp);var kE=[["own","Sources"],["modules","Dependencies"]],Up=class extends z{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Ue(this,{role:"group","aria-label":"Source filter"})}render(){return d`${kE.map(([t,r])=>{let n=a.filterSources.has(t);return d`<button type="button" class="${T({"source-chip":!0,active:n})}" aria-pressed="${String(n)}" @click="${()=>this._toggle(t)}">${r}</button>`})}`}_toggle(t){this.dispatchEvent(new CustomEvent("source-toggle",{detail:{source:t},bubbles:!0,composed:!0}))}};customElements.define("source-filter",Up);var $E=d`<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>`,xE=d`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6h10v4"/></svg>`,tw={findings:{stateKey:"filterInclude",placeholder:"Search findings\u2026"},files:{stateKey:"filesSearch",placeholder:"Search files\u2026"}},Hp=class extends z{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let t=tw[this.kind];if(!t)return console.warn(`<toolbar-search>: unknown kind ${JSON.stringify(this.kind)}; expected one of ${Object.keys(tw).map(n=>JSON.stringify(n)).join(", ")}.`),m;let r=a[t.stateKey];return d`${$E} <input type="text" aria-label="${t.placeholder}" placeholder="${t.placeholder}" .value="${Se(r)}" @input="${this._onInput}"> ${this.kind==="findings"&&r?this._negateToggle():m}`}_negateToggle(){let t=a.filterIncludeNegate;return d`<button type="button" class="${T({"search-negate-btn":!0,active:t})}" title="${t?"Negation on \u2014 click to undo":"Negate: show non-matching findings"}" aria-label="Negate search" aria-pressed="${String(t)}" @click="${this._onToggleNegate}">${xE}</button>`}_onInput=t=>{this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:this.kind,value:t.target.value},bubbles:!0,composed:!0}))};_onToggleNegate=()=>{this.dispatchEvent(new CustomEvent("search-negate-toggle",{bubbles:!0,composed:!0}))}};customElements.define("toolbar-search",Hp);function _E(e){if(!e)return"";let t=e.match(/github\.com\/([^/?#]+\/[^/?#]+?)(?:\.git)?(?:[/?#]|$)/iu);return t?t[1]:e}var Vp=class extends z{static properties={options:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.options=[]}render(){return d`<select class="sort-select" aria-label="Filter by repository" .value="${Se(a.filterRepo)}" @change="${this._onChange}"><option value="" ?selected="${a.filterRepo===""}">All repositories</option>${this.options.map(t=>{let r=t??fn,n=t==null?"(no repo)":_E(t);return d`<option value="${r}" ?selected="${a.filterRepo===r}">${n}</option>`})}</select>`}_onChange=t=>{this.dispatchEvent(new CustomEvent("repo-change",{detail:{value:t.target.value},bubbles:!0,composed:!0}))}};customElements.define("repo-filter",Vp);var rw={"":"+ Partial",exclude:"\u2212 Partial",only:"only Partial"},nw={"":"included",exclude:"excluded",only:"only"},ow={"":"Confirmed, partial and revalidation rows \u2014 click for full confirmations only",exclude:"Full confirmations only \u2014 click to show the partial ones only",only:"Partial confirmations only \u2014 click to show all of them again"},jp=class extends z{static properties={options:{attribute:!1},hasPartial:{type:Boolean,attribute:"has-partial"}};createRenderRoot(){return this}constructor(){super(),this.options=[],this.hasPartial=!1}render(){return d`<select class="sort-select" aria-label="Filter by revalidation outcome" .value="${Se(a.filterRevalidate)}" @change="${this._onChange}"><option value="" hidden ?selected="${a.filterRevalidate===""}"></option><option value="">Confidence</option>${this.options.map(t=>d`<option value="${t.value}" ?selected="${a.filterRevalidate===t.value}">${t.label}</option>`)}</select> ${this.hasPartial&&a.filterRevalidate==="confirmed"?d`<button type="button" class="${T({"partial-cycle":!0,[nw[a.filterPartial]??nw[""]]:!0})}" title="${ow[a.filterPartial]??ow[""]}" @click="${this._onPartial}">${rw[a.filterPartial]??rw[""]}</button>`:m}`}_onPartial=()=>{let t=$a.indexOf(a.filterPartial),r=$a[(t+1)%$a.length];this.dispatchEvent(new CustomEvent("partial-change",{detail:{value:r},bubbles:!0,composed:!0}))};_onChange=t=>{let{value:r}=t.target;r||(t.target.selectedIndex=0),this.dispatchEvent(new CustomEvent("revalidate-change",{detail:{value:r},bubbles:!0,composed:!0}))}};customElements.define("revalidate-filter",jp);var sw=[["none","none","unmarked"],["red","r","red"],["blue","b","blue"],["green","g","green"],["gray","x","gray"]],Wp=class extends z{static properties={counts:{attribute:!1},selected:{attribute:!1},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.selected=[],this.kind="findings"}connectedCallback(){super.connectedCallback(),Ue(this,{role:"group","aria-label":"Filter by mark color"})}render(){let t=this.kind==="graph"?new Set(this.selected):a.filterColors;return sw.some(([n])=>(this.counts[n]??0)||t.has(n))?d`${sw.map(([n,o,s])=>{let i=this.counts[n]??0,l=t.has(n);return d`<button type="button" class="${l?"active":""}" title="${`${s} (${i})`}" aria-pressed="${String(l)}" @click="${()=>this._toggle(n)}"><span class="${`td ${o}`}"></span><span class="count">${i}</span></button>`})}`:m}_toggle(t){this.dispatchEvent(new CustomEvent("color-toggle",{detail:{color:t,kind:this.kind},bubbles:!0,composed:!0}))}};customElements.define("triage-filter",Wp);var SE=["inprogress","fixed","invalid","deleted","ignored"],Kp={graph:"graph2-triage-selector",packages:"packages-triage-selector"},CE={inprogress:"In progress"},EE=e=>CE[e]??e.charAt(0).toUpperCase()+e.slice(1),qp=class extends z{static properties={counts:{attribute:!1},states:{attribute:!1},variant:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.states=null,this.variant=""}connectedCallback(){super.connectedCallback(),Ue(this,{role:"group","aria-label":"Triage view"})}render(){let t=this.states??SE,r=t.reduce((s,i)=>s+(this.counts[i]??0),0),n=this.variant?Kp[this.variant]:null;this.variant&&n===void 0&&console.warn(`<triage-selector>: unknown variant ${JSON.stringify(this.variant)}; expected one of ${Object.keys(Kp).map(s=>JSON.stringify(s)).join(", ")} or "".`);for(let s of Object.values(Kp))this.classList.toggle(s,s===n);let o=r===0&&!a.shownTriage;return this.classList.toggle("is-empty",o),o?m:d`${t.map(s=>{let i=this.counts[s]??0,l=a.shownTriage===s;if(i===0&&!l)return m;let c=EE(s);return d`<button type="button" class="${T({"triage-state-btn":!0,[`triage-state-${s}`]:!0,active:l})}" data-triage-show="${s}" title="${l?`Exit ${c.toLowerCase()} view`:`Show ${c.toLowerCase()} (${i})`}" aria-pressed="${String(l)}">${c} (${i})</button>`})}`}};customElements.define("triage-selector",qp);var AE={table:d`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><rect x="3" y="3" width="18" height="18" rx="2"/><line x1="3" x2="21" y1="9" y2="9"/><line x1="3" x2="21" y1="15" y2="15"/><line x1="9" x2="9" y1="3" y2="21"/></svg>`,list:d`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><line x1="3" x2="21" y1="6" y2="6"/><line x1="3" x2="21" y1="12" y2="12"/><line x1="3" x2="21" y1="18" y2="18"/></svg>`,grouped:d`<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><rect x="2" y="1.5" width="12" height="2" rx=".4"/><rect x="5" y="4.4" width="9" height="1.3"/><rect x="5" y="6.2" width="9" height="1.3"/><rect x="2" y="8.5" width="12" height="2" rx=".4"/><rect x="5" y="11.4" width="9" height="1.3"/><rect x="5" y="13.2" width="9" height="1.3"/></svg>`,kanban:d`<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><rect x="1.5" y="2" width="3.8" height="12" rx=".6" fill="none" stroke="currentColor" stroke-width="1"/><rect x="6.1" y="2" width="3.8" height="12" rx=".6" fill="none" stroke="currentColor" stroke-width="1"/><rect x="10.7" y="2" width="3.8" height="12" rx=".6" fill="none" stroke="currentColor" stroke-width="1"/><rect x="2.4" y="3.6" width="2" height="1.4" rx=".2"/><rect x="2.4" y="5.6" width="2" height="1.4" rx=".2"/><rect x="7" y="3.6" width="2" height="1.4" rx=".2"/><rect x="11.6" y="3.6" width="2" height="1.4" rx=".2"/><rect x="11.6" y="5.6" width="2" height="1.4" rx=".2"/><rect x="11.6" y="7.6" width="2" height="1.4" rx=".2"/></svg>`,focus:d`<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><rect x="1.5" y="2.5" width="8.5" height="11" rx=".6" fill="none" stroke="currentColor" stroke-width="1"/><rect x="3" y="4.4" width="5.5" height="1"/><rect x="3" y="6.4" width="5.5" height="1"/><rect x="3" y="8.4" width="3.5" height="1"/><rect x="11.2" y="2.5" width="3.3" height="2.5" rx=".4" fill="currentColor" opacity=".55"/><rect x="11.2" y="5.7" width="3.3" height="2.5" rx=".4" fill="currentColor" opacity=".35"/><rect x="11.2" y="8.9" width="3.3" height="2.5" rx=".4" fill="currentColor" opacity=".22"/></svg>`,graph:d`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" aria-hidden="true"><line x1="4.5" y1="4.5" x2="11.5" y2="6.5"/><line x1="4.5" y1="4.5" x2="6.5" y2="11.5"/><line x1="11.5" y1="6.5" x2="6.5" y2="11.5"/><circle cx="4.5" cy="4.5" r="2" fill="currentColor"/><circle cx="11.5" cy="6.5" r="2" fill="currentColor"/><circle cx="6.5" cy="11.5" r="2" fill="currentColor"/></svg>`},iw={table:"Table view (compact rows, click a row to expand)",list:"List view (flat, one card per finding)",grouped:"List view, grouped by file",focus:"Focus view (one finding centered + a queue of next findings)",kanban:"Kanban board, columns grouped by triage status",graph:"Graph view (canvas with imports / exports)"},Gp=["table","list","grouped","focus","kanban","graph"],Yp=class extends z{static properties={modes:{type:String},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.modes=Gp.join(","),this.kind="findings"}connectedCallback(){super.connectedCallback(),Ue(this,{role:"group","aria-label":"View mode"})}render(){let t=this.kind==="files"?a.filesViewMode:a.viewMode,r=this.modes.split(",").map(o=>o.trim()).filter(o=>Gp.includes(o)),n=r.length>0?r:Gp;return d`${n.map(o=>d`<button type="button" class="${T({"view-mode-btn":!0,active:t===o})}" title="${iw[o]}" aria-label="${iw[o]}" aria-pressed="${String(t===o)}" @click="${()=>this._select(o,t)}">${AE[o]}</button>`)}`}_select(t,r){t!==r&&this.dispatchEvent(new CustomEvent("view-mode-change",{detail:{mode:t,kind:this.kind},bubbles:!0,composed:!0}))}};customElements.define("view-mode-buttons",Yp);var dw=6,aw=14,ul=2,lw=24,Gs=4,TE=1.5,pl=new Map,cw="treemap";function RE(e){let t=/^#?([0-9a-f]{6})$/iu.exec(e);if(!t)return"#fff";let r=parseInt(t[1],16),n=r>>16&255,o=r>>8&255,s=r&255;return(.2126*n+.7152*o+.0722*s)/255>.6?"#1a1a1a":"#fff"}function IE(e,t,r,n){let o=r*r,s=n*n;return Math.max(s*e/o,o/(s*t))}function uw(e,t){let r=[],n=e.filter(f=>f.value>0),{x:o,y:s,w:i,h:l}=t;if(n.length===0||i<=0||l<=0)return r;let c=0;for(let f of n)c+=f.value;let u=i*l/c,p=0;for(;p<n.length&&i>.5&&l>.5;){let f=Math.min(i,l),h=p,b=0,g=0,w=1/0,v=1/0;for(;h<n.length;){let k=n[h].value*u,S=k>g?k:g,M=k<w?k:w,_=IE(S,M,b+k,f);if(h===p||_<=v)v=_,b+=k,g=S,w=M,h++;else break}let y=b/f;if(i>=l){let k=s;for(let S=p;S<h;S++){let M=S===h-1?s+l-k:n[S].value*u/y;r.push({node:n[S],x:o,y:k,w:y,h:M}),k+=M}o+=y,i-=y}else{let k=o;for(let S=p;S<h;S++){let M=S===h-1?o+i-k:n[S].value*u/y;r.push({node:n[S],x:k,y:s,w:M,h:y}),k+=M}s+=y,l-=y}p=h}return r}function pw(e){for(;e.children&&e.children.size===1;){let t=e.children.values().next().value;if(t.isFile)break;e.name=`${e.name}/${t.name}`,e.children=t.children}if(e.children)for(let t of e.children.values())pw(t)}function fw(e,t,r,n){if(e.path=e.name?t?`${t}/${e.name}`:e.name:t,e.parent=r,e.isFile)return e.count=1,e.value;n.set(e.path,e);let o=0,s=0,i;for(let l of e.children.values())o+=fw(l,e.path,e,n),s+=l.count,i===void 0?i=l.pkg:i!==l.pkg&&(i=null);return e.value=o,e.count=s,e.pkg=i??null,o}function hw(e,t,r,n,o,s,i){if(n<Gs||o<Gs)return;if(e.isFile){i.push({kind:"file",node:e,x:t,y:r,w:n,h:o});return}if(!(s<dw&&n>=lw&&o>=lw&&e.children.size>0)){i.push({kind:"agg",node:e,x:t,y:r,w:n,h:o});return}i.push({kind:"dir",node:e,x:t,y:r,w:n,h:o});let c=o>=aw+Gs+ul?aw:0,u=t+ul,p=r+c,f=n-ul*2,h=o-c-ul;if(f<Gs||h<Gs)return;let b=[...e.children.values()].toSorted((g,w)=>w.value-g.value);for(let g of uw(b,{x:u,y:p,w:f,h}))hw(g.node,g.x,g.y,g.w,g.h,s+1,i)}function Jp(e,t){let r=e/(t||1)*100;return r>=10?r.toFixed(0):r.toFixed(r>=1?1:2)}function mw(e,t){if(t<=0||e.isFile||!e.children||e.children.size===0)return 0;let r=1;for(let n of e.children.values()){if(r>=t)break;let o=1+mw(n,t-1);o>r&&(r=o)}return r}function ME(e,t,r,n,o,s){let i=Math.min(s-o,Math.PI*2-1e-4),l=o+i,c=i>Math.PI?1:0,u=Math.cos(o),p=Math.sin(o),f=Math.cos(l),h=Math.sin(l),b=g=>g.toFixed(2);return`M${b(e+n*u)} ${b(t+n*p)}A${b(n)} ${b(n)} 0 ${c} 1 ${b(e+n*f)} ${b(t+n*h)}L${b(e+r*f)} ${b(t+r*h)}A${b(r)} ${b(r)} 0 ${c} 0 ${b(e+r*u)} ${b(t+r*p)}Z`}function FE(e,t){let r=Math.max(4,Math.floor(t/6.4));return e.length>r?`${e.slice(0,r-1)}\u2026`:e}var Xp=class extends Z{static properties={details:{attribute:!1},_w:{state:!0},_h:{state:!0},_focus:{state:!0},_mode:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.details=null,this._w=0,this._h=0,this._root=null,this._focus=[],this._mode=cw,this._dirByPath=new Map,this._status="loading",this._meta={files:0,total:0,prefix:""},this._ro=null,this._plot=null,this._tooltip=null,this._ttCell=null,this._onPointerMove=this._onPointerMove.bind(this),this._onPointerLeave=this._onPointerLeave.bind(this),this._onPlotClick=this._onPlotClick.bind(this)}willUpdate(t){t.has("details")&&this._rebuild()}firstUpdated(){this._plot=this.querySelector(".bundle-treemap-plot"),this._tooltip=this.querySelector(".bundle-treemap-tooltip"),!(!this._plot||typeof ResizeObserver>"u")&&(this._ro=new ResizeObserver(t=>{let r=t[0]?.contentRect;if(!r)return;let n=Math.floor(r.width),o=Math.floor(r.height);(n!==this._w||o!==this._h)&&(this._w=n,this._h=o)}),this._ro.observe(this._plot))}disconnectedCallback(){super.disconnectedCallback(),this._ro&&(this._ro.disconnect(),this._ro=null)}_onPointerMove(t){let r=t.target.closest(".bundle-treemap-node");if(!r||!this._tooltip){this._hideTooltip();return}if(r!==this._ttCell){this._ttCell=r;let n=r.dataset;J(d`<div class="bundle-treemap-tt-path">${n.ttPath}</div>${n.ttPkg?d`<div class="bundle-treemap-tt-head"><span class="bundle-treemap-tt-dot" style="${`background:${n.ttColor}`}"></span> <span class="bundle-treemap-tt-pkg">${n.ttPkg}</span></div>`:""}<div class="bundle-treemap-tt-meta">${n.ttMeta}</div>`,this._tooltip)}this._positionTooltip(t.clientX,t.clientY)}_onPointerLeave(){this._hideTooltip()}_positionTooltip(t,r){let n=this._tooltip;if(!n||!this._plot)return;n.classList.add("show");let o=this._plot.getBoundingClientRect(),s=t-o.left,i=r-o.top,l=12,c=s+l;c+n.offsetWidth>o.width-4&&(c=s-n.offsetWidth-l),c<4&&(c=4);let u=i+l;u+n.offsetHeight>o.height-4&&(u=i-n.offsetHeight-l),u<4&&(u=4),n.style.left=`${c}px`,n.style.top=`${u}px`}_hideTooltip(){this._ttCell=null,this._tooltip&&this._tooltip.classList.remove("show")}_rebuild(){if(this._root=null,this._focus=[],this._dirByPath=new Map,this._meta={files:0,total:0,prefix:""},!this.details){this._status="loading";return}let t=We(this.details);if(!t||t.size===0){this._status="empty";return}let r=[...t.keys()],n=Lr(this.details),{prefix:o,stripped:s}=it(r),i=new TextEncoder,l={name:"",children:new Map,value:0,isFile:!1},c=0,u=0;for(let h=0;h<r.length;h++){let b=t.get(r[h]),g=typeof b=="string"?i.encode(b).byteLength:0;if(g<=0)continue;let w=s[h].split("/"),v=l,y=!1;for(let M=0;M<w.length-1;M++){let _=v.children.get(w[M]);if(_&&_.isFile){y=!0;break}_||(_={name:w[M],children:new Map,value:0,isFile:!1},v.children.set(w[M],_)),v=_}if(y)continue;let k=w.at(-1),S=v.children.get(k);if(!(S&&!S.isFile)){if(!S){let M=bt(s[h],{packageDir:n?.get(r[h])});S={name:k,isFile:!0,value:0,origPath:r[h],pkg:M},v.children.set(k,S)}S.value+=g,c+=g,u++}}if(c===0){this._status="empty";return}for(let h of l.children.values())pw(h);let p=new Map;fw(l,"",null,p),this._root=l,this._dirByPath=p,this._meta={files:u,total:c,prefix:o},this._status="ok";let f=this.details?.integrity?pl.get(this.details.integrity):null;if(f){let h=p.get(f);h?this._focus=this._chainTo(h):pl.delete(this.details.integrity)}}get _focusNode(){return this._focus.length>0?this._focus.at(-1):this._root}_chainTo(t){let r=[];for(let n=t;n&&n!==this._root;n=n.parent)r.push(n);return r.reverse(),r}_rememberFocus(){let t=this.details?.integrity;if(!t)return;let r=this._focus.at(-1)?.path;r?pl.set(t,r):pl.delete(t)}_drillInto(t){!t||t.isFile||!t.children||t.children.size===0||(this._focus=this._chainTo(t),this._rememberFocus(),this._hideTooltip())}_focusTo(t){let r=t<0?[]:this._focus.slice(0,t+1);r.length!==this._focus.length&&(this._focus=r,this._rememberFocus(),this._hideTooltip())}_toggleMode(){this._mode=this._mode==="sunburst"?"treemap":"sunburst",cw=this._mode,this._hideTooltip()}_onPlotClick(t){let r=t.target.closest("[data-treemap-into]");if(!r)return;let n=this._dirByPath.get(r.dataset.treemapInto);n&&this._drillInto(n)}_renderCrumbs(){let t=this._focus,r=t.length===0,n=t.slice(0,-1),o=r?null:t.at(-1);return d`<nav class="bundle-treemap-crumbs" aria-label="Treemap location"><span class="bundle-treemap-crumbs-lead"><button type="button" class="${T({"bundle-treemap-crumb-home":!0,"at-root":r})}" @click="${()=>this._focusTo(-1)}">Source ${this._mode==="sunburst"?"sunburst":"treemap"}</button> ${n.map((s,i)=>d`<span class="bundle-treemap-crumb-sep" aria-hidden="true">›</span><button type="button" class="bundle-treemap-crumb" @click="${()=>this._focusTo(i)}" title="${s.path}">${s.name}</button>`)} </span>${o?d`<span class="bundle-treemap-crumb-sep" aria-hidden="true">›</span><span class="bundle-treemap-crumb-current" aria-current="location" title="${o.path}">${o.name}</span>`:""}</nav>`}_cell(t){let r=Jp(t.node.value,this._meta.total),n={left:`${t.x}px`,top:`${t.y}px`,width:`${t.w}px`,height:`${t.h}px`},o=`${t.node.count} ${t.node.count===1?"file":"files"}`;if(t.kind==="dir")return d`<div class="bundle-treemap-node bundle-treemap-dir" style="${ue(n)}" data-treemap-into="${t.node.path}" data-tt-path="${`${t.node.path}/`}" data-tt-meta="${`${ie(t.node.value)} \xB7 ${o} \xB7 ${r}%`}"><span class="bundle-treemap-dirname">${t.node.name}</span></div>`;let s=t.node.pkg??bt(t.node.path),i=Xe(s),l=ue({...n,background:i,color:RE(i)}),c=s==="__own__"?"own source":s;return t.kind==="agg"?d`<div class="bundle-treemap-node bundle-treemap-leaf bundle-treemap-agg" style="${l}" data-treemap-into="${t.node.path}" data-tt-path="${`${t.node.path}/`}" data-tt-pkg="${c}" data-tt-color="${i}" data-tt-meta="${`${ie(t.node.value)} \xB7 ${o} \xB7 ${r}%`}"><span class="bundle-treemap-label">${t.node.name}/</span></div>`:d`<div class="bundle-treemap-node bundle-treemap-leaf bundle-treemap-file" style="${l}" data-bundle-view-source="${t.node.origPath}" data-tt-path="${t.node.path}" data-tt-pkg="${c}" data-tt-color="${i}" data-tt-meta="${`${ie(t.node.value)} \xB7 ${r}% of bundle`}"><span class="bundle-treemap-label">${t.node.name}</span></div>`}_arc(t,r,n){let o=Jp(t.value,n),s=t.pkg??bt(t.path),i=Xe(s),l=s==="__own__"?"own source":s;if(t.isFile)return ur`<path class="bundle-treemap-node bundle-treemap-arc" d="${r}" fill="${i}" data-bundle-view-source="${t.origPath}" data-tt-path="${t.path}" data-tt-pkg="${l}" data-tt-color="${i}" data-tt-meta="${`${ie(t.value)} \xB7 ${o}% of bundle`}"></path>`;let c=`${t.count} ${t.count===1?"file":"files"}`;return ur`<path class="bundle-treemap-node bundle-treemap-arc" d="${r}" fill="${i}" data-treemap-into="${t.path}" data-tt-path="${`${t.path}/`}" data-tt-pkg="${t.pkg?l:m}" data-tt-color="${t.pkg?i:m}" data-tt-meta="${`${ie(t.value)} \xB7 ${c} \xB7 ${o}%`}"></path>`}_renderSunburst(t){let r=this._w,n=this._h,o=r/2,s=n/2,i=Math.min(r,n)/2-6;if(i<30)return m;let l=mw(t,dw),c=Math.min(Math.max(i*.18,26),i*.45),u=(i-c)/l,p=this._meta.total||1,f=[],h=(y,k,S,M)=>{let _=[...y.children.values()].toSorted((B,V)=>V.value-B.value),R=S-k,O=k;for(let B of _){let V=R*(B.value/y.value),le=c+(M-1)*u,Y=le+u;V*Y>=TE&&(f.push(this._arc(B,ME(o,s,le,Y,O,O+V),p)),!B.isFile&&M<l&&B.children.size>0&&h(B,O,O+V,M+1)),O+=V}};h(t,-Math.PI/2,Math.PI*1.5,1);let b=this._focus.length>0,g=Math.max(c-4,10),w=b?ur`<circle class="bundle-treemap-node bundle-treemap-center" cx="${o}" cy="${s}" r="${g}" data-treemap-into="${t.parent.path}" data-tt-path="${`${t.path}/`}" data-tt-meta="${`${ie(t.value)} \xB7 ${t.count} ${t.count===1?"file":"files"} \xB7 ${Jp(t.value,p)}%`}"></circle>`:ur`<circle class="bundle-treemap-center" cx="${o}" cy="${s}" r="${g}"></circle>`,v=ur`<text class="bundle-treemap-center-label" x="${o}" y="${s}" text-anchor="middle">${b?ur`<tspan x="${o}" dy="-0.3em">${FE(t.name,g*2-12)}</tspan><tspan class="bundle-treemap-center-sub" x="${o}" dy="1.5em">${ie(t.value)}</tspan>`:ur`<tspan x="${o}" dy="0.35em">${ie(t.value)}</tspan>`}</text>`;return d`<svg class="bundle-treemap-sunburst" width="${r}" height="${n}" viewBox="${`0 0 ${r} ${n}`}">${f}${w}${v}</svg>`}render(){let t=this._focusNode,r=this._mode==="sunburst",n=this._status==="ok"&&t&&t.children&&this._w>0&&this._h>0,o=[];if(n&&!r){let p=[...t.children.values()].toSorted((f,h)=>h.value-f.value);for(let f of uw(p,{x:0,y:0,w:this._w,h:this._h}))hw(f.node,f.x,f.y,f.w,f.h,1,o)}let{files:s,total:i,prefix:l}=this._meta,c=this._status==="ok"&&t?t.count:s,u=this._status==="ok"&&t?t.value:i;return d`<header class="bundle-treemap-head">${this._renderCrumbs()} <span class="bundle-treemap-head-right"><span class="bundle-treemap-sub">${c} ${c===1?"file":"files"} · ${ie(u)}${l?d`· <span class="mono">${l}</span>`:""}</span> <button type="button" class="${T({"bundle-treemap-mode-toggle":!0,on:r})}" aria-pressed="${String(r)}" aria-label="Toggle sunburst view" @click="${this._toggleMode}"><span>Sunburst</span><span class="bundle-treemap-switch" aria-hidden="true"></span></button></span></header><div class="bundle-treemap-plot" @click="${this._onPlotClick}" @pointermove="${this._onPointerMove}" @pointerleave="${this._onPointerLeave}">${this._status==="loading"?d`<div class="bundle-treemap-empty">Loading…</div>`:this._status==="empty"?d`<div class="bundle-treemap-empty">This bundle doesn't carry any source content.</div>`:r?n?this._renderSunburst(t):m:o.map(p=>this._cell(p))}<div class="bundle-treemap-tooltip"></div></div>`}};customElements.define("bundle-treemap",Xp);var BE=new TextEncoder;function fl(e){return typeof e=="string"?BE.encode(e).byteLength:0}function gw(e){return(t,r)=>Math.abs(r.delta)-Math.abs(t.delta)||t[e].localeCompare(r[e])}function hl(e){return(t,r)=>r.bytes-t.bytes||t[e].localeCompare(r[e])}function LE(){return{baseBytes:0,otherBytes:0,onlyBaseFiles:0,onlyOtherFiles:0,changedFiles:0}}function yw(e,t,r){let n=[],o=[],s=[],i=0,l=0,c=0,u=0,p=0,f=0,h=new Map,b=k=>{let S=r(k),M=h.get(S);return M||(M=LE(),h.set(S,M)),M},g=new Set([...e.keys(),...t.keys()]);for(let k of g){let S=e.has(k),M=t.has(k),_=b(k);if(S&&M){let R=e.get(k),O=t.get(k),B=fl(R),V=R===O?B:fl(O);if(i+=B,l+=V,_.baseBytes+=B,_.otherBytes+=V,R===O)f++;else{let le=V-B;s.push({path:k,baseBytes:B,otherBytes:V,delta:le}),p+=le,_.changedFiles++}}else if(S){let R=fl(e.get(k));i+=R,c+=R,_.baseBytes+=R,_.onlyBaseFiles++,n.push({path:k,bytes:R})}else{let R=fl(t.get(k));l+=R,u+=R,_.otherBytes+=R,_.onlyOtherFiles++,o.push({path:k,bytes:R})}}let w=[],v=[],y=[];for(let[k,S]of h){let M=S.baseBytes>0||S.onlyBaseFiles>0||S.changedFiles>0,_=S.otherBytes>0||S.onlyOtherFiles>0||S.changedFiles>0,R=S.onlyBaseFiles+S.onlyOtherFiles+S.changedFiles;M&&!_?w.push({pkg:k,bytes:S.baseBytes}):_&&!M?v.push({pkg:k,bytes:S.otherBytes}):(R>0||S.baseBytes!==S.otherBytes)&&y.push({pkg:k,baseBytes:S.baseBytes,otherBytes:S.otherBytes,delta:S.otherBytes-S.baseBytes})}return n.sort(hl("path")),o.sort(hl("path")),s.sort(gw("path")),w.sort(hl("pkg")),v.sort(hl("pkg")),y.sort(gw("pkg")),{totals:{baseFiles:e.size,baseBytes:i,otherFiles:t.size,otherBytes:l,onlyBaseFiles:n.length,onlyBaseBytes:c,onlyOtherFiles:o.length,onlyOtherBytes:u,changedFiles:s.length,changedDelta:p,unchangedFiles:f,fileDelta:t.size-e.size,byteDelta:l-i,identical:n.length===0&&o.length===0&&s.length===0},files:{onlyBase:n,onlyOther:o,changed:s},packages:{onlyBase:w,onlyOther:v,changed:y}}}function bw(e){let r=String(e).trim().split("+",1)[0],n=r.indexOf("-");return n===-1?{core:r,pre:""}:{core:r.slice(0,n),pre:r.slice(n+1)}}function Ys(e,t){if(e===t)return 0;let r=bw(e),n=bw(t),o=r.core.split("."),s=n.core.split(".");for(let c=0;c<Math.max(o.length,s.length);c++){let u=Number(o[c]??0),p=Number(s[c]??0);if(Number.isNaN(u)||Number.isNaN(p))return e<t?-1:1;if(u!==p)return u<p?-1:1}if(r.pre===n.pre)return 0;if(!r.pre)return 1;if(!n.pre)return-1;let i=r.pre.split("."),l=n.pre.split(".");for(let c=0;c<Math.max(i.length,l.length);c++){let u=i[c],p=l[c];if(u===void 0)return-1;if(p===void 0)return 1;if(u===p)continue;let f=/^\d+$/u.test(u),h=/^\d+$/u.test(p);return f&&h?Number(u)<Number(p)?-1:1:f!==h?f?-1:1:u<p?-1:1}return 0}function OE(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function PE(e,t){let r=Ys(t.at(-1),e.at(-1));return r>0?"up":r<0?"down":"changed"}function vw(e,t){let r=[],n=[],o=[],s=new Set([...e.keys(),...t.keys()]);for(let l of s){let c=e.get(l),u=t.get(l);if(c&&u){let p=[...c].toSorted(Ys),f=[...u].toSorted(Ys);if(OE(p,f))continue;r.push({pkg:l,baseVersions:p,otherVersions:f,direction:PE(p,f)})}else c?o.push({pkg:l,versions:[...c].toSorted(Ys)}):n.push({pkg:l,versions:[...u].toSorted(Ys)})}let i=(l,c)=>l.pkg.localeCompare(c.pkg);return r.sort(i),n.sort(i),o.sort(i),{updated:r,added:n,removed:o,totals:{baseDeps:e.size,otherDeps:t.size}}}var ml=400,Js=null;function Qp(e){return e===0?"\xB10 B":`${e>0?"+":"\u2212"}${Math.abs(e).toLocaleString()} B`}function ww(e){return e===0?"\xB10":`${e>0?"+":"\u2212"}${Math.abs(e).toLocaleString()}`}function Zp(e){return e>0?"up":e<0?"down":""}function NE(e,t){if(!t)return"";let r=e/t*100;return`${r>0?"+":r<0?"\u2212":"\xB1"}${Math.abs(r).toFixed(1)}%`}function kw(e){return e==="__own__"?"own source":e}function ef(e){return e.join(", ")}var tf=class extends Z{static properties={details:{attribute:!1},integrity:{attribute:!1},_targetIntegrity:{state:!0},_otherDetails:{state:!0},_status:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.details=null,this.integrity=null,this._targetIntegrity=null,this._otherDetails=null,this._status="idle",this._diff=null,this._diffKey=null}willUpdate(t){if(t.has("integrity")){if(Js&&this.integrity===Js.base){let r=Js.target;Js=null,this._targetIntegrity=r,this._otherDetails=null,this._status="loading",this._diff=null,this._diffKey=null,this._loadOther(r);return}this._targetIntegrity=null,this._otherDetails=null,this._status="idle",this._diff=null,this._diffKey=null}}_swap(){let t=this._targetIntegrity;!t||t===this.integrity||(a.bundles??[]).some(r=>r.integrity===t)&&(Js={base:t,target:this.integrity},this.dispatchEvent(new CustomEvent("bundle-swap",{bubbles:!0,composed:!0,detail:{integrity:t}})))}_nameFor(t){return(a.bundles??[]).find(n=>n.integrity===t)?.name??`${t.slice(0,15)}\u2026`}_onPick(t){let r=t.target.value||null;if(this._targetIntegrity=r,this._otherDetails=null,this._diff=null,this._diffKey=null,!r){this._status="idle";return}this._status="loading",this._loadOther(r)}async _loadOther(t){let r=(a.bundles??[]).find(o=>o.integrity===t);if(!r){this._status="idle",this._targetIntegrity=null;return}let n=await io(t,r);this._targetIntegrity===t&&(this._otherDetails=n,this._status="ready")}get _baseReady(){return!!(this.details&&this.details.integrity===this.integrity&&(this.details.json||this.details.bundle))}_fileRow(t,r,n,o){let s=d`<span class="bundle-compare-row-path mono">${r}</span>${o}`;return n?d`<li><button type="button" class="bundle-compare-row bundle-compare-row-link" data-bundle-view-source="${t}" title="${t}">${s}</button></li>`:d`<li><div class="bundle-compare-row" title="${t}">${s}</div></li>`}_fileGroup(t,r,n,o,s){if(r.length===0)return m;let i=r.slice(0,ml),l=r.length-i.length;return d`<section class="${`bundle-compare-group bundle-compare-${n}`}"><header class="bundle-compare-group-head"><span class="bundle-compare-dot" aria-hidden="true"></span> <span class="bundle-compare-group-title">${t}</span> <span class="bundle-compare-group-count">${r.length}</span></header><ul class="bundle-compare-rows">${Q(i,c=>c.path,c=>{let u=c.delta===void 0?d`<span class="bundle-compare-row-size">${ie(c.bytes)}</span>`:d`<span class="bundle-compare-row-size">${ie(c.baseBytes)} → ${ie(c.otherBytes)}</span> <span class="${`bundle-compare-row-delta ${c.delta>0?"up":c.delta<0?"down":""}`}">${Qp(c.delta)}</span>`;return this._fileRow(c.path,s(c.path),o,u)})}</ul>${l>0?d`<div class="bundle-compare-more">and ${l.toLocaleString()} more…</div>`:m}</section>`}_pkgGroup(t,r,n){if(r.length===0)return m;let o=r.slice(0,ml),s=r.length-o.length;return d`<section class="${`bundle-compare-group bundle-compare-${n}`}"><header class="bundle-compare-group-head"><span class="bundle-compare-dot" aria-hidden="true"></span> <span class="bundle-compare-group-title">${t}</span> <span class="bundle-compare-group-count">${r.length}</span></header><ul class="bundle-compare-rows">${Q(o,i=>i.pkg,i=>{let l=i.delta===void 0?d`<span class="bundle-compare-row-size">${ie(i.bytes)}</span>`:d`<span class="bundle-compare-row-size">${ie(i.baseBytes)} → ${ie(i.otherBytes)}</span> <span class="${`bundle-compare-row-delta ${i.delta>0?"up":i.delta<0?"down":""}`}">${Qp(i.delta)}</span>`;return d`<li><div class="bundle-compare-row" title="${kw(i.pkg)}"><span class="bundle-compare-pkg-dot" style="${ue({background:Xe(i.pkg)})}"></span> <span class="bundle-compare-row-path">${kw(i.pkg)}</span> ${l}</div></li>`})}</ul>${s>0?d`<div class="bundle-compare-more">and ${s.toLocaleString()} more…</div>`:m}</section>`}_versionRow(t){let r=t.direction==="up"?"\u2191":t.direction==="down"?"\u2193":"\xB1",n=t.direction==="up"?"Upgraded":t.direction==="down"?"Downgraded":"Changed";return d`<li><div class="bundle-compare-row" title="${`${t.pkg} \xB7 ${n}`}"><span class="bundle-compare-pkg-dot" style="${ue({background:Xe(t.pkg)})}"></span> <span class="bundle-compare-row-path">${t.pkg}</span> <span class="bundle-compare-ver"><span class="bundle-compare-ver-from">${ef(t.baseVersions)}</span> <span class="bundle-compare-ver-arrow" aria-hidden="true">→</span> <span class="${`bundle-compare-ver-to ${t.direction}`}">${ef(t.otherVersions)}</span> <span class="${`bundle-compare-ver-dir ${t.direction}`}" aria-hidden="true">${r}</span></span></div></li>`}_depGroup(t,r,n){if(r.length===0)return m;let o=r.slice(0,ml),s=r.length-o.length;return d`<section class="${`bundle-compare-group bundle-compare-${n}`}"><header class="bundle-compare-group-head"><span class="bundle-compare-dot" aria-hidden="true"></span> <span class="bundle-compare-group-title">${t}</span> <span class="bundle-compare-group-count">${r.length}</span></header><ul class="bundle-compare-rows">${Q(o,i=>i.pkg,i=>d`<li><div class="bundle-compare-row" title="${i.pkg}"><span class="bundle-compare-pkg-dot" style="${ue({background:Xe(i.pkg)})}"></span> <span class="bundle-compare-row-path">${i.pkg}</span> <span class="bundle-compare-dep-ver">${ef(i.versions)}</span></div></li>`)}</ul>${s>0?d`<div class="bundle-compare-more">and ${s.toLocaleString()} more…</div>`:m}</section>`}_renderVersionUpdates(t,r,n){let{updated:o,added:s,removed:i}=t;if(o.length===0&&s.length===0&&i.length===0)return m;let l=o.slice(0,ml),c=o.length-l.length;return d`<section class="bundle-compare-section"><h3 class="bundle-compare-section-head">Dependency updates</h3>${o.length>0?d`<div class="bundle-compare-ver-changes"><header class="bundle-compare-group-head"><span class="bundle-compare-group-title">Updated</span> <span class="bundle-compare-group-count">${o.length}</span></header><ul class="bundle-compare-rows">${Q(l,u=>u.pkg,u=>this._versionRow(u))}</ul>${c>0?d`<div class="bundle-compare-more">and ${c.toLocaleString()} more…</div>`:m}</div>`:m} ${s.length>0||i.length>0?d`<div class="bundle-compare-cols">${this._depGroup(`Removed \xB7 only in ${r}`,i,"removed")} ${this._depGroup(`Added \xB7 only in ${n}`,s,"added")}</div>`:m}</section>`}_diffFor(){let t=`${this.integrity}|${this._targetIntegrity}`;if(this._diffKey!==t||!this._diff){let r=We(this.details),n=We(this._otherDetails),{prefix:o}=it([...r.keys(),...n.keys()]),s=Lr(this.details),i=Lr(this._otherDetails),l=s||i?new Map([...s??[],...i??[]]):null,c=u=>bt(o&&u.startsWith(o)?u.slice(o.length):u,{packageDir:l?.get(u)});this._diff=yw(r,n,c),this._diff.versionUpdates=vw(Es(this.details),Es(this._otherDetails)),this._diffKey=t}return this._diff}_renderSummary(t){let r=t.totals,n=t.versionUpdates.totals,o=n.baseDeps>0||n.otherDeps>0,s=n.otherDeps-n.baseDeps;return d`<div class="bundle-compare-summary"><div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Files</span> <span class="bundle-compare-metric-value">${r.baseFiles.toLocaleString()} → ${r.otherFiles.toLocaleString()}</span> <span class="${`bundle-compare-metric-delta ${Zp(r.fileDelta)}`}">${ww(r.fileDelta)}</span></div><div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Size</span> <span class="bundle-compare-metric-value">${ie(r.baseBytes)} → ${ie(r.otherBytes)}</span> <span class="${`bundle-compare-metric-delta ${Zp(r.byteDelta)}`}">${Qp(r.byteDelta)}${(()=>{let i=NE(r.byteDelta,r.baseBytes);return i?d`${" "}<span class="bundle-compare-pct">(${i})</span>`:m})()}</span></div>${o?d`<div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Deps</span> <span class="bundle-compare-metric-value">${n.baseDeps.toLocaleString()} → ${n.otherDeps.toLocaleString()}</span> <span class="${`bundle-compare-metric-delta ${Zp(s)}`}">${ww(s)}</span></div>`:m}<div class="bundle-compare-chips"><span class="bundle-compare-chip removed">−${r.onlyBaseFiles.toLocaleString()} removed</span> <span class="bundle-compare-chip added">+${r.onlyOtherFiles.toLocaleString()} added</span> <span class="bundle-compare-chip changed">${r.changedFiles.toLocaleString()} changed</span> <span class="bundle-compare-chip unchanged">${r.unchangedFiles.toLocaleString()} unchanged</span></div></div>`}_renderPicker(t,r){let n=this._nameFor(this.integrity);return d`<div class="bundle-compare-picker"><span class="bundle-compare-base" title="${n}">${n}</span> <span class="bundle-compare-arrow" aria-hidden="true">→</span> <label class="bundle-compare-select-wrap"><span class="bundle-compare-select-hint">Compare with</span> <select class="bundle-compare-select" .value="${Se(this._targetIntegrity??"")}" @change="${o=>this._onPick(o)}" aria-label="Bundle to compare with"><option value="">Choose a bundle…</option>${t.map(o=>d`<option value="${o.integrity}">${o.label}</option>`)}</select></label> ${r?d`<button type="button" class="bundle-compare-swap" @click="${()=>this._swap()}" aria-label="Swap the two bundles"><span class="bundle-compare-swap-icon" aria-hidden="true">↔</span>Swap</button>`:m}</div>`}_otherOptions(){let t=(a.bundles??[]).filter(n=>n.integrity!==this.integrity),r=new Map;for(let n of t)r.set(n.name,(r.get(n.name)??0)+1);return t.map(n=>({integrity:n.integrity,label:r.get(n.name)>1?`${n.name} \xB7 ${n.integrity.slice(7,13)}\u2026`:n.name}))}render(){let t=this._otherOptions(),r=!!this._targetIntegrity&&t.some(i=>i.integrity===this._targetIntegrity),n=t.length>0?this._renderPicker(t,r):m,o=r&&this._status==="ready"&&this._otherDetails&&(this._otherDetails.json||this._otherDetails.bundle)&&!this._otherDetails.error,s;return this._baseReady?t.length===0?s=d`<div class="bundle-compare-empty">No other bundles to compare with. Drop a second <code>.map</code> or <code>.stasis.code.br</code> bundle to diff against this one.</div>`:r?this._status==="loading"||!this._otherDetails?s=d`<div class="bundle-compare-empty">Comparing…</div>`:this._otherDetails.error?s=d`<div class="bundle-compare-empty is-error">Couldn't read the selected bundle: ${this._otherDetails.error}</div>`:!this._otherDetails.json&&!this._otherDetails.bundle?s=d`<div class="bundle-compare-empty is-error">The selected bundle couldn't be parsed.</div>`:s=this._renderDiff():s=d`<div class="bundle-compare-empty">Pick a bundle above to compare against <strong>${this._nameFor(this.integrity)}</strong>.</div>`:s=d`<div class="bundle-compare-empty">Loading bundle…</div>`,d`<div class="bundle-compare"><header class="bundle-compare-head">${n} ${this._baseReady&&o?this._renderSummary(this._diffFor()):m}</header><div class="bundle-compare-body">${s}</div></div>`}_renderDiff(){let t=this._diffFor(),r=this._nameFor(this._targetIntegrity),n=this._nameFor(this.integrity),o=[...t.files.onlyBase.map(p=>p.path),...t.files.onlyOther.map(p=>p.path),...t.files.changed.map(p=>p.path)],{prefix:s,stripped:i}=it(o),l=new Map;for(let p=0;p<o.length;p++)l.set(o[p],i[p]);let c=p=>l.get(p)??p,u=t.packages.onlyOther.length>0||t.packages.onlyBase.length>0||t.packages.changed.length>0;return d`<div class="bundle-compare-caption">Changes from <strong>${n}</strong> to <strong>${r}</strong> ${s?d`· <span class="mono">${s}</span>`:m}</div>${this._renderVersionUpdates(t.versionUpdates,n,r)} ${t.totals.identical?d`<div class="bundle-compare-identical">These two bundles carry identical sources (${t.totals.unchangedFiles.toLocaleString()} ${t.totals.unchangedFiles===1?"file":"files"}).</div>`:d`${u?d`<section class="bundle-compare-section"><h3 class="bundle-compare-section-head">Packages</h3><div class="bundle-compare-cols">${this._pkgGroup(`Removed \xB7 only in ${n}`,t.packages.onlyBase,"removed")} ${this._pkgGroup(`Added \xB7 only in ${r}`,t.packages.onlyOther,"added")} ${this._pkgGroup("Changed size",t.packages.changed,"changed")}</div></section>`:m}<section class="bundle-compare-section"><h3 class="bundle-compare-section-head">Files</h3><div class="bundle-compare-cols bundle-compare-cols--files">${this._fileGroup(`Removed \xB7 only in ${n}`,t.files.onlyBase,"removed",!0,c)} ${this._fileGroup(`Added \xB7 only in ${r}`,t.files.onlyOther,"added",!1,c)} ${this._fileGroup("Changed",t.files.changed,"changed",!0,c)}</div></section>`}`}};customElements.define("bundle-compare",tf);var DE=d`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M6 9V2h12v7"/><path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"/><rect x="6" y="14" width="12" height="8"/></svg>`,rf=class extends z{createRenderRoot(){return this}render(){return a.reports.length>0&&a.currentView==="findings"&&a.viewMode!=="graph"&&a.viewMode!=="kanban"?d`<button type="button" title="print this report" aria-label="print" @click="${this._onClick}">${DE}</button>`:m}_onClick=()=>{this.dispatchEvent(new CustomEvent("print-requested",{bubbles:!0,composed:!0}))}};customElements.define("print-button",rf);var zE=d`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/></svg>`,nf=class extends z{createRenderRoot(){return this}render(){return a.reports.length>0&&a.currentView==="findings"&&a.viewMode!=="graph"&&a.viewMode!=="kanban"?d`<button type="button" title="download this report" aria-label="download" @click="${this._onClick}">${zE}</button>`:m}_onClick=()=>{this.dispatchEvent(new CustomEvent("download-requested",{bubbles:!0,composed:!0}))}};customElements.define("download-button",nf);function Xs(e){let t=new Map;for(let[r,n]of a.triage)n[e]&&t.set(r,n[e]);return t}var UE={get markers(){return Xs("color")},get triageState(){return Xs("triage")},get comments(){return Xs("comment")},get fixes(){return Xs("fix")},get flags(){return Xs("flagged")},get(e){let t=a.triage.get(e),r={};return t?.color&&(r.color=t.color),t?.triage&&(r.triage=t.triage),t?.comment&&(r.comment=t.comment),t?.fix&&(r.fix=t.fix),t?.flagged!==void 0&&(r.flagged=t.flagged),r},async set(e,{color:t,triage:r,comment:n,fix:o,flagged:s}={}){let i=!1;if(t!==void 0&&(t===null||t===""?U(a.triage,e,{color:void 0})&&(i=!0):a.triage.get(e)?.color!==t&&(U(a.triage,e,{color:t}),i=!0)),r!==void 0)if(r===null||r===""||r===!1)U(a.triage,e,{triage:void 0})&&(i=!0);else if(r==="inprogress"||r==="fixed"||r==="invalid"||r==="deleted")a.triage.get(e)?.triage!==r&&(U(a.triage,e,{triage:r}),i=!0);else throw new TypeError(`DeepView.triage.set: unknown triage value ${JSON.stringify(r)} (expected 'inprogress' | 'fixed' | 'invalid' | 'deleted' | null)`);if(n!==void 0){let l=n?String(n):"";l?a.triage.get(e)?.comment!==l&&(U(a.triage,e,{comment:l}),i=!0):U(a.triage,e,{comment:void 0})&&(i=!0)}if(o!==void 0){let l=o?String(o):"";l?a.triage.get(e)?.fix!==l&&(U(a.triage,e,{fix:l}),i=!0):U(a.triage,e,{fix:void 0})&&(i=!0)}if(s!==void 0){let l=s===null||s===""?void 0:!!s;a.triage.get(e)?.flagged!==l&&(U(a.triage,e,{flagged:l}),i=!0)}return i&&(await fe(),x()),i}};window.DeepView={get reports(){return a.reports.slice()},get groups(){return St()},get findings(){return St().flat()},get currentFile(){return a.currentFile},get currentWorkspace(){return a.currentWorkspace},triage:UE,themes:Dv,setTheme:Pv,get theme(){return Nv()},triageSync:N,refresh(){x()},export(){return Jv()}};var HE={default:se.default,"claude-security":se["claude-security"],"codex-security":se["codex-security"],deepsec:se.deepsec,piolium:se.piolium,bundle:to,workspace:Oa};for(let e of document.querySelectorAll(".drop-supported-icon[data-icon]")){let t=HE[e.dataset.icon];t&&(e.innerHTML=t)}Rm(x);ad(x);Tm(x);N.onStatusChange(x);Em(async(e,t)=>{a.currentWorkspace===e?await Ct(e):a.currentFile&&a.currentFile===t?await Ze(t):await j()});Am(async()=>{await j(),a.currentView==="bundles"&&x()});fv();mv();async function Sw(){let e=Sd();if(!e)return!1;try{history.replaceState(null,"",location.pathname)}catch{}let t;try{t=await bv({encoded:e})}catch(n){return alert(`Couldn't open the share-link unlock prompt: ${n.message}`),!1}if(!t)return!1;let r=await Yc({id:t.id,name:t.name,privateKey:t.privateKeyBase64});if(r.status==="already-attached")return alert(`This workspace is already attached as "${r.workspace.name}".`),!1;if(r.status==="name-collision"){let n=r.existing?.name;return alert(n?`A workspace named "${n}" already exists. Open the share link again and pick a different name.`:"The shared workspace name is empty or invalid. Ask the sender to re-share with a real name."),!1}return r.workspace?.id?await Ct(r.workspace.id):await j(),!0}async function Cw(){let e=ta();if(!e)return!1;try{history.replaceState(null,"",location.pathname)}catch{}let t=await uv(e);return t.ok?!0:(alert(t.reason),!1)}var mo=!1;async function Ew(){if(mo||(mo=!0,await mr(),jc(),await j(),await Sw())||await Cw())return;let r=Ie(Pr);if(r)if(r.startsWith("ws:")){let n=r.slice(3);K().some(o=>o.id===n)&&await Ct(n)}else if(r.startsWith("b:")){let n=r.slice(2),o=n.indexOf(" "),s=o>=0?n.slice(0,o):n,i=o>=0?n.slice(o+1):"",l=Ms.has(i)?i:"overview";(a.bundles??[]).some(c=>c.integrity===s)&&(a.currentView="bundles",a.selectedBundle=s,a.bundleDetails=null,a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.bundleCodeSearchQuery="",a.bundleCodeSearchMode="files",a.bundleSearchQuery="",a.bundleSearchRegex=!1,a.bundleSearchCase=!1,a.bundleSearchContext=!0,a.bundleDetailsTab=l,a.shownTriage=null,A.showAll=!0,x(),nr(s))}else(await ce()).includes(r)&&await Ze(r)}var $w=ae(),xw=!1;function _w(e){xw||(xw=!0,queueMicrotask(()=>{alert(e+" This tab will reload to refresh its state. Any unsaved edits in this tab will be lost."),location.reload()}))}Me(()=>{let e=$w,t=ae();if($w=t,x(),!mo&&$t()){Ew().catch(r=>console.warn("continueBoot:",r));return}if(mo&&t&&!$t()){_w("Encryption was just enabled in another tab.");return}mo&&e&&!t&&!Hl()&&_w("Encryption was disabled in another tab.")});window.addEventListener("hashchange",()=>{mo&&(async()=>{await Sw()||await Cw()})().catch(e=>console.warn("deep-link hashchange:",e))});(async()=>{if(!await gv()){try{let e=window.matchMedia?.("(display-mode: window-controls-overlay)").matches;if(!e&&a.serverMode!=="managed"&&localStorage.getItem("deepview.sidebarCollapsed")==="1"&&Wf.classList.add("collapsed"),window.matchMedia?.("(display-mode: standalone)").matches||e){let r=document.querySelector('meta[name="viewport"]');r&&r.setAttribute("content","width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"),window.addEventListener("wheel",n=>{(n.ctrlKey||n.metaKey)&&n.preventDefault()},{passive:!1}),window.addEventListener("keydown",n=>{(n.ctrlKey||n.metaKey)&&(n.key==="="||n.key==="+"||n.key==="-"||n.key==="0")&&n.preventDefault()})}}catch{}ae()&&!$t()||await Ew()}})();
129
149
  /*! Bundled license information:
130
150
 
131
151
  @lit/reactive-element/css-tag.js: