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

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,75 +1,90 @@
1
- var Ns=globalThis,Us=Ns.ShadowRoot&&(Ns.ShadyCSS===void 0||Ns.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,_p=Symbol(),xp=new WeakMap,zs=class{constructor(t,r,n){if(this._$cssResult$=!0,n!==_p)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(Us&&t===void 0){let n=r!==void 0&&r.length===1;n&&(t=xp.get(r)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&xp.set(r,t))}return t}toString(){return this.cssText}},F=e=>new zs(typeof e=="string"?e:e+"",void 0,_p);var Sp=(e,t)=>{if(Us)e.adoptedStyleSheets=t.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet);else for(let r of t){let n=document.createElement("style"),o=Ns.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=r.cssText,e.appendChild(n)}},qa=Us?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:lv,defineProperty:cv,getOwnPropertyDescriptor:dv,getOwnPropertyNames:uv,getOwnPropertySymbols:pv,getPrototypeOf:fv}=Object,Hs=globalThis,Cp=Hs.trustedTypes,hv=Cp?Cp.emptyScript:"",gv=Hs.reactiveElementPolyfillSupport,oo=(e,t)=>e,Ga={toAttribute(e,t){switch(t){case Boolean:e=e?hv: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}},Ap=(e,t)=>!lv(e,t),Ep={attribute:!0,type:String,converter:Ga,reflect:!1,useDefault:!1,hasChanged:Ap};Symbol.metadata??=Symbol("metadata"),Hs.litPropertyMetadata??=new WeakMap;var Lt=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=Ep){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&&cv(this.prototype,t,o)}}static getPropertyDescriptor(t,r,n){let{get:o,set:s}=dv(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)??Ep}static _$Ei(){if(this.hasOwnProperty(oo("elementProperties")))return;let t=fv(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(oo("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(oo("properties"))){let r=this.properties,n=[...uv(r),...pv(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(qa(o))}else t!==void 0&&r.push(qa(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 Sp(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:Ga).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:Ga;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??Ap)(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){}};Lt.elementStyles=[],Lt.shadowRootOptions={mode:"open"},Lt[oo("elementProperties")]=new Map,Lt[oo("finalized")]=new Map,gv?.({ReactiveElement:Lt}),(Hs.reactiveElementVersions??=[]).push("2.1.2");var Ja=globalThis,Tp=e=>e,Vs=Ja.trustedTypes,Ip=Vs?Vs.createPolicy("lit-html",{createHTML:e=>e}):void 0,Xa="$lit$",Ot=`lit$${Math.random().toFixed(9).slice(2)}$`,Qa="?"+Ot,mv=`<${Qa}>`,Nr=document,io=()=>Nr.createComment(""),ao=e=>e===null||typeof e!="object"&&typeof e!="function",Za=Array.isArray,Op=e=>Za(e)||typeof e?.[Symbol.iterator]=="function",Ya=`[
2
- \f\r]`,so=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Rp=/-->/g,Mp=/>/g,Pr=RegExp(`>|${Ya}(?:([^\\s"'>=/]+)(${Ya}*=${Ya}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Bp=/'/g,Fp=/"/g,Pp=/^(?:script|style|textarea|title)$/i,el=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),c=el(1),er=el(2),yS=el(3),be=Symbol.for("lit-noChange"),g=Symbol.for("lit-nothing"),Lp=new WeakMap,Dr=Nr.createTreeWalker(Nr,129);function Dp(e,t){if(!Za(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ip!==void 0?Ip.createHTML(t):t}var Np=(e,t)=>{let r=e.length-1,n=[],o,s=t===2?"<svg>":t===3?"<math>":"",i=so;for(let l=0;l<r;l++){let d=e[l],u,p,f=-1,h=0;for(;h<d.length&&(i.lastIndex=h,p=i.exec(d),p!==null);)h=i.lastIndex,i===so?p[1]==="!--"?i=Rp:p[1]!==void 0?i=Mp:p[2]!==void 0?(Pp.test(p[2])&&(o=RegExp("</"+p[2],"g")),i=Pr):p[3]!==void 0&&(i=Pr):i===Pr?p[0]===">"?(i=o??so,f=-1):p[1]===void 0?f=-2:(f=i.lastIndex-p[2].length,u=p[1],i=p[3]===void 0?Pr:p[3]==='"'?Fp:Bp):i===Fp||i===Bp?i=Pr:i===Rp||i===Mp?i=so:(i=Pr,o=void 0);let b=i===Pr&&e[l+1].startsWith("/>")?" ":"";s+=i===so?d+mv:f>=0?(n.push(u),d.slice(0,f)+Xa+d.slice(f)+Ot+b):d+Ot+(f===-2?l:b)}return[Dp(e,s+(e[r]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),n]},lo=class e{constructor({strings:t,_$litType$:r},n){let o;this.parts=[];let s=0,i=0,l=t.length-1,d=this.parts,[u,p]=Np(t,r);if(this.el=e.createElement(u,n),Dr.currentNode=this.el.content,r===2||r===3){let f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(o=Dr.nextNode())!==null&&d.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(let f of o.getAttributeNames())if(f.endsWith(Xa)){let h=p[i++],b=o.getAttribute(f).split(Ot),m=/([.?@])?(.*)/.exec(h);d.push({type:1,index:s,name:m[2],strings:b,ctor:m[1]==="."?Ws:m[1]==="?"?Ks:m[1]==="@"?qs:Ur}),o.removeAttribute(f)}else f.startsWith(Ot)&&(d.push({type:6,index:s}),o.removeAttribute(f));if(Pp.test(o.tagName)){let f=o.textContent.split(Ot),h=f.length-1;if(h>0){o.textContent=Vs?Vs.emptyScript:"";for(let b=0;b<h;b++)o.append(f[b],io()),Dr.nextNode(),d.push({type:2,index:++s});o.append(f[h],io())}}}else if(o.nodeType===8)if(o.data===Qa)d.push({type:2,index:s});else{let f=-1;for(;(f=o.data.indexOf(Ot,f+1))!==-1;)d.push({type:7,index:s}),f+=Ot.length-1}s++}}static createElement(t,r){let n=Nr.createElement("template");return n.innerHTML=t,n}};function zr(e,t,r=e,n){if(t===be)return t;let o=n!==void 0?r._$Co?.[n]:r._$Cl,s=ao(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=zr(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??Nr).importNode(r,!0);Dr.currentNode=o;let s=Dr.nextNode(),i=0,l=0,d=n[0];for(;d!==void 0;){if(i===d.index){let u;d.type===2?u=new pn(s,s.nextSibling,this,t):d.type===1?u=new d.ctor(s,d.name,d.strings,this,t):d.type===6&&(u=new Gs(s,this,t)),this._$AV.push(u),d=n[++l]}i!==d?.index&&(s=Dr.nextNode(),i++)}return Dr.currentNode=Nr,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++}},pn=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=zr(this,t,r),ao(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):Op(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&&ao(this._$AH)?this._$AA.nextSibling.data=t:this.T(Nr.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=lo.createElement(Dp(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=Lp.get(t.strings);return r===void 0&&Lp.set(t.strings,r=new lo(t)),r}k(t){Za(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(io()),this.O(io()),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=Tp(t).nextSibling;Tp(t).remove(),t=n}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},Ur=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=zr(this,t,r,0),i=!ao(t)||t!==this._$AH&&t!==be,i&&(this._$AH=t);else{let l=t,d,u;for(t=s[0],d=0;d<s.length-1;d++)u=zr(this,l[n+d],r,d),u===be&&(u=this._$AH[d]),i||=!ao(u)||u!==this._$AH[d],u===g?t=g:t!==g&&(t+=(u??"")+s[d+1]),this._$AH[d]=u}i&&!o&&this.j(t)}j(t){t===g?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Ws=class extends Ur{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===g?void 0:t}},Ks=class extends Ur{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==g)}},qs=class extends Ur{constructor(t,r,n,o,s){super(t,r,n,o,s),this.type=5}_$AI(t,r=this){if((t=zr(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)}},Gs=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){zr(this,t)}},zp={M:Xa,P:Ot,A:Qa,C:1,L:Np,R:js,D:Op,V:zr,I:pn,H:Ur,N:Ks,U:qs,B:Ws,F:Gs},bv=Ja.litHtmlPolyfillSupport;bv?.(lo,pn),(Ja.litHtmlVersions??=[]).push("3.3.3");var q=(e,t,r)=>{let n=r?.renderBefore??t,o=n._$litPart$;if(o===void 0){let s=r?.renderBefore??null;n._$litPart$=o=new pn(t.insertBefore(io(),s),s,void 0,r??{})}return o._$AI(e),o};var tl=globalThis,Q=class extends Lt{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=q(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,tl.litElementHydrateSupport?.({LitElement:Q});var yv=tl.litElementPolyfillSupport;yv?.({LitElement:Q});(tl.litElementVersions??=[]).push("4.2.2");var Ne={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},$t=e=>(...t)=>({_$litDirective$:e,values:t}),st=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 B=$t(class extends st{constructor(e){if(super(e),e.type!==Ne.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:vv}=zp,Up=e=>e;var Vp=e=>e.strings===void 0,Hp=()=>document.createComment(""),fn=(e,t,r)=>{let n=e._$AA.parentNode,o=t===void 0?e._$AB:t._$AA;if(r===void 0){let s=n.insertBefore(Hp(),o),i=n.insertBefore(Hp(),o);r=new vv(s,i,e,e.options)}else{let s=r._$AB.nextSibling,i=r._$AM,l=i!==e;if(l){let d;r._$AQ?.(e),r._$AM=e,r._$AP!==void 0&&(d=e._$AU)!==i._$AU&&r._$AP(d)}if(s!==o||l){let d=r._$AA;for(;d!==s;){let u=Up(d).nextSibling;Up(n).insertBefore(d,o),d=u}}}return r},tr=(e,t,r=e)=>(e._$AI(t,r),e),wv={},Ys=(e,t=wv)=>e._$AH=t,jp=e=>e._$AH,Js=e=>{e._$AR(),e._$AA.remove()};var Wp=(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 st{constructor(e){if(super(e),e.type!==Ne.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=jp(e),{values:s,keys:i}=this.dt(t,r,n);if(!Array.isArray(o))return this.ut=i,s;let l=this.ut??=[],d=[],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])d[b]=tr(o[f],s[b]),f++,b++;else if(l[h]===i[m])d[m]=tr(o[h],s[m]),h--,m--;else if(l[f]===i[m])d[m]=tr(o[f],s[m]),fn(e,d[m+1],o[f]),f++,m--;else if(l[h]===i[b])d[b]=tr(o[h],s[b]),fn(e,o[f],o[h]),h--,b++;else if(u===void 0&&(u=Wp(i,b,m),p=Wp(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=fn(e,o[f]);tr(y,s[b]),d[b]=y}else d[b]=tr(w,s[b]),fn(e,o[f],w),o[v]=null;b++}else Js(o[h]),h--;else Js(o[f]),f++;for(;b<=m;){let v=fn(e,d[m+1]);tr(v,s[b]),d[b++]=v}for(;f<=h;){let v=o[f++];v!==null&&Js(v)}return this.ut=i,Ys(e,d),be}});var Kp="important",kv=" !"+Kp,de=$t(class extends st{constructor(e){if(super(e),e.type!==Ne.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(kv);n.includes("-")||s?r.setProperty(n,s?o.slice(0,-11):o,s?Kp:""):r[n]=o}}return be}});var sl=new WeakMap,Jp=Symbol("iteration key");function $v(e){sl.set(e,new Map)}function xv(e,{target:t,key:r,type:n}){n==="iterate"&&(r=Jp);let o=sl.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 _v({target:e,key:t,type:r}){let n=sl.get(e),o=new Set;if(r==="clear"?n.forEach((s,i)=>{rl(o,n,i)}):rl(o,n,t),r==="add"||r==="delete"||r==="clear"){let s=Array.isArray(e)?"length":Jp;rl(o,n,s)}return o}function rl(e,t,r){let n=t.get(r);n&&n.forEach(e.add,e)}function Xp(e){e.cleaners&&e.cleaners.forEach(Sv,e),e.cleaners=[]}function Sv(e){e.delete(this)}var hn=[],nl=!1;function Cv(e,t,r,n){if(e.unobserved)return Reflect.apply(t,r,n);if(hn.indexOf(e)===-1){Xp(e);try{return hn.push(e),Reflect.apply(t,r,n)}finally{hn.pop()}}}function mt(e){let t=hn[hn.length-1];t&&(Qp(t,e),xv(t,e))}function rr(e){_v(e).forEach(Ev,e)}function Ev(e){Qp(e,this),typeof e.scheduler=="function"?e.scheduler(e):typeof e.scheduler=="object"?e.scheduler.add(e):e()}function Qp(e,t){if(e.debugger&&!nl)try{nl=!0,e.debugger(t)}finally{nl=!1}}function Zp(){return hn.length>0}var qp=Symbol("is reaction");function ef(e,t={}){let r=e[qp]?e:function n(){return Cv(n,e,this,arguments)};return r.scheduler=t.scheduler,r.debugger=t.debugger,r[qp]=!0,t.lazy||r(),r}function il(e){e.unobserved||(e.unobserved=!0,Xp(e)),typeof e.scheduler=="object"&&e.scheduler.delete(e)}var Fe=new WeakMap,Zs=new WeakMap,Av=Object.prototype.hasOwnProperty;function Qs(e){let t=Zs.get(e);return Zp()&&typeof e=="object"&&e!==null?t||ei(e):t||e}function ol(e,t){let r=e.next;return e.next=()=>{let{done:n,value:o}=r.call(e);return n||(t?o[1]=Qs(o[1]):o=Qs(o)),{done:n,value:o}},e}var Gp={has(e){let t=Fe.get(this),r=Reflect.getPrototypeOf(this);return mt({target:t,key:e,type:"has"}),r.has.apply(t,arguments)},get(e){let t=Fe.get(this),r=Reflect.getPrototypeOf(this);return mt({target:t,key:e,type:"get"}),Qs(r.get.apply(t,arguments))},add(e){let t=Fe.get(this),r=Reflect.getPrototypeOf(this),n=r.has.call(t,e),o=r.add.apply(t,arguments);return n||rr({target:t,key:e,value:e,type:"add"}),o},set(e,t){let r=Fe.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&&rr({target:r,key:e,value:t,oldValue:s,type:"set"}):rr({target:r,key:e,value:t,type:"add"}),i},delete(e){let t=Fe.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&&rr({target:t,key:e,oldValue:o,type:"delete"}),s},clear(){let e=Fe.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&&rr({target:e,oldTarget:n,type:"clear"}),o},forEach(e,...t){let r=Fe.get(this),n=Reflect.getPrototypeOf(this);mt({target:r,type:"iterate"});let o=(s,...i)=>e(Qs(s),...i);return n.forEach.call(r,o,...t)},keys(){let e=Fe.get(this),t=Reflect.getPrototypeOf(this);return mt({target:e,type:"iterate"}),t.keys.apply(e,arguments)},values(){let e=Fe.get(this),t=Reflect.getPrototypeOf(this);mt({target:e,type:"iterate"});let r=t.values.apply(e,arguments);return ol(r,!1)},entries(){let e=Fe.get(this),t=Reflect.getPrototypeOf(this);mt({target:e,type:"iterate"});let r=t.entries.apply(e,arguments);return ol(r,!0)},[Symbol.iterator](){let e=Fe.get(this),t=Reflect.getPrototypeOf(this);mt({target:e,type:"iterate"});let r=t[Symbol.iterator].apply(e,arguments);return ol(r,e instanceof Map)},get size(){let e=Fe.get(this),t=Reflect.getPrototypeOf(this);return mt({target:e,type:"iterate"}),Reflect.get(t,"size",e)}},Xs={get(e,t,r){return e=Av.call(Gp,t)?Gp:e,Reflect.get(e,t,r)}},Yp=typeof window=="object"?window:Function("return this")(),tf=new Map([[Map,Xs],[Set,Xs],[WeakMap,Xs],[WeakSet,Xs],[Object,!1],[Array,!1],[Int8Array,!1],[Uint8Array,!1],[Uint8ClampedArray,!1],[Int16Array,!1],[Uint16Array,!1],[Int32Array,!1],[Uint32Array,!1],[Float32Array,!1],[Float64Array,!1]]);function Tv({constructor:e}){return!(typeof e=="function"&&e.name in Yp&&Yp[e.name]===e)||tf.has(e)}function Iv(e){return tf.get(e.constructor)}var rf=Object.prototype.hasOwnProperty,Rv=new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(e=>typeof e=="symbol"));function Mv(e,t,r){let n=Reflect.get(e,t,r);if(typeof t=="symbol"&&Rv.has(t))return n;mt({target:e,key:t,receiver:r,type:"get"});let o=Zs.get(n);if(Zp()&&typeof n=="object"&&n!==null){if(o)return o;let s=Reflect.getOwnPropertyDescriptor(e,t);if(!s||!(s.writable===!1&&s.configurable===!1))return ei(n)}return o||n}function Bv(e,t){let r=Reflect.has(e,t);return mt({target:e,key:t,type:"has"}),r}function Fv(e){return mt({target:e,type:"iterate"}),Reflect.ownKeys(e)}function Lv(e,t,r,n){typeof r=="object"&&r!==null&&(r=Fe.get(r)||r);let o=rf.call(e,t),s=e[t],i=Reflect.set(e,t,r,n);return e!==Fe.get(n)||(o?r!==s&&rr({target:e,key:t,value:r,oldValue:s,receiver:n,type:"set"}):rr({target:e,key:t,value:r,receiver:n,type:"add"})),i}function Ov(e,t){let r=rf.call(e,t),n=e[t],o=Reflect.deleteProperty(e,t);return r&&rr({target:e,key:t,oldValue:n,type:"delete"}),o}var Pv={get:Mv,has:Bv,ownKeys:Fv,set:Lv,deleteProperty:Ov};function ei(e={}){return Fe.has(e)||!Tv(e)?e:Zs.get(e)||Dv(e)}function Dv(e){let t=Iv(e)||Pv,r=new Proxy(e,t);return Zs.set(e,r),Fe.set(r,e),$v(e),r}var nf=ei;function al(e){let t=!0,r=ef(()=>{try{e(t)}finally{t=!1}},{lazy:!0});try{r()}catch(n){throw il(r),n}return()=>il(r)}var z=class extends Q{_disposers=[];observes=null;connectedCallback(){super.connectedCallback(),this.bindState()}bindState(){if(this.observes){this._disposers.push(al(t=>{this.observes(),t||this.requestUpdate()}));return}this._render||(this._render=this.render,this.render=()=>{let t,r=al(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:c,nothing:g,render:q,unsafeCSS:F,StateElement:z,classMap:B,repeat:J,styleMap:de};var fe=document.querySelector("#drop-zone"),E=document.querySelector("#report"),of=document.querySelector("app-sidebar");function Pt(e,t){let r=URL.createObjectURL(e),n=document.createElement("span");n.style.display="none",q(c`<a href="${r}" download="${t}"></a>`,n),document.body.append(n),n.firstElementChild.click(),n.remove(),URL.revokeObjectURL(r)}function xt(e){return new Error("Another dialog is already open. Close it and try again.",{cause:e})}var Nv="solidity-bundle",zv="0.0.0";function gn(e){if(e?.name!==Nv)return!1;let t=e.version;return!t||t===zv}function af(e){let t=e?.package?.npm,r=t?.version;if(typeof r=="string"&&r&&!gn(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 ti(){return{keys:new Set,findings:[],files:new Map,reports:new Set,_keyReports:new Map}}function ri(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 ni(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 oi(e){let t=new Set;for(let r of e._keyReports.values())for(let n of r)t.add(n);e.reports=t}function lf(e,t,r,n,o){let s=e.byVersion.get(t);s||(s=ti(),e.byVersion.set(t,s)),ri(s,n,o,r)}function cf(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&&ni(i,r,n,s)),i._keyReports.size===0){e.byVersion.delete(t);return}oi(i)}function ll(e,t){if(e===t)return 0;if(e===null)return 1;if(t===null)return-1;let[r,n=""]=sf(e,"-"),[o,s=""]=sf(t,"-"),i=r.split("."),l=o.split("."),d=Math.max(i.length,l.length);for(let u=0;u<d;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 sf(e,t){let r=e.indexOf(t);return r<0?[e,""]:[e.slice(0,r),e.slice(r+1)]}var Uv=new TextEncoder,Hv=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function oe(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 Uv.encode(e)}function $e(e){if(!ArrayBuffer.isView(e)&&!(e instanceof ArrayBuffer))throw new TypeError(`decodeUtf8 expects a BufferSource, got ${e===null?"null":typeof e}`);return Hv.decode(e)}async function co(e){let t=new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(t).arrayBuffer())}async function _t(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:d,done:u}=await n.read();if(u)break;if(s+=d.length,s>t){try{await n.cancel()}catch{}throw new Error(`gunzipBytes: decompressed size exceeds ${t}-byte cap`)}o.push(d)}let i=new Uint8Array(s),l=0;for(let d of o)i.set(d,l),l+=d.length;return i}async function si(e){return await co(oe(e))}async function uo(e){return $e(await _t(e))}async function df(e){let t=await crypto.subtle.digest("SHA-512",e);return`sha512-${new Uint8Array(t).toBase64()}`}var bt=new Uint8Array([68,86,69,49]),mn=12,Vv=32,jv="deepview-passkey.v1.content-key";function po(){return!(typeof window>"u"||typeof PublicKeyCredential>"u"||typeof navigator>"u"||!navigator.credentials)}async function uf(){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 ii(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),t}async function cl(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:oe(jv)},t,Vv*8);return new Uint8Array(r)}function dl(e){return crypto.subtle.importKey("raw",e,{name:"AES-GCM"},!1,["encrypt","decrypt"])}async function nr(e,t,r){let n=ii(mn),o=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:n,additionalData:r},e,t)),s=new Uint8Array(bt.length+mn+o.length);return s.set(bt,0),s.set(n,bt.length),s.set(o,bt.length+mn),s}async function Hr(e,t,r){if(!qe(t))throw new Error("passkey: missing envelope magic");if(t.length<bt.length+mn+16)throw new Error("passkey: envelope too short");let n=t.subarray(bt.length,bt.length+mn),o=t.subarray(bt.length+mn);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 pf(e){if(!po())throw new Error("passkey: not supported in this environment");let t=ii(32),r=ii(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 ul(e){if(!po())throw new Error("passkey: not supported in this environment");let t=ii(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 fo=Object.freeze(["deepview.workspaces","deepview.sync.sessions","deepview.sync.userEnabled","deepview.sync.password","deepview.repoUrls","deepview.fileCounts","deepview.lastFile"]),ze=new Map,li=!1,Dt=new Map,it=new Map,ai=new Set;function bn(e){let t=()=>e();return ai.add(t),li&&queueMicrotask(()=>{if(ai.has(t))try{t()}catch(r){console.warn("secure-storage after-hydrate listener:",r)}}),()=>ai.delete(t)}function Wv(){for(let e of ai)try{e()}catch(t){console.warn("secure-storage after-hydrate listener:",t)}}function ci(e){let t=mf()??"";return oe(`deepview.secure.v1|${t}|${e}`)}function pl(e){try{let t=Uint8Array.fromBase64(e);if(qe(t))return t}catch{}return null}function Ce(e){return ze.get(e)??null}async function Ie(e,t){if(typeof t!="string")throw new TypeError("secure-storage: value must be a string");if(se()&&!Re())throw new Error(`secure-storage: vault locked, cannot save "${e}"`);if(gf())throw new Error(`secure-storage: wipe in progress, cannot save "${e}"`);let r=ze.has(e),n=ze.get(e);ze.set(e,t),it.set(e,t);let o=Dt.get(e)??Promise.resolve(),s=()=>{it.get(e)===t&&it.delete(e)},i=o.catch(()=>{}).then(()=>Kv(e,t)).then(()=>s(),l=>{throw s(),ze.get(e)===t&&(r?ze.set(e,n):ze.delete(e)),l});Dt.set(e,i.catch(()=>{})),await i}async function yn(e){let t=Symbol("secure-storage:removed");ze.delete(e),it.set(e,t);let r=Dt.get(e)??Promise.resolve(),n=()=>{try{localStorage.removeItem(e)}catch{}it.get(e)===t&&(it.delete(e),ze.delete(e))},o=r.catch(()=>{}).then(()=>n());Dt.set(e,o.catch(()=>{})),await o}async function Kv(e,t){let r=Re();if(r){let n=await nr(r,oe(t),ci(e));localStorage.setItem(e,n.toBase64())}else localStorage.setItem(e,t)}async function or(){li||Ee(()=>{or().catch(r=>console.warn("secure-storage rehydrate:",r))}),li=!0;for(let r of[...ze.keys()])it.has(r)||ze.delete(r);let e=Re(),t=[];for(let r of fo){if(it.has(r))continue;let n=localStorage.getItem(r);if(n===null)continue;let o=pl(n);if(o){if(!e)continue;try{let s=await Hr(e,o,ci(r));if(it.has(r))continue;ze.set(r,$e(s))}catch(s){console.warn(`secure-storage: decrypt failed for "${r}":`,s)}}else ze.set(r,n),e&&se()&&t.push([r,n])}Wv(),t.length>0&&queueMicrotask(()=>{for(let[r,n]of t)ze.get(r)===n&&Ie(r,n).catch(o=>{console.warn(`secure-storage: self-heal failed for "${r}":`,o)})})}async function ff(e,t){let r=Dt.get(e)??Promise.resolve(),n=async()=>{if(it.has(e))return;let s=localStorage.getItem(e);if(s===null)return;let i=await t(s);i!==null&&(it.has(e)||(localStorage.setItem(e,i.storageValue),ze.set(e,i.cacheValue)))},o=r.catch(()=>{}).then(n);Dt.set(e,o.catch(()=>{})),await o}async function fl({seal:e}){for(let t of fo)await ff(t,async r=>{if(pl(r))return null;let n=Re();return n?{storageValue:(await nr(n,oe(r),ci(t))).toBase64(),cacheValue:r}:null})}async function hl({open:e}){for(let t of fo)await ff(t,async r=>{let n=pl(r);if(!n)return null;let o=await e(n,ci(t)),s=$e(o);return{storageValue:s,cacheValue:s}})}var qv="deepview.secure.v1.mutate:";function gl(e,t){return fo.includes(e)?navigator.locks.request(qv+e,async()=>{let r=Dt.get(e);r&&await r.catch(()=>{}),await or();let n=Ce(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 Ie(e,o)}}):Promise.reject(new Error(`secure-storage: mutate() called with non-secure key "${e}"`))}async function hf(){await Promise.allSettled([...Dt.values()]),it.clear(),Dt.clear()}typeof window<"u"&&window.addEventListener("storage",e=>{!li||!e.key||!fo.includes(e.key)||or().catch(()=>{})});var mo="deepview.passkey.v1",vn="deepview.passkey.userId",ui="deepview.passkey.cleanDisable",Qe="deepview.passkey.v1.write",Yv="deepview.triage.v1|",Jv="deepview.opfs.v1|",Xv="deepview.bundle.v1|",ae=null,St=null,sr=null,go=0;function yl(){return go>0}var ml=0;function gf(){return ml>0}function Vr(){try{let e=localStorage.getItem(mo);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 bf(e){localStorage.setItem(mo,JSON.stringify(e))}function Qv(){localStorage.removeItem(mo)}function Zv(){try{let t=localStorage.getItem(vn);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(vn,e.toBase64({alphabet:"base64url",omitPadding:!0}))}catch{}return e}function pi(){return typeof location>"u"?"":location.hostname}function se(){return Vr()!==null}function yt(){return ae!==null}function Ct(){return!(!po()||typeof navigator>"u"||!navigator.locks?.request||!pi())}function mf(){return St}function bo(){if(Vr()!==null)return!1;try{return localStorage.getItem(ui)==="1"?!1:localStorage.getItem(vn)!==null}catch{return!1}}function Re(){return ae}function yo(){return oe(Yv+(St??""))}function fi(e){if(typeof e!="string")throw new TypeError("passkey vault: OPFS AAD requires a filename string");return oe(Jv+(St??"")+"|"+e)}function hi(e){if(typeof e!="string")throw new TypeError("passkey vault: bundle AAD requires a slot string");return oe(Xv+(St??"")+"|"+e)}var bl=new Set;function Ee(e){return bl.add(e),()=>bl.delete(e)}function wn(){for(let e of bl)try{e()}catch(t){console.warn("passkey vault listener:",t)}}async function vo({signal:e}={}){let t=Vr();if(!t)return!1;let r;try{r=await ul({credentialId:t.credentialId,prfSalt:t.prfSalt,rpId:t.rpId??pi(),...e?{signal:e}:{}})}catch(o){if(o&&o.name==="NotAllowedError"||o&&o.name==="AbortError")return!1;throw o&&o.message?.includes("PRF")?ho(o):o}if(!r||r.length<32)throw ho();let n=await cl(r);return r.fill(0),navigator.locks.request(Qe,async()=>{let o=Vr();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 ae=await dl(n),n.fill(0),St=o.userId,sr=o.credentialId,wn(),!0})}function ho(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(!po())throw new Error("passkey: WebAuthn unavailable in this environment");if(bo()&&!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=pi();return navigator.locks.request(Qe,async()=>{if(se())throw new Error("passkey: encryption is already enabled");if(await uf()===!1)throw ho();let l=Zv(),d=await pf({userName:t||"DeepView user",userId:l,rpName:r||"DeepView",rpId:s,...n?{signal:n}:{}}),u=d.prfOutput;if(!u)try{u=await ul({credentialId:d.credentialId,prfSalt:d.prfSalt,rpId:s,...n?{signal:n}:{}})}catch(m){let v=l.toBase64({alphabet:"base64url",omitPadding:!0});await di({credentialId:d.credentialId,rpId:s,userId:v}).catch(()=>{});try{localStorage.removeItem(vn)}catch{}throw m&&m.message?.includes("PRF")?ho(m):m}if(!u||u.length<32){let m=l.toBase64({alphabet:"base64url",omitPadding:!0});await di({credentialId:d.credentialId,rpId:s,userId:m}).catch(()=>{});try{localStorage.removeItem(vn)}catch{}throw ho()}let p=await cl(u);u.fill(0);let f=await dl(p);p.fill(0);let h=l.toBase64({alphabet:"base64url",omitPadding:!0}),b={enabled:!0,credentialId:d.credentialId,prfSalt:d.prfSalt,userId:h,rpId:s,createdAt:Date.now()};ae=f,St=h,sr=d.credentialId,bf(b),typeof e=="function"&&await e({seal:(v,w)=>nr(f,v,w)});try{localStorage.removeItem(ui)}catch{}return wn(),!0})}async function wl({migrate:e}){if(!se())return{disabled:!1,signalAttempted:!1};if(!yt())throw new Error("passkey: must unlock before disabling encryption");go+=1;try{return await navigator.locks.request(Qe,async()=>{let t=Vr();if(!t)return{disabled:!1,signalAttempted:!1};let r=ae;if(!r)return{disabled:!1,signalAttempted:!1};if(Qv(),ae=null,sr=null,typeof e=="function"){let o=(s,i)=>Hr(r,s,i);try{await e({open:o})}catch(s){throw bf(t),ae=r,sr=t.credentialId,wn(),s}}St=null;try{localStorage.setItem(ui,"1")}catch{}let n=await di(t).catch(()=>!1);return wn(),{disabled:!0,signalAttempted:n}})}finally{go-=1}}async function di({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 ew(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 tw(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 ew(r,n);o&&t.push(o)}return t}async function wo({refuseIfEnabled:e=!1}={}){go+=1,ml+=1;try{return await navigator.locks.request(Qe,async()=>{if(e&&se())throw new Error("passkey: encryption was just enabled in another tab. Reload this page to unlock instead of wiping.");await hf();let t=Vr();if(t)try{await di({credentialId:t.credentialId,rpId:t.rpId??pi(),userId:t.userId})}catch{}try{localStorage.removeItem(mo)}catch{}try{localStorage.removeItem(vn)}catch{}try{localStorage.removeItem(ui)}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{}ae=null,St=null,sr=null,wn();let r=await tw(["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{go-=1,ml-=1}}function yf(e){return ae?nr(ae,e,yo()):Promise.reject(new Error("passkey: vault locked, cannot seal triage"))}function vf(e){return ae?Hr(ae,e,yo()):Promise.reject(new Error("passkey: vault locked, cannot open triage"))}function gi(e,t){return ae?nr(ae,e,fi(t)):Promise.reject(new Error("passkey: vault locked, cannot seal OPFS file"))}function wf(e,t){return ae?Hr(ae,e,fi(t)):Promise.reject(new Error("passkey: vault locked, cannot open OPFS file"))}function kl(e,t){return ae?nr(ae,e,hi(t)):Promise.reject(new Error("passkey: vault locked, cannot seal bundle"))}function $l(e,t){return ae?Hr(ae,e,hi(t)):Promise.reject(new Error("passkey: vault locked, cannot open bundle"))}typeof window<"u"&&window.addEventListener("storage",e=>{if(e.key!==mo)return;let t=Vr();(!t&&ae||t&&ae&&t.credentialId!==sr)&&(ae=null,St=null,sr=null),wn()});var Sl="__meta__",rw="deepview-reports",Cl="deepview-bundles",ar="deepview.report:",kf=!1;async function El(e,{create:t,warnOnce:r=!1}={}){try{return await(await navigator.storage.getDirectory()).getDirectoryHandle(e,{create:t})}catch(n){return r&&!kf&&(kf=!0,console.warn("OPFS unavailable, falling back to gzipped localStorage (limited quota).",n)),null}}async function bi(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 Al(e,t){if(!qe(e))return e;if(!Re())throw new Error(`storage: vault locked, cannot decrypt "${t}"`);return await wf(e,t)}function yi(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 Tl(e,t){$o(e)===t&&(console.warn(`storage: report "${e}" is an empty/corrupt on-disk entry \u2014 quarantining, will read as missing`),await navigator.locks.request(Qe,{mode:"exclusive"},async()=>{if($o(e)!==t)return;ce(e),at.delete(e);let r=await lr();if(r)try{await r.removeEntry(e)}catch{}vi(e),ce(e),jr(e,"delete")}))}async function Il(e,t,r){try{(await t.getFile()).size===0&&await e.removeEntry(r)}catch{}}async function ko(e,t,r,n,o=()=>{}){if(se()&&!Re())throw o(),new Error(`storage: vault locked, cannot save ${n}`);let s=Re(),i=s?await t(e,r):e;if(Re()!==s)throw o(),new Error(`storage: vault state changed mid-save for ${n}; retry`);return i}function lr(){return El(rw,{create:!0,warnOnce:!0})}function mi(e){try{return localStorage.getItem(ar+e)}catch{return null}}function vi(e){try{localStorage.removeItem(ar+e)}catch{}}function nw(){let e=[];for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);r&&r.startsWith(ar)&&e.push(r.slice(ar.length))}return e}var at=new Map,ir=new Map,xl=new Map;function ce(e){xl.set(e,(xl.get(e)??0)+1)}function $o(e){return xl.get(e)??0}var _l=new Set;function _o(e){return _l.add(e),()=>_l.delete(e)}function jr(e,t){for(let r of _l)try{r(e,t)}catch(n){console.warn("storage file-change listener:",n)}}async function ue(){let e=new Set(nw()),t=await lr();if(t)for await(let[r]of t.entries())e.add(r);return[...e].toSorted()}async function lt(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 ce(e),navigator.locks.request(Qe,{mode:"shared"},async()=>{let r=await lr();if(r){let s=await co(oe(t));s=await ko(s,gi,e,`"${e}"`,()=>ce(e));let i=await r.getFileHandle(e,{create:!0}),l=await i.createWritable();try{await l.write(s),await l.close()}catch(d){at.delete(e),ce(e);try{await l.abort(d)}catch{}throw await Il(r,i,e),d}at.set(e,t),ce(e),vi(e),jr(e,"save");return}let n=oe(t);n=await co(n),n=await ko(n,gi,e,`"${e}"`,()=>ce(e));let o=n.toBase64();try{localStorage.setItem(ar+e,o),at.set(e,t),ce(e),jr(e,"save")}catch(s){throw ce(e),new Error(`localStorage write failed for ${e}: ${s.message}`,{cause:s})}})}async function $f(e,t){let r=mi(e);if(r===null)return null;let n=Uint8Array.fromBase64(r);if(n=await Al(n,e),yi(n))throw await Tl(e,t),new Error(`File not found: ${e}`);return $e(await _t(n))}async function Ue(e){if(at.has(e))return at.get(e);if(ir.has(e))return ir.get(e);let t=$o(e),r=(async()=>{let n=await lr();if(n){let s;try{s=await n.getFileHandle(e)}catch(u){if(u instanceof DOMException&&u.name==="NotFoundError"){let p=await $f(e,t);if(p!==null)return lt(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 Al(l,e),yi(l))throw await Tl(e,t),new Error(`File not found: ${e}`);if(l.length>=2&&l[0]===31&&l[1]===139){let u=await _t(l);return $e(u)}let d=$e(l);return lt(e,d).catch(u=>{console.warn(`storage: legacy-uncompressed migration of "${e}" failed:`,u)}),d}let o=await $f(e,t);if(o===null)throw new Error(`File not found: ${e}`);return o})();ir.set(e,r);try{let n=await r;return $o(e)===t&&at.set(e,n),n}finally{ir.delete(e)}}async function Wr(e){let t=$o(e),r=await lr(),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=mi(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=mi(e);if(o===null)throw new Error(`File not found: ${e}`);n=Uint8Array.fromBase64(o)}if(n=await Al(n,e),yi(n))throw await Tl(e,t),new Error(`File not found: ${e}`);return n}async function So(e,t){if(typeof e!="string"||e.includes("\0"))throw new Error("Invalid report name: contains NUL byte or is not a string");if(yi(t))throw new Error(`Refusing to save empty report bytes for "${e}"`);return ce(e),at.delete(e),navigator.locks.request(Qe,{mode:"shared"},async()=>{let r=await ko(t,gi,e,`"${e}"`,()=>ce(e)),n=await lr();if(n){let o=await n.getFileHandle(e,{create:!0}),s=await o.createWritable();try{await s.write(r),await s.close()}catch(i){ce(e);try{await s.abort(i)}catch{}throw await Il(n,o,e),i}ce(e),vi(e),jr(e,"save");return}try{localStorage.setItem(ar+e,r.toBase64()),ce(e),jr(e,"save")}catch(o){throw ce(e),new Error(`localStorage write failed for ${e}: ${o.message}`,{cause:o})}})}async function kn(e){return ce(e),at.delete(e),ir.delete(e),navigator.locks.request(Qe,{mode:"shared"},async()=>{let t=await lr();if(t){try{await t.removeEntry(e)}catch(r){if(!(r instanceof DOMException)||r.name!=="NotFoundError")throw ce(e),r}vi(e),ce(e),jr(e,"delete");return}localStorage.removeItem(ar+e),ce(e),jr(e,"delete")})}var xo="_meta.json";function Co(){return El(Cl,{create:!0})}function Rl(e){return e.replaceAll("/","_")}async function Ml(e){let t;try{let o=await(await e.getFileHandle(xo)).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(!Re())return console.warn("readBundleMeta: vault locked, returning empty bundle list"),[];try{r=await $l(t,Sl)}catch(o){return console.warn("readBundleMeta: decrypt failed (tampering, key mismatch, or vault identity drift):",o),[]}}try{let n=JSON.parse($e(r));return Array.isArray(n)?n:[]}catch(n){return console.warn("readBundleMeta: JSON.parse failed:",n),[]}}async function xf(e,t){let r=oe(JSON.stringify(t));r=await ko(r,kl,Sl,"bundle metadata");try{await e.removeEntry(xo)}catch{}let n=await e.getFileHandle(xo,{create:!0});await bi(n,r)}var ow=`${Cl}/${xo}`;function _f(e){return navigator.locks.request(ow,e)}async function vt(){let e=await Co();return e?[...await Ml(e)].toSorted((r,n)=>r.name.localeCompare(n.name)):[]}async function Eo(){if(typeof navigator>"u"||!navigator.storage?.getDirectory)return!1;let e=await El(Cl,{create:!1});if(!e)return!1;try{for await(let t of e.entries())return!0}catch{}return!1}async function Kr(e,t){let r=await Co();if(!r)throw new Error(`Cannot save bundle ${e}: OPFS unavailable`);let n=t instanceof Uint8Array?t:oe(t),o=await df(n),s=Rl(o),i=e.toLowerCase().endsWith(".map")?await co(n):n;return navigator.locks.request(Qe,{mode:"shared"},async()=>{i=await ko(i,kl,o,`bundle "${e}"`);try{await r.removeEntry(s)}catch{}let l=await r.getFileHandle(s,{create:!0});await bi(l,i);try{await _f(async()=>{let d=await Ml(r),u=d.findIndex(p=>p.integrity===o);u>=0?d[u]={integrity:o,name:e}:d.push({integrity:o,name:e}),await xf(r,d)})}catch(d){try{await r.removeEntry(s)}catch{}throw d}return{integrity:o,name:e}})}async function Bl(e){let t=await Co();if(t)return navigator.locks.request(Qe,{mode:"shared"},async()=>{try{await t.removeEntry(Rl(e))}catch(r){if(!(r instanceof DOMException)||r.name!=="NotFoundError")throw r}await _f(async()=>{let r=await Ml(t),n=r.filter(o=>o.integrity!==e);n.length!==r.length&&await xf(t,n)})})}async function Nt(e){let t=await Co();if(!t)throw new Error("OPFS unavailable");let n=await(await t.getFileHandle(Rl(e))).getFile(),o=new Uint8Array(await n.arrayBuffer());if(qe(o)){if(!Re())throw new Error(`storage: vault locked, cannot read bundle "${e}"`);o=await $l(o,e)}return o.length>=2&&o[0]===31&&o[1]===139?await _t(o):o}async function sw(e,t){let r=await lr();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(),d=new Uint8Array(await l.arrayBuffer()),u=await t(d);if(u===null)return;at.delete(e),ir.delete(e),ce(e);let p=await r.getFileHandle(e,{create:!0});try{await bi(p,u)}catch(f){throw await Il(r,p,e),f}ce(e);return}}let n=mi(e);if(n===null)return;let o=Uint8Array.fromBase64(n),s=await t(o);s!==null&&(at.delete(e),ir.delete(e),ce(e),localStorage.setItem(ar+e,s.toBase64()),ce(e))}function Sf(e,t){return e.seal?r=>qe(r)?null:e.seal(r,t):r=>qe(r)?e.open(r,t):null}async function Cf(e){let t=await ue();for(let r of t)try{await sw(r,Sf(e,fi(r)))}catch(n){if(n instanceof DOMException&&n.name==="NotFoundError")continue;throw n}}var Fl=({seal:e})=>Cf({seal:e}),Ll=({open:e})=>Cf({open:e});async function iw(){let e=await Co();if(!e)return{dir:null,keys:[]};let t=[];for await(let[r]of e.entries())t.push(r);return{dir:e,keys:t}}function aw(e){return e===xo?Sl:e.startsWith("sha512-")?e.replaceAll("_","/"):null}async function lw(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 bi(l,i)}async function Ef(e){let{dir:t,keys:r}=await iw();if(t)for(let n of r){let o=aw(n);if(o!==null)try{await lw(t,n,Sf(e,hi(o)))}catch(s){if(s instanceof DOMException&&s.name==="NotFoundError")continue;throw s}}}var Ol=({seal:e})=>Ef({seal:e}),Pl=({open:e})=>Ef({open:e});Ee(()=>{at.clear(),ir.clear()});var wi="/api/config";var Af="deepview.sync.serverInfo";function ki(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 zt(){try{let e=localStorage.getItem(Af);return e==null?null:ki(JSON.parse(e))}catch{return null}}function Dl(e){try{localStorage.setItem(Af,JSON.stringify(e))}catch{}}function Nl(e,t){return e==null?"first":e===t?"match":"mismatch"}var xi="deepview.viewMode",_i="deepview.severityMode",$i="deepview.repoUrls",cw=new Set(["grouped","list","table","kanban","focus"]),dw=new Set(["corrected","original"]);function uw(){try{let e=localStorage.getItem(xi);return e!==null&&cw.has(e)?e:null}catch{return null}}function pw(){try{let e=localStorage.getItem(_i);return e!==null&&dw.has(e)?e:null}catch{return null}}function Ul(e){try{let t=JSON.parse(e||"{}");return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function Si(){return Ul(Ce($i))}function Ze(e){return e?Si()[e]??"":""}var zl=new Set;function If(e){return zl.add(e),()=>{zl.delete(e)}}function fw(e){for(let t of zl)try{t(e)}catch(r){console.warn("repo-url listener:",r)}}function et(e,t){if(!e)return;let r=Si();t?r[e]=t:delete r[e],Ie($i,JSON.stringify(r)).catch(n=>console.warn("saveRepoUrlFor:",n)),gl($i,n=>{let o=Ul(n);return t?o[e]=t:delete o[e],JSON.stringify(o)}).catch(n=>console.warn("saveRepoUrlFor cross-tab merge:",n)),fw(e)}async function Rf(e,t){await gl($i,r=>{let n=Ul(r),o=t==="replace"?{...e}:t==="prefer-imported"?{...n,...e}:{...e,...n};return JSON.stringify(o)}),Mf()}var Tf=zt(),a=nf({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:uw()??"table",severityMode:pw()??"corrected",triage:new Map,shownTriage:null,nextFindingId:0,activeTabByGroup:new Map,tableSelectedGid:null,filesViewMode:"table",filesSearch:"",filesSelectedFile:null,kanbanPopoverGid:null,focusGid:null,focusCodeTick:0,serverMode:Tf?.mode??"e2e",managed:Tf?.managed??null,serverModeMismatch:!1,managedSession:null,managedTeams:[]});function Mf(){a.repoEditing||a.currentFile&&(a.repoUrl=Ze(a.currentFile))}bn(()=>{Mf()});var hw=/^## ([A-Z][A-Z_]*)\s*\(\d+\)\s*$/mu;function gw(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 mw(e){if(e)switch(e.toLowerCase()){case"high":return 8;case"medium":return 5;case"low":return 2;default:return}}function bw(e){return typeof e=="string"?e.replace(/^`(.*)`$/u,"$1"):e}function $n(e){let t=e.replaceAll(/\r\n?/gu,`
4
- `).trim();if(!hw.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=gw(r[o]),l=(r[o+1]||"").split(/^### /mu).slice(1);for(let d of l){let u=yw(d,s);u&&n.push(u)}}return n.length===0?null:{type:"security",source:"deepsec",findings:n}}function yw(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,d="";i&&(l=o.slice(0,i.index),d=o.slice(i.index+i[0].length).trim());let u=l.split(`
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
6
  `).filter(v=>!/^\s*- \*\*/u.test(v)).join(`
7
7
  `).replaceAll("**","").trim(),p=n+(u?`
8
8
 
9
- `+u:""),f=bw(s.file||"unknown"),h=(s.lines||"").split(",").map(v=>v.trim()).find(Boolean)||"?",b={file:f,line:h,severity:t,description:p};d&&(b.recommendation=d.replaceAll("**",""));let m=mw(s.confidence);return m!==void 0&&(b.confidence=m),s.slug&&(b.slug=s.slug),b}function Hl(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 Vl(e,t){return e.some(([r,n])=>t>=r&&t<n)}function cr(e,t){let r=Hl(e),n=[...e.matchAll(t)].filter(o=>!Vl(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 vw(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 Ao(e){let t=vw(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 Bf(e){let t=Object.create(null),r=Object.create(null),n=[],o=null,s="",i=[],l="",d=(p,f,h)=>{!p||p in t||(t[p]=h.trim(),r[p]=f)},u=()=>{o&&d(o,s,i.join(`
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(`
11
11
  `)),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;)d(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 Ci(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 d=[...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(d);u&&(d=u[1],o||(o=u[2]));let p=/^(.+):(\d+(?:-\d+)?)$/u.exec(d);return p?(o||(o=p[2]),{file:p[1],line:o,locationLink:r}):{file:d,line:o||"?",locationLink:r}}function jl(e){return e.replaceAll("**","")}function qr(e){let t=(e||"").trim();return/^[-–—]+$/u.test(t)?"":t}function dr(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 To(e){let t=/^([CHML])-?\d+$/iu.exec((e||"").trim());return t?{C:"critical",H:"high",M:"medium",L:"low"}[t[1].toUpperCase()]:""}function Wl(e){let t=/^(critical|high|medium|low|informational|info)(?:[ -](?:severity|risk))?(?:[ -]findings?)?(?:\s*\(\d+\))?$/iu.exec((e||"").trim());return t?dr(t[1]):""}function Ff(e){let t=/^(critical|high|medium|low|informational|info)\b/iu.exec((e||"").trim());return t?dr(t[1]):""}function _n(e){return/^variants?\s*(?:\(\d+\))?\s*:?$/iu.test((e||"").trim())}function xn(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 Ei(e){return(e||"").replaceAll("-"," ")}function Sn(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 Kl(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 d=xn(o[1].trim());return d?{id:d.id,title:o[2].trim()||Ei(d.slug)||d.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=xn(i);if(l){let d=(s===-1?"":t.slice(s+1)).replace(/^[:—–-]+\s*/u,"").trim();return{id:l.id,title:d||Ei(l.slug)||l.id,link:r}}return{id:"",title:t.trim(),link:r}}function Lf(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 ql=["key code reference","key code","code reference","location","affected file","file","path"];function Of(e){for(let t of ql)if(e[t])return e[t];return""}function Ai(e){return{id:Sn(e.id||""),title:qr(e.title),severity:qr(e.severity),pocStatus:qr(e["poc status"]||e.poc),status:qr(e.status),parent:Sn(qr(e.parent||"")),location:qr(e.location)}}function Ti(e,t=""){let r=dr(e.severity)||t||To(e.id)||"medium",{file:n,line:o,locationLink:s}=Ci(e.location||""),i={file:n||"unknown",line:o,severity:r,description:jl(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 Gl(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="",d=/^\[([^\]]+)\]\(([^)]+)\)\s*[:—–-]*\s*(.*)$/u.exec(i);if(d)l=d[2].trim(),i=d[3]?`${d[1].trim()} ${d[3].trim()}`:d[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=xn(p),h="",b=i;if(f){h=f.id;let y=(u===-1?"":i.slice(u+1)).replace(/^[:—–-]+\s*/u,"").trim(),k=Ei(f.slug);b=k&&y?`${k}
15
-
16
- ${y}`:y||k||f.id}let m=r.get(h),w={file:"unknown",line:"?",severity:dr(m?.severity)||t||To(h)||"medium",description:jl(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 Io(e,t,r,n=""){let o=[];for(let i of Ao(e)){let l=Ai(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:Ti(l,n)}))}if(o.length>0)return o;let s=Gl(e,n,t);for(let i of s)r&&!i.finding.parent&&(i.finding.parent=r);return s}var Yl=/^### +(.*)$/gmu,Ri=/^#### +(.*)$/gmu,ww=new Set(["technical findings detail","technical findings","detailed findings","findings detail","findings"]);function kw(e){return ww.has(e)||e.startsWith("findings by severity")}var $w=/^(?:summary of findings|deferred|methodolog|executive|conclusion|attack surface|coverage|discoveries|scope|table of contents|contents|appendix|recommendation|remediation)/u;function xw(e){return $w.test(e)}function Df(e){let{id:t}=Kl(e);return!!(t&&xn(t))}function _w(e){let t=cr(e,Yl);return(t.length>0?t:cr(e,Ri)).some(({heading:n})=>Df(n))}function Cn(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=Ew(t),n=Aw(r["summary of findings"]||""),o=Lf(Xl(t,/^## +(.*)$/gmu).head),s=[],i=new Set,l=[],d=(p,f)=>{s.push(f),p&&i.add(p)},u=p=>{for(let f of p)d(f.id,f.finding)};for(let[p,f]of Object.entries(r)){let h=Wl(p);if(h){u(Jl(f,h,n,l));continue}if(kw(p)){u(Pf(f,n,l));continue}!xw(p)&&_w(f)&&u(Pf(f,n,l,Ff(p)))}for(let p of l)p.id&&i.has(p.id)||d(p.id,p.finding);for(let p of n.values())i.has(p.id)||d(p.id,Ti(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 Pf(e,t,r,n=""){let o=cr(e,Yl);return o.length===0?Jl(e,n,t,r):Nf(o,t,r,n)}function Nf(e,t,r,n){let o=[],s="";for(let{heading:i,body:l}of e){let d=Wl(i);if(d){o.push(...Jl(l,d,t,r)),s="";continue}if(_n(i)){o.push(...Cw(l,t,s,r,n));continue}let u=Sw(i,l,t,r,n);o.push(...u),s=u[0]?.id||s}return o}function Sw(e,t,r,n,o=""){let{head:s,subs:i}=Xl(t,Ri),l=[],d=Ii(e,s,r,o),u=!!d&&!d.id&&i.some(f=>!_n(f.heading)&&Df(f.heading));d&&!u&&l.push({id:d.id,finding:d.finding});let p=u?"":d?.id||"";for(let f of i){if(_n(f.heading)){n.push(...Io(f.body,r,p,o));continue}let h=Ii(f.heading,f.body,r,o);h&&l.push({id:h.id,finding:h.finding})}return l}function Cw(e,t,r,n,o=""){let{head:s,subs:i}=Xl(e,Ri);n.push(...Io(s,t,r,o));let l=[];for(let d of i){if(_n(d.heading)){n.push(...Io(d.body,t,"",o));continue}let u=Ii(d.heading,d.body,t,o);u&&l.push({id:u.id,finding:u.finding})}return l}function Jl(e,t,r,n){let o=cr(e,Yl);if(o.length>0)return Nf(o,r,n,t);let s=[],i="";for(let{heading:d,body:u}of cr(e,Ri)){if(_n(d)){n.push(...Io(u,r,i,t));continue}let p=Ii(d,u,r,t);p&&(s.push({id:p.id,finding:p.finding}),i=p.id||i)}if(s.length>0)return s;let l=Ao(e).map(Ai).filter(d=>d.id||d.title);if(l.length>0){for(let d of l)!d.severity&&t&&(d.severity=t),d.id&&!r.has(d.id)?r.set(d.id,d):d.id||n.push({id:"",finding:Ti(d,t)});return[]}return n.push(...Gl(e,t,r)),[]}function Ii(e,t,r,n=""){let o=e.trim();if(!o)return null;let{id:s,title:i,link:l}=Kl(o),d=r.get(s);if(!s&&i){for(let O of r.values())if(O.title.toLowerCase()===i.toLowerCase()){s=O.id,d=O;break}}let{fields:u,labels:p,prose:f}=Bf(t),h=dr(u.severity)||dr(d?.severity)||n||To(s)||"medium",{file:b,line:m,locationLink:v}=Ci(Of(u)),w=m;if(w==="?"&&(u.line||u.lines)){let O=/\d+/u.exec(u.line||u.lines);O&&(w=O[0])}let y=/\*\*Variant of:?\*\*\s*\[?([^\]\s)]+)/iu.exec(t),k=f.split(`
18
- `).filter(O=>!/^\s*<a\s[^>]*>\s*<\/a>\s*$/iu.test(O)&&!/\*\*Variant of:?\*\*/iu.test(O)).join(`
19
- `).trim(),_={file:b||"unknown",line:w,severity:h,description:Iw(i||s,u,p,k)};v?_.location=v:_.file==="unknown"&&s&&(_.location=`piolium:${s}`);let T=u["poc status"]||u.poc||d?.pocStatus;T&&(_.pocStatus=T);let S=u["detailed report"]||(l.endsWith("report.md")?l:"");S&&(_.reportPath=S),d?.status&&(_.status=d.status);let I=u["variant of"]?Sn(u["variant of"].split(/\s+/u)[0]):"",R=d?.parent||I||(y?Sn(y[1]):"");return R&&(_.parent=R),{id:s,finding:_}}function Ew(e){let t=Object.create(null);for(let{heading:r,body:n}of cr(e,/^## +(.*)$/gmu)){let o=r.trim().toLowerCase();o&&(t[o]=o in t?`${t[o]}
20
- ${n}`:n)}return t}function Xl(e,t){let r=Hl(e),n=[...e.matchAll(t)].find(o=>!Vl(r,o.index));return n?{head:e.slice(0,n.index),subs:cr(e,t)}:{head:e,subs:[]}}function Aw(e){let t=new Map;for(let r of Ao(e)){let n=Ai(r);n.id&&t.set(n.id,n)}return t}var Tw=new Set([...ql,"severity","summary","files","poc","poc status","line","lines","detailed report","proof of concept","evidence","variant of","pattern","status","id","title"]);function Iw(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||Tw.has(s)||o.push(`**${r[s]||s}:** ${i}`);return o.filter(Boolean).join(`
21
-
22
- `)}var Rw=new Set(["critical","high","medium","low","high_bug","bug","informational"]);function En(e){let t=e.replaceAll(/\r\n?/gu,`
23
- `).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=Mw(s);i&&n.push(i)}return n.length===0?null:{type:n.find(s=>s.type)?.type||"analysis",source:"claude-security",findings:n}}function Mw(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}=Bw(n),i=Fw(o),l=Lw(s),{file:d,line:u,locationLink:p}=Ow(i.location||""),f=(l.severity||"").toLowerCase(),h=Rw.has(f)?f:"medium",b=Pw(r,i),m=i["recommended fix"]?zf(i["recommended fix"]):void 0,v={file:d||"unknown",line:u,severity:h,description:b};return p&&(v.location=p),m&&(v.recommendation=m),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()),v}function Bw(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 Fw(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 Lw(e){let t={};for(let r of e.matchAll(/\*\*([^:]+):\*\*\s*(.+)/gu))t[r[1].trim().toLowerCase()]=r[2].trim();return t}function Ow(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 Pw(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"]}`),zf(r.join(`
26
-
27
- `))}function zf(e){return e.replaceAll("**","")}function Dw(e){return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}function Nw(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(e[r]);return btoa(t)}async function Uf(e){let t=typeof e=="string"?oe(e):e,r=await crypto.subtle.digest("SHA-512",t);return`sha512-${Nw(new Uint8Array(r))}`}async function zw(e){let t=oe(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=Dw(n);return`${o.slice(0,8)}-${o.slice(8,12)}-${o.slice(12,16)}-${o.slice(16,20)}-${o.slice(20,32)}`}async function Mi(e){if(typeof crypto?.subtle?.digest!="function")return null;let t;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 zw(t)}catch{return null}}function ur(e){try{return JSON.parse(e)}catch{return $n(e)??Cn(e)??En(e)}}function pr(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 An(e){let t=e.filter(n=>n&&!n.id);if(t.length===0)return;let r=await Promise.all(t.map(Mi));t.forEach((n,o)=>{r[o]&&(n.id=r[o])})}var Uw=["type","model","think","effort","exportsMode"];function Bi(e,t){if(!t.source)for(let r of Uw)e[r]==null&&t[r]!=null&&(e[r]=t[r])}var Gr=new Map,Tn=new Map,In=new Map,Fi=new Map;function Hw(e){let t=e?.package?.npm;if(typeof t?.name=="string"&&t.name&&!gn(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 Vw(e){return typeof e?.file!="string"?!1:/(?:^|\/)(?:node_modules|dependencies)\//u.test(e.file)}function jw(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 Mo=new Set,Ql=new Set,Ro=null,Zl=!1;function ec(e){return Ql.add(e),()=>Ql.delete(e)}function tc(){for(let e of Ql)try{e()}catch{}}function Bo(e){return Gr.get(e)?.list??[]}function rc(){let e=0;for(let t of Gr.values())e+=t.list.length;return e}function Et(){return Tn}function Yr(){return In}function Fo(e,t){let r=Gr.get(e);if(!r)return[];let n=r.reports.get(fr(t));return n?[...n]:[]}function nc(e,t){let r=Tn.get(e);if(!r)return[];let n=r._keyReports.get(fr(t));return n?[...n]:[]}function oc(e,t){let r=In.get(e);if(!r)return[];let n=r._keyReports.get(fr(t));return n?[...n]:[]}function Ww(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 pr(t))Bi(n,e),r.push(n);return r}function fr(e){return e.id?`id:${e.id}`:`c:${e.severity??""}|${e.description??""}|${e.file??""}|${e.line??""}`}function sc(e,t,r){let n=Fi.get(e);n||(n={hash:[],pkg:[],repo:[]},Fi.set(e,n)),n[t].push(r)}function Kw(e,t,r){let n=Gr.get(e.fileHash);n||(n={keys:new Set,list:[],reports:new Map},Gr.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&&sc(r,"hash",{hash:e.fileHash,key:t}),n.keys.has(t)?s:(n.keys.add(t),n.list.push(e),!0)}function qw(e,t,r){let n=Hw(e);if(!n)return!1;let o=af(e),s=Tn.get(n);if(s||(s={...ti(),repos:new Set,byVersion:new Map,_repoReports:new Map},Tn.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)}lf(s,o,e,t,r);let i=ri(s,t,r,e);return sc(r,"pkg",{pkg:n,key:t,file:e.file,version:o}),i}function Gw(e,t,r,n){if(Vw(e))return!1;let o=jw(e,n);if(!o)return!1;let s=In.get(o);s||(s=ti(),In.set(o,s));let i=ri(s,t,r,e);return i&&sc(r,"repo",{repo:o,key:t,file:e.file}),i}function ic(e){let t=Fi.get(e);if(Fi.delete(e),Mo.delete(e),!t)return!1;let r=!1;for(let{hash:o,key:s}of t.hash){let i=Gr.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 d=i.list.findIndex(u=>fr(u)===s);d>=0&&i.list.splice(d,1)}i.keys.size===0&&Gr.delete(o)}}let n=new Set;for(let{pkg:o,key:s,file:i,version:l}of t.pkg){let d=Tn.get(o);if(!d)continue;let u=d._keyReports.get(s);if(u){if(u.delete(e)&&(r=!0),u.size===0&&ni(d,s,i,fr),cf(d,l,s,i,e,fr),!n.has(o)){n.add(o);for(let p of[...d._repoReports.keys()]){let f=d._repoReports.get(p);f?.delete(e)&&f.size===0&&(d._repoReports.delete(p),d.repos.delete(p),r=!0)}}d._keyReports.size===0?Tn.delete(o):oi(d)}}for(let{repo:o,key:s,file:i}of t.repo){let l=In.get(o);if(!l)continue;let d=l._keyReports.get(s);d&&(d.delete(e)&&(r=!0),d.size===0&&ni(l,s,i,fr),l._keyReports.size===0?In.delete(o):oi(l))}return r}async function Yw(e){if(Mo.has(e))return!1;Mo.add(e);try{let t=await Ue(e),r=ur(t);if(!r)return!1;let n=Ww(r);if(n.length===0)return!1;let o="";try{o=Ze(e)}catch{}let s=!1;for(let i of n){let l=fr(i);i.fileHash&&Kw(i,l,e)&&(s=!0),i.file&&qw(i,l,e)&&(s=!0),i.file&&Gw(i,l,e,o)&&(s=!0)}return Mo.has(e)?s:(ic(e),Zl=!0,!1)}catch{return Mo.delete(e),!1}}function At(){return Ro||(Ro=(async()=>{try{do{Zl=!1;let e=await ue();for(let t of e)await Yw(t)&&tc()}while(Zl)}finally{Ro=null}})(),Ro)}_o(e=>{ic(e)&&tc()});If(e=>{ic(e)&&tc(),At().catch(()=>{})});var Lo=new Map,Oo=new Map;function Li(e,t){if(!e||!t)return!1;let r=!Oo.has(e);Oo.set(e,t);for(let[n,o]of t){if(!o)continue;let s=Lo.get(o);s||(s=new Map,Lo.set(o,s)),s.set(e,n)}return r}function ac(e){let t=Oo.get(e);if(Oo.delete(e),!!t)for(let r of t.values()){let n=Lo.get(r);n&&(n.delete(e),n.size===0&&Lo.delete(r))}}function Jr(e){if(!e)return[];let t=Lo.get(e);if(!t)return[];let r=[];for(let[n,o]of t)r.push({integrity:n,file:o});return r}function lc(e){return Oo.has(e)}var Vf="deepview.fileCounts",Hf=2,hr=null;function Pi(){if(hr)return hr;try{hr=JSON.parse(Ce(Vf)||"{}")}catch{hr={}}return hr?.__v!==Hf&&(hr={__v:Hf}),hr}function cc(){Ie(Vf,JSON.stringify(hr)).catch(e=>console.warn("counts persist:",e))}function jf(e){if(e==="__v")return;let t=Pi()[e];if(t!==void 0)return typeof t=="number"?{count:t}:t}function Do(e){return jf(e)?.count}function No(e){return jf(e)?.source}function tt(e,t,r){let n=Pi();n[e]=r?{count:t,source:r}:{count:t},cc()}function Mn(e){let t=Pi();delete t[e],cc()}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=$n(e);if(t)return{count:t.findings.length,source:t.source,recognized:!0};let r=Cn(e);if(r)return{count:r.findings.length,source:r.source,recognized:!0};let n=En(e);return n?{count:n.findings.length,source:n.source,recognized:!0}:{count:0,recognized:!1}}var Po=null,Rn=null,Oi=null;function Jw(e,t){for(let{names:r,onUpdate:n}of Oi)if(r.has(e))try{n(e,t)}catch(o){console.warn("ensureCounts onUpdate:",o)}}function dc(e,t){if(Po){t&&Oi.push({names:new Set(e),onUpdate:t});for(let r of e)Rn.add(r);return Po}return Rn=new Set(e),Oi=t?[{names:new Set(e),onUpdate:t}]:[],Po=(async()=>{await Promise.resolve();try{let r=Pi();for(;Rn.size>0;){let n=Rn.values().next().value;if(Rn.delete(n),r[n]===void 0)try{let o=await Ue(n);if(r[n]!==void 0)continue;let{count:s,source:i}=Ge(o);r[n]=i?{count:s,source:i}:{count:s},cc(),Jw(n,s)}catch{}}}finally{Po=null,Rn=null,Oi=null}})(),Po}function uc(e){if(!e)return"";for(let t of e.split(`
28
- `))if(t.trim())return t.trim();return""}function pc(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:uc(s.description)}),r.size===t.size))return r}return r}var Xw=`deepview/workspace-id/v1
29
- `;async function zo(e){let t=Uint8Array.fromBase64(e),r=oe(Xw),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 d=i.join("");return`${d.slice(0,8)}-${d.slice(8,12)}-${d.slice(12,16)}-${d.slice(16,20)}-${d.slice(20,32)}`}function Uo(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 Wf=Uo("create"),Kf=Uo("delete"),qf=Uo("privateKey"),Gf=Uo("report-membership"),Yf=Uo("bundle-membership"),Qw=Wf.on,fc=Kf.on,hc=qf.on,gc=Gf.on,mc=Yf.on,Di=Wf.fire,bc=Kf.fire,yc=qf.fire,Ni=Gf.fire,zi=Yf.fire;var wc="deepview.workspaces",Zw=1;function Ho(){try{let e=Ce(wc);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 e0(e){await Ie(wc,JSON.stringify({version:Zw,workspaces:e}))}var t0=wc;function Bn(e){return navigator.locks.request(t0,async()=>{await or();let t=Ho(),r=await e(t);if(r!==!1)return await e0(t),r})}function Vo(e){return{id:e.id,privateKey:e.privateKey,reports:Array.isArray(e.reports)?[...e.reports]:[],bundles:Array.isArray(e.bundles)?[...e.bundles]:[]}}var wt=Ho().map(Vo);function kc(){wt=Ho().map(Vo)}function $c(e){wt=wt.filter(t=>t.id!==e.id),wt.push(Vo(e))}function r0(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(Vo(e))}function n0(e){wt=wt.filter(t=>t.id!==e)}function G(){let e=Ho();for(let t of e)Array.isArray(t.reports)||(t.reports=[]),Array.isArray(t.bundles)||(t.bundles=[]);return e}var o0=200;function Tt(e){let t=(e??"").trim();return t&&t.replaceAll(/[\u0000-\u001F\u007F]/gu,"").slice(0,o0)||null}async function xc(e){let t=Tt(e);if(!t)return null;let r=new Uint8Array(32);crypto.getRandomValues(r);let n=r.toBase64(),o={id:await zo(n),name:t,privateKey:n,reports:[],bundles:[],createdAt:Date.now()};return await Bn(i=>i.some(l=>l.id===o.id)?!1:(i.push(o),o))?($c(o),o):null}async function _c(e){await Bn(r=>{let n=r.findIndex(o=>o.id===e);return n<0?!1:(r.splice(n,1),!0)})&&(bc(e),n0(e))}async function Sc(e,t){let r=Tt(t);return!(!r||!await Bn(o=>{let s=o.find(i=>i.id===e);return!s||s.name===r?!1:(s.name=r,s)}))}async function Jf(e){let t=await Bn(o=>{let s=o.findIndex(p=>p.id===e.id),i=s>=0?o[s]:null,l=Tt(e.name)??i?.name??"Workspace",d=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(d)],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?Di(r.id):(n.privateKey!==r.privateKey&&yc(r.id),Ui(n.reports,r.reports)||Ni(r.id),Ui(n.bundles,r.bundles)||zi(r.id)),$c(r),r}async function Cc({id:e,name:t,privateKey:r,createdAt:n}){let o=null;return await Bn(s=>{let i=Tt(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 d=s.find(p=>Tt(p.name)===i)??null;if(d)return o={status:"name-collision",existing:d},!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"&&(Di(o.workspace.id),$c(o.workspace)),o}function Ui(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 vc({identifier:e,workspaceId:t,field:r,fire:n,additive:o=!1,from:s=void 0}){let i=await Bn(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:d}=i;for(let u of l){n(u);let p=d.get(u);p&&r0(p,r)}}function Xf(e,t){return{move:(r,n)=>vc({identifier:r,workspaceId:n,field:e,fire:t}),add:(r,n)=>vc({identifier:r,workspaceId:n,field:e,fire:t,additive:!0}),remove:(r,n)=>vc({identifier:r,field:e,fire:t,from:n})}}var Ec=Xf("reports",Ni),Ac=Xf("bundles",zi),jo=Ec.move,Ut=Ec.add,Wo=Ec.remove,Tc=Ac.move,Xr=Ac.add,Ic=Ac.remove;function s0(){let e=Ho().map(Vo),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)||bc(o);for(let[o,s]of n){let i=r.get(o);if(!i){Di(o);continue}i.privateKey!==s.privateKey&&yc(o),Ui(i.reports,s.reports)||Ni(o),Ui(i.bundles,s.bundles)||zi(o)}wt=e}bn(()=>{s0()});function Qf(e){return e==="inprogress"||e==="fixed"||e==="invalid"||e==="deleted"?e:void 0}function xe(e){if(e)return Qf(e.triage)??(e.deleted?"deleted":void 0)}function i0(e){return e?!e.color&&!xe(e)&&!e.comment&&!e.fix&&!(e.ignoredReports&&e.ignoredReports.length>0)&&e.flagged===void 0:!0}function Ht(e,t,r){let n=e.get(t)?.ignoredReports;return Array.isArray(n)&&n.includes(r)}function Ko(e){if(!e||typeof e!="object")return;let t=e,r={};typeof t.color=="string"&&t.color&&(r.color=t.color);let n=Qf(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 i0(r)?void 0:r}function a0(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 l0(e,t){let r=e??{},n=t??{};return(r.color??"")===(n.color??"")&&(xe(r)??"")===(xe(n)??"")&&(r.comment??"")===(n.comment??"")&&(r.fix??"")===(n.fix??"")&&r.flagged===n.flagged&&a0(r.ignoredReports,n.ignoredReports)}function D(e,t,r){let n=e.get(t),o=Ko({...n,...r});return o===void 0?e.delete(t):l0(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),D(e,t,{ignoredReports:o.size>0?[...o]:void 0})}var Rc=()=>{};function eh(e){Rc=typeof e=="function"?e:()=>{}}var th=()=>{};function Mc(e){th=typeof e=="function"?e:()=>{}}var gr="deepview.triage",Vt="deepview.triage.pending",It=/^\d+$/u;async function c0(e){let t=new Blob([e]).stream().pipeThrough(new CompressionStream("deflate"));return new Uint8Array(await new Response(t).arrayBuffer())}async function d0(e){let t=new Blob([e]).stream().pipeThrough(new DecompressionStream("deflate"));return new Uint8Array(await new Response(t).arrayBuffer())}var u0="deepview.triage.save",Zf=0;function Bc(){let e={};for(let[t,r]of a.triage){if(It.test(t))continue;let n=Ko(r);n&&(e[t]=n)}return e}function pe(){let e=++Zf,t=Bc(),r=Object.keys(t).length===0,n=r?null:JSON.stringify(t);if(n!=null)try{localStorage.setItem(Vt,n)}catch{}return navigator.locks.request(Qe,{mode:"shared"},async()=>{let o=null,s=null;if(n!=null)try{let i=oe(n),l=await c0(i);s=Re(),o=(s?await yf(l):l).toBase64()}catch(i){console.warn("Failed to save triage:",i),Rc();return}await navigator.locks.request(u0,()=>{try{if(e!==Zf)return;if(n!=null&&Re()!==s){queueMicrotask(()=>{pe()});return}if(r)localStorage.removeItem(gr),localStorage.removeItem(Vt);else{localStorage.setItem(gr,o);try{localStorage.removeItem(Vt)}catch{}}}catch(i){console.warn("Failed to save triage:",i)}}),Rc()})}async function rh(){let e=localStorage.getItem(Vt);if(e)try{return JSON.parse(e)}catch{}let t=localStorage.getItem(gr);if(!t)return null;let r=Uint8Array.fromBase64(t);if(qe(r)){if(!Re())throw new Error("triage: vault locked, cannot decrypt envelope");r=await vf(r)}let n=await d0(r);return JSON.parse($e(n))}function nh(e,{replace:t=!1}={}){let r=a.triage;if(t){let n=null,o=localStorage.getItem(Vt);if(o)try{n=JSON.parse(o)}catch{}let s=i=>n!=null&&i in n;for(let i of[...r.keys()]){if(It.test(i))continue;let l=e?.[i],d=!e||!(i in e);!(s(i)&&n[i]?.color)&&(d||!l?.color)&&D(r,i,{color:void 0}),!(s(i)&&(n[i]?.triage||n[i]?.deleted))&&!xe(l)&&D(r,i,{triage:void 0}),!(s(i)&&n[i]?.comment)&&(d||typeof l?.comment!="string"||!l.comment)&&D(r,i,{comment:void 0}),!(s(i)&&n[i]?.fix)&&(d||typeof l?.fix!="string"||!l.fix)&&D(r,i,{fix:void 0}),!(s(i)&&n[i]?.flagged!==void 0)&&(d||l?.flagged===void 0)&&D(r,i,{flagged:void 0})}for(let i of[...r.keys()]){if(It.test(i))continue;let l=r.get(i)?.ignoredReports;if(!l||l.length===0)continue;let d=e?.[i],u=!!xe(d);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=d?.ignoredReports;(!Array.isArray(f)||!f.includes(p))&&he(r,i,p,!1)}}}if(e)for(let[n,o]of Object.entries(e)){let s=xe(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&&D(r,n,i),!s&&o&&Array.isArray(o.ignoredReports)){let l=new Set(r.get(n)?.ignoredReports??[]),d=!1;for(let u of o.ignoredReports)typeof u=="string"&&!l.has(u)&&(l.add(u),d=!0);d&&D(r,n,{ignoredReports:[...l]})}}}async function p0(){try{let e=await rh();nh(e)}catch(e){console.warn("Failed to load triage:",e)}}async function oh(){try{let e=await rh();nh(e,{replace:!0}),th()}catch(e){console.warn("Failed to reload triage:",e)}}typeof window<"u"&&window.addEventListener("storage",e=>{e.key!==gr&&e.key!==Vt||oh()});var qo=p0();Ee(()=>{oh()});Ee(()=>{Re()&&localStorage.getItem(Vt)&&pe()});async function Fc({seal:e}){try{localStorage.removeItem(Vt)}catch{}let t=localStorage.getItem(gr);if(!t)return;let r=Uint8Array.fromBase64(t);if(qe(r))return;let n=await e(r,yo());localStorage.setItem(gr,n.toBase64())}async function Lc({open:e}){try{localStorage.removeItem(Vt)}catch{}let t=localStorage.getItem(gr);if(!t)return;let r=Uint8Array.fromBase64(t);if(!qe(r))return;let n=await e(r,yo());localStorage.setItem(gr,n.toBase64())}var sh="deepview.lastFile",Go=null;function Oc(){return Go||(Go=f0(),Go.catch(()=>{Go=null})),Go}async function f0(){try{await qo}catch{}let e=await ue(),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 Ue(o),await lt(s,i),await kn(o)}catch(p){console.warn(`migrate: failed to rename ${o} -> ${s}`,p);continue}t.delete(o),t.add(s),n.add(o);let l=Do(o);if(Mn(o),l===void 0){let{count:p,source:f}=Ge(i);tt(s,p,f)}else{let{source:p}=Ge(i);tt(s,l,p)}let d=Ze(o);d&&(et(o,""),et(s,d));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(),Ce(sh)===o)try{await Ie(sh,s)}catch{}}for(let o of G())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 Wo(s,o.id),await Ut(i,o.id)}}function ih(){return typeof navigator<"u"&&typeof navigator.storage=="object"&&navigator.storage!==null}async function Fn(){if(!ih()||typeof navigator.storage.persist!="function")return!1;try{return await navigator.storage.persist()===!0}catch{return!1}}async function Pc(){let e={supported:ih(),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 Dc=1;function h0(){let e=Bc(),t=Si();return{version:Dc,exportedAt:new Date().toISOString(),triage:e,repoUrls:t}}function g0(){return`deepview-triage-${new Date().toISOString().replaceAll(/[:.]/gu,"-").slice(0,19)}.json.gz`}async function Nc(){let e=h0();return{blob:new Blob([await si(JSON.stringify(e))]),filename:g0()}}async function zc(e){let t;try{t=await uo(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!==Dc)throw new Error(`Unsupported backup version: ${r.version} (expected ${Dc})`);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 Uc(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()])It.test(l)||n.delete(l);let o=t==="prefer-current";for(let[l,d]of Object.entries(r)){if(It.test(l)||!d||typeof d!="object")continue;typeof d.color=="string"&&d.color&&(!o||!n.get(l)?.color)&&D(n,l,{color:d.color});let u=xe(d);if(u&&(!o||!xe(n.get(l)))&&D(n,l,{triage:u}),typeof d.comment=="string"&&d.comment&&(!o||!n.get(l)?.comment)&&D(n,l,{comment:d.comment}),typeof d.fix=="string"&&d.fix&&(!o||!n.get(l)?.fix)&&D(n,l,{fix:d.fix}),typeof d.flagged=="boolean"&&(!o||n.get(l)?.flagged===void 0)&&D(n,l,{flagged:d.flagged}),Array.isArray(d.ignoredReports)&&!xe(n.get(l)))for(let p of d.ignoredReports)typeof p=="string"&&(o&&Ht(n,l,p)||he(n,l,p,!0))}await pe();let s=0,i=null;try{await Rf(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 m0(e){return e?.name==="NotFoundError"||typeof e?.message=="string"&&e.message.startsWith("File not found:")}async function Hc(e){let t=new Set;for(let r of e){let n;try{n=await Ue(r)}catch(i){if(m0(i))continue;throw new Error(`Failed to read ${r}: ${i.message}`,{cause:i})}if(n==null)continue;let o=ur(n);if(!Array.isArray(o?.findings))continue;let s=pr(o.findings);await An(s);for(let i of s)i.id&&t.add(i.id)}return t}function b0(){let e=new Set;for(let t of a.triage.keys())It.test(t)||e.add(t);return e}async function Hi(e){let t=b0();if(t.size===0)return{orphanedCount:0,sharedCount:0};let r=await Hc(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 ue(),s=new Set(e),i=o.filter(p=>!s.has(p)),l=await Hc(i),d=0,u=0;for(let p of n)l.has(p)?u++:d++;return{orphanedCount:d,sharedCount:u}}async function Vi(){let e=new Set(a.triage.keys()),t=[];for(let[i,l]of a.triage)if(l.ignoredReports)for(let d of l.ignoredReports)t.push({id:i,report:d});let r=await ue(),n=new Set(r),o=await Hc(r),s=!1;for(let i of e){if(It.test(i)||o.has(i))continue;let l=a.triage.get(i);!l||!(l.color||xe(l)||l.comment||l.fix||l.flagged!==void 0)||D(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)It.test(i)||o.has(i)&&n.has(l)||Ht(a.triage,i,l)&&he(a.triage,i,l,!1)&&(s=!0);s&&await pe()}var Vc=1,br=16,ah=12,lh=1+br+ah+16,mr=1+br+ah;async function ch(e,t){let r=await crypto.subtle.importKey("raw",oe(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 dh(e){return!(e instanceof Uint8Array)||e.length<lh?!1:e[0]===Vc}async function ji(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(mr+e.length+16);r[0]=Vc,crypto.getRandomValues(r.subarray(1,1+br)),crypto.getRandomValues(r.subarray(1+br,mr));let n=r.subarray(1,1+br),o=r.subarray(1+br,mr),s=await ch(t,n),i=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:o,additionalData:r.subarray(0,mr)},s,e));return r.set(i,mr),r}async function v0(e,t){if(typeof t!="string"||!t)throw new TypeError("tryDecryptWithPassword: password required");if(!(e instanceof Uint8Array)||e.length<lh)return{ok:!1,reason:"malformed"};if(e[0]!==Vc)return{ok:!1,reason:"malformed"};let r=e.subarray(1,1+br),n=e.subarray(1+br,mr),o=e.subarray(mr),s=await ch(t,r),i;try{i=new Uint8Array(await crypto.subtle.decrypt({name:"AES-GCM",iv:n,additionalData:e.subarray(0,mr)},s,o))}catch{return{ok:!1,reason:"wrong-password"}}return{ok:!0,plaintext:i}}async function Wi(e,t,r){if(!r||typeof r.malformedMsg!="string"||typeof r.wrongPasswordMsg!="string")throw new TypeError("decryptWithPasswordOrThrow: { malformedMsg, wrongPasswordMsg } strings required");let n=await v0(e,t);if(n.ok)return n.plaintext;throw n.reason==="wrong-password"?new Error(r.wrongPasswordMsg):new Error(r.malformedMsg)}var Yo=dh,uh=ji;function ph(e,t){return Wi(e,t,{malformedMsg:"malformed encrypted bundle",wrongPasswordMsg:"wrong password or corrupt bundle"})}var w0=1;async function k0(e){let t=new Set,r=ur(e);if(!Array.isArray(r?.findings))return t;let n=pr(r.findings);await An(n);for(let o of n)o.id&&t.add(o.id);return t}function fh(e){return(e??"").replaceAll(/[^a-zA-Z0-9._-]+/gu,"_").replaceAll(/^_+|_+$/gu,"")||"workspace"}async function $0(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 Nt(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 x0(e,{includeBundleBytes:t=!1}={}){let r=[],n=new Set;for(let u of e.reports??[]){let p;try{p=await Ue(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 k0(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=Ko({...p,ignoredReports:f});h&&(s[u]=h)}let i={};for(let u of r){let p=Ze(u.name);p&&(i[u.name]=p)}let l=(e.bundles??[]).filter(u=>typeof u=="string"&&u.length>0),d={version:w0,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 $0(l);u.length>0&&(d.bundleBlobs=u)}return d}async function hh(e,{includeBundleBytes:t=!1}={}){let r=await x0(e,{includeBundleBytes:t});return{blob:new Blob([await si(JSON.stringify(r))]),filename:`${fh(e.name)}.deepview-workspace.json.gz`}}async function _0(e,t,{includeBundleBytes:r=!1}={}){if(typeof t!="string"||!t)throw new TypeError("buildWorkspaceExportEncrypted: password required");let{blob:n}=await hh(e,{includeBundleBytes:r}),o=new Uint8Array(await n.arrayBuffer()),s=await uh(o,t);return{blob:new Blob([s],{type:"application/octet-stream"}),filename:`${fh(e.name)}.deepview-workspace.enc`}}async function jc(e,{password:t,includeBundleBytes:r=!1}={}){return typeof t=="string"&&t?await _0(e,t,{includeBundleBytes:r}):await hh(e,{includeBundleBytes:r})}var S0=1,gh=1024,mh=1024,Ki=200,wh=100*1024*1024,C0=Math.ceil(wh*4/3)+16,bh=512,yh=64;function E0(e){if(!e||typeof e!="object")return"payload is not an object";if(e.version!==S0)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>mh)return`reports count (${e.reports.length}) exceeds cap (${mh})`;if(e.bundles!==void 0){if(!Array.isArray(e.bundles))return"bundles field must be an array when present";if(e.bundles.length>gh)return`bundles count (${e.bundles.length}) exceeds cap (${gh})`;for(let t of e.bundles){if(typeof t!="string")return"bundles entries must be strings";if(t.length>Ki)return`bundle integrity exceeds per-entry length cap (${Ki})`}}if(e.bundleBlobs!==void 0){if(!Array.isArray(e.bundleBlobs))return"bundleBlobs field must be an array when present";if(e.bundleBlobs.length>yh)return`bundleBlobs count (${e.bundleBlobs.length}) exceeds cap (${yh})`;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>Ki)return`bundleBlobs.integrity exceeds per-entry length cap (${Ki})`;if(typeof t.name!="string"||t.name.length===0)return"bundleBlobs.name must be a non-empty string";if(t.name.length>bh)return`bundleBlobs.name exceeds per-entry length cap (${bh})`;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>C0)return`bundleBlobs.data exceeds per-blob size cap (${wh} bytes raw)`}}return null}async function Wc(e){return new Uint8Array(await e.arrayBuffer())}async function qi(e,t){if(Yo(e)){if(typeof t!="string"||!t)throw new TypeError("parseWorkspaceBundleBytes: password required for encrypted bundle");let n=await ph(e,t);try{return vh(await uo(n))}catch(o){throw new Error("wrong password or corrupt bundle",{cause:o})}}let r;try{r=await uo(e)}catch(n){throw new Error(`gzip decompression failed: ${n.message}`,{cause:n})}return vh(r)}function vh(e){let t;try{t=JSON.parse(e)}catch(o){throw new Error(`payload is not JSON: ${o.message}`,{cause:o})}let r=E0(t);if(r===null)return t;let n=r.includes("exceeds cap");throw new Error(n?r:`not a deepview workspace export: ${r}`)}function A0(e){return xe(e)??null}async function T0(e){let t=new Map;for(let r of e??[]){if(typeof r?.content!="string")continue;let n=ur(r.content);if(!n?.findings)continue;let o=pr(n.findings);await An(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:uc(s.description)})}return t}async function I0(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,d=typeof i.color=="string"?i.color:void 0;d&&l&&l!==d?o.push({id:s,property:"color",local:l,imported:d}):d&&d!==l&&D(n,s,{color:d});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&&D(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&&D(n,s,{fix:h});let b=A0(i),m=xe(n.get(s))??null;b&&m&&m!==b?o.push({id:s,property:"triage",local:m,imported:b}):b&&!m&&D(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&&D(n,s,{flagged:w});let y=Array.isArray(i.ignoredReports)?i.ignoredReports:[];if(!xe(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&&R0(o,s)}await pe()}function R0(e,t){for(let r of e){let n=`${r.id}:${r.property}`;t[n]==="imported"&&M0(r.id,r.property)===r.local&&(r.property==="color"?D(a.triage,r.id,{color:r.imported}):r.property==="comment"?D(a.triage,r.id,{comment:r.imported}):r.property==="fix"?D(a.triage,r.id,{fix:r.imported}):r.property==="triage"?D(a.triage,r.id,{triage:r.imported,ignoredReports:void 0}):r.property==="flagged"&&D(a.triage,r.id,{flagged:r.imported==="flagged"?!0:r.imported==="not flagged"?!1:void 0}))}}function M0(e,t){if(t==="color")return a.triage.get(e)?.color;if(t==="triage")return xe(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 B0(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 Kr(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 Kc(e,{conflictResolver:t}={}){let r=[];for(let u of e.reports)if(!(typeof u?.name!="string"||typeof u?.content!="string"))try{await lt(u.name,u.content);let{count:p,source:f}=Ge(u.content);tt(u.name,p,f??No(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 B0(e.bundleBlobs);let o=e.triage&&Object.keys(e.triage).length>0?await T0(e.reports):new Map;await I0(e.triage,t,o);let s=Array.isArray(e.bundles),i=s?e.bundles.filter(u=>typeof u=="string"&&u.length>0):[],l=await Jf({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}),d=new Set(r);if(e.repoUrls&&typeof e.repoUrls=="object")for(let[u,p]of Object.entries(e.repoUrls))!d.has(u)||typeof p!="string"||!p||Ze(u)||(et(u,p),a.currentFile===u&&(a.repoUrl=p));return l}async function qc({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 zo(r)===e?{v:1,n:t,k:r}:{v:1,i:e,n:t,k:r};return(await ji(oe(JSON.stringify(s)),n)).toBase64({alphabet:"base64url",omitPadding:!0})}async function Gc({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 Wi(r,t,{malformedMsg:"malformed share link",wrongPasswordMsg:"wrong password or corrupt link"});try{return await F0(n)}catch(o){throw new Error("wrong password or corrupt link",{cause:o})}}async function F0(e){let t=JSON.parse($e(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 zo(t.k),name:t.n,privateKeyBase64:t.k}}function Yc(e){return typeof location>"u"?`#share=${e}`:`${location.origin}${location.pathname}#share=${e}`}function Jc(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 L0={get state(){return a},listWorkspaces:G,addReportToWorkspace:Ut,addBundleToWorkspace:Xr,onReportMembershipChanged:gc,onBundleMembershipChanged:mc,onWorkspaceDeleted:fc,onWorkspacePrivateKeyChanged:hc,analyzeContent:Ge,setCount:tt,gunzipBytes:_t,listBundles:vt,listFiles:ue,readBundle:Nt,readFileBytes:Wr,saveBundle:Kr,saveFileBytes:So,saveTriage:pe,getSecureItem:Ce,setSecureItem:Ie,removeSecureItem:yn,onSecureStorageHydrated:bn};function kh(e){e.installSyncHost(L0),eh(()=>e.triageSync.notify())}var W=null,Jo=null;function Sh(){try{return Ce("deepview.sync.userEnabled")!=="0"}catch{return!0}}var Ch=!1;function Eh(e){Ch=!!e}function Xc(){if(Ch)return!0;try{return zt()?.mode==="managed"}catch{return!1}}function Qc(){return Jo||(Xc()&&!W?Promise.resolve(null):(Jo=(async()=>{let e="./client-sync.js";try{let t=await import(e);return kh(t),W=t,O0(),t}catch(t){throw Jo=null,t}})(),Jo))}function Ah(){return Qc()}var Th=[];function Xo(e){W?e(W):Th.push(e)}function O0(){let e=Th.splice(0);for(let t of e)try{t(W)}catch(r){console.warn("client-sync: deferred apply failed:",r)}}function Qr(e,t){let r={cancelled:!1,unsub:null};return Xo(n=>{r.cancelled||(r.unsub=t(n,e))}),()=>{r.cancelled=!0,r.unsub&&r.unsub()}}function Zc(e,t){return W?W.isInRemote(e,t):!1}function Ih(e,t){return W?W.isBundleInRemote(e,t):!1}var P0="deepview.objstore-presence.";function Rh(e){try{let t=localStorage.getItem(P0+e);if(!t)return null;let r=JSON.parse(t);return r&&typeof r=="object"?r:null}catch{return null}}function Ln(e,t){if(W&&W.isInRemote(e,t))return!0;let r=Rh(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 ed(e,t){if(W&&W.isBundleInRemote(e,t))return!0;let r=Rh(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 Mh(e){return W?W.remoteCount(e):0}function Bh(e){return Qr(e,(t,r)=>t.onAutoDownloaded(r))}function Fh(e){return Qr(e,(t,r)=>t.onBundleAutoDownloaded(r))}function Lh(e){return Qr(e,(t,r)=>t.onChange(r))}var $h=null,xh=null,_h=null,Gi=[];function Oh(e){if(W){W.setRedraw(e);return}$h=e,Xo(t=>{$h===e&&t.setRedraw(e)})}function Ph(e){if(W){W.setAuthenticationResolver(e);return}xh=e,Xo(t=>{xh===e&&t.setAuthenticationResolver(e)})}function Dh(e){if(W){W.setHydrationConflictResolver(e);return}_h=e,Xo(t=>{_h===e&&t.setHydrationConflictResolver(e)})}async function Wt(e,t){if(!Xc()&&!(!Sh()&&!W))return(await Qc())[e](...t)}function Nh(...e){return Wt("fetchFile",e)}function zh(...e){return Wt("fetchBundleFromRemote",e)}function Yi(...e){return Wt("putFile",e)}function Uh(...e){return Wt("putBundleToRemote",e)}function Ji(...e){return Wt("deleteFromRemote",e)}function Xi(...e){return Wt("deleteBundleFromRemote",e)}function Qo(...e){return Wt("openWorkspace",e)}function Zo(...e){return Wt("closeWorkspace",e)}function Hh(...e){return Wt("recheckRemoteStorage",e)}function jt(e,t){if(W)return W.triageSync[e](...t);Xo(r=>{r.triageSync[e](...t)})}var P={get status(){return W?W.triageSync.status:"off"},get openSessions(){return W?W.triageSync.openSessions:[]},get persistenceDegraded(){return W?W.triageSync.persistenceDegraded:!1},get proxyAuthRequired(){return W?W.triageSync.proxyAuthRequired:!1},setEnabled(e){if(e===!0)return Xc()?Promise.resolve(null):Qc().then(t=>{t.triageSync.setEnabled(!0);let r=Gi;Gi=[];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(W){Gi=W.openWorkspaceIds();for(let t of Gi)try{W.closeWorkspace(t)}catch(r){console.warn(`client-sync: closeWorkspace(${t}) failed during disable:`,r)}W.triageSync.setEnabled(!1);return}jt("setEnabled",[e])},isEnabled(){return W?W.triageSync.isEnabled():Sh()},openSession(e){jt("openSession",[e])},closeSession(e){jt("closeSession",[e])},refreshSession(e){jt("refreshSession",[e])},dismissError(e){jt("dismissError",[e])},setForcedOff(e){jt("setForcedOff",[e])},setProtocolLocked(e){jt("setProtocolLocked",[e])},setServerUrl(e){jt("setServerUrl",[e])},getServerUrl(){return W?W.triageSync.getServerUrl():null},notify(){jt("notify",[])},onStatusChange(e){return Qr(e,(t,r)=>t.triageSync.onStatusChange(r))},onServerInfo(e){return Qr(e,(t,r)=>t.triageSync.onServerInfo(r))},onPersistenceDegraded(e){return Qr(e,(t,r)=>t.triageSync.onPersistenceDegraded(r))},onProxyAuthRequired(e){return Qr(e,(t,r)=>t.triageSync.onProxyAuthRequired(r))}};var es=class extends st{constructor(t){if(super(t),this.it=g,t.type!==Ne.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:[]}}};es.directiveName="unsafeHTML",es.resultType=1;var ye=$t(es);var ts=null;function rs(){return ts||(ts=(async()=>{let e="./client-managed.js";try{return await import(e)}catch(t){throw ts=null,t}})(),ts)}async function Vh(){return(await rs()).probeSession()}async function jh(){return(await rs()).probeTeams()}async function Wh(e){return(await rs()).fetchReport(e)}async function Kh(e){return(await rs()).login(e)}async function qh(e){return(await rs()).logout(e)}var ns=null;function os(){return ns||(ns=(async()=>{let e="./client-admin.js";try{return await import(e)}catch(t){throw ns=null,t}})(),ns)}function Gh(){return os()}function Yh(){return os()}function Jh(){return os()}function Xh(){return os()}function Qh(){return os()}var Zh=`*,*: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}
30
- `;var eg=`.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}}
31
- `;var tg=`*,*: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}}
32
- `;var M=class extends Q{static styles=[F(tg)];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 Z(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 ct=`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}
33
- `;var td=class extends M{static styles=[...M.styles,F(ct)];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=bo(),this._vaultStateUnsub=Ee(()=>{if(this._settled)return;let t=bo();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 wo({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(!Ct()){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 fl({seal:r}),this._phase="Encrypting triage data\u2026",await Fc({seal:r}),this._phase="Encrypting report files\u2026",await Fl({seal:r}),this._phase="Encrypting bundles\u2026",await Ol({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 c`<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?c`<p class="nwd-note">${this._phase}</p>`:g} ${this._error?c`<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 c`<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=Ct();return c`<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:c`<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?c`<p class="nwd-note">${this._phase}</p>`:g} ${this._error?c`<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 c`<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",td);function Qi(){return Z("passkey-setup-dialog")}var rd=class extends M{static styles=[...M.styles,F(ct)];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 vo({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 c`<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?c`<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",rd);function Zi(){return Z("passkey-unlock-dialog")}var rg=c`<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>`,H0=c`<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>`,Ae=null;function nd(){if(!Ae)return;if(!Ct()){Ae.hidden=!0;return}let e=se();if(!e&&a.serverMode==="managed"){Ae.hidden=!0;return}Ae.hidden=!1;let t=yt();Ae.classList.toggle("encrypted",e&&t),Ae.classList.toggle("locked-pending",e&&!t),e&&t?(Ae.title="Encryption on \u2014 click to disable",Ae.setAttribute("aria-label","Disable encryption"),q(rg,Ae)):e?(Ae.title="Encryption on, locked \u2014 click to unlock",Ae.setAttribute("aria-label","Unlock encrypted data"),q(rg,Ae)):(Ae.title="Encryption off \u2014 click to enable",Ae.setAttribute("aria-label","Enable encryption"),q(H0,Ae))}async function V0(){if(confirm(`Disable encryption?
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:**
33
+ ${t.evidence}`),t.impact&&n.push(`**Impact:** ${t.impact}`),t["reproduction steps"]&&n.push(`**Reproduction:** ${t["reproduction steps"]}`),n.join(`
34
+
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
+ `,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?
34
44
 
35
45
  Your local triage and report data will be rewritten as plaintext.
36
46
 
37
- 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 wl({migrate:async({open:t})=>{await hl({open:t}),await Lc({open:t}),await Ll({open:t}),await Pl({open:t})}}))?.disabled&&alert(`Encryption disabled. Your data is now plaintext.
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.
38
48
 
39
49
  To complete cleanup, remove the DeepView passkey from your password manager / OS settings:
40
50
  \u2022 macOS / iOS: Settings \u2192 Passwords
41
51
  \u2022 Windows: Settings \u2192 Accounts \u2192 Sign-in options \u2192 Passkeys
42
52
  \u2022 Chrome: chrome://settings/passkeys
43
- \u2022 Hardware security key: use the vendor's management tool`)}catch(e){alert(`Could not disable encryption: ${e?.message??e}`)}}async function j0(){await Qi()}function ng(){nd()}function og(e){if(!e||e===Ae)return;Ae=e;let t=!1;Ae.addEventListener("click",async()=>{if(!t){t=!0;try{if(!se()){await j0();return}if(!yt()){await Zi();return}await V0()}finally{t=!1}}}),Ee(nd),nd()}var sg=`.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}
44
- `;function sd(){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 od=class extends M{static styles=[...M.styles,F(sg)];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 Fn()){this._finish("granted");return}this._retryDenied=!0};_chromiumBody(){let t=location.hostname==="localhost"?c`Plain <code>localhost</code> can never qualify — for local testing open the app via <code>127.0.0.1</code> instead.`:g;return c`<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 c`<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 c`<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=sd(),r=t==="webkit"?this._webkitBody():t==="firefox"?this._firefoxBody():this._chromiumBody();return c`<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?c`<span class="spd-denied" role="status">Still not granted.</span>`:g} <span class="nwd-spacer"></span> ${t==="webkit"?g:c`<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",od);function ig(){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 Mt=null,Rt=null,ld=!1,ea=!1,id=0;function ad(){return sd()==="webkit"}function ag(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 K0(){if(!Mt)return;if(!Rt||Rt.persisted!==!1||!ld){Mt.hidden=!0;return}Mt.hidden=!1;let e=Rt.usage===null||Rt.quota===null?"":` Using ${ag(Rt.usage)} of ${ag(Rt.quota)}.`;Mt.querySelector(".storage-label").textContent="Storage at risk",Mt.title="Reports, bundles and triage are in best-effort storage \u2014 the browser may delete them all under disk pressure or after long inactivity. "+(ad()?"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 cg(e,t){let r=t?" (user gesture)":"";if(e){console.info(`storage: persistent-storage request granted${r}`);return}let n=!ad()&&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 `+(ad()?"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 ta(){if(!Mt)return;let[e,t]=await Promise.all([Pc(),(async()=>{try{return(await ue()).length>0||await Eo()}catch{return!1}})()]);Rt=e,ld=t,K0()}function cd(){!Mt||id||(id=setTimeout(()=>{id=0,ta()},1e3))}async function lg(){if(ea||(await ta(),Rt?.persisted!==!1||!ld||ea))return;ea=!0;let e=await Fn();cg(e,!1),await ta()}async function q0(){if(Rt&&Rt.persisted===!1){ea=!0;let e=await Fn();cg(e,!0),e||await ig()}await ta()}function dg(e){Mt=e,Mt&&(Mt.addEventListener("click",()=>{q0()}),_o((t,r)=>{cd(),r==="save"&&lg()}),lg())}var ss='<path class="bg" d="M3 2h6l4 4v8H3z"/><path fill="rgba(0,0,0,.18)" d="M9 2v4h4Z"/>',re={default:`<svg class="file-icon brand-deepview" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true">${ss}<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">${ss}<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">${ss}<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">${ss}<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">${ss}<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 rt(e){let t=No(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 Le(e){return e.toLowerCase().endsWith(".codex")?e.slice(0,-6).replaceAll("__","/"):e}var ug=globalThis[Symbol.for("@rray/frontend")];if(!ug)throw new Error("@rray/frontend global not installed; view.js must run before lazy bundles import this wrapper");var{LitElement:JA,html:dd,nothing:pg,unsafeCSS:XA,render:QA,StateElement:ZA,classMap:e6,repeat:t6,styleMap:r6}=ug;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 mg(e){return e!=null&&e in ve?e:null}function Kt(e){return mg(e?.correctedSeverity)??e?.severity}function qt(e){let t=mg(e?.correctedSeverity);return t!=null&&t!==e?.severity}function te(e,t){return t==="original"?e?.severity:Kt(e)}function ra(e){let t=e?._correctedByReport;return t&&new Set(Object.values(t).map(n=>n?.severity)).size>1?t:null}function na(e){return new RegExp(`(^|/)${e}/`,"u")}function bg(e){return new RegExp(`^(?:.*/)?${e}/(?:@[^/]+/[^/]+|[^/]+)/(.*)$`,"u")}var G0=na("node_modules"),Y0=na("vendor"),is="node_modules",yg=na(is),vg=bg(is);function J0(e){e!==is&&(is=e,yg=na(e),vg=bg(e))}function wg(e){let t=!1,r=!1,n=o=>(!t&&G0.test(o)&&(t=!0),!r&&Y0.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}}J0(t?"node_modules":r?"vendor":"dependencies")}function kg(){return is}function yr(e){return yg.test(e)}function ne(e){return typeof e!="number"||!Number.isFinite(e)?null:`${e.toLocaleString()} B`}function nt(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 X0(e){return e.match(vg)?.[1]??e}function dt(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 Zr(e){let t=e?.exportName,r=e?.methodName;return t&&r&&t!==r?`${t}.${r}`:t||r||""}function $g(e){return[e.file,e.description,e.recommendation,e.confidenceReason,e.discoveredIn,e.repo?.github].filter(Boolean).join(`
45
- `).toLowerCase()}function as(e){return e&&e.replace(/^[^/]+\//u,"").replace(/^claude-/u,"").replaceAll("-"," ")}function en(e){return[e.type,as(e.model),e.effort,e.exportsMode].filter(Boolean).join(" \xB7 ")}function oa(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 xg(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 Q0=/^(?:@[\w.-]+\/)?[\w.-]+@[^/\s@]+$/u;function Z0(e){return Q0.test(e||"")}function On(e,t,r){if(Z0(e))return null;if(t)return`https://github.com/${t}/blob/HEAD/${X0(e)}`;if(yr(e))return null;let n=xg(r);return n?`${n}/blob/HEAD/${e}`:null}function pd(e,t,r){let n=On(e,t,r);return n?dd`<a href="${n}" target="_blank" rel="noopener">${e}</a>`:e}function vr(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 _g(e,t,r,n){let o=parseInt(t,10);if(!Number.isFinite(o))return pg;let s=On(e,r,n),i=`line ${o}`;return s?dd`<a href="${`${s}#L${o}`}" target="_blank" rel="noopener">${i}</a>`:i}function Sg(e,t){return!e||!t?null:`${/^https?:/iu.test(e)?e.replace(/\/$/u,""):`https://github.com/${e}`}/commit/${t}`}function Cg(e,t){let r=[];return 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}`),e.confidence!==void 0&&e.confidence!==null&&r.push(`Confidence: ${e.confidence}/10`),r.join(`
46
- `)}function Eg(e,{title:t,body:r}={}){let n=xg(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 ek=/^[a-zA-Z\d](?:-?[a-zA-Z\d])*$/u,tk=/^[a-zA-Z\d._-]+$/u,rk=/^[1-9]\d{0,9}$/u,nk=/^[a-fA-F\d]{7,40}$/u,ok=/^#[\w-]+$/u,fg=/^GHSA(?:-[0-9a-z]{4}){3}$/u;function hg(e){return e.length<=39&&ek.test(e)}function gg(e){return e.length<=100&&e!=="."&&e!==".."&&tk.test(e)}function sk(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 fg.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!hg(p)||!gg(f)||!fg.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(!hg(n)||!gg(o))return null;let l;if(s==="issues"||s==="pull"){if(!rk.test(i))return null;l=`${n}/${o}#${i}`}else if(s==="commit"){if(!nk.test(i))return null;l=`${n}/${o}@${i.slice(0,7)}`}else return null;let d=ok.test(t.hash)?t.hash:"";return{url:`https://github.com/${n}/${o}/${s}/${i}${d}`,label:l}}var ud=/https?:\/\/[^\s<>"'`(){}[\]|\\^]+/giu,ik=new Set([")",".",",","!","?",";",":","'",'"',"*","]","}",">"]);function ak(e){let t=e.length;for(;t>0&&ik.has(e[t-1]);)t--;return t===e.length?e:e.slice(0,t)}function Ag(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=ak(n[0]),s=o?sk(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 wr="\0",tn="",kr="";function ls(e){return as(e.model)||null}function fd(e){if(a.filterAnalyzer){let t=e._analyzer??null,r=a.filterAnalyzer===wr?null:a.filterAnalyzer;if(t!==r)return!1}if(a.filterModel){let t=ls(e),r=a.filterModel===kr?null:a.filterModel;if(t!==r)return!1}return!0}function hd(e){return typeof e.repo?.github=="string"&&e.repo.github?e.repo.github:typeof e._repoFallback=="string"&&e._repoFallback?e._repoFallback:null}function sa(){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 lk(e){let t=a.filterInclude.toLowerCase();if(a.filterSeverities.size>0&&!a.filterSeverities.has(te(e,a.severityMode)))return!1;if(a.filterColors.size>0){let r=a.triage.get(U(e))?.color??"none";if(!a.filterColors.has(r))return!1}if(a.filterSources.size===1){let r=a.filterSources.has("own");if(r&&yr(e.file)||!r&&!yr(e.file))return!1}if(!fd(e))return!1;if(a.filterRepo){let r=hd(e),n=a.filterRepo===tn?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(U(e)),n=$g(e).includes(t)||(r?.comment??"").toLowerCase().includes(t)||(r?.fix??"").toLowerCase().includes(t);return a.filterIncludeNegate?!n:n}return!0}function ck(e){if(!a.filterComment&&!a.filterFix&&!a.filterFlagged)return!0;let t=r=>e.some(n=>r(a.triage.get(U(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 Pn(e){return e.filter(t=>t.some(lk)&&ck(t))}function Tg(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 Rg(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 Ig=Rg("desc"),dk={severity:(e,t)=>(ve[te(t,a.severityMode)]||0)-(ve[te(e,a.severityMode)]||0)||Ig(e,t)||parseInt(e.line,10)-parseInt(t.line,10),"confidence-desc":Ig,"confidence-asc":Rg("asc"),"priority-desc":Tg("priority","desc",-1),"priority-asc":Tg("priority","asc",11)};function Mg(e){let t=dk[a.sortBy];return t?e.map(r=>({p:rn(r),g:r})).toSorted((r,n)=>t(r.p,n.p)).map(r=>r.g):[...e]}function U(e){return e.id??String(e._id)}function Me(e){return U(e[0])}function gd(e){return Array.isArray(e)?e:[e]}function ia(e){return e?._reportName??""}function Dn(e){return Ht(a.triage,U(e),ia(e))}function Nn(e){return e.length<=1?e:[...e].toSorted((t,r)=>{let n=a.triage.get(U(t))?.color?1:0,o=a.triage.get(U(r))?.color?1:0;if(n!==o)return o-n;let s=ve[te(t,a.severityMode)]||0,i=ve[te(r,a.severityMode)]||0;if(s!==i)return i-s;let l=t.confidence??-1;return(r.confidence??-1)-l})}function rn(e){return e.length===1?e[0]:Nn(e)[0]}function uk(e){let t=a.triage.get(U(e));return!!t?.comment||!!t?.fix||t?.flagged===!0}function He(e){if(e.length===1)return e[0];let t=a.activeTabByGroup.get(Me(e));if(t){let o=e.find(s=>U(s)===t);if(o)return o}let r=Nn(e),n=r;if(a.filterAnalyzer||a.filterModel){let o=r.filter(fd);o.length>0&&(n=o)}return n.find(uk)??n[0]}function aa(e){for(let t of Et().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 _e(e){let t=0,r=!1,n,o=!1,s=!1,i,l=!1,d=null,u=!1,p=!0;for(let v of e){let w=a.triage.get(U(v)),y=w?.triage??(Dn(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?(d===null&&(d=y),y==="ignored"?p=!1:u=!0):p=!1)}let f=r||s,h=!f&&o?n:null,b=t>0&&p,m=!f&&d!==null?d: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 Gt(){let e=a.reports.flatMap(d=>d.groups),t=a.workspaceMerges;if(!t||t.length===0)return e;let r=e.map((d,u)=>u),n=d=>{let u=d;for(;r[u]!==u;)u=r[u];for(;r[d]!==u;){let p=r[d];r[d]=u,d=p}return u},o=(d,u)=>{let p=n(d),f=n(u);p!==f&&(r[p]=f)},s=new Map;for(let d=0;d<e.length;d++)for(let u of e[d])u.id&&s.set(u.id,d);for(let d of t){let u=-1;for(let p of d){let f=s.get(p);f!==void 0&&(u===-1?u=f:o(u,f))}}let i=new Set,l=[];for(let d=0;d<e.length;d++){let u=n(d);if(i.has(u))continue;i.add(u);let p=[];for(let y=d;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 nn(e){for(let t of Gt())if(Me(t)===e)return t;return null}var bd={"claude-security":"Claude Security","codex-security":"Codex Security",deepsec:"DeepSec",piolium:"Piolium"};function Bg(e){return e==null?"(none)":bd[e]??e}function Fg(e){return e??"(no model)"}var md=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 g;let n=a.filterAnalyzer===""?void 0:a.filterAnalyzer===wr?null:a.filterAnalyzer,o=a.filterModel===""?void 0:a.filterModel===kr?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=ls(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:Bg(n),d=o===void 0?null:Fg(o),u=l!=null&&d!=null?`${l} \xB7 ${d}`:l??d??(t?"All analyzers":"All models"),p=l!=null||d!=null;return c`<button type="button" class="${B({"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:wr,labelOf:Bg,counts:s,current:a.filterAnalyzer}):g} ${t&&r?c`<div class="analyzer-menu-sep"></div>`:g} ${r?this._column({dim:"model",heading:"Model",allLabel:"All models",values:this.models,sentinel:kr,labelOf:Fg,counts:i,current:a.filterModel}):g}</div>`}_column({dim:t,heading:r,allLabel:n,values:o,sentinel:s,labelOf:i,counts:l,current:d}){return c`<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(d==="")}" class="${B({"analyzer-menu-item":!0,active:d===""})}" @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=d===p;return c`<button type="button" aria-pressed="${String(h)}" class="${B({"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 d=n.bottom+i;d+s>window.innerHeight-4&&n.top>s+i&&(d=n.top-s-i),t.style.top=`${d}px`,t.style.left=`${l}px`}updated(){this._open&&this.querySelector(".analyzer-menu")?.matches(":popover-open")&&this._position()}};customElements.define("analyzer-select",md);function Ve(e){return e==="informational"?"info":e.replaceAll("_"," ")}function yd(e,{variant:t="full"}={}){let r=a.severityMode,n=te(e,r),o=c`<span class="${`badge ${n}`}">${Ve(n)}</span>`,s=qt(e),i=t==="tab"?null:ra(e);if(!s&&!i)return o;let l=i?`Corrected severity varies across reports \u2014 ${Object.entries(i).map(([_,T])=>`${_||"(this report)"}: ${Ve(T.severity)}`).join("; ")}`:null,d=i?c`<span class="badge-varies" title="${l}" aria-label="${l}">varies</span>`:g;if(!s)return c`<span class="${`badge-pair badge-pair-${t}`}">${o}${d}</span>`;let u=e.severity,p=Kt(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 ${Ve(u)}`:`Original severity \u2014 corrected ${b} to ${Ve(p)}`)+(f?` \u2014 ${f}`:""),y=`Severity ${Ve(n)}; ${v?`corrected ${b} from ${Ve(u)}`:`original, corrected to ${Ve(p)}`}${f?`; reason: ${f}`:""}`;if(t==="tab")return c`<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 c`<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?c`<span class="badge-pre" aria-hidden="true">was</span>`:g}<span class="${`badge-orig ${k}${v?" struck":""}`}">${Ve(k)}</span></span>${d}</span>`}function la(e){if(!e)return"";for(let t of e.split(`
47
- `))if(t.trim())return t.trim();return""}function pk(e){if(!e)return{title:"",body:""};let t=e.indexOf(`
48
- `);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 Lg=/\*\*[^*\n]+\*\*|"[^"\n]+"|`[^`\n]+`/gu;function $r(e){if(!e)return e;Lg.lastIndex=0;let t=[],r=0,n;for(;(n=Lg.exec(e))!==null;){n.index>r&&t.push(e.slice(r,n.index));let o=n[0].codePointAt(0);if(o===42)t.push(c`<strong>${n[0].slice(2,-2)}</strong>`);else{let s=o===96?"inline-code":"inline-quote";t.push(c`<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 fk(e){return Ag(e).map(t=>typeof t=="string"?t:c`<a href="${t.url}" target="_blank" rel="noopener noreferrer" title="${t.url}">${t.label}</a>`)}function hk(e){let t=On(e.file,e.repo?.github,e._repoFallback??a.repoUrl),r=parseInt(e.line,10),n=Number.isFinite(r)?`${e.file}:${e.line}`:e.file;if(!t)return n;let o=Number.isFinite(r)?`${t}#L${r}`:t;return c`<a href="${o}" target="_blank" rel="noopener">${n}</a>`}function gk(e,t){if(!t)return g;let r=t.slice(0,7),n=Sg(e,t);return n?c`<a href="${n}" target="_blank" rel="noopener" title="${t}">${r}</a>`:c`<span title="${t}">${r}</span>`}var ca=c`<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>`,cs=c`<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>`,mk=c`<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>`,bk=c`<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>`,yk=c`<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>`,da=c`<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 vk(e,t=!1){let r=a.triage.get(e)?.flagged===!0,n=r?"Remove flag":"Flag this finding";return c`<button type="button" class="${B({"mark-flag":!0,flagged:r})}" data-flag-toggle="${e}" title="${n}" aria-label="${n}" aria-pressed="${String(r)}">${da}${t?c`<span class="mark-btn-label">${r?"Flagged":"Flag"}</span>`:g}</button>`}function wk(e){let t=la(e.description)||e.file||"Security finding";return t.length>120?`${t.slice(0,119)}\u2026`:t}function kk(e){let t=On(e.file,e.repo?.github,e._repoFallback??a.repoUrl),r=parseInt(e.line,10),n=Number.isFinite(r),o=n?`${e.file}:${r}`:e.file,s=t&&n?`${t}#L${r}`:t,i=[];return e.file&&i.push(`File: ${s?`[${o}](${s})`:o}`),e.description&&i.push(e.description),e.confidence!==void 0&&e.confidence!==null&&i.push(`Confidence: ${e.confidence}/10`),i.join(`
49
-
50
- `)}function $k(e){if(!a.currentWorkspace)return g;let t=e[0]?._reportName;if(!t)return g;let r=re[rt(t)]??re.default;return c`<span class="report-chip" title="${t}">${ye(r)}<span class="report-chip-label">${Le(t)}</span></span>`}function Og(e,t,r,n,o=null){let s=$k(e),i=U(n),l=a.triage.get(i),d=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=c`<button type="button" class="${B({"mark-comment":!0,"has-comment":u})}" title="${f}" aria-label="${f}">${ca}${b?c`<span class="mark-btn-label">${m}</span>`:g}</button>`,y=c`<button type="button" class="${B({"mark-fix":!0,"has-fix":p})}" title="${h}" aria-label="${h}">${cs}${b?c`<span class="mark-btn-label">${v}</span>`:g}</button>`,k=vk(i,b),_=c`<button type="button" class="mark-copy" title="Copy file, line, description, confidence to clipboard" aria-label="Copy finding details to clipboard">${mk}${b?c`<span class="mark-btn-label">Copy</span>`:g}</button>`,T=aa(n),S=Eg(T,{title:wk(n),body:kk(n)}),I=S?c`<a class="mark-issue" href="${S}" target="_blank" rel="noopener" title="Create a pre-filled GitHub issue for this finding" aria-label="Create a GitHub issue for this finding">${yk}${b?c`<span class="mark-btn-label">Issue</span>`:g}</a>`:g,R=c`<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">${bk}${b?c`<span class="mark-btn-label">Claude</span>`:g}</button>`,O=c`<color-marker .selected="${d}"></color-marker>`,K=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 c`${s}<span class="mark-action-group">${w}${y}${k}</span><span class="mark-action-group">${_}${I}${R}</span>${O}${_k(e,K,o,r,n)}`}function xk(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,d=o.right-s;d<4&&(d=4),d+s>window.innerWidth-4&&(d=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=`${d}px`}function _k(e,t,r,n,o){let s=U(e[0]),i=U(o),l=n.hasConflict?a.triage.get(i)?.triage??(Dn(o)?"ignored":null):n.commonTriage,d={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?d[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 c`<div class="triage-menu-wrap"><button type="button" class="${v.join(" ")}" popovertarget="${w}" popovertargetaction="toggle" title="${t}" aria-label="${t}">${f?c`<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="${xk}">${m.map(y=>c`<button type="button" class="${B({"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 Sk(e){let t=!!e?.comment,r=!!e?.fix,n=e?.flagged===!0;return!t&&!r&&!n?g:c`<span class="tab-marks">${t?c`<span class="has-comment" title="Has a comment">${ca}</span>`:g}${r?c`<span class="has-fix" title="Has a fix link">${cs}</span>`:g}${n?c`<span class="flagged" title="Flagged">${da}</span>`:g}</span>`}function Pg(e,t){let r=U(e),n=a.triage.get(r),o=n?.color,s=n?.triage,i=Dn(e),l=["tab"];return t&&l.push("active"),o&&l.push(`tab-mark-${o}`),s?l.push(`tab-${s}`):i&&l.push("tab-ignored"),c`<button type="button" class="${l.join(" ")}" data-tid="${r}"><span class="tab-label">${yd(e,{variant:"tab"})} ${e.confidence===void 0?g:c`<span class="tab-conf">${e.confidence}/10</span>`}${Sk(n)}</span></button>`}function Ck(e){if(a.viewMode==="table"||a.viewMode==="focus"){let t=e.confidence*10;return c`<div class="${`conf-ring ${te(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 c`<div class="conf-score"><strong>${e.confidence}</strong>/10</div><div class="value-label">Confidence</div>`}var Ek=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/iu;function Ak(e){if(gn(e))return g;let t=e?.name;if(typeof t!="string"||!Ek.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 c`<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 Tk(e,t,r=0,n=1,o=null){let s=U(e),i=a.triage.get(s),l=i?.comment??"",d=i?.fix??"",u=On(e.file,e.repo?.github,e._repoFallback??a.repoUrl),p=parseInt(e.line,10),f=Number.isFinite(p),h=f?`${e.file}:${e.line}`:e.file,b=u?c`<a href="${f?`${u}#L${p}`:u}" target="_blank" rel="noopener">${h}</a>`:h,m=Zr(e),v=m?c`<span class="line-num">${b}, ${m}</span>`:c`<span class="line-num">${b}</span>`,w=en(e),y=o==="focus"?Ak(e.package?.npm):g,k=g;if(o!=="focus"&&e.fileHash&&Array.isArray(e._bundleHashes)&&e._bundleHashes.length>0){let S=new Set(e._bundleHashes),I=Jr(e.fileHash).find(({integrity:R})=>S.has(R));I&&(k=c`<button type="button" class="finding-code-btn" data-finding-code-bundle="${I.integrity}" data-finding-code-file="${I.file}" data-finding-code-line="${e.line??""}" title="${`Open ${I.file} in bundle source viewer`}">Code</button>`)}let{title:_,body:T}=pk(dt(e.description,e));return c`<div class="${B({"tab-body":!0,active:t})}" data-tid="${s}">${n>1?c`<div class="print-case-label">${r+1} of ${n}</div>`:g}<div class="finding-left">${yd(e,{variant:"full"})}<div class="value-label">Severity</div>${e.confidence===void 0?g:Ck(e)} ${k}</div><div><div class="line-row">${v} ${y} ${e.discoveredIn?c`<span class="line-num discovered-in">(found analyzing ${e.discoveredIn})</span>`:g} ${w?c`<span class="run-meta">${w}</span>`:g}</div>${_?c`<div class="desc-title">${_}</div>`:g} ${T?c`<div class="desc">${$r(T)}</div>`:g} ${e.recommendation?c`<div class="recommendation">Recommendation: ${$r(dt(e.recommendation,e))}</div>`:g} ${e.confidenceReason?c`<div class="conf-reason">${$r(dt(e.confidenceReason,e))}</div>`:g} ${qt(e)&&e.correctedSeverityReason?c`<div class="severity-reason"><span class="severity-reason-label">Severity correction:</span> ${$r(e.correctedSeverityReason)}</div>`:g} ${l?c`<div class="comment-block"><span class="comment-label">Comment:</span> ${fk(l)}</div>`:g} ${d?c`<div class="fix-block"><span class="fix-label">Fix:</span> ${vr(d)?c`<a href="${d}" target="_blank" rel="noopener noreferrer">${d}</a>`:d}</div>`:g}</div></div>`}function zn(e){return Me(e)}function Dg(e){let t=_e(e),r=Nn(e),n=e.some(s=>s.critical||te(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 Ng(e,t={}){let{context:r=null}=t,n=_e(e),o=Nn(e),s=He(e),i=U(s),l=s.commitHash?c`<div class="commit-ref">introduced in ${gk(s.repo?.github,s.commitHash)}</div>`:g,d=a.currentWorkspace&&l!==g;return c`${o.map((u,p)=>Tk(u,U(u)===i,p,o.length,r))} ${d?c`<div class="marks-commit-row">${l}</div>`:g}<div class="marks"><div class="marks-left">${d?g:l} ${o.length>1?c`<div class="tabs">${o.map(u=>Pg(u,U(u)===i))}</div>`:g}</div>${Og(e,o,n,s,r)}</div>`}function ds(e){return Me(e)}function zg(e){let t=_e(e),r=e.some(o=>o.critical||te(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 Ug(e){let t=_e(e),r=Nn(e),n=He(e),o=U(n),s=n,i=la(dt(s.description,s)),l=en(s),d=Zr(s),u=d?`, ${d}`:"";return c`<div class="row-score">${yd(s,{variant:"compact"})} ${s.confidence===void 0?g:c`<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?c`<span class="row-type">${l}</span>`:g}</div><div class="meta-row"><span class="row-loc">${hk(s)}${u}</span><div class="marks">${Og(e,r,t,n)}</div></div>${r.length>1?c`<div class="tabs-row"><div class="tabs">${r.map(p=>Pg(p,U(p)===o))}</div></div>`:g}</div>`}function us(e){return"tree-"+e.replaceAll(/[^\w-]+/gu,"_")}var Vg=()=>Object.fromEntries(we.map(e=>[e,0]));function vd(e,t){let r=new Map;for(let n of e)for(let o of n){r.has(o.file)||r.set(o.file,Vg());let s=r.get(o.file),i=te(o,t);s[i]!==void 0&&s[i]++}return r}function wd(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 ua(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 d of e[l]?.imports??[])e[d]&&s.push(d)}}let i=Vg();for(let l of o){let d=t.get(l);if(d)for(let u of we)i[u]+=d[u]??0}r.set(n,i)}return r}function kd(e,t,r){let n=t.get(e),o=r.get(e);return Hg(n)>0||Hg(o)>0}function Hg(e){if(!e)return 0;let t=0;for(let r of we)t+=e[r]??0;return t}function jg(e){if(!e)return g;let t=Jr(e)[0];return t?c`<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 Wg(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]?c`<a href="${`#${us(p)}`}"><span class="name">${p}</span></a>`:c`<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:c`<span class="tree-count-chips">${h.map(b=>c`<span class="${`tree-count-chip ${b}`}">${f[b]} ${b.replaceAll("_"," ")}</span>`)}</span>`},d=p=>{let f=t.get(p);return f?we.reduce((h,b)=>h+(f[b]??0),0):0},u=c`<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 c`<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?c`<div class="tree-table-empty">No files match the search.</div>`:g} ${s.map(b=>{let m=d(b),v=b===p,w=ne(e[b]?.size);return c`<div class="${`tree-table-row${v?" selected":""}${m===0?" clean":""}`}" data-tree-select="${b}"><span class="tree-table-name">${b}</span> ${l(b)??c`<span class="tree-table-clean-marker">—</span>`} ${w?c`<span class="tree-table-size">${w}</span>`:g}</div>`})}</div>${p?c`<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">${Ik(e[p],p,n.get(p)??[],i)}</div></aside>`:g}</div></div>`}return c`<div class="tree-view">${u} ${s.length===0?c`<div class="tree-table-empty">No files match the search.</div>`:g} ${s.map(p=>{let f=e[p],h=n.get(p)??[],b=ne(f?.size);return c`<section class="tree-file" id="${us(p)}"><div class="tree-file-header"><span class="name">${p}</span> ${l(p)} ${b?c`<span class="tree-file-size">${b}</span>`:g} ${jg(f.fileHash)}</div>${f.fileHash||f.treeHash?c`<div class="tree-hashes hashes">${f.fileHash?c`<div class="tree-hash">file: ${f.fileHash}</div>`:g} ${f.treeHash?c`<div class="tree-hash">tree: ${f.treeHash}</div>`:g}</div>`:g} ${f.imports?.length>0?c`<div class="tree-section"><span class="tree-section-label">imports</span><ul>${f.imports.map(m=>c`<li>${i(m)}</li>`)}</ul></div>`:g} ${h.length>0?c`<div class="tree-section"><span class="tree-section-label">imported by</span><ul>${h.map(m=>c`<li>${i(m)}</li>`)}</ul></div>`:g} ${f.exports?.length>0?c`<div class="tree-section"><span class="tree-section-label">exports</span><ul>${f.exports.map(m=>c`<li><span class="name">${m}</span></li>`)}</ul></div>`:g}</section>`})}</div>`}function Ik(e,t,r,n){let o=ne(e?.size);return c`<div class="tree-detail-name"><span class="name">${t}</span> ${o?c`<span class="tree-detail-size">${o}</span>`:g} ${jg(e.fileHash)}</div>${e.fileHash||e.treeHash?c`<div class="tree-hashes hashes">${e.fileHash?c`<div class="tree-hash">file: ${e.fileHash}</div>`:g} ${e.treeHash?c`<div class="tree-hash">tree: ${e.treeHash}</div>`:g}</div>`:g} ${e.imports?.length>0?c`<div class="tree-section"><span class="tree-section-label">imports</span><ul>${e.imports.map(s=>c`<li>${n(s)}</li>`)}</ul></div>`:g} ${r.length>0?c`<div class="tree-section"><span class="tree-section-label">imported by</span><ul>${r.map(s=>c`<li>${n(s)}</li>`)}</ul></div>`:g} ${e.exports?.length>0?c`<div class="tree-section"><span class="tree-section-label">exports</span><ul>${e.exports.map(s=>c`<li><span class="name">${s}</span></li>`)}</ul></div>`:g}`}function Rk(){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 xr=Rk(),A=new Proxy(xr,{get(e,t){return xr[t]},set(e,t,r){return xr[t]=r,!0},has(e,t){return t in xr},deleteProperty(e,t){return delete xr[t]},ownKeys(){return Reflect.ownKeys(xr)},getOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(xr,t)}});function Oe(){A.graphState?._cleanup&&A.graphState._cleanup(),A.graphState=null}function Kg(){return xr}var ps=null,qg=null;function Un(){return qg}function Mk(){return ps||(ps=(async()=>{let e="./graph.js";try{let t=await import(e);return t._swapGraph2Impl(Kg()),qg=t,t}catch(t){throw ps=null,t}})(),ps)}async function $d(e,t,r,n,o){try{let s=await Mk(),i=s.buildGraphFromPrep(t);q(c`<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 je(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 _r(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 fs(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 hs=null,gs=null;function Bk(){return hs||(hs=(async()=>{let e="./terminal.js";try{return await import(e)}catch(t){throw hs=null,t}})(),hs)}function Fk(e){let t=je(e);if(t.size===0)return t;let r=[...t.keys()],{stripped:n}=nt(r),o=new Map;for(let s=0;s<r.length;s++)o.set(n[s],t.get(r[s]));return o}async function Gg(e,t){let r=t?.integrity??"";(!gs||gs.integrity!==r)&&(gs={integrity:r,promise:Lk(t,r)});try{let n=await gs.promise;return!e.isConnected||e.contains(n)||e.replaceChildren(n),n}catch(n){gs=null;let o=n instanceof Error?n.message:String(n);return e.textContent=`Terminal failed to load: ${o}`,null}}async function Lk(e,t){return(await Bk()).createTerminalElement(Fk(e),t)}function Jg(e){if(!e)return null;let t=kg(),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 Ok=["#4e9af1","#f28e2b","#59a14f","#e15759","#76b7b2","#edc948","#b07aa1","#ff9da7","#9c755f","#5cd1e5","#f1ce63","#d37295","#a0cbe8","#86bcb6","#8cd17d","#b6992d","#499894","#e15759","#e879c7","#d4a6c8"],Yg=["#2f8aef","#d2691e","#2ea043","#e63946","#2e9a92","#b88817","#9560e8","#d24a9c","#8a5d40","#0891b2","#a07a14","#c14e8e","#1f7ad0","#549b94","#3fb95f","#a07a14","#2a8278","#cb2c40","#c026d3","#965f93"];function Pk(){if(typeof document>"u")return!1;let e=document.body?.classList;return!!e&&(e.contains("theme-light")||e.contains("theme-pink"))}var xd=new Map;function Ye(e){let t=Pk()?Yg:Ok,n=`${t===Yg?"l":"d"}:${e??"__own__"}`;if(xd.has(n))return xd.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,d=t[l];return xd.set(n,d),d}var _d=(e,t,r)=>{for(let n of t)if(n[0]===e)return(0,n[1])();return r?.()};var Hn='<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>',pa='<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 Xg="@preventive/triage";function Sd(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 fa(e){let t=/^(.*?)\.stasis\.(?:code|resources)\.br$/u.exec(e);return t?t[1]:e.replace(/\.[^.]+$/u,"")||e}function Qg(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 Zg(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 em(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:Sd(r.name,r.version)}:{name:fa(t?.name??"bundle"),version:null,purl:null},rest:n}}function tm(e){return e??globalThis.crypto.randomUUID()}function rm(e,t,{now:r=new Date,uuid:n}={}){let o=Qg(e),{root:s,rest:i}=em(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 d={bomFormat:"CycloneDX",specVersion:"1.5",serialNumber:`urn:uuid:${tm(n)}`,version:1,metadata:{timestamp:r.toISOString(),tools:{components:[{type:"application",name:Xg}]},component:l},components:i.map(u=>{let p=Sd(u.name,u.version);return{type:"library","bom-ref":p,name:u.name,version:u.version,purl:p}})};return`${JSON.stringify(d,null,2)}
51
- `}function Dk(e){return{referenceCategory:"PACKAGE-MANAGER",referenceType:"purl",referenceLocator:e}}function nm(e,t,{now:r=new Date,uuid:n}={}){let o=Qg(e),{root:s,rest:i}=em(o,t),l=fa(t?.name??"bundle"),d=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=[Dk(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,Sd(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)}-${tm(n)}`,creationInfo:{created:d,creators:[`Tool: ${Xg}`]},packages:f,relationships:h};return`${JSON.stringify(b,null,2)}
52
- `}function Nk(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 Cd(e,t,r){if(t){let s=Nk(e,r);if(s.error)return{error:s.error};let{re:i}=s;return{ranges(l){i.lastIndex=0;let d=[],u;for(;(u=i.exec(l))!==null;){if(u[0].length===0){i.lastIndex++;continue}if(d.push([u.index,u.index+u[0].length]),d.length>=50)break}return d}}}let n=r?e:e.toLowerCase(),o=n.length;return{ranges(s){let i=r?s:s.toLowerCase(),l=[],d=0,u;for(;(u=i.indexOf(n,d))!==-1&&(l.push([u,u+o]),d=u+o,!(l.length>=50)););return l}}}function zk(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 d=l.split(`
53
- `),u=[];for(let p=0;p<d.length;p++){let f=t.ranges(d[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:d,hits:u}),s)break;if(n.length>=500){s=!0;break}}return{fileResults:n,totalHits:o,truncated:s}}function Uk(e,t){let r=[],n=0;for(let{path:o,lines:s,hits:i}of e.fileResults){let l=[];for(let{ln:d}of i){let u=t.ranges(s[d-1]);u.length!==0&&(l.push({ln:d,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 om(e,t,r,n,o){if(!r)return{fileResults:[],totalHits:0,truncated:!1};let s=Cd(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),d=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)||(d=h.result,u=b.length)}let p=d?Uk(d,s):zk(t,s);return Je.entries.unshift({query:r,result:p}),Je.entries.length>8&&Je.entries.pop(),p}function ut(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 sm(e,t=null){let r=new Set;for(let n of e){let o=t?.(n)??null;if(ut(n,{splitOwnDirs:!1,packageDir:o})==="__own__"&&(r.add(ut(n,{splitOwnDirs:!0,packageDir:o})),r.size>1))return!0}return!1}var ha=null;function Hk(){return ha||(ha=(async()=>await import("./prism.js"))(),ha)}var Vk={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 ga(e){if(typeof e!="string")return null;let t=e.lastIndexOf(".");return t<0?null:Vk[e.slice(t+1).toLowerCase()]??null}async function ma(e,t){if(!t)return null;try{return(await Hk()).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}
54
- `;var Ed=class extends M{static styles=[...M.styles,F(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 c`<span class="lwd-option-hint">The local file will be overwritten.</span>`;let r=t===1?c`workspace <strong>"${this.workspaceNames[0]}"</strong>`:c`<strong>${t}</strong> workspaces (${this.workspaceNames.join(", ")})`;return c`<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?c`<p class="lwd-rename-error">Pick a name different from the original.</p>`:t.includes("\0")?c`<p class="lwd-rename-error">The new name cannot contain a NUL byte.</p>`:t.includes("/")||t.includes("\\")?c`<p class="lwd-rename-error">The new name cannot contain "/" or "\\".</p>`:this.existingNames.has(t)?c`<p class="lwd-rename-error">A file named "${t}" already exists — pick something else.</p>`:g:c`<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?c`<span class="lwd-option-hint">Saved as an unfiled report — the renamed copy isn't added to any workspace.</span>`:g;return c`<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",Ed);function im({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:Wk(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 Wk(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 Kk=new Set(["module","commonjs","json","module-typescript","commonjs-typescript"]),qk=new Set(["solidity","php","shell","rust"]),Gk=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"]),Yk=new Set(["resource","resource:base64"]),cm=new Set(["stat:file","stat:directory"]),dm=new Set([...Kk,...qk,...Gk,...Yk,"patch","directory",...cm]),Ad=e=>cm.has(e),am=e=>e==="directory"||e==="stat:directory"?"directory":"file";function Jk(e,t,r){if(e===t)return e;let n=Ad(e),o=Ad(t);if(n!==o&&am(e)===am(t))return n?t:e;throw new Error(`format conflict for '${r}' ('${t}' vs '${e}')`)}function Vn(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"&&!Kn(n)))for(let s of Object.keys(o))r.add(Vn(n,s));return r}function Xk(e,{what:t,files:r,formats:n,scope:o}){if(pt(e))return"escapes the root";if(o!=="full"&&!Kn(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":Ad(s)?`is a payload-free '${s}' record, not a file`:null}function pm(e,{what:t,files:r,formats:n,scope:o}){for(let s of e){let i=Xk(s,{what:t,files:r,formats:n,scope:o});H(i===null,`${t}: executable entry '${s}' ${i}`)}}function fm(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 pm(i,{what:t,files:r,formats:n,scope:o}),i}function hm(e,{what:t,modules:r,formats:n,scope:o}){if(e.size!==0)return pm(e,{what:t,files:um(r,{scope:o}),formats:n,scope:o}),ba(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 bs=e=>e&&[null,Object.prototype].includes(Object.getPrototypeOf(e)),Wn=e=>Object.setPrototypeOf(Object.fromEntries(e),null),ba=e=>[...e].toSorted((t,r)=>jn(t,r)),ms=(e,{sorted:t=!0}={})=>{if(!t){let r=Object.create(null);for(let[n,o]of e)r[n]=o instanceof Map?ms(o,{sorted:t}):o;return r}return Wn([...e].toSorted((r,n)=>jn(r[0],n[0])).map(([r,n])=>[r,n instanceof Map?ms(n,{sorted:t}):n]))},Td=e=>new Map(Object.entries(e).map(([t,r])=>[t,bs(r)?Td(r):r]));function pt(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 Qk(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 lm=e=>e instanceof Map?`{${[...e].map(([t,r])=>`${t}: ${r}`).join(", ")}}`:e;function gm(e,t,r){let n=new Map,o=s=>{for(let[i,l]of s){let d=n.get(i);d===void 0&&n.set(i,d=new Map);for(let[u,p]of l){let f=d.get(u);f===void 0&&d.set(u,f=new Map);for(let[h,b]of p)f.has(h)?H(Qk(f.get(h),b),`${r}: import '${h}' from '${u}' resolves differently ('${lm(f.get(h))}' vs '${lm(b)}')`):f.set(h,b instanceof Map?new Map(b):b)}}};return o(e),o(t),n}function mm(e,t,r){let n=new Map,o=s=>{for(let[i,l]of s){let d=n.get(i);if(d===void 0){n.set(i,l);continue}try{n.set(i,Jk(l,d,i))}catch(u){throw new Error(`${r}: ${u.message}`,{cause:u})}}};return o(e),o(t),n}function bm(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 ym(e,t,r){let n=new Map,o=s=>{for(let[i,l]of s){let d=n.get(i);if(d===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(d.name===l.name,`${r}: module '${i}' name mismatch ('${d.name}' vs '${l.name}')`),H(d.version===l.version,`${r}: module '${i}' version mismatch ('${d.version}' vs '${l.version}')`),H(d.ecosystem===l.ecosystem,`${r}: module '${i}' ecosystem mismatch ('${d.ecosystem??"(none)"}' vs '${l.ecosystem??"(none)"}')`);for(let[u,p]of Object.entries(l.files))Object.hasOwn(d.files,u)?H(d.files[u]===p,`${r}: content mismatch for '${Vn(i,u)}'`):d.files[u]=p}};return o(e),o(t),n}function Kn(e){return e.split("/").includes("node_modules")}function Zk(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 vm(e){let t="node_modules/",r=Zk(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 Sr=1,wm=0,km=({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:Wn(Object.entries(n))}),e$=e=>vm(e)??{dir:".",rel:e,name:null},$m=(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]=ba(new Set([...r[o]??[],...s]));return r},ya=class e{static VERSION=Sr;version=Sr;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:d=Sr}={}){H([wm,Sr].includes(d)),H(["node_modules","full"].includes(t.scope)),this.version=d,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(Vn(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(Vn(t,n))))return!0;return!1}static parse(t){let r=JSON.parse(t);H(r.version===Sr||r.version===wm),H(["node_modules","full"].includes(r.config?.scope)),H(bs(r.formats)),H(bs(r.imports));let n=new Map;for(let[u,p]of Object.entries(r.formats)){H(!pt(u)),H(dm.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===Sr){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(Kn(p)),H(!pt(p)),H(f?.name&&f.version&&f.files),o.set(p,km(f))}if(u){H(r.sources&&typeof r.sources=="object");for(let[p,f]of Object.entries(r.sources))H(!Kn(p)),H(!pt(p)),H(f?.name&&f.version&&f.files),o.set(p,km(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(!pt(f))}else{H(r.sources);for(let[u,p]of Object.entries(r.sources)){H(!pt(u));let{dir:f,rel:h,name:b}=e$(u);H(!pt(f)&&!pt(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=Vn(u,f);H(!i.has(h),`duplicate file key '${h}' across bundle buckets`),i.add(h)}let l=Td(r.imports),d=u=>{if(typeof u=="string"){H(!pt(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(!pt(f))};for(let[,u]of l){H(u instanceof Map);for(let[p,f]of u){H(!pt(p)),H(f instanceof Map);for(let[,h]of f)d(h)}}return new e({version:r.version,config:r.config,entries:s,modules:o,formats:n,imports:l,executable:r.version===Sr?fm(r.executable,{what:"bundle",files:i,formats:n,scope:r.config.scope}):new Set,reason:bs(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 d=Kn(n);d&&H(o&&s&&l);let u=Wn(Object.entries(l).toSorted((f,h)=>jn(f[0],h[0])));(d?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:Wn(t),sources:Wn(r)}}serialize(){let t=ba(this.entries),{modules:r,sources:n}=this.#e(),o=ms(this.formats),s=ms(this.imports),i={version:Sr,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=hm(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:$m(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:ym(this.modules,t.modules,"bundle merge"),formats:mm(this.formats,t.formats,"bundle merge"),imports:gm(this.imports,t.imports,"bundle merge"),executable:bm(this.executable,t.executable,t.modules,this.config.scope),reason:$m(this.reason,t.reason)})}};var va=null,wa=null,ka=null;function t$(){for(let e of["br","brotli"])try{return new DecompressionStream(e),e}catch{}return null}async function r$(e,t){let r=new Blob([t]).stream().pipeThrough(new DecompressionStream(e));return new Uint8Array(await new Response(r).arrayBuffer())}async function n$(){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 o$(){return ka||(ka=(async()=>await import("./brotli-fallback.js"))(),ka)}async function s$(){await n$();let e=t$();return e?(va={kind:"native",format:e},va):(va={kind:"fallback"},va)}function xm(){return wa||(wa=s$(),wa)}async function _m(e){let t=await xm();return t.kind==="native"?r$(t.format,e):(await o$()).brotliDecompress(e)}xm().catch(()=>{});async function qn(e,t){try{let r=await Nt(e),n=t.name.toLowerCase().endsWith(".map"),o=n?"sourcemap":"stasis";try{if(n){let l=JSON.parse($e(r));return{integrity:e,kind:o,size:r.byteLength,json:l}}let s=$e(await _m(r)),i=ya.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 i$(e){!e?.json&&!e?.bundle||(async()=>{try{let t=await Rd(e);if(Li(e.integrity,t),a.selectedBundle!==e.integrity)return;e.fileHashes=t,x()}catch{}})()}async function Id(e){if(lc(e))return;let t=(a.bundles??[]).find(n=>n.integrity===e);if(!t)return;let r=await qn(e,t);if(!(!r?.json&&!r?.bundle))try{let n=await Rd(r);Li(e,n)}catch{}}async function Yt(e){let t=(a.bundles??[]).find(n=>n.integrity===e);if(!t)return;let r=await qn(e,t);a.selectedBundle===e&&(a.bundleDetails=r,x(),i$(r),At().catch(()=>{}))}var a$=["finding_url","repository","title","description","severity","configured_scan_id","relevant_paths"];function l$(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===`
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===`
55
70
  `||l==="\r"?(r.push(n),t.push(r),r=[],n="",l==="\r"&&e[i+1]===`
56
- `&&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 Sm(e){let t=l$(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 a$)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 d=t[l];if(d.length===1&&d[0]==="")continue;let u=d[o.configured_scan_id];u&&(s.has(u)||s.set(u,[]),s.get(u).push(d))}if(s.size===0)throw new Error("Codex CSV: no rows with a configured_scan_id");let i=[];for(let[l,d]of s){let u=new Set(d.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=d.map(m=>c$(m,o));i.push({displayName:h,data:{type:"security",source:"codex-security",findings:b}})}return i}function c$(e,t){let r=(e[t.relevant_paths]||"").split(" | ").map(d=>d.trim()).find(Boolean)||"unknown",n="?",o=e[t.title]||"",s=e[t.description]||"",i=o&&s?`${o}
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}
57
72
 
58
- ${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 Gn=`.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)}}
59
- `;var Cm=`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)}
60
- `;function Yn(e){if(!e)return g;let t=e.replaceAll("_"," ");return c`<span class="${`conflict-sev sev-${e}`}">${t}</span>`}function p$(e){return`bundle-${e.slice(7,19)}\u2026`}function ot(e){return e.kind==="bundle"?e.label??p$(e.identifier):e.identifier}function f$(e){return e?c`<span class="color"><span class="${`color-dot marker-${e}`}"></span> <span class="color-name">${e}</span></span>`:c`<em>none</em>`}function h$(e){return c`<span class="comment-text">${e||c`<em>empty</em>`}</span>`}function g$(e){return e?vr(e)?c`<span class="fix-text"><a href="${e}" target="_blank" rel="noopener noreferrer">${e}</a></span>`:c`<span class="fix-text">${e}</span>`:c`<span class="comment-text"><em>empty</em></span>`}function m$(e){return e?c`<span class="${`triage triage-${e}`}">${e}</span>`:c`<em>none</em>`}function b$(e){return e?c`<span class="${`flag-badge${e==="flagged"?" on":""}`}">${e}</span>`:c`<em>none</em>`}function Em(e,t){return e==="color"?f$(t):e==="comment"?h$(t):e==="fix"?g$(t):e==="triage"?m$(t):e==="flagged"?b$(t):c`${String(t)}`}function y$(e,t){let r=e?.file?e.line?`${e.file}:${e.line}`:e.file:"";return c`<div class="card-head">${Yn(e?.severity)} ${r?c`<span class="loc" title="${r}">${r}</span>`:g} <code class="id" title="${t}">${t.slice(0,8)}…</code></div>${e?.description?c`<div class="desc" title="${e.description}">${e.description}</div>`:g}`}var Tm={title:"Triage conflicts",intro:"disagree with your local triage on",trailingNote:"",applyButton:"Apply",importedSideLabel:"Apply imported"},Am={color:0,comment:1,fix:2,triage:3,flagged:4},v$={color:"Color",comment:"Comment",fix:"Fix",triage:"Triage state",flagged:"Flag"},Md=class extends M{static styles=[...M.styles,F(Gn),F(Cm)];static properties={conflicts:{attribute:!1},findingLookup:{attribute:!1},labels:{attribute:!1},_settled:{state:!0}};constructor(){super(),this.conflicts=[],this.findingLookup=new Map,this.labels={...Tm},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)=>(Am[f.property]??99)-(Am[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,d=[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 c`<dialog @click="${this._onClick}" @cancel="${this._blockEscClose}" @close="${this._onClose}"><header><h3>${t.title}</h3><p>${u} ${t.intro} ${d}.${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])=>c`<li class="card" data-id="${p}">${y$(this.findingLookup.get(p),p)}<div class="rows">${f.map(h=>{let b=`${h.id}:${h.property}`,m=`conflict-${b}`;return c`<div class="row" data-key="${b}"><span class="row-label">${v$[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">${Em(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">${Em(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",Md);function $a(e,t,r={}){return new Promise((n,o)=>{let s=document.createElement("triage-conflict-dialog");s.conflicts=e,s.findingLookup=t,s.labels={...Tm,...r},s.addEventListener("resolve",i=>{s.remove(),n(i.detail)}),s.addEventListener("modal-conflict",i=>{s.remove(),o(xt(i.detail?.cause))}),document.body.append(s)})}var Bd=class extends M{static styles=[...M.styles,F(ct)];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 c`<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?c`<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",Bd);function Im({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(xt(o.detail?.cause))}),document.body.append(n)})}async function Rm(e){let t=await Wc(e),r;if(Yo(t)){if(r=await Im({tryPassword:o=>qi(t,o)}),!r)return null}else r=await qi(t);let n=await Kc(r,{conflictResolver:async(o,s)=>{try{return await $a(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 Bm="deepview.passkey.firstImportPrompted";function w$(){try{return localStorage.getItem(Bm)==="1"}catch{return!1}}function Mm(){try{localStorage.setItem(Bm,"1")}catch{}}async function Fd(){if(se()||!Ct()||w$())return;if(!confirm(`Encrypt your DeepView data with a passkey?
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?
61
76
 
62
77
  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.
63
78
 
64
- You can change this anytime from the lock icon in the sidebar header.`)){Mm();return}await Qi(),se()&&Mm()}var Fm=Fd;var Ld=class extends M{static styles=[...M.styles,F(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 zh(this.workspaceId,n.identifier);if(!l.ok){let d=l.reason??"unknown";r.push({kind:"bundle",identifier:n.identifier,reason:d}),this._errors=[...this._errors,{label:ot(n),reason:d}];continue}await Xr(n.identifier,this.workspaceId),t.push({kind:"bundle",identifier:n.identifier});continue}let o=await Nh(this.workspaceId,n.identifier);if(!o){r.push({kind:"report",identifier:n.identifier,reason:"not found in remote"}),this._errors=[...this._errors,{label:ot(n),reason:"not found in remote"}];continue}let s;try{s=$e(await _t(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:ot(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:ot(n),reason:l}];continue}await So(n.identifier,o.content),tt(n.identifier,i.count,i.source),await Ut(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:ot(n),reason:s}]}if(this._running=!1,this._done=!0,t.some(n=>n.kind==="report"))try{a.currentWorkspace===this.workspaceId&&await Cr(this.workspaceId)}catch{}r.length===0&&this._finish({downloaded:t,failed:r})};_errorsSection(){return this._errors.length===0?g:c`<ul class="lwd-list" role="alert">${this._errors.map(t=>c`<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?c`Download <strong>"${ot(this.items[0])}"</strong> from the workspace's remote inventory?`:c`Download <strong>${t}</strong> remote ${s} into this workspace?`,l=r?g:c`<ul class="lwd-list">${this.items.map(u=>c`<li>${ot(u)}${u.kind==="bundle"?c`<span class="lwd-kind-tag">bundle</span>`:g}</li>`)}</ul>`,d=this._running?r?"Downloading\u2026":`Downloading ${t} ${s}\u2026`:r?"Download":`Download ${t}`;return c`<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:c`<button type="button" data-role="download" @click="${this._onDownload}" ?disabled="${this._running||t===0}">${d}</button>`}</footer></dialog>`}};customElements.define("sync-download-dialog",Ld);function xa({workspaceId:e,items:t}={}){return Z("sync-download-dialog",{workspaceId:e??"",items:Array.isArray(t)?[...t]:[]})}var Er="deepview.lastFile",ys=new Set(["overview","graph","treemap","compare","advisories","issues","code","search","terminal"]);function Ar(e,t="overview"){let r=t&&t!=="overview"&&ys.has(t)?` ${t}`:"";Ie(Er,`b:${e}${r}`).catch(()=>{})}var on=0,ge=e=>e!==on;function Od(e){let t=Om(e.toLowerCase());return t.endsWith(".map")?"sourcemap":t==="stasis.code.br"||t.endsWith(".stasis.code.br")?"stasis":null}function Om(e){return e.replace(/ \(\d+\)(?=\.[^.]*$)/u,"")}async function Lm({name:e,content:t,existingNames:r}){if(!r.has(e))return await lt(e,t),r.add(e),{name:e,content:t};let n;try{n=await Ue(e)}catch(l){if(!(l instanceof DOMException&&l.name==="NotFoundError"||typeof l?.message=="string"&&l.message.startsWith("File not found:")))throw l;return await lt(e,t),r.add(e),{name:e,content:t}}if(n===t)return{name:e,content:t};let s=G().filter(l=>Array.isArray(l.reports)&&l.reports.includes(e)).filter(l=>Ln(l.id,e)),i=await im({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 lt(l,t),r.add(l),{name:l,content:t}}return await lt(e,t),s.length>0&&await k$(e,s),{name:e,content:t}}async function k$(e,t){let r;try{r=await Wr(e)}catch(n){console.warn(`Import: failed to read freshly-saved "${e}" for cloud sync:`,n);return}for(let n of t)try{await Qo(n.id);let o=await Yi(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 Pd(e){if(a.serverMode==="managed")return;await Fm();let t=null,r=null,n=new Set,o=new Set(await ue());for(let s of e)try{let i=Om(s.name.toLowerCase());if(i.endsWith(".gz")||i.endsWith(".deepview-workspace.enc")){await Rm(s);try{let u=await ue();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(Od(s.name)){let u=new Uint8Array(await s.arrayBuffer()),{integrity:p}=await Kr(s.name,u);r=p,n.add(p);continue}let d=await s.text();if(i.endsWith(".csv")){let u=Sm(d);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 Lm({name:h,content:b,existingNames:o});w&&(tt(w.name,m,v),t={name:w.name,content:w.content})}}else{let u=Ge(d);if(!u.recognized)throw new Error("not a recognized DeepView, DeepSec, Piolium, Claude Security, or Codex report");let p=await Lm({name:s.name,content:d,existingNames:o});if(!p)continue;tt(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)Id(s).catch(()=>{});t?await ft(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,Ar(r),x(),await j(),Yt(r))}async function ft(e,t){let r=++on,n=new Set(G().filter(o=>Array.isArray(o.reports)&&o.reports.includes(e)).map(o=>o.id));for(let o of P.openSessions)o&&!n.has(o.workspaceId)&&(P.closeSession(o.workspaceId),Zo(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=Ze(e),a.repoEditing=!1,A.selected=null,A.focusedPkg=null,A.layoutCache=null,A.solo=null,A.hidden.clear(),A.pathFilter="",Oe(),Ie(Er,e).catch(()=>{}),t===void 0){try{t=await Ue(e)}catch(o){if(ge(r))return;if(o&&o.message?.includes("vault locked")){if(await Zi()&&!ge(r)){await ft(e);return}ge(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=G().find(l=>Array.isArray(l.reports)&&l.reports.includes(e)&&Ln(l.id,e));if(i)try{if(await Qo(i.id),ge(r))return;let l=await xa({workspaceId:i.id,items:[{kind:"report",identifier:e}]});if(ge(r))return;if(l?.downloaded?.some(d=>d.kind==="report"&&d.identifier===e)){await ft(e);return}}catch(l){if(console.warn(`Re-download prompt for missing "${e}" failed:`,l),ge(r))return}ge(r)||(a.currentFile=null,await j());return}alert(`Failed to read ${e}: ${o.message}`),a.currentFile=null,await j();return}if(ge(r))return}if(await Nd(e,t,r),!ge(r)){for(let o of n)P.openSession(o),P.refreshSession(o),Qo(o);await j()}}async function Cr(e){let t=G().find(o=>o.id===e);if(!t)return;let r=++on;for(let o of P.openSessions)o&&o.workspaceId!==e&&(P.closeSession(o.workspaceId),Zo(o.workspaceId));(a.currentView==="bundles"||a.currentView==="packages"||a.currentView==="repositories")&&(a.currentView="findings"),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="",Oe(),Ie(Er,`ws:${e}`).catch(()=>{}),t.reports.length===0&&(E.classList.remove("active"),q(g,E),fe.classList.remove("hidden"));let n=t.reports.map(o=>Ue(o).catch(()=>null));for(let o=0;o<t.reports.length;o++){let s=await n[o];if(ge(r))return;if(s!==null&&(await Nd(t.reports[o],s,r),ge(r)))return}P.openSession(e),P.refreshSession(e),Qo(e),await j()}async function Pm({triage:e="keep",deleteFromRemoteWorkspaceIds:t=[]}={}){if(!a.currentFile)return;let r=++on,n=a.currentFile;Mn(n),et(n,"");for(let o of t)try{let s=await Ji(o,n);if(ge(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 kn(n),!ge(r)&&(await jo(n,null),!ge(r))){if(e==="wipe"){try{await Vi()}catch(o){console.warn("Skipped orphan-triage GC:",o)}if(ge(r))return}ge(r)||(Dd(),await j())}}function Dd(){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="",Oe(),yn(Er),E.classList.remove("active"),q(g,E),fe.classList.remove("hidden"),document.title="DeepView"}async function Dm(){++on;for(let e of P.openSessions)e&&(P.closeSession(e.workspaceId),Zo(e.workspaceId));Dd(),await j()}async function Nm({deleteFromRemoteWorkspaceIds:e=[]}={}){if(!a.selectedBundle)return;let t=++on,r=a.selectedBundle;for(let o of e)try{let s=await Xi(o,r);if(ge(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 Bl(r),ge(t)||(await Tc(r,null),ge(t)))return;a.selectedBundle=null,a.bundleDetails=null,a.bundleSourceFile=null,a.bundleSourceFindingIdx=null;let n=Ce(Er);typeof n=="string"&&(n===`b:${r}`||n.startsWith(`b:${r} `))&&yn(Er),ac(r),a.bundles=await vt(),!ge(t)&&(x(),await j())}async function zm(e,t="detach",{triage:r="keep"}={}){let n=G().find(l=>l.id===e);if(!n)return;++on;let o=Array.isArray(n.reports)?[...n.reports]:[];if(P.closeSession(e),Zo(e),t==="delete"){for(let l of o){try{await kn(l)}catch{}Mn(l),et(l,"")}if(r==="wipe")try{await Vi()}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)&&Dd(),await _c(e),await j()}async function Nd(e,t,r=null){let n=()=>r!==null&&ge(r);try{if(await qo,n())return;let o;try{o=JSON.parse(t)}catch(v){if(o=$n(t)??Cn(t)??En(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,d=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],_=`${v}:${y}`;for(let T of k)T.id&&(i.add(T.id),l.set(T.id,_),d.has(T.id)||d.set(T.id,T))}}let u=(v,w,y)=>{!v||!y.correctedSeverity&&!v.correctedSeverity||(v._correctedByReport||(v._correctedByReport={[v._reportName??""]:{severity:Kt(v),reason:v.correctedSeverityReason}}),v._correctedByReport[w??""]={severity:Kt(y),reason:y.correctedSeverityReason})},p=o.findings||[],f=p.flatMap(gd).filter(v=>!v.id);if(f.length>0){let v=await Promise.all(f.map(Mi));if(n())return;f.forEach((w,y)=>{v[y]&&(w.id=v[y])})}let h=Ze(e),b=[],m=0;for(let v of p){let w=gd(v);if(w.length===0)continue;let y=w.filter(R=>R.id&&i.has(R.id)),k=w.filter(R=>!R.id||!i.has(R.id)),_=new Set;for(let R of y){let O=l.get(R.id);O!==void 0&&_.add(O)}let T=w.filter(R=>R.id).map(R=>R.id);if(k.length===0){_.size>1&&a.workspaceMerges.push(new Set(T));for(let R of y)u(d.get(R.id),e,R);m+=y.length;continue}let S=[];for(let R of k){R.id&&i.add(R.id);let O={...R,_id:a.nextFindingId++,_repoFallback:h,_reportName:e,_bundleHashes:o.bundleHashes??[]};Bi(O,o),O._analyzer=o.source??O.type??null,O.id&&!d.has(O.id)&&d.set(O.id,O),S.push(O)}if(y.length>0){m+=y.length,a.workspaceMerges.push(new Set(T));for(let R of y)u(d.get(R.id),e,R)}let I=`${a.reports.length}:${b.length}`;for(let R of k)R.id&&l.set(R.id,I);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)&&Id(w).catch(()=>{})}if(s)if(sa(),b.some(w=>w.some(y=>y.confidence!==void 0))){let w=k=>b.reduce((_,T)=>_+(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)=>Nd(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")&&Pd(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"),Pd(e.dataTransfer.files)});var Bt=null;function $$(){Bt||(Bt=document.createElement("input"),Bt.type="file",Bt.multiple=!0,Bt.hidden=!0,Bt.addEventListener("change",()=>{let e=Bt.files;e&&e.length>0&&Pd(e),Bt.value=""}),document.body.append(Bt)),Bt.click()}fe.addEventListener("click",e=>{e.target.closest(".drop-prompt-action")&&$$()});var Jt=new Map,Um="deepview.advisories.proxyConsent";function Hm(){try{return localStorage.getItem(Um)==="1"}catch{return!1}}function Vm(){try{localStorage.setItem(Um,"1")}catch{}}function x$(e){return fs(e)}function _$(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 jm(e,t){return!e||Od(e.name)!=="stasis"?!1:!t||t.integrity!==e.integrity?!0:_$(t)}function S$(e){let t=Object.create(null);for(let[r,n]of e)t[r]=[...n].toSorted();return t}async function zd(e,t){if(!e?.integrity||Jt.has(e.integrity)||!Hm())return;let r=x$(e);if(r.size===0){Jt.set(e.integrity,{state:"ok",byPackage:new Map,query:r});return}Jt.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(S$(r))});if(!o.ok){let l=`HTTP ${o.status}`;try{let d=await o.json();d&&typeof d.error=="string"&&d.error&&(l=`${d.error} (HTTP ${o.status})`)}catch{}Jt.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,d]of Object.entries(s)){if(!Array.isArray(d))continue;let u=d.filter(p=>p&&typeof p=="object"&&typeof p.title=="string"&&typeof p.severity=="string");u.length>0&&i.set(l,u)}Jt.set(n,{state:"ok",byPackage:i,query:r})}catch(o){Jt.set(n,{state:"error",reason:o?.message??"fetch-failed",query:r})}t()}async function Wm(e,t){e?.integrity&&Jt.get(e.integrity)?.state==="error"&&(Jt.delete(e.integrity),await zd(e,t))}var C$={critical:0,high:1,moderate:2,low:3,info:4};function _a(e){return C$[e]??999}function E$(e){return e.charAt(0).toUpperCase()+e.slice(1)}function A$(){let e=typeof window>"u"?"":window.location.host;return c`<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 Km(e){if(!e)return c`<div class="bundle-advisories-empty">Bundle not loaded yet.</div>`;if(e.kind!=="stasis"||!e.bundle)return c`<div class="bundle-advisories-empty">Advisories are only available for stasis bundles.</div>`;if(!Hm())return A$();let t=Jt.get(e.integrity);if(!t||t.state==="loading")return c`<div class="bundle-advisories-empty">Loading advisories from npm registry…</div>`;if(t.state==="error")return c`<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 c`<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],[d,u])=>{let p=Math.min(...l.map(h=>_a(h.severity))),f=Math.min(...u.map(h=>_a(h.severity)));return p!==f?p-f:i.localeCompare(d)}),s=[...t.byPackage.values()].reduce((i,l)=>i+l.length,0);return c`<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])=>T$(i,l,t.query.get(i)))}</ul></div>`}function T$(e,t,r){let n=[...t].toSorted((s,i)=>{let l=_a(s.severity)-_a(i.severity);return l!==0?l:(s.title??"").localeCompare(i.title??"")}),o=r?[...r].toSorted():[];return c`<li class="bundle-advisories-section"><div class="bundle-advisories-section-header"><span class="bundle-advisories-section-name">${e}</span> ${o.length>0?c`<span class="bundle-advisories-section-versions">${o.map(s=>c`<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=>B$(s))}</ul></li>`}function I$(e){if(typeof e!="string")return null;let t=/\/(GHSA-[a-z0-9-]+)(?:[/?#]|$)/iu.exec(e);return t?t[1]:null}var R$=c`<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 M$(e){let t=/^CWE-(\d+)$/u.exec(e);if(!t)return c`<span>${e}</span>`;let r=`https://cwe.mitre.org/data/definitions/${t[1]}.html`;return c`<a class="bundle-advisory-cwe" href="${r}" target="_blank" rel="noopener noreferrer">${e}</a>`}function B$(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=I$(i),d=Array.isArray(e.cwe)?e.cwe.filter(p=>typeof p=="string"):[],u=l&&i?c`<a class="bundle-advisory-ghsa" href="${i}" target="_blank" rel="noopener noreferrer">${l}${R$}</a>`:l?c`<span class="bundle-advisory-ghsa">${l}</span>`:g;return c`<li class="bundle-advisory-row"><div class="bundle-advisory-rail"><span class="${`bundle-advisory-severity sev-${t}`}">${E$(t)}</span> ${n?c`<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?c`<span>Affected <span class="mono">${s}</span></span>`:g} ${d.length>0?c`<span class="bundle-advisory-cwes">${d.map((p,f)=>c`${f===0?"":", "}${M$(p)}`)}</span>`:g}</div>${o?c`<div class="bundle-advisory-cvss-vector mono">${o}</div>`:g}</div></div></li>`}var ws=null;function F$(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 L$(e){let t=je(e),r=F$(e),n=[...t.keys()],{stripped:o}=nt(n),s=new Map(n.map((l,d)=>[l,o[d]])),i={};for(let[l,d]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(d).byteLength}}return{tree:i,origToStripped:s}}async function Rd(e){let t=je(e),r=new Map;for(let[n,o]of t)r.set(n,await Uf(o));return r}function Jm(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 Bo(n)){let s=a.triage.get(U(o))?.triage;s&&t[s]!==void 0&&t[s]++}}return t}function Jn(e,t="graph"){if(!e||e.size===0)return new Map;let r=new Map;for(let[n,o]of e){let s=Bo(o);if(s.length===0)continue;let i=s.filter(d=>{let u=a.triage.get(U(d))?.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 d of i)l.push(d)}return r}function Xm(e){let{tree:t,origToStripped:r}=L$(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,I]of e.fileHashes){let R=r.get(S);R!==void 0&&o.set(R,I)}}let s=Jn(o),i=new Map,l=new Map,d=new Map,u=new Map;for(let[S,I]of s){let R={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0},O=new Set,K=new Set,Ke=[];for(let ie of I){R[ie.severity]=(R[ie.severity]||0)+1,O.add(ie.severity);let Xe=a.triage.get(U(ie))?.color??"none";K.add(Xe),Ke.push({severity:ie.severity,color:Xe})}i.set(S,R),l.set(S,O),d.set(S,K),u.set(S,Ke)}let p=ua(t,i),f=new Map;for(let[S,I]of r)f.set(I,S);let h=_r(e),b=h?new Map([...r].map(([S,I])=>[I,h.get(S)])):null,m=b?S=>b.get(S):null,v=sm(n,m),w=A.splitOwnDirs&&v,y=S=>ut(S,{splitOwnDirs:w,packageDir:m?.(S)}),k=new Set;for(let S of n)if(k.add(y(S)),k.size>=3)break;let _=k.size>=3,T=n;if(A.focusedPkg){let S=n.filter(I=>y(I)===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:d,fileFindings:u,options:{pkgOf:y},strippedToOrig:f,canSplitOwnDirs:v,canPackagesView:_}}function Ca(){if(!ws)return;let e=Un();e&&e.refreshSidebar(ws,{isBundleContext:!0})}function Ea(){if(!ws)return;let e=Un();e&&e.refreshTopPkgs(ws)}function Qm(e){ws=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=ut(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 c`<div class="bundles-dist"><div class="bundles-dist-bar" aria-hidden="true">${J(n,([o])=>o,([o,s])=>c`<span class="bundles-dist-seg" style="${de({flexGrow:s,background:Ye(o)})}" data-tooltip="${o==="__own__"?g:`${o}: ${ne(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,d=Ye(o);return c`<li><span class="bundles-dist-dot" style="${de({background:d})}"></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:d})}"></span> </span><span class="bundles-dist-size">${ne(s)}</span> <span class="bundles-dist-percent">${i}%</span></li>`})}</ul></div>`}function qm(e,t,r,n,o,s){let{prefix:i,stripped:l}=nt(r),d=S=>o?.get(r[S]),u=new Set;for(let S=0;S<l.length;S++)u.add(ut(l[S],{packageDir:d(S)}));let p=l.map((S,I)=>I).toSorted((S,I)=>l[S].localeCompare(l[I])),f=l.map((S,I)=>({path:S,size:n[I],pkgDir:d(I)})),h=O$(f),b=h===g?c`<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=Jn(a.bundleDetails.fileHashes,"issues");for(let I of S.values())for(let R of I){m[R.severity]!==void 0&&m[R.severity]++,v++;for(let O of Fo(R.fileHash,R))w.set(O,(w.get(O)??0)+1)}}let y=[...w.keys()].toSorted(),k=we.filter(S=>m[S]>0).map(S=>c`<span class="${`tree-count-chip ${S}`}">${m[S]} ${S.replaceAll("_"," ")}</span>`),_=r.length>0?c`<ul class="bundles-sources-list">${p.map(S=>{let I=r[S],R=l[S],O=n[S];return c`<li><button type="button" class="bundles-source-row" data-bundle-view-source="${I}" data-tooltip="${I}"><span class="bundles-source-path">${R}</span> ${O==null?g:c`<span class="bundles-source-size">${ne(O)}</span>`}</button></li>`})}</ul>`:c`<p class="bundles-overview-col-empty">No source files in this bundle.</p>`,T=y.length>0?c`<ul class="bundles-reports-list">${y.map(S=>{let I=re[rt(S)]??re.default,R=w.get(S)??0;return c`<li><button type="button" class="report-chip bundles-report-chip" data-tooltip="${S}" data-bundle-issue-report="${S}">${ye(I)}<span class="report-chip-label">${Le(S)}</span> <span class="bundles-report-count">${R} ${R===1?"issue":"issues"}</span></button></li>`})}</ul>`:c`<p class="bundles-overview-col-empty">No matching reports indexed yet.</p>`;return c`<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?c`<dt>Prefix</dt><dd class="mono">${i}</dd>`:g}</dl>${s??g}</div>${v>0?c`<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">${_}</div></section>${y.length>0?c`<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 Ud=new Map,Hd=new Set,P$=c`<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>`,Xt=null;function ks(){queueMicrotask(()=>{document.querySelector(".bundle-code-rail-body .bundle-code-tree-link.current")?.scrollIntoView({block:"nearest"})})}function sn(e){for(let t of we)for(let r of e)if(r.severity===t)return t;return e[0]?.severity??null}function jd(e,t,r,n,o=null){let s=e.split(`
65
- `).length,i=String(s).length,l=ga(t),d=`${r??""}\0${t}`;l&&!Ud.has(d)&&!Hd.has(d)&&(Hd.add(d),(async()=>{let p=await ma(e,l);Ud.set(d,p??null),Hd.delete(d),a.bundleSourceFile===t&&x()})());let u=Ud.get(d);return c`<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?sn(b.map(w=>w.f)):null,v=b&&a.bundleSourceFindingIdx!=null&&b.some(w=>w.idx===a.bundleSourceFindingIdx);return c`<div class="${B({"bundle-source-lineno-row":!0,"is-match":o?.has(h)??!1})}" data-line="${h}">${b?c`<button type="button" class="${B({"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>`:c`<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 Wd(e){let t=a.bundleSourceFindingIdx;if(t==null)return g;let r=e[t];if(!r)return g;let n=r.fileHash?Fo(r.fileHash,r):[],o=a.triage.get(U(r))?.triage,s=o==="fixed"?"Fixed":o==="inprogress"?"In progress":null,i=en(r),l=tb(r.line);return c`<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?c`<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?c`<div class="bundle-source-panel-line-row">${l?c`<span class="bundle-source-panel-line">${l}</span>`:g} ${i?c`<span class="bundle-source-panel-meta" title="${i}">${i}</span>`:g}</div>`:g}<div class="bundle-source-panel-desc">${$r(r.description??"")}</div>${n.length>0?c`<div class="bundle-source-panel-reports"><div class="bundle-source-panel-reports-label">Reported by</div>${n.map(d=>{let u=re[rt(d)]??re.default;return c`<button type="button" class="report-chip bundle-source-panel-report" title="${d}" data-bundle-issue-report="${d}">${ye(u)}<span class="report-chip-label">${Le(d)}</span></button>`})}</div>`:g}</div></aside>`}function Kd(e,t,r){let n=[],o=new Map;if(typeof r=="string"&&e?.fileHashes){let i=Jn(e.fileHashes,"issues").get(t)??[];for(let l=0;l<i.length;l++){let d=i[l];n.push(d);let u=parseInt(d.line,10);Number.isFinite(u)&&u>0&&(o.has(u)||o.set(u,[]),o.get(u).push({f:d,idx:l}))}}return{fileFindings:n,lineFindings:o}}function Zm(){let e=a.bundleSourceFile;if(!e)return g;if(a.bundleDetailsTab==="code"||a.bundleDetailsTab==="search")return g;let r=je(a.bundleDetails).get(e),{fileFindings:n,lineFindings:o}=Kd(a.bundleDetails,e,r);return c`<div class="bundle-source-overlay"><div class="${B({"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"?jd(r,e,a.bundleDetails?.integrity,o):c`<div class="bundle-source-empty">Source content not bundled.</div>`}</div>${Wd(n)}</div></div></div>`}function eb(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 Sa=new Map,Gm=null;function D$(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 d=sn(l);(n===null||(ve[d]??0)>(ve[n]??0))&&(n=d)}for(let i of s.dirs.values())o(i)};return o(e),{count:r,worst:n}}function Vd(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)),d=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(d(h))return!0;return!1},u=(f,h)=>s?!0:Sa.has(f)?Sa.get(f):r===0||d(h),p=f=>h=>{Sa.set(f,!h.currentTarget.parentElement.open)};return c`<ul class="${B({"bundle-code-tree":!0,root:r===0})}">${J(i,([f])=>`${o}/${f}`,([f,h])=>{let b=o?`${o}/${f}`:f,m=D$(h,n);return c`<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?c`<span class="${`bundle-code-tree-count sev-${m.worst}`}" title="${`${m.count} ${m.count===1?"issue":"issues"} inside`}">${m.count}</span>`:g}</summary>${Vd(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?sn(b):null,v=b?.length??0;return c`<li class="bundle-code-tree-file"><button type="button" class="${B({"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?c`<span class="${`bundle-code-tree-count sev-${m}`}" title="${`${v} ${v===1?"issue":"issues"}`}">${v}</span>`:g}</button></li>`})}</ul>`}function N$(e,t,r,n,o=""){if(!r)return Vd(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 c`<div class="bundle-code-search-empty">No files match.</div>`;let d=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(d[h],i[h]);let p=eb(d),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),Vd(p,t,0,n,"",!0)}function z$(e,t,r,n=""){if(!t)return c`<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=[],d=0;for(let[u,p]of e){if(typeof p!="string")continue;let f=[],h=p.split(`
66
- `);for(let b=0;b<h.length;b++){let m=h[b];if(m.toLowerCase().includes(o)&&(f.push({ln:b+1,text:m}),d++,f.length>=s))break}if(f.length>0&&l.push({path:u,hits:f}),l.length>=i)break}return l.length===0?c`<div class="bundle-code-search-empty">No matches.</div>`:c`<div class="bundle-code-search-results"><div class="bundle-code-search-summary">${d} ${d===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 c`<div class="${B({"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=>c`<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 U$(e,t,r,n=""){if(!e.fileHashes)return c`<div class="bundle-code-search-empty">Computing file hashes…</div>`;let o=Jn(e.fileHashes,"issues");if(o.size===0)return c`<div class="bundle-code-search-empty">No issues match this bundle's files.</div>`;let s=t.toLowerCase(),i=[];for(let[l,d]of o)for(let u=0;u<d.length;u++){let p=d[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,d)=>{let u=ve[l.finding.severity]??0,p=ve[d.finding.severity]??0;return p!==u?p-u:l.file.localeCompare(d.file)}),i.length===0?c`<div class="bundle-code-search-empty">No matches.</div>`:c`<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:d,fileIdx:u})=>{let p=d.severity,f=n&&l.startsWith(n)?l.slice(n.length):l,h=l===r&&a.bundleSourceFindingIdx===u;return c`<li class="${B({"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="${d.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}${d.line?`:${d.line}`:""}</span></div><div class="bundle-code-search-issue-desc">${$r(d.description??"")}</div></button></li>`})}</ul></div>`}function Ym(e,t,r){let n=null,o=-1,s=0;for(let[d,u]of r){if(typeof t.get(d)!="string")continue;let p=ve[sn(u)]??0;(p>o||p===o&&u.length>s||p===o&&u.length===s&&(n===null||d.localeCompare(n)<0))&&(n=d,o=p,s=u.length)}if(n)return n;if(e.kind==="stasis"&&e.bundle){for(let d of e.bundle.entries)if(typeof t.get(d)=="string")return d}let i=null,l=-1;for(let[d,u]of t)typeof u=="string"&&u.length>l&&(i=d,l=u.length);return i}function H$(e){if(!e||!e.json&&!e.bundle)return g;let t=je(e);if(t.size===0)return c`<div class="bundle-code-empty">This bundle doesn't carry any source content.</div>`;Gm!==a.selectedBundle&&(Sa.clear(),Gm=a.selectedBundle);let r=[...t.keys()].toSorted(),{prefix:n,stripped:o}=nt(r),s=new Map;for(let y=0;y<r.length;y++)s.set(o[y],r[y]);let i=eb(o),l=y=>{let k=new Map;for(let[_,T]of y.files)k.set(_,s.get(T)??T);y.files=k;for(let _ of y.dirs.values())l(_)};l(i);let d=e.fileHashes?Jn(e.fileHashes,"issues"):new Map,u=a.bundleSourceFile;if(Xt&&(Xt.bundle!==a.selectedBundle||u&&u!==Xt.path)&&(Xt=null),!u)u=Ym(e,t,d),u&&(a.bundleSourceFile=u,Xt={bundle:a.selectedBundle,path:u,hadIssues:d.size>0},ks());else if(Xt&&!Xt.hadIssues&&d.size>0){Xt.hadIssues=!0;let y=Ym(e,t,d);y&&y!==u&&(u=y,a.bundleSourceFile=y,a.bundleSourceFindingIdx=null,Xt.path=y,ks())}let p=u?t.get(u):null,{fileFindings:f,lineFindings:h}=Kd(e,u,p),m=d.size>0?["files","code","issues"]:["files","code"],v=m.includes(a.bundleCodeSearchMode)?a.bundleCodeSearchMode:"files",w=a.bundleCodeSearchQuery;return c`<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?c`<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">${_d(v,[["files",()=>N$(i,u,w,d,n)],["code",()=>z$(t,w,u,n)],["issues",()=>U$(e,w,u,n)]])}</div></aside><div class="${B({"bundle-code-main":!0,"with-panel":a.bundleSourceFindingIdx!=null})}">${u?V$(e,u,p,f,h):c`<div class="bundle-code-placeholder">Pick a file from the tree to view its source.</div>`}</div></div>`}function V$(e,t,r,n,o){let s=typeof r=="string"?r.split(`
67
- `).length:0,i=typeof r=="string"?new TextEncoder().encode(r).byteLength:0,l=n.map((d,u)=>({idx:u,line:parseInt(d.line,10)||0})).toSorted((d,u)=>d.line-u.line||d.idx-u.idx);return c`<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">${P$}</button> <span class="bundle-code-main-spacer"></span> ${typeof r=="string"?c`<span class="bundle-code-main-stats">${s.toLocaleString()} ${s===1?"line":"lines"} · ${ne(i)}</span>`:g} ${n.length>0?c`<span class="bundle-code-main-issues" data-bundle-code-issue-order="${JSON.stringify(l)}"><span class="${`bundle-code-tree-count sev-${sn(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"?jd(r,t,e.integrity,o):c`<div class="bundle-source-empty">Source content not bundled.</div>`}</div>${Wd(n)}</div>`}var j$=400;function W$(e){return e<=5?8:e<=15?6:e<=40?4:e<=120?3:2}function K$(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 q$(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,d]of t){let u=l-o,p=d-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(c`<mark class="bundle-search-mark">${e.slice(i,l)}</mark>`),n=l)}return n<e.length&&r.push(e.slice(n)),r}function Y$(e,t,r){let n=q$(e,r??[],j$);return c`<div class="${B({"bundle-search-line":!0,"is-match":r!=null})}"><span class="bundle-search-lineno">${t}</span> <span class="bundle-search-code">${n.clipped?c`<span class="bundle-search-clip">…</span>`:g}${G$(n.text,n.ranges)}</span></div>`}function J$(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 d=String(i).length,u=[];for(let p=s;p<=i;p++)u.push(Y$(t[p-1]??"",p,n.get(p)??null));return c`${o?c`<div class="bundle-search-gap" aria-hidden="true"></div>`:g} <button type="button" class="bundle-search-snippet" style="${de({"--bundle-search-lineno-w":`${d}ch`})}" data-bundle-view-source="${e}" data-bundle-view-line="${l}" data-bundle-view-scroll-block="center" title="${`${e}:${l}`}">${u}</button>`}function X$(e,t,r){let{path:n,lines:o,hits:s}=e,i=t&&n.startsWith(t)?n.slice(t.length):n,l=K$(s,o.length,r),d=new Map(s.map(f=>[f.ln,f.ranges])),u=s[0].ln,p=n===a.bundleSourceFile;return c`<section class="${B({"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)=>J$(n,o,f,d,h>0))}</div></section>`}function Q$(e,t,r,n,o,s){if(!r)return c`<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=om(e.integrity??"",t,r,n,o);if(i.error)return c`<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:d,truncated:u}=i,p=[...t.keys()].toSorted(),{prefix:f}=nt(p);if(l.length===0)return c`<div class="bundle-search-results"><div class="bundle-search-empty">No matches.</div></div>`;let h=s?W$(d):0,b=l.length;return c`<div class="bundle-search-results"><div class="bundle-search-summary"><span>${d}${u?"+":""} ${d===1?"match":"matches"} in ${b}${u?"+":""} ${b===1?"file":"files"}</span> ${f?c`<span class="bundle-search-summary-prefix mono" title="${f}">${f}</span>`:g} ${u?c`<span class="bundle-search-summary-more">results capped — refine to narrow</span>`:g}</div>${J(l,m=>m.path,m=>X$(m,f,h))}</div>`}function Z$(e,t,r,n){if(!t||typeof e!="string")return null;let o=Cd(t,r,n);if(o.error)return null;let s=new Set,i=e.split(`
68
- `);for(let l=0;l<i.length;l++)o.ranges(i[l]).length>0&&s.add(l+1);return s}function ex(e,t,r){let n=a.bundleSourceFile;if(!n)return g;let o=t.get(n),{fileFindings:s,lineFindings:i}=Kd(e,n,o);return c`<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"?jd(o,n,e.integrity,i,r):c`<div class="bundle-source-empty">Source content not bundled.</div>`}</div>${Wd(s)}</div></aside>`}function tx(e){if(!e||!e.json&&!e.bundle)return g;let t=je(e);if(t.size===0)return c`<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=Z$(t.get(a.bundleSourceFile),r,n,o);l&&l.size===0?(a.bundleSourceFile=null,a.bundleSourceFindingIdx=null):s=l}let i=a.bundleSearchContext;return c`<div class="bundle-search-view"><div class="bundle-search-bar-row"><bundle-search></bundle-search><button type="button" class="${B({"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">${Q$(e,t,r,n,o,i)} ${ex(e,t,s)}</div></div>`}function rx(e){let t=jm(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&&zd(s,x).catch(()=>{}),c`<div class="bundles-view bundles-slide-view"><header class="bundles-slide-bar"><span class="bundles-slide-icon" aria-hidden="true">${ye(Hn)}</span><div class="bundles-slide-title"><div class="bundles-slide-name">${e.name}</div></div><div class="bundles-slide-tabs" role="tablist">${t?c`<button type="button" class="${B({"bundles-tab":!0,active:n==="advisories"})}" data-bundle-tab="advisories" aria-selected="${String(n==="advisories")}" role="tab">Advisories</button>`:g} <button type="button" class="${B({"bundles-tab":!0,active:n==="issues"})}" data-bundle-tab="issues" aria-selected="${String(n==="issues")}" role="tab">Issues</button> <button type="button" class="${B({"bundles-tab":!0,active:n==="terminal"})}" data-bundle-tab="terminal" aria-selected="${String(n==="terminal")}" role="tab">Terminal</button> <button type="button" class="${B({"bundles-tab":!0,active:n==="treemap"})}" data-bundle-tab="treemap" aria-selected="${String(n==="treemap")}" role="tab">Treemap</button> <button type="button" class="${B({"bundles-tab":!0,active:n==="graph"})}" data-bundle-tab="graph" aria-selected="${String(n==="graph")}" role="tab">Graph</button> <button type="button" class="${B({"bundles-tab":!0,active:n==="code"})}" data-bundle-tab="code" aria-selected="${String(n==="code")}" role="tab">Code</button> <button type="button" class="${B({"bundles-tab":!0,active:n==="search"})}" data-bundle-tab="search" aria-selected="${String(n==="search")}" role="tab">Search</button> ${r?c`<button type="button" class="${B({"bundles-tab":!0,active:n==="compare"})}" data-bundle-tab="compare" aria-selected="${String(n==="compare")}" role="tab">Compare</button>`:g} <button type="button" class="${B({"bundles-tab":!0,active:o})}" data-bundle-tab="overview" aria-selected="${String(o)}" role="tab">Overview</button></div></header><div class="${B({"bundles-slide-body":!0,"bundles-slide-body-overview":o})}">${o?lx(e,s):l?_d(n,[["terminal",()=>c`<div id="bundle-terminal-slot" class="bundle-terminal-slot"></div>`],["graph",()=>c`<div id="bundle-graph-slot" class="bundle-graph-slot"></div>`],["treemap",()=>c`<bundle-treemap .details="${s}"></bundle-treemap>`],["code",()=>H$(s)],["search",()=>tx(s)],["compare",()=>c`<bundle-compare .details="${s}" .integrity="${e.integrity}"></bundle-compare>`],["issues",()=>ox(s)],["advisories",()=>Km(s)]]):i?c`<div class="${B({"bundles-slide-placeholder":!0,"is-error":!!s.error})}">${s.error?`Failed to parse: ${s.error}`:"Bundle contents not parsed."}</div>`:c`<div class="bundles-slide-placeholder">Loading bundle…</div>`}</div></div>`}function nx(e,t={}){if(!e)return g;let r=[];if(e.fileHash&&(r=Fo(e.fileHash,e)),r.length===0&&t.bucketKey&&(t.kind==="package"?r=nc(t.bucketKey,e):t.kind==="repository"&&(r=oc(t.bucketKey,e))),r.length===0)return g;let n=r.slice(0,2),o=r.length-n.length;return c`<div class="bundle-issue-reports">${n.map(s=>{let i=re[rt(s)]??re.default;return c`<button type="button" class="report-chip" title="${s}" data-bundle-issue-report="${s}">${ye(i)}<span class="report-chip-label">${Le(s)}</span></button>`})} ${o>0?c`<span class="bundle-issue-reports-more">, and ${o} more…</span>`:g}</div>`}function tb(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 vs(e,t){return c`<div class="bundle-issues-empty"><p class="bundle-issues-empty-primary">${e}</p>${t?c`<p class="bundle-issues-empty-hint">${t}</p>`:g}</div>`}function ox(e){if(!e||!e.json&&!e.bundle)return g;if(!e.fileHashes)return vs("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 vs("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=Jn(e.fileHashes,"issues");if(t.size===0){let r=rc();if(r===0)return vs("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+=Bo(o).length;return n>0?vs("All matching issues are dismissed.",`${n} ${n===1?"finding matches":"findings match"} this bundle's files, but every one is triaged invalid or deleted.`):vs("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 $s(t,{kind:"bundle"})}function $s(e,{kind:t,bucketKey:r}={}){let n=[...e.keys()],{prefix:o,stripped:s}=nt(n),i=new Map(n.map((u,p)=>[u,s[p]])),l=[...e.entries()].toSorted(([u,p],[f,h])=>{let b=ve[sn(p)]??0,m=ve[sn(h)]??0;return m!==b?m-b:(i.get(u)??u).localeCompare(i.get(f)??f)}),d=[...e.values()].reduce((u,p)=>u+p.length,0);return c`<div class="bundle-issues"><div class="bundle-issues-summary">${d} ${d===1?"issue":"issues"} across ${e.size} ${e.size===1?"file":"files"} ${o?c`<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,_=parseInt(v.line,10)||0;return k-_}),b=t==="repository"&&r?`${/^https?:/iu.test(r)?r.replace(/\/$/u,""):`https://github.com/${r}`}/blob/HEAD/${u}`:null;return c`<li class="bundle-issues-file-group"><header class="bundle-issues-file-header">${t==="bundle"?c`<button type="button" class="bundle-issues-file-name mono" data-bundle-view-source="${u}" title="${u}">${f}</button>`:b?c`<a class="bundle-issues-file-name bundle-issues-file-name-link mono" href="${b}" target="_blank" rel="noopener" title="${u}">${f}</a>`:c`<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(U(m))?.triage,k=y==="fixed"||y==="invalid"||y==="deleted"?y.toUpperCase():y==="inprogress"?"In progress":null,_=c`<div class="bundle-issues-finding-head"><span class="${`bundle-issue-sev sev-${w}`}">${w.replaceAll("_"," ")}</span> ${(()=>{let T=tb(m.line);return T?c`<span class="bundle-issues-finding-line">${T}</span>`:g})()} ${k?c`<span class="${`bundle-issues-finding-triage triage-${y}`}">${k}</span>`:g} <span class="bundle-issues-finding-spacer"></span> ${nx(m,{kind:t,bucketKey:r})}</div><div class="bundle-issues-finding-desc">${$r(m.description??"")}</div>`;return c`<li class="bundle-issues-finding">${t==="bundle"?c`<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}">${_}</button>`:c`<div class="bundle-issues-finding-link bundle-issues-finding-static" title="${u}">${_}</div>`}</li>`})}</ul></li>`})}</ul></div>`}function rb(e){let t=a.selectedBundle,r=t?e.find(n=>n.integrity===t):null;return r?rx(r):c`<div class="bundles-view bundles-view-empty"><p class="bundles-empty-hint">${e.length===0?c`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 sx=c`<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>`,ix=c`<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 ax(e,t){let r=Zg(t);return c`<div class="bundles-overview-exports"><div class="bundles-overview-exports-row"><button type="button" class="bundles-download-btn" data-bundle-download="${e.integrity}">${sx}<span>Download bundle</span></button> ${r?c`<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)">${ix}<span>SPDX</span></button></div>`:g}</div></div>`}function lx(e,t){let r=c`<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?c`<dt>Size</dt><dd>${ne(t.size)}</dd>`:g}</dl>`,n=ax(e,t);if(!t||t.integrity!==e.integrity)return c`<div class="bundles-overview"><div class="bundles-overview-summary"><div class="bundles-detail-meta-row">${r}${n}</div></div></div>`;if(t.error)return c`<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),d=c`<dt>Version</dt><dd>${String(o.version??"?")}</dd>${o.file?c`<dt>Output</dt><dd class="mono">${o.file}</dd>`:g} ${o.sourceRoot?c`<dt>Source root</dt><dd class="mono">${o.sourceRoot}</dd>`:g} ${o.names?c`<dt>Names</dt><dd>${o.names.length}</dd>`:g}`;return qm(r,d,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 d=[...l].toSorted(),u=i.map(f=>{let h=s.get(f);return typeof h=="string"?new TextEncoder().encode(h).byteLength:null}),p=c`<dt>Version</dt><dd>${String(o.version)}</dd>${d.length>0?c`<dt>Resolution kinds</dt><dd>${d.join(", ")}</dd>`:g}`;return qm(r,p,i,u,_r(t),n)}return c`<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 nb(){At().catch(()=>{});let e=Et(),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,_]of b.byVersion){let T=[],S=new Map;for(let I of _.findings){let R=a.triage.get(U(I))?.triage??null;R==="inprogress"?t.inprogress++:R==="fixed"?t.fixed++:R==="invalid"?t.invalid++:R==="deleted"&&t.deleted++,R===a.shownTriage&&(T.push(I),S.has(I.file)||S.set(I.file,[]),S.get(I.file).push(I))}if(T.length!==0){m.push([k,{findings:T,files:S,reports:_.reports}]);for(let I of T)v.push(I),w.has(I.file)||w.set(I.file,[]),w.get(I.file).push(I);for(let I of _.reports)y.add(I)}}m.length!==0&&(m.sort(([k],[_])=>ll(k,_)),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 gx(o[0],i,s?s[0]:void 0);let l=a.packagesSearchQuery.trim().toLowerCase(),d=l?r.filter(([h])=>h.toLowerCase().includes(l)):r.slice();fx(d,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 c`<div class="${B({"packages-view":!0,"with-details":!!o})}"><header class="page-head"><div class="page-title"><h1>Packages</h1><div class="meta-row"><span>${d.length===r.length?c`${r.length} ${r.length===1?"package":"packages"}`:c`${d.length} of ${r.length} ${r.length===1?"package":"packages"}`}</span> ${u>0?c`<span>${u} ${u===1?"finding":"findings"} across ${p.size} ${p.size===1?"report":"reports"}</span>`:g}</div></div>${ux(t)}</header>${r.length===0?c`<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>`:d.length===0?c`<p style="color:var(--muted)">No packages match "${a.packagesSearchQuery}".</p>`:c`<div class="${f}"><ul class="packages-list">${J(cx(d),dx,h=>mx(h,n,a.selectedPackageVersion))}</ul>${o?c`<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">${vx(o[0],i,s?s[0]:void 0)}</div></aside>`:g}</div>`}</div>`}function cx(e){let t=[];for(let[r,n]of e){let o=n.versions;if(o.length<=1){let[d,u]=o[0];t.push({kind:"single",pkg:r,version:d,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 d=1;d<o.length;d++){let[u,p]=o[d];t.push({kind:"other",pkg:r,version:u,bucket:p,totalVersions:o.length})}}return t}function dx(e){return e.version===null?`${e.kind}:${e.pkg}`:`${e.kind}:${e.pkg}@${e.version}`}function ux(e){return c`<div class="packages-toolbar"><entity-search kind="packages"></entity-search><entity-sort kind="packages"></entity-sort><triage-selector variant="packages" .counts="${e}" .states="${px}"></triage-selector></div>`}var px=["inprogress","fixed","invalid","deleted"];function fx(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 hx(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(U(s))?.triage??null;i==="invalid"?r.invalid++:i==="deleted"?r.deleted++:r.live++}return r}function gx(e,t,r){let n=Et().get(e),o=hx(n,r),s=a.packageSlideTriage??"live",i=n?ob(n,e,s,r):new Map,l=[...i.values()].reduce((f,h)=>f+h.length,0),d=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 c`<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} ${d} · ${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?c`<div class="bundle-issues-empty">${u}</div>`:$s(i,{kind:"package",bucketKey:e})}</div></div>`}function mx(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=te(m,a.severityMode);l[v]!==void 0&&l[v]++}let d=we.filter(m=>l[m]>0),u=Ye(o),f={selected:o===t&&bx(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 c`<li class="${B(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:c`<span class="packages-version">@${s}</span>`} </span>${n==="latest"?yx(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>${d.length>0?c`<div class="packages-row-chips">${d.map(m=>c`<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 bx(e,t){return e.kind==="single"?!0:e.version===t}function yx(e,t,r){let n=t?"Hide":`+${r} ${r===1?"version":"versions"}`;return c`<button type="button" class="${B({"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 vx(e,t,r){let n=Et().get(e),s=[...(n?ob(n,e,"live",r):new Map).values()].reduce((i,l)=>i+l.length,0);return c`<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?c`<button type="button" class="bundles-tab bundles-tab-action" data-package-tab="issues">Issues (${s}) →</button>`:g}</div>${wx(e,t,r)}`}function ob(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 d=l.filter(f=>{let h=a.triage.get(U(f))?.triage??null;return r==="invalid"?h==="invalid":r==="deleted"?h==="deleted":h!=="invalid"&&h!=="deleted"});if(d.length===0)continue;let u=sb(t,i);o.has(u)||o.set(u,[]);let p=o.get(u);for(let f of d)p.push(f)}return o}function wx(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=te(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)),d=Et().get(e)?.repos,u=d&&d.size===1?[...d][0]:null,p=u?/^https?:/iu.test(u)?u:`https://github.com/${u}`:null;return c`<dl class="packages-detail-meta"><dt>Package</dt><dd class="mono">${e}</dd>${r?c`<dt>Version</dt><dd class="mono">${r}</dd>`:g} ${p?c`<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?c`<div class="packages-detail-chips">${o.map(f=>c`<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=re[rt(f)]??re.default;return c`<li><button type="button" class="packages-detail-report" title="${f}" data-package-report="${f}">${ye(h)}<span class="packages-detail-report-label">${Le(f)}</span></button></li>`})}</ul><h3 class="packages-detail-section">Files</h3><ul class="packages-detail-files">${s.map(([f,h])=>{let b=sb(e,f);return c`<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 sb(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 ht(e){if(!e)return"";let t=e.match(/github\.com\/([^/?#]+\/[^/?#]+?)(?:\.git)?(?:[/?#]|$)/iu);return t?t[1]:e}function ib(){At().catch(()=>{});let e=Yr(),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(U(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 Sx(o[0],o[1]);let s=a.repositoriesSearchQuery.trim().toLowerCase(),i=s?r.filter(([p])=>p.toLowerCase().includes(s)||ht(p).toLowerCase().includes(s)):r.slice();xx(i,a.repositoriesSortBy);let l=r.reduce((p,[,f])=>p+f.findings.length,0),d=new Set;for(let[,p]of r)for(let f of p.reports)d.add(f);let u=o?"packages-layout open":"packages-layout";return c`<div class="${B({"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?c`${r.length} ${r.length===1?"repository":"repositories"}`:c`${i.length} of ${r.length} ${r.length===1?"repository":"repositories"}`}</span> ${l>0?c`<span>${l} ${l===1?"finding":"findings"} across ${d.size} ${d.size===1?"report":"reports"}</span>`:g}</div></div>${kx(t)}</header>${r.length===0?c`<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?c`<p style="color:var(--muted)">No repositories match "${a.repositoriesSearchQuery}".</p>`:c`<div class="${u}"><ul class="packages-list">${J(i,([p])=>p,([p,f])=>Cx(p,f,p===n))}</ul>${o?c`<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">${Ex(o[0],o[1])}</div></aside>`:g}</div>`}</div>`}function kx(e){return c`<div class="packages-toolbar"><entity-search kind="repositories"></entity-search><entity-sort kind="repositories"></entity-sort><triage-selector variant="packages" .counts="${e}" .states="${$x}"></triage-selector></div>`}var $x=["inprogress","fixed","invalid","deleted"];function xx(e,t){let r=t==="name-asc"?(n,o)=>ht(n[0]).localeCompare(ht(o[0])):t==="files-desc"?(n,o)=>o[1].files.size-n[1].files.size||ht(n[0]).localeCompare(ht(o[0])):t==="reports-desc"?(n,o)=>o[1].reports.size-n[1].reports.size||ht(n[0]).localeCompare(ht(o[0])):(n,o)=>o[1].findings.length-n[1].findings.length||ht(n[0]).localeCompare(ht(o[0]));e.sort(r)}function _x(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(U(n))?.triage??null;o==="invalid"?t.invalid++:o==="deleted"?t.deleted++:t.live++}return t}function Sx(e,t){let r=Yr().get(e),n=_x(r),o=a.repositorySlideTriage??"live",s=r?ab(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`,d=o==="live"?"No live issues for this repository.":`No ${o} issues for this repository.`;return c`<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">${ht(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?c`<div class="bundle-issues-empty">${d}</div>`:$s(s,{kind:"repository",bucketKey:e})}</div></div>`}function Cx(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 d=te(l,a.severityMode);n[d]!==void 0&&n[d]++}let o=we.filter(l=>n[l]>0),s=Ye(e),i=ht(e);return c`<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?c`<div class="packages-row-chips">${o.map(l=>c`<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 Ex(e,t){let r=Yr().get(e),o=[...(r?ab(r):new Map).values()].reduce((s,i)=>s+i.length,0);return c`<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?c`<button type="button" class="bundles-tab bundles-tab-action" data-repository-tab="issues">Issues (${o}) →</button>`:g}</div>${Ax(e,t)}`}function ab(e,t="live"){let r=new Map;for(let[n,o]of e.files){let s=o.filter(i=>{let l=a.triage.get(U(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 Ax(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 d=te(l,a.severityMode);r[d]!==void 0&&r[d]++}let n=we.filter(l=>r[l]>0),o=[...t.files.entries()].toSorted(([l,d],[u,p])=>p.length!==d.length?p.length-d.length:l.localeCompare(u)),s=[...t.reports].toSorted((l,d)=>l.localeCompare(d)),i=/^https?:/iu.test(e)?e:`https://github.com/${e}`;return c`<dl class="packages-detail-meta"><dt>Repository</dt><dd class="mono"><a href="${i}" target="_blank" rel="noopener">${ht(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?c`<div class="packages-detail-chips">${n.map(l=>c`<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 d=re[rt(l)]??re.default;return c`<li><button type="button" class="packages-detail-report" title="${l}" data-package-report="${l}">${ye(d)}<span class="packages-detail-report-label">${Le(l)}</span></button></li>`})}</ul><h3 class="packages-detail-section">Files</h3><ul class="packages-detail-files">${o.map(([l,d])=>c`<li class="packages-detail-file"><span class="packages-detail-file-path mono" title="${l}">${l}</span> <span class="packages-detail-file-count">${d.length}</span></li>`)}</ul>`}var xs=new Map,_s=new Map,qd=new Set;function Tx(e,t,r){let n=`${e}\0${t}`;if(_s.has(n)||qd.has(n))return;let o=ga(t);if(!o){_s.set(n,null);return}qd.add(n),(async()=>{let s=await ma(r,o);_s.set(n,s??null),qd.delete(n),a.focusCodeTick++,queueMicrotask(x)})()}async function Ix(e){let t=xs.get(e);if(t&&(t.loading||t.sources))return;let r=(a.bundles??[]).find(n=>n.integrity===e);if(r){xs.set(e,{sources:null,loading:!0,error:null});try{let n=await qn(e,r),o=je(n);xs.set(e,{sources:o,loading:!1,error:n.error??null})}catch(n){xs.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 lb(e){if(!e)return null;let t=He(e);if(!t.fileHash||!Array.isArray(t._bundleHashes)||t._bundleHashes.length===0)return null;let r=new Set(t._bundleHashes),n=Jr(t.fileHash).find(({integrity:u})=>r.has(u));if(!n)return null;let o=xs.get(n.integrity);if(!o)return Ix(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;Tx(n.integrity,n.file,s);let i=`${n.integrity}\0${n.file}`,l=_s.has(i)?_s.get(i):void 0,d=parseInt(t.line,10);return{content:s,file:n.file,integrity:n.integrity,line:Number.isFinite(d)?d:null,highlighted:l,loading:!1}}var Gd=class extends M{static styles=[...M.styles,F(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 Uh(this.workspaceId,n.identifier);else{let s=await Wr(n.identifier);o=await Yi(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:ot(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:ot(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:c`<ul class="lwd-list" role="alert">${this._errors.map(t=>c`<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?c`Upload <strong>"${ot(this.items[0])}"</strong> to the workspace's remote inventory?`:c`Upload <strong>${t}</strong> local ${s} to the workspace's remote inventory?`,l=r?g:c`<ul class="lwd-list">${this.items.map(u=>c`<li>${ot(u)}${u.kind==="bundle"?c`<span class="lwd-kind-tag">bundle</span>`:g}</li>`)}</ul>`,d=this._uploading?r?"Uploading\u2026":`Uploading ${t} ${s}\u2026`:r?"Upload":`Upload ${t}`;return c`<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:c`<button type="button" data-role="upload" @click="${this._onUpload}" ?disabled="${this._uploading||t===0}">${d}</button>`}</footer></dialog>`}};customElements.define("sync-upload-dialog",Gd);function cb({workspaceId:e,items:t}={}){return Z("sync-upload-dialog",{workspaceId:e??"",items:Array.isArray(t)?[...t]:[]})}var db=`.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}
69
- `;var Mx={checking:"checking\u2026",good:"available",reuploaded:"re-uploaded",failed:"re-upload failed","check-failed":"check failed",missing:"missing"},Yd=class extends M{static styles=[...M.styles,F(ke),F(db)];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 Hh(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 xa({workspaceId:this.workspaceId,items:t})};_rowsSection(){return this._rows.length===0?this._running?c`<p class="lwd-body">Fetching remote listing…</p>`:g:c`<ul class="rec-list">${this._rows.map(t=>c`<li class="rec-row"><span class="rec-label">${t.label}${t.kind==="bundle"?c`<span class="lwd-kind-tag">bundle</span>`:g}</span> <span class="${`rec-status rec-status-${t.status}`}" title="${t.detail??g}">${Mx[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?c`<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:c`<p class="lwd-body">Re-check ${this.cloudCount>0?c`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?c`<p class="lwd-empty">No remote objects to check.</p>`:g,o=this._ran?this._downloadableItems().length:0;return c`<dialog @close="${this._onClose}"><header><h3>Re-check cloud storage</h3></header>${r} ${this._rowsSection()} ${n} ${this._summarySection()} ${this._error?c`<p class="rec-error" role="alert">${this._error}</p>`:g}<footer class="nwd-actions"><span class="nwd-spacer"></span> ${o>0?c`<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",Yd);function ub({workspaceId:e,cloudCount:t,localFileNames:r,localBundles:n}={}){return Z("objstore-recovery-dialog",{workspaceId:e??"",cloudCount:typeof t=="number"?t:0,localFileNames:Array.isArray(r)?[...r]:[],localBundles:Array.isArray(n)?[...n]:[]})}function Qd(){let e=wd(a.reports);if(!e)return null;let t=Object.keys(e),n=Gt().filter(p=>_e(p).commonTriage===a.shownTriage),o=vd(n,a.severityMode),s=ua(e,o),i=new Map,l=new Map,d=new Map;for(let p of n)for(let f of p){let h=te(f,a.severityMode);i.has(f.file)||i.set(f.file,new Set),i.get(f.file).add(h);let b=a.triage.get(U(f))?.color??"none";l.has(f.file)||l.set(f.file,new Set),l.get(f.file).add(b),d.has(f.file)||d.set(f.file,[]),d.get(f.file).push({severity:h,color:b})}let u;return A.focusedPkg?(u=t.filter(p=>(Jg(p)??"__own__")===A.focusedPkg),A.showAll||(u=u.filter(p=>kd(p,o,s)))):u=A.showAll?t:t.filter(p=>kd(p,o,s)),{prep:{treeData:e,files:u,ownCounts:o,transitiveCounts:s,severitySets:i,colorSets:l,fileFindings:d},findingCounts:o}}function Zd(){let e=Un();if(!e)return;let t=Qd();t&&e.refreshSidebar(t.prep,{isBundleContext:a.currentView==="bundles"})}function eu(){let e=Un();if(!e)return;let t=Qd();t&&e.refreshTopPkgs(t.prep)}var Bx={"claude-security":"Claude Security findings","codex-security":"Codex Security findings",deepsec:"DeepSec findings",piolium:"Piolium findings"};function Fx(e,t){return a.currentWorkspace?t?c`<repo-chip url="${t}"></repo-chip>`:g:e?c`<repo-chip url="${a.repoUrl}" editable ?editing="${a.repoEditing}" ?empty="${!a.repoUrl}"></repo-chip>`:t?c`<repo-chip url="${t}"></repo-chip>`:g}var Xd=["type","model","effort","exportsMode"];function pb(e,t,{typePrefix:r=!0}={}){return e==="type"?r?`analyzer: ${t??"null"}`:`${t??"null"}`:t??null}function Lx(e,t=Xd){let r=new Map;for(let f of e){let h={};for(let m of t)h[m]=m==="model"?as(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]),d=[...l,...t.filter(f=>!l.includes(f))],u=[],p=!1;for(let f of d)if(o[f]){let h=pb(f,n[0][f]);h!=null&&u.push(h)}else if(!p){for(let h of n){let b=s.map(m=>pb(m,h[m],{typePrefix:!i})).filter(m=>m!=null);b.length>0&&u.push(b.join(" \xB7 "))}p=!0}return u}function Ox(e,t,r,n,o){let s=e.length,i=new Set(a.reports.map(K=>K.source)),l=i.size===1?[...i][0]:null,d=a.currentWorkspace?G().find(K=>K.id===a.currentWorkspace):null,u=d?`Workspace: ${d.name}`:l?Bx[l]:"Findings",p=l&&re[l]?l:"default",f=ye(re[p]),h=c`<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=c`<span class="file-chip" data-copy-report="${t[0]}" title="Copy report name">${f}<span>${t[0]}</span></span>`:t.length>1&&(b=c`<span class="file-chip" data-copy-report="${t.join(`
70
- `)}" title="Copy report names">${h}<span>${t.length} reports</span></span>`);let m=a.reports.flatMap(K=>K.groups.flat()),w=`${s} ${`finding${s===1?"":"s"}`}`,k=l||a.currentWorkspace?Xd.filter(K=>K!=="type"):Xd,_=Lx(m,k),T=g;if(s>0){let K={};for(let ie of e){let Xe=te(rn(ie),a.severityMode);Xe&&(K[Xe]=(K[Xe]||0)+1)}let Ke=we.filter(ie=>K[ie]>0);Ke.length>0&&(T=c`<span class="status-bar" aria-hidden="true">${Ke.map(ie=>{let Xe=`${K[ie]} ${ie.replaceAll("_"," ")}`;return c`<span class="${`status-seg sev-${ie}`}" style="${de({flexGrow:K[ie]})}" title="${Xe}"></span>`})}</span>`)}let S=Fx(r,n),I=c`<span class="sep" aria-hidden="true"></span>`,R=a.currentView==="files",O=(o??0)>1?c`<button type="button" class="${B({"files-toggle-btn":!0,active:R})}" data-action="toggle-files" title="${R?"exit files view":"show files"}" aria-pressed="${String(R)}">${`Files: ${o}`}</button>`:g;return c`<header class="page-head"><div class="page-title"><h1>${u}${b}${S}${O}${Px()}</h1><div class="meta-row"><span>${w}</span> ${T} ${_.length>0?c`${I}${_.map(K=>c`<span class="tag">${K}</span>`)}`:g}</div></div></header>`}function Px(){if(P.status!=="online")return g;if(a.currentView!=="findings"&&a.currentView!=="files")return g;let e=Nx();if(!e)return g;let{workspaceId:t,fileNames:r,mode:n}=e;if(n==="single"){let w=r[0],y=Zc(t,w)?"cloud":"local";return Dx({status:y,label:y,title:y==="cloud"?"Synced to remote":"Local only \u2014 click to upload",onClick:y==="local"?()=>fb({workspaceId:t,items:[{kind:"report",identifier:w}]}):null})}let o=G().find(w=>w.id===t),s=o&&Array.isArray(o.bundles)?o.bundles:[],i=Mh(t),l=r.filter(w=>!Zc(t,w)),d=s.filter(w=>!Ih(t,w)),u=[...l.map(w=>({kind:"report",identifier:w})),...d.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:c`<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})}}">${wb()}<span>${i} cloud</span></button>`,m=u.length===0?g:c`<button type="button" class="sync-badge-chunk local" aria-label="${`${u.length} items not yet uploaded \u2014 open upload dialog`}" @click="${w=>{w.stopPropagation(),fb({workspaceId:t,items:u})}}">${vb()}<span>${u.length} local</span></button>`,v=i>0&&u.length>0?c`<span class="sync-badge-divider" aria-hidden="true"></span>`:g;return c`<div class="${`report-sync-badge${p||f?" report-sync-badge-clickable":""}`}" data-status="mixed" title="${h}">${b}${v}${m}</div>`}function Dx({status:e,label:t,title:r,onClick:n}){let o=e==="cloud"?wb():vb(),s=c`<span class="sync-badge-label">${t}</span>`;return typeof n!="function"?c`<span class="report-sync-badge" data-status="${e}" title="${r}" aria-label="${`report sync status: ${t}`}">${o}${s}</span>`:c`<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 vb(){return c`<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 wb(){return c`<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 fb({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 cb({workspaceId:e,items:t})}function Nx(){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=G().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 zx(e){return Object.values(e).some(r=>r>0)||a.filterSeverities.size>0?c`<severity-chips .counts="${e}"></severity-chips>`:g}function Ux(e){return Object.values(e).some(r=>r>0)||a.filterColors.size>0?c`<triage-filter .counts="${e}"></triage-filter>`:g}function Hx(e,t,r,n,o,s,i,l){let{showSource:d,showConfidence:u,showPriority:p,showGraphMode:f,showFileSort:h,kanbanMode:b,showRepo:m,hasComment:v,hasFix:w,hasFlagged:y,showSeverityMode:k}=s;return c`<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>${d?c`<div class="sep"></div><source-filter></source-filter>`:g} ${v||w||y||a.filterComment||a.filterFix||a.filterFlagged?c`<div class="sep"></div><annotation-filter .hasComment="${v}" .hasFix="${w}" .hasFlagged="${y}"></annotation-filter>`:g} ${u?c`<div class="sep"></div><conf-filter></conf-filter>`:g} ${b?g:c`<triage-selector .counts="${r}"></triage-selector>`}</div><div class="toolbar-row sev-row">${k?c`<severity-mode-switch></severity-mode-switch><div class="sep"></div>`:g} ${zx(n)} ${i.analyzers.length>1||i.models.length>1?c`<analyzer-select .analyzers="${i.analyzers}" .models="${i.models}" .groups="${i.groups}"></analyzer-select>`:g} ${m&&l.length>1?c`<repo-filter .options="${l}"></repo-filter>`:g} ${Ux(o)}<div class="search-row"><toolbar-search kind="findings"></toolbar-search><span class="result-count">${e} of ${t}</span></div></div></div>`}function Jd(e,t){return e.map(r=>({p:rn(r),g:r})).toSorted((r,n)=>t(r.p,n.p)).map(r=>r.g)}var hb=(e,t)=>e.file.localeCompare(t.file)||parseInt(e.line,10)-parseInt(t.line,10),Aa=null,gb=0,Xn=null,Ta=new Map;function Ss(e,t=!1,r=null){let n=zn(e);return Ta.set(n,{group:e,inGroup:t}),t?r?c`<finding-card data-gid="${n}" in-group context="${r}"></finding-card>`:c`<finding-card data-gid="${n}" in-group></finding-card>`:r?c`<finding-card data-gid="${n}" context="${r}"></finding-card>`:c`<finding-card data-gid="${n}"></finding-card>`}var Vx={critical:"C",high:"H",medium:"M",low:"L",high_bug:"H",bug:"B",informational:"i"};function mb(e,t={}){let{variant:r="kanban",active:n=!1}=t,o=_e(e),s=He(e),i=la(dt(s.description,s))||"(untitled finding)",l=r==="kanban",d={"kanban-card":!0,"has-conflict":o.hasConflict,"focus-side-card":!l,active:n};!o.hasConflict&&o.commonColor&&(d[`mark-${o.commonColor}`]=!0);let u=parseInt(s.line,10),p=Number.isFinite(u)?`:${u}`:"",f=te(s,a.severityMode),h=Vx[f]??"?",b=qt(s)&&a.severityMode!=="original",m=a.triage.get(U(s)),v=m?.flagged===!0,w=m?.fix??"",y=m?.comment??"",k=g;l&&w?k=vr(w)?c`<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}`}">${cs}</a>`:c`<button type="button" class="kanban-action mark-fix" title="${`Edit fix link: ${w}`}" aria-label="${`Edit fix link: ${w}`}">${cs}</button>`:l&&y&&(k=c`<button type="button" class="kanban-action mark-comment" title="${`Edit comment: ${y}`}" aria-label="${`Edit comment: ${y}`}">${ca}</button>`);let _=c`<div class="kanban-badge-col"><span class="${`kanban-badge sev-${f}`}" title="${b?`${Ve(f)} \u2014 corrected from ${Ve(s.severity)}`:Ve(f)}" aria-label="${b?`Severity ${Ve(f)}, corrected from ${Ve(s.severity)}`:`Severity ${Ve(f)}`}">${h}${b?"*":""}</span> ${v?c`<span class="kanban-flag" title="Flagged" aria-label="Flagged">${da}</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:c`<span class="kanban-conf" title="${`Confidence ${s.confidence}/10`}">${s.confidence}</span>`}</div>`;return l?c`<div class="${B(d)}" data-gid="${Me(e)}" data-kanban-source draggable="true" role="button" tabindex="0" aria-current="${n?"true":"false"}" aria-label="${`Open details for ${i}`}">${_}</div>`:c`<div class="${B(d)}" data-gid="${Me(e)}" data-focus-select role="button" tabindex="0" aria-current="${n?"true":"false"}" aria-label="${`Focus on ${i}`}">${_}</div>`}function jx(e){let{content:t,line:r,highlighted:n}=e,o=t.split(`
71
- `).length,s=String(o).length;return c`<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 d=l+1;return c`<div class="${B({"focus-code-lineno":!0,"focus-code-line-active":d===r})}" data-focus-code-line="${d}">${d}</div>`})}</aside><pre class="focus-code-source"><code>${typeof n=="string"?ye(n):t}</code></pre></div>`}function Wx(e){if(!e)return g;let t=_e(e),r={"kanban-detail-modal":!0,"has-conflict":t.hasConflict};return!t.hasConflict&&t.commonColor&&(r[`mark-${t.commonColor}`]=!0),c`<div class="kanban-detail-backdrop"><div class="kanban-detail-dim"></div><div class="${B(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">${Ss(e,!1,"kanban-detail")}</div></div></div>`}function Kx(e){if(a.viewMode==="table"){let r=a.sortBy==="file"?Jd(e,hb):e;if(r.length===0)return g;let n=a.tableSelectedGid?r.find(s=>Me(s)===a.tableSelectedGid):null;return Aa=r,c`<div class="${n?"findings-table-layout open":"findings-table-layout"}"><div class="findings-table-list"><div class="finding-table-slot"></div></div>${n?c`<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">${Ss(n)}</div></aside>`:g}</div>`}if(a.viewMode==="focus"){if(e.length===0)return g;let r=a.focusGid?e.findIndex(d=>Me(d)===a.focusGid):-1;r<0&&(r=Math.min(gb,e.length-1),r<0&&(r=0)),gb=r;let n=e[r];a.focusCodeTick;let o=lb(n),s=o?"focus-main with-code":"focus-main",i=r===0,l=r===e.length-1;return c`<div class="focus-view"><div class="${s}"><div class="focus-pane focus-pane-card"><div class="focus-card-wrapper">${Ss(n,!1,"focus")}</div></div>${o?c`<div class="focus-pane focus-pane-code">${o.loading?c`<div class="focus-code-empty">Loading source…</div>`:c`<header class="focus-code-bar" title="${o.file}"><span class="focus-code-file">${o.file}</span> ${o.line?c`<span class="focus-code-line">:${o.line}</span>`:g}</header><div class="focus-code-body">${jx(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,d=>Me(d),d=>mb(d,{variant:"focus",active:Me(d)===Me(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(s=>[s.key,[]]));for(let s of e){let l=_e(s).commonTriage??"untriaged",d=n.get(l);d&&d.push(s)}let o=a.kanbanPopoverGid?e.find(s=>Me(s)===a.kanbanPopoverGid):null;return c`<div class="kanban-board">${J(r,s=>s.key,s=>{let i=n.get(s.key);return c`<div class="${`kanban-column kanban-column-${s.key}`}" data-kanban-target="${s.target}"><div class="kanban-column-header"><span class="label">${s.label}</span> <span class="count">${i.length}</span></div><div class="kanban-column-body">${i.length===0?c`<div class="kanban-empty">No ${s.label.toLowerCase()} findings.</div>`:J(i,l=>Me(l),l=>mb(l,{active:Me(l)===a.kanbanPopoverGid}))}</div></div>`})}</div>${Wx(o)}`}if(a.viewMode==="grouped"){let r=new Map;for(let o of e){let s=rn(o).file;r.has(s)||r.set(s,[]),r.get(s).push(o)}let n=a.sortBy==="file"?[...r.keys()].toSorted():[...r.keys()];return c`${J(n,o=>o,o=>{let s=a.sortBy==="file"?Jd(r.get(o),(l,d)=>parseInt(l.line,10)-parseInt(d.line,10)):r.get(o),i=rn(s[0]);return c`<div class="file-group"><div class="file-header"><span>${pd(o,i?.repo?.github,i?._repoFallback??a.repoUrl)}</span> <span class="count">${s.length}</span></div><div class="file-body">${J(s,l=>zn(l),l=>Ss(l))}</div></div>`})}`}let t=a.sortBy==="file"?Jd(e,hb):e;return c`${J(t,r=>zn(r),r=>{let n=He(r),o=_g(n.file,n.line,n.repo?.github,n._repoFallback??a.repoUrl),s=en(n),i=Zr(n),l=r.length>1;return c`<div class="${B({"flat-group":!0,"multi-case":l})}"><div class="flat-group-loc"><span class="file">${pd(n.file,n.repo?.github,n._repoFallback??a.repoUrl)}</span> ${o===g?g:c`<span class="line-num">${o}</span>`} ${i?c`<span class="meta">${i}</span>`:g} ${s?c`<span class="run-meta">${s}</span>`:g}</div>${Ss(r,!0)}</div>`})}`}function qx(){let e=document.querySelector("#bundle-source-overlay-slot");e&&q(Zm(),e)}var bb=null;function x(){let e=bb;if(bb=a.currentView,e!==null&&e!==a.currentView&&typeof document.startViewTransition=="function"&&!matchMedia("(prefers-reduced-motion: reduce)").matches){document.startViewTransition(()=>yb());return}yb()}function yb(){if(qx(),wg(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")),$&&q(rb(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 le=Xm(a.bundleDetails);if(le){Qm(le);let Ds={hideAllFiles:!0,triageCounts:Jm(a.bundleDetails),triageStates:["inprogress","fixed","invalid","deleted"],showSplitOwnDirs:le.canSplitOwnDirs,showPackagesView:le.canPackagesView};$d(L,le,Ds,Ca,Ea)}}}if(a.selectedBundle&&a.bundleDetailsTab==="terminal"&&a.bundleDetails&&(a.bundleDetails.json||a.bundleDetails.bundle)){let L=document.querySelector("#bundle-terminal-slot");L&&Gg(L,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")),$&&q(nb(),$),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")),$&&q(ib(),$),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=Gt(),t=a.viewMode==="kanban",r={inprogress:0,fixed:0,invalid:0,deleted:0,ignored:0},n=[];for(let $ of e){let L=_e($).commonTriage;L&&r[L]++,(t||L===a.shownTriage)&&n.push($)}let o=!1,s=!1,i=!1,l=!1;for(let $ of e)for(let L of $){qt(L)&&(l=!0);let le=a.triage.get(U(L));le&&(le.comment&&(o=!0),le.fix&&(s=!0),le.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 Be=$[0],Ds=te(Be,a.severityMode);f[Ds]=(f[Ds]||0)+1;let $p=a.triage.get(U(Be))?.color??"none";h[$p]=(h[$p]||0)+1;continue}let L=new Set($.map(Be=>te(Be,a.severityMode)));for(let Be of L)f[Be]=(f[Be]||0)+1;let le=new Set($.map(Be=>a.triage.get(U(Be))?.color??"none"));for(let Be of le)h[Be]=(h[Be]||0)+1}let b=n.length>0&&n.every($=>$.every(L=>L.confidence!==void 0||L.critical===!0)),m=e.some($=>$.some(L=>L.priority!==void 0)),v=e.some($=>$.some(L=>yr(L.file))),w=!1,y=!1,k;e:for(let $ of e)for(let L of $)if(!y)y=!0,k=L.file;else if(L.file!==k){w=!0;break e}let _=e.some($=>$.some(L=>!L.repo?.github&&!yr(L.file))),T=new Set;for(let $ of e)for(let L of $)!yr(L.file)&&L.repo?.github&&T.add(L.repo.github);let S=T.size===1?[...T][0]:null,I=new Set,R=new Set;for(let $ of e)for(let L of $)I.add(L._analyzer??null),R.add(ls(L));let O=Object.keys(bd),K=[...I].toSorted(($,L)=>{let le=$==null?1/0:O.indexOf($)===-1?O.length:O.indexOf($),Be=L==null?1/0:O.indexOf(L)===-1?O.length:O.indexOf(L);return le!==Be?le-Be:String($??"").localeCompare(String(L??""))}),Ke=[...R].toSorted(($,L)=>$==null&&L==null?0:$==null?1:L==null?-1:$.localeCompare(L));if(a.filterAnalyzer){let $=a.filterAnalyzer===wr?null:a.filterAnalyzer;(!I.has($)||I.size<2)&&(a.filterAnalyzer="")}if(a.filterModel){let $=a.filterModel===kr?null:a.filterModel;(!R.has($)||R.size<2)&&(a.filterModel="")}let ie=new Set;for(let $ of e)for(let L of $)ie.add(hd(L));let Xe=[...ie].toSorted(($,L)=>$==null&&L==null?0:$==null?1:L==null?-1:$.localeCompare(L));if(a.filterRepo){let $=a.filterRepo===tn?null:a.filterRepo;ie.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 Br=Mg(Pn(n)),Qt=wd(a.reports),Ka=Qt?Object.keys(Qt).length:0,Fr=Ka>1;!Fr&&a.currentView==="files"&&(a.currentView="findings"),!Fr&&a.viewMode==="graph"&&(a.viewMode="table");let Lr=Ox(e,p,_,S,Ka);if(a.currentView==="files"){let $=vd(e,a.severityMode),L=document.querySelector("#header-slot"),le=document.querySelector("#tree-view-slot");(!L||!le||!E.contains(L)||!E.contains(le))&&(E.innerHTML='<div id="header-slot"></div><div id="tree-view-slot"></div>',L=document.querySelector("#header-slot"),le=document.querySelector("#tree-view-slot")),L&&q(Lr,L),le&&q(Wg(Qt,$),le),E.classList.add("active"),fe.classList.add("hidden"),document.title=`DeepView \u2014 ${u||"no analyzer"}`;return}let dn=a.viewMode==="table"&&a.tableSelectedGid&&Br.some($=>Me($)===a.tableSelectedGid),Ft=null;a.viewMode==="graph"&&Qt&&(Ft=Qd(),Ft||(a.viewMode="table"));let no=!!Ft,kt="findings-content";dn&&(kt+=" with-details"),no&&(kt+=" with-graph"),t&&(kt+=" with-kanban"),a.viewMode==="focus"&&(kt+=" with-focus");let un=g,Or=g,C=g;Aa=null,Ta.clear(),no||(un=Hx(Br.length,n.length,r,f,h,{showSource:v,showConfidence:b,showPriority:m,showGraphMode:Fr,showFileSort:w,kanbanMode:t,showRepo:!!a.currentWorkspace,hasComment:o,hasFix:s,hasFlagged:i,showSeverityMode:l||a.severityMode==="original"},{analyzers:K,models:Ke,groups:n},Xe),a.shownTriage&&n.length===0?Or=c`<p style="color:var(--muted);margin:1rem 0">No ${a.shownTriage} findings.</p>`:Br.length===0&&n.length>0?Or=c`<p style="color:var(--muted);margin:1rem 0">No findings match the current filters.</p>`:n.length===0&&(Or=e.length>0?c`<p style="color:var(--green)">All ${u} issues triaged.</p>`:c`<p style="color:var(--green)">No ${u} issues found.</p>`),C=Kx(Br));let N=document.querySelector("#header-slot"),V=E.querySelector(":scope > .findings-content"),X=V&&V.querySelector(":scope > #findings-graph-slot"),me=V&&V.querySelector(":scope > #findings-body-slot"),De=V&&(X?"graph":me?"body":null)===(no?"graph":"body");if(!N||!V||!E.contains(N)||!E.contains(V)||!De){let $=no?'<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="${kt}">${$}</div>`,N=document.querySelector("#header-slot"),V=E.querySelector(":scope > .findings-content")}else V.className!==kt&&(V.className=kt);N&&q(Lr,N);let Zt=document.querySelector("#toolbar-slot");Zt&&q(un,Zt);let wp=document.querySelector("#empty-state-slot");wp&&q(Or,wp);let kp=document.querySelector("#findings-body-slot");if(kp&&q(C,kp),Ft){let $=document.querySelector("#findings-graph-slot");if($){let le={extraTopRow:c`<view-mode-buttons modes="table,list,grouped,focus,kanban,graph"></view-mode-buttons>`,triageCounts:r,triageStates:["inprogress","fixed","invalid","deleted","ignored"]};$d($,Ft.prep,le,Zd,eu)}}if(Aa){let $=E.querySelector(".finding-table-slot");$&&(Xn||(Xn=document.createElement("finding-table")),Xn.items=Aa,Xn.selectedGid=a.tableSelectedGid,Xn.parentNode!==$&&$.append(Xn))}if(Ta.size>0)for(let $ of E.querySelectorAll("finding-card")){let L=Ta.get($.dataset.gid);L&&($.group=L.group)}E.classList.add("active"),fe.classList.add("hidden"),document.title=`DeepView \u2014 ${u||"no analyzer"}`}var tu=class extends M{static styles=[...M.styles,F(ct)];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 jc(this.workspace,{password:this._noPassword?void 0:this._password,includeBundleBytes:this._includeBundleBytes});if(this._settled)return;Pt(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 c`<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?c`<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?c`<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?c`<p class="wsl-error" role="alert">${this._error}</p>`:g} ${!this._noPassword&&!t?c`<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 c`<dialog @close="${this._onClose}"><header><h3>Export workspace</h3></header>${this._body()}</dialog>`}};customElements.define("workspace-export-dialog",tu);function kb({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(xt(o.detail?.cause))}),document.body.append(n)})}async function $b(e){await kb({workspace:e})}var ru=class extends M{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 c`<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",ru);function xb(){return Z("new-workspace-dialog")}var nu=class extends M{static styles=[...M.styles,F(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?c`<p class="lwd-note">No local triage is attached to ${this.reportCount===1?"this report":"these reports"}.</p>`:t===0?c`<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>`:c`<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",d=r>0?c`<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?c`<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?c`<p class="lwd-empty">No reports are attached to this workspace (only bundles, see below).</p>`:c`<p class="lwd-empty">No reports are attached to this workspace.</p>`;return c`<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} ${d} ${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",nu);function _b({name:e,reportCount:t,bundleCount:r,triageImpact:n}={}){return Z("leave-workspace-dialog",{workspaceName:e??"",reportCount:t??0,bundleCount:r??0,orphanedTriage:n?.orphanedCount??0,sharedTriage:n?.sharedCount??0})}var ou=class extends M{static styles=[...M.styles,F(ct)];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 qc({id:this.workspaceId,name:this._name.trim(),privateKeyBase64:this.privateKeyBase64,password:this._password});if(this._settled)return;this._url=Yc(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?c`<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?c`<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>`:c`<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?c`<p class="wsl-error" role="alert">${this._error}</p>`:g} ${this._password&&this._confirm&&this._password!==this._confirm?c`<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 c`<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",ou);function Sb({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(xt(i.detail?.cause))}),document.body.append(s)})}var su=class extends M{static styles=[...M.styles,F(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?c`<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?c`<p class="lwd-note">No local triage is attached to this report.</p>`:t===0?c`<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>`:c`<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 c`<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",su);function Cb({name:e,triageImpact:t,inRemote:r}={}){return Z("delete-report-dialog",{reportName:e??"",orphanedTriage:t?.orphanedCount??0,sharedTriage:t?.sharedCount??0,inRemote:!!r})}var iu=class extends M{static styles=[...M.styles,F(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?c`<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 c`<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",iu);function Eb({name:e,inRemote:t}={}){return Z("delete-bundle-dialog",{bundleName:e??"",inRemote:!!t})}var au=class extends M{static styles=[...M.styles,F(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 c`<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",au);function Ab({name:e,workspaceName:t}={}){return Z("detach-bundle-dialog",{bundleName:e??"",workspaceName:t??""})}var lu=class extends M{static styles=[...M.styles,F(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 c`<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",lu);function Tb({name:e,workspaceName:t}={}){return Z("detach-report-dialog",{reportName:e??"",workspaceName:t??""})}var cu=class extends M{focusInitial(){this.renderRoot.querySelector("button.primary")?.focus()}_onConfirm=()=>this._finish(!0);render(){return c`<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",cu);function Ib(){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 du=class extends M{focusInitial(){this.renderRoot.querySelector("button.primary")?.focus()}_onReload=()=>this._finish("reload");render(){return c`<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",du);function Rb(){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 Tr;function Gx(){return Tr||(Tr=document.createElement("div"),Tr.id="styled-tooltip",document.body.append(Tr),Tr)}var an=null,Cs=null,Lb=0,Ob=0,Mb=!1;function Yx(){Mb||(Mb=!0,document.addEventListener("mousemove",e=>{Lb=e.clientX,Ob=e.clientY},{passive:!0}))}Yx();var Jx=100,Xx=14,Qx=8,Bb=8;function Zx(e,{placement:t="cursor"}={}){let r=Gx();if(an===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+Qx)}px`,r.style.transform="translateY(-50%)"}else{r.style.transform="none",r.style.top=`${Ob+Xx}px`,r.style.left="0px",r.classList.add("visible");let o=r.offsetWidth,s=window.innerWidth-o-Bb,i=Math.max(Bb,Math.min(Lb,s));r.style.left=`${Math.round(i)}px`}r.classList.add("visible"),an=e}}function Es(){clearTimeout(Cs),Cs=null,Tr&&Tr.classList.remove("visible"),an=null}function uu(e,{gate:t,placement:r}={}){t&&!t(e)||(clearTimeout(Cs),Cs=setTimeout(()=>{Zx(e,{placement:r})},Jx))}var Fb=!1;function Pb(){Fb||(Fb=!0,document.body.addEventListener("mouseover",e=>{let t=e.target.closest("[data-tooltip]");!t||t===an||(Es(),uu(t))}),document.body.addEventListener("mouseout",e=>{!an&&!Cs||an&&an.contains(e.relatedTarget)||Es()}))}var cn=null,Y=null,Ia=null;Pb();function e1(){return Et().size}function t1(){return Yr().size}var As=typeof location>"u"||location.hostname.endsWith(".github.io")?"":`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/api/sync`,vu="application/x-deepview-report",gu="application/x-deepview-source-ws",Ts="application/x-deepview-bundle",Ra=!1,Ma=!1,r1={default:"Reports","claude-security":"Claude Security","codex-security":"Codex Security",deepsec:"DeepSec",piolium:"Piolium"},Db=["default","claude-security","codex-security","deepsec","piolium"],ln="";function Nb(e,t={}){let n=`file-item${e===a.currentFile&&(a.currentView==="findings"||a.currentView==="files")?" current":""}${t.indented?" indented":""}`,o=Le(e),s=Do(e),i=re[rt(e)]??re.default;return c`<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:c`<span class="file-count">${s}</span>`}</button></li>`}function Hb(e,t={}){let r=`file-group-header${t.dropTarget?" default-reports":""}`;return c`<li class="${r}" data-default-reports="${t.dropTarget?"true":g}"><span class="group-label">${e}</span></li>`}var n1=c`<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 o1(){let e=a.serverMode==="managed"?g:c`<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">${n1}</button></span>`;return c`<li class="file-group-header workspace-header"><span class="group-label">Workspaces</span>${e}</li>`}function s1(){if(a.serverMode!=="managed")return g;let e=Array.isArray(a.managedTeams)?a.managedTeams:[];return e.length===0?g:c`${Hb("Teams")} ${J(e,t=>t.id,t=>c`<li class="file-item team-item"><span class="team-name">${f1}<span class="team-label">${t.name}</span></span></li>${J(Array.isArray(t.reports)?t.reports:[],r=>r.id,r=>i1(r))}`)}`}function i1(e){return c`<li class="file-item indented team-report-item"><button type="button" class="file-name" data-tooltip="${e.filename}" @click="${()=>{a1(e)}}">${ye(re.default)}<span class="file-label">${e.filename}</span></button></li>`}async function a1(e){let t=await Wh(e.id);if(t==null){console.warn("managed: could not load team report",e.id);return}await ft(e.filename,t)}function l1(){return c`<li class="file-group-header bundles-header" data-default-bundles="true"><span class="group-label">Bundles</span></li>`}var c1=c`${ye(Hn)}`;function zb(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 c`<li class="${i}" data-bundle-integrity="${r}" data-workspace-id="${t.workspaceId??g}" draggable="true"><button type="button" class="file-name" data-tooltip="${`${n}
72
- ${r}`}">${c1}<span class="file-label">${n}</span></button></li>`}function d1(e,t){let r=e.slice(0,15);return c`<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 u1(e,t){return c`<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 · ${Le(e)}</em></span></span></li>`}var p1=c`${ye(pa)}`,f1=c`<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>`,h1=c`<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>`,g1=c`<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>`,m1=c`<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 b1(e){let r=`file-item workspace-item${a.currentWorkspace===e.id&&(a.currentView==="findings"||a.currentView==="files")?" current":""}`;return c`<li class="${r}" data-workspace-id="${e.id}"><button type="button" class="file-name">${p1}<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">${m1}</button><button type="button" class="workspace-export" data-action="export-workspace" title="Export workspace" aria-label="Export workspace">${h1}</button><button type="button" class="workspace-leave" data-action="leave-workspace" title="Leave workspace" aria-label="Leave workspace">${g1}</button></li>`}function Qn(e){return ln?Le(e).toLowerCase().includes(ln):!0}var pu=(e,t)=>Le(e).localeCompare(Le(t));async function j(){await Oc(),At().catch(()=>{});let e=await ue(),t=G(),r=await vt();if(a.bundles=r,cd(),!Y)return;cn.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 Db)l.set(h,[]);for(let h of e){if(o.has(h)||!Qn(h))continue;let b=rt(h);l.has(b)||l.set(b,[]),l.get(b).push(h)}let d=t.filter(h=>!ln||h.name.toLowerCase().includes(ln)||h.reports.some(b=>Qn(b))?!0:h.bundles.some(b=>{let m=s.get(b);return m&&Qn(m.name)})),u=r.filter(h=>!i.has(h.integrity)&&Qn(h.name));q(c`${s1()} ${a.serverMode==="managed"&&t.length===0?g:o1()} ${J(d,h=>h.id,h=>{let b=[],m=[];for(let y of h.reports)Qn(y)&&(n.has(y)?b.push(y):m.push(y));b.sort(pu),m.sort(pu);let v=[],w=[];for(let y of h.bundles){let k=s.get(y);k?(!ln||Qn(k.name))&&v.push(k):ln||w.push(y)}return c`${b1(h)} ${b.map(y=>Nb(y,{indented:!0,workspaceId:h.id}))} ${m.map(y=>u1(y,h.id))} ${v.map(y=>zb(y,{workspaceId:h.id}))} ${w.map(y=>d1(y,h.id))}`})} ${Db.map(h=>{let b=(l.get(h)??[]).toSorted(pu),m=h==="default";return b.length===0&&!(m&&Ra)?null:c`${Hb(r1[h]??h,{dropTarget:m})} ${b.map(v=>Nb(v))}`})} ${u.length>0||Ma?l1():null} ${J(u,h=>h.integrity,h=>zb(h))}`,Ia);let p=Y.querySelector('sidebar-view-button[kind="packages"]');p&&(p.count=e1());let f=Y.querySelector('sidebar-view-button[kind="repositories"]');f&&(f.count=t1()),Ir(),dc(e,()=>{j()})}Ee(()=>{j()});async function y1(e){if(e.target.closest('[data-action="go-home"]')){await Dm();return}let t=e.target.closest(".file-item[data-bundle-integrity]");if(t){if(t.classList.contains("bundle-missing"))return;let d=t.dataset.bundleIntegrity;if(a.selectedBundle===d&&a.currentView==="bundles")return;a.currentView="bundles",a.selectedBundle=d,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,Ar(d),x(),j(),Yt(d);return}let r=e.target.closest("sidebar-view-button");if(r){let d=r.getAttribute("kind");(d==="packages"||d==="repositories")&&(a.currentView=d,x(),j());return}if(e.target.closest('[data-action="new-workspace"]')){if(a.serverMode==="managed")return;let d=await xb();d&&(await Fd(),await xc(d),j());return}let n=e.target.closest('[data-action="share-workspace"]');if(n){let d=n.closest("[data-workspace-id]"),u=d?G().find(p=>p.id===d.dataset.workspaceId):null;u&&Sb({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 d=o.closest("[data-workspace-id]"),u=d?G().find(p=>p.id===d.dataset.workspaceId):null;u&&$b(u).catch(p=>alert(`Failed to open export dialog: ${p.message}`));return}let s=e.target.closest('[data-action="leave-workspace"]');if(s){let d=s.closest("[data-workspace-id]"),u=d?G().find(v=>v.id===d.dataset.workspaceId):null;if(!u)return;let p=Array.isArray(u.reports)?u.reports:[],f;try{f=await Hi(p)}catch(v){alert(`Couldn't read reports to analyze triage impact: ${v.message}`);return}let{confirmed:h,mode:b,triage:m}=await _b({name:u.name,reportCount:p.length,bundleCount:u.bundles.length,triageImpact:f});if(!h)return;if(!G().some(v=>v.id===u.id)){alert(`Workspace "${u.name}" was removed elsewhere; nothing to leave.`);return}try{await zm(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 d=i.dataset.workspaceId,u=a.currentView==="findings"||a.currentView==="files";d&&(d!==a.currentWorkspace||!u)&&Cr(d);return}let l=e.target.closest(".file-item[data-file]");if(l){let d=l.dataset.file;d&&(d!==a.currentFile||a.currentView!=="findings")&&ft(d);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=G().filter(k=>Array.isArray(k.bundles)&&k.bundles.includes(m)).filter(k=>ed(k.id,m)).map(k=>k.id),{confirmed:y}=await Eb({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 Nm({deleteFromRemoteWorkspaceIds:w})}catch(k){alert(`Failed to delete bundle: ${k.message}`)}return}if(!a.currentFile)return;let d=a.currentFile,u;try{u=await Hi([d])}catch(m){alert(`Couldn't read reports to analyze triage impact: ${m.message}`);return}let p=G().filter(m=>Array.isArray(m.reports)&&m.reports.includes(d)).filter(m=>Ln(m.id,d)).map(m=>m.id),f=p.length>0,{confirmed:h,triage:b}=await Cb({name:d,triageImpact:u,inRemote:f});if(!h)return;if(a.currentFile!==d){alert(`Active report changed during confirmation; aborting delete of "${d}".`);return}try{await Pm({triage:b,deleteFromRemoteWorkspaceIds:p})}catch(m){alert(`Failed to delete report: ${m.message}`)}return}if(e.target.closest("#sync-status")){if(a.serverModeMismatch)return;P.status==="error"?P.dismissError():P.status==="off"?(!P.getServerUrl()&&As&&P.setServerUrl(As),P.setEnabled(!0)):P.setEnabled(!1);return}if(e.target.closest('[data-action="admin-users"]')){Y?.querySelector("#user-menu")?.hidePopover?.(),B1();return}if(e.target.closest('[data-action="manage-repos"]')){Y?.querySelector("#user-menu")?.hidePopover?.(),F1();return}if(e.target.closest('[data-action="manage-reports"]')){Y?.querySelector("#user-menu")?.hidePopover?.(),L1();return}if(e.target.closest('[data-action="manage-bundles"]')){Y?.querySelector("#user-menu")?.hidePopover?.(),O1();return}if(e.target.closest('[data-action="manage-teams"]')){Y?.querySelector("#user-menu")?.hidePopover?.(),P1();return}if(e.target.closest('[data-action="managed-logout"]')){qh(a.managedSession?.csrfToken);return}if(e.target.closest("#auth-status")){a.managedSession==null&&Kh(a.managed?.loginPath);return}if(e.target.closest("#sidebar-toggle")){if(a.serverMode==="managed")return;cn.classList.toggle("collapsed");try{localStorage.setItem("deepview.sidebarCollapsed",cn.classList.contains("collapsed")?"1":"0")}catch{}}}function v1(e){let t=e.target.closest("[data-tooltip]");if(!t){Es();return}uu(t,{placement:"right",gate:r=>{let n=r.querySelector(".file-label");return!n||(r.dataset.tooltip??"")!==n.textContent?!0:n.scrollWidth>n.clientWidth}})}function w1(e){let t=e.target.closest("[data-tooltip]"),r=e.relatedTarget?.closest?.("[data-tooltip]")??null;t&&t===r||Es()}function k1(e){ln=e.target.value.trim().toLowerCase(),j()}var $1={off:"Sync off",online:"Online",offline:"Offline",connecting:"Connecting\u2026",error:"Sync error"};function x1(){return P.getServerUrl()||As?G().length>0:!1}function Vb(){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"),q(c`Log in`,e),t&&q(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}`),q(Ub(n,r.id),e),t&&q(c`<div class="user-card">${Ub(n,r.id,!0)} <span class="user-id"><span class="user-login">${r.login}</span> ${r.name?c`<span class="user-name">${r.name}</span>`:g}</span></div>${r.role==="admin"||r.role==="manage"?c`<div class="user-menu-group" role="group" aria-label="Manage"><div class="user-menu-group-label">Manage</div>${r.role==="admin"?c`<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 Ub(e,t,r=!1){let n=`/api/avatar/${encodeURIComponent(t)}`;return c`<span class="${r?"user-avatar user-avatar-lg":"user-avatar"}"><span class="user-avatar-fallback">${e}</span> <img alt="" src="${n}" @error="${_1}"></span>`}function _1(e){e.currentTarget.classList.add("broken")}function S1(){let e=Y?.querySelector(".brand-tag");e&&(e.textContent=a.serverMode)}function C1(){cn&&(cn.dataset.mode=a.serverMode),a.serverMode==="managed"&&cn?.classList.remove("collapsed"),ng()}function Ir(e){let t=Y?.querySelector("#sync-status");if(!t)return;if(S1(),C1(),a.serverModeMismatch){let u=Y?.querySelector("#auth-status");u&&(u.hidden=!0),P.setForcedOff(!0),P.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,P.setForcedOff(!0),Vb();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=x1(),o=zt()!=null;if(n&&o&&P.isEnabled()&&Ah().catch(u=>{console.warn("sync: load failed",u)}),n&&o&&!P.getServerUrl()&&As&&P.isEnabled()&&P.setServerUrl(As),P.setForcedOff(!n),!n){t.hidden=!0;return}t.hidden=!1;let s=e??P.status;t.dataset.status=s;let i=P.persistenceDegraded;t.toggleAttribute("data-degraded",i);let l=P.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 d=t.querySelector(".sync-label");d&&(d.textContent=$1[s]??"")}P.onStatusChange(Ir);var fu=!1,mu=!1;async function jb(){if(!P.persistenceDegraded||mu||fu)return;fu=!0;let{shown:e}=await Ib();if(fu=!1,e){mu=!0;return}P.persistenceDegraded&&setTimeout(jb,1500)}P.onPersistenceDegraded(e=>{Ir(),e?jb():mu=!1});var hu=!1,bu=!1;async function Wb(){if(!P.proxyAuthRequired||bu||hu)return;hu=!0;let{shown:e,reload:t}=await Rb();if(hu=!1,!e){P.proxyAuthRequired&&setTimeout(Wb,1500);return}bu=!0,t&&location.reload()}P.onProxyAuthRequired(e=>{Ir(),e?Wb():bu=!1});function E1(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=G().find(d=>d.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 d=>{i||(i=!0,d&&await Sc(n,s.value),j())};s.addEventListener("keydown",d=>{d.key==="Enter"?(d.preventDefault(),l(!0)):d.key==="Escape"&&(d.preventDefault(),l(!1))}),s.addEventListener("blur",()=>l(!0)),s.addEventListener("click",d=>d.stopPropagation()),s.addEventListener("dblclick",d=>d.stopPropagation())}function Ba(){for(let e of Y.querySelectorAll(".drag-over"))e.classList.remove("drag-over")}function Kb(e){return e.dataTransfer.types.includes(vu)||e.dataTransfer.types.includes(Ts)}function A1(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(Ts,n),e.dataTransfer.setData(gu,t.dataset.workspaceId??""),e.dataTransfer.setData("text/plain",n),t.classList.add("dragging"),Ma=!0,j();return}let r=e.target.closest(".file-item[data-file]");r&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData(vu,r.dataset.file),e.dataTransfer.setData(gu,r.dataset.workspaceId??""),e.dataTransfer.setData("text/plain",r.dataset.file),r.classList.add("dragging"),Ra=!0,j())}function T1(){for(let e of Y.querySelectorAll(".dragging"))e.classList.remove("dragging");Ba(),(Ra||Ma)&&(Ra=!1,Ma=!1,j())}function I1(e){if(!Kb(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",Ba(),!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(Ts)?"[data-default-bundles]":"[data-default-reports]",d=Y.querySelector(l);d&&d.classList.add("drag-over")}}function R1(e){Y.contains(e.relatedTarget)||Ba()}async function M1(e){if(!Kb(e))return;e.preventDefault(),e.stopPropagation(),Ba();let t=e.target.closest("[data-workspace-id]"),r=t?t.dataset.workspaceId:null,n=e.dataTransfer.getData(gu)||null;if(e.dataTransfer.types.includes(Ts)){let s=e.dataTransfer.getData(Ts);if(!s)return;if(n&&n!==r&&ed(n,s)){let i=(a.bundles??[]).find(u=>u.integrity===s)?.name??s,l=G().find(u=>u.id===n),{confirmed:d}=await Ab({name:i,workspaceName:l?.name??""});if(!d)return;try{await Xi(n,s)}catch(u){console.warn(`Failed to remove '${i}' from source workspace ${n} remote:`,u)}}r&&await Xr(s,r),n&&n!==r&&await Ic(s,n),j();return}let o=e.dataTransfer.getData(vu);if(o){if(n&&n!==r&&Ln(n,o)){let s=G().find(l=>l.id===n),{confirmed:i}=await Tb({name:o,workspaceName:s?.name??""});if(!i)return;try{await Ji(n,o)}catch(l){console.warn(`Failed to remove '${o}' from source workspace ${n} remote:`,l)}}r&&await Ut(o,r),n&&n!==r&&await Wo(o,n),j()}}function qb(e){let t=zt();if(Nl(t?t.mode:null,e.mode)==="mismatch"){a.serverModeMismatch=!0,P.setForcedOff(!0),P.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)`),Ir(P.status);return}a.serverModeMismatch=!1,P.setProtocolLocked(!1);let n=a.serverMode!==e.mode;a.serverMode=e.mode,a.managed=e.managed,Dl(e),Ir(P.status),n&&j(),e.mode==="managed"&&Gb()}async function Gb(){try{a.managedSession=await Vh(),Vb(),a.managedTeams=a.managedSession==null?[]:await jh(),j()}catch(e){console.warn("managed: session probe failed:",e)}}async function B1(){try{await Gh()}catch(e){console.warn("admin: bundle load failed:",e);return}a.currentView="admin-users",x(),j()}async function F1(){try{await Yh()}catch(e){console.warn("admin: repos bundle load failed:",e);return}a.currentView="manage-repos",x(),j()}async function L1(){try{await Jh()}catch(e){console.warn("admin: reports bundle load failed:",e);return}a.currentView="manage-reports",x(),j()}async function O1(){try{await Xh()}catch(e){console.warn("admin: bundles bundle load failed:",e);return}a.currentView="manage-bundles",x(),j()}async function P1(){try{await Qh()}catch(e){console.warn("admin: teams bundle load failed:",e);return}a.currentView="manage-teams",x(),j()}async function D1(){if(zt())return;let e=0,t=null;try{let r=await fetch(wi,{credentials:"same-origin",headers:{accept:"application/json"}});e=r.status,r.ok&&(t=ki(await r.json()))}catch{}if(t){qb(t);return}e===404&&(a.serverMode="standalone",Eh(!0),Ir(P.status),j())}function N1(){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 z1(e){cn=e,Y=e.renderRoot,Ia=Y.querySelector("#file-list"),og(Y.querySelector("#encryption-toggle")),dg(Y.querySelector("#storage-status")),Y.addEventListener("click",y1),Y.addEventListener("dblclick",E1),Y.addEventListener("dragstart",A1),Y.addEventListener("dragend",T1),Y.addEventListener("dragover",I1),Y.addEventListener("dragleave",R1),Y.addEventListener("drop",M1),Ia.addEventListener("mouseover",v1),Ia.addEventListener("mouseout",w1),Y.querySelector("#sidebar-search-input")?.addEventListener("input",k1),N1(),Ir(P.status),j(),P.onServerInfo(qb),D1(),a.serverMode==="managed"&&Gb()}var yu=class extends Q{static styles=[F(eg),F(Zh)];render(){return c`<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(){z1(this)}};customElements.define("app-sidebar",yu);var Yb={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 Jb(){Dh(async(e,t,r)=>{let n=pc(e);try{return await $a(e,n,Yb[r]??Yb.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 wu=class extends M{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 c`<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",wu);function Xb({retry:e=!1}={}){return Z("sync-auth-dialog",{retry:!!e})}function Qb(){Ph(async({retry:e})=>{try{return await Xb({retry:e})}catch(t){return console.warn("Sync auth dialog failed to open:",t),null}})}var Fa="https://triage.space/",U1=[{hostname:"deepaudit.dev",pathPrefix:"/",supportsSync:!0},{hostname:"chalker.github.io",pathPrefix:"/deepview/",supportsSync:!1}];function H1(){for(let e of U1)if(location.hostname===e.hostname&&location.pathname.startsWith(e.pathPrefix))return e;return null}var V1=["deepview.triage","deepview.triage.pending"],j1="deepview.repoUrls";function W1(){try{for(let e of V1)if(localStorage.getItem(e))return!0}catch{return!0}try{let e=localStorage.getItem(j1);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 K1(){if(W1())return!0;let e=[];try{e=await ue()}catch{return!0}if(e.length>0)return!0;try{if(G().length>0)return!0}catch{return!0}try{return await Eo()}catch{return!0}}var ku=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=()=>c`<a class="om-link" href="${Fa}" target="_blank" rel="noopener noreferrer">${Fa}</a>`;return c`<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?c`<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>`:c`<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",ku);function q1(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 Zb(){let e=H1();return e?await K1()?await q1(e)?(location.assign(Fa),!0):!1:(location.replace(Fa),!0):!1}var $u=class extends M{static styles=[...M.styles,F(ct)];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 Gc({encoded:this.encoded,password:this._password});if(this._settled)return;let r=G().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=Tt(this._name);if(!t)return;let r=G().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 G())if(r.id!==this._decoded.id&&Tt(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 c`<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?c`<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 c`<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=Tt(this._name),r=this._nameCollision(t),n=!!t&&!r;return c`<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?c`<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 c`<dialog @close="${this._onClose}"><header><h3>${t}</h3></header>${this._stage==="password"?this._passwordStage():this._nameStage()}</dialog>`}};customElements.define("workspace-unlock-link-dialog",$u);function ey({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(xt(o.detail?.cause))}),document.body.append(n)})}var We=null,La=!1,Is=null;function G1(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 Y1(){if(We)return We;We=document.createElement("div"),We.id="lock-overlay",We.setAttribute("role","dialog"),We.setAttribute("aria-modal","true"),We.setAttribute("aria-label","Unlock DeepView"),We.innerHTML=`
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=`
73
88
  <div class="lock-overlay-card">
74
89
  <div class="lock-overlay-icon" aria-hidden="true">
75
90
  <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>
@@ -86,31 +101,31 @@ ${r}`}">${c1}<span class="file-label">${n}</span></button></li>`}function d1(e,t
86
101
  <a href="#" class="lock-overlay-wipe">Wipe local data and start over</a>
87
102
  </p>
88
103
  </div>
89
- `;let e=We.querySelector("button"),t=We.querySelector(".lock-overlay-error");return e.addEventListener("click",async()=>{if(!La){La=!0,t.hidden=!0,t.textContent="",e.disabled=!0,e.textContent="Waiting\u2026",Is=new AbortController;try{let n=await vo({signal:Is.signal})}catch(n){let o=G1(n);t.textContent=o,t.hidden=!o}finally{La=!1,Is=null,e.disabled=!1,e.textContent="Unlock with passkey"}}}),We.querySelector(".lock-overlay-wipe").addEventListener("click",async n=>{if(n.preventDefault(),!La&&confirm(`Wipe ALL local DeepView data and start over?
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?
90
105
 
91
106
  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.
92
107
 
93
- 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 wo()}catch(o){alert(`Wipe failed: ${o?.message??o}. Try again or clear localStorage manually via DevTools.`);return}location.reload()}}),document.body.append(We),We}function J1(){return Ct()?se()&&!yt():!1}function ty(){if(J1()){let e=Y1();e.hidden=!1;let t=e.querySelector("button");t&&t.focus()}else if(We&&(We.hidden=!0,Is))try{Is.abort()}catch{}}Ee(ty);ty();var ry=`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)}}
94
- `;var xu=class extends M{static styles=[...M.styles,F(Gn),F(ry)];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 c`<dialog @close="${this._onClose}"><header><h3>${n?"Edit comment":"Add comment"}</h3><div class="finding">${Yn(te(t,a.severityMode))} ${r?c`<span class="loc" title="${r}">${r}</span>`:g}</div>${t.description?c`<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?c`<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",xu);function ny({initial:e="",finding:t=null}={}){return Z("comment-dialog",{initial:e,finding:t})}var _u=class extends M{static styles=[...M.styles,F(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?c`<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>`:c`<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 c`<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",_u);function oy({name:e,encrypted:t}={}){return Z("download-bundle-dialog",{bundleName:e??"",encrypted:!!t})}var Q1={critical:"Critical",high:"High",medium:"Medium",low:"Low",high_bug:"High bug",bug:"Bug",informational:"Informational"},Z1={red:"Red",blue:"Blue",green:"Green",gray:"Gray",none:"Unmarked"},e_={inprogress:"In progress",fixed:"Fixed",invalid:"Invalid",deleted:"Deleted",ignored:"Ignored"};function t_(e){return we.filter(t=>e.has(t)).map(t=>Q1[t]??t).join(", ")}function r_(){let e=[];if(a.filterSeverities.size>0&&e.push({label:"Severity",value:t_(a.filterSeverities)}),a.filterColors.size>0&&e.push({label:"Marks",value:[...a.filterColors].map(t=>Z1[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===wr?"(none)":a.filterAnalyzer}),a.filterModel&&e.push({label:"Model",value:a.filterModel===kr?"(none)":a.filterModel}),a.filterRepo&&e.push({label:"Repository",value:a.filterRepo===tn?"(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 n_(e){return(e==="download"?a.reports.flatMap(r=>r.groups??[]):Gt()).filter(r=>_e(r).commonTriage===a.shownTriage)}function sy(e){let t=n_(e),r=t.length,n=Pn(t).length;return{included:n,total:r,excluded:r-n,filters:r_(),bucketLabel:a.shownTriage?e_[a.shownTriage]??a.shownTriage:null,focusedOnly:e==="print"&&a.viewMode==="focus"}}var iy=`.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}
95
- `;var Su=class extends M{static styles=[...M.styles,F(iy)];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 c`<p class="ecd-count">No findings to ${this.mode==="print"?"print":"download"}.</p>`;if(this.focusedOnly&&this.included>0)return c`<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?c`All <strong>${this.included}</strong> ${this.included===1?"finding":"findings"} included.`:c`<strong>${this.included}</strong> of ${this.total} ${this.total===1?"finding":"findings"} included.`;return c`<p class="ecd-count">${r}</p>${this.excluded>0?c`<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?c`<p class="ecd-filters-label">No filters active — the full ${this.bucketLabel?`${this.bucketLabel.toLowerCase()} `:""}set is included.</p>`:c`<p class="ecd-filters-label">Active filters</p><dl class="ecd-filters">${this.filters.map(t=>c`<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 c`<dialog @close="${this._onClose}"><header><h3>${r}</h3></header><p class="nwd-intro">${n}</p>${this._countSection()} ${this.bucketLabel?c`<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",Su);function Cu(e){let t=sy(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 ay=`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}
96
- `;var Eu=class extends M{static styles=[...M.styles,F(Gn),F(ay)];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=vr(o);return c`<dialog @close="${this._onClose}"><header><h3>${n?"Edit fix link":"Add fix link"}</h3><div class="finding">${Yn(te(t,a.severityMode))} ${r?c`<span class="loc" title="${r}">${r}</span>`:g}</div>${t.description?c`<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?c`<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?c`<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",Eu);function ly({initial:e="",finding:t=null}={}){return Z("fix-link-dialog",{initial:e,finding:t})}var i_={critical:"Critical",high:"High",medium:"Medium",low:"Low",high_bug:"High Bug",bug:"Bug",informational:"Informational"},a_=["critical","high","medium","low","high_bug","bug","informational"];function Au(e){return i_[e]??e}function cy(e){let t=a_.indexOf(e);return t===-1?999:t}function dy(e){let t=parseInt(e.line,10);return Number.isFinite(t)?`${e.file}:${t}`:e.file}function l_(e){let t=U(e),r=a.triage.get(t),n=r?.triage,o=Dn(e),s=r?.color,i=r?.comment??"",l=dt(e.description??"",e),d=Zr(e),p=[d?`### ${dy(e)} - ${d}`:`### ${dy(e)}`,""],f=[];if(qt(e)){let h=ra(e)?", varies across reports":"";f.push(`**Severity:** ${Au(Kt(e))} (corrected from ${Au(e.severity)}${h})`)}return 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("")),e.recommendation&&(p.push(`**Recommendation:** ${dt(e.recommendation,e).trim()}`),p.push("")),e.confidenceReason&&(p.push(`**Confidence reason:** ${dt(e.confidenceReason,e).trim()}`),p.push("")),qt(e)&&e.correctedSeverityReason&&(p.push(`**Severity correction:** ${e.correctedSeverityReason.trim()}`),p.push("")),e.fix&&(p.push(`**Fix:** ${dt(e.fix,e).trim()}`),p.push("")),i&&(p.push(`**Comment:** ${i.trim()}`),p.push("")),p.join(`
97
- `)}function c_(e){let t=(e.groups??[]).filter(r=>_e(r).commonTriage===a.shownTriage);return Pn(t)}function d_(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(`
98
- `);let o=new Map;for(let i of r){let l=Kt(i)??"informational";o.has(l)||o.set(l,[]),o.get(l).push(i)}let s=[...o.keys()].toSorted((i,l)=>cy(i)-cy(l));for(let i of s){let l=o.get(i);n.push(`## ${Au(i)} (${l.length})`),n.push("");for(let d of l)n.push(l_(d))}return n.join(`
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(`
99
114
  `).trimEnd()+`
100
- `}function u_(e){let t=[];for(let r of e){let n=c_(r);n.length!==0&&t.push(d_(r,n))}return t.join(`
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(`
101
116
  ---
102
117
 
103
- `)}function p_(e){let t=e.map(n=>n.fileName),r="";return t.length===1?r=t[0]:t.length>1&&(r=oa(t)),r=r.replace(/\.json$/u,""),`${r||"deepview-report"}.md`}function uy(e){if(e.length===0)return;let t=u_(e),r=new Blob([t],{type:"text/markdown;charset=utf-8"});Pt(r,p_(e))}ec(()=>{a.currentView==="bundles"&&a.selectedBundle?x():a.currentView==="packages"?x():a.currentView==="repositories"?x():(a.currentView==="findings"||a.currentView==="files")&&j().catch(()=>{})});function py(){a.currentView==="bundles"&&a.bundleDetailsTab==="graph"?Ca():Zd()}function Pa(){a.currentView==="bundles"&&a.bundleDetailsTab==="graph"?Ea():eu()}function eo(){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 Rs(e){let r=document.querySelector(e)?.scrollTop??0;x();let n=document.querySelector(e);n&&(n.scrollTop=r)}function Rr(){a.viewMode==="table"?Rs(".findings-table-list"):x()}var Tu=0;function f_(){Tu||(Tu=requestAnimationFrame(()=>{Tu=0,x()}))}function ee(e,t){for(let r of e.composedPath())if(r?.matches?.(t))return r;return null}function fy(e){let r=ee(e,"[data-gid]")?.dataset?.gid,n=r?nn(r):null;if(!n)return null;let o=He(n);return Cg(o,aa(o))}E.addEventListener("click",e=>{let t=ee(e,"[data-finding-code-bundle]");if(t){let C=t.dataset.findingCodeBundle,N=t.dataset.findingCodeFile,V=t.dataset.findingCodeLine,X=V?parseInt(V,10):null;a.bundleSourceFile=N||null,a.bundleSourceFindingIdx=null,(a.bundleDetailsTab==="code"||a.bundleDetailsTab==="search")&&(a.bundleDetailsTab="overview");let me=()=>{Number.isFinite(X)&&queueMicrotask(()=>{let Se=document.querySelector(`.bundle-source-lineno-row[data-line="${X}"]`);Se&&Se.scrollIntoView({block:"start",behavior:"instant"})})};if(a.selectedBundle===C&&a.bundleDetails?.integrity===C){x(),me();return}a.selectedBundle=C,a.bundleDetails=null,x(),(async()=>(await Yt(C),me()))();return}let r=e.target.closest("[data-package-expand]");if(r){let C=r.dataset.packageExpand;a.expandedPackages.has(C)?a.expandedPackages.delete(C):a.expandedPackages.add(C),x();return}let n=e.target.closest("[data-package-row-issues]");if(n){let C=n.dataset.packageRowIssues,N=n.dataset.packageRowIssuesVersion;a.selectedPackage=C,a.selectedPackageVersion=N||null,a.packageDetailsTab="issues",a.packageSlideTriage=null,a.packageSlideTransient=!0,x();return}let o=e.target.closest("[data-repository-row-issues]");if(o){let C=o.dataset.repositoryRowIssues;a.selectedRepository=C,a.repositoryDetailsTab="issues",a.repositorySlideTriage=null,a.repositorySlideTransient=!0,x();return}let s=e.target.closest("[data-select-package]");if(s){let C=s.dataset.selectPackage,N=s.dataset.selectPackageVersion??"",V=N===""?null:N;if(a.selectedPackage===C&&a.selectedPackageVersion===V)return;a.selectedPackage=C,a.selectedPackageVersion=V,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 C=i.dataset.packageTab;(C==="overview"||C==="issues")&&a.packageDetailsTab!==C&&(a.packageDetailsTab=C,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 C=l.dataset.packageReport;C&&ft(C);return}let d=e.target.closest("[data-select-repository]");if(d){let C=d.dataset.selectRepository;if(a.selectedRepository===C)return;a.selectedRepository=C,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 C=u.dataset.repositoryTab;(C==="overview"||C==="issues")&&a.repositoryDetailsTab!==C&&(a.repositoryDetailsTab=C,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 C=p.dataset.bundleTab;if(ys.has(C)){if(C===a.bundleDetailsTab){a.selectedBundle&&Ar(a.selectedBundle,C);return}a.bundleDetailsTab==="graph"&&C!=="graph"&&Oe(),a.bundleDetailsTab=C,a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.selectedBundle&&Ar(a.selectedBundle,C),x(),C==="code"&&ks()}return}let f=e.target.closest("[data-bundle-download]");if(f){let C=f.dataset.bundleDownload,N=(a.bundles??[]).find(V=>V.integrity===C);if(!N)return;(async()=>{let{confirmed:V}=await oy({name:N.name,encrypted:se()});if(V)try{let X=await Nt(C);Pt(new Blob([X],{type:"application/octet-stream"}),N.name)}catch(X){alert(`Failed to download bundle: ${X.message}`)}})();return}let h=e.target.closest("[data-bundle-export-sbom]");if(h){let C=h.dataset.bundleExportSbom,N=a.bundleDetails,V=(a.bundles??[]).find(X=>X.integrity===a.selectedBundle);if(!V||!N||N.integrity!==V.integrity)return;try{let X=C==="cyclonedx",me=X?rm(N,V):nm(N,V),Se=`${fa(V.name)}.${X?"cdx":"spdx"}.json`;Pt(new Blob([me],{type:"application/json"}),Se)}catch(X){alert(`Failed to export ${C==="cyclonedx"?"CycloneDX":"SPDX"}: ${X.message}`)}return}if(ee(e,"[data-bundle-search-context]")){a.bundleSearchContext=!a.bundleSearchContext,Rs(".bundle-search-results");return}if(e.target.closest("[data-advisories-consent]")){Vm(),x();return}if(e.target.closest("[data-advisories-retry]")){Wm(a.bundleDetails,x).catch(()=>{}),x();return}let m=e.target.closest("[data-bundle-issue-report]");if(m){let C=m.dataset.bundleIssueReport;C&&ft(C);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,eo());return}let v=e.target.closest("[data-bundle-source-finding]");if(v){let C=parseInt(v.dataset.bundleSourceFinding,10);Number.isFinite(C)&&(a.bundleSourceFindingIdx=a.bundleSourceFindingIdx===C?null:C,eo());return}let w=e.target.closest("[data-bundle-code-issue-step]");if(w){let C=w.closest("[data-bundle-code-issue-order]"),N=null;try{N=JSON.parse(C?.dataset.bundleCodeIssueOrder??"null")}catch{}if(Array.isArray(N)&&N.length>0){let V=w.dataset.bundleCodeIssueStep==="-1"?-1:1,X=N.findIndex(Se=>Se.idx===a.bundleSourceFindingIdx),me=X===-1?V>0?N[0]:N.at(-1):N[(X+V+N.length)%N.length];a.bundleSourceFindingIdx=me.idx,eo(),me.line>0&&queueMicrotask(()=>{let Se=document.querySelector(`.bundle-source-lineno-row[data-line="${me.line}"]`);Se&&Se.scrollIntoView({block:"center",behavior:"smooth"})})}return}let y=ee(e,"[data-bundle-view-source]");if(y){let C=y.dataset.bundleViewSource;if(!C)return;let N=y.dataset.bundleViewFindingIdx,V=N===void 0?null:parseInt(N,10),X=y.dataset.bundleViewLine,me=X?parseInt(X,10):null,Se=a.bundleSourceFile!==C;if(a.bundleSourceFile=C,Number.isFinite(V)?a.bundleSourceFindingIdx=V:Se&&(a.bundleSourceFindingIdx=null),y.closest(".bundle-code-rail")?Rs(".bundle-code-rail-body"):y.closest(".bundle-search-results")?Rs(".bundle-search-results"):y.closest(".bundles-slide-body")?Rs(".bundles-slide-body"):x(),Number.isFinite(me)){let gt=y.dataset.bundleViewScrollBlock||"center";queueMicrotask(()=>{let De=document.querySelector(`.bundle-source-lineno-row[data-line="${me}"]`);De&&De.scrollIntoView({block:gt,behavior:"smooth"})})}return}if(e.target.closest('[data-action="toggle-files"]')){a.currentView==="files"?a.currentView="findings":(a.viewMode==="graph"&&Oe(),a.currentView="files"),document.body.classList.remove("report-fullscreen"),x();return}let _=ee(e,"[data-g2-pkg]");if(_){let C=_.dataset.g2Pkg;A.solo=A.solo===C?null:C,A.solo&&(A.selected=null),py(),Pa(),A.graphState?.requestDraw?.();return}let T=ee(e,"[data-g2-select]");if(T){A.selected=T.dataset.g2Select,py(),A.graphState?.requestDraw?.();return}let S=ee(e,"[data-g2-top-pkgs]");if(S){A.topPkgsTab=S.dataset.g2TopPkgs,Pa();return}let I=ee(e,"[data-g2-jump-findings]");if(I){if(a.currentView==="bundles"){a.bundleDetailsTab==="graph"&&Oe(),a.bundleDetailsTab="issues",a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.selectedBundle&&Ar(a.selectedBundle,"issues"),x();return}sa(),a.filterConfMin=0,a.filterInclude=I.dataset.g2JumpFindings,a.currentView="findings",a.viewMode==="graph"&&(a.viewMode="table"),Oe(),x();return}let R=ee(e,"[data-g2-jump-file]");if(R){let C=R.dataset.g2JumpFile;a.currentView="files",Oe(),x(),requestAnimationFrame(()=>{let N=document.querySelector(`#${us(C)}`);N&&N.scrollIntoView({behavior:"smooth",block:"start"})});return}if(ee(e,"#g2-path-filter-clear")){A.pathFilter="";let C=document.querySelector("graph-layout")?.shadowRoot?.querySelector("#g2-path-filter");C&&(C.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,Oe(),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),Oe(),x();return}if(ee(e,"[data-g2-packages-view]")){A.packagesView=!A.packagesView,A.layoutCache=null,A.selected=null,A.focusedPkg=null,Oe(),x();return}let ie=ee(e,".graph2-triage-selector [data-triage-show]");if(ie){let C=ie.dataset.triageShow;a.shownTriage=a.shownTriage===C?null:C,A.layoutCache=null,A.selected=null,Oe(),x();return}let Xe=ee(e,"[data-g2-focus-pkg]");if(Xe){A.focusedPkg=Xe.dataset.g2FocusPkg,A.layoutCache=null,Oe(),x();return}if(ee(e,"#g2-back-to-full")){A.focusedPkg=null,A.layoutCache=null,A.packagesView&&(A.selected=null),Oe(),x();return}let Br=ee(e,".tab");if(Br&&ee(e,".tabs")){let N=ee(e,"[data-gid]").dataset.gid,V=Br.dataset.tid;a.activeTabByGroup.set(N,V),Rr();return}let Qt=ee(e,"[data-triage-action]");if(Qt){let C=Qt.closest(".triage-menu"),N=C?.dataset.gid;if(!N)return;let V=nn(N);if(!V)return;let X=Qt.dataset.triageAction;if(!["inprogress","fixed","invalid","deleted","ignored","restore"].includes(X))return;let Se=_e(V).hasConflict?[He(V)]:V;for(let gt of Se){let De=U(gt),Zt=ia(gt);X==="restore"?(D(a.triage,De,{triage:void 0}),he(a.triage,De,Zt,!1)):X==="ignored"?Ht(a.triage,De,Zt)?he(a.triage,De,Zt,!1):(D(a.triage,De,{triage:void 0}),he(a.triage,De,Zt,!0)):a.triage.get(De)?.triage===X?D(a.triage,De,{triage:void 0}):(D(a.triage,De,{triage:X}),he(a.triage,De,Zt,!1))}try{C.hidePopover()}catch{}pe(),Rr();return}if(ee(e,".mark-comment")){let N=ee(e,"[data-gid]").dataset.gid,V=nn(N);if(!V)return;let X=He(V),me=U(X),Se=a.triage.get(me)?.comment??"";ny({initial:Se,finding:X}).then(gt=>(gt===null||(D(a.triage,me,{comment:gt||void 0}),pe(),Rr()),null)).catch(()=>{});return}let Fr=ee(e,".mark-copy");if(Fr){let C=fy(e);if(C===null)return;try{navigator.clipboard.writeText(C).then(()=>(Fr.classList.add("copied"),setTimeout(()=>Fr.classList.remove("copied"),1e3),null)).catch(()=>{})}catch{}return}let Lr=ee(e,"[data-copy-report]");if(Lr){let C=Lr.dataset.copyReport;try{navigator.clipboard.writeText(C).then(()=>(Lr.classList.add("copied"),setTimeout(()=>Lr.classList.remove("copied"),1e3),null)).catch(()=>{})}catch{}return}let dn=ee(e,"[data-copy-path]");if(dn){let C=dn.dataset.copyPath;try{navigator.clipboard.writeText(C).then(()=>(dn.classList.add("copied"),setTimeout(()=>dn.classList.remove("copied"),1e3),null)).catch(()=>{})}catch{}return}let Ft=ee(e,".mark-claude");if(Ft){let C=fy(e);if(C===null)return;let N=`claude://code/new?q=${encodeURIComponent(`Confirm and fix:
104
-
105
- ${C}`)}`;try{window.location.href=N,Ft.classList.add("copied"),setTimeout(()=>Ft.classList.remove("copied"),1e3)}catch{}return}if(ee(e,".mark-fix")){let N=ee(e,"[data-gid]").dataset.gid,V=nn(N);if(!V)return;let X=He(V),me=U(X),Se=a.triage.get(me)?.fix??"";ly({initial:Se,finding:X}).then(gt=>(gt===null||(D(a.triage,me,{fix:gt||void 0}),pe(),Rr()),null)).catch(()=>{});return}let kt=ee(e,"[data-flag-toggle]");if(kt){let C=kt.dataset.flagToggle,N=a.triage.get(C)?.flagged;D(a.triage,C,{flagged:N!==!0}),pe(),Rr();return}let un=e.target.closest("[data-triage-show]");if(un&&!un.closest(".graph2-triage-selector")){let C=un.dataset.triageShow;a.shownTriage=a.shownTriage===C?null:C,x();return}if(e.target.closest("[data-table-deselect]")){a.tableSelectedGid=null,Rr();return}let Or=e.target.closest("[data-tree-select]");if(Or){let C=Or.dataset.treeSelect;a.filesSelectedFile=a.filesSelectedFile===C?null:C,x();return}e.target.closest("[data-tree-deselect]")&&(a.filesSelectedFile=null,x())});var hy=document.querySelector("#bundle-source-overlay-slot");hy&&hy.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,eo());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,eo())}});E.addEventListener("row-select",e=>{let t=e.detail?.gid;t&&(a.tableSelectedGid=a.tableSelectedGid===t?null:t,Rr())});var Da="application/x-deepview-kanban-gid";function h_(e,t){let n=_e(e).hasConflict?[He(e)]:e;for(let o of n){let s=U(o),i=ia(o);t==="untriaged"?(D(a.triage,s,{triage:void 0}),he(a.triage,s,i,!1)):t==="ignored"?(D(a.triage,s,{triage:void 0}),he(a.triage,s,i,!0)):(D(a.triage,s,{triage:t}),he(a.triage,s,i,!1))}}function Ru(){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(Da,r),e.dataTransfer.setData("text/plain",r),e.dataTransfer.effectAllowed="move",t.classList.add("dragging"))});E.addEventListener("dragend",()=>{Ru()});E.addEventListener("dragover",e=>{if(!e.dataTransfer?.types.includes(Da))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(Da))return;let t=e.target.closest?.(".kanban-column[data-kanban-target]");if(!t){Ru();return}e.preventDefault();let r=e.dataTransfer.getData(Da),n=t.dataset.kanbanTarget;if(Ru(),!r||!n)return;let o=nn(r);!o||(_e(o).commonTriage??"untriaged")===n||(h_(o,n),x(),queueMicrotask(pe))});var Iu=!1;function Zn(e){return e?E.querySelector(`.kanban-card[data-gid="${CSS.escape(e)}"]`):null}function Oa(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 Ms(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(Iu)return;Iu=!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),Iu=!1};if(r){let u=Zn(e);u?(Oa(u),u.style.viewTransitionName="kanban-detail-modal",u.getBoundingClientRect()):Oa(),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}Oa(),a.kanbanPopoverGid=e;let i=null,l=document.startViewTransition(()=>{x(),i=Zn(t),i&&(Oa(i),i.style.viewTransitionName="kanban-detail-modal")}),d=setTimeout(()=>s(i??Zn(t)),600);(async()=>{try{await l.finished}catch{}clearTimeout(d),s(i??Zn(t))})()}function g_(e){let t=Zn(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;Ms(i);let l=Zn(i);l&&(l.focus({preventScroll:!0}),l.scrollIntoView({block:"nearest",behavior:"instant"}))}E.addEventListener("click",e=>{if(e.target.closest?.(".kanban-detail-close")){Ms(null);return}if(e.target.closest?.(".kanban-action"))return;let t=e.target.closest?.(".kanban-card[data-kanban-source]");if(t){if(window.getSelection?.()?.toString())return;let r=t.dataset.gid;if(!r)return;Ms(a.kanbanPopoverGid===r?null:r);return}e.target.closest?.(".kanban-detail-modal")||a.kanbanPopoverGid&&Ms(null)});document.addEventListener("keydown",e=>{e.key==="Escape"&&a.kanbanPopoverGid&&Ms(null)});function gy(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 my(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&&gy(o)}E.addEventListener("click",e=>{let t=e.target.closest?.("[data-focus-nav]");if(t){my(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&&gy(n)});function m_(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||m_(e))return;let n=0;if(e.key==="ArrowRight")n=1;else if(e.key==="ArrowLeft")n=-1;else return;e.preventDefault(),t?my(n):g_(n)});E.addEventListener("mark-color",e=>{let t=ee(e,"[data-gid]");if(!t)return;let r=t.dataset.gid,n=nn(r);if(!n)return;let o=U(He(n)),s=e.detail?.color;if(!s)return;a.triage.get(o)?.color===s?D(a.triage,o,{color:void 0}):D(a.triage,o,{color:s}),pe(),Rr()});var Mr=null,Mu=null;function by(){if(Mr!==null||a.reports.length===0)return;Mr=a.viewMode,Mu=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=oa(e)),t=t.replace(/\.json$/u,""),t&&(document.title=t)}function yy(){Mr!==null&&(a.viewMode!==Mr&&(a.viewMode=Mr,x()),document.title=Mu,Mr=null,Mu=null)}window.addEventListener("beforeprint",by);window.addEventListener("afterprint",yy);document.addEventListener("print-requested",async()=>{if(a.reports.length===0||Mr!==null)return;let{confirmed:e}=await Cu("print");if(e&&Mr===null){by();try{await Promise.all([...E.querySelectorAll("finding-card")].map(t=>t.updateComplete)),window.print()}catch(t){throw yy(),t}}});document.addEventListener("download-requested",async()=>{if(a.reports.length===0)return;let{confirmed:e}=await Cu("download");e&&uy(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"&&ks())});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,Ar(t,"compare"),x(),j(),Yt(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,f_();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?.(),Pa();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?.(),Pa();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(xi,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(_i,t)}catch{}x()}});E.addEventListener("repo-edit-start",()=>{a.repoEditing=!0,x()});E.addEventListener("repo-input",e=>{a.repoUrl=e.detail.url,et(a.currentFile,a.repoUrl)});E.addEventListener("repo-commit",e=>{a.repoUrl=e.detail.url,et(a.currentFile,a.repoUrl),a.repoEditing=!1,x()});E.addEventListener("repo-cancel",e=>{a.repoUrl=e.detail.url,et(a.currentFile,a.repoUrl),a.repoEditing=!1,x()});document.addEventListener("keydown",e=>{if(e.key==="Escape"){if(a.bundleSourceFindingIdx!=null){a.bundleSourceFindingIdx=null,eo();return}if(a.bundleSourceFile){if(a.currentView==="bundles"&&a.bundleDetailsTab==="code")return;a.bundleSourceFile=null,x()}}});var vy=`: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}}
106
- `;var Bu="deepview.theme",to=Object.freeze(["dark","light","green","pink"]),y_={dark:{base:"#1a1a1b",dim:"#0a0a0a"},light:{base:"#f6f6fa",dim:"#646464"},green:{base:"#0a140a",dim:"#050a05"},pink:{base:"#ffe4ee",dim:"#a3727f"}},v_="\u2600",w_="\u263E",Fu="deepview-theme-changed",Na="dark",Ou=!1;function k_(){try{let e=localStorage.getItem(Bu);return to.includes(e)?e:"dark"}catch{return"dark"}}function Bs(e){to.includes(e)||(e="dark"),Na=e;for(let r of to)r!=="dark"&&document.body.classList.remove(`theme-${r}`);e!=="dark"&&document.body.classList.add(`theme-${e}`);try{e==="dark"?localStorage.removeItem(Bu):localStorage.setItem(Bu,e)}catch{}let t=document.querySelector('meta[name="theme-color"]');if(t){let{base:r,dim:n}=y_[e];t.setAttribute("content",Ou?n:r)}window.dispatchEvent(new CustomEvent(Fu,{detail:{theme:e}}))}Bs(k_());window.addEventListener("beforeprint",()=>{Ou=!0,Bs(Na)});window.addEventListener("afterprint",()=>{Ou=!1,Bs(Na)});function wy(e){if(!to.includes(e))throw new TypeError(`DeepView.setTheme: unknown theme ${JSON.stringify(e)} (expected one of ${to.map(t=>JSON.stringify(t)).join(", ")})`);Bs(e)}function ky(){return Na}var $y=to,Lu=class extends Q{static properties={_light:{state:!0}};static styles=F(vy);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(Fu,this._onThemeChanged)}disconnectedCallback(){window.removeEventListener(Fu,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");Bs(t?"dark":"light")};_onKeydown=t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this._toggle())};render(){return c`${this._light?w_:v_}`}};customElements.define("theme-toggle",Lu);var xy=`: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(: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-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-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}.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}}
107
- `;var x_=["is-critical","mark-red","mark-blue","mark-green","mark-gray","has-conflict","triage-inprogress","triage-fixed","triage-invalid","triage-deleted","triage-ignored","selected"],Pu=class extends z{static properties={group:{attribute:!1},selected:{type:Boolean}};static styles=F(xy);constructor(){super(),this.group=null,this.selected=!1}render(){if(!this.group)return c``;this.dataset.gid=ds(this.group);let t=new Set(zg(this.group));this.selected&&t.add("selected");for(let r of x_)this.classList.toggle(r,t.has(r));return c`<div class="row">${Ug(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",Pu);var _y=`: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}}
108
- `;var Du=class extends Q{static properties={items:{attribute:!1},selectedGid:{attribute:!1}};static styles=F(_y);constructor(){super(),this.items=[],this.selectedGid=null}render(){return c`${J(this.items??[],t=>ds(t),t=>c`<finding-row .group="${t}" ?selected="${ds(t)===this.selectedGid}"></finding-row>`)}`}};customElements.define("finding-table",Du);var Sy=`: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([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-line;font-size:.96em;line-height:1.6;color:rgb(from var(--text) r g b / .82);margin-top:.4rem}.recommendation{grid-column:2;white-space:pre-line;font-size:.92em;line-height:1.55;color:var(--green);margin-top:.4rem}.conf-reason{grid-column:2;white-space:pre-line;font-size:.92em;font-style:italic;color:var(--muted);margin-top:.6rem;padding-top:.55rem;border-top:1px dashed var(--border)}.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-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-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-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}}.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-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(.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{color:inherit}.inline-code{border:0;background:transparent;padding:0}}
109
- `;var C_=["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"],Nu=class extends z{static properties={group:{attribute:!1},inGroup:{type:Boolean,attribute:"in-group",reflect:!0},context:{type:String,reflect:!0}};static styles=F(Sy);constructor(){super(),this.group=null,this.inGroup=!1,this.context=null}render(){if(!this.group)return c``;this.dataset.gid=zn(this.group);let t=new Set(Dg(this.group));for(let r of C_)this.classList.toggle(r,t.has(r));return c`<div class="card">${Ng(this.group,{context:this.context})}</div>`}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.requestUpdate()}};customElements.define("finding-card",Nu);var Cy=`: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)}
110
- `;var A_=["red","blue","green","gray"],zu=class extends Q{static properties={selected:{type:String}};static styles=F(Cy);constructor(){super(),this.selected=null}render(){return c`${A_.map(t=>c`<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",zu);var Uu=class extends z{createRenderRoot(){return this}render(){let t=a.filterConfMin,r=a.filterConfMax;return c`<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",Uu);var Te=$t(class extends st{constructor(e){if(super(e),e.type!==Ne.PROPERTY&&e.type!==Ne.ATTRIBUTE&&e.type!==Ne.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!Vp(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===Ne.PROPERTY){if(t===r[n])return be}else if(e.type===Ne.BOOLEAN_ATTRIBUTE){if(!!t===r.hasAttribute(n))return be}else if(e.type===Ne.ATTRIBUTE&&r.getAttribute(n)===t+"")return be;return Ys(e),t}});var Ey={files:"Filter files\u2026",code:"Search code\u2026",issues:"Search issues\u2026"},Ay={files:"Filter files",code:"Search code",issues:"Search issues"},T_=c`<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>`,I_={files:c`<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:c`<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:c`<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>`},Hu=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=Ey[n]??Ey.files;return c`${T_} <input type="text" class="bundle-code-search-input" placeholder="${o}" aria-label="${o}" .value="${Te(t)}" @input="${this._onInput}"> ${t?c`<button type="button" class="bundle-code-search-clear" title="Clear search" aria-label="Clear search" @click="${this._onClear}">×</button>`:g} ${this.modes.length>0?c`<span class="bundle-code-search-modes" role="tablist">${this.modes.map(s=>c`<button type="button" class="${B({"bundle-code-search-mode":!0,active:n===s})}" role="tab" aria-selected="${String(n===s)}" title="${Ay[s]??s}" aria-label="${Ay[s]??s}" @click="${()=>this._selectMode(s)}">${I_[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",Hu);var R_=c`<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>`,Vu=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 c`${R_} <input type="text" class="bundle-search-input" placeholder="${o}" aria-label="${o}" spellcheck="false" autocapitalize="off" autocomplete="off" .value="${Te(t)}" @input="${this._onInput}"> ${t?c`<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="${B({"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="${B({"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",Vu);var Ty={packages:{stateKey:"packagesSearchQuery",label:"Filter packages"},repositories:{stateKey:"repositoriesSearchQuery",label:"Filter repositories"}},ju=class extends z{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let t=Ty[this.kind];return t?c`<input type="search" class="packages-search" placeholder="${`${t.label}\u2026`}" aria-label="${t.label}" .value="${Te(a[t.stateKey])}" @input="${this._onInput}">`:(console.warn(`<entity-search>: unknown kind ${JSON.stringify(this.kind)}; expected one of ${Object.keys(Ty).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",ju);var M_=[["findings-desc","Findings \u2193"],["files-desc","Files \u2193"],["reports-desc","Reports \u2193"],["name-asc","Name A\u2192Z"]],Iy={packages:{stateKey:"packagesSortBy",aria:"Sort packages"},repositories:{stateKey:"repositoriesSortBy",aria:"Sort repositories"}},Wu=class extends z{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let t=Iy[this.kind];return t?c`<select class="packages-sort" aria-label="${t.aria}" .value="${Te(a[t.stateKey])}" @change="${this._onChange}">${M_.map(([r,n])=>c`<option value="${r}">${n}</option>`)}</select>`:(console.warn(`<entity-sort>: unknown kind ${JSON.stringify(this.kind)}; expected one of ${Object.keys(Iy).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",Wu);var Ku=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)=>c`<option value="${r}">${n}</option>`;return c`<select class="sort-select" aria-label="Sort findings" .value="${Te(a.sortBy)}" @change="${this._onChange}">${t("severity","Severity \u2193")} ${this.showFile?t("file","File \u2191"):g} ${this.showConfidence?c`${t("confidence-desc","Confidence \u2193")}${t("confidence-asc","Confidence \u2191")}`:g} ${this.showPriority?c`${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",Ku);var Ry=`: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)}
111
- `;var qu=class extends Q{static properties={min:{type:Number},max:{type:Number},step:{type:Number},low:{type:Number},high:{type:Number}};static styles=F(Ry);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 c`<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",qu);var Gu=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 c`<span>${this.low}</span><span class="dash">–</span><span>${this.high}</span>`}};customElements.define("conf-range-mirror",Gu);var My=`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)}}
112
- `;var Yu=class extends M{static styles=[...M.styles,F(My)];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 Nc();Pt(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 zc(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 Uc(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 c`<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?c`<div class="error">Failed to parse: ${this.parseError}</div>`:g} ${t?c`<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?c`<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?c`<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",Yu);function By(){return Z("triage-export-dialog")}var Fy=`: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}}
113
- `;function za(e){if(!e)return"";let t=e.match(/github\.com\/([^/?#]+\/[^/?#]+?)(?:\.git)?(?:[/?#]|$)/iu);return t?t[1]:e}var Ju=c`<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>`,Ly=c`<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>`,Xu=class extends Q{static properties={url:{type:String},editable:{type:Boolean,reflect:!0},editing:{type:Boolean,reflect:!0},_copied:{state:!0}};static styles=F(Fy);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?za(this.url):"Set repo";return c`<span class="${t?"chip":"chip empty"}" aria-hidden="true" inert>${Ju} <span class="label">${r}</span> <button type="button" class="edit-btn">${Ly}</button> </span><input type="text" .value="${Te(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?za(this.url):"Set repo",n=t?this._copied?"chip copied":"chip":"chip empty";return c`<span class="${n}" @click="${t?null:this._onEdit}">${Ju} ${t?this._slugLabel(r):c`<span class="label">${r}</span>`} <button type="button" class="edit-btn" title="Edit repo URL" aria-label="Edit repo URL" @click="${this._onEdit}">${Ly}</button></span>`}if(this.url){let t=this._copied?"chip readonly copied":"chip readonly";return c`<span class="${t}" title="Repo from findings (read-only)">${Ju} ${this._slugLabel(za(this.url))}</span>`}return g}_slugLabel(t){return c`<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=za(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",Xu);function Pe(e,t){for(let[r,n]of Object.entries(t))e.hasAttribute(r)||e.setAttribute(r,n)}var O_=c`<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>`,P_=c`<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>`,D_=c`<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>`,N_=[{key:"comment",glyph:O_,label:"commented",stateKey:"filterComment",hasKey:"hasComment"},{key:"fix",glyph:P_,label:"fixed",stateKey:"filterFix",hasKey:"hasFix"},{key:"flag",glyph:D_,label:"flagged",stateKey:"filterFlagged",hasKey:"hasFlagged"}],Qu=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(),Pe(this,{role:"group","aria-label":"Annotation filter"})}render(){let t=N_.filter(r=>this[r.hasKey]||a[r.stateKey]);return t.length===0?g:c`${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 c`<button type="button" class="${B({"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",Qu);var z_=[["critical","Critical"],["high","High"],["medium","Medium"],["low","Low"],["high_bug","High bug"],["bug","Bug"],["informational","Info"]],Zu=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(),Pe(this,{role:"group","aria-label":"Filter by severity"})}render(){let t=this.kind==="graph"?new Set(this.selected):a.filterSeverities,r=z_.filter(([n])=>(this.counts[n]??0)||t.has(n));return r.length===0?g:c`${r.map(([n,o])=>{let s=this.counts[n]??0,i=t.has(n);return c`<button type="button" class="${B({"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",Zu);var U_=[["corrected","Corrected","Show corrected severities (application-specific re-ratings)"],["original","Original","Show the original analyzer severities"]],ep=class extends z{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Pe(this,{role:"group","aria-label":"Severity display mode"})}render(){let t=a.severityMode;return c`<span class="severity-mode-label">Severity</span><span class="severity-mode-chips">${U_.map(([r,n,o])=>{let s=t===r;return c`<button type="button" class="${B({"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",ep);var H_=c`<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>`,tp=class extends z{createRenderRoot(){return this}render(){let t=a.currentView==="bundles"&&a.selectedBundle,r=!a.currentFile&&!t;return c`<button type="button" class="danger" ?disabled="${r}">${H_}<span>Delete current</span></button>`}};customElements.define("sidebar-delete-current",tp);var V_=c`<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>`,j_=c`<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>`,Oy={packages:{title:"Show packages",icon:V_,view:"packages"},repositories:{title:"Show repositories",icon:j_,view:"repositories"}},rp=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 g;let t=Oy[this.kind];if(!t)return console.warn(`<sidebar-view-button>: unknown kind ${JSON.stringify(this.kind)}; expected one of ${Object.keys(Oy).map(n=>JSON.stringify(n)).join(", ")}.`),g;let r=a.currentView===t.view;return c`<button type="button" class="${B({"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",rp);var W_=["invalid","deleted"],Py={package:{stateKey:"packageSlideTriage"},repository:{stateKey:"repositorySlideTriage"}},np=class extends z{static properties={counts:{attribute:!1},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.kind=""}connectedCallback(){super.connectedCallback(),Pe(this,{role:"group","aria-label":"Triage view"})}render(){let t=Py[this.kind];if(!t)return console.warn(`<slide-triage-tabs>: unknown kind ${JSON.stringify(this.kind)}; expected one of ${Object.keys(Py).map(o=>JSON.stringify(o)).join(", ")}.`),g;let r=a[t.stateKey],n=W_.filter(o=>(this.counts[o]??0)>0||r===o);return n.length===0?g:c`${n.map(o=>{let s=r===o,i=this.counts[o]??0;return c`<button type="button" class="${B({"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",np);var K_=[["own","Sources"],["modules","Dependencies"]],op=class extends z{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Pe(this,{role:"group","aria-label":"Source filter"})}render(){return c`${K_.map(([t,r])=>{let n=a.filterSources.has(t);return c`<button type="button" class="${B({"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",op);var q_=c`<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>`,G_=c`<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>`,Dy={findings:{stateKey:"filterInclude",placeholder:"Search findings\u2026"},files:{stateKey:"filesSearch",placeholder:"Search files\u2026"}},sp=class extends z{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let t=Dy[this.kind];if(!t)return console.warn(`<toolbar-search>: unknown kind ${JSON.stringify(this.kind)}; expected one of ${Object.keys(Dy).map(n=>JSON.stringify(n)).join(", ")}.`),g;let r=a[t.stateKey];return c`${q_} <input type="text" aria-label="${t.placeholder}" placeholder="${t.placeholder}" .value="${Te(r)}" @input="${this._onInput}"> ${this.kind==="findings"&&r?this._negateToggle():g}`}_negateToggle(){let t=a.filterIncludeNegate;return c`<button type="button" class="${B({"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}">${G_}</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",sp);function Y_(e){if(!e)return"";let t=e.match(/github\.com\/([^/?#]+\/[^/?#]+?)(?:\.git)?(?:[/?#]|$)/iu);return t?t[1]:e}var ip=class extends z{static properties={options:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.options=[]}render(){return c`<select class="sort-select" aria-label="Filter by repository" .value="${Te(a.filterRepo)}" @change="${this._onChange}"><option value="">All repositories</option>${this.options.map(t=>{let r=t??tn,n=t==null?"(no repo)":Y_(t);return c`<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",ip);var Ny=[["none","none","unmarked"],["red","r","red"],["blue","b","blue"],["green","g","green"],["gray","x","gray"]],ap=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(),Pe(this,{role:"group","aria-label":"Filter by mark color"})}render(){let t=this.kind==="graph"?new Set(this.selected):a.filterColors;return Ny.some(([n])=>(this.counts[n]??0)||t.has(n))?c`${Ny.map(([n,o,s])=>{let i=this.counts[n]??0,l=t.has(n);return c`<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",ap);var J_=["inprogress","fixed","invalid","deleted","ignored"],lp={graph:"graph2-triage-selector",packages:"packages-triage-selector"},X_={inprogress:"In progress"},Q_=e=>X_[e]??e.charAt(0).toUpperCase()+e.slice(1),cp=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(),Pe(this,{role:"group","aria-label":"Triage view"})}render(){let t=this.states??J_,r=t.reduce((s,i)=>s+(this.counts[i]??0),0),n=this.variant?lp[this.variant]:null;this.variant&&n===void 0&&console.warn(`<triage-selector>: unknown variant ${JSON.stringify(this.variant)}; expected one of ${Object.keys(lp).map(s=>JSON.stringify(s)).join(", ")} or "".`);for(let s of Object.values(lp))this.classList.toggle(s,s===n);let o=r===0&&!a.shownTriage;return this.classList.toggle("is-empty",o),o?g:c`${t.map(s=>{let i=this.counts[s]??0,l=a.shownTriage===s;if(i===0&&!l)return g;let d=Q_(s);return c`<button type="button" class="${B({"triage-state-btn":!0,[`triage-state-${s}`]:!0,active:l})}" data-triage-show="${s}" title="${l?`Exit ${d.toLowerCase()} view`:`Show ${d.toLowerCase()} (${i})`}" aria-pressed="${String(l)}">${d} (${i})</button>`})}`}};customElements.define("triage-selector",cp);var Z_={table:c`<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:c`<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:c`<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:c`<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:c`<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:c`<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>`},zy={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)"},dp=["table","list","grouped","focus","kanban","graph"],up=class extends z{static properties={modes:{type:String},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.modes=dp.join(","),this.kind="findings"}connectedCallback(){super.connectedCallback(),Pe(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=>dp.includes(o)),n=r.length>0?r:dp;return c`${n.map(o=>c`<button type="button" class="${B({"view-mode-btn":!0,active:t===o})}" title="${zy[o]}" aria-label="${zy[o]}" aria-pressed="${String(t===o)}" @click="${()=>this._select(o,t)}">${Z_[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",up);var jy=6,Uy=14,Ua=2,Hy=24,Fs=4,eS=1.5,Ha=new Map,Vy="treemap";function tS(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 rS(e,t,r,n){let o=r*r,s=n*n;return Math.max(s*e/o,o/(s*t))}function Wy(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 d=0;for(let f of n)d+=f.value;let u=i*l/d,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,_=k>m?k:m,T=k<v?k:v,S=rS(_,T,b+k,f);if(h===p||S<=w)w=S,b+=k,m=_,v=T,h++;else break}let y=b/f;if(i>=l){let k=s;for(let _=p;_<h;_++){let T=_===h-1?s+l-k:n[_].value*u/y;r.push({node:n[_],x:o,y:k,w:y,h:T}),k+=T}o+=y,i-=y}else{let k=o;for(let _=p;_<h;_++){let T=_===h-1?o+i-k:n[_].value*u/y;r.push({node:n[_],x:k,y:s,w:T,h:y}),k+=T}s+=y,l-=y}p=h}return r}function Ky(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())Ky(t)}function qy(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+=qy(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 Gy(e,t,r,n,o,s,i){if(n<Fs||o<Fs)return;if(e.isFile){i.push({kind:"file",node:e,x:t,y:r,w:n,h:o});return}if(!(s<jy&&n>=Hy&&o>=Hy&&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 d=o>=Uy+Fs+Ua?Uy:0,u=t+Ua,p=r+d,f=n-Ua*2,h=o-d-Ua;if(f<Fs||h<Fs)return;let b=[...e.children.values()].toSorted((m,v)=>v.value-m.value);for(let m of Wy(b,{x:u,y:p,w:f,h}))Gy(m.node,m.x,m.y,m.w,m.h,s+1,i)}function pp(e,t){let r=e/(t||1)*100;return r>=10?r.toFixed(0):r.toFixed(r>=1?1:2)}function Yy(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+Yy(n,t-1);o>r&&(r=o)}return r}function nS(e,t,r,n,o,s){let i=Math.min(s-o,Math.PI*2-1e-4),l=o+i,d=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 ${d} 1 ${b(e+n*f)} ${b(t+n*h)}L${b(e+r*f)} ${b(t+r*h)}A${b(r)} ${b(r)} 0 ${d} 0 ${b(e+r*u)} ${b(t+r*p)}Z`}function oS(e,t){let r=Math.max(4,Math.floor(t/6.4));return e.length>r?`${e.slice(0,r-1)}\u2026`:e}var fp=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=Vy,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;q(c`<div class="bundle-treemap-tt-path">${n.ttPath}</div>${n.ttPkg?c`<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,d=s+l;d+n.offsetWidth>o.width-4&&(d=s-n.offsetWidth-l),d<4&&(d=4);let u=i+l;u+n.offsetHeight>o.height-4&&(u=i-n.offsetHeight-l),u<4&&(u=4),n.style.left=`${d}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=je(this.details);if(!t||t.size===0){this._status="empty";return}let r=[...t.keys()],n=_r(this.details),{prefix:o,stripped:s}=nt(r),i=new TextEncoder,l={name:"",children:new Map,value:0,isFile:!1},d=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),_=w.children.get(k);if(!(_&&!_.isFile)){if(!_){let T=ut(s[h],{packageDir:n?.get(r[h])});_={name:k,isFile:!0,value:0,origPath:r[h],pkg:T},w.children.set(k,_)}_.value+=m,d+=m,u++}}if(d===0){this._status="empty";return}for(let h of l.children.values())Ky(h);let p=new Map;qy(l,"",null,p),this._root=l,this._dirByPath=p,this._meta={files:u,total:d,prefix:o},this._status="ok";let f=this.details?.integrity?Ha.get(this.details.integrity):null;if(f){let h=p.get(f);h?this._focus=this._chainTo(h):Ha.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?Ha.set(t,r):Ha.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",Vy=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 c`<nav class="bundle-treemap-crumbs" aria-label="Treemap location"><span class="bundle-treemap-crumbs-lead"><button type="button" class="${B({"bundle-treemap-crumb-home":!0,"at-root":r})}" @click="${()=>this._focusTo(-1)}">Source ${this._mode==="sunburst"?"sunburst":"treemap"}</button> ${n.map((s,i)=>c`<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?c`<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=pp(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 c`<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="${`${ne(t.node.value)} \xB7 ${o} \xB7 ${r}%`}"><span class="bundle-treemap-dirname">${t.node.name}</span></div>`;let s=t.node.pkg??ut(t.node.path),i=Ye(s),l=de({...n,background:i,color:tS(i)}),d=s==="__own__"?"own source":s;return t.kind==="agg"?c`<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="${d}" data-tt-color="${i}" data-tt-meta="${`${ne(t.node.value)} \xB7 ${o} \xB7 ${r}%`}"><span class="bundle-treemap-label">${t.node.name}/</span></div>`:c`<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="${d}" data-tt-color="${i}" data-tt-meta="${`${ne(t.node.value)} \xB7 ${r}% of bundle`}"><span class="bundle-treemap-label">${t.node.name}</span></div>`}_arc(t,r,n){let o=pp(t.value,n),s=t.pkg??ut(t.path),i=Ye(s),l=s==="__own__"?"own source":s;if(t.isFile)return er`<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="${`${ne(t.value)} \xB7 ${o}% of bundle`}"></path>`;let d=`${t.count} ${t.count===1?"file":"files"}`;return er`<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="${`${ne(t.value)} \xB7 ${d} \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=Yy(t,jy),d=Math.min(Math.max(i*.18,26),i*.45),u=(i-d)/l,p=this._meta.total||1,f=[],h=(y,k,_,T)=>{let S=[...y.children.values()].toSorted((O,K)=>K.value-O.value),I=_-k,R=k;for(let O of S){let K=I*(O.value/y.value),Ke=d+(T-1)*u,ie=Ke+u;K*ie>=eS&&(f.push(this._arc(O,nS(o,s,Ke,ie,R,R+K),p)),!O.isFile&&T<l&&O.children.size>0&&h(O,R,R+K,T+1)),R+=K}};h(t,-Math.PI/2,Math.PI*1.5,1);let b=this._focus.length>0,m=Math.max(d-4,10),v=b?er`<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="${`${ne(t.value)} \xB7 ${t.count} ${t.count===1?"file":"files"} \xB7 ${pp(t.value,p)}%`}"></circle>`:er`<circle class="bundle-treemap-center" cx="${o}" cy="${s}" r="${m}"></circle>`,w=er`<text class="bundle-treemap-center-label" x="${o}" y="${s}" text-anchor="middle">${b?er`<tspan x="${o}" dy="-0.3em">${oS(t.name,m*2-12)}</tspan><tspan class="bundle-treemap-center-sub" x="${o}" dy="1.5em">${ne(t.value)}</tspan>`:er`<tspan x="${o}" dy="0.35em">${ne(t.value)}</tspan>`}</text>`;return c`<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 Wy(p,{x:0,y:0,w:this._w,h:this._h}))Gy(f.node,f.x,f.y,f.w,f.h,1,o)}let{files:s,total:i,prefix:l}=this._meta,d=this._status==="ok"&&t?t.count:s,u=this._status==="ok"&&t?t.value:i;return c`<header class="bundle-treemap-head">${this._renderCrumbs()} <span class="bundle-treemap-head-right"><span class="bundle-treemap-sub">${d} ${d===1?"file":"files"} · ${ne(u)}${l?c`· <span class="mono">${l}</span>`:""}</span> <button type="button" class="${B({"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"?c`<div class="bundle-treemap-empty">Loading…</div>`:this._status==="empty"?c`<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",fp);var sS=new TextEncoder;function Va(e){return typeof e=="string"?sS.encode(e).byteLength:0}function Jy(e){return(t,r)=>Math.abs(r.delta)-Math.abs(t.delta)||t[e].localeCompare(r[e])}function ja(e){return(t,r)=>r.bytes-t.bytes||t[e].localeCompare(r[e])}function iS(){return{baseBytes:0,otherBytes:0,onlyBaseFiles:0,onlyOtherFiles:0,changedFiles:0}}function Qy(e,t,r){let n=[],o=[],s=[],i=0,l=0,d=0,u=0,p=0,f=0,h=new Map,b=k=>{let _=r(k),T=h.get(_);return T||(T=iS(),h.set(_,T)),T},m=new Set([...e.keys(),...t.keys()]);for(let k of m){let _=e.has(k),T=t.has(k),S=b(k);if(_&&T){let I=e.get(k),R=t.get(k),O=Va(I),K=I===R?O:Va(R);if(i+=O,l+=K,S.baseBytes+=O,S.otherBytes+=K,I===R)f++;else{let Ke=K-O;s.push({path:k,baseBytes:O,otherBytes:K,delta:Ke}),p+=Ke,S.changedFiles++}}else if(_){let I=Va(e.get(k));i+=I,d+=I,S.baseBytes+=I,S.onlyBaseFiles++,n.push({path:k,bytes:I})}else{let I=Va(t.get(k));l+=I,u+=I,S.otherBytes+=I,S.onlyOtherFiles++,o.push({path:k,bytes:I})}}let v=[],w=[],y=[];for(let[k,_]of h){let T=_.baseBytes>0||_.onlyBaseFiles>0||_.changedFiles>0,S=_.otherBytes>0||_.onlyOtherFiles>0||_.changedFiles>0,I=_.onlyBaseFiles+_.onlyOtherFiles+_.changedFiles;T&&!S?v.push({pkg:k,bytes:_.baseBytes}):S&&!T?w.push({pkg:k,bytes:_.otherBytes}):(I>0||_.baseBytes!==_.otherBytes)&&y.push({pkg:k,baseBytes:_.baseBytes,otherBytes:_.otherBytes,delta:_.otherBytes-_.baseBytes})}return n.sort(ja("path")),o.sort(ja("path")),s.sort(Jy("path")),v.sort(ja("pkg")),w.sort(ja("pkg")),y.sort(Jy("pkg")),{totals:{baseFiles:e.size,baseBytes:i,otherFiles:t.size,otherBytes:l,onlyBaseFiles:n.length,onlyBaseBytes:d,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 Xy(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 Ls(e,t){if(e===t)return 0;let r=Xy(e),n=Xy(t),o=r.core.split("."),s=n.core.split(".");for(let d=0;d<Math.max(o.length,s.length);d++){let u=Number(o[d]??0),p=Number(s[d]??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 d=0;d<Math.max(i.length,l.length);d++){let u=i[d],p=l[d];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 aS(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 lS(e,t){let r=Ls(t.at(-1),e.at(-1));return r>0?"up":r<0?"down":"changed"}function Zy(e,t){let r=[],n=[],o=[],s=new Set([...e.keys(),...t.keys()]);for(let l of s){let d=e.get(l),u=t.get(l);if(d&&u){let p=[...d].toSorted(Ls),f=[...u].toSorted(Ls);if(aS(p,f))continue;r.push({pkg:l,baseVersions:p,otherVersions:f,direction:lS(p,f)})}else d?o.push({pkg:l,versions:[...d].toSorted(Ls)}):n.push({pkg:l,versions:[...u].toSorted(Ls)})}let i=(l,d)=>l.pkg.localeCompare(d.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 Wa=400,Os=null;function hp(e){return e===0?"\xB10 B":`${e>0?"+":"\u2212"}${Math.abs(e).toLocaleString()} B`}function ev(e){return e===0?"\xB10":`${e>0?"+":"\u2212"}${Math.abs(e).toLocaleString()}`}function gp(e){return e>0?"up":e<0?"down":""}function cS(e,t){if(!t)return"";let r=e/t*100;return`${r>0?"+":r<0?"\u2212":"\xB1"}${Math.abs(r).toFixed(1)}%`}function tv(e){return e==="__own__"?"own source":e}function mp(e){return e.join(", ")}var bp=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(Os&&this.integrity===Os.base){let r=Os.target;Os=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)&&(Os={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 qn(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=c`<span class="bundle-compare-row-path mono">${r}</span>${o}`;return n?c`<li><button type="button" class="bundle-compare-row bundle-compare-row-link" data-bundle-view-source="${t}" title="${t}">${s}</button></li>`:c`<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,Wa),l=r.length-i.length;return c`<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,d=>d.path,d=>{let u=d.delta===void 0?c`<span class="bundle-compare-row-size">${ne(d.bytes)}</span>`:c`<span class="bundle-compare-row-size">${ne(d.baseBytes)} → ${ne(d.otherBytes)}</span> <span class="${`bundle-compare-row-delta ${d.delta>0?"up":d.delta<0?"down":""}`}">${hp(d.delta)}</span>`;return this._fileRow(d.path,s(d.path),o,u)})}</ul>${l>0?c`<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,Wa),s=r.length-o.length;return c`<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?c`<span class="bundle-compare-row-size">${ne(i.bytes)}</span>`:c`<span class="bundle-compare-row-size">${ne(i.baseBytes)} → ${ne(i.otherBytes)}</span> <span class="${`bundle-compare-row-delta ${i.delta>0?"up":i.delta<0?"down":""}`}">${hp(i.delta)}</span>`;return c`<li><div class="bundle-compare-row" title="${tv(i.pkg)}"><span class="bundle-compare-pkg-dot" style="${de({background:Ye(i.pkg)})}"></span> <span class="bundle-compare-row-path">${tv(i.pkg)}</span> ${l}</div></li>`})}</ul>${s>0?c`<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 c`<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">${mp(t.baseVersions)}</span> <span class="bundle-compare-ver-arrow" aria-hidden="true">→</span> <span class="${`bundle-compare-ver-to ${t.direction}`}">${mp(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,Wa),s=r.length-o.length;return c`<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=>c`<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">${mp(i.versions)}</span></div></li>`)}</ul>${s>0?c`<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,Wa),d=o.length-l.length;return c`<section class="bundle-compare-section"><h3 class="bundle-compare-section-head">Dependency updates</h3>${o.length>0?c`<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>${d>0?c`<div class="bundle-compare-more">and ${d.toLocaleString()} more…</div>`:g}</div>`:g} ${s.length>0||i.length>0?c`<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=je(this.details),n=je(this._otherDetails),{prefix:o}=nt([...r.keys(),...n.keys()]),s=_r(this.details),i=_r(this._otherDetails),l=s||i?new Map([...s??[],...i??[]]):null,d=u=>ut(o&&u.startsWith(o)?u.slice(o.length):u,{packageDir:l?.get(u)});this._diff=Qy(r,n,d),this._diff.versionUpdates=Zy(fs(this.details),fs(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 c`<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 ${gp(r.fileDelta)}`}">${ev(r.fileDelta)}</span></div><div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Size</span> <span class="bundle-compare-metric-value">${ne(r.baseBytes)} → ${ne(r.otherBytes)}</span> <span class="${`bundle-compare-metric-delta ${gp(r.byteDelta)}`}">${hp(r.byteDelta)}${(()=>{let i=cS(r.byteDelta,r.baseBytes);return i?c`${" "}<span class="bundle-compare-pct">(${i})</span>`:g})()}</span></div>${o?c`<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 ${gp(s)}`}">${ev(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 c`<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="${Te(this._targetIntegrity??"")}" @change="${o=>this._onPick(o)}" aria-label="Bundle to compare with"><option value="">Choose a bundle…</option>${t.map(o=>c`<option value="${o.integrity}">${o.label}</option>`)}</select></label> ${r?c`<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=c`<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=c`<div class="bundle-compare-empty">Comparing…</div>`:this._otherDetails.error?s=c`<div class="bundle-compare-empty is-error">Couldn't read the selected bundle: ${this._otherDetails.error}</div>`:!this._otherDetails.json&&!this._otherDetails.bundle?s=c`<div class="bundle-compare-empty is-error">The selected bundle couldn't be parsed.</div>`:s=this._renderDiff():s=c`<div class="bundle-compare-empty">Pick a bundle above to compare against <strong>${this._nameFor(this.integrity)}</strong>.</div>`:s=c`<div class="bundle-compare-empty">Loading bundle…</div>`,c`<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}=nt(o),l=new Map;for(let p=0;p<o.length;p++)l.set(o[p],i[p]);let d=p=>l.get(p)??p,u=t.packages.onlyOther.length>0||t.packages.onlyBase.length>0||t.packages.changed.length>0;return c`<div class="bundle-compare-caption">Changes from <strong>${n}</strong> to <strong>${r}</strong> ${s?c`· <span class="mono">${s}</span>`:g}</div>${this._renderVersionUpdates(t.versionUpdates,n,r)} ${t.totals.identical?c`<div class="bundle-compare-identical">These two bundles carry identical sources (${t.totals.unchangedFiles.toLocaleString()} ${t.totals.unchangedFiles===1?"file":"files"}).</div>`:c`${u?c`<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,d)} ${this._fileGroup(`Added \xB7 only in ${r}`,t.files.onlyOther,"added",!1,d)} ${this._fileGroup("Changed",t.files.changed,"changed",!0,d)}</div></section>`}`}};customElements.define("bundle-compare",bp);var dS=c`<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>`,yp=class extends z{createRenderRoot(){return this}render(){return a.reports.length>0&&a.currentView==="findings"&&a.viewMode!=="graph"&&a.viewMode!=="kanban"?c`<button type="button" title="print this report" aria-label="print" @click="${this._onClick}">${dS}</button>`:g}_onClick=()=>{this.dispatchEvent(new CustomEvent("print-requested",{bubbles:!0,composed:!0}))}};customElements.define("print-button",yp);var uS=c`<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>`,vp=class extends z{createRenderRoot(){return this}render(){return a.reports.length>0&&a.currentView==="findings"&&a.viewMode!=="graph"&&a.viewMode!=="kanban"?c`<button type="button" title="download this report" aria-label="download" @click="${this._onClick}">${uS}</button>`:g}_onClick=()=>{this.dispatchEvent(new CustomEvent("download-requested",{bubbles:!0,composed:!0}))}};customElements.define("download-button",vp);function Ps(e){let t=new Map;for(let[r,n]of a.triage)n[e]&&t.set(r,n[e]);return t}var pS={get markers(){return Ps("color")},get triageState(){return Ps("triage")},get comments(){return Ps("comment")},get fixes(){return Ps("fix")},get flags(){return Ps("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===""?D(a.triage,e,{color:void 0})&&(i=!0):a.triage.get(e)?.color!==t&&(D(a.triage,e,{color:t}),i=!0)),r!==void 0)if(r===null||r===""||r===!1)D(a.triage,e,{triage:void 0})&&(i=!0);else if(r==="inprogress"||r==="fixed"||r==="invalid"||r==="deleted")a.triage.get(e)?.triage!==r&&(D(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&&(D(a.triage,e,{comment:l}),i=!0):D(a.triage,e,{comment:void 0})&&(i=!0)}if(o!==void 0){let l=o?String(o):"";l?a.triage.get(e)?.fix!==l&&(D(a.triage,e,{fix:l}),i=!0):D(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&&(D(a.triage,e,{flagged:l}),i=!0)}return i&&(await pe(),x()),i}};window.DeepView={get reports(){return a.reports.slice()},get groups(){return Gt()},get findings(){return Gt().flat()},get currentFile(){return a.currentFile},get currentWorkspace(){return a.currentWorkspace},triage:pS,themes:$y,setTheme:wy,get theme(){return ky()},triageSync:P,refresh(){x()},export(){return By()}};var fS={default:re.default,"claude-security":re["claude-security"],"codex-security":re["codex-security"],deepsec:re.deepsec,piolium:re.piolium,bundle:Hn,workspace:pa};for(let e of document.querySelectorAll(".drop-supported-icon[data-icon]")){let t=fS[e.dataset.icon];t&&(e.innerHTML=t)}Oh(x);Mc(x);Lh(x);P.onStatusChange(x);Bh(async(e,t)=>{a.currentWorkspace===e?await Cr(e):a.currentFile&&a.currentFile===t?await ft(t):await j()});Fh(async()=>{await j(),a.currentView==="bundles"&&x()});Jb();Qb();async function sv(){let e=Jc();if(!e)return!1;try{history.replaceState(null,"",location.pathname)}catch{}let t;try{t=await ey({encoded:e})}catch(n){return alert(`Couldn't open the share-link unlock prompt: ${n.message}`),!1}if(!t)return!1;let r=await Cc({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 Cr(r.workspace.id):await j(),!0}var ro=!1;async function iv(){if(ro||(ro=!0,await or(),kc(),await j(),await sv()))return;let t=Ce(Er);if(t)if(t.startsWith("ws:")){let r=t.slice(3);G().some(n=>n.id===r)&&await Cr(r)}else if(t.startsWith("b:")){let r=t.slice(2),n=r.indexOf(" "),o=n>=0?r.slice(0,n):r,s=n>=0?r.slice(n+1):"",i=ys.has(s)?s:"overview";(a.bundles??[]).some(l=>l.integrity===o)&&(a.currentView="bundles",a.selectedBundle=o,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=i,a.shownTriage=null,A.showAll=!0,x(),Yt(o))}else(await ue()).includes(t)&&await ft(t)}var rv=se(),nv=!1;function ov(e){nv||(nv=!0,queueMicrotask(()=>{alert(e+" This tab will reload to refresh its state. Any unsaved edits in this tab will be lost."),location.reload()}))}Ee(()=>{let e=rv,t=se();if(rv=t,x(),!ro&&yt()){iv().catch(r=>console.warn("continueBoot:",r));return}if(ro&&t&&!yt()){ov("Encryption was just enabled in another tab.");return}ro&&e&&!t&&!yl()&&ov("Encryption was disabled in another tab.")});window.addEventListener("hashchange",()=>{ro&&sv().catch(e=>console.warn("share-link hashchange:",e))});(async()=>{if(!await Zb()){try{let e=window.matchMedia?.("(display-mode: window-controls-overlay)").matches;if(!e&&a.serverMode!=="managed"&&localStorage.getItem("deepview.sidebarCollapsed")==="1"&&of.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 iv()}})();
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()}})();
114
129
  /*! Bundled license information:
115
130
 
116
131
  @lit/reactive-element/css-tag.js: