@preventive/triage 1.0.0-alpha.2 → 1.0.0-alpha.20

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.
Files changed (168) hide show
  1. package/api/reap.ts +17 -0
  2. package/cli.js +6 -0
  3. package/client/finding-link.js +305 -0
  4. package/client/linked-findings.d.ts +1 -0
  5. package/client/linked-findings.js +111 -0
  6. package/common/bundle-metadata.d.ts +10 -0
  7. package/common/bundle-metadata.js +177 -0
  8. package/common/bundle-reasons.d.ts +2 -0
  9. package/common/bundle-reasons.js +21 -0
  10. package/common/bundle-sources.d.ts +3 -0
  11. package/common/bundle-sources.js +284 -0
  12. package/common/bundle-stats.js +41 -0
  13. package/common/bundle-tabs.js +1 -0
  14. package/common/code-language.js +36 -0
  15. package/common/default-scan-models.ts +30 -0
  16. package/common/finding-id.js +47 -0
  17. package/common/github-pr.ts +56 -0
  18. package/common/managed/comments.ts +34 -0
  19. package/common/managed/permissions.ts +35 -0
  20. package/common/managed/report-content.ts +42 -0
  21. package/common/managed/report-filter.ts +108 -0
  22. package/common/managed/roles.ts +28 -0
  23. package/common/managed/routes.d.ts +2 -0
  24. package/common/managed/routes.js +121 -0
  25. package/common/managed/scan-models.ts +6 -0
  26. package/common/managed/triage.ts +83 -0
  27. package/common/save-error-reason.ts +20 -7
  28. package/common/scan-server.ts +13 -0
  29. package/common/server-info.ts +33 -0
  30. package/common/utf8.d.ts +3 -0
  31. package/common/utf8.js +45 -0
  32. package/out/brotli-fallback.js +3 -3
  33. package/out/client-managed-import.js +81 -0
  34. package/out/client-managed.js +110 -0
  35. package/out/client-sync.js +16 -13
  36. package/out/graph.js +30 -4
  37. package/out/index.html +55 -8
  38. package/out/prism.js +2 -2
  39. package/out/stasis.svg +45 -0
  40. package/out/terminal.js +273 -39
  41. package/out/view.css +1 -1
  42. package/out/view.js +198 -62
  43. package/package.json +179 -55
  44. package/report/index.js +254 -0
  45. package/report/src/finding-id.js +80 -0
  46. package/report/src/finding.js +312 -0
  47. package/report/src/labels.js +33 -0
  48. package/report/src/md-structure.js +471 -0
  49. package/report/src/md-text.js +167 -0
  50. package/report/src/meta.js +76 -0
  51. package/report/src/parse-codex.js +147 -0
  52. package/report/src/parse-deepsec.js +197 -0
  53. package/report/src/parse-deepview-fields.js +375 -0
  54. package/report/src/parse-deepview-md.js +185 -0
  55. package/report/src/parse-md-id.js +137 -0
  56. package/report/src/parse-md.js +322 -0
  57. package/report/src/parse-piolium-id.js +79 -0
  58. package/report/src/parse-piolium-rows.js +131 -0
  59. package/report/src/parse-piolium-tokens.js +175 -0
  60. package/report/src/parse-piolium.js +400 -0
  61. package/report/src/security.js +63 -0
  62. package/report/src/utf8.js +21 -0
  63. package/report/src/write-md-finding.js +273 -0
  64. package/report/src/write-md.js +291 -0
  65. package/server-common/database-config.ts +16 -0
  66. package/server-common/initialize.ts +18 -0
  67. package/server-common/npm-advisories.ts +101 -0
  68. package/{server → server-common}/origin.ts +5 -5
  69. package/server-common/reap.ts +48 -0
  70. package/server-common/scan-config.ts +19 -0
  71. package/server-common/standalone.ts +29 -0
  72. package/server-common/storage-log.ts +34 -0
  73. package/server-common/vercel-blob.ts +110 -0
  74. package/server-e2e/app.ts +485 -0
  75. package/{server → server-e2e}/auth.ts +5 -1
  76. package/{server → server-e2e}/bus-receiver.ts +9 -8
  77. package/{server → server-e2e}/cli.js +9 -4
  78. package/{server → server-e2e}/config.ts +54 -39
  79. package/{server → server-e2e}/db-neon.ts +2 -2
  80. package/{server → server-e2e}/db-revision-sql.ts +7 -10
  81. package/{server → server-e2e}/db-stmt.ts +2 -2
  82. package/{server → server-e2e}/db.ts +96 -135
  83. package/{server → server-e2e}/http.ts +110 -12
  84. package/{server → server-e2e}/hub.ts +44 -14
  85. package/server-e2e/index.ts +17 -0
  86. package/server-e2e/lifecycle.ts +95 -0
  87. package/{server → server-e2e}/neon-driver.ts +2 -2
  88. package/{server → server-e2e}/npm-proxy.ts +11 -144
  89. package/{server → server-e2e}/objstore/blob-fs.ts +6 -8
  90. package/{server → server-e2e}/objstore/blob-vercel.ts +49 -141
  91. package/{server → server-e2e}/objstore/blob.ts +24 -9
  92. package/server-e2e/objstore/fetch-mint-guard.ts +74 -0
  93. package/{server → server-e2e}/objstore/handlers.ts +19 -20
  94. package/{server → server-e2e}/objstore/init.ts +53 -27
  95. package/{server → server-e2e}/objstore/reaper.ts +31 -11
  96. package/server-e2e/objstore/rest-deny.ts +28 -0
  97. package/server-e2e/objstore/rest-mint.ts +224 -0
  98. package/{server → server-e2e}/objstore/rest.ts +110 -93
  99. package/{server → server-e2e}/objstore/sign.ts +105 -0
  100. package/{server → server-e2e}/objstore/store-neon.ts +10 -14
  101. package/{server → server-e2e}/objstore/store.ts +98 -118
  102. package/{server → server-e2e}/objstore/tokens.ts +9 -12
  103. package/{server → server-e2e}/peer.ts +7 -9
  104. package/{server → server-e2e}/pubsub.ts +29 -36
  105. package/{server → server-e2e}/sign.ts +12 -14
  106. package/{server → server-e2e}/sse-server.ts +105 -73
  107. package/{server → server-e2e}/sse-session.ts +30 -16
  108. package/{server → server-e2e}/static.ts +36 -29
  109. package/server-e2e/sync-handlers.ts +408 -0
  110. package/{server → server-e2e}/util.ts +9 -0
  111. package/{server → server-e2e}/ws-server.ts +29 -23
  112. package/server-managed/activity.ts +231 -0
  113. package/server-managed/avatar-store.ts +51 -0
  114. package/server-managed/blob-store.ts +66 -0
  115. package/server-managed/blob-vercel.ts +125 -0
  116. package/server-managed/brotli.ts +10 -0
  117. package/server-managed/bundle-cache.ts +185 -0
  118. package/server-managed/bundle-catalog.ts +29 -0
  119. package/server-managed/bundle-store.ts +28 -0
  120. package/server-managed/bundle-summary-cache.ts +97 -0
  121. package/server-managed/bundle.ts +39 -0
  122. package/server-managed/cache-storage.ts +40 -0
  123. package/server-managed/cli.js +13 -0
  124. package/server-managed/combined.ts +46 -0
  125. package/server-managed/comments.ts +151 -0
  126. package/server-managed/config.ts +144 -0
  127. package/server-managed/content-access.ts +15 -0
  128. package/server-managed/crypto.ts +25 -0
  129. package/server-managed/db-methods.ts +1330 -0
  130. package/server-managed/db-neon.ts +171 -0
  131. package/server-managed/db-schema.ts +203 -0
  132. package/server-managed/db-table-names.ts +22 -0
  133. package/server-managed/db.ts +109 -0
  134. package/server-managed/github-app.ts +332 -0
  135. package/server-managed/github-metadata.ts +65 -0
  136. package/server-managed/github-oauth.ts +215 -0
  137. package/server-managed/github-pulls.ts +115 -0
  138. package/server-managed/http-response.ts +18 -0
  139. package/server-managed/http.ts +2043 -0
  140. package/server-managed/import-triage.ts +48 -0
  141. package/server-managed/index.ts +135 -0
  142. package/server-managed/public-workspace.ts +150 -0
  143. package/server-managed/repo-path.ts +21 -0
  144. package/server-managed/report-migration.ts +35 -0
  145. package/server-managed/report-query.ts +4 -0
  146. package/server-managed/report-response.ts +16 -0
  147. package/server-managed/report-sources.ts +154 -0
  148. package/server-managed/repository-discovery.ts +82 -0
  149. package/server-managed/repository-policy.ts +25 -0
  150. package/server-managed/session.ts +78 -0
  151. package/server-managed/slugs.ts +38 -0
  152. package/server-managed/sql-postgres.ts +30 -0
  153. package/server-managed/sql.ts +61 -0
  154. package/server-managed/static.ts +28 -0
  155. package/server-managed/storage.ts +34 -0
  156. package/server-managed/team-catalog.ts +7 -0
  157. package/server-managed/team-feed.ts +128 -0
  158. package/server-managed/team-reports.ts +156 -0
  159. package/server-managed/triage-response.ts +16 -0
  160. package/server-managed/uploads.ts +47 -0
  161. package/server-managed/workspace-shares.ts +150 -0
  162. package/server.ts +50 -0
  163. package/server/index.ts +0 -481
  164. package/server/lifecycle.ts +0 -204
  165. package/server/sync-handlers.ts +0 -327
  166. /package/{server → server-e2e}/config.example.json +0 -0
  167. /package/{server → server-e2e}/objstore/fs.ts +0 -0
  168. /package/{server → server-e2e}/validation.ts +0 -0
package/out/view.js CHANGED
@@ -1,51 +1,159 @@
1
- var To=globalThis,Ro=To.ShadowRoot&&(To.ShadyCSS===void 0||To.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,sd=Symbol(),od=new WeakMap,Io=class{constructor(t,r,n){if(this._$cssResult$=!0,n!==sd)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(Ro&&t===void 0){let n=r!==void 0&&r.length===1;n&&(t=od.get(r)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&od.set(r,t))}return t}toString(){return this.cssText}},T=e=>new Io(typeof e=="string"?e:e+"",void 0,sd);var id=(e,t)=>{if(Ro)e.adoptedStyleSheets=t.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet);else for(let r of t){let n=document.createElement("style"),o=To.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=r.cssText,e.appendChild(n)}},wi=Ro?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let r="";for(let n of t.cssRules)r+=n.cssText;return T(r)})(e):e;var{is:bg,defineProperty:yg,getOwnPropertyDescriptor:wg,getOwnPropertyNames:vg,getOwnPropertySymbols:kg,getPrototypeOf:$g}=Object,Bo=globalThis,ad=Bo.trustedTypes,xg=ad?ad.emptyScript:"",_g=Bo.reactiveElementPolyfillSupport,un=(e,t)=>e,vi={toAttribute(e,t){switch(t){case Boolean:e=e?xg: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}},cd=(e,t)=>!bg(e,t),ld={attribute:!0,type:String,converter:vi,reflect:!1,useDefault:!1,hasChanged:cd};Symbol.metadata??=Symbol("metadata"),Bo.litPropertyMetadata??=new WeakMap;var St=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=ld){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&&yg(this.prototype,t,o)}}static getPropertyDescriptor(t,r,n){let{get:o,set:s}=wg(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)??ld}static _$Ei(){if(this.hasOwnProperty(un("elementProperties")))return;let t=$g(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(un("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(un("properties"))){let r=this.properties,n=[...vg(r),...kg(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(wi(o))}else t!==void 0&&r.push(wi(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 id(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:vi).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:vi;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??cd)(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){}};St.elementStyles=[],St.shadowRootOptions={mode:"open"},St[un("elementProperties")]=new Map,St[un("finalized")]=new Map,_g?.({ReactiveElement:St}),(Bo.reactiveElementVersions??=[]).push("2.1.2");var $i=globalThis,dd=e=>e,Fo=$i.trustedTypes,ud=Fo?Fo.createPolicy("lit-html",{createHTML:e=>e}):void 0,xi="$lit$",Ct=`lit$${Math.random().toFixed(9).slice(2)}$`,_i="?"+Ct,Sg=`<${_i}>`,or=document,fn=()=>or.createComment(""),hn=e=>e===null||typeof e!="object"&&typeof e!="function",Si=Array.isArray,bd=e=>Si(e)||typeof e?.[Symbol.iterator]=="function",ki=`[
2
- \f\r]`,pn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,pd=/-->/g,fd=/>/g,rr=RegExp(`>|${ki}(?:([^\\s"'>=/]+)(${ki}*=${ki}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),hd=/'/g,gd=/"/g,yd=/^(?:script|style|textarea|title)$/i,Ci=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),c=Ci(1),R0=Ci(2),B0=Ci(3),ae=Symbol.for("lit-noChange"),g=Symbol.for("lit-nothing"),md=new WeakMap,nr=or.createTreeWalker(or,129);function wd(e,t){if(!Si(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return ud!==void 0?ud.createHTML(t):t}var vd=(e,t)=>{let r=e.length-1,n=[],o,s=t===2?"<svg>":t===3?"<math>":"",i=pn;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===pn?p[1]==="!--"?i=pd:p[1]!==void 0?i=fd:p[2]!==void 0?(yd.test(p[2])&&(o=RegExp("</"+p[2],"g")),i=rr):p[3]!==void 0&&(i=rr):i===rr?p[0]===">"?(i=o??pn,f=-1):p[1]===void 0?f=-2:(f=i.lastIndex-p[2].length,u=p[1],i=p[3]===void 0?rr:p[3]==='"'?gd:hd):i===gd||i===hd?i=rr:i===pd||i===fd?i=pn:(i=rr,o=void 0);let b=i===rr&&e[l+1].startsWith("/>")?" ":"";s+=i===pn?d+Sg:f>=0?(n.push(u),d.slice(0,f)+xi+d.slice(f)+Ct+b):d+Ct+(f===-2?l:b)}return[wd(e,s+(e[r]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),n]},gn=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]=vd(t,r);if(this.el=e.createElement(u,n),nr.currentNode=this.el.content,r===2||r===3){let f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(o=nr.nextNode())!==null&&d.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(let f of o.getAttributeNames())if(f.endsWith(xi)){let h=p[i++],b=o.getAttribute(f).split(Ct),m=/([.?@])?(.*)/.exec(h);d.push({type:1,index:s,name:m[2],strings:b,ctor:m[1]==="."?Lo:m[1]==="?"?Po:m[1]==="@"?Oo:ir}),o.removeAttribute(f)}else f.startsWith(Ct)&&(d.push({type:6,index:s}),o.removeAttribute(f));if(yd.test(o.tagName)){let f=o.textContent.split(Ct),h=f.length-1;if(h>0){o.textContent=Fo?Fo.emptyScript:"";for(let b=0;b<h;b++)o.append(f[b],fn()),nr.nextNode(),d.push({type:2,index:++s});o.append(f[h],fn())}}}else if(o.nodeType===8)if(o.data===_i)d.push({type:2,index:s});else{let f=-1;for(;(f=o.data.indexOf(Ct,f+1))!==-1;)d.push({type:7,index:s}),f+=Ct.length-1}s++}}static createElement(t,r){let n=or.createElement("template");return n.innerHTML=t,n}};function sr(e,t,r=e,n){if(t===ae)return t;let o=n!==void 0?r._$Co?.[n]:r._$Cl,s=hn(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=sr(e,o._$AS(e,t.values),o,n)),t}var Mo=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??or).importNode(r,!0);nr.currentNode=o;let s=nr.nextNode(),i=0,l=0,d=n[0];for(;d!==void 0;){if(i===d.index){let u;d.type===2?u=new Ar(s,s.nextSibling,this,t):d.type===1?u=new d.ctor(s,d.name,d.strings,this,t):d.type===6&&(u=new No(s,this,t)),this._$AV.push(u),d=n[++l]}i!==d?.index&&(s=nr.nextNode(),i++)}return nr.currentNode=or,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++}},Ar=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=sr(this,t,r),hn(t)?t===g||t==null||t===""?(this._$AH!==g&&this._$AR(),this._$AH=g):t!==this._$AH&&t!==ae&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):bd(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&&hn(this._$AH)?this._$AA.nextSibling.data=t:this.T(or.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=gn.createElement(wd(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===o)this._$AH.p(r);else{let s=new Mo(o,this),i=s.u(this.options);s.p(r),this.T(i),this._$AH=s}}_$AC(t){let r=md.get(t.strings);return r===void 0&&md.set(t.strings,r=new gn(t)),r}k(t){Si(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(fn()),this.O(fn()),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=dd(t).nextSibling;dd(t).remove(),t=n}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},ir=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=sr(this,t,r,0),i=!hn(t)||t!==this._$AH&&t!==ae,i&&(this._$AH=t);else{let l=t,d,u;for(t=s[0],d=0;d<s.length-1;d++)u=sr(this,l[n+d],r,d),u===ae&&(u=this._$AH[d]),i||=!hn(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??"")}},Lo=class extends ir{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===g?void 0:t}},Po=class extends ir{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==g)}},Oo=class extends ir{constructor(t,r,n,o,s){super(t,r,n,o,s),this.type=5}_$AI(t,r=this){if((t=sr(this,t,r,0)??g)===ae)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)}},No=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){sr(this,t)}},kd={M:xi,P:Ct,A:_i,C:1,L:vd,R:Mo,D:bd,V:sr,I:Ar,H:ir,N:Po,U:Oo,B:Lo,F:No},Cg=$i.litHtmlPolyfillSupport;Cg?.(gn,Ar),($i.litHtmlVersions??=[]).push("3.3.2");var W=(e,t,r)=>{let n=r?.renderBefore??t,o=n._$litPart$;if(o===void 0){let s=r?.renderBefore??null;n._$litPart$=o=new Ar(t.insertBefore(fn(),s),s,void 0,r??{})}return o._$AI(e),o};var Ei=globalThis,H=class extends St{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=W(r,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return ae}};H._$litElement$=!0,H.finalized=!0,Ei.litElementHydrateSupport?.({LitElement:H});var Eg=Ei.litElementPolyfillSupport;Eg?.({LitElement:H});(Ei.litElementVersions??=[]).push("4.2.2");var Be={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},pt=e=>(...t)=>({_$litDirective$:e,values:t}),Je=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=pt(class extends Je{constructor(e){if(super(e),e.type!==Be.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 ae}});var{I:Ag}=kd,$d=e=>e;var _d=e=>e.strings===void 0,xd=()=>document.createComment(""),Tr=(e,t,r)=>{let n=e._$AA.parentNode,o=t===void 0?e._$AB:t._$AA;if(r===void 0){let s=n.insertBefore(xd(),o),i=n.insertBefore(xd(),o);r=new Ag(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=$d(d).nextSibling;$d(n).insertBefore(d,o),d=u}}}return r},Lt=(e,t,r=e)=>(e._$AI(t,r),e),Tg={},Do=(e,t=Tg)=>e._$AH=t,Sd=e=>e._$AH,Uo=e=>{e._$AR(),e._$AA.remove()};var Cd=(e,t,r)=>{let n=new Map;for(let o=t;o<=r;o++)n.set(e[o],o);return n},J=pt(class extends Je{constructor(e){if(super(e),e.type!==Be.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=Sd(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]=Lt(o[f],s[b]),f++,b++;else if(l[h]===i[m])d[m]=Lt(o[h],s[m]),h--,m--;else if(l[f]===i[m])d[m]=Lt(o[f],s[m]),Tr(e,d[m+1],o[f]),f++,m--;else if(l[h]===i[b])d[b]=Lt(o[h],s[b]),Tr(e,o[f],o[h]),h--,b++;else if(u===void 0&&(u=Cd(i,b,m),p=Cd(l,f,h)),u.has(l[f]))if(u.has(l[h])){let y=p.get(i[b]),$=y!==void 0?o[y]:null;if($===null){let w=Tr(e,o[f]);Lt(w,s[b]),d[b]=w}else d[b]=Lt($,s[b]),Tr(e,o[f],$),o[y]=null;b++}else Uo(o[h]),h--;else Uo(o[f]),f++;for(;b<=m;){let y=Tr(e,d[m+1]);Lt(y,s[b]),d[b++]=y}for(;f<=h;){let y=o[f++];y!==null&&Uo(y)}return this.ut=i,Do(e,d),ae}});var Ed="important",Ig=" !"+Ed,we=pt(class extends Je{constructor(e){if(super(e),e.type!==Be.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(Ig);n.includes("-")||s?r.setProperty(n,s?o.slice(0,-11):o,s?Ed:""):r[n]=o}}return ae}});var Ri=new WeakMap,Rd=Symbol("iteration key");function Rg(e){Ri.set(e,new Map)}function Bg(e,{target:t,key:r,type:n}){n==="iterate"&&(r=Rd);let o=Ri.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 Fg({target:e,key:t,type:r}){let n=Ri.get(e),o=new Set;if(r==="clear"?n.forEach((s,i)=>{Ai(o,n,i)}):Ai(o,n,t),r==="add"||r==="delete"||r==="clear"){let s=Array.isArray(e)?"length":Rd;Ai(o,n,s)}return o}function Ai(e,t,r){let n=t.get(r);n&&n.forEach(e.add,e)}function Bd(e){e.cleaners&&e.cleaners.forEach(Mg,e),e.cleaners=[]}function Mg(e){e.delete(this)}var Ir=[],Ti=!1;function Lg(e,t,r,n){if(e.unobserved)return Reflect.apply(t,r,n);if(Ir.indexOf(e)===-1){Bd(e);try{return Ir.push(e),Reflect.apply(t,r,n)}finally{Ir.pop()}}}function nt(e){let t=Ir[Ir.length-1];t&&(Fd(t,e),Bg(t,e))}function Pt(e){Fg(e).forEach(Pg,e)}function Pg(e){Fd(e,this),typeof e.scheduler=="function"?e.scheduler(e):typeof e.scheduler=="object"?e.scheduler.add(e):e()}function Fd(e,t){if(e.debugger&&!Ti)try{Ti=!0,e.debugger(t)}finally{Ti=!1}}function Md(){return Ir.length>0}var Ad=Symbol("is reaction");function Ld(e,t={}){let r=e[Ad]?e:function n(){return Lg(n,e,this,arguments)};return r.scheduler=t.scheduler,r.debugger=t.debugger,r[Ad]=!0,t.lazy||r(),r}function Bi(e){e.unobserved||(e.unobserved=!0,Bd(e)),typeof e.scheduler=="object"&&e.scheduler.delete(e)}var Se=new WeakMap,Ho=new WeakMap,Og=Object.prototype.hasOwnProperty;function Wo(e){let t=Ho.get(e);return Md()&&typeof e=="object"&&e!==null?t||Vo(e):t||e}function Ii(e,t){let r=e.next;return e.next=()=>{let{done:n,value:o}=r.call(e);return n||(t?o[1]=Wo(o[1]):o=Wo(o)),{done:n,value:o}},e}var Td={has(e){let t=Se.get(this),r=Reflect.getPrototypeOf(this);return nt({target:t,key:e,type:"has"}),r.has.apply(t,arguments)},get(e){let t=Se.get(this),r=Reflect.getPrototypeOf(this);return nt({target:t,key:e,type:"get"}),Wo(r.get.apply(t,arguments))},add(e){let t=Se.get(this),r=Reflect.getPrototypeOf(this),n=r.has.call(t,e),o=r.add.apply(t,arguments);return n||Pt({target:t,key:e,value:e,type:"add"}),o},set(e,t){let r=Se.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&&Pt({target:r,key:e,value:t,oldValue:s,type:"set"}):Pt({target:r,key:e,value:t,type:"add"}),i},delete(e){let t=Se.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&&Pt({target:t,key:e,oldValue:o,type:"delete"}),s},clear(){let e=Se.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&&Pt({target:e,oldTarget:n,type:"clear"}),o},forEach(e,...t){let r=Se.get(this),n=Reflect.getPrototypeOf(this);nt({target:r,type:"iterate"});let o=(s,...i)=>e(Wo(s),...i);return n.forEach.call(r,o,...t)},keys(){let e=Se.get(this),t=Reflect.getPrototypeOf(this);return nt({target:e,type:"iterate"}),t.keys.apply(e,arguments)},values(){let e=Se.get(this),t=Reflect.getPrototypeOf(this);nt({target:e,type:"iterate"});let r=t.values.apply(e,arguments);return Ii(r,!1)},entries(){let e=Se.get(this),t=Reflect.getPrototypeOf(this);nt({target:e,type:"iterate"});let r=t.entries.apply(e,arguments);return Ii(r,!0)},[Symbol.iterator](){let e=Se.get(this),t=Reflect.getPrototypeOf(this);nt({target:e,type:"iterate"});let r=t[Symbol.iterator].apply(e,arguments);return Ii(r,e instanceof Map)},get size(){let e=Se.get(this),t=Reflect.getPrototypeOf(this);return nt({target:e,type:"iterate"}),Reflect.get(t,"size",e)}},zo={get(e,t,r){return e=Og.call(Td,t)?Td:e,Reflect.get(e,t,r)}},Id=typeof window=="object"?window:Function("return this")(),Pd=new Map([[Map,zo],[Set,zo],[WeakMap,zo],[WeakSet,zo],[Object,!1],[Array,!1],[Int8Array,!1],[Uint8Array,!1],[Uint8ClampedArray,!1],[Int16Array,!1],[Uint16Array,!1],[Int32Array,!1],[Uint32Array,!1],[Float32Array,!1],[Float64Array,!1]]);function Ng({constructor:e}){return!(typeof e=="function"&&e.name in Id&&Id[e.name]===e)||Pd.has(e)}function Dg(e){return Pd.get(e.constructor)}var Od=Object.prototype.hasOwnProperty,Ug=new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(e=>typeof e=="symbol"));function zg(e,t,r){let n=Reflect.get(e,t,r);if(typeof t=="symbol"&&Ug.has(t))return n;nt({target:e,key:t,receiver:r,type:"get"});let o=Ho.get(n);if(Md()&&typeof n=="object"&&n!==null){if(o)return o;let s=Reflect.getOwnPropertyDescriptor(e,t);if(!s||!(s.writable===!1&&s.configurable===!1))return Vo(n)}return o||n}function Wg(e,t){let r=Reflect.has(e,t);return nt({target:e,key:t,type:"has"}),r}function Hg(e){return nt({target:e,type:"iterate"}),Reflect.ownKeys(e)}function Vg(e,t,r,n){typeof r=="object"&&r!==null&&(r=Se.get(r)||r);let o=Od.call(e,t),s=e[t],i=Reflect.set(e,t,r,n);return e!==Se.get(n)||(o?r!==s&&Pt({target:e,key:t,value:r,oldValue:s,receiver:n,type:"set"}):Pt({target:e,key:t,value:r,receiver:n,type:"add"})),i}function jg(e,t){let r=Od.call(e,t),n=e[t],o=Reflect.deleteProperty(e,t);return r&&Pt({target:e,key:t,oldValue:n,type:"delete"}),o}var Kg={get:zg,has:Wg,ownKeys:Hg,set:Vg,deleteProperty:jg};function Vo(e={}){return Se.has(e)||!Ng(e)?e:Ho.get(e)||qg(e)}function qg(e){let t=Dg(e)||Kg,r=new Proxy(e,t);return Ho.set(e,r),Se.set(r,e),Rg(e),r}var Nd=Vo;function Fi(e){let t=!0,r=Ld(()=>{try{e(t)}finally{t=!1}},{lazy:!0});try{r()}catch(n){throw Bi(r),n}return()=>Bi(r)}var L=class extends H{_disposers=[];observes=null;connectedCallback(){super.connectedCallback(),this.bindState()}bindState(){if(this.observes){this._disposers.push(Fi(t=>{this.observes(),t||this.requestUpdate()}));return}this._render||(this._render=this.render,this.render=()=>{let t,r=Fi(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:H,html:c,nothing:g,render:W,unsafeCSS:T,StateElement:L,classMap:F,repeat:J,styleMap:we};var Ce=document.querySelector("#drop-zone"),E=document.querySelector("#report"),Dd=document.querySelector("app-sidebar");function Rr(e,t){let r=URL.createObjectURL(e),n=document.createElement("span");n.style.display="none",W(c`<a href="${r}" download="${t}"></a>`,n),document.body.append(n),n.firstElementChild.click(),n.remove(),URL.revokeObjectURL(r)}function ft(e){return new Error("Another dialog is already open. Close it and try again.",{cause:e})}function zd(e){let t=e?.package?.npm?.version;if(typeof t=="string"&&t)return t;let r=e?.file;if(!r)return null;let n=/(?:^|\/)node_modules\/\.pnpm\/([^/]+)\/node_modules\//u.exec(r);if(!n)return null;let o=n[1],s=o.indexOf("_");s>0&&(o=o.slice(0,s));let i=o.lastIndexOf("@");return i<=0?null:o.slice(i+1)||null}function jo(){return{keys:new Set,findings:[],files:new Map,reports:new Set,_keyReports:new Map}}function Ko(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 qo(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 Go(e){let t=new Set;for(let r of e._keyReports.values())for(let n of r)t.add(n);e.reports=t}function Wd(e,t,r,n,o){let s=e.byVersion.get(t);s||(s=jo(),e.byVersion.set(t,s)),Ko(s,n,o,r)}function Hd(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&&qo(i,r,n,s)),i._keyReports.size===0){e.byVersion.delete(t);return}Go(i)}function Mi(e,t){if(e===t)return 0;if(e===null)return 1;if(t===null)return-1;let[r,n=""]=Ud(e,"-"),[o,s=""]=Ud(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 Ud(e,t){let r=e.indexOf(t);return r<0?[e,""]:[e.slice(0,r),e.slice(r+1)]}var Gg=new TextEncoder,Yg=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function G(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 Gg.encode(e)}function ce(e){if(!ArrayBuffer.isView(e)&&!(e instanceof ArrayBuffer))throw new TypeError(`decodeUtf8 expects a BufferSource, got ${e===null?"null":typeof e}`);return Yg.decode(e)}async function mn(e){let t=new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(t).arrayBuffer())}async function ht(e){let t=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip"));return new Uint8Array(await new Response(t).arrayBuffer())}async function Yo(e){return await mn(G(e))}async function bn(e){return ce(await ht(e))}async function Vd(e){let t=await crypto.subtle.digest("SHA-512",e);return`sha512-${new Uint8Array(t).toBase64()}`}var ot=new Uint8Array([68,86,69,49]),Br=12,Jg=32,Xg="deepview-passkey.v1.content-key";function yn(){return!(typeof window>"u"||typeof PublicKeyCredential>"u"||typeof navigator>"u"||!navigator.credentials)}async function jd(){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 Jo(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),t}async function Li(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:G(Xg)},t,Jg*8);return new Uint8Array(r)}function Pi(e){return crypto.subtle.importKey("raw",e,{name:"AES-GCM"},!1,["encrypt","decrypt"])}async function Ot(e,t,r){let n=Jo(Br),o=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:n,additionalData:r},e,t)),s=new Uint8Array(ot.length+Br+o.length);return s.set(ot,0),s.set(n,ot.length),s.set(o,ot.length+Br),s}async function ar(e,t,r){if(!Le(t))throw new Error("passkey: missing envelope magic");if(t.length<ot.length+Br+16)throw new Error("passkey: envelope too short");let n=t.subarray(ot.length,ot.length+Br),o=t.subarray(ot.length+Br);return new Uint8Array(await crypto.subtle.decrypt({name:"AES-GCM",iv:n,additionalData:r},e,o))}function Le(e){if(e.length<ot.length)return!1;for(let t=0;t<ot.length;t++)if(e[t]!==ot[t])return!1;return!0}async function Kd(e){if(!yn())throw new Error("passkey: not supported in this environment");let t=Jo(32),r=Jo(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 Oi(e){if(!yn())throw new Error("passkey: not supported in this environment");let t=Jo(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 wn=Object.freeze(["deepview.workspaces","deepview.sync.sessions","deepview.sync.userEnabled","deepview.sync.password","deepview.repoUrls","deepview.fileCounts","deepview.lastFile"]),Pe=new Map,Ni=!1,lr=new Map,Nt=new Map,Di=new Set;function Fr(e){return Di.add(e),()=>Di.delete(e)}function Qg(){for(let e of Di)try{e()}catch(t){console.warn("secure-storage after-hydrate listener:",t)}}function Xo(e){let t=Jd()??"";return G(`deepview.secure.v1|${t}|${e}`)}function Ui(e){try{let t=Uint8Array.fromBase64(e);if(Le(t))return t}catch{}return null}function he(e){return Pe.get(e)??null}async function ve(e,t){if(typeof t!="string")throw new TypeError("secure-storage: value must be a string");if(X()&&!ke())throw new Error(`secure-storage: vault locked, cannot save "${e}"`);if(Yd())throw new Error(`secure-storage: wipe in progress, cannot save "${e}"`);let r=Pe.has(e),n=Pe.get(e);Pe.set(e,t),Nt.set(e,t);let o=lr.get(e)??Promise.resolve(),s=()=>{Nt.get(e)===t&&Nt.delete(e)},i=o.catch(()=>{}).then(()=>Zg(e,t)).then(()=>s(),l=>{throw s(),Pe.get(e)===t&&(r?Pe.set(e,n):Pe.delete(e)),l});lr.set(e,i.catch(()=>{})),await i}function Mr(e){Pe.delete(e);try{localStorage.removeItem(e)}catch{}}async function Zg(e,t){let r=ke();if(r){let n=await Ot(r,G(t),Xo(e));localStorage.setItem(e,n.toBase64())}else localStorage.setItem(e,t)}async function Lr(){Ni||ge(()=>{Lr().catch(r=>console.warn("secure-storage rehydrate:",r))}),Ni=!0;for(let r of[...Pe.keys()])Nt.has(r)||Pe.delete(r);let e=ke(),t=[];for(let r of wn){if(Nt.has(r))continue;let n=localStorage.getItem(r);if(n===null)continue;let o=Ui(n);if(o){if(!e)continue;try{let s=await ar(e,o,Xo(r));Pe.set(r,ce(s))}catch(s){console.warn(`secure-storage: decrypt failed for "${r}":`,s)}}else Pe.set(r,n),e&&X()&&t.push([r,n])}Qg(),t.length>0&&queueMicrotask(()=>{for(let[r,n]of t)Pe.get(r)===n&&ve(r,n).catch(o=>{console.warn(`secure-storage: self-heal failed for "${r}":`,o)})})}async function qd(e,t){let r=lr.get(e)??Promise.resolve(),n=async()=>{if(Nt.has(e))return;let s=localStorage.getItem(e);if(s===null)return;let i=await t(s);i!==null&&(Nt.has(e)||(localStorage.setItem(e,i.storageValue),Pe.set(e,i.cacheValue)))},o=r.catch(()=>{}).then(n);lr.set(e,o.catch(()=>{})),await o}async function zi({seal:e}){for(let t of wn)await qd(t,async r=>{if(Ui(r))return null;let n=ke();return n?{storageValue:(await Ot(n,G(r),Xo(t))).toBase64(),cacheValue:r}:null})}async function Wi({open:e}){for(let t of wn)await qd(t,async r=>{let n=Ui(r);if(!n)return null;let o=await e(n,Xo(t)),s=ce(o);return{storageValue:s,cacheValue:s}})}var em="deepview.secure.v1.mutate:";function Hi(e,t){return wn.includes(e)?navigator.locks.request(em+e,async()=>{let r=lr.get(e);r&&await r.catch(()=>{}),await Lr();let n=he(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 ve(e,o)}}):Promise.reject(new Error(`secure-storage: mutate() called with non-secure key "${e}"`))}async function Gd(){await Promise.allSettled([...lr.values()]),Nt.clear(),lr.clear()}typeof window<"u"&&window.addEventListener("storage",e=>{!Ni||!e.key||!wn.includes(e.key)||Lr().catch(()=>{})});var $n="deepview.passkey.v1",Pr="deepview.passkey.userId",Zo="deepview.passkey.cleanDisable",Xe="deepview.passkey.v1.write",rm="deepview.triage.v1|",nm="deepview.opfs.v1|",om="deepview.bundle.v1|",ee=null,gt=null,Dt=null,kn=0;function Ki(){return kn>0}var Vi=0;function Yd(){return Vi>0}function cr(){try{let e=localStorage.getItem($n);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 Xd(e){localStorage.setItem($n,JSON.stringify(e))}function sm(){localStorage.removeItem($n)}function im(){try{let t=localStorage.getItem(Pr);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(Pr,e.toBase64({alphabet:"base64url",omitPadding:!0}))}catch{}return e}function es(){return typeof location>"u"?"":location.hostname}function X(){return cr()!==null}function st(){return ee!==null}function mt(){return!(!yn()||typeof navigator>"u"||!navigator.locks?.request||!es())}function Jd(){return gt}function xn(){if(cr()!==null)return!1;try{return localStorage.getItem(Zo)==="1"?!1:localStorage.getItem(Pr)!==null}catch{return!1}}function ke(){return ee}function _n(){return G(rm+(gt??""))}function ts(e){if(typeof e!="string")throw new TypeError("passkey vault: OPFS AAD requires a filename string");return G(nm+(gt??"")+"|"+e)}function rs(e){if(typeof e!="string")throw new TypeError("passkey vault: bundle AAD requires a slot string");return G(om+(gt??"")+"|"+e)}var ji=new Set;function ge(e){return ji.add(e),()=>ji.delete(e)}function Or(){for(let e of ji)try{e()}catch(t){console.warn("passkey vault listener:",t)}}async function Sn({signal:e}={}){let t=cr();if(!t)return!1;let r;try{r=await Oi({credentialId:t.credentialId,prfSalt:t.prfSalt,rpId:t.rpId??es(),...e?{signal:e}:{}})}catch(o){if(o&&o.name==="NotAllowedError"||o&&o.name==="AbortError")return!1;throw o&&o.message?.includes("PRF")?vn(o):o}if(!r||r.length<32)throw vn();let n=await Li(r);return r.fill(0),navigator.locks.request(Xe,async()=>{let o=cr();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 ee=await Pi(n),n.fill(0),gt=o.userId,Dt=o.credentialId,Or(),!0})}function vn(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 qi({migrate:e,userName:t,rpName:r,signal:n,acknowledgeOrphan:o}){if(!yn())throw new Error("passkey: WebAuthn unavailable in this environment");if(xn()&&!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=es();return navigator.locks.request(Xe,async()=>{if(X())throw new Error("passkey: encryption is already enabled");if(await jd()===!1)throw vn();let l=im(),d=await Kd({userName:t||"DeepView user",userId:l,rpName:r||"DeepView",rpId:s,...n?{signal:n}:{}}),u=d.prfOutput;if(!u)try{u=await Oi({credentialId:d.credentialId,prfSalt:d.prfSalt,rpId:s,...n?{signal:n}:{}})}catch(m){let y=l.toBase64({alphabet:"base64url",omitPadding:!0});await Qo({credentialId:d.credentialId,rpId:s,userId:y}).catch(()=>{});try{localStorage.removeItem(Pr)}catch{}throw m&&m.message?.includes("PRF")?vn(m):m}if(!u||u.length<32){let m=l.toBase64({alphabet:"base64url",omitPadding:!0});await Qo({credentialId:d.credentialId,rpId:s,userId:m}).catch(()=>{});try{localStorage.removeItem(Pr)}catch{}throw vn()}let p=await Li(u);u.fill(0);let f=await Pi(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()};ee=f,gt=h,Dt=d.credentialId,Xd(b),typeof e=="function"&&await e({seal:(y,$)=>Ot(f,y,$)});try{localStorage.removeItem(Zo)}catch{}return Or(),!0})}async function Gi({migrate:e}){if(!X())return{disabled:!1,signalAttempted:!1};if(!st())throw new Error("passkey: must unlock before disabling encryption");kn+=1;try{return await navigator.locks.request(Xe,async()=>{let t=cr();if(!t)return{disabled:!1,signalAttempted:!1};let r=ee;if(!r)return{disabled:!1,signalAttempted:!1};if(sm(),ee=null,Dt=null,typeof e=="function"){let o=(s,i)=>ar(r,s,i);try{await e({open:o})}catch(s){throw Xd(t),ee=r,Dt=t.credentialId,Or(),s}}gt=null;try{localStorage.setItem(Zo,"1")}catch{}let n=await Qo(t).catch(()=>!1);return Or(),{disabled:!0,signalAttempted:n}})}finally{kn-=1}}async function Qo({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 am(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 lm(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 am(r,n);o&&t.push(o)}return t}async function Cn({refuseIfEnabled:e=!1}={}){kn+=1,Vi+=1;try{return await navigator.locks.request(Xe,async()=>{if(e&&X())throw new Error("passkey: encryption was just enabled in another tab. Reload this page to unlock instead of wiping.");await Gd();let t=cr();if(t)try{await Qo({credentialId:t.credentialId,rpId:t.rpId??es(),userId:t.userId})}catch{}try{localStorage.removeItem($n)}catch{}try{localStorage.removeItem(Pr)}catch{}try{localStorage.removeItem(Zo)}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{}ee=null,gt=null,Dt=null,Or();let r=await lm(["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{kn-=1,Vi-=1}}function Qd(e){return ee?Ot(ee,e,_n()):Promise.reject(new Error("passkey: vault locked, cannot seal triage"))}function Zd(e){return ee?ar(ee,e,_n()):Promise.reject(new Error("passkey: vault locked, cannot open triage"))}function ns(e,t){return ee?Ot(ee,e,ts(t)):Promise.reject(new Error("passkey: vault locked, cannot seal OPFS file"))}function eu(e,t){return ee?ar(ee,e,ts(t)):Promise.reject(new Error("passkey: vault locked, cannot open OPFS file"))}function Yi(e,t){return ee?Ot(ee,e,rs(t)):Promise.reject(new Error("passkey: vault locked, cannot seal bundle"))}function Ji(e,t){return ee?ar(ee,e,rs(t)):Promise.reject(new Error("passkey: vault locked, cannot open bundle"))}typeof window<"u"&&window.addEventListener("storage",e=>{if(e.key!==$n)return;let t=cr();(!t&&ee||t&&ee&&t.credentialId!==Dt)&&(ee=null,gt=null,Dt=null),Or()});var ea="__meta__",cm="deepview-reports",ta="deepview-bundles",Et="deepview.report:",tu=!1;async function ra(e,{create:t,warnOnce:r=!1}={}){try{return await(await navigator.storage.getDirectory()).getDirectoryHandle(e,{create:t})}catch(n){return r&&!tu&&(tu=!0,console.warn("OPFS unavailable, falling back to gzipped localStorage (limited quota).",n)),null}}async function os(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 Xi(e,t){if(!Le(e))return e;if(!ke())throw new Error(`storage: vault locked, cannot decrypt "${t}"`);return await eu(e,t)}async function En(e,t,r,n,o=()=>{}){if(X()&&!ke())throw o(),new Error(`storage: vault locked, cannot save ${n}`);let s=ke(),i=s?await t(e,r):e;if(ke()!==s)throw o(),new Error(`storage: vault state changed mid-save for ${n}; retry`);return i}function dr(){return ra(cm,{create:!0,warnOnce:!0})}var it=new Map,Ut=new Map,Qi=new Map;function re(e){Qi.set(e,(Qi.get(e)??0)+1)}function ru(e){return Qi.get(e)??0}var Zi=new Set;function nu(e){return Zi.add(e),()=>Zi.delete(e)}function Nr(e,t){for(let r of Zi)try{r(e,t)}catch(n){console.warn("storage file-change listener:",n)}}async function le(){let e=await dr();if(e){let r=[];for await(let[n]of e.entries())r.push(n);return r.toSorted()}let t=[];for(let r=0;r<localStorage.length;r++){let n=localStorage.key(r);n&&n.startsWith(Et)&&t.push(n.slice(Et.length))}return t.toSorted()}async function at(e,t){if(typeof e!="string"||e.includes("\0"))throw new Error("Invalid report name: contains NUL byte or is not a string");return re(e),navigator.locks.request(Xe,{mode:"shared"},async()=>{let r=await dr();if(r){let s=await mn(G(t));s=await En(s,ns,e,`"${e}"`,()=>re(e));let l=await(await r.getFileHandle(e,{create:!0})).createWritable();try{await l.write(s),await l.close()}catch(d){it.delete(e),re(e);try{await l.abort(d)}catch{}throw d}it.set(e,t),re(e),Nr(e,"save");return}let n=G(t);n=await mn(n),n=await En(n,ns,e,`"${e}"`,()=>re(e));let o=n.toBase64();try{localStorage.setItem(Et+e,o),it.set(e,t),re(e),Nr(e,"save")}catch(s){throw re(e),new Error(`localStorage write failed for ${e}: ${s.message}`,{cause:s})}})}async function Fe(e){if(it.has(e))return it.get(e);if(Ut.has(e))return Ut.get(e);let t=ru(e),r=(async()=>{let n=await dr();if(n){let d=await(await n.getFileHandle(e)).getFile(),u=new Uint8Array(await d.arrayBuffer());if(u=await Xi(u,e),u.length>=2&&u[0]===31&&u[1]===139){let f=await ht(u);return ce(f)}let p=ce(u);return at(e,p).catch(f=>{console.warn(`storage: legacy-uncompressed migration of "${e}" failed:`,f)}),p}let o=localStorage.getItem(Et+e);if(o===null)throw new Error(`File not found: ${e}`);let s=Uint8Array.fromBase64(o);s=await Xi(s,e);let i=await ht(s);return ce(i)})();Ut.set(e,r);try{let n=await r;return ru(e)===t&&it.set(e,n),n}finally{Ut.delete(e)}}async function Tn(e){let t=await dr(),r;if(t){let o=await(await t.getFileHandle(e)).getFile();r=new Uint8Array(await o.arrayBuffer())}else{let n=localStorage.getItem(Et+e);if(n===null)throw new Error(`File not found: ${e}`);r=Uint8Array.fromBase64(n)}return r=await Xi(r,e),r}async function In(e,t){if(typeof e!="string"||e.includes("\0"))throw new Error("Invalid report name: contains NUL byte or is not a string");return re(e),it.delete(e),navigator.locks.request(Xe,{mode:"shared"},async()=>{let r=await En(t,ns,e,`"${e}"`,()=>re(e)),n=await dr();if(n){let s=await(await n.getFileHandle(e,{create:!0})).createWritable();try{await s.write(r),await s.close()}catch(i){re(e);try{await s.abort(i)}catch{}throw i}re(e),Nr(e,"save");return}try{localStorage.setItem(Et+e,r.toBase64()),re(e),Nr(e,"save")}catch(o){throw re(e),new Error(`localStorage write failed for ${e}: ${o.message}`,{cause:o})}})}async function Dr(e){return re(e),it.delete(e),Ut.delete(e),navigator.locks.request(Xe,{mode:"shared"},async()=>{let t=await dr();if(t){try{await t.removeEntry(e)}catch(r){if(!(r instanceof DOMException)||r.name!=="NotFoundError")throw re(e),r}re(e),Nr(e,"delete");return}localStorage.removeItem(Et+e),re(e),Nr(e,"delete")})}var An="_meta.json";function Rn(){return ra(ta,{create:!0})}function na(e){return e.replaceAll("/","_")}async function oa(e){let t;try{let o=await(await e.getFileHandle(An)).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(Le(t)){if(!ke())return console.warn("readBundleMeta: vault locked, returning empty bundle list"),[];try{r=await Ji(t,ea)}catch(o){return console.warn("readBundleMeta: decrypt failed (tampering, key mismatch, or vault identity drift):",o),[]}}try{let n=JSON.parse(ce(r));return Array.isArray(n)?n:[]}catch(n){return console.warn("readBundleMeta: JSON.parse failed:",n),[]}}async function ou(e,t){let r=G(JSON.stringify(t));r=await En(r,Yi,ea,"bundle metadata");try{await e.removeEntry(An)}catch{}let n=await e.getFileHandle(An,{create:!0});await os(n,r)}var dm=`${ta}/${An}`;function su(e){return navigator.locks.request(dm,e)}async function lt(){let e=await Rn();return e?[...await oa(e)].toSorted((r,n)=>r.name.localeCompare(n.name)):[]}async function sa(){if(typeof navigator>"u"||!navigator.storage?.getDirectory)return!1;let e=await ra(ta,{create:!1});if(!e)return!1;try{for await(let t of e.entries())return!0}catch{}return!1}async function ur(e,t){let r=await Rn();if(!r)throw new Error(`Cannot save bundle ${e}: OPFS unavailable`);let n=t instanceof Uint8Array?t:new TextEncoder().encode(t),o=await Vd(n),s=na(o),i=e.toLowerCase().endsWith(".map")?await mn(n):n;return navigator.locks.request(Xe,{mode:"shared"},async()=>{i=await En(i,Yi,o,`bundle "${e}"`);try{await r.removeEntry(s)}catch{}let l=await r.getFileHandle(s,{create:!0});await os(l,i);try{await su(async()=>{let d=await oa(r),u=d.findIndex(p=>p.integrity===o);u>=0?d[u]={integrity:o,name:e}:d.push({integrity:o,name:e}),await ou(r,d)})}catch(d){try{await r.removeEntry(s)}catch{}throw d}return{integrity:o,name:e}})}async function ia(e){let t=await Rn();if(t)return navigator.locks.request(Xe,{mode:"shared"},async()=>{try{await t.removeEntry(na(e))}catch{}await su(async()=>{let r=await oa(t),n=r.filter(o=>o.integrity!==e);n.length!==r.length&&await ou(t,n)})})}async function pr(e){let t=await Rn();if(!t)throw new Error("OPFS unavailable");let n=await(await t.getFileHandle(na(e))).getFile(),o=new Uint8Array(await n.arrayBuffer());if(Le(o)){if(!ke())throw new Error(`storage: vault locked, cannot read bundle "${e}"`);o=await Ji(o,e)}return o.length>=2&&o[0]===31&&o[1]===139?await ht(o):o}async function um(e,t){let r=await dr();if(r){let l=await(await r.getFileHandle(e)).getFile(),d=new Uint8Array(await l.arrayBuffer()),u=await t(d);if(u===null)return;it.delete(e),Ut.delete(e),re(e);let p=await r.getFileHandle(e,{create:!0});await os(p,u),re(e);return}let n=localStorage.getItem(Et+e);if(n===null)return;let o=Uint8Array.fromBase64(n),s=await t(o);s!==null&&(it.delete(e),Ut.delete(e),re(e),localStorage.setItem(Et+e,s.toBase64()),re(e))}function iu(e,t){return e.seal?r=>Le(r)?null:e.seal(r,t):r=>Le(r)?e.open(r,t):null}async function au(e){let t=await le();for(let r of t)try{await um(r,iu(e,ts(r)))}catch(n){if(n instanceof DOMException&&n.name==="NotFoundError")continue;throw n}}var aa=({seal:e})=>au({seal:e}),la=({open:e})=>au({open:e});async function pm(){let e=await Rn();if(!e)return{dir:null,keys:[]};let t=[];for await(let[r]of e.entries())t.push(r);return{dir:e,keys:t}}function fm(e){return e===An?ea:e.startsWith("sha512-")?e.replaceAll("_","/"):null}async function hm(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 os(l,i)}async function lu(e){let{dir:t,keys:r}=await pm();if(t)for(let n of r){let o=fm(n);if(o!==null)try{await hm(t,n,iu(e,rs(o)))}catch(s){if(s instanceof DOMException&&s.name==="NotFoundError")continue;throw s}}}var ca=({seal:e})=>lu({seal:e}),da=({open:e})=>lu({open:e});ge(()=>{it.clear(),Ut.clear()});var is="deepview.viewMode",ss="deepview.repoUrls",gm=new Set(["grouped","list","table","kanban","focus"]);function mm(){try{let e=localStorage.getItem(is);return e!==null&&gm.has(e)?e:null}catch{return null}}function pa(e){try{let t=JSON.parse(e||"{}");return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function as(){return pa(he(ss))}function He(e){return e?as()[e]??"":""}var ua=new Set;function cu(e){return ua.add(e),()=>{ua.delete(e)}}function bm(e){for(let t of ua)try{t(e)}catch(r){console.warn("repo-url listener:",r)}}function Ve(e,t){if(!e)return;let r=as();t?r[e]=t:delete r[e],ve(ss,JSON.stringify(r)).catch(n=>console.warn("saveRepoUrlFor:",n)),Hi(ss,n=>{let o=pa(n);return t?o[e]=t:delete o[e],JSON.stringify(o)}).catch(n=>console.warn("saveRepoUrlFor cross-tab merge:",n)),bm(e)}async function du(e,t){await Hi(ss,r=>{let n=pa(r),o=t==="replace"?{...e}:t==="prefer-imported"?{...n,...e}:{...e,...n};return JSON.stringify(o)}),uu()}var a=Nd({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:"",filterSeverities:new Set,filterColors:new Set,filterSources:new Set,filterAnalyzer:"",filterRepo:"",filterConfMin:0,filterConfMax:10,filterInclude:"",repoUrl:"",repoEditing:!1,sortBy:"severity",viewMode:mm()??"table",triage:new Map,shownTriage:null,nextFindingId:0,activeTabByGroup:new Map,tableSelectedGid:null,filesViewMode:"table",filesSearch:"",filesSelectedFile:null,kanbanPopoverGid:null,focusGid:null,focusCodeTick:0});function uu(){a.repoEditing||a.currentFile&&(a.repoUrl=He(a.currentFile))}Fr(()=>{uu()});var ym=/^## ([A-Z][A-Z_]*)\s*\(\d+\)\s*$/mu;function wm(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 vm(e){if(e)switch(e.toLowerCase()){case"high":return 8;case"medium":return 5;case"low":return 2;default:return}}function km(e){return typeof e=="string"?e.replace(/^`(.*)`$/u,"$1"):e}function Ur(e){let t=e.replaceAll(/\r\n?/gu,`
4
- `).trim();if(!ym.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=wm(r[o]),l=(r[o+1]||"").split(/^### /mu).slice(1);for(let d of l){let u=$m(d,s);u&&n.push(u)}}return n.length===0?null:{type:"security",source:"deepsec",findings:n}}function $m(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 y of o.matchAll(/^- \*\*([^:*]+):\*\*\s*(.+)$/gmu))s[y[1].trim().toLowerCase()]=y[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(`
6
- `).filter(y=>!/^\s*- \*\*/u.test(y)).join(`
7
- `).replaceAll("**","").trim(),p=n+(u?`
8
-
9
- `+u:""),f=km(s.file||"unknown"),h=(s.lines||"").split(",").map(y=>y.trim()).find(Boolean)||"?",b={file:f,line:h,severity:t,description:p};d&&(b.recommendation=d.replaceAll("**",""));let m=vm(s.confidence);return m!==void 0&&(b.confidence=m),s.slug&&(b.slug=s.slug),b}var xm=new Set(["critical","high","medium","low","high_bug","bug","informational"]);function zr(e){let t=e.replaceAll(/\r\n?/gu,`
10
- `).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=_m(s);i&&n.push(i)}return n.length===0?null:{type:n.find(s=>s.type)?.type||"analysis",source:"claude-security",findings:n}}function _m(e){let t=e.indexOf(`
11
- `),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}=Sm(n),i=Cm(o),l=Em(s),{file:d,line:u,locationLink:p}=Am(i.location||""),f=(l.severity||"").toLowerCase(),h=xm.has(f)?f:"medium",b=Tm(r,i),m=i["recommended fix"]?pu(i["recommended fix"]):void 0,y={file:d||"unknown",line:u,severity:h,description:b};return p&&(y.location=p),m&&(y.recommendation=m),l.repository&&(y.repo={github:l.repository}),l.branch&&(y.branch=l.branch),l["date created"]&&(y.dateCreated=l["date created"]),l.status&&(y.status=l.status),l.category&&(y.type=l.category.toLowerCase()),y}function Sm(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 Cm(e){let t={},r=e.split(/^## /mu);for(let n=1;n<r.length;n++){let o=r[n],s=o.indexOf(`
12
- `),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 Em(e){let t={};for(let r of e.matchAll(/\*\*([^:]+):\*\*\s*(.+)/gu))t[r[1].trim().toLowerCase()]=r[2].trim();return t}function Am(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 Tm(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"]}`),pu(r.join(`
13
-
14
- `))}function pu(e){return e.replaceAll("**","")}function Im(e){return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}function Rm(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(e[r]);return btoa(t)}async function fu(e){let t=typeof e=="string"?G(e):e,r=await crypto.subtle.digest("SHA-512",t);return`sha512-${Rm(new Uint8Array(r))}`}async function Bm(e){let t=G(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=Im(n);return`${o.slice(0,8)}-${o.slice(8,12)}-${o.slice(12,16)}-${o.slice(16,20)}-${o.slice(20,32)}`}async function ls(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 Bm(t)}catch{return null}}function zt(e){try{return JSON.parse(e)}catch{return Ur(e)??zr(e)}}function Wt(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 Wr(e){let t=e.filter(n=>n&&!n.id);if(t.length===0)return;let r=await Promise.all(t.map(ls));t.forEach((n,o)=>{r[o]&&(n.id=r[o])})}var Hr=new Map,Vr=new Map,jr=new Map,cs=new Map;function Fm(e){if(typeof e?.package?.npm?.name=="string"&&e.package.npm.name)return e.package.npm.name;if(!e?.file)return null;let t=/(?:^|\/)(?:node_modules|dependencies)\/(@[^/]+\/[^/]+|[^/]+)/gu,r;for(;(r=t.exec(e.file))!==null;)if(r[1]!==".pnpm")return r[1];return null}function Mm(e){return typeof e?.file!="string"?!1:/(?:^|\/)(?:node_modules|dependencies)\//u.test(e.file)}function Lm(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 Fn=new Set,fa=new Set,Bn=null,ha=!1;function ga(e){return fa.add(e),()=>fa.delete(e)}function ma(){for(let e of fa)try{e()}catch{}}function ds(e){return Hr.get(e)?.list??[]}function bt(){return Vr}function fr(){return jr}function Mn(e,t){let r=Hr.get(e);if(!r)return[];let n=r.reports.get(Ht(t));return n?[...n]:[]}function ba(e,t){let r=Vr.get(e);if(!r)return[];let n=r._keyReports.get(Ht(t));return n?[...n]:[]}function ya(e,t){let r=jr.get(e);if(!r)return[];let n=r._keyReports.get(Ht(t));return n?[...n]:[]}var hu=["type","model","think","effort","exportsMode"];function Pm(e,t){if(!hu.some(r=>e[r]!==void 0))for(let r of hu)t[r]!==void 0&&(e[r]=t[r])}function Om(e){let t=Array.isArray(e?.findings)?e.findings:Array.isArray(e?.groups)?e.groups:null;if(!t)return[];let r=!e?.source,n=[];for(let o of Wt(t))r&&Pm(o,e),n.push(o);return n}function Ht(e){return e.id?`id:${e.id}`:`c:${e.severity??""}|${e.description??""}|${e.file??""}|${e.line??""}`}function wa(e,t,r){let n=cs.get(e);n||(n={hash:[],pkg:[],repo:[]},cs.set(e,n)),n[t].push(r)}function Nm(e,t,r){let n=Hr.get(e.fileHash);n||(n={keys:new Set,list:[],reports:new Map},Hr.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&&wa(r,"hash",{hash:e.fileHash,key:t}),n.keys.has(t)?s:(n.keys.add(t),n.list.push(e),!0)}function Dm(e,t,r){let n=Fm(e);if(!n)return!1;let o=zd(e),s=Vr.get(n);if(s||(s={...jo(),repos:new Set,byVersion:new Map,_repoReports:new Map},Vr.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)}Wd(s,o,e,t,r);let i=Ko(s,t,r,e);return wa(r,"pkg",{pkg:n,key:t,file:e.file,version:o}),i}function Um(e,t,r,n){if(Mm(e))return!1;let o=Lm(e,n);if(!o)return!1;let s=jr.get(o);s||(s=jo(),jr.set(o,s));let i=Ko(s,t,r,e);return i&&wa(r,"repo",{repo:o,key:t,file:e.file}),i}function va(e){let t=cs.get(e);if(cs.delete(e),Fn.delete(e),!t)return!1;let r=!1;for(let{hash:o,key:s}of t.hash){let i=Hr.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=>Ht(u)===s);d>=0&&i.list.splice(d,1)}i.keys.size===0&&Hr.delete(o)}}let n=new Set;for(let{pkg:o,key:s,file:i,version:l}of t.pkg){let d=Vr.get(o);if(!d)continue;let u=d._keyReports.get(s);if(u){if(u.delete(e)&&(r=!0),u.size===0&&qo(d,s,i,Ht),Hd(d,l,s,i,e,Ht),!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?Vr.delete(o):Go(d)}}for(let{repo:o,key:s,file:i}of t.repo){let l=jr.get(o);if(!l)continue;let d=l._keyReports.get(s);d&&(d.delete(e)&&(r=!0),d.size===0&&qo(l,s,i,Ht),l._keyReports.size===0?jr.delete(o):Go(l))}return r}async function zm(e){if(Fn.has(e))return!1;Fn.add(e);try{let t=await Fe(e),r=zt(t);if(!r)return!1;let n=Om(r);if(n.length===0)return!1;let o="";try{o=He(e)}catch{}let s=!1;for(let i of n){let l=Ht(i);i.fileHash&&Nm(i,l,e)&&(s=!0),i.file&&Dm(i,l,e)&&(s=!0),i.file&&Um(i,l,e,o)&&(s=!0)}return Fn.has(e)?s:(va(e),ha=!0,!1)}catch{return Fn.delete(e),!1}}function yt(){return Bn||(Bn=(async()=>{try{do{ha=!1;let e=await le();for(let t of e)await zm(t)&&ma()}while(ha)}finally{Bn=null}})(),Bn)}nu(e=>{va(e)&&ma()});cu(e=>{va(e)&&ma(),yt().catch(()=>{})});var Ln=new Map,Pn=new Map;function us(e,t){if(!e||!t)return!1;let r=!Pn.has(e);Pn.set(e,t);for(let[n,o]of t){if(!o)continue;let s=Ln.get(o);s||(s=new Map,Ln.set(o,s)),s.set(e,n)}return r}function ka(e){let t=Pn.get(e);if(Pn.delete(e),!!t)for(let r of t.values()){let n=Ln.get(r);n&&(n.delete(e),n.size===0&&Ln.delete(r))}}function hr(e){if(!e)return[];let t=Ln.get(e);if(!t)return[];let r=[];for(let[n,o]of t)r.push({integrity:n,file:o});return r}function $a(e){return Pn.has(e)}var gu="deepview.fileCounts",qr=null;function fs(){if(qr)return qr;try{qr=JSON.parse(he(gu)||"{}")}catch{qr={}}return qr}function xa(){ve(gu,JSON.stringify(qr)).catch(e=>console.warn("counts persist:",e))}function mu(e){let t=fs()[e];if(t!==void 0)return typeof t=="number"?{count:t}:t}function Nn(e){return mu(e)?.count}function Dn(e){return mu(e)?.source}function je(e,t,r){let n=fs();n[e]=r?{count:t,source:r}:{count:t},xa()}function Gr(e){let t=fs();delete t[e],xa()}function Oe(e){try{let n=JSON.parse(e);if(n&&Array.isArray(n.findings))return{count:n.findings.length,source:n.source,recognized:!0}}catch{}let t=Ur(e);if(t)return{count:t.findings.length,source:t.source,recognized:!0};let r=zr(e);return r?{count:r.findings.length,source:r.source,recognized:!0}:{count:0,recognized:!1}}var On=null,Kr=null,ps=null;function Wm(e,t){for(let{names:r,onUpdate:n}of ps)if(r.has(e))try{n(e,t)}catch(o){console.warn("ensureCounts onUpdate:",o)}}function _a(e,t){if(On){t&&ps.push({names:new Set(e),onUpdate:t});for(let r of e)Kr.add(r);return On}return Kr=new Set(e),ps=t?[{names:new Set(e),onUpdate:t}]:[],On=(async()=>{await Promise.resolve();try{let r=fs();for(;Kr.size>0;){let n=Kr.values().next().value;if(Kr.delete(n),r[n]===void 0)try{let o=await Fe(n),{count:s,source:i}=Oe(o);r[n]=i?{count:s,source:i}:{count:s},xa(),Wm(n,s)}catch{}}}finally{On=null,Kr=null,ps=null}})(),On}function Sa(e){if(!e)return"";for(let t of e.split(`
15
- `))if(t.trim())return t.trim();return""}function Ca(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);!t.has(i)||r.has(i)||r.set(i,{severity:s.severity,file:s.file,line:s.line,description:Sa(s.description)})}return r}var Hm=`deepview/workspace-id/v1
16
- `;async function Un(e){let t=Uint8Array.fromBase64(e),r=G(Hm),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 zn(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 bu=zn("create"),yu=zn("delete"),wu=zn("privateKey"),vu=zn("report-membership"),ku=zn("bundle-membership"),Vm=bu.on,Ea=yu.on,Aa=wu.on,Ta=vu.on,Ia=ku.on,hs=bu.fire,Ra=yu.fire,Ba=wu.fire,gs=vu.fire,ms=ku.fire;var Ma="deepview.workspaces",jm=1;function Wn(){try{let e=he(Ma);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 Km(e){await ve(Ma,JSON.stringify({version:jm,workspaces:e}))}var qm=Ma;function Yr(e){return navigator.locks.request(qm,async()=>{let t=Wn(),r=await e(t);if(r!==!1)return await Km(t),r})}function Hn(e){return{id:e.id,privateKey:e.privateKey,reports:Array.isArray(e.reports)?[...e.reports]:[],bundles:Array.isArray(e.bundles)?[...e.bundles]:[]}}var ct=Wn().map(Hn);function La(){ct=Wn().map(Hn)}function Pa(e){ct=ct.filter(t=>t.id!==e.id),ct.push(Hn(e))}function Gm(e,t){let r=Array.isArray(e[t])?[...e[t]]:[],n=ct.find(o=>o.id===e.id);if(n){n[t]=r;return}ct.push(Hn(e))}function Ym(e){ct=ct.filter(t=>t.id!==e)}function z(){let e=Wn();for(let t of e)Array.isArray(t.reports)||(t.reports=[]),Array.isArray(t.bundles)||(t.bundles=[]);return e}var Jm=200;function wt(e){let t=(e??"").trim();return t&&t.replaceAll(/[\u0000-\u001F\u007F]/gu,"").slice(0,Jm)||null}async function Oa(e){let t=wt(e);if(!t)return null;let r=new Uint8Array(32);crypto.getRandomValues(r);let n=r.toBase64(),o={id:await Un(n),name:t,privateKey:n,reports:[],bundles:[],createdAt:Date.now()};return await Yr(i=>i.some(l=>l.id===o.id)?!1:(i.push(o),o))?(Pa(o),o):null}async function Na(e){await Yr(r=>{let n=r.findIndex(o=>o.id===e);return n<0?!1:(r.splice(n,1),!0)})&&(Ra(e),Ym(e))}async function Da(e,t){let r=wt(t);return!(!r||!await Yr(o=>{let s=o.find(i=>i.id===e);return!s||s.name===r?!1:(s.name=r,s)}))}async function $u(e){let t=await Yr(o=>{let s=o.findIndex(p=>p.id===e.id),i=s>=0?o[s]:null,l=wt(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=ct.find(o=>o.id===r.id)??null;return n==null?hs(r.id):(n.privateKey!==r.privateKey&&Ba(r.id),bs(n.reports,r.reports)||gs(r.id),bs(n.bundles,r.bundles)||ms(r.id)),Pa(r),r}async function Ua({id:e,name:t,privateKey:r,createdAt:n}){let o=null;return await Yr(s=>{let i=wt(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=>wt(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"&&(hs(o.workspace.id),Pa(o.workspace)),o}function bs(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 Fa({identifier:e,workspaceId:t,field:r,fire:n,additive:o=!1,from:s=void 0}){let i=await Yr(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(y=>y!==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 y=u.find($=>$.id===m);y&&b.set(m,y)}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&&Gm(p,r)}}function xu(e,t){return{move:(r,n)=>Fa({identifier:r,workspaceId:n,field:e,fire:t}),add:(r,n)=>Fa({identifier:r,workspaceId:n,field:e,fire:t,additive:!0}),remove:(r,n)=>Fa({identifier:r,field:e,fire:t,from:n})}}var za=xu("reports",gs),Wa=xu("bundles",ms),Vn=za.move,At=za.add,jn=za.remove,Ha=Wa.move,gr=Wa.add,Va=Wa.remove;function Xm(){let e=Wn().map(Hn),t=ct,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)||Ra(o);for(let[o,s]of n){let i=r.get(o);if(!i){hs(o);continue}i.privateKey!==s.privateKey&&Ba(o),bs(i.reports,s.reports)||gs(o),bs(i.bundles,s.bundles)||ms(o)}ct=e}Fr(()=>{Xm()});function _u(e){return e==="fixed"||e==="invalid"||e==="deleted"?e:void 0}function de(e){if(e)return _u(e.triage)??(e.deleted?"deleted":void 0)}function Qm(e){return e?!e.color&&!de(e)&&!e.comment&&!e.fix&&!(e.ignoredReports&&e.ignoredReports.length>0):!0}function Tt(e,t,r){let n=e.get(t)?.ignoredReports;return Array.isArray(n)&&n.includes(r)}function Kn(e){if(!e||typeof e!="object")return;let t=e,r={};typeof t.color=="string"&&t.color&&(r.color=t.color);let n=_u(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),Array.isArray(t.ignoredReports)){let o=t.ignoredReports.filter(s=>typeof s=="string"&&s.length>0);o.length>0&&(r.ignoredReports=o)}return Qm(r)?void 0:r}function Zm(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 eb(e,t){let r=e??{},n=t??{};return(r.color??"")===(n.color??"")&&(de(r)??"")===(de(n)??"")&&(r.comment??"")===(n.comment??"")&&(r.fix??"")===(n.fix??"")&&Zm(r.ignoredReports,n.ignoredReports)}function M(e,t,r){let n=e.get(t),o=Kn({...n,...r});return o===void 0?e.delete(t):eb(n,o)?!1:(e.set(t,o),!0)}function ne(e,t,r,n){let o=new Set(e.get(t)?.ignoredReports??[]);return n?o.add(r):o.delete(r),M(e,t,{ignoredReports:o.size>0?[...o]:void 0})}var ja=()=>{};function Cu(e){ja=typeof e=="function"?e:()=>{}}var Vt="deepview.triage",It="deepview.triage.pending",vt=/^\d+$/u;async function tb(e){let t=new Blob([e]).stream().pipeThrough(new CompressionStream("deflate"));return new Uint8Array(await new Response(t).arrayBuffer())}async function rb(e){let t=new Blob([e]).stream().pipeThrough(new DecompressionStream("deflate"));return new Uint8Array(await new Response(t).arrayBuffer())}var nb="deepview.triage.save",Su=0;function Ka(){let e={};for(let[t,r]of a.triage){if(vt.test(t))continue;let n=Kn(r);n&&(e[t]=n)}return e}function oe(){let e=++Su,t=Ka(),r=Object.keys(t).length===0,n=r?null:JSON.stringify(t);if(n!=null)try{localStorage.setItem(It,n)}catch{}return navigator.locks.request(Xe,{mode:"shared"},async()=>{let o=null,s=null;if(n!=null)try{let i=G(n),l=await tb(i);s=ke(),o=(s?await Qd(l):l).toBase64()}catch(i){console.warn("Failed to save triage:",i),ja();return}await navigator.locks.request(nb,()=>{try{if(e!==Su)return;if(n!=null&&ke()!==s){queueMicrotask(()=>{oe()});return}if(r)localStorage.removeItem(Vt),localStorage.removeItem(It);else{localStorage.setItem(Vt,o);try{localStorage.removeItem(It)}catch{}}}catch(i){console.warn("Failed to save triage:",i)}}),ja()})}async function Eu(){let e=localStorage.getItem(It);if(e)try{return JSON.parse(e)}catch{}let t=localStorage.getItem(Vt);if(!t)return null;let r=Uint8Array.fromBase64(t);if(Le(r)){if(!ke())throw new Error("triage: vault locked, cannot decrypt envelope");r=await Zd(r)}let n=await rb(r);return JSON.parse(ce(n))}function Au(e,{replace:t=!1}={}){let r=a.triage;if(t){let n=null,o=localStorage.getItem(It);if(o)try{n=JSON.parse(o)}catch{}let s=i=>n!=null&&i in n;for(let i of[...r.keys()]){if(vt.test(i))continue;let l=e?.[i],d=!e||!(i in e);!(s(i)&&n[i]?.color)&&(d||!l?.color)&&M(r,i,{color:void 0}),!(s(i)&&(n[i]?.triage||n[i]?.deleted))&&!de(l)&&M(r,i,{triage:void 0}),!(s(i)&&n[i]?.comment)&&(d||typeof l?.comment!="string"||!l.comment)&&M(r,i,{comment:void 0}),!(s(i)&&n[i]?.fix)&&(d||typeof l?.fix!="string"||!l.fix)&&M(r,i,{fix:void 0})}for(let i of[...r.keys()]){if(vt.test(i))continue;let l=r.get(i)?.ignoredReports;if(!l||l.length===0)continue;let d=e?.[i],u=!!de(d);for(let p of[...l]){if(s(i)&&Array.isArray(n[i]?.ignoredReports)&&n[i].ignoredReports.includes(p))continue;if(u){ne(r,i,p,!1);continue}let f=d?.ignoredReports;(!Array.isArray(f)||!f.includes(p))&&ne(r,i,p,!1)}}}if(e)for(let[n,o]of Object.entries(e)){let s=de(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),Object.keys(i).length>0&&M(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&&M(r,n,{ignoredReports:[...l]})}}}async function ob(){try{let e=await Eu();Au(e)}catch(e){console.warn("Failed to load triage:",e)}}async function Tu(){try{let e=await Eu();Au(e,{replace:!0})}catch(e){console.warn("Failed to reload triage:",e)}}typeof window<"u"&&window.addEventListener("storage",e=>{e.key!==Vt&&e.key!==It||Tu()});var qn=ob();ge(()=>{Tu()});ge(()=>{ke()&&localStorage.getItem(It)&&oe()});async function qa({seal:e}){try{localStorage.removeItem(It)}catch{}let t=localStorage.getItem(Vt);if(!t)return;let r=Uint8Array.fromBase64(t);if(Le(r))return;let n=await e(r,_n());localStorage.setItem(Vt,n.toBase64())}async function Ga({open:e}){try{localStorage.removeItem(It)}catch{}let t=localStorage.getItem(Vt);if(!t)return;let r=Uint8Array.fromBase64(t);if(!Le(r))return;let n=await e(r,_n());localStorage.setItem(Vt,n.toBase64())}var Iu="deepview.lastFile",Gn=null;function Ya(){return Gn||(Gn=sb(),Gn.catch(()=>{Gn=null})),Gn}async function sb(){try{await qn}catch{}let e=await le(),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 Fe(o),await at(s,i),await Dr(o)}catch(p){console.warn(`migrate: failed to rename ${o} -> ${s}`,p);continue}t.delete(o),t.add(s),n.add(o);let l=Nn(o);if(Gr(o),l===void 0){let{count:p,source:f}=Oe(i);je(s,p,f)}else{let{source:p}=Oe(i);je(s,l,p)}let d=He(o);d&&(Ve(o,""),Ve(s,d));let u=!1;for(let[p,f]of[...a.triage])f.ignoredReports?.includes(o)&&(ne(a.triage,p,o,!1),ne(a.triage,p,s,!0),u=!0);if(u&&await oe(),he(Iu)===o)try{await ve(Iu,s)}catch{}}for(let o of z())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 jn(s,o.id),await At(i,o.id)}}var Ja=1;function ib(){let e=Ka(),t=as();return{version:Ja,exportedAt:new Date().toISOString(),triage:e,repoUrls:t}}function ab(){return`deepview-triage-${new Date().toISOString().replaceAll(/[:.]/gu,"-").slice(0,19)}.json.gz`}async function Xa(){let e=ib();return{blob:new Blob([await Yo(JSON.stringify(e))]),filename:ab()}}async function Qa(e){let t;try{t=await bn(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!==Ja)throw new Error(`Unsupported backup version: ${r.version} (expected ${Ja})`);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 Za(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()])vt.test(l)||n.delete(l);let o=t==="prefer-current";for(let[l,d]of Object.entries(r)){if(vt.test(l)||!d||typeof d!="object")continue;typeof d.color=="string"&&d.color&&(!o||!n.get(l)?.color)&&M(n,l,{color:d.color});let u=de(d);if(u&&(!o||!de(n.get(l)))&&M(n,l,{triage:u}),typeof d.comment=="string"&&d.comment&&(!o||!n.get(l)?.comment)&&M(n,l,{comment:d.comment}),typeof d.fix=="string"&&d.fix&&(!o||!n.get(l)?.fix)&&M(n,l,{fix:d.fix}),Array.isArray(d.ignoredReports)&&!de(n.get(l)))for(let p of d.ignoredReports)typeof p=="string"&&(o&&Tt(n,l,p)||ne(n,l,p,!0))}await oe();let s=0,i=null;try{await du(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 lb(e){return e?.name==="NotFoundError"||typeof e?.message=="string"&&e.message.startsWith("File not found:")}async function el(e){let t=new Set;for(let r of e){let n;try{n=await Fe(r)}catch(i){if(lb(i))continue;throw new Error(`Failed to read ${r}: ${i.message}`,{cause:i})}if(n==null)continue;let o=zt(n);if(!o?.findings)continue;let s=Wt(o.findings);await Wr(s);for(let i of s)i.id&&t.add(i.id)}return t}function cb(){let e=new Set;for(let t of a.triage.keys())vt.test(t)||e.add(t);return e}async function ys(e){let t=cb();if(t.size===0)return{orphanedCount:0,sharedCount:0};let r=await el(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 le(),s=new Set(e),i=o.filter(p=>!s.has(p)),l=await el(i),d=0,u=0;for(let p of n)l.has(p)?u++:d++;return{orphanedCount:d,sharedCount:u}}async function ws(){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 le(),n=new Set(r),o=await el(r),s=!1;for(let i of e){if(vt.test(i)||o.has(i))continue;let l=a.triage.get(i);!l||!(l.color||de(l)||l.comment||l.fix)||M(a.triage,i,{color:void 0,triage:void 0,comment:void 0,fix:void 0})&&(s=!0)}for(let{id:i,report:l}of t)vt.test(i)||o.has(i)&&n.has(l)||Tt(a.triage,i,l)&&ne(a.triage,i,l,!1)&&(s=!0);s&&await oe()}var tl=1,Kt=16,Ru=12,Bu=1+Kt+Ru+16,jt=1+Kt+Ru;async function Fu(e,t){let r=await crypto.subtle.importKey("raw",G(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 Mu(e){return!(e instanceof Uint8Array)||e.length<Bu?!1:e[0]===tl}async function vs(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(jt+e.length+16);r[0]=tl,crypto.getRandomValues(r.subarray(1,1+Kt)),crypto.getRandomValues(r.subarray(1+Kt,jt));let n=r.subarray(1,1+Kt),o=r.subarray(1+Kt,jt),s=await Fu(t,n),i=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:o,additionalData:r.subarray(0,jt)},s,e));return r.set(i,jt),r}async function ub(e,t){if(typeof t!="string"||!t)throw new TypeError("tryDecryptWithPassword: password required");if(!(e instanceof Uint8Array)||e.length<Bu)return{ok:!1,reason:"malformed"};if(e[0]!==tl)return{ok:!1,reason:"malformed"};let r=e.subarray(1,1+Kt),n=e.subarray(1+Kt,jt),o=e.subarray(jt),s=await Fu(t,r),i;try{i=new Uint8Array(await crypto.subtle.decrypt({name:"AES-GCM",iv:n,additionalData:e.subarray(0,jt)},s,o))}catch{return{ok:!1,reason:"wrong-password"}}return{ok:!0,plaintext:i}}async function ks(e,t,r){if(!r||typeof r.malformedMsg!="string"||typeof r.wrongPasswordMsg!="string")throw new TypeError("decryptWithPasswordOrThrow: { malformedMsg, wrongPasswordMsg } strings required");let n=await ub(e,t);if(n.ok)return n.plaintext;throw n.reason==="wrong-password"?new Error(r.wrongPasswordMsg):new Error(r.malformedMsg)}var Yn=Mu,Lu=vs;function Pu(e,t){return ks(e,t,{malformedMsg:"malformed encrypted bundle",wrongPasswordMsg:"wrong password or corrupt bundle"})}var pb=1;async function fb(e){let t=new Set,r=zt(e);if(!Array.isArray(r?.findings))return t;let n=Wt(r.findings);await Wr(n);for(let o of n)o.id&&t.add(o.id);return t}function Ou(e){return(e??"").replaceAll(/[^a-zA-Z0-9._-]+/gu,"_").replaceAll(/^_+|_+$/gu,"")||"workspace"}async function hb(e){if(!Array.isArray(e)||e.length===0)return[];let t=await lt(),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 pr(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 gb(e,{includeBundleBytes:t=!1}={}){let r=[],n=new Set;for(let u of e.reports??[]){let p;try{p=await Fe(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 Vn(u,null);continue}r.push({name:u,content:p});for(let f of await fb(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=Kn({...p,ignoredReports:f});h&&(s[u]=h)}let i={};for(let u of r){let p=He(u.name);p&&(i[u.name]=p)}let l=(e.bundles??[]).filter(u=>typeof u=="string"&&u.length>0),d={version:pb,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 hb(l);u.length>0&&(d.bundleBlobs=u)}return d}async function Nu(e,{includeBundleBytes:t=!1}={}){let r=await gb(e,{includeBundleBytes:t});return{blob:new Blob([await Yo(JSON.stringify(r))]),filename:`${Ou(e.name)}.deepview-workspace.json.gz`}}async function mb(e,t,{includeBundleBytes:r=!1}={}){if(typeof t!="string"||!t)throw new TypeError("buildWorkspaceExportEncrypted: password required");let{blob:n}=await Nu(e,{includeBundleBytes:r}),o=new Uint8Array(await n.arrayBuffer()),s=await Lu(o,t);return{blob:new Blob([s],{type:"application/octet-stream"}),filename:`${Ou(e.name)}.deepview-workspace.enc`}}async function rl(e,{password:t,includeBundleBytes:r=!1}={}){return typeof t=="string"&&t?await mb(e,t,{includeBundleBytes:r}):await Nu(e,{includeBundleBytes:r})}var bb=1,Du=1024,Uu=1024,$s=200,Vu=100*1024*1024,yb=Math.ceil(Vu*4/3)+16,zu=512,Wu=64;function wb(e){if(!e||typeof e!="object")return"payload is not an object";if(e.version!==bb)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>Uu)return`reports count (${e.reports.length}) exceeds cap (${Uu})`;if(e.bundles!==void 0){if(!Array.isArray(e.bundles))return"bundles field must be an array when present";if(e.bundles.length>Du)return`bundles count (${e.bundles.length}) exceeds cap (${Du})`;for(let t of e.bundles){if(typeof t!="string")return"bundles entries must be strings";if(t.length>$s)return`bundle integrity exceeds per-entry length cap (${$s})`}}if(e.bundleBlobs!==void 0){if(!Array.isArray(e.bundleBlobs))return"bundleBlobs field must be an array when present";if(e.bundleBlobs.length>Wu)return`bundleBlobs count (${e.bundleBlobs.length}) exceeds cap (${Wu})`;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>$s)return`bundleBlobs.integrity exceeds per-entry length cap (${$s})`;if(typeof t.name!="string"||t.name.length===0)return"bundleBlobs.name must be a non-empty string";if(t.name.length>zu)return`bundleBlobs.name exceeds per-entry length cap (${zu})`;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>yb)return`bundleBlobs.data exceeds per-blob size cap (${Vu} bytes raw)`}}return null}async function nl(e){return new Uint8Array(await e.arrayBuffer())}async function xs(e,t){if(Yn(e)){if(typeof t!="string"||!t)throw new TypeError("parseWorkspaceBundleBytes: password required for encrypted bundle");let n=await Pu(e,t);try{return Hu(await bn(n))}catch(o){throw new Error("wrong password or corrupt bundle",{cause:o})}}let r;try{r=await bn(e)}catch(n){throw new Error(`gzip decompression failed: ${n.message}`,{cause:n})}return Hu(r)}function Hu(e){let t;try{t=JSON.parse(e)}catch(o){throw new Error(`payload is not JSON: ${o.message}`,{cause:o})}let r=wb(t);if(r===null)return t;let n=r.includes("exceeds cap");throw new Error(n?r:`not a deepview workspace export: ${r}`)}function vb(e){return de(e)??null}async function kb(e){let t=new Map;for(let r of e??[]){if(typeof r?.content!="string")continue;let n=zt(r.content);if(!n?.findings)continue;let o=Wt(n.findings);await Wr(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:Sa(s.description)})}return t}async function $b(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&&M(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&&M(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&&M(n,s,{fix:h});let b=vb(i),m=de(n.get(s))??null;b&&m&&m!==b?o.push({id:s,property:"triage",local:m,imported:b}):b&&!m&&M(n,s,{triage:b});let y=Array.isArray(i.ignoredReports)?i.ignoredReports:[];if(!de(n.get(s)))for(let $ of y)typeof $=="string"&&ne(n,s,$,!0)}if(o.length>0&&t){let s=await t(o,r??new Map);s&&xb(o,s)}await oe()}function xb(e,t){for(let r of e){let n=`${r.id}:${r.property}`;t[n]==="imported"&&_b(r.id,r.property)===r.local&&(r.property==="color"?M(a.triage,r.id,{color:r.imported}):r.property==="comment"?M(a.triage,r.id,{comment:r.imported}):r.property==="fix"?M(a.triage,r.id,{fix:r.imported}):r.property==="triage"&&M(a.triage,r.id,{triage:r.imported,ignoredReports:void 0}))}}function _b(e,t){if(t==="color")return a.triage.get(e)?.color;if(t==="triage")return de(a.triage.get(e))??null;if(t==="comment")return a.triage.get(e)?.comment??"";if(t==="fix")return a.triage.get(e)?.fix??""}async function Sb(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 ur(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 ol(e,{conflictResolver:t}={}){let r=[];for(let u of e.reports)if(!(typeof u?.name!="string"||typeof u?.content!="string"))try{await at(u.name,u.content);let{count:p,source:f}=Oe(u.content);je(u.name,p,f??Dn(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 Sb(e.bundleBlobs);let o=e.triage&&Object.keys(e.triage).length>0?await kb(e.reports):new Map;await $b(e.triage,t,o);let s=Array.isArray(e.bundles),i=s?e.bundles.filter(u=>typeof u=="string"&&u.length>0):[],l=await $u({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||He(u)||(Ve(u,p),a.currentFile===u&&(a.repoUrl=p));return l}async function sl({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 Un(r)===e?{v:1,n:t,k:r}:{v:1,i:e,n:t,k:r};return(await vs(G(JSON.stringify(s)),n)).toBase64({alphabet:"base64url",omitPadding:!0})}async function il({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 ks(r,t,{malformedMsg:"malformed share link",wrongPasswordMsg:"wrong password or corrupt link"});try{return await Cb(n)}catch(o){throw new Error("wrong password or corrupt link",{cause:o})}}async function Cb(e){let t=JSON.parse(ce(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(Uint8Array.fromBase64(t.k).length!==32)throw new Error("shape");return{id:typeof t.i=="string"?t.i:await Un(t.k),name:t.n,privateKeyBase64:t.k}}function al(e){return typeof location>"u"?`#share=${e}`:`${location.origin}${location.pathname}#share=${e}`}function ll(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 Eb={get state(){return a},listWorkspaces:z,addReportToWorkspace:At,addBundleToWorkspace:gr,onReportMembershipChanged:Ta,onBundleMembershipChanged:Ia,onWorkspaceDeleted:Ea,onWorkspacePrivateKeyChanged:Aa,analyzeContent:Oe,setCount:je,gunzipBytes:ht,listBundles:lt,listFiles:le,readBundle:pr,saveBundle:ur,saveFileBytes:In,saveTriage:oe,getSecureItem:he,setSecureItem:ve,removeSecureItem:Mr,onSecureStorageHydrated:Fr};function ju(e){e.installSyncHost(Eb),Cu(()=>e.triageSync.notify())}var N=null,Jn=null;function Yu(){try{return he("deepview.sync.userEnabled")!=="0"}catch{return!0}}function cl(){return Jn||(Jn=(async()=>{let e="./client-sync.js";try{let t=await import(e);return ju(t),N=t,Ab(),t}catch(t){throw Jn=null,t}})(),Jn)}function Ju(){return cl()}var Xu=[];function Qn(e){N?e(N):Xu.push(e)}function Ab(){let e=Xu.splice(0);for(let t of e)try{t(N)}catch(r){console.warn("client-sync: deferred apply failed:",r)}}function Xn(e,t){let r={cancelled:!1,unsub:null};return Qn(n=>{r.cancelled||(r.unsub=t(n,e))}),()=>{r.cancelled=!0,r.unsub&&r.unsub()}}function dl(e,t){return N?N.isInRemote(e,t):!1}function Qu(e,t){return N?N.isBundleInRemote(e,t):!1}var Tb="deepview.objstore-presence.";function Zu(e){try{let t=localStorage.getItem(Tb+e);if(!t)return null;let r=JSON.parse(t);return r&&typeof r=="object"?r:null}catch{return null}}function Zn(e,t){if(N&&N.isInRemote(e,t))return!0;let r=Zu(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 ul(e,t){if(N&&N.isBundleInRemote(e,t))return!0;let r=Zu(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 ep(e){return N?N.remoteCount(e):0}function tp(e,t){return N?N.remoteBundleName(e,t):null}function rp(e){return Xn(e,(t,r)=>t.onAutoDownloaded(r))}function np(e){return Xn(e,(t,r)=>t.onBundleAutoDownloaded(r))}function op(e){return Xn(e,(t,r)=>t.onChange(r))}var Ku=null,qu=null,Gu=null,_s=[];function sp(e){if(N){N.setRedraw(e);return}Ku=e,Qn(t=>{Ku===e&&t.setRedraw(e)})}function ip(e){if(N){N.setAuthenticationResolver(e);return}qu=e,Qn(t=>{qu===e&&t.setAuthenticationResolver(e)})}function ap(e){if(N){N.setHydrationConflictResolver(e);return}Gu=e,Qn(t=>{Gu===e&&t.setHydrationConflictResolver(e)})}async function kt(e,t){if(!(!Yu()&&!N))return(await cl())[e](...t)}function lp(...e){return kt("fetchFile",e)}function cp(...e){return kt("fetchBundleFromRemote",e)}function Ss(...e){return kt("putFile",e)}function dp(...e){return kt("putBundleToRemote",e)}function Cs(...e){return kt("deleteFromRemote",e)}function Es(...e){return kt("deleteBundleFromRemote",e)}function As(...e){return kt("openWorkspace",e)}function eo(...e){return kt("closeWorkspace",e)}function up(...e){return kt("discoverRemoteFileNames",e)}function pp(...e){return kt("discoverRemoteBundleIntegrities",e)}function qt(e,t){if(N)return N.triageSync[e](...t);Qn(r=>{r.triageSync[e](...t)})}var D={get status(){return N?N.triageSync.status:"off"},get openSessions(){return N?N.triageSync.openSessions:[]},get persistenceDegraded(){return N?N.triageSync.persistenceDegraded:!1},setEnabled(e){if(e===!0)return cl().then(t=>{t.triageSync.setEnabled(!0);let r=_s;_s=[];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(N){_s=N.openWorkspaceIds();for(let t of _s)try{N.closeWorkspace(t)}catch(r){console.warn(`client-sync: closeWorkspace(${t}) failed during disable:`,r)}N.triageSync.setEnabled(!1);return}qt("setEnabled",[e])},isEnabled(){return N?N.triageSync.isEnabled():Yu()},openSession(e){qt("openSession",[e])},closeSession(e){qt("closeSession",[e])},refreshSession(e){qt("refreshSession",[e])},dismissError(e){qt("dismissError",[e])},setForcedOff(e){qt("setForcedOff",[e])},setServerUrl(e){qt("setServerUrl",[e])},getServerUrl(){return N?N.triageSync.getServerUrl():null},notify(){qt("notify",[])},onStatusChange(e){return Xn(e,(t,r)=>t.triageSync.onStatusChange(r))},onPersistenceDegraded(e){return Xn(e,(t,r)=>t.triageSync.onPersistenceDegraded(r))}};var to=class extends Je{constructor(t){if(super(t),this.it=g,t.type!==Be.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===ae)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:[]}}};to.directiveName="unsafeHTML",to.resultType=1;var ue=pt(to);var fp=`*,*: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) #sync-status .sync-label{display:none}:host(.collapsed) #sync-status{padding:.25rem;border:0}.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{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-degraded] .sync-dot{box-shadow:0 0 0 2px var(--medium)}#sync-status[hidden]{display:none}
17
- `;var hp=`.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}}
18
- `;var gp=`*,*: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}}
19
- `;var I=class extends H{static styles=[T(gp)];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 q(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 Qe=`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}
20
- `;var pl=class extends I{static styles=[...I.styles,T(Qe)];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=xn(),this._vaultStateUnsub=ge(()=>{if(this._settled)return;let t=xn();this._orphan&&!t&&X()?(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(X()){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 Cn({refuseIfEnabled:!0}),location.reload()}catch(t){this._error=`Could not clear previous vault state: ${t?.message??t}`,this._phase=""}finally{this._busy=!1,this._canCancel=!0}}};_onEnable=async()=>{if(!this._busy){if(!mt()){this._error="Passkeys are not supported in this browser.";return}this._busy=!0,this._canCancel=!0,this._error="",this._phase="Registering passkey\u2026",this._abortController=new AbortController;try{await qi({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 zi({seal:r}),this._phase="Encrypting triage data\u2026",await qa({seal:r}),this._phase="Encrypting report files\u2026",await aa({seal:r}),this._phase="Encrypting bundles\u2026",await ca({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=mt();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",pl);function Ts(){return q("passkey-setup-dialog")}var fl=class extends I{static styles=[...I.styles,T(Qe)];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 Sn({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",fl);function Is(){return q("passkey-unlock-dialog")}var mp=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>`,Mb=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>`,$e=null;function bp(){if(!$e)return;if(!mt()){$e.hidden=!0;return}$e.hidden=!1;let e=X(),t=st();$e.classList.toggle("encrypted",e&&t),$e.classList.toggle("locked-pending",e&&!t),e&&t?($e.title="Encryption on \u2014 click to disable",$e.setAttribute("aria-label","Disable encryption"),W(mp,$e)):e?($e.title="Encryption on, locked \u2014 click to unlock",$e.setAttribute("aria-label","Unlock encrypted data"),W(mp,$e)):($e.title="Encryption off \u2014 click to enable",$e.setAttribute("aria-label","Enable encryption"),W(Mb,$e))}async function Lb(){if(confirm(`Disable encryption?
1
+ var p8=Object.defineProperty;var w=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var kg=(e,t)=>{for(var r in t)p8(e,r,{get:t[r],enumerable:!0})};var Hu,ju,xg,N$,Xl,A,Me,D$,$g,_g=w(()=>{Hu=globalThis,ju=Hu.ShadowRoot&&(Hu.ShadyCSS===void 0||Hu.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,xg=Symbol(),N$=new WeakMap,Xl=class{constructor(t,r,n){if(this._$cssResult$=!0,n!==xg)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(ju&&t===void 0){let n=r!==void 0&&r.length===1;n&&(t=N$.get(r)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&N$.set(r,t))}return t}toString(){return this.cssText}},A=e=>new Xl(typeof e=="string"?e:e+"",void 0,xg),Me=(e,...t)=>{let r=e.length===1?e[0]:t.reduce((n,o,i)=>n+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+e[i+1],e[0]);return new Xl(r,e,xg)},D$=(e,t)=>{if(ju)e.adoptedStyleSheets=t.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet);else for(let r of t){let n=document.createElement("style"),o=Hu.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=r.cssText,e.appendChild(n)}},$g=ju?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let r="";for(let n of t.cssRules)r+=n.cssText;return A(r)})(e):e});var f8,h8,m8,g8,b8,y8,Vu,z$,v8,w8,Jl,Sg,H$,U$,Wn,Wu=w(()=>{_g();_g();({is:f8,defineProperty:h8,getOwnPropertyDescriptor:m8,getOwnPropertyNames:g8,getOwnPropertySymbols:b8,getPrototypeOf:y8}=Object),Vu=globalThis,z$=Vu.trustedTypes,v8=z$?z$.emptyScript:"",w8=Vu.reactiveElementPolyfillSupport,Jl=(e,t)=>e,Sg={toAttribute(e,t){switch(t){case Boolean:e=e?v8: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}},H$=(e,t)=>!f8(e,t),U$={attribute:!0,type:String,converter:Sg,reflect:!1,useDefault:!1,hasChanged:H$};Symbol.metadata??=Symbol("metadata"),Vu.litPropertyMetadata??=new WeakMap;Wn=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=U$){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&&h8(this.prototype,t,o)}}static getPropertyDescriptor(t,r,n){let{get:o,set:i}=m8(this.prototype,t)??{get(){return this[r]},set(s){this[r]=s}};return{get:o,set(s){let a=o?.call(this);i?.call(this,s),this.requestUpdate(t,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??U$}static _$Ei(){if(this.hasOwnProperty(Jl("elementProperties")))return;let t=y8(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Jl("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Jl("properties"))){let r=this.properties,n=[...g8(r),...b8(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($g(o))}else t!==void 0&&r.push($g(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 D$(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 i=(n.converter?.toAttribute!==void 0?n.converter:Sg).toAttribute(r,n.type);this._$Em=t,i==null?this.removeAttribute(o):this.setAttribute(o,i),this._$Em=null}}_$AK(t,r){let n=this.constructor,o=n._$Eh.get(t);if(o!==void 0&&this._$Em!==o){let i=n.getPropertyOptions(o),s=typeof i.converter=="function"?{fromAttribute:i.converter}:i.converter?.fromAttribute!==void 0?i.converter:Sg;this._$Em=o;let a=s.fromAttribute(r,i.type);this[o]=a??this._$Ej?.get(o)??a,this._$Em=null}}requestUpdate(t,r,n,o=!1,i){if(t!==void 0){let s=this.constructor;if(o===!1&&(i=this[t]),n??=s.getPropertyOptions(t),!((n.hasChanged??H$)(i,r)||n.useDefault&&n.reflect&&i===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,n))))return;this.C(t,r,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,r,{useDefault:n,reflect:o,wrapped:i},s){n&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,s??r??this[t]),i!==!0||s!==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,i]of this._$Ep)this[o]=i;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[o,i]of n){let{wrapped:s}=i,a=this[o];s!==!0||this._$AL.has(o)||a===void 0||this.C(o,void 0,i,a)}}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){}};Wn.elementStyles=[],Wn.shadowRootOptions={mode:"open"},Wn[Jl("elementProperties")]=new Map,Wn[Jl("finalized")]=new Map,w8?.({ReactiveElement:Wn}),(Vu.reactiveElementVersions??=[]).push("2.1.2")});function Z$(e,t){if(!Ag(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return V$!==void 0?V$.createHTML(t):t}function Hi(e,t,r=e,n){if(t===Xe)return t;let o=n!==void 0?r._$Co?.[n]:r._$Cl,i=ec(t)?void 0:t._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),i===void 0?o=void 0:(o=new i(e),o._$AT(e,r,n)),n!==void 0?(r._$Co??=[])[n]=o:r._$Cl=o),o!==void 0&&(t=Hi(e,o._$AS(e,t.values),o,n)),t}var Eg,j$,Ku,V$,Rg,Kn,Mg,k8,Ui,Ql,ec,Ag,X$,Cg,Zl,W$,K$,Di,G$,q$,J$,Tg,d,To,Aj,Xe,m,Y$,zi,Q$,tc,Gu,na,ji,qu,Yu,Xu,Ju,e_,x8,se,Ur=w(()=>{Eg=globalThis,j$=e=>e,Ku=Eg.trustedTypes,V$=Ku?Ku.createPolicy("lit-html",{createHTML:e=>e}):void 0,Rg="$lit$",Kn=`lit$${Math.random().toFixed(9).slice(2)}$`,Mg="?"+Kn,k8=`<${Mg}>`,Ui=document,Ql=()=>Ui.createComment(""),ec=e=>e===null||typeof e!="object"&&typeof e!="function",Ag=Array.isArray,X$=e=>Ag(e)||typeof e?.[Symbol.iterator]=="function",Cg=`[
2
+ \f\r]`,Zl=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,W$=/-->/g,K$=/>/g,Di=RegExp(`>|${Cg}(?:([^\\s"'>=/]+)(${Cg}*=${Cg}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),G$=/'/g,q$=/"/g,J$=/^(?:script|style|textarea|title)$/i,Tg=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),d=Tg(1),To=Tg(2),Aj=Tg(3),Xe=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),Y$=new WeakMap,zi=Ui.createTreeWalker(Ui,129);Q$=(e,t)=>{let r=e.length-1,n=[],o,i=t===2?"<svg>":t===3?"<math>":"",s=Zl;for(let a=0;a<r;a++){let c=e[a],u,p,f=-1,h=0;for(;h<c.length&&(s.lastIndex=h,p=s.exec(c),p!==null);)h=s.lastIndex,s===Zl?p[1]==="!--"?s=W$:p[1]!==void 0?s=K$:p[2]!==void 0?(J$.test(p[2])&&(o=RegExp("</"+p[2],"g")),s=Di):p[3]!==void 0&&(s=Di):s===Di?p[0]===">"?(s=o??Zl,f=-1):p[1]===void 0?f=-2:(f=s.lastIndex-p[2].length,u=p[1],s=p[3]===void 0?Di:p[3]==='"'?q$:G$):s===q$||s===G$?s=Di:s===W$||s===K$?s=Zl:(s=Di,o=void 0);let g=s===Di&&e[a+1].startsWith("/>")?" ":"";i+=s===Zl?c+k8:f>=0?(n.push(u),c.slice(0,f)+Rg+c.slice(f)+Kn+g):c+Kn+(f===-2?a:g)}return[Z$(e,i+(e[r]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),n]},tc=class e{constructor({strings:t,_$litType$:r},n){let o;this.parts=[];let i=0,s=0,a=t.length-1,c=this.parts,[u,p]=Q$(t,r);if(this.el=e.createElement(u,n),zi.currentNode=this.el.content,r===2||r===3){let f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(o=zi.nextNode())!==null&&c.length<a;){if(o.nodeType===1){if(o.hasAttributes())for(let f of o.getAttributeNames())if(f.endsWith(Rg)){let h=p[s++],g=o.getAttribute(f).split(Kn),b=/([.?@])?(.*)/.exec(h);c.push({type:1,index:i,name:b[2],strings:g,ctor:b[1]==="."?qu:b[1]==="?"?Yu:b[1]==="@"?Xu:ji}),o.removeAttribute(f)}else f.startsWith(Kn)&&(c.push({type:6,index:i}),o.removeAttribute(f));if(J$.test(o.tagName)){let f=o.textContent.split(Kn),h=f.length-1;if(h>0){o.textContent=Ku?Ku.emptyScript:"";for(let g=0;g<h;g++)o.append(f[g],Ql()),zi.nextNode(),c.push({type:2,index:++i});o.append(f[h],Ql())}}}else if(o.nodeType===8)if(o.data===Mg)c.push({type:2,index:i});else{let f=-1;for(;(f=o.data.indexOf(Kn,f+1))!==-1;)c.push({type:7,index:i}),f+=Kn.length-1}i++}}static createElement(t,r){let n=Ui.createElement("template");return n.innerHTML=t,n}};Gu=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??Ui).importNode(r,!0);zi.currentNode=o;let i=zi.nextNode(),s=0,a=0,c=n[0];for(;c!==void 0;){if(s===c.index){let u;c.type===2?u=new na(i,i.nextSibling,this,t):c.type===1?u=new c.ctor(i,c.name,c.strings,this,t):c.type===6&&(u=new Ju(i,this,t)),this._$AV.push(u),c=n[++a]}s!==c?.index&&(i=zi.nextNode(),s++)}return zi.currentNode=Ui,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++}},na=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,r,n,o){this.type=2,this._$AH=m,this._$AN=void 0,this._$AA=t,this._$AB=r,this._$AM=n,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,r=this._$AM;return r!==void 0&&t?.nodeType===11&&(t=r.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,r=this){t=Hi(this,t,r),ec(t)?t===m||t==null||t===""?(this._$AH!==m&&this._$AR(),this._$AH=m):t!==this._$AH&&t!==Xe&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):X$(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==m&&ec(this._$AH)?this._$AA.nextSibling.data=t:this.T(Ui.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=tc.createElement(Z$(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===o)this._$AH.p(r);else{let i=new Gu(o,this),s=i.u(this.options);i.p(r),this.T(s),this._$AH=i}}_$AC(t){let r=Y$.get(t.strings);return r===void 0&&Y$.set(t.strings,r=new tc(t)),r}k(t){Ag(this._$AH)||(this._$AH=[],this._$AR());let r=this._$AH,n,o=0;for(let i of t)o===r.length?r.push(n=new e(this.O(Ql()),this.O(Ql()),this,this.options)):n=r[o],n._$AI(i),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=j$(t).nextSibling;j$(t).remove(),t=n}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},ji=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,r,n,o,i){this.type=1,this._$AH=m,this._$AN=void 0,this.element=t,this.name=r,this._$AM=o,this.options=i,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=m}_$AI(t,r=this,n,o){let i=this.strings,s=!1;if(i===void 0)t=Hi(this,t,r,0),s=!ec(t)||t!==this._$AH&&t!==Xe,s&&(this._$AH=t);else{let a=t,c,u;for(t=i[0],c=0;c<i.length-1;c++)u=Hi(this,a[n+c],r,c),u===Xe&&(u=this._$AH[c]),s||=!ec(u)||u!==this._$AH[c],u===m?t=m:t!==m&&(t+=(u??"")+i[c+1]),this._$AH[c]=u}s&&!o&&this.j(t)}j(t){t===m?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},qu=class extends ji{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===m?void 0:t}},Yu=class extends ji{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==m)}},Xu=class extends ji{constructor(t,r,n,o,i){super(t,r,n,o,i),this.type=5}_$AI(t,r=this){if((t=Hi(this,t,r,0)??m)===Xe)return;let n=this._$AH,o=t===m&&n!==m||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,i=t!==m&&(n===m||o);o&&this.element.removeEventListener(this.name,this,n),i&&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)}},Ju=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){Hi(this,t)}},e_={M:Rg,P:Kn,A:Mg,C:1,L:Q$,R:Gu,D:X$,V:Hi,I:na,H:ji,N:Yu,U:Xu,B:qu,F:Ju},x8=Eg.litHtmlPolyfillSupport;x8?.(tc,na),(Eg.litHtmlVersions??=[]).push("3.3.3");se=(e,t,r)=>{let n=r?.renderBefore??t,o=n._$litPart$;if(o===void 0){let i=r?.renderBefore??null;n._$litPart$=o=new na(t.insertBefore(Ql(),i),i,void 0,r??{})}return o._$AI(e),o}});var Ig,X,$8,t_=w(()=>{Wu();Wu();Ur();Ur();Ig=globalThis,X=class extends Wn{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=se(r,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Xe}};X._$litElement$=!0,X.finalized=!0,Ig.litElementHydrateSupport?.({LitElement:X});$8=Ig.litElementPolyfillSupport;$8?.({LitElement:X});(Ig.litElementVersions??=[]).push("4.2.2")});var r_=w(()=>{});var T=w(()=>{Wu();Ur();t_();r_()});var Rt,kr,Gt,Vi=w(()=>{Rt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},kr=e=>(...t)=>({_$litDirective$:e,values:t}),Gt=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 N,n_=w(()=>{Ur();Vi();N=kr(class extends Gt{constructor(e){if(super(e),e.type!==Rt.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 Xe}})});var Ne=w(()=>{n_()});var _8,o_,s_,i_,oa,Io,S8,ia,a_,Zu,Qu=w(()=>{Ur();({I:_8}=e_),o_=e=>e,s_=e=>e.strings===void 0,i_=()=>document.createComment(""),oa=(e,t,r)=>{let n=e._$AA.parentNode,o=t===void 0?e._$AB:t._$AA;if(r===void 0){let i=n.insertBefore(i_(),o),s=n.insertBefore(i_(),o);r=new _8(i,s,e,e.options)}else{let i=r._$AB.nextSibling,s=r._$AM,a=s!==e;if(a){let c;r._$AQ?.(e),r._$AM=e,r._$AP!==void 0&&(c=e._$AU)!==s._$AU&&r._$AP(c)}if(i!==o||a){let c=r._$AA;for(;c!==i;){let u=o_(c).nextSibling;o_(n).insertBefore(c,o),c=u}}}return r},Io=(e,t,r=e)=>(e._$AI(t,r),e),S8={},ia=(e,t=S8)=>e._$AH=t,a_=e=>e._$AH,Zu=e=>{e._$AR(),e._$AA.remove()}});var l_,re,c_=w(()=>{Ur();Vi();Qu();l_=(e,t,r)=>{let n=new Map;for(let o=t;o<=r;o++)n.set(e[o],o);return n},re=kr(class extends Gt{constructor(e){if(super(e),e.type!==Rt.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=[],i=[],s=0;for(let a of e)o[s]=n?n(a,s):s,i[s]=r(a,s),s++;return{values:i,keys:o}}render(e,t,r){return this.dt(e,t,r).values}update(e,[t,r,n]){let o=a_(e),{values:i,keys:s}=this.dt(t,r,n);if(!Array.isArray(o))return this.ut=s,i;let a=this.ut??=[],c=[],u,p,f=0,h=o.length-1,g=0,b=i.length-1;for(;f<=h&&g<=b;)if(o[f]===null)f++;else if(o[h]===null)h--;else if(a[f]===s[g])c[g]=Io(o[f],i[g]),f++,g++;else if(a[h]===s[b])c[b]=Io(o[h],i[b]),h--,b--;else if(a[f]===s[b])c[b]=Io(o[f],i[b]),oa(e,c[b+1],o[f]),f++,b--;else if(a[h]===s[g])c[g]=Io(o[h],i[g]),oa(e,o[f],o[h]),h--,g++;else if(u===void 0&&(u=l_(s,g,b),p=l_(a,f,h)),u.has(a[f]))if(u.has(a[h])){let y=p.get(s[g]),k=y!==void 0?o[y]:null;if(k===null){let v=oa(e,o[f]);Io(v,i[g]),c[g]=v}else c[g]=Io(k,i[g]),oa(e,o[f],k),o[y]=null;g++}else Zu(o[h]),h--;else Zu(o[f]),f++;for(;g<=b;){let y=oa(e,c[b+1]);Io(y,i[g]),c[g++]=y}for(;f<=h;){let y=o[f++];y!==null&&Zu(y)}return this.ut=s,ia(e,c),Xe}})});var Mt=w(()=>{c_()});var d_,C8,Se,u_=w(()=>{Ur();Vi();d_="important",C8=" !"+d_,Se=kr(class extends Gt{constructor(e){if(super(e),e.type!==Rt.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 i=typeof o=="string"&&o.endsWith(C8);n.includes("-")||i?r.setProperty(n,i?o.slice(0,-11):o,i?d_:""):r[n]=o}}return Xe}})});var Gn=w(()=>{u_()});function E8(e){Og.set(e,new Map)}function R8(e,{target:t,key:r,type:n}){n==="iterate"&&(r=m_);let o=Og.get(t),i=o.get(r);i||(i=new Set,o.set(r,i)),i.has(e)||(i.add(e),e.cleaners.push(i))}function M8({target:e,key:t,type:r}){let n=Og.get(e),o=new Set;if(r==="clear"?n.forEach((i,s)=>{Lg(o,n,s)}):Lg(o,n,t),r==="add"||r==="delete"||r==="clear"){let i=Array.isArray(e)?"length":m_;Lg(o,n,i)}return o}function Lg(e,t,r){let n=t.get(r);n&&n.forEach(e.add,e)}function g_(e){e.cleaners&&e.cleaners.forEach(A8,e),e.cleaners=[]}function A8(e){e.delete(this)}function T8(e,t,r,n){if(e.unobserved)return Reflect.apply(t,r,n);if(sa.indexOf(e)===-1){g_(e);try{return sa.push(e),Reflect.apply(t,r,n)}finally{sa.pop()}}}function Hr(e){let t=sa[sa.length-1];t&&(b_(t,e),R8(t,e))}function Lo(e){M8(e).forEach(I8,e)}function I8(e){b_(e,this),typeof e.scheduler=="function"?e.scheduler(e):typeof e.scheduler=="object"?e.scheduler.add(e):e()}function b_(e,t){if(e.debugger&&!Fg)try{Fg=!0,e.debugger(t)}finally{Fg=!1}}function y_(){return sa.length>0}function v_(e,t={}){let r=e[p_]?e:function n(){return T8(n,e,this,arguments)};return r.scheduler=t.scheduler,r.debugger=t.debugger,r[p_]=!0,t.lazy||r(),r}function Pg(e){e.unobserved||(e.unobserved=!0,g_(e)),typeof e.scheduler=="object"&&e.scheduler.delete(e)}function tp(e){let t=rp.get(e);return y_()&&typeof e=="object"&&e!==null?t||np(e):t||e}function Bg(e,t){let r=e.next;return e.next=()=>{let{done:n,value:o}=r.call(e);return n||(t?o[1]=tp(o[1]):o=tp(o)),{done:n,value:o}},e}function F8({constructor:e}){return!(typeof e=="function"&&e.name in h_&&h_[e.name]===e)||w_.has(e)}function B8(e){return w_.get(e.constructor)}function P8(e,t,r){let n=Reflect.get(e,t,r);if(typeof t=="symbol"&&O8.has(t))return n;Hr({target:e,key:t,receiver:r,type:"get"});let o=rp.get(n);if(y_()&&typeof n=="object"&&n!==null){if(o)return o;let i=Reflect.getOwnPropertyDescriptor(e,t);if(!i||!(i.writable===!1&&i.configurable===!1))return np(n)}return o||n}function N8(e,t){let r=Reflect.has(e,t);return Hr({target:e,key:t,type:"has"}),r}function D8(e){return Hr({target:e,type:"iterate"}),Reflect.ownKeys(e)}function z8(e,t,r,n){typeof r=="object"&&r!==null&&(r=kt.get(r)||r);let o=k_.call(e,t),i=e[t],s=Reflect.set(e,t,r,n);return e!==kt.get(n)||(o?r!==i&&Lo({target:e,key:t,value:r,oldValue:i,receiver:n,type:"set"}):Lo({target:e,key:t,value:r,receiver:n,type:"add"})),s}function U8(e,t){let r=k_.call(e,t),n=e[t],o=Reflect.deleteProperty(e,t);return r&&Lo({target:e,key:t,oldValue:n,type:"delete"}),o}function np(e={}){return kt.has(e)||!F8(e)?e:rp.get(e)||j8(e)}function j8(e){let t=B8(e)||H8,r=new Proxy(e,t);return rp.set(e,r),kt.set(r,e),E8(e),r}var Og,m_,sa,Fg,p_,kt,rp,L8,f_,ep,h_,w_,k_,O8,H8,x_=w(()=>{Og=new WeakMap,m_=Symbol("iteration key");sa=[],Fg=!1;p_=Symbol("is reaction");kt=new WeakMap,rp=new WeakMap,L8=Object.prototype.hasOwnProperty;f_={has(e){let t=kt.get(this),r=Reflect.getPrototypeOf(this);return Hr({target:t,key:e,type:"has"}),r.has.apply(t,arguments)},get(e){let t=kt.get(this),r=Reflect.getPrototypeOf(this);return Hr({target:t,key:e,type:"get"}),tp(r.get.apply(t,arguments))},add(e){let t=kt.get(this),r=Reflect.getPrototypeOf(this),n=r.has.call(t,e),o=r.add.apply(t,arguments);return n||Lo({target:t,key:e,value:e,type:"add"}),o},set(e,t){let r=kt.get(this),n=Reflect.getPrototypeOf(this),o=n.has.call(r,e),i=n.get.call(r,e),s=n.set.apply(r,arguments);return o?t!==i&&Lo({target:r,key:e,value:t,oldValue:i,type:"set"}):Lo({target:r,key:e,value:t,type:"add"}),s},delete(e){let t=kt.get(this),r=Reflect.getPrototypeOf(this),n=r.has.call(t,e),o=r.get?r.get.call(t,e):void 0,i=r.delete.apply(t,arguments);return n&&Lo({target:t,key:e,oldValue:o,type:"delete"}),i},clear(){let e=kt.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&&Lo({target:e,oldTarget:n,type:"clear"}),o},forEach(e,...t){let r=kt.get(this),n=Reflect.getPrototypeOf(this);Hr({target:r,type:"iterate"});let o=(i,...s)=>e(tp(i),...s);return n.forEach.call(r,o,...t)},keys(){let e=kt.get(this),t=Reflect.getPrototypeOf(this);return Hr({target:e,type:"iterate"}),t.keys.apply(e,arguments)},values(){let e=kt.get(this),t=Reflect.getPrototypeOf(this);Hr({target:e,type:"iterate"});let r=t.values.apply(e,arguments);return Bg(r,!1)},entries(){let e=kt.get(this),t=Reflect.getPrototypeOf(this);Hr({target:e,type:"iterate"});let r=t.entries.apply(e,arguments);return Bg(r,!0)},[Symbol.iterator](){let e=kt.get(this),t=Reflect.getPrototypeOf(this);Hr({target:e,type:"iterate"});let r=t[Symbol.iterator].apply(e,arguments);return Bg(r,e instanceof Map)},get size(){let e=kt.get(this),t=Reflect.getPrototypeOf(this);return Hr({target:e,type:"iterate"}),Reflect.get(t,"size",e)}},ep={get(e,t,r){return e=L8.call(f_,t)?f_:e,Reflect.get(e,t,r)}},h_=typeof window=="object"?window:Function("return this")(),w_=new Map([[Map,ep],[Set,ep],[WeakMap,ep],[WeakSet,ep],[Object,!1],[Array,!1],[Int8Array,!1],[Uint8Array,!1],[Uint8ClampedArray,!1],[Int16Array,!1],[Uint16Array,!1],[Int32Array,!1],[Uint32Array,!1],[Float32Array,!1],[Float64Array,!1]]);k_=Object.prototype.hasOwnProperty,O8=new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(e=>typeof e=="symbol"));H8={get:P8,has:N8,ownKeys:D8,set:z8,deleteProperty:U8}});function Ng(e){let t=!0,r=v_(()=>{try{e(t)}finally{t=!1}},{lazy:!0});try{r()}catch(n){throw Pg(r),n}return()=>Pg(r)}var Wi,rc=w(()=>{x_();Wi=np});var $_=w(()=>{});var __=w(()=>{$_()});var G,Ce=w(()=>{T();rc();T();Mt();__();G=class extends X{_disposers=[];observes=null;connectedCallback(){super.connectedCallback(),this.bindState()}bindState(){if(this.observes){this._disposers.push(Ng(t=>{this.observes(),t||this.requestUpdate()}));return}this._render||(this._render=this.render,this.render=()=>{let t,r=Ng(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()()}}});function qn(e,t){let r=URL.createObjectURL(e),n=document.createElement("span");n.style.display="none",se(d`<a href="${r}" download="${t}"></a>`,n),document.body.append(n),n.firstElementChild.click(),n.remove(),URL.revokeObjectURL(r)}function aa(e){return new Error("Another dialog is already open. Close it and try again.",{cause:e})}var Ge,P,S_,or=w(()=>{"use strict";T();Ge=document.querySelector("#drop-zone"),P=document.querySelector("#report"),S_=document.querySelector("app-sidebar")});function ve(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 C_.encode(e)}function Ki(e){if(typeof e!="string")throw new TypeError(`utf8ByteLength expects a string, got ${typeof e}`);if(/[\u0100-\uFFFF]/.test(e))return C_.encode(e).byteLength;let t=/[\u0080-\u00FF]/gu,r=e.length;for(;t.test(e);){let n=t.lastIndex-1;for(let o=0;n<e.length&&o<W8;n++)e.codePointAt(n)>127?(r++,o=0):o++;t.lastIndex=n}return r}function it(e){if(!ArrayBuffer.isView(e)&&!(e instanceof ArrayBuffer))throw new TypeError(`decodeUtf8 expects a BufferSource, got ${e===null?"null":typeof e}`);return V8.decode(e)}var C_,V8,W8,At=w(()=>{"use strict";C_=new TextEncoder,V8=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});W8=2});function nc(){return!(typeof window>"u"||typeof PublicKeyCredential>"u"||typeof navigator>"u"||!navigator.credentials)}async function E_(){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 op(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),t}async function Dg(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:ve(G8)},t,K8*8);return new Uint8Array(r)}function zg(e){return crypto.subtle.importKey("raw",e,{name:"AES-GCM"},!1,["encrypt","decrypt"])}async function Fo(e,t,r){let n=op(la),o=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:n,additionalData:r},e,t)),i=new Uint8Array(jr.length+la+o.length);return i.set(jr,0),i.set(n,jr.length),i.set(o,jr.length+la),i}async function Gi(e,t,r){if(!Tt(t))throw new Error("passkey: missing envelope magic");if(t.length<jr.length+la+16)throw new Error("passkey: envelope too short");let n=t.subarray(jr.length,jr.length+la),o=t.subarray(jr.length+la);return new Uint8Array(await crypto.subtle.decrypt({name:"AES-GCM",iv:n,additionalData:r},e,o))}function Tt(e){if(e.length<jr.length)return!1;for(let t=0;t<jr.length;t++)if(e[t]!==jr[t])return!1;return!0}async function R_(e){if(!nc())throw new Error("passkey: not supported in this environment");let t=op(32),r=op(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}),i=n.getClientExtensionResults().prf,s=i?.results?.first?new Uint8Array(i.results.first):null;return{credentialId:o,prfSalt:r.toBase64({alphabet:"base64url",omitPadding:!0}),prfOutput:s}}async function Ug(e){if(!nc())throw new Error("passkey: not supported in this environment");let t=op(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 s=o.getClientExtensionResults().prf?.results?.first;if(!s)throw new Error("passkey: authenticator did not return PRF output (extension unsupported)");return new Uint8Array(s)}var jr,la,K8,G8,Hg=w(()=>{"use strict";At();jr=new Uint8Array([68,86,69,49]),la=12,K8=32,G8="deepview-passkey.v1.content-key"});function Wg(){return ic>0}function M_(){return jg>0}function qi(){try{let e=localStorage.getItem(sc);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 A_(e){localStorage.setItem(sc,JSON.stringify(e))}function J8(){localStorage.removeItem(sc)}function Z8(){try{let t=localStorage.getItem(ca);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(ca,e.toBase64({alphabet:"base64url",omitPadding:!0}))}catch{}return e}function ap(){return typeof location>"u"?"":location.hostname}function fe(){return qi()!==null}function qt(){return Be!==null}function pn(){return!(!nc()||typeof navigator>"u"||!navigator.locks?.request||!ap())}function T_(){return dn}function ac(){if(qi()!==null)return!1;try{return localStorage.getItem(sp)==="1"?!1:localStorage.getItem(ca)!==null}catch{return!1}}function dt(){return Be}function lc(){return ve(q8+(dn??""))}function lp(e){if(typeof e!="string")throw new TypeError("passkey vault: OPFS AAD requires a filename string");return ve(Y8+(dn??"")+"|"+e)}function cp(e){if(typeof e!="string")throw new TypeError("passkey vault: bundle AAD requires a slot string");return ve(X8+(dn??"")+"|"+e)}function Je(e){return Vg.add(e),()=>Vg.delete(e)}function da(){for(let e of Vg)try{e()}catch(t){console.warn("passkey vault listener:",t)}}async function Yi({signal:e}={}){let t=qi();if(!t)return!1;let r;try{r=await Ug({credentialId:t.credentialId,prfSalt:t.prfSalt,rpId:t.rpId??ap(),...e?{signal:e}:{}})}catch(o){if(o&&o.name==="NotAllowedError"||o&&o.name==="AbortError")return!1;throw o&&o.message?.includes("PRF")?oc(o):o}if(!r||r.length<32)throw oc();let n=await Dg(r);return r.fill(0),navigator.locks.request(un,async()=>{let o=qi();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 Be=await zg(n),n.fill(0),dn=o.userId,Bo=o.credentialId,da(),!0})}function oc(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 Kg({migrate:e,userName:t,rpName:r,signal:n,acknowledgeOrphan:o}){if(!nc())throw new Error("passkey: WebAuthn unavailable in this environment");if(ac()&&!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 i=ap();return navigator.locks.request(un,async()=>{if(fe())throw new Error("passkey: encryption is already enabled");if(await E_()===!1)throw oc();let a=Z8(),c=await R_({userName:t||"DeepView user",userId:a,rpName:r||"DeepView",rpId:i,...n?{signal:n}:{}}),u=c.prfOutput;if(!u)try{u=await Ug({credentialId:c.credentialId,prfSalt:c.prfSalt,rpId:i,...n?{signal:n}:{}})}catch(b){let y=a.toBase64({alphabet:"base64url",omitPadding:!0});await ip({credentialId:c.credentialId,rpId:i,userId:y}).catch(()=>{});try{localStorage.removeItem(ca)}catch{}throw b&&b.message?.includes("PRF")?oc(b):b}if(!u||u.length<32){let b=a.toBase64({alphabet:"base64url",omitPadding:!0});await ip({credentialId:c.credentialId,rpId:i,userId:b}).catch(()=>{});try{localStorage.removeItem(ca)}catch{}throw oc()}let p=await Dg(u);u.fill(0);let f=await zg(p);p.fill(0);let h=a.toBase64({alphabet:"base64url",omitPadding:!0}),g={enabled:!0,credentialId:c.credentialId,prfSalt:c.prfSalt,userId:h,rpId:i,createdAt:Date.now()};Be=f,dn=h,Bo=c.credentialId,A_(g),typeof e=="function"&&await e({seal:(y,k)=>Fo(f,y,k)});try{localStorage.removeItem(sp)}catch{}return da(),!0})}async function Gg({migrate:e}){if(!fe())return{disabled:!1,signalAttempted:!1};if(!qt())throw new Error("passkey: must unlock before disabling encryption");ic+=1;try{return await navigator.locks.request(un,async()=>{let t=qi();if(!t)return{disabled:!1,signalAttempted:!1};let r=Be;if(!r)return{disabled:!1,signalAttempted:!1};if(J8(),Be=null,Bo=null,typeof e=="function"){let o=(i,s)=>Gi(r,i,s);try{await e({open:o})}catch(i){throw A_(t),Be=r,Bo=t.credentialId,da(),i}}dn=null;try{localStorage.setItem(sp,"1")}catch{}let n=await ip(t).catch(()=>!1);return da(),{disabled:!0,signalAttempted:n}})}finally{ic-=1}}async function ip({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 Q8(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 eL(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 Q8(r,n);o&&t.push(o)}return t}async function cc({refuseIfEnabled:e=!1}={}){ic+=1,jg+=1;try{return await navigator.locks.request(un,async()=>{if(e&&fe())throw new Error("passkey: encryption was just enabled in another tab. Reload this page to unlock instead of wiping.");await B_();let t=qi();if(t)try{await ip({credentialId:t.credentialId,rpId:t.rpId??ap(),userId:t.userId})}catch{}try{localStorage.removeItem(sc)}catch{}try{localStorage.removeItem(ca)}catch{}try{localStorage.removeItem(sp)}catch{}for(let n of["deepview.workspaces","deepview.sync.sessions","deepview.sync.userEnabled","deepview.repoUrls","deepview.fileCounts","deepview.workspaceApp","deepview.lastFile","deepview.scan.access","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 i=localStorage.key(o);i&&i.startsWith("deepview.report:")&&n.push(i)}for(let o of n)try{localStorage.removeItem(o)}catch{}}catch{}Be=null,dn=null,Bo=null,da();let r=await eL(["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{ic-=1,jg-=1}}function I_(e){return Be?Fo(Be,e,lc()):Promise.reject(new Error("passkey: vault locked, cannot seal triage"))}function L_(e){return Be?Gi(Be,e,lc()):Promise.reject(new Error("passkey: vault locked, cannot open triage"))}function dp(e,t){return Be?Fo(Be,e,lp(t)):Promise.reject(new Error("passkey: vault locked, cannot seal OPFS file"))}function F_(e,t){return Be?Gi(Be,e,lp(t)):Promise.reject(new Error("passkey: vault locked, cannot open OPFS file"))}function up(e,t){return Be?Fo(Be,e,cp(t)):Promise.reject(new Error("passkey: vault locked, cannot seal bundle"))}function pp(e,t){return Be?Gi(Be,e,cp(t)):Promise.reject(new Error("passkey: vault locked, cannot open bundle"))}var sc,ca,sp,un,q8,Y8,X8,Be,dn,Bo,ic,jg,Vg,ua=w(()=>{"use strict";Hg();At();Vr();sc="deepview.passkey.v1",ca="deepview.passkey.userId",sp="deepview.passkey.cleanDisable",un="deepview.passkey.v1.write",q8="deepview.triage.v1|",Y8="deepview.opfs.v1|",X8="deepview.bundle.v1|",Be=null,dn=null,Bo=null,ic=0;jg=0;Vg=new Set;typeof window<"u"&&window.addEventListener("storage",e=>{if(e.key!==sc)return;let t=qi();(!t&&Be||t&&Be&&t.credentialId!==Bo)&&(Be=null,dn=null,Bo=null),da()})});function fn(e){let t=()=>e();return fp.add(t),hp&&queueMicrotask(()=>{if(fp.has(t))try{t()}catch(r){console.warn("secure-storage after-hydrate listener:",r)}}),()=>fp.delete(t)}function tL(){for(let e of fp)try{e()}catch(t){console.warn("secure-storage after-hydrate listener:",t)}}function mp(e){let t=T_()??"";return ve(`deepview.secure.v1|${t}|${e}`)}function qg(e){try{let t=Uint8Array.fromBase64(e);if(Tt(t))return t}catch{}return null}function Ae(e){return xt.get(e)??null}async function st(e,t){if(typeof t!="string")throw new TypeError("secure-storage: value must be a string");if(fe()&&!dt())throw new Error(`secure-storage: vault locked, cannot save "${e}"`);if(M_())throw new Error(`secure-storage: wipe in progress, cannot save "${e}"`);let r=xt.has(e),n=xt.get(e);xt.set(e,t),ir.set(e,t);let o=Yn.get(e)??Promise.resolve(),i=()=>{ir.get(e)===t&&ir.delete(e)},s=o.catch(()=>{}).then(()=>rL(e,t)).then(()=>i(),a=>{throw i(),xt.get(e)===t&&(r?xt.set(e,n):xt.delete(e)),a});Yn.set(e,s.catch(()=>{})),await s}async function Oo(e){let t=Symbol("secure-storage:removed");xt.delete(e),ir.set(e,t);let r=Yn.get(e)??Promise.resolve(),n=()=>{try{localStorage.removeItem(e)}catch{}ir.get(e)===t&&(ir.delete(e),xt.delete(e))},o=r.catch(()=>{}).then(()=>n());Yn.set(e,o.catch(()=>{})),await o}async function rL(e,t){let r=dt();if(r){let n=await Fo(r,ve(t),mp(e));localStorage.setItem(e,n.toBase64())}else localStorage.setItem(e,t)}async function hn(){hp||Je(()=>{hn().catch(e=>console.warn("secure-storage rehydrate:",e))}),hp=!0;for(let e of[...xt.keys()])ir.has(e)||xt.delete(e);await O_(pa,!0)}async function Yg(e){if(!pa.includes(e))throw new Error(`secure-storage: unknown secure key "${e}"`);return ir.has(e)||xt.delete(e),(await O_([e],!1)).get(e)??null}async function O_(e,t){let r=dt(),n=[],o=new Map;for(let i of e){if(ir.has(i)){o.set(i,Ae(i));continue}let s=localStorage.getItem(i);if(s===null)continue;let a=qg(s);if(a){if(!r)continue;try{let c=await Gi(r,a,mp(i));if(ir.has(i)){o.set(i,Ae(i));continue}let u=it(c);xt.set(i,u),o.set(i,u)}catch(c){console.warn(`secure-storage: decrypt failed for "${i}":`,c)}}else xt.set(i,s),o.set(i,s),r&&fe()&&n.push([i,s])}return t&&tL(),n.length>0&&queueMicrotask(()=>{for(let[i,s]of n)xt.get(i)===s&&st(i,s).catch(a=>{console.warn(`secure-storage: self-heal failed for "${i}":`,a)})}),o}async function P_(e,t){let r=Yn.get(e)??Promise.resolve(),n=async()=>{if(ir.has(e))return;let i=localStorage.getItem(e);if(i===null)return;let s=await t(i);s!==null&&(ir.has(e)||(localStorage.setItem(e,s.storageValue),xt.set(e,s.cacheValue)))},o=r.catch(()=>{}).then(n);Yn.set(e,o.catch(()=>{})),await o}async function Xg({seal:e}){for(let t of pa)await P_(t,async r=>{if(qg(r))return null;let n=dt();return n?{storageValue:(await Fo(n,ve(r),mp(t))).toBase64(),cacheValue:r}:null})}async function Jg({open:e}){for(let t of pa)await P_(t,async r=>{let n=qg(r);if(!n)return null;let o=await e(n,mp(t)),i=it(o);return{storageValue:i,cacheValue:i}})}function fa(e,t){return pa.includes(e)?navigator.locks.request(nL+e,async()=>{let r=Yn.get(e);r&&await r.catch(()=>{}),await hn();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 st(e,o)}}):Promise.reject(new Error(`secure-storage: mutate() called with non-secure key "${e}"`))}async function B_(){await Promise.allSettled([...Yn.values()]),ir.clear(),Yn.clear()}var pa,xt,hp,Yn,ir,fp,nL,Vr=w(()=>{"use strict";At();Hg();ua();pa=Object.freeze(["deepview.workspaces","deepview.sync.sessions","deepview.sync.userEnabled","deepview.sync.password","deepview.repoUrls","deepview.fileCounts","deepview.workspaceApp","deepview.lastFile","deepview.scan.access"]),xt=new Map,hp=!1,Yn=new Map,ir=new Map,fp=new Set;nL="deepview.secure.v1.mutate:";typeof window<"u"&&window.addEventListener("storage",e=>{!hp||!e.key||!pa.includes(e.key)||hn().catch(()=>{})})});var Zg,N_=w(()=>{"use strict";Zg="/api/config"});function dc(e){if(typeof e!="string"||!e.trim())return null;try{let t=new URL(e);return!["http:","https:"].includes(t.protocol)||t.username||t.password||t.search||t.hash?null:(t.pathname=t.pathname.replace(/\/+$/u,"")+"/",t.href)}catch{return null}}var D_,Qg=w(()=>{"use strict";D_="http://127.0.0.1:3123/"});function uc(){try{return localStorage.getItem(eb)==="1"}catch{return!1}}function gp(){try{localStorage.setItem(eb,"1")}catch{}}function Wr(e){return e==="managed+e2e"||e==="e2e+managed"}function ha(e,t){return(e==="managed"||Wr(e))&&/^\/(?:team|manage)(?:\/|$)/u.test(t)}function tb(e,t=null){return t&&(Wr(e)||e===t)?t:e==="managed"||e==="managed+e2e"?"managed":"e2e"}function rb(e,t){return e&&Wr(e.mode)&&t.mode==="e2e"?{...e,...t.deepviewScanServer?{deepviewScanServer:t.deepviewScanServer}:{}}:t}function nb(e){if(e==null||typeof e!="object")return null;let t=e.mode;if(t!=="e2e"&&t!=="managed"&&t!=="managed+e2e"&&t!=="e2e+managed")return null;let r=null,n=e.managed;if(n!=null&&typeof n=="object"){let i=n.loginPath,s=n.cookieName;typeof i=="string"&&typeof s=="string"&&(r={loginPath:i,cookieName:s},n.allowShare===!0&&(r.allowShare=!0))}let o=t==="managed"?null:dc(e.deepviewScanServer);return{mode:t,managed:r,...o?{deepviewScanServer:o}:{}}}async function bp(){try{let e=await fetch(Zg,{credentials:"same-origin",cache:"no-store",headers:{accept:"application/json"}});return e.status===404?"standalone":e.ok?nb(await e.json()):null}catch{return null}}async function ob(e,t=3e3){let r;try{return await Promise.race([e,new Promise(n=>{r=setTimeout(()=>n(null),t)})])}catch{return null}finally{clearTimeout(r)}}function sr(){try{let e=localStorage.getItem(z_);if(e==null)return null;let t=nb(JSON.parse(e));return t?{mode:t.mode,managed:t.managed}:null}catch{return null}}function ib(e){try{localStorage.setItem(z_,JSON.stringify({mode:e.mode,managed:e.managed})),localStorage.removeItem(eb)}catch{}}var z_,eb,sb=w(()=>{"use strict";N_();Qg();z_="deepview.sync.serverInfo",eb="deepview.sync.standaloneProbe"});function sL(){try{let e=localStorage.getItem(vp);return e!==null&&iL.has(e)?e:null}catch{return null}}function aL(){try{let e=localStorage.getItem(kp);return e==="true"?!0:e==="false"?!1:null}catch{return null}}function hc(e){if(!Number.isFinite(e))return fc;let t=Math.round(e*10)/10;return Math.min(Math.max(t,xp),$p)}function lL(){try{let e=localStorage.getItem(wp);if(e===null||e.trim()==="")return null;let t=Number(e);return Number.isFinite(t)?hc(t):null}catch{return null}}function _p(e){try{let t=JSON.parse(e||"{}");return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function Sp(){return _p(Ae(pc))}function It(e){return e?Sp()[e]??"":""}function j_(e){return ab.add(e),()=>{ab.delete(e)}}function V_(e){for(let t of ab)try{t(e)}catch(r){console.warn("repo-url listener:",r)}}function Kr(e,t){if(_()||!e)return;let r=Sp();t?r[e]=t:delete r[e],st(pc,JSON.stringify(r)).catch(n=>console.warn("saveRepoUrlFor:",n)),fa(pc,n=>{let o=_p(n);return t?o[e]=t:delete o[e],JSON.stringify(o)}).catch(n=>console.warn("saveRepoUrlFor cross-tab merge:",n)),V_(e)}async function W_(e,t){await fa(pc,r=>{let n=_p(r),o=t==="replace"?{...e}:t==="prefer-imported"?{...n,...e}:{...e,...n};return JSON.stringify(o)}),db()}async function Cp(e){if(!e||typeof e!="object")return[];let t=[];if(await fa(pc,r=>{let n=_p(r);t=[];for(let[o,i]of Object.entries(e))!o||typeof i!="string"||!i||n[o]||(n[o]=i,t.push(o));return t.length===0?r:JSON.stringify(n)}),t.length===0)return t;db();for(let r of t)V_(r);return t}async function lb(e,t){return!e||!t?!1:(await Cp({[e]:t})).length>0}function _(){return l.serverMode==="managed"&&!l.localMode}function Xn(e){l.localMode=!!e}function Ep(e,t=globalThis.location?.pathname??""){let r=ha(e,t);r&&(l.serverModeSelection="managed"),l.serverModeConfig=e,l.serverMode=tb(e,l.serverModeSelection),l.serverModeSelection!==l.serverMode&&(l.serverModeSelection=null),(r||l.serverMode==="e2e"||Wr(e))&&Xn(!1)}function cb(){return Wr(l.serverModeConfig)?(l.serverModeSelection=l.serverMode==="managed"?"e2e":"managed",l.serverMode=l.serverModeSelection,Xn(!1),!0):l.serverMode!=="managed"?!1:(Xn(!l.localMode),!0)}function mn(){return l.serverMode==="standalone"&&l.localMode?"local":l.serverMode!=="managed"?l.serverMode:l.localMode?"local":"managed"}function db(){_()||l.repoEditing||l.currentFile&&(l.repoUrl=It(l.currentFile))}var H_,vp,pc,wp,kp,iL,fc,xp,$p,ab,yp,U_,l,Yt=w(()=>{"use strict";rc();Vr();sb();H_="deepview.viewMode",vp="deepview.severityMode",pc="deepview.repoUrls",wp="deepview.focusSplit",kp="deepview.kanbanDetailFullscreen",iL=new Set(["corrected","original"]),fc=50,xp=20,$p=80;try{localStorage.removeItem(H_)}catch{}ab=new Set;yp=sr(),U_=ha(yp?.mode??"e2e",globalThis.location?.pathname??"")?"managed":null,l=Wi({reports:[],workspaceMerges:[],currentFile:null,currentWorkspace:null,currentManagedTeam:null,currentManagedReport:null,currentReportWorkspace:null,currentView:"findings",currentLinks:null,bundles:[],storedFiles:[],selectedBundle:null,selectedBundleWorkspace:null,scanSelection:null,bundleDetails:null,bundleDetailsTab:"overview",selectedPackage:null,selectedPackageVersion:null,packageDetailsTab:"overview",packageSlideTriage:null,packageSlideTransient:!1,packagesSearchQuery:"",packagesSortBy:"findings-desc",expandedPackages:new Set,selectedRepository:null,repositoryDetailsTab:"overview",repositorySlideTriage:null,repositorySlideTransient:!1,repositoriesSearchQuery:"",repositoriesSortBy:"findings-desc",bundleSourceFile:null,bundleSourceFindingIdx:null,bundleCodeSearchMode:"files",bundleCodeSearchQuery:"",bundleSearchQuery:"",bundleSearchRegex:!1,bundleSearchCase:!1,bundleSearchContext:!0,filterSeverities:new Set,filterColors:new Set,filterSources:new Set,filterAnalyzer:"",filterModel:"",filterRepo:"",filterRevalidate:"",filterPartial:"",showRevalidation:!0,revalidationDetailed:!1,upstreamOnly:!1,revalidateConflicts:new Map,codePreviews:new Set,filterConfMin:0,filterConfMax:10,filterInclude:"",filterIncludeNegate:!1,filterComment:"",filterFix:"",filterFlagged:"",filterDuplicates:"",filterCrossContext:"",filterAppStacked:"",filterSecurity:"",repoUrl:"",repoEditing:!1,sortBy:"severity",viewMode:"kanban",severityMode:sL()??"corrected",triage:new Map,shownTriage:null,nextFindingId:0,activeTabByGroup:new Map,tableSelectedGid:null,filesViewMode:"table",filesSearch:"",filesSelectedFile:null,kanbanPopoverGid:null,kanbanDetailFullscreen:aL()??!1,kanbanExpandedColumn:null,focusGid:null,focusCodeTick:0,focusCodeStack:[],focusCodeAt:0,focusSplit:lL()??fc,codeBlockTick:0,bundleHashTick:0,linksTick:0,findingIndexTick:0,serverMode:tb(yp?.mode??"e2e",U_),serverModeConfig:yp?.mode??null,serverModeSelection:U_,deepviewScanServer:null,localMode:!1,managed:yp?.managed??null,managedSession:null,managedTeams:[],managedReport:null,managedReports:[],managedComments:new Map});fn(()=>{db()})});var gn,Rp=w(()=>{"use strict";gn=new Set(["overview","graph","treemap","compare","advisories","issues","code","search","terminal"])});function dL(e){for(let t=0;t<e.length;t++){let r=e.codePointAt(t);if(r<32||r===127)return!0}return!1}function uL(e){return typeof e=="string"&&e.length>0&&e.length<=mc&&!dL(e)}function Lt(e){return uL(e)&&!cL.test(e)}var cL,mc,Mp=w(()=>{"use strict";cL=/^\d+$/u;mc=512});function K_(e){if(!Lt(e)||e==="."||e==="..")return null;try{return`/finding/${encodeURIComponent(e)}`}catch{return null}}function ar(e){if(!e)return null;if(e.view==="home")return"/";if(e.view==="bundles"){if(!/^[A-Za-z0-9_-]+$/u.test(e.bundleSlug??"")||e.teamSlug!=null&&!/^[A-Za-z0-9_-]+$/u.test(e.teamSlug))return null;let n=e.bundleTab??"overview";return gn.has(n)?`${e.teamSlug?`/team/${e.teamSlug}`:"/manage"}/bundle/${e.bundleSlug}${n==="overview"?"":`/${n}`}`:null}if(Object.hasOwn(Xi,e.view)){let n=Xi[e.view];return e.view==="manage-scans"&&e.bundleId?`${n}?bundle=${encodeURIComponent(e.bundleId)}`:e.view==="manage-history"&&e.actor?`${n}?actor=${encodeURIComponent(e.actor)}`:n}if(!["findings","files"].includes(e.view)||!e.teamSlug||[e.teamSlug,e.reportSlug].some(n=>n!=null&&!/^[A-Za-z0-9_-]+$/u.test(n)))return null;let t=`/team/${encodeURIComponent(e.teamSlug)}`,r=e.reportSlug?`/report/${encodeURIComponent(e.reportSlug)}`:"";if(e.finding){let n=K_(e.finding.id);return e.view==="findings"&&n?`${t}${r}${n}`:null}return`${t}${r}${e.view==="files"?"/files":""}`}function gc(e){let t=e.pathname.replace(/\/$/u,"")||"/";if(t==="/"||t==="/index.html")return{view:"home"};let r=Object.keys(Xi).find(i=>Xi[i]===t);if(r)return{view:r,...r==="manage-history"&&e.searchParams.get("actor")?{actor:e.searchParams.get("actor")}:{},...r==="manage-scans"&&e.searchParams.get("bundle")?{bundleId:e.searchParams.get("bundle")}:{}};let n=/^(?:\/team\/([A-Za-z0-9_-]+)|\/manage)\/bundle\/([A-Za-z0-9_-]+)(?:\/([a-z]+))?$/u.exec(t);if(n){let i=n[3]??"overview";return gn.has(i)?{view:"bundles",teamSlug:n[1]??null,bundleSlug:n[2],bundleTab:i}:null}let o=/^\/team\/([^/]+)(?:\/report\/([^/]+))?(?:\/(files)|\/finding\/([^/]+))?$/u.exec(t);if(!o)return null;try{let i=decodeURIComponent(o[1]),s=o[2]?decodeURIComponent(o[2]):null;if([i,s].some(c=>c!=null&&!/^[A-Za-z0-9_-]+$/u.test(c))||o[4]?.length>mc*9)return null;let a=o[4]?decodeURIComponent(o[4]):null;return a!=null&&!K_(a)?null:{view:o[3]?"files":"findings",teamSlug:i,reportSlug:s,...a==null?{}:{finding:{id:a}}}}catch{return null}}function Ap(e,t,r=[]){if(e.view==="bundles"){let{teamSlug:f,bundleSlug:h,...g}=e,b=f==null?[]:t.filter($=>$.slug===f);if(f!=null&&b.length!==1)return null;let y=b[0],k=f==null?r:t.flatMap($=>$.bundles??[]),v=new Set(k.filter($=>$.slug===h).map($=>$.id)),x=(y?.bundles??r).find($=>$.slug===h);return h&&x&&v.size===1?{...g,teamId:y?.id??null,bundleId:x.id}:null}if(!["findings","files"].includes(e.view))return e;let{teamSlug:n,reportSlug:o,...i}=e,s=t.filter(f=>f.slug===n);if(!n||s.length!==1)return null;let a=s[0];if(o==null)return{...i,teamId:a.id,reportId:null};let c=t.flatMap(f=>f.reports??[]).filter(f=>f.slug===o),u=new Set(c.map(f=>f.id)),p=(a.reports??[]).find(f=>f.slug===o);return p&&u.size===1?{...i,teamId:a.id,reportId:p.id}:null}function bt(e,t,r=[]){if(e.view==="bundles"){let{teamId:u,bundleId:p,...f}=e,h=t.find(y=>y.id===u);if(u!=null&&!h?.slug)return null;let g=(h?.bundles??r).find(y=>y.id===p);if(!g?.slug)return null;let b={...f,teamSlug:h?.slug??null,bundleSlug:g.slug};return Ap(b,t,r)?b:null}if(!["findings","files"].includes(e.view))return e;let{teamId:n,reportId:o,...i}=e,s=t.find(u=>u.id===n),a=o==null?null:s?.reports?.find(u=>u.id===o);if(!s?.slug||o!=null&&!a?.slug)return null;let c={...i,teamSlug:s.slug,reportSlug:a?.slug??null};return Ap(c,t)?c:null}var Xi,Jn=w(()=>{"use strict";Rp();Mp();Xi=Object.freeze({manage:"/manage","manage-bundles":"/manage/bundle","manage-scans":"/manage/scans","manage-reports":"/manage/report","manage-repos":"/manage/repositories","admin-users":"/manage/users","manage-teams":"/manage/team","manage-import":"/manage/import","manage-links":"/manage/links","manage-history":"/manage/history"})});function q_(e,t){return`${e}\0${t}`}function Y_(e){return typeof e=="string"&&fL.test(e)}async function $t(e,t){let r=mL[e];if(!r||typeof t!="string"||!t)return null;let n=q_(e,t),o=ub.get(n);if(o!==void 0)return o;let i;try{let s=await crypto.subtle.digest("SHA-256",ve(r+t));i=new Uint8Array(s).slice(0,pL).toBase64({alphabet:"base64url",omitPadding:!0})}catch{return null}return ub.set(n,i),i}function Tp(e,t){return typeof t!="string"||!t?null:ub.get(q_(e,t))??null}function gL(e,t){let r=[];for(let[n,o]of[["report",e],["workspace",t]]){if(o==null||o===""){r.push(bc);continue}if(!Y_(o))throw new TypeError(`encodeFindingRef: ${n} must be a link hint token, not a name`);r.push(o)}return r.every(n=>n===bc)?null:r[0]===bc?`w${r[1]}`:r.join("")}function bL(e){let t=[e.slice(0,G_),e.slice(G_)].map(r=>r===bc?null:r);return{report:t[0],workspace:t[1]}}function bn({id:e,report:t,workspace:r}={}){if(!Lt(e))throw new TypeError("encodeFindingRef: a persistent finding id is required");let n=[`finding=${encodeURIComponent(e)}`],o=gL(t,r);return o&&n.push(`v=${o}`),n.join("&")}function pb(e,t){let r=bn(e);return typeof location>"u"?`${t??""}#${r}`:`${location.origin}${t??location.pathname}#${r}`}function Po(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 i=o.indexOf("=");if(i<0)continue;let s=o.slice(0,i),a=o.slice(i+1);if(!a)continue;if(s==="v"){if(a.length===5&&a[0]==="w"&&Y_(a.slice(1))){let u=a.slice(1);Object.assign(n,{report:null,workspace:u===bc?null:u});continue}if(!hL.test(a))continue;Object.assign(n,bL(a));continue}if(s!=="finding"||a.length>mc*3)continue;let c;try{c=decodeURIComponent(a)}catch{continue}Lt(c)&&(n.id=c)}return n.id?n:null}function X_(e,{managed:t=!1}={}){if(typeof location>"u")return null;let r;try{r=new URL(e)}catch{return null}if(r.href!==e||r.protocol!==location.protocol||r.host!==location.host||r.username||r.password)return null;let n=gc(r);if(n?.finding)return{id:n.finding.id,fragment:bn(n.finding),path:ar(n)};if(t&&n?.view!=="home"&&!/\/(?:index|view)\.html$/u.test(r.pathname))return null;let o=Po(r.hash);if(!o)return null;let i=bn(o);return{id:o.id,fragment:i,path:`/#${i}`}}var pL,G_,fL,hL,bc,mL,ub,ma=w(()=>{"use strict";At();Jn();Mp();Mp();pL=3,G_=4,fL=/^[\w-]{4}$/u,hL=/^[\w-]{8}$/u,bc="AAAA",mL={report:`deepview/finding-link/report/v1
4
+ `,workspace:`deepview/finding-link/workspace/v1
5
+ `},ub=new Map});function yL(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let{id:t}=e;return typeof t=="string"&&t.length>0?t:null}function yn(e){let t;try{t=JSON.parse(e)}catch{return null}if(!Array.isArray(t)||t.length===0)return null;let r=[],n=0;for(let o of t){if(!Array.isArray(o))return null;let i=new Set;for(let s of o){let a=yL(s);if(a===null)return null;Lt(a)?i.add(a):n++}i.size>1&&r.push([...i])}return{groups:r,skipped:n}}function Ip(e){let t=new Set;for(let r of e)for(let n of r)t.add(n);return t.size}function Lp(e,t){for(let r of e)for(let n of r){let o=t.get(n);o||t.set(n,o=new Set);for(let i of r)i!==n&&o.add(i)}return t}var at,ga=w(()=>{"use strict";ma();at="links"});function ut(e){let t=[],r=-1,n="",o=0,i=0,s=0;for(let a of e.split(`
6
+ `)){let c=s;s+=a.length+1;let u=vL.exec(a);if(r!==-1){u&&u[2]===n&&u[1].length<=o+3&&(t.push([r,c+a.length]),r=-1);continue}if(u&&u[1].length<=i+3){r=c,n=u[2],o=u[1].length;continue}if(!a.trim())continue;let p=ba.exec(a),f=/^ */u.exec(a)[0].length;p&&p[1].length<=i+3?i=p[0].length:f<i&&(i=0)}return r!==-1&&t.push([r,e.length]),t}function lr(e,t){return e.some(([r,n])=>t>=r&&t<n)}function xr(e){return String(e??"").replaceAll(/\r\n?/gu,`
7
+ `)}function Fp(e){return/^[0-9a-f]{7,64}$/iu.test(e)}function Zn(e,t){let r=ut(e),n=[...e.matchAll(t)].filter(o=>!lr(r,o.index));return n.map((o,i)=>({heading:o[1],body:e.slice(o.index+o[0].length+1,n[i+1]?.index)}))}function Zi(e,t){let r=ut(e),n=[...e.matchAll(t)].find(o=>!lr(r,o.index));return n?{head:e.slice(0,n.index),subs:Zn(e,t)}:{head:e,subs:[]}}function wc(e){let t=e.indexOf(`
8
+ `);return t===-1?{title:e.trim(),body:""}:{title:e.slice(0,t).trim(),body:e.slice(t+1)}}function wL(e){let t=[];for(let r of e.split(`
9
+ `)){let n=r.trim();if(!n.startsWith("|")||/^[\s:|-]+$/u.test(n)&&n.includes("-"))continue;let o=n.replace(/^\|/u,"").replace(/\|$/u,"").split("|").map(i=>i.trim());t.push(o)}return t}function kc(e){let t=wL(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((s,a)=>s.toLowerCase()===r[a]))continue;let i={};r.forEach((s,a)=>{s&&(i[s]=o[a]??"")}),n.push(i)}return n}function J_(e){let t=Object.create(null),r=Object.create(null),n=[],o=null,i="",s=[],a="",c=(f,h,g)=>{!f||f in t||(t[f]=g.trim(),r[f]=h)},u=()=>{o&&c(o,i,s.join(`
10
+ `)),o=null,i="",s=[]},p=f=>{(o?s:n).push(f)};for(let f of e.split(`
11
+ `)){let h=/^ {0,3}(```|~~~)/u.exec(f),g=h!==null&&(!a||h[1]===a);if(g&&(a=a?"":h[1]),g||a){p(f);continue}if(!f.trim()){o?u():n.push(f);continue}let b=/^\s*(?:[-*] +)?\*\*([^:*]+):\*\*\s*(.*)$/u.exec(f);if(b){u();let y=b[1].trim(),k=b[2],v;for(;(v=/\s+[·•]\s+\*\*([^:*]+):\*\*\s*/u.exec(k))!==null;)c(y.toLowerCase(),y,k.slice(0,v.index)),y=v[1].trim(),k=k.slice(v.index+v[0].length);o=y.toLowerCase(),i=y,s=[k];continue}if(/^\s*(?:#{1,6} |\||[-=*_]{3,}\s*$)/u.test(f)){u();continue}p(f)}return u(),{fields:t,labels:r,prose:n.join(`
12
+ `).trim()}}function Bp(e){let t=(e||"").trim(),r="",n=ya(t);n&&(t=n.label.trim(),r=n.url.trim());let o="",i=/#L(\d+)/u.exec(r);i&&(o=i[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=fb.exec(c);return p?(o||(o=p[2]),{file:p[1],line:o,locationLink:r}):{file:c,line:o||"?",locationLink:r}}function hb(e){return e.replaceAll("**","")}function ya(e){let t=String(e??""),r=kL(t,xL(t)),n=$L(t),o=t.indexOf("]");for(let i=t.indexOf("[");i!==-1;i=t.indexOf("[",i+1)){for(;o!==-1&&o<=i;)o=t.indexOf("]",o+1);for(let s of[o,r.get(i)??-1]){if(s===-1||s===i+1||t[s+1]!=="(")continue;let a=_L(t,s+1,n);if(a!==null)return{label:t.slice(i+1,s),url:a,index:i}}}return null}function kL(e,t){let r=new Map,n=[];for(let o=0;o<e.length;o++){let i=e[o];Z_(e,o)?o++:i==="`"?o=t.get(o)??o:i==="["?n.push(o):i==="]"&&n.length>0&&r.set(n.pop(),o)}return r}function xL(e){let t=[];for(let o=e.indexOf("`");o!==-1;o=e.indexOf("`",o)){let i=1;for(;e[o+i]==="`";)i++;t.push([o,i]),o+=i}let r=new Map,n=new Map;for(let o=t.length-1;o>=0;o--){let[i,s]=t[o],a=n.get(s);a!==void 0&&r.set(i,a+s-1),n.set(s,i)}return r}function $L(e){let t=e.length,r=new Int32Array(t+1).fill(-1),n=new Int32Array(t+1).fill(-1),o=new Int32Array(t+1).fill(-1),i=new Int32Array(t+1).fill(-1);for(let c=t-1;c>=0;c--)r[c]=e[c]===")"?c:r[c+1],n[c]=/\s/u.test(e[c])?c:n[c+1],o[c]=e[c]===">"?c:o[c+1],i[c]=e[c]===`
13
+ `?c:i[c+1];let s=new Map,a=[];for(let c=0;c<t;c++){let u=e[c];Z_(e,c)?c++:n[c]===c?a.length=0:u==="("?a.push(c):u===")"&&a.length>0&&s.set(a.pop(),c)}return{balanced:s,nextClose:r,nextSpace:n,nextAngle:o,nextLine:i}}function _L(e,t,r){let n=SL(e,t,r);if(n)return n;let o=r.balanced.get(t);if(o!==void 0)return o>t+1?e.slice(t+1,o):null;let i=r.nextClose[t+1],s=r.nextSpace[t+1];return i===-1||i===t+1||s!==-1&&s<i?null:e.slice(t+1,i)}function SL(e,t,r){if(e[t+1]!=="<")return"";let n=r.nextAngle[t+2],o=r.nextLine[t+2];return n===-1||o!==-1&&o<n||e[n+1]!==")"?"":e.slice(t+2,n)}function Z_(e,t){return e[t]==="\\"&&EL.test(e[t+1]??"")}function xc(e){return typeof e=="string"?e.replace(CL,"$1"):e}function Q_(e){let t=/^\[(.+)\]$/u.exec(e.trim());return t?t[1].trim():e.trim()}function Qi(e){let t=(e||"").trim();return/^[-–—]+$/u.test(t)?"":t}var vL,ba,yc,vc,Ji,fb,CL,EL,$r=w(()=>{"use strict";vL=/^( *)(```|~~~)/u,ba=/^( *)(?:[-*+]|\d{1,9}[.)]) +(?=\S)/u;yc=/^## +(.*)$/gmu,vc=/^### +(.*)$/gmu,Ji=/^#### +(.*)$/gmu,fb=/^(.+):(\d+(?:-\d+)?)$/u;CL=/\\([!-/:-@[-`{-~])/gu,EL=/[!-/:-@[-`{-~]/u});function ML(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 AL(e){if(e!==void 0)return eS.get(tS(e))??eS.get("medium")}function rS(e){let r=xr(e).trim().split(RL);if(r.length===1)return null;let n=[];for(let o=1;o<r.length;o+=2){let i=ML(r[o]);for(let s of r[o+1].split(/^### /mu).slice(1)){let a=IL(s,i);a&&n.push(a)}}return n.length===0?null:{type:"security",source:"deepsec",findings:n}}function IL(e,t){let{title:r,body:n}=wc(e);if(!r)return null;let o=n.replace(/\n---\s*$/u,"").trim(),i={};for(let k of o.matchAll(/^- \*\*([^:*]+):\*\*\s*(.+)$/gmu))i[k[1].trim().toLowerCase()]=k[2].trim();let s=/^\*\*Recommendation:\*\*\s*/mu.exec(o),a=o,c="";s&&(a=o.slice(0,s.index),c=o.slice(s.index+s[0].length).trim());let u=a.split(`
14
+ `).filter(k=>!/^\s*- \*\*/u.test(k)).join(`
15
+ `).replaceAll("**","").trim(),p=[r,u].filter(Boolean).join(`
16
+
17
+ `),f=(i.file||"unknown").replace(/^`(.*)`$/u,"$1"),h=(i.lines||"").split(",").map(k=>k.trim()).find(Boolean)||"?",g={file:f,line:h,severity:t,description:p};c&&(g.recommendation=c.replaceAll("**",""));let b=AL(i.confidence);b!==void 0&&(g.confidence=b);let y=TL.get(tS(i.revalidation));return y&&(g.revalidate=y,g.revalidateSource="deepsec",i.reasoning&&(g.revalidateVerdict=i.reasoning.replaceAll("**",""))),i.slug&&(g.slug=i.slug),g}var RL,tS,eS,TL,nS=w(()=>{"use strict";$r();RL=/^## ([A-Z][A-Z_]*)\s*\(\d+\)\s*\n/mu;tS=e=>String(e??"").toLowerCase().replaceAll(/[^a-z]+/gu,""),eS=new Map([["high",8],["medium",6],["low",4]]);TL=new Map([["confirmed","confirmed"],["falsepositive","refuted"],["uncertain","unknown"]])});function vn(e){return va[e]??String(e??"")}var va,No,$c,yt,wa=w(()=>{"use strict";va={critical:"Critical",high:"High",medium:"Medium",low:"Low",high_bug:"High bug",bug:"Bug",informational:"Informational"},No={inprogress:"In progress",fixed:"Fixed",invalid:"Invalid",deleted:"Deleted",ignored:"Ignored"},$c={red:"Red",blue:"Blue",green:"Green",gray:"Gray",none:"Unmarked"},yt={"claude-security":"Claude Security","codex-security":"Codex Security",deepsec:"DeepSec",piolium:"Piolium"}});function oS(e){return e!=null&&e in je?e:null}function wn(e){return oS(e?.correctedSeverity)??e?.severity}function cr(e){let t=oS(e?.correctedSeverity);return t!=null&&t!==e?.severity}function ce(e,t){return t==="original"?e?.severity:wn(e)}function ka(e){let t=e?._correctedByReport;return t&&new Set(Object.values(t).map(n=>n?.severity)).size>1?t:null}function Te(e){return LL.has(e?.revalidate)?e.revalidate:""}function Gr(e,t=e?.source){return Object.hasOwn(yt,t)||Te(e)==="revalidation"}function mb(e,t=e?._source??e?.source){let r=typeof t=="string"&&t!==""&&t!=="deepview",n=r?t:e?.analyzer??e?.type??e?._analyzer;return e?.security===!0||(n==="security"||n==="dependencies")&&e?.security!==!1||r&&["critical","high","medium","low"].includes(e?.severity)}function ts(e){return e&&e.replace(/^[^/]+\//u,"").replace(/^claude-/u,"").replaceAll("-"," ")}function _c(e,t=!0){let r=t&&Te(e)==="revalidation"?"revalidate":"";return[e?.type,r,ts(e?.model),e?.effort,e?.exportsMode].filter(Boolean).join(" \xB7 ")}function Ft(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).map(o=>o.replaceAll(/[.*+?^${}()|[\]\\]/gu,"\\$&"));for(let o of n)r=r.replaceAll(new RegExp(`\\[export:\\s*${o}\\]\\s*`,"gu"),"");for(let o of n)r=r.replace(new RegExp(`^\\(\`?${o}\`?\\): `,"u"),"");return r}function Qn(e){let t=e?.exportName,r=e?.methodName;return t&&r&&t!==r?`${t}.${r}`:t||r||""}function rs(e){if(!e)return"";for(let t of e.split(`
18
+ `))if(t.trim())return t.trim();return""}function gb(e){return typeof e?.title=="string"?e.title.trim():""}function lt(e){return gb(e)||rs(Ft(e?.description,e))}function Do(e){let t=Ft(e?.description,e)||"",r=gb(e);if(r){let i=t.trim(),s=i.indexOf(`
19
+ `);return(s<0?i:i.slice(0,s)).trim()!==r?{title:r,body:i}:{title:r,body:s<0?"":i.slice(s+1).replace(/^\s+/u,"")}}if(!t)return{title:"",body:""};let n=t.indexOf(`
20
+ `);if(n<0)return{title:"",body:t};if(ut(t)[0]?.[0]===0)return{title:"",body:t};let o=t.slice(n+1).replace(/^\s+/u,"");return o?{title:t.slice(0,n).trim(),body:o}:{title:"",body:t}}function xa(e){let t=gb(e);if(!t)return Ft(e?.description,e)||"";let{body:r}=Do(e);return r?`${t}
21
+
22
+ ${r}`:t}function BL(e){let t=ut(e);if(t.length===0)return e.split(/\n{2,}/u);let r=[],n=0;for(let o of e.matchAll(/\n{2,}/gu))lr(t,o.index)||(r.push(e.slice(n,o.index)),n=o.index+o[0].length);return r.push(e.slice(n)),r}function $a(e){let t=[];for(let r of BL(e||"")){if(!r.trim())continue;let n=FL.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+=`
23
+
24
+ ${r}`:t.push({label:null,body:r})}return t}function vt(e){return Number.isFinite(parseInt(e?.line,10))?`${e.file}:${e.line}`:e?.file??""}function ns(e){let t=r=>typeof r=="string"?r:"";return`${t(e?.observation)}
25
+ ${t(e?.text)}`.trim()}var je,Le,es,LL,FL,os=w(()=>{"use strict";$r();wa();je={critical:6,high:5,medium:4,low:3,high_bug:2,bug:1,informational:0},Le=["critical","high","medium","low","high_bug","bug","informational"];es=["revalidation","refuted","unreachable","confirmed","partial","unknown"],LL=new Set(es);FL=/^\*\*([^*\n]+):\*\*[ \t]*/u});function Fe(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 bb(e){return String(e??"").replaceAll(/\s*\n\s*/gu," ").replaceAll("|","\\|").trim()}function pt(e){let t=String(e??"");if(t==="")return"";let r=Math.max(0,...[...t.matchAll(/`+/gu)].map(i=>i[0].length)),n="`".repeat(r+1),o=t.startsWith("`")||t.endsWith("`")?" ":"";return`${n}${o}${t}${o}${n}`}function sS(e){return String(e??"").replaceAll(/[[\]]/gu,"\\$&")}function is(e,t){let r=/[\s()<>]/u.test(t)?`<${t.replaceAll(">","%3E")}>`:t;return`[${e}](${r})`}function Op(e){return Fe(e)?`<${e}>`:String(e??"")}function aS(e,t){let r=String(e??"").toLowerCase().replaceAll(/[^\p{L}\p{N}\p{M}\s_-]/gu,"").replaceAll(/\s/gu,"-"),n=r;for(let o=1;t.has(n);o++)n=`${r}-${o}`;return t.add(n),n}function kn(e,t){return`${"#".repeat(Math.min(6,Math.max(1,e)))} ${t}`}function yb(e,t,r=[]){let n=e.map((o,i)=>r[i]==="right"?"---:":"---");return[e,n,...t].map(o=>`| ${o.join(" | ")} |`).join(`
26
+ `)}function lS(e){let t=e instanceof Date?e:new Date(e);if(Number.isNaN(t.getTime()))return"";let r=n=>String(n).padStart(2,"0");return`${t.getUTCFullYear()}-${r(t.getUTCMonth()+1)}-${r(t.getUTCDate())} ${r(t.getUTCHours())}:${r(t.getUTCMinutes())} UTC`}function _a(e,t,r=`${t}s`){return`${e} ${e===1?t:r}`}function Sc(e){return e.filter(t=>typeof t=="string"&&t.trim()).map(t=>t.replace(/\s+$/u,"")).join(`
27
+
28
+ `)}function Sa(e){let t=PL(xr(e).trim());return t?NL(t):""}function PL(e){if(!e)return"";let t=ut(e).at(-1);if(!t||t[1]<e.length)return e;let r=e.slice(t[0]).split(`
29
+ `),n=iS.exec(r[0])?.[1]??"```";return r.length>1&&iS.exec(r.at(-1))?.[1]?.startsWith(n.slice(0,3))?e:`${e}
30
+ ${n}`}function cS(e,t){let r=ut(e),n=0;return e.split(`
31
+ `).map(o=>{let i=n;return n+=o.length+1,lr(r,i)?o:t(o)}).join(`
32
+ `)}function NL(e){return cS(e,t=>t.replace(OL,"$1\\$2"))}function dS(e){return cS(String(e??""),t=>t.replace(/^( {0,3})\\(\\*#)/u,"$1$2"))}function uS(e,t){let r=" ".repeat(e.length);return t.split(`
33
+ `).map(n=>n?r+n:"").join(`
34
+ `)}var iS,OL,Cc=w(()=>{"use strict";$r();iS=/^ *(`{3,}|~{3,})/u,OL=/^( {0,3})(\\*#)/u});function xn(e){let t=/(`+)(.+?)\1(?!`)/u.exec(String(e??""));if(!t)return null;let r=t[2];if(r.length>2&&r.startsWith(" ")&&r.endsWith(" ")){let n=r.slice(1,-1);if(n.startsWith("`")||n.endsWith("`"))return n}return r}function Pp(e){let t=ya(String(e??""));return t?.index===0?{label:t.label,url:t.url}:null}function hS(e){let t=/^<(https?:[^>\s]*)>$/u.exec(e.trim());return t?t[1]:null}function mS(e){let t=fb.exec(e);return t?{file:t[1],line:t[2]}:{file:e,line:"?"}}function UL(e){let t=e.indexOf(".");return t>0?{exportName:e.slice(0,t),methodName:e.slice(t+1)}:{exportName:e}}function ss(e){let t=String(e??"").trim();return DL.get(t.toLowerCase())??t}function HL(e){let t={},r=e.trim(),n=/ · (`+)(.+?)\1$/u.exec(r);n&&(Object.assign(t,UL(xn(n[0]))),r=r.slice(0,n.index));let o=Pp(r),i=xn(o?o.label:r);return i!==null&&Object.assign(t,mS(i)),o&&Fe(o.url)&&(t.location=o.url),t}function VL(e){let t={},r=e.trim();r.endsWith(pS)&&(t.critical=!0,r=r.slice(0,-pS.length));let n=r.indexOf(jL);n!==-1&&(r=r.slice(0,n));let o=/^(.*?) — corrected (from|to) (.*)$/u.exec(r);return o?o[2]==="from"?(t.severity=ss(o[3]),t.correctedSeverity=ss(o[1])):(t.severity=ss(o[1]),t.correctedSeverity=ss(o[3])):t.severity=ss(r),t}function GL(e){return/\d/u.test(e)||/^(?:opus|sonnet|haiku|gpt|gemini|fable|mythos|llama|mistral)\b/iu.test(e)}function Np(e){let t=e.trim(),r=fS.get(t.toLowerCase());if(r)return{source:r};let n={},o=[];for(let i of t.split(" \xB7 ").map(s=>s.trim()).filter(Boolean))i==="revalidate"&&!n.revalidate?n.revalidate="revalidation":KL.has(i)&&!n.exportsMode?n.exportsMode=i:WL.has(i)&&!n.effort?n.effort=i:o.push(i);return o.length>1?[n.type,n.model]=o:o.length===1&&(n[GL(o[0])?"model":"type"]=o[0]),{run:n}}function vb(e){let t=e.trim(),r=Pp(t);return r?r.label.trim():hS(t)??t}function qL(e){let t=Pp(e.trim());if(t){let r=t.url.split("/").at(-1)??"";return Fp(r)?r:xn(t.label)??r}return xn(e)??e.trim()}function YL(e){let t=xn(e)??e.trim(),r=t.lastIndexOf("@");return{npm:r>0?{name:t.slice(0,r),version:t.slice(r+1)}:{name:t}}}function XL(e){let t=e.trim().toLowerCase();return t==="the revalidation pass itself"?"revalidation":zL.has(t)?t:void 0}function gS(e,t,r){let n=JL.get(t.trim().toLowerCase());n&&n(e,r.trim())}function bS(e){let t=e.split(`
35
+ `),r=0,n=()=>{for(;r<t.length&&!t[r].trim();)r++},o=()=>{let a=[];for(;r<t.length;){let c=ZL.exec(t[r]);if(!c)break;a.push([c[1].trim(),c[2].trim()]),r++}return a};n();let i=o();if(i.length>0)return{title:"",facts:i,rest:t.slice(r).join(`
36
+ `)};let s=[];for(;r<t.length&&t[r].trim();)s.push(t[r++]);return n(),i=o(),i.length===0?{title:"",facts:i,rest:e}:{title:Ca(s.join(`
37
+ `).trim()),facts:i,rest:t.slice(r).join(`
38
+ `)}}function Ca(e){return dS(e)}function yS(e,t){let r=new RegExp(`^#{${t}} +(.*)$`,"gmu"),n=ut(e),o=[...e.matchAll(r)].filter(a=>!lr(n,a.index)),i=e.slice(0,o[0]?.index??e.length).trim(),s=o.map((a,c)=>({label:a[1].trim(),body:e.slice(a.index+a[0].length,o[c+1]?.index).trim()}));return{lead:i,sections:s}}function vS(e){let t=[],r=ut(e),n=0;for(let o of e.split(`
39
+ `)){let i=lr(r,n)?null:QL.exec(o);n+=o.length+1,i?t.push({ref:i[2].trim(),indent:i[1].length+2,note:[]}):t.length>0&&t.at(-1).note.push(o)}return t.map(o=>e7(o))}function e7({ref:e,indent:t,note:r}){let n={},o=Pp(e),i=hS(e),s=i===null?xn(o?o.label:e):null;s!==null&&Object.assign(n,mS(s));let a=o?o.url:i;Fe(a)&&(n.url=a);let c=Ca(r.map(u=>u.slice(Math.min(t,/^ */u.exec(u)[0].length))).join(`
40
+ `).trim());return c&&(n.text=c),n}function kS(e){let t=e.length,r=1/0;for(let n=e.length-1;n>=0;n--){let o=t7.indexOf(e[n].label.toLowerCase());if(o===-1||o>=r)break;r=o,t=n}return{paragraphs:e.slice(0,t),fields:e.slice(t).map(n=>[wS.get(n.label.toLowerCase()),n.body])}}function xS(e,t,r){let n=[],o=rs(t),i=e.endsWith("\u2026")?e.slice(0,-1).trimEnd():"";!e||o===e||i&&o.startsWith(i)?n.push(t):n.push(e,t);for(let{label:s,body:a}of r)n.push(a?`**${s}:** ${a}`:`**${s}:**`);return n.filter(Boolean).join(`
41
+
42
+ `)}var DL,fS,zL,pS,jL,WL,KL,JL,ZL,QL,wS,t7,$S=w(()=>{"use strict";os();wa();$r();Cc();DL=new Map(Object.entries(va).map(([e,t])=>[t.toLowerCase(),e])),fS=new Map(Object.entries(yt).map(([e,t])=>[t.toLowerCase(),e])),zL=new Set(es);pS=" \xB7 flagged critical by the analyzer",jL=" (varies across reports \u2014 ";WL=new Set(["max","xhigh","high","medium","low","minimal"]),KL=new Set(["list","isolate"]);JL=new Map([["location",(e,t)=>Object.assign(e,HL(t))],["severity",(e,t)=>Object.assign(e,VL(t))],["confidence",(e,t)=>{let r=/^(\d+(?:\.\d+)?)\/10$/u.exec(t);r&&(e.confidence=Number(r[1]))}],["revalidation",(e,t)=>{let r=XL(t);r&&(e.revalidate=r)}],["revalidated by",(e,t)=>{let r=t.trim();r&&(e.revalidateSource=fS.get(r.toLowerCase())??r)}],["repository",(e,t)=>{e.repo={github:vb(t)}}],["introduced in",(e,t)=>{e.commitHash=qL(t)}],["package",(e,t)=>{e.package=YL(t)}],["priority",(e,t)=>{e.priority=/^-?\d+(?:\.\d+)?$/u.test(t)?Number(t):t}],["found while analyzing",(e,t)=>{e.discoveredIn=xn(t)??t}],["detailed report",(e,t)=>{e.reportPath=xn(t)??t}],["commit audited",(e,t)=>{e.auditedCommit=xn(t)??t}],["id",(e,t)=>{e.id=xn(t)??t}],...[["category","category"],["status","status"],["branch","branch"],["date created","dateCreated"],["detected at","detectedAt"],["committed at","committedAt"],["poc status","pocStatus"],["variant of","parent"],["slug","slug"]].map(([e,t])=>[e,(r,n)=>{r[t]=n}])]);ZL=/^- \*\*([^*\n]+?):\*\* ?(.*)$/u;QL=/^(\d+)\. (.*)$/u;wS=new Map([["impact","impact"],["reproduction","reproduction"],["recommendation","recommendation"],["confidence reasoning","confidenceReason"],["revalidation verdict","revalidateVerdict"],["revalidation recommendation","revalidateRecommendation"]]),t7=[...wS.keys()]});function SS(e){let t=xr(e).trim();if(!r7.test(t))return null;let{head:r,subs:n}=Zi(t,yc),o=[];for(let{heading:i,body:s}of n){if(i.trim().toLowerCase()==="summary")continue;let a=s7(i);for(let c of Zn(s,vc))o.push(l7(c,a))}return d7(a7(r),o)}function s7(e){let t=/^(.*?)\s*\(\d+\)\s*$/u.exec(e.trim());return ss(t?t[1]:e)}function a7(e){let t=new Map;for(let r of e.matchAll(o7)){let n=r[1].trim().toLowerCase();t.has(n)||t.set(n,r[2].trim())}return{sources:(t.get("source")??"").split(",").map(r=>Np(r).source).filter(Boolean),analyzers:(t.get("analyzer")??t.get("analyzers")??"").split(";").map(r=>r.trim()).filter(Boolean),repo:t.has("repository")?vb(t.get("repository")):""}}function l7({heading:e,body:t},r){let n=e.trim().replace(/^\d+\.\s+/u,""),o=Zi(t,Ji).subs.filter(i=>n7.test(i.heading.trim()));return o.length===0?[_S(t,4,n,r)]:o.map(i=>_S(i.body,5,n,r))}function _S(e,t,r,n){let{title:o,facts:i,rest:s}=bS(e),{lead:a,sections:c}=yS(s,t),u={file:"unknown",line:"?"},p=null;for(let[x,$]of i)x.trim().toLowerCase()==="analyzer"?p=Np($):gS(u,x,$);u.severity||(u.severity=n||"medium");let f=o||r,h=f!=="Untitled finding"&&f!==vt(u),g=c.filter(x=>!i7.has(x.label.toLowerCase())).map(x=>({label:x.label,body:Ca(x.body)})),{paragraphs:b,fields:y}=kS(g);u.description=xS(h?f:"",Ca(a),b);let k=c.filter(x=>x.label.toLowerCase()==="evidence").flatMap(x=>vS(x.body));k.length>0&&(u.evidence=k);for(let[x,$]of y)u[x]=$;let v=c.find(x=>x.label.toLowerCase()==="severity correction");return v?.body&&(u.correctedSeverityReason=Ca(v.body)),{finding:u,analyzer:p}}function c7(e,t){let r={source:null,run:{}};if(t.some(o=>o.analyzer!==null)){let o=new Set(t.map(i=>i.analyzer?.source??null));o.size===1&&!o.has(null)&&([r.source]=o);for(let i of t)i.analyzer?.run?Object.assign(i.finding,i.analyzer.run):i.analyzer?.source&&!r.source&&(i.finding.source=i.analyzer.source);return r}let n=e.analyzers.length===1?Np(e.analyzers[0]):null;return n?.source?r.source=n.source:n?.run?r.run=n.run:e.analyzers.length===0&&e.sources.length===1&&([r.source]=e.sources),r}function d7(e,t){let r=t.flat(),{source:n,run:o}=c7(e,r),i={},s=new Set(r.map(u=>u.finding.type).filter(Boolean)),a=o.type??(s.size===1?[...s][0]:null)??(n?"security":null);a&&(i.type=a),n&&(i.source=n);for(let u of["model","effort","exportsMode"])o[u]&&(i[u]=o[u]);e.repo&&(i.repo={github:e.repo});let c=t.map(u=>u.map(p=>p.finding));return c.every(u=>u.length===1)?i.findings=c.flat():i.groups=c,i}var r7,n7,o7,i7,CS=w(()=>{"use strict";os();$r();$S();r7=/^<!--\s*DeepView findings export\b[^>]*-->/u,n7=/^Case \d+ of \d+(?:\s|$)/u,o7=/^- \*\*([^*\n]+?):\*\* ?(.*)$/gmu,i7=new Set(["evidence","severity correction","comment"])});function ES(e){let t=p7(e);if(!t)return null;let{severity:r,description:n,location:o,file:i,line:s}=t;return o?{severity:r,description:n,location:o}:{severity:r,description:n,file:i,line:s}}function p7(e){let t=e.indexOf(`
43
+ `),r=(t===-1?e:e.slice(0,t)).trim();if(!r)return null;let n=t===-1?"":e.slice(t+1),{sectionsText:o,metaText:i}=f7(n),s=h7(o),a=m7(i),{file:c,line:u,locationLink:p}=g7(s.location||""),f=(a.severity||"").toLowerCase();return{severity:u7.has(f)?f:"medium",description:b7(r,s),location:p,file:c||"unknown",line:u}}function f7(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,""),i=t.exec(o),s=i?o.slice(0,i.index):o;return{sectionsText:n,metaText:s}}function h7(e){let t={},r=e.split(/^## /mu);for(let n=1;n<r.length;n++){let o=r[n],i=o.indexOf(`
44
+ `),s=(i===-1?o:o.slice(0,i)).trim().toLowerCase(),a=(i===-1?"":o.slice(i+1)).trim();s&&(t[s]=a)}return t}function m7(e){let t={};for(let r of e.matchAll(/\*\*([^:]+):\*\*\s*(.+)/gu))t[r[1].trim().toLowerCase()]=r[2].trim();return t}function g7(e){let t="",r="?",n="",o=e.match(/\[([^\]]+)\]\(([^)]+)\)/u);if(o){t=o[1].trim(),n=o[2];let s=o[2].match(/#L(\d+)/u);s&&(r=s[1])}else t=e.trim(),n=e.trim();let i=t.match(/^(.+):(\d+)$/u);return i&&(t=i[1],r==="?"&&(r=i[2])),{file:t,line:r,locationLink:n}}function b7(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"]}`),y7(r.join(`
45
+
46
+ `))}function y7(e){return e.replaceAll("**","")}var u7,RS=w(()=>{"use strict";u7=new Set(["critical","high","medium","low","high_bug","bug","informational"])});function TS(e){let t=xr(e).trim();if(!t.startsWith("# "))return null;let r=t.split(/^# /mu).filter(o=>o.trim().length>0),n=[];for(let o of r){let i=w7(o);i&&n.push(i)}return n.length===0?null:{type:"security",source:"claude-security",findings:n}}function w7(e){let{title:t,body:r}=wc(e);if(!t)return null;let{sectionsText:n,metaText:o}=k7(r),i=x7(n),s=$7(o),a=E7(i.evidence||""),{file:c,line:u,locationLink:p}=IS(i.location||a[0]?.ref||""),f=(s.severity||"").toLowerCase(),h=v7.has(f)?f:"medium",g=M7(t,i,a.length>0),b={file:c||"unknown",line:u,severity:h,description:g};p&&(b.location=p),a.length>0&&(b.evidence=a.map(R7)),i["reproduction steps"]&&(b.reproduction=_7(i["reproduction steps"])),i["recommended fix"]&&(b.recommendation=i["recommended fix"]),s.repository&&(b.repo={github:s.repository}),s.branch&&(b.branch=s.branch),s["date created"]&&(b.dateCreated=s["date created"]),s.status&&(b.status=s.status),s.category&&(b.category=s.category);let y=ES(e);return y&&(b._idBasis=y),b}function k7(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,""),i=t.exec(o),s=i?o.slice(0,i.index):o;return{sectionsText:n,metaText:s}}function x7(e){let t={};for(let r of e.split(/^## /mu).slice(1)){let{title:n,body:o}=wc(r),i=n.toLowerCase();i&&(t[i]=o.trim())}return t}function $7(e){let t={};for(let r of e.matchAll(/\*\*([^:]+):\*\*\s*(.+)/gu))t[r[1].trim().toLowerCase()]=r[2].trim();return t}function IS(e){let t="",r="?",n="",o=ya(e);if(o){t=o.label.trim(),n=o.url.trim();let s=n.match(/#L(\d+)(?:-L?(\d+))?/u);s&&(r=s[2]?`${s[1]}-${s[2]}`:s[1])}else t=e.trim(),n=e.trim();t=xc(t.replaceAll("`","")).trim();let i=t.match(/^(.+):(\d+)(?:\s*[-–—]\s*L?(\d+))?$/u);return i&&(t=i[1],r==="?"&&(r=i[3]?`${i[2]}-${i[3]}`:i[2])),{file:t,line:r,locationLink:n,linked:o!==null}}function _7(e){let t=e.split(`
47
+ `),r=t.findIndex(a=>a.trim());if(r===-1||!ba.test(t[r])||t.some((a,c)=>c!==r&&ba.test(a)))return e;let n=t[r].replace(/^ */u,""),o=n.replace(ba,"");if(!o.trim())return e;let i=MS(o)??MS(n);if(i===null&&(ba.test(o)||C7.test(n)))return e;let s=i===null?[o]:i.length===1?[i[0].step]:i.map(({number:a,step:c})=>`${a}. ${c}`);return t.splice(r,1,...s),t.join(`
48
+ `)}function MS(e){let t=[...e.matchAll(S7)];if(t.length===0||t[0].index!==0)return null;let r=[];for(let[n,o]of t.entries()){let i=Number(o[1]);if(n>0&&i<=r[n-1].number)return null;let s=e.slice(o.index+o[0].length,t[n+1]?.index).trim();if(!s)return null;r.push({number:i,step:s})}return r}function E7(e){let t=[];for(let r of e.split(`
49
+ `))AS.test(r)?t.push({ref:r.replace(AS,"").trim(),note:[]}):t.length>0&&r.trim()&&t.at(-1).note.push(r.trim());if(t.length===0){let r=e.split(`
50
+ `).map(i=>i.trim()).filter(Boolean),n=r.findIndex(i=>ya(i)!==null);if(n===-1&&r.length!==1)return[];let o=n===-1?0:n;t.push({ref:r[o],note:r.filter((i,s)=>s!==o)})}return t.filter(r=>r.ref)}function R7({ref:e,note:t}){let{file:r,line:n,locationLink:o,linked:i}=IS(e),s={file:r||"unknown",line:n};o&&i&&(s.url=o);let a=t.join(`
51
+ `);return a&&(s.text=a),s}function M7(e,t,r){let n=[e];return t.details&&n.push(t.details),t.evidence&&!r&&n.push(`**Evidence:**
52
+ ${t.evidence}`),t.impact&&n.push(`**Impact:** ${t.impact}`),n.join(`
53
+
54
+ `)}var v7,S7,C7,AS,LS=w(()=>{"use strict";RS();$r();v7=new Set(["critical","high","medium","low","high_bug","bug","informational"]);S7=/(?:^|[ \t])(\d{1,9})\)(?=[ \t]|$)/gu,C7=/^\d{1,9}\)(?=[ \t]|$)/u;AS=/^[ \t]*(?:\d+[.)]|[-*+])\s+/u});function A7(e){let t=(e||"").trim(),r="",n=/\[([^\]]+)\]\(([^)]+)\)/u.exec(t);n&&(t=n[1].trim(),r=n[2].trim());let o="",i=/#L(\d+)/u.exec(r);i&&(o=i[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 Dp({severity:e,description:t,ref:r,lineBullet:n="",id:o=""}){let i=A7(r),s=i.file||"unknown",a=i.line==="?"&&n?n:i.line,c=i.locationLink||(s==="unknown"&&o?`piolium:${o}`:"");return c?{severity:e,description:t,location:c}:{severity:e,description:t,file:s,line:a}}var wb=w(()=>{"use strict"});function eo(e,t){if(!t.source)for(let r of FS)e[r]==null&&t[r]!=null&&(e[r]=t[r])}function Ec(e){return I7.test(e)}function qr(e){let t=e?.repo?.github;if(typeof t!="string")return null;let r=t.trim().replace(/\/+$/u,"");if(!r)return null;let n=T7.exec(r),o=(n?`${n[1]}/${n[2]}`:r).replace(/\.git$/u,"");return Ec(o)?o:null}function as(e){let r=(typeof e?.directory=="string"?e.directory.trim():"").replace(/^(?:\.\/)+/u,"").replaceAll(/^\/+|\/+$/gu,"").replaceAll(/\/{2,}/gu,"/");return!r||r==="."||/[?#]/u.test(r)||r.split("/").includes("..")?"":r}var FS,T7,I7,zp=w(()=>{"use strict";FS=["type","model","think","effort","exportsMode"];T7=/^(?:https?:\/\/)?(?:www\.)?github\.com\/([^/?#]+)\/([^/?#]+?)(?:\.git)?(?:[/?#].*)?$/iu,I7=/^[\w.-]+\/[\w.-]+$/u});function zo(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 Rc(e){let t=/^([CHML])-?\d+$/iu.exec((e||"").trim());return t?{C:"critical",H:"high",M:"medium",L:"low"}[t[1].toUpperCase()]:""}function kb(e){let t=/^(critical|high|medium|low|informational|info)(?:[ -](?:severity|risk))?(?:[ -]findings?)?(?:\s*\(\d+\))?$/iu.exec((e||"").trim());return t?zo(t[1]):""}function BS(e){let t=/^(critical|high|medium|low|informational|info)\b/iu.exec((e||"").trim());return t?zo(t[1]):""}function Hp(e){return/^variants?\s*(?:\(\d+\))?\s*:?$/iu.test((e||"").trim())}function jp(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 Up(e){return(e||"").replaceAll("-"," ")}function Mc(e){let t=(e||"").trim(),r=/^\[([^\]]+)\]\([^)]*\)$/u.exec(t);return Q_(r?r[1]:t).toUpperCase()}function xb(e){let t=/^\[([^\]]+)\]\(([^)]+)\)\s*[:—–-]*\s*(.*)$/u.exec(e);return t?{text:t[3]?`${t[1].trim()} ${t[3].trim()}`:t[1].trim(),link:t[2].trim()}:null}function $b(e){let t=e.search(/\s/u),r=(t===-1?e:e.slice(0,t)).replace(/[:.,—–-]+$/u,""),n=jp(r);if(!n)return null;let o=(t===-1?"":e.slice(t+1)).replace(/^[:—–-]+\s*/u,"").trim();return{id:n.id,slug:n.slug,rest:o}}function _b(e){let{text:t,link:r}=xb(e)??{text:e,link:""},n=/^\[([^\]]+)\] *(.*)$/u.exec(t);if(n){let i=jp(n[1].trim());return i?{id:i.id,title:n[2].trim()||Up(i.slug)||i.id,link:r}:{id:n[1].trim().toUpperCase(),title:n[2].trim(),link:r}}let o=$b(t);return o?{id:o.id,title:o.rest||Up(o.slug)||o.id,link:r}:{id:"",title:t.trim(),link:r}}function OS(e){let t={},r=i=>(/`([^`]+)`/u.exec(i)?.[1]??i.split(/\s+/u)[0]??"").trim(),n=/^\s*(?:[-*] +)?\*\*Target:?\*\*\s*(.*)$/imu.exec(e||"");if(n){let i=r(n[1]);Ec(i)&&(t.repo=i)}let o=/^\s*(?:[-*] +)?\*\*Commit[^:*]*:?\*\*\s*(.*)$/imu.exec(e||"");if(o){let i=r(o[1]);Fp(i)&&(t.commitHash=i)}return t}function Cb(e){for(let t of Sb)if(e[t])return e[t];return""}var Sb,Eb=w(()=>{"use strict";$r();zp();Sb=["key code reference","key code","code reference","location","affected file","file","path"]});function Vp(e){return{id:Mc(e.id||""),title:Qi(e.title),severity:Qi(e.severity),pocStatus:Qi(e["poc status"]||e.poc),status:Qi(e.status),parent:Mc(Qi(e.parent||"")),location:Qi(e.location)}}function Wp(e,t=""){let r=zo(e.severity)||t||Rc(e.id)||"medium",{file:n,line:o,locationLink:i}=Bp(e.location||""),s={file:n||"unknown",line:o,severity:r,description:hb(e.title||e.id)};return i?s.location=i:s.file==="unknown"&&e.id&&(s.location=`piolium:${e.id}`),s._idBasis=Dp({severity:r,description:s.description,ref:e.location||"",id:e.id}),e.pocStatus&&(s.pocStatus=e.pocStatus),e.status&&(s.status=e.status),e.parent&&(s.parent=e.parent),s}function Rb(e,t,r){let n=[];for(let o of e.split(`
55
+ `)){let i=/^\s{0,3}(?:[-*+]|\d{1,3}[.)])\s+(.+)$/u.exec(o);if(!i)continue;let s=i[1].trim();if(/^\*\*[^:*]+:\*\*/u.test(s))continue;let a=xb(s),c=a?.link??"";if(a)s=a.text;else{let y=/^\*\*([^*]+)\*\*\s*[:—–-]*\s*(.*)$/u.exec(s);y&&(s=y[2]?`${y[1].trim()} ${y[2].trim()}`:y[1].trim())}if(/^(?:none\b|no |n\/a\b)/iu.test(s))continue;let u=$b(s),p=u?.id??"",f=s;if(u){let y=Up(u.slug);f=y&&u.rest?`${y}
56
+
57
+ ${u.rest}`:u.rest||y||u.id}let h=r.get(p),b={file:"unknown",line:"?",severity:zo(h?.severity)||t||Rc(p)||"medium",description:hb(f)};p?b.location=`piolium:${p}`:c&&(b.location=c),c.endsWith("report.md")&&(b.reportPath=c),h?.pocStatus&&(b.pocStatus=h.pocStatus),h?.status&&(b.status=h.status),h?.parent&&(b.parent=h.parent),n.push({id:p,finding:b})}return n}function Mb(e,t,r,n=""){let o=[];for(let s of kc(e)){let a=Vp(s);!a.id&&!a.title||(!a.parent&&r&&(a.parent=r),a.id&&!t.has(a.id)&&t.set(a.id,a),o.push({id:a.id,finding:Wp(a,n)}))}if(o.length>0)return o;let i=Rb(e,n,t);for(let s of i)r&&!s.finding.parent&&(s.finding.parent=r);return i}var PS=w(()=>{"use strict";$r();wb();Eb()});function F7(e){return L7.has(e)||e.startsWith("findings by severity")}function O7(e){return B7.test(e)}function NS(e){let{id:t}=_b(e);return!!(t&&jp(t))}function P7(e){let t=Zn(e,vc);return(t.length>0?t:Zn(e,Ji)).some(({heading:n})=>NS(n))}function DS(e){let t=xr(e).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=U7(t),n=H7(r["summary of findings"]||""),o=OS(Zi(t,yc).head),i=[],s=new Set,a=[],c=({id:p,finding:f})=>{i.push(f),p&&s.add(p)},u=p=>{for(let f of p)c(f)};for(let[p,f]of Object.entries(r)){let h=kb(p);h||F7(p)?u(Ab(f,h,n,a)):!O7(p)&&P7(f)&&u(Ab(f,BS(p),n,a))}for(let p of a)(!p.id||!s.has(p.id))&&c(p);for(let p of n.values())s.has(p.id)||c({id:p.id,finding:Wp(p)});if(i.length===0)return null;for(let p of i)o.repo&&(p.repo={github:o.repo}),o.commitHash&&!p.auditedCommit&&(p.auditedCommit=o.commitHash);return{type:"security",source:"piolium",findings:i}}function N7(e,t,r,n){let o=[],i="";for(let{heading:s,body:a}of e){let c=kb(s);if(c)o.push(...Ab(a,c,t,r)),i="";else if(Hp(s))o.push(...z7(a,t,i,r,n));else{let u=D7(s,a,t,r,n);o.push(...u),i=u[0]?.id||i}}return o}function D7(e,t,r,n,o){let{head:i,subs:s}=Zi(t,Ji),a=zS(e,i,r,o),c=a!==null&&!a.id&&s.some(p=>!Hp(p.heading)&&NS(p.heading)),u=a&&!c?[a]:[];return u.push(...Tb(s,r,n,o,a?.id||"")),u}function z7(e,t,r,n,o){let{head:i,subs:s}=Zi(e,Ji);return n.push(...Mb(i,t,r,o)),Tb(s,t,n,o,"")}function Tb(e,t,r,n,o){let i=[],s="";for(let{heading:a,body:c}of e){if(Hp(a)){r.push(...Mb(c,t,o??s,n));continue}let u=zS(a,c,t,n);u&&(i.push(u),s=u.id||s)}return i}function Ab(e,t,r,n){let o=Zn(e,vc);if(o.length>0)return N7(o,r,n,t);let i=Tb(Zn(e,Ji),r,n,t,null);if(i.length>0)return i;let s=kc(e).map(Vp).filter(a=>a.id||a.title);if(s.length>0){for(let a of s)!a.severity&&t&&(a.severity=t),a.id&&!r.has(a.id)?r.set(a.id,a):a.id||n.push({id:"",finding:Wp(a,t)});return[]}return n.push(...Rb(e,t,r)),[]}function zS(e,t,r,n=""){let o=e.trim();if(!o)return null;let{id:i,title:s,link:a}=_b(o),c=r.get(i);!i&&s&&(c=[...r.values()].find(E=>E.title.toLowerCase()===s.toLowerCase()),i=c?.id??"");let{fields:u,labels:p,prose:f}=J_(t),h=zo(u.severity)||zo(c?.severity)||n||Rc(i)||"medium",g=Bp(Cb(u)),b=/\d+/u.exec(u.line||u.lines||"")?.[0]??"",y=g.line==="?"&&b?b:g.line,k=/\*\*Variant of:?\*\*\s*\[?([^\]\s)]+)/iu.exec(t),v=f.split(`
58
+ `).filter(E=>!/^\s*<a\s[^>]*>\s*<\/a>\s*$/iu.test(E)&&!/\*\*Variant of:?\*\*/iu.test(E)).join(`
59
+ `).trim(),x={file:g.file||"unknown",line:y,severity:h,description:V7(s||i,u,p,v)};g.locationLink?x.location=g.locationLink:x.file==="unknown"&&i&&(x.location=`piolium:${i}`),x._idBasis=Dp({severity:h,description:x.description,ref:Cb(u),lineBullet:b,id:i});let $=u["poc status"]||u.poc||c?.pocStatus;$&&(x.pocStatus=$);let C=u["detailed report"]||(a.endsWith("report.md")?a:"");C&&(x.reportPath=C),c?.status&&(x.status=c.status);let I=c?.parent||(k?Mc(k[1]):"");return I&&(x.parent=I),{id:i,finding:x}}function U7(e){let t=Object.create(null);for(let{heading:r,body:n}of Zn(e,yc)){let o=r.trim().toLowerCase();o&&(t[o]=o in t?`${t[o]}
60
+ ${n}`:n)}return t}function H7(e){let t=new Map;for(let r of kc(e)){let n=Vp(r);n.id&&t.set(n.id,n)}return t}function V7(e,t,r,n){let o=[e];t.summary&&o.push(t.summary),n&&o.push(n);for(let[i,s]of Object.entries(t))!s||j7.has(i)||o.push(`**${r[i]||i}:** ${s}`);return o.filter(Boolean).join(`
61
+
62
+ `)}var L7,B7,j7,US=w(()=>{"use strict";$r();wb();PS();Eb();L7=new Set(["technical findings detail","technical findings","detailed findings","findings detail","findings"]);B7=/^(?:summary of findings|deferred|methodolog|executive|conclusion|attack surface|coverage|discoveries|scope|table of contents|contents|appendix|recommendation|remediation)/u;j7=new Set([...Sb,"severity","summary","files","poc","poc status","line","lines","detailed report","proof of concept","evidence","variant of","pattern","status","id","title"])});function Ib(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 W7.encode(e)}var W7,HS=w(()=>{"use strict";W7=new TextEncoder});function K7(e){return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}async function Lb(e){let t=typeof e=="string"?Ib(e):e,r=new Uint8Array(await crypto.subtle.digest("SHA-512",t));return`sha512-${btoa(String.fromCodePoint(...r))}`}async function G7(e){let t=Ib(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=K7(n);return`${o.slice(0,8)}-${o.slice(8,12)}-${o.slice(12,16)}-${o.slice(16,20)}-${o.slice(20,32)}`}async function Fb(e){if(typeof crypto?.subtle?.digest!="function")return null;let t=q7(e);try{return await G7(t)}catch{return null}}function q7(e){if(e._idBasis)return e._idBasis;let{severity:t,description:r}=e;return e.fileHash?{severity:t,description:r,fileHash:e.fileHash}:e.location?{severity:t,description:r,location:e.location}:{severity:t,description:r,file:e.file,line:e.line}}var Bb=w(()=>{"use strict";HS()});function X7(e){let t=[],r=[],n="",o=!1,i=e.length;for(let s=0;s<i;s++){let a=e[s];o?a==='"'?e[s+1]==='"'?(n+='"',s++):o=!1:n+=a:a==='"'?o=!0:a===","?(r.push(n),n=""):a===`
63
+ `||a==="\r"?(r.push(n),t.push(r),r=[],n="",a==="\r"&&e[s+1]===`
64
+ `&&s++):n+=a}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 J7(e,t){return t.map(r=>{let n=Object.create(null);return e.forEach((o,i)=>{n[o]=r[i]??""}),n})}function Ac(e){let t=X7(e);if(t.length<2)throw new Error("Codex CSV: empty or missing header row");let[r,...n]=t;for(let s of Y7)if(!r.includes(s))throw new Error(`Codex CSV: missing required column "${s}"`);let o=new Map;for(let s of J7(r,n)){let a=s.configured_scan_id;a&&(o.has(a)||o.set(a,[]),o.get(a).push(s))}if(o.size===0)throw new Error("Codex CSV: no rows with a configured_scan_id");let i=[];for(let[s,a]of o){let c=new Set(a.map(f=>f.repository).filter(Boolean));if(c.size>1)throw new Error(`Codex CSV: scan ${s} contains multiple repositories: ${[...c].join(", ")}`);let p=`${[...c][0]||"unknown-repo"}:${s.replace(/^[^:]+:/u,"")}`;i.push({displayName:p,data:{type:"security",source:"codex-security",findings:a.map(Z7)}})}return i}function Z7(e){let t=e.relevant_paths.split(" | ").map(o=>o.trim()).find(Boolean)||"unknown",r=[e.title,e.description].filter(Boolean).join(`
65
+
66
+ `),n={id:e.finding_url,file:t,line:"?",severity:(e.severity||"medium").toLowerCase(),description:r,repo:{github:e.repository}};return e.commit_hash&&(n.commitHash=e.commit_hash),e.detected_at&&(n.detectedAt=e.detected_at),e.committed_at&&(n.committedAt=e.committed_at),n}var Y7,jS=w(()=>{"use strict";Y7=["finding_url","repository","title","description","severity","configured_scan_id","relevant_paths"]});function Q7(){let e=[],t=new Map,r=i=>{if(!t.has(i)){let s={security:!1};s.parent=s,t.set(i,s),typeof i=="string"&&e.push(i)}return t.get(i)},n=i=>{let s=i;for(;s.parent!==s;)s=s.parent;for(;i.parent!==i;){let a=i.parent;i.parent=s,i=a}return s};return{nodeFor:r,root:n,join:(i,s)=>{i=n(i),s=n(s),i!==s&&(s.parent=i,i.security||=s.security)},ids:e}}function to(e,{source:t,linkedIds:r=()=>[],knownRows:n=()=>[]}={}){let{nodeFor:o,root:i,join:s,ids:a}=Q7(),c=[],u=(h,g=!1)=>{let b;for(let y of h){if(!y||typeof y!="object")continue;let k=o(y.id||y);i(k).security||=g?y.isSecurity===!0:mb(y,y._source??y.source??t),b?s(b,k):b=k,g||c.push([y,k])}};for(let h of e)u(h);let p=new Set;for(let h=0;h<a.length;h++){let g=a[h],b=o(g);for(let y of r(g))s(b,o(y));for(let y of n([g]))p.has(y)||(p.add(y),u(y.members,!0))}let f=!1;for(let[h,g]of c){let b=i(g).security;h.isSecurity!==b&&(h.isSecurity=b,f=!0)}return f}var VS=w(()=>{"use strict";os()});function Ob(e){let t=lt(e)||vt(e)||"Untitled finding";return t.length>WS?`${t.slice(0,WS-1).trimEnd()}\u2026`:t}function Pb(e){let t=String(e??"").trim();return Fe(t)?Op(t):Ec(t)?is(t,`https://github.com/${t}`):t}function qS(e,t,r){return t?yt[t]??String(t):_c(e,r)}function Yr(e){return typeof e=="number"?Number.isFinite(e)?String(e):"":typeof e=="string"?e.replaceAll(/\s*\n\s*/gu," ").trim():""}function KS(e){return typeof e=="string"?e.trim():""}function nF(e,t){let r=t.severityMode==="original",n=vn(ce(e,t.severityMode));cr(e)&&(n+=r?` \u2014 corrected to ${vn(wn(e))}`:` \u2014 corrected from ${vn(e.severity)}`);let o=ka(e);if(o){let i=Object.entries(o).map(([s,a])=>`${s||"this report"}: ${vn(a?.severity)}`);n+=` (varies across reports \u2014 ${i.join("; ")})`}return e.critical===!0&&(n+=" \xB7 flagged critical by the analyzer"),n}function oF(e,t){let r=vt(e);if(!r)return"";let n=t.hooks.location(e),o=Fe(n)?is(pt(r),n):pt(r),i=Qn(e);return i?`${o} \xB7 ${pt(i)}`:o}function iF(e){if(!e)return"";let t=[],r=No[e.triage]??(e.ignored?No.ignored:"");return r&&t.push(r),e.color&&t.push(`${$c[e.color]??e.color} mark`),e.flagged===!0&&t.push("Flagged"),t.join(" \xB7 ")}function sF(e){let t=Yr(e);return t?yt[t]??t:""}function aF(e,t){let r=Yr(e.commitHash);if(!r)return"";let n=t.hooks.commit(e);return Fe(n)?is(pt(r.slice(0,7)),n):pt(r)}function lF(e,t,r){let n=[],o=(p,f)=>{f&&n.push(`- **${p}:** ${f}`)};o("Location",oF(e,t)),o("Severity",nF(e,t)),e.confidence!==void 0&&e.confidence!==null&&o("Confidence",`${e.confidence}/10`),t.showAnalyzer&&o("Analyzer",t.analyzerOf(e)),o("Category",Yr(e.category));let i=t.revalidation?Te(e):"";i&&o("Revalidation",i==="revalidation"?"the revalidation pass itself":i),i&&o("Revalidated by",sF(e.revalidateSource)),o("Triage",iF(r)),r?.fix&&o("Fix",Op(String(r.fix).trim())),t.showReport&&o("Report",pt(t.hooks.report(e)??""));let s=Yr(e.repo?.github);s&&s!==t.repo&&o("Repository",Pb(s)),o("Introduced in",aF(e,t));let a=Yr(e.discoveredIn);a&&a!==String(e.file??"").trim()&&o("Found while analyzing",pt(a));let c=e.package?.npm,u=Yr(c?.name);u&&o("Package",pt(Yr(c.version)?`${u}@${Yr(c.version)}`:u));for(let[p,f]of tF)o(p,Yr(e[f]));for(let[p,f]of rF)o(p,pt(Yr(e[f])));return o("ID",pt(Yr(e.id))),n.join(`
67
+ `)}function Kp(e,t,r){let n=Sa(r);return n?`${kn(e,t)}
68
+
69
+ ${n}`:kn(e,t)}function cF(e,t){return(Array.isArray(e.evidence)?e.evidence:[]).map((n,o)=>{let i=`${o+1}. `,s=vt(n),a=t.hooks.evidence(n,e,o),c="";s?c=Fe(a)?is(pt(s),a):pt(s):Fe(a)&&(c=Op(a));let u=Sa(ns(n)),p=i+(c||"(no reference)");return u?`${p}
70
+
71
+ ${uS(i,u)}`:p}).join(`
72
+
73
+ `)}function dF(e,t,r){let n=Do(e),o=xr(n.body),i=lt(e),s=i!==""&&Ob(e)!==i,a=!s&&!n.title&&o.trim()===i,c=s&&rs(o)!==i?`${i}
74
+
75
+ ${o}`:o,u=$a(a?"":c),p=u.findIndex(y=>y.label!==null),f=p===-1?u:u.slice(0,p),h=p===-1?[]:u.slice(p),g=f.map(y=>Sa(y.body)),b=cF(e,t);b&&g.push(`${kn(r,"Evidence")}
76
+
77
+ ${b}`);for(let y of h)g.push(y.label===null?Sa(y.body):Kp(r,y.label,y.body));return g}function GS(e,t,r){let n=t.hooks.annotation(e),o=[lF(e,t,n),...dF(e,t,r)];for(let[s,a,c]of eF){if(c&&!t.revalidation)continue;let u=e[a],p=typeof u=="string"?Ft(u,e):"";p.trim()&&o.push(Kp(r,s,p))}cr(e)&&KS(e.correctedSeverityReason)&&o.push(Kp(r,"Severity correction",e.correctedSeverityReason));let i=KS(n?.comment);return i&&o.push(Kp(r,"Comment",i)),o}function YS(e,t,{headingText:r,depth:n}){let o=[kn(n,r)];if(e.length===1)return Sc([...o,...GS(e[0],t,n+1)]);let i=[...new Set(e.map(c=>t.hooks.report(c)).filter(Boolean))],s=i.length>1?` \u2014 reported in ${i.map(c=>pt(c)).join(", ")}`:"";o.push(`${_a(e.length,"case")} of this finding${s}.`);let a=lt(e[0]);return e.forEach((c,u)=>{let p=vt(c);o.push(kn(n+1,`Case ${u+1} of ${e.length}${p?` \u2014 ${pt(p)}`:""}`));let f=lt(c);f&&f!==a&&o.push(Sa(f)),o.push(...GS(c,t,n+2))}),Sc(o)}var WS,eF,tF,rF,XS=w(()=>{"use strict";os();wa();Cc();zp();$r();WS=120;eF=[["Impact","impact",!1],["Reproduction","reproduction",!1],["Recommendation","recommendation",!1],["Confidence reasoning","confidenceReason",!1],["Revalidation verdict","revalidateVerdict",!0],["Revalidation recommendation","revalidateRecommendation",!0]],tF=[["Status","status"],["Branch","branch"],["Date created","dateCreated"],["Detected at","detectedAt"],["Committed at","committedAt"],["PoC status","pocStatus"],["Variant of","parent"],["Slug","slug"],["Priority","priority"]],rF=[["Detailed report","reportPath"],["Commit audited","auditedCommit"]]});function fF(e){let t={};for(let[r,n]of Object.entries(pF))t[r]=typeof e?.[r]=="function"?e[r]:n;return t}function hF(e,t){let r=o=>typeof o?.source=="string"&&o.source?o.source:null;if(e.length===1)return o=>r(o)??e[0].source??null;let n=new Map(e.map(o=>[o.name,o.source??null]));return o=>r(o)??n.get(t.report(o))??null}function mF(e,t,r){let n=e.view?.revalidation!==!1,o=(Array.isArray(e.reports)?e.reports:[]).filter(u=>u&&typeof u=="object"),i=hF(o,t),s=u=>qS(u,i(u),n),a=new Set(r.map(s)),c=new Set(r.map(u=>t.report(u)).filter(Boolean));return{hooks:t,analyzerOf:s,severityMode:e.view?.severityMode==="original"?"original":"corrected",revalidation:n,showAnalyzer:a.size>1,showReport:c.size>1||o.length>1,repo:typeof e.repo=="string"&&e.repo?e.repo:null}}function gF(e){if(!e)return"";let t=[e.bucket?`${e.bucket} findings`:"Live findings"];return e.severityMode==="original"?t.push("original analyzer severities"):e.severityMode==="corrected"&&t.push("corrected severities"),e.revalidation===!1?t.push("code view \u2014 the revalidation pass is not applied"):e.revalidation===!0&&(e.revalidationDetail===!0?t.push("detailed app view \u2014 the revalidation pass is applied, with the rows it re-rated"):e.revalidationDetail===!1?t.push("app view \u2014 the revalidation pass is applied, standing in for the rows it re-rated"):t.push("app view \u2014 the revalidation pass is applied")),t.join(" \xB7 ")}function bF(e){if(!e)return"";let t=Number(e.included)||0,r=Number(e.total)||0;return r===0?"no findings":t>=r?`all ${_a(r,"finding")}`:`${t} of ${_a(r,"finding")} (${r-t} filtered out)`}function yF(e,t,r){let n=[],o=(p,f)=>{f&&n.push(`- **${p}:** ${f}`)},i=Array.isArray(e.reports)?e.reports:[],s=[...new Set(i.map(p=>yt[p?.source]??"").filter(Boolean))];o("Source",s.join(", "));let a=i.map(p=>p?.name).filter(Boolean);o(a.length===1?"Report":"Reports",a.map(p=>pt(p)).join(", ")),o("Workspace",typeof e.workspace=="string"?e.workspace.trim():""),t.repo&&o("Repository",Pb(t.repo));let c=[...new Set(r.map(t.analyzerOf).filter(Boolean))],u=c.length===s.length&&c.every(p=>s.includes(p));return c.length>0&&!u&&o(c.length===1?"Analyzer":"Analyzers",c.join("; ")),e.generatedAt&&o("Exported",lS(e.generatedAt)),o("View",gF(e.view)),Array.isArray(e.filters)&&o("Filters",e.filters.length>0?e.filters.map(p=>`${p.label}: ${p.value}`).join(" \xB7 "):"none"),o("Included",bF(e.counts)),n.join(`
78
+ `)}function vF(e,t){let r=new Map;for(let s of e){let a=ce(s[0],t.severityMode)??"informational";r.has(a)||r.set(a,[]),r.get(a).push(s)}let n=[...Le,...[...r.keys()].filter(s=>!Le.includes(s))],o=new Set,i=[];for(let s of n)for(let a of r.get(s)??[]){let c=i.length+1,u=Ob(a[0]),p=`${c}. ${u}`;i.push({group:a,number:c,severity:s,title:u,headingText:p,slug:aS(p,o)})}return i}function JS(e){let t=new Map;for(let r of e)t.set(r.severity,(t.get(r.severity)??0)+1);return t}function wF(e,t){let r={flagged:0,marked:0,commented:0,fixed:0};for(let{group:o}of e)for(let i of o){let s=t.hooks.annotation(i);s&&(s.flagged===!0&&r.flagged++,s.color&&r.marked++,s.comment&&r.commented++,s.fix&&r.fixed++)}let n=[];return r.flagged&&n.push(`${r.flagged} flagged`),r.marked&&n.push(`${r.marked} colour-marked`),r.commented&&n.push(`${r.commented} commented`),r.fixed&&n.push(`${r.fixed} with a fix link`),n.length>0?`Annotations: ${n.join(", ")}.`:""}function kF(e){let t=e.some(({group:o})=>o.some(i=>i.confidence!==void 0&&i.confidence!==null)),r=["#","Severity","Finding","Location"];t&&r.push("Confidence");let n=e.map(o=>{let i=o.group[0],s=o.group.length>1?` (${_a(o.group.length,"case")})`:"",a=vt(i),c=[String(o.number),vn(o.severity),is(bb(sS(o.title)),`#${o.slug}`)+s,a?bb(pt(a)):""];return t&&c.push(i.confidence===void 0||i.confidence===null?"":`${i.confidence}/10`),c});return yb(r,n,["right"])}function xF(e,t){let r=[kn(2,"Summary")];if(e.length===0)return[...r,"No findings are included."];let n=[...JS(e)].map(([i,s])=>[vn(i),String(s)]);n.push(["**Total**",`**${e.length}**`]),r.push(yb(["Severity","Findings"],n,["left","right"]));let o=wF(e,t);return o&&r.push(o),r.push(kF(e)),r}function $F(e,t){let r=JS(e),n=[],o=null;for(let i of e)i.severity!==o&&(o=i.severity,n.push(kn(2,`${vn(o)} (${r.get(o)})`))),n.push(YS(i.group,t,{headingText:i.headingText,depth:3}));return n}function Nb(e={},t={}){let r=fF(t),n=(Array.isArray(e.groups)?e.groups:[]).map(c=>Array.isArray(c)?c:[c]).map(c=>c.filter(u=>u&&typeof u=="object")).filter(c=>c.length>0),o=n.flat(),i=mF(e,r,o),s=vF(n,i),a=[uF,kn(1,typeof e.title=="string"&&e.title.trim()?e.title.trim():"Findings"),yF(e,i,o),...xF(s,i),...$F(s,i)];return`${Sc(a)}
79
+ `}var uF,pF,ZS=w(()=>{"use strict";os();wa();XS();Cc();uF="<!-- DeepView findings export -->",pF={annotation:()=>null,location:e=>typeof e?.location=="string"?e.location:null,evidence:e=>typeof e?.url=="string"?e.url:null,commit:()=>null,report:()=>null}});function Bt(e){return Array.isArray(e?.findings)?e.findings:Array.isArray(e?.groups)?e.groups:null}function Gp(e,t){return typeof t=="string"&&/\.csv$/iu.test(t)?"codex":ro(e).format}function ro(e){let t;try{let r=JSON.parse(e);return Bt(r)?{data:r,format:"json",reason:null}:{data:null,format:null,reason:"JSON, but not a report: no findings array"}}catch(r){t=r}for(let[r,n]of _F){let o=n(e);if(o)return{data:o,format:r,reason:null}}return{data:null,format:null,reason:`Not JSON, and not a recognized markdown format. (JSON error: ${t.message})`}}function QS(e){let{data:t}=ro(e);return t?{count:Bt(t).length,source:t.source,recognized:!0}:{count:0,recognized:!1}}function SF(e){return e.flat().filter(t=>t&&typeof t=="object")}async function Db(e){let t=e.filter(n=>!n.id);if(t.length===0)return;let r=await Promise.all(t.map(Fb));t.forEach((n,o)=>{r[o]&&(n.id=r[o])})}async function Xt(e){let{data:t,format:r}=ro(e);if(!t)return null;let n=SF(Bt(t));return await Db(n),{format:r,data:t,findings:n}}var _F,Ee=w(()=>{"use strict";nS();CS();LS();US();Bb();jS();Bb();zp();VS();ZS();wa();os();$r();Cc();_F=[["deepview-md",SS],["deepsec",rS],["piolium",DS],["claude-security",TS]]});function e2(){Ea=null}function Tc(){return _()&&Ea?.teamId===l.currentManagedTeam&&Ea?.userId===l.managedSession?.id&&Ea?.role===l.managedSession?.role?Ea:null}function t2(e,t){let r=new Map,n=new Map,o=[],i=[];for(let s of t){let a=s.data;if(a.source==="links"&&Array.isArray(a.links)){o.push({id:s.id,name:s.filename,groups:a.links,skipped:0}),Lp(a.links,n);continue}for(let[c,u]of(Bt(a)??[]).entries()){let p=(Array.isArray(u)?u:[u]).filter(h=>h&&typeof h=="object").map(h=>{let g={...h,_managedReportId:s.id,_reportName:s.filename,_repoFallback:s.repo.github,_repoDirectory:s.repo.directory,_source:h.source??a.source??null,_bundleHashes:a.bundleHashes??[]};return eo(g,a),g._analyzer=g._source??g.type??null,"isApp"in g||(g.isApp=Gr(g,g._source)),g}),f={report:s.filename,managedReportId:s.id,index:c,members:p};i.push(f);for(let h of p)r.has(h.id)||r.set(h.id,[]),r.get(h.id).push(f)}}Ea={teamId:e,userId:l.managedSession?.id,role:l.managedSession?.role,links:o,rows:i,byId:r,duplicates:n},l.linksTick++,l.findingIndexTick++}function qp(e){let t=Tc();return[...new Set(e.flatMap(r=>t?.byId.get(r)??[]))]}function r2(e){for(let t of qp([e])){let r=lt(t.members.find(n=>n.id===e));if(r)return r}return""}var Ea,Ic=w(()=>{"use strict";Yt();ga();Ee();Ea=null});function Uo(e){if(e?.name!==CF)return!1;let t=e.version;return!t||t===EF}function o2(e){let t=e?.package?.npm,r=t?.version;if(typeof r=="string"&&r&&!Uo(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 i=o[1],s=i.indexOf("_");s>0&&(i=i.slice(0,s));let a=i.lastIndexOf("@");return a<=0?null:i.slice(a+1)||null}function Yp(){return{keys:new Set,findings:[],files:new Map,reports:new Set,_keyReports:new Map}}function Xp(e,t,r,n){e.reports.add(r);let o=e._keyReports.get(t);o||e._keyReports.set(t,o=new Set);let i=!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)),i}function Jp(e,t,r,n){e._keyReports.delete(t),e.keys.delete(t);let o=e.findings.findIndex(a=>n(a)===t);o>=0&&e.findings.splice(o,1);let i=e.files.get(r);if(!i)return;let s=i.findIndex(a=>n(a)===t);s>=0&&i.splice(s,1),i.length===0&&e.files.delete(r)}function Zp(e){let t=new Set;for(let r of e._keyReports.values())for(let n of r)t.add(n);e.reports=t}function i2(e,t,r,n,o){let i=e.byVersion.get(t);i||(i=Yp(),e.byVersion.set(t,i)),Xp(i,n,o,r)}function s2(e,t,r,n,o,i){let s=e.byVersion.get(t);if(!s)return;let a=s._keyReports.get(r);if(a&&(a.delete(o),a.size===0&&Jp(s,r,n,i)),s._keyReports.size===0){e.byVersion.delete(t);return}Zp(s)}function zb(e,t){if(e===t)return 0;if(e===null)return 1;if(t===null)return-1;let[r,n=""]=n2(e,"-"),[o,i=""]=n2(t,"-"),s=r.split("."),a=o.split("."),c=Math.max(s.length,a.length);for(let u=0;u<c;u++){let p=s[u]??"0",f=a[u]??"0",h=/^\d+$/u.test(p),g=/^\d+$/u.test(f);if(h&&g){let b=Number(f)-Number(p);if(b!==0)return b}else{let b=f.localeCompare(p);if(b!==0)return b}}return n===""&&i!==""?-1:n!==""&&i===""?1:i.localeCompare(n)}function n2(e,t){let r=e.indexOf(t);return r<0?[e,""]:[e.slice(0,r),e.slice(r+1)]}var CF,EF,Ub=w(()=>{"use strict";CF="solidity-bundle",EF="0.0.0"});async function Ra(e){let t=new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(t).arrayBuffer())}async function $n(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=[],i=0;for(;;){let{value:c,done:u}=await n.read();if(u)break;if(i+=c.length,i>t){try{await n.cancel()}catch{}throw new Error(`gunzipBytes: decompressed size exceeds ${t}-byte cap`)}o.push(c)}let s=new Uint8Array(i),a=0;for(let c of o)s.set(c,a),a+=c.length;return s}async function Lc(e){return await Ra(ve(e))}async function ls(e){return it(await $n(e))}var Ma=w(()=>{"use strict";At()});async function a2(e){let t=await crypto.subtle.digest("SHA-512",e);return`sha512-${new Uint8Array(t).toBase64()}`}var l2=w(()=>{"use strict"});function u2(e,t,r,n){return navigator.locks.request(`deepview-storage/${e}/${t}`,{mode:r},n)}function p2(e,t,r){return u2(e,t,"shared",r)}function Oc(e,t,r){return u2(e,t,"exclusive",()=>navigator.locks.request(un,{mode:"shared"},r))}async function Gb(e,{create:t,warnOnce:r=!1}={}){try{return await(await navigator.storage.getDirectory()).getDirectoryHandle(e,{create:t})}catch(n){return r&&!c2&&(c2=!0,console.warn("OPFS unavailable, falling back to gzipped localStorage (limited quota).",n)),null}}async function Pc(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 qb(e,t){if(!Tt(e))return e;if(!dt())throw new Error(`storage: vault locked, cannot decrypt "${t}"`);return await F_(e,t)}function rf(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 Yb(e,t){Fc(e)===t&&(console.warn(`storage: report "${e}" is an empty/corrupt on-disk entry \u2014 quarantining, will read as missing`),await navigator.locks.request(un,{mode:"exclusive"},async()=>{if(Fc(e)!==t)return;De(e),_r.delete(e);let r=await Vo();if(r)try{await r.removeEntry(e)}catch{}nf(e),De(e),cs(e,"delete")}))}async function Xb(e,t,r){try{(await t.getFile()).size===0&&await e.removeEntry(r)}catch{}}async function Aa(e,t,r,n,o=()=>{}){if(fe()&&!dt())throw o(),new Error(`storage: vault locked, cannot save ${n}`);let i=dt(),s=i?await t(e,r):e;if(dt()!==i)throw o(),new Error(`storage: vault state changed mid-save for ${n}; retry`);return s}function Vo(){return Gb(RF,{create:!0,warnOnce:!0})}function Qp(e){try{return localStorage.getItem(jo+e)}catch{return null}}function nf(e){try{localStorage.removeItem(jo+e)}catch{}}function MF(){let e=[];for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);r&&r.startsWith(jo)&&e.push(r.slice(jo.length))}return e}function De(e){Hb.set(e,(Hb.get(e)??0)+1)}function Fc(e){return Hb.get(e)??0}function dr(e){return jb.add(e),()=>jb.delete(e)}function cs(e,t){for(let r of jb)try{r(e,t)}catch(n){console.warn("storage file-change listener:",n)}}async function me(){let e=new Set(MF()),t=await Vo();if(t)for await(let[r]of t.entries())e.add(r);return[...e].toSorted()}async function Sr(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 De(e),Oc("report",e,async()=>{let r=await Vo();if(r){let i=await Ra(ve(t));i=await Aa(i,dp,e,`"${e}"`,()=>De(e));let s=await r.getFileHandle(e,{create:!0}),a=await s.createWritable();try{await a.write(i),await a.close()}catch(c){_r.delete(e),De(e);try{await a.abort(c)}catch{}throw await Xb(r,s,e),c}_r.set(e,t),De(e),nf(e),cs(e,"save");return}let n=ve(t);n=await Ra(n),n=await Aa(n,dp,e,`"${e}"`,()=>De(e));let o=n.toBase64();try{localStorage.setItem(jo+e,o),_r.set(e,t),De(e),cs(e,"save")}catch(i){throw De(e),new Error(`localStorage write failed for ${e}: ${i.message}`,{cause:i})}})}async function d2(e,t){let r=Qp(e);if(r===null)return null;let n=Uint8Array.fromBase64(r);if(n=await qb(n,e),rf(n))throw await Yb(e,t),new Error(`File not found: ${e}`);return it(await $n(n))}async function ze(e){if(_r.has(e))return _r.get(e);if(Ho.has(e))return Ho.get(e);let t=Fc(e),r=(async()=>{let n=await Vo();if(n){let i;try{i=await n.getFileHandle(e)}catch(u){if(u instanceof DOMException&&u.name==="NotFoundError"){let p=await d2(e,t);if(p!==null)return Sr(e,p).catch(f=>{console.warn(`storage: stranded-localStorage migration of "${e}" failed:`,f)}),p}throw u}let s=await i.getFile(),a=new Uint8Array(await s.arrayBuffer());if(a=await qb(a,e),rf(a))throw await Yb(e,t),new Error(`File not found: ${e}`);if(a.length>=2&&a[0]===31&&a[1]===139){let u=await $n(a);return it(u)}let c=it(a);return Sr(e,c).catch(u=>{console.warn(`storage: legacy-uncompressed migration of "${e}" failed:`,u)}),c}let o=await d2(e,t);if(o===null)throw new Error(`File not found: ${e}`);return o})();Ho.set(e,r);try{let n=await r;return Fc(e)===t&&_r.set(e,n),n}finally{Ho.delete(e)}}async function Wo(e){let t=Fc(e),r=await Vo(),n;if(r){let o=null;try{o=await r.getFileHandle(e)}catch(i){if(!(i instanceof DOMException)||i.name!=="NotFoundError")throw i;let s=Qp(e);if(s===null)throw i;n=Uint8Array.fromBase64(s)}if(o){let i=await o.getFile();n=new Uint8Array(await i.arrayBuffer())}}else{let o=Qp(e);if(o===null)throw new Error(`File not found: ${e}`);n=Uint8Array.fromBase64(o)}if(n=await qb(n,e),rf(n))throw await Yb(e,t),new Error(`File not found: ${e}`);return n}async function f2(e){let t=await Wo(e),r=t[0]===31&&t[1]===139?await $n(t):t;return it(r)}async function Jb(e,t){if(typeof e!="string"||e.includes("\0"))throw new Error("Invalid report name: contains NUL byte or is not a string");if(rf(t))throw new Error(`Refusing to save empty report bytes for "${e}"`);return De(e),_r.delete(e),Oc("report",e,async()=>{let r=await Aa(t,dp,e,`"${e}"`,()=>De(e)),n=await Vo();if(n){let o=await n.getFileHandle(e,{create:!0}),i=await o.createWritable();try{await i.write(r),await i.close()}catch(s){De(e);try{await i.abort(s)}catch{}throw await Xb(n,o,e),s}De(e),nf(e),cs(e,"save");return}try{localStorage.setItem(jo+e,r.toBase64()),De(e),cs(e,"save")}catch(o){throw De(e),new Error(`localStorage write failed for ${e}: ${o.message}`,{cause:o})}})}async function Ta(e){return De(e),_r.delete(e),Ho.delete(e),Oc("report",e,async()=>{let t=await Vo();if(t){try{await t.removeEntry(e)}catch(r){if(!(r instanceof DOMException)||r.name!=="NotFoundError")throw De(e),r}nf(e),De(e),cs(e,"delete");return}localStorage.removeItem(jo+e),De(e),cs(e,"delete")})}function h2(e){return Vb.add(e),()=>Vb.delete(e)}function tf(e,t){for(let r of Vb)try{r(e,t)}catch(n){console.warn("storage bundle-change listener:",n)}}function us(){return Gb(Kb,{create:!0})}function ds(e){return e.replaceAll("/","_")}async function Zb(e){let t;try{let o=await(await e.getFileHandle(Bc)).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(Tt(t)){if(!dt())return console.warn("readBundleMeta: vault locked, returning empty bundle list"),[];try{r=await pp(t,Wb)}catch(o){return console.warn("readBundleMeta: decrypt failed (tampering, key mismatch, or vault identity drift):",o),[]}}try{let n=JSON.parse(it(r));return Array.isArray(n)?n:[]}catch(n){return console.warn("readBundleMeta: JSON.parse failed:",n),[]}}async function m2(e,t){let r=ve(JSON.stringify(t));r=await Aa(r,up,Wb,"bundle metadata");try{await e.removeEntry(Bc)}catch{}let n=await e.getFileHandle(Bc,{create:!0});await Pc(n,r)}function Qb(e){return navigator.locks.request(g2,e)}async function Ot(){let e=await us();return e?[...await navigator.locks.request(g2,{mode:"shared"},()=>Zb(e))].toSorted((r,n)=>r.name.localeCompare(n.name)):[]}function Nc(){return y2(()=>!0)}function b2(){return y2((e,t)=>t.kind==="file"&&/^sha512-[A-Za-z0-9+_]{86}==$/u.test(e))}async function y2(e){if(typeof navigator>"u"||!navigator.storage?.getDirectory)return!1;let t=await Gb(Kb,{create:!1});if(!t)return!1;try{for await(let[r,n]of t.entries())if(e(r,n))return!0}catch{}return!1}async function ps(e,t){let r=await us();if(!r)throw new Error(`Cannot save bundle ${e}: OPFS unavailable`);let n=t instanceof Uint8Array?t:ve(t),o=await a2(n),i=ds(o),s=e.toLowerCase().endsWith(".map")?await Ra(n):n;return Oc("bundle",o,async()=>{s=await Aa(s,up,o,`bundle "${e}"`);try{await r.removeEntry(i)}catch{}let a=await r.getFileHandle(i,{create:!0});await Pc(a,s);try{await Qb(async()=>{let c=await Zb(r),u=c.findIndex(p=>p.integrity===o);u>=0?c[u]={integrity:o,name:e}:c.push({integrity:o,name:e}),await m2(r,c)})}catch(c){try{await r.removeEntry(i),tf(o,"delete")}catch{}throw c}return tf(o,"save"),{integrity:o,name:e}})}async function ey(e){let t=await us();if(t)return Oc("bundle",e,async()=>{try{await t.removeEntry(ds(e))}catch(r){if(!(r instanceof DOMException)||r.name!=="NotFoundError")throw r}tf(e,"delete");try{await Qb(async()=>{try{await t.removeEntry(ds(e)+ef)}catch(o){if(!(o instanceof DOMException)||o.name!=="NotFoundError")throw o}let r=await Zb(t),n=r.filter(o=>o.integrity!==e);n.length!==r.length&&await m2(t,n)})}finally{tf(e,"delete")}})}async function Xr(e){let t=await us();if(!t)throw new Error("OPFS unavailable");let n=await(await t.getFileHandle(ds(e))).getFile(),o=new Uint8Array(await n.arrayBuffer());if(Tt(o)){if(!dt())throw new Error(`storage: vault locked, cannot read bundle "${e}"`);o=await pp(o,e)}return o.length>=2&&o[0]===31&&o[1]===139?await $n(o):o}async function ty(e){let t=await us();if(!t||fe()&&!dt())return null;try{let r=await t.getFileHandle(ds(e)+ef),n=new Uint8Array(await(await r.getFile()).arrayBuffer());return Tt(n)&&(n=await pp(n,e+ef)),JSON.parse(it(await $n(n)))}catch{return null}}async function ry(e,t){let r=await Ra(ve(JSON.stringify(t)));return navigator.locks.request(un,{mode:"shared"},()=>Qb(async()=>{let n=await us();if(!n)return;await n.getFileHandle(ds(e));let o=e+ef,i=await Aa(r,up,o,"bundle index"),s=await n.getFileHandle(ds(o),{create:!0});await Pc(s,i)}))}async function AF(e,t){let r=await Vo();if(r){let s=null;try{s=await r.getFileHandle(e)}catch(a){if(!(a instanceof DOMException)||a.name!=="NotFoundError")throw a}if(s){let a=await s.getFile(),c=new Uint8Array(await a.arrayBuffer()),u=await t(c);if(u===null)return;_r.delete(e),Ho.delete(e),De(e);let p=await r.getFileHandle(e,{create:!0});try{await Pc(p,u)}catch(f){throw await Xb(r,p,e),f}De(e);return}}let n=Qp(e);if(n===null)return;let o=Uint8Array.fromBase64(n),i=await t(o);i!==null&&(_r.delete(e),Ho.delete(e),De(e),localStorage.setItem(jo+e,i.toBase64()),De(e))}function v2(e,t){return e.seal?r=>Tt(r)?null:e.seal(r,t):r=>Tt(r)?e.open(r,t):null}async function w2(e){let t=await me();for(let r of t)try{await AF(r,v2(e,lp(r)))}catch(n){if(n instanceof DOMException&&n.name==="NotFoundError")continue;throw n}}async function TF(){let e=await us();if(!e)return{dir:null,keys:[]};let t=[];for await(let[r]of e.entries())t.push(r);return{dir:e,keys:t}}function IF(e){return e===Bc?Wb:e.startsWith("sha512-")?e.replaceAll("_","/"):null}async function LF(e,t,r){let o=await(await e.getFileHandle(t)).getFile(),i=new Uint8Array(await o.arrayBuffer()),s=await r(i);if(s===null)return;let a=await e.getFileHandle(t,{create:!0});await Pc(a,s)}async function k2(e){let{dir:t,keys:r}=await TF();if(t)for(let n of r){let o=IF(n);if(o!==null)try{await LF(t,n,v2(e,cp(o)))}catch(i){if(i instanceof DOMException&&i.name==="NotFoundError")continue;throw i}}}var Wb,RF,Kb,jo,c2,_r,Ho,Hb,jb,Bc,ef,Vb,g2,ny,oy,iy,sy,ur=w(()=>{"use strict";At();Ma();l2();ua();Wb="__meta__",RF="deepview-reports",Kb="deepview-bundles",jo="deepview.report:";c2=!1;_r=new Map,Ho=new Map,Hb=new Map;jb=new Set;Bc="_meta.json",ef=".index-v1",Vb=new Set;g2=`${Kb}/${Bc}`;ny=({seal:e})=>w2({seal:e}),oy=({open:e})=>w2({open:e});iy=({seal:e})=>k2({seal:e}),sy=({open:e})=>k2({open:e});Je(()=>{_r.clear(),Ho.clear()})});function FF(e){let t=e?.package?.npm;if(typeof t?.name=="string"&&t.name&&!Uo(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 BF(e){return typeof e?.file!="string"?!1:/(?:^|\/)(?:node_modules|dependencies)\//u.test(e.file)}function OF(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}function cy(e){return ay.add(e),()=>ay.delete(e)}function dy(){for(let e of ay)try{e()}catch{}}function uy(e){return fs.get(e)?.list??[]}function py(){let e=0;for(let t of fs.values())e+=t.list.length;return e}function _n(){return Ia}function ms(){return La}function Uc(e,t){let r=fs.get(e);if(!r)return[];let n=r.reports.get(Ko(t));return n?[...n]:[]}function fy(e,t){let r=Ia.get(e);if(!r)return[];let n=r._keyReports.get(Ko(t));return n?[...n]:[]}function hy(e,t){let r=La.get(e);if(!r)return[];let n=r._keyReports.get(Ko(t));return n?[...n]:[]}function gs(e){return _()?[...new Set(qp([e]).map(t=>t.report))]:[...hs.get(e)?.reports.keys()??[]]}function my(e){if(_())return r2(e);for(let{title:t}of hs.get(e)?.reports.values()??[])if(t)return t;return""}function Go(e){if(_())return qp(e);let t=new Set;for(let r of e)for(let n of hs.get(r)?.reports.values()??[])for(let o of n.rows)t.add(o);return[...t]}function Ko(e){return e.id?`id:${e.id}`:`c:${e.severity??""}|${e.description??""}|${e.file??""}|${e.line??""}`}function sf(e,t,r){let n=of.get(e);n||(n={hash:[],pkg:[],repo:[],id:[]},of.set(e,n)),n[t].push(r)}function PF(e,t,r){let n=hs.get(e.id);n||hs.set(e.id,n={reports:new Map});let o=n.reports.get(t);return o?(o.rows.add(r),!1):(n.reports.set(t,{title:lt(e),rows:new Set([r])}),sf(t,"id",e.id),!0)}function NF(e,t,r){let n=fs.get(e.fileHash);n||(n={keys:new Set,list:[],reports:new Map},fs.set(e.fileHash,n));let o=n.reports.get(t);o||(o=new Set,n.reports.set(t,o));let i=!o.has(r);return o.add(r),i&&sf(r,"hash",{hash:e.fileHash,key:t}),n.keys.has(t)?i:(n.keys.add(t),n.list.push(e),!0)}function DF(e,t,r){let n=FF(e);if(!n)return!1;let o=o2(e),i=Ia.get(n);if(i||(i={...Yp(),repos:new Set,byVersion:new Map,_repoReports:new Map},Ia.set(n,i)),typeof e.repo?.github=="string"&&e.repo.github){i.repos.add(e.repo.github);let a=i._repoReports.get(e.repo.github);a||i._repoReports.set(e.repo.github,a=new Set),a.add(r)}i2(i,o,e,t,r);let s=Xp(i,t,r,e);return sf(r,"pkg",{pkg:n,key:t,file:e.file,version:o}),s}function zF(e,t,r,n){if(BF(e))return!1;let o=OF(e,n);if(!o)return!1;let i=La.get(o);i||(i=Yp(),La.set(o,i));let s=Xp(i,t,r,e);return s&&sf(r,"repo",{repo:o,key:t,file:e.file}),s}function gy(e){let t=of.get(e);if(of.delete(e),zc.delete(e),!t)return!1;let r=!1;for(let{hash:o,key:i}of t.hash){let s=fs.get(o);if(!s)continue;let a=s.reports.get(i);if(a){if(a.delete(e)&&(r=!0),a.size===0){s.reports.delete(i),s.keys.delete(i);let c=s.list.findIndex(u=>Ko(u)===i);c>=0&&s.list.splice(c,1)}s.keys.size===0&&fs.delete(o)}}let n=new Set;for(let{pkg:o,key:i,file:s,version:a}of t.pkg){let c=Ia.get(o);if(!c)continue;let u=c._keyReports.get(i);if(u){if(u.delete(e)&&(r=!0),u.size===0&&Jp(c,i,s,Ko),s2(c,a,i,s,e,Ko),!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?Ia.delete(o):Zp(c)}}for(let{repo:o,key:i,file:s}of t.repo){let a=La.get(o);if(!a)continue;let c=a._keyReports.get(i);c&&(c.delete(e)&&(r=!0),c.size===0&&Jp(a,i,s,Ko),a._keyReports.size===0?La.delete(o):Zp(a))}for(let o of t.id){let i=hs.get(o);i&&(i.reports.delete(e)&&(r=!0),i.reports.size===0&&hs.delete(o))}return r}async function UF(e){if(zc.has(e))return!1;zc.add(e);try{let t=await ze(e),r=await Xt(t);if(!r)return!1;let{data:n,findings:o}=r;if(o.length===0)return!1;for(let a of o)eo(a,n);to(Bt(n).map(a=>Array.isArray(a)?a:[a]),{source:n.source});let i=qr(n)??"";if(!i)try{i=It(e)}catch{}let s=!1;for(let a of o){let c=Ko(a);a.fileHash&&NF(a,c,e)&&(s=!0),a.file&&DF(a,c,e)&&(s=!0),a.file&&zF(a,c,e,i)&&(s=!0)}for(let[a,c]of Bt(n).entries()){let u=(Array.isArray(c)?c:[c]).filter(f=>f?.id);if(u.length===0)continue;let p={report:e,index:a,members:u.map(f=>{let h=f.source??n.source??null;return{id:f.id,title:lt(f),source:h,revalidate:Te(f),isApp:f.isApp??Gr(f,h),isSecurity:f.isSecurity}})};for(let f of u)PF(f,e,p)&&(s=!0)}return zc.has(e)?s:(gy(e),ly=!0,!1)}catch{return zc.delete(e),!1}}function Cr(){return _()?Promise.resolve():Dc||(Dc=(async()=>{try{do{ly=!1;let e=await me();for(let t of e)await UF(t)&&dy()}while(ly)}finally{Dc=null}})(),Dc)}var fs,Ia,La,hs,of,zc,ay,Dc,ly,x2=w(()=>{"use strict";Yt();Ic();Ub();ur();Yt();Ee();fs=new Map,Ia=new Map,La=new Map,hs=new Map,of=new Map;zc=new Set,ay=new Set,Dc=null,ly=!1;dr(e=>{gy(e)&&dy()});j_(e=>{gy(e)&&dy(),Cr().catch(()=>{})})});function yy(e){return by.add(e),()=>by.delete(e)}function $2(){for(let e of by)try{e()}catch{}}function jc(e,t){if(!e||!t)return!1;let r=!Fa.has(e);Fa.set(e,t),af.delete(e);for(let[n,o]of t){if(!o)continue;let i=Hc.get(o);i||(i=new Map,Hc.set(o,i)),i.set(e,n)}return r&&$2(),r}function vy(e){let t=Fa.get(e);if(Fa.delete(e),af.delete(e),!!t){for(let r of t.values()){let n=Hc.get(r);n&&(n.delete(e),n.size===0&&Hc.delete(r))}$2()}}function wy(e,t){let r=Fa.get(e);if(!r||typeof t!="string"||t==="")return null;if(r.has(t))return t;let n=HF(e,r).get(_2(t));if(!n)return null;let o=t.startsWith("/")?t:`/${t}`,i=null;for(let s of n)if(s.endsWith(o)){if(i!==null)return null;i=s}return i}function _2(e){let t=e.lastIndexOf("/");return t<0?e:e.slice(t+1)}function HF(e,t){let r=af.get(e);if(r)return r;r=new Map;for(let n of t.keys()){let o=_2(n),i=r.get(o);i?i.push(n):r.set(o,[n])}return af.set(e,r),r}function bs(e){if(!e)return[];let t=Hc.get(e);if(!t)return[];let r=[];for(let[n,o]of t)r.push({integrity:n,file:o});return r}function ky(e){return Fa.has(e)}var Hc,Fa,af,by,S2=w(()=>{"use strict";Hc=new Map,Fa=new Map,af=new Map,by=new Set});function cf(){return Wc||(Wc=VF(),Wc)}function VF(e=Ae(C2)){let t;try{t=JSON.parse(e||"{}")}catch{t={}}return jF.has(t?.__v)?t.__v=xy:t={__v:xy},t}function $y(){st(C2,JSON.stringify(Wc)).catch(e=>console.warn("counts persist:",e))}function E2(e,t=cf()){if(e==="__v")return;let r=t[e];if(r!==void 0)return typeof r=="number"?{count:r}:r}function Kc(e){return E2(e)?.count}function Jt(e){return E2(e)?.source}function Pt(e,t,r){let n=cf();n[e]={count:t,source:r??null},$y()}function Oa(e){let t=cf();delete t[e],$y()}function Nt(e){let t=yn(e);return t?{count:Ip(t.groups),source:at,recognized:!0}:QS(e)}function WF(e,t){for(let{names:r,onUpdate:n}of lf)if(r.has(e))try{n(e,t)}catch(o){console.warn("ensureCounts onUpdate:",o)}}function _y(e,t){if(Vc){t&&lf.push({names:new Set(e),onUpdate:t});for(let r of e)Ba.add(r);return Vc}return Ba=new Set(e),lf=t?[{names:new Set(e),onUpdate:t}]:[],Vc=(async()=>{await Promise.resolve();try{let r=cf();for(;Ba.size>0;){let n=Ba.values().next().value;if(Ba.delete(n),r[n]===void 0)try{let o=await ze(n);if(r[n]!==void 0)continue;let{count:i,source:s}=Nt(o);r[n]=s?{count:i,source:s}:{count:i},$y(),WF(n,i)}catch{}}}finally{Vc=null,Ba=null,lf=null}})(),Vc}var C2,xy,jF,Wc,Vc,Ba,lf,Pa=w(()=>{"use strict";ur();Ee();ga();Vr();C2="deepview.fileCounts",xy=4,jF=new Set([3,xy]),Wc=null;Vc=null,Ba=null,lf=null});async function Gc(e){let t=Uint8Array.fromBase64(e),r=ve(KF),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)),s=Array.from(o.subarray(0,16),u=>u.toString(16).padStart(2,"0")).join("").split("");s[12]="8";let a=parseInt(s[16],16)&3|8;s[16]=a.toString(16);let c=s.join("");return`${c.slice(0,8)}-${c.slice(8,12)}-${c.slice(12,16)}-${c.slice(16,20)}-${c.slice(20,32)}`}var KF,Sy=w(()=>{"use strict";At();KF=`deepview/workspace-id/v1
80
+ `});function qc(e){let t=new Set;function r(o){return t.add(o),()=>t.delete(o)}function n(o){for(let i of t)try{i(o)}catch(s){console.warn(`workspace ${e} listener failed:`,s)}}return{on:r,fire:n}}var R2,M2,A2,T2,I2,GF,Yc,Cy,Xc,Ey,df,Ry,My,uf,pf,Ay=w(()=>{"use strict";R2=qc("create"),M2=qc("delete"),A2=qc("privateKey"),T2=qc("report-membership"),I2=qc("bundle-membership"),GF=R2.on,Yc=M2.on,Cy=A2.on,Xc=T2.on,Ey=I2.on,df=R2.fire,Ry=M2.fire,My=A2.fire,uf=T2.fire,pf=I2.fire});function Jc(){try{let e=Ae(Iy);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 YF(e){await st(Iy,JSON.stringify({version:qF,workspaces:e}))}function Na(e){return navigator.locks.request(XF,async()=>{await hn();let t=Jc(),r=await e(t);if(r!==!1)return await YF(t),r})}function Zc(e){return{id:e.id,privateKey:e.privateKey,reports:Array.isArray(e.reports)?[...e.reports]:[],bundles:Array.isArray(e.bundles)?[...e.bundles]:[]}}function Qc(){Jr=Jc().map(Zc)}function Ly(e){Jr=Jr.filter(t=>t.id!==e.id),Jr.push(Zc(e))}function JF(e,t){let r=Array.isArray(e[t])?[...e[t]]:[],n=Jr.find(o=>o.id===e.id);if(n){n[t]=r;return}Jr.push(Zc(e))}function ZF(e){Jr=Jr.filter(t=>t.id!==e)}function J(){let e=Jc();for(let t of e)Array.isArray(t.reports)||(t.reports=[]),Array.isArray(t.bundles)||(t.bundles=[]);return e}function Sn(e){let t=(e??"").trim();return t&&t.replaceAll(/[\u0000-\u001F\u007F]/gu,"").slice(0,QF)||null}async function Fy(e){let t=Sn(e);if(!t)return null;let r=new Uint8Array(32);crypto.getRandomValues(r);let n=r.toBase64(),o={id:await Gc(n),name:t,privateKey:n,reports:[],bundles:[],createdAt:Date.now()};return await Na(s=>s.some(a=>a.id===o.id)?!1:(s.push(o),o))?(Ly(o),o):null}async function By(e){await Na(r=>{let n=r.findIndex(o=>o.id===e);return n<0?!1:(r.splice(n,1),!0)})&&(Ry(e),ZF(e))}async function Oy(e,t){let r=Sn(t);return!(!r||!await Na(o=>{let i=o.find(s=>s.id===e);return!i||i.name===r?!1:(i.name=r,i)}))}async function L2(e){let t=await Na(o=>{let i=o.findIndex(p=>p.id===e.id),s=i>=0?o[i]:null,a=Sn(e.name)??s?.name??"Workspace",c=e.preserveBundles?Array.isArray(s?.bundles)?s.bundles:[]:Array.isArray(e.bundles)?e.bundles:[],u={id:e.id,name:a,privateKey:e.privateKey,reports:Array.isArray(e.reports)?[...new Set(e.reports)]:[],bundles:[...new Set(c)],createdAt:e.createdAt??Date.now()};return i>=0?o[i]=u:o.push(u),{previous:s,next:u}}),{next:r}=t,n=Jr.find(o=>o.id===r.id)??null;return n==null?df(r.id):(n.privateKey!==r.privateKey&&My(r.id),ff(n.reports,r.reports)||uf(r.id),ff(n.bundles,r.bundles)||pf(r.id)),Ly(r),r}async function Py({id:e,name:t,privateKey:r,createdAt:n}){let o=null;return await Na(i=>{let s=Sn(t);if(!s)return o={status:"name-collision",existing:null},!1;let a=i.find(p=>p.id===e)??null;if(a)return o={status:"already-attached",workspace:a},!1;let c=i.find(p=>Sn(p.name)===s)??null;if(c)return o={status:"name-collision",existing:c},!1;let u={id:e,name:s,privateKey:r,reports:[],bundles:[],createdAt:n??Date.now()};i.push(u),o={status:"attached",workspace:u}}),o?.status==="attached"&&(df(o.workspace.id),Ly(o.workspace)),o}function ff(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 Ty({identifier:e,workspaceId:t,field:r,fire:n,additive:o=!1,from:i=void 0}){let s=await Na(u=>{if((u.find(b=>Array.isArray(b[r])&&b[r].includes(e))?.id??null)===(t??null))return!1;let f=null;if(t!=null&&(f=u.find(b=>b.id===t)??null,!f))return!1;let h=new Set;if(!o)for(let b of u)i!==void 0&&b.id!==i||(Array.isArray(b[r])||(b[r]=[]),b[r].includes(e)&&(b[r]=b[r].filter(y=>y!==e),h.add(b.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 g=new Map;for(let b of h){let y=u.find(k=>k.id===b);y&&g.set(b,y)}return{affected:h,snapshot:g}});if(!s)return;let{affected:a,snapshot:c}=s;for(let u of a){n(u);let p=c.get(u);p&&JF(p,r)}}function F2(e,t){return{move:(r,n)=>Ty({identifier:r,workspaceId:n,field:e,fire:t}),add:(r,n)=>Ty({identifier:r,workspaceId:n,field:e,fire:t,additive:!0}),remove:(r,n)=>Ty({identifier:r,field:e,fire:t,from:n})}}function eB(){let e=Jc().map(Zc),t=Jr,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)||Ry(o);for(let[o,i]of n){let s=r.get(o);if(!s){df(o);continue}s.privateKey!==i.privateKey&&My(o),ff(s.reports,i.reports)||uf(o),ff(s.bundles,i.bundles)||pf(o)}Jr=e}var Iy,qF,XF,Jr,QF,Ny,Dy,ed,ys,td,zy,vs,Uy,qo=w(()=>{"use strict";Sy();Vr();Ay();Iy="deepview.workspaces",qF=1;XF=Iy;Jr=Jc().map(Zc);QF=200;Ny=F2("reports",uf),Dy=F2("bundles",pf),ed=Ny.move,ys=Ny.add,td=Ny.remove,zy=Dy.move,vs=Dy.add,Uy=Dy.remove;fn(()=>{eB()})});async function Hy(e){if(!e)return null;let t=J(),n=(await Promise.all(t.map(o=>$t("workspace",o.id)))).indexOf(e);return n===-1?null:t[n]}async function jy(e){if(!e)return null;let t=await me(),n=(await Promise.all(t.map(o=>$t("report",o)))).indexOf(e);return n===-1?null:t[n]}async function tB(e,t){let r;try{r=await ze(e)}catch{return!1}return r==null?!1:(await Xt(r))?.findings.some(o=>o.id===t)??!1}async function Vy(e,{skip:t=[]}={}){if(!e)return null;let r=new Set(t),n=(await me()).filter(o=>!r.has(o));for(let o of n)if(await tB(o,e))return o;return null}function rd(e){return e?J().filter(t=>t.reports.includes(e)):[]}var B2=w(()=>{"use strict";ma();ur();qo();Ee()});function Wy(e){if(!e)return"";for(let t of e.split(`
81
+ `))if(t.trim())return t.trim();return""}function Ky(e){let t=new Set(e.map(n=>n.id)),r=new Map;for(let n of l.reports)for(let o of n.groups)for(let i of o){let s=i.id??String(i._id);if(!(!t.has(s)||r.has(s))&&(r.set(s,{severity:i.severity,file:i.file,line:i.line,description:Wy(i.description)}),r.size===t.size))return r}return r}var Gy=w(()=>{"use strict";Yt()});function Jy(){return _()||Zr}function ws(e){return qy.add(e),()=>qy.delete(e)}function Da(){for(let e of qy)try{e()}catch(t){console.warn("linked-findings listener:",t)}}function Zy(){let e=new Map;for(let t of Yo.values())t&&Lp(t.groups,e);Xy=e}function Qy(){if(_())return Tc()?.links??[];let e=[];for(let[t,r]of Yo)r&&e.push({name:t,groups:r.groups,skipped:r.skipped});return e.toSorted((t,r)=>t.name.localeCompare(r.name))}function ev(){return _()?!!Tc()?.duplicates.size:Xy.size>0}function pr(e){if(_())return[...Tc()?.duplicates.get(e)??[]];let t=Xy.get(e);return t?[...t]:[]}async function O2(e){if(Yo.has(e))return!1;let t=hf.get(e)??0,r;try{r=await ze(e)}catch{return!1}if(r==null)return!1;if((hf.get(e)??0)!==t)return id=!0,!1;let n=/^\s*\[/u.test(r)?yn(r):null;if(Yo.set(e,n),n&&Jt(e)!==at)Pt(e,Ip(n.groups),at);else if(!n&&Jt(e)===at){let{count:o,source:i}=Nt(r);Pt(e,o,i)}return n!==null}function mf(){return _()?Promise.resolve():od||(od=(async()=>{try{let e,t;do{t=Yy,e=await me(),Zr&&e.some(o=>!Yo.has(o))&&(Zr=!1,Da());let r=e.filter(o=>Jt(o)===at);(await Promise.all(r.map(o=>O2(o)))).some(Boolean)&&(Zy(),Da())}while(t!==Yy);return e}catch(e){throw Zr&&(Zr=!1,Da()),e}finally{od=null}})(),od)}function sd(){return _()?Promise.resolve():nd||(nd=(async()=>{try{do{id=!1;let e=await mf(),t=!1;for(let o of e)await O2(o)&&(t=!0);let r=!id&&e.every(o=>Yo.has(o)),n=Zr!==r;Zr=r,t&&Zy(),(t||n)&&Da()}while(id)}catch(e){throw Zr&&(Zr=!1,Da()),e}finally{nd=null}})(),nd)}var Yo,Xy,hf,qy,nd,od,Yy,id,Zr,tv=w(()=>{"use strict";Yt();Ic();ga();ur();Pa();Yo=new Map,Xy=new Map,hf=new Map,qy=new Set,nd=null,od=null,Yy=0,id=!1,Zr=!1;dr(e=>{let t=Zr;Zr=!1,Yy++,hf.set(e,(hf.get(e)??0)+1),id=!0;let r=Yo.get(e)!=null;Yo.delete(e),r&&Zy(),(r||t)&&Da()})});function P2(e){return e==="inprogress"||e==="fixed"||e==="invalid"||e==="deleted"?e:void 0}function Ue(e){if(e)return P2(e.triage)??(e.deleted?"deleted":void 0)}function rB(e){return e?!e.color&&!Ue(e)&&!e.comment&&!e.fix&&!(e.ignoredReports&&e.ignoredReports.length>0)&&e.flagged===void 0:!0}function no(e,t,r){let n=e.get(t)?.ignoredReports;return Array.isArray(n)&&n.includes(r)}function za(e){if(!e||typeof e!="object")return;let t=e,r={};typeof t.color=="string"&&t.color&&(r.color=t.color);let n=P2(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(i=>typeof i=="string"&&i.length>0);o.length>0&&(r.ignoredReports=o)}return rB(r)?void 0:r}function nB(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 i of n)if(!o.has(i))return!1;return!0}function N2(e,t){let r=e??{},n=t??{};return(r.color??"")===(n.color??"")&&(Ue(r)??"")===(Ue(n)??"")&&(r.comment??"")===(n.comment??"")&&(r.fix??"")===(n.fix??"")&&r.flagged===n.flagged&&nB(r.ignoredReports,n.ignoredReports)}function Z(e,t,r){let n=e.get(t),o=za({...n,...r});return o===void 0?e.delete(t):N2(n,o)?!1:(e.set(t,o),!0)}function gf(e,t,r){let n=za(r),o=e.get(t);return n===void 0?e.delete(t):N2(o,n)?!1:(e.set(t,n),!0)}function wt(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 Xo=w(()=>{"use strict"});function nv(e){rv=typeof e=="function"?e:()=>{}}function ov(e){z2=typeof e=="function"?e:()=>{}}function iv(e){U2=typeof e=="function"?e:()=>{}}async function oB(e){let t=new Blob([e]).stream().pipeThrough(new CompressionStream("deflate"));return new Uint8Array(await new Response(t).arrayBuffer())}async function iB(e){let t=new Blob([e]).stream().pipeThrough(new DecompressionStream("deflate"));return new Uint8Array(await new Response(t).arrayBuffer())}function sv(){let e={};for(let[t,r]of l.triage){if(Cn.test(t))continue;let n=za(r);n&&(e[t]=n)}return e}function we(){if(_())return z2(),Promise.resolve();let e=++D2,t=sv(),r=Object.keys(t).length===0,n=r?null:JSON.stringify(t);if(n!=null)try{localStorage.setItem(oo,n)}catch{}return navigator.locks.request(un,{mode:"shared"},async()=>{let o=null,i=null;if(n!=null)try{let s=ve(n),a=await oB(s);i=dt(),o=(i?await I_(a):a).toBase64()}catch(s){console.warn("Failed to save triage:",s),rv();return}await navigator.locks.request(sB,()=>{try{if(e!==D2)return;if(n!=null&&dt()!==i){queueMicrotask(()=>{we()});return}if(r)localStorage.removeItem(Jo),localStorage.removeItem(oo);else{localStorage.setItem(Jo,o);try{localStorage.removeItem(oo)}catch{}}}catch(s){console.warn("Failed to save triage:",s)}}),rv()})}async function bf(){let e=localStorage.getItem(oo);if(e)try{return JSON.parse(e)}catch{}let t=localStorage.getItem(Jo);if(!t)return null;let r=Uint8Array.fromBase64(t);if(Tt(r)){if(!dt())throw new Error("triage: vault locked, cannot decrypt envelope");r=await L_(r)}let n=await iB(r);return JSON.parse(it(n))}function H2(e,{replace:t=!1}={}){let r=l.triage;if(t){let n=null,o=localStorage.getItem(oo);if(o)try{n=JSON.parse(o)}catch{}let i=s=>n!=null&&s in n;for(let s of[...r.keys()]){if(Cn.test(s))continue;let a=e?.[s],c=!e||!(s in e);!(i(s)&&n[s]?.color)&&(c||!a?.color)&&Z(r,s,{color:void 0}),!(i(s)&&(n[s]?.triage||n[s]?.deleted))&&!Ue(a)&&Z(r,s,{triage:void 0}),!(i(s)&&n[s]?.comment)&&(c||typeof a?.comment!="string"||!a.comment)&&Z(r,s,{comment:void 0}),!(i(s)&&n[s]?.fix)&&(c||typeof a?.fix!="string"||!a.fix)&&Z(r,s,{fix:void 0}),!(i(s)&&n[s]?.flagged!==void 0)&&(c||a?.flagged===void 0)&&Z(r,s,{flagged:void 0})}for(let s of[...r.keys()]){if(Cn.test(s))continue;let a=r.get(s)?.ignoredReports;if(!a||a.length===0)continue;let c=e?.[s],u=!!Ue(c);for(let p of[...a]){if(i(s)&&Array.isArray(n[s]?.ignoredReports)&&n[s].ignoredReports.includes(p))continue;if(u){wt(r,s,p,!1);continue}let f=c?.ignoredReports;(!Array.isArray(f)||!f.includes(p))&&wt(r,s,p,!1)}}}if(e)for(let[n,o]of Object.entries(e)){let i=Ue(o),s={};if(o&&o.color&&(s.color=o.color),i&&(s.triage=i),o&&typeof o.comment=="string"&&o.comment&&(s.comment=o.comment),o&&typeof o.fix=="string"&&o.fix&&(s.fix=o.fix),o&&typeof o.flagged=="boolean"&&(s.flagged=o.flagged),Object.keys(s).length>0&&Z(r,n,s),!i&&o&&Array.isArray(o.ignoredReports)){let a=new Set(r.get(n)?.ignoredReports??[]),c=!1;for(let u of o.ignoredReports)typeof u=="string"&&!a.has(u)&&(a.add(u),c=!0);c&&Z(r,n,{ignoredReports:[...a]})}}}async function aB(){if(!_())try{let e=await bf();if(_())return;H2(e)}catch(e){console.warn("Failed to load triage:",e)}}async function ad(){if(!_())try{let e=await bf();if(_())return;H2(e,{replace:!0}),U2()}catch(e){console.warn("Failed to reload triage:",e)}}function ks(){return _()?Promise.resolve():lB??=aB()}async function av({seal:e}){try{localStorage.removeItem(oo)}catch{}let t=localStorage.getItem(Jo);if(!t)return;let r=Uint8Array.fromBase64(t);if(Tt(r))return;let n=await e(r,lc());localStorage.setItem(Jo,n.toBase64())}async function lv({open:e}){try{localStorage.removeItem(oo)}catch{}let t=localStorage.getItem(Jo);if(!t)return;let r=Uint8Array.fromBase64(t);if(!Tt(r))return;let n=await e(r,lc());localStorage.setItem(Jo,n.toBase64())}var rv,z2,U2,Jo,oo,Cn,sB,D2,lB,Zo=w(()=>{"use strict";Yt();At();Xo();ua();rv=()=>{};z2=()=>{};U2=()=>{};Jo="deepview.triage",oo="deepview.triage.pending",Cn=/^\d+$/u;sB="deepview.triage.save",D2=0;typeof window<"u"&&window.addEventListener("storage",e=>{e.key!==Jo&&e.key!==oo||ad()});Je(()=>{ad()});Je(()=>{_()||dt()&&localStorage.getItem(oo)&&we()})});function yf(e,t){return t?`r:${JSON.stringify({name:e,workspaceId:t})}`:e}function vf(e){if(typeof e!="string"||!e)return null;if(e.startsWith("r:"))try{let t=JSON.parse(e.slice(2));if(t&&typeof t.name=="string"&&t.name&&typeof t.workspaceId=="string"&&t.workspaceId)return{name:t.name,workspaceId:t.workspaceId}}catch{}return{name:e,workspaceId:null}}var wf=w(()=>{"use strict"});function cv(){return ld||(ld=cB(),ld.catch(()=>{ld=null})),ld}async function cB(){try{await ks()}catch{}let e=await me(),t=new Set(e),r=new Set(e),n=new Set;for(let o of e){if(!o.toLowerCase().endsWith(".deepseek"))continue;let i=o.slice(0,-9)+".md";if(t.has(i))continue;let s;try{s=await ze(o),await Sr(i,s),await Ta(o)}catch(f){console.warn(`migrate: failed to rename ${o} -> ${i}`,f);continue}t.delete(o),t.add(i),n.add(o);let a=Kc(o);if(Oa(o),a===void 0){let{count:f,source:h}=Nt(s);Pt(i,f,h)}else{let{source:f}=Nt(s);Pt(i,a,f)}let c=It(o);c&&(Kr(o,""),Kr(i,c));let u=!1;for(let[f,h]of[...l.triage])h.ignoredReports?.includes(o)&&(wt(l.triage,f,o,!1),wt(l.triage,f,i,!0),u=!0);u&&await we();let p=vf(Ae(j2));if(p?.name===o)try{await st(j2,yf(i,p.workspaceId))}catch{}}for(let o of J())for(let i of o.reports){if(!i.toLowerCase().endsWith(".deepseek")||!n.has(i)&&r.has(i))continue;let s=i.slice(0,-9)+".md";await td(i,o.id),await ys(s,o.id)}}var j2,ld,V2=w(()=>{"use strict";ur();Pa();qo();Yt();Zo();Vr();Xo();wf();j2="deepview.lastFile",ld=null});function dv(){return{...W2,hydrateKey:Yg,readTriageBlob:bf}}function uv(e=W2){let t=()=>e.isEncryptionEnabled()&&!e.isUnlocked(),r=(o,i,s)=>{let a=!1,c=!1,u=e.onVaultStateChange(()=>{a=!0}),p=i==="report"?e.onFileMutated:e.onBundleMutated,f=s===void 0?null:p(h=>{h===s&&(c=!0)});return{check(){if(o?.throwIfAborted(),t()||a)throw new Error("Local data is locked or has changed. Unlock it and select the file again.");if(c)throw new Error(`This local ${i} changed. Select it again before importing.`)},unsubscribe(){u(),f?.()}}},n=async o=>o==="report"?(await e.listFiles()).map(i=>({value:i,label:i})):(await e.listBundles()).map(i=>({value:i.integrity,label:i.name,secondary:i.integrity}));return{get locked(){return t()},async hasData(o){return o==="report"?(await e.listFiles()).length>0:t()?e.hasStoredBundleBytes():(await e.listBundles()).length>0},async list(o){let i=r();try{i.check();let s=await n(o);return i.check(),s}finally{i.unsubscribe()}},unlock(o){return e.unlockEncryption(o)},subscribe(o){let i=e.onVaultStateChange(()=>o()),s=e.onFileMutated(c=>o({kind:"report",value:c})),a=e.onBundleMutated(c=>o({kind:"bundle",value:c}));return()=>{i(),s(),a()}},async importItem(o,i,s,{signal:a}={}){let c=r(a,o,i);try{c.check();let{result:u}=await e.withStoredItem(o,i,async()=>{c.check();let p=(await n(o)).find(g=>g.value===i);if(c.check(),!p)throw new Error("This file is no longer in local storage. Select another file.");let f=o==="report"?await e.readFile(i):await e.readBundle(i);c.check();let h=new File([f],p.label,{type:o==="report"?"text/plain":"application/octet-stream"});try{let g=Promise.resolve(s(h));return g.catch(()=>{}),{result:g}}finally{c.unsubscribe()}});return u}finally{c.unsubscribe()}}}}var W2,K2=w(()=>{"use strict";ur();ua();Vr();Zo();W2={hasStoredBundleBytes:b2,listBundles:Ot,listFiles:me,onBundleMutated:h2,onFileMutated:dr,readBundle:Xr,readFile:f2,withStoredItem:p2,isEncryptionEnabled:fe,isUnlocked:qt,onVaultStateChange:Je,unlockEncryption:Yi}});function G2(){return typeof navigator<"u"&&typeof navigator.storage=="object"&&navigator.storage!==null}async function Ua(){if(!G2()||typeof navigator.storage.persist!="function")return!1;try{return await navigator.storage.persist()===!0}catch{return!1}}async function pv(){let e={supported:G2(),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 q2=w(()=>{"use strict"});function Y2(){for(let e of fv)e()}function Ha(){return Ae(kf)!=null}function hv(e){try{let t=JSON.parse(Ae(kf)),r=t?.provider==="moonshotai"?"moonshot":t?.provider;return!e||t?.server!==e||typeof t.deepview!="string"||!t.deepview.trim()||![null,"anthropic","openai","moonshot","openrouter"].includes(r)||typeof t.token!="string"?null:{...t,provider:r}}catch{return null}}async function mv({server:e,deepview:t,provider:r,token:n}){await st(kf,JSON.stringify({server:e,deepview:t,provider:r,token:n})),Y2()}async function gv(){await Oo(kf),Y2()}function bv(e){fv.add(e);let t=fn(e);return()=>{fv.delete(e),t()}}var kf,fv,X2=w(()=>{"use strict";Vr();kf="deepview.scan.access",fv=new Set});function dB(){let e=sv(),t=Sp();return{version:yv,exportedAt:new Date().toISOString(),triage:e,repoUrls:t}}function uB(){return`deepview-triage-${new Date().toISOString().replaceAll(/[:.]/gu,"-").slice(0,19)}.json.gz`}async function vv(){let e=dB();return{blob:new Blob([await Lc(JSON.stringify(e))]),filename:uB()}}async function wv(e){let t;try{t=await ls(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!==yv)throw new Error(`Unsupported backup version: ${r.version} (expected ${yv})`);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 kv(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=l.triage;if(t==="replace")for(let a of[...n.keys()])Cn.test(a)||n.delete(a);let o=t==="prefer-current";for(let[a,c]of Object.entries(r)){if(Cn.test(a)||!c||typeof c!="object")continue;typeof c.color=="string"&&c.color&&(!o||!n.get(a)?.color)&&Z(n,a,{color:c.color});let u=Ue(c);if(u&&(!o||!Ue(n.get(a)))&&Z(n,a,{triage:u}),typeof c.comment=="string"&&c.comment&&(!o||!n.get(a)?.comment)&&Z(n,a,{comment:c.comment}),typeof c.fix=="string"&&c.fix&&(!o||!n.get(a)?.fix)&&Z(n,a,{fix:c.fix}),typeof c.flagged=="boolean"&&(!o||n.get(a)?.flagged===void 0)&&Z(n,a,{flagged:c.flagged}),Array.isArray(c.ignoredReports)&&!Ue(n.get(a)))for(let p of c.ignoredReports)typeof p=="string"&&(o&&no(n,a,p)||wt(n,a,p,!0))}await we();let i=0,s=null;try{await W_(e.repoUrls,t),i=Object.keys(e.repoUrls).length}catch(a){console.warn("applyTriageImport: repo-URL import failed:",a),s=a}return{triageEntries:Object.keys(r).length,repoUrls:i,repoUrlError:s}}var yv,J2=w(()=>{"use strict";Ma();Xo();Yt();Zo();yv=1});function pB(e){return e?.name==="NotFoundError"||typeof e?.message=="string"&&e.message.startsWith("File not found:")}async function xv(e){let t=new Set;for(let r of e){let n;try{n=await ze(r)}catch(i){if(pB(i))continue;throw new Error(`Failed to read ${r}: ${i.message}`,{cause:i})}if(n==null)continue;let o=await Xt(n);if(o)for(let i of o.findings)i.id&&t.add(i.id)}return t}function fB(){let e=new Set;for(let t of l.triage.keys())Cn.test(t)||e.add(t);return e}async function xf(e){let t=fB();if(t.size===0)return{orphanedCount:0,sharedCount:0};let r=await xv(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 me(),i=new Set(e),s=o.filter(p=>!i.has(p)),a=await xv(s),c=0,u=0;for(let p of n)a.has(p)?u++:c++;return{orphanedCount:c,sharedCount:u}}async function $f(){let e=new Set(l.triage.keys()),t=[];for(let[s,a]of l.triage)if(a.ignoredReports)for(let c of a.ignoredReports)t.push({id:s,report:c});let r=await me(),n=new Set(r),o=await xv(r),i=!1;for(let s of e){if(Cn.test(s)||o.has(s))continue;let a=l.triage.get(s);!a||!(a.color||Ue(a)||a.comment||a.fix||a.flagged!==void 0)||Z(l.triage,s,{color:void 0,triage:void 0,comment:void 0,fix:void 0,flagged:void 0,deleted:void 0})&&(i=!0)}for(let{id:s,report:a}of t)Cn.test(s)||o.has(s)&&n.has(a)||no(l.triage,s,a)&&wt(l.triage,s,a,!1)&&(i=!0);i&&await we()}var Z2=w(()=>{"use strict";Yt();Xo();Zo();ur();Ee()});var Q2=w(()=>{"use strict"});async function rC(e,t){let r=await crypto.subtle.importKey("raw",ve(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 nC(e){return!(e instanceof Uint8Array)||e.length<tC?!1:e[0]===$v}async function _f(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(Qo+e.length+16);r[0]=$v,crypto.getRandomValues(r.subarray(1,1+ei)),crypto.getRandomValues(r.subarray(1+ei,Qo));let n=r.subarray(1,1+ei),o=r.subarray(1+ei,Qo),i=await rC(t,n),s=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:o,additionalData:r.subarray(0,Qo)},i,e));return r.set(s,Qo),r}async function mB(e,t){if(typeof t!="string"||!t)throw new TypeError("tryDecryptWithPassword: password required");if(!(e instanceof Uint8Array)||e.length<tC)return{ok:!1,reason:"malformed"};if(e[0]!==$v)return{ok:!1,reason:"malformed"};let r=e.subarray(1,1+ei),n=e.subarray(1+ei,Qo),o=e.subarray(Qo),i=await rC(t,r),s;try{s=new Uint8Array(await crypto.subtle.decrypt({name:"AES-GCM",iv:n,additionalData:e.subarray(0,Qo)},i,o))}catch{return{ok:!1,reason:"wrong-password"}}return{ok:!0,plaintext:s}}async function Sf(e,t,r){if(!r||typeof r.malformedMsg!="string"||typeof r.wrongPasswordMsg!="string")throw new TypeError("decryptWithPasswordOrThrow: { malformedMsg, wrongPasswordMsg } strings required");let n=await mB(e,t);if(n.ok)return n.plaintext;throw n.reason==="wrong-password"?new Error(r.wrongPasswordMsg):new Error(r.malformedMsg)}var $v,ei,eC,tC,Qo,_v=w(()=>{"use strict";At();Q2();$v=1,ei=16,eC=12,tC=1+ei+eC+16,Qo=1+ei+eC});function iC(e,t){return Sf(e,t,{malformedMsg:"malformed encrypted bundle",wrongPasswordMsg:"wrong password or corrupt bundle"})}var cd,oC,dd=w(()=>{"use strict";_v();cd=nC,oC=_f});async function bB(e){let t=new Set,r=await Xt(e);for(let n of r?.findings??[])n.id&&t.add(n.id);return t}function Sv(e){return(e??"").replaceAll(/[^a-zA-Z0-9._-]+/gu,"_").replaceAll(/^_+|_+$/gu,"")||"workspace"}async function yB(e){if(!Array.isArray(e)||e.length===0)return[];let t=await Ot(),r=new Map(t.map(o=>[o.integrity,o.name])),n=[];for(let o of e){let i=r.get(o);if(!i)continue;let s;try{s=await Xr(o)}catch(a){console.warn(`Workspace export: failed to read bundle ${o}: ${a?.message??a}`);continue}n.push({integrity:o,name:i,data:s.toBase64()})}return n}function vB(e){let t=It(e);return t?{github:t}:null}async function sC(e){let t=[];for(let r of e.reports??[]){let n;try{n=await ze(r)}catch(i){console.warn(`Workspace export: skipping ${r}: ${i?.message??i}`),(i instanceof DOMException&&i.name==="NotFoundError"||typeof i?.message=="string"&&i.message.startsWith("File not found:"))&&await ed(r,null);continue}let o=vB(r);t.push(o?{name:r,content:n,repo:o}:{name:r,content:n})}return t}async function wB(e,{includeBundleBytes:t=!1}={}){let r=await sC(e),n=new Set;for(let u of r)for(let p of await bB(u.content))n.add(p);let o=new Set(e.reports??[]),i={};for(let[u,p]of l.triage){if(!n.has(u))continue;let f=(p.ignoredReports??[]).filter(g=>o.has(g)),h=za({...p,ignoredReports:f});h&&(i[u]=h)}let s={};for(let u of r)u.repo?.github&&(s[u.name]=u.repo.github);let a=(e.bundles??[]).filter(u=>typeof u=="string"&&u.length>0),c={version:gB,exportedAt:new Date().toISOString(),workspace:{id:e.id,name:e.name,privateKey:e.privateKey,createdAt:e.createdAt},reports:r,bundles:a,repoUrls:s,triage:i};if(t){let u=await yB(a);u.length>0&&(c.bundleBlobs=u)}return c}async function aC(e,{includeBundleBytes:t=!1}={}){let r=await wB(e,{includeBundleBytes:t});return{blob:new Blob([await Lc(JSON.stringify(r))]),filename:`${Sv(e.name)}.deepview-workspace.json.gz`}}async function kB(e,t,{includeBundleBytes:r=!1}={}){if(typeof t!="string"||!t)throw new TypeError("buildWorkspaceExportEncrypted: password required");let{blob:n}=await aC(e,{includeBundleBytes:r}),o=new Uint8Array(await n.arrayBuffer()),i=await oC(o,t);return{blob:new Blob([i],{type:"application/octet-stream"}),filename:`${Sv(e.name)}.deepview-workspace.enc`}}async function Cv(e,{password:t,includeBundleBytes:r=!1}={}){return typeof t=="string"&&t?await kB(e,t,{includeBundleBytes:r}):await aC(e,{includeBundleBytes:r})}async function xB(e){return{reports:await sC(e)}}async function Ev(e){let t=await xB(e);return{blob:new Blob([await Lc(JSON.stringify(t))]),filename:`${Sv(e.name)}.deepview-reports.json.gz`}}var gB,lC=w(()=>{"use strict";Yt();Xo();ur();qo();Ee();Ma();dd();gB=1});function SB(e){if(!e||typeof e!="object")return"payload is not an object";if(e.version!==$B)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>ja)return`reports count (${e.reports.length}) exceeds cap (${ja})`;if(e.bundles!==void 0){if(!Array.isArray(e.bundles))return"bundles field must be an array when present";if(e.bundles.length>cC)return`bundles count (${e.bundles.length}) exceeds cap (${cC})`;for(let t of e.bundles){if(typeof t!="string")return"bundles entries must be strings";if(t.length>Cf)return`bundle integrity exceeds per-entry length cap (${Cf})`}}if(e.bundleBlobs!==void 0){if(!Array.isArray(e.bundleBlobs))return"bundleBlobs field must be an array when present";if(e.bundleBlobs.length>uC)return`bundleBlobs count (${e.bundleBlobs.length}) exceeds cap (${uC})`;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>Cf)return`bundleBlobs.integrity exceeds per-entry length cap (${Cf})`;if(typeof t.name!="string"||t.name.length===0)return"bundleBlobs.name must be a non-empty string";if(t.name.length>dC)return`bundleBlobs.name exceeds per-entry length cap (${dC})`;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>_B)return`bundleBlobs.data exceeds per-blob size cap (${pC} bytes raw)`}}return null}async function Ef(e){return new Uint8Array(await e.arrayBuffer())}async function Rf(e,t){if(cd(e)){if(typeof t!="string"||!t)throw new TypeError("parseWorkspaceBundleBytes: password required for encrypted bundle");let n=await iC(e,t);try{return Va(await ls(n))}catch(o){throw new Error("wrong password or corrupt bundle",{cause:o})}}let r;try{r=await ls(e)}catch(n){throw new Error(`gzip decompression failed: ${n.message}`,{cause:n})}return Va(r)}function Va(e){let t;try{t=JSON.parse(e)}catch(o){throw new Error(`payload is not JSON: ${o.message}`,{cause:o})}let r=SB(t);if(r===null)return t;let n=r.includes("exceeds cap");throw new Error(n?r:`not a deepview workspace export: ${r}`)}var $B,cC,ja,Cf,pC,_B,dC,uC,fC=w(()=>{"use strict";Ma();dd();$B=1,cC=1024,ja=1024,Cf=200,pC=100*1024*1024,_B=Math.ceil(pC*4/3)+16,dC=512,uC=64});function CB(e){return Ue(e)??null}async function EB(e){let t=new Map;for(let r of e??[]){if(typeof r?.content!="string")continue;let n=await Xt(r.content);if(n)for(let o of n.findings)!o.id||t.has(o.id)||t.set(o.id,{severity:o.severity,file:o.file,line:o.line,description:Wy(o.description)})}return t}async function RB(e,t,r){if(!e||typeof e!="object"||Array.isArray(e))return;let n=l.triage,o=[];for(let[i,s]of Object.entries(e)){if(!s||typeof s!="object")continue;let a=n.get(i)?.color,c=typeof s.color=="string"?s.color:void 0;c&&a&&a!==c?o.push({id:i,property:"color",local:a,imported:c}):c&&c!==a&&Z(n,i,{color:c});let u=n.get(i)?.comment??"",p=typeof s.comment=="string"?s.comment:"";p&&u&&u!==p?o.push({id:i,property:"comment",local:u,imported:p}):p&&p!==u&&Z(n,i,{comment:p});let f=n.get(i)?.fix??"",h=typeof s.fix=="string"?s.fix:"";h&&f&&f!==h?o.push({id:i,property:"fix",local:f,imported:h}):h&&h!==f&&Z(n,i,{fix:h});let g=CB(s),b=Ue(n.get(i))??null;g&&b&&b!==g?o.push({id:i,property:"triage",local:b,imported:g}):g&&!b&&Z(n,i,{triage:g,ignoredReports:void 0});let y=n.get(i)?.flagged,k=typeof s.flagged=="boolean"?s.flagged:void 0;k!==void 0&&y!==void 0&&y!==k?o.push({id:i,property:"flagged",local:y?"flagged":"not flagged",imported:k?"flagged":"not flagged"}):k!==void 0&&k!==y&&Z(n,i,{flagged:k});let v=Array.isArray(s.ignoredReports)?s.ignoredReports:[];if(!Ue(n.get(i)))for(let x of v)typeof x=="string"&&wt(n,i,x,!0)}if(o.length>0&&t){let i=await t(o,r??new Map);i&&MB(o,i)}await we()}function MB(e,t){for(let r of e){let n=`${r.id}:${r.property}`;t[n]==="imported"&&AB(r.id,r.property)===r.local&&(r.property==="color"?Z(l.triage,r.id,{color:r.imported}):r.property==="comment"?Z(l.triage,r.id,{comment:r.imported}):r.property==="fix"?Z(l.triage,r.id,{fix:r.imported}):r.property==="triage"?Z(l.triage,r.id,{triage:r.imported,ignoredReports:void 0}):r.property==="flagged"&&Z(l.triage,r.id,{flagged:r.imported==="flagged"?!0:r.imported==="not flagged"?!1:void 0}))}}function AB(e,t){if(t==="color")return l.triage.get(e)?.color;if(t==="triage")return Ue(l.triage.get(e))??null;if(t==="comment")return l.triage.get(e)?.comment??"";if(t==="fix")return l.triage.get(e)?.fix??"";if(t==="flagged"){let r=l.triage.get(e)?.flagged;return r===!0?"flagged":r===!1?"not flagged":""}}async function TB(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 ps(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 Rv(e,{conflictResolver:t}={}){let r=[];for(let p of e.reports)if(!(typeof p?.name!="string"||typeof p?.content!="string"))try{await Sr(p.name,p.content);let{count:f,source:h}=Nt(p.content);Pt(p.name,f,h??Jt(p.name)),r.push(p.name)}catch(f){console.warn(`Workspace import: failed to save ${p.name}: ${f.message}`)}Array.isArray(e.bundleBlobs)&&e.bundleBlobs.length>0&&await TB(e.bundleBlobs);let o=e.triage&&Object.keys(e.triage).length>0?await EB(e.reports):new Map;await RB(e.triage,t,o);let i=Array.isArray(e.bundles),s=i?e.bundles.filter(p=>typeof p=="string"&&p.length>0):[],a=await L2({id:e.workspace.id,name:e.workspace.name,privateKey:e.workspace.privateKey,reports:r,bundles:i?s:void 0,preserveBundles:!i,createdAt:e.workspace.createdAt}),c=new Set(r),u=Object.create(null);if(e.repoUrls&&typeof e.repoUrls=="object")for(let[p,f]of Object.entries(e.repoUrls))!c.has(p)||typeof f!="string"||!f||(u[p]=f);if(Object.keys(u).length>0)try{await Cp(u)}catch(p){console.warn("Workspace import: failed to adopt per-report repository URLs:",p)}return a}var Mv=w(()=>{"use strict";Yt();ur();qo();Zo();Pa();Gy();Ee();Xo();fC()});function IB(e){return!e||typeof e!="object"||Array.isArray(e)?"payload is not an object":e.version!==void 0||e.workspace!==void 0?"payload claims to be a workspace export":Array.isArray(e.reports)?e.reports.length>ja?`reports count (${e.reports.length}) exceeds cap (${ja})`:null:"reports field must be an array"}function hC(e){return IB(e)===null}async function Av(e){if(cd(e))return{kind:"encrypted"};let t;try{t=await ls(e)}catch(n){throw new Error(`gzip decompression failed: ${n.message}`,{cause:n})}let r;try{r=JSON.parse(t)}catch{return{kind:"workspace",text:t}}return hC(r)?{kind:"reports",reports:r.reports}:{kind:"workspace",text:t}}var mC=w(()=>{"use strict";Mv();Ma();dd()});async function Tv({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 i=await Gc(r)===e?{v:1,n:t,k:r}:{v:1,i:e,n:t,k:r};return(await _f(ve(JSON.stringify(i)),n)).toBase64({alphabet:"base64url",omitPadding:!0})}async function Iv({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 Sf(r,t,{malformedMsg:"malformed share link",wrongPasswordMsg:"wrong password or corrupt link"});try{return await LB(n)}catch(o){throw new Error("wrong password or corrupt link",{cause:o})}}async function LB(e){let t=JSON.parse(it(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 Gc(t.k),name:t.n,privateKeyBase64:t.k}}function Lv(e){return typeof location>"u"?`#share=${e}`:`${location.origin}${location.pathname}#share=${e}`}function Fv(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 gC=w(()=>{"use strict";At();_v();Sy()});function Ka(e=Ae(Nv)){try{let t=JSON.parse(e);if(t?.version===bC&&t.entries&&typeof t.entries=="object")return t}catch{}return{version:bC,revision:"",links:"[]",entries:{}}}function Wa(){for(let e of Bv)e()}function vC(e){let t=Tf.then(()=>fa(Nv,r=>e(Ka(r))));return Tf=t.catch(r=>console.warn("workspace App cache:",r)),t}function Mf(e){return JSON.stringify(e.reports.toSorted())}function wC(){return JSON.stringify(Qy().map(({name:e,groups:t})=>({name:e,groups:t})))}function Uv(e){return Jy()&&e.links===wC()}function kC(e,t){return e.workspaceRevisions?.[t]??""}function xC(e,t,r){return r.workspaceId===t?.id&&r.workspaceEpoch===(Af.get(t?.id)??0)&&r.workspaceRevision===kC(e,t?.id)}function $C(e,t,r){return r.reportEpoch===zv&&r.reportRevision===(e.reportRevision??e.revision)&&xC(e,t,r)}function Hv(e,t){return $C(Ka(),e,t)}function _C(e,t){if(Pv||Ov.has(e.id))return null;let r=t.entries[e.id];return!r||r.reports!==Mf(e)||typeof r.appMode!="boolean"||r.appMode&&(!Number.isSafeInteger(r.appFindings)||r.appFindings<0)?null:r}function jv(e){return _C(e,Ka())?.appMode??null}function xs(e){let t=Ka(),r=_C(e,t);return!r||!Uv(t)?null:r}async function ud(e,t=null){let r;do r=Tf,await r;while(r!==Tf);let n=Ka(),o=n.reportRevision??n.revision;return t&&(!$C(n,e,t)||!Uv(n))?null:{epoch:Dv,revision:n.revision,reportEpoch:zv,reportRevision:o,workspaceId:e?.id,workspaceEpoch:Af.get(e?.id)??0,workspaceRevision:kC(n,e?.id)}}async function Vv(e,t,r){let n=!1;return await vC(o=>{if(r.epoch!==Dv||r.revision!==o.revision||!xC(o,e,r)||!Uv(o))return;let i=J().find(s=>s.id===e.id);if(!(!i||Mf(i)!==Mf(e)))return o.entries[e.id]={...t,reports:Mf(e)},n=!0,JSON.stringify(o)}),n&&Wa(),n}function If(e=null,t){if(e?.length===0)return Promise.resolve();if(e===null)Dv++,t===void 0&&zv++,Pv++;else for(let r of e)Af.set(r,(Af.get(r)??0)+1),Ov.add(r);return Wa(),vC(r=>{if(r.reportRevision??=r.revision,e===null)r.revision=crypto.randomUUID(),t===void 0&&(r.reportRevision=r.revision),r.entries={};else{r.workspaceRevisions??={};for(let n of e)r.workspaceRevisions[n]=crypto.randomUUID(),delete r.entries[n]}return t!==void 0&&(r.links=t),JSON.stringify(r)}).finally(()=>{if(e===null)Pv--;else for(let r of e)Ov.delete(r);Wa()})}function Wv(e){return Bv.add(e),()=>Bv.delete(e)}var Nv,bC,Bv,Ov,Pv,Dv,zv,Af,Tf,yC,SC=w(()=>{"use strict";Vr();qo();Ay();ur();tv();Nv="deepview.workspaceApp",bC=2,Bv=new Set,Ov=new Set,Pv=0,Dv=0,zv=0,Af=new Map,Tf=Promise.resolve(),yC=null;fn(()=>{let e=Ae(Nv);e!==yC&&(yC=e,Wa())});Xc(e=>{If([e]).catch(()=>{})});Yc(e=>{If([e]).catch(()=>{})});dr(e=>{let t=J().filter(r=>r.reports.includes(e)).map(r=>r.id);If(t).catch(()=>{})});ws(()=>{if(!Jy()){Wa();return}let e=wC();Ka().links===e?Wa():If(null,e).catch(()=>{})})});var D=w(()=>{"use strict";x2();Ub();S2();Pa();ma();B2();Gy();ga();tv();V2();K2();ua();q2();Vr();X2();Yt();sb();ur();J2();Z2();Zo();Xo();dd();lC();Mv();mC();gC();qo();SC()});function CC(e){e.installSyncHost(FB),nv(()=>e.triageSync.notify())}var FB,EC=w(()=>{"use strict";Yt();Pa();qo();ur();Zo();Vr();FB={get state(){return l},listWorkspaces:J,addReportToWorkspace:ys,addBundleToWorkspace:vs,onReportMembershipChanged:Xc,onBundleMembershipChanged:Ey,onWorkspaceDeleted:Yc,onWorkspacePrivateKeyChanged:Cy,analyzeContent:Nt,setCount:Pt,gunzipBytes:$n,listBundles:Ot,listFiles:me,readBundle:Xr,readFileBytes:Wo,saveBundle:ps,saveFileBytes:Jb,onFileMutated:dr,saveTriage:we,getSecureItem:Ae,setSecureItem:st,removeSecureItem:Oo,onSecureStorageHydrated:fn}});function TC(){try{return Ae("deepview.sync.userEnabled")!=="0"}catch{return!0}}function Bf(e){IC=!!e}function Ff(){if(IC||l.serverMode!=="e2e")return!0;try{return sr()?.mode==="managed"}catch{return!1}}function pd(){return $s||(Ff()&&!ie?Promise.resolve(null):($s=(async()=>{let e="./client-sync.js";try{let t=await import(e);return CC(t),ie=t,BB(),t}catch(t){throw $s=null,t}})(),$s))}function fd(e){ie?e(ie):LC.push(e)}function BB(){let e=LC.splice(0);for(let t of e)try{t(ie)}catch(r){console.warn("client-sync: deferred apply failed:",r)}}function _s(e,t){let r={cancelled:!1,unsub:null};return fd(n=>{r.cancelled||(r.unsub=t(n,e))}),()=>{r.cancelled=!0,r.unsub&&r.unsub()}}function Kv(e,t){return ie?ie.isInRemote(e,t):!1}function FC(e,t){return ie?ie.isBundleInRemote(e,t):!1}function BC(e){try{let t=localStorage.getItem(OB+e);if(!t)return null;let r=JSON.parse(t);return r&&typeof r=="object"?r:null}catch{return null}}function Ga(e,t){if(ie&&ie.isInRemote(e,t))return!0;let r=BC(e);return!r||typeof r.names!="object"?!1:Object.values(r.names).includes(t)}function Gv(e,t){if(ie&&ie.isBundleInRemote(e,t))return!0;let r=BC(e);return!r||typeof r.bundles!="object"?!1:Object.values(r.bundles).includes(t)}function qv(e){return ie?ie.remoteCount(e):0}function OC(e){return ie?ie.differingReports(e):[]}function PC(e){return _s(e,(t,r)=>t.onAutoDownloaded(r))}function NC(e){return _s(e,(t,r)=>t.onBundleAutoDownloaded(r))}function DC(e){return _s(e,(t,r)=>t.onChange(r))}function zC(e){if(ie){ie.setRedraw(e);return}RC=e,fd(t=>{RC===e&&t.setRedraw(e)})}function UC(e){if(ie){ie.setAuthenticationResolver(e);return}MC=e,fd(t=>{MC===e&&t.setAuthenticationResolver(e)})}function HC(e){if(ie){ie.setHydrationConflictResolver(e);return}AC=e,fd(t=>{AC===e&&t.setHydrationConflictResolver(e)})}async function En(e,t){if(Ff()||!TC()&&!ie)return;let r=await pd();if(!(!r||Ff()))return r[e](...t)}function jC(...e){return En("downloadFileFromRemote",e)}function VC(...e){return En("fetchBundleFromRemote",e)}function Of(...e){return En("putFile",e)}function WC(...e){return En("holdLocalChangeChecks",e)}function KC(...e){return En("putBundleToRemote",e)}function Pf(...e){return En("deleteFromRemote",e)}function Nf(...e){return En("deleteBundleFromRemote",e)}function hd(...e){return En("openWorkspace",e)}async function Yv(...e){return(ie??($s?await $s:null))?.closeWorkspace(...e)}function GC(...e){return En("recheckRemoteStorage",e)}function qC(...e){return En("resolveReportDifference",e)}function io(e,t){if(ie)return ie.triageSync[e](...t);fd(r=>{r.triageSync[e](...t)})}var ie,$s,IC,LC,OB,RC,MC,AC,Lf,Q,Qr=w(()=>{"use strict";D();EC();ie=null,$s=null;IC=!1;LC=[];OB="deepview.objstore-presence.";RC=null,MC=null,AC=null,Lf=[];Q={get status(){return ie?ie.triageSync.status:"off"},get openSessions(){return ie?ie.triageSync.openSessions:[]},get persistenceDegraded(){return ie?ie.triageSync.persistenceDegraded:!1},get proxyAuthRequired(){return ie?ie.triageSync.proxyAuthRequired:!1},setEnabled(e){if(e===!0)return Ff()?Promise.resolve(null):pd().then(t=>{t.triageSync.setEnabled(!0);let r=Lf;Lf=[];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(ie){Lf=ie.openWorkspaceIds();for(let t of Lf)try{ie.closeWorkspace(t)}catch(r){console.warn(`client-sync: closeWorkspace(${t}) failed during disable:`,r)}ie.triageSync.setEnabled(!1);return}io("setEnabled",[e])},isEnabled(){return ie?ie.triageSync.isEnabled():TC()},openSession(e){io("openSession",[e])},closeSession(e){io("closeSession",[e])},refreshSession(e){io("refreshSession",[e])},dismissError(e){io("dismissError",[e])},setForcedOff(e){io("setForcedOff",[e])},setProtocolLocked(e){io("setProtocolLocked",[e])},setServerUrl(e){io("setServerUrl",[e])},getServerUrl(){return ie?ie.triageSync.getServerUrl():null},notify(){io("notify",[])},onStatusChange(e){return _s(e,(t,r)=>t.triageSync.onStatusChange(r))},onServerInfo(e){return _s(e,(t,r)=>t.triageSync.onServerInfo(r))},onPersistenceDegraded(e){return _s(e,(t,r)=>t.triageSync.onPersistenceDegraded(r))},onProxyAuthRequired(e){return _s(e,(t,r)=>t.triageSync.onProxyAuthRequired(r))}}});function Xv(e){if(!e?.startsWith("#public="))return null;let t=/^#public=([A-Za-z0-9_-]+)\.([A-Za-z0-9_-]{43})$/u.exec(e);return t?{id:t[1],token:t[2]}:{id:"",token:""}}function Rn(){return XC}function Ss(e,t=XC){return t?`${e}#public=${t.id}.${t.token}`:e}var YC,XC,Cs=w(()=>{"use strict";YC=globalThis.location?.hash,XC=Xv(YC);globalThis.addEventListener?.("hashchange",()=>{let e=globalThis.location?.hash;e?.startsWith("#public=")&&e!==YC&&globalThis.location.reload()})});function Jv(e,t){return e?.view==="findings"&&t?.view==="findings"&&e.teamSlug===t.teamSlug&&(e.reportSlug??null)===(t.reportSlug??null)}function PB(e){let t=e.location.hash,r=Xv(t),n=!1,o=null,i=0,s=null,a=null,c=!1,u=null,p=null;function f(){return e.location.hash.startsWith("#public=")&&e.location.hash!==t}function h($){let C=gc($),I=C?.view==="home"?Po($.hash):null;return C?{...C,...I?{finding:I}:{}}:null}function g(){try{let $=e.sessionStorage?.getItem(Df);if(e.sessionStorage?.removeItem(Df),!$)return null;let C=new URL($,e.location.origin),I=C.origin===e.location.origin?h(C):null;return I?.finding?I:null}catch{return null}}function b(){if(!n||!Po(e.location.hash)||u===e.location.href||e.history.state?.[Mn]&&e.history.state[Mn]!==o)return;let $=u=e.location.href,C=h(new URL($));k(C??{view:"home"},{replace:!0}).finally(()=>{u===$&&(u=null)})}function y($){f()||($=Ss($,r),e.history.replaceState(n?{[Mn]:o}:null,"",$),a=$)}async function k($,{replace:C=!1,pop:I=!1}={}){if(!n||!s||f())return!1;$??={view:"home"};let E=ar($);if(E===null)return!1;let R=++i,z=p={route:$,findingRoute:null},U=()=>n&&R===i&&!f(),B=!1;try{B=await s($,U)}catch(ne){console.warn("managed: navigation failed:",ne)}return U()?B?(typeof B=="object"&&(E=ar(B)??E),Jv(z.findingRoute,typeof B=="object"?B:$)&&(E=ar(z.findingRoute)),p=null,I||C?y(E):Ss(E,r)!==a&&(E=Ss(E,r),e.history.pushState({[Mn]:o},"",E),a=E),!0):(await s({view:"home"},U),U()&&(p=null,y("/")),!1):!1}function v($){if(f())return;if(!n){$.state?.[Mn]&&y("/");return}if((!$.state?.[Mn]||$.state[Mn]===o)&&Po(e.location.hash)){b();return}let C=$.state?.[Mn]===o?h(new URL(e.location.href)):null;k(C??{view:"home"},{pop:!0})}function x($){if(!n||$.defaultPrevented||$.button!==0||$.metaKey||$.ctrlKey||$.shiftKey||$.altKey)return;let C=$.composedPath().find(R=>R.matches?.("a.comment-self-ref[href]"));if(!C||C.hasAttribute("download")||C.target&&C.target!=="_self")return;let I=new URL(C.href);if(I.origin!==e.location.origin)return;let E=h(I);if(E?.finding)return $.preventDefault(),k(E)}return{get active(){return n},rememberFinding(){let $=h(new URL(e.location.href));if(!$?.finding)return;let C=$.view==="home"?`/#${bn($.finding)}`:ar($);try{e.sessionStorage?.setItem(Df,C)}catch{}},start($){if(n)return;n=!0,s=$,o=typeof e.history.state?.[Mn]=="string"?e.history.state[Mn]:e.crypto.randomUUID(),c||(e.addEventListener("popstate",v),e.addEventListener("hashchange",b),e.addEventListener("click",x),e.launchQueue?.setConsumer(({targetURL:E})=>{if(!n||!E)return;let R=new URL(E);if(R.origin!==e.location.origin)return;let z=h(R);z&&k(z)}),c=!0);let C=g(),I=h(new URL(e.location.href))??{view:"home"};return C&&I.view==="home"&&!I.finding&&(I=C),k(I,{replace:!0})},navigate:k,replaceFindingRoute($){if(!n||$?.view!=="findings"||f())return;let C=ar($);if(C!=null){if(p){(p.route.view==="home"&&p.route.finding||Jv($,{...p.route,view:"findings"}))&&(p.findingRoute=$);return}Jv($,gc(new URL(e.location.href)))&&Ss(C,r)!==a&&y(C)}},replaceRoute($){if(!n||!$||f())return;let C=ar($);C!=null&&y(C)},reset({force:$=!1}={}){if(++i,p=null,n||$){try{e.sessionStorage?.removeItem(Df)}catch{}n=!1,o=null,s=null,y("/")}}}}var Mn,Df,Ie,qa=w(()=>{"use strict";Jn();ma();Cs();Mn="deepviewManagedNavigation",Df="deepviewManagedLoginFinding";Ie=typeof window>"u"?null:PB(window)});function Zv(){return so?.getPreviewRole()??null}function JC(){so?.setPreviewRole(null)}function ZC(){so?.resetManagedAppState()}function QC(e){so?.setManagedAppSession(e)}function e5(e){return so?.setManagedReportCatalog(e)??new Set}function Ya(e,t=l.currentManagedTeam){return so?.readReportSources(e,t)}function t5(){so?.clearReportSources()}async function zf(e,t=l.currentManagedTeam){return(await He()).fetchReportSources(e,t)}function He(){return md||(md=(async()=>{let e="./client-managed.js";try{return so=await import(e),so}catch(t){throw md=null,t}})(),md)}async function r5(e){return(await He()).probeSession(e)}async function n5(e){return(await He()).probeTeams(e)}async function o5(){return(await He()).fetchManagedBundleCatalog()}async function i5(e){return(await He()).openManagedShareDialog(e,"",l.managedSession)}async function Qv(e,t=l.currentManagedTeam,r){return(await He()).fetchReportTriage(e,t,r)}async function s5(e,t){return(await He()).fetchFixes(e,t)}async function a5(e,t=l.currentManagedTeam,r){return(await He()).fetchReportComments(e,t,r)}async function l5(e,t,r,n=l.currentManagedTeam){return(await He()).saveReportComment(e,t,r,n)}async function c5(e,t,r,n,o=l.currentManagedTeam){return(await He()).deleteReportComment(e,t,r,n,o)}async function d5(e,t,r,n=l.currentManagedTeam){return(await He()).pushReportTriage(e,t,r,n)}async function u5(e){return e&&Ie?.rememberFinding(),(await He()).login(e)}async function p5(e){return(await He()).logout(e)}async function Uf(e){return(await He()).fetchBundleMetadata(e)}async function f5(e,t){return(await He()).fetchBundleContents(e,t)}async function Hf(e){return(await He()).fetchTeamReports(e)}async function h5(e,t){return(await He()).watchTeamFeed(e,t)}async function m5(e,t=l.currentManagedTeam,r=""){return(await He()).fetchBundleAdvisories(e,t,r)}var md,so,Zt=w(()=>{"use strict";D();qa();md=null,so=null});var gd,V,g5=w(()=>{Ur();Vi();gd=class extends Gt{constructor(t){if(super(t),this.it=m,t.type!==Rt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===m||t==null)return this._t=void 0,this.it=t;if(t===Xe)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:[]}}};gd.directiveName="unsafeHTML",gd.resultType=1;V=kr(gd)});var qe=w(()=>{g5()});function b5(e){return e==="completed"||e==="not_planned"||e==="duplicate"?e:"unknown"}function NB(e){let[t,r,n]=e.split("/");return n===void 0&&t!==void 0&&r!==void 0&&t.length<=39&&/^[a-zA-Z\d](?:-?[a-zA-Z\d])*$/u.test(t)&&r.length<=100&&r!=="."&&r!==".."&&/^[a-zA-Z\d._-]+$/u.test(r)}function y5(e,t){if(typeof e!="string"||e.length>2048)return null;let r;try{r=new URL(e)}catch{return null}if(r.href!==e||r.origin!=="https://github.com"||r.username||r.password)return null;let n=t.exec(r.pathname);if(!n)return null;let o=`${n[1]}/${n[2]}`,i=Number(n[3]);return!NB(o)||!Number.isSafeInteger(i)||i<=0?null:{repo:o,number:i}}function ew(e){return y5(e,/^\/([^/]+)\/([^/]+)\/pull\/(\d+)(?:\/(?:files|commits|checks))?\/?$/u)}function tw(e){return y5(e,/^\/([^/]+)\/([^/]+)\/issues\/(\d+)\/?$/u)}function rw(e){let t=ew(e);if(t)return{...t,kind:"pull"};let r=tw(e);return r?{...r,kind:"issue"}:null}function jf(e){return`${e.repo.toLowerCase()}#${e.kind}:${e.number}`}var nw=w(()=>{"use strict"});function DB(e){let t=e?.teams?.find(r=>r.id===e.teamId);return t?!t.cacheKey||!Array.isArray(t.reports)||t.reports.some(r=>!r.cacheKey)?e.teams:JSON.stringify([t.cacheKey,t.reports.map(r=>[r.id,r.cacheKey]).toSorted()]):null}var Vf,v5=w(()=>{"use strict";nw();Vf=class{constructor({context:t,fetchWorkspace:r,changed:n=()=>{},now:o=Date.now}){this.getContext=t,this.fetchWorkspace=r,this.changed=n,this.now=o,this.entries=new Map,this.expires=0,this.context=null,this.scope=null,this.timer=null,this.run=null}reset(){this.run?.abort(),this.run=null,clearTimeout(this.timer),this.timer=null,this.entries.clear(),this.expires=0,this.context=null,this.scope=null}syncContext(){let t=this.getContext();if(t?.key!==this.context?.key||t?.teamId!==this.context?.teamId||t?.teams!==this.context?.teams){let r=DB(t);(t?.key!==this.context?.key||t?.teamId!==this.context?.teamId||r!==this.scope)&&this.reset(),this.context=t,this.scope=r}return this.scope===null?null:this.context}read(t){let n=this.syncContext()?.teamId&&rw(t);return n?this.expires>this.now()?this.entries.get(jf(n))??null:(!this.timer&&!this.run&&(this.timer=setTimeout(()=>{this.timer=null,this.flush()},0)),this.entries.get(jf(n))??null):null}async flush(){let t=this.syncContext();if(!t?.teamId||this.run||this.expires>this.now())return;let r=this.run=new AbortController,n;try{n=await this.fetchWorkspace(t.teamId,r.signal)}catch{n=null}if(this.syncContext(),!(this.run!==r||r.signal.aborted)){this.entries.clear();for(let o of Array.isArray(n)?n:[]){let i=rw(o?.url);if(i&&typeof o.title=="string"&&["open","draft","closed","merged"].includes(o.status)){let s=i.kind==="issue"&&o.status==="closed"?b5(o.stateReason):null;this.entries.set(jf(i),{title:o.title,description:typeof o.description=="string"?o.description:null,status:o.status,stateReason:s})}}this.expires=this.now()+6e4,this.run=null,this.changed()}}}});function w5(e){return Wf.add(e),()=>Wf.delete(e)}function iw(){ow.reset();for(let e of Wf)e()}function sw(e){l.currentManagedTeam===e&&iw()}var Wf,ow,Kf=w(()=>{"use strict";D();v5();Zt();Wf=new Set,ow=new Vf({context:()=>{let e=l.managedSession;return _()&&e?.id&&l.currentManagedTeam?{key:JSON.stringify([e.id,e.role,e.csrfToken]),teamId:l.currentManagedTeam,teams:l.managedTeams}:null},fetchWorkspace:s5,changed:()=>{for(let e of Wf)e()}})});function zB(){return An||(An=document.createElement("div"),An.id="app-toast",An.setAttribute("role","status"),An.setAttribute("aria-live","polite"),document.body.append(An),An)}function _t(e,{kind:t="info",duration:r=5200}={}){let n=zB(),o=++Gf;clearTimeout(bd),bd=null,n.className=t,n.textContent=e,requestAnimationFrame(()=>{Gf===o&&n.classList.add("visible")});let i=()=>{Gf===o&&aw()};return r>0&&(bd=setTimeout(i,r)),i}function aw(){Gf++,An&&(clearTimeout(bd),bd=null,An.classList.remove("visible"))}var An,bd,Gf,Xa=w(()=>{"use strict";An=null,bd=null,Gf=0});function qf(e){return{managedId:e.id,slug:e.slug,integrity:e.integrity,kind:e.kind,summary:e.summary,name:e.filename,size:e.byteSize,repoId:e.repoId,repoFullName:e.repoFullName,repoDirectory:e.repoDirectory??""}}function Ja(e,t,r,n="overview"){if(!t?.managedId)return null;let o=e.find(i=>i.id===r&&i.bundles?.some(s=>s.id===t.managedId));return r!=null&&!o?null:bt({view:"bundles",teamId:o?.id??null,bundleId:t.managedId,bundleTab:n},e,[{id:t.managedId,slug:t.slug}])}function k5(e){return[...new Map(e.flatMap(t=>t.bundles??[]).map(t=>[t.id,qf(t)])).values()]}var Yf=w(()=>{"use strict";Jn()});function x5(e,t,r){if(e.currentView!=="findings"&&e.currentView!=="files"&&e.currentView!=="links"||!e.currentManagedTeam)return!1;let n=t.find(s=>s.id===e.currentManagedTeam);if(r.has(`team:${e.currentManagedTeam}`)||!n||e.managedReports.some(s=>r.has(s.id)))return!0;let o=new Set(n.reports.map(s=>s.id));if(e.currentManagedReport!==null)return!o.has(e.currentManagedReport);let i=new Set(e.managedReports.map(s=>s.id));return o.size!==i.size||[...o].some(s=>!i.has(s))}var $5=w(()=>{"use strict"});function UB(e){let t=1/0,r=Date.now()+5e3;for(let n of e)for(let o of n.bundles??[])["stasis","sourcemap"].includes(o.kind)&&o.summary==null&&(t=Math.min(t,Math.max(r,o.summaryRetryAt??0)));return t}function _5(e){let t=null,r=null,n=null;return async({generation:o,session:i,signal:s,reuse:a=!1,revision:c=null})=>{if(s.aborted)return null;let u=JSON.stringify([o,i?.id,i?.role,i?.csrfToken]);if(n!==u&&(t?.controller.abort(),t=null,r=null,n=u),r&&Date.now()<r.expiresAt&&(a||c!==null&&c===r.revision))return r.teams;if(!t||t.signal.aborted||c!==null&&t.revision!==c){t?.controller.abort(),r=null;let h=new AbortController,g=AbortSignal.any([s,h.signal]),b={controller:h,signal:g,promise:null,revision:c};t=b;let y=null;b.promise=e({fallback:null,signal:g,onRevision:k=>{y=k}}).then(k=>g.aborted||n!==u?null:(k!==null&&(r={teams:k,revision:y,expiresAt:UB(k)}),k)).finally(()=>{t===b&&(t=null)})}let p=t,f=()=>p.controller.abort();s.addEventListener("abort",f,{once:!0});try{let h=await p.promise;return s.aborted||p.signal.aborted?null:h}finally{s.removeEventListener("abort",f)}}}var S5=w(()=>{"use strict"});function Ze(){return C5}function Es(){return lw.signal}function St(){return lw.abort(),lw=new AbortController,++C5}var C5,lw,Za=w(()=>{"use strict";C5=0,lw=new AbortController});function cw(e){return e.repoFullName?`${e.repoFullName}${e.repoDirectory?`/${e.repoDirectory}`:""}`:""}function E5(e){let t=e.summary;return t&&[t.files,t.lines].every(r=>Number.isSafeInteger(r)&&r>=0)?`${t.files.toLocaleString()} files \xB7 ${t.lines.toLocaleString()} LoC`:""}function R5(e,t=""){let r=t.trim().toLowerCase(),n=o=>String(o??"").toLowerCase().includes(r);return(Array.isArray(e)?e:[]).flatMap(o=>{let i=(o.reports??[]).filter(a=>n(a.filename)),s=(o.bundles??[]).filter(a=>n(a.filename));return n(o.name)||i.length>0||s.length>0?[{team:o,reports:i,bundles:s}]:[]})}var M5=w(()=>{"use strict"});function HB(){return{showAll:!1,splitOwnDirs:!1,packagesView:!1,dependencyPackagesView:!1,bundleLayout:"graph",bundleReason:null,bundleReasonFor:null,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}}function Ye(){L.graphState?._cleanup&&L.graphState._cleanup(),L.graphState=null}function A5(){return ti}var ti,L,ao=w(()=>{"use strict";ti=HB(),L=new Proxy(ti,{get(e,t){return ti[t]},set(e,t,r){return ti[t]=r,!0},has(e,t){return t in ti},deleteProperty(e,t){return delete ti[t]},ownKeys(){return Reflect.ownKeys(ti)},getOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(ti,t)}})});function T5(e){return typeof e=="string"&&yd.includes(e)}function Xf(e,t){let r=yd.indexOf(e);return r!==-1&&r<=yd.indexOf(t)}var yd,Jf=w(()=>{"use strict";yd=["admin","manage","triage","view","none"]});var I5=w(()=>{"use strict"});var Zf,Er,ri,L5,F5,Qf,Qa,el,eh,th,B5,ni,O5,P5,ft=w(()=>{"use strict";Zf="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",Er='<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>',ri='<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>',L5='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" aria-hidden="true"><path d="m4.5 4.5 7 2-5 5z"/><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>',F5='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.35" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="8" cy="2.5" r="1.5" fill="currentColor"/><circle cx="3" cy="13" r="1.5" fill="currentColor"/><circle cx="8" cy="13" r="1.5" fill="currentColor"/><circle cx="13" cy="13" r="1.5" fill="currentColor"/><path d="M8 4v3M8 7H3m5 0h5M3 7v4M8 7v4M13 7v4"/></svg>',Qf='<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.38a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg>',Qa='<svg class="file-icon" 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="M6.67 8.67a3.33 3.33 0 0 0 5.03.36l2-2a3.33 3.33 0 0 0-4.71-4.71l-1.15 1.14"/><path d="M9.33 7.33a3.33 3.33 0 0 0-5.03-.36l-2 2a3.33 3.33 0 0 0 4.71 4.71l1.14-1.14"/></svg>',el='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 1.5H2.5a1 1 0 0 0-1 1V5m9.5-3.5h2.5a1 1 0 0 1 1 1V5M1.5 11v2.5a1 1 0 0 0 1 1H5m6 0h2.5a1 1 0 0 0 1-1V11"/><circle cx="7.25" cy="7.25" r="2.75"/><path d="m9.25 9.25 2.25 2.25"/></svg>',eh='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 1.5H4a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V5.5L9 1.5ZM9 1.5v4h4M5.5 8h5m-5 3h3.5"/></svg>',th='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m4.5 4.5-3 3.5 3 3.5m7-7 3 3.5-3 3.5M9.5 2l-3 12"/></svg>',B5='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6.5 3.5 1.6 3.9L12 9l-3.9 1.6-1.6 3.9-1.6-3.9L1 9l3.9-1.6 1.6-3.9ZM12 1.5v4m-2-2h4"/></svg>',ni='<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path fill="currentColor" 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-.27s1.36.09 2 .27c1.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.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z"/></svg>',O5='<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m10 2 4 4-8 8H2v-4l8-8Zm-1 1 4 4"/></svg>',P5='<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 4h12M6 4V2h4v2M4 4l.6 10h6.8L12 4M6.5 7v4m3-4v4"/></svg>'});var N5,jB,vd,Qe,rh=w(()=>{"use strict";ft();N5={default:{className:"brand-deepview",mark:'<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"/>'},"claude-security":{className:"brand-claude",mark:`<path class="fg" d="${Zf}"/>`},"codex-security":{className:"brand-codex",mark:'<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"/>'},deepsec:{className:"brand-vercel",mark:'<path class="fg" d="m8 5.97 3.5 6.062h-7Z"/>'},piolium:{className:"brand-piolium",mark:'<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"/>'}},jB={default:["#2563eb","#fff"],"claude-security":["#d97757","#fff"],"codex-security":["#fff","#000"],deepsec:["#000","#fff"],piolium:["#fbb829","#1c1b19"]},vd=Object.fromEntries(Object.entries(N5).map(([e,{className:t,mark:r}])=>{let[n,o]=jB[e],i=e==="codex-security"||e==="deepsec"?` stroke="${o}" stroke-width=".5"`:"";return[e,`<svg class="file-icon ${t}" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path class="bg" fill="${n}"${i} d="M3 2h6l4 4v8H3z"/><path fill="rgba(0,0,0,.18)" d="M9 2v4h4Z"/><g fill="${o}">${r}</g></svg>`]})),Qe=Object.fromEntries(Object.entries(N5).map(([e,{className:t,mark:r}])=>[e,`<span class="report-logo ${t}" aria-hidden="true"><svg viewBox="${e==="default"?"3.5 4 9 9":"4 5 8 8"}" width="14" height="14">${r}</svg></span>`]))});function D5(e){return e!=="default"&&Object.hasOwn(Qe,e)?e:null}function wd(e){return D5(e._source??e.source)}function z5(e){let t=new Set;for(let o of e){let i=D5(o.source);i!==null&&t.add(i);for(let s of o.groups.flat()){let a=wd(s);a!==null&&t.add(a)}}let r=Object.keys(yt),n=o=>{let i=r.indexOf(o);return i===-1?r.length:i};return[...t].toSorted((o,i)=>n(o)-n(i)||o.localeCompare(i))}function et(e){let t=Jt(e);if(t===at)return at;if(t!==void 0)return VB.has(t)?t:"default";let r=e.toLowerCase();return r.endsWith(".codex")?"codex-security":r.endsWith(".md")?"claude-security":"default"}function nh(e){return Jt(e)===at}function Re(e){return e.toLowerCase().endsWith(".codex")?e.slice(0,-6).replaceAll("__","/"):e}var ke,VB,Rs,en=w(()=>{"use strict";D();rh();rh();Ee();ft();ke={...vd,[at]:Qa},VB=new Set(["claude-security","codex-security","deepsec","piolium"]),Rs={...yt,default:"DeepView"}});function kd(e=document){if(e.querySelector(":modal"))return!0;for(let t of e.querySelectorAll("*"))if(t.shadowRoot&&kd(t.shadowRoot))return!0;return!1}var dw=w(()=>{"use strict"});function WB(){return Rr||(Rr=document.createElement("div"),Rr.id="styled-tooltip",Rr.setAttribute("popover","manual"),document.body.append(Rr),Rr)}function KB(e){typeof e.showPopover=="function"&&(e.matches(":popover-open")&&e.hidePopover(),e.showPopover())}function uw(e,{placement:t="cursor"}={}){let r=WB(),n=e.dataset.tooltip??"",o=e.dataset.tooltipRepo??"",i=["stasis","sourcemap"].includes(e.dataset.tooltipBundle)?e.dataset.tooltipBundle:"",s=e.dataset.tooltipStats??"";if(!n||oi===e&&U5===n&&H5===o&&j5===i&&V5===s)return;if(r.textContent=n,o){let y=document.createElement("div");y.className="tooltip-repo",y.innerHTML=ni;let k=document.createElement("span");k.textContent=o,y.append(k),r.append(y)}if(i){let y=document.createElement("div");if(y.className="tooltip-bundle",i==="stasis"){let v=document.createElement("img");v.src="./stasis.svg",v.alt="",y.append(v)}else y.innerHTML=Er;let k=document.createElement("span");k.textContent=`${i==="stasis"?"Stasis":"Sourcemap"}${s?` \xB7 ${s}`:""}`,y.append(k),r.append(y)}KB(r),r.style.left="0px",r.style.top="0px",r.style.transform="none",r.classList.add("visible");let a=q5,c=Y5+qB;if(t==="right"){let y=e.getBoundingClientRect();a=y.right+YB,c=y.top+y.height/2}let u=window.innerWidth-r.offsetWidth-oh,p=Math.max(oh,Math.min(a,u));r.style.left=`${Math.round(p)}px`;let f=r.offsetHeight,h=t==="right"?c-f/2:c,g=window.innerHeight-f-oh,b=Math.max(oh,Math.min(h,g));r.style.top=`${Math.round(b)}px`,oi=e,U5=n,H5=o,j5=i,V5=s}function ii(){clearTimeout(xd),xd=null,Rr&&(Rr.classList.remove("visible"),typeof Rr.hidePopover=="function"&&Rr.matches(":popover-open")&&Rr.hidePopover()),oi=null}function X5(e,{gate:t,placement:r}={}){t&&!t(e)||(clearTimeout(xd),xd=setTimeout(()=>{uw(e,{placement:r})},GB))}function K5(e,t){for(let r of e.composedPath()){if(r===t)break;if(r.nodeType===1&&Object.hasOwn(r.dataset,"tooltip"))return r}return null}function Dt(e,t){!e||W5.has(e)||(W5.add(e),e.addEventListener("mouseover",r=>{let n=K5(r,e);if(!n){ii();return}n!==oi&&X5(n,t)}),e.addEventListener("mouseout",r=>{let n=K5(r,e),o=r.relatedTarget?.closest?.("[data-tooltip]")??null;n&&n===o||ii()}))}function J5(){G5||(G5=!0,document.body.addEventListener("mouseover",e=>{if(e.target.closest("[data-tooltip-managed]"))return;let t=e.target.closest("[data-tooltip]");!t||t===oi||(ii(),X5(t))}),document.body.addEventListener("mouseout",e=>{e.target.closest("[data-tooltip-managed]")||e.relatedTarget?.closest?.("[data-tooltip-managed]")||!oi&&!xd||oi&&oi.contains(e.relatedTarget)||ii()}))}var Rr,oi,U5,H5,j5,V5,xd,q5,Y5,GB,qB,YB,oh,W5,G5,lo=w(()=>{"use strict";ft();oi=null,U5="",H5="",j5="",V5="",xd=null,q5=0,Y5=0;document.addEventListener("mousemove",e=>{q5=e.clientX,Y5=e.clientY},{passive:!0});GB=100,qB=14,YB=8,oh=8;W5=new WeakSet;G5=!1});var Q5,Z5=w(()=>{Q5=`a{cursor:default}*,*: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)}}&.quiet{border-color:transparent;color:var(--muted);&:hover:not(:disabled){border-color:transparent}}&.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}}
82
+ `});function le(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)})}function si(e,t,r){return new Promise((n,o)=>{let i=document.createElement(e);Object.assign(i,t),i.exclusive=!0,i.addEventListener("resolve",s=>{i.remove(),n(s.detail)}),i.addEventListener("modal-conflict",s=>{r(i),i.remove(),o(aa(s.detail?.cause))}),document.body.append(i)})}var F,ue=w(()=>{"use strict";T();or();dw();lo();Z5();F=class extends X{static styles=[A(Q5)];exclusive=!1;firstUpdated(){Dt(this.renderRoot),this.beforeOpen();let t=this.renderRoot.querySelector("dialog");if(t){if(this.exclusive&&kd()){this._conflict(new DOMException("Another modal dialog is already open","InvalidStateError"));return}try{t.showModal()}catch(r){this._conflict(r);return}this.focusInitial()}}_conflict(t){this._settled=!0,this.dispatchEvent(new CustomEvent("modal-conflict",{detail:{cause:t}}))}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)}});var Mr,Ms=w(()=>{Mr=`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);>p+p{margin-top:.45rem}}.wsl-optout{display:flex;align-items:center;gap:.5rem;margin-top:.7rem;color:var(--text);font-size:.78rem}.nwd-input:disabled{opacity:.5}.nwd-actions button.primary.danger{background:var(--critical, #f87171);border-color:var(--critical, #f87171);color:var(--surface);&:hover:not(:disabled){border-color:var(--critical, #f87171);color:var(--surface);filter:brightness(1.08)}}
83
+ `});function ih({tryPassword:e}={}){if(typeof e!="function")throw new TypeError("openWorkspaceUnlockBundleDialog: tryPassword required");return si("workspace-unlock-bundle-dialog",{_tryPassword:e},t=>{t._tryPassword=null})}var pw,fw=w(()=>{"use strict";T();ue();Ms();pw=class extends F{static styles=[...F.styles,A(Mr)];static properties={_password:{state:!0},_busy:{state:!0},_error:{state:!0},_settled:{state:!0}};constructor(){super(),this._password="",this._busy=!1,this._error="",this._settled=!1,this._tryPassword=null}_finish(t){this._settled||(this._password="",this._tryPassword=null,super._finish(t))}_onClose=()=>this._finish(null);_onCancel=()=>this._finish(null);_onPasswordInput=t=>{this._password=t.target.value,this._error=""};_onUnlock=async()=>{if(!(!this._password||this._busy)){this._busy=!0,this._error="";try{let t=await this._tryPassword(this._password);if(this._settled)return;this._finish(t)}catch(t){if(this._settled)return;this._error=t?.message??String(t)}finally{this._busy=!1}}};_onKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._onUnlock())};render(){return d`<dialog @close="${this._onClose}"><header><h3>Unlock encrypted workspace</h3></header><p class="nwd-note">This workspace bundle is password-protected. Enter the password the sender shared with you separately to decrypt and import it.</p><label class="wsl-field"><span>Password</span> <input type="password" class="nwd-input" autocomplete="off" data-1p-ignore="true" data-lpignore="true" data-bwignore="true" data-form-type="other" name="dv-bundle-unlock" maxlength="1024" .value="${this._password}" @input="${this._onPasswordInput}" @keydown="${this._onKeydown}"></label> ${this._error?d`<p class="wsl-error" role="alert">${this._error}</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!this._password||this._busy}" @click="${this._onUnlock}">${this._busy?"Unlocking\u2026":"Unlock"}</button></footer></dialog>`}};customElements.define("workspace-unlock-bundle-dialog",pw)});var eE,tE,$d,rE,nE,$X,_X,SX,CX,EX,hw=w(()=>{"use strict";eE=globalThis[Symbol.for("@rray/frontend")];if(!eE)throw new Error("@rray/frontend global not installed; view.js must run before lazy bundles import this wrapper");({LitElement:tE,html:$d,nothing:rE,unsafeCSS:nE,render:$X,StateElement:_X,classMap:SX,repeat:CX,styleMap:EX}=eE)});function ai(e,t=!1){tl=e!==!1&&!t}function yw(){return tl}function fr(e){return tl?Te(e):""}function hE(e){return Te(e)!==""}function vw(e){let t=Te(e);return t!==""&&t!=="revalidation"}function sh(e){return e.some(t=>(t.groups??[]).some(r=>r.some(vw)))}function ww(e){let t=fr(e);return t&&t!=="revalidation"?t:null}function Sd(e){return fr(e)==="revalidation"}function As(e){return mE.has(fr(e))}function gE(e){return mE.has(fr(e))}function lh(e){return ah.find(t=>t.value===e)?.kinds??null}function Cd(e,t){let r=lh(e);return r?.includes("partial")?t==="only"?["partial"]:t==="exclude"?["confirmed"]:r:r}function bE(e){let t=new Set(e);return ah.filter(r=>r.kinds.some(n=>t.has(n)))}function dh(e){return new RegExp(`(^|/)${e}/`,"u")}function yE(e){return new RegExp(`^(?:.*/)?${e}/(?:@[^/]+/[^/]+|[^/]+)/(.*)$`,"u")}function ZB(e){e!==_d&&(_d=e,kw=dh(e),kE=yE(e))}function uh(e){let t=!1,r=!1,n=o=>(!t&&vE.test(o)&&(t=!0),!r&&wE.test(o)&&(r=!0),t);e:for(let o of e){for(let i of o.groups??[])for(let s of i)if(n(s.file))break e;if(o.tree){for(let i of Object.keys(o.tree))if(n(i))break e}}ZB(t?"node_modules":r?"vendor":"dependencies")}function xE(){return _d}function Qt(e){return kw.test(e)}function ph(e){let t=!1;for(let r of e??[])for(let n of r.groups??[])for(let o of n){if(o.isApp!==!1)continue;let i=mw.has(o);"isUpstream"in o&&!i||(Qt(o.file)?(o.isUpstream!==!0&&(t=!0),o.isUpstream=!0,mw.add(o)):i&&(t=!0,delete o.isUpstream,mw.delete(o)))}return t}function oE(e){let t=typeof e=="string"?e:"";return vE.test(t)||wE.test(t)||kw.test(t)}function iE(e){return QB.exec(typeof e=="string"?e:"")?.[1]??null}function ye(e){return typeof e!="number"||!Number.isFinite(e)?null:`${e.toLocaleString()} B`}function hr(e){if(e.length<=1)return{prefix:"",stripped:[...e]};let t=e.map(s=>s.split("/")),r=Math.min(...t.map(s=>s.length)),n=0;for(let s=0;s<r-1&&t.every(a=>a[s]===t[0][s]);s++)n=s+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("/")}/`,i=t.map(s=>s.slice(n).join("/"));return{prefix:o,stripped:i}}function eO(e){return e.match(kE)?.[1]??e}function $E(e){let t=tl?[ww(e),e.revalidateVerdict,e.revalidateRecommendation]:[];return[e.file,e.title,e.description,e.impact,e.reproduction,$w(e),e.recommendation,e.confidenceReason,...t,e.discoveredIn,e.repo?.github].filter(Boolean).join(`
84
+ `).toLowerCase()}function Ts(e){return[typeof e?.category=="string"?e.category.trim():"",_c(e,tl)].filter(Boolean).join(" \xB7 ")}function Ed(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 tt(e){if(!e)return"";let t=e.match(/github\.com\/([^/?#]+\/[^/?#]+?)(?:\.git)?(?:[/?#]|$)/iu);return t?t[1]:e}function _E(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}function rO(e){return tO.test(e||"")}function sE(e){if(e==null||typeof e=="string")return{id:e??"",prefix:""};let t=as(e);return{id:typeof e.github=="string"?e.github:"",prefix:t?`${t}/`:""}}function nO(e,t,r){if(rO(e))return null;let n=sE(t);if(n.id)return`https://github.com/${n.id}/blob/HEAD/${n.prefix}${eO(e)}`;if(Qt(e))return null;let o=sE(r),i=_E(o.id);return i?`${i}/blob/HEAD/${o.prefix}${e}`:null}function xw(e,t){let r=e?.file??"",n=Tn(e,t);return n?$d`<a href="${oO(n)}" target="_blank" rel="noopener">${r}</a>`:r}function oO(e){return e.replace(/#L\d+(?:-L?\d+)?$/u,"")}function Tn(e,t){if(!e)return null;if(Fe(e.location))return e.location;let r=nO(e.file,e.repo,t);if(!r)return null;let n=parseInt(e.line,10);return Number.isFinite(n)?`${r}#L${n}`:r}function SE(e){let t=typeof e=="string"?iO.exec(e):null;if(!t)return"";let r=t[2],n=sO.exec(r);if(!n)return`${t[1]}/${r}`;r=r.slice(0,n.index);let o=n[2]?`${n[1]}-${n[2]}`:n[1];return`${t[1]}/${r}:${o}`}function CE(e){return e.split(/(\n{2,})/u).map(t=>{if(/^\n+$/u.test(t))return t;let r=t.split(`
85
+ `);return r.some(n=>aO.test(n))?t:r.map(n=>n.trim()).filter(Boolean).join(" ")}).join("")}function aE(e,t,r){let n=t?/^\n*/u.exec(e)[0]:"",o=e.slice(n.length),i=r?/\n*$/u.exec(o)[0]:"";return n+CE(o.slice(0,o.length-i.length))+i}function rl(e){if(!e)return e;let t=ut(e);if(t.length===0)return CE(e);let r=[],n=0;for(let[o,i]of t)o>n&&r.push(aE(e.slice(n,o),n>0,!0)),r.push(e.slice(o,i)),n=i;return n<e.length&&r.push(aE(e.slice(n),!0,!1)),r.join("")}function EE(e,t){let r=0;for(;r<t&&e[r]===" ";)r++;return e.slice(r)}function cO(e){let t=e.split(`
86
+ `),r=lE.exec(t[0]),n=(r?.[2]??"```").slice(0,3),o=(r?.[3]??"").trim().split(/\s+/u)[0].toLowerCase(),s=!!(t.length>1?lE.exec(t.at(-1)):null)?.[2].startsWith(n),a=r?.[1].length??0,c=t.slice(1,s?-1:void 0);return{lang:lO.test(o)?o:"",code:(a>0?c.map(u=>EE(u,a)):c).join(`
87
+ `)}}function RE(e){let t=ut(e||"");if(t.length===0)return[e];let r=[],n=0,o=(i,s)=>{let a=(s?i.replace(/^\n+/u,""):i).replace(/\n+$/u,"");a&&r.push(a)};for(let[i,s]of t)i>n&&o(e.slice(n,i),n>0),r.push(cO(e.slice(i,s))),n=s;return n<e.length&&o(e.slice(n),!0),r}function dO(e){return/^ */u.exec(e)[0].length}function dE(e){let t=e.length;for(;t>0&&!e[t-1].trim();)t--;return e.slice(0,t).join(`
88
+ `)}function ME(e){let t=typeof e=="string"?e:"";if(!t)return[e];let r=ut(t),n=t.split(`
89
+ `),o=[],i=0;for(let f of n)o.push(i),i+=f.length+1;let s=f=>!lr(r,o[f])&&!cE.test(n[f])&&gw.test(n[f]),a=[],c=0,u=0,p=f=>{let h=n.slice(c,f).join(`
90
+ `).replace(/^\n+/u,"").replace(/\n+$/u,"");h.trim()&&a.push(h)};for(;u<n.length;){if(!s(u)){u++;continue}p(u);let f=gw.exec(n[u]),h=!!f[2],g=[],b=null,y=!1;for(;u<n.length;){let k=n[u];if(!lr(r,o[u])){if(!k.trim()){b.lines.push(""),y=!0,u++;continue}let v=dO(k),x=cE.test(k)?null:gw.exec(k);if(x&&(!b||v<b.column)){if(!!x[2]!==h)break;b&&g.push(dE(b.lines)),b={column:x[0].length,lines:[k.slice(x[0].length)]},y=!1,u++;continue}if(v<b.column&&y)break}b.lines.push(EE(k,b.column)),y=!1,u++}b&&g.push(dE(b.lines)),a.push({ordered:h,start:h?Number(f[2]):null,items:g}),c=u}return a.length===0?[e]:(p(n.length),a)}function Ct(e){if(typeof e=="number")return Number.isFinite(e)&&e>=1?{start:Math.floor(e),end:Math.floor(e)}:null;let t=uO.exec(String(e??"").trim());if(!t)return null;let r=parseInt(t[1],10),n=t[2]===void 0?r:parseInt(t[2],10);return!Number.isFinite(r)||r<1||!Number.isFinite(n)||n<1?null:{start:Math.min(r,n),end:Math.max(r,n)}}function fh(e){return e?e.start===e.end?String(e.start):`${e.start}-${e.end}`:""}function pO(e){if(e&&typeof e=="object"){let t=Ct(e.start);if(!t)return null;let r=Ct(e.end)??t;return{start:t.start,end:Math.max(t.start,r.end)}}return Ct(e)}function AE(e,t,r=4){let n=typeof e=="string"&&e!==""?e.split(`
91
+ `):[];if(n.length===0)return{text:"",startLine:1,lines:[]};let o=pO(t),i=o&&{start:Math.min(o.start,n.length),end:Math.min(o.end,n.length)},s=i?Math.max(1,i.start-r):1,a=i?Math.min(n.length,i.end+r):Math.min(n.length,r*2+1),c=n.slice(s-1,a);return{text:c.join(`
92
+ `),startLine:s,lines:c}}function hh(e,t,r,n){if(Fe(e?.url))return e.url;let o=e?.file;if(typeof o!="string"||o==="")return null;let i=t?.file??"",s=t?.repo?.github,a=()=>s?Tn({file:o,line:e?.line,repo:t.repo},null):null;if(n===0&&o===i)return a();let c=iE(o);return c!==null&&c===iE(i)?a():oE(o)?null:s&&!oE(i)?a():Tn({file:o,line:e?.line},r)}function TE(e,{spaced:t=!1}={}){let r=Array.isArray(e?.evidence)?e.evidence:[];return r.length===0?"":r.map((n,o)=>{let i=vt(n),s=[`${o+1}. ${n.url?`[${i}](${n.url})`:i}`],a=ns(n);if(a)for(let c of a.split(`
93
+ `))s.push(` ${c}`);return s.join(`
94
+ `)}).join(t?`
95
+
96
+ `:`
97
+ `)}function $w(e){let t=TE(e);return t?`**Evidence:**
98
+ ${t}`:""}function IE(e){let t=/^\[([^\]]+)\]\(([^)\s]+)\)$/u.exec(e);return!t||!Fe(t[2])?null:{label:xc(t[1].trim())||t[2],url:t[2]}}function LE(e,t){let r=parseInt(e?.line,10);if(!Number.isFinite(r))return rE;let n=Tn(e,t),o=`line ${r}`;return n?$d`<a href="${n}" target="_blank" rel="noopener">${o}</a>`:o}function mh(e,t){return!e||!t?null:`${/^https?:/iu.test(e)?e.replace(/\/$/u,""):`https://github.com/${e}`}/commit/${t}`}function FE(e,t){let r=[];t&&r.push(`Repo: ${t}`);let n=vt(e);n&&r.push(`Location: ${n}`),e?.confidence!=null&&r.push(`Confidence: ${e.confidence}/10`);let o=fr(e);o&&r.push(`Revalidation: ${o}`);let i=[];r.length>0&&i.push(r.join(`
99
+ `));let{title:s,body:a}=Do(e);s&&i.push(`# ${s}`),a&&i.push(a.trim());let c=TE(e,{spaced:!0});c&&i.push(`# Evidence
100
+
101
+ ${c}`);for(let[u,p]of fO){if(!tl&&p.startsWith("revalidate"))continue;let f=Ft(e?.[p],e)?.trim();f&&i.push(`# ${u}
102
+
103
+ ${f}`)}return i.join(`
104
+
105
+ `)}function BE(e,{title:t,body:r}={}){let n=_E(e);if(!n)return null;let o;try{o=new URL(n).host.toLowerCase()}catch{return null}if(o!=="github.com")return null;let i=new URLSearchParams;t&&i.set("title",t),r&&i.set("body",r);let s=i.toString();return s?`${n}/issues/new?${s}`:`${n}/issues/new`}function pE(e){return e.length<=39&&hO.test(e)}function fE(e){return e.length<=100&&e!=="."&&e!==".."&&mO.test(e)}function vO(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 uE.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!pE(p)||!fE(f)||!uE.test(h)?null:{url:`https://github.com/${p}/${f}/security/advisories/${h}`,label:h}}if(r.length!==5)return null;let[,n,o,i,s]=r;if(!pE(n)||!fE(o))return null;let a;if(i==="issues"||i==="pull"){if(!gO.test(s))return null;a=`${n}/${o}#${s}`}else if(i==="commit"){if(!bO.test(s))return null;a=`${n}/${o}@${s.slice(0,7)}`}else return null;let c=yO.test(t.hash)?t.hash:"";return{url:`https://github.com/${n}/${o}/${i}/${s}${c}`,label:a}}function Is(e){if(typeof e!="string")return null;let t=Rd(e);return t!==e||wO.test(e)?t.slice(0,8):null}function Rd(e){let t=String(e),r="https://chatgpt.com/codex/cloud/security/findings/";return t.startsWith(r)?t.slice(r.length):t}function kO(e,t){let r=X_(e,{managed:t});if(!r)return null;let n=Is(r.id);return{url:t?r.path:`#${r.fragment}`,label:n?`finding ${n}`:"finding",self:!0}}function $O(e){let t=e.length;for(;t>0&&xO.has(e[t-1]);)t--;return t===e.length?e:e.slice(0,t)}function OE(e,{managed:t=!1}={}){if(typeof e!="string"||e.length===0)return[];let r=[],n=0;bw.lastIndex=0;let o;for(;(o=bw.exec(e))!==null;){let i=$O(o[0]),s=i?vO(i)??kO(i,t):null;s&&(o.index>n&&r.push(e.slice(n,o.index)),r.push(s),n=o.index+i.length,bw.lastIndex=n)}return n<e.length&&r.push(e.slice(n)),r}var tl,mE,ah,ch,vE,wE,_d,kw,kE,mw,QB,tO,iO,sO,aO,lE,lO,gw,cE,uO,fO,hO,mO,gO,bO,yO,uE,wO,bw,xO,pe=w(()=>{"use strict";Ee();hw();ma();tl=!0;mE=new Set(["refuted","unreachable"]);ah=[{value:"confirmed",label:"Confirmed",kinds:["confirmed","partial","revalidation"]},{value:"unreachable",label:"Unreachable",kinds:["unreachable"]},{value:"refuted",label:"Refuted",kinds:["refuted"]}];ch=["","exclude","only"];vE=dh("node_modules"),wE=dh("vendor"),_d="node_modules",kw=dh(_d),kE=yE(_d);mw=new WeakSet;QB=/^(.*(?:^|\/)node_modules\/(?:@[^/]+\/[^/]+|[^/]+))(?:\/|$)/u;tO=/^(?:@[\w.-]+\/)?[\w.-]+@[^/\s@]+$/u;iO=/^https?:\/\/(?:www\.)?github\.com\/([^/\s]+\/[^/\s]+)\/(?:blob|tree|blame)\/[^/\s]+\/(\S+)$/u,sO=/#L(\d+)(?:-L?(\d+))?$/u;aO=/^(?:\s+\S|[-*+] |\d+[.)] |>|#{1,6} |\||`{3}|~{3})/u;lE=/^( *)(`{3,}|~{3,})(.*)$/u,lO=/^[a-z0-9+#._-]{1,20}$/u;gw=/^( *)(?:[-*+]|(\d{1,9})[.)]) +(?=\S)/u,cE=/^ {0,3}([-*_])(?: *\1){2,} *$/u;uO=/^(\d+)(?:\s*-\s*(\d+))?$/u;fO=[["Impact","impact"],["Reproduction","reproduction"],["Recommendation","recommendation"],["Confidence reason","confidenceReason"],["Revalidation verdict","revalidateVerdict"],["Revalidation recommendation","revalidateRecommendation"]];hO=/^[a-zA-Z\d](?:-?[a-zA-Z\d])*$/u,mO=/^[a-zA-Z\d._-]+$/u,gO=/^[1-9]\d{0,9}$/u,bO=/^[a-fA-F\d]{7,40}$/u,yO=/^#[\w-]+$/u,uE=/^GHSA(?:-[0-9a-z]{4}){3}$/u;wO=/^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/u;bw=/https?:\/\/[^\s<>"'`(){}[\]|\\^]+/giu,xO=new Set([")",".",",","!","?",";",":","'",'"',"*","]","}",">"])});var li,Md=w(()=>{li=`.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)}}
106
+ `});var NE,PE=w(()=>{NE=`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)}
107
+ `});function gh({tabs:e,current:t,prefix:r,select:n,disabled:o=!1}){return d`<div class="dlg-tabs" role="tablist" @keydown="${s=>{if(s.key!=="ArrowLeft"&&s.key!=="ArrowRight")return;s.preventDefault();let a=e.findIndex(f=>f.id===t),c=s.key==="ArrowRight"?1:-1,u=e[(a+c+e.length)%e.length];if(!u||u.id===t)return;let p=s.currentTarget;n(u.id),requestAnimationFrame(()=>p.querySelector(`#${r}-tab-${u.id}`)?.focus())}}">${e.map(s=>d`<button type="button" role="tab" class="dlg-tab" id="${`${r}-tab-${s.id}`}" aria-controls="${`${r}-panel-${s.id}`}" aria-selected="${String(t===s.id)}" tabindex="${t===s.id?0:-1}" ?disabled="${o&&t!==s.id}" @click="${()=>n(s.id)}">${s.icon??m}${s.label}</button>`)}</div>`}function ci(e){if(!e)return m;let t=e.replaceAll("_"," ");return d`<span class="${`conflict-sev sev-${e}`}">${t}</span>`}function CO(e){return`bundle-${e.slice(7,19)}\u2026`}function di(e){return e.kind==="bundle"?e.label??CO(e.identifier):e.identifier}function DE(e){return e.kind==="bundle"?"bundle":nh(e.identifier)?"links file":"report"}function bh(e){let t=e.length,r=t===1,n=new Set(e.map(DE)),o="items";if(n.size===1){let i=[...n][0];o=r?i:`${i}s`}return{count:t,singular:r,kindLabel:o}}function yh(e){return d`<ul class="lwd-list">${e.map(t=>{let r=DE(t);return d`<li>${di(t)}${r==="report"?m:d`<span class="lwd-kind-tag">${r}</span>`}</li>`})}</ul>`}function vh(e){return e.length===0?m:d`<ul class="lwd-list" role="alert">${e.map(t=>d`<li><strong>${t.label}</strong> — ${t.reason}</li>`)}</ul>`}var co=w(()=>{"use strict";T();en()});function EO(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 RO(e){return d`<span class="comment-text">${e||d`<em>empty</em>`}</span>`}function MO(e){return e?Fe(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 AO(e){return e?d`<span class="${`triage triage-${e}`}">${e}</span>`:d`<em>none</em>`}function TO(e){return e?d`<span class="${`flag-badge${e==="flagged"?" on":""}`}">${e}</span>`:d`<em>none</em>`}function zE(e,t){return e==="color"?EO(t):e==="comment"?RO(t):e==="fix"?MO(t):e==="triage"?AO(t):e==="flagged"?TO(t):d`${String(t)}`}function IO(e,t){let r=e?.file?e.line?`${e.file}:${e.line}`:e.file:"";return d`<div class="card-head">${ci(e?.severity)} ${r?d`<span class="loc" title="${r}">${r}</span>`:m} <code class="id" title="${t}">${t.slice(0,8)}…</code></div>${e?.description?d`<div class="desc" title="${e.description}">${e.description}</div>`:m}`}function nl(e,t,r={}){return new Promise((n,o)=>{let i=document.createElement("triage-conflict-dialog");i.conflicts=e,i.findingLookup=t,i.labels={...HE,...r},i.addEventListener("resolve",s=>{i.remove(),n(s.detail)}),i.addEventListener("modal-conflict",s=>{i.remove(),o(aa(s.detail?.cause))}),document.body.append(i)})}var HE,UE,LO,_w,Ad=w(()=>{"use strict";T();pe();or();ue();Md();PE();co();HE={title:"Triage conflicts",intro:"disagree with your local triage on",trailingNote:"",applyButton:"Apply",importedSideLabel:"Apply imported"},UE={color:0,comment:1,fix:2,triage:3,flagged:4},LO={color:"Color",comment:"Comment",fix:"Fix",triage:"Triage state",flagged:"Flag"},_w=class extends F{static styles=[...F.styles,A(li),A(NE)];static properties={conflicts:{attribute:!1},findingLookup:{attribute:!1},labels:{attribute:!1},_settled:{state:!0}};constructor(){super(),this.conflicts=[],this.findingLookup=new Map,this.labels={...HE},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}`,i=this.renderRoot.querySelector(`input[name="conflict-${CSS.escape(o)}"]:checked`);i&&(r[o]=i.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)=>(UE[f.property]??99)-(UE[h.property]??99));let n=this.conflicts.filter(p=>p.property==="color").length,o=this.conflicts.filter(p=>p.property==="comment").length,i=this.conflicts.filter(p=>p.property==="fix").length,s=this.conflicts.filter(p=>p.property==="triage").length,a=this.conflicts.filter(p=>p.property==="flagged").length,c=[n?`${n} color${n===1?"":"s"}`:"",o?`${o} comment${o===1?"":"s"}`:"",i?`${i} fix${i===1?"":"es"}`:"",s?`${s} triage state${s===1?"":"s"}`:"",a?`${a} flag${a===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}">${IO(this.findingLookup.get(p),p)}<div class="rows">${f.map(h=>{let g=`${h.id}:${h.property}`,b=`conflict-${g}`;return d`<div class="row" data-key="${g}"><span class="row-label">${LO[h.property]??h.property}</span> <label class="choice"><input type="radio" name="${b}" value="local" required> <span class="choice-label">Keep current</span> <span class="choice-value">${zE(h.property,h.local)}</span></label> <label class="choice"><input type="radio" name="${b}" value="imported" required> <span class="choice-label">${t.importedSideLabel}</span> <span class="choice-value">${zE(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",_w)});function wh(){let e=new Set;if(l.currentWorkspace||!ev())return e;let t=l.currentFile??l.reports[0]?.fileName;if(!t)return e;let r=new Set;for(let n of l.reports)if(n.fileName===t)for(let o of n.groups)for(let i of o)i.id!=null&&r.add(String(i.id));for(let n of r)pr(n).some(o=>!r.has(o)&&gs(o).some(i=>i!==t))&&e.add(n);return e}var Sw=w(()=>{"use strict";D()});function Id(e){return ts(e.model)||null}function Ew(e){let t=In();if(t.filterAnalyzer){let r=e._analyzer??null,n=t.filterAnalyzer===ui?null:t.filterAnalyzer;if(r!==n)return!1}if(t.filterModel){let r=Id(e),n=t.filterModel===pi?null:t.filterModel;if(r!==n)return!1}return!0}function Rw(e){let t=typeof e._repoFallback=="string"&&e._repoFallback?e._repoFallback:null;return e.isApp&&!(e._source??e.source)&&t?t:typeof e.repo?.github=="string"&&e.repo.github?e.repo.github:t}function WE(e){let t=new Set;for(let r of e)for(let n of r)t.add(Rw(n));return t}function ol(){l.filterSeverities=new Set,l.filterColors=new Set,l.filterSources=new Set,l.filterAnalyzer="",l.filterModel="",l.filterRepo="",l.filterConfMin=0,l.filterConfMax=10,l.filterInclude="",l.filterIncludeNegate=!1,l.filterComment="",l.filterFix="",l.filterFlagged="",l.filterDuplicates="",l.filterCrossContext="",l.filterAppStacked="",l.filterSecurity="",l.filterRevalidate="",l.filterPartial="",l.sortBy="severity"}function KE(){let e={};for(let t of FO){let r=l[t];e[t]=r instanceof Set?new Set(r):r}return e}function Ld(e){Mw=e}function Fd(){Mw=null}function In(){return Mw??l}function Td(e){if(e.confidence!==void 0)return e.confidence;if(e.critical===!0||e._source)return 10}function Aw(e){return e.every(t=>t.every(r=>Td(r)!==void 0))&&e.some(t=>t.some(BO))}function GE(e,t,r=fr){return e.some(n=>{let o=["refuted","unreachable"].includes(r(n))?0:Td(n);return o===void 0?t===0:o>=t})}function kh(e,t=Ar){let r=e.map(t).filter(i=>i.length>0);if(!r.some(i=>i.some(s=>Td(s)!==void 0)))return 0;let n=i=>r.reduce((s,a)=>s+(a.some(c=>(Td(c)??-1)>=i)?1:0),0),o;for(n(6)<=25?o=6:n(7)<=25?o=7:o=8;o>0&&n(o-1)===n(o);)o--;return o}function qE(e){return fr(e)||(e._source&&!e._sourcePass?"revalidation":"")}function YE(e){let t=Cd("confirmed","");return e.some(r=>t.includes(qE(r)))}function XE(e,t){return Aw(e)?t:0}function JE(e,t=Ar,r=fr){let n=new Set(e.ruledOutIds??[]);for(let o of e)for(let i of o)["refuted","unreachable"].includes(r(i))&&n.add(W(i));for(let o of e){let i=t(o);if(i.length!==0&&i.some(s=>Cd("confirmed","").includes(r(s)||(s._source&&!s._sourcePass?"revalidation":"")))){for(let s of o)if(n.add(W(s)),s.isApp&&Array.isArray(s.revalidateInputs))for(let a of s.revalidateInputs)a&&n.add(a)}}return n}function ZE(e,t,r,n=fr){let o=XE(e,t),i=e.filter(a=>GE(a,o,n));if(i.length===0)return!1;let s=new Set(Cd("confirmed",""));return e.some(a=>a.some(c=>s.has(n(c))))?i.every(a=>a.every(c=>r.has(W(c)))):!1}function Tw(e,t){let r=e.map(Ar).filter(n=>n.length>0);return ZE(r,t,JE(e))?"confirmed":""}function xh(e){return l.showRevalidation===!1||l.upstreamOnly||po()?!1:Iw(e)}function Iw(e,{tabs:t=Ar,kindOf:r=fr,severityMode:n=l.severityMode}={}){let o=e.map(t).filter(a=>a.length>0),i=JE(e,t,r);if(!ZE(o,kh(e,t),i,r))return!1;let s=XE(o,6);return o.every(a=>!GE(a,s,r)||!a.some(c=>ce(c,n)!=="low")||a.every(c=>i.has(W(c))))}function Fs(e,{resetSort:t=!0}={}){l.filterConfMin=kh(e),l.filterConfMax=10,l.filterRevalidate=Tw(e,l.filterConfMin),l.filterPartial="",t&&(l.sortBy=Lw(e)?"priority-desc":"severity")}function Lw(e){return!Array.isArray(e)||e.length===0?!1:e.every(t=>{if(QE(t)===void 0)return!1;let r=t.filter(o=>o.isApp);if(r.length===0)return!0;let n=t.some(o=>o.priority!==void 0);return r.some(o=>o.priority!==void 0||!n&&As(o))})}function QE(e){let t=e.find(r=>r.priority!==void 0);return t?t.priority:e.some(As)?0:void 0}function e6(e){let t=In();if(t.filterSources.size===1){let r=t.filterSources.has("own");if(r&&Qt(e.file)||!r&&!Qt(e.file))return!1}if(t.filterRevalidate){let r=Cd(t.filterRevalidate,t.filterPartial);if(r&&!r.includes(qE(e)))return!1}if(!t.filterRevalidate){let r=gE(e)?0:Td(e);if(r===void 0){if(t.filterConfMin>0)return!1}else if(r<t.filterConfMin||t.filterConfMax<10&&r>t.filterConfMax)return!1}return!0}function OO(e){if(!e6(e))return!1;let t=In(),r=t.filterInclude.toLowerCase();if(t.filterSeverities.size>0&&!t.filterSeverities.has(ce(e,l.severityMode)))return!1;if(t.filterColors.size>0){let n=xe(e)?.color??"none";if(!t.filterColors.has(n))return!1}if(!Ew(e))return!1;if(t.filterRepo){let n=Rw(e),o=t.filterRepo===Ls?null:t.filterRepo;if(n!==o)return!1}if(r){let n=xe(e),o=$E(e).includes(r)||(n?.comment??"").toLowerCase().includes(r)||(n?.fix??"").toLowerCase().includes(r);return t.filterIncludeNegate?!o:o}return!0}function PO(e){let t=In();if(!t.filterComment&&!t.filterFix&&!t.filterFlagged)return!0;let r=n=>e.some(o=>n(xe(o)));if(t.filterComment){let n=r(o=>!!o?.comment);if(t.filterComment==="with"?!n:n)return!1}if(t.filterFix){let n=r(o=>!!o?.fix);if(t.filterFix==="with"?!n:n)return!1}if(t.filterFlagged){let n=r(o=>o?.flagged===!0);if(t.filterFlagged==="with"?!n:n)return!1}return!0}function NO(e){let t=e?.package?.npm;if(typeof t?.name=="string"&&t.name&&!Uo(t))return t.name;let r=typeof e?.file=="string"?e.file:"";return/(?:^|\/)(?:node_modules|dependencies|vendor)\/(@[^/]+\/[^/]+|[^/]+)(?:\/|$)/u.exec(r)?.[1]??null}function t6(){return l.showRevalidation!==!1&&!l.upstreamOnly}function Fw(e){if(t6())return!1;let t=Ar(e);if(t.length<2)return!1;let r=new Set,n=new Set;for(let o of t){let i=Rw(o);i&&r.add(i);let s=NO(o);s&&n.add(s)}return r.size>1||n.size>1}function Bw(e){if(!t6()||Ar(e).length===0)return!1;let r=e.filter(n=>n.isApp);return r.length>0&&r.length>1}function Cw(e){return e.some(t=>t.isSecurity===!0)}function r6(e){return e.some(Cw)&&e.some(t=>!Cw(t))}function n6(e){return e.filter(t=>t.some(e6)).map(Ar)}function fi(e){let t=!l.currentWorkspace&&In().filterDuplicates,r=t?wh():null,n=In().filterCrossContext,o=In().filterAppStacked,i=In().filterSecurity;return e.filter(s=>s.some(OO)&&PO(s)&&(!t||t==="with"===s.some(a=>r.has(W(a))))&&(!n||n==="with"===Fw(s))&&(!o||o==="with"===Bw(s))&&(!i||i==="with"===Cw(s)))}function jE(e,t){let r=t==="desc"?-1:11;return(n,o)=>{let i=n[e]??r,s=o[e]??r;return(t==="desc"?s-i:i-s)||n.file.localeCompare(o.file)}}function o6(e){let t=e==="desc"?-1:11;return(r,n)=>{let o=r.confidence===void 0&&r.critical===!0,i=n.confidence===void 0&&n.critical===!0,s=r.confidence??(o?10:t),a=n.confidence??(i?10:t);return(e==="desc"?a-s:s-a)||(o===i?0:o?-1:1)||r.file.localeCompare(n.file)}}function $h(e){let t=DO[l.sortBy];if(!t)return[...e];if(l.sortBy==="priority-desc"||l.sortBy==="priority-asc"){let r=l.sortBy==="priority-desc"?"desc":"asc",n=r==="desc"?-1:11;return e.map(o=>({p:QE(o),g:o})).toSorted((o,i)=>{let s=o.p??n,a=i.p??n;return(r==="desc"?a-s:s-a)||uo(o.g).file.localeCompare(uo(i.g).file)}).map(o=>o.g)}return e.map(r=>({p:uo(r),g:r})).toSorted((r,n)=>t(r.p,n.p)).map(r=>r.g)}var ui,Ls,pi,FO,Mw,BO,VE,DO,tn=w(()=>{"use strict";D();pe();ct();Sw();ui="\0",Ls="",pi="";FO=["filterSeverities","filterColors","filterSources","filterAnalyzer","filterModel","filterRepo","filterConfMin","filterConfMax","filterInclude","filterIncludeNegate","filterComment","filterFix","filterFlagged","filterDuplicates","filterCrossContext","filterAppStacked","filterSecurity","filterRevalidate","filterPartial"];Mw=null;BO=e=>e.confidence!==void 0||e.critical===!0;VE=o6("desc"),DO={severity:(e,t)=>(je[ce(t,l.severityMode)]||0)-(je[ce(e,l.severityMode)]||0)||VE(e,t)||parseInt(e.line,10)-parseInt(t.line,10),"confidence-desc":VE,"confidence-asc":o6("asc"),"priority-desc":jE("priority","desc"),"priority-asc":jE("priority","asc")}});function i6(e){return Object.fromEntries(Object.entries(e).filter(([t,r])=>t.startsWith("revalidate")&&r!=null))}function s6(e,t,r){let n=i6(t);if(!e._revalidationCopies){let o=i6(e);if(Object.keys(o).length===0&&Object.keys(n).length===0)return[];e._revalidationCopies=Object.keys(o).length>0?[{reportName:e._reportName??"",fields:o}]:[]}return Object.keys(n).length>0&&e._revalidationCopies.push({reportName:r,fields:n}),e._revalidationCopies}function a6(e){let t=new Map,r=new Set(es);for(let{reportName:n,fields:o}of e)for(let[i,s]of Object.entries(o)){if(s==null)continue;let a=i==="revalidate"?Te(o)||String(s).trim().toLowerCase():String(s).trim();if(i==="revalidate"&&!a||i==="revalidate"&&!r.has(a))continue;t.has(i)||t.set(i,new Map);let c=t.get(i);c.has(a)||c.set(a,new Set),c.get(a).add(n)}return[...t].filter(([,n])=>n.size>1).map(([n,o])=>({field:n,variants:[...o].map(([i,s])=>({value:i,reports:[...s]}))}))}var Ow=w(()=>{"use strict";Ee()});function l6(e,t){if(!e||!t||e===t)return!1;let r=!1;for(let[n,o]of Object.entries(t)){if(n.startsWith("_")||zO.has(n)||o==null)continue;if(n==="revalidate"){let s=Te(t);if(!s)continue;let a=Te(e);a?a!==s&&(r=!0):e[n]=o;continue}let i=e[n];if(i==null){e[n]=o;continue}n.startsWith("revalidate")&&String(i).trim()!==String(o).trim()&&(r=!0)}return r}function Pw(e,t,r,n){if(!e||!t||e===t)return;(e.correctedSeverity||t.correctedSeverity)&&(e._correctedByReport??={[e._reportName??""]:{severity:wn(e),reason:e.correctedSeverityReason}},e._correctedByReport[r]={severity:wn(t),reason:t.correctedSeverityReason});let o=s6(e,t,r);(l6(e,t)||n.has(e.id))&&n.set(e.id,{finding:e,copies:o})}var zO,Nw=w(()=>{"use strict";Ee();Ow();pe();zO=new Set(["correctedSeverity","correctedSeverityReason","isApp","isUpstream","isSecurity","source"])});function Bd(e,t=null){let r=t??e.filter(p=>p.isApp),n=e.filter(p=>!p.isApp);if(r.length===0||n.length===0)return[e];if(t&&e.some(p=>p.isApp))return[e];if(n.some(p=>typeof p.id!="string"||!p.id))return[e];let o=new Set(n.map(p=>p.id)),i=new Map,s=new Set;for(let p of r){let f=p.revalidateInputs===void 0?[]:p.revalidateInputs;if(!Array.isArray(f))return[e];for(let h of f){if(!o.has(h))return[e];s.add(h)}i.set(p,f)}if(s.size!==o.size)return[e];let a=new Map([...o].map(p=>[p,p])),c=p=>{let f=p;for(;a.get(f)!==f;)f=a.get(f);for(;a.get(p)!==f;){let h=a.get(p);a.set(p,f),p=h}return f};for(let p of i.values()){if(p.length===0)continue;let f=c(p[0]);for(let h of p)a.set(c(h),f)}let u=new Map;for(let p of e){let f=i.get(p),h=f?f.length>0?c(f[0]):p:c(p.id);u.has(h)||u.set(h,[]),u.get(h).push(p)}return u.size===1?[e]:[...u.values()]}var Dw=w(()=>{"use strict"});function _h(e,{showRevalidation:t=!0,upstreamOnly:r=!1,hideRuledOut:n=!1,merges:o=[]}={}){let i=[],s=new Set;for(let y=0;y<e.length;y++){let k=e[y];for(let v of k.groups){for(let C of v)C.id&&["refuted","unreachable"].includes(Te(C))&&s.add(C.id);let x=r?v.filter(C=>C.isUpstream&&Te(C)!=="revalidation").map(c6):t?n?v.filter(C=>!["refuted","unreachable"].includes(Te(C))):v:v.filter(C=>Te(C)!=="revalidation").map(c6),$=x.length===v.length&&x.every((C,I)=>C===v[I])?v:x;$.length>0&&i.push({group:$,sourceGroup:v,reportIndex:y,reportName:k.fileName??"",hasApp:$.some(C=>C.isApp)})}}let a=i.map((y,k)=>k),c=i.map(y=>y.hasApp),u=y=>{let k=y;for(;a[k]!==k;)k=a[k];for(;a[y]!==k;){let v=a[y];a[y]=k,y=v}return k},p=(y,k)=>{y=u(y),k=u(k),y!==k&&(a[k]=y,c[y]||=c[k])},f=new Map;for(let y=0;y<i.length;y++)for(let k of i[y].group)k.id&&(f.has(k.id)||f.set(k.id,[]),f.get(k.id).push({index:y,app:k.isApp}));for(let y of f.values()){let k=new Map,v=y.find(x=>x.app);for(let{index:x}of y){v&&p(v.index,x);let $=i[x].reportIndex;k.has($)?p(k.get($),x):k.set($,x)}}for(let y of f.values()){let k=null;for(let{index:v}of y)c[u(v)]||(k===null?k=v:p(k,v))}for(let y of o){let k=null;for(let v of y)for(let{index:x}of f.get(v)??[])k===null?k=x:p(k,x)}let h=new Map;for(let y=0;y<i.length;y++){let k=u(y);h.has(k)||h.set(k,[]),h.get(k).push(i[y])}let g=new Map,b=[];for(let y of h.values()){let k=y[0].group,v=k.map(R=>R.id).filter(Boolean);if(y.length===1&&new Set(v).size===v.length&&o.length===0){let R=e.length>1&&k.find(z=>z.isApp);if(R){let z=[...k];z.workspaceKey=R.id??String(R._id),b.push(...zw(y,z,t,r))}else b.push(...zw(y,k,t,r));continue}let x=new Map,$=new Map,C=[];for(let{group:R,reportName:z}of y)for(let U of R)if(U.id&&$.has(U.id))Pw($.get(U.id),U,z,x);else{let B={...U,_reportName:U._reportName??z};U.id&&$.set(U.id,B),C.push(B)}let I=new Set;for(let R of o)for(let z of R)$.has(z)&&I.add(z);for(let{group:R}of y)if(R.length>1)for(let z of R)z.id&&I.add(z.id);let E=[...I].map(R=>$.get(R));for(let R of C)I.has(R.id)||E.push(R);if(e.length>1){let R=E.find(z=>z.isApp);R&&(E.workspaceKey=R.id??String(R._id))}b.push(...zw(y,E,t,r));for(let[R,z]of x){let U=g.get(R);g.set(R,U?{finding:U.finding,copies:[...U.copies,...z.copies]}:z)}}return Object.defineProperty(b,"ruledOutIds",{value:s,configurable:!0}),{groups:b,conflicts:g}}function zw(e,t,r,n){if(r)return[t];if(n){let i=e.flatMap(p=>p.sourceGroup),s=Bd(i);if(s.length===1)return[t];let a=[],c=new Set;for(let p of s){let f=new Set(p.filter(g=>!g.isApp&&g.id).map(g=>g.id)),h=t.filter(g=>f.has(g.id));if(h.length>0){a.push(h);for(let g of h)c.add(g.id)}}let u=new Set(t.map(p=>p.id).filter(Boolean));return c.size===u.size?a:[t]}let o=e.flatMap(i=>i.sourceGroup.filter(s=>s.isApp));return Bd(t,o)}function c6(e){let t=Object.keys(e).filter(n=>n.startsWith("revalidate")||n==="_revalidationCopies");if(t.length===0)return e;let r={...e};for(let n of t)delete r[n];return r}var Uw=w(()=>{"use strict";Ee();Nw();Dw()});function mr(){return l.currentView==="links"&&Bs?.owner===l.currentLinks?Bs:null}function Sh(){Hw++,Bs=null}async function d6(e,t,r,n){if(l.currentView!=="links"||!l.currentLinks)return;let o=Wi(l.currentLinks),i=++Hw;Bs={owner:o,id:e,reportName:t,group:null,error:""},l.focusCodeStack=[],l.focusCodeAt=0;let s=()=>i===Hw&&l.currentView==="links"&&l.currentLinks===o;try{if(_()){let g=Go([e]).find(b=>b.report===t&&(!n||b.managedReportId===n)&&(r==null||b.index===Number(r)));if(!g)throw new Error("This finding is no longer in the team.");Bs={owner:o,id:e,reportName:t,group:g.members.map(b=>({...b})),error:""},l.activeTabByGroup.set(g.members[0].id,e);return}let a=await Xt(await ze(t));if(!s())return;let c=(Bt(a?.data)??[]).map(g=>Array.isArray(g)?g:[g]),u=g=>g?.some(b=>String(b?.id)===e),p=u(c[r])?c[r]:c.find(u);if(!p)throw new Error("This finding is no longer in the report.");let{data:f}=a,h=p.filter(g=>g?.id).map(g=>{let b={...g,_reportName:t,_repoFallback:qr(f)??It(t),_repoDirectory:as(f?.repo),_bundleHashes:f.bundleHashes??[],_source:g.source??f.source??null};return eo(b,f),b._analyzer=b._source??b.type??null,"isApp"in b||(b.isApp=Gr(b,b._source)),b});await Promise.all([ks(),$t("report",t),...rd(t).map(g=>$t("workspace",g.id))]),s()&&(to([h],{linkedIds:pr,knownRows:g=>[...Go(g),...l.reports.flatMap(b=>b.groups??[]).filter(b=>b.some(y=>g.includes(y.id))).map(b=>({members:b}))]}),Bs.group=h,l.activeTabByGroup.set(h[0].id,e))}catch(a){s()&&(Bs.error=a.message||"Unable to load this finding.")}}var Bs,Hw,Ch=w(()=>{"use strict";D();rc();Ee();Bs=null,Hw=0});function Eh(e,t,r,n=r){let o=e.map((f,h)=>h),i=f=>{for(;o[f]!==f;)o[f]=o[o[f]],f=o[f];return f},s=e.map(r),a=new Map;for(let f=0;f<s.length;f++)for(let h of s[f])h.id&&(a.has(h.id)||a.set(h.id,[]),a.get(h.id).push(f));for(let[f,h]of a)for(let g of t(f))if(g!==f)for(let b of h)for(let y of a.get(g)??[]){let k=i(b),v=i(y);k!==v&&(o[v]=k)}let c=new Map;for(let f=0;f<e.length;f++){let h=i(f);c.has(h)||c.set(h,[]),c.get(h).push(f)}if(c.size===e.length)return e;let u=f=>f.id??String(f._id),p=[...c.values()].map(f=>{if(f.length===1)return e[f[0]];let h=new Map;for(let k of f)for(let v of n(e[k]))h.has(u(v))||h.set(u(v),v);let g=new Map;for(let k of f)for(let v of e[k])g.has(u(v))||g.set(u(v),h.get(u(v))??v);let b=[...g.values()],y=e[f[0]];return b.workspaceKey=y.workspaceKey??u(y[0]),b.linkedTabs=[...h.values()],b});return Object.defineProperty(p,"ruledOutIds",{value:e.ruledOutIds,configurable:!0}),p}var jw=w(()=>{"use strict"});function W(e){return e.id??String(e._id)}function de(e){return e.workspaceKey??W(e[0])}function Vw(e){return Array.isArray(e)?e:[e]}function po(){return l.revalidationDetailed===!0}function Ww(e){return e?._reportName??""}function UO(){let e=l.reports;return!Array.isArray(e)||e.length===0?!0:(e!==u6&&(u6=e,p6=sh(e)),p6)}function Oe(e){return!e.isUpstream||l.showRevalidation===!1||l.upstreamOnly===!0||!UO()}function xe(e){if(!Oe(e))return;let t=l.triage.get(W(e));if(!_())return t;let r=l.managedComments?.get(e.id)??[];return r.length===0&&!t?.comment?t:{...t,comment:r.map(n=>n.authorLogin?`${n.authorLogin}: ${n.body}`:n.body).join(`
108
+
109
+ `)}}function Kw(e){return Oe(e)&&no(l.triage,W(e),Ww(e))}function Od(e,t=xe(e)){if(Oe(e))return t?.triage??(Kw(e)?"ignored":void 0)}function Ar(e){return mr()?.group===e?e:e.linkedTabs?e.linkedTabs:po()?e:f6(e)}function f6(e){return e.length<=1||!e.some(Sd)?e:e.filter(Sd)}function Ln(e){let t=Ar(e);return t.length<=1?t:[...t].toSorted((r,n)=>{let o=Sd(r)?1:0,i=Sd(n)?1:0;if(o!==i)return i-o;let s=xe(r)?.color?1:0,a=xe(n)?.color?1:0;if(s!==a)return a-s;let c=je[ce(r,l.severityMode)]||0,u=je[ce(n,l.severityMode)]||0;if(c!==u)return u-c;let p=r.confidence??-1;return(n.confidence??-1)-p})}function uo(e){return e.length===1?e[0]:Ln(e)[0]}function h6(e){let t=[],r=[];for(let n of e)(n.isApp?t:r).push(n);return{app:t,source:r}}function HO(e){let t=xe(e);return!!t?.comment||!!t?.fix||t?.flagged===!0}function rt(e){if(e.length===1)return e[0];let t=Ln(e);if(t.length===1)return t[0];let r=l.activeTabByGroup.get(de(e));if(r){let o=t.find(i=>W(i)===r);if(o)return o}let n=t;if(l.filterAnalyzer||l.filterModel){let o=t.filter(Ew);o.length>0&&(n=o)}return n.find(HO)??n[0]}function m6(e){return e?._repoFallback||l.repoUrl||""}function Tr(e){return{github:m6(e),directory:e?._repoDirectory??""}}function Rh(e){for(let t of _n().values())if(t.files.has(e.file))return t.repos?.size===1?[...t.repos][0]:null;return e.repo?.github||m6(e)||null}function il(e){if(!Array.isArray(e))return[];let t=e.filter(r=>!r.isUpstream);return t.length===0||t.length===e.length?e:t}function Ve(e){let t=il(e),r=0,n=!1,o,i=!1,s=!1,a,c=!1,u=null,p=!1,f=!0;for(let k of t){let v=xe(k),x=Od(k,v),$=v?.color;$===void 0&&x===void 0||(r++,$!==void 0&&(i?$!==o&&(n=!0):(i=!0,o=$)),c?x!==a&&(s=!0):(c=!0,a=x),x?(u===null&&(u=x),x==="ignored"?f=!1:p=!0):f=!1)}let h=n||s,g=!h&&i?o:null,b=r>0&&f,y=!h&&u!==null?u:null;return{hasConflict:h,commonColor:g,anyTriage:p,allTriaged:b,commonTriage:y,allIgnored:y==="ignored"&&r===t.length,isInProgress:y==="inprogress",isFixed:y==="fixed",isInvalid:y==="invalid",isDeleted:y==="deleted",isIgnored:y==="ignored"}}function g6(e,t){if(!Array.isArray(e)||e.length<2)return!1;let r=e.filter(Oe);if(r.length<2)return!1;let n=(t??"").trim();return r.every(o=>Gw(o,n))}function Gw(e,t){if(!Oe(e))return!1;let r=(xe(e)?.fix??"").trim();return r===""||r===(t??"").trim()}function b6(e,t){if(!Oe(rt(e)))return{targets:[],clearing:!1};let r=Ve(e);return{targets:hi(e,r),clearing:t==="restore"||qw(e,r)===t}}function hi(e,t=Ve(e)){let r=il(e),n=e.linkedTabs||r!==e&&e.some(o=>o.isApp)?r:t.hasConflict?[rt(e)]:r;return n.every(Oe)?n:n.filter(Oe)}function qw(e,t=Ve(e),r=null){return e.linkedTabs||e.some(n=>n.isApp)&&il(e)!==e||!t.hasConflict?t.commonTriage??null:Od(r??rt(e))??null}function Mh(e){let t=il(e);if(t.length<2)return!1;let n=Ve(e).commonTriage;if(!n||n==="ignored")return!1;let o=!1;for(let i of t){if(!Oe(i))continue;let s=W(i),a=l.triage.get(s);Od(i,a)!==n&&(a?.ignoredReports?.length||Z(l.triage,s,{triage:n})&&(o=!0))}return o}function mi(){gr=null}function Ah(e,t=!1,r=!1){let n=l.reports,o=l.workspaceMerges,i=_();(!gr||gr.reports.length!==n.length||gr.reports.some((a,c)=>a!==n[c])||gr.merges!==o||gr.mergeCount!==o.length||gr.securityLinksTick!==l.linksTick||gr.findingIndexTick!==l.findingIndexTick||gr.managed!==i)&&(to(n.flatMap(a=>a.groups??[]),{linkedIds:pr,knownRows:Go}),gr={reports:[...n],merges:o,mergeCount:o.length,managed:i,securityLinksTick:l.linksTick,findingIndexTick:l.findingIndexTick});let s=t?"upstream":e?r?"workspace-app":"app":"code";return gr[s]||(gr[s]=_h(n,{showRevalidation:e&&!t,upstreamOnly:t,hideRuledOut:r,merges:o})),gr[s]}function y6(){return Ah(l.showRevalidation!==!1).groups}function Yw(){return Ah(!0).groups}function v6(){return Ah(!0,!1,!!l.currentWorkspace).conflicts}function br(){let e=Ah(l.showRevalidation!==!1,l.upstreamOnly===!0,!!l.currentWorkspace),t=e.groups;if(l.showRevalidation===!1||l.upstreamOnly)return t;if(l.currentWorkspace){let r=po();return(!e.linkedGroups||e.linksTick!==l.linksTick||e.linkedDetailed!==r)&&(e.linkedGroups=Eh(t,pr,f6,Ar),e.linksTick=l.linksTick,e.linkedDetailed=r),e.linkedGroups}return po()?t:e.visibleGroups??=(()=>{let r=t.flatMap(n=>{let o=n.filter(i=>!As(i));return o.length===n.length?[n]:o.length===0?[]:(o.workspaceKey=de(n),[o])});return Object.defineProperty(r,"ruledOutIds",{value:t.ruledOutIds,configurable:!0}),r})()}function Fn(){let e=br();if(l.viewMode==="kanban")return e;let t=e.filter(r=>Ve(r).commonTriage===l.shownTriage);return Object.defineProperty(t,"ruledOutIds",{value:e.ruledOutIds,configurable:!0}),t}function w6(e){if(l.showRevalidation||l.upstreamOnly||!Array.isArray(e)||e.length===0)return e;let t=new Set(e.map(W)),r=new Map;for(let n of Yw())for(let o of Bd(n))if(o.some(i=>t.has(W(i))))for(let i of o)r.set(W(i),i);return r.size===e.length&&e.every(n=>r.get(W(n))===n)?e:r.size>0?[...r.values()]:e}function yr(e){let t=mr()?.group;if(t&&de(t)===e)return t;for(let r of br())if(de(r)===e)return r;return null}var u6,p6,gr,ct=w(()=>{"use strict";D();Ee();pe();tn();Uw();Ch();jw();Dw();Nw();u6=null,p6=!0;gr=null});function k6(e){return e==null?"(none)":Jw[e]??e}function x6(e){return e??"(no model)"}var Jw,Xw,Zw=w(()=>{"use strict";T();Ne();Ce();D();tn();Ee();Jw=yt;Xw=class extends G{static properties={analyzers:{attribute:!1},models:{attribute:!1},groups:{attribute:!1},_open:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.analyzers=[],this.models=[],this.groups=[],this._open=!1}render(){let t=this.analyzers.length>1,r=this.models.length>1;if(!t&&!r)return m;let n=l.filterAnalyzer===""?void 0:l.filterAnalyzer===ui?null:l.filterAnalyzer,o=l.filterModel===""?void 0:l.filterModel===pi?null:l.filterModel,i=new Map,s=new Map;for(let f of this.groups){let h=new Set,g=new Set;for(let b of f){let y=b._analyzer??null,k=Id(b);(o===void 0||k===o)&&h.add(y),(n===void 0||y===n)&&g.add(k)}for(let b of h)i.set(b,(i.get(b)??0)+1);for(let b of g)s.set(b,(s.get(b)??0)+1)}let a=n===void 0?null:k6(n),c=o===void 0?null:x6(o),u=a!=null&&c!=null?`${a} \xB7 ${c}`:a??c??(t?"All analyzers":"All models"),p=a!=null||c!=null;return d`<button type="button" class="${N({"analyzer-btn":!0,active:p})}" popovertarget="analyzer-select-menu" popovertargetaction="toggle" 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:ui,labelOf:k6,counts:i,current:l.filterAnalyzer}):m} ${t&&r?d`<div class="analyzer-menu-sep"></div>`:m} ${r?this._column({dim:"model",heading:"Model",allLabel:"All models",values:this.models,sentinel:pi,labelOf:x6,counts:s,current:l.filterModel}):m}</div>`}_column({dim:t,heading:r,allLabel:n,values:o,sentinel:i,labelOf:s,counts:a,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="${N({"analyzer-menu-item":!0,active:c===""})}" @click="${()=>this._pick(t,"")}"><span class="analyzer-menu-label">${n}</span></button> ${o.map(u=>{let p=u??i,f=a.get(u)??0,h=c===p;return d`<button type="button" aria-pressed="${String(h)}" class="${N({"analyzer-menu-item":!0,active:h,zero:f===0})}" @click="${()=>this._pick(t,p)}"><span class="analyzer-menu-label">${s(u)}</span><span class="analyzer-menu-count">${f}</span></button>`})}</div>`}_pick(t,r){let n=t==="analyzer"?l.filterAnalyzer:l.filterModel,o=r!==""&&n===r?"":r;this.dispatchEvent(new CustomEvent("analyzer-change",{detail:{analyzer:t==="analyzer"?o:l.filterAnalyzer,model:t==="model"?o:l.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,i=t.offsetHeight||200,s=4,a=n.left;a+o>window.innerWidth-4&&(a=window.innerWidth-o-4),a<4&&(a=4);let c=n.bottom+s;c+i>window.innerHeight-4&&n.top>i+s&&(c=n.top-i-s),t.style.top=`${c}px`,t.style.left=`${a}px`}updated(){this._open&&this.querySelector(".analyzer-menu")?.matches(":popover-open")&&this._position()}};customElements.define("analyzer-select",Xw)});function Qw(e,t){if(t==null)return e.length+1;let r=e.indexOf(t);return r===-1?e.length:r}function KO(e,t,r){for(let n of r){let o=WO[n],i=o(e[n])-o(t[n]);if(i!==0)return i;let s=String(e[n]??"").localeCompare(String(t[n]??""));if(s!==0)return s}return 0}function _6(e,t,{typePrefix:r=!0}={}){return e==="type"?r?`analyzer: ${t??"null"}`:`${t??"null"}`:t??null}function GO(e,t){let r=t.filter(i=>i!=="exportsMode"),n=[],o=new Map;for(let i of e){if(i.exportsMode==null){n.push({...i});continue}let s=r.map(u=>i[u]??"").join("|"),a=o.get(s);if(a){a.exportsMode=`${a.exportsMode}+${i.exportsMode}`;continue}let c={...i};o.set(s,c),n.push(c)}return n}function S6(e,t=Th){let r=new Map;for(let h of e){let g={};for(let y of t)g[y]=y==="model"?ts(h.model)??null:h[y]??null;let b=t.map(y=>g[y]??"").join("|");r.has(b)||r.set(b,g)}let n=[...r.values()].toSorted((h,g)=>KO(h,g,t));if(n.length===0)return[];let o={};for(let h of t)o[h]=new Set(n.map(g=>g[h])).size===1;let i=t.filter(h=>!o[h]),s=i.includes("exportsMode")?GO(n,t):n,a=s.length>2&&i.includes("type")&&i.length>1,c=["model","effort"].filter(h=>t.includes(h)&&o[h]),u=[...c,...t.filter(h=>!c.includes(h))],p=[],f=!1;for(let h of u)if(o[h]){let g=_6(h,s[0][h]);g!=null&&p.push(g)}else if(!f){for(let g of s){let b=i.map(y=>_6(y,g[y],{typePrefix:!a})).filter(y=>y!=null);b.length>0&&p.push(b.join(" \xB7 "))}f=!0}return p}var Th,$6,jO,VO,WO,C6=w(()=>{"use strict";pe();Th=["type","model","effort","exportsMode"],$6=["security","correctness"],jO=["max","xhigh","high","medium","low","minimal"],VO=["list","isolate"];WO={type:e=>e==="terminal"?$6.length+2:Qw($6,e),model:e=>e==null?1:0,effort:e=>Qw(jO,e),exportsMode:e=>Qw(VO,e)}});function rn(e){if(typeof e!="string")return null;let t=e.slice(e.lastIndexOf("/")+1),r=t.lastIndexOf(".");return r<=0?null:qO[t.slice(r+1).toLowerCase()]??null}var qO,e0=w(()=>{"use strict";qO={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",rb:"ruby",java:"java",cpp:"cpp",cc:"cpp",cxx:"cpp","c++":"cpp",hpp:"cpp",hh:"cpp",hxx:"cpp","h++":"cpp",h:"cpp",c:"c",m:"objectivec",mm:"objectivec"}});function YO(){return Ih||(Ih=(async()=>await import("./prism.js"))(),Ih)}function E6(e){return typeof e!="string"?null:XO[e.toLowerCase()]??null}async function Ir(e,t){if(!t)return null;try{return(await YO()).highlight(e,t)}catch{return null}}function R6(e){let t=[],r=[],n="",o=0;for(;o<e.length;){let i=e.indexOf("<",o),a=(i===-1?e.slice(o):e.slice(o,i)).split(`
110
+ `);n+=a[0];for(let p=1;p<a.length;p++){for(let f=r.length-1;f>=0;f--)n+=r[f].close;t.push(n),n=r.map(f=>f.open).join("")+a[p]}if(i===-1)break;let c=e.indexOf(">",i);if(c===-1){n+=e.slice(i);break}let u=e.slice(i,c+1);u.startsWith("</")?r.pop():r.push({open:u,close:`</${/^<([a-zA-Z][^\s/>]*)/u.exec(u)?.[1]??"span"}>`}),n+=u,o=c+1}return t.push(n),t}var Ih,XO,Os=w(()=>{"use strict";e0();Ih=null;XO={__proto__:null,js:"javascript",javascript:"javascript",mjs:"javascript",cjs:"javascript",node:"javascript",jsx:"jsx",ts:"typescript",typescript:"typescript",mts:"typescript",cts:"typescript",tsx:"tsx",json:"json",css:"css",html:"markup",htm:"markup",xml:"markup",svg:"markup",markup:"markup",yaml:"yaml",yml:"yaml",sh:"bash",bash:"bash",shell:"bash",zsh:"bash",console:"bash",md:"markdown",markdown:"markdown",sol:"solidity",solidity:"solidity",rs:"rust",rust:"rust",rb:"ruby",ruby:"ruby",php:"php",phtml:"php",java:"java",cpp:"cpp","c++":"cpp",cc:"cpp",cxx:"cpp",hpp:"cpp",hh:"cpp",hxx:"cpp","h++":"cpp",h:"cpp",c:"c",objc:"objectivec",objectivec:"objectivec","objective-c":"objectivec",m:"objectivec",mm:"objectivec"}});function JO(){n0||(n0=!0,queueMicrotask(()=>{n0=!1,l.codeBlockTick++,S()}))}function o0(e,t){let r=E6(t);if(!r||!e)return null;let n=`${r}\0${e}`;return t0.has(n)?t0.get(n):(r0.has(n)||(r0.add(n),(async()=>{let o=await Ir(e,r);t0.set(n,o??null),r0.delete(n),JO()})()),null)}var t0,r0,n0,M6=w(()=>{"use strict";D();Os();zt();t0=new Map,r0=new Set,n0=!1});function rP(e,t,r){if(e===t)return e;let n=i0(e),o=i0(t);if(n!==o&&A6(e)===A6(t))return n?t:e;throw new Error(`format conflict for '${r}' ('${t}' vs '${e}')`)}function sl(e,t){return t===""?e:e==="."?t:`${e}/${t}`}function F6(e,{scope:t="full"}={}){let r=new Set;for(let[n,{files:o}]of e)if(!(t!=="full"&&!cl(n)))for(let i of Object.keys(o))r.add(sl(n,i));return r}function nP(e,{what:t,files:r,formats:n,scope:o}){if(Lr(e))return"escapes the root";if(o!=="full"&&!cl(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 i=n.get(e);return i==="directory"?"is a directory capture, not a file":i0(i)?`is a payload-free '${i}' record, not a file`:null}function B6(e,{what:t,files:r,formats:n,scope:o}){for(let i of e){let s=nP(i,{what:t,files:r,formats:n,scope:o});te(s===null,`${t}: executable entry '${i}' ${s}`)}}function O6(e,{what:t,files:r,formats:n,scope:o="full"}){if(e===void 0)return new Set;let i=`${t}: executable`;te(Array.isArray(e),`${i} must be an array of file paths`);let s=new Set;for(let a of e)te(typeof a=="string"&&a!=="",`${i} entry must be a non-empty string`),te(!s.has(a),`${i} entry '${a}' is listed twice`),s.add(a);return B6(s,{what:t,files:r,formats:n,scope:o}),s}function P6(e,{what:t,modules:r,formats:n,scope:o}){if(e.size!==0)return B6(e,{what:t,files:F6(r,{scope:o}),formats:n,scope:o}),Lh(e)}function te(e,t){if(!e)throw new Error(t)}function al(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,i]=[r,n].map(s=>s.join(String.fromCodePoint(0)));if(o<i)return-1;if(o>i)return 1;throw new Error("Unreachable")}function Lr(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 oP(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}function N6(e,t,r){let n=new Map,o=i=>{for(let[s,a]of i){let c=n.get(s);c===void 0&&n.set(s,c=new Map);for(let[u,p]of a){let f=c.get(u);f===void 0&&c.set(u,f=new Map);for(let[h,g]of p)f.has(h)?te(oP(f.get(h),g),`${r}: import '${h}' from '${u}' resolves differently ('${T6(f.get(h))}' vs '${T6(g)}')`):f.set(h,g instanceof Map?new Map(g):g)}}};return o(e),o(t),n}function D6(e,t,r){let n=new Map,o=i=>{for(let[s,a]of i){let c=n.get(s);if(c===void 0){n.set(s,a);continue}try{n.set(s,rP(a,c,s))}catch(u){throw new Error(`${r}: ${u.message}`,{cause:u})}}};return o(e),o(t),n}function z6(e,t,r,n){if(e.size===0)return new Set(t);let o=F6(r,{scope:n}),i=new Set(t);for(let s of e)o.has(s)||i.add(s);return i}function U6(e,t,r){let n=new Map,o=i=>{for(let[s,a]of i){let c=n.get(s);if(c===void 0){n.set(s,{name:a.name,version:a.version,...a.ecosystem===void 0?{}:{ecosystem:a.ecosystem},files:Object.assign(Object.create(null),a.files)});continue}te(c.name===a.name,`${r}: module '${s}' name mismatch ('${c.name}' vs '${a.name}')`),te(c.version===a.version,`${r}: module '${s}' version mismatch ('${c.version}' vs '${a.version}')`),te(c.ecosystem===a.ecosystem,`${r}: module '${s}' ecosystem mismatch ('${c.ecosystem??"(none)"}' vs '${a.ecosystem??"(none)"}')`);for(let[u,p]of Object.entries(a.files))Object.hasOwn(c.files,u)?te(c.files[u]===p,`${r}: content mismatch for '${sl(s,u)}'`):c.files[u]=p}};return o(e),o(t),n}function cl(e){return e.split("/").includes("node_modules")}function iP(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 H6(e){let t="node_modules/",r=iP(e);if(r===-1)return null;let n=r+t.length,o=e.slice(n).split("/"),i=o[0].startsWith("@")?2:1;if(o.length<=i||o.slice(0,i).some(a=>!a))return null;let s=o.slice(0,i).join("/");return{dir:e.slice(0,n)+s,rel:o.slice(i).join("/"),name:s}}var ZO,QO,eP,tP,I6,L6,i0,A6,Nd,ll,Lh,Pd,s0,T6,j6=w(()=>{ZO=new Set(["module","commonjs","json","module-typescript","commonjs-typescript"]),QO=new Set(["solidity","php","shell","rust"]),eP=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"]),tP=new Set(["resource","resource:base64"]),I6=new Set(["stat:file","stat:directory"]),L6=new Set([...ZO,...QO,...eP,...tP,"patch","directory",...I6]),i0=e=>I6.has(e),A6=e=>e==="directory"||e==="stat:directory"?"directory":"file";Nd=e=>e&&[null,Object.prototype].includes(Object.getPrototypeOf(e)),ll=e=>Object.setPrototypeOf(Object.fromEntries(e),null),Lh=e=>[...e].toSorted((t,r)=>al(t,r)),Pd=(e,{sorted:t=!0}={})=>{if(!t){let r=Object.create(null);for(let[n,o]of e)r[n]=o instanceof Map?Pd(o,{sorted:t}):o;return r}return ll([...e].toSorted((r,n)=>al(r[0],n[0])).map(([r,n])=>[r,n instanceof Map?Pd(n,{sorted:t}):n]))},s0=e=>new Map(Object.entries(e).map(([t,r])=>[t,Nd(r)?s0(r):r]));T6=e=>e instanceof Map?`{${[...e].map(([t,r])=>`${t}: ${r}`).join(", ")}}`:e});var gi,V6,W6,sP,K6,Fr,Fh=w(()=>{j6();gi=1,V6=0,W6=({name:e,version:t,ecosystem:r,files:n})=>(te(r===void 0||typeof r=="string"),{name:e,version:t,...r===void 0?{}:{ecosystem:r},files:ll(Object.entries(n))}),sP=e=>H6(e)??{dir:".",rel:e,name:null},K6=(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,i]of Object.entries(n))r[o]=Lh(new Set([...r[o]??[],...i]));return r},Fr=class e{static VERSION=gi;version=gi;config;entries;modules;formats;imports;executable;reason;constructor({config:t={scope:"full"},entries:r,modules:n,formats:o,imports:i,executable:s,reason:a,version:c=gi}={}){te([V6,gi].includes(c)),te(["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=i??new Map,this.executable=s??new Set,this.reason=a}get sources(){let t=new Map;for(let[r,{files:n}]of this.modules)for(let[o,i]of Object.entries(n))t.set(sl(r,o),i);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(sl(t,n))))return!0;return!1}static parse(t){let r=JSON.parse(t);te(r.version===gi||r.version===V6),te(["node_modules","full"].includes(r.config?.scope)),te(Nd(r.formats)),te(Nd(r.imports));let n=new Map;for(let[u,p]of Object.entries(r.formats)){te(!Lr(u)),te(L6.has(p),`unknown format '${p}' for ${u}`);let f=u===""?".":u;te(!n.has(f),`duplicate format key '${f}'`),n.set(f,p)}let o=new Map,i=new Set;if(r.version===gi){let u=r.config.scope==="full";if(r.modules!==void 0){te(typeof r.modules=="object"&&r.modules!==null);for(let[p,f]of Object.entries(r.modules))te(cl(p)),te(!Lr(p)),te(f?.name&&f.version&&f.files),o.set(p,W6(f))}if(u){te(r.sources&&typeof r.sources=="object");for(let[p,f]of Object.entries(r.sources))te(!cl(p)),te(!Lr(p)),te(f?.name&&f.version&&f.files),o.set(p,W6(f));te(r.entries===void 0||Array.isArray(r.entries)),i=new Set(r.entries)}else te(r.entries===void 0),te(r.sources===void 0);for(let[,{files:p}]of o)for(let f of Object.keys(p))te(!Lr(f))}else{te(r.sources);for(let[u,p]of Object.entries(r.sources)){te(!Lr(u));let{dir:f,rel:h,name:g}=sP(u);te(!Lr(f)&&!Lr(h)),o.has(f)||o.set(f,{name:g,version:null,files:Object.create(null)}),o.get(f).files[h]=p}}let s=new Set;for(let[u,{files:p}]of o)for(let f of Object.keys(p)){let h=sl(u,f);te(!s.has(h),`duplicate file key '${h}' across bundle buckets`),s.add(h)}let a=s0(r.imports),c=u=>{if(typeof u=="string"){te(!Lr(u));return}te(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)te(typeof p=="string"&&p.length>0&&!p.includes("/"),`invalid platform key '${p}'`),te(typeof f=="string"),te(!Lr(f))};for(let[,u]of a){te(u instanceof Map);for(let[p,f]of u){te(!Lr(p)),te(f instanceof Map);for(let[,h]of f)c(h)}}return new e({version:r.version,config:r.config,entries:i,modules:o,formats:n,imports:a,executable:r.version===gi?O6(r.executable,{what:"bundle",files:s,formats:n,scope:r.config.scope}):new Set,reason:Nd(r.reason)?r.reason:void 0})}#e(){let t=[],r=[];for(let[n,{name:o,version:i,ecosystem:s,files:a}]of this.modules){if(Object.keys(a).length===0)continue;let c=cl(n);c&&te(o&&i&&a);let u=ll(Object.entries(a).toSorted((f,h)=>al(f[0],h[0])));(c?t:r).push([n,{name:o,version:i,...s===void 0?{}:{ecosystem:s},files:u}])}return t.sort((n,o)=>al(n[0],o[0])),r.sort((n,o)=>al(n[0],o[0])),{modules:ll(t),sources:ll(r)}}serialize(){let t=Lh(this.entries),{modules:r,sources:n}=this.#e(),o=Pd(this.formats),i=Pd(this.imports),s={version:gi,config:this.config};this.config.scope==="full"&&Object.assign(s,{entries:t,sources:n}),Object.assign(s,{modules:r,formats:o,imports:i});let a=P6(this.executable,{what:"bundle",modules:this.modules,formats:this.formats,scope:this.config.scope});return a!==void 0&&(s.executable=a),this.reason!==void 0&&(s.reason=this.reason),JSON.stringify(s,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:K6(this.reason,{[t]:r})})}merge(t){return te(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:U6(this.modules,t.modules,"bundle merge"),formats:D6(this.formats,t.formats,"bundle merge"),imports:N6(this.imports,t.imports,"bundle merge"),executable:z6(this.executable,t.executable,t.modules,this.config.scope),reason:K6(this.reason,t.reason)})}}});function aP(){for(let e of["br","brotli"])try{return new DecompressionStream(e),e}catch{}return null}async function lP(e,t){let r=new Blob([t]).stream().pipeThrough(new DecompressionStream(e));return new Uint8Array(await new Response(r).arrayBuffer())}async function cP(){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 uP(){return Oh||(Oh=(async()=>await import(G6))(),Oh)}function l0(){a0=!0,Bn&&(Bn.terminate(),Bn=null);let e=[...dl.values()];dl.clear();for(let t of e)t.resolve(Ph)}function pP(e){let{id:t,bytes:r,error:n}=e.data??{},o=dl.get(t);o&&(dl.delete(t),n?o.reject(new Error(n)):o.resolve(r))}function fP(){if(Bn)return Bn;if(a0||typeof Worker>"u")return null;try{Bn=new Worker(new URL(G6,import.meta.url),{type:"module"})}catch{return a0=!0,null}return Bn.addEventListener("message",pP),Bn.addEventListener("error",l0),Bn.addEventListener("messageerror",l0),Bn}function hP(e){let t=fP();return t?new Promise((r,n)=>{let o=++dP;dl.set(o,{resolve:r,reject:n});try{t.postMessage({id:o,bytes:e})}catch{dl.delete(o),l0(),r(Ph)}}):Promise.resolve(Ph)}async function mP(){await cP();let e=aP();return e?{kind:"native",format:e}:{kind:"fallback"}}function q6(){return Bh||(Bh=mP(),Bh)}async function Y6(e,t=()=>!0){let r=()=>{if(!t())throw new DOMException("Bundle decode cancelled","AbortError")};r();let n=await q6();if(r(),n.kind==="native")return lP(n.format,e);let o=await hP(e);return r(),o!==Ph?o:(await uP()).brotliDecompress(e)}var Bh,Oh,G6,Ph,Bn,a0,dP,dl,c0=w(()=>{"use strict";Bh=null,Oh=null;G6="./brotli-fallback.js",Ph=Symbol("brotli worker unavailable"),Bn=null,a0=!1,dP=0,dl=new Map;q6().catch(()=>{})});function yP(e){let t=typeof e=="string"?e.slice(e.lastIndexOf("/")+1):"",r=t.lastIndexOf("."),n=r>0?t.slice(r+1).trim().toLowerCase():"",o=rn(e)??bP[n];return o?{key:o,label:gP[o]??o}:n?{key:`extension:${n}`,label:`.${n}`}:{key:"other",label:"Other"}}function Dd(e,t){let r=new Map,n=0,o=0;for(let[i,s]of e){let a=yP(i),c=r.get(a.key)??{...a,files:0,lines:0,bytes:0};c.files++,c.lines+=s,c.bytes+=t.get(i)??0,r.set(a.key,c),o+=s,n+=t.get(i)??0}return{files:e.size,lines:o,bytes:n,languages:[...r.values()].toSorted((i,s)=>s.lines-i.lines||i.label.localeCompare(s.label))}}var gP,bP,d0=w(()=>{"use strict";e0();gP=Object.freeze({javascript:"JavaScript",jsx:"JSX",typescript:"TypeScript",tsx:"TSX",json:"JSON",css:"CSS",markup:"HTML",yaml:"YAML",bash:"Shell",markdown:"Markdown",solidity:"Solidity",php:"PHP",rust:"Rust",ruby:"Ruby",java:"Java",cpp:"C++",c:"C",objectivec:"Objective-C",python:"Python",go:"Go",kotlin:"Kotlin",swift:"Swift",dart:"Dart",sql:"SQL",lua:"Lua",csharp:"C#",scala:"Scala",vue:"Vue",svelte:"Svelte"}),bP=Object.freeze({py:"python",pyw:"python",go:"go",kt:"kotlin",kts:"kotlin",swift:"swift",dart:"dart",sql:"sql",lua:"lua",cs:"csharp",scala:"scala",sc:"scala",vue:"vue",svelte:"svelte"})});function vr(e){if(e?.metadataOnly)return new Map;let t=e?.bundle??e?.json;if(t&&u0.has(t))return u0.get(t);let r=new Map;if(!e)return r;if(e.kind==="stasis"){if(!e.bundle)return r;let n=e.bundle.formats;for(let[o,i]of e.bundle.sources)typeof i=="string"&&(Fr.isResourceFormat(n?.get(o))||r.set(o,i))}else if(e.kind==="sourcemap"){if(!e.json)return r;let n=e.json.sources??[],o=e.json.sourcesContent??[];for(let i=0;i<n.length;i++)typeof o[i]=="string"&&r.set(n[i],o[i])}return t&&u0.set(t,r),r}function On(e){let t=e?.bundle??e?.json;if(t&&p0.has(t))return p0.get(t);let r=new Map(vr(e));if(e?.kind==="stasis"&&e.bundle){let n=e.bundle.formats;for(let[o,i]of e.bundle.sources){if(typeof i!="string")continue;let s=n?.get(o);s==="resource"?r.set(o,i):s==="resource:base64"&&r.set(o,{format:"base64",data:i})}}return t&&p0.set(t,r),r}function wP(e){let t=e.endsWith("=");if(t?e.length%4!==0||e.at(-3)==="=":e.length%4===1)return null;let r=t?e.slice(0,e.endsWith("==")?-2:-1):e;if(/[^A-Za-z0-9+/]/u.test(r))return null;let n=r.length%4;return n>1&&vP.indexOf(r.at(-1))&(n===2?15:3)?null:Math.floor(r.length*3/4)}function zd(e){return typeof e=="string"?Ki(e):e?.format==="base64"?wP(e.data):null}function Ut(e){if(e?.fileSizes)return e.fileSizes;let t=e?.bundle??e?.json;if(t&&f0.has(t))return f0.get(t);let r=new Map,n=On(e),o=e?.kind==="stasis"?e.bundle?.sources.keys():e?.json?.sources;for(let i of o??[])r.set(i,zd(n.get(i)));return t&&f0.set(t,r),r}function b0(e){if(e?.metadataOnly)return e.unsizedFiles??new Set;let t=Ut(e);if(g0.has(t))return g0.get(t);let r=new Set;for(let n of On(e).keys())t.get(n)===null&&r.add(n);return g0.set(t,r),r}function ul(e){let t=Ut(e);if(m0.has(t))return m0.get(t);let r=b0(e),n=e?.kind==="stasis"?e.bundle?.formats:null,o=new Map;for(let[i,s]of t)s===null&&!r.has(i)||o.set(i,Fr.isResourceFormat(n?.get(i))?"resource":"source");return m0.set(t,o),o}function X6(e){let t=Ut(e),r=e?.kind==="stasis"?e.bundle?.formats:null;if(!r||r.size===0)return t;if(h0.has(t))return h0.get(t);let n=new Map;for(let[o,i]of t)n.set(o,Fr.isResourceFormat(r.get(o))?null:i);return h0.set(t,n),n}function nn(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 Ud(e,t=null){let r=new Map;if(e?.kind!=="stasis"||!e.bundle?.modules)return r;let n=t===null?null:nn(e),o=t===null?null:new Set([...t].map(i=>n?.get(i)));for(let[i,s]of e.bundle.modules){if(o&&!o.has(i)||!i.includes("node_modules")||!s?.name||typeof s.version!="string"||!s.version)continue;let a=r.get(s.name);a||(a=new Set,r.set(s.name,a)),a.add(s.version)}return r}var u0,p0,f0,h0,m0,g0,vP,Nh=w(()=>{"use strict";Fh();At();u0=new WeakMap,p0=new WeakMap,f0=new WeakMap,h0=new WeakMap,m0=new WeakMap,g0=new WeakMap;vP="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"});function bi(e,t=null){return!!t||xP.has(e)}function Hd(e){if(e.fileHashes)return Promise.resolve(e.fileHashes);if(Dh.has(e))return Dh.get(e);let t=(async()=>{let r=[...vr(e)],n=new Map;for(let o=0;o<r.length;o+=32){let i=await Promise.all(r.slice(o,o+32).map(async([s,a])=>[s,await Lb(a)]));for(let[s,a]of i)n.set(s,a)}return e.fileHashes=n,n})();return Dh.set(e,t),t.catch(()=>Dh.delete(e)),t}function jd(e){return typeof e!="string"||e.length===0?0:(e.match(/\r\n|\r|\n/gu)?.length??0)+(/[\r\n]$/u.test(e)?0:1)}function v0(e){return e instanceof Map?Object.fromEntries([...e].map(([t,r])=>[t,v0(r)])):e}async function J6(e){let t=await Hd(e),r=Ut(e),n=e.lineCounts??=new Map([...vr(e)].map(([s,a])=>[s,jd(a)])),o={version:y0,integrity:e.integrity,kind:e.kind,size:e.size,codeStats:Dd(n,r),files:[...r].map(([s,a])=>[s,a,t.get(s)??null,n.get(s)??null])},i=b0(e);if(i.size>0&&(o.unsized=[...i]),e.kind==="sourcemap"){let{version:s,file:a,sourceRoot:c,names:u,sources:p=[],sourcesContent:f=[]}=e.json;o.json={version:s,file:a,sourceRoot:c,sources:p},o.sourceSizes=p.map((h,g)=>typeof f[g]=="string"?Ki(f[g]):null),o.namesCount=u?.length??null}else{let s=e.bundle,a={version:s.version,config:s.config,formats:v0(s.formats),imports:v0(s.imports),reason:s.reason,executable:[...s.executable]};if(s.version===0)a.sources=Object.fromEntries([...r.keys()].map(c=>[c,null]));else{let c={},u={};for(let[p,f]of s.modules){let h=p.split("/").includes("node_modules")?c:u;Object.defineProperty(h,p,{enumerable:!0,value:{name:f.name,version:f.version,ecosystem:f.ecosystem,files:Object.fromEntries(Object.keys(f.files).map(g=>[g,null]))}})}a.modules=c,s.config.scope==="full"&&(a.sources=u,a.entries=[...s.entries])}o.bundle=a}return o}function Vd(e,t){if(e?.version!==1&&e?.version!==y0||e.integrity!==t||!["stasis","sourcemap"].includes(e.kind)||!Number.isSafeInteger(e.size)||e.size<0||!Array.isArray(e.files))throw new Error("Invalid bundle metadata");let r=e.version!==y0,n=new Map,o=new Map,i=new Map;for(let c of e.files){if(!Array.isArray(c)||c.length!==4&&!(r&&c.length===3))throw new Error("Invalid bundle metadata file");let[u,p,f,h]=c;if(typeof u!="string"||o.has(u)||p!==null&&(!Number.isSafeInteger(p)||p<0)||f!==null&&(typeof f!="string"||!/^sha512-[A-Za-z0-9+/]{86}==$/u.test(f))||p===null&&f!==null||r&&p!==null&&f===null||h!=null&&(!Number.isSafeInteger(h)||h<0))throw new Error("Invalid bundle metadata file");o.set(u,p),f!==null&&n.set(u,f),h!=null&&i.set(u,h)}let s=new Set(e.unsized??[]);if(e.unsized!==void 0&&(r||!Array.isArray(e.unsized)||s.size!==e.unsized.length)||[...s].some(c=>typeof c!="string"||!o.has(c)||o.get(c)!==null))throw new Error("Invalid bundle metadata");let a={integrity:t,kind:e.kind,size:e.size,metadataOnly:!0,fileSizes:o,fileHashes:n,lineCounts:i,unsizedFiles:s,stale:r};if(e.kind==="stasis"){a.bundle=Fr.parse(JSON.stringify(e.bundle));let c=a.bundle.sources;if(c.size!==o.size||[...c.keys()].some(p=>!o.has(p)))throw new Error("Invalid bundle metadata inventory");let u=a.bundle.formats;if(!r&&[...o].some(([p,f])=>n.has(p)!==(f!==null&&!Fr.isResourceFormat(u.get(p)))))throw new Error("Invalid bundle metadata inventory");if([...s].some(p=>u.get(p)!=="resource:base64"))throw new Error("Invalid bundle metadata inventory")}else{if(!e.json||typeof e.json!="object"||![null,void 0].includes(e.namesCount)&&(!Number.isSafeInteger(e.namesCount)||e.namesCount<0))throw new Error("Invalid sourcemap metadata");if(!Array.isArray(e.json.sources)||e.json.sources.some(c=>!o.has(c))||!Array.isArray(e.sourceSizes)||e.sourceSizes.length!==e.json.sources.length||e.sourceSizes.some(c=>c!==null&&(!Number.isSafeInteger(c)||c<0))||[...o].some(([c,u])=>n.has(c)!==(u!==null))||s.size>0)throw new Error("Invalid sourcemap inventory");a.json=e.json,a.sourceSizes=e.sourceSizes,a.namesCount=e.namesCount}if(e.codeStats===void 0)a.codeStats=Dd(i,o);else{let c=e.codeStats,u=p=>Number.isSafeInteger(p)&&p>=0;if(!c||![c.files,c.lines,c.bytes].every(u)||!Array.isArray(c.languages)||c.languages.some(p=>!p||typeof p.key!="string"||typeof p.label!="string"||![p.files,p.lines,p.bytes].every(u)))throw new Error("Invalid bundle code stats");a.codeStats=c}return a}function Z6(e,{integrity:t,kind:r,size:n}){if(r==="stasis")return{integrity:t,kind:r,size:n,bundle:Fr.parse(e)};if(r!=="sourcemap")throw new Error("Unsupported bundle format");let o=JSON.parse(e);if(!Array.isArray(o?.sources)||o.sources.some(i=>typeof i!="string")||o.sourcesContent!==void 0&&(!Array.isArray(o.sourcesContent)||o.sourcesContent.some(i=>i!==null&&typeof i!="string")))throw new Error("Invalid sourcemap");return{integrity:t,kind:r,size:n,json:o}}var kP,y0,Dh,xP,Q6=w(()=>{"use strict";d0();Fh();Ee();At();Nh();kP=2,y0=kP,Dh=new WeakMap,xP=new Set(["terminal","code","search","compare"])});var pl=w(()=>{"use strict";Q6()});async function w0(e){try{let t=await ty(e);return t?Vd(t,e):null}catch{return null}}function fo(e,t,{sources:r=!0}={}){if(!t.managedId&&_())return Promise.reject(new DOMException("Local bundle closed","AbortError"));let n=r?$P:_P,o=t.name.toLowerCase().endsWith(".map")?"sourcemap":"stasis",i=l.bundleDetails;if(i?.integrity===e&&i.kind===o&&i.managedId===t.managedId&&!i.error&&(!r||!i.metadataOnly))return Promise.resolve(i);let s=`${t.managedId??"local"}:${e}:${o}`,a=t.managedId&&r?Es():void 0,c=n.get(s);if(c&&c.signal===a)return c.job;let u=(async()=>{if(t.managedId)try{let h=r?Z6(await f5(t.managedId,{signal:a}),{integrity:e,kind:o,size:t.size}):Vd(await Uf(t.managedId),e);return h.managedId=t.managedId,h}catch(h){if(h.name==="AbortError")throw h;return{integrity:e,kind:o,size:t.size,managedId:t.managedId,error:h.message}}if(!r){let h=await w0(e);return h?.kind===o&&!h.stale?h:fo(e,t)}let[p,f]=await Promise.all([SP(e,t),w0(e)]);if(!p.error){let h=f?.kind===p.kind&&!f.stale;h&&(p.fileHashes=f.fileHashes,p.fileSizes=f.fileSizes,p.lineCounts=f.lineCounts),h||J6(p).then(g=>ry(e,g)).catch(()=>{})}return p})();return n.set(s,{job:u,signal:a}),u.finally(()=>{n.get(s)?.job===u&&n.delete(s)}).catch(()=>{}),u}function ho(e,t=l.currentView==="bundles"?l.bundleDetailsTab:"overview",{workspaceId:r=null}={}){St(),l.currentView="bundles",l.selectedBundle=e,l.selectedBundleWorkspace=r,l.bundleDetails=null,l.bundleSourceFile=null,l.bundleSourceFindingIdx=null,l.bundleCodeSearchQuery="",l.bundleCodeSearchMode="files",l.bundleSearchQuery="",l.bundleSearchRegex=!1,l.bundleSearchCase=!1,l.bundleSearchContext=!0,l.bundleDetailsTab=t??"overview",L.showAll=!0,l.shownTriage=null}function Kd(e){bi(l.bundleDetailsTab,l.bundleSourceFile)&&!bi(e)&&St(),l.bundleDetailsTab=e,l.bundleSourceFile=null,l.bundleSourceFindingIdx=null}async function SP(e,t){try{let r=await Xr(e);if(_())throw new DOMException("Local bundle closed","AbortError");let n=t.name.toLowerCase().endsWith(".map"),o=n?"sourcemap":"stasis";try{if(n){let a=JSON.parse(it(r));return{integrity:e,kind:o,size:r.byteLength,json:a}}let i=it(await Y6(r,()=>!_())),s=Fr.parse(i);return{integrity:e,kind:o,size:r.byteLength,bundle:s}}catch(i){if(i.name==="AbortError")throw i;return{integrity:e,kind:o,size:r.byteLength,error:i.message}}}catch(r){if(r.name==="AbortError")throw r;return{integrity:e,error:r.message,size:0}}}function CP(e){if(!(e?.managedId||!e?.json&&!e?.bundle)){if(e.fileHashes){jc(e.integrity,e.fileHashes);return}(async()=>{try{let t=await Hd(e);if(jc(e.integrity,t),l.bundleDetails!==e)return;e.fileHashes=t,S()}catch{}})()}}function k0(e){if(ky(e))return Promise.resolve();if(Wd.has(e))return Wd.get(e);let t=(l.bundles??[]).find(n=>n.integrity===e);if(!t||t.managedId)return Promise.resolve();let r=(async()=>{let n=await w0(e);if(!(!n?.json&&!n?.bundle))try{let o=await Hd(n);jc(e,o)}catch{}})();return Wd.set(e,r),r.finally(()=>{Wd.get(e)===r&&Wd.delete(e)}).catch(()=>{}),r}async function x0(e,t=()=>!0){let r=new Set(e);if(r.size!==0){await new Promise(n=>{let o=()=>setTimeout(n,0);typeof requestAnimationFrame=="function"?requestAnimationFrame(o):o()});for(let n of r){if(!t())return;await k0(n)}}}async function mo(e){let t=(l.bundles??[]).find(n=>n.integrity===e);if(!t)return;let r;try{r=await fo(e,t,{sources:bi(l.bundleDetailsTab,l.bundleSourceFile)})}catch(n){if(n.name==="AbortError")return;throw n}l.selectedBundle!==e||t.managedId&&!l.bundles.includes(t)||(l.bundleDetails=r,S(),CP(r),t.managedId||Cr().catch(()=>{}))}function Ps(e=l.bundleDetails){if(e?.sourceError)return Promise.resolve(null);if(!e?.metadataOnly)return Promise.resolve(e);let t=e.managedId?Es():void 0,r=zh.get(e);if(r&&r.signal===t)return r.job;let n=(l.bundles??[]).find(i=>i.integrity===e.integrity);if(!n)return Promise.resolve(null);let o=fo(e.integrity,n).then(i=>(t?.throwIfAborted(),l.bundleDetails!==e?i:i.error&&e.managedId?(e.sourceError=i.error,S(),null):(i.error||(i.fileHashes=e.fileHashes,i.fileSizes=e.fileSizes,i.lineCounts=e.lineCounts,i.codeStats=e.codeStats),l.bundleDetails=i,S(),i))).catch(i=>{if(i.name==="AbortError")return null;throw i});return zh.set(e,{job:o,signal:t}),o.finally(()=>{zh.get(e)?.job===o&&zh.delete(e)}).catch(()=>{}),o}var $P,_P,Wd,zh,go=w(()=>{"use strict";Fh();D();Zt();At();c0();ao();zt();Za();pl();$P=new Map,_P=new Map,Wd=new Map,zh=new WeakMap});var on=w(()=>{"use strict";Nh()});function Uh(e,t){return!!e&&!!t&&e.integrity===t.integrity&&e.file===t.file&&(e.range?.start??null)===(t.range?.start??null)&&(e.range?.end??null)===(t.range?.end??null)}function $0(e,t,r){if(!r)return null;if(!Array.isArray(e)||e.length===0||!Uh(e[0],r))return{stack:EP,at:0,pos:r};let n=Math.min(Math.max(t,0),e.length-1);return{stack:e,at:n,pos:e[n]}}function e3({stack:e,at:t,base:r},n){let o=e.length>0?e[t]:r;if(Uh(o,n))return null;let i=e.length>0?e.slice(0,t+1):[r];return{stack:[...i,n],at:i.length}}function t3(e,t,r){return!Array.isArray(e)||e.length===0?0:Math.min(Math.max(t+r,0),e.length-1)}var EP,Hh=w(()=>{"use strict";EP=[]});function fl(e,t){if(!e||!t||t.length===0)return;let r=e.getBoundingClientRect().top,n=t[0].getBoundingClientRect(),o=t.item(t.length-1).getBoundingClientRect(),i=n.top-r+e.scrollTop,s=o.bottom-r+e.scrollTop,a=i+(s-i)/2-e.clientHeight/2;e.scrollTo({top:Math.max(0,Math.min(a,i-n.height)),behavior:"instant"})}var jh=w(()=>{"use strict"});function n3(e,t,r,n=S0,o=RP){let i=`${e}\0${t}`;if(n.has(i)||o.has(i))return;let s=rn(t);if(!s){n.set(i,null);return}o.add(i),(async()=>{let a=await Ir(r,s);n.set(i,a??null),o.delete(i),l.focusCodeTick++,queueMicrotask(S)})()}async function MP(e){let t=Gd.get(e);if(t&&(t.loading||t.sources))return;let r=(l.bundles??[]).find(n=>n.integrity===e);if(r){Gd.set(e,{sources:null,loading:!0,error:null});try{let n=await fo(e,r),o=vr(n);Gd.set(e,{sources:o,loading:!1,error:n.error??null})}catch(n){Gd.set(e,{sources:null,loading:!1,error:n.message})}l.focusCodeTick++,queueMicrotask(S),queueMicrotask(bo)}}function bo(){let e=P.querySelectorAll(".focus-code-line-active");e.length!==0&&fl(e[0].closest(".focus-code-body"),e)}function qd(e){if(_()){if(!e?._managedReportId||!Array.isArray(e._bundleHashes)||e._bundleHashes.length===0)return null;l.focusCodeTick;let r=Ya(e._managedReportId);if(r?.data===null||r?.error)return null;let n={integrity:r?.data?.integrity??null,reportId:e._managedReportId},o=[e,...Array.isArray(e.evidence)?e.evidence:[]];for(let i of o){let s=Yd(n,i?.file);if(s)return{...n,file:s,line:i.line}}return null}let t=e?._bundleHashes;return!e?.fileHash||!Array.isArray(t)||t.length===0?null:bs(e.fileHash).find(({integrity:r})=>t.includes(r))??null}function Yd(e,t){if(typeof t!="string"||!t)return null;if(!e.reportId)return wy(e.integrity,t);let r=Ya(e.reportId);if(!r||r.data===void 0&&!r.error)return t;let n=r.data;return n?.paths.get(t)??(n?.sources.has(t)?t:null)}function o3(e,t,r){if(!_())return null;let n=Ya(e);if(!n||n.data===void 0&&!n.error)return r&&!_0.has(e)&&(_0.add(e),zf(e).catch(()=>{}).finally(()=>{_0.delete(e),l.focusCodeTick++,queueMicrotask(S),queueMicrotask(bo)})),r?{loading:!0}:null;let o=n.data;if(!o)return null;t=o.paths.get(t)??t;let i=o.sources.get(t);if(typeof i!="string")return null;let s=r3.get(o);return s||(s={cache:new Map,pending:new Set},r3.set(o,s)),n3(o.integrity,t,i,s.cache,s.pending),{content:i,highlighted:s.cache.get(`${o.integrity}\0${t}`)??null,loading:!1}}function hl(e,t,{kick:r=!0,reportId:n=null}={}){if(n)return o3(n,t,r);if(_())return null;let o=Gd.get(e);if(!o)return r?(MP(e),{loading:!0}):null;if(o.loading&&!r)return null;if(o.loading)return{loading:!0};if(!o.sources)return null;let i=o.sources.get(t);if(typeof i!="string")return null;n3(e,t,i);let s=`${e}\0${t}`;return{content:i,highlighted:S0.has(s)?S0.get(s):void 0,loading:!1}}function i3(e){let t=qd(e);return t?.integrity?{integrity:t.integrity,file:t.file,range:Ct(t.reportId?t.line:e.line)}:null}function AP(e){return e?i3(rt(e)):null}function Xd(e){let t=AP(e);return t?{base:t,...$0(l.focusCodeStack,l.focusCodeAt,t)}:null}function s3(e){let t=i3(e);return t?$0(l.focusCodeStack,l.focusCodeAt,t).pos:null}function a3(e){let t=e&&rt(e),r=qd(t);if(r?.reportId&&!r.integrity)return o3(r.reportId,r.file,!0);let n=Xd(e);if(!n)return null;let{pos:o}=n,i=hl(o.integrity,o.file,{reportId:t?._managedReportId});return!i||i.loading?i:{...i,file:o.file,integrity:o.integrity,range:o.range}}var Gd,S0,RP,r3,_0,Vh=w(()=>{"use strict";D();Zt();ct();go();on();Hh();pe();Os();zt();or();jh();Gd=new Map,S0=new Map,RP=new Set,r3=new WeakMap,_0=new Set});function ml(e,{teamOnly:t=!1,reportId:r}={}){if(!e)return null;let n=W(e);if(!Lt(n))return null;if(_()){let s=t?null:r??(l.currentView==="links"?e._managedReportId:l.currentManagedReport),a=ar(bt({view:"findings",teamId:l.currentManagedTeam,reportId:s,finding:{id:n}},l.managedTeams));return a?`${typeof location>"u"?"":location.origin}${a}`:null}let o=e._reportName||l.currentFile||"",i=l.currentWorkspace||yi(o);return pb({id:n,report:l.currentWorkspace?null:Tp("report",o),workspace:Tp("workspace",i??"")})}function yi(e,t=l.currentReportWorkspace||l.currentWorkspace){let r=rd(e);return r.some(n=>n.id===t)?t:r.length===1?r[0].id:null}function vi(e){for(let t of[br(),y6()])for(let r of t)for(let n of r)if(W(n)===e)return{group:r,finding:n};return null}function C0(e,t){l.currentView="findings",l.viewMode==="graph"&&(l.viewMode="table",Ye());let r=Ve(e).commonTriage;if(l.viewMode==="kanban"){let s=r??"untriaged";l.kanbanExpandedColumn!==null&&l.kanbanExpandedColumn!==s&&(l.kanbanExpandedColumn=null)}else r!==l.shownTriage&&(l.shownTriage=r);l.upstreamOnly&&!e.every(s=>s.isUpstream)&&(l.upstreamOnly=!1),ai(l.showRevalidation,l.upstreamOnly);let n=e.find(s=>W(s)===t);if(As(n)||xh(Fn())&&!YE(e)||!Ln(e).some(s=>W(s)===t))if(l.currentWorkspace){n?.isUpstream?l.upstreamOnly=!0:l.showRevalidation=!1,ai(l.showRevalidation,l.upstreamOnly);let s=br().find(a=>a.some(c=>W(c)===t));if(s)return C0(s,t)}else l.revalidationDetailed=!0;if(fi([e]).length===0){let s=l.sortBy;ol(),l.sortBy=s}let i=de(e);return e.length>1&&l.activeTabByGroup.set(i,t),l.viewMode==="table"?l.tableSelectedGid=i:l.viewMode==="focus"?l.focusGid=i:l.viewMode==="kanban"&&(l.kanbanPopoverGid=i),i}var wi=w(()=>{"use strict";D();Jn();tn();ct();pe();ao()});function l3(e,t){return t!=null&&(e.authorId===t.id||e.authorId==null&&t.role==="admin")}function c3(e,t){if(e.createdAt==null&&t.createdAt!=null)return-1;if(e.createdAt!=null&&t.createdAt==null)return 1;let r=(e.createdAt??0)-(t.createdAt??0);return r!==0?r:e.id===t.id?0:e.id<t.id?-1:1}var E0=w(()=>{"use strict"});function Wh(e,t){Jd.has(e)||Jd.set(e,new Set);let r=Jd.get(e);return r.add(t),()=>{r.delete(t),r.size===0&&Jd.delete(e)}}function R0(e,t){l.managedComments.set(e,t);for(let r of Jd.get(e)??[])r()}function Pn(e){return _()?l.managedComments?.get(e?.id)??[]:[]}function Kh(){return _()&&l.managedSession!=null&&Xf(l.managedSession.role,"triage")}function Gh(e){return Kh()&&l3(e,l.managedSession)}function Zd(e){let t=l.reports,r=l.managedSession?.id;return()=>_()&&r!=null&&l.managedSession?.id===r&&l.reports===t&&l.managedReports.some(n=>n.id===e)}async function gl(e,{signal:t}={}){let r=Zd(e);if(!r())return!1;let n=new Set(l.reports.filter(a=>a._managedReportId===e).flatMap(a=>a.groups.flatMap(c=>c.map(u=>u.id)))),o=new Map([...n].map(a=>[a,l.managedComments.get(a)])),i=await a5(e,l.currentManagedTeam,{signal:t});if(!r()||i==null||t?.aborted)return!1;let s=new Map([...n].map(a=>[a,[]]));for(let a of i)s.has(a.findingId)&&s.get(a.findingId).push(a);for(let[a,c]of s)l.managedComments.get(a)===o.get(a)&&R0(a,c);return!0}async function d3(e,t,r=null){let n=e?._managedReportId,o=Zd(n);if(!o()||!Kh())return{status:403};if(r&&r.authorId!==l.managedSession.id)return{status:403};let i=await l5(n,{findingId:e.id,body:t,commentId:r?.id,version:r?.version},l.managedSession.csrfToken);if(!o())return{status:0};if(i.comment){let a=(l.managedComments.get(e.id)??[]).filter(c=>c.id!==i.comment.id);a.push(i.comment),a.sort(c3),R0(e.id,a)}return i}async function u3(e,t){let r=e?._managedReportId,n=Zd(r);if(!n()||!Gh(t))return 403;let o=await c5(r,t.id,t.version,l.managedSession.csrfToken);if(!n())return 0;if(o===204){let i=l.managedComments.get(e.id)??[];R0(e.id,i.filter(s=>s.id!==t.id))}return o}var Jd,bl=w(()=>{"use strict";D();Jf();E0();Zt();Jd=new Map});var p3,f3=w(()=>{Ur();Vi();Qu();p3=kr(class extends Gt{constructor(){super(...arguments),this.key=m}render(e,t){return this.key=e,t}update(e,[t,r]){return t!==this.key&&(ia(e),this.key=t),r}})});var h3=w(()=>{f3()});function M0(e,t){return e?p3(e,d`<span class="managed-comment-avatar" aria-hidden="true"><span>${(t?.[0]??"?").toUpperCase()}</span> ${Rn()?m:d`<img alt="" src="${`/api/avatar/${encodeURIComponent(e)}`}" loading="lazy" @error="${r=>{r.currentTarget.hidden=!0}}">`}</span>`):m}function TP(e){let t=e.version>1&&e.updatedAt!=null,r=e.createdAt??(t?e.updatedAt:null);if(r==null)return m;let n=new Date(r),o=[e.createdAt==null?"":`Posted ${new Date(e.createdAt).toLocaleString()}`,t?`Edited ${new Date(e.updatedAt).toLocaleString()}`:""].filter(Boolean).join(`
111
+ `);return d`<time class="managed-comment-time" datetime="${n.toISOString()}" data-tooltip="${o}">${e.createdAt==null?"edited ":""}${n.toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})}${t&&e.createdAt!=null?" (edited)":""}</time>`}function yl(e,t,r=m){let n=TP(e);return d`<div class="managed-comment"><div class="managed-comment-row">${e.authorId||e.authorLogin?d`<span class="managed-comment-author">${M0(e.authorId,e.authorLogin)} ${e.authorLogin?d`<strong data-tooltip="${e.authorLogin}">${e.authorLogin}</strong>`:m}</span>`:m}<div class="managed-comment-body">${t}</div>${n===m&&r===m?m:d`<div class="managed-comment-meta">${r===m?m:d`<div class="managed-comment-actions">${r}</div>`} ${n}</div>`}</div></div>`}var qh=w(()=>{"use strict";Cs();T();h3()});function yo(e){return OE(e,{managed:_()}).map(t=>typeof t=="string"?t:t.self?d`<a class="comment-self-ref" href="${t.url}" data-tooltip="Show this finding">${t.label}</a>`:d`<a href="${t.url}" target="_blank" rel="noopener noreferrer" data-tooltip="${t.url}">${t.label}</a>`)}var Yh=w(()=>{"use strict";T();D();pe()});function Ht(e){return e==="informational"?"info":e.replaceAll("_"," ")}function A0(e,{variant:t="full"}={}){let r=l.severityMode,n=ce(e,r),o=d`<span class="${`badge ${n}`}">${Ht(n)}</span>`,i=cr(e),s=t==="tab"?null:ka(e);if(!i&&!s)return o;let a=s?`Corrected severity varies across reports \u2014 ${Object.entries(s).map(([$,C])=>`${$||"(this report)"}: ${Ht(C.severity)}`).join("; ")}`:null,c=s?d`<span class="badge-varies" title="${a}" aria-label="${a}">varies</span>`:m;if(!i)return d`<span class="${`badge-pair badge-pair-${t}`}">${o}${c}</span>`;let u=e.severity,p=wn(e),f=e.correctedSeverityReason,h=(je[p]??0)>(je[u]??0),g=h?"up":"down",b=h?"\u25B2":"\u25BC",y=r!=="original",k=(y?`Corrected ${g} from ${Ht(u)}`:`Original severity \u2014 corrected ${g} to ${Ht(p)}`)+(f?` \u2014 ${f}`:""),v=`Severity ${Ht(n)}; ${y?`corrected ${g} from ${Ht(u)}`:`original, corrected to ${Ht(p)}`}${f?`; reason: ${f}`:""}`;if(t==="tab")return d`<span class="badge-pair badge-pair-tab" title="${k}" aria-label="${v}">${o}<span class="${`badge-corr-mark ${g}`}" aria-hidden="true">${b}</span></span>`;let x=y?u:p;return d`<span class="${`badge-pair badge-pair-${t}`}" title="${k}" aria-label="${v}">${o}<span class="badge-orig-wrap"><span class="${`badge-arrow ${g}`}" aria-hidden="true">${b}</span>${y?d`<span class="badge-pre" aria-hidden="true">was</span>`:m}<span class="${`badge-orig ${x}${y?" struck":""}`}">${Ht(x)}</span></span>${c}</span>`}function eu(e){m3.lastIndex=0;let t=[],r=0,n;for(;(n=m3.exec(e))!==null;){n.index>r&&t.push(e.slice(r,n.index));let o=n[0].codePointAt(0);if(o===91){let i=IE(n[0]);t.push(i?d`<a href="${i.url}" target="_blank" rel="noopener noreferrer" data-tooltip="${i.url}">${i.label}</a>`:n[0])}else o===42?t.push(d`<strong>${n[0].slice(2,-2)}</strong>`):o===96?t.push(d`<span class="inline-code">${n[0].slice(1,-1)}</span>`):t.push(d`<span class="inline-quote">${n[0]}</span>`);r=n.index+n[0].length}return r===0?e:(r<e.length&&t.push(e.slice(r)),t)}function IP({lang:e,code:t}){l.codeBlockTick;let r=o0(t,e);return d`<div class="code-block" data-lang="${e||m}">${e?d`<div class="code-block-lang">${e}</div>`:m}<pre><code>${r?V(r):t}</code></pre></div>`}function LP(e,{wrap:t=!1}={}){let r=e.split(/\n{2,}/u).filter(n=>n.trim());return r.length<2?t?d`<div class="para">${eu(e)}</div>`:eu(e):r.map(n=>d`<div class="para">${eu(n)}</div>`)}function FP({ordered:e,start:t,items:r}){let n=r.map(o=>d`<li>${Br(o)}</li>`);return e?d`<ol class="md-list" start="${t>1?t:m}">${n}</ol>`:d`<ul class="md-list">${n}</ul>`}function Br(e,{paragraphs:t=!0}={}){if(!e)return e;let r=t?ME(e):[e],n=r.length>1,o=s=>t?LP(s,{wrap:n}):eu(s),i=s=>{let a=RE(s);return a.length===1&&typeof a[0]=="string"?o(a[0]):a.map(c=>typeof c=="string"?o(c):IP(c))};return r.length===1&&typeof r[0]=="string"?i(r[0]):r.map(s=>typeof s=="string"?i(s):FP(s))}function BP(e){let t=new Set;for(let r of e)t.add(et(r));return[...t]}function OP(e){let t=et(e);return Rs[t]??t}function PP(e,t){l.linksTick,l.findingIndexTick;let r=W(e),n=Lt(r)?pr(r).filter(o=>!t.has(o)):[];return n.length===0?m:d`<div class="duplicates-block"><span class="duplicates-label">Duplicates:</span>${n.map(o=>{let i=Rd(o),s=gs(o),a=s.length===0?"":` \u2014 in ${s.map(c=>`${Re(c)} (${OP(c)})`).join(", ")}`;return d`<a class="duplicate-ref" href="${_()?ml({id:o},{teamOnly:!0}):`#${bn({id:o})}`}" data-tooltip="${`${i}${a}`}">${BP(s).map(c=>V(ke[c]??ke.default))}<span class="duplicate-ref-id">${Is(o)??i}</span></a>`})}</div>`}function NP(e){let t=ww(e);return t?d`<span class="${`revalidate-stamp ${t}`}">${t}</span><div class="value-label">Revalidation</div>`:m}function DP(e){let t=yw()?Ft(e.revalidateVerdict,e):"";return t?d`<div class="revalidate-verdict">${Br(rl(t))}</div>`:m}function Qd(e,t,r="section",{collapsible:n=!1}={}){let o=t?d`<div class="section-body">${Br(rl(t))}</div>`:m;return!n||!t?d`<div class="${r}"><div class="section-label">${e}</div>${o}</div>`:d`<details class="${r}"><summary class="section-label">${e}</summary>${o}</details>`}function zP(e,t,r){let n=e?.integrity&&t?.file?Yd(e,t.file):null;return n?d`<span class="evidence-ref" role="link" tabindex="0" data-code-nav-integrity="${e.integrity}" data-code-nav-file="${n}" data-code-nav-line="${t?.line??""}">${r}</span>`:d`<span class="evidence-ref">${r}</span>`}function UP(e,t){let r=Array.isArray(e.evidence)?e.evidence:[];if(r.length===0)return m;let n=Tr(e),o=qd(e),i=t==="focus"&&o!==null,s=i?s3(e):null;return d`<details class="evidence"><summary class="section-label">Evidence<span class="evidence-count">(${r.length})</span></summary><ol class="evidence-list">${r.map((a,c)=>{let u=vt(a),p=hh(a,e,n,c),f=ns(a),h=y3(e,`ev${c}`,o,a?.file,a?.line),g=T0(p),b=i&&Uh(s,{integrity:o.integrity,file:Yd(o,a?.file),range:Ct(a?.line)});return d`<li class="${N({current:b})}">${i?zP(o,a,u):p?d`<a class="evidence-ref" href="${p}" target="_blank" rel="noopener">${u}</a>`:d`<span class="evidence-ref">${u}</span>`} ${h?.mark??m} ${g} ${h?.tip??m} ${f?d`<div class="evidence-note">${Br(rl(f))}</div>`:m} ${h?.body??m}</li>`})}</ol></details>`}function b3(e,t){let r=vt(e);return t?d`<a href="${t}" target="_blank" rel="noopener">${r}</a>`:r}function HP(e,t){if(!t)return m;let r=t.slice(0,7),n=mh(e,t);return n?d`<a href="${n}" target="_blank" rel="noopener" data-tooltip="${t}">${r}</a>`:d`<span title="${t}">${r}</span>`}function T0(e){let t=SE(e);return t?d`<a class="gh-ref-btn" href="${e}" target="_blank" rel="noopener noreferrer" data-tooltip="${t}" aria-label="${`Open ${t} on GitHub`}">${KP}</a>`:m}function GP(e,t,r,n){return`${W(e)}\0${t}\0${r}\0${n?`${n.start}-${n.end}`:""}`}function Xh(e,t){if(vl.key===e)return;let r=vl.host,n=e===null?null:t?.getRootNode?.()?.host??null;vl={key:e,host:n},r?.requestUpdate?.(),n!==r&&n?.requestUpdate?.()}function g3(e,t,r){l.codeBlockTick;let{text:n,lines:o,startLine:i}=AE(e,t);if(o.length===0)return m;let s=r.lastIndexOf("."),a=o0(n,s<0?"":r.slice(s+1)),c=i+o.length-1;return d`<div class="code-preview" style="${Se({"--lineno-width":`${String(c).length}ch`})}"><aside class="code-preview-gutter" aria-hidden="true">${o.map((u,p)=>{let f=i+p,h=!!t&&f>=t.start&&f<=t.end;return d`<div class="${N({"code-preview-lineno":!0,cited:h})}">${f}</div>`})}</aside><pre class="code-preview-source"><code>${a?V(a):n}</code></pre></div>`}function y3(e,t,r,n,o){if(l.bundleHashTick,!r||!n)return null;let i=Yd(r,n);if(!i)return null;let s=Ct(o),a=GP(e,t,n,s),c=l.codePreviews.has(a);l.focusCodeTick;let u=d`<button type="button" class="${N({"code-preview-btn":!0,open:c})}" data-code-preview="${a}" aria-expanded="${String(c)}" aria-label="${c?`Hide the source at ${n}`:`Show the source at ${n}`}" @mouseenter="${h=>{Xh(a,h.currentTarget),hl(r.integrity,i,{reportId:r.reportId})}}" @mouseleave="${h=>{vl.key===a&&Xh(null,h.currentTarget)}}" @focus="${h=>{Xh(a,h.currentTarget),hl(r.integrity,i,{reportId:r.reportId})}}" @blur="${h=>{vl.key===a&&Xh(null,h.currentTarget)}}">${WP}</button>`;if(c){let h=hl(r.integrity,i,{reportId:r.reportId}),g=!h||h.loading?d`<div class="code-preview code-preview-pending">${h?"Loading source\u2026":"Source unavailable"}</div>`:g3(h.content,s,i);return{mark:u,tip:m,body:g}}if(vl.key!==a)return{mark:u,tip:m,body:m};let p=hl(r.integrity,i,{kick:!1,reportId:r.reportId}),f=p&&!p.loading?d`<div class="code-preview-tip" role="tooltip">${g3(p.content,s,i)}</div>`:m;return{mark:u,tip:f,body:m}}function XP(e,t=!1){let r=xe(e)?.flagged===!0,n=r?"Remove flag":"Flag this finding";return d`<button type="button" class="${N({"mark-flag":!0,flagged:r})}" data-flag-toggle="${W(e)}" ?disabled="${!Oe(e)}" aria-label="${n}" aria-pressed="${String(r)}">${Zh}${t?d`<span class="mark-btn-label">${r?"Flagged":"Flag"}</span>`:m}</button>`}function JP(e){let t=lt(e)||e.file||"Security finding";return t.length>120?`${t.slice(0,119)}\u2026`:t}function ZP(e){let t=Tn(e,Tr(e)),r=vt(e),n=[];e.file&&n.push(`File: ${t?`[${r}](${t})`:r}`),e.description&&n.push(e.description);let o=$w(e);return o&&n.push(o),e.confidence!==void 0&&e.confidence!==null&&n.push(`Confidence: ${e.confidence}/10`),n.join(`
112
+
113
+ `)}function QP(e){if(!l.currentWorkspace)return m;let t=e._reportName;if(!t)return m;if(_()&&!e._managedReportId)return m;let r=Qe[et(t)]??Qe.default,n=d`${V(r)}<span class="report-chip-label report-button-label">${Re(t)}</span>`;if(_()){let o=ml(e,{reportId:e._managedReportId});if(o)return d`<a class="report-chip report-button comment-self-ref" href="${Ss(o)}">${n}</a>`}return d`<button type="button" class="report-chip report-button" data-links-report="${t}" data-links-finding="${W(e)}" data-managed-report="${_()?e._managedReportId:m}">${n}</button>`}function v3(e,t,r,n,o=null){let i=o==="table"?m:QP(n),s=xe(n),a=!Oe(n),c=s?.color??null,u=s?.comment??"",p=s?.fix??"",f=_()?"View comments":u?`Edit comment: ${u}`:"Add comment",h=p?`Edit fix link: ${p}`:"Add fix link (PR URL, etc.)",g=o==="focus"&&i===m,b=_()?"Comments":u?"Edit comment":"Comment",y=p?"Edit fix link":"Fix link",k=d`<button type="button" ?disabled="${a}" class="${N({"mark-comment":!0,"has-comment":u})}" data-tooltip="${g&&!u?m:f}" aria-label="${f}">${Jh}${g?d`<span class="mark-btn-label">${b}</span>`:m}</button>`,v=d`<button type="button" ?disabled="${a}" class="${N({"mark-fix":!0,"has-fix":p})}" data-tooltip="${g&&!p?m:h}" aria-label="${h}">${tu}${g?d`<span class="mark-btn-label">${y}</span>`:m}</button>`,x=XP(n,g),$=d`<button type="button" class="mark-copy" data-tooltip="Copy file, line, description, confidence to clipboard" aria-label="Copy finding details to clipboard">${jP}${g?d`<span class="mark-btn-label">Copy</span>`:m}</button>`,C=ml(n)?d`<button type="button" class="mark-link" data-tooltip="Copy a link to this finding" aria-label="Copy a link to this finding">${VP}${g?d`<span class="mark-btn-label">Link</span>`:m}</button>`:m,I=Rh(n),E=BE(I,{title:JP(n),body:ZP(n)}),R=E?d`<a class="mark-issue" href="${E}" target="_blank" rel="noopener" data-tooltip="Create a pre-filled GitHub issue for this finding" aria-label="Create a GitHub issue for this finding">${YP}${g?d`<span class="mark-btn-label">Issue</span>`:m}</a>`:m,z=d`<button type="button" class="mark-claude" data-tooltip="Open in Claude Code (claude://) with a confirm-and-fix prompt" aria-label="Open finding in Claude Code">${qP}${g?d`<span class="mark-btn-label">Claude</span>`:m}</button>`,U=d`<color-marker .selected="${c}" .disabled="${a}"></color-marker>`,B=il(e)!==e,ne=e.linkedTabs?"change triage state for linked findings":B?"change triage state for App and own-source findings":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`<div class="finding-actions">${i}<div class="finding-action-controls"><span class="mark-action-group">${k}${v}${x}</span><span class="mark-action-group">${$}${C}${R}${z}</span>${U}${tN(e,ne,o,r,n)}</div></div>`}function eN(e){if(e.newState!=="open")return;let t=e.currentTarget,n=t.getRootNode().querySelector?.(`[popovertarget="${t.id}"]`);if(!n)return;let o=n.getBoundingClientRect(),i=t.offsetWidth||110,s=t.offsetHeight||100,a=4,c=o.right-i;c<4&&(c=4),c+i>window.innerWidth-4&&(c=window.innerWidth-i-4);let u=o.bottom+a;u+s>window.innerHeight-4&&o.top>s+a&&(u=o.top-s-a),t.style.top=`${u}px`,t.style.left=`${c}px`}function tN(e,t,r,n,o){let i=de(e),s=!Oe(o)||hi(e,n).length===0,a=s?null:qw(e,n,o),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=!!l.shownTriage,f=p?c[l.shownTriage]:null,h=["inprogress","fixed","invalid","deleted","ignored"],b=p&&!(r==="focus")?[{key:"restore",label:"Restore"},...h.filter(v=>v!==l.shownTriage).map(v=>({key:v,label:u[v]}))]:h.map(v=>({key:v,label:u[v]})),y=["mark-triage-menu"];p&&y.push("with-label",`triage-state-${l.shownTriage}`);let k=`triage-menu-${i.replaceAll(/[^A-Za-z0-9_-]/gu,"_")}`;return d`<div class="triage-menu-wrap"><button type="button" class="${y.join(" ")}" popovertarget="${k}" popovertargetaction="toggle" data-tooltip="${t}" aria-label="${t}" ?disabled="${s}">${f?d`<span class="mark-triage-label">${f}</span>`:m} <svg viewBox="0 0 12 12" width="11" height="11" aria-hidden="true"><path d="M2 4l4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg></button><div popover="auto" id="${k}" class="triage-menu" data-gid="${i}" role="menu" @beforetoggle="${eN}">${b.map(v=>d`<button type="button" class="${N({"triage-menu-item":!0,[`triage-menu-${v.key}`]:!0,active:a===v.key})}" data-triage-action="${v.key}" ?disabled="${s}" role="menuitem">${v.label}</button>`)}</div></div>`}function rN(e){let t=!!e?.comment,r=!!e?.fix,n=e?.flagged===!0;return!t&&!r&&!n?m:d`<span class="tab-marks">${t?d`<span class="has-comment" title="Has a comment">${Jh}</span>`:m}${r?d`<span class="has-fix" title="Has a fix link">${tu}</span>`:m}${n?d`<span class="flagged" title="Flagged">${Zh}</span>`:m}</span>`}function w3(e,t,r){let{app:n,source:o}=h6(e),i=s=>nN(s,W(s)===t,r);return d`<div class="tabs">${n.map(i)} ${n.length>0&&o.length>0?d`<span class="tab-level-separator" aria-hidden="true">•</span>`:m} ${o.map(i)}</div>`}function nN(e,t,r){let n=W(e),o=xe(e),i=o?.color,s=Od(e,o),a=["tab",`tab-severity-${ce(e,l.severityMode)}`];t&&a.push("active"),i&&a.push(`tab-mark-${i}`),s==="ignored"&&!r.allIgnored?a.push("tab-ignored"):s&&s!=="ignored"&&r.commonTriage===null&&a.push(`tab-${s}`);let c=wd(e),u=c?Qe[c]:null,p=!u&&e.confidence!=null;u?a.push("tab-with-analyzer"):p&&a.push("tab-with-confidence");let f=u?d`<span class="tab-analyzer" role="img" aria-label="${Rs[c]}">${V(u)}</span>`:p?d`<span class="tab-conf" aria-label="${`Confidence ${e.confidence} out of 10`}">${e.confidence}<span class="tab-conf-max">/10</span></span>`:m;return d`<button type="button" class="${a.join(" ")}" data-tid="${n}" aria-pressed="${t}" aria-description="${i?`${i} color label`:m}"><span class="tab-label"><span class="tab-severity">${A0(e,{variant:"tab"})}</span><span class="tab-indicators">${rN(o)}</span></span>${f}</button>`}function oN(e){if(l.viewMode==="table"||l.viewMode==="focus"){let t=e.confidence*10;return d`<div class="${`conf-ring ${ce(e,l.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"/></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>`}function sN(e){if(Uo(e))return m;let t=e?.name;if(typeof t!="string"||!iN.test(t))return m;let r=e?.version,n=typeof r=="string"&&r.length>0,o=n?`https://www.npmjs.com/package/${t}/v/${encodeURIComponent(r)}`:`https://www.npmjs.com/package/${t}`,i=n?`${t}@${r}`:t;return d`<span class="line-num"><a class="npm-link" href="${o}" target="_blank" rel="noopener noreferrer">npm: ${i}</a></span>`}function aN(e,t,r,n,o,i){let s=W(e),a=xe(e),c=a?.comment??"",u=a?.fix??"",p=Tn(e,Tr(e)),f=b3(e,p),h=Qn(e),g=qd(e),b=y3(e,"loc",g,e.file,e.line),y=T0(p),k=d`<span class="line-num">${h?d`${f}, ${h}`:f}${b?.mark??m}${y}</span>`,v=Ts(e),x=String(e.discoveredIn??"").trim(),$=x===String(e.file??"").trim()?"":x,C=o==="focus"?sN(e.package?.npm):m,I=m;if(o!=="focus"&&_()&&b)I=d`<button type="button" class="finding-code-btn" data-finding-code-report="${g.reportId}" data-finding-code-file="${e.file}" data-finding-code-line="${e.line??""}" aria-label="${`Open full source for ${e.file}`}">Code</button>`;else if(o!=="focus"&&!_()&&e.fileHash&&Array.isArray(e._bundleHashes)&&e._bundleHashes.length>0){l.bundleHashTick;let be=new Set(e._bundleHashes),Wt=bs(e.fileHash).find(({integrity:he})=>be.has(he));Wt&&(I=d`<button type="button" class="finding-code-btn" data-finding-code-bundle="${Wt.integrity}" data-finding-code-file="${Wt.file}" data-finding-code-line="${e.line??""}" data-tooltip="${`Open ${Wt.file} in bundle source viewer`}">Code</button>`)}let{title:E,body:R}=Do(e),z=$a(R),U=z.findIndex(be=>be.label!==null),B=U===-1?z:z.slice(0,U),ne=U===-1?[]:z.slice(U);return d`<div class="${N({"tab-body":!0,active:t})}" data-tid="${s}">${n>1?d`<div class="print-case-label">${r+1} of ${n}</div>`:m}<div class="finding-left">${a?.color||a?.flagged===!0?d`<div class="${a?.color?`finding-top-marks color-${a.color}`:"finding-top-marks"}">${a?.color?d`<span class="finding-color-mark" role="img" aria-label="${`Color label: ${a.color}`}"></span>`:m} ${a?.flagged===!0?d`<span class="finding-bookmark-mark" role="img" aria-label="Bookmarked"></span>`:m}</div>`:m} ${A0(e,{variant:"full"})}<div class="value-label">Severity</div>${e.confidence===void 0?m:oN(e)} ${NP(e)} ${I}</div><div class="finding-body"><div class="line-row">${k} ${b?.tip??m} ${C} ${$?d`<span class="line-num discovered-in">(found analyzing ${$})</span>`:m} ${v?d`<span class="run-meta">${v}</span>`:m}</div>${b?.body??m} ${E?d`<div class="desc-title">${eu(E)}</div>`:m} ${B.map(be=>d`<div class="desc">${Br(rl(be.body))}</div>`)} ${UP(e,o)} ${ne.map(be=>be.label===null?d`<div class="desc">${Br(rl(be.body))}</div>`:Qd(be.label,be.body))} ${e.impact?Qd("Impact",Ft(e.impact,e)):m} ${e.reproduction?Qd("Reproduction",Ft(e.reproduction,e),"section",{collapsible:!0}):m} ${e.recommendation?Qd("Recommendation",Ft(e.recommendation,e),"recommendation",{collapsible:!0}):m} ${e.confidenceReason?d`<div class="conf-reason">${Br(Ft(e.confidenceReason,e))}</div>`:m} ${DP(e)} ${e.revalidateRecommendation&&yw()?Qd("Revalidation recommendation",Ft(e.revalidateRecommendation,e),"recommendation",{collapsible:!0}):m} ${cr(e)&&e.correctedSeverityReason?d`<div class="severity-reason"><span class="severity-reason-label">Severity correction:</span> ${Br(e.correctedSeverityReason)}</div>`:m} ${PP(e,i)} ${_()?Pn(e).map(be=>d`<div class="comment-block">${yl(be,yo(be.body))}</div>`):c?d`<div class="comment-block"><span class="comment-label">Comment:</span> ${yo(c)}</div>`:m} ${u?d`<div class="fix-block"><span class="fix-label">Fix:</span> ${Fe(u)?d`<managed-fix-link .url="${u}"></managed-fix-link>`:u}</div>`:m}</div></div>`}function k3(e){let t=["finding",...I0(e)];return Ln(e).length>1&&t.push("multi-case"),t}function x3(e,t={}){let{context:r=null}=t,n=Ve(e),o=Ln(e),i=new Set(o.map(W)),s=rt(e),a=W(s),c=s.commitHash?d`<div class="commit-ref">introduced in ${HP(s.repo?.github,s.commitHash)}</div>`:m,u=l.currentWorkspace&&c!==m;return d`${o.map((p,f)=>aN(p,W(p)===a,f,o.length,r,i))} ${u?d`<div class="marks-commit-row">${c}</div>`:m}<div class="marks"><div class="marks-left">${u?m:c} ${o.length>1?w3(o,a,n):m}</div>${v3(e,o,n,s,r)}</div>`}function I0(e){let t=Ve(e),r=e.some(o=>o.critical||ce(o,l.severityMode)==="critical"),n=[];return r&&n.push("is-critical"),t.hasConflict?n.push("has-conflict"):t.commonColor&&n.push(`mark-${t.commonColor}`),l.shownTriage&&n.push(`triage-${l.shownTriage}`),n}function $3(e){let t=Ve(e),r=Ln(e),n=rt(e),o=W(n),i=n,s=lt(i),a=Ts(i),c=Qn(i),u=c?`, ${c}`:"",p=Tn(i,Tr(i));return d`<div class="row-score">${A0(i,{variant:"compact"})} ${i.confidence===void 0?m:d`<span class="row-conf"><strong>${i.confidence}</strong>/10</span>`}</div><div class="row-body"><div class="title-row"><span class="title">${s}</span> ${a?d`<span class="row-type">${a}</span>`:m}</div><div class="meta-row"><span class="row-loc">${b3(i,p)}${u}</span> ${T0(p)}<div class="marks">${v3(e,r,t,n,"table")}</div></div>${r.length>1?d`<div class="tabs-row">${w3(r,o,t)}</div>`:m}</div>`}var m3,Jh,tu,jP,VP,WP,KP,vl,qP,YP,Zh,iN,wl=w(()=>{"use strict";T();Ne();Gn();qe();D();Cs();pe();ct();M6();Vh();Hh();en();ft();wi();bl();qh();Yh();Yh();m3=/\[[^\]\n]+\]\([^)\s]+\)|\*\*[^*\n]+\*\*|"[^"\n]+"|`[^`\n]+`/gu;Jh=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>`,tu=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>`,jP=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>`,VP=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>`,WP=d`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"><path d="M4.4 4.6 1.3 8l3.1 3.4"/><path d="m11.6 4.6 3.1 3.4-3.1 3.4"/><path d="M9.8 2.6 6.2 13.4"/></g></svg>`,KP=V(ni);vl={key:null,host:null};qP=d`<svg viewBox="4 5 8 8" width="11" height="11" fill="currentColor" aria-hidden="true"><path d="${Zf}"/></svg>`,YP=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>`,Zh=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>`;iN=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/iu});function ru(e){return"tree-"+e.replaceAll(/[^\w-]+/gu,"_")}function L0(e,t){let r=new Map;for(let n of e)for(let o of n){r.has(o.file)||r.set(o.file,S3());let i=r.get(o.file),s=ce(o,t);i[s]!==void 0&&i[s]++}return r}function F0(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 i=new Set(t[n].imports);for(let s of o.imports??[])i.has(s)||(i.add(s),t[n].imports.push(s));t[n].size==null&&o.size!=null&&(t[n].size=o.size)}}return t}function Qh(e,t){let r=Object.keys(e),n=new Map(r.map((c,u)=>[c,u])),o=r.map(()=>S3()),i=r.map(()=>[]);for(let[c,u]of r.entries())for(let p of e[u].imports??[]){let f=n.get(p);f!==void 0&&i[f].push(c)}let s=new Uint32Array(r.length),a=0;for(let[c,u]of t){let p=n.get(c);if(p===void 0||!u)continue;let f=Le.map(y=>[y,u[y]??0]).filter(([,y])=>y!==0);if(f.length===0)continue;let h=++a,g=[],b=y=>{s[y]!==h&&(s[y]=h,g.push(y))};for(let y of i[p])b(y);for(;g.length>0;){let y=g.pop();for(let[k,v]of f)o[y][k]+=v;for(let k of i[y])b(k)}}return new Map(r.map((c,u)=>[c,o[u]]))}function B0(e,t,r){let n=t.get(e),o=r.get(e);return _3(n)>0||_3(o)>0}function _3(e){if(!e)return 0;let t=0;for(let r of Le)t+=e[r]??0;return t}var S3,nu=w(()=>{"use strict";pe();S3=()=>Object.fromEntries(Le.map(e=>[e,0]))});function C3(e){if(!e)return m;let t=bs(e)[0];return t?d`<button type="button" class="tree-code-btn" data-finding-code-bundle="${t.integrity}" data-finding-code-file="${t.file}" data-tooltip="${`Open ${t.file} in bundle source viewer`}">Code</button>`:m}function E3(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=l.filesSearch.trim().toLowerCase(),i=o?r.filter(p=>p.toLowerCase().includes(o)):r,s=p=>e[p]?d`<a href="${`#${ru(p)}`}"><span class="name">${p}</span></a>`:d`<span class="name">${p}</span>`,a=p=>{let f=t.get(p);if(!f)return null;let h=Le.filter(g=>(f[g]??0)>0);return h.length===0?null:d`<span class="tree-count-chips">${h.map(g=>d`<span class="${`tree-count-chip ${g}`}">${f[g]} ${g.replaceAll("_"," ")}</span>`)}</span>`},c=p=>{let f=t.get(p);return f?Le.reduce((h,g)=>h+(f[g]??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">${i.length} of ${r.length}</span></div></div>`;if(l.filesViewMode==="table"){let p=l.filesSelectedFile&&e[l.filesSelectedFile]&&i.includes(l.filesSelectedFile)?l.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">${i.length===0?d`<div class="tree-table-empty">No files match the search.</div>`:m} ${i.map(g=>{let b=c(g),y=g===p,k=ye(e[g].size);return d`<div class="${`tree-table-row${y?" selected":""}${b===0?" clean":""}`}" data-tree-select="${g}"><span class="tree-table-name">${g}</span> ${a(g)??d`<span class="tree-table-clean-marker">—</span>`} ${k?d`<span class="tree-table-size">${k}</span>`:m}</div>`})}</div>${p?d`<aside class="tree-table-details" id="tree-table-details"><header class="tree-table-details-bar"><span class="tree-table-details-label">Details</span> <button type="button" class="tree-table-details-close" data-tree-deselect aria-label="Close details">×</button></header><div class="tree-table-details-body">${lN(e[p],p,n.get(p)??[],s)}</div></aside>`:m}</div></div>`}return d`<div class="tree-view">${u} ${i.length===0?d`<div class="tree-table-empty">No files match the search.</div>`:m} ${i.map(p=>{let f=e[p],h=n.get(p)??[],g=ye(f.size);return d`<section class="tree-file" id="${ru(p)}"><div class="tree-file-header"><span class="name">${p}</span> ${a(p)} ${g?d`<span class="tree-file-size">${g}</span>`:m} ${C3(f.fileHash)}</div>${R3(f,h,s)}</section>`})}</div>`}function R3(e,t,r){return d`${e.fileHash||e.treeHash?d`<div class="tree-hashes hashes">${e.fileHash?d`<div class="tree-hash">file: ${e.fileHash}</div>`:m} ${e.treeHash?d`<div class="tree-hash">tree: ${e.treeHash}</div>`:m}</div>`:m} ${e.imports?.length>0?d`<div class="tree-section"><span class="tree-section-label">imports</span><ul>${e.imports.map(n=>d`<li>${r(n)}</li>`)}</ul></div>`:m} ${t.length>0?d`<div class="tree-section"><span class="tree-section-label">imported by</span><ul>${t.map(n=>d`<li>${r(n)}</li>`)}</ul></div>`:m} ${e.exports?.length>0?d`<div class="tree-section"><span class="tree-section-label">exports</span><ul>${e.exports.map(n=>d`<li><span class="name">${n}</span></li>`)}</ul></div>`:m}`}function lN(e,t,r,n){let o=ye(e.size);return d`<div class="tree-detail-name"><span class="name">${t}</span> ${o?d`<span class="tree-detail-size">${o}</span>`:m} ${C3(e.fileHash)}</div>${R3(e,r,n)}`}var M3=w(()=>{"use strict";T();D();pe();nu()});function kl(){return A3}function cN(){return ou||(ou=(async()=>{let e="./graph.js";try{let t=await import(e);return t._swapGraph2Impl(A5()),A3=t,t}catch(t){throw ou=null,t}})(),ou)}async function O0(e,t,r,n,o){try{let i=await cN(),s=i.buildGraphFromPrep(t);se(d`<graph-layout .graph="${s}" .options="${r}"></graph-layout>`,e);let a=e.querySelector("graph-layout");return await a.updateComplete,n(),o(),i.attachGraph2Interaction(e,s,n,o),a}catch(i){let s=i instanceof Error?i.message:String(i);return e.textContent=`Graph failed to load: ${s}`,null}}var ou,A3,P0=w(()=>{"use strict";T();ao();ou=null,A3=null});function T3(){ki=null}function dN(){return iu||(iu=(async()=>{let e="./terminal.js";try{return await import(e)}catch(t){throw iu=null,t}})(),iu)}function uN(e){let t=On(e);if(t.size===0)return t;let r=[...t.keys()],{stripped:n}=hr(r),o=new Map;for(let i=0;i<r.length;i++)o.set(n[i],t.get(r[i]));return o}async function I3(e,t){let r=t?.integrity??"";(!ki||ki.integrity!==r||(t?.managedId||ki.managedId)&&ki.details!==t)&&(ki={integrity:r,managedId:t?.managedId,details:t?.managedId?t:null,promise:pN(t,r)});try{let n=await ki.promise;return!e.isConnected||e.contains(n)||e.replaceChildren(n),n}catch(n){ki=null;let o=n instanceof Error?n.message:String(n);return e.textContent=`Terminal failed to load: ${o}`,null}}async function pN(e,t){return(await dN()).createTerminalElement(uN(e),t)}var iu,ki,N0=w(()=>{"use strict";on();pe();iu=null,ki=null});function L3(e){if(!e)return null;let t=xE(),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):"/"}function mN(){if(typeof document>"u")return!1;let e=document.body?.classList;return!!e&&(e.contains("theme-light")||e.contains("theme-pink"))}function er(e){let t=mN(),r=t?hN:fN,n=e??"__own__",o=`${t?"l":"d"}:${n}`;if(D0.has(o))return D0.get(o);let i=0;for(let u of n)i=i*37+u.codePointAt(0)|0;let a=((i%r.length+r.length)%r.length*7+3)%r.length,c=r[a];return D0.set(o,c),c}var fN,hN,D0,Ns=w(()=>{"use strict";pe();fN=["#4e9af1","#f28e2b","#59a14f","#e15759","#76b7b2","#edc948","#b07aa1","#ff9da7","#9c755f","#5cd1e5","#f1ce63","#d37295","#a0cbe8","#86bcb6","#8cd17d","#b6992d","#499894","#e15759","#e879c7","#d4a6c8"],hN=["#2f8aef","#d2691e","#2ea043","#e63946","#2e9a92","#b88817","#9560e8","#d24a9c","#8a5d40","#0891b2","#a07a14","#c14e8e","#1f7ad0","#549b94","#3fb95f","#a07a14","#2a8278","#cb2c40","#c026d3","#965f93"];D0=new Map});var z0,F3=w(()=>{z0=(e,t,r)=>{for(let n of t)if(n[0]===e)return(0,n[1])();return r?.()}});var B3=w(()=>{F3()});var We,Or=w(()=>{We=`.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}
114
+ `});function O3({name:e,workspaceNames:t,existingNames:r}={}){let n=r instanceof Set?r:new Set(r??[]);return new Promise(o=>{let i=document.createElement("import-conflict-dialog");Object.assign(i,{reportName:e??"",workspaceNames:Array.isArray(t)?t:[],existingNames:n,_newName:bN(e??"",n)}),i.addEventListener("resolve",s=>{i.remove(),o(s.detail)}),i.addEventListener("modal-conflict",()=>{i.remove(),o({action:"cancel"})}),document.body.append(i)})}function bN(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):"",i=n.replace(/-\d+$/u,"");for(let s=2;s<1e3;s++){let a=`${i}-${s}${o}`;if(!t.has(a))return a}return""}var U0,P3=w(()=>{"use strict";T();ue();Or();U0=class extends F{static styles=[...F.styles,A(We)];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._renameError(t)!==null)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>`}_renameError(t){return t?t===this.reportName?"Pick a name different from the original.":t.includes("\0")?"The new name cannot contain a NUL byte.":t.includes("/")||t.includes("\\")?'The new name cannot contain "/" or "\\".':this.existingNames.has(t)?`A file named "${t}" already exists \u2014 pick something else.`:null:"Enter a new name."}render(){let t=this._choice==="rename",r=(this._newName??"").trim(),n=t?this._renameError(r):null,o=n!==null,i=t?"Rename":"Replace",s=t?"primary":"danger",a=this.workspaceNames.length>0?d`<span class="lwd-option-hint">Saved as an unfiled report — the renamed copy isn't added to any workspace.</span>`:m;return d`<dialog @close="${this._onClose}"><header><h3>Import conflict</h3></header><p class="lwd-body"><strong>"${this.reportName}"</strong> already exists with different content.</p><fieldset class="lwd-choice"><legend>What should happen?</legend><label class="lwd-option"><input type="radio" name="icd-choice" value="replace" ?checked="${this._choice==="replace"}" @change="${this._onChoiceChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Replace</span> ${this._replaceHint()}</span></label> <label class="lwd-option"><input type="radio" name="icd-choice" value="rename" ?checked="${this._choice==="rename"}" @change="${this._onChoiceChange}"> <span class="lwd-option-text"><span class="lwd-option-title">Rename to</span> <input type="text" class="nwd-input lwd-rename-input" maxlength="200" .value="${this._newName}" ?disabled="${!t}" @input="${this._onNewNameInput}" @keydown="${this._onNewNameKeydown}" @focus="${()=>{this._choice="rename"}}"> ${a} ${n===null?m:d`<p class="lwd-rename-error">${n}</p>`}</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="${o}" @click="${this._onConfirm}">${i}</button></footer></dialog>`}};customElements.define("import-conflict-dialog",U0)});function H0(e,t){let r=e.trimStart().startsWith("[")?yn(e):null;if(r)return{data:{source:"links",findings:[],links:r.groups},format:"links",reason:null};let n=ro(e);if(n.data!=null||Gp(e,t)!=="codex")return n;try{return{data:{type:"security",source:"codex-security",findings:Ac(e).flatMap(i=>i.data.findings)},format:"codex",reason:null}}catch(o){return{data:null,format:null,reason:o instanceof Error?o.message:"Invalid Codex CSV"}}}function N3(e,t){let r=H0(e,t);return r.data==null?Promise.resolve(null):Xt(JSON.stringify(r.data))}var j0=w(()=>{"use strict";ga();Ee()});async function D3(e){let t=await Ef(e),r=await Av(t);if(r.kind==="reports")return{kind:"reports",reports:r.reports};let n;if(r.kind==="encrypted"){if(n=await ih({tryPassword:i=>Rf(t,i)}),!n)return null}else n=Va(r.text);let o=await Rv(n,{conflictResolver:async(i,s)=>{try{return await nl(i,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 a=i.length;return alert(`Imported ${e.name}. Kept your local triage on ${a} conflicting entr${a===1?"y":"ies"} because another dialog is open \u2014 re-drop the file to pick again.`),null}}});return(l.currentFile||l.currentWorkspace)&&S(),{kind:"workspace",workspace:o}}var z3=w(()=>{"use strict";D();zt();Ad();fw()});function em(){return le("passkey-setup-dialog")}var V0,W0=w(()=>{"use strict";T();D();ue();Ms();V0=class extends F{static styles=[...F.styles,A(Mr)];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=ac(),this._vaultStateUnsub=Je(()=>{if(this._settled)return;let t=ac();this._orphan&&!t&&fe()?(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(fe()){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 cc({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(!pn()){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 Kg({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 Xg({seal:r}),this._phase="Encrypting triage data\u2026",await av({seal:r}),this._phase="Encrypting report files\u2026",await ny({seal:r}),this._phase="Encrypting bundles\u2026",await iy({seal:r})}})&&(this._success=!0,this._phase="")}catch(t){t?.name==="AbortError"?this._error="":this._error=t?.message??String(t),this._phase=""}finally{this._busy=!1,this._canCancel=!0,this._abortController=null}}};_body(){if(this._orphan)return d`<p class="wsl-error">DeepView found an abandoned passkey setup on this device. The original passkey can no longer be accessed, so any local data still encrypted under it is <strong>unreadable</strong> and cannot be recovered.</p><p class="nwd-note">To enable encryption, DeepView will <strong>permanently delete ALL local DeepView data on this device</strong> — including any plaintext workspaces or reports you may have added after the previous passkey was lost — and then register a fresh passkey. This is irreversible. There is no backup.</p><label class="wsl-ack"><input type="checkbox" data-role="orphan-ack" .checked="${this._orphanAck}" ?disabled="${this._busy}" @change="${this._onOrphanAckInput}"> <span>I understand all local DeepView data on this device will be deleted.</span></label> ${this._phase?d`<p class="nwd-note">${this._phase}</p>`:m} ${this._error?d`<p class="wsl-error">${this._error}</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" ?disabled="${this._busy&&!this._canCancel}" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${this._busy||!this._orphanAck}" @click="${this._onWipeOrphan}">${this._busy?"Working\u2026":"Wipe and continue"}</button></footer>`;if(this._success)return d`<p class="nwd-note"><strong>Encryption is on.</strong> Your triage data and report files are now sealed under your passkey. You'll be asked to unlock with the passkey on every fresh load.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" class="primary" @click="${()=>this._finish(!0)}">Close</button></footer>`;let t=pn();return d`<p class="nwd-note">Passkey encryption protects your local triage and report data with a hardware-backed key (TouchID, Windows Hello, security key). Without the passkey, the data on disk is unreadable — even to scripts running on this origin.</p><p class="wsl-error"><strong>If you lose access to this passkey, your data CANNOT be recovered.</strong> DeepView has no backup key, no recovery code, and no escrow. Make sure your passkey is backed up (iCloud Keychain / Google Password Manager sync, or a second registered device) before relying on encryption for important data.</p><p class="nwd-note"><strong>Opt-in.</strong> You can disable encryption later from the lock icon in the sidebar header — the data is rewritten as plaintext and DeepView signals your authenticator to remove the passkey (where supported).</p>${t?m:d`<p class="wsl-error">Your browser doesn't expose the WebAuthn passkey API. Try Chrome, Safari, Edge, or Firefox in a recent version on a device with a platform authenticator.</p>`} <label class="wsl-field"><span>Passkey label</span> <input type="text" class="nwd-input" data-role="name" placeholder="DeepView" maxlength="200" .value="${this._userName}" @input="${this._onNameInput}"></label> ${this._phase?d`<p class="nwd-note">${this._phase}</p>`:m} ${this._error?d`<p class="wsl-error">${this._error}</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" ?disabled="${this._busy&&!this._canCancel}" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!t||this._busy}" @click="${this._onEnable}">${this._busy?"Working\u2026":"Enable encryption"}</button></footer>`}render(){return d`<dialog @close="${this._onClose}" @cancel="${this._onDialogCancel}"><header><h3>${this._success?"Encryption enabled":this._orphan?"Previous passkey setup detected":"Enable passkey encryption"}</h3></header>${this._body()}</dialog>`}};customElements.define("passkey-setup-dialog",V0)});function yN(){try{return localStorage.getItem(H3)==="1"}catch{return!1}}function U3(){try{localStorage.setItem(H3,"1")}catch{}}async function tm(){if(fe()||!pn()||yN())return;if(!confirm(`Encrypt your DeepView data with a passkey?
115
+
116
+ 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.
117
+
118
+ You can change this anytime from the lock icon in the sidebar header.`)){U3();return}await em(),fe()&&U3()}var H3,K0=w(()=>{"use strict";D();W0();H3="deepview.passkey.firstImportPrompted"});function rm(){return le("passkey-unlock-dialog")}var G0,q0=w(()=>{"use strict";T();D();ue();Ms();G0=class extends F{static styles=[...F.styles,A(Mr)];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 Yi({signal:this._abortController.signal})){this._finish(!0);return}this._error=""}catch(t){this._error=t?.message??String(t)}finally{this._busy=!1,this._abortController=null}}};render(){return d`<dialog @close="${this._onClose}"><header><h3>Unlock your data</h3></header><p class="nwd-note">Your triage data and report files are encrypted with a passkey on this device. Unlock to load them.</p>${this._error?d`<p class="wsl-error">${this._error}</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">${this._busy?"Cancel":"Later"}</button> <button type="button" class="primary" ?disabled="${this._busy}" @click="${this._onUnlock}">${this._busy?"Waiting\u2026":"Unlock with passkey"}</button></footer></dialog>`}};customElements.define("passkey-unlock-dialog",G0)});function nm({workspaceId:e,items:t}={}){return le("sync-download-dialog",{workspaceId:e??"",items:Array.isArray(t)?[...t]:[]})}var Y0,X0=w(()=>{"use strict";T();D();Qr();xi();ue();Or();co();Y0=class extends F{static styles=[...F.styles,A(We)];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:[]});_fail(t,r,n,o){t.push({kind:n,identifier:r.identifier,reason:o}),this._errors=[...this._errors,{label:di(r),reason:o}]}_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 i=await VC(this.workspaceId,n.identifier);if(!i.ok){this._fail(r,n,"bundle",i.reason??"unknown");continue}await vs(n.identifier,this.workspaceId),t.push({kind:"bundle",identifier:n.identifier});continue}let o=await jC(this.workspaceId,n.identifier);if(!o||!o.ok){this._fail(r,n,"report",o?.reason??"sync is not available");continue}t.push({kind:"report",identifier:n.identifier})}catch(o){this._fail(r,n,n.kind,o?.message??String(o))}if(this._running=!1,this._done=!0,t.some(n=>n.kind==="report"))try{l.currentWorkspace===this.workspaceId&&await Pr(this.workspaceId)}catch{}r.length===0&&this._finish({downloaded:t,failed:r})};render(){let{count:t,singular:r,kindLabel:n}=bh(this.items),o=r?d`Download <strong>"${di(this.items[0])}"</strong> from the workspace's remote inventory?`:d`Download <strong>${t}</strong> remote ${n} into this workspace?`,i=r?m:yh(this.items),s=this._running?r?"Downloading\u2026":`Downloading ${t} ${n}\u2026`:r?"Download":`Download ${t}`;return d`<dialog @close="${this._onClose}"><header><h3>Download from remote</h3></header><p class="lwd-body">${o}</p>${i} ${vh(this._errors)}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}" ?disabled="${this._running}">${this._done&&this._errors.length>0?"Close":"Cancel"}</button> ${this._done&&this._errors.length>0?m:d`<button type="button" data-role="download" @click="${this._onDownload}" ?disabled="${this._running||t===0}">${s}</button>`}</footer></dialog>`}};customElements.define("sync-download-dialog",Y0)});function V3(e){j3=e}function Ds(){vo?.controller.abort(),vo=null}function vN(e,t,r){let{promise:n,resolve:o}=Promise.withResolvers(),i=!1,s=p=>{clearTimeout(u),t.removeEventListener("abort",a),o(p)},a=()=>s(!1),c=()=>(!i&&!t.aborted&&(i=!0,clearTimeout(u),Promise.resolve().then(()=>r()&&e(t)).then(p=>s(!!p&&r()),()=>s(!1))),n),u=setTimeout(c,1e3);return t.addEventListener("abort",a,{once:!0}),t.aborted&&a(),{promise:n,start:c}}function W3(e,t){return t.aborted?Promise.resolve(!1):new Promise(r=>{let n=i=>{t.removeEventListener("abort",o),r(i)},o=()=>n(!1);t.addEventListener("abort",o,{once:!0}),e.then(n,()=>n(!1))})}function $i({catalogOnly:e=!1,hydrate:t}={}){let r=l.managedSession,n=Es(),i=["findings","files","links"].includes(l.currentView)&&(!e||vo?.teamId===l.currentManagedTeam&&!vo.signal.aborted)?l.currentManagedTeam:null;if(!_()||!r||r.role==="none"||r.publicShare&&!i)return Ds(),t?Promise.resolve(!1):void 0;let s=JSON.stringify([i,r.id,r.role,r.csrfToken,!!r.publicShare]);if(vo?.key!==s||vo.signal.aborted){Ds();let g=new AbortController,b={key:s,controller:g,signal:g.signal,teamId:i,version:0,target:null};b.current=(y=b.signal)=>!y.aborted&&!b.signal.aborted&&vo===b&&_()&&l.managedSession?.id===r.id&&l.managedSession?.role===r.role&&l.managedSession?.csrfToken===r.csrfToken&&!!l.managedSession?.publicShare==!!r.publicShare,vo=b,wN(b)}let a=vo;if(e||!i)return a.target?.ready;let c=Wi(l.reports),u=a.target;if(u?.view===n&&u.reports===c&&!u.signal.aborted)return u.ready;u?.controller.abort();let p=new AbortController,f=AbortSignal.any([p.signal,a.signal,n]),h={controller:p,signal:f,view:n,reports:c,version:u?.reports===c?u.version:0};return a.target=h,h.current=()=>a.current()&&!f.aborted&&a.target===h&&l.currentManagedTeam===i&&Wi(l.reports)===c,h.hydration=t?vN(async g=>{let b=a.version,y=await t(g);return y&&h.current()&&(h.version=b),y},f,h.current):null,h.ready=h.hydration?.promise,(a.version||a.finished)&&(h.hydration?h.hydration.start():h.version<a.version&&J0(a,h,a.signal).then(g=>(!g&&h.current()&&(Ds(),$i()),g))),h.ready}function wN(e){let{signal:t,controller:r,current:n}=e;h5(e.teamId,{signal:t,onTeams:async(o,i)=>{let s=()=>n(o);return s()?await j3(s,o,i)&&s():!1},onUpdate:o=>n(o)?(e.version++,J0(e,e.target,o)):!1,onClose:()=>{n()&&document.dispatchEvent(new Event("managed-feed-closed")),r.abort()}}).catch(o=>{n()&&console.warn("managed: team feed failed",o)}).finally(()=>{e.finished=!0,n()&&e.target?.hydration?.start()})}async function J0(e,t,r){if(!e.current(r))return!1;if(!t?.current())return!0;if(!t.refresh||t.refresh.controller.signal.aborted){let a=new AbortController,c={controller:a,promise:null},u=AbortSignal.any([a.signal,t.signal]);t.refresh=c,c.promise=kN(e,t,u).catch(()=>!1).finally(()=>{t.refresh===c&&(t.refresh=null)})}let n=t.refresh,o=AbortSignal.any([r,t.signal,n.controller.signal]),i=()=>n.controller.abort();r.addEventListener("abort",i,{once:!0});let s;try{s=await W3(n.promise,o)}finally{r.removeEventListener("abort",i)}return e.current(r)?t.current()?s?t.version<e.version?J0(e,t,r):!0:!1:!0:!1}async function kN(e,t,r){if(t.hydration&&!await W3(t.hydration.start(),r))return!1;for(;t.current()&&!r.aborted&&t.version<e.version;){let n=e.version;for(let o of l.managedReports)if(t.reports.some(i=>i._managedReportId===o.id)&&(!await Q0(o.id,{signal:r})||!t.current()||r.aborted||!await gl(o.id,{signal:r})))return!1;if(!t.current()||r.aborted)return!1;t.version=n}return!r.aborted&&t.current()}var vo,j3,Z0=w(()=>{"use strict";D();rc();Zt();bl();om();Za();vo=null,j3=()=>Promise.resolve(!0)});function ek(e){if(e.linkedTabs)return e.linkedTabs;let t=e.filter(r=>Te(r)==="revalidation");return t.length>0?t:e}function tk(e,t=()=>[]){let{groups:r,conflicts:n}=_h(e,{hideRuledOut:!0});if(n.size>0)return{appMode:!1};let o=Eh(r,t,ek);return Iw(o,{tabs:ek,kindOf:Te,severityMode:"corrected"})?{appMode:!0,appFindings:o.filter(i=>ek(i).some(s=>s.isApp)).length}:{appMode:!1}}var K3=w(()=>{"use strict";Ee();tn();Uw();jw()});function G3(e,t,r,{complete:n,isCurrent:o}){Nr={id:e.id,membership:JSON.stringify(e.reports.toSorted()),reports:t,token:r,complete:n,isCurrent:o}}function q3(e){return!Nr||Nr.id!==e.id||!Nr.isCurrent()||Nr.membership!==JSON.stringify(e.reports.toSorted())||!Hv(e,Nr.token)?null:(Nr.linksRevision!==rk&&(Nr.metadata=Nr.complete?tk(Nr.reports,pr):{appMode:!1},Nr.linksRevision=rk),Nr.metadata)}async function Y3(e,t,r,{complete:n,isCurrent:o,onReady:i}){if(!o()||(await sd(),!o()))return;let s=await ud(e,r);if(!s||!o())return;let a=n?tk(t,pr):{appMode:!1};await Vv(e,a,s)&&o()&&await i(a)}var Nr,rk,nk=w(()=>{"use strict";D();K3();Nr=null,rk=0;ws(()=>{rk++})});function Si(e,t="overview"){if(_()){let n=l.bundles.find(o=>o.integrity===e);Ie.replaceRoute(Ja(l.managedTeams,n,l.currentManagedTeam,t));return}let r=t&&t!=="overview"&&gn.has(t)?` ${t}`:"";st(_i,`b:${e}${r}`).catch(()=>{})}function xN(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(e,0)})}async function su(e){return await xN(),e!==null&&ge(e)?!1:(S(),x0(l.reports.flatMap(t=>t.bundleHashes??[]),()=>e===null||!ge(e)).catch(()=>{}),!0)}function sm(){L.selected=null,L.focusedPkg=null,L.layoutCache=null,L.solo=null,L.hidden.clear(),L.pathFilter="",Ye()}function lu(e){for(let t of Q.openSessions)t&&!e.has(t.workspaceId)&&(Q.closeSession(t.workspaceId),Yv(t.workspaceId))}function im(){P.classList.remove("active"),P.replaceChildren(),Ge.classList.remove("hidden"),document.title="DeepView"}function X3(e){return e instanceof DOMException&&e.name==="NotFoundError"||typeof e?.message=="string"&&e.message.startsWith("File not found:")}function ik(e){let t=J3(e.toLowerCase());return t.endsWith(".map")?"sourcemap":t==="stasis.code.br"||t.endsWith(".stasis.code.br")?"stasis":null}function J3(e){return e.replace(/ \(\d+\)(?=\.[^.]*$)/u,"")}async function ok({name:e,content:t,existingNames:r}){if(!r.has(e))return await Sr(e,t),r.add(e),{name:e,content:t};let n;try{n=await ze(e)}catch(c){if(!X3(c))throw c;return await Sr(e,t),r.add(e),{name:e,content:t}}if(n===t)return{name:e,content:t};let i=J().filter(c=>Array.isArray(c.reports)&&c.reports.includes(e)).filter(c=>Ga(c.id,e)),s=await O3({name:e,workspaceNames:i.map(c=>c.name),existingNames:r});if(s.action==="cancel")return null;if(s.action==="rename"){let c=s.newName;return await Sr(c,t),r.add(c),{name:c,content:t}}let a;if(i.length>0)try{a=await WC(e)}catch(c){console.warn(`Import: couldn't announce the replace of "${e}" to sync:`,c)}try{await Sr(e,t),i.length>0&&await _N(e,i)}finally{typeof a=="function"&&a()}return{name:e,content:t}}async function $N(e,t){let r=typeof t?.github=="string"?t.github:"";if(r)try{await lb(e,r)}catch(n){console.warn(`Import: failed to adopt the repository "${r}" for "${e}":`,n)}}async function _N(e,t){let r;try{r=await Wo(e)}catch(n){console.warn(`Import: failed to read freshly-saved "${e}" for cloud sync:`,n);return}for(let n of t)try{await hd(n.id);let o=await Of(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 sk(e){if(e=[...e],e.length===0||(await ht(),_())||(await tm(),_()))return;let t=null,r=null,n=new Set,o=new Set(await me()),i=[];for(let s of e)try{let a=J3(s.name.toLowerCase());if(a.endsWith(".gz")||a.endsWith(".deepview-workspace.enc")){let p=await D3(s);if(p?.kind==="reports")for(let f of p.reports){if(typeof f?.name!="string"||!f.name||typeof f?.content!="string")continue;let h=Nt(f.content);if(!h.recognized){i.push(f.name);continue}let g=await ok({name:f.name,content:f.content,existingNames:o});g&&(Pt(g.name,h.count,h.source),await $N(g.name,f.repo),t={name:g.name,content:g.content})}try{let f=await me();o.clear();for(let h of f)o.add(h)}catch(f){console.warn("Import: failed to refresh existingNames after workspace import:",f)}continue}if(ik(s.name)){let p=new Uint8Array(await s.arrayBuffer()),{integrity:f}=await ps(s.name,p);r=f,n.add(f);continue}let u=await s.text();if(Gp(u,a)==="codex"){let p=Ac(u);for(let{displayName:f,data:h}of p){let g=f.replaceAll("/","__")+".codex",b=JSON.stringify(h),{count:y,source:k}=Nt(b),v=await ok({name:g,content:b,existingNames:o});v&&(Pt(v.name,y,k),t={name:v.name,content:v.content})}}else{let p=Nt(u);if(!p.recognized)throw new Error("not a recognized DeepView, DeepSec, Piolium, Claude Security, or Codex report, and not a links file");let f=await ok({name:s.name,content:u,existingNames:o});if(!f)continue;Pt(f.name,p.count,p.source),t={name:f.name,content:f.content}}}catch(a){alert(`Failed to load ${s.name}: ${a.message}`)}if(i.length>0){let s=i.length;alert(`Skipped ${s} report${s===1?"":"s"} no parser recognised: ${i.join(", ")}`)}await K(),t?await tr(t.name,t.content):r&&(ho(r),Si(r,l.bundleDetailsTab),S(),await K(),mo(r)),x0(n).catch(()=>{})}async function tr(e,t,{workspaceId:r}={}){if(_())return;let n=St();l.currentManagedTeam=null,l.currentManagedReport=null,l.currentReportWorkspace=yi(e,r);let o=new Set(J().filter(s=>Array.isArray(s.reports)&&s.reports.includes(e)).map(s=>s.id));if(lu(o),l.reports=[],mi(),l.workspaceMerges=[],l.revalidateConflicts=new Map,l.currentFile=e,l.currentWorkspace=null,l.currentLinks=null,l.managedReport=null,l.managedReports=[],l.managedComments.clear(),l.currentView!=="findings"&&l.currentView!=="files"&&(l.currentView="findings"),l.repoUrl=It(e),l.repoEditing=!1,sm(),st(_i,yf(e,l.currentReportWorkspace)).catch(()=>{}),t===void 0){try{t=await ze(e)}catch(s){if(ge(n))return;if(s&&s.message?.includes("vault locked")){if(await rm()&&!ge(n)){await tr(e);return}ge(n)||(l.currentFile=null,await K());return}if(X3(s)){let a=J().find(c=>Array.isArray(c.reports)&&c.reports.includes(e)&&Ga(c.id,e));if(a)try{if(await hd(a.id),ge(n))return;let c=await nm({workspaceId:a.id,items:[{kind:"report",identifier:e}]});if(ge(n))return;if(c?.downloaded?.some(u=>u.kind==="report"&&u.identifier===e)){await tr(e);return}}catch(c){if(console.warn(`Re-download prompt for missing "${e}" failed:`,c),ge(n))return}ge(n)||(l.currentFile=null,await K());return}alert(`Failed to read ${e}: ${s.message}`),l.currentFile=null,await K();return}if(ge(n))return}let i=yn(t);if(i?(l.currentLinks={name:e,...i},l.currentView="links",S()):await lm(e,t,n),!ge(n)){for(let s of o)Q.openSession(s),Q.refreshSession(s),hd(s);return await K(),!0}}async function wo(e,t=null,{history:r=!0}={}){if(!_()||!e||!Array.isArray(e.reports))return!1;if(r&&Ie.active)return Ie.navigate(bt({view:"findings",teamId:e.id,reportId:t},l.managedTeams));if(t!==null&&!e.reports.some(u=>u.id===t))return!1;let n=St(),o=await Hf(e.id);if(ge(n))return!1;if(t5(),o===null||t!==null&&!o.some(u=>u.id===t))return _t("Could not load all team reports. Please try again."),!1;let i=o.find(u=>u.id===t&&u.data.source==="links"&&Array.isArray(u.data.links)),s=o.filter(u=>t===null||i||u.id===t),a=s.filter(u=>u.data.source!=="links"||!Array.isArray(u.data.links));lu(new Set);let c=document.createElement("p");c.setAttribute("role","status"),c.textContent="Loading report triage\u2026",P.replaceChildren(c),P.classList.add("active"),Ge.classList.add("hidden"),l.currentView="findings",l.reports=[],mi(),l.workspaceMerges=[],l.revalidateConflicts=new Map,l.currentFile=t===null?null:o.find(u=>u.id===t).filename,l.currentWorkspace=t===null?`managed-team:${e.id}`:null,l.currentManagedTeam=e.id,l.currentManagedReport=t,t2(e.id,o),l.managedReports=s.map(u=>({id:u.id,filename:u.filename})),l.managedComments.clear(),l.managedReport=t===null?null:l.managedReports[0]??null,l.currentReportWorkspace=null,l.currentLinks=null,l.selectedBundle=null,l.selectedBundleWorkspace=null,l.scanSelection=null,l.repoUrl="",l.repoEditing=!1,sm();for(let u of a)if(await lm(u.filename,u.data,n,{renderView:!1,managedReportId:u.id,managedRepo:u.repo}),ge(n))return!1;if(a.length>0){let{hydrateManagedReportTriage:u}=await Promise.resolve().then(()=>(om(),rR));if(ge(n))return!1;let p=await $i({hydrate:async f=>{for(let h of a)if(!(await Promise.all([u(h.id,{renderView:!1,signal:f}),gl(h.id,{signal:f})])).every(Boolean)||f.aborted||ge(n))return!1;return!0}});if(ge(n))return!1;if(!p)return await Dn({history:!1}),_t("Could not load report annotations. Open the team or report again to retry."),!1}if(i){if(l.currentView="links",l.currentLinks={name:i.filename,groups:i.data.links,skipped:0},!await su(n))return!1}else if(s.length===0)im();else if(Fs(Fn()),!await su(n))return!1;return $i(),await K(),!0}async function Pr(e){if(_())return;l.currentManagedTeam=null,l.currentManagedReport=null,l.managedReport=null,l.managedReports=[],l.managedComments.clear();let t=J().find(f=>f.id===e);if(!t)return;let r=St();lu(new Set([e])),l.currentView!=="findings"&&l.currentView!=="files"&&(l.currentView="findings"),$t("workspace",e),l.reports=[],mi(),l.workspaceMerges=[],l.revalidateConflicts=new Map,l.currentFile=null,l.currentWorkspace=e,l.currentReportWorkspace=null,l.currentLinks=null,l.repoUrl="",l.repoEditing=!1,sm(),st(_i,`ws:${e}`).catch(()=>{}),t.reports.length===0&&im();let n=await ud(t);if(ge(r))return;let o=!0,i=t.reports.map(f=>ze(f).catch(()=>null)),s=0;for(let f=0;f<t.reports.length;f++){let h=await i[f];if(ge(r))return;if(h===null){o=!1;continue}if(!yn(h)&&(await lm(t.reports[f],h,r,{renderView:!1})?s++:o=!1,ge(r)))return}s===0&&t.reports.length>0&&im(),o&&xs(t)?.appMode&&(l.showRevalidation=!0,l.upstreamOnly=!1,l.revalidationDetailed=!1,au());let a=l.reports.slice();G3(t,a,n,{complete:o,isCurrent:()=>!ge(r)&&l.currentWorkspace===e&&["findings","files"].includes(l.currentView)});let c=K().catch(f=>console.warn("workspace sidebar:",f));if(s>0&&(Fs(Fn()),!await su(r)))return;let u=["showRevalidation","upstreamOnly","revalidationDetailed","filterConfMin","filterConfMax","filterRevalidate","filterPartial","sortBy","severityMode"],p=u.map(f=>l[f]);Y3(t,a,n,{complete:o,isCurrent:()=>!ge(r),onReady:async f=>{!f.appMode||l.currentWorkspace!==e||!["findings","files"].includes(l.currentView)||u.some((h,g)=>l[h]!==p[g])||(l.showRevalidation=!0,l.upstreamOnly=!1,l.revalidationDetailed=!1,au(),Fs(Fn()),await su(r))}}).catch(f=>console.warn("workspace App metadata:",f)),Q.openSession(e),Q.refreshSession(e),hd(e),await c}async function Z3({triage:e="keep",deleteFromRemoteWorkspaceIds:t=[]}={}){if(!l.currentFile)return;let r=St(),n=l.currentFile;Oa(n),Kr(n,"");for(let o of t)try{let i=await Pf(o,n);if(ge(r))return;i&&i.ok===!1&&i.reason!=="not-found"&&console.warn(`Failed to delete '${n}' from workspace ${o} remote: ${i.reason}`)}catch(i){console.warn(`Failed to delete '${n}' from workspace ${o} remote:`,i)}if(await Ta(n),!ge(r)&&(await ed(n,null),!ge(r))){if(e==="wipe"){try{await $f()}catch(o){console.warn("Skipped orphan-triage GC:",o)}if(ge(r))return}ge(r)||(am(),await K())}}function am({forgetLastView:e=!0}={}){T3(),l.currentManagedTeam=null,l.currentManagedReport=null,l.currentFile=null,l.currentWorkspace=null,l.currentReportWorkspace=null,l.currentLinks=null,l.managedReport=null,l.managedReports=[],l.managedComments.clear(),l.selectedBundle=null,l.selectedBundleWorkspace=null,l.scanSelection=null,l.bundleDetails=null,l.bundleDetailsTab="overview",l.bundleSourceFile=null,l.bundleSourceFindingIdx=null,l.selectedPackage=null,l.selectedPackageVersion=null,l.packageDetailsTab="overview",l.packageSlideTriage=null,l.packageSlideTransient=!1,l.expandedPackages.clear(),l.selectedRepository=null,l.repositoryDetailsTab="overview",l.repositorySlideTriage=null,l.repositorySlideTransient=!1,l.filesSelectedFile=null,l.tableSelectedGid=null,l.kanbanPopoverGid=null,l.kanbanExpandedColumn=null,l.focusGid=null,l.activeTabByGroup.clear(),l.reports=[],mi(),l.workspaceMerges=[],l.revalidateConflicts=new Map,l.repoUrl="",l.repoEditing=!1,l.shownTriage=null,l.currentView="findings",sm(),e&&Oo(_i),im()}function Q3(e){St(),lu(new Set),am(e)}async function Dn({history:e=!0}={}){return e&&_()&&Ie.active?Ie.navigate({view:"home"}):(St(),lu(new Set),am({forgetLastView:!_()}),await K(),!0)}async function eR({deleteFromRemoteWorkspaceIds:e=[]}={}){if(!l.selectedBundle)return;let t=St(),r=l.selectedBundle;for(let o of e)try{let i=await Nf(o,r);if(ge(t))return;i&&i.ok===!1&&i.reason!=="not-found"&&console.warn(`Failed to delete bundle from workspace ${o} remote: ${i.reason}`)}catch(i){console.warn(`Failed to delete bundle from workspace ${o} remote:`,i)}if(await ey(r),ge(t)||(await zy(r,null),ge(t)))return;l.selectedBundle=null,l.selectedBundleWorkspace=null,l.bundleDetails=null,l.bundleSourceFile=null,l.bundleSourceFindingIdx=null;let n=Ae(_i);typeof n=="string"&&(n===`b:${r}`||n.startsWith(`b:${r} `))&&Oo(_i),vy(r),l.bundles=await Ot(),!ge(t)&&(S(),await K())}async function tR(e,t="detach",{triage:r="keep"}={}){let n=J().find(a=>a.id===e);if(!n)return;St();let o=Array.isArray(n.reports)?[...n.reports]:[];if(Q.closeSession(e),Yv(e),t==="delete"){for(let a of o){try{await Ta(a)}catch{}Oa(a),Kr(a,"")}if(r==="wipe")try{await $f()}catch(a){console.warn("Skipped orphan-triage GC:",a)}}let i=l.currentWorkspace===e,s=t==="delete"&&l.currentFile!=null&&o.includes(l.currentFile);(i||s)&&am(),await By(e),await K()}async function lm(e,t,r=null,{renderView:n=!0,managedReportId:o=null,managedRepo:i=null}={}){let s=()=>r!==null&&ge(r);try{if(await Promise.all([$t("report",e),$t("workspace",l.currentWorkspace||l.currentReportWorkspace)]),s()||(await ks(),s()))return;let{data:a,reason:c}=o===null?_()?H0(t,e):ro(t):{data:structuredClone(t),reason:null};if(!a)throw new Error(c);let u=l.reports.length===0,p=Bt(a)??[],f=p.flatMap(Vw);if(await Db(f),s())return;let h=new Set(f.filter(vw).map(x=>x.source??a.source??null)),g=i??a?.repo,b=qr({repo:g}),y=b??(o==null?It(e):""),k=as(g),v=[];for(let x of p){let $=Vw(x);if($.length===0)continue;let C=[];for(let I of $){let E={...I,_id:l.nextFindingId++,_repoFallback:y,_repoDirectory:k,_reportName:e,_managedReportId:o,_bundleHashes:a.bundleHashes??[]};eo(E,a),E._source=E.source??a.source??null,"isApp"in E||(E.isApp=Gr(E,E._source)),E._sourcePass=h.has(E._source),E._analyzer=E._source??E.type??null,C.push(E)}v.push(C)}return to(v),l.reports.push({type:a.type||"analysis",source:a.source??null,fileName:e,_managedReportId:o,groups:v,repo:b,tree:a.tree??null,bundleHashes:a.bundleHashes??[]}),uh(l.reports),ph(l.reports)&&mi(),l.revalidateConflicts=v6(),au(),u&&(ol(),Fs(Fn())),n&&await su(r),!0}catch(a){alert(`Failed to parse ${e}: ${a.message}`)}}function SN(){_()||(Nn||(Nn=document.createElement("input"),Nn.type="file",Nn.multiple=!0,Nn.hidden=!0,Nn.addEventListener("change",()=>{let e=[...Nn.files];e.length>0&&sk(e),Nn.value=""}),document.body.append(Nn)),Nn.click())}var _i,ge,Nn,xi=w(()=>{"use strict";Rp();Yf();Ic();Jn();D();Qr();P3();or();ct();pe();tn();wi();j0();wf();zt();zn();N0();ao();go();Ee();z3();K0();q0();X0();Zt();Xa();qa();bl();Z0();nk();Za();Za();Rp();_i="deepview.lastFile";ge=e=>e!==Ze();window.__loadFile=(e,t)=>lm(e,t);window.__setFilters=({severities:e,confMin:t}={})=>{e!=null&&(l.filterSeverities=new Set(e)),t!==void 0&&(l.filterConfMin=t),S()};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")&&sk(e.dataTransfer.files)});Ge.addEventListener("dragover",e=>{e.preventDefault(),_()||Ge.classList.add("hover")});Ge.addEventListener("dragleave",()=>Ge.classList.remove("hover"));Ge.addEventListener("drop",e=>{e.preventDefault(),Ge.classList.remove("hover"),sk(e.dataTransfer.files)});Nn=null;Ge.addEventListener("click",e=>{let t=e.target.closest("[data-managed-page]");if(t){zs(t.dataset.managedPage);return}if(e.target.closest("[data-managed-login]")){u5(l.managed?.loginPath);return}let r=e.target.closest("[data-managed-team]");if(r){let o=l.managedTeams.find(i=>i.id===r.dataset.managedTeam);o&&wo(o);return}let n=e.target.closest("[data-landing-workspace]");if(n){Pr(n.dataset.landingWorkspace);return}e.target.closest(".drop-prompt-action")&&SN()})});function nR(e){let t=e.replace(/:free$/u,"").replaceAll("_","-").split("-").filter(Boolean),r=[];for(let o=0;o<t.length;o++){let i=t[o],s=t[o+1];if(/^\d+$/u.test(i)&&/^\d+$/u.test(s??"")){r.push(`${i}.${s}`),o++;continue}let a=RN.get(i.toLowerCase());r.push(a??(/^(?:[a-z]+\d+|\d+[a-z]+)$/iu.test(i)?i.toUpperCase():i[0]?.toUpperCase()+i.slice(1)))}return r.join(" ").replace(/^GPT (\d)/u,"GPT-$1")}function Us(e){return CN.get(e)??nR(e.includes("/")?e.slice(e.indexOf("/")+1):e)}function cu(e){let t=e.includes("/")?e.split("/")[0]:"other";return{key:t,name:EN.get(t)??(t==="other"?"Other":nR(t))}}function Hs(e){return e==="xhigh"?"Extra high":e?e[0].toUpperCase()+e.slice(1):"Unavailable"}function xl(e){return e.efforts.includes("max")?"max":e.efforts.at(-1)??null}async function cm(e,t=fetch){let r=await t("/api/admin/scan/models",{credentials:"same-origin",headers:{accept:"application/json"},signal:e});if(!r.ok)throw new Error(`HTTP ${r.status}`);let n=await r.json();return ak(n)}function ak(e){if(!Array.isArray(e?.models))throw new Error("No model catalogue returned");let t=e.models.filter(r=>typeof r?.id=="string"&&r.id.length>0).map(r=>({id:r.id,efforts:Array.isArray(r.efforts)?[...new Set(r.efforts.filter(n=>typeof n=="string"&&n.length>0))]:[]}));if(t.length===0)throw new Error("No models available");return{models:t,defaultModel:t.find(r=>r.id===e.defaultModel)?.id??t[0].id}}var CN,EN,RN,Ci=w(()=>{"use strict";CN=new Map([["openai/gpt-6-astra","GPT-6 Astra"],["openai/gpt-6-astra-pro","GPT-6 Astra Pro"],["openai/gpt-5.6-sol","GPT-5.6 Sol"],["openai/gpt-5.6-terra","GPT-5.6 Terra"],["openai/gpt-5.6-luna","GPT-5.6 Luna"],["anthropic/claude-fable-5.1","Claude Fable 5.1"],["anthropic/claude-opus-5","Claude Opus 5"],["anthropic/claude-sonnet-5","Claude Sonnet 5"],["moonshotai/kimi-k3","Kimi K3"],["z-ai/glm-5.3","GLM 5.3"],["qwen/qwen3.8-max","Qwen3.8 Max"],["deepseek/deepseek-v4.1-flash","DeepSeek V4.1 Flash"],["deepseek/deepseek-v4-pro","DeepSeek V4 Pro"]]),EN=new Map([["openai","OpenAI"],["anthropic","Anthropic"],["moonshotai","Moonshot AI"],["google","Google"],["nvidia","NVIDIA"],["qwen","Qwen"],["deepseek","DeepSeek"],["x-ai","xAI"],["z-ai","Z.ai"]]),RN=new Map([["gpt","GPT"],["gptoss","GPT OSS"],["oss","OSS"],["o","O"],["ai","AI"],["api","API"],["4o","4o"],["k3","K3"],["k4","K4"],["qwen","Qwen"],["kimi","Kimi"],["gemini","Gemini"],["claude","Claude"],["fable","Fable"],["opus","Opus"],["sonnet","Sonnet"],["astra","Astra"],["terra","Terra"],["luna","Luna"],["codex","Codex"],["deepseek","DeepSeek"],["nemotron","Nemotron"],["gemma","Gemma"]])});function lk(e=null){let t=["anthropic/claude-opus-5.5","anthropic/claude-fable-5.1","anthropic/claude-sonnet-5","anthropic/claude-haiku-4.5","openai/gpt-6-astra","openai/gpt-6-astra-pro","openai/gpt-6-sol","openai/gpt-6-sol-pro","openai/gpt-6-luna","openai/gpt-6-luna-pro","moonshotai/kimi-k3","google/gemini-3.8-flash","google/gemma-4-31b-it","x-ai/grok-4.7","z-ai/glm-5.3","qwen/qwen3.8-max","deepseek/deepseek-v4.1-flash","deepseek/deepseek-v4-pro"],r=e==="moonshot"?"moonshotai":e,n=t.filter(o=>!["anthropic","openai","moonshot"].includes(e??"")||o.startsWith(`${r}/`)).map(o=>({id:o,efforts:["low","medium","high","xhigh","max"]}));return{models:n,defaultModel:n[0].id}}var oR=w(()=>{"use strict"});var iR=w(()=>{"use strict";oR()});function sR(e,t=fetch,r=""){let n=new URL(e);return(o,i={})=>{let s=new URL(o.replace(/^\/+/u,""),n);if(s.origin!==n.origin)throw new Error("Scan requests must use the configured server");let a=new Headers(i.headers);return r&&a.set("authorization",`Bearer ${r}`),t(s,{...i,headers:a,credentials:"omit",redirect:"error"})}}var aR=w(()=>{"use strict"});var dm,lR=w(()=>{"use strict";Ci();iR();aR();dm=class{constructor(t,r=()=>{},n=fetch){this.onChange=r,this.request=n,this.reset(t)}reset(t=this.server){this.server=t,this.apiKey="",this.provider=null,this._remoteModels=!1,this._disconnect()}_previewModels(){let t=lk(this.provider);this.loadModels=()=>Promise.resolve(t)}_disconnect(){this._controller?.abort(),this.connected=!1,this.managed=!1,this.loading=!1,this.error=null,this.catalogue=null,this._remoteModels||this._previewModels(),this.onChange()}get ready(){return this.connected&&!this.loading&&this.catalogue!=null}setKey(t){this.apiKey!==t&&(this.apiKey=t,this._disconnect())}setProvider(t){if(!(this.provider===t||this.managed)){if(this.provider=t,this.connected&&t)return this._load(t);this.connected&&(this._controller?.abort(),this.loading=!1,this.error=null,this.catalogue=null),this._remoteModels||this._previewModels(),this.onChange()}}connect(){if(this._disconnect(),!(!this.server||!this.apiKey.trim()))return this._load(null)}async _fetch(t,r){let n=sR(this.server,this.request,this.apiKey.trim()),o=t?`?${new URLSearchParams({provider:t})}`:"",i=await n(`api/models${o}`,{headers:{accept:"application/json"},cache:"no-store",signal:r});if(i.status===401)throw Object.assign(new Error("DeepView API key not recognized."),{status:401});if(!i.ok)throw new Error(`Scan server returned HTTP ${i.status}.`);let s=await i.json();if(s?.valid!==!0||typeof s.managed!="boolean")throw new Error("Invalid response from scan server.");return{managed:s.managed,catalogue:s.managed||t?ak(s):null}}async _load(t){this._controller?.abort();let r=this._controller=new AbortController;this.loading=!0,this.error=null,this.catalogue=null;let n=this._fetch(t,r.signal);this.onChange();try{let o=await n;if(r.signal.aborted)return;if(this.connected=!0,this.managed=o.managed,this.catalogue=o.catalogue,!o.managed&&!t&&this.provider)return this._load(this.provider);if(o.catalogue){let i=o.catalogue;this._remoteModels=!0,this.loadModels=()=>Promise.resolve(i)}else this._remoteModels||this._previewModels();this.loading=!1,this.onChange()}catch(o){if(r.signal.aborted)return;(!t||o.status===401)&&this._disconnect(),this.loading=!1,this.error=o instanceof TypeError?"Couldn\u2019t reach the scan server. Check your connection and try again.":String(o?.message??o),this.onChange()}}}});function cR(e){let t=e.trim();return/^sk-ant-[A-Za-z0-9_-]*$/u.test(t)?"anthropic":/^sk-or-v1-[A-Za-z0-9_-]*$/u.test(t)?"openrouter":/^sk-kimi-[A-Za-z0-9_-]*$/u.test(t)?"moonshot":/^sk-(?:proj|svcacct)-[A-Za-z0-9_-]*$/u.test(t)?"openai":null}var dR=w(()=>{"use strict"});var uR,pR=w(()=>{T();uR=d`<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z"></path></svg>`});var fR,hR=w(()=>{T();fR=d`<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 01-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 00-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 01-.465.137 9.597 9.597 0 00-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 001.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 011.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 01.415-.287.302.302 0 01.2.288.306.306 0 01-.31.307.303.303 0 01-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 01-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 01.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 01-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z"></path></svg>`});var mR,gR=w(()=>{T();mR=d`<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
119
+ <path fill="#4285F4" d="M21.35 12.27c0-.79-.07-1.55-.2-2.27H12v4.3h5.24a4.48 4.48 0 0 1-1.94 2.94v2.45h3.15c1.85-1.7 2.9-4.2 2.9-7.42Z"/>
120
+ <path fill="#34A853" d="M12 21.8c2.64 0 4.86-.87 6.48-2.35l-3.15-2.45c-.87.58-1.98.92-3.33.92-2.56 0-4.73-1.73-5.51-4.06H3.24v2.52A9.8 9.8 0 0 0 12 21.8Z"/>
121
+ <path fill="#FBBC05" d="M6.49 13.86a5.9 5.9 0 0 1 0-3.72V7.62H3.24a9.8 9.8 0 0 0 0 8.76l3.25-2.52Z"/>
122
+ <path fill="#EA4335" d="M12 6.08c1.43 0 2.72.49 3.74 1.45l2.8-2.8C16.85 3.14 14.63 2.2 12 2.2a9.8 9.8 0 0 0-8.76 5.42l3.25 2.52C7.27 7.81 9.44 6.08 12 6.08Z"/>
123
+ </svg>
124
+ `});var bR,yR=w(()=>{T();bR=d`<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815"></path></svg>`});var ck,vR=w(()=>{T();ck=d`<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M1.052 16.916l9.539 2.552a21.007 21.007 0 00.06 2.033l5.956 1.593a11.997 11.997 0 01-5.586.865l-.18-.016-.044-.004-.084-.009-.094-.01a11.605 11.605 0 01-.157-.02l-.107-.014-.11-.016a11.962 11.962 0 01-.32-.051l-.042-.008-.075-.013-.107-.02-.07-.015-.093-.019-.075-.016-.095-.02-.097-.023-.094-.022-.068-.017-.088-.022-.09-.024-.095-.025-.082-.023-.109-.03-.062-.02-.084-.025-.093-.028-.105-.034-.058-.019-.08-.026-.09-.031-.066-.024a6.293 6.293 0 01-.044-.015l-.068-.025-.101-.037-.057-.022-.08-.03-.087-.035-.088-.035-.079-.032-.095-.04-.063-.028-.063-.027a5.655 5.655 0 01-.041-.018l-.066-.03-.103-.047-.052-.024-.096-.046-.062-.03-.084-.04-.086-.044-.093-.047-.052-.027-.103-.055-.057-.03-.058-.032a6.49 6.49 0 01-.046-.026l-.094-.053-.06-.034-.051-.03-.072-.041-.082-.05-.093-.056-.052-.032-.084-.053-.061-.039-.079-.05-.07-.047-.053-.035a7.785 7.785 0 01-.054-.036l-.044-.03-.044-.03a6.066 6.066 0 01-.04-.028l-.057-.04-.076-.054-.069-.05-.074-.054-.056-.042-.076-.057-.076-.059-.086-.067-.045-.035-.064-.052-.074-.06-.089-.073-.046-.039-.046-.039a7.516 7.516 0 01-.043-.037l-.045-.04-.061-.053-.07-.062-.068-.06-.062-.058-.067-.062-.053-.05-.088-.084a13.28 13.28 0 01-.099-.097l-.029-.028-.041-.042-.069-.07-.05-.051-.05-.053a6.457 6.457 0 01-.168-.179l-.08-.088-.062-.07-.071-.08-.042-.049-.053-.062-.058-.068-.046-.056a7.175 7.175 0 01-.027-.033l-.045-.055-.066-.082-.041-.052-.05-.064-.02-.025a11.99 11.99 0 01-1.44-2.402zm-1.02-5.794l11.353 3.037a20.468 20.468 0 00-.469 2.011l10.817 2.894a12.076 12.076 0 01-1.845 2.005L.657 15.923l-.016-.046-.035-.104a11.965 11.965 0 01-.05-.153l-.007-.023a11.896 11.896 0 01-.207-.741l-.03-.126-.018-.08-.021-.097-.018-.081-.018-.09-.017-.084-.018-.094c-.026-.141-.05-.283-.071-.426l-.017-.118-.011-.083-.013-.102a12.01 12.01 0 01-.019-.161l-.005-.047a12.12 12.12 0 01-.034-2.145zm1.593-5.15l11.948 3.196c-.368.605-.705 1.231-1.01 1.875l11.295 3.022c-.142.82-.368 1.612-.668 2.365l-11.55-3.09L.124 10.26l.015-.1.008-.049.01-.067.015-.087.018-.098c.026-.148.056-.295.088-.442l.028-.124.02-.085.024-.097c.022-.09.045-.18.07-.268l.028-.102.023-.083.03-.1.025-.082.03-.096.026-.082.031-.095a11.896 11.896 0 011.01-2.232zm4.442-4.4L17.352 4.59a20.77 20.77 0 00-1.688 1.721l7.823 2.093c.267.852.442 1.744.513 2.665L2.106 5.213l.045-.065.027-.04.04-.055.046-.065.055-.076.054-.072.064-.086.05-.065.057-.073.055-.07.06-.074.055-.069.065-.077.054-.066.066-.077.053-.06.072-.082.053-.06.067-.074.054-.058.073-.078.058-.06.063-.067.168-.17.1-.098.059-.056.076-.071a12.084 12.084 0 012.272-1.677zM12.017 0h.097l.082.001.069.001.054.002.068.002.046.001.076.003.047.002.06.003.054.002.087.005.105.007.144.011.088.007.044.004.077.008.082.008.047.005.102.012.05.006.108.014.081.01.042.006.065.01.207.032.07.012.065.011.14.026.092.018.11.022.046.01.075.016.041.01L14.7.3l.042.01.065.015.049.012.071.017.096.024.112.03.113.03.113.032.05.015.07.02.078.024.073.023.05.016.05.016.076.025.099.033.102.036.048.017.064.023.093.034.11.041.116.045.1.04.047.02.06.024.041.018.063.026.04.018.057.025.11.048.1.046.074.035.075.036.06.028.092.046.091.045.102.052.053.028.049.026.046.024.06.033.041.022.052.029.088.05.106.06.087.051.057.034.053.032.096.059.088.055.098.062.036.024.064.041.084.056.04.027.062.042.062.043.023.017c.054.037.108.075.161.114l.083.06.065.048.056.043.086.065.082.064.04.03.05.041.086.069.079.065.085.071c.712.6 1.353 1.283 1.909 2.031L7.222.994l.062-.027.065-.028.081-.034.086-.035c.113-.045.227-.09.341-.131l.096-.035.093-.033.084-.03.096-.031c.087-.03.176-.058.264-.085l.091-.027.086-.025.102-.03.085-.023.1-.026L9.04.37l.09-.023.091-.022.095-.022.09-.02.098-.021.091-.02.095-.018.092-.018.1-.018.091-.016.098-.017.092-.014.097-.015.092-.013.102-.013.091-.012.105-.012.09-.01.105-.01c.093-.01.186-.018.28-.024l.106-.008.09-.005.11-.006.093-.004.1-.004.097-.002.099-.002.197-.002z"></path></svg>`});var wR,kR=w(()=>{T();wR=d`<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M10.212 8.976V7.62c.127-.01.256-.017.388-.021 3.596-.117 5.957 3.184 5.957 3.184s-2.548 3.647-5.282 3.647a3.227 3.227 0 01-1.063-.175v-4.109c1.4.174 1.681.812 2.523 2.258l1.873-1.627a4.905 4.905 0 00-3.67-1.846 6.594 6.594 0 00-.729.044m0-4.476v2.025c.13-.01.259-.019.388-.024 5.002-.174 8.261 4.226 8.261 4.226s-3.743 4.69-7.643 4.69c-.338 0-.675-.031-1.007-.092v1.25c.278.038.558.057.838.057 3.629 0 6.253-1.91 8.794-4.169.421.347 2.146 1.193 2.501 1.564-2.416 2.083-8.048 3.763-11.24 3.763-.308 0-.603-.02-.894-.048V19.5H24v-15H10.21zm0 9.756v1.068c-3.356-.616-4.287-4.21-4.287-4.21a7.173 7.173 0 014.287-2.138v1.172h-.005a3.182 3.182 0 00-2.502 1.178s.615 2.276 2.507 2.931m-5.961-3.3c1.436-1.935 3.604-3.148 5.961-3.336V6.523C5.81 6.887 2 10.723 2 10.723s2.158 6.427 8.21 7.015v-1.166C5.77 16 4.25 10.958 4.25 10.958h-.002z"></path></svg>`});var xR,$R=w(()=>{T();xR=d`<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z"></path></svg>`});var _R,SR=w(()=>{T();_R=d`<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M18.654 3.87a5.087 5.087 0 110 10.174L23.7 19.09c.64.641.187 1.737-.72 1.737H8.48a8.479 8.479 0 010-16.958h10.175zM8.479 7.26a5.087 5.087 0 100 10.176 5.087 5.087 0 000-10.175z"></path></svg>`});var CR,ER=w(()=>{T();CR=d`<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M12.604 1.34c.393.69.784 1.382 1.174 2.075a.18.18 0 00.157.091h5.552c.174 0 .322.11.446.327l1.454 2.57c.19.337.24.478.024.837-.26.43-.513.864-.76 1.3l-.367.658c-.106.196-.223.28-.04.512l2.652 4.637c.172.301.111.494-.043.77-.437.785-.882 1.564-1.335 2.34-.159.272-.352.375-.68.37-.777-.016-1.552-.01-2.327.016a.099.099 0 00-.081.05 575.097 575.097 0 01-2.705 4.74c-.169.293-.38.363-.725.364-.997.003-2.002.004-3.017.002a.537.537 0 01-.465-.271l-1.335-2.323a.09.09 0 00-.083-.049H4.982c-.285.03-.553-.001-.805-.092l-1.603-2.77a.543.543 0 01-.002-.54l1.207-2.12a.198.198 0 000-.197 550.951 550.951 0 01-1.875-3.272l-.79-1.395c-.16-.31-.173-.496.095-.965.465-.813.927-1.625 1.387-2.436.132-.234.304-.334.584-.335a338.3 338.3 0 012.589-.001.124.124 0 00.107-.063l2.806-4.895a.488.488 0 01.422-.246c.524-.001 1.053 0 1.583-.006L11.704 1c.341-.003.724.032.9.34zm-3.432.403a.06.06 0 00-.052.03L6.254 6.788a.157.157 0 01-.135.078H3.253c-.056 0-.07.025-.041.074l5.81 10.156c.025.042.013.062-.034.063l-2.795.015a.218.218 0 00-.2.116l-1.32 2.31c-.044.078-.021.118.068.118l5.716.008c.046 0 .08.02.104.061l1.403 2.454c.046.081.092.082.139 0l5.006-8.76.783-1.382a.055.055 0 01.096 0l1.424 2.53a.122.122 0 00.107.062l2.763-.02a.04.04 0 00.035-.02.041.041 0 000-.04l-2.9-5.086a.108.108 0 010-.113l.293-.507 1.12-1.977c.024-.041.012-.062-.035-.062H9.2c-.059 0-.073-.026-.043-.077l1.434-2.505a.107.107 0 000-.114L9.225 1.774a.06.06 0 00-.053-.031zm6.29 8.02c.046 0 .058.02.034.06l-.832 1.465-2.613 4.585a.056.056 0 01-.05.029.058.058 0 01-.05-.029L8.498 9.841c-.02-.034-.01-.052.028-.054l.216-.012 6.722-.012z"></path></svg>`});var RR,MR=w(()=>{T();RR=d`<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M12.105 2L9.927 4.953H.653L2.83 2h9.276zM23.254 19.048L21.078 22h-9.242l2.174-2.952h9.244zM24 2L9.264 22H0L14.736 2H24z"></path></svg>`});function du(e){return Object.hasOwn(AR,e)?AR[e]:MN}var AR,MN,dk=w(()=>{"use strict";T();pR();hR();gR();yR();vR();kR();$R();SR();ER();MR();AR={anthropic:uR,deepseek:fR,google:mR,moonshot:ck,moonshotai:ck,nvidia:wR,openai:xR,openrouter:_R,qwen:CR,"x-ai":bR,"z-ai":RR},MN=d`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><rect x="4" y="4" width="12" height="12" rx="3"/><path d="M8 1v3m4-3v3M8 16v3m4-3v3M1 8h3m-3 4h3m12-4h3m-3 4h3"/></svg>`});var $e,TR=w(()=>{Ur();Vi();Qu();$e=kr(class extends Gt{constructor(e){if(super(e),e.type!==Rt.PROPERTY&&e.type!==Rt.ATTRIBUTE&&e.type!==Rt.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!s_(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[t]){if(t===Xe||t===m)return t;let r=e.element,n=e.name;if(e.type===Rt.PROPERTY){if(t===r[n])return Xe}else if(e.type===Rt.BOOLEAN_ATTRIBUTE){if(!!t===r.hasAttribute(n))return Xe}else if(e.type===Rt.ATTRIBUTE&&r.getAttribute(n)===t+"")return Xe;return ia(e),t}})});var wr=w(()=>{TR()});function uk(e){let t=new Map(e.map(n=>[n.id,n])),r=new Set;return e.flatMap(n=>{if(r.has(n.id))return[];let o=n.id.endsWith("-pro")?n.id.slice(0,-4):n.id,i=t.get(o),s=t.get(`${o}-pro`);return!/(?:^|\/)gpt-.+$/u.test(o)||o.endsWith("-pro")||!i||!s?[n]:(r.add(i.id),r.add(s.id),[{...i,pro:s}])})}function pk(e){return[...Map.groupBy(uk(e),r=>cu(r.id).key)].map(([r,n])=>({key:r,models:n}))}function IR(e,t){if(e.length===0)return[];let r=Math.min(e.length,Math.max(1,t)),n=e.map(u=>u.models.length*2+3),o=n.reduce((u,p)=>u+p,0),i=Math.max(...n);for(;i<o;){let u=Math.floor((i+o)/2),p=0,f=1;for(let h of n)p+h>u&&(f++,p=0),p+=h;f>r?i=u+1:o=u}let s=[],a=[],c=0;for(let[u,p]of e.entries())a.length>0&&(c+n[u]>i||e.length-u===r-s.length-1)&&(s.push(a),a=[],c=0),a.push(p),c+=n[u];return s.push(a),s}var LR=w(()=>{"use strict";Ci()});var AN,fk,hk=w(()=>{"use strict";T();Ci();LR();dk();AN=d`<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m4 6 4 4 4-4"/></svg>`,fk=class extends X{static properties={loadModels:{attribute:!1},pending:{type:Boolean},value:{attribute:!1},effort:{attribute:!1},hasExtra:{type:Boolean,attribute:"has-extra"},_models:{state:!0},_error:{state:!0},_menuColumns:{state:!0}};static styles=Me`:host{display:block;min-width:0;container:scan-controls / inline-size}*{box-sizing:border-box}.layout{display:grid;grid-template-columns:minmax(13rem,1fr) minmax(14rem,1fr);gap:1.25rem;align-items:start}.layout.with-extra{grid-template-columns:minmax(13rem,.9fr) minmax(14rem,1.2fr) minmax(14rem,auto)}.field{min-width:0;min-height:4.9rem}.model-placeholder{height:3.25rem;display:flex;align-items:center;padding:.5rem .6rem;border:1px solid var(--border);border-radius:6px;color:var(--muted);background:var(--bg);font-size:.75rem}.effort-placeholder{height:.3rem;margin:1rem .6rem;border-radius:999px;background:var(--surface-active)}.label{display:flex;justify-content:space-between;align-items:center;margin-bottom:.4rem;color:var(--muted);font-size:.72rem}output{color:var(--text);font-size:.72rem;font-weight:500}details{position:relative}.model-control{position:relative}summary{display:flex;align-items:center;gap:.55rem;padding:.5rem .6rem;border:1px solid var(--border);border-radius:6px;background:var(--bg);color:var(--text);list-style:none;transition:border-color .12s,background .12s}summary:hover,details[open] summary{border-color:var(--muted);background:var(--surface-active)}summary::-webkit-details-marker{display:none}summary,.menu{user-select:none}summary>svg{width:.9rem;height:.9rem;margin-left:auto;color:var(--muted)}.selected-copy{display:grid;gap:.1rem;flex:1;min-width:0}.selected-copy strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.8rem;font-weight:500}.selected-copy small{color:var(--muted);font-size:.63rem}.pro-space{width:3.65rem;flex:0 0 3.65rem}.pro-toggle{position:absolute;right:2.05rem;top:50%;transform:translateY(-50%);display:inline-flex;align-items:center;justify-content:center;gap:.3rem;width:3.65rem;height:1.65rem;padding:.2rem .3rem;border:1px solid var(--border);border-radius:5px;background:var(--bg);color:var(--muted);font:inherit;font-size:.65rem;font-weight:600;cursor:default;user-select:none}.pro-toggle:hover{border-color:var(--muted);color:var(--text)}.pro-track{position:relative;flex:0 0 1.3rem;height:.8rem;border-radius:999px;background:var(--border)}.pro-track:after{content:"";position:absolute;top:.15rem;left:.15rem;width:.5rem;height:.5rem;border-radius:50%;background:var(--muted);transition:transform .12s,background .12s}.pro-toggle[aria-checked=true]{color:var(--accent);border-color:rgb(from var(--accent) r g b / .45);background:rgb(from var(--accent) r g b / .08)}.pro-toggle[aria-checked=true] .pro-track{background:rgb(from var(--accent) r g b / .25)}.pro-toggle[aria-checked=true] .pro-track:after{transform:translate(.5rem);background:var(--accent)}.icon{display:inline-grid;place-items:center;width:1.7rem;height:1.5rem;flex:0 0 1.7rem;color:var(--text)}.icon svg{display:block;width:1.12rem;height:1.12rem}.icon.openai{color:#10a37f}.icon.anthropic{color:#d97757}.icon.moonshotai{color:#8068d9}.icon.google{color:#4285f4}.icon.nvidia{color:#76b900}.icon.qwen{color:#f97316}.icon.deepseek{color:#4d8dff}.icon.moonshotai svg{transform:scale(.78)}.icon.qwen svg{transform:scale(.82)}.icon.nvidia svg{transform:scale(.86)}.icon.deepseek svg{transform:scale(.9)}.extra{display:flex;min-width:0;min-height:4.9rem;align-items:flex-end;align-self:end;padding-bottom:.05rem}.menu{visibility:hidden;position:fixed;z-index:1000;width:min(46rem,calc(100vw - 1rem));max-height:calc(100dvh - 1rem);overflow:auto;overscroll-behavior:contain;padding:.65rem;border:1px solid var(--border);border-radius:9px;background:var(--surface-active);color:var(--text);box-shadow:0 .65rem 1.8rem #0000008c}details[open] .menu[data-positioned]{visibility:visible}.groups{display:grid;grid-template-columns:repeat(var(--model-columns, 1),minmax(0,1fr));gap:1rem;align-items:start}.provider-column{min-width:0}fieldset{min-width:0;margin:0 0 .6rem;padding:0;border:0}fieldset:last-child{margin-bottom:0}legend{display:flex;align-items:center;gap:.45rem;width:100%;min-height:1.9rem;padding:.35rem .5rem .25rem;border-bottom:1px solid rgb(from var(--border) r g b / .7);color:var(--muted);font-size:.64rem;font-weight:700;letter-spacing:.055em;text-transform:uppercase}legend .icon{width:.88rem;height:1.25rem;flex-basis:.88rem}legend .icon svg{width:.88rem;height:.88rem}.choice{display:flex;align-items:center;gap:.5rem;padding:.35rem .5rem;border-radius:4px;font-size:.76rem}.choice:hover{background:rgb(from var(--text) r g b / .05)}.choice:has(:checked){color:var(--accent);background:rgb(from var(--accent) r g b / .1)}.choice input{margin:0;accent-color:var(--accent)}.choice span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.slider{--thumb-size: 1rem;padding:.15rem .6rem 0}input[type=range]{appearance:none;display:block;width:100%;height:var(--thumb-size);margin:.4rem 0 .5rem;padding:0;border:0;background:transparent}input[type=range]::-webkit-slider-runnable-track{height:.3rem;border-radius:999px;background:linear-gradient(to right,var(--accent) var(--effort-fill),var(--surface-active) var(--effort-fill))}input[type=range]::-moz-range-track{height:.3rem;border-radius:999px;background:linear-gradient(to right,var(--accent) var(--effort-fill),var(--surface-active) var(--effort-fill))}input[type=range]::-webkit-slider-thumb{appearance:none;width:var(--thumb-size);height:var(--thumb-size);margin-top:calc((.3rem - var(--thumb-size)) / 2);border:0;border-radius:50%;background:var(--accent)}input[type=range]::-moz-range-thumb{width:var(--thumb-size);height:var(--thumb-size);border:0;border-radius:50%;background:var(--accent)}input[type=range]:disabled{opacity:.5}.steps{position:relative;height:1.3rem;margin:0 calc(var(--thumb-size) / 2)}.step{position:absolute;top:0;left:var(--step-position);transform:translate(-50%);padding:.35rem 0 0;border:0;background:transparent;color:var(--muted);font:inherit;font-size:.62rem;white-space:nowrap;cursor:default}.step:before{content:"";position:absolute;top:0;left:50%;transform:translate(-50%);width:1px;height:.2rem;background:var(--muted)}.step.active{color:var(--accent)}:is(summary,input,button):focus-visible{outline:2px solid var(--accent);outline-offset:2px}.message{margin:0;color:var(--muted);font-size:.75rem}.error{color:var(--critical, #e5534b)}.retry{margin-left:.5rem;padding:.2rem .4rem;border:1px solid var(--border);border-radius:4px;background:var(--bg);color:var(--text);font:inherit}@container scan-controls (max-width: 50rem){.layout.with-extra{grid-template-columns:minmax(13rem,1fr) minmax(14rem,1fr)}.layout.with-extra .extra{grid-column:1 / -1;align-self:start;min-height:0}}@container scan-controls (max-width: 30rem){.layout,.layout.with-extra{grid-template-columns:minmax(0,1fr);gap:1rem}.layout.with-extra .extra{grid-column:auto}}`;constructor(){super(),this.loadModels=cm,this.pending=!1,this.value=null,this.effort=null,this.hasExtra=!1,this._models=[],this._error=null,this._menuColumns=1,this._positionRequest=0,this._onOutside=t=>{t.composedPath().includes(this)||this._close()},this._onViewportChange=()=>this._positionMenu()}connectedCallback(){super.connectedCallback(),document.addEventListener("pointerdown",this._onOutside),window.addEventListener("resize",this._onViewportChange),window.addEventListener("scroll",this._onViewportChange,!0),this.hasUpdated&&this._load()}updated(t){(t.has("loadModels")||t.has("pending"))&&this.isConnected&&this._load(),t.has("_models")&&this.renderRoot.querySelector("details")?.open&&(this._resetMenuPosition(),this._positionMenu())}disconnectedCallback(){super.disconnectedCallback(),this._controller?.abort(),document.removeEventListener("pointerdown",this._onOutside),window.removeEventListener("resize",this._onViewportChange),window.removeEventListener("scroll",this._onViewportChange,!0)}async _load(){if(this._controller?.abort(),this.pending)return;let t=new AbortController;this._controller=t,this._error=null;let r=!1,n=o=>{if(t.signal.aborted)return;r=!0,this._models=o.models;let i=o.models.find(s=>s.id===this.value);i?i.efforts.includes(this.effort)||this._setEffort(xl(i)):this._select(o.defaultModel)};try{n(await this.loadModels(t.signal,n))}catch(o){!t.signal.aborted&&!r&&(this._error=String(o?.message??o))}}_close(){this._resetMenuPosition();let t=this.renderRoot.querySelector("details");t&&(t.open=!1)}_resetMenuPosition(){this._positionRequest++;let t=this.renderRoot.querySelector(".menu");t&&delete t.dataset.positioned}_toggleMenu(t){this._resetMenuPosition(),t.currentTarget.open&&this._positionMenu()}get _selectedRow(){return uk(this._models).find(t=>t.id===this.value||t.pro?.id===this.value)}async _positionMenu(){let t=++this._positionRequest,r=this.renderRoot.querySelector("details"),n=this.renderRoot.querySelector("summary"),o=this.renderRoot.querySelector(".menu");if(!r?.open||!n||!o)return;let i=n.getBoundingClientRect(),s=6,a=8,c=pk(this._models),u=c.reduce((E,R)=>E+R.models.length,0),p=Math.min(3,c.length,Math.ceil((u+c.length*1.5)/9)),f=parseFloat(getComputedStyle(o).fontSize),h=0;for(let E of o.querySelectorAll(".choice span, legend")){let R=document.createRange();R.selectNodeContents(E),h=Math.max(h,R.getBoundingClientRect().width)}let g=Math.max(11*f,Math.min(18*f,h+2.5*f)),b=1.3*f+2,y=Math.max(1,Math.min(p,Math.floor((window.innerWidth-a*2-b+f)/(g+f)))),k=Math.min(y*g+(y-1)*f+b,window.innerWidth-a*2),v=Math.max(a,Math.min(i.left,window.innerWidth-k-a));if(this._menuColumns=y,await this.updateComplete,t!==this._positionRequest||!this.isConnected||!r.open)return;o.style.left=`${v}px`,o.style.width=`${k}px`,o.style.setProperty("--model-columns",y),o.style.maxHeight=`${Math.max(0,window.innerHeight-a*2)}px`;let x=o.getBoundingClientRect().height,$=window.innerHeight-i.bottom-s-a,C=i.top-s-a,I=$<x&&C>$?i.top-s-x:i.bottom+s;o.style.bottom="auto",o.style.top=`${Math.max(a,Math.min(I,window.innerHeight-x-a))}px`,o.dataset.positioned=""}_select(t,{preserveEffort:r=!1,close:n=!0}={}){let o=this._models.find(i=>i.id===t);o&&(this.value=t,this._setEffort(r&&o.efforts.includes(this.effort)?this.effort:xl(o)),n&&this._close())}_selectRow(t){let r=this._selectedRow?.pro?.id===this.value;this._select(r&&t.pro?t.pro.id:t.id)}_togglePro(){let t=this._selectedRow;t?.pro&&this._select(this.value===t.pro.id?t.id:t.pro.id,{preserveEffort:!0,close:!1})}_setEffort(t){this.effort=t,this.dispatchEvent(new CustomEvent("model-change",{detail:{model:this.value,effort:t},bubbles:!0,composed:!0}))}render(){let t=this._models.find(i=>i.id===this.value);if(this.pending||!t)return d`<div class="${`layout ${this.hasExtra?"with-extra":""}`}" aria-busy="true"><div class="field"><span class="label">Model</span><div class="model-placeholder" role="${this._error?"alert":"status"}">${this._error?d`Couldn’t load models. <button type="button" class="retry" @click="${()=>{this._load()}}">Retry</button>`:"Loading models\u2026"}</div></div><div class="field" aria-hidden="true"><span class="label">Effort</span><div class="effort-placeholder"></div></div>${this.hasExtra?d`<div class="extra"><slot name="effort-extra"></slot></div>`:m}</div>`;let r=this._selectedRow,n=cu(t.id),o=IR(pk(this._models),this._menuColumns);return d`${this._error?d`<p class="message error" role="alert">Couldn’t refresh models: ${this._error}<button class="retry" @click="${()=>{this._load()}}">Retry</button></p>`:m}<div class="${`layout ${this.hasExtra?"with-extra":""}`}"><div class="field"><span class="label" id="model-label">Model</span><div class="model-control"><details @toggle="${this._toggleMenu}" @keydown="${i=>{i.key==="Escape"&&(this._close(),this.renderRoot.querySelector("summary")?.focus())}}"><summary aria-labelledby="model-label selected-model" @click="${this._resetMenuPosition}"><span class="${`icon ${n.key}`}" aria-hidden="true">${du(n.key)}</span><span class="selected-copy"><strong id="selected-model">${Us(r.id)}</strong><small>${n.name}</small></span>${r.pro?d`<span class="pro-space" aria-hidden="true"></span>`:m}${AN}</summary><div class="menu"><div class="groups">${o.map(i=>d`<div class="provider-column">${i.map(s=>this._modelSection(s))}</div>`)}</div></div></details>${r.pro?d`<button type="button" class="pro-toggle" role="switch" aria-label="Pro model" aria-checked="${t.id===r.pro.id}" @click="${this._togglePro}"><span>Pro</span><span class="pro-track" aria-hidden="true"></span></button>`:m}</div></div>${t.efforts.length>0?this._effortSlider(t.efforts):d`<div class="field" aria-hidden="true"></div>`} ${this.hasExtra?d`<div class="extra"><slot name="effort-extra"></slot></div>`:m}</div>`}_modelSection({key:t,models:r}){return d`<fieldset><legend><span class="${`icon ${t}`}" aria-hidden="true">${du(t)}</span>${cu(r[0].id).name}</legend>${r.map(n=>d`<label class="choice"><input type="radio" name="scan-model" value="${n.id}" .checked="${n.id===this.value||n.pro?.id===this.value}" @change="${()=>{this._selectRow(n),this.renderRoot.querySelector("summary")?.focus()}}"><span>${Us(n.id)}</span></label>`)}</fieldset>`}_effortSlider(t){let r=Math.max(0,t.indexOf(this.effort)),n=Math.max(1,t.length-1);return d`<div class="field"><div class="label"><label for="effort">Effort</label><output for="effort">${Hs(t[r])}</output></div><div class="slider" style="${`--effort-fill: calc(var(--thumb-size) / 2 + (100% - var(--thumb-size)) * ${r/n})`}"><input id="effort" type="range" min="0" max="${n}" step="1" .value="${String(r)}" ?disabled="${t.length===1}" aria-valuetext="${Hs(t[r])}" @input="${o=>this._setEffort(t[Number(o.target.value)])}"><div class="steps">${t.map((o,i)=>d`<button type="button" class="${`step ${o===this.effort?"active":""}`}" style="${`--step-position: ${i/n*100}%`}" aria-label="${`Set effort to ${Hs(o)}`}" aria-pressed="${o===this.effort}" @click="${()=>this._setEffort(o)}">${Hs(o)}</button>`)}</div></div></div>`}};customElements.get("scan-model-picker")||customElements.define("scan-model-picker",fk)});var ko,um=w(()=>{"use strict";T();wr();ko=class extends X{static properties={options:{attribute:!1},value:{attribute:!1},label:{type:String},placeholder:{type:String},disabled:{type:Boolean},_query:{state:!0},_facet:{state:!0},_open:{state:!0}};static styles=Me`:host{display:block;min-width:0}*{box-sizing:border-box}button,input{font:inherit;color:var(--text)}button{cursor:default;user-select:none}.trigger{display:flex;align-items:center;gap:.6rem;width:100%;height:2rem;padding:.28rem .5rem;border:1px solid var(--border);border-radius:5px;background:var(--bg);text-align:left;font-size:.76rem}.trigger:hover:not(:disabled){border-color:var(--muted)}.trigger:disabled{opacity:.5}:host([variant=filter]){display:inline-block;max-width:min(20rem,100%)}:host([variant=filter]) .trigger{height:30px;min-width:8.5rem;background:transparent;font-size:.8rem;font-weight:500;border-radius:4px}.name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.option-copy{flex:1;min-width:0;display:grid;gap:.08rem}.secondary{color:var(--muted);font-size:.64rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.avatar{display:grid;place-items:center;flex:0 0 1.5rem;width:1.5rem;height:1.5rem;border-radius:50%;color:var(--accent);background:rgb(from var(--accent) r g b / .13);font-family:sans-serif;font-size:.62rem;font-weight:600}.detail,.count{flex:0 0 auto;color:var(--muted);font-size:.66rem;font-variant-numeric:tabular-nums;white-space:nowrap}svg{flex:0 0 auto;width:.9rem;height:.9rem;color:var(--muted)}.menu{visibility:hidden;position:fixed;inset:auto;margin:0;padding:0;overflow:hidden;border:1px solid var(--border);border-radius:8px;background:var(--bg);color:var(--text);box-shadow:0 .6rem 1.6rem #0006;user-select:none}.menu:popover-open{display:flex;flex-direction:column}.menu[data-positioned]{visibility:visible}.search{display:flex;align-items:center;gap:.5rem;flex:0 0 auto;padding:.55rem .65rem;border-bottom:1px solid var(--border)}input{flex:1;min-width:0;width:0;padding:.15rem 0;border:0;background:transparent;font-size:.78rem;outline:none}input::placeholder{color:var(--muted)}.search:focus-within{box-shadow:inset 0 -2px var(--accent)}.body{display:flex;min-height:0;flex:1}.facets{width:10.5rem;flex:0 0 auto;padding:.35rem;overflow:auto;overscroll-behavior:none;border-right:1px solid var(--border);background:rgb(from var(--bg) r g b / .25)}.org{display:flex;align-items:center;gap:.4rem;width:100%;padding:.4rem .45rem;border:0;border-radius:4px;background:transparent;text-align:left;font-size:.7rem}.org[aria-pressed=true]{color:var(--accent);background:rgb(from var(--accent) r g b / .1)}.results{flex:1;min-width:0;overflow:auto;overscroll-behavior:none;padding:.3rem}.group+.group{margin-top:.35rem;padding-top:.35rem;border-top:1px solid var(--border)}.heading{position:sticky;top:-.3rem;z-index:1;display:flex;align-items:center;gap:.4rem;margin:0;padding:.4rem .5rem;color:var(--muted);background:var(--bg);font-size:.68rem;font-weight:600}.heading svg{width:.8rem;height:.8rem}.option{display:flex;align-items:center;gap:.65rem;width:100%;padding:.35rem .5rem;border:0;border-radius:4px;background:transparent;text-align:left;font-size:.76rem}.option svg{width:.8rem;height:.8rem;opacity:0;color:var(--accent)}.option[aria-selected=true]{color:var(--accent);background:rgb(from var(--accent) r g b / .1)}.option[aria-selected=true] svg{opacity:1}.option:disabled{opacity:.45}.option:hover:not(:disabled),.org:hover{background:rgb(from var(--text) r g b / .05)}.pinned{padding-bottom:.25rem;margin-bottom:.25rem;border-bottom:1px solid var(--border)}.empty{margin:0;padding:1.3rem .7rem;color:var(--muted);font-size:.76rem}button:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}@media(max-width:40rem){.facets{width:8.5rem}}@media(max-width:28rem){.facets{width:7rem}.option{gap:.35rem}}`;constructor(){super(),this.options=[],this.value=null,this.label="Choose",this.placeholder="Choose",this.disabled=!1,this._query="",this._facet=null,this._open=!1,this._menuHeight=null,this._onViewport=()=>this._position()}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this._onViewport),window.addEventListener("scroll",this._onViewport,!0)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this._onViewport),window.removeEventListener("scroll",this._onViewport,!0)}render(){let t=this.options.find(s=>s.value===this.value),r=this.choices(),o=[...r.pinned,...r.sections.flatMap(s=>s.options)].filter(s=>!s.disabled),i=o.find(s=>s.value===this.value)?.value??o[0]?.value;return d`<button type="button" class="trigger" popovertarget="selector-menu" aria-label="${this.label}" aria-haspopup="dialog" aria-expanded="${this._open}" ?disabled="${this.disabled}">${t?this.optionIcon(t):m}<span class="name">${t?.label??this.placeholder}</span>${t?.detail?d`<span class="detail">${t.detail}</span>`:m} <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m4 6 4 4 4-4"/></svg></button><div class="menu" id="selector-menu" popover="auto" role="dialog" aria-label="${this.label}" @beforetoggle="${this._beforeToggle}" @toggle="${this._toggle}" @keydown="${this._keyDown}"><div class="search"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="7" cy="7" r="4.5"/><path d="m10.5 10.5 3.5 3.5"/></svg> <input type="search" placeholder="${`${this.searchLabel}\u2026`}" aria-label="${this.searchLabel}" aria-controls="selector-options" .value="${$e(this._query)}" @input="${s=>{this._query=s.target.value}}"> <span class="count" role="status">${r.count}${r.count===r.total?"":` / ${r.total}`}</span></div><div class="body">${r.showFacets?d`<div class="facets" role="group" aria-label="${this.facetLabel}"><button type="button" class="org" aria-pressed="${r.activeFacet==null}" @click="${()=>this._filterFacet(null)}"><span class="name">${this.allFacetsLabel}</span><span class="count">${r.total}</span></button> ${r.facets.map(s=>d`<button type="button" class="org" title="${s.name}" aria-pressed="${r.activeFacet===s.value}" @click="${()=>this._filterFacet(s.value)}"><span class="name">${s.name}</span><span class="count">${s.count}</span></button>`)}</div>`:m}<div class="results" id="selector-options" role="listbox" aria-label="${this.optionsLabel}">${r.pinned.length>0?d`<div class="pinned">${r.pinned.map(s=>this._option(s,!1,i))}</div>`:m} ${r.sections.map((s,a)=>d`<div class="group" role="group" aria-labelledby="${s.label?`selector-group-${a}`:m}">${s.label?d`<h3 class="heading" id="${`selector-group-${a}`}">${s.organization?d`<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.2" aria-hidden="true"><path d="M3 14V3h6v11M9 7h4v7M1 14h14M5 6h2M5 9h2M5 12h2"/></svg>`:m}${s.label}</h3>`:m} ${s.options.map(c=>this._option(c,s.organization,i))}</div>`)} ${r.count?m:d`<p class="empty">${this.options.length>0?this.noMatchesLabel:this.emptyLabel}</p>`}</div></div></div>`}optionIcon(t){return m}optionTitle(t){return t.label}_option(t,r,n){return d`<button type="button" class="option" role="option" ?data-reset="${t.reset}" ?disabled="${t.disabled}" aria-label="${t.label}" title="${this.optionTitle(t)}" aria-selected="${t.value===this.value}" tabindex="${t.value===n?0:-1}" @click="${()=>this._pick(t.value)}"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m3 8 3 3 7-7"/></svg>${this.optionIcon(t)}${t.initials?d`<span class="avatar" aria-hidden="true">${t.initials}</span>`:m}<span class="option-copy"><span class="name">${t.displayLabel??(r?t.name:t.label)}</span>${t.secondary?d`<span class="secondary">${t.secondary}</span>`:m}</span>${t.detail?d`<span class="detail">${t.detail}</span>`:m}</button>`}updated(t){this.disabled&&this._open&&this._close(!1),t.has("options")&&(this._menuHeight=null),this._position(),(t.has("_query")||t.has("_facet"))&&(this.renderRoot.querySelector(".results").scrollTop=0)}_beforeToggle(t){this._open=t.newState==="open",delete t.target.dataset.positioned,this._open&&(this._query="",this._facet=null,this._menuHeight=null)}async _toggle(t){t.newState==="open"&&(await this.updateComplete,!(!this._open||!this.isConnected)&&(this._position(),this.renderRoot.querySelector("input").focus({preventScroll:!0})))}_position(){let t=this.renderRoot.querySelector(".menu");if(!t?.matches(":popover-open"))return;let r=this.renderRoot.querySelector(".trigger").getBoundingClientRect(),n=8,o=t.querySelector(".facets")!=null,i=Math.min(Math.max(r.width,o?560:360),window.innerWidth-n*2),s=window.innerHeight-r.bottom-n-4,a=r.top-n-4;t.style.width=`${i}px`,this._menuHeight??=Math.min(480,t.querySelector(".search").offsetHeight+Math.max(t.querySelector(".results").scrollHeight,t.querySelector(".facets")?.scrollHeight??0)+2);let c=this._menuHeight,u=s<c&&a>s;t.style.maxHeight=`${Math.max(0,Math.min(c,u?a:s))}px`,t.style.left=`${Math.max(n,Math.min(r.left,window.innerWidth-i-n))}px`,t.style.top=`${Math.max(n,u?r.top-t.offsetHeight-4:r.bottom+4)}px`,t.dataset.positioned=""}_filterFacet(t){this._facet=t,this.renderRoot.querySelector("input").focus({preventScroll:!0})}_keyDown(t){if(t.stopPropagation(),t.key==="Escape"){t.preventDefault(),this._close();return}let r=this.renderRoot.querySelector("input"),n=this.renderRoot.activeElement,o=[...this.renderRoot.querySelectorAll(".option:not(:disabled)")],i=o.indexOf(n);if(n!==r&&i<0)return;if(t.key==="Enter"&&n===r){t.preventDefault(),(this.renderRoot.querySelector(".option:not([data-reset]):not(:disabled)")??o[0])?.click();return}let s;if(t.key==="ArrowDown")s=Math.min(i+1,o.length-1);else if(t.key==="ArrowUp")s=i-1;else if(n!==r&&t.key==="Home")s=0;else if(n!==r&&t.key==="End")s=o.length-1;else if(n!==r&&t.key.length===1&&t.key!==" "&&!t.ctrlKey&&!t.metaKey&&!t.altKey){t.preventDefault(),this._query+=t.key,r.focus();return}else return;t.preventDefault();for(let[a,c]of o.entries())c.tabIndex=a===s?0:-1;s<0?r.focus():o[s]?.focus()}_pick(t){this.disabled||!this.options.some(r=>r.value===t&&!r.disabled)||(this._close(),this.dispatchEvent(new CustomEvent(this.changeEvent,{detail:{value:t},bubbles:!0,composed:!0})))}_close(t=!0){this.renderRoot.querySelector(".menu").hidePopover(),this._open=!1,t&&this.renderRoot.querySelector(".trigger").focus({preventScroll:!0})}}});function TN(e){if(/^https?:\/\//iu.test(e)){try{let r=new URL(e),n=r.pathname.split("/").filter(Boolean);if(n.length>=2)return{owner:`${r.host}/${n[0]}`,name:n.slice(1).join("/")}}catch{}return{owner:null,name:e}}let t=/^([^\s/:]+)\/(.+)$/u.exec(e);return t?{owner:t[1],name:t[2]}:{owner:null,name:e}}function BR(e,t="",r=null,{includeSingletonOrganizations:n=!1}={}){let o=e.map(v=>({...v,...v.special?{owner:null,name:v.label}:TN(v.label)})),i=new Map;for(let v of o)v.owner!=null&&i.set(v.owner,(i.get(v.owner)??0)+1);let s=n?1:2,a=[...i].filter(([,v])=>v>=s).toSorted(([v],[x])=>mk(v,x)).map(([v,x])=>({value:v,name:v,count:x})),c=v=>(i.get(v.owner)??0)<s,u=o.filter(v=>!v.special&&!v.reset&&c(v)).length;u>0&&a.push({value:gk,name:"Other",count:u});let p=a.some(v=>v.value===r)?r:null,f=FR(t.trim()).split(/\s+/u).filter(Boolean),h=v=>f.every(x=>FR(v.label).includes(x)),g=o.filter(v=>v.reset||v.special&&h(v)),b=o.filter(v=>!v.reset&&!v.special&&h(v)&&(p==null||(p===gk?c(v):v.owner===p))),y=new Map;for(let v of b){let x=(i.get(v.owner)??0)>=s?v.owner:null;y.has(x)||y.set(x,[]),y.get(x).push(v)}let k=[...y].toSorted(([v],[x])=>v==null?1:x==null?-1:mk(v,x)).map(([v,x])=>({label:v??(a.some($=>$.value!==gk)?"Other":null),organization:v!=null,options:x.toSorted(($,C)=>mk($.label,C.label))}));return{facets:a,activeFacet:p,pinned:g,sections:k,count:b.length+g.filter(v=>!v.reset).length,total:o.filter(v=>!v.reset).length,showFacets:a.length>1}}var FR,mk,gk,OR=w(()=>{"use strict";FR=e=>e.normalize("NFKC").toLocaleLowerCase(),mk=(e,t)=>e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"}),gk=Symbol("other repositories")});var bk,pm=w(()=>{"use strict";um();OR();bk=class extends ko{constructor(){super(),this.label="Choose repository",this.placeholder="Choose repository"}get searchLabel(){return"Search repositories"}get optionsLabel(){return"Repositories"}get facetLabel(){return"Filter by organization"}get allFacetsLabel(){return"All organizations"}get noMatchesLabel(){return"No matching repositories"}get emptyLabel(){return"No repositories available"}get changeEvent(){return"repository-change"}choices(){return BR(this.options,this._query,this._facet)}};customElements.get("repository-selector")||customElements.define("repository-selector",bk)});var yk,vk=w(()=>{"use strict";um();yk=class extends ko{constructor(){super(),this.label="Choose workspace",this.placeholder="Choose workspace"}get searchLabel(){return"Search workspaces"}get optionsLabel(){return"Workspaces"}get noMatchesLabel(){return"No matching workspaces"}get emptyLabel(){return"No workspaces available"}get changeEvent(){return"workspace-change"}choices(){let t=this._query.normalize("NFKC").toLocaleLowerCase().trim().split(/\s+/u).filter(Boolean),r=this.options.filter(n=>t.every(o=>n.label.normalize("NFKC").toLocaleLowerCase().includes(o))).toSorted((n,o)=>n.label.localeCompare(o.label,void 0,{numeric:!0,sensitivity:"base"}));return{pinned:[],sections:[{label:null,options:r}],facets:[],showFacets:!1,count:r.length,total:this.options.length}}};customElements.get("workspace-selector")||customElements.define("workspace-selector",yk)});function js(e){return!Number.isFinite(e)||e<0?"\u2014":e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KiB`:e<1073741824?`${(e/1048576).toFixed(1)} MiB`:`${(e/1073741824).toFixed(1)} GiB`}function uu(e){return Array.isArray(e)?e.reduce((t,r)=>({bytes:t.bytes!=null&&Number.isFinite(r.bytes)?t.bytes+r.bytes:null,lines:t.lines!=null&&Number.isFinite(r.lines)?t.lines+r.lines:null}),{bytes:0,lines:0}):{bytes:null,lines:null}}function wk(e){return(e??[]).filter(t=>!["resource:base64","directory"].includes(t.format))}var pu=w(()=>{"use strict"});function IN(e){return e.map(t=>{let r=["sourcemap","sourcemaps"].includes(t.kind)||t.filename.toLowerCase().endsWith(".map")?"sourcemap":"stasis",n=r==="sourcemap"?"Sourcemap":"Stasis",o=[];if(typeof t.size=="string"&&!["","\u2014"].includes(t.size)&&o.push(t.size),t.files){o.push(`${t.files.length.toLocaleString()} files`);let{lines:i}=uu(t.files);i!=null&&o.push(`${i.toLocaleString()} LoC`)}else t.summary&&(Number.isSafeInteger(t.summary.files)&&t.summary.files>=0&&o.push(`${t.summary.files.toLocaleString()} files`),Number.isSafeInteger(t.summary.lines)&&t.summary.lines>=0&&o.push(`${t.summary.lines.toLocaleString()} LoC`));return{value:t.id,label:t.filename,detail:n,format:r,secondary:o.join(" \xB7 ")}})}var kk,fm=w(()=>{"use strict";T();qe();um();ft();pu();kk=class extends ko{static properties={bundles:{attribute:!1}};static styles=[ko.styles,Me`.bundle-icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 1.05rem;width:1.05rem;height:1.05rem;color:var(--muted)}.bundle-icon img,.bundle-icon svg{display:block;width:100%;height:100%;opacity:1}.option{gap:.5rem;padding-block:.25rem}.option-copy{gap:0}.option .name{line-height:1.3}.option .bundle-icon{flex-basis:1.35rem;width:1.35rem;height:1.35rem;margin-right:.15rem}.secondary{line-height:1.25;font-variant-numeric:tabular-nums}`];constructor(){super(),this.bundles=[],this.label="Choose bundle",this.placeholder="Choose bundle"}get searchLabel(){return"Search bundles"}get optionsLabel(){return"Bundles"}get noMatchesLabel(){return"No matching bundles"}get emptyLabel(){return"No stored bundles"}get changeEvent(){return"bundle-change"}willUpdate(t){t.has("bundles")&&(this.options=IN(this.bundles))}optionIcon(t){return d`<span class="bundle-icon" aria-hidden="true">${t.format==="sourcemap"?V(Er):d`<img src="./stasis.svg" alt="">`}</span>`}optionTitle(t){return m}choices(){let t=this._query.normalize("NFKC").toLocaleLowerCase().trim().split(/\s+/u).filter(Boolean),r=this.options.filter(n=>t.every(o=>`${n.label} ${n.detail}`.normalize("NFKC").toLocaleLowerCase().includes(o))).toSorted((n,o)=>n.label.localeCompare(o.label,void 0,{numeric:!0,sensitivity:"base"}));return{pinned:[],sections:[{label:null,options:r}],facets:[],showFacets:!1,count:r.length,total:this.options.length}}};customElements.get("bundle-selector")||customElements.define("bundle-selector",kk)});var fu,xk,PR=w(()=>{"use strict";T();qe();rh();Ci();fm();pm();vk();fu=e=>({kind:e,sourceId:null,ids:new Set}),xk=class extends X{static properties={mode:{type:String},loadSources:{attribute:!1},restore:{attribute:!1},_sources:{state:!0},_loading:{state:!0},_error:{state:!0},_merge:{state:!0},_link:{state:!0}};constructor(){super(),this.mode="link",this._sources=null,this._loading=!1,this._error=null,this._merge=fu("bundle"),this._link=fu("repository")}disconnectedCallback(){super.disconnectedCallback(),this._controller?.abort()}updated(t){if(t.has("loadSources")){this._load();return}t.has("mode")&&this._selectOnlySource(),t.has("restore")&&this._restore(),["_sources","_merge","_link","mode","restore"].some(r=>t.has(r))&&this._notify()}get _current(){return this.mode==="merge"?this._merge:this._link}get _parents(){if(this.mode==="merge")return this._sources?.merge?.bundles??[];let t=this._sources?.link?.reports??[];return this._current.kind==="workspace"?(this._sources?.link?.workspaces??[]).filter(r=>t.some(n=>r.reports.includes(n.id))):(this._sources?.link?.repositories??[]).filter(r=>t.some(n=>n.repoIds.includes(r.id)))}get _parent(){return this._parents.find(t=>t.id===this._current.sourceId)}get _scopeOptions(){let t=this._sources?.link?.reports??[];return this._parents.map(r=>{let n=t.filter(o=>this._current.kind==="workspace"?r.reports.includes(o.id):o.repoIds.includes(r.id)).length;return{value:r.id,label:r.label,detail:`${n} ${n===1?"report":"reports"}`}})}get _inputs(){return this._parent?this.mode==="merge"?(this._sources?.merge?.results??[]).filter(t=>t.bundleId===this._parent.id):(this._sources?.link?.reports??[]).filter(t=>this._current.kind==="workspace"?this._parent.reports.includes(t.id):t.repoIds.includes(this._parent.id)):[]}get selection(){let t=this._parent;return{mode:this.mode,source:t?{kind:this._current.kind,id:t.id,label:t.label??t.filename}:null,inputs:this._loading||this._error?[]:this._inputs.filter(r=>this._current.ids.has(r.id))}}_notify(){this.dispatchEvent(new CustomEvent("report-inputs-change",{detail:this.selection,bubbles:!0,composed:!0}))}async _load(){this._controller?.abort();let t=this._controller=new AbortController;this._loading=!0,this._error=null,this._notify();let r=!1,n=o=>{if(t.signal.aborted)return;let i=!r;r=!0,this._sources=o,i&&(this._merge=fu("bundle"),this._link=fu(Array.isArray(o.link?.workspaces)?"workspace":"repository")),this._selectOnlySource(),i&&this._restore(),this._loading=!1,this._notify()};try{n(this.loadSources?await this.loadSources(t.signal,n):{merge:{bundles:[],results:[]},link:{repositories:[],reports:[]}})}catch(o){!t.signal.aborted&&!r&&(this._error=String(o?.message??o))}finally{t.signal.aborted||(this._loading=!1,this._notify())}}_setCurrent(t){this.mode==="merge"?this._merge=t:this._link=t}_selectSource(t){t===this._current.sourceId||!this._parents.some(r=>r.id===t)||(this._setCurrent({...this._current,sourceId:t,ids:new Set}),this._setCurrent({...this._current,ids:new Set(this._inputs.map(r=>r.id))}),this._notify())}_changeKind(t){["workspace","repository"].includes(t)&&(t==="workspace"&&!Array.isArray(this._sources?.link?.workspaces)||(t!==this._link.kind&&(this._link=fu(t)),this._selectOnlySource(),this._notify()))}_selectOnlySource(){this.mode==="link"&&this._current.sourceId==null&&this._parents.length===1&&this._selectSource(this._parents[0].id)}_toggle(t,r){if(!this._inputs.some(o=>o.id===t))return;let n=new Set(this._current.ids);r?n.add(t):n.delete(t),this._setCurrent({...this._current,ids:n}),this._notify()}_selectAll(t){this._setCurrent({...this._current,ids:new Set(t?this._inputs.map(r=>r.id):[])}),this._notify()}_restore(){let t=this.restore;if(!this._sources||t?.mode!==this.mode||!t.source)return;let r=this.mode==="merge"?"bundle":t.source.kind;this.mode==="link"&&(r==="workspace"?!Array.isArray(this._sources.link?.workspaces):r!=="repository")||(this._setCurrent({kind:r,sourceId:t.source.id,ids:new Set}),this._setCurrent({...this._current,ids:new Set(this._inputs.filter(n=>t.inputIds.includes(n.id)).map(n=>n.id))}))}render(){let t=this.mode==="merge",r=this._inputs,n=r.filter(s=>this._current.ids.has(s.id)).length,o=Array.isArray(this._sources?.link?.workspaces),i=this._parent?t?"No scan results for this bundle.":`No saved reports in this ${this._current.kind}.`:t?"Choose a bundle to see its scan results.":this._parents.length===0?"No saved reports with app findings.":`Choose a ${this._current.kind} to see its saved reports.`;return d`<section class="panel" aria-label="${t?"Merge scan results":"Link saved reports"}" aria-busy="${this._loading}"><div class="source">${!t&&o?d`<div class="kinds" role="radiogroup" aria-label="Report source">${[["workspace","Workspace"],["repository","Repository"]].map(([s,a])=>d`<button type="button" role="radio" aria-checked="${s===this._link.kind}" @click="${()=>this._changeKind(s)}">${a}</button>`)}</div>`:m}<div class="field">${t?d`<span>Bundle with scan results</span>`:m} ${t?d`<bundle-selector .bundles="${this._parents}" .value="${this._current.sourceId}" ?disabled="${this._loading||this._parents.length===0}" @bundle-change="${s=>this._selectSource(s.detail.value)}"></bundle-selector>`:this._current.kind==="workspace"?d`<workspace-selector .options="${this._scopeOptions}" .value="${this._current.sourceId}" ?disabled="${this._loading}" @workspace-change="${s=>this._selectSource(s.detail.value)}"></workspace-selector>`:d`<repository-selector .options="${this._scopeOptions}" .value="${this._current.sourceId}" ?disabled="${this._loading}" @repository-change="${s=>this._selectSource(s.detail.value)}"></repository-selector>`}</div></div><div class="input-results">${this._error?d`<p class="empty" role="alert">Couldn’t load report inputs: ${this._error} <button type="button" @click="${()=>{this._load()}}">Retry</button></p>`:this._loading&&this._sources==null?d`<p class="empty" role="status">Loading report inputs…</p>`:r.length>0?d`<div class="list-head"><label><input type="checkbox" aria-label="Select all" ?disabled="${this._loading}" .checked="${n===r.length}" .indeterminate="${n>0&&n<r.length}" @change="${s=>this._selectAll(s.target.checked)}"><strong>All</strong></label><span>${n} of ${r.length} selected</span></div><div class="list">${r.map(s=>this._row(s))}</div>`:d`<p class="empty">${t&&this._parents.length===0?"No scan results available.":i}</p>`}</div></section>`}_row(t){let r=this.mode==="link"?t.appFindings:t.findings,n=[t.model?Us(t.model):null,r==null?null:`${r} ${this.mode==="link"?"app ":""}${r===1?"finding":"findings"}`,t.createdAt,t.repo?`${t.repo}${t.directory?`/${t.directory}`:""}`:null].filter(Boolean);return d`<label class="option"><input type="checkbox" ?disabled="${this._loading}" .checked="${this._current.ids.has(t.id)}" @change="${o=>this._toggle(t.id,o.target.checked)}">${V(vd[t.analyzer]??vd.default)}<span class="copy"><strong>${t.title??t.filename}</strong><span>${n.join(" \xB7 ")}</span></span></label>`}static styles=Me`:host{display:block;min-width:0}*{box-sizing:border-box}.panel{border:1px solid var(--border);border-radius:9px;background:var(--surface);overflow:hidden}.source{display:flex;flex-wrap:wrap;align-items:center;gap:.7rem;padding:.85rem .9rem;border-bottom:1px solid var(--border)}.field{display:grid;flex:1 1 14rem;gap:.3rem;max-width:32rem;min-width:0}.field>span{color:var(--muted);font-size:.72rem}button{padding:.3rem .55rem;border:1px solid var(--border);border-radius:5px;color:var(--text);background:var(--bg);font:inherit;font-size:.74rem;cursor:default}.kinds{display:flex;width:fit-content;border:1px solid var(--border);border-radius:5px;overflow:hidden}.kinds button{padding-block:.5rem;border:0;border-radius:0;color:var(--muted)}.kinds button+button{border-left:1px solid var(--border)}.kinds button[aria-checked=true]{color:var(--text);background:var(--surface-active)}.list-head{flex-shrink:0;display:flex;align-items:center;justify-content:space-between;gap:.5rem;padding:.55rem .9rem;border-bottom:1px solid var(--border)}.list-head label{display:flex;align-items:center;gap:.55rem;user-select:none}.list-head strong{color:var(--text);font-size:.74rem;font-weight:600}.list-head>span{color:var(--muted);font-size:.68rem}.input-results{height:16rem;display:flex;flex-direction:column;overflow:auto}.list{min-height:0;overflow:auto;overscroll-behavior:none}.option{display:flex;align-items:center;gap:.55rem;min-width:0;padding:.35rem .9rem;user-select:none}.option+.option{border-top:1px solid var(--border)}.option:hover{background:var(--surface-active)}input{width:.85rem;height:.85rem;margin:0;flex:0 0 auto;accent-color:var(--accent)}.file-icon{width:1.4rem;height:1.4rem;flex:0 0 auto}.copy{display:flex;align-items:center;justify-content:space-between;gap:.75rem;flex:1;min-width:0}.copy strong,.copy span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.copy strong{flex:1;color:var(--text);font-size:.74rem;font-weight:500}.copy span{max-width:55%;color:var(--muted);font-size:.66rem}.empty{margin:0;padding:1rem .9rem;color:var(--muted);font-size:.76rem}button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}`};customElements.get("scan-report-inputs")||customElements.define("scan-report-inputs",xk)});var LN,FN,$k,_k=w(()=>{"use strict";T();LN=d`<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M6 4h7M6 8h7M6 12h7M3 4h.01M3 8h.01M3 12h.01"/></svg>`,FN=d`<svg viewBox="0 0 16 16" aria-hidden="true"><circle cx="7" cy="7" r="4.5"/><path d="m10.5 10.5 3 3M7 5v4M5 7h4"/></svg>`,$k=class extends X{static properties={isolate:{type:Boolean},vertical:{type:Boolean,reflect:!0}};constructor(){super(),this.isolate=!1,this.vertical=!1}_select(t){this.isolate!==t&&(this.isolate=t,this.dispatchEvent(new CustomEvent("depth-change",{detail:{isolate:t},bubbles:!0,composed:!0})))}render(){return d`<div class="scan-depth"><div class="depth-options" role="radiogroup" aria-label="Scan depth" aria-orientation="${this.vertical?"vertical":"horizontal"}" aria-describedby="${this.vertical?m:"scan-depth-description"}">${[[!1,"List",LN],[!0,"Isolate",FN]].map(([t,r,n])=>d`<label class="depth-choice"><input type="radio" name="scan-depth" value="${t?"isolate":"list"}" .checked="${this.isolate===t}" @change="${()=>this._select(t)}"><span>${n}${r}</span></label>`)}</div>${this.vertical?m:d`<div class="depth-description" id="scan-depth-description" aria-live="polite"><span class="${this.isolate?"inactive":""}" aria-hidden="${this.isolate}">Regular scan depth</span><span class="${this.isolate?"":"inactive"}" aria-hidden="${!this.isolate}">Deeper search at ~10x the tokens spent</span></div>`}</div>`}static styles=Me`:host{display:block;width:19rem;max-width:100%;min-width:0}*{box-sizing:border-box}.scan-depth{display:grid;gap:.4rem;width:100%;min-width:0;user-select:none}.depth-options{display:flex;position:relative;padding:.2rem;border:1px solid var(--border);border-radius:8px;background:var(--bg)}.depth-options:before{content:"";position:absolute;inset:.2rem auto .2rem .2rem;width:calc((100% - .4rem)/2);border-radius:5px;background:var(--surface-active);box-shadow:0 1px 3px #0000001f,inset 0 0 0 1px rgb(from var(--accent) r g b / .18);transition:transform .16s ease-out}.depth-options:has(input[value=isolate]:checked):before{transform:translate(100%)}.depth-choice{position:relative;flex:1;min-width:0}.depth-choice input{position:absolute;width:1px;height:1px;opacity:0}.depth-choice span{display:flex;align-items:center;justify-content:center;gap:.4rem;height:1.9rem;padding:.3rem .65rem;border-radius:5px;color:var(--muted);font-size:.76rem;font-weight:500;transition:color .12s}.depth-choice svg{width:.95rem;height:.95rem;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}.depth-choice:hover span{color:var(--text)}.depth-choice input:checked+span{color:var(--accent)}.depth-choice input:focus-visible+span{outline:2px solid var(--accent);outline-offset:-2px}.depth-description{display:grid;color:var(--muted);font-size:.68rem;line-height:1.4}.depth-description span{grid-area:1 / 1}.depth-description .inactive{visibility:hidden}@media(prefers-reduced-motion:reduce){.depth-options:before,.depth-choice span{transition:none}}:host([vertical]){width:5.8rem}:host([vertical]) .depth-options{flex-direction:column}:host([vertical]) .depth-options:before{inset:.2rem .2rem auto;width:auto;height:calc((100% - .4rem)/2)}:host([vertical]) .depth-options:has(input[value=isolate]:checked):before{transform:translateY(100%)}:host([vertical]) .depth-choice span{justify-content:flex-start;height:1.7rem;padding:.25rem .5rem;font-size:.72rem}`};customElements.get("scan-depth-toggle")||customElements.define("scan-depth-toggle",$k)});function NR(e){let t=e[0];return t?.model&&e.every(r=>r.model===t.model&&r.effort===t.effort)?{model:t.model,effort:t.effort}:null}function DR(e,t){let r=t.models.find(n=>n.id===e?.model)??t.models.find(n=>n.id===t.defaultModel)??t.models[0];return r?{model:r.id,effort:r.efforts.includes(e?.effort)?e.effort:xl(r)}:null}function Ck(e,t){let r=t.models.find(n=>n.id===t.defaultModel)??t.models[0];return r?(e.length>0?e:[{mode:"generic",isolate:!1}]).map(n=>{let o=t.models.find(i=>i.id===n.model)??r;return{...n,mode:Sk.includes(n.mode)?n.mode:"generic",model:o.id,effort:o.efforts.includes(n.effort)?n.effort:xl(o),isolate:!!n.isolate}}):[]}function Ek(e){let t=new Set;return e.map(r=>{let n=BN(r),o=t.has(n);return t.add(n),o})}var Sk,BN,zR=w(()=>{"use strict";Ci();Sk=["security","generic","correctness"],BN=e=>JSON.stringify([e.mode,e.model,e.effort,e.isolate])});var Rk,UR=w(()=>{"use strict";T();wr();Mt();hk();_k();Ci();zR();Rk=class extends X{static properties={value:{attribute:!1},loadModels:{attribute:!1},appModel:{attribute:!1},appModelAutomatic:{attribute:!1},_rows:{state:!0},_loading:{state:!0},_error:{state:!0},_resolvedAppModel:{state:!0},_appModelOpen:{state:!0}};constructor(){super(),this.value=[],this.appModel=null,this.appModelAutomatic=!0,this._resolvedAppModel=null,this._appModelOpen=!1,this._appModelsAgree=!0,this._rows=[],this._catalogue={models:[]},this._nextId=0,this._loading=!0,this._error=null}disconnectedCallback(){super.disconnectedCallback(),this._controller?.abort()}updated(t){if(t.has("loadModels")){this._load();return}t.has("value")&&this.value!==this._lastEmitted&&!this._loading?(this._setRows(this.value),this._notify()):(t.has("appModel")||t.has("appModelAutomatic"))&&!this._loading&&this._notify()}_setRows(t){this._rows=Ck(t,this._catalogue).map(r=>({...r,id:r.id??++this._nextId}))}_notify(){let t=this._loading&&this._rows.length===0?this.value:this._rows.map(({id:n,...o})=>o);this._loading||this._syncAppModel();let r=!this._loading&&!this._error&&this._resolvedAppModel!=null&&t.length>0&&!Ek(t).includes(!0);this._lastEmitted=t,this.dispatchEvent(new CustomEvent("regimes-change",{detail:{value:t,ready:r,appModel:this._resolvedAppModel??this.appModel,appModelAutomatic:this.appModelAutomatic},bubbles:!0,composed:!0}))}_syncAppModel(){let t=NR(this._rows),r=DR((this.appModelAutomatic?t:null)??this.appModel??this._rows[0],this._catalogue);(this.appModel?.model!==r?.model||this.appModel?.effort!==r?.effort)&&(this.appModel=r),this._resolvedAppModel=this.appModel;let n=!!t&&t.model===r?.model&&t.effort===r?.effort;n!==this._appModelsAgree&&(this._appModelOpen=!n),this._appModelsAgree=n}_changeAppModel(t){t.model===this._resolvedAppModel?.model&&t.effort===this._resolvedAppModel?.effort||(this.appModelAutomatic=!1,this.appModel={model:t.model,effort:t.effort},this._notify())}async _load(){this._controller?.abort();let t=this._controller=new AbortController;this._loading=!0,this._error=null,this._notify();let r=!1,n=o=>{t.signal.aborted||(r=!0,this._catalogue=o,this._sharedModels=()=>Promise.resolve(o),this._setRows(this._rows.length>0?this._rows:this.value),this._loading=!1,this._notify())};try{n(await this.loadModels(t.signal,n))}catch(o){!t.signal.aborted&&!r&&(this._error=String(o?.message??o))}finally{t.signal.aborted||(this._loading=!1,this._notify())}}_change(t,r){let n=this._rows.find(i=>i.id===t);if(!n)return;let o=Ck([{...n,...r}],this._catalogue)[0];o&&(this._rows=this._rows.map(i=>i.id===t?o:i),this._notify())}_add(){let t=this._rows.at(-1);t&&(this._rows=[...this._rows,{...t,id:++this._nextId}],this._notify())}_remove(t){this._rows.length<=1||(this._rows=this._rows.filter(r=>r.id!==t),this._notify())}render(){let t=this._loading&&this._rows.length===0,r=t?(this.value.length>0?this.value:[{mode:"generic",isolate:!1}]).map((o,i)=>({...o,id:`pending-${i}`})):this._rows,n=Ek(this._rows);return d`<section aria-label="Scan regimes" aria-busy="${this._loading}"><div class="heading"><h2>Scan regimes</h2><span>${r.length} ${r.length===1?"regime":"regimes"}</span></div>${this._error?d`<p class="message" role="alert">Couldn’t load models: ${this._error} <button type="button" @click="${()=>{this._load()}}">Retry</button></p>`:m} ${re(r,o=>o.id,(o,i)=>this._row(o,i,n[i],t))}<div class="footer"><button type="button" class="add" ?disabled="${this._loading||this._rows.length===0}" @click="${this._add}"><span aria-hidden="true">+</span> Add regime</button><span class="message" role="status">${n.includes(!0)?"Change or remove duplicate regimes to run the scan":"Results from these regimes will be merged"}</span></div>${t?d`<div class="app-model"><div class="app-model-placeholder">App model: Loading…</div></div>`:this._appModelRow()}</section>`}_appModelRow(){let t=this._resolvedAppModel;return t?d`<details class="app-model" .open="${$e(this._appModelOpen)}" @toggle="${r=>{this._appModelOpen=r.currentTarget.open}}"><summary><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m6 3 5 5-5 5"/></svg><span class="app-model-name">App model: <strong>${Us(t.model)}</strong></span><span class="app-model-effort">Effort: <strong>${Hs(t.effort)}</strong></span></summary><div class="app-model-controls"><scan-model-picker .loadModels="${this._sharedModels}" .value="${$e(t.model)}" .effort="${$e(t.effort)}" @model-change="${r=>{r.stopPropagation(),this._changeAppModel(r.detail)}}"></scan-model-picker></div></details>`:m}_row(t,r,n,o=!1){return d`<div class="${`row${n?" duplicate":""}`}" ?inert="${o}" role="group" aria-label="${`Regime ${r+1}`}" aria-describedby="${n?`duplicate-${t.id}`:m}"><div class="mode" role="radiogroup" aria-label="Scan mode">${Sk.map(i=>d`<label class="mode-choice"><input type="radio" name="${`regime-mode-${t.id}`}" .checked="${t.mode===i}" @change="${()=>this._change(t.id,{mode:i})}"><span>${i[0].toUpperCase()+i.slice(1)}</span></label>`)}</div><scan-model-picker .pending="${o}" .loadModels="${this._sharedModels}" .value="${$e(t.model)}" .effort="${$e(t.effort)}" @model-change="${i=>{i.stopPropagation(),this._change(t.id,i.detail)}}"></scan-model-picker><div class="row-actions"><scan-depth-toggle vertical .isolate="${t.isolate}" @depth-change="${i=>{i.stopPropagation(),this._change(t.id,{isolate:i.detail.isolate})}}"></scan-depth-toggle>${n?d`<span class="duplicate-label" id="${`duplicate-${t.id}`}">Duplicate regime</span>`:m}</div><button type="button" class="remove" aria-label="${`Remove regime ${r+1}`}" ?disabled="${this._rows.length===1}" @click="${()=>this._remove(t.id)}"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" aria-hidden="true"><path d="m4 4 8 8M12 4l-8 8"/></svg></button></div>`}static styles=Me`:host{display:block;min-width:0;container:regime-editor / inline-size}*{box-sizing:border-box}.heading{display:flex;align-items:baseline;gap:.65rem;margin-bottom:.75rem}h2{margin:0;color:var(--text);font-size:.85rem;font-weight:600}.heading>span{color:var(--muted);font-size:.7rem}.row{position:relative;display:grid;grid-template-columns:7.75rem minmax(0,1fr) 5.8rem;align-items:start;gap:1rem;padding:.85rem 0;border-top:1px solid var(--border)}.mode{display:grid;min-width:0;border:1px solid var(--border);border-radius:6px;overflow:hidden;background:var(--bg)}.mode-choice{position:relative;user-select:none}.mode-choice+.mode-choice{border-top:1px solid var(--border)}.mode-choice input{position:absolute;width:1px;height:1px;opacity:0}.mode-choice span{display:block;padding:.2rem .6rem;color:var(--muted);font-size:.72rem;line-height:1.15rem}.mode-choice:hover span{background:var(--surface-active)}.mode-choice input:checked+span{color:var(--accent);background:rgb(from var(--accent) r g b / .1);box-shadow:inset 2px 0 var(--accent);font-weight:600}.mode-choice input:focus-visible+span{outline:2px solid var(--accent);outline-offset:-2px}button{border:1px solid var(--border);border-radius:5px;color:var(--text);background:var(--bg);font:inherit;font-size:.74rem;cursor:default}button{padding:.4rem .55rem;user-select:none}button:hover:not(:disabled){background:var(--surface-active)}button:disabled{opacity:.35}.row-actions{position:relative;display:flex;align-items:center;align-self:stretch;min-height:4.65rem;padding:.8rem 0 .25rem}.remove{position:absolute;top:.15rem;right:0;display:grid;place-items:center;width:1.5rem;height:1.5rem;padding:.25rem;border:0;background:transparent;color:var(--muted)}.duplicate-label{position:absolute;right:.15rem;bottom:-.05rem;transform:rotate(-7deg);padding:.1rem .3rem;border:1px solid rgb(from var(--critical, #e5534b) r g b / .45);border-radius:3px;color:var(--critical, #e5534b);background:var(--surface);font-size:.6rem;line-height:1rem;white-space:nowrap;pointer-events:none;user-select:none}svg{width:1rem;height:1rem}.footer{display:flex;flex-wrap:wrap;align-items:center;gap:.7rem;padding-top:.6rem;border-top:1px solid var(--border)}.add{display:flex;align-items:center;gap:.3rem}.app-model{margin-top:.7rem;border-top:1px solid var(--border)}.app-model-placeholder{padding:.65rem 0 .1rem;color:var(--muted);font-size:.74rem}.app-model>summary{display:flex;flex-wrap:wrap;align-items:center;gap:.35rem .8rem;padding:.65rem 0 .1rem;color:var(--muted);font-size:.74rem;list-style:none;cursor:default;user-select:none}.app-model>summary::-webkit-details-marker{display:none}.app-model>summary:hover{color:var(--text)}.app-model>summary:focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:3px}.app-model>summary svg{width:.8rem;height:.8rem;flex:0 0 .8rem}.app-model[open]>summary svg{transform:rotate(90deg)}.app-model strong{color:var(--text);font-weight:500}.app-model-name{min-width:0;overflow-wrap:anywhere}.app-model-effort{white-space:nowrap}.app-model-controls{padding:.85rem 0 .15rem}.message{margin:0;color:var(--muted);font-size:.7rem}button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}@container regime-editor (max-width: 54rem){.row{grid-template-columns:minmax(0,1fr) 5.8rem}scan-model-picker{grid-row:2;grid-column:1 / -1}.mode{grid-column:1;max-width:9rem}.row-actions{grid-column:2}}`};customElements.get("scan-regime-editor")||customElements.define("scan-regime-editor",Rk)});var jR,HR=w(()=>{jR=`:host{display:block;min-width:0;color:var(--text);container:mode-selector / inline-size}*{box-sizing:border-box}section{overflow:hidden;border:1px solid var(--border);border-radius:9px;background:var(--surface)}header{display:flex;align-items:baseline;gap:.8rem;padding:.85rem 1rem .7rem}h2{margin:0;font-size:.86rem;font-weight:600}header>span{color:var(--muted);font-size:.73rem}fieldset{min-width:0;margin:0;padding:0;border:0}.modes{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.5rem;padding:0 1rem .9rem}.mode{position:relative;display:flex;align-items:flex-start;gap:.55rem;padding:.7rem .65rem;border:1px solid var(--border);border-radius:7px;background:var(--bg);cursor:default;text-align:left}.mode:hover{background:var(--surface-active)}.mode:has(:checked){border-color:rgb(from var(--accent) r g b / .6);background:rgb(from var(--accent) r g b / .07)}input{position:absolute;width:1px;height:1px;opacity:0;margin:0}.mode:has(:focus-visible),.subtype-option:has(:focus-visible){outline:2px solid var(--accent);outline-offset:3px}.mode-icon{display:flex;flex-shrink:0;color:var(--muted);padding-top:.1rem}.mode-icon svg{width:1rem;height:1rem}.mode-copy{display:grid;min-width:0;gap:.35rem;padding-right:.55rem}.mode-copy strong{font-size:.78rem;font-weight:500;line-height:1.3}.mode-copy>span{color:var(--muted);font-size:.69rem;line-height:1.4}.mode:has(:checked) .mode-copy strong,.mode:has(:checked) .mode-icon{color:var(--accent)}.indicator{position:absolute;right:.55rem;top:.75rem;width:.55rem;height:.55rem;border:1px solid var(--muted);border-radius:50%;opacity:.5}.mode:has(:checked) .indicator{border-color:var(--accent);background:var(--accent);box-shadow:inset 0 0 0 2px var(--bg);opacity:1}.subtype-wrap{border-top:1px solid var(--border);background:rgb(from var(--accent) r g b / .025)}.subtype-options{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.45rem;padding:.7rem .9rem .45rem}.report-subtypes{grid-template-columns:repeat(2,minmax(0,1fr));padding-bottom:.7rem}.subtype-option{position:relative;display:grid;gap:.12rem;padding:.42rem .55rem;border:1px solid var(--border);border-radius:5px;color:var(--muted);background:var(--bg);text-align:left}.subtype-option strong{color:var(--text);font-size:.72rem;font-weight:500}.subtype-option span{font-size:.62rem}.subtype-option:has(:checked){border-color:rgb(from var(--accent) r g b / .55);background:rgb(from var(--accent) r g b / .1)}.subtype-option:has(:checked) strong{color:var(--accent)}.subtype-help{margin:0;padding:.15rem .9rem .72rem;color:var(--muted);font-size:.68rem;line-height:1.4}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}@container mode-selector (max-width: 48rem){.modes,.subtype-options{grid-template-columns:repeat(2,minmax(0,1fr))}}@container mode-selector (max-width: 30rem){.mode-icon{display:none}header>span{display:none}}
125
+ `});var PN,NN,DN,Mk,VR=w(()=>{"use strict";T();qe();ft();HR();PN=[{id:"code",label:"Code",detail:"Run a full scan of the codebase",icon:th},{id:"dependencies",label:"Dependency alerts",detail:"Validate incoming alerts against actual code",icon:F5},{id:"agentic",label:"Agentic",detail:"Free-form analysis with your instructions",icon:B5},{id:"report",label:"Reports",detail:"Link saved reports or merge scan results",icon:eh}],NN=[{id:"generic",label:"Generic",detail:"Free-form code scan: wide-scoped, most results"},{id:"security",label:"Security",detail:"Security findings only"},{id:"correctness",label:"Correctness",detail:"Guided correctness scan"},{id:"advanced",label:"Advanced",detail:"Merge multiple regimes"}],DN=[{id:"link",label:"Link",detail:"Link findings across saved reports"},{id:"merge",label:"Merge",detail:"Combine scan results for one bundle"}],Mk=class extends X{static properties={mode:{},analyzer:{},reportMode:{}};static styles=A(jR);constructor(){super(),this.mode="code",this.analyzer="generic",this.reportMode="link"}_choose(t,r){this.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0}))}render(){let t=this.mode==="code",r=this.mode==="report",n=t?NN:DN,o=t?this.analyzer:this.reportMode;return d`<section aria-labelledby="mode-heading"><header><h2 id="mode-heading">Scan mode</h2><span>Choose what the server should analyze</span></header><fieldset class="modes"><legend class="sr-only">Scan mode</legend>${PN.map(i=>d`<label class="mode"><input type="radio" name="scan-mode" .checked="${this.mode===i.id}" aria-label="${i.label}" @change="${()=>this._choose("scan-mode-change",{mode:i.id})}"> <span class="mode-icon" aria-hidden="true">${V(i.icon)}</span> <span class="mode-copy"><strong>${i.label}</strong><span>${i.detail}</span></span> <span class="indicator" aria-hidden="true"></span></label>`)}</fieldset>${t||r?d`<div class="subtype-wrap"><fieldset class="${`subtype-options ${r?"report-subtypes":""}`}"><legend class="sr-only">${t?"Code subtype":"Reports submode"}</legend>${n.map(i=>d`<label class="subtype-option"><input type="radio" name="scan-focus" .checked="${o===i.id}" aria-label="${i.label}" @change="${()=>t?this._choose("scan-analyzer-change",{analyzer:i.id}):this._choose("scan-report-mode-change",{mode:i.id})}"> <strong>${i.label}</strong><span>${i.detail}</span></label>`)}</fieldset>${t?d`<p class="subtype-help">Focusing controls how effort is spent: while Generic can also find security issues, a focused Security scan is likely to find more.</p>`:m}</div>`:m}</section>`}};customElements.get("scan-mode-selector")||customElements.define("scan-mode-selector",Mk)});var WR,KR=w(()=>{"use strict";T();WR=Me`:host{display:block;box-sizing:border-box;color:var(--text)}*{box-sizing:border-box}.wrap{max-width:76rem;margin:0 auto;container:scan-page / inline-size}.head{display:flex;flex-wrap:wrap;align-items:center;gap:.65rem;min-height:2.1rem;margin-bottom:.45rem}.head-title{display:flex;align-items:center;gap:.65rem}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}h1{margin:0;font-size:1.65rem;font-weight:600;letter-spacing:-.035em}.head-tabs{display:inline-flex;flex-shrink:0;margin-left:auto;margin-block:calc(-.25rem - 1px);border:1px solid var(--border);border-radius:6px;overflow:hidden}.head-tabs button{border:0;border-right:1px solid var(--border);padding:.25rem .6rem;color:var(--muted);background:transparent;font:inherit;font-size:.75rem;line-height:1.5}.head-tabs button:last-child{border-right:0}.head-tabs button.active{color:var(--text);background:var(--surface-active)}.head-tabs button:hover{color:var(--text)}.source-choice.single-repository{grid-template-columns:1fr}.head-actions{margin-left:auto;display:flex;gap:.45rem}button,select,input{font:inherit}button{cursor:default}button:focus-visible,select:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.intro-row{display:flex;align-items:center;flex-wrap:wrap;gap:.65rem 1rem;margin-bottom:1.15rem}.intro{margin:0;max-width:52rem;color:var(--muted);font-size:.82rem;line-height:1.5}.intro span{display:block}.notice{margin:0 0 1rem;padding:.55rem .7rem;border:1px solid rgb(from var(--accent) r g b / .35);border-radius:7px;color:var(--text);background:rgb(from var(--accent) r g b / .08);font-size:.78rem}.setup{display:grid;gap:.85rem}.panel{border:1px solid var(--border);border-radius:9px;background:var(--surface);overflow:hidden}.panel-head{display:flex;align-items:baseline;justify-content:space-between;gap:.7rem;padding:.72rem .9rem;border-bottom:1px solid var(--border)}.panel-head h2{margin:0;font-size:.86rem;font-weight:600}.panel-head p{margin:0;color:var(--muted);font-size:.72rem}.bundle-choice{display:grid;grid-template-columns:minmax(16rem,1.2fr) minmax(0,1fr);gap:1rem;align-items:end;padding:.85rem .9rem}.field{display:grid;gap:.3rem;min-width:0}.field label,.scope-field>span{color:var(--muted);font-size:.68rem}select{min-width:0;height:2rem;padding:.28rem .5rem;border:1px solid var(--border);border-radius:5px;color:var(--text);background:var(--bg);font-size:.76rem}.bundle-stats{display:grid;grid-template-columns:repeat(4,max-content);align-items:center;gap:.45rem 1.1rem;min-width:0}.metric{display:inline-flex;align-items:center;gap:.3rem;min-width:0;white-space:nowrap}.metric svg{flex:0 0 auto;width:.85rem;height:.85rem;margin-right:.1rem;color:var(--muted)}.metric strong{min-width:0;overflow:hidden;text-overflow:ellipsis;font-size:.72rem;font-weight:600;font-variant-numeric:tabular-nums}.metric span{color:var(--muted);font-size:.7rem}.source-choice{display:grid;grid-template-columns:minmax(12rem,.8fr) minmax(16rem,1.2fr);gap:.7rem;align-items:end;padding:.85rem .9rem}.source-footer{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:.7rem 1rem;grid-column:1 / -1;min-width:0}.scope-slot{justify-self:end;width:min(34rem,100%);min-height:2rem}.source-footer .bundle-stats{min-height:2rem}.choice-empty{display:flex;align-items:center;height:2rem;padding:.28rem .5rem;border:1px dashed var(--border);border-radius:5px;color:var(--muted);background:var(--bg);font-size:.72rem}.scope-head{display:flex;align-items:center;gap:.55rem;padding:.72rem .9rem;list-style:none;cursor:default;user-select:none}.scope-head::-webkit-details-marker{display:none}.scope-head:hover{background:var(--surface-active)}.scope-head:focus-visible{outline:2px solid var(--accent);outline-offset:-3px;border-radius:8px}.scope-chevron{width:.85rem;height:.85rem;flex:0 0 auto;transition:transform .15s}.scope-panel[open] .scope-chevron{transform:rotate(90deg)}.scope-panel[open] .scope-head{border-bottom:1px solid var(--border)}.scope-head h2{margin:0;font-size:.86rem;font-weight:600}.scope-head p{display:flex;flex-wrap:wrap;justify-content:end;gap:.15rem .65rem;margin:0 0 0 auto;color:var(--muted);font-size:.7rem;font-variant-numeric:tabular-nums;text-align:right}.scope-head p span{white-space:nowrap}.scope-head p span+span{padding-left:.65rem;border-left:1px solid var(--border)}.scope-grid{display:grid;grid-template-columns:minmax(13rem,.75fr) minmax(0,1.25fr);min-height:0}.scope-pane{min-width:0}.scope-pane+.scope-pane{border-left:1px solid var(--border)}.pane-head{display:flex;align-items:baseline;justify-content:space-between;gap:.5rem;padding:.55rem .75rem;border-bottom:1px solid var(--border)}.pane-head strong{font-size:.72rem;font-weight:600}.pane-head span{color:var(--muted);font-size:.65rem;font-variant-numeric:tabular-nums}.package-list{max-height:22rem;overflow:auto;overscroll-behavior:none}.package-row{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:.45rem;width:100%;padding:.42rem .7rem;border:0;border-bottom:1px solid var(--border);color:var(--text);background:transparent;text-align:left}.package-row:hover{background:var(--surface-active)}.package-row input,.file input{width:.85rem;height:.85rem;accent-color:var(--accent)}.package-name,.package-size{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.package-name{font-size:.7rem}.package-size{color:var(--muted);font-size:.64rem;font-variant-numeric:tabular-nums}.package-row.excluded .package-name{color:var(--muted);text-decoration:line-through}.file-panel{min-width:0}.file-list{display:grid;grid-template-columns:minmax(0,1fr);max-height:22rem;overflow:auto;overscroll-behavior:none}.file{display:flex;align-items:center;gap:.45rem;min-width:0;padding:.35rem .75rem;border-bottom:1px solid var(--border)}.file input{flex:0 0 auto}.file-copy{display:flex;align-items:center;gap:.75rem;flex:1;min-width:0}.file-path{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.72rem}.file-meta{flex:0 1 auto;min-width:0;max-width:50%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted);font-size:.66rem;font-variant-numeric:tabular-nums}.excluded .file-path{color:var(--muted);text-decoration:line-through}.file-foot{display:flex;justify-content:space-between;gap:.6rem;padding:.6rem .8rem;color:var(--muted);font-size:.7rem}.options{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:1rem;position:relative;z-index:2;overflow:visible;padding:.85rem .9rem 1rem}.options-grid{display:grid;grid-column:1 / -1;gap:.7rem;min-width:0}.checks{position:relative;display:grid;grid-column:2;grid-row:3;align-content:center;justify-items:end;margin-top:1rem}.offline-help{position:absolute;top:calc(50% + .75rem);right:0;color:var(--muted);font-size:.66rem;line-height:1.4;white-space:nowrap}.check{display:inline-flex;align-items:center;gap:.4rem;color:var(--text);font-size:.75rem}.check input{width:.85rem;height:.85rem;accent-color:var(--accent)}.switch{display:inline-flex;align-items:center;gap:.45rem;color:var(--text);font-size:.74rem;cursor:default}.switch input{position:absolute;width:1px;height:1px;opacity:0}.switch-track{position:relative;width:2rem;height:1.1rem;border-radius:999px;background:var(--surface-active);transition:background .12s}.switch-track:after{content:"";position:absolute;top:.15rem;left:.15rem;width:.8rem;height:.8rem;border-radius:50%;background:var(--muted);transition:transform .12s,background .12s}.switch input:checked+.switch-track{background:rgb(from var(--accent) r g b / .4)}.switch input:checked+.switch-track:after{transform:translate(.9rem);background:var(--accent)}.checks .switch input:checked+.switch-track{background:rgb(from var(--critical, #e5534b) r g b / .3)}.checks .switch input:checked+.switch-track:after{background:var(--critical, #e5534b)}.switch input:focus-visible+.switch-track{outline:2px solid var(--accent);outline-offset:2px}.options-footer{display:flex;flex-wrap:wrap;grid-column:1;grid-row:3;align-items:end;gap:.7rem;min-width:0;margin-top:1rem}.options-footer slot[name=before-run]{display:contents}.agentic-fields{display:grid;gap:.65rem;padding:.85rem .9rem 1rem}.agentic-panel .panel-head{align-items:center}.prompt-row{display:flex;align-items:start;gap:.4rem;min-width:0}.prompt-row textarea{flex:1;width:0}.prompt-action{display:grid;place-items:center;flex:0 0 auto;width:1.5rem;height:1.5rem;padding:.25rem;border:0;border-radius:4px;color:var(--muted);background:transparent}.prompt-action:hover{color:var(--text);background:var(--surface-active)}.prompt-action svg{width:1rem;height:1rem;fill:none;stroke:currentColor;stroke-width:1.4}textarea{min-width:0;resize:vertical;padding:.4rem .5rem;border:1px solid var(--border);border-radius:5px;color:var(--text);background:var(--bg);font:inherit;font-size:.76rem}.run{padding:.48rem .8rem;border:0;border-radius:6px;color:var(--bg);background:var(--accent);font-size:.8rem;font-weight:600}.run:disabled{opacity:.45}.summary{align-self:end;padding-block:.48rem;color:var(--muted);font-size:.74rem}.history{display:grid;gap:.6rem}.scan-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:1rem;padding:.85rem .9rem}.scan-row+.scan-row{border-top:1px solid var(--border)}.scan-main{min-width:0}.scan-title{display:flex;align-items:center;gap:.45rem;min-width:0}.scan-title strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.82rem}.scan-meta{display:block;margin-top:.25rem;color:var(--muted);font-size:.7rem}.status{display:inline-flex;align-items:center;gap:.3rem;padding:.15rem .4rem;border-radius:999px;font-size:.66rem;font-weight:600;text-transform:capitalize}.status:before{content:"";width:.4rem;height:.4rem;border-radius:50%;background:currentColor}.status.running{color:var(--accent);background:rgb(from var(--accent) r g b / .1)}.status.completed{color:#48b878;background:#48b8781a}.status.stopped{color:var(--muted);background:var(--surface-active)}.scan-actions{display:flex;align-items:center;gap:.45rem}.action{padding:.35rem .55rem;border:1px solid var(--border);border-radius:5px;color:var(--text);background:var(--bg);font-size:.72rem;white-space:nowrap}.action:hover{border-color:var(--muted);background:var(--surface-active)}.empty{margin:0;padding:1.2rem;color:var(--muted);font-size:.8rem}@container scan-page (max-width: 48rem){.bundle-choice,.source-choice,.source-footer{grid-template-columns:1fr;gap:.7rem}.scope-grid{grid-template-columns:1fr}.scope-pane+.scope-pane{border-top:1px solid var(--border);border-left:0}}@container scan-page (max-width: 42rem){.options{display:block;padding-bottom:3rem}.checks{margin-top:.8rem}.offline-help{max-width:100%;white-space:normal}.options-footer{margin-top:.8rem}}@container scan-page (max-width: 34rem){.bundle-stats{grid-template-columns:repeat(2,minmax(0,1fr));gap:.45rem .65rem}.scope-head{flex-wrap:wrap}.scope-head p{flex-basis:100%;justify-content:start;margin-left:1.4rem;text-align:left}.scope-head p span{white-space:normal}.scope-head p span+span{padding-left:0;border-left:0}.scan-row{grid-template-columns:1fr;gap:.55rem}.scan-actions{justify-content:flex-start}.head-tabs{margin-left:0}}`});function qR(e){let t=e.filter(n=>n.id!=="all");if(t.length===0)return null;let r=new Map(t.map(n=>[String(n.id).replace(/^reason:/u,""),n]));return r.size!==t.length||[...r.keys()].some(n=>!GR.some(o=>o.key===n))?null:[{id:"",label:"All files",subtitle:"Everything"},...GR.filter(n=>r.has(n.key)).map(({key:n,...o})=>({...o,id:r.get(n).id,subtitle:n==="run"&&r.has("metro")?"Bundler and Node.js CLI":o.subtitle}))]}var GR,YR=w(()=>{"use strict";GR=[{key:"metro",label:"metro",subtitle:"Metro bundle contents"},{key:"run",label:"run",subtitle:"Node.js CLI"},{key:"add",label:"add",subtitle:"Manually added files"}]});var Ak,hm=w(()=>{"use strict";T();wr();YR();Ak=class extends X{static properties={reasons:{attribute:!1},value:{attribute:!1},label:{type:String}};constructor(){super(),this.reasons=[],this.value="",this.label="Choose scope"}_select(t){this.dispatchEvent(new CustomEvent("scope-change",{detail:{value:t},bubbles:!0,composed:!0}))}render(){let t=this.reasons.filter(o=>o.id!=="all");if(t.length===0)return m;let r=qR(t);if(!r)return d`<label class="scope-field"><span>Scope</span><select aria-label="${this.label}" .value="${$e(this.value==="all"?"":this.value)}" @change="${o=>this._select(o.target.value)}"><option value="">All files</option>${t.map(o=>d`<option value="${o.id}">${o.label??o.id}</option>`)}</select></label>`;let n=r.find(o=>o.id===this.value)??r[0];return d`<div class="scope-toggle"><div class="scope-options" role="radiogroup" aria-label="${this.label}" aria-describedby="scope-description">${r.map(o=>d`<label class="scope-option"><input type="radio" name="scope" value="${o.id}" .checked="${n.id===o.id}" @change="${()=>this._select(o.id)}"><span>${o.label}</span></label>`)}</div><span class="scope-description" id="scope-description">${n.subtitle}</span></div>`}static styles=Me`:host{display:block;min-width:0}*{box-sizing:border-box}.scope-toggle{display:flex;align-items:center;justify-content:end;flex-wrap:wrap;gap:.4rem .7rem;min-width:0;min-height:2rem}.scope-options{display:flex;flex-shrink:0;min-width:0;border:1px solid var(--border);border-radius:5px;overflow:hidden;background:var(--bg)}.scope-option{position:relative;flex:1 0 auto;user-select:none}.scope-option+.scope-option{border-left:1px solid var(--border)}.scope-option input{position:absolute;width:1px;height:1px;opacity:0}.scope-option span{display:grid;place-items:center;height:calc(2rem - 2px);padding:.3rem .55rem;color:var(--muted);font-size:.74rem;white-space:nowrap}.scope-option:hover span{color:var(--text);background:var(--surface-active)}.scope-option input:checked+span{color:var(--text);background:var(--surface-active);font-weight:500}.scope-option input:focus-visible+span{outline:2px solid var(--accent);outline-offset:-2px}.scope-description{order:-1;min-width:0;color:var(--muted);font-size:.66rem;line-height:1rem;text-align:right}.scope-field{display:flex;align-items:center;justify-content:end;gap:.5rem;min-width:0;max-width:100%;margin-left:auto;color:var(--muted);font-size:.7rem}select{width:13rem;min-width:0;max-width:100%;padding:.35rem .5rem;border:1px solid var(--border);border-radius:5px;background:var(--bg);color:var(--text);font:inherit;font-size:.76rem}`};customElements.get("bundle-scope-selector")||customElements.define("bundle-scope-selector",Ak)});var XR,Tk,JR=w(()=>{"use strict";T();qe();wr();Mt();ft();Ci();hk();pm();vk();fm();PR();UR();_k();VR();KR();pu();hm();XR={code:V(th),report:V(eh)},Tk=class extends X{static properties={hideHeading:{type:Boolean,attribute:"hide-heading"},sourceLoading:{type:Boolean,attribute:!1},selection:{attribute:!1},scopeLabel:{type:String,attribute:"scope-label"},source:{attribute:!1},loadBundle:{attribute:!1},loadModels:{attribute:!1},loadReportSources:{attribute:!1},canRun:{attribute:!1},_loadingBundle:{state:!0},_bundleError:{state:!0},_tab:{state:!0},_mode:{state:!0},_bundles:{state:!0},_repositories:{state:!0},_reportMode:{state:!0},_reportInput:{state:!0},_reportRestore:{state:!0},_scans:{state:!0},_selectedRepoId:{state:!0},_selectedBundleId:{state:!0},_reason:{state:!0},_excluded:{state:!0},_excludedModules:{state:!0},_prompts:{state:!0},_options:{state:!0},_regimes:{state:!0},_regimesReady:{state:!0},_appModel:{state:!0},_appModelAutomatic:{state:!0},_notice:{state:!0}};static styles=WR;constructor(){super(),this.loadModels=cm,this.canRun=!0,this.hideHeading=!1,this._tab="new",this._mode="code",this.source=null,this.selection=null,this.scopeLabel="Repository",this._pendingSelection=null,this.sourceLoading=!1,this.loadBundle=null,this._loadingBundle=!1,this._bundleError=null,this._bundles=[],this._repositories=[],this._reportMode="link",this._reportInput=null,this._reportRestore=null,this._scans=[],this._selectedRepoId=null,this._selectedBundleId=this._bundles[0]?.id??null,this._reason=this._bundles[0]?.reasons[0]?.id??"",this._excluded=new Set,this._excludedModules=new Set,this._nextPromptId=1,this._prompts=[{id:1,text:""}],this._options={analyzer:"generic",model:null,effort:null,cached:!1,isolate:!1},this._regimes=[],this._appModel=null,this._appModelAutomatic=!0,this._regimesReady=!1,this._notice=null,this._timers=new Set}willUpdate(t){if(t.has("selection")&&(this._pendingSelection=this.selection),t.has("source")&&(this._bundles=this.source?.bundles??[],this._repositories=this.source?.repositories??[],this._scans=this.source?.scans??[]),t.has("source")||t.has("selection")){this._excluded=new Set,this._excludedModules=new Set;let r=this._repositories.find(i=>i.id===this._selectedRepoId),n=this._pendingSelection,o=n?this._bundles.find(i=>i.id===n.bundleId&&(n.repoId==null||i.repoId===n.repoId)):this._bundles.find(i=>i.id===this._selectedBundleId&&i.repoId===this._selectedRepoId)??(this.scopeLabel==="Workspace"?null:this._bundles.find(i=>i.id===this._selectedBundleId))??(r?this._bundles.find(i=>i.repoId===r.id):this._bundles[0]);this._selectedRepoId=o?.repoId??n?.repoId??r?.id??this._repositories[0]?.id??"unattached",this._selectedBundleId=o?.id??null,this._reason=o?.reasons?.[0]?.id??"",n&&(this._tab="new",this._mode="code",this._notice=o||this.source==null?null:"The selected bundle is no longer available in this source. Choose another bundle.",o&&(this._pendingSelection=null))}}updated(t){(t.has("source")||t.has("selection")||t.has("loadBundle"))&&this._loadSelectedBundle()}async _loadSelectedBundle(){this._bundleController?.abort(),this._loadingBundle=!1,this._bundleError=null;let t=this._bundle;if(!this.loadBundle||!t||Array.isArray(t.files))return;let r=this._bundleController=new AbortController;this._loadingBundle=!0;try{let n=await this.loadBundle(t,r.signal);if(r.signal.aborted)return;this._bundles=this._bundles.map(o=>o.id===t.id?{...n,repoId:o.repoId,repo:o.repo}:o),this._reason=n.reasons?.[0]?.id??""}catch(n){r.signal.aborted||(this._bundleError=String(n?.message??n))}finally{r.signal.aborted||(this._loadingBundle=!1)}}disconnectedCallback(){super.disconnectedCallback(),this._bundleController?.abort();for(let t of this._timers)clearTimeout(t);this._timers.clear()}get _repoBundles(){return this._bundles.filter(t=>t.repoId===this._selectedRepoId)}get _bundle(){return this._repoBundles.find(t=>t.id===this._selectedBundleId)}get _reasonData(){return this._bundle?.reasons.find(t=>t.id===this._reason)??this._bundle?.reasons[0]}_packageLabel(t){return t==="__own__"?"Own code":t}get _scopeFiles(){let t=this._reasonData,r=t?.fileModules,n=t?.filePaths?new Set(t.filePaths):null;return(this._bundle?.files??[]).filter(o=>(r==null||r.includes(o.module))&&(n==null||n.has(o.path))).toSorted((o,i)=>i.bytes-o.bytes)}get _files(){return wk(this._scopeFiles)}render(){return d`<div class="wrap">${this.hideHeading?d`<h1 class="sr-only">Scans</h1>`:d`<div class="head"><div class="head-title"><slot name="navigation"></slot><h1>Scans</h1></div></div>`}<div class="intro-row"><p class="intro">${this._tab==="history"?"Review past scans and save completed results as reports.":this._mode==="report"?"Choose inputs and start a scan. Save the report when it finishes.":"Choose a bundle and start a scan. Save the report when it finishes."}</p><div class="head-tabs" role="tablist" aria-label="Scan views"><button class="${this._tab==="new"?"active":""}" role="tab" aria-selected="${this._tab==="new"}" @click="${()=>{this._tab="new"}}">New scan</button> <button class="${this._tab==="history"?"active":""}" role="tab" aria-selected="${this._tab==="history"}" @click="${()=>{this._tab="history"}}">Scan history</button></div></div>${this._notice?d`<p class="notice" role="status">${this._notice}</p>`:m} ${this._bundleError?d`<p class="notice" role="alert">Couldn’t load bundle: ${this._bundleError}<button @click="${()=>{this._loadSelectedBundle()}}">Retry</button></p>`:m} ${this._tab==="new"?this._newScan():this._history()}</div>`}_newScan(){let t=this._mode,r=this._bundle,n=t==="code"?this._files:t==="dependencies"?this._scopeFiles:r?.files??[],o=this._excluded,i=this._excludedModules,s=n.filter(g=>!o.has(g.path)&&!i.has(g.module)),a=uu(r?.files?s:null),c=new Map;for(let g of n){let b=c.get(g.module)??{bytes:0,count:0,included:0};b.bytes+=g.bytes,b.count++,o.has(g.path)||b.included++,c.set(g.module,b)}let u=[...c.keys()].toSorted((g,b)=>c.get(b).bytes-c.get(g).bytes||this._packageLabel(g).localeCompare(this._packageLabel(b))),p=n.slice(0,80),f=u.filter(g=>!i.has(g)).length,h=this._reportInput?.mode===this._reportMode?this._reportInput.inputs:[];return d`<div class="setup"><scan-mode-selector .mode="${t}" .analyzer="${this._options.analyzer}" .reportMode="${this._reportMode}" @scan-mode-change="${g=>this._changeMode(g.detail.mode)}" @scan-analyzer-change="${g=>this._setOption("analyzer",g.detail.analyzer)}" @scan-report-mode-change="${g=>{this._reportMode=g.detail.mode,this._reportRestore=null}}"></scan-mode-selector>${t==="report"?d`<scan-report-inputs .mode="${this._reportMode}" .loadSources="${this.loadReportSources}" .restore="${this._reportRestore}" @report-inputs-change="${g=>{this._reportInput=g.detail}}"></scan-report-inputs>`:this._sourcePanel(r,n)} ${t==="code"?d`<details class="panel scope-panel"><summary class="scope-head"><svg class="scope-chevron" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 3 5 5-5 5"/></svg><h2>Source filter</h2><p><span>${s.length} of ${n.length} files · ${f} of ${u.length} packages</span> <span>${js(a.bytes)} · ${a.lines==null?"\u2014":a.lines.toLocaleString()} LoC</span></p></summary><div class="scope-grid"><section class="scope-pane package-pane" aria-label="Packages in bundle"><div class="pane-head"><strong>Packages</strong><span>${u.length} total · sorted by size</span></div><div class="package-list">${u.map(g=>{let{bytes:b,count:y,included:k}=c.get(g),v=!i.has(g);return d`<label class="${`package-row ${v?"":"excluded"}`}"><input type="checkbox" .checked="${v}" @change="${x=>this._toggleModule(g)}"><span class="package-name">${this._packageLabel(g)}</span><span class="package-size">${js(b)} · ${k}/${y}</span></label>`})}</div></section><section class="scope-pane file-panel" aria-label="Largest files in bundle"><div class="pane-head"><strong>Largest files</strong><span>showing ${p.length} of ${n.length}</span></div>${n.length===0?d`<p class="empty">No files in this selection.</p>`:d`<div class="file-list">${p.map(g=>{let b=!o.has(g.path)&&!i.has(g.module);return d`<label class="${`file ${b?"":"excluded"}`}"><input type="checkbox" .checked="${b}" @change="${y=>this._toggleFile(g,y.target.checked)}"><span class="file-copy"><span class="file-path" data-tooltip-truncated data-tooltip="${g.path}">${g.path}</span><span class="file-meta">${g.size} · ${this._packageLabel(g.module)}</span></span></label>`})}</div>`}</section></div></details>`:m} ${t==="agentic"?this._agenticPanel():m}<slot name="access"></slot>${this._optionsPanel(t,r,t==="report"?h.length:s.length)}</div>`}_sourcePanel(t,r){if(this.sourceLoading)return d`<section class="panel source-panel" aria-busy="true"><div class="panel-head"><h2>Source</h2></div><p class="empty" role="status">Loading scan sources…</p></section>`;let n=this._mode==="code"?this._repoBundles.map(u=>u.files?{...u,files:wk(u.files)}:u.summary?{...u,summary:{...u.summary,files:u.summary.codeFiles}}:u):this._repoBundles,{lines:o}=uu(t?.files?r:null),i=new Map;for(let u of this._bundles)i.set(u.repoId,(i.get(u.repoId)??0)+1);let s=this._repositories.length>1,a=["code","agentic","dependencies"].includes(this._mode)&&t!=null&&(!t.filename.toLowerCase().endsWith(".map")||t.reasons?.some(u=>u.id!=="all")),c=this._repositories.map(u=>{let p=i.get(u.id)??0;return{value:u.id,label:u.label,detail:`${p} ${p===1?"bundle":"bundles"}`,special:u.id==="unattached"}});return d`<section class="panel source-panel" aria-busy="${this._loadingBundle}"><div class="panel-head"><h2>Source</h2></div><div class="${`source-choice ${s?"":"single-repository"}`}">${s?d`<div class="field"><span>${this.scopeLabel}</span>${this.scopeLabel==="Workspace"?d`<workspace-selector .options="${c}" .value="${this._selectedRepoId}" @workspace-change="${u=>this._selectRepoById(u.detail.value)}"></workspace-selector>`:d`<repository-selector .options="${c}" .value="${this._selectedRepoId}" @repository-change="${u=>this._selectRepoById(u.detail.value)}"></repository-selector>`}</div>`:m}<div class="field">${s?d`<span>Bundle</span>`:m}${n.length>0?d`<bundle-selector .bundles="${n}" .value="${t?.id??null}" @bundle-change="${u=>this._selectBundleById(u.detail.value)}"></bundle-selector>`:d`<div class="choice-empty">${this._bundles.length===0?"No stored bundles.":`No stored bundles for this ${this.scopeLabel.toLowerCase()}.`}</div>`}</div><div class="source-footer"><div class="bundle-stats" aria-label="Bundle statistics"><div class="metric"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><ellipse cx="8" cy="4" rx="5" ry="2"/><path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/></svg><strong>${t?.size??"\u2014"}</strong><span>bundle size</span></div><div class="metric">${XR.report}<strong>${r.length}</strong><span>files</span></div><div class="metric">${XR.code}<strong>${o==null?"\u2014":o.toLocaleString()}</strong><span>LoC</span></div><div class="metric">${V(Er)}<strong>${new Set(r.map(u=>u.module)).size}</strong><span>packages</span></div></div>${a?d`<div class="scope-slot">${this._scopeField(t)}</div>`:m}</div></div></section>`}_scopeField(t){if(!["code","agentic","dependencies"].includes(this._mode))return m;let r=(t?.reasons??[]).filter(n=>n.id!=="all");return r.length===0?m:d`<bundle-scope-selector .reasons="${r}" .value="${this._reason}" label="${this._mode==="agentic"?"Choose agentic scope":"Choose scan scope"}" @scope-change="${n=>this._changeReason(n.detail.value)}"></bundle-scope-selector>`}_optionsPanel(t,r,n){let o=t==="report"?`${n} ${this._reportMode==="merge"?"scan results":"reports"} selected`:`${r?.filename??"No bundle selected"} \xB7 ${n} files will be analyzed`,i=t==="code"&&this._options.analyzer==="advanced",s=!this.canRun||(t==="report"?n===0:r==null||n===0||i&&(!this._regimesReady||this._regimes.length===0));return d`<section class="panel options"><div class="options-grid">${i?d`<scan-regime-editor .loadModels="${this.loadModels}" .value="${this._regimes}" .appModel="${this._appModel}" .appModelAutomatic="${this._appModelAutomatic}" @regimes-change="${a=>{this._regimesReady=a.detail.ready,this._regimes=a.detail.value,this._appModel=a.detail.appModel,this._appModelAutomatic=a.detail.appModelAutomatic}}"></scan-regime-editor>`:d`<scan-model-picker .loadModels="${this.loadModels}" ?has-extra="${t==="code"}" .value="${this._options.model}" .effort="${this._options.effort}" @model-change="${a=>{this._options={...this._options,model:a.detail.model,effort:a.detail.effort}}}">${t==="code"?d`<scan-depth-toggle slot="effort-extra" .isolate="${this._options.isolate}" @depth-change="${a=>this._setOption("isolate",a.detail.isolate)}"></scan-depth-toggle>`:m}</scan-model-picker>`}</div><div class="options-footer"><slot name="before-run"></slot><button type="button" class="run" ?disabled="${s}" @click="${()=>this._runScan()}">${t==="report"?this._reportMode==="merge"?"Merge results":"Link reports":"Run scan"}</button><span class="summary">${o}</span></div><div class="checks"><label class="switch"><input type="checkbox" aria-describedby="${this._options.cached?"offline-help":m}" .checked="${this._options.cached}" @change="${a=>this._setOption("cached",a.target.checked)}"><span class="switch-track" aria-hidden="true"></span><span>Offline</span></label>${this._options.cached?d`<small class="offline-help" id="offline-help">Cache only, no new model requests</small>`:m}</div></section>`}_history(){return d`<section class="panel history"><div class="panel-head"><h2>Scan history</h2><p>${this._scans.length} scans</p></div>${this._scans.length===0?d`<p class="empty">No scans yet.</p>`:this._scans.map(t=>this._scanRow(t))}</section>`}_scanRow(t){let r=t.status==="completed"?t.reportSaved?d`<button type="button" class="action" @click="${()=>this._deleteSavedReport(t)}">Delete saved report</button>`:d`<button type="button" class="action" @click="${()=>this._saveReport(t)}">Save report</button>`:m;return d`<div class="scan-row"><div class="scan-main"><div class="scan-title"><strong>${t.bundleName}</strong><span class="${`status ${t.status}`}">${t.status}</span></div><span class="scan-meta">${t.reason} · ${t.files} ${t.mode==="report"?t.reportMode==="merge"?"results":"reports":"files"} · ${t.createdAt}${t.duration?` \xB7 ${t.duration}`:""}${t.reportSaved?" \xB7 Report saved":t.status==="completed"?" \xB7 Report available":""}</span></div><span class="scan-actions">${r}${t.status==="running"?d`<button type="button" class="action" @click="${()=>this._stopScan(t)}">Stop</button>`:m}${t.status==="stopped"?d`<button type="button" class="action" @click="${()=>this._restartScan(t)}">Restart as new scan</button>`:m}</span><span aria-hidden="true"></span></div>`}_selectBundle(t){this._pendingSelection=null,this._selectedRepoId=t.repoId,this._selectedBundleId=t.id,this._reason=t.reasons?.[0]?.id??"",this._excluded=new Set,this._excludedModules=new Set,this._notice=null,this._loadSelectedBundle()}_selectBundleById(t){let r=this._repoBundles.find(n=>n.id===t);r!=null&&this._selectBundle(r)}_selectRepoById(t){if(t===this._selectedRepoId||!this._repositories.some(n=>n.id===t))return;this._selectedRepoId=t,this._pendingSelection=null;let r=this._bundles.find(n=>n.repoId===t);this._selectedBundleId=r?.id??null,this._reason=r?.reasons[0]?.id??"",this._excluded=new Set,this._excludedModules=new Set,this._notice=null,this._loadSelectedBundle()}_changeMode(t){!["dependencies","code","agentic","report"].includes(t)||t===this._mode||(this._mode=t,this._reportInput=null,this._reportRestore=null,this._excluded=new Set,this._excludedModules=new Set,this._notice=null)}_changeReason(t){this._reason=t,this._excluded=new Set,this._excludedModules=new Set}_toggleFile(t,r){let n=new Set(this._excluded);r?n.delete(t.path):n.add(t.path),this._excluded=n}_toggleModule(t){let r=new Set(this._excludedModules);r.has(t)?r.delete(t):r.add(t),this._excludedModules=r}_setOption(t,r){this._options[t]!==r&&(t==="analyzer"&&r==="advanced"&&(this._regimesReady=!1,this._regimes.length===0&&(this._regimes=[{mode:this._options.analyzer,model:this._options.model,effort:this._options.effort,isolate:this._options.isolate}])),this._options={...this._options,[t]:r})}_agenticPanel(){return d`<section class="panel agentic-panel"><div class="panel-head"><h2>Agentic instructions</h2><button type="button" class="prompt-action" aria-label="Add prompt" @click="${()=>this._addPrompt()}"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 3v10M3 8h10"/></svg></button></div><div class="agentic-fields">${re(this._prompts,t=>t.id,(t,r)=>d`<div class="prompt-row"><textarea aria-label="${`Prompt ${r+1}`}" rows="3" placeholder="${this._promptPlaceholder(r)}" .value="${$e(t.text)}" @input="${n=>{this._prompts=this._prompts.map(o=>o.id===t.id?{...o,text:n.target.value}:o)}}"></textarea>${this._prompts.length>1?d`<button type="button" class="prompt-action" aria-label="${`Remove prompt ${r+1}`}" @click="${()=>this._removePrompt(t.id)}"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="m4 4 8 8M12 4l-8 8"/></svg></button>`:m}</div>`)}</div></section>`}_promptPlaceholder(t){let r=["","second","third","fourth","fifth","sixth","seventh","eighth","ninth","tenth"][t];return r!=null?`What should the ${r?`${r} `:""}agent focus on?`:`What should agent ${t+1} focus on?`}async _addPrompt(){this._prompts=[...this._prompts,{id:++this._nextPromptId,text:""}],await this.updateComplete,this.renderRoot?.querySelector(".prompt-row:last-child textarea")?.focus()}_removePrompt(t){this._prompts.length>1&&(this._prompts=this._prompts.filter(r=>r.id!==t))}_runScan(){if(!this.canRun)return;let t=this._mode,r=t==="code"&&this._options.analyzer==="advanced";if(r&&(!this._regimesReady||this._regimes.length===0))return;let n=this._bundle,o=this._reportInput?.mode===this._reportMode?this._reportInput:null,i=o?.inputs??[],s=t==="code"?this._files.filter(u=>!this._excluded.has(u.path)&&!this._excludedModules.has(u.module)):t==="dependencies"?this._scopeFiles:n?.files??[];if(t==="report"&&(!o?.source||i.length===0)||t!=="report"&&(!n||s.length===0))return;let a={id:`scan-${Date.now()}`,mode:t,bundleId:t==="report"?this._reportMode==="merge"?o.source.id:null:n?.id??null,bundleName:t==="report"?o.source.label:n.filename,reason:t==="report"?this._reportMode==="merge"?"Merge scan results":"Link saved reports":this._reasonData?.label??"All files",status:"running",createdAt:"Just now",duration:"",files:t==="report"?i.length:s.length,reportSaved:!1,cached:this._options.cached,isolate:t==="code"&&this._options.isolate,model:this._options.model,effort:this._options.effort};t!=="report"&&(a.repoId=this._selectedRepoId,a.scopeId=this._reason),t==="code"&&(a.analyzer=this._options.analyzer),r&&(a.regimes=this._regimes.map(u=>({...u})),a.appModel=this._appModel?{...this._appModel}:null,a.appModelAutomatic=this._appModelAutomatic,a.reason=`Advanced \xB7 ${a.regimes.length} regimes \xB7 ${a.reason}`,a.model=null,a.effort=null,a.isolate=!1),t==="agentic"&&(a.prompts=this._prompts.map(u=>u.text)),t==="report"&&(a.reportMode=this._reportMode,a.reportSource={...o.source},a.inputIds=i.map(u=>u.id)),this._scans=[a,...this._scans],this._tab="history",this._notice="Scan started. The server will update its status as work progresses.";let c=setTimeout(()=>{this._timers.delete(c),a.status==="running"&&(a.status="completed",a.duration="2m 14s",this._notice="Scan completed. Its report is ready to save.",this.requestUpdate())},2200);this._timers.add(c)}_stopScan(t){t.status==="running"&&(t.status="stopped",t.duration=t.duration||"stopped by user",this._notice="Scan stopped. It cannot continue, but you can restart it as a new scan.",this.requestUpdate())}_restartScan(t){if(this._options={...this._options,model:t.model??this._options.model,effort:t.effort??this._options.effort,cached:t.cached??!1,isolate:t.isolate??!1,analyzer:t.analyzer??"generic"},t.mode==="report"){this._mode="report",this._reportMode=t.reportMode==="link"?"link":"merge",this._reportInput=null,this._reportRestore={mode:this._reportMode,source:t.reportSource,inputIds:t.inputIds??[]},this._tab="new",this._notice="New report scan settings restored from the stopped run.";return}let r=this._bundles.find(n=>n.id===t.bundleId&&(t.repoId==null||n.repoId===t.repoId));r&&(this._selectBundle(r),this._mode=t.mode??"dependencies",t.mode==="agentic"&&(this._prompts=(t.prompts?.length>0?t.prompts:[""]).map(n=>({id:++this._nextPromptId,text:n}))),t.regimes?.length>0&&(this._options={...this._options,analyzer:"advanced"},this._regimes=t.regimes.map(n=>({...n})),this._appModel=t.appModel?{...t.appModel}:null,this._appModelAutomatic=t.appModelAutomatic!==!1,this._regimesReady=!1),this._reason=r.reasons.find(n=>n.label===t.reason)?.id??r.reasons[0]?.id??"",this._reason=t.scopeId??this._reason,this._tab="new",this._notice="New scan settings restored from the stopped run.")}_saveReport(t){t.reportSaved=!0,this._notice="Report saved. You can delete it from Reports and save this completed scan again.",this.requestUpdate()}_deleteSavedReport(t){t.reportSaved=!1,this._notice="Saved report deleted. The completed scan can be saved again.",this.requestUpdate()}};customElements.get("deepview-scan-page")||customElements.define("deepview-scan-page",Tk)});function mt(e,{splitOwnDirs:t=!0,packageDir:r=null}={}){if(r){if(r!=="."){let n=r.match(/(?:^|\/)node_modules\/(@[^/]+\/[^/]+|[^/]+)$/u);return n&&n[1]!==".pnpm"?n[1]:r}}else{let n=/(?:^|\/)(?:node_modules|dependencies)\/(@[^/]+\/[^/]+|[^/]+)/gu,o;for(;(o=n.exec(e))!==null;)if(o[1]!==".pnpm")return o[1]}if(t){let n=e.indexOf("/");if(n>0)return e.slice(0,n)}return"__own__"}function ZR(e,t=null){let r=new Set;for(let n of e){let o=t?.(n)??null;if(mt(n,{splitOwnDirs:!1,packageDir:o})==="__own__"&&(r.add(mt(n,{splitOwnDirs:!0,packageDir:o})),r.size>1))return!0}return!1}function Ei(e){return e==="__own__"?"own source":typeof e!="string"?e:e.match(/^(?:.*\/)?vendor\/(.+)$/u)?.[1]??e}var $l=w(()=>{"use strict"});function xo(e,t){let r=new Map,n=e?.kind==="stasis"?e.bundle?.reason:null;if(!n||typeof n!="object"||Array.isArray(n))return r;let o=new Set(t??[...Ut(e)].filter(([,i])=>i!=null).map(([i])=>i));for(let[i,s]of Object.entries(n).toSorted(([a],[c])=>a.localeCompare(c))){if(!i||!Array.isArray(s))continue;let a=new Set(s.filter(c=>typeof c=="string"&&o.has(c)));a.size>0&&r.set(i,a)}return[...r.values()].some(i=>i.size<o.size)||r.clear(),r}var Ik=w(()=>{"use strict";Nh()});function QR(e,t,r,n){let o=r.has(n)?n:null;if(o===null)return{tree:e,origToStripped:t,selected:o};let i=new Map([...t].filter(([c])=>r.get(o).has(c))),s=new Set(i.values());return{tree:Object.fromEntries([...s].map(c=>[c,{...e[c],imports:(e[c].imports??[]).filter(u=>s.has(u))}])),origToStripped:i,selected:o}}function Lk(e,t,{splitOwnDirs:r=!1,packageDir:n}={}){let o=mt(t,{splitOwnDirs:!1,packageDir:n});return o==="__own__"?mt(e,{splitOwnDirs:r,packageDir:n}):o}function Fk(e){let t=new Map;if(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 i of o.values()){let s=typeof i=="string"?[i]:i instanceof Map?i.values():[];for(let a of s)typeof a=="string"&&t.get(n).add(a)}}return t}function eM(e,t,r,n,o=t){let i=Fk(e),s=new Set;for(let[c,u]of t)mt(c,{splitOwnDirs:!1,packageDir:n?.get(c)})==="__own__"&&s.add(r(u));for(let c of e?.bundle?.entries??[]){let u=t.get(c);u!==void 0&&s.add(r(u))}if(s.size===0){let c=new Set;for(let[p,f]of t){let h=n?.get(p);h&&h!=="."&&!/(?:^|\/)(?:node_modules|dependencies|vendor)(?:\/|$)/u.test(h)&&c.add(r(f))}let u=new Set;for(let[p,f]of i){let h=t.get(p);if(!(h===void 0||!c.has(r(h))))for(let g of f){let b=t.get(g);b!==void 0&&r(h)!==r(b)&&u.add(r(b))}}for(let p of c)u.has(p)||s.add(p)}let a=new Set;for(let[c,u]of i)if(!o.has(c)&&mt(c,{splitOwnDirs:!1,packageDir:n?.get(c)})==="__own__")for(let p of u){let f=t.get(p);f!==void 0&&a.add(r(f))}return a.size>0&&s.add("__own__"),{roots:[...s],appImports:[...a]}}var mm=w(()=>{"use strict";$l();Ik()});function tM(e,t=[]){let r=new Map,n=e.flatMap(o=>{let i=t.filter(a=>a.bundles?.includes(o.integrity));return(i.length>0?i.map(a=>({id:a.id,label:a.name})):[{id:"unattached",label:"Unattached"}]).map(a=>(r.set(a.id,a),{id:o.integrity,integrity:o.integrity,filename:o.name,repoId:a.id,repo:a.label,files:null,reasons:[],size:"\u2014"}))});return{repositories:[...r.values()],bundles:n,reports:[],scans:[]}}function rM(e,t){if(t.error)throw new Error(t.error);let r=nn(t),n=t.kind==="stasis"?t.bundle?.formats:null,o=t.lineCounts??new Map([...vr(t)].map(([a,c])=>[a,jd(c)])),i=[...Ut(t)].filter(([,a])=>a!=null).map(([a,c])=>({path:a,format:n?.get(a)??null,bytes:c,lines:o.get(a)??0,size:js(c),module:mt(a,{splitOwnDirs:!1,packageDir:r?.get(a)})})),s=[{id:"all",label:"All",filePaths:null},...[...xo(t,i.map(a=>a.path))].map(([a,c])=>({id:`reason:${a}`,label:a,filePaths:[...c]}))];return{...e,files:i,reasons:s,size:js(t.size)}}var nM=w(()=>{"use strict";on();pl();$l();mm();pu()});function zN(e){let{data:t}=ro(e);return t&&oM(t)>0?t:null}function oM(e){return(Bt(e)??[]).filter(t=>(Array.isArray(t)?t:[t]).some(r=>r&&typeof r=="object"&&Gr(r,r.source??e.source))).length}function iM(e,t){let r=[],n=new Map;for(let{name:i,content:s,fallbackRepo:a}of e){if(typeof s!="string")continue;let c=zN(s);if(!c)continue;let u=Bt(c),p=qr(c)??qr({repo:{github:a}}),f=new Set(p?[p]:[]);if(!p)for(let h of u.flat()){if(/(?:^|\/)(?:node_modules|dependencies)\//u.test(h?.file??""))continue;let g=qr(h);g&&f.add(g)}for(let h of f)n.set(h,{id:h,label:h});r.push({id:i,filename:i,repoIds:[...f],analyzer:c.source,appFindings:oM(c)})}let o=new Set(r.map(i=>i.id));return{merge:{bundles:[],results:[]},link:{reports:r,repositories:[...n.values()],workspaces:t.map(i=>({id:i.id,label:i.name,reports:i.reports.filter(s=>o.has(s))})).filter(i=>i.reports.length>0)}}}var sM=w(()=>{"use strict";Ee();pu()});function Ri(e){if(e?.throwIfAborted(),_())throw new DOMException("Local scan closed","AbortError")}async function aM(e){Ri(e);let t=await Ot();return Ri(e),tM(t,J())}async function lM(e,t){Ri(t);let r=await fo(e.integrity,{name:e.filename},{sources:!1});return Ri(t),rM(e,r)}async function cM(e){Ri(e);let t=await me(),r=[];for(let n of t){Ri(e);let o=await ze(n);Ri(e),r.push({name:n,content:o,fallbackRepo:It(n)})}return Ri(e),iM(r,J())}var dM=w(()=>{"use strict";D();go();nM();sM()});function uM({hostname:e,devServer:t,serverMode:r,localMode:n,deepviewScanServer:o}){return r==="managed"&&!n?null:r==="e2e"?dc(o):dc(t)??(e==="127.0.0.1"?D_:null)}var pM=w(()=>{"use strict";Qg()});async function fM(e,t,r){let n=_t(e,{duration:0});t.addEventListener("abort",n,{once:!0});try{return await r()}finally{t.removeEventListener("abort",n),n()}}function hu(){return uM({hostname:window.location.hostname,devServer:document.querySelector('meta[name="deepview-scan-server"]')?.content,serverMode:l.serverMode,localMode:l.localMode,deepviewScanServer:l.deepviewScanServer})}function gm(e){return _()?!!e.managedId&&["admin","manage"].includes(l.managedSession?.role):!e.managedId&&!!hu()}async function Ok(e=null){let t=l.selectedBundleWorkspace,r=Ze();if(await ht(),r!==Ze()||e&&!gm(e))return;if(_()){e&&await zs("manage-scans",{bundleId:e.managedId});return}if(!hu())return;let n=Dn(),o=Ze();await n,!(!hu()||o!==Ze())&&(l.scanSelection=e?{bundleId:e.integrity,...t?{repoId:t}:{}}:null,l.currentView="scan",S(),K())}function bm(){let e=document.querySelector("#drop-zone");if(!e)return;let t=e.querySelector(".local-scan-button");t||(t=document.createElement("button"),t.type="button",t.className="local-scan-button",t.innerHTML=`${el}<span>Scan</span>`,t.addEventListener("click",()=>{Ok()}),e.append(t));let r=hu();t.hidden=!r,document.querySelector("local-scan-page")?.setScanServer(r);let n=document.querySelector(".bundles-scan-button"),o=l.bundles?.find(i=>i.integrity===l.selectedBundle);n&&(n.hidden=!o||!gm(o))}var Bk,ym=w(()=>{"use strict";T();D();xi();zn();zt();lR();dR();dk();ft();JR();dM();pM();Xa();Bk=class extends X{static properties={selection:{attribute:!1},_source:{state:!0},_error:{state:!0},_providerToken:{state:!0},_savedAccess:{state:!0},_savingAccess:{state:!0}};constructor(){super(),this._server=hu(),this._access=new dm(this._server,()=>this.requestUpdate()),this._resetAccess(),this._source=null,this._error=null,this._loadBundle=(t,r)=>fM("Loading bundle\u2026",r,()=>lM(t,r))}connectedCallback(){super.connectedCallback(),this._restoreAccess(),this._unsubscribeSavedAccess=bv(()=>{this._savedAccess=Ha()}),this._loadSource()}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribeSavedAccess?.(),this._controller?.abort(),this._resetAccess()}async _loadSource(){this._controller?.abort();let t=this._controller=new AbortController;this._error=null;try{this._source=await fM("Loading bundles\u2026",t.signal,()=>aM(t.signal))}catch(r){t.signal.aborted||(this._error=String(r?.message??r))}}_resetAccess(){this._access.reset(this._server),this._providerToken=""}_restoreAccess(){this._savedAccess=Ha();let t=hv(this._server);t&&(this._access.setKey(t.deepview),this._access.setProvider(t.provider),this._providerToken=t.token,this._access.connect())}async _saveOrForgetAccess(){if(this._savingAccess)return;let t=Ha();if(!(!t&&!this._access.connected)){this._savingAccess=!0;try{t?(await gv(),this._resetAccess()):await mv({server:this._server,deepview:this._access.apiKey,provider:this._access.provider,token:this._providerToken}),this._savedAccess=Ha()}catch{_t(t?"Couldn\u2019t forget scan credentials. Try again.":"Couldn\u2019t save scan credentials. Try again.",{kind:"warning"})}finally{this._savingAccess=!1}}}_connect(t){t.preventDefault(),this._access.connect()}_setProvider(t){this._access.provider!==t&&(this._access.setProvider(t),this._providerToken="")}_setProviderToken(t){this._providerToken=t;let r=cR(t);r&&this._access.setProvider(r)}setScanServer(t){this._server!==t&&(this._server=t,this._resetAccess(),this._restoreAccess())}static styles=Me`:host{display:block}*{box-sizing:border-box}button{display:inline-flex;align-items:center;gap:.35rem;padding:.25rem .5rem;color:var(--muted);background:transparent;border:1px solid var(--border);border-radius:5px;font:inherit;font-size:.8rem;cursor:default}button:hover:not(:disabled){color:var(--text);background:var(--surface)}button:disabled{opacity:.5}.access{min-width:0;border:1px solid var(--border);border-radius:9px;background:var(--surface);container:scan-access / inline-size}.access-heading{display:flex;align-items:center;justify-content:space-between;min-height:2.5rem;padding:.45rem .9rem;border-bottom:1px solid var(--border)}.access h2{margin:0;color:var(--text);font-size:.86rem;font-weight:600}.save-access{min-height:1.6rem;margin-left:auto;flex-shrink:0}.access-fields{display:grid;gap:.8rem;padding:.85rem .9rem}.connection-row,.provider-row{display:grid;align-items:end;gap:.65rem;margin:0}.connection-row{grid-template-columns:minmax(0,1fr) auto;width:min(42rem,100%)}.provider-row{grid-template-columns:max-content minmax(0,1fr);width:100%}.access label{display:grid;gap:.3rem;min-width:0;color:var(--muted);font-size:.72rem}input{min-width:0;width:100%;height:2rem;padding:.35rem .55rem;border:1px solid var(--border);border-radius:5px;background:var(--bg);color:var(--text);font:inherit;font-size:.8rem}.provider-field{min-width:0;margin:0;padding:0;border:0}.provider-field legend{margin-bottom:.3rem;padding:0;color:var(--muted);font-size:.72rem}.provider-options{display:flex;width:fit-content;max-width:100%;border:1px solid var(--border);border-radius:5px;background:var(--bg);overflow:hidden}.access .provider-choice{position:relative;display:inline-flex;align-items:center;justify-content:center;gap:.35rem;height:calc(2rem - 2px);padding:.3rem .6rem;color:var(--muted);font-size:.74rem;white-space:nowrap;user-select:none}.provider-choice+.provider-choice{border-left:1px solid var(--border)}.provider-choice:hover{color:var(--text);background:var(--surface)}.provider-choice:has(:checked){color:var(--text);background:var(--surface-active)}.provider-choice:has(:focus-visible){outline:2px solid var(--accent);outline-offset:-2px}.provider-choice input{position:absolute;inset:0;margin:0;width:100%;height:100%;opacity:0;cursor:default}.provider-icon{display:block;width:1rem;height:1rem;flex:0 0 1rem}.provider-icon svg{display:block;width:100%;height:100%}.provider-icon.anthropic{color:#d97757}.provider-icon.openai{color:#10a37f}.provider-icon.moonshot{color:#8068d9}.provider-icon.moonshot svg{transform:scale(.8)}.provider-icon.openrouter{color:var(--text)}.connect{justify-content:center;height:2rem;padding:.35rem .8rem;color:var(--text);background:var(--surface-active)}.connection-status{flex:1;min-width:0;margin:0 .7rem;line-height:1rem;color:var(--muted);font-size:.7rem}.connection-status.error{color:var(--critical, #e5534b)}button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}@container scan-access (max-width: 38rem){.provider-row{grid-template-columns:minmax(0,1fr)}}@container scan-access (max-width: 28rem){.provider-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%}.provider-choice:nth-child(odd){border-left:0}.provider-choice:nth-child(n+3){border-top:1px solid var(--border)}}@container scan-access (max-width: 23rem){.access .provider-choice{gap:.25rem;padding-inline:.4rem;font-size:.7rem}}`;_accessPanel(){let t=this._access,r=t.catalogue?.models.length??0,n=t.error??(t.loading?t.connected?"Loading provider models\u2026":"Connecting\u2026":t.connected?t.catalogue?`Connected \xB7 ${r} ${r===1?"model":"models"}`:"Connected. Choose a provider.":"");return d`<section slot="access" class="access" aria-labelledby="scan-access-heading"><div class="access-heading"><h2 id="scan-access-heading">Access</h2><p class="${`connection-status ${t.error?"error":""}`}" role="${t.error?"alert":"status"}">${n}</p>${this._savedAccess||t.connected?d`<button class="save-access" type="button" ?disabled="${this._savingAccess}" @click="${this._saveOrForgetAccess}">${this._savedAccess?"Forget":"Save"}</button>`:m}</div><div class="access-fields"><form class="connection-row" @submit="${this._connect}"><label>DeepView API Key<input type="password" name="deepview-api-key" placeholder="Enter API key" autocomplete="off" spellcheck="false" .value="${t.apiKey}" @input="${o=>t.setKey(o.target.value)}"></label> <button type="submit" class="connect" ?disabled="${!t.apiKey.trim()||t.loading||t.connected&&!t.error}">${t.connected&&!t.error?"Connected":"Connect"}</button></form>${t.managed?m:d`<div class="provider-row"><fieldset class="provider-field"><legend>Provider</legend><div class="provider-options">${[["anthropic","Anthropic"],["openai","OpenAI"],["moonshot","Moonshot"],["openrouter","OpenRouter"]].map(([o,i])=>d`<label class="provider-choice"><input type="radio" name="scan-provider" value="${o}" .checked="${t.provider===o}" @change="${()=>this._setProvider(o)}"><span class="${`provider-icon ${o}`}" aria-hidden="true">${du(o)}</span><span>${i}</span></label>`)}</div></fieldset><label>Token<input type="password" name="provider-token" placeholder="Enter provider token" autocomplete="off" spellcheck="false" .value="${this._providerToken}" @input="${o=>this._setProviderToken(o.target.value)}"></label></div>`}</div></section>`}render(){return d`${this._error?d`<p role="alert">Couldn’t load saved bundles: ${this._error} <button @click="${()=>{this._loadSource()}}">Retry</button></p>`:m}<deepview-scan-page .selection="${this.selection}" scope-label="Workspace" .source="${this._source}" .sourceLoading="${this._source==null&&!this._error}" .loadBundle="${this._loadBundle}" .loadModels="${this._access.loadModels}" .canRun="${this._access.ready}" .loadReportSources="${cM}"><button slot="navigation" type="button" @click="${()=>{Dn()}}"><span aria-hidden="true">‹</span> Home</button>${this._accessPanel()}</deepview-scan-page>`}};customElements.get("local-scan-page")||customElements.define("local-scan-page",Bk)});function _l(e,t){let r=e.find(n=>n.integrity===t);return e.filter(n=>n.integrity!==t&&(r?.managedId?n.managedId&&r.repoId!=null&&n.repoId===r.repoId:!n.managedId))}var Pk=w(()=>{"use strict"});function Nk(e,t){let r=e.toLowerCase(),n="",o=r;if(r.startsWith("@")){let s=r.indexOf("/");s>0&&(n=r.slice(0,s),o=r.slice(s+1))}return`pkg:npm/${n?`${encodeURIComponent(n)}/`:""}${encodeURIComponent(o)}@${encodeURIComponent(t)}`}function vm(e){let t=/^(.*?)\.stasis\.(?:code|resources)\.br$/u.exec(e);return t?t[1]:e.replace(/\.[^.]+$/u,"")||e}function mM(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 i=`${o.name}@${o.version}`,s=r.get(i);if(s!==void 0){n==="."&&(t[s].dir=".");continue}r.set(i,t.length),t.push({name:o.name,version:o.version,dir:n})}return t}function gM(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 bM(e,t){let r=e.find(i=>i.dir===".")??null,n=r?e.filter(i=>i!==r):e;return{root:r?{name:r.name,version:r.version,purl:Nk(r.name,r.version)}:{name:vm(t?.name??"bundle"),version:null,purl:null},rest:n}}function yM(e){return e??globalThis.crypto.randomUUID()}function vM(e,t,{now:r=new Date,uuid:n}={}){let o=mM(e),{root:i,rest:s}=bM(o,t),a={type:"application","bom-ref":i.purl??`application:${i.name}`,name:i.name};i.version&&(a.version=i.version),i.purl&&(a.purl=i.purl);let c={bomFormat:"CycloneDX",specVersion:"1.5",serialNumber:`urn:uuid:${yM(n)}`,version:1,metadata:{timestamp:r.toISOString(),tools:{components:[{type:"application",name:hM}]},component:a},components:s.map(u=>{let p=Nk(u.name,u.version);return{type:"library","bom-ref":p,name:u.name,version:u.version,purl:p}})};return`${JSON.stringify(c,null,2)}
126
+ `}function UN(e){return{referenceCategory:"PACKAGE-MANAGER",referenceType:"purl",referenceLocator:e}}function wM(e,t,{now:r=new Date,uuid:n}={}){let o=mM(e),{root:i,rest:s}=bM(o,t),a=vm(t?.name??"bundle"),c=r.toISOString().replace(/\.\d{3}Z$/u,"Z"),u=(b,y,k,v)=>{let x={SPDXID:b,name:y,downloadLocation:"NOASSERTION",filesAnalyzed:!1,licenseConcluded:"NOASSERTION",licenseDeclared:"NOASSERTION",copyrightText:"NOASSERTION"};return k&&(x.versionInfo=k),v&&(x.externalRefs=[UN(v)]),x},p="SPDXRef-Package-root",f=[u(p,i.name,i.version,i.purl)],h=[{spdxElementId:"SPDXRef-DOCUMENT",relationshipType:"DESCRIBES",relatedSpdxElement:p}];s.forEach((b,y)=>{let k=`SPDXRef-Package-${y+1}`;f.push(u(k,b.name,b.version,Nk(b.name,b.version))),h.push({spdxElementId:p,relationshipType:"DEPENDS_ON",relatedSpdxElement:k})});let g={spdxVersion:"SPDX-2.3",dataLicense:"CC0-1.0",SPDXID:"SPDXRef-DOCUMENT",name:a,documentNamespace:`https://spdx.org/spdxdocs/${encodeURIComponent(a)}-${yM(n)}`,creationInfo:{created:c,creators:[`Tool: ${hM}`]},packages:f,relationships:h};return`${JSON.stringify(g,null,2)}
127
+ `}var hM,Dk=w(()=>{"use strict";hM="@preventive/triage"});function HN(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 zk(e,t,r){if(t){let i=HN(e,r);if(i.error)return{error:i.error};let{re:s}=i;return{ranges(a){s.lastIndex=0;let c=[],u;for(;(u=s.exec(a))!==null;){if(u[0].length===0){s.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(i){let s=r?i:i.toLowerCase(),a=[],c=0,u;for(;(u=s.indexOf(n,c))!==-1&&(a.push([u,u+o]),c=u+o,!(a.length>=50)););return a}}}function jN(e,t){let r=[...e.keys()].toSorted(),n=[],o=0,i=!1;for(let s of r){let a=e.get(s);if(typeof a!="string")continue;let c=a.split(`
128
+ `),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)){i=!0;break}}if(u.length>0&&n.push({path:s,lines:c,hits:u}),i)break;if(n.length>=500){i=!0;break}}return{fileResults:n,totalHits:o,truncated:i}}function VN(e,t){let r=[],n=0;for(let{path:o,lines:i,hits:s}of e.fileResults){let a=[];for(let{ln:c}of s){let u=t.ranges(i[c-1]);u.length!==0&&(a.push({ln:c,ranges:u}),n++)}a.length>0&&r.push({path:o,lines:i,hits:a})}return{fileResults:r,totalHits:n,truncated:!1}}function kM(e,t,r,n,o){if(!r)return{fileResults:[],totalHits:0,truncated:!1};let i=zk(r,n,o);if(i.error)return{error:i.error};(rr.tag!==e||rr.useRegex!==n||rr.caseSensitive!==o)&&(rr.tag=e,rr.useRegex=n,rr.caseSensitive=o,rr.entries.length=0);let s=n||o?f=>f:f=>f.toLowerCase(),a=s(r),c=null,u=-1;for(let f=0;f<rr.entries.length;f++){let h=rr.entries[f],g=s(h.query);if(g===a)return rr.entries.splice(f,1),rr.entries.unshift(h),h.result;n||h.result.truncated||g.length<=u||!a.includes(g)||(c=h.result,u=g.length)}let p=c?VN(c,i):jN(t,i);return rr.entries.unshift({query:r,result:p}),rr.entries.length>8&&rr.entries.pop(),p}var rr,xM=w(()=>{"use strict";rr={tag:null,useRegex:!1,caseSensitive:!1,entries:[]}});function km(e){if(!e?.managedId)return WN;let t=l.managedSession,r=[t?.id,t?.role,t?.csrfToken,l.currentManagedTeam,l.managedTeams];return r.some((n,o)=>n!==_M[o])&&(_M=r,$M=new Map),$M}function xm(e){return Uk.has(e)||Uk.set(e,{reasons:xo(e),selected:""}),Uk.get(e)}function $m(e){return JSON.stringify([e.managedId??e.integrity,xm(e).selected])}function Hk(){try{return localStorage.getItem(SM)==="1"}catch{return!1}}function CM(){try{localStorage.setItem(SM,"1")}catch{}}function KN(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 EM(e,t){return!e||ik(e.name)!=="stasis"?!1:e.managedId||!t||t.integrity!==e.integrity?!0:KN(t)}function GN(e){let t=Object.create(null);for(let[r,n]of e)t[r]=[...n].toSorted();return t}async function qN(e){let t=await fetch("/api/npm-advisories",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(GN(e))});if(!t.ok){let r=`HTTP ${t.status}`;try{let n=await t.json();typeof n?.error=="string"&&n.error&&(r=`${n.error} (HTTP ${t.status})`)}catch{}throw new Error(r)}return t.json()}async function _m(e,t){if(!e?.integrity||!e.managedId&&!Hk())return;let r=km(e),n=$m(e);if(r.has(n))return;let{reasons:o,selected:i}=xm(e),s=e.managedId?new Map:Ud(e,o.get(i)??null);r.set(n,{state:"loading",query:s});try{let a;if(e.managedId){let u=await m5(e.managedId,void 0,i);s=new Map(Object.entries(u.packages).map(([p,f])=>[p,new Set(f)])),a=u.advisories}else a=s.size>0?await qN(s):{};let c=new Map;if(a&&typeof a=="object")for(let[u,p]of Object.entries(a)){if(!Array.isArray(p))continue;let f=p.filter(h=>h&&typeof h=="object"&&typeof h.title=="string"&&typeof h.severity=="string");f.length>0&&c.set(u,f)}r.set(n,{state:"ok",byPackage:c,query:s})}catch(a){r.set(n,{state:"error",reason:a?.message??"fetch-failed",query:s})}t()}async function RM(e,t){if(!e?.integrity)return;let r=km(e),n=$m(e);r.get(n)?.state==="error"&&(r.delete(n),await _m(e,t))}function wm(e){return YN[e]??999}function XN(e){return e.charAt(0).toUpperCase()+e.slice(1)}function JN(){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 MM(e,t=()=>{}){let r=e?xm(e):null,n=[...r?.reasons.keys()??[]].map(i=>({id:`reason:${i}`,label:i})),o=ZN(e);return d`<div class="bundle-advisories-panel">${o!==m||n.length>0?d`<div class="bundle-advisories-toolbar">${o} ${n.length>0?d`<div class="bundle-advisories-scopes"><bundle-scope-selector .reasons="${n}" .value="${r.selected?`reason:${r.selected}`:""}" label="Choose advisory scope" @scope-change="${i=>{let s=i.detail.value.replace(/^reason:/u,"");r.selected=r.reasons.has(s)?s:"";let a=_m(e,t);return t(),a}}"></bundle-scope-selector></div>`:m}</div>`:m} ${QN(e)}</div>`}function ZN(e){if(!e||!e.managedId&&!Hk())return m;let t=km(e).get($m(e));if(t?.state!=="ok")return m;let r=t.query.size,n=t.byPackage.size;if(n===0)return d`<div class="bundle-advisories-summary">No advisories for the ${r} ${r===1?"package":"packages"} in ${xm(e).selected?"this scope":"this bundle"}.</div>`;let o=[...t.byPackage.values()].reduce((i,s)=>i+s.length,0);return d`<div class="bundle-advisories-summary">${o} ${o===1?"advisory":"advisories"} across ${n} of ${r} ${r===1?"package":"packages"}</div>`}function QN(e){if(!e)return d`<div class="bundle-advisories-empty">Bundle not loaded yet.</div>`;if(e.kind!=="stasis"||!e.managedId&&!e.bundle)return d`<div class="bundle-advisories-empty">Advisories are only available for stasis bundles.</div>`;if(!e.managedId&&!Hk())return JN();let t=km(e).get($m(e));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>`;if(t.byPackage.size===0)return m;let r=[...t.byPackage.entries()].toSorted(([n,o],[i,s])=>{let a=Math.min(...o.map(u=>wm(u.severity))),c=Math.min(...s.map(u=>wm(u.severity)));return a!==c?a-c:n.localeCompare(i)});return d`<div class="bundle-advisories"><ul class="bundle-advisories-list">${r.map(([n,o])=>eD(n,o,t.query.get(n)))}</ul></div>`}function eD(e,t,r){let n=[...t].toSorted((i,s)=>{let a=wm(i.severity)-wm(s.severity);return a!==0?a:(i.title??"").localeCompare(s.title??"")}),o=r?[...r].toSorted():[];return d`<li class="bundle-advisories-section"><div class="bundle-advisories-package"><span class="bundle-advisories-section-name">${e}</span> ${o.length>0?d`<span class="bundle-advisories-section-versions">${o.join(", ")}</span>`:m}</div><ul class="bundle-advisories-rows">${n.map(i=>oD(i))}</ul></li>`}function tD(e){if(typeof e!="string")return null;let t=/\/(GHSA-[a-z0-9-]+)(?:[/?#]|$)/iu.exec(e);return t?t[1]:null}function nD(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 oD(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:"",i=typeof e.vulnerable_versions=="string"?e.vulnerable_versions:null,s=typeof e.url=="string"&&/^https?:\/\//iu.test(e.url)?e.url:null,a=tD(s),c=Array.isArray(e.cwe)?e.cwe.filter(p=>typeof p=="string"):[],u=a?d`<a class="bundle-advisory-ghsa" href="${s}" target="_blank" rel="noopener noreferrer">${a}${rD}</a>`:m;return d`<li class="bundle-advisory-row"><div class="bundle-advisory-rail"><span class="${`bundle-advisory-severity sev-${t}`}">${XN(t)}</span> ${n?d`<span class="bundle-advisory-cvss-score">CVSS <span class="mono">${n}</span></span>`:m}</div><div class="bundle-advisory-body"><div class="bundle-advisory-header"><span class="bundle-advisory-title">${r}</span> ${u}</div><div class="bundle-advisory-subrow"><div class="bundle-advisory-meta">${i?d`<span>Affected <span class="mono">${i}</span></span>`:m} ${c.length>0?d`<span class="bundle-advisory-cwes">${c.map((p,f)=>d`${f===0?"":", "}${nD(p)}`)}</span>`:m}</div>${o?d`<div class="bundle-advisory-cvss-vector mono">${o}</div>`:m}</div></div></li>`}var WN,$M,_M,Uk,SM,YN,rD,jk=w(()=>{"use strict";T();D();Zt();xi();on();Ik();hm();WN=new Map,$M=new Map,_M=[];Uk=new WeakMap;SM="deepview.advisories.proxyConsent";YN={critical:0,high:1,moderate:2,low:3,info:4};rD=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 sD(e){if(Vk.has(e))return Vk.get(e);let t=X6(e),r=Fk(e),n=[...t.keys()].filter(c=>t.get(c)!==null),{stripped:o}=hr(n),i=new Map(n.map((c,u)=>[c,o[u]])),s={};for(let c of n){let u=i.get(c),p=r.get(c);s[u]={imports:p?[...p].map(f=>i.get(f)).filter(Boolean):[],size:t.get(c)}}let a={tree:s,origToStripped:i};return Vk.set(e,a),a}function BM(e,t=null){let r={inprogress:0,fixed:0,invalid:0,deleted:0};if(!e?.fileHashes)return r;let n=new Set;for(let[o,i]of e.fileHashes)if(!(t&&!t.has(o))&&!n.has(i)){n.add(i);for(let s of Xk(i)){let a=l.triage.get(W(s))?.triage;a&&r[a]!==void 0&&r[a]++}}return r}function Cl(e,t="graph"){if(!e||e.size===0)return new Map;let r=new Map;for(let[n,o]of e){let i=Xk(o);if(i.length===0)continue;let s=i.filter(a=>{let c=l.triage.get(W(a))?.triage??null;return t==="issues"?c!=="invalid"&&c!=="deleted":c===l.shownTriage});s.length!==0&&r.set(n,s)}return r}function OM(e){let t=sD(e),r=xo(e,t.origToStripped.keys());L.bundleReasonFor!==e.integrity&&(L.bundleReasonFor=e.integrity,L.dependencyPackagesView=!1,L.bundleReason=null);let{tree:n,origToStripped:o,selected:i}=QR(t.tree,t.origToStripped,r,L.bundleReason);L.bundleReason=i;let s=Object.keys(n);if(s.length===0)return null;let a=null;if(e.fileHashes&&e.fileHashes.size>0){a=new Map;for(let[B,ne]of e.fileHashes){let be=o.get(B);be!==void 0&&a.set(be,ne)}}let c=Cl(a),u=new Map,p=new Map,f=new Map,h=new Map;for(let[B,ne]of c){let be={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0},Wt=new Set,he=new Set,ln=[];for(let Ke of ne){be[Ke.severity]=(be[Ke.severity]||0)+1,Wt.add(Ke.severity);let nr=l.triage.get(W(Ke))?.color??"none";he.add(nr),ln.push({severity:Ke.severity,color:nr})}u.set(B,be),p.set(B,Wt),f.set(B,he),h.set(B,ln)}let g=L.bundleLayout==="matrix"||u.size===0?null:Qh(n,u),b=new Map;for(let[B,ne]of o)b.set(ne,B);let y=nn(e),k=y?new Map([...o].map(([B,ne])=>[ne,y.get(B)])):null,v=k?B=>k.get(B):null,x=s.filter(B=>Lk(B,b.get(B)??B,{packageDir:v?.(B)})==="__own__"),$=ZR(x,v),C=L.splitOwnDirs&&$,I=B=>Lk(B,b.get(B)??B,{splitOwnDirs:C,packageDir:v?.(B)}),E=eM(e,o,I,y,t.origToStripped),R=new Set;for(let B of s)if(R.add(I(B)),R.size>=3)break;let z=R.size>=3,U=s;if(L.focusedPkg){let B=s.filter(ne=>I(ne)===L.focusedPkg);B.length>0?U=B:L.focusedPkg=null}return L.selected&&!Object.hasOwn(n,L.selected)&&(L.selected=null),{treeData:n,files:U,ownCounts:u,transitiveCounts:g,severitySets:p,colorSets:f,fileFindings:h,options:{pkgOf:I},strippedToOrig:b,canSplitOwnDirs:$,canPackagesView:z,supportsLayers:!0,layerRoots:E,ownSourcePackages:x.length>0?new Set(x.map(I)):void 0,reasons:[...r.keys()]}}function Cm(){if(!mu)return;let e=kl();e&&e.refreshSidebar(mu,{isBundleContext:!0})}function Em(){if(!mu)return;let e=kl();e&&e.refreshTopPkgs(mu)}function PM(e){mu=e}function aD(e){let t=new Map,r=0;for(let{path:o,size:i,pkgDir:s}of e){if(typeof i!="number"||i<=0)continue;let a=mt(o,{packageDir:s});t.set(a,(t.get(a)??0)+i),r+=i}if(r===0)return m;let n=[...t.entries()].toSorted((o,i)=>i[1]-o[1]);return d`<div class="bundles-dist"><div class="bundles-dist-bar" aria-hidden="true">${re(n,([o])=>o,([o,i])=>d`<span class="bundles-dist-seg" style="${Se({flexGrow:i,background:er(o)})}" data-tooltip="${o==="__own__"?m:`${o}: ${ye(i)}`}"></span>`)}</div><ul class="bundles-dist-list">${re(n,([o])=>o,([o,i])=>{let s=(i/r*100).toFixed(1),a=Ei(o),c=er(o);return d`<li><span class="bundles-dist-dot" style="${Se({background:c})}"></span> <span class="bundles-dist-pkg" data-tooltip="${o==="__own__"?m:o}">${a}</span> <span class="bundles-dist-bar-row" aria-hidden="true"><span class="bundles-dist-bar-fill" style="${Se({width:`${s}%`,background:c})}"></span> </span><span class="bundles-dist-size">${ye(i)}</span> <span class="bundles-dist-percent">${s}%</span></li>`})}</ul></div>`}function AM(e,t,r,n,o,i,s=null){let{prefix:a,stripped:c}=hr(r),u=E=>o?.get(r[E]),p=new Set;for(let E=0;E<c.length;E++)p.add(mt(c[E],{packageDir:u(E)}));let f=c.map((E,R)=>R).toSorted((E,R)=>c[E].localeCompare(c[R])),h=c.map((E,R)=>({path:E,size:n[R],pkgDir:u(R)})),g=aD(h),b=g===m?d`<p class="bundles-overview-col-empty">No size information for this bundle's sources.</p>`:g,y={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0},k=0,v=new Map;if(l.bundleDetails?.fileHashes){let E=Cl(l.bundleDetails.fileHashes,"issues");for(let R of E.values())for(let z of R){y[z.severity]!==void 0&&y[z.severity]++,k++;for(let U of Uc(z.fileHash,z))v.set(U,(v.get(U)??0)+1)}}let x=[...v.keys()].toSorted(),$=Le.filter(E=>y[E]>0).map(E=>d`<span class="${`tree-count-chip ${E}`}">${y[E]} ${E.replaceAll("_"," ")}</span>`),C=r.length>0?d`<ul class="bundles-sources-list">${f.map(E=>{let R=r[E],z=n[E],U=d`<span class="bundles-source-path">${c[E]}</span> ${z==null?m:d`<span class="bundles-source-size">${ye(z)}</span>`}`;return d`<li>${s?.has(R)?d`<div class="bundles-source-row is-resource" data-tooltip="${R}">${U}</div>`:d`<button type="button" class="bundles-source-row" data-bundle-view-source="${R}" data-tooltip="${R}">${U}</button>`}</li>`})}</ul>`:d`<p class="bundles-overview-col-empty">No source files in this bundle.</p>`,I=x.length>0?d`<ul class="bundles-reports-list">${x.map(E=>{let R=ke[et(E)]??ke.default,z=v.get(E)??0;return d`<li><button type="button" class="report-chip bundles-report-chip" data-tooltip="${E}" data-bundle-issue-report="${E}">${V(R)}<span class="report-chip-label">${Re(E)}</span> <span class="bundles-report-count">${z} ${z===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-(s?.size??0)}</dd>${s?.size?d`<dt>Resources</dt><dd>${s.size}</dd>`:m} ${a?d`<dt>Prefix</dt><dd class="mono">${a}</dd>`:m}</dl>${i??m}</div>${k>0?d`<div class="bundles-issue-summary tree-count-chips">${$}</div>`:m}</div><div class="bundles-overview-columns"><section class="bundles-overview-col"><header class="bundles-overview-col-head">Packages <span class="bundles-overview-col-count">${p.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>${x.length>0?d`<section class="bundles-overview-col"><header class="bundles-overview-col-head">Reports <span class="bundles-overview-col-count">${x.length}</span></header><div class="bundles-overview-col-body bundles-overview-col-body--list">${I}</div></section>`:m}</div></div>`}function gu(){queueMicrotask(()=>{document.querySelector(".bundle-code-rail-body .bundle-code-tree-link.current")?.scrollIntoView({block:"nearest"})})}function Vs(e){for(let t of Le)for(let r of e)if(r.severity===t)return t;return e[0]?.severity??null}function cD(e,t,r,n,o=null){let i=e.split(`
129
+ `).length,s=String(i).length,a=rn(t),c=`${r??""}\0${t}`;a&&!Wk.has(c)&&!Kk.has(c)&&(Kk.add(c),(async()=>{let p=await Ir(e,a);Wk.set(c,p??null),Kk.delete(c),l.bundleSourceFile===t&&S()})());let u=Wk.get(c);return d`<div class="bundle-source-lines" style="${Se({"--lineno-width":`${s}ch`})}"><aside class="bundle-source-lineno-col" aria-hidden="true">${Array.from({length:i},(p,f)=>{let h=f+1,g=n.get(h),b=g?Vs(g.map(k=>k.f)):null,y=g&&l.bundleSourceFindingIdx!=null&&g.some(k=>k.idx===l.bundleSourceFindingIdx);return d`<div class="${N({"bundle-source-lineno-row":!0,"is-match":o?.has(h)??!1})}" data-line="${h}">${g?d`<button type="button" class="${N({"bundle-source-dot":!0,[`sev-${b}`]:!0,active:y})}" data-bundle-source-finding="${g[0].idx}" data-tooltip="${`${g.length} ${g.length===1?"issue":"issues"} on line ${h}`}" aria-label="${`${g.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="${a?`language-${a}`:""}">${typeof u=="string"?V(u):e}</code></pre></div>`}function dD(e){let t=l.bundleSourceFindingIdx;if(t==null)return m;let r=e[t];if(!r)return m;let n=r.fileHash?Uc(r.fileHash,r):[],o=l.triage.get(W(r))?.triage,i=o==="fixed"?"Fixed":o==="inprogress"?"In progress":null,s=Ts(r),a=UM(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> ${i?d`<span class="${`bundle-source-panel-triage triage-${o}`}">${i}</span>`:m} <button type="button" class="bundle-source-panel-close" data-action="bundle-source-panel-close" aria-label="Close finding details">×</button></header><div class="bundle-source-panel-body">${a||s?d`<div class="bundle-source-panel-line-row">${a?d`<span class="bundle-source-panel-line">${a}</span>`:m} ${s?d`<span class="bundle-source-panel-meta" title="${s}">${s}</span>`:m}</div>`:m}<div class="bundle-source-panel-desc">${Br(xa(r),{paragraphs:!1})}</div>${n.length>0?d`<div class="bundle-source-panel-reports"><div class="bundle-source-panel-reports-label">Reported by</div>${n.map(c=>{let u=Qe[et(c)]??Qe.default;return d`<button type="button" class="report-chip bundle-source-panel-report" data-tooltip="${c}" data-bundle-issue-report="${c}">${V(u)}<span class="report-chip-label">${Re(c)}</span></button>`})}</div>`:m}</div></aside>`}function Jk(e,t,r){let n=[],o=new Map;if(typeof r=="string"&&e?.fileHashes){let s=Cl(e.fileHashes,"issues").get(t)??[];for(let a=0;a<s.length;a++){let c=s[a];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:a}))}}return{fileFindings:n,lineFindings:o}}function NM(e){return d`<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" aria-label="Close source viewer">×</button></header>`}function Zk(e,t,r,n,o,i=null){return d`<div class="bundle-source-code-wrap">${typeof t=="string"?cD(t,e,r,o,i):d`<div class="bundle-source-empty">Source content not bundled.</div>`}</div>${dD(n)}`}function DM(){let e=l.bundleSourceFile;if(!e)return m;if(l.bundleDetailsTab==="code"||l.bundleDetailsTab==="search")return m;let r=vr(l.bundleDetails).get(e),{fileFindings:n,lineFindings:o}=Jk(l.bundleDetails,e,r);return d`<div class="bundle-source-overlay"><div class="${N({"bundle-source-modal":!0,"with-panel":l.bundleSourceFindingIdx!=null})}">${NM(e)}<div class="bundle-source-body">${l.bundleDetails?.metadataOnly?d`<div class="bundles-slide-placeholder">Loading source…</div>`:Zk(e,r,l.bundleDetails?.integrity,n,o)}</div></div></div>`}function uD(e){let t={name:"",files:new Map,dirs:new Map};for(let r of e){let n=r.split("/"),o=t;for(let i=0;i<n.length-1;i++){let s=n[i],a=o.dirs.get(s);a||(a={name:s,files:new Map,dirs:new Map},o.dirs.set(s,a)),o=a}o.files.set(n.at(-1),r)}return t}function pD(e,t){let r=0,n=null;if(!t||t.size===0)return{count:r,worst:n};let o=i=>{for(let s of i.files.values()){let a=t.get(s);if(!a||a.length===0)continue;r+=a.length;let c=Vs(a);(n===null||(je[c]??0)>(je[n]??0))&&(n=c)}for(let s of i.dirs.values())o(s)};return o(e),{count:r,worst:n}}function Yk(e,t,r=0,n=null,o="",i=!1){let s=[...e.dirs.entries()].toSorted(([f],[h])=>f.localeCompare(h)),a=[...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)=>i?!0:Sm.has(f)?Sm.get(f):r===0||c(h),p=f=>h=>{Sm.set(f,!h.currentTarget.parentElement.open)};return d`<ul class="${N({"bundle-code-tree":!0,root:r===0})}">${re(s,([f])=>`${o}/${f}`,([f,h])=>{let g=o?`${o}/${f}`:f,b=pD(h,n);return d`<li class="bundle-code-tree-dir"><details ?open="${u(g,h)}"><summary @click="${p(g)}"><span class="bundle-code-tree-dirname">${f}</span> ${b.count>0?d`<span class="${`bundle-code-tree-count sev-${b.worst}`}" title="${`${b.count} ${b.count===1?"issue":"issues"} inside`}">${b.count}</span>`:m}</summary>${Yk(h,t,r+1,n,g,i)}</details></li>`})} ${re(a,([,f])=>f,([f,h])=>{let g=n?.get(h),b=g&&g.length>0?Vs(g):null,y=g?.length??0;return d`<li class="bundle-code-tree-file"><button type="button" class="${N({"bundle-code-tree-link":!0,current:h===t})}" data-bundle-view-source="${h}" data-tooltip="${h}"><span class="bundle-code-tree-name">${f}</span> ${y>0?d`<span class="${`bundle-code-tree-count sev-${b}`}" title="${`${y} ${y===1?"issue":"issues"}`}">${y}</span>`:m}</button></li>`})}</ul>`}function bu(e,t){return t&&e.startsWith(t)?e.slice(t.length):e}function zM(e,t){let r=new Map;for(let i=0;i<t.length;i++)r.set(e[i],t[i]);let n=uD(e),o=i=>{let s=new Map;for(let[a,c]of i.files)s.set(a,r.get(c)??c);i.files=s;for(let a of i.dirs.values())o(a)};return o(n),n}function fD(e,t,r,n,o=""){if(!r)return Yk(e,t,0,n);let i=r.toLowerCase(),s=[],a=p=>{for(let[,f]of p.dirs)a(f);for(let[,f]of p.files)bu(f,o).toLowerCase().includes(i)&&s.push(f)};if(a(e),s.length===0)return d`<div class="bundle-code-search-empty">No files match.</div>`;let c=o?s.map(p=>bu(p,o)):s,u=zM(c,s);return Yk(u,t,0,n,"",!0)}function hD(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(),i=20,s=100,a=[],c=0;for(let[u,p]of e){if(typeof p!="string")continue;let f=[],h=p.split(`
130
+ `);for(let g=0;g<h.length;g++){let b=h[g];if(b.toLowerCase().includes(o)&&(f.push({ln:g+1,text:b}),c++,f.length>=i))break}if(f.length>0&&a.push({path:u,hits:f}),a.length>=s)break}return a.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 ${a.length} ${a.length===1?"file":"files"}</div>${a.map(({path:u,hits:p})=>{let f=bu(u,n);return d`<div class="${N({"bundle-code-search-file":!0,current:u===r})}"><button type="button" class="bundle-code-search-file-name" data-bundle-view-source="${u}" data-tooltip="${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" data-tooltip="${`${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 mD(e,t,r,n=""){if(!e.fileHashes)return d`<div class="bundle-code-search-empty">Computing file hashes…</div>`;let o=Cl(e.fileHashes,"issues");if(o.size===0)return d`<div class="bundle-code-search-empty">No issues match this bundle's files.</div>`;let i=t.toLowerCase(),s=[];for(let[a,c]of o)for(let u=0;u<c.length;u++){let p=c[u],f=p.description??"";i&&!a.toLowerCase().includes(i)&&!p.severity.includes(i)&&!p.severity.replaceAll("_"," ").includes(i)&&!f.toLowerCase().includes(i)||s.push({file:a,finding:p,fileIdx:u})}return s.sort((a,c)=>{let u=je[a.finding.severity]??0,p=je[c.finding.severity]??0;return p!==u?p-u:a.file.localeCompare(c.file)}),s.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">${s.length} ${s.length===1?"issue":"issues"}</div><ul class="bundle-code-search-issues">${s.map(({file:a,finding:c,fileIdx:u})=>{let p=c.severity,f=bu(a,n),h=a===r&&l.bundleSourceFindingIdx===u;return d`<li class="${N({"bundle-code-search-issue":!0,current:h})}"><button type="button" class="bundle-code-search-issue-link" data-bundle-view-source="${a}" data-bundle-view-finding-idx="${u}" data-bundle-view-line="${c.line??""}" data-tooltip="${a}"><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">${Br(xa(c),{paragraphs:!1})}</div></button></li>`})}</ul></div>`}function IM(e,t,r){let n=null,o=-1,i=0;for(let[c,u]of r){if(typeof t.get(c)!="string")continue;let p=je[Vs(u)]??0;(p>o||p===o&&u.length>i||p===o&&u.length===i&&(n===null||c.localeCompare(n)<0))&&(n=c,o=p,i=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 s=null,a=-1;for(let[c,u]of t)typeof u=="string"&&u.length>a&&(s=c,a=u.length);return s}function gD(e){let t=vr(e);if(t.size===0)return d`<div class="bundle-code-empty">This bundle doesn't carry any source content.</div>`;TM!==l.selectedBundle&&(Sm.clear(),TM=l.selectedBundle);let r=[...t.keys()].toSorted(),{prefix:n,stripped:o}=hr(r),i=zM(o,r),s=e.fileHashes?Cl(e.fileHashes,"issues"):new Map,a=l.bundleSourceFile;if($o&&($o.bundle!==l.selectedBundle||a&&a!==$o.path)&&($o=null),!a)a=IM(e,t,s),a&&(l.bundleSourceFile=a,$o={bundle:l.selectedBundle,path:a,hadIssues:s.size>0},gu());else if($o&&!$o.hadIssues&&s.size>0){$o.hadIssues=!0;let y=IM(e,t,s);y&&y!==a&&(a=y,l.bundleSourceFile=y,l.bundleSourceFindingIdx=null,$o.path=y,gu())}let c=a?t.get(a):null,{fileFindings:u,lineFindings:p}=Jk(e,a,c),h=s.size>0?["files","code","issues"]:["files","code"],g=h.includes(l.bundleCodeSearchMode)?l.bundleCodeSearchMode:"files",b=l.bundleCodeSearchQuery;return d`<div class="bundle-code-view"><aside class="bundle-code-rail"><div class="bundle-code-rail-head"><span class="bundle-code-rail-label">Files</span> <span class="bundle-code-rail-count">${r.length}</span></div>${n?d`<div class="bundle-code-rail-prefix mono" title="${n}">${n}</div>`:m}<bundle-code-search .modes="${h}"></bundle-code-search><div class="bundle-code-rail-body">${z0(g,[["files",()=>fD(i,a,b,s,n)],["code",()=>hD(t,b,a,n)],["issues",()=>mD(e,b,a,n)]])}</div></aside><div class="${N({"bundle-code-main":!0,"with-panel":l.bundleSourceFindingIdx!=null})}">${a?bD(e,a,c,u,p):d`<div class="bundle-code-placeholder">Pick a file from the tree to view its source.</div>`}</div></div>`}function bD(e,t,r,n,o){let i=typeof r=="string"?r.split(`
131
+ `).length:0,s=typeof r=="string"?Ki(r):0,a=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}" aria-label="Copy file path">${lD}</button> <span class="bundle-code-main-spacer"></span> ${typeof r=="string"?d`<span class="bundle-code-main-stats">${i.toLocaleString()} ${i===1?"line":"lines"} · ${ye(s)}</span>`:m} ${n.length>0?d`<span class="bundle-code-main-issues" data-bundle-code-issue-order="${JSON.stringify(a)}"><span class="${`bundle-code-tree-count sev-${Vs(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" aria-label="Previous issue">‹</button> <button type="button" class="bundle-code-issue-step" data-bundle-code-issue-step="1" aria-label="Next issue">›</button></span>`:m}</header><div class="bundle-code-main-body">${Zk(t,r,e.integrity,n,o)}</div>`}function vD(e){return e<=5?8:e<=15?6:e<=40?4:e<=120?3:2}function wD(e,t,r){let n=[];for(let o of e){let i=Math.max(1,o.ln-r),s=Math.min(t,o.ln+r),a=n.at(-1);a&&i<=a.end+1?a.end=Math.max(a.end,s):n.push({start:i,end:s})}return n}function kD(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,i=e.slice(o,o+r);if(o===0)return{text:i,ranges:t,clipped:!1};let s=[];for(let[a,c]of t){let u=a-o,p=c-o;p<=0||u>=i.length||s.push([Math.max(0,u),Math.min(i.length,p)])}return{text:i,ranges:s,clipped:!0}}function xD(e,t){if(t.length===0)return e;let r=[],n=0;for(let[o,i]of t){let s=Math.max(n,Math.min(o,e.length)),a=Math.max(s,Math.min(i,e.length));a<=s||(s>n&&r.push(e.slice(n,s)),r.push(d`<mark class="bundle-search-mark">${e.slice(s,a)}</mark>`),n=a)}return n<e.length&&r.push(e.slice(n)),r}function $D(e,t,r){let n=kD(e,r??[],yD);return d`<div class="${N({"bundle-search-line":!0,"is-match":r!=null})}"><span class="bundle-search-lineno">${t}</span> <span class="bundle-search-code">${n.clipped?d`<span class="bundle-search-clip">…</span>`:m}${xD(n.text,n.ranges)}</span></div>`}function _D(e,t,r,n,o){let{start:i,end:s}=r,a=i;for(let p=i;p<=s;p++)if(n.has(p)){a=p;break}let c=String(s).length,u=[];for(let p=i;p<=s;p++)u.push($D(t[p-1]??"",p,n.get(p)??null));return d`${o?d`<div class="bundle-search-gap" aria-hidden="true"></div>`:m} <button type="button" class="bundle-search-snippet" style="${Se({"--bundle-search-lineno-w":`${c}ch`})}" data-bundle-view-source="${e}" data-bundle-view-line="${a}" data-bundle-view-scroll-block="center" data-tooltip="${`${e}:${a}`}">${u}</button>`}function SD(e,t,r){let{path:n,lines:o,hits:i}=e,s=bu(n,t),a=wD(i,o.length,r),c=new Map(i.map(f=>[f.ln,f.ranges])),u=i[0].ln,p=n===l.bundleSourceFile;return d`<section class="${N({"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" data-tooltip="${n}">${s}</button> <span class="bundle-search-file-count">${i.length} ${i.length===1?"match":"matches"}</span></header><div class="bundle-search-snippets">${a.map((f,h)=>_D(n,o,f,c,h>0))}</div></section>`}function CD(e,t,r,n,o,i){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 s=kM(e.integrity??"",t,r,n,o);if(s.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">${s.error}</span></div></div>`;let{fileResults:a,totalHits:c,truncated:u}=s,p=[...t.keys()].toSorted(),{prefix:f}=hr(p);if(a.length===0)return d`<div class="bundle-search-results"><div class="bundle-search-empty">No matches.</div></div>`;let h=i?vD(c):0,g=a.length;return d`<div class="bundle-search-results"><div class="bundle-search-summary"><span>${c}${u?"+":""} ${c===1?"match":"matches"} in ${g}${u?"+":""} ${g===1?"file":"files"}</span> ${f?d`<span class="bundle-search-summary-prefix mono" title="${f}">${f}</span>`:m} ${u?d`<span class="bundle-search-summary-more">results capped — refine to narrow</span>`:m}</div>${re(a,b=>b.path,b=>SD(b,f,h))}</div>`}function ED(e,t,r,n){if(!t||typeof e!="string")return null;let o=zk(t,r,n);if(o.error)return null;let i=new Set,s=e.split(`
132
+ `);for(let a=0;a<s.length;a++)o.ranges(s[a]).length>0&&i.add(a+1);return i}function RD(e,t,r){let n=l.bundleSourceFile;if(!n)return m;let o=t.get(n),{fileFindings:i,lineFindings:s}=Jk(e,n,o);return d`<aside class="bundle-search-side">${NM(n)}<div class="bundle-source-body">${Zk(n,o,e.integrity,i,s,r)}</div></aside>`}function MD(e){let t=vr(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=l.bundleSearchQuery,n=l.bundleSearchRegex,o=l.bundleSearchCase,i=null;if(l.bundleSourceFile){let a=ED(t.get(l.bundleSourceFile),r,n,o);a&&a.size===0?(l.bundleSourceFile=null,l.bundleSourceFindingIdx=null):i=a}let s=l.bundleSearchContext;return d`<div class="bundle-search-view"><div class="bundle-search-bar-row"><bundle-search></bundle-search><mode-switch data-bundle-search-context label="Context" .checked="${s}" accessible-label="Toggle context lines"></mode-switch></div><div class="bundle-search-main">${CD(e,t,r,n,o,s)} ${RD(e,t,i)}</div></div>`}function AD(e){let t=EM(e,l.bundleDetails);l.bundleDetailsTab==="advisories"&&!t&&(l.bundleDetailsTab="overview");let r=_l(l.bundles??[],l.selectedBundle).length>0;l.bundleDetailsTab==="compare"&&!r&&(l.bundleDetailsTab="overview");let n=l.bundleDetailsTab,o=n==="overview",i=l.bundleDetails,s=!!(i&&i.integrity===e.integrity),a=s&&!i.error&&!!(i.json||i.bundle)&&!(i.metadataOnly&&bi(n));return n==="advisories"&&t&&a&&_m(i,S).catch(()=>{}),d`<div class="bundles-view bundles-slide-view"><header class="bundles-slide-bar"><span class="bundles-slide-icon" aria-hidden="true">${V(Er)}</span><div class="bundles-slide-title"><div class="bundles-slide-name">${e.name}</div></div><button type="button" class="bundles-download-btn bundles-scan-button" ?hidden="${!gm(e)}" @click="${()=>{Ok(e)}}">${V(el)}<span>Scan</span></button><div class="bundles-slide-tabs" role="tablist">${t?d`<button type="button" class="${N({"bundles-tab":!0,active:n==="advisories"})}" data-bundle-tab="advisories" aria-selected="${String(n==="advisories")}" role="tab">Advisories</button>`:m} <button type="button" class="${N({"bundles-tab":!0,active:n==="issues"})}" data-bundle-tab="issues" aria-selected="${String(n==="issues")}" role="tab">Issues</button> <button type="button" class="${N({"bundles-tab":!0,active:n==="terminal"})}" data-bundle-tab="terminal" aria-selected="${String(n==="terminal")}" role="tab">Terminal</button> <button type="button" class="${N({"bundles-tab":!0,active:n==="treemap"})}" data-bundle-tab="treemap" aria-selected="${String(n==="treemap")}" role="tab">Treemap</button> <button type="button" class="${N({"bundles-tab":!0,active:n==="graph"})}" data-bundle-tab="graph" aria-selected="${String(n==="graph")}" role="tab">Graph</button> <button type="button" class="${N({"bundles-tab":!0,active:n==="code"})}" data-bundle-tab="code" aria-selected="${String(n==="code")}" role="tab">Code</button> <button type="button" class="${N({"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="${N({"bundles-tab":!0,active:n==="compare"})}" data-bundle-tab="compare" aria-selected="${String(n==="compare")}" role="tab">Compare</button>`:m} <button type="button" class="${N({"bundles-tab":!0,active:o})}" data-bundle-tab="overview" aria-selected="${String(o)}" role="tab">Overview</button></div></header><div class="${N({"bundles-slide-body":!0,"bundles-slide-body-overview":o})}">${o?zD(e,i):a?z0(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="${i}"></bundle-treemap>`],["code",()=>gD(i)],["search",()=>MD(i)],["compare",()=>d`<bundle-compare .details="${i}" .integrity="${e.integrity}"></bundle-compare>`],["issues",()=>ID(i)],["advisories",()=>MM(i,S)]]):s&&i.sourceError?d`<div class="bundles-slide-placeholder is-error">${i.sourceError} <button type="button" data-bundle-retry-sources>Retry</button></div>`:s&&!i.metadataOnly?d`<div class="${N({"bundles-slide-placeholder":!0,"is-error":!!i.error})}">${i.error?`Failed to parse: ${i.error}`:"Bundle contents not parsed."}</div>`:d`<div class="bundles-slide-placeholder">Loading bundle…</div>`}</div></div>`}function TD(e,t={}){if(!e)return m;let r=[];if(e.fileHash&&(r=Uc(e.fileHash,e)),r.length===0&&t.bucketKey&&(t.kind==="package"?r=fy(t.bucketKey,e):t.kind==="repository"&&(r=hy(t.bucketKey,e))),r.length===0)return m;let n=r.slice(0,2),o=r.length-n.length;return d`<div class="bundle-issue-reports">${n.map(i=>{let s=Qe[et(i)]??Qe.default;return d`<button type="button" class="report-chip" data-tooltip="${i}" data-bundle-issue-report="${i}">${V(s)}<span class="report-chip-label">${Re(i)}</span></button>`})} ${o>0?d`<span class="bundle-issue-reports-more">, and ${o} more…</span>`:m}</div>`}function UM(e){if(e==null||e==="")return"";let t=String(e),r=t.indexOf("-");if(r>0){let o=parseInt(t.slice(0,r),10),i=parseInt(t.slice(r+1),10);return Number.isFinite(o)&&Number.isFinite(i)&&i>o?`Lines ${o}-${i}`:Number.isFinite(o)?`Line ${o}`:""}let n=parseInt(t,10);return Number.isFinite(n)?`Line ${n}`:""}function Sl(e,t){return d`<div class="bundle-issues-empty"><p class="bundle-issues-empty-primary">${e}</p>${t?d`<p class="bundle-issues-empty-hint">${t}</p>`:m}</div>`}function ID(e){if(e.managedId)return Sl("Open a report to review its findings.","Bundle metadata includes source hashes; reports are available through your teams.");if(!e.fileHashes)return Sl("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 Sl("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=Cl(e.fileHashes,"issues");if(t.size===0){let r=iD();if(r===0)return Sl("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+=Xk(o).length;return n>0?Sl("All matching issues are dismissed.",`${n} ${n===1?"finding matches":"findings match"} this bundle's files, but every one is triaged invalid or deleted.`):Sl("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 yu(t,{kind:"bundle"})}function yu(e,{kind:t,bucketKey:r}={}){let n=[...e.keys()],{prefix:o,stripped:i}=hr(n),s=new Map(n.map((u,p)=>[u,i[p]])),a=[...e.entries()].toSorted(([u,p],[f,h])=>{let g=je[Vs(p)]??0,b=je[Vs(h)]??0;return b!==g?b-g:(s.get(u)??u).localeCompare(s.get(f)??f)}),c=[...e.values()].reduce((u,p)=>u+p.length,0);return d`<div class="bundle-issues"><div class="bundle-issues-summary">${c} ${c===1?"issue":"issues"} across ${e.size} ${e.size===1?"file":"files"} ${o?d`<span class="mono">${o}</span>`:m}</div><ul class="bundle-issues-list">${re(a,([u])=>u,([u,p])=>{let f=s.get(u)??u,h=[...p].toSorted((b,y)=>{let k=je[b.severity]??0,v=je[y.severity]??0;if(v!==k)return v-k;let x=parseInt(b.line,10)||0,$=parseInt(y.line,10)||0;return x-$}),g=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}" data-tooltip="${u}">${f}</button>`:g?d`<a class="bundle-issues-file-name bundle-issues-file-name-link mono" href="${g}" target="_blank" rel="noopener" data-tooltip="${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">${re(h,b=>b.id??`${u}\0${b.line??""}\0${b.severity??""}\0${b.description??""}`,b=>{let y=p.indexOf(b),k=b.severity,v=UM(b.line),x=l.triage.get(W(b))?.triage,$=x==="fixed"||x==="invalid"||x==="deleted"?x.toUpperCase():x==="inprogress"?"In progress":null,C=d`<div class="bundle-issues-finding-head"><span class="${`bundle-issue-sev sev-${k}`}">${k.replaceAll("_"," ")}</span> ${v?d`<span class="bundle-issues-finding-line">${v}</span>`:m} ${$?d`<span class="${`bundle-issues-finding-triage triage-${x}`}">${$}</span>`:m} <span class="bundle-issues-finding-spacer"></span> ${TD(b,{kind:t,bucketKey:r})}</div><div class="bundle-issues-finding-desc">${Br(xa(b),{paragraphs:!1})}</div>`;return d`<li class="bundle-issues-finding">${t==="bundle"?d`<button type="button" class="bundle-issues-finding-link" data-bundle-view-source="${u}" data-bundle-view-finding-idx="${y}" data-bundle-view-line="${b.line??""}" data-tooltip="${u}">${C}</button>`:d`<div class="bundle-issues-finding-link bundle-issues-finding-static" title="${u}">${C}</div>`}</li>`})}</ul></li>`})}</ul></div>`}function HM(e){let t=l.selectedBundle,r=t?e.find(n=>n.integrity===t):null;return r?AD(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>`}function FD(e){if(LM[e])return LM[e];let t=0;for(let r of e)t=Math.imul(t,31)+r.codePointAt(0)|0;return FM[(t>>>0)%FM.length]}function BD(e){let t=e.currentTarget,r=e.target.closest?.(".bundles-languages-segment");!r||!t.contains(r)||(t.dataset.tooltip=r.dataset.languageTooltip??"",uw(t))}function OD(e){delete e.currentTarget.dataset.tooltip,ii()}function PD(e){if(e?.kind!=="stasis"||!e.bundle)return m;let t=e.lineCounts?.size>0?e.lineCounts:new Map([...vr(e)].map(([i,s])=>[i,jd(s)])),r=e.codeStats??Dd(t,Ut(e)),n=r.lines,o=r.languages.filter(i=>i.lines>0);return n<=0||o.length===0?m:d`<div class="bundles-languages-bar" data-tooltip-managed aria-label="Languages in this bundle" @pointerover="${BD}" @pointerleave="${OD}">${o.map(({key:i,label:s,lines:a})=>{let c=a/n*100;return d`<span class="bundles-languages-segment" style="${Se({flexGrow:a,background:FD(i)})}" data-language-tooltip="${`${s} \xB7 ${c<1?c.toFixed(1):c.toFixed(0)}% \xB7 ${a} ${a===1?"line":"lines"}`}"></span>`})}</div>`}async function ND(e){try{await(await He()).downloadManagedBundle(e.managedId,e.filename??e.name??"bundle")}catch(t){alert(t.message)}}function DD(e,t){let r=gM(t),n=PD(t);return d`<div class="bundles-overview-exports">${n}<div class="bundles-overview-exports-row">${e.managedId?Rn()?d`<button type="button" class="bundles-download-btn" @click="${()=>{ND(e)}}">${Gk}<span>Download bundle</span></button>`:d`<a class="bundles-download-btn" href="${`/api/bundles/${encodeURIComponent(e.managedId)}/download`}">${Gk}<span>Download bundle</span></a>`:d`<button type="button" class="bundles-download-btn" data-bundle-download="${e.integrity}">${Gk}<span>Download bundle</span></button>`} ${r?d`<div class="bundles-export-pair"><button type="button" class="bundles-download-btn" data-bundle-export-sbom="cyclonedx" data-tooltip="Export a CycloneDX SBOM (.cdx.json)">CycloneDX</button> <button type="button" class="bundles-download-btn" data-bundle-export-sbom="spdx" data-tooltip="Export an SPDX SBOM (.spdx.json)">${LD}<span>SPDX</span></button></div>`:m}</div></div>`}function qk(e,t,r=m){return d`<div class="bundles-overview"><div class="bundles-overview-summary"><div class="bundles-detail-meta-row">${e}${t}</div></div>${r}</div>`}function zD(e,t){let r=d`<dl class="bundles-detail-meta"><dt>Name</dt><dd>${e.name}</dd>${e.managedId?d`<dt>Repository</dt><dd>${e.repoFullName||"Unattached"}</dd>${e.repoId==null?m:d`<dt>Directory</dt><dd class="mono">/${e.repoDirectory??""}</dd>`}`:m}<dt>Integrity</dt><dd class="mono">${e.integrity}</dd>${t&&t.integrity===e.integrity?d`<dt>Size</dt><dd>${ye(t.size)}</dd>`:m}</dl>`,n=DD(e,t);if(!t||t.integrity!==e.integrity)return qk(r,n);if(t.error)return qk(r,n,d`<div class="bundles-overview-placeholder is-error">Failed to parse: ${t.error}</div>`);if(t.kind==="sourcemap"&&t.json){let o=t.json,i=o.sources??[],s=Ut(t),a=t.sourceSizes??(s.size===i.length?i.map(u=>s.get(u)??null):i.map((u,p)=>typeof o.sourcesContent?.[p]=="string"?Ki(o.sourcesContent[p]):null)),c=d`<dt>Version</dt><dd>${String(o.version??"?")}</dd>${o.file?d`<dt>Output</dt><dd class="mono">${o.file}</dd>`:m} ${o.sourceRoot?d`<dt>Source root</dt><dd class="mono">${o.sourceRoot}</dd>`:m} ${o.names||t.namesCount!=null?d`<dt>Names</dt><dd>${o.names?.length??t.namesCount}</dd>`:m}`;return AM(r,c,i,a,null,n)}if(t.kind==="stasis"&&t.bundle){let o=t.bundle,i=Ut(t),s=ul(t),a=[...s.keys()],c=new Set(a.filter(g=>s.get(g)==="resource")),u=new Set;for(let g of o.imports.keys()){let b=g.replace(/\s*\(with: .*\)\s*$/u,"");for(let y of b.split(", "))u.add(y)}let p=[...u].toSorted(),f=a.map(g=>i.get(g)),h=d`<dt>Version</dt><dd>${String(o.version)}</dd>${p.length>0?d`<dt>Resolution kinds</dt><dd>${p.join(", ")}</dd>`:m}`;return AM(r,h,a,f,nn(t),n,c)}return qk(r,n,d`<div class="bundles-overview-placeholder">Bundle contents not parsed.</div>`)}var Xk,iD,mu,Vk,Wk,Kk,lD,$o,Sm,TM,yD,Gk,LD,LM,FM,vu=w(()=>{"use strict";T();Cs();Zt();B3();Ne();Mt();Gn();qe();en();ft();ym();Pk();D();pe();At();on();d0();pl();Dk();xM();$l();mm();ct();Os();nu();Ns();ao();P0();lo();jk();wl();zt();Xk=e=>_()?[]:uy(e),iD=()=>_()?0:py(),mu=null,Vk=new WeakMap;Wk=new Map,Kk=new Set,lD=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>`,$o=null;Sm=new Map,TM=null;yD=400;Gk=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>`,LD=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>`,LM=Object.freeze({javascript:"#f1e05a",jsx:"#f1e05a",typescript:"#3178c6",tsx:"#3178c6",json:"#f1e05a",css:"#663399",markup:"#e34c26",yaml:"#cb171e",bash:"#89e051",markdown:"#083fa1",solidity:"#AA6746",php:"#4F5D95",rust:"#dea584",ruby:"#701516",java:"#b07219",cpp:"#f34b7d",c:"#555555",objectivec:"#438eff",python:"#3572A5",go:"#00ADD8",kotlin:"#A97BFF",swift:"#F05138",dart:"#00B4AB",sql:"#e38c00",lua:"#000080",csharp:"#178600",scala:"#DC322F",vue:"#41B883",svelte:"#FF3E00"}),FM=Object.freeze(["#8b5cf6","#ec4899","#14b8a6","#f97316","#06b6d4","#84cc16","#e11d48","#a855f7"])});function jM(){Cr().catch(()=>{});let e=_n(),t={inprogress:0,fixed:0,invalid:0,deleted:0},r=[];for(let[h,g]of e){let b=[],y=[],k=new Map,v=new Set;for(let[x,$]of g.byVersion){let C=[],I=new Map;for(let E of $.findings){let R=l.triage.get(W(E))?.triage??null;R==="inprogress"?t.inprogress++:R==="fixed"?t.fixed++:R==="invalid"?t.invalid++:R==="deleted"&&t.deleted++,R===l.shownTriage&&(C.push(E),I.has(E.file)||I.set(E.file,[]),I.get(E.file).push(E))}if(C.length!==0){b.push([x,{findings:C,files:I,reports:$.reports}]);for(let E of C)y.push(E),k.has(E.file)||k.set(E.file,[]),k.get(E.file).push(E);for(let E of $.reports)v.add(E)}}b.length!==0&&(b.sort(([x],[$])=>zb(x,$)),r.push([h,{findings:y,files:k,reports:v,versions:b}]))}let n=l.selectedPackage,o=n?r.find(([h])=>h===n)??null:null,i=null;if(o){let h=o[1].versions,g=l.selectedPackageVersion;i=h.find(([b])=>b===g)??null,!i&&h.length===1&&(i=h[0])}let s=i?i[1]:o?o[1]:null;if(o&&l.packageDetailsTab==="issues")return GD(o[0],s,i?i[0]:void 0);let a=l.packagesSearchQuery.trim().toLowerCase(),c=a?r.filter(([h])=>h.toLowerCase().includes(a)):r.slice();WD(c,l.packagesSortBy);let u=r.reduce((h,[,g])=>h+g.findings.length,0),p=new Set;for(let[,h]of r)for(let g of h.reports)p.add(g);let f=o?"packages-layout open":"packages-layout";return d`<div class="${N({"packages-view":!0,"with-details":!!o})}"><header class="page-head"><div class="page-title"><h1>Packages</h1><div class="meta-row"><span>${c.length===r.length?d`${r.length} ${r.length===1?"package":"packages"}`:d`${c.length} of ${r.length} ${r.length===1?"package":"packages"}`}</span> ${u>0?d`<span>${u} ${u===1?"finding":"findings"} across ${p.size} ${p.size===1?"report":"reports"}</span>`:m}</div></div>${jD(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.":l.shownTriage?`No ${l.shownTriage} findings in any package.`:"No untriaged findings in any package."}</p>`:c.length===0?d`<p style="color:var(--muted)">No packages match "${l.packagesSearchQuery}".</p>`:d`<div class="${f}"><ul class="packages-list">${re(UD(c),HD,h=>qD(h,n,l.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 aria-label="Close details">×</button></header><div class="packages-details-body">${JD(o[0],s,i?i[0]:void 0)}</div></aside>`:m}</div>`}</div>`}function UD(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[i,s]=o[0],a=l.expandedPackages.has(r);if(t.push({kind:"latest",pkg:r,version:i,bucket:s,totalVersions:o.length,expanded:a}),a)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 HD(e){return e.version===null?`${e.kind}:${e.pkg}`:`${e.kind}:${e.pkg}@${e.version}`}function jD(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="${VD}"></triage-selector></div>`}function WD(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 KD(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 i of o){let s=l.triage.get(W(i))?.triage??null;s==="invalid"?r.invalid++:s==="deleted"?r.deleted++:r.live++}return r}function GD(e,t,r){let n=_n().get(e),o=KD(n,r),i=l.packageSlideTriage??"live",s=n?VM(n,e,i,r):new Map,a=[...s.values()].reduce((f,h)=>f+h.length,0),c=i==="live"?a===1?"issue":"issues":a===1?`${i} issue`:`${i} issues`,u=i==="live"?"No live issues for this package.":`No ${i} 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" 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">${a} ${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">${s.size===0?d`<div class="bundle-issues-empty">${u}</div>`:yu(s,{kind:"package",bucketKey:e})}</div></div>`}function qD(e,t,r){let{kind:n,pkg:o,version:i,bucket:s}=e,a={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0};for(let b of s.findings){let y=ce(b,l.severityMode);a[y]!==void 0&&a[y]++}let c=Le.filter(b=>a[b]>0),u=er(o),f={selected:o===t&&YD(e,r),"packages-row-latest":n==="latest","packages-row-other":n==="other"},h=i===null?"":i,g=i===null?`Open issues for ${o}`:`Open issues for ${o}@${i}`;return d`<li class="${N(f)}" data-select-package="${o}" data-select-package-version="${h}"><span class="packages-dot" style="${Se({background:u})}"></span><div class="packages-row-text"><div class="packages-name-line"><span class="packages-name">${o}${i===null?m:d`<span class="packages-version">@${i}</span>`} </span>${n==="latest"?XD(o,e.expanded,e.totalVersions-1):m}</div><span class="packages-row-meta">${s.findings.length} ${s.findings.length===1?"finding":"findings"} · ${s.files.size} ${s.files.size===1?"file":"files"} · ${s.reports.size} ${s.reports.size===1?"report":"reports"}</span></div>${c.length>0?d`<div class="packages-row-chips">${c.map(b=>d`<span class="${`tree-count-chip ${b}`}" title="${b.replaceAll("_"," ")}">${a[b]}</span>`)}</div>`:m} <button type="button" class="packages-row-issues" data-package-row-issues="${o}" data-package-row-issues-version="${h}" aria-label="${g}">Issues →</button></li>`}function YD(e,t){return e.kind==="single"?!0:e.version===t}function XD(e,t,r){let n=t?"Hide":`+${r} ${r===1?"version":"versions"}`;return d`<button type="button" class="${N({"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}`}" data-tooltip="${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 JD(e,t,r){let n=_n().get(e),i=[...(n?VM(n,e,"live",r):new Map).values()].reduce((s,a)=>s+a.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> ${i>0?d`<button type="button" class="bundles-tab bundles-tab-action" data-package-tab="issues">Issues (${i}) →</button>`:m}</div>${ZD(e,t,r)}`}function VM(e,t,r="live",n){let o=new Map,i=n===void 0?e.files:e.byVersion.get(n)?.files??new Map;for(let[s,a]of i){let c=a.filter(f=>{let h=l.triage.get(W(f))?.triage??null;return r==="invalid"?h==="invalid":r==="deleted"?h==="deleted":h!=="invalid"&&h!=="deleted"});if(c.length===0)continue;let u=WM(t,s);o.has(u)||o.set(u,[]);let p=o.get(u);for(let f of c)p.push(f)}return o}function ZD(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=ce(f,l.severityMode);n[h]!==void 0&&n[h]++}let o=Le.filter(f=>n[f]>0),i=[...t.files.entries()].toSorted(([f,h],[g,b])=>b.length!==h.length?b.length-h.length:f.localeCompare(g)),s=[...t.reports].toSorted((f,h)=>f.localeCompare(h)),c=_n().get(e)?.repos,u=c&&c.size===1?[...c][0]:null,p=u?/^https?:/iu.test(u)?u:`https://github.com/${u}`:null;return d`<dl class="packages-detail-meta"><dt>Package</dt><dd class="mono">${e}</dd>${r?d`<dt>Version</dt><dd class="mono">${r}</dd>`:m} ${p?d`<dt>Repository</dt><dd class="mono"><a href="${p}" target="_blank" rel="noopener">${u}</a></dd>`:m}<dt>Findings</dt><dd>${t.findings.length}</dd><dt>Files</dt><dd>${t.files.size}</dd><dt>Reports</dt><dd>${t.reports.size}</dd></dl>${o.length>0?d`<div class="packages-detail-chips">${o.map(f=>d`<span class="${`tree-count-chip ${f}`}">${n[f]} ${f.replaceAll("_"," ")}</span>`)}</div>`:m}<h3 class="packages-detail-section">Reports</h3><ul class="packages-detail-reports">${s.map(f=>{let h=ke[et(f)]??ke.default;return d`<li><button type="button" class="packages-detail-report" data-tooltip="${f}" data-package-report="${f}">${V(h)}<span class="packages-detail-report-label">${Re(f)}</span></button></li>`})}</ul><h3 class="packages-detail-section">Files</h3><ul class="packages-detail-files">${i.map(([f,h])=>{let g=WM(e,f);return d`<li class="packages-detail-file"><span class="packages-detail-file-path mono" title="${f}">${g}</span> <span class="packages-detail-file-count">${h.length}</span></li>`})}</ul>`}function WM(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}var VD,KM=w(()=>{"use strict";T();Ne();Mt();Gn();qe();D();ct();pe();en();Ns();vu();VD=["inprogress","fixed","invalid","deleted"]});function GM(){Cr().catch(()=>{});let e=ms(),t={inprogress:0,fixed:0,invalid:0,deleted:0},r=[];for(let[p,f]of e){let h=[],g=new Map;for(let b of f.findings){let y=l.triage.get(W(b))?.triage??null;y==="inprogress"?t.inprogress++:y==="fixed"?t.fixed++:y==="invalid"?t.invalid++:y==="deleted"&&t.deleted++,y===l.shownTriage&&(h.push(b),g.has(b.file)||g.set(b.file,[]),g.get(b.file).push(b))}h.length>0&&r.push([p,{findings:h,files:g,reports:f.reports}])}let n=l.selectedRepository,o=n?r.find(([p])=>p===n)??null:null;if(o&&l.repositoryDetailsTab==="issues")return n9(o[0],o[1]);let i=l.repositoriesSearchQuery.trim().toLowerCase(),s=i?r.filter(([p])=>p.toLowerCase().includes(i)||tt(p).toLowerCase().includes(i)):r.slice();t9(s,l.repositoriesSortBy);let a=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="${N({"packages-view":!0,"with-details":!!o})}"><header class="page-head"><div class="page-title"><h1>Repositories</h1><div class="meta-row"><span>${s.length===r.length?d`${r.length} ${r.length===1?"repository":"repositories"}`:d`${s.length} of ${r.length} ${r.length===1?"repository":"repositories"}`}</span> ${a>0?d`<span>${a} ${a===1?"finding":"findings"} across ${c.size} ${c.size===1?"report":"reports"}</span>`:m}</div></div>${QD(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.":l.shownTriage?`No ${l.shownTriage} findings in any repository.`:"No untriaged findings in any repository."}</p>`:s.length===0?d`<p style="color:var(--muted)">No repositories match "${l.repositoriesSearchQuery}".</p>`:d`<div class="${u}"><ul class="packages-list">${re(s,([p])=>p,([p,f])=>o9(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 aria-label="Close details">×</button></header><div class="packages-details-body">${i9(o[0],o[1])}</div></aside>`:m}</div>`}</div>`}function QD(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="${e9}"></triage-selector></div>`}function t9(e,t){let r=t==="name-asc"?(n,o)=>tt(n[0]).localeCompare(tt(o[0])):t==="files-desc"?(n,o)=>o[1].files.size-n[1].files.size||tt(n[0]).localeCompare(tt(o[0])):t==="reports-desc"?(n,o)=>o[1].reports.size-n[1].reports.size||tt(n[0]).localeCompare(tt(o[0])):(n,o)=>o[1].findings.length-n[1].findings.length||tt(n[0]).localeCompare(tt(o[0]));e.sort(r)}function r9(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=l.triage.get(W(n))?.triage??null;o==="invalid"?t.invalid++:o==="deleted"?t.deleted++:t.live++}return t}function n9(e,t){let r=ms().get(e),n=r9(r),o=l.repositorySlideTriage??"live",i=r?qM(r,o):new Map,s=[...i.values()].reduce((u,p)=>u+p.length,0),a=o==="live"?s===1?"issue":"issues":s===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" aria-label="Back to repositories">← Back</button><div class="bundles-slide-title"><div class="bundles-slide-name">${tt(e)}</div><div class="bundles-slide-integrity">${s} ${a} · ${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">${i.size===0?d`<div class="bundle-issues-empty">${c}</div>`:yu(i,{kind:"repository",bucketKey:e})}</div></div>`}function o9(e,t,r){let n={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0};for(let a of t.findings){let c=ce(a,l.severityMode);n[c]!==void 0&&n[c]++}let o=Le.filter(a=>n[a]>0),i=er(e),s=tt(e);return d`<li class="${r?"selected":""}" data-select-repository="${e}"><span class="packages-dot" style="${Se({background:i})}"></span><div class="packages-row-text"><span class="packages-name">${s}</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(a=>d`<span class="${`tree-count-chip ${a}`}" title="${a.replaceAll("_"," ")}">${n[a]}</span>`)}</div>`:m} <button type="button" class="packages-row-issues" data-repository-row-issues="${e}" aria-label="${`Open issues for ${s}`}">Issues →</button></li>`}function i9(e,t){let r=ms().get(e),o=[...(r?qM(r):new Map).values()].reduce((i,s)=>i+s.length,0);return d`<div class="bundles-tabs" role="tablist"><button type="button" class="bundles-tab active" data-repository-tab="overview" aria-selected="true" role="tab">Overview</button> <span class="bundles-tabs-spacer"></span> ${o>0?d`<button type="button" class="bundles-tab bundles-tab-action" data-repository-tab="issues">Issues (${o}) →</button>`:m}</div>${s9(e,t)}`}function qM(e,t="live"){let r=new Map;for(let[n,o]of e.files){let i=o.filter(s=>{let a=l.triage.get(W(s))?.triage??null;return t==="invalid"?a==="invalid":t==="deleted"?a==="deleted":a!=="invalid"&&a!=="deleted"});i.length>0&&r.set(n,i)}return r}function s9(e,t){let r={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0};for(let a of t.findings){let c=ce(a,l.severityMode);r[c]!==void 0&&r[c]++}let n=Le.filter(a=>r[a]>0),o=[...t.files.entries()].toSorted(([a,c],[u,p])=>p.length!==c.length?p.length-c.length:a.localeCompare(u)),i=[...t.reports].toSorted((a,c)=>a.localeCompare(c)),s=/^https?:/iu.test(e)?e:`https://github.com/${e}`;return d`<dl class="packages-detail-meta"><dt>Repository</dt><dd class="mono"><a href="${s}" target="_blank" rel="noopener">${tt(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(a=>d`<span class="${`tree-count-chip ${a}`}">${r[a]} ${a.replaceAll("_"," ")}</span>`)}</div>`:m}<h3 class="packages-detail-section">Reports</h3><ul class="packages-detail-reports">${i.map(a=>{let c=ke[et(a)]??ke.default;return d`<li><button type="button" class="packages-detail-report" data-tooltip="${a}" data-package-report="${a}">${V(c)}<span class="packages-detail-report-label">${Re(a)}</span></button></li>`})}</ul><h3 class="packages-detail-section">Files</h3><ul class="packages-detail-files">${o.map(([a,c])=>d`<li class="packages-detail-file"><span class="packages-detail-file-path mono" title="${a}">${a}</span> <span class="packages-detail-file-count">${c.length}</span></li>`)}</ul>`}var e9,YM=w(()=>{"use strict";T();Ne();Mt();Gn();qe();D();ct();pe();en();Ns();vu();e9=["inprogress","fixed","invalid","deleted"]});function XM(e,t){let r=new Set(e),n=new Set,o=new Map,i=new Map(e.map((s,a)=>[s,a]));for(let s of t){let a=[...new Map(s.members.map(h=>[h.id,h])).values()],c=a.filter(h=>r.has(h.id));if(c.length===0)continue;for(let h of c)n.add(h.id);let u=a.filter(h=>r.has(h.id)||h.isApp),p=JSON.stringify([a.map(h=>h.id).toSorted(),u.map(h=>[h.id,h.title??"",h.source??null,h.revalidate??""]).toSorted(([h],[g])=>h.localeCompare(g))]),f=o.get(p);f||(f={key:p,members:u,reports:[],first:Math.min(...c.map(h=>i.get(h.id)))},o.set(p,f)),f.reports.some(h=>h.name===s.report&&h.managedReportId===s.managedReportId)||f.reports.push({name:s.report,...s.managedReportId?{managedReportId:s.managedReportId}:{},findingId:c[0].id,rowIndex:s.index})}return{rows:[...o.values()].toSorted((s,a)=>s.first-a.first),missing:e.filter(s=>!n.has(s))}}var JM=w(()=>{"use strict"});function Ws(e,t,r){return`${e} ${e===1?t:r}`}function a9(e,t){let r=Ue(l.triage.get(e)),n=t.filter(({name:a})=>no(l.triage,e,a)),o=r??(n.length>0?"ignored":null);if(!o)return m;let i=o==="ignored"&&n.length<t.length,s=i?`Ignored in ${n.length}/${t.length} reports`:No[o];return d`<span class="${`links-finding-status triage-${o}`}" data-tooltip="${i?n.map(({name:a})=>Re(a)).join(", "):m}">${s}</span>`}function Qk({id:e,title:t},r=[],n=!0,o=m){let i=r[0]?.name,s=Rd(e),a=Is(e)??s;return d`<li class="${n?"links-finding":"links-finding links-finding-context"}">${i?d`<button type="button" class="links-finding-id mono" data-links-preview="${e}" data-preview-report="${i}" data-preview-row="${r[0].rowIndex??m}" data-preview-managed-report="${r[0].managedReportId??m}" data-tooltip="${s}" aria-haspopup="dialog">${a}</button>`:Lt(e)?d`<a class="links-finding-id mono" href="${`#${bn({id:e})}`}" data-tooltip="${s}">${a}</a>`:d`<span class="links-finding-id mono">${a}</span>`} ${t?d`<span class="links-finding-title">${t}</span>`:m} ${a9(e,r)} ${n?m:d`<span class="links-member-context">not in this link</span>`} ${o}</li>`}function ZM(e){return d`<div class="links-finding-reports">${e.map(({name:t,findingId:r,managedReportId:n})=>d`<button type="button" class="links-finding-report report-button" data-tooltip="${Re(t)}" data-links-report="${t}" data-links-finding="${r}" data-managed-report="${n??m}">${V(Qe[et(t)]??Qe.default)}<span class="links-finding-report-label report-button-label">${Re(t)}</span></button>`)}</div>`}function l9(e,t){let r=e.reports.toSorted((n,o)=>Re(n.name).localeCompare(Re(o.name)));if(e.members.length===1){let n=e.members[0];return d`<li class="links-report-row links-report-row-single"><ul class="links-row-members">${Qk(n,r,t.has(n.id),ZM(r))}</ul></li>`}return d`<li class="links-report-row"><div class="links-report-row-head"><span class="links-row-count">${Ws(e.members.length,"finding","findings")} in row</span> ${ZM(r)}</div><ul class="links-row-members">${e.members.map(n=>Qk(n,r,t.has(n.id)))}</ul></li>`}function c9(e,t){let{rows:r,missing:n}=XM(e,Go(e)),o=new Set(e);return d`<li class="links-group"><div class="links-group-head"><span class="links-group-index">Link ${t+1}</span> <span class="links-group-count">${Ws(e.length,"finding","findings")}</span></div><ul class="links-group-rows">${re(r,i=>i.key,i=>l9(i,o))}</ul>${n.length>0?d`<div class="links-unlocated"><div class="links-finding-missing">Not in your reports</div><ul class="links-row-members">${n.map(i=>Qk({id:i,title:my(i)}))}</ul></div>`:m}</li>`}function QM(e=m){let t=l.currentLinks;if(!t)return m;Cr().catch(()=>{});let{name:r,groups:n,skipped:o}=t,i=new Set,s=new Set,a=0;for(let c of n)for(let u of c){if(i.has(u))continue;i.add(u);let p=gs(u);if(p.length!==0){a++;for(let f of p)s.add(f)}}return d`<div class="links-view"><header class="page-head"><div class="page-title"><h1>Links${e}</h1><div class="meta-row"><span class="links-file-name" data-tooltip="${r}">${V(ke[et(r)]??ke.default)}${Re(r)}</span> <span>${Ws(n.length,"link","links")}</span> <span>${Ws(i.size,"finding","findings")}</span> ${s.size>0?d`<span>found in ${Ws(s.size,"report","reports")}</span>`:m}</div></div></header>${a<i.size?d`<p class="links-note">${Ws(i.size-a,"linked finding is","linked findings are")} not in any report you hold. Import the reports they came from and this page fills in.</p>`:m} ${o>0?d`<p class="links-note">${Ws(o,"entry","entries")} in this file could not be linked — an id the app can't follow (a session-local number, or something that isn't an id at all).</p>`:m} ${n.length===0?d`<p class="links-empty">This file declares no links: every entry in it named fewer than two findings this app can reach.</p>`:d`<ol class="links-list">${re(n,(c,u)=>`${u}:${c.join(" ")}`,(c,u)=>c9(c,u))}</ol>`}</div>`}var e4=w(()=>{"use strict";T();Mt();qe();D();en();pe();JM();Ee()});function e1(e,t,r){let n=new Set(t);for(let o of r)n.add(o);return e.filter(o=>n.has(o))}function t4(){if(l.currentWorkspace){let e=J().find(r=>r.id===l.currentWorkspace),t=l.reports.map(r=>r.fileName).filter(r=>typeof r=="string");return{mode:"workspace",workspaceId:l.currentWorkspace,fileNames:e?e1(e.reports??[],l.storedFiles??[],t):t}}if(l.currentFile){let e=J().find(t=>Array.isArray(t.reports)&&t.reports.includes(l.currentFile));return e?{mode:"single",workspaceId:e.id,fileNames:[l.currentFile]}:null}return null}var r4=w(()=>{"use strict";D()});function n4({workspaceId:e,items:t}={}){return le("sync-upload-dialog",{workspaceId:e??"",items:Array.isArray(t)?[...t]:[]})}var t1,o4=w(()=>{"use strict";T();D();Qr();ue();Or();co();t1=class extends F{static styles=[...F.styles,A(We)];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 KC(this.workspaceId,n.identifier);else{let i=await Wo(n.identifier);o=await Of(this.workspaceId,n.identifier,i)}if(o.ok)t.push({kind:n.kind,identifier:n.identifier});else{let i=o.reason??"unknown";r.push({kind:n.kind,identifier:n.identifier,reason:i}),this._errors=[...this._errors,{label:di(n),reason:i}]}}catch(o){let i=o?.message??String(o);r.push({kind:n.kind,identifier:n.identifier,reason:i}),this._errors=[...this._errors,{label:di(n),reason:i}]}this._uploading=!1,this._done=!0,r.length===0&&this._finish({uploaded:t,failed:r})};render(){let{count:t,singular:r,kindLabel:n}=bh(this.items),o=r?d`Upload <strong>"${di(this.items[0])}"</strong> to the workspace's remote inventory?`:d`Upload <strong>${t}</strong> local ${n} to the workspace's remote inventory?`,i=r?m:yh(this.items),s=this._uploading?r?"Uploading\u2026":`Uploading ${t} ${n}\u2026`:r?"Upload":`Upload ${t}`;return d`<dialog @close="${this._onClose}"><header><h3>Upload to remote</h3></header><p class="lwd-body">${o}</p>${i}<p class="nwd-note">End-to-end encrypted with the workspace key — only workspace members can decrypt the uploaded content.</p>${vh(this._errors)}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}" ?disabled="${this._uploading}">${this._done&&this._errors.length>0?"Close":"Cancel"}</button> ${this._done&&this._errors.length>0?m:d`<button type="button" data-role="upload" @click="${this._onUpload}" ?disabled="${this._uploading||t===0}">${s}</button>`}</footer></dialog>`}};customElements.define("sync-upload-dialog",t1)});var Rm,r1=w(()=>{Rm=`.detail-action{width:22px;height:22px;display:grid;place-items:center;padding:0;background:transparent;border:0;border-radius:4px;color:var(--muted);font:500 16px/1 ui-monospace,monospace;cursor:default;&:hover{color:var(--accent);background:var(--surface-active)}&:focus-visible{outline:2px solid var(--accent);outline-offset:1px}}
133
+ `});var s4,i4=w(()=>{s4=`.rec-close{position:absolute;top:6px;right:6px;z-index:1}header{padding-right:1.5rem}.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-uploaded,.rec-status-reuploaded{color:var(--accent, #2563eb)}.rec-status-updated{color:var(--high, #d57422)}.rec-status-differs{color:var(--warning, #d97706)}.rec-choice{flex:0 0 auto;display:flex;gap:.3rem;& button{background:transparent;border:1px solid var(--border);color:var(--text);border-radius:4px;padding:.1rem .45rem;font:inherit;font-size:.72rem;cursor:default;&:hover:not(:disabled){border-color:var(--accent);color:var(--accent)}&:disabled{opacity:.5;cursor:default}}}.rec-status-failed,.rec-status-check-failed{color:var(--warning, #d97706)}.rec-status-differs,.rec-status-failed,.rec-status-check-failed{background:rgb(from var(--warning, #d97706) r g b / .14)}.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}
134
+ `});function p9(e){let t={good:0,updated:0,uploaded:0,differs:0,reuploaded:0,failed:0,"check-failed":0,missing:0};for(let r of e)r.status in t&&(t[r.status]+=1);return t}function o1({workspaceId:e,cloudCount:t,localFileNames:r,localBundles:n,autoRun:o}={}){return le("objstore-recovery-dialog",{workspaceId:e??"",cloudCount:typeof t=="number"?t:0,localFileNames:Array.isArray(r)?[...r]:[],localBundles:Array.isArray(n)?[...n]:[],autoRun:o===!0})}var a4,l4,n1,c4=w(()=>{"use strict";T();Qr();ue();X0();r1();Or();i4();a4={checking:{label:"checking\u2026",hint:"Checking the cloud copy\u2026"},good:{label:"available",hint:"The cloud copy is intact."},updated:{label:"local updated",hint:"Your copy was out of date. It was replaced with the cloud copy."},uploaded:{label:"cloud updated",hint:"Your copy was newer. It was uploaded to the cloud."},differs:{label:"differs",hint:"Your copy differs from the cloud copy, and nothing shows which one is newer. Choose which to keep."},reuploaded:{label:"re-uploaded",hint:"The cloud copy's data was missing. It was restored from your copy."},failed:{label:"failed",hint:"Couldn't bring this back in line. Re-check again to retry."},"check-failed":{label:"check failed",hint:"Couldn't download the cloud copy to check it, so its state is unknown. Re-check again to retry."},missing:{label:"missing",hint:"The cloud copy's data is gone, and there's no matching copy here to restore it from."}};l4=e=>e===1?"copy":"copies",n1=class extends F{static styles=[...F.styles,A(Rm),A(We),A(s4)];static properties={workspaceId:{type:String},cloudCount:{type:Number},localFileNames:{type:Array},localBundles:{type:Array},autoRun:{type:Boolean},_rows:{state:!0},_running:{state:!0},_ran:{state:!0},_error:{state:!0},_settled:{state:!0},_resolving:{state:!0},_bulk:{state:!0}};constructor(){super(),this.workspaceId="",this.cloudCount=0,this.localFileNames=[],this.localBundles=[],this.autoRun=!1,this._rows=[],this._running=!1,this._ran=!1,this._error=null,this._settled=!1,this._resolving=new Set,this._bulk=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="recheck"]')?.focus(),this.autoRun&&this._onRecheck()}_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(){return p9(this._rows)}_onResolve=async(t,r)=>{if(this._resolving.has(t.resourceTag))return;this._resolving=new Set([...this._resolving,t.resourceTag]);let n;try{let i=await qC(this.workspaceId,t.identifier,r,t.compared);n=i?{status:i.status,detail:i.detail}:{status:"failed",detail:"sync is not available"}}catch(i){n={status:"failed",detail:i?.message??String(i)}}this._rows=this._rows.map(i=>i.resourceTag===t.resourceTag?{...i,...n}:i);let o=new Set(this._resolving);o.delete(t.resourceTag),this._resolving=o};_onUseCloudForAll=async()=>{if(!(this._bulk||this._running)){this._bulk=!0;try{for(let t of this._differingRows())await this._onResolve(t,"cloud")}finally{this._bulk=!1}}};_differingRows(){return this._rows.filter(t=>t.status==="differs")}_onRecheck=async()=>{if(!(this._running||this._bulk||this._resolving.size>0)){this._running=!0,this._error=null,this._rows=[];try{let{items:t}=await GC(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 nm({workspaceId:this.workspaceId,items:t})};_statusHint(t){let r=a4[t.status]?.hint??"";return t.status==="good"&&this._heldLocally(t)&&(r="The cloud copy is intact and matches your copy."),t.detail?`${r}
135
+ ${t.detail}`:r}_heldLocally(t){return t.identifier?t.kind==="bundle"?this.localBundles.includes(t.identifier):this.localFileNames.includes(t.identifier):!1}_choice(t){if(t.status!=="differs")return m;let r=this._running||this._bulk||this._resolving.has(t.resourceTag);return d`<span class="rec-choice"><button type="button" data-role="keep-cloud" data-tooltip="Replace your copy with the cloud copy" @click="${()=>this._onResolve(t,"cloud")}" ?disabled="${r}">Use cloud copy</button> <button type="button" data-role="keep-local" data-tooltip="Upload your copy, replacing the cloud copy" @click="${()=>this._onResolve(t,"local")}" ?disabled="${r}">Upload mine</button></span>`}_rowsSection(){return this._rows.length===0?this._running?d`<p class="lwd-body">Fetching remote listing…</p>`:m:d`<ul class="rec-list">${this._rows.map(t=>d`<li class="rec-row"><span class="rec-label">${t.label}${t.kind==="bundle"?d`<span class="lwd-kind-tag">bundle</span>`:m}</span> ${this._choice(t)} <span class="${`rec-status rec-status-${t.status}`}" data-tooltip="${this._statusHint(t)}">${a4[t.status]?.label??t.status}</span></li>`)}</ul>`}_summarySection(){if(!this._ran||this._rows.length===0)return m;let t=this._counts(),r=[];return t.good&&r.push(`${t.good} available`),t.updated&&r.push(`${t.updated} local ${l4(t.updated)} updated from the cloud`),t.uploaded&&r.push(`${t.uploaded} cloud ${l4(t.uploaded)} updated from yours`),t.differs&&r.push(`${t.differs} ${t.differs===1?"differs":"differ"} \u2014 choose which copy to keep`),t.reuploaded&&r.push(`${t.reuploaded} re-uploaded`),t.failed&&r.push(`${t.failed} failed`),t["check-failed"]&&r.push(`${t["check-failed"]} check failed`),t.missing&&r.push(`${t.missing} missing`),r.length>0?d`<p class="rec-summary" role="status" aria-live="polite">${r.join(" \xB7 ")}</p>`:m}render(){let t=this.cloudCount===1?"":"s",r=this.cloudCount>0?d`the <strong>${this.cloudCount}</strong> remote`:"remote",n=this._ran?m:d`<p class="lwd-body">Re-check ${r} object${t} for this workspace. Each is re-fetched from the relay and compared with your copy. When one copy is provably newer, the other is updated to match; when it isn't clear, you choose which to keep. Any whose bytes are missing are re-uploaded from a matching local copy.</p>`,o=this._ran&&this._rows.length===0&&!this._error?d`<p class="lwd-empty">No remote objects to check.</p>`:m,i=this._ran?this._downloadableItems().length:0,s=this._differingRows().length>1||this._bulk;return d`<dialog @close="${this._onClose}"><button type="button" class="detail-action rec-close" data-role="close" aria-label="Close" @click="${this._onCancel}">×</button><header><h3>Re-check cloud storage</h3></header>${n} ${this._rowsSection()} ${o} ${this._summarySection()} ${this._error?d`<p class="rec-error" role="alert">${this._error}</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> ${s?d`<button type="button" data-role="use-cloud-all" data-tooltip="Replace your copy of every report that differs with its cloud copy" @click="${this._onUseCloudForAll}" ?disabled="${this._running||this._bulk}">${this._bulk?"Using cloud copies\u2026":`Use cloud for all ${this._differingRows().length} conflicts`}</button>`:m} ${!s&&i>0?d`<button type="button" data-role="download" @click="${this._onDownload}" ?disabled="${this._running}">Download ${i} not stored locally</button>`:m} ${s?m:d`<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._bulk||this._resolving.size>0}">${this._running?"Re-checking\u2026":this._ran?"Re-check again":"Re-check"}</button></footer></dialog>`}};customElements.define("objstore-recovery-dialog",n1)});var u4,d4=w(()=>{u4=`.ssd-close{position:absolute;top:6px;right:6px;z-index:1}header{padding-right:1.5rem}.lwd-list{margin:.5rem 0 0}
136
+ `});function p4({names:e}={}){return new Promise(t=>{let r=document.createElement("sync-suggest-dialog");r.exclusive=!0,r.names=Array.isArray(e)?[...e]:[];let n=(o,i)=>{r.remove(),t({shown:o,sync:i})};r.addEventListener("resolve",o=>n(!0,o.detail===!0)),r.addEventListener("modal-conflict",()=>n(!1,!1)),document.body.append(r)})}var h9,i1,f4=w(()=>{"use strict";T();ue();r1();Or();d4();h9=10,i1=class extends F{static styles=[...F.styles,A(Rm),A(We),A(u4)];static properties={names:{type:Array}};constructor(){super(),this.names=[]}focusInitial(){this.renderRoot.querySelector('button[data-role="sync"]')?.focus()}_onSync=()=>this._finish(!0);_onDismiss=()=>this._finish(!1);_onClose=()=>this._finish(!1);_list(){if(this.names.length<2)return m;let t=this.names.slice(0,h9),r=this.names.length-t.length;return d`<ul class="lwd-list">${t.map(n=>d`<li><strong>${n}</strong></li>`)} ${r>0?d`<li>and ${r} more</li>`:m}</ul>`}render(){let t=this.names.length===1,r=t?d`Your copy of <strong>"${this.names[0]}"</strong> no longer matches its cloud copy, so other members may be seeing a different version.`:d`<strong>${this.names.length}</strong> reports no longer match their cloud copies, so other members may be seeing different versions.`;return d`<dialog @close="${this._onClose}"><button type="button" class="detail-action ssd-close" data-role="close" aria-label="Close" @click="${this._onDismiss}">×</button><header><h3>Reports out of sync</h3></header><p class="lwd-body">${r}</p>${this._list()}<p class="nwd-note">Sync compares ${t?"it":"each one"} with the cloud. Where it's clear which copy is newer, the other is updated; otherwise you choose which to keep.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="dismiss" @click="${this._onDismiss}">Not now</button> <button type="button" class="primary" data-role="sync" @click="${this._onSync}">Sync</button></footer></dialog>`}};customElements.define("sync-suggest-dialog",i1)});function h4({open:e,later:t=(n,o)=>setTimeout(n,o),modalOpen:r=()=>kd()}){let n=new Set,o=!1;function i(s,a,{onSync:c,retry:u}={}){!s||!Array.isArray(a)||a.length===0||o||n.has(s)||(o=!0,t(async()=>{let p;if(r())p={shown:!1,sync:!1};else try{p=await e([...a])}catch{p={shown:!1,sync:!1}}if(o=!1,!p.shown){typeof u=="function"&&t(u,m9);return}n.add(s),p.sync&&typeof c=="function"&&c()},0))}return{suggestSync:i,isClosedFor:s=>n.has(s)}}var m9,m4=w(()=>{"use strict";dw();m9=1500});function g4(e,t,r=0){let{viewMode:n,focusGid:o,tableSelectedGid:i,kanbanPopoverGid:s}=t,a=n==="focus"?o:n==="table"?i:n==="kanban"?s:null,c=a?e.find(u=>de(u)===a):null;return c||(n==="focus"?e[Math.min(r,e.length-1)]??null:null)}function b4(e,t){if(t.currentView!=="findings")return null;let r=bt({view:"findings",teamId:t.currentManagedTeam,reportId:t.currentManagedReport},t.managedTeams);if(!r||!e)return r;let n={...r,finding:{id:W(rt(e))}};return ar(n)?n:r}var y4=w(()=>{"use strict";Jn();ct()});function c1(){let e=F0(l.reports);if(!e)return null;let t=Object.keys(e),n=br().filter(p=>Ve(p).commonTriage===l.shownTriage),o=L0(n,l.severityMode),i=Qh(e,o),s=new Map,a=new Map,c=new Map;for(let p of n)for(let f of p){let h=ce(f,l.severityMode);s.has(f.file)||s.set(f.file,new Set),s.get(f.file).add(h);let g=xe(f)?.color??"none";a.has(f.file)||a.set(f.file,new Set),a.get(f.file).add(g),c.has(f.file)||c.set(f.file,[]),c.get(f.file).push({severity:h,color:g})}let u;return L.focusedPkg?(u=t.filter(p=>(L3(p)??"__own__")===L.focusedPkg),L.showAll||(u=u.filter(p=>B0(p,o,i)))):u=L.showAll?t:t.filter(p=>B0(p,o,i)),{treeData:e,files:u,ownCounts:o,transitiveCounts:i,severitySets:s,colorSets:a,fileFindings:c}}function d1(){let e=kl();if(!e)return;let t=c1();t&&e.refreshSidebar(t,{isBundleContext:l.currentView==="bundles"})}function u1(){let e=kl();if(!e)return;let t=c1();t&&e.refreshTopPkgs(t)}function g9(e){return`${yt[e]??e} findings`}function b9(e,t,r){return r?d`<repo-chip url="${r}"></repo-chip>`:_()?m:l.currentWorkspace?t?d`<repo-chip url="${t}"></repo-chip>`:m:e?d`<repo-chip url="${l.repoUrl}" editable ?editing="${l.repoEditing}" ?empty="${!l.repoUrl}"></repo-chip>`:t?d`<repo-chip url="${t}"></repo-chip>`:m}function y9(e,t,r,n,o){let i=e.length,s=new Set(l.reports.map(he=>he.source)),a=s.size===1?[...s][0]:null,c=l.currentWorkspace?J().find(he=>he.id===l.currentWorkspace):null,u=l.currentWorkspace&&l.currentManagedTeam?l.managedTeams.find(he=>he.id===l.currentManagedTeam):null,p=u?`Team: ${u.name}`:c?`Workspace: ${c.name}`:a?g9(a):"Findings",f=a&&ke[a]?a:"default",h=V(ke[f]),g=d`<svg class="file-icon" viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"/><path d="M14 3v6h6"/></svg>`,b=m;t.length===1?b=d`<span class="file-chip" data-copy-report="${t[0]}" title="Copy report name">${h}<span>${t[0]}</span></span>`:t.length>1&&(b=d`<span class="file-chip" data-copy-report="${t.join(`
137
+ `)}" title="Copy report names">${g}<span>${t.length} reports</span></span>`);let y=l.reports.flatMap(he=>he.groups.flat()),v=`${i} ${`finding${i===1?"":"s"}`}`,$=a||l.currentWorkspace?Th.filter(he=>he!=="type"):Th,C=S6(y,$),I=l.currentWorkspace?z5(l.reports).map(he=>Rs[he]??he):[],E=[...C,...I],R=m;if(i>0){let he={};for(let Ke of e){let nr=ce(uo(Ke),l.severityMode);nr&&(he[nr]=(he[nr]||0)+1)}let ln=Le.filter(Ke=>he[Ke]>0);ln.length>0&&(R=d`<span class="status-bar" aria-hidden="true">${ln.map(Ke=>{let nr=`${he[Ke]} ${Ke.replaceAll("_"," ")}`;return d`<span class="${`status-seg sev-${Ke}`}" style="${Se({flexGrow:he[Ke]})}" title="${nr}"></span>`})}</span>`)}let z=new Set(l.reports.map(he=>he.repo??null)),U=z.size===1?[...z][0]:null,B=b9(r,n,U),ne=d`<span class="sep" aria-hidden="true"></span>`,be=l.currentView==="files",Wt=(o??0)>1?d`<button type="button" class="${N({"files-toggle-btn":!0,active:be})}" data-action="toggle-files" aria-pressed="${String(be)}">${`Files: ${o}`}</button>`:m;return d`<header class="page-head"><div class="page-title"><h1>${p}${b}${B}${Wt}${S4()}</h1><div class="meta-row"><span>${v}</span> ${R} ${E.length>0?d`${ne}${E.map(he=>d`<span class="tag">${he}</span>`)}`:m}</div></div></header>`}function S4(){if(Q.status!=="online")return m;if(!w9.has(l.currentView))return m;let e=t4();if(!e)return m;let{workspaceId:t,fileNames:r,mode:n}=e,o=OC(t);if(o.length>0&&v9(t,o,{onSync:()=>s1(t,n,r),retry:S}),n==="single"){let x=r[0];if(o.includes(x))return v4({status:"differ",label:"differs",title:`Your copy of "${x}" doesn't match its cloud copy. Click to re-check and bring them in line.`,onClick:()=>s1(t,n,r)});let $=Kv(t,x)?"cloud":"local";return v4({status:$,label:$,title:$==="cloud"?"Synced to remote":"Local only \u2014 click to upload",onClick:$==="local"?()=>w4({workspaceId:t,items:[{kind:"report",identifier:x}]}):null})}let i=J().find(x=>x.id===t),s=i&&Array.isArray(i.bundles)?i.bundles:[],a=qv(t),c=r.filter(x=>!Kv(t,x)),u=s.filter(x=>!FC(t,x)),p=[...c.map(x=>({kind:"report",identifier:x})),...u.map(x=>({kind:"bundle",identifier:x}))];if(a===0&&p.length===0)return m;let f=[a>0?`${a} in cloud`:null,p.length>0?`${p.length} local-only`:null,o.length>0?`${o.length} differ from the cloud`:null,a>0?'click "cloud" to re-check storage':null,p.length>0?`click "local" to upload ${p.length}`:null].filter(Boolean).join(" \u2014 "),h=o.length===1?`Your copy of "${o[0]}" doesn't match its cloud copy. Click to re-check and bring them in line.`:`${o.length} reports don't match their cloud copies. Click to re-check and bring them in line.`,g=o.length===0?m:d`<button type="button" class="sync-badge-chunk differ" data-tooltip="${h}" aria-label="${`${o.length} report${o.length===1?"":"s"} differ from the cloud \u2014 re-check`}" @click="${x=>{x.stopPropagation(),s1(t,n,r)}}">${E4()}<span>${o.length} differ</span></button>`,b=a===0?m:d`<button type="button" class="sync-badge-chunk cloud" aria-label="${`re-check ${a} cloud object${a===1?"":"s"}`}" @click="${x=>{x.stopPropagation(),o1({workspaceId:t,cloudCount:a,localFileNames:r,localBundles:s})}}">${R4()}<span>${a} cloud</span></button>`,y=p.length===0?m:d`<button type="button" class="sync-badge-chunk local" aria-label="${`${p.length} items not yet uploaded \u2014 open upload dialog`}" @click="${x=>{x.stopPropagation(),w4({workspaceId:t,items:p})}}">${C4()}<span>${p.length} local</span></button>`,k=d`<span class="sync-badge-divider" aria-hidden="true"></span>`,v=[b,g,y].filter(x=>x!==m);return d`<div class="report-sync-badge report-sync-badge-clickable" data-status="mixed" data-tooltip="${f}">${v.map((x,$)=>$===0?x:d`${k}${x}`)}</div>`}function s1(e,t,r){let n=J().find(s=>s.id===e),o=t==="single"?e1(n?.reports??[],l.storedFiles??[],r):r,i=n&&Array.isArray(n.bundles)?n.bundles:[];return o1({workspaceId:e,cloudCount:qv(e),localFileNames:o,localBundles:i,autoRun:!0})}function v4({status:e,label:t,title:r,onClick:n}){let o=e==="cloud"?R4():e==="differ"?E4():C4(),i=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}${i}</span>`:d`<button type="button" class="report-sync-badge report-sync-badge-clickable" data-status="${e}" data-tooltip="${r}" aria-label="${`report sync status: ${t}`}" @click="${n}">${o}${i}</button>`}function C4(){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 E4(){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="M7 4v14"/><path d="M3 14l4 4 4-4"/><path d="M17 20V6"/><path d="M13 10l4-4 4 4"/></svg>`}function R4(){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 w4({workspaceId:e,items:t}){let r=t.filter(n=>n.kind==="bundle");if(r.length>0){let n=await Ot(),o=new Map(n.map(i=>[i.integrity,i.name]));for(let i of r){let s=o.get(i.identifier);s&&(i.label=s)}}await n4({workspaceId:e,items:t})}function k9(e){return Object.values(e).some(r=>r>0)||l.filterSeverities.size>0?d`<severity-chips .counts="${e}"></severity-chips>`:m}function x9(e){return Object.values(e).some(r=>r>0)||l.filterColors.size>0?d`<triage-filter .counts="${e}"></triage-filter>`:m}function $9(e,t,r,n,o,i,s,a){let{showSource:c,showConfidence:u,showPriority:p,showGraphMode:f,showFileSort:h,kanbanMode:g,showRepo:b,hasComment:y,hasFix:k,hasFlagged:v,hasDuplicates:x,hasCrossContext:$,hasAppStacked:C,showSecurity:I,showSeverityMode:E,revalidateOptions:R,showPartial:z,canDropLayer:U,canDetailLayer:B,canUpstreamLens:ne,confirmedLocked:be}=i;return d`<div class="toolbar"><div class="toolbar-row"><view-mode-buttons modes="${f?"kanban,focus,table,list,grouped,graph":"kanban,focus,table,list,grouped"}"></view-mode-buttons><findings-sort ?show-file="${h}" ?show-confidence="${u}" ?show-priority="${p}"></findings-sort>${c?d`<source-filter></source-filter>`:m} ${!be&&(u||R.length>0)?d`<conf-filter ?range-disabled="${!u}" .revalidateOptions="${R}" ?has-partial="${z}"></conf-filter>`:m} ${y||k||v||l.filterComment||l.filterFix||l.filterFlagged?d`<annotation-filter .hasComment="${y}" .hasFix="${k}" .hasFlagged="${v}"></annotation-filter>`:m} ${g?m:d`<triage-selector .counts="${r}"></triage-selector>`}<div class="toolbar-end"><download-button></download-button>${!l.currentWorkspace&&(x||l.filterDuplicates)||$||C||I||l.filterCrossContext||l.filterAppStacked?d`<annotation-filter group="context" .hasDuplicates="${x}" .hasCrossContext="${$}" .hasAppStacked="${C}" .hasSecurityContrast="${I}"></annotation-filter>`:m} ${U||l.revalidateConflicts.size>0?d`<revalidation-switch ?can-drop="${U}" ?can-detail="${B}" ?can-upstream="${ne&&U}" .upstreamDisabled="${l.showRevalidation===!1&&U}"></revalidation-switch>`:m}</div></div><div class="toolbar-row sev-row">${E?d`<severity-mode-switch></severity-mode-switch>`:m} ${k9(n)} ${s.analyzers.length>1||s.models.length>1?d`<analyzer-select .analyzers="${s.analyzers}" .models="${s.models}" .groups="${s.groups}"></analyzer-select>`:m} ${b&&a.length>1?d`<repo-filter .options="${a}"></repo-filter>`:m} ${x9(o)}<div class="search-row"><toolbar-search kind="findings"></toolbar-search><span class="result-count">${e} of ${t}</span></div></div></div>`}function a1(e,t){return e.map(r=>({p:uo(r),g:r})).toSorted((r,n)=>t(r.p,n.p)).map(r=>r.g)}function wu(e,t=!1,r=null,n=!1,o=!1){return d`<finding-card data-gid="${de(e)}" .group="${e}" ?in-group="${t}" context="${r??m}" ?lazy="${n}" ?popup="${o}"></finding-card>`}function l1(e,t={}){let{variant:r="kanban",active:n=!1,expandedTrackLast:o=!1}=t,i=Ve(e),s=rt(e),a=lt(s)||"(untitled finding)",c=r==="kanban",u=r==="kanban-side",p=c&&l.currentWorkspace?wd(s):null,f={"kanban-card":!0,"has-conflict":i.hasConflict,"focus-side-card":!c,"kanban-expanded-track-last":o,active:n};!i.hasConflict&&i.commonColor&&(f[`mark-${i.commonColor}`]=!0);let h=parseInt(s.line,10),g=Number.isFinite(h)?`:${h}`:"",b=ce(s,l.severityMode),y=_9[b]??"?",k=cr(s)&&l.severityMode!=="original",v=xe(s),x=v?.flagged===!0,$=v?.fix??"",C=v?.comment??"",I=m;c&&$?I=Fe($)?d`<managed-fix-link class="kanban-action kanban-fix-link" compact="compact" .url="${$}">${tu}</managed-fix-link>`:d`<button type="button" class="kanban-action mark-fix" data-tooltip="${`Edit fix link: ${$}`}" aria-label="${`Edit fix link: ${$}`}">${tu}</button>`:c&&(C||_()&&Oe(s))&&(I=d`<comment-preview class="kanban-action" .finding="${s}" .comment="${C}">${Jh}</comment-preview>`);let E=d`<div class="kanban-badge-col"><span class="${`kanban-badge sev-${b}`}" title="${k?`${Ht(b)} \u2014 corrected from ${Ht(s.severity)}`:Ht(b)}" aria-label="${k?`Severity ${Ht(b)}, corrected from ${Ht(s.severity)}`:`Severity ${Ht(b)}`}">${y}${k?"*":""}</span> ${x?d`<span class="kanban-flag" title="Flagged" aria-label="Flagged">${Zh}</span>`:m} ${I}</div><span class="kanban-title">${a}</span><div class="kanban-meta"><span class="kanban-loc">${s.file}${g}</span> ${s.confidence===void 0||s.confidence===null?m:d`<span class="kanban-conf" title="${`Confidence ${s.confidence}/10`}">${s.confidence}</span>`} ${p?d`<span class="kanban-analyzer" role="img" title="${Rs[p]}" aria-label="${Rs[p]}">${V(Qe[p])}</span>`:m}</div>`;return c?d`<div class="${N(f)}" data-gid="${de(e)}" data-kanban-source draggable="${hi(e,i).length>0?"true":"false"}" role="button" tabindex="0" aria-current="${n?"true":"false"}" aria-label="${`Open details for ${a}`}">${E}</div>`:u?d`<div class="${N(f)}" data-gid="${de(e)}" data-kanban-select role="button" tabindex="0" aria-current="${n?"true":"false"}" aria-label="${`Show details for ${a}`}">${E}</div>`:d`<div class="${N(f)}" data-gid="${de(e)}" data-focus-select role="button" tabindex="0" aria-current="${n?"true":"false"}" aria-label="${`Focus on ${a}`}">${E}</div>`}function S9(e){let{content:t,range:r,highlighted:n}=e,o=t.split(`
138
+ `).length,i=String(o).length;return d`<div class="focus-code-lines" style="${Se({"--lineno-width":`${i}ch`})}"><aside class="focus-code-gutter" aria-hidden="true">${Array.from({length:o},(s,a)=>{let c=a+1,p={"focus-code-lineno":!0,"focus-code-line-active":!!r&&c>=r.start&&c<=r.end};return d`<div class="${N(p)}" data-focus-code-line="${c}">${c}</div>`})}</aside><pre class="focus-code-source"><code>${typeof n=="string"?V(n):t}</code></pre></div>`}function I4(e,t=m,r=!1){l.focusCodeTick;let n=a3(e),o=Xd(e),i=n?"focus-main with-code":"focus-main",s=Se({"--focus-split":String(l.focusSplit)});return d`<div class="${i}" style="${s}"><div class="focus-pane focus-pane-card"><div class="focus-card-wrapper">${wu(e,!1,"focus",!1,r)}</div></div>${t} ${n?d`<div class="focus-splitter" data-focus-splitter role="separator" tabindex="0" aria-orientation="vertical" aria-label="Resize the finding and code panes" aria-valuemin="${xp}" aria-valuemax="${$p}" aria-valuenow="${Math.round(l.focusSplit)}" data-tooltip="Drag to resize · double-click to reset"></div><div class="focus-pane focus-pane-code">${n.loading?d`<div class="focus-code-empty">Loading source…</div>`:d`<header class="focus-code-bar" title="${n.file}"><span class="focus-code-file">${n.file}</span> ${n.range?d`<span class="focus-code-line">:${fh(n.range)}</span>`:m} ${(o?.stack.length??0)>1?d`<div class="focus-code-nav"><button type="button" class="focus-code-nav-btn" data-code-history="back" ?disabled="${o.at===0}" aria-label="Back to the previously shown file">${p1}</button> <button type="button" class="focus-code-nav-btn" data-code-history="forward" ?disabled="${o.at===o.stack.length-1}" aria-label="Forward to the next shown file">${f1}</button></div>`:m}</header><div class="focus-code-body">${S9(n)}</div>`}</div>`:m}</div>`}function L4(e,t,r=[],n=null){if(!e&&!n)return m;let o=e?Ve(e):{},i=l.kanbanDetailFullscreen,s={"kanban-detail-modal":!0,fullscreen:i,"has-conflict":o.hasConflict},a=e?de(e):null,c=t?.items??[],u=c.findIndex(f=>de(f)===a),p=d`<div class="kanban-detail-actions"><button type="button" class="kanban-detail-expand detail-action" data-kanban-detail-fullscreen aria-pressed="${i?"true":"false"}" aria-label="${i?"Back to the readable width":"Fill the available space"}">${i?T4:A4}</button> <button type="button" class="kanban-detail-close detail-action" aria-label="Close details">×</button></div>`;return d`<div class="${N({"kanban-detail-backdrop":!0,"links-preview-backdrop":!!n})}"><div class="kanban-detail-dim"></div><div class="${N(s)}" role="dialog" aria-modal="true" aria-label="${n?"Finding preview":"Finding details"}">${i&&e?m:p}<div class="kanban-detail-body">${e?i?I4(e,p,!0):wu(e,!1,"kanban-detail",!1,!0):d`<div class="links-preview-message" role="status">${n.error||"Loading finding\u2026"}</div>`}</div></div>${c.length===0?m:d`<aside class="kanban-detail-side" aria-label="${`${t.label} findings`}"><div class="kanban-detail-side-header"><span class="kanban-detail-side-pick"><select class="kanban-detail-side-select" data-kanban-column aria-label="Column to show">${r.map(f=>{let h=f.key===t.key,g=h?f.label:`${f.label} (${f.count})`;return d`<option value="${f.key}" data-gid="${f.firstGid}" .selected="${h}" ?disabled="${f.count===0}">${g}</option>`})}</select></span><div class="focus-nav"><button type="button" class="focus-nav-btn" data-kanban-nav="prev" ?disabled="${u===0}" aria-label="Previous finding">${p1}</button> <span class="count">${u<0?c.length:`${u+1} / ${c.length}`}</span> <button type="button" class="focus-nav-btn" data-kanban-nav="next" ?disabled="${u===c.length-1}" aria-label="Next finding">${f1}</button></div></div><div class="kanban-detail-side-body">${re(c,f=>de(f),f=>l1(f,{variant:"kanban-side",active:de(f)===a}))}</div></aside>`}</div>`}function C9(e,t){if(l.viewMode==="table"){let n=l.sortBy==="file"?a1(e,k4):e;return n.length===0?m:(Am=n,d`<div class="${t?"findings-table-layout open":"findings-table-layout"}"><div class="findings-table-list"><div class="finding-table-slot"></div></div>${t?d`<aside class="findings-table-details" id="findings-table-details" aria-label="Finding details"><button type="button" class="findings-table-details-close" data-table-deselect aria-label="Close details">×</button><div class="findings-table-details-body">${wu(t)}</div></aside>`:m}</div>`)}if(l.viewMode==="focus"){if(e.length===0)return m;let n=e.indexOf(t);M4=n;let o=t,i=n===0,s=n===e.length-1;return d`<div class="focus-view">${I4(o)}<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}" aria-label="Previous finding">${p1}</button> <span class="count">${n+1} / ${e.length}</span> <button type="button" class="focus-nav-btn" data-focus-nav="next" ?disabled="${s}" aria-label="Next finding">${f1}</button></div></div><div class="focus-sidebar-body">${re(e,a=>de(a),a=>l1(a,{variant:"focus",active:de(a)===de(o)}))}</div></aside></div>`}if(l.viewMode==="kanban"){let n=[{key:"untriaged",label:"Untriaged"},{key:"inprogress",label:"In progress"},{key:"fixed",label:"Fixed"},{key:"invalid",label:"Invalid"},{key:"deleted",label:"Deleted"},{key:"ignored",label:"Ignored"}],o=new Map(n.map(p=>[p.key,[]]));for(let p of e){let h=Ve(p).commonTriage??"untriaged",g=o.get(h);g&&g.push(p)}let i=n.some(p=>p.key===l.kanbanExpandedColumn)?l.kanbanExpandedColumn:null,s=i?n.filter(p=>p.key===i):n,a={"--kanban-cols":String(n.length)},c=t,u=c?n.find(p=>p.key===(Ve(c).commonTriage??"untriaged")):null;return d`<div class="kanban-board" style="${Se(a)}">${re(s,p=>p.key,p=>{let f=o.get(p.key),h=p.key===i;return d`<div class="${`kanban-column kanban-column-${p.key}${h?" expanded":""}`}" data-kanban-target="${p.key}"><div class="kanban-column-header"><span class="label">${p.label}</span> <span class="count">${f.length}</span> <button type="button" class="kanban-expand" data-kanban-expand="${p.key}" aria-pressed="${h}" aria-label="${h?"Show all columns":`Show only ${p.label}`}">${h?T4:A4}</button></div><div class="kanban-column-body">${f.length===0?d`<div class="kanban-empty">No ${p.label.toLowerCase()} findings.</div>`:re(f,g=>de(g),(g,b)=>l1(g,{active:de(g)===l.kanbanPopoverGid,expandedTrackLast:(b+1)%n.length===0}))}</div></div>`})}</div>${L4(c,u&&{key:u.key,label:u.label,items:o.get(u.key)},n.map(p=>{let f=o.get(p.key);return{key:p.key,label:p.label,count:f.length,firstGid:f.length>0?de(f[0]):""}}))}`}if(l.viewMode==="grouped"){let n=new Map;for(let i of e){let s=uo(i).file;n.has(s)||n.set(s,[]),n.get(s).push(i)}let o=l.sortBy==="file"?[...n.keys()].toSorted():[...n.keys()];return d`${re(o,i=>i,i=>{let s=l.sortBy==="file"?a1(n.get(i),(c,u)=>parseInt(c.line,10)-parseInt(u.line,10)):n.get(i),a=uo(s[0]);return d`<div class="file-group"><div class="file-header"><span>${xw(a,Tr(a))}</span> <span class="count">${s.length}</span></div><div class="file-body">${re(s,c=>de(c),c=>wu(c,!1,null,!0))}</div></div>`})}`}let r=l.sortBy==="file"?a1(e,k4):e;return d`${re(r,n=>de(n),n=>{let o=rt(n),i=LE(o,Tr(o)),s=Ts(o),a=Qn(o),c=n.length>1;return d`<div class="${N({"flat-group":!0,"multi-case":c})}"><div class="flat-group-loc"><span class="file">${xw(o,Tr(o))}</span> ${i===m?m:d`<span class="line-num">${i}</span>`} ${a?d`<span class="meta">${a}</span>`:m} ${s?d`<span class="run-meta">${s}</span>`:m}</div>${wu(n,!0,null,!0)}</div>`})}`}function E9(){l.bundleSourceFile&&Ps().catch(()=>{});let e=document.querySelector("#bundle-source-overlay-slot");e&&se(DM(),e)}function S({animate:e=!0}={}){let t=x4;x4=l.currentView;let r=t!==null&&t!==l.currentView;if(e&&r&&typeof document.startViewTransition=="function"&&!matchMedia("(prefers-reduced-motion: reduce)").matches){document.startViewTransition(()=>_4()).ready.catch(()=>{});return}_4()}function Rl(e){let t=document.querySelector(`#${e}`);return(!t||!P.contains(t)||P.firstElementChild!==t)&&(P.innerHTML=`<div id="${e}"></div>`,t=document.querySelector(`#${e}`)),t}function au(){let e=l.revalidateConflicts.size>0,t=!e&&sh(l.reports);return e?l.showRevalidation!==!1&&(Mm=l.showRevalidation,l.showRevalidation=!1):(Mm!==null&&(l.showRevalidation=Mm,Mm=null),!t&&l.showRevalidation===!1&&(l.showRevalidation=!0)),l.upstreamOnly&&(!t||l.showRevalidation===!1||!l.reports.some(r=>(r.groups??[]).some(n=>n.some(o=>o.isUpstream))))&&(l.upstreamOnly=!1),ai(l.showRevalidation,l.upstreamOnly),t}function _4(){mr()||Sh(),E9(),uh(l.reports),ph(l.reports)&&mi();let e=au(),t=l.reports.some(O=>(O.groups??[]).some(j=>j.some(oe=>oe.isUpstream)));if(l.currentView==="bundles")if((l.bundles??[]).length===0)l.currentView="findings";else{bi(l.bundleDetailsTab,l.bundleSourceFile)&&Ps().catch(()=>{});let O=Rl("bundles-slot");O&&se(HM(l.bundles),O);let j=l.bundleDetails,oe=l.selectedBundle&&j&&(j.json||j.bundle);if(oe&&l.bundleDetailsTab==="graph"){let _e=document.querySelector("#bundle-graph-slot");if(_e){let Kt=OM(l.bundleDetails);if(Kt){PM(Kt);let u8={hideAllFiles:!0,triageCounts:BM(l.bundleDetails,new Set(Kt.strippedToOrig.values())),triageStates:["inprogress","fixed","invalid","deleted"],showSplitOwnDirs:Kt.canSplitOwnDirs,showPackagesView:Kt.canPackagesView,showBundleLayouts:!0};O0(_e,Kt,u8,Cm,Em)}}}if(oe&&!j.metadataOnly&&l.bundleDetailsTab==="terminal"){let _e=document.querySelector("#bundle-terminal-slot");_e&&I3(_e,l.bundleDetails)}P.classList.add("active"),Ge.classList.add("hidden"),document.title="DeepView \u2014 bundles";return}if(l.currentView==="packages"){let O=Rl("packages-slot");O&&se(jM(),O),P.classList.add("active"),Ge.classList.add("hidden"),document.title="DeepView \u2014 packages";return}if(l.currentView==="repositories"){let O=Rl("repositories-slot");O&&se(GM(),O),P.classList.add("active"),Ge.classList.add("hidden"),document.title="DeepView \u2014 repositories";return}if(l.currentView==="links"){if(l.currentLinks){let O=Rl("links-slot"),j=mr();O&&se(d`${QM(S4())}${j?L4(j.group,null,[],j):m}`,O),P.classList.add("active"),Ge.classList.add("hidden"),document.title=`DeepView \u2014 ${l.currentLinks.name}`;return}l.currentView="findings"}if(l.currentView==="scan"&&customElements.get("local-scan-page")){let O=Rl("scan-slot");if(O&&!O.firstElementChild){let j=document.createElement("local-scan-page");j.selection=l.scanSelection,O.append(j),j.updateComplete.then(()=>Dt(j.renderRoot,{gate:oe=>!Object.hasOwn(oe.dataset,"tooltipTruncated")||oe.scrollWidth>oe.clientWidth}))}P.classList.add("active"),Ge.classList.add("hidden"),document.title="DeepView \u2014 scans";return}let r=R9[l.currentView];if(r){let O=Rl(r.slot),j=O?.firstElementChild?.session;if((j?.id!==l.managedSession?.id||j?.role!==l.managedSession?.role)&&O?.replaceChildren(),O&&!O.firstElementChild){let oe=document.createElement(r.tag);oe.localImportSource=uv(),l.currentView==="manage-import"&&(oe.localDeps=dv(),oe.promptPassword=ih,oe.resolveConflicts=nl),oe.session=l.managedSession,oe.allowShare=l.managed?.allowShare===!0,l.currentView==="manage-scans"&&(oe.selection=l.scanSelection),O.append(oe),(async()=>{await customElements.whenDefined(r.tag),await oe.updateComplete,Dt(oe.renderRoot,{gate:_e=>!Object.hasOwn(_e.dataset,"tooltipTruncated")||_e.scrollWidth>_e.clientWidth})})().catch(()=>{})}O?.firstElementChild&&(O.firstElementChild.session=l.managedSession,O.firstElementChild.allowShare=l.managed?.allowShare===!0),l.currentView==="manage-scans"&&O?.firstElementChild&&(O.firstElementChild.selection=l.scanSelection),P.classList.add("active"),Ge.classList.add("hidden"),document.title=r.title;return}if(l.reports.length===0)return;let n=br(),o=l.viewMode==="kanban",i={inprogress:0,fixed:0,invalid:0,deleted:0,ignored:0},s=[];for(let O of n){let j=Ve(O).commonTriage;j&&i[j]++,(o||j===l.shownTriage)&&s.push(O)}Object.defineProperty(s,"ruledOutIds",{value:n.ruledOutIds});let a=!1,c=!1,u=!1,p=!1;for(let O of n)for(let j of O){cr(j)&&(p=!0);let oe=xe(j);oe&&(oe.comment&&(a=!0),oe.fix&&(c=!0),oe.flagged===!0&&(u=!0))}let f=wh(),h=n.some(O=>O.some(j=>f.has(j.id)));h||(l.filterDuplicates="");let g=s.some(Fw),b=s.some(Bw);g||(l.filterCrossContext=""),b||(l.filterAppStacked="");let y=r6(s);y||(l.filterSecurity="");let k=new Set,v=!1,x=!1,$=!1;for(let O of s)for(let j of O){let oe=fr(j);oe&&k.add(oe)}for(let O of Yw()){let j=!1,oe=!1;for(let _e of O){let Kt=Te(_e);Kt==="partial"&&(x=!0),!((Kt==="unreachable"||Kt==="refuted")&&($=!0,l.currentWorkspace))&&(Kt==="revalidation"?j=!0:oe=!0)}j&&oe&&(v=!0)}let I=[...new Set(l.reports.map(O=>O.type))].join(", "),E=l.reports.map(O=>O.fileName),R=s.map(Ar).filter(O=>O.length>0),z=R.length>0&&Aw(R),U=Lw(n),B=n.some(O=>O.some(j=>Qt(j.file))),ne=n.some(O=>O.some(j=>!Qt(j.file))),be=!1,Wt=!1,he;e:for(let O of n)for(let j of O)if(!Wt)Wt=!0,he=j.file;else if(j.file!==he){be=!0;break e}let ln=n.some(O=>O.some(j=>!j.repo?.github&&!Qt(j.file))),Ke=new Set;for(let O of n)for(let j of O)!Qt(j.file)&&j.repo?.github&&Ke.add(j.repo.github);let nr=Ke.size===1?[...Ke][0]:null,Pi=new Set,Mo=new Set;for(let O of n)for(let j of O)Pi.add(j._analyzer??null),Mo.add(Id(j));let vg=Object.keys(Jw),jl=O=>{if(O==null)return 1/0;let j=vg.indexOf(O);return j===-1?vg.length:j},Pu=[...Pi].toSorted((O,j)=>{let oe=jl(O),_e=jl(j);return oe!==_e?oe-_e:String(O??"").localeCompare(String(j??""))}),Vl=[...Mo].toSorted($4);if(l.filterAnalyzer){let O=l.filterAnalyzer===ui?null:l.filterAnalyzer;(!Pi.has(O)||Pi.size<2)&&(l.filterAnalyzer="")}if(l.filterModel){let O=l.filterModel===pi?null:l.filterModel;(!Mo.has(O)||Mo.size<2)&&(l.filterModel="")}let ta=bE(k);l.filterRevalidate&&!ta.some(O=>O.value===l.filterRevalidate)&&(l.filterRevalidate="");let Wl=xh(s);Wl&&(l.filterRevalidate="confirmed");let wg=k.has("partial")&&po();wg||(l.filterPartial="");let Nu=e&&(v||x||!l.currentWorkspace&&$),Kl=!(e&&l.showRevalidation!==!1)&&!l.upstreamOnly&&B&&ne;!Kl&&l.filterSources.size>0&&l.filterSources.clear(),z||(l.filterConfMin=0,l.filterConfMax=10,(l.sortBy==="confidence-desc"||l.sortBy==="confidence-asc")&&(l.sortBy="severity")),!U&&(l.sortBy==="priority-desc"||l.sortBy==="priority-asc")&&(l.sortBy="severity"),!be&&l.sortBy==="file"&&(l.sortBy="severity");let M=n6(s),H={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0},Y={red:0,blue:0,green:0,gray:0,none:0};for(let O of M){if(O.length===1){let _e=ce(O[0],l.severityMode);H[_e]=(H[_e]||0)+1;let Kt=xe(O[0])?.color??"none";Y[Kt]=(Y[Kt]||0)+1;continue}let j=new Set(O.map(_e=>ce(_e,l.severityMode)));for(let _e of j)H[_e]=(H[_e]||0)+1;let oe=new Set(O.map(_e=>xe(_e)?.color??"none"));for(let _e of oe)Y[_e]=(Y[_e]||0)+1}let q=WE(M),Pe=[...q].toSorted($4);if(l.filterRepo){let O=l.filterRepo===Ls?null:l.filterRepo;q.has(O)||(l.filterRepo="")}let ot=$h(fi(s)),Et=F0(l.reports),Gl=Et?Object.keys(Et).length:0,ra=Gl>1;!ra&&l.currentView==="files"&&(l.currentView="findings"),!ra&&l.viewMode==="graph"&&(l.viewMode="kanban");let Ao=y9(n,E,ln,nr,Gl);if(l.currentView==="files"){let O=L0(n,l.severityMode),j=document.querySelector("#header-slot"),oe=document.querySelector("#tree-view-slot");(!j||!oe||!P.contains(j)||!P.contains(oe))&&(P.innerHTML='<div id="header-slot"></div><div id="tree-view-slot"></div>',j=document.querySelector("#header-slot"),oe=document.querySelector("#tree-view-slot")),j&&se(Ao,j),oe&&se(E3(Et,O),oe),P.classList.add("active"),Ge.classList.add("hidden"),document.title=`DeepView \u2014 ${I||"no analyzer"}`;return}let a8=l.viewMode==="table"&&l.tableSelectedGid&&ot.some(O=>de(O)===l.tableSelectedGid),ql=null;l.viewMode==="graph"&&Et&&(ql=c1(),ql||(l.viewMode="kanban"));let zu=!!ql,Ni="findings-content";a8&&(Ni+=" with-details"),zu&&(Ni+=" with-graph"),o&&(Ni+=" with-kanban"),l.viewMode==="focus"&&(Ni+=" with-focus");let I$=m,Uu=m,L$=m,F$=g4(ot,l,M4);Am=null,zu||(I$=$9(ot.length,s.length,i,H,Y,{showSource:Kl,showConfidence:z,showPriority:U,showGraphMode:ra,showFileSort:be,kanbanMode:o,showRepo:!!l.currentWorkspace,hasComment:a,revalidateOptions:ta,showPartial:wg,canDropLayer:e,canDetailLayer:Nu,canUpstreamLens:t,confirmedLocked:Wl,hasFix:c,hasFlagged:u,hasDuplicates:h,hasCrossContext:g,hasAppStacked:b,showSecurity:y,showSeverityMode:p||l.severityMode==="original"},{analyzers:Pu,models:Vl,groups:M},Pe),l.shownTriage&&s.length===0?Uu=d`<p style="color:var(--muted); margin: 1rem 0;">No ${l.shownTriage} findings.</p>`:ot.length===0&&s.length>0&&!o?Uu=d`<p style="color:var(--muted); margin: 1rem 0;">No findings match the current filters.</p>`:s.length===0&&(Uu=n.length>0?d`<p style="color:var(--green)">All ${I} issues triaged.</p>`:d`<p style="color:var(--green)">No ${I} issues found.</p>`),L$=C9(ot,F$));let Yl=document.querySelector("#header-slot"),cn=P.querySelector(":scope > .findings-content"),l8=cn&&cn.querySelector(":scope > #findings-graph-slot"),c8=cn&&cn.querySelector(":scope > #findings-body-slot"),d8=cn&&(l8?"graph":c8?"body":null)===(zu?"graph":"body");if(!Yl||!cn||!P.contains(Yl)||!P.contains(cn)||!d8){let O=zu?'<div id="findings-graph-slot"></div>':'<div id="toolbar-slot"></div><div id="empty-state-slot"></div><div id="findings-body-slot"></div>';P.innerHTML=`<div id="header-slot"></div><div class="${Ni}">${O}</div>`,Yl=document.querySelector("#header-slot"),cn=P.querySelector(":scope > .findings-content")}else cn.className!==Ni&&(cn.className=Ni);Yl&&se(Ao,Yl);let B$=document.querySelector("#toolbar-slot");B$&&se(I$,B$);let O$=document.querySelector("#empty-state-slot");O$&&se(Uu,O$);let P$=document.querySelector("#findings-body-slot");if(P$&&se(L$,P$),ql){let O=document.querySelector("#findings-graph-slot");if(O){let oe={extraTopRow:d`<view-mode-buttons modes="kanban,focus,table,list,grouped,graph"></view-mode-buttons>`,triageCounts:i,triageStates:["inprogress","fixed","invalid","deleted","ignored"]};O0(O,ql,oe,d1,u1)}}if(Am){let O=P.querySelector(".finding-table-slot");O&&(El||(El=document.createElement("finding-table")),El.items=Am,El.selectedGid=l.tableSelectedGid,El.parentNode!==O&&O.append(El))}P.classList.add("active"),Ge.classList.add("hidden"),document.title=`DeepView \u2014 ${I||"no analyzer"}`,_()&&Ie?.replaceFindingRoute(b4(F$,l))}var v9,w9,k4,Am,M4,El,A4,T4,p1,f1,_9,x4,R9,$4,Mm,zt=w(()=>{"use strict";T();Ne();Mt();Gn();qe();en();D();fw();Ad();Qr();lo();or();pe();ct();tn();Zw();Sw();Ee();C6();wl();nu();M3();ao();P0();N0();go();pl();Ns();KM();YM();e4();Ch();r4();vu();Vh();o4();c4();f4();m4();y4();qa();({suggestSync:v9}=h4({open:e=>p4({names:e})})),w9=new Set(["findings","files","links"]);k4=(e,t)=>e.file.localeCompare(t.file)||parseInt(e.line,10)-parseInt(t.line,10),Am=null,M4=0,El=null;A4=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>`,T4=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>`,p1=d`<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>`,f1=d`<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>`,_9={critical:"C",high:"H",medium:"M",low:"L",high_bug:"H",bug:"B",informational:"i"};x4=null;R9={manage:{slot:"manage-slot",tag:"managed-admin-home",title:"DeepView \u2014 manage"},"admin-users":{slot:"admin-users-slot",tag:"managed-admin-users",title:"DeepView \u2014 users"},"manage-repos":{slot:"manage-repos-slot",tag:"managed-admin-repos",title:"DeepView \u2014 repositories"},"manage-reports":{slot:"manage-reports-slot",tag:"managed-admin-reports",title:"DeepView \u2014 reports"},"manage-bundles":{slot:"manage-bundles-slot",tag:"managed-admin-bundles",title:"DeepView \u2014 bundles"},"manage-history":{slot:"manage-history-slot",tag:"managed-admin-history",title:"DeepView \u2014 history"},"manage-teams":{slot:"manage-teams-slot",tag:"managed-admin-teams",title:"DeepView \u2014 teams"},"manage-import":{slot:"manage-import-slot",tag:"managed-admin-import",title:"DeepView \u2014 import"},"manage-links":{slot:"manage-links-slot",tag:"managed-admin-links",title:"DeepView \u2014 links"},"manage-scans":{slot:"manage-scans-slot",tag:"managed-admin-scans",title:"DeepView \u2014 scans"}},$4=(e,t)=>e==null&&t==null?0:e==null?1:t==null?-1:e.localeCompare(t),Mm=null});var rR={};kg(rR,{hydrateManagedReportTriage:()=>H9,initManagedTriagePush:()=>b1,refreshManagedReportTriage:()=>Q0,resetManagedTriage:()=>$u});function Tm(e){if(!e)return null;let t={};e.color&&(t.color=e.color);let r=Ue(e);return r&&(t.triage=r),typeof e.fix=="string"&&e.fix&&(t.fix=e.fix),typeof e.flagged=="boolean"&&(t.flagged=e.flagged),Object.keys(t).length>0?t:null}function ku(e){return e==null?"":JSON.stringify([e.color??"",e.triage??"",e.fix??"",e.flagged])}function O9(e,t){return e.length>100?!1:t==null?!0:(t.color?.length??0)<=50&&(t.fix?.length??0)<=1e4}function B4(){let e=new Set;for(let t of l.reports)for(let r of t.groups)for(let n of r)typeof n.id=="string"&&n.id&&e.add(n.id);return e}function h1(){return Array.isArray(l.managedReports)&&l.managedReports.length>0?l.managedReports:l.managedReport==null?[]:[l.managedReport]}function O4(e){let t=new Set,r=!1;for(let n of l.reports)if(n._managedReportId===e){r=!0;for(let o of n.groups??[])for(let i of o)typeof i.id=="string"&&i.id&&t.add(i.id)}return r||l.reports.length===0?t:new Set(B4())}function N9(e){let t=h1();for(let r of l.reports)if(r._managedReportId!=null&&(r.groups??[]).some(n=>n.some(o=>o.id===e))){let n=t.find(o=>o.id===r._managedReportId);if(n)return n}return t[0]??null}function m1(){let e=l.managedSession;return l.serverMode==="managed"&&l.localMode!==!0&&e!=null&&Xf(e.role,"triage")}function D9(e){return e>=400&&e<500&&e!==401&&e!==403&&e!==408&&e!==429}function z9(e,t){let r=Mi.get(e.key);r==null&&(r={report:e.report,key:e.key,teamId:e.teamId,changes:new Map},Mi.set(e.key,r));for(let n of t)r.changes.has(n)||r.changes.set(n,e.changes.get(n))}async function U9(e,t){if(!m1())return;let r=[...e.changes.keys()],n=0;for(;n<r.length;){let o=n,i={},s=0,a=B9;for(;n<r.length&&s<200;){let p=r[n],f=P9(`${JSON.stringify(p)}:${JSON.stringify(e.changes.get(p))},`);if(s>0&&a+f>262144)break;i[p]=e.changes.get(p),a+=f,s++,n++}let c=await d5(e.report.id,i,l.managedSession?.csrfToken,e.teamId),u=c>=200&&c<300;if(!u&&!D9(c)){z9(e,r.slice(o));return}u||console.warn("managed: the server refused a triage batch",e.report.id,c,Object.keys(i));for(let[p,f]of Object.entries(i)){let h=sn.get(p)?.fix??"",g=u?f?.fix??"":h;g!==h&&t.add(e.teamId),sn.set(p,{key:ku(f),fix:g})}}}function g1(){_o!=null&&(clearTimeout(_o),_o=null);let e=[...Mi.values()];if(Mi.clear(),e.length===0)return;let t=new Set;for(let r of e)Ml=Ml.then(()=>U9(r,t)).catch(n=>{console.warn("managed: triage push failed",n)});Ml=Ml.finally(()=>{for(let r of t)sw(r)}).catch(r=>{console.warn("managed: Fix cache invalidation failed",r)})}function P4(){if(!(h1().length===0||!m1()||Al.size===0)){for(let t of B4()){let r=Tm(l.triage.get(t)),n=ku(r);if((sn.get(t)?.key??"")===n)continue;if(!O9(t,r)){console.warn("managed: triage entry exceeds the server caps, kept local only",t),sn.set(t,{key:n,fix:sn.get(t)?.fix??""});continue}let o=N9(t);if(o==null||!Al.has(xu(o.id)))continue;let i=l.currentManagedTeam,s=xu(o.id,i),a=Mi.get(s);a==null&&(a={report:o,key:s,teamId:i,changes:new Map},Mi.set(s,a)),a.changes.set(t,r)}Mi.size!==0&&(_o!=null&&clearTimeout(_o),_o=setTimeout(g1,F9))}}function b1(){F4||!m1()||(F4=!0,ov(P4))}function $u(){e2(),l.managedComments?.clear(),globalThis.document?.dispatchEvent(new Event("managed-comments-reset")),_o!=null&&(clearTimeout(_o),_o=null),Mi.clear(),Al.clear(),sn.clear()}async function H9(e,{renderView:t=!0,signal:r}={}){let n=l.reports,o=l.currentManagedTeam,i=l.managedSession?.role,s=l.managedSession?.id,a=()=>!r?.aborted&&l.serverMode==="managed"&&l.localMode!==!0&&l.managedSession!=null&&l.managedSession.id===s&&l.managedSession.role===i&&l.reports===n&&l.currentManagedTeam===o&&h1().some(f=>f.id===e);if(!a()||(Al.delete(xu(e)),g1(),!await N4(r)||!a()))return!1;let c=await Qv(e,o,{signal:r});if(c==null||!a())return!1;let u=!1,p=O4(e);for(let f of p){if(!Object.hasOwn(c,f)){sn.delete(f);continue}let h=Tm(c[f]);sn.set(f,{key:ku(h),fix:h?.fix??""});let g=h?.triage==null?l.triage.get(f)?.ignoredReports:void 0;gf(l.triage,f,{...h,ignoredReports:g})&&(u=!0)}if(Al.add(xu(e)),u){if(await we(),!a())return!1;t&&S()}return P4(),!0}function N4(e){return e?e.aborted?Promise.resolve(!1):new Promise(t=>{let r=o=>{e.removeEventListener("abort",n),t(o)},n=()=>r(!1);e.addEventListener("abort",n,{once:!0}),Ml.then(()=>r(!0),()=>r(!1))}):Ml.then(()=>!0)}async function Q0(e,{signal:t}={}){let r=l.reports,n=l.currentManagedTeam,o=l.managedSession?.role,i=l.managedSession?.id,s=()=>!t?.aborted&&l.serverMode==="managed"&&!l.localMode&&l.reports===r&&l.currentManagedTeam===n&&l.managedSession?.id===i&&l.managedSession?.role===o&&Al.has(xu(e,n));if(!s()||(g1(),!await N4(t)||!s()))return!1;let a=O4(e),c=new Map([...a].map(h=>[h,sn.get(h)])),u=await Qv(e,n,{signal:t});if(u==null||!s())return!1;let p=!1,f=!1;for(let h of a){let g=c.get(h),b=Tm(l.triage.get(h));if(sn.get(h)!==g||ku(b)!==(g?.key??""))continue;let y=Tm(u[h]);(g?.fix??"")!==(y?.fix??"")&&(f=!0),sn.set(h,{key:ku(y),fix:y?.fix??""});let k=y?.triage==null?l.triage.get(h)?.ignoredReports:void 0;gf(l.triage,h,{...y,ignoredReports:k})&&(p=!0)}if(f&&sw(n),p){if(await we(),!s())return!1;S()}return!0}var F9,B9,P9,sn,Al,xu,Mi,_o,Ml,F4,om=w(()=>{"use strict";D();Ic();Jf();I5();Zt();Kf();zt();F9=500,B9=14;P9=e=>new TextEncoder().encode(e).length,sn=new Map,Al=new Set,xu=(e,t=l.currentManagedTeam)=>JSON.stringify([t,e]),Mi=new Map,_o=null,Ml=Promise.resolve();F4=!1});var z4,D4=w(()=>{z4=`*,*: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([inert]) .brand-tag,:host([inert]) .sidebar-search,:host([inert]) .sidebar-actions,:host([inert]) #file-list,:host([inert]) #sidebar-toggle,:host([inert]) #encryption-toggle,:host([inert]) #storage-status{visibility:hidden}: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}:host([data-mode="managed"]:not([data-workspace-access])) .sidebar-search,:host([data-mode="managed"]:not([data-authenticated])) .sidebar-actions{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:center;gap:.4rem;font-size:.95rem;font-weight:700;letter-spacing:-.01em;white-space:nowrap;overflow:hidden;user-select:none}.brand-button{display:inline-flex;align-items:center;gap:.5rem;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{padding:.08rem .25rem;border:0;border-radius:4px;background:transparent;font:inherit;font-size:.65rem;font-weight:500;color:var(--muted);text-transform:lowercase;letter-spacing:.02em;&[role=button]{cursor:default}&[role=button]:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&:focus-visible{outline:2px solid var(--accent);outline-offset:2px}}}@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,.brand-tag,#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}}#encryption-toggle[hidden]{display:none!important}.sidebar-search{display:flex;align-items:center;margin:0 .55rem .25rem;padding:0 .25rem 0 .55rem;background:rgb(from var(--bg) r g b / .45);border:1px solid var(--border);border-radius:7px;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-button[hidden]{display:none!important}.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:color-mix(in srgb,var(--muted),var(--text) 15%);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}}.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:block;border-radius:0 5px 5px 0}.workspace-heading{display:flex;align-items:stretch;gap:.15rem}.file-item.workspace-item button.file-name{flex:1;min-width:0}.workspace-meta{display:flex;align-items:center;justify-content:space-between;gap:.35rem;padding:0 .3rem .2rem 2rem;color:var(--muted);font-size:.68rem;line-height:1.3;white-space:nowrap;user-select:none}.workspace-findings{min-width:0;overflow:hidden;text-overflow:ellipsis}.workspace-sections{display:inline-flex;flex-shrink:0;margin-left:auto;border:1px solid var(--border);border-radius:4px;overflow:hidden}.workspace-sections button{padding:.06rem .25rem;border:0;background:transparent;color:var(--muted);font:inherit;font-size:.64rem;line-height:1.4;font-variant-numeric:tabular-nums;+button{border-left:1px solid var(--border)}&:hover:not(:disabled){background:var(--surface-active);color:var(--text)}&[aria-expanded=true]{background:rgb(from var(--accent) r g b / .1);color:var(--accent)}&:disabled{background:var(--surface-active);color:var(--muted)}}.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)}}.file-item.team-item{display:flex}.file-item.team-item button.file-name{flex:1;min-width:0}.file-item.team-item:focus-within .workspace-share{display:grid}@media(hover:none){.file-item.team-item .workspace-share{display:grid}}.workspace-leave:hover:not(:disabled){color:var(--critical, #f87171);border-color:var(--critical, #f87171)}@media(hover:hover){.file-item.team-item:hover .workspace-share,.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-icon{flex-shrink:0;color:var(--muted)}.file-item.team-bundle-item>.file-name{display:flex;align-items:center;gap:.5rem;width:100%;box-sizing:border-box;background:none;border:0;padding:.2rem .3rem .2rem 1.3rem;font-family:inherit;font-size:.78rem;text-align:left}.file-item.team-bundle-item .file-icon{flex-shrink:0;color:var(--muted)}.file-item.team-bundle-item .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{list-style:none;position:relative}.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}.file-item.current button.file-name{background:rgb(from var(--accent) r g b / .09);border-color:rgb(from var(--accent) r g b / .16);.file-icon,.file-count{color:var(--text)}}.file-item.workspace-item:hover{background:rgb(from var(--text) r g b / .04)}.file-item.workspace-item button.file-name:hover{background:transparent}.file-item.workspace-item.current{background:rgb(from var(--accent) r g b / .09);border-radius:0 5px 5px 0;box-shadow:inset 0 0 0 1px rgb(from var(--accent) r g b / .16)}.file-item.workspace-item.current button.file-name{background:transparent;border-color:transparent}button:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}@media(prefers-reduced-motion:reduce){:host,*,*:before,*:after{transition:none!important}}.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[hidden]{display:none!important}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:default;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]{display:none}#auth-status[hidden],#manage-status[hidden]{display:none!important}#auth-status{display:inline-flex;align-items:center}#auth-status[data-authed="1"]{display:inline-flex;align-items:center;gap:.4rem;max-width:12rem;padding:.2rem .35rem;border-color:transparent;border-radius:5px}#auth-status[data-authed="1"]:hover{border-color:transparent;background:rgb(from var(--text) r g b / .07)}#manage-status[hidden]{display:none}#manage-status{display:inline-grid;place-items:center;width:1.8rem;height:1.8rem;padding:.25rem;border-color:transparent;color:var(--accent)}#manage-status:hover{border-color:transparent;background:rgb(from var(--text) r g b / .07)}.auth-login{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text);font:inherit;font-size:.72rem;font-weight:400}.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.logout-row{display:inline-flex;align-items:center;gap:.4rem;font-size:.76rem}.logout-row svg{flex:0 0 auto}.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}
139
+ `});var Ai,_u=w(()=>{Ai=`:is(.file-icon,.report-logo){&.brand-deepview{--brand-bg: #2563eb;--brand-fg: #fff}&.brand-claude{--brand-bg: #d97757;--brand-fg: #fff}&.brand-codex{--brand-bg: #fff;--brand-fg: #000}&.brand-vercel{--brand-bg: #000;--brand-fg: #fff}&.brand-piolium{--brand-bg: #fbb829;--brand-fg: #1c1b19}.bg{fill:var(--brand-bg)}.fg{fill:var(--brand-fg)}}.file-icon:is(.brand-codex,.brand-vercel) .bg{stroke:var(--brand-fg);stroke-width:.5}.report-logo{display:grid;place-items:center;align-self:stretch;flex:0 0 20px;background:var(--brand-bg);border-right:1px solid var(--border)}
140
+ `});async function y1(){if(!gt)return;if(await ht(),_()){gt.hidden=!0;return}if(!pn()){gt.hidden=!0;return}let e=fe();gt.hidden=!1;let t=qt();gt.classList.toggle("encrypted",e&&t),gt.classList.toggle("locked-pending",e&&!t),e&&t?(gt.dataset.tooltip="Encryption on \u2014 click to disable",gt.setAttribute("aria-label","Disable encryption"),se(U4,gt)):e?(gt.dataset.tooltip="Encryption on, locked \u2014 click to unlock",gt.setAttribute("aria-label","Unlock encrypted data"),se(U4,gt)):(gt.dataset.tooltip="Encryption off \u2014 click to enable",gt.setAttribute("aria-label","Enable encryption"),se(W9,gt))}async function K9(){if(confirm(`Disable encryption?
21
141
 
22
142
  Your local triage and report data will be rewritten as plaintext.
23
143
 
24
- 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 Gi({migrate:async({open:t})=>{await Wi({open:t}),await Ga({open:t}),await la({open:t}),await da({open:t})}}))?.disabled&&alert(`Encryption disabled. Your data is now plaintext.
144
+ 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 Gg({migrate:async({open:t})=>{await Jg({open:t}),await lv({open:t}),await oy({open:t}),await sy({open:t})}}))?.disabled&&alert(`Encryption disabled. Your data is now plaintext.
25
145
 
26
146
  To complete cleanup, remove the DeepView passkey from your password manager / OS settings:
27
147
  \u2022 macOS / iOS: Settings \u2192 Passwords
28
148
  \u2022 Windows: Settings \u2192 Accounts \u2192 Sign-in options \u2192 Passkeys
29
149
  \u2022 Chrome: chrome://settings/passkeys
30
- \u2022 Hardware security key: use the vendor's management tool`)}catch(e){alert(`Could not disable encryption: ${e?.message??e}`)}}async function Pb(){await Ts()}function yp(e){if(!e||e===$e)return;$e=e;let t=!1;$e.addEventListener("click",async()=>{if(!t){t=!0;try{if(!X()){await Pb();return}if(!st()){await Is();return}await Lb()}finally{t=!1}}}),ge(bp),bp()}var Rs='<path class="bg" d="M3 2h6l4 4v8H3z"/><path fill="rgba(0,0,0,.18)" d="M9 2v4h4Z"/>',Y={default:`<svg class="file-icon brand-deepview" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true">${Rs}<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">${Rs}<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">${Rs}<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">${Rs}<path class="fg" d="m8 5.97 3.5 6.062h-7Z"/></svg>`};function Ke(e){let t=Dn(e);if(t==="deepsec")return"deepsec";if(t==="claude-security")return"claude-security";let r=e.toLowerCase();return r.endsWith(".codex")?"codex-security":r.endsWith(".md")?"claude-security":"default"}function Ne(e){return e.toLowerCase().endsWith(".codex")?e.slice(0,-6).replaceAll("__","/"):e}var wp=globalThis[Symbol.for("@rray/frontend")];if(!wp)throw new Error("@rray/frontend global not installed; view.js must run before lazy bundles import this wrapper");var{LitElement:F1,html:hl,nothing:vp,unsafeCSS:M1,render:L1,StateElement:P1,classMap:O1,repeat:N1,styleMap:D1}=wp;var qe={critical:6,high:5,medium:4,low:3,high_bug:2,bug:1,informational:0},me=["critical","high","medium","low","high_bug","bug","informational"],Bs="node_modules";function kp(e){let t=n=>/(^|\/)node_modules\//u.test(n),r=!1;e:for(let n of e){for(let o of n.groups??[])for(let s of o)if(t(s.file)){r=!0;break e}if(n.tree){for(let o of Object.keys(n.tree))if(t(o)){r=!0;break e}}}Bs=r?"node_modules":"dependencies"}function $p(){return Bs}function Gt(e){return Bs==="node_modules"?/(^|\/)node_modules\//u.test(e):/(^|\/)dependencies\//u.test(e)}function De(e){return typeof e!="number"||!Number.isFinite(e)?null:`${e.toLocaleString()} B`}function Rt(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 Ob(e){let t=Bs==="node_modules"?/^(?:.*\/)?node_modules\/(?:@[^/]+\/[^/]+|[^/]+)\/(.*)$/u:/^(?:.*\/)?dependencies\/(?:@[^/]+\/[^/]+|[^/]+)\/(.*)$/u;return e.match(t)?.[1]??e}function Ze(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 mr(e){let t=e?.exportName,r=e?.methodName;return t&&r&&t!==r?`${t}.${r}`:t||r||""}function xp(e){return[e.file,e.description,e.recommendation,e.confidenceReason,e.discoveredIn,e.repo?.github].filter(Boolean).join(`
31
- `).toLowerCase()}function gl(e){return e&&e.replace(/^[^/]+\//u,"").replace(/^claude-/u,"").replaceAll("-"," ")}function br(e){return[e.type,gl(e.model),e.effort,e.exportsMode].filter(Boolean).join(" \xB7 ")}function Fs(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 Nb(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}function ro(e,t,r){if(t)return`https://github.com/${t}/blob/HEAD/${Ob(e)}`;if(Gt(e))return null;let n=Nb(r);return n?`${n}/blob/HEAD/${e}`:null}function ml(e,t,r){let n=ro(e,t,r);return n?hl`<a href="${n}" target="_blank" rel="noopener">${e}</a>`:e}function Jr(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 _p(e,t,r,n){let o=parseInt(t,10);if(!Number.isFinite(o))return vp;let s=ro(e,r,n),i=`line ${o}`;return s?hl`<a href="${`${s}#L${o}`}" target="_blank" rel="noopener">${i}</a>`:i}function Sp(e,t){return!e||!t?null:`${/^https?:/iu.test(e)?e.replace(/\/$/u,""):`https://github.com/${e}`}/commit/${t}`}function P(e){return e.id??String(e._id)}function Ee(e){return P(e[0])}function bl(e){return Array.isArray(e)?e:[e]}function Ms(e){return e?._reportName??""}function Xr(e){return Tt(a.triage,P(e),Ms(e))}function no(e){return[...e].toSorted((t,r)=>{let n=a.triage.get(P(t))?.color?1:0,o=a.triage.get(P(r))?.color?1:0;if(n!==o)return o-n;let s=qe[t.severity]||0,i=qe[r.severity]||0;if(s!==i)return i-s;let l=t.confidence??-1;return(r.confidence??-1)-l})}function Ue(e){return no(e)[0]}function Ae(e){let t=a.activeTabByGroup.get(Ee(e));if(t){let r=e.find(n=>P(n)===t);if(r)return r}return Ue(e)}function be(e){let t=e.map(f=>{let h=P(f),b=a.triage.get(h),m=b?.triage??(Xr(f)?"ignored":void 0);return{color:b?.color,bucket:m}}).filter(f=>f.color!==void 0||f.bucket!==void 0),r=new Set(t.map(f=>f.color).filter(f=>f!==void 0)),n=Symbol("none"),o=new Set(t.map(f=>f.bucket??n)),s=r.size>1||o.size>1,i=!s&&r.size===1?[...r][0]:null,l=t.map(f=>f.bucket).filter(Boolean),d=l.some(f=>f!=="ignored"),u=t.length>0&&t.every(f=>!!f.bucket&&f.bucket!=="ignored"),p=!s&&l.length>0?l[0]:null;return{hasConflict:s,commonColor:i,anyTriage:d,allTriaged:u,commonTriage:p,isFixed:p==="fixed",isInvalid:p==="invalid",isDeleted:p==="deleted",isIgnored:p==="ignored"}}function Bt(){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 w=d;w<e.length;w++)n(w)===u&&p.push(...e[w]);let f=new Set(p.map(w=>w.id).filter(Boolean)),h=[],b=new Set;for(let w of t)for(let v of w)b.has(v)||f.has(v)&&(h.push(v),b.add(v));if(h.length===0){l.push(p);continue}let m=new Map;for(let w of p)w.id&&!m.has(w.id)&&m.set(w.id,w);let y=new Set,$=[];for(let w of h){let v=m.get(w);v&&($.push(v),y.add(v))}for(let w of p)y.has(w)||$.push(w);l.push($)}return l}function yr(e){for(let t of Bt())if(Ee(t)===e)return t;return null}var oo="\0",so="";function yl(e){return typeof e.repo?.github=="string"&&e.repo.github?e.repo.github:typeof e._repoFallback=="string"&&e._repoFallback?e._repoFallback:null}function Ls(){a.filterSeverities=new Set,a.filterColors=new Set,a.filterSources=new Set,a.filterAnalyzer="",a.filterRepo="",a.filterConfMin=0,a.filterConfMax=10,a.filterInclude="";let e=a.reports.some(t=>t.groups.some(r=>r.some(n=>n.priority!==void 0)));a.sortBy=e?"priority-desc":"severity"}function Db(e){let t=a.filterInclude.toLowerCase();if(a.filterSeverities.size>0&&!a.filterSeverities.has(e.severity))return!1;if(a.filterColors.size>0){let r=a.triage.get(P(e))?.color??"none";if(!a.filterColors.has(r))return!1}if(a.filterSources.size===1){let r=a.filterSources.has("own");if(r&&Gt(e.file)||!r&&!Gt(e.file))return!1}if(a.filterAnalyzer){let r=e._analyzer??null,n=a.filterAnalyzer===oo?null:a.filterAnalyzer;if(r!==n)return!1}if(a.filterRepo){let r=yl(e),n=a.filterRepo===so?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;return t?!!(xp(e).includes(t)||t.startsWith("https://")&&t.length>8&&(a.triage.get(P(e))?.fix??"").toLowerCase().includes(t)):!0}function Ap(e){return e.filter(t=>t.some(Db))}function Cp(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 Tp(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 Ep=Tp("desc"),Ub={severity:(e,t)=>(qe[t.severity]||0)-(qe[e.severity]||0)||Ep(e,t)||parseInt(e.line,10)-parseInt(t.line,10),"confidence-desc":Ep,"confidence-asc":Tp("asc"),"priority-desc":Cp("priority","desc",-1),"priority-asc":Cp("priority","asc",11)};function Ip(e){let t=Ub[a.sortBy];return t?[...e].toSorted((r,n)=>t(Ue(r),Ue(n))):[...e]}var Te=pt(class extends Je{constructor(e){if(super(e),e.type!==Be.PROPERTY&&e.type!==Be.ATTRIBUTE&&e.type!==Be.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!_d(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[t]){if(t===ae||t===g)return t;let r=e.element,n=e.name;if(e.type===Be.PROPERTY){if(t===r[n])return ae}else if(e.type===Be.BOOLEAN_ATTRIBUTE){if(!!t===r.hasAttribute(n))return ae}else if(e.type===Be.ATTRIBUTE&&r.getAttribute(n)===t+"")return ae;return Do(e),t}});var vl={"claude-security":"Claude Security","codex-security":"Codex Security",deepsec:"DeepSec"};function zb(e){return e==null?"(none)":vl[e]??e}var wl=class extends L{static properties={options:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.options=[]}render(){return c`<select class="sort-select" aria-label="Filter by analyzer" .value="${Te(a.filterAnalyzer)}" @change="${this._onChange}"><option value="">All analyzers</option>${this.options.map(t=>c`<option value="${t??oo}">${zb(t)}</option>`)}</select>`}_onChange=t=>{this.dispatchEvent(new CustomEvent("analyzer-change",{detail:{value:t.target.value},bubbles:!0,composed:!0}))}};customElements.define("analyzer-select",wl);function Qr(e){return e==="informational"?"info":e.replaceAll("_"," ")}function $l(e){if(!e)return"";for(let t of e.split(`
32
- `))if(t.trim())return t.trim();return""}function Wb(e){if(!e)return{title:"",body:""};let t=e.indexOf(`
33
- `);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 Rp=/"[^"\n]+"|`[^`\n]+`/gu;function kl(e){if(!e)return e;Rp.lastIndex=0;let t=[],r=0,n;for(;(n=Rp.exec(e))!==null;){n.index>r&&t.push(e.slice(r,n.index));let o=n[0].codePointAt(0)===96?"inline-code":"inline-quote";t.push(c`<span class="${o}">${n[0]}</span>`),r=n.index+n[0].length}return r===0?e:(r<e.length&&t.push(e.slice(r)),t)}function Hb(e){let t=ro(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 Vb(e,t){if(!t)return g;let r=t.slice(0,7),n=Sp(e,t);return n?c`<a href="${n}" target="_blank" rel="noopener" title="${t}">${r}</a>`:c`<span title="${t}">${r}</span>`}var jb=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>`,Kb=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>`,qb=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>`,Gb=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>`;function Yb(e){if(!a.currentWorkspace)return g;let t=e[0]?._reportName;if(!t)return g;let r=Y[Ke(t)]??Y.default;return c`<span class="report-chip" title="${t}">${ue(r)}<span class="report-chip-label">${Ne(t)}</span></span>`}function Bp(e,t,r,n,o=null){let s=Yb(e),i=a.triage.get(n),l=i?.color??null,d=i?.comment??"",u=i?.fix??"",p=d?`Edit comment: ${d}`:"Add comment",f=u?`Edit fix link: ${u}`:"Add fix link (PR URL, etc.)",h=o==="focus",b=d?"Edit comment":"Comment",m=u?"Edit fix link":"Fix link",y=c`<button type="button" class="${F({"mark-comment":!0,"has-comment":d})}" title="${p}" aria-label="${p}">${jb}${h?c`<span class="mark-btn-label">${b}</span>`:g}</button>`,$=c`<button type="button" class="${F({"mark-fix":!0,"has-fix":u})}" title="${f}" aria-label="${f}">${Kb}${h?c`<span class="mark-btn-label">${m}</span>`:g}</button>`,w=c`<button type="button" class="mark-copy" title="Copy file, line, description, confidence to clipboard" aria-label="Copy finding details to clipboard">${qb}${h?c`<span class="mark-btn-label">Copy</span>`:g}</button>`,v=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">${Gb}${h?c`<span class="mark-btn-label">Claude</span>`:g}</button>`,S=c`<color-marker .selected="${l}"></color-marker>`,C=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">${y}${$}</span><span class="mark-action-group">${w}${v}</span>${S}${Xb(e,C,o)}`}function Jb(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 Xb(e,t,r=null){let n=P(e[0]),o=be(e),s=Ae(e),i=P(s),l=o.hasConflict?a.triage.get(i)?.triage??(Xr(s)?"ignored":null):o.commonTriage,d={fixed:"Fixed",invalid:"Invalid",deleted:"Deleted",ignored:"Ignored"},u={fixed:"Fixed",invalid:"Invalid",deleted:"Delete",ignored:"Ignore"},p=!!a.shownTriage,f=p?d[a.shownTriage]:null,h=["fixed","invalid","deleted","ignored"],b=r==="focus",m;b?m=h.map(w=>({key:w,label:u[w]})):p?m=[{key:"restore",label:"Restore"},...h.filter(w=>w!==a.shownTriage).map(w=>({key:w,label:u[w]}))]:m=h.map(w=>({key:w,label:u[w]}));let y=["mark-triage-menu"];p&&y.push("with-label",`triage-state-${a.shownTriage}`);let $=`triage-menu-${n.replaceAll(/[^A-Za-z0-9_-]/gu,"_")}`;return c`<div class="triage-menu-wrap"><button type="button" class="${y.join(" ")}" popovertarget="${$}" 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="${$}" class="triage-menu" data-gid="${n}" role="menu" @beforetoggle="${Jb}">${m.map(w=>c`<button type="button" class="${F({"triage-menu-item":!0,[`triage-menu-${w.key}`]:!0,active:l===w.key})}" data-triage-action="${w.key}" role="menuitem">${w.label}</button>`)}</div></div>`}function Fp(e,t){let r=P(e),n=a.triage.get(r),o=n?.color,s=n?.triage,i=Xr(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"><span class="${`badge ${e.severity}`}">${Qr(e.severity)}</span> ${e.confidence===void 0?g:c`<span class="tab-conf">${e.confidence}/10</span>`}</span></button>`}function Qb(e){if(a.viewMode==="table"||a.viewMode==="focus"){let t=e.confidence*10;return c`<div class="${`conf-ring ${e.severity}`}"><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 Zb=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/iu;function ey(e){let t=e?.name;if(typeof t!="string"||!Zb.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 ty(e,t,r=0,n=1,o=null){let s=P(e),i=a.triage.get(s),l=i?.comment??"",d=i?.fix??"",u=ro(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=mr(e),y=m?c`<span class="line-num">${b}, ${m}</span>`:c`<span class="line-num">${b}</span>`,$=br(e),w=o==="focus"?ey(e.package?.npm):g,v=g;if(o!=="focus"&&e.fileHash&&Array.isArray(e._bundleHashes)&&e._bundleHashes.length>0){let R=new Set(e._bundleHashes),O=hr(e.fileHash).find(({integrity:ye})=>R.has(ye));O&&(v=c`<button type="button" class="finding-code-btn" data-finding-code-bundle="${O.integrity}" data-finding-code-file="${O.file}" data-finding-code-line="${e.line??""}" title="${`Open ${O.file} in bundle source viewer`}">Code</button>`)}let{title:S,body:C}=Wb(Ze(e.description,e));return c`<div class="${F({"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"><span class="${`badge ${e.severity}`}">${Qr(e.severity)}</span><div class="value-label">Severity</div>${e.confidence===void 0?g:Qb(e)} ${v}</div><div><div class="line-row">${y} ${w} ${e.discoveredIn?c`<span class="line-num discovered-in">(found analyzing ${e.discoveredIn})</span>`:g} ${$?c`<span class="run-meta">${$}</span>`:g}</div>${S?c`<div class="desc-title">${S}</div>`:g} ${C?c`<div class="desc">${kl(C)}</div>`:g} ${e.recommendation?c`<div class="recommendation">Recommendation: ${kl(Ze(e.recommendation,e))}</div>`:g} ${e.confidenceReason?c`<div class="conf-reason">${kl(Ze(e.confidenceReason,e))}</div>`:g} ${l?c`<div class="comment-block"><span class="comment-label">Comment:</span> ${l}</div>`:g} ${d?c`<div class="fix-block"><span class="fix-label">Fix:</span> ${Jr(d)?c`<a href="${d}" target="_blank" rel="noopener noreferrer">${d}</a>`:d}</div>`:g}</div></div>`}function Zr(e){return Ee(e)}function Mp(e){let t=be(e),r=no(e),n=e.some(s=>s.critical||s.severity==="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 Lp(e,t={}){let{context:r=null}=t,n=be(e),o=no(e),s=Ae(e),i=P(s),l=s.commitHash?c`<div class="commit-ref">introduced in ${Vb(s.repo?.github,s.commitHash)}</div>`:g,d=a.currentWorkspace&&l!==g;return c`${o.map((u,p)=>ty(u,P(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=>Fp(u,P(u)===i))}</div>`:g}</div>${Bp(e,o,n,i,r)}</div>`}function io(e){return Ee(e)}function Pp(e){let t=be(e),r=e.some(o=>o.critical||o.severity==="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 Op(e){let t=be(e),r=no(e),n=Ae(e),o=P(n),s=n,i=$l(Ze(s.description,s)),l=br(s),d=mr(s),u=d?`, ${d}`:"";return c`<div class="row-score"><span class="${`badge ${s.severity}`}">${Qr(s.severity)}</span> ${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">${Hb(s)}${u}</span><div class="marks">${Bp(e,r,t,o)}</div></div>${r.length>1?c`<div class="tabs-row"><div class="tabs">${r.map(p=>Fp(p,P(p)===o))}</div></div>`:g}</div>`}function ao(e){return"tree-"+e.replaceAll(/[^\w-]+/gu,"_")}var Dp=()=>Object.fromEntries(me.map(e=>[e,0]));function xl(e){let t=new Map;for(let r of e)for(let n of r){t.has(n.file)||t.set(n.file,Dp());let o=t.get(n.file);o[n.severity]!==void 0&&o[n.severity]++}return t}function _l(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 Ps(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=Dp();for(let l of o){let d=t.get(l);if(d)for(let u of me)i[u]+=d[u]??0}r.set(n,i)}return r}function Sl(e,t,r){let n=t.get(e),o=r.get(e);return Np(n)>0||Np(o)>0}function Np(e){if(!e)return 0;let t=0;for(let r of me)t+=e[r]??0;return t}function Up(e){if(!e)return g;let t=hr(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 zp(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="${`#${ao(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=me.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?me.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),y=b===p,$=De(e[b]?.size);return c`<div class="${`tree-table-row${y?" 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>`} ${$?c`<span class="tree-table-size">${$}</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">${ry(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=De(f?.size);return c`<section class="tree-file" id="${ao(p)}"><div class="tree-file-header"><span class="name">${p}</span> ${l(p)} ${b?c`<span class="tree-file-size">${b}</span>`:g} ${Up(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 ry(e,t,r,n){let o=De(e?.size);return c`<div class="tree-detail-name"><span class="name">${t}</span> ${o?c`<span class="tree-detail-size">${o}</span>`:g} ${Up(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 ny(){return{showAll:!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 Yt=ny(),A=new Proxy(Yt,{get(e,t){return Yt[t]},set(e,t,r){return Yt[t]=r,!0},has(e,t){return t in Yt},deleteProperty(e,t){return delete Yt[t]},ownKeys(){return Reflect.ownKeys(Yt)},getOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(Yt,t)}});function ze(){A.graphState?._cleanup&&A.graphState._cleanup(),A.graphState=null}function Wp(){return Yt}var lo=null,Hp=null;function en(){return Hp}function oy(){return lo||(lo=(async()=>{let e="./graph.js";try{let t=await import(e);return t._swapGraph2Impl(Wp()),Hp=t,t}catch(t){throw lo=null,t}})(),lo)}async function Cl(e,t,r,n,o){try{let s=await oy(),i=s.buildGraphFromPrep(t);W(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),l}catch(s){let i=s instanceof Error?s.message:String(s);return e.textContent=`Graph failed to load: ${i}`,null}}function dt(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}var co=null,uo=null;function sy(){return co||(co=(async()=>{let e="./terminal.js";try{return await import(e)}catch(t){throw co=null,t}})(),co)}function iy(e){let t=dt(e);if(t.size===0)return t;let r=[...t.keys()],{stripped:n}=Rt(r),o=new Map;for(let s=0;s<r.length;s++)o.set(n[s],t.get(r[s]));return o}async function Vp(e,t){let r=t?.integrity??"";(!uo||uo.integrity!==r)&&(uo={integrity:r,promise:ay(t,r)});try{let n=await uo.promise;return!e.isConnected||e.contains(n)||e.replaceChildren(n),n}catch(n){uo=null;let o=n instanceof Error?n.message:String(n);return e.textContent=`Terminal failed to load: ${o}`,null}}async function ay(e,t){return(await sy()).createTerminalElement(iy(e),t)}function Kp(e){if(!e)return null;let t=$p()==="node_modules"?/^(?:.*\/)?node_modules\/(@[^/]+\/[^/]+|[^/]+)/u:/^(?:.*\/)?dependencies\/(@[^/]+\/[^/]+|[^/]+)/u,r=e.match(t);if(r)return r[1];let n=e.indexOf("/");return n>0?e.slice(0,n):"/"}var ly=["#4e9af1","#f28e2b","#59a14f","#e15759","#76b7b2","#edc948","#b07aa1","#ff9da7","#9c755f","#5cd1e5","#f1ce63","#d37295","#a0cbe8","#86bcb6","#8cd17d","#b6992d","#499894","#e15759","#e879c7","#d4a6c8"],jp=["#2f8aef","#d2691e","#2ea043","#e63946","#2e9a92","#b88817","#9560e8","#d24a9c","#8a5d40","#0891b2","#a07a14","#c14e8e","#1f7ad0","#549b94","#3fb95f","#a07a14","#2a8278","#cb2c40","#c026d3","#965f93"];function cy(){if(typeof document>"u")return!1;let e=document.body?.classList;return!!e&&(e.contains("theme-light")||e.contains("theme-pink"))}var El=new Map;function Ft(e){let t=cy()?jp:ly,n=`${t===jp?"l":"d"}:${e??"__own__"}`;if(El.has(n))return El.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 El.set(n,d),d}var Al=(e,t,r)=>{for(let n of t)if(n[0]===e)return(0,n[1])();return r?.()};var tn='<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>',Os='<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 Ns=null;function dy(){return Ns||(Ns=(async()=>await import("./prism.js"))(),Ns)}var uy={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"};function Ds(e){if(typeof e!="string")return null;let t=e.lastIndexOf(".");return t<0?null:uy[e.slice(t+1).toLowerCase()]??null}async function Us(e,t){if(!t)return null;try{return(await dy()).highlight(e,t)}catch{return null}}var Ie=`.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}
34
- `;var Tl=class extends I{static styles=[...I.styles,T(Ie)];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",Tl);function qp({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:fy(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 fy(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""}function U(e,t){if(!e)throw new Error(t)}function rn(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 hy=e=>e&&[null,Object.prototype].includes(Object.getPrototypeOf(e)),nn=e=>Object.setPrototypeOf(Object.fromEntries(e),null),Gp=e=>[...e].toSorted((t,r)=>rn(t,r)),zs=e=>nn([...e].toSorted((t,r)=>rn(t[0],r[0])).map(([t,r])=>[t,r instanceof Map?zs(r):r])),Il=e=>new Map(Object.entries(e).map(([t,r])=>[t,hy(r)?Il(r):r]));function Yp(e){let t="node_modules/",r=e.lastIndexOf(t);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 $t=1,Rl=0,Ws=({name:e,version:t,files:r})=>({name:e,version:t,files:nn(Object.entries(r))}),Jp=e=>Yp(e)??{dir:".",rel:e,name:null},Hs=class e{static VERSION=$t;version=$t;config;entries;modules;formats;imports;constructor({config:t={scope:"full"},entries:r,modules:n,formats:o,imports:s,version:i=$t}={}){U([Rl,$t].includes(i)),U(["node_modules","full"].includes(t.scope)),this.version=i,this.config=t,this.entries=r??new Set,this.modules=n??new Map,this.formats=o??new Map,this.imports=s??new Map}get sources(){let t=new Map;for(let[r,{files:n}]of this.modules)for(let[o,s]of Object.entries(n))t.set(r==="."?o:`${r}/${o}`,s);return t}static parseCode(t){let r=JSON.parse(t);U(r.version===$t||r.version===Rl),U(["node_modules","full"].includes(r.config?.scope)),U(r.formats),U(r.imports);let n=new Map,o=new Set;if(r.version===$t){let s=r.config.scope==="full";if(r.modules!==void 0){U(typeof r.modules=="object"&&r.modules!==null);for(let[i,l]of Object.entries(r.modules))U(i.includes("node_modules")),U(!i.startsWith("..")),U(l?.name&&l.version&&l.files),n.set(i,Ws(l))}if(s){U(Array.isArray(r.entries)),U(r.entries.length>0,"v1 bundle with scope=full must have at least one entry"),U(r.sources&&typeof r.sources=="object"),o=new Set(r.entries);for(let[i,l]of Object.entries(r.sources))U(!i.includes("node_modules")),U(!i.startsWith("..")),U(l?.name&&l.version&&l.files),n.set(i,Ws(l))}else U(r.entries===void 0),U(r.sources===void 0);for(let[,{files:i}]of n)for(let l of Object.keys(i))U(!l.startsWith(".."))}else{U(r.sources);for(let[s,i]of Object.entries(r.sources)){U(!s.startsWith(".."));let{dir:l,rel:d,name:u}=Jp(s);U(!l.startsWith("..")&&!d.startsWith("..")),n.has(l)||n.set(l,{name:u,version:null,files:Object.create(null)}),n.get(l).files[d]=i}}return new e({version:r.version,config:r.config,entries:o,modules:n,formats:new Map(Object.entries(r.formats)),imports:Il(r.imports)})}static parseResources(t){let r=JSON.parse(t);U(r.version===$t||r.version===Rl);let n=new Map,o={scope:"full"};if(r.version===$t){U(["node_modules","full"].includes(r.config?.scope)),o=r.config;let s=o.scope==="full";if(r.modules!==void 0){U(typeof r.modules=="object"&&r.modules!==null);for(let[i,l]of Object.entries(r.modules))U(i.includes("node_modules")),U(!i.startsWith("..")),U(l?.name&&l.version&&l.files),n.set(i,Ws(l))}if(s&&r.sources!==void 0){U(typeof r.sources=="object"&&r.sources!==null);for(let[i,l]of Object.entries(r.sources))U(!i.includes("node_modules")),U(!i.startsWith("..")),U(l?.name&&l.version&&l.files),n.set(i,Ws(l))}else s||U(r.sources===void 0);for(let[,{files:i}]of n)for(let l of Object.keys(i))U(!l.startsWith(".."))}else{U(r.resources);for(let[s,i]of Object.entries(r.resources)){U(!s.startsWith(".."));let{dir:l,rel:d,name:u}=Jp(s);U(!l.startsWith("..")&&!d.startsWith("..")),n.has(l)||n.set(l,{name:u,version:null,files:Object.create(null)}),n.get(l).files[d]=i}}return new e({version:r.version,config:o,modules:n})}#e(){let t=[],r=[];for(let[n,{name:o,version:s,files:i}]of this.modules){if(Object.keys(i).length===0)continue;let l=n.includes("node_modules");l&&U(o&&s&&i);let d=nn(Object.entries(i).toSorted((p,f)=>rn(p[0],f[0])));(l?t:r).push([n,{name:o,version:s,files:d}])}return t.sort((n,o)=>rn(n[0],o[0])),r.sort((n,o)=>rn(n[0],o[0])),{modules:nn(t),sources:nn(r)}}serializeCode(){let t=Gp(this.entries),{modules:r,sources:n}=this.#e(),o=zs(this.formats),s=zs(this.imports),i={version:$t,config:this.config};return this.config.scope==="full"&&Object.assign(i,{entries:t,sources:n}),Object.assign(i,{modules:r,formats:o,imports:s}),JSON.stringify(i,void 0,2)}serializeResources(){let{modules:t,sources:r}=this.#e(),n={version:$t,config:this.config};return this.config.scope==="full"&&Object.assign(n,{sources:r}),Object.assign(n,{modules:t}),JSON.stringify(n,void 0,2)}};var Vs=null,js=null,Ks=null;function gy(){for(let e of["br","brotli"])try{return new DecompressionStream(e),e}catch{}return null}async function my(e,t){let r=new Blob([t]).stream().pipeThrough(new DecompressionStream(e));return new Uint8Array(await new Response(r).arrayBuffer())}async function by(){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 yy(){return Ks||(Ks=(async()=>await import("./brotli-fallback.js"))(),Ks)}async function wy(){await by();let e=gy();return e?(Vs={kind:"native",format:e},Vs):(Vs={kind:"fallback"},Vs)}function Xp(){return js||(js=wy(),js)}async function Qp(e){let t=await Xp();return t.kind==="native"?my(t.format,e):(await yy()).brotliDecompress(e)}Xp().catch(()=>{});async function qs(e,t){try{let r=await pr(e),n=t.name.toLowerCase().endsWith(".map"),o=n?"sourcemap":"stasis";try{if(n){let l=JSON.parse(ce(r));return{integrity:e,kind:o,size:r.byteLength,json:l}}let s=ce(await Qp(r)),i=Hs.parseCode(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 vy(e){!e?.json&&!e?.bundle||(async()=>{try{let t=await Fl(e);if(us(e.integrity,t),a.selectedBundle!==e.integrity)return;e.fileHashes=t,k()}catch{}})()}async function Bl(e){if($a(e))return;let t=(a.bundles??[]).find(n=>n.integrity===e);if(!t)return;let r=await qs(e,t);if(!(!r?.json&&!r?.bundle))try{let n=await Fl(r);us(e,n)}catch{}}async function Jt(e){let t=(a.bundles??[]).find(n=>n.integrity===e);if(!t)return;let r=await qs(e,t);a.selectedBundle===e&&(a.bundleDetails=r,k(),vy(r),yt().catch(()=>{}))}var ky=["finding_url","repository","title","description","severity","configured_scan_id","relevant_paths"];function $y(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===`
35
- `||l==="\r"?(r.push(n),t.push(r),r=[],n="",l==="\r"&&e[i+1]===`
36
- `&&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 Zp(e){let t=$y(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 ky)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=>xy(m,o));i.push({displayName:h,data:{type:"security",source:"codex-security",findings:b}})}return i}function xy(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}
37
-
38
- ${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 on=`.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)}}
39
- `;var ef=`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{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)}}.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}.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)}
40
- `;function sn(e){if(!e)return g;let t=e.replaceAll("_"," ");return c`<span class="${`conflict-sev sev-${e}`}">${t}</span>`}function Cy(e){return`bundle-${e.slice(7,19)}\u2026`}function Ge(e){return e.kind==="bundle"?e.label??Cy(e.identifier):e.identifier}function Ey(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 Ay(e){return c`<span class="comment-text">${e||c`<em>empty</em>`}</span>`}function Ty(e){return e?Jr(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 Iy(e){return e?c`<span class="${`triage triage-${e}`}">${e}</span>`:c`<em>none</em>`}function tf(e,t){return e==="color"?Ey(t):e==="comment"?Ay(t):e==="fix"?Ty(t):e==="triage"?Iy(t):c`${String(t)}`}function Ry(e,t){let r=e?.file?e.line?`${e.file}:${e.line}`:e.file:"";return c`<div class="card-head">${sn(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 nf={title:"Triage conflicts",intro:"disagree with your local triage on",trailingNote:"",applyButton:"Apply",importedSideLabel:"Apply imported"},rf={color:0,comment:1,fix:2,triage:3},By={color:"Color",comment:"Comment",fix:"Fix",triage:"Triage state"},Ml=class extends I{static styles=[...I.styles,T(on),T(ef)];static properties={conflicts:{attribute:!1},findingLookup:{attribute:!1},labels:{attribute:!1},_settled:{state:!0}};constructor(){super(),this.conflicts=[],this.findingLookup=new Map,this.labels={...nf},this._settled=!1}focusInitial(){}_onClick=t=>{let r=t.target.closest("[data-bulk]");if(r){let n=r.dataset.bulk;for(let o of this.renderRoot.querySelectorAll(`input[type="radio"][value="${n}"]`))o.checked=!0;return}if(t.target.closest('[data-action="apply"]')){let n={};for(let o of this.conflicts){let s=`${o.id}:${o.property}`,i=this.renderRoot.querySelector(`input[name="conflict-${CSS.escape(s)}"]:checked`);n[s]=i?.value??"local"}this._finish(n);return}t.target.closest('[data-action="cancel"]')&&this._finish(null)};render(){let t=this.labels,r=new Map;for(let u of this.conflicts)r.has(u.id)||r.set(u.id,[]),r.get(u.id).push(u);for(let u of r.values())u.sort((p,f)=>(rf[p.property]??99)-(rf[f.property]??99));let n=this.conflicts.filter(u=>u.property==="color").length,o=this.conflicts.filter(u=>u.property==="comment").length,s=this.conflicts.filter(u=>u.property==="fix").length,i=this.conflicts.filter(u=>u.property==="triage").length,l=[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"}`:""].filter(Boolean).join(", "),d=`${r.size} finding${r.size===1?"":"s"}`;return c`<dialog @click="${this._onClick}" @close="${this._onClose}"><header><h3>${t.title}</h3><p>${d} ${t.intro} ${l}.${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><ul class="list">${[...r.entries()].map(([u,p])=>c`<li class="card" data-id="${u}">${Ry(this.findingLookup.get(u),u)}<div class="rows">${p.map(f=>{let h=`${f.id}:${f.property}`,b=`conflict-${h}`;return c`<div class="row" data-key="${h}"><span class="row-label">${By[f.property]??f.property}</span> <label class="choice"><input type="radio" name="${b}" value="local" checked="checked"> <span class="choice-label">Keep current</span> <span class="choice-value">${tf(f.property,f.local)}</span></label> <label class="choice"><input type="radio" name="${b}" value="imported"> <span class="choice-label">${t.importedSideLabel}</span> <span class="choice-value">${tf(f.property,f.imported)}</span></label></div>`})}</div></li>`)}</ul><footer class="actions"><button type="button" data-action="cancel">Cancel</button> <button type="button" data-action="apply" class="primary">${t.applyButton}</button></footer></dialog>`}};customElements.define("triage-conflict-dialog",Ml);function Gs(e,t,r={}){return new Promise((n,o)=>{let s=document.createElement("triage-conflict-dialog");s.conflicts=e,s.findingLookup=t,s.labels={...nf,...r},s.addEventListener("resolve",i=>{s.remove(),n(i.detail)}),s.addEventListener("modal-conflict",i=>{s.remove(),o(ft(i.detail?.cause))}),document.body.append(s)})}var Ll=class extends I{static styles=[...I.styles,T(Qe)];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",Ll);function of({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(ft(o.detail?.cause))}),document.body.append(n)})}async function sf(e){let t=await nl(e),r;if(Yn(t)){if(r=await of({tryPassword:o=>xs(t,o)}),!r)return null}else r=await xs(t);let n=await ol(r,{conflictResolver:async(o,s)=>{try{return await Gs(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)&&k(),n}var lf="deepview.passkey.firstImportPrompted";function Fy(){try{return localStorage.getItem(lf)==="1"}catch{return!1}}function af(){try{localStorage.setItem(lf,"1")}catch{}}async function Pl(){if(X()||!mt()||Fy())return;if(!confirm(`Encrypt your DeepView data with a passkey?
41
-
42
- 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.
43
-
44
- You can change this anytime from the lock icon in the sidebar header.`)){af();return}await Ts(),X()&&af()}var cf=Pl;var df=["type","model","think","effort","exportsMode"],Xt="deepview.lastFile",po=new Set(["overview","graph","treemap","advisories","issues","code","terminal"]);function an(e,t="overview"){let r=t&&t!=="overview"&&po.has(t)?` ${t}`:"";ve(Xt,`b:${e}${r}`).catch(()=>{})}var wr=0,xe=e=>e!==wr;function Ol(e){let t=pf(e.toLowerCase());return t.endsWith(".map")?"sourcemap":t==="stasis.code.br"||t.endsWith(".stasis.code.br")?"stasis":null}function pf(e){return e.replace(/ \(\d+\)(?=\.[^.]*$)/u,"")}async function uf({name:e,content:t,existingNames:r}){if(!r.has(e))return await at(e,t),r.add(e),{name:e,content:t};let n;try{n=await Fe(e)}catch(l){if(!(l instanceof DOMException&&l.name==="NotFoundError"||typeof l?.message=="string"&&l.message.startsWith("File not found:")))throw l;return await at(e,t),r.add(e),{name:e,content:t}}if(n===t)return{name:e,content:t};let s=z().filter(l=>Array.isArray(l.reports)&&l.reports.includes(e)).filter(l=>Zn(l.id,e)),i=await qp({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 at(l,t),r.add(l),{name:l,content:t}}return await at(e,t),s.length>0&&await My(e,s),{name:e,content:t}}async function My(e,t){let r;try{r=await Tn(e)}catch(n){console.warn(`Import: failed to read freshly-saved "${e}" for cloud sync:`,n);return}for(let n of t)try{await As(n.id);let o=await Ss(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 Nl(e){await cf();let t=null,r=null,n=new Set,o=new Set(await le());for(let s of e)try{let i=pf(s.name.toLowerCase());if(i.endsWith(".gz")||i.endsWith(".deepview-workspace.enc")){await sf(s);try{let u=await le();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(Ol(s.name)){let u=new Uint8Array(await s.arrayBuffer()),{integrity:p}=await ur(s.name,u);r=p,n.add(p);continue}let d=await s.text();if(i.endsWith(".csv")){let u=Zp(d);for(let{displayName:p,data:f}of u){let h=p.replaceAll("/","__")+".codex",b=JSON.stringify(f),{count:m,source:y}=Oe(b),$=await uf({name:h,content:b,existingNames:o});$&&(je($.name,m,y),t={name:$.name,content:$.content})}}else{let u=Oe(d);if(!u.recognized)throw new Error("not a recognized DeepView, DeepSec, Claude Security, or Codex report");let p=await uf({name:s.name,content:d,existingNames:o});if(!p)continue;je(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)Bl(s).catch(()=>{});t?await _t(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.shownTriage=null,A.showAll=!0,an(r),k(),await V(),Jt(r))}async function _t(e,t){let r=++wr,n=new Set(z().filter(o=>Array.isArray(o.reports)&&o.reports.includes(e)).map(o=>o.id));for(let o of D.openSessions)o&&!n.has(o.workspaceId)&&(D.closeSession(o.workspaceId),eo(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=He(e),a.repoEditing=!1,A.selected=null,A.focusedPkg=null,A.layoutCache=null,A.solo=null,A.hidden.clear(),A.pathFilter="",ze(),ve(Xt,e).catch(()=>{}),t===void 0){try{t=await Fe(e)}catch(o){if(xe(r))return;if(o&&o.message?.includes("vault locked")){if(await Is()&&!xe(r)){await _t(e);return}xe(r)||(a.currentFile=null,await V());return}alert(`Failed to read ${e}: ${o.message}`),a.currentFile=null,await V();return}if(xe(r))return}if(await Ul(e,t,r),!xe(r)){for(let o of n)D.openSession(o),D.refreshSession(o),As(o);await V()}}async function Qt(e){let t=z().find(o=>o.id===e);if(!t)return;let r=++wr;for(let o of D.openSessions)o&&o.workspaceId!==e&&(D.closeSession(o.workspaceId),eo(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="",ze(),ve(Xt,`ws:${e}`).catch(()=>{}),t.reports.length===0&&(E.classList.remove("active"),W(g,E),Ce.classList.remove("hidden"));let n=t.reports.map(o=>Fe(o).catch(()=>null));for(let o=0;o<t.reports.length;o++){let s=await n[o];if(xe(r))return;if(s!==null&&(await Ul(t.reports[o],s,r),xe(r)))return}D.openSession(e),D.refreshSession(e),As(e),await V()}async function ff({triage:e="keep",deleteFromRemoteWorkspaceIds:t=[]}={}){if(!a.currentFile)return;let r=++wr,n=a.currentFile;Gr(n),Ve(n,"");for(let o of t)try{let s=await Cs(o,n);if(xe(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 Dr(n),!xe(r)&&(await Vn(n,null),!xe(r))){if(e==="wipe"){try{await ws()}catch(o){console.warn("Skipped orphan-triage GC:",o)}if(xe(r))return}xe(r)||(Dl(),await V())}}function Dl(){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="",ze(),Mr(Xt),E.classList.remove("active"),W(g,E),Ce.classList.remove("hidden"),document.title="DeepView"}async function hf(){++wr;for(let e of D.openSessions)e&&(D.closeSession(e.workspaceId),eo(e.workspaceId));Dl(),await V()}async function gf({deleteFromRemoteWorkspaceIds:e=[]}={}){if(!a.selectedBundle)return;let t=++wr,r=a.selectedBundle;for(let o of e)try{let s=await Es(o,r);if(xe(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 ia(r),xe(t)||(await Ha(r,null),xe(t)))return;a.selectedBundle=null,a.bundleDetails=null,a.bundleSourceFile=null,a.bundleSourceFindingIdx=null;let n=he(Xt);typeof n=="string"&&(n===`b:${r}`||n.startsWith(`b:${r} `))&&Mr(Xt),ka(r),a.bundles=await lt(),!xe(t)&&(k(),await V())}async function mf(e,t="detach",{triage:r="keep"}={}){let n=z().find(l=>l.id===e);if(!n)return;++wr;let o=Array.isArray(n.reports)?[...n.reports]:[];if(D.closeSession(e),eo(e),t==="delete"){for(let l of o){try{await Dr(l)}catch{}Gr(l),Ve(l,"")}if(r==="wipe")try{await ws()}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)&&Dl(),await Na(e),await V()}async function Ul(e,t,r=null){let n=()=>r!==null&&xe(r);try{if(await qn,n())return;let o;try{o=JSON.parse(t)}catch(b){if(o=Ur(t)??zr(t),!o)throw new Error(`Not JSON, and not a recognized markdown format. (JSON error: ${b.message})`,{cause:b})}let s=a.reports.length===0,i=new Set,l=new Map;for(let b=0;b<a.reports.length;b++){let m=a.reports[b];for(let y=0;y<m.groups.length;y++){let $=m.groups[y],w=`${b}:${y}`;for(let v of $)v.id&&(i.add(v.id),l.set(v.id,w))}}let d=o.findings||[],u=d.flatMap(bl).filter(b=>!b.id);if(u.length>0){let b=await Promise.all(u.map(ls));if(n())return;u.forEach((m,y)=>{b[y]&&(m.id=b[y])})}let p=He(e),f=[],h=0;for(let b of d){let m=bl(b);if(m.length===0)continue;let y=m.filter(R=>R.id&&i.has(R.id)),$=m.filter(R=>!R.id||!i.has(R.id)),w=new Set;for(let R of y){let O=l.get(R.id);O!==void 0&&w.add(O)}let v=m.filter(R=>R.id).map(R=>R.id);if($.length===0){w.size>1&&a.workspaceMerges.push(new Set(v)),h+=y.length;continue}let S=[];for(let R of $){R.id&&i.add(R.id);let O={...R,_id:a.nextFindingId++,_repoFallback:p,_reportName:e,_bundleHashes:o.bundleHashes??[]};if(!o.source&&!df.some(K=>O[K]!==void 0))for(let K of df)o[K]!==void 0&&(O[K]=o[K]);O._analyzer=o.source??O.type??null,S.push(O)}y.length>0&&(h+=y.length,a.workspaceMerges.push(new Set(v)));let C=`${a.reports.length}:${f.length}`;for(let R of $)R.id&&l.set(R.id,C);f.push(S)}if(h>0&&console.log(`${e}: skipped ${h} duplicate finding${h===1?"":"s"}`),a.reports.push({type:o.type||"analysis",source:o.source??null,fileName:e,groups:f,tree:o.tree??null,bundleHashes:o.bundleHashes??[]}),Array.isArray(o.bundleHashes)&&o.bundleHashes.length>0){let b=new Set((a.bundles??[]).map(m=>m.integrity));for(let m of o.bundleHashes)b.has(m)&&Bl(m).catch(()=>{})}if(s)if(Ls(),f.some(m=>m.some(y=>y.confidence!==void 0))){let m=$=>f.reduce((w,v)=>w+(v.some(S=>S.confidence!==void 0&&S.confidence>=$)?1:0),0),y;for(m(6)<=25?y=6:m(7)<=25?y=7:y=8;y>0&&m(y-1)===m(y);)y--;a.filterConfMin=y}else a.filterConfMin=0;k()}catch(o){alert(`Failed to parse ${e}: ${o.message}`)}}window.__loadFile=(e,t)=>Ul(e,t);window.__setFilters=({severities:e,confMin:t}={})=>{e!=null&&(a.filterSeverities=new Set(e)),t!==void 0&&(a.filterConfMin=t),k()};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")&&Nl(e.dataTransfer.files)});Ce.addEventListener("dragover",e=>{e.preventDefault(),Ce.classList.add("hover")});Ce.addEventListener("dragleave",()=>Ce.classList.remove("hover"));Ce.addEventListener("drop",e=>{e.preventDefault(),Ce.classList.remove("hover"),Nl(e.dataTransfer.files)});var xt=null;function Ly(){xt||(xt=document.createElement("input"),xt.type="file",xt.multiple=!0,xt.hidden=!0,xt.addEventListener("change",()=>{let e=xt.files;e&&e.length>0&&Nl(e),xt.value=""}),document.body.append(xt)),xt.click()}Ce.addEventListener("click",e=>{e.target.closest(".drop-prompt-action")&&Ly()});var vr=new Map,bf="deepview.advisories.proxyConsent";function yf(){try{return localStorage.getItem(bf)==="1"}catch{return!1}}function wf(){try{localStorage.setItem(bf,"1")}catch{}}function Py(e){let t=new Map;if(!e||e.kind!=="stasis"||!e.bundle)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}function Oy(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 vf(e,t){return!e||Ol(e.name)!=="stasis"?!1:!t||t.integrity!==e.integrity?!0:Oy(t)}function Ny(e){let t=Object.create(null);for(let[r,n]of e)t[r]=[...n].toSorted();return t}async function kf(e,t){if(!e?.integrity||vr.has(e.integrity)||!yf())return;let r=Py(e);if(r.size===0){vr.set(e.integrity,{state:"ok",byPackage:new Map,query:r});return}vr.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(Ny(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{}vr.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)}vr.set(n,{state:"ok",byPackage:i,query:r})}catch(o){vr.set(n,{state:"error",reason:o?.message??"fetch-failed",query:r})}t()}var Dy={critical:0,high:1,moderate:2,low:3,info:4};function Ys(e){return Dy[e]??999}function Uy(e){return e.charAt(0).toUpperCase()+e.slice(1)}function zy(){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 $f(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(!yf())return zy();let t=vr.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">Failed to fetch advisories: ${t.reason}</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=>Ys(h.severity))),f=Math.min(...u.map(h=>Ys(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])=>Wy(i,l,t.query.get(i)))}</ul></div>`}function Wy(e,t,r){let n=[...t].toSorted((s,i)=>{let l=Ys(s.severity)-Ys(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=>Ky(s))}</ul></li>`}function Hy(e){if(typeof e!="string")return null;let t=/\/(GHSA-[a-z0-9-]+)(?:[/?#]|$)/iu.exec(e);return t?t[1]:null}var Vy=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 jy(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 Ky(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=Hy(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}${Vy}</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}`}">${Uy(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?"":", "}${jy(p)}`)}</span>`:g}</div>${o?c`<div class="bundle-advisory-cvss-vector mono">${o}</div>`:g}</div></div></li>`}var fo=null;function qy(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 Gy(e){let t=dt(e),r=qy(e),n=[...t.keys()],{stripped:o}=Rt(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 Fl(e){let t=dt(e),r=new Map;for(let[n,o]of t)r.set(n,await fu(o));return r}function Sf(e){let t={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 ds(n)){let s=a.triage.get(P(o))?.triage;s&&t[s]!==void 0&&t[s]++}}return t}function kr(e,t="graph"){if(!e||e.size===0)return new Map;let r=new Map;for(let[n,o]of e){let s=ds(o);if(s.length===0)continue;let i=s.filter(d=>{let u=a.triage.get(P(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 Yy(e,t){let r=new Set;for(let[o,s]of t)if(s){for(let i of Object.values(s))if(i>0){r.add(o);break}}let n=[...r];for(;n.length>0;){let o=n.shift(),s=e[o]?.imports??[];for(let i of s)!r.has(i)&&e[i]&&(r.add(i),n.push(i))}return r}function Cf(e){let{tree:t,origToStripped:r}=Gy(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[m,y]of e.fileHashes){let $=r.get(m);$!==void 0&&o.set($,y)}}let s=kr(o),i=new Map,l=new Map,d=new Map,u=new Map;for(let[m,y]of s){let $={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0},w=new Set,v=new Set,S=[];for(let C of y){$[C.severity]=($[C.severity]||0)+1,w.add(C.severity);let R=a.triage.get(P(C))?.color??"none";v.add(R),S.push({severity:C.severity,color:R})}i.set(m,$),l.set(m,w),d.set(m,v),u.set(m,S)}let p=Ps(t,i),f=A.showAll?n:[...Yy(t,i)],h=new Map;for(let[m,y]of r)h.set(y,m);let b=!1;for(let m of Object.values(t))if(m?.imports&&m.imports.length>0){b=!0;break}return{treeData:t,files:f,ownCounts:i,transitiveCounts:p,severitySets:l,colorSets:d,fileFindings:u,options:{pkgOf:ho},strippedToOrig:h,hasEdges:b}}function Qs(){if(!fo)return;let e=en();e&&e.refreshSidebar(fo,{isBundleContext:!0})}function Zs(){if(!fo)return;let e=en();e&&e.refreshTopPkgs(fo)}function Ef(e){fo=e}function ho(e){let t=/(?:^|\/)(?:node_modules|dependencies)\/(@[^/]+\/[^/]+|[^/]+)/gu,r;for(;(r=t.exec(e))!==null;)if(r[1]!==".pnpm")return r[1];let n=e.indexOf("/");return n>0?e.slice(0,n):"__own__"}function Jy(e){let t=new Map,r=0;for(let{path:o,size:s}of e){if(typeof s!="number"||s<=0)continue;let i=ho(o);t.set(i,(t.get(i)??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="${we({flexGrow:s,background:Ft(o)})}" data-tooltip="${o==="__own__"?g:`${o}: ${De(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=Ft(o);return c`<li><span class="bundles-dist-dot" style="${we({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="${we({width:`${i}%`,background:d})}"></span> </span><span class="bundles-dist-size">${De(s)}</span> <span class="bundles-dist-percent">${i}%</span></li>`})}</ul></div>`}function xf(e,t,r,n){let{prefix:o,stripped:s}=Rt(r),i=new Set;for(let v of s)i.add(ho(v));let l=s.map((v,S)=>S).toSorted((v,S)=>s[v].localeCompare(s[S])),d=s.map((v,S)=>({path:v,size:n[S]})),u=Jy(d),p=u===g?c`<p class="bundles-overview-col-empty">No size information for this bundle's sources.</p>`:u,f={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0},h=0,b=new Map;if(a.bundleDetails?.fileHashes){let v=kr(a.bundleDetails.fileHashes,"issues");for(let S of v.values())for(let C of S){f[C.severity]!==void 0&&f[C.severity]++,h++;for(let R of Mn(C.fileHash,C))b.set(R,(b.get(R)??0)+1)}}let m=[...b.keys()].toSorted(),y=me.filter(v=>f[v]>0).map(v=>c`<span class="${`tree-count-chip ${v}`}">${f[v]} ${v.replaceAll("_"," ")}</span>`),$=r.length>0?c`<ul class="bundles-sources-list">${l.map(v=>{let S=r[v],C=s[v],R=n[v];return c`<li><button type="button" class="bundles-source-row" data-bundle-view-source="${S}" data-tooltip="${S}"><span class="bundles-source-path">${C}</span> ${R==null?g:c`<span class="bundles-source-size">${De(R)}</span>`}</button></li>`})}</ul>`:c`<p class="bundles-overview-col-empty">No source files in this bundle.</p>`,w=m.length>0?c`<ul class="bundles-reports-list">${m.map(v=>{let S=Y[Ke(v)]??Y.default,C=b.get(v)??0;return c`<li><button type="button" class="report-chip bundles-report-chip" data-tooltip="${v}" data-bundle-issue-report="${v}">${ue(S)}<span class="report-chip-label">${Ne(v)}</span> <span class="bundles-report-count">${C} ${C===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">${e}<dl class="bundles-detail-meta">${t}<dt>Sources</dt><dd>${r.length}</dd>${o?c`<dt>Prefix</dt><dd class="mono">${o}</dd>`:g}</dl>${h>0?c`<div class="bundles-issue-summary tree-count-chips">${y}</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">${i.size}</span></header><div class="bundles-overview-col-body">${p}</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>${m.length>0?c`<section class="bundles-overview-col"><header class="bundles-overview-col-head">Reports <span class="bundles-overview-col-count">${m.length}</span></header><div class="bundles-overview-col-body bundles-overview-col-body--list">${w}</div></section>`:g}</div></div>`}var zl=new Map,Wl=new Set;function Xs(e){for(let t of me)for(let r of e)if(r.severity===t)return t;return e[0]?.severity??null}function Af(e,t,r,n){let o=e.split(`
45
- `).length,s=String(o).length,i=Ds(t),l=`${r??""}\0${t}`;i&&!zl.has(l)&&!Wl.has(l)&&(Wl.add(l),(async()=>{let u=await Us(e,i);zl.set(l,u??null),Wl.delete(l),a.bundleSourceFile===t&&k()})());let d=zl.get(l);return c`<div class="bundle-source-lines" style="${we({"--lineno-width":`${s}ch`})}"><aside class="bundle-source-lineno-col" aria-hidden="true">${Array.from({length:o},(u,p)=>{let f=p+1,h=n.get(f),b=h?Xs(h.map(y=>y.f)):null,m=h&&a.bundleSourceFindingIdx!=null&&h.some(y=>y.idx===a.bundleSourceFindingIdx);return c`<div class="bundle-source-lineno-row" data-line="${f}">${h?c`<button type="button" class="${F({"bundle-source-dot":!0,[`sev-${b}`]:!0,active:m})}" data-bundle-source-finding="${h[0].idx}" title="${`${h.length} ${h.length===1?"issue":"issues"} on line ${f}`}" aria-label="${`${h.length} issues on line ${f}`}"></button>`:c`<span class="bundle-source-dot-placeholder"></span>`} <span class="bundle-source-lineno-num">${f}</span></div>`})}</aside><pre class="bundle-source-code"><code class="${i?`language-${i}`:""}">${typeof d=="string"?ue(d):e}</code></pre></div>`}function Tf(e){let t=a.bundleSourceFindingIdx;if(t==null)return g;let r=e[t];if(!r)return g;let n=r.fileHash?Mn(r.fileHash,r):[],o=a.triage.get(P(r))?.triage,s=o==="fixed"?"Fixed":null,i=br(r),l=Bf(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.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=Y[Ke(d)]??Y.default;return c`<button type="button" class="report-chip bundle-source-panel-report" title="${d}" data-bundle-issue-report="${d}">${ue(u)}<span class="report-chip-label">${Ne(d)}</span></button>`})}</div>`:g}</div></aside>`}function If(){let e=a.bundleSourceFile;if(!e)return g;if(a.bundleDetailsTab==="code")return g;let r=dt(a.bundleDetails).get(e),n=[],o=new Map;if(typeof r=="string"&&a.bundleDetails?.fileHashes){let i=kr(a.bundleDetails.fileHashes,"issues").get(e)??[];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 c`<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"?Af(r,e,a.bundleDetails?.integrity,o):c`<div class="bundle-source-empty">Source content not bundled.</div>`}</div>${Tf(n)}</div></div></div>`}function Rf(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 Js=new Map,_f=null;function Hl(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:Js.has(f)?Js.get(f):r===0||d(h),p=f=>h=>{Js.set(f,!h.currentTarget.parentElement.open)};return c`<ul class="${F({"bundle-code-tree":!0,root:r===0})}">${J(i,([f])=>`${o}/${f}`,([f,h])=>{let b=o?`${o}/${f}`:f;return c`<li class="bundle-code-tree-dir"><details ?open="${u(b,h)}"><summary @click="${p(b)}">${f}</summary>${Hl(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?Xs(b):null,y=b?.length??0;return c`<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> ${y>0?c`<span class="${`bundle-code-tree-count sev-${m}`}" title="${`${y} ${y===1?"issue":"issues"}`}">${y}</span>`:g}</button></li>`})}</ul>`}function Xy(e,t,r,n,o=""){if(!r)return Hl(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=Rf(d),f=h=>{let b=new Map;for(let[m,y]of h.files)b.set(m,u.get(y)??y);h.files=b;for(let m of h.dirs.values())f(m)};return f(p),Hl(p,t,0,n,"",!0)}function Qy(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(`
46
- `);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="${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=>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 Zy(e,t,r,n=""){if(!e.fileHashes)return c`<div class="bundle-code-search-empty">Computing file hashes…</div>`;let o=kr(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)&&!f.toLowerCase().includes(s)||i.push({file:l,finding:p,fileIdx:u})}return i.sort((l,d)=>{let u=qe[l.finding.severity]??0,p=qe[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="${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="${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">${d.description??""}</div></button></li>`})}</ul></div>`}function ew(e){if(!e||!e.json&&!e.bundle)return g;let t=dt(e);if(t.size===0)return c`<div class="bundle-code-empty">This bundle doesn't carry any source content.</div>`;_f!==a.selectedBundle&&(Js.clear(),_f=a.selectedBundle);let r=[...t.keys()].toSorted(),{prefix:n,stripped:o}=Rt(r),s=new Map;for(let w=0;w<r.length;w++)s.set(o[w],r[w]);let i=Rf(o),l=w=>{let v=new Map;for(let[S,C]of w.files)v.set(S,s.get(C)??C);w.files=v;for(let S of w.dirs.values())l(S)};l(i);let d=a.bundleSourceFile,u=d?t.get(d):null,p=[],f=new Map;if(typeof u=="string"&&e.fileHashes){let v=kr(e.fileHashes,"issues").get(d)??[];for(let S=0;S<v.length;S++){let C=v[S];p.push(C);let R=parseInt(C.line,10);Number.isFinite(R)&&R>0&&(f.has(R)||f.set(R,[]),f.get(R).push({f:C,idx:S}))}}let h=e.fileHashes?kr(e.fileHashes,"issues"):new Map,m=h.size>0?["files","code","issues"]:["files","code"],y=m.includes(a.bundleCodeSearchMode)?a.bundleCodeSearchMode:"files",$=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">${Al(y,[["files",()=>Xy(i,d,$,h,n)],["code",()=>Qy(t,$,d,n)],["issues",()=>Zy(e,$,d,n)]])}</div></aside><div class="${F({"bundle-code-main":!0,"with-panel":a.bundleSourceFindingIdx!=null})}">${d?c`<header class="bundle-code-main-bar"><span class="bundle-code-main-path mono" title="${d}">${d}</span></header><div class="bundle-code-main-body"><div class="bundle-source-code-wrap">${typeof u=="string"?Af(u,d,e.integrity,f):c`<div class="bundle-source-empty">Source content not bundled.</div>`}</div>${Tf(p)}</div>`:c`<div class="bundle-code-placeholder">Pick a file from the tree to view its source.</div>`}</div></div>`}function tw(e){let t=vf(e,a.bundleDetails);a.bundleDetailsTab==="advisories"&&!t&&(a.bundleDetailsTab="overview");let r=a.bundleDetailsTab,n=r==="overview";return r==="advisories"&&t&&kf(a.bundleDetails,k).catch(()=>{}),c`<div class="bundles-view bundles-slide-view"><header class="bundles-slide-bar"><span class="bundles-slide-icon" aria-hidden="true">${ue(tn)}</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="${F({"bundles-tab":!0,active:r==="advisories"})}" data-bundle-tab="advisories" aria-selected="${String(r==="advisories")}" role="tab">Advisories</button>`:g} <button type="button" class="${F({"bundles-tab":!0,active:r==="issues"})}" data-bundle-tab="issues" aria-selected="${String(r==="issues")}" role="tab">Issues</button> <button type="button" class="${F({"bundles-tab":!0,active:r==="terminal"})}" data-bundle-tab="terminal" aria-selected="${String(r==="terminal")}" role="tab">Terminal</button> <button type="button" class="${F({"bundles-tab":!0,active:r==="treemap"})}" data-bundle-tab="treemap" aria-selected="${String(r==="treemap")}" role="tab">Treemap</button> <button type="button" class="${F({"bundles-tab":!0,active:r==="graph"})}" data-bundle-tab="graph" aria-selected="${String(r==="graph")}" role="tab">Graph</button> <button type="button" class="${F({"bundles-tab":!0,active:r==="code"})}" data-bundle-tab="code" aria-selected="${String(r==="code")}" role="tab">Code</button> <button type="button" class="${F({"bundles-tab":!0,active:n})}" data-bundle-tab="overview" aria-selected="${String(n)}" role="tab">Overview</button></div></header><div class="${F({"bundles-slide-body":!0,"bundles-slide-body-overview":n})}">${n?ow(e,a.bundleDetails):Al(r,[["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="${a.bundleDetails}"></bundle-treemap>`],["code",()=>ew(a.bundleDetails)],["issues",()=>nw(a.bundleDetails)],["advisories",()=>$f(a.bundleDetails)]])}</div></div>`}function rw(e,t={}){if(!e)return g;let r=[];if(e.fileHash&&(r=Mn(e.fileHash,e)),r.length===0&&t.bucketKey&&(t.kind==="package"?r=ba(t.bucketKey,e):t.kind==="repository"&&(r=ya(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=Y[Ke(s)]??Y.default;return c`<button type="button" class="report-chip" title="${s}" data-bundle-issue-report="${s}">${ue(i)}<span class="report-chip-label">${Ne(s)}</span></button>`})} ${o>0?c`<span class="bundle-issue-reports-more">, and ${o} more…</span>`:g}</div>`}function Bf(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 nw(e){if(!e||!e.json&&!e.bundle)return g;if(!e.fileHashes)return c`<div class="bundle-issues-empty">Computing file hashes…</div>`;let t=kr(e.fileHashes,"issues");return t.size===0?c`<div class="bundle-issues-empty">No issues match this bundle's files.</div>`:go(t,{kind:"bundle"})}function go(e,{kind:t,bucketKey:r}={}){let n=[...e.keys()],{prefix:o,stripped:s}=Rt(n),i=new Map(n.map((u,p)=>[u,s[p]])),l=[...e.entries()].toSorted(([u,p],[f,h])=>{let b=qe[Xs(p)]??0,m=qe[Xs(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,y)=>{let $=qe[m.severity]??0,w=qe[y.severity]??0;if(w!==$)return w-$;let v=parseInt(m.line,10)||0,S=parseInt(y.line,10)||0;return v-S}),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 y=p.indexOf(m),$=m.severity,w=a.triage.get(P(m))?.triage,v=w==="fixed"||w==="invalid"||w==="deleted"?w.toUpperCase():null,S=c`<div class="bundle-issues-finding-head"><span class="${`bundle-issue-sev sev-${$}`}">${$.replaceAll("_"," ")}</span> ${(()=>{let C=Bf(m.line);return C?c`<span class="bundle-issues-finding-line">${C}</span>`:g})()} ${v?c`<span class="${`bundle-issues-finding-triage triage-${w}`}">${v}</span>`:g} <span class="bundle-issues-finding-spacer"></span> ${rw(m,{kind:t,bucketKey:r})}</div><div class="bundle-issues-finding-desc">${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="${y}" data-bundle-view-line="${m.line??""}" title="${u}">${S}</button>`:c`<div class="bundle-issues-finding-link bundle-issues-finding-static" title="${u}">${S}</div>`}</li>`})}</ul></li>`})}</ul></div>`}function Ff(e){let t=a.selectedBundle,r=t?e.find(n=>n.integrity===t):null;return r?tw(r):c`<div class="bundles-view bundles-view-empty"><p class="bundles-empty-hint">${e.length===0?"No bundles yet. Drop a `.map` sourcemap or a `.stasis.code.br` bundle to start.":"Pick a bundle from the sidebar to open it."}</p></div>`}function ow(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>${De(t.size)}</dd>`:g}</dl>`;if(!t||t.integrity!==e.integrity)return c`<div class="bundles-overview"><div class="bundles-overview-summary">${r}</div></div>`;if(t.error)return c`<div class="bundles-overview"><div class="bundles-overview-summary">${r}</div><div class="bundles-overview-placeholder is-error">Failed to parse: ${t.error}</div></div>`;if(t.kind==="sourcemap"&&t.json){let n=t.json,o=n.sources??[],s=n.sourcesContent??[],i=o.map((d,u)=>typeof s[u]=="string"?new TextEncoder().encode(s[u]).byteLength:null),l=c`<dt>Version</dt><dd>${String(n.version??"?")}</dd>${n.file?c`<dt>Output</dt><dd class="mono">${n.file}</dd>`:g} ${n.sourceRoot?c`<dt>Source root</dt><dd class="mono">${n.sourceRoot}</dd>`:g} ${n.names?c`<dt>Names</dt><dd>${n.names.length}</dd>`:g}`;return xf(r,l,o,i)}if(t.kind==="stasis"&&t.bundle){let n=t.bundle,o=n.sources,s=[...o.keys()],i=new Set;for(let p of n.imports.keys()){let f=p.replace(/\s*\(with: .*\)\s*$/u,"");for(let h of f.split(", "))i.add(h)}let l=[...i].toSorted(),d=s.map(p=>{let f=o.get(p);return typeof f=="string"?new TextEncoder().encode(f).byteLength:null}),u=c`<dt>Version</dt><dd>${String(n.version)}</dd>${l.length>0?c`<dt>Resolution kinds</dt><dd>${l.join(", ")}</dd>`:g}`;return xf(r,u,s,d)}return c`<div class="bundles-overview"><div class="bundles-overview-summary">${r}</div><div class="bundles-overview-placeholder">Bundle contents not parsed.</div></div>`}function Mf(){yt().catch(()=>{});let e=bt(),t={fixed:0,invalid:0,deleted:0},r=[];for(let[h,b]of e){let m=[],y=[],$=new Map,w=new Set;for(let[v,S]of b.byVersion){let C=[],R=new Map;for(let O of S.findings){let ye=a.triage.get(P(O))?.triage??null;ye==="fixed"?t.fixed++:ye==="invalid"?t.invalid++:ye==="deleted"&&t.deleted++,ye===a.shownTriage&&(C.push(O),R.has(O.file)||R.set(O.file,[]),R.get(O.file).push(O))}if(C.length!==0){m.push([v,{findings:C,files:R,reports:S.reports}]);for(let O of C)y.push(O),$.has(O.file)||$.set(O.file,[]),$.get(O.file).push(O);for(let O of S.reports)w.add(O)}}m.length!==0&&(m.sort(([v],[S])=>Mi(v,S)),r.push([h,{findings:y,files:$,reports:w,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 uw(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();cw(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="${F({"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>${aw(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(sw(d),iw,h=>pw(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">${gw(o[0],i,s?s[0]:void 0)}</div></aside>`:g}</div>`}</div>`}function sw(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 iw(e){return e.version===null?`${e.kind}:${e.pkg}`:`${e.kind}:${e.pkg}@${e.version}`}function aw(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="${lw}"></triage-selector></div>`}var lw=["fixed","invalid","deleted"];function cw(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 dw(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(P(s))?.triage??null;i==="invalid"?r.invalid++:i==="deleted"?r.deleted++:r.live++}return r}function uw(e,t,r){let n=bt().get(e),o=dw(n,r),s=a.packageSlideTriage??"live",i=n?Lf(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>`:go(i,{kind:"package",bucketKey:e})}</div></div>`}function pw(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)l[m.severity]!==void 0&&l[m.severity]++;let d=me.filter(m=>l[m]>0),u=Ft(o),f={selected:o===t&&fw(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="${F(f)}" data-select-package="${o}" data-select-package-version="${h}"><span class="packages-dot" style="${we({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"?hw(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 fw(e,t){return e.kind==="single"?!0:e.version===t}function hw(e,t,r){let n=t?"Hide":`+${r} ${r===1?"version":"versions"}`;return c`<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 gw(e,t,r){let n=bt().get(e),s=[...(n?Lf(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>${mw(e,t,r)}`}function Lf(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(P(f))?.triage??null;return r==="invalid"?h==="invalid":r==="deleted"?h==="deleted":h!=="invalid"&&h!=="deleted"});if(d.length===0)continue;let u=Pf(t,i);o.has(u)||o.set(u,[]);let p=o.get(u);for(let f of d)p.push(f)}return o}function mw(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)n[f.severity]!==void 0&&n[f.severity]++;let o=me.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=bt().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=Y[Ke(f)]??Y.default;return c`<li><button type="button" class="packages-detail-report" title="${f}" data-package-report="${f}">${ue(h)}<span class="packages-detail-report-label">${Ne(f)}</span></button></li>`})}</ul><h3 class="packages-detail-section">Files</h3><ul class="packages-detail-files">${s.map(([f,h])=>{let b=Pf(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 Pf(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 et(e){if(!e)return"";let t=e.match(/github\.com\/([^/?#]+\/[^/?#]+?)(?:\.git)?(?:[/?#]|$)/iu);return t?t[1]:e}function Of(){yt().catch(()=>{});let e=fr(),t={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 y=a.triage.get(P(m))?.triage??null;y==="fixed"?t.fixed++:y==="invalid"?t.invalid++:y==="deleted"&&t.deleted++,y===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 kw(o[0],o[1]);let s=a.repositoriesSearchQuery.trim().toLowerCase(),i=s?r.filter(([p])=>p.toLowerCase().includes(s)||et(p).toLowerCase().includes(s)):r.slice();ww(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="${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?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>${bw(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])=>$w(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">${xw(o[0],o[1])}</div></aside>`:g}</div>`}</div>`}function bw(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="${yw}"></triage-selector></div>`}var yw=["fixed","invalid","deleted"];function ww(e,t){let r=t==="name-asc"?(n,o)=>et(n[0]).localeCompare(et(o[0])):t==="files-desc"?(n,o)=>o[1].files.size-n[1].files.size||et(n[0]).localeCompare(et(o[0])):t==="reports-desc"?(n,o)=>o[1].reports.size-n[1].reports.size||et(n[0]).localeCompare(et(o[0])):(n,o)=>o[1].findings.length-n[1].findings.length||et(n[0]).localeCompare(et(o[0]));e.sort(r)}function vw(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(P(n))?.triage??null;o==="invalid"?t.invalid++:o==="deleted"?t.deleted++:t.live++}return t}function kw(e,t){let r=fr().get(e),n=vw(r),o=a.repositorySlideTriage??"live",s=r?Nf(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">${et(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>`:go(s,{kind:"repository",bucketKey:e})}</div></div>`}function $w(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)n[l.severity]!==void 0&&n[l.severity]++;let o=me.filter(l=>n[l]>0),s=Ft(e),i=et(e);return c`<li class="${r?"selected":""}" data-select-repository="${e}"><span class="packages-dot" style="${we({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 xw(e,t){let r=fr().get(e),o=[...(r?Nf(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>${_w(e,t)}`}function Nf(e,t="live"){let r=new Map;for(let[n,o]of e.files){let s=o.filter(i=>{let l=a.triage.get(P(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 _w(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)r[l.severity]!==void 0&&r[l.severity]++;let n=me.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">${et(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=Y[Ke(l)]??Y.default;return c`<li><button type="button" class="packages-detail-report" title="${l}" data-package-report="${l}">${ue(d)}<span class="packages-detail-report-label">${Ne(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 mo=new Map,bo=new Map,Vl=new Set;function Sw(e,t,r){let n=`${e}\0${t}`;if(bo.has(n)||Vl.has(n))return;let o=Ds(t);if(!o){bo.set(n,null);return}Vl.add(n),(async()=>{let s=await Us(r,o);bo.set(n,s??null),Vl.delete(n),a.focusCodeTick++,queueMicrotask(k)})()}async function Cw(e){let t=mo.get(e);if(t&&(t.loading||t.sources))return;let r=(a.bundles??[]).find(n=>n.integrity===e);if(r){mo.set(e,{sources:null,loading:!0,error:null});try{let n=await qs(e,r),o=dt(n);mo.set(e,{sources:o,loading:!1,error:n.error??null})}catch(n){mo.set(e,{sources:null,loading:!1,error:n.message})}a.focusCodeTick++,queueMicrotask(k),queueMicrotask(()=>{let n=E.querySelector(".focus-code-line-active");n&&n.scrollIntoView({block:"center",behavior:"instant"})})}}function Df(e){if(!e)return null;let t=Ae(e);if(!t.fileHash||!Array.isArray(t._bundleHashes)||t._bundleHashes.length===0)return null;let r=new Set(t._bundleHashes),n=hr(t.fileHash).find(({integrity:u})=>r.has(u));if(!n)return null;let o=mo.get(n.integrity);if(!o)return Cw(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;Sw(n.integrity,n.file,s);let i=`${n.integrity}\0${n.file}`,l=bo.has(i)?bo.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 jl=class extends I{static styles=[...I.styles,T(Ie)];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 dp(this.workspaceId,n.identifier);else{let s=await Tn(n.identifier);o=await Ss(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:Ge(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:Ge(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>"${Ge(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>${Ge(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",jl);function Uf({workspaceId:e,items:t}={}){return q("sync-upload-dialog",{workspaceId:e??"",items:Array.isArray(t)?[...t]:[]})}var Kl=class extends I{static styles=[...I.styles,T(Ie)];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 cp(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:Ge(n),reason:d}];continue}await gr(n.identifier,this.workspaceId),t.push({kind:"bundle",identifier:n.identifier});continue}let o=await lp(this.workspaceId,n.identifier);if(!o){r.push({kind:"report",identifier:n.identifier,reason:"not found in remote"}),this._errors=[...this._errors,{label:Ge(n),reason:"not found in remote"}];continue}let s;try{s=ce(await ht(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:Ge(n),reason:l}];continue}let i=Oe(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:Ge(n),reason:l}];continue}await In(n.identifier,o.content),je(n.identifier,i.count,i.source),await At(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:Ge(n),reason:s}]}if(this._running=!1,this._done=!0,t.some(n=>n.kind==="report"))try{a.currentWorkspace===this.workspaceId&&await Qt(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>"${Ge(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>${Ge(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",Kl);function zf({workspaceId:e,items:t}={}){return q("sync-download-dialog",{workspaceId:e??"",items:Array.isArray(t)?[...t]:[]})}function Yl(){let e=_l(a.reports);if(!e)return null;let t=Object.keys(e),n=Bt().filter(p=>be(p).commonTriage===a.shownTriage),o=xl(n),s=Ps(e,o),i=new Map,l=new Map,d=new Map;for(let p of n)for(let f of p){i.has(f.file)||i.set(f.file,new Set),i.get(f.file).add(f.severity);let h=a.triage.get(P(f))?.color??"none";l.has(f.file)||l.set(f.file,new Set),l.get(f.file).add(h),d.has(f.file)||d.set(f.file,[]),d.get(f.file).push({severity:f.severity,color:h})}let u;return A.focusedPkg?(u=t.filter(p=>(Kp(p)??"__own__")===A.focusedPkg),A.showAll||(u=u.filter(p=>Sl(p,o,s)))):u=A.showAll?t:t.filter(p=>Sl(p,o,s)),{prep:{treeData:e,files:u,ownCounts:o,transitiveCounts:s,severitySets:i,colorSets:l,fileFindings:d},findingCounts:o}}function Jl(){let e=en();if(!e)return;let t=Yl();t&&e.refreshSidebar(t.prep,{isBundleContext:a.currentView==="bundles"})}function Xl(){let e=en();if(!e)return;let t=Yl();t&&e.refreshTopPkgs(t.prep)}var Ew={"claude-security":"Claude Security findings","codex-security":"Codex Security findings",deepsec:"DeepSec findings"};function Aw(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 ql=["type","model","effort","exportsMode"];function Wf(e,t){return e==="type"?`analyzer: ${t??"null"}`:t??null}function Tw(e,t=ql){let r=new Map;for(let p of e){let f={};for(let b of t)f[b]=b==="model"?gl(p.model)??null:p[b]??null;let h=t.map(b=>f[b]??"").join("|");r.has(h)||r.set(h,f)}let n=[...r.values()];if(n.length===0)return[];let o={};for(let p of t)o[p]=new Set(n.map(f=>f[p])).size===1;let s=t.filter(p=>!o[p]),i=["model","effort"].filter(p=>t.includes(p)&&o[p]),l=[...i,...t.filter(p=>!i.includes(p))],d=[],u=!1;for(let p of l)if(o[p]){let f=Wf(p,n[0][p]);f!=null&&d.push(f)}else if(!u){for(let f of n){let h=s.map(b=>Wf(b,f[b])).filter(b=>b!=null);h.length>0&&d.push(h.join(" \xB7 "))}u=!0}return d}function Iw(e,t,r,n,o){let s=new Set(a.reports.map(K=>K.source)),i=s.size===1?[...s][0]:null,l=a.currentWorkspace?z().find(K=>K.id===a.currentWorkspace):null,d=l?`Workspace: ${l.name}`:i?Ew[i]:"Findings",u=i&&Y[i]?i:"default",p=ue(Y[u]),f=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>`,h=g;t.length===1?h=c`<span class="file-chip">${p}<span>${t[0]}</span></span>`:t.length>1&&(h=c`<span class="file-chip">${f}<span>${t.length} reports</span></span>`);let b=a.reports.flatMap(K=>K.groups.flat()),y=`${e} ${`finding${e===1?"":"s"}`}`,w=i||a.currentWorkspace?ql.filter(K=>K!=="type"):ql,v=Tw(b,w),S=g;if(e>0){let K={};for(let Re of Bt()){let rt=Ue(Re).severity;rt&&(K[rt]=(K[rt]||0)+1)}let tr=me.filter(Re=>K[Re]>0);tr.length>0&&(S=c`<span class="status-bar" aria-hidden="true">${tr.map(Re=>{let rt=`${K[Re]} ${Re.replaceAll("_"," ")}`;return c`<span class="${`status-seg sev-${Re}`}" style="${we({flexGrow:K[Re]})}" title="${rt}"></span>`})}</span>`)}let C=Aw(r,n),R=c`<span class="sep" aria-hidden="true"></span>`,O=a.currentView==="files",ye=(o??0)>1?c`<button type="button" class="${F({"files-toggle-btn":!0,active:O})}" data-action="toggle-files" title="${O?"exit files view":"show files"}" aria-pressed="${String(O)}">${`Files: ${o}`}</button>`:g;return c`<header class="page-head"><div class="page-title"><h1>${d}${h}${C}${ye}${Rw()}</h1><div class="meta-row"><span>${y}</span> ${S} ${v.length>0?c`${R}${v.map(K=>c`<span class="tag">${K}</span>`)}`:g}</div></div></header>`}function Rw(){if(D.status!=="online")return g;if(a.currentView!=="findings"&&a.currentView!=="files")return g;let e=Mw();if(!e)return g;let{workspaceId:t,fileNames:r,mode:n}=e;if(n==="single"){let C=r[0],R=dl(t,C)?"cloud":"local";return Bw({status:R,label:R,title:R==="cloud"?"Synced to remote":"Local only \u2014 click to upload",onClick:R==="local"?()=>Hf({workspaceId:t,items:[{kind:"report",identifier:C}]}):null})}let o=z().find(C=>C.id===t),s=o&&Array.isArray(o.bundles)?o.bundles:[],i=ep(t),l=r.filter(C=>!dl(t,C)),d=s.filter(C=>!Qu(t,C)),u=[...l.map(C=>({kind:"report",identifier:C})),...d.map(C=>({kind:"bundle",identifier:C}))],p=r.length-l.length,f=s.length-d.length,h=p+f,b=Math.max(0,i-h);if(i===0&&u.length===0)return g;let m=b>0,y=u.length>0,$=[i>0?`${i} in cloud`:null,u.length>0?`${u.length} local-only`:null,b>0?`click "cloud" to download ${b}`:null,u.length>0?`click "local" to upload ${u.length}`:null].filter(Boolean).join(" \u2014 "),w=i===0?g:m?c`<button type="button" class="sync-badge-chunk cloud" aria-label="${`${b} remote items not yet downloaded \u2014 open download dialog`}" @click="${C=>{C.stopPropagation(),Fw({workspaceId:t,localFileNames:r,localBundles:s})}}">${Gl()}<span>${i} cloud</span></button>`:c`<span class="sync-badge-chunk cloud" aria-label="${`${i} items in remote`}">${Gl()}<span>${i} cloud</span></span>`,v=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="${C=>{C.stopPropagation(),Hf({workspaceId:t,items:u})}}">${Gf()}<span>${u.length} local</span></button>`,S=i>0&&u.length>0?c`<span class="sync-badge-divider" aria-hidden="true"></span>`:g;return c`<div class="${`report-sync-badge${m||y?" report-sync-badge-clickable":""}`}" data-status="mixed" title="${$}">${w}${S}${v}</div>`}function Bw({status:e,label:t,title:r,onClick:n}){let o=e==="cloud"?Gl():Gf(),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 Gf(){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 Gl(){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 Hf({workspaceId:e,items:t}){let r=t.filter(n=>n.kind==="bundle");if(r.length>0){let n=await lt(),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 Uf({workspaceId:e,items:t})}async function Fw({workspaceId:e,localFileNames:t,localBundles:r}){let[n,o]=await Promise.all([up(e),pp(e)]),s=new Set(t),i=new Set(r),l=[...n.filter(d=>!s.has(d)).map(d=>({kind:"report",identifier:d})),...o.filter(d=>!i.has(d)).map(d=>{let u=tp(e,d);return u?{kind:"bundle",identifier:d,label:u}:{kind:"bundle",identifier:d}})];await zf({workspaceId:e,items:l})}function Mw(){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=z().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 Lw(e){return Object.values(e).some(r=>r>0)||a.filterSeverities.size>0?c`<severity-chips .counts="${e}"></severity-chips>`:g}function Pw(e){return Object.values(e).some(r=>r>0)||a.filterColors.size>0?c`<triage-filter .counts="${e}"></triage-filter>`:g}function Ow(e,t,r,n,o,s,i,l){let{showSource:d,showConfidence:u,showPriority:p,showGraphMode:f,showFileSort:h,kanbanMode:b,showRepo:m}=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} ${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">${Lw(n)} ${i.length>1?c`<analyzer-select .options="${i}"></analyzer-select>`:g} ${m&&l.length>1?c`<repo-filter .options="${l}"></repo-filter>`:g} ${Pw(o)}<div class="search-row"><toolbar-search kind="findings"></toolbar-search><span class="result-count">${e} of ${t}</span></div></div></div>`}var yo=null,Vf=0,Zt=null,ei=new Map;function wo(e,t=!1,r=null){let n=Zr(e);return ei.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 Nw={critical:"C",high:"H",medium:"M",low:"L",high_bug:"H",bug:"B",informational:"i"};function jf(e,t={}){let{variant:r="kanban",active:n=!1}=t,o=be(e),s=Ae(e),i=$l(Ze(s.description,s))||"(untitled finding)",l=r==="kanban",d={"kanban-card":!0,"has-conflict":o.hasConflict,"focus-side-card":!l,active:!l&&n};!o.hasConflict&&o.commonColor&&(d[`mark-${o.commonColor}`]=!0);let u=parseInt(s.line,10),p=Number.isFinite(u)?`:${u}`:"",f=Nw[s.severity]??"?",h=c`<span class="${`kanban-badge sev-${s.severity}`}" title="${Qr(s.severity)}" aria-label="${Qr(s.severity)}">${f}</span> <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="${F(d)}" data-gid="${Ee(e)}" data-kanban-source draggable="true" role="button" tabindex="0" aria-label="${`Open details for ${i}`}">${h}</div>`:c`<div class="${F(d)}" data-gid="${Ee(e)}" data-focus-select role="button" tabindex="0" aria-current="${n?"true":"false"}" aria-label="${`Focus on ${i}`}">${h}</div>`}function Dw(e){let{content:t,line:r,highlighted:n}=e,o=t.split(`
47
- `).length,s=String(o).length;return c`<div class="focus-code-lines" style="${we({"--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="${F({"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"?ue(n):t}</code></pre></div>`}function Uw(e){if(!e)return g;let t=be(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="${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">${wo(e)}</div></div></div>`}function zw(e){if(a.viewMode==="table"){let r=a.sortBy==="file"?[...e].toSorted((s,i)=>{let l=Ue(s),d=Ue(i);return l.file.localeCompare(d.file)||parseInt(l.line,10)-parseInt(d.line,10)}):e;if(r.length===0)return g;let n=a.tableSelectedGid?r.find(s=>Ee(s)===a.tableSelectedGid):null;return yo=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">${wo(n)}</div></aside>`:g}</div>`}if(a.viewMode==="focus"){if(e.length===0)return g;let r=a.focusGid?e.findIndex(d=>Ee(d)===a.focusGid):-1;r<0&&(r=Math.min(Vf,e.length-1),r<0&&(r=0)),Vf=r;let n=e[r];a.focusCodeTick;let o=Df(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">${wo(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">${Dw(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=>Ee(d),d=>jf(d,{variant:"focus",active:Ee(d)===Ee(n)}))}</div></aside></div>`}if(a.viewMode==="kanban"){let r=[{key:"untriaged",label:"Untriaged",target:"untriaged"},{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=be(s).commonTriage??"untriaged",d=n.get(l);d&&d.push(s)}let o=a.kanbanPopoverGid?e.find(s=>Ee(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=>Ee(l),l=>jf(l))}</div></div>`})}</div>${Uw(o)}`}if(a.viewMode==="grouped"){let r=new Map;for(let o of e){let s=Ue(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"?r.get(o).toSorted((l,d)=>parseInt(Ue(l).line,10)-parseInt(Ue(d).line,10)):r.get(o),i=Ue(s[0]);return c`<div class="file-group"><div class="file-header"><span>${ml(o,i?.repo?.github,i?._repoFallback??a.repoUrl)}</span> <span class="count">${s.length}</span></div><div class="file-body">${J(s,l=>Zr(l),l=>wo(l))}</div></div>`})}`}let t=a.sortBy==="file"?[...e].toSorted((r,n)=>{let o=Ue(r),s=Ue(n);return o.file.localeCompare(s.file)||parseInt(o.line,10)-parseInt(s.line,10)}):e;return c`${J(t,r=>Zr(r),r=>{let n=Ae(r),o=_p(n.file,n.line,n.repo?.github,n._repoFallback??a.repoUrl),s=br(n),i=mr(n),l=r.length>1;return c`<div class="${F({"flat-group":!0,"multi-case":l})}"><div class="flat-group-loc"><span class="file">${ml(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>${wo(r,!0)}</div>`})}`}function Ww(){let e=document.querySelector("#bundle-source-overlay-slot");e&&W(If(),e)}var Kf=null;function k(){let e=Kf;if(Kf=a.currentView,e!==null&&e!==a.currentView&&typeof document.startViewTransition=="function"&&!matchMedia("(prefers-reduced-motion: reduce)").matches){document.startViewTransition(()=>qf());return}qf()}function qf(){if(Ww(),kp(a.reports),a.currentView==="bundles")if((a.bundles??[]).length===0)a.currentView="findings";else{let x=document.querySelector("#bundles-slot");if((!x||!E.contains(x)||E.firstElementChild!==x)&&(E.innerHTML='<div id="bundles-slot"></div>',x=document.querySelector("#bundles-slot")),x&&W(Ff(a.bundles),x),a.selectedBundle&&a.bundleDetailsTab==="graph"&&a.bundleDetails&&(a.bundleDetails.json||a.bundleDetails.bundle)){let B=document.querySelector("#bundle-graph-slot");if(B){let fe=Cf(a.bundleDetails);if(fe){Ef(fe);let _e=!fe.hasEdges,bi=Sf(a.bundleDetails);Cl(B,fe,{hideAllFiles:_e,triageCounts:bi,triageStates:["fixed","invalid","deleted"]},Qs,Zs)}}}if(a.selectedBundle&&a.bundleDetailsTab==="terminal"&&a.bundleDetails&&(a.bundleDetails.json||a.bundleDetails.bundle)){let B=document.querySelector("#bundle-terminal-slot");B&&Vp(B,a.bundleDetails)}E.classList.add("active"),Ce.classList.add("hidden"),document.title="DeepView \u2014 bundles";return}if(a.currentView==="packages"){let x=document.querySelector("#packages-slot");(!x||!E.contains(x)||E.firstElementChild!==x)&&(E.innerHTML='<div id="packages-slot"></div>',x=document.querySelector("#packages-slot")),x&&W(Mf(),x),E.classList.add("active"),Ce.classList.add("hidden"),document.title="DeepView \u2014 packages";return}if(a.currentView==="repositories"){let x=document.querySelector("#repositories-slot");(!x||!E.contains(x)||E.firstElementChild!==x)&&(E.innerHTML='<div id="repositories-slot"></div>',x=document.querySelector("#repositories-slot")),x&&W(Of(),x),E.classList.add("active"),Ce.classList.add("hidden"),document.title="DeepView \u2014 repositories";return}if(a.reports.length===0)return;let e=Bt(),t={fixed:0,invalid:0,deleted:0,ignored:0};for(let x of e){let B=be(x).commonTriage;B&&t[B]++}let r=a.viewMode==="kanban",n=r?e:e.filter(x=>be(x).commonTriage===a.shownTriage),s=[...new Set(a.reports.map(x=>x.type))].join(", "),i=a.reports.map(x=>x.fileName),l={critical:0,high:0,medium:0,low:0,high_bug:0,bug:0,informational:0},d={red:0,blue:0,green:0,gray:0,none:0};for(let x of n){let B=new Set(x.map(_e=>_e.severity));for(let _e of B)l[_e]=(l[_e]||0)+1;let fe=new Set(x.map(_e=>a.triage.get(P(_e))?.color??"none"));for(let _e of fe)d[_e]=(d[_e]||0)+1}let u=n.length>0&&n.every(x=>x.every(B=>B.confidence!==void 0||B.critical===!0)),p=e.some(x=>x.some(B=>B.priority!==void 0)),f=e.some(x=>x.some(B=>Gt(B.file))),h=new Set;for(let x of e)for(let B of x)h.add(B.file);let b=h.size>1,m=e.some(x=>x.some(B=>!B.repo?.github&&!Gt(B.file))),y=new Set;for(let x of e)for(let B of x)!Gt(B.file)&&B.repo?.github&&y.add(B.repo.github);let $=y.size===1?[...y][0]:null,w=new Set;for(let x of e)for(let B of x)w.add(B._analyzer??null);let v=Object.keys(vl),S=[...w].toSorted((x,B)=>{let fe=x==null?1/0:v.indexOf(x)===-1?v.length:v.indexOf(x),_e=B==null?1/0:v.indexOf(B)===-1?v.length:v.indexOf(B);return fe!==_e?fe-_e:String(x??"").localeCompare(String(B??""))});if(a.filterAnalyzer){let x=a.filterAnalyzer===oo?null:a.filterAnalyzer;w.has(x)||(a.filterAnalyzer="")}let C=new Set;for(let x of e)for(let B of x)C.add(yl(B));let R=[...C].toSorted((x,B)=>x==null&&B==null?0:x==null?1:B==null?-1:x.localeCompare(B));if(a.filterRepo){let x=a.filterRepo===so?null:a.filterRepo;C.has(x)||(a.filterRepo="")}!f&&a.filterSources.size>0&&a.filterSources.clear(),u||(a.filterConfMin=0,a.filterConfMax=10,(a.sortBy==="confidence-desc"||a.sortBy==="confidence-asc")&&(a.sortBy="severity")),!p&&(a.sortBy==="priority-desc"||a.sortBy==="priority-asc")&&(a.sortBy="severity"),!b&&a.sortBy==="file"&&(a.sortBy="severity");let O=Ip(Ap(n)),ye=_l(a.reports),K=ye?Object.keys(ye).length:0,tr=K>1;!tr&&a.currentView==="files"&&(a.currentView="findings"),!tr&&a.viewMode==="graph"&&(a.viewMode="table");let Re=Iw(e.length,i,m,$,K);if(a.currentView==="files"){let x=xl(e),B=document.querySelector("#header-slot"),fe=document.querySelector("#tree-view-slot");(!B||!fe||!E.contains(B)||!E.contains(fe))&&(E.innerHTML='<div id="header-slot"></div><div id="tree-view-slot"></div>',B=document.querySelector("#header-slot"),fe=document.querySelector("#tree-view-slot")),B&&W(Re,B),fe&&W(zp(ye,x),fe),E.classList.add("active"),Ce.classList.add("hidden"),document.title=`DeepView \u2014 ${s||"no analyzer"}`;return}let rt=a.viewMode==="table"&&a.tableSelectedGid&&O.some(x=>Ee(x)===a.tableSelectedGid),Cr=null;a.viewMode==="graph"&&ye&&(Cr=Yl(),Cr||(a.viewMode="table"));let Mt=!!Cr,ut="findings-content";rt&&(ut+=" with-details"),Mt&&(ut+=" with-graph"),r&&(ut+=" with-kanban"),a.viewMode==="focus"&&(ut+=" with-focus");let _=g,j=g,Z=g;Mt||(_=Ow(O.length,n.length,t,l,d,{showSource:f,showConfidence:u,showPriority:p,showGraphMode:tr,showFileSort:b,kanbanMode:r,showRepo:!!a.currentWorkspace},S,R),a.shownTriage&&n.length===0?j=c`<p style="color:var(--muted);margin:1rem 0">No ${a.shownTriage} findings.</p>`:O.length===0&&n.length>0?j=c`<p style="color:var(--muted);margin:1rem 0">No findings match the current filters.</p>`:n.length===0&&(j=e.length>0?c`<p style="color:var(--green)">All ${s} issues triaged.</p>`:c`<p style="color:var(--green)">No ${s} issues found.</p>`),yo=null,ei.clear(),Z=zw(O));let ie=!!(Zt&&Zt.isConnected);ie&&Zt.remove();let pe=document.querySelector("#header-slot"),te=E.querySelector(":scope > .findings-content"),We=te&&te.querySelector(":scope > #findings-graph-slot"),Ye=te&&te.querySelector(":scope > #findings-body-slot"),gg=te&&(We?"graph":Ye?"body":null)===(Mt?"graph":"body");if(!pe||!te||!E.contains(pe)||!E.contains(te)||!gg){let x=Mt?'<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="${ut}">${x}</div>`,pe=document.querySelector("#header-slot"),te=E.querySelector(":scope > .findings-content")}else te.className!==ut&&(te.className=ut);pe&&W(Re,pe);let rd=document.querySelector("#toolbar-slot");rd&&W(_,rd);let nd=document.querySelector("#empty-state-slot");nd&&W(j,nd);let dn=document.querySelector("#findings-body-slot");if(dn&&(yo||ie)){let x=document.createElement("div");x.id="findings-body-slot",dn.replaceWith(x),dn=x}if(dn&&W(Z,dn),Cr){let x=document.querySelector("#findings-graph-slot");if(x){let B=c`<view-mode-buttons modes="table,list,grouped,focus,kanban,graph"></view-mode-buttons>`,fe={fixed:0,invalid:0,deleted:0,ignored:0};for(let bi of Bt()){let yi=be(bi).commonTriage;yi&&fe[yi]++}let _e={extraTopRow:B,triageCounts:fe,triageStates:["fixed","invalid","deleted","ignored"]};Cl(x,Cr.prep,_e,Jl,Xl)}}if(yo){let x=E.querySelector(".finding-table-slot");x&&(Zt||(Zt=document.createElement("finding-table")),Zt.items=yo,Zt.selectedGid=a.tableSelectedGid,x.replaceWith(Zt))}if(ei.size>0)for(let x of E.querySelectorAll("finding-card")){let B=ei.get(x.dataset.gid);B&&(x.group=B.group)}E.classList.add("active"),Ce.classList.add("hidden"),document.title=`DeepView \u2014 ${s||"no analyzer"}`}var Ql=class extends I{static styles=[...I.styles,T(Qe)];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 rl(this.workspace,{password:this._noPassword?void 0:this._password,includeBundleBytes:this._includeBundleBytes});if(this._settled)return;Rr(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",Ql);function Yf({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(ft(o.detail?.cause))}),document.body.append(n)})}async function Jf(e){await Yf({workspace:e})}var Zl=class extends I{static properties={_value:{state:!0}};constructor(){super(),this._value=""}_onInput=t=>{this._value=t.target.value};_onCreate=()=>{let t=(this._value??"").trim();t&&this._finish(t)};_onCancel=()=>this._finish(null);_onKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._onCreate())};render(){let t=(this._value??"").trim().length>0;return 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",Zl);function Xf(){return q("new-workspace-dialog")}var ec=class extends I{static styles=[...I.styles,T(Ie)];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",ec);function Qf({name:e,reportCount:t,bundleCount:r,triageImpact:n}={}){return q("leave-workspace-dialog",{workspaceName:e??"",reportCount:t??0,bundleCount:r??0,orphanedTriage:n?.orphanedCount??0,sharedTriage:n?.sharedCount??0})}var tc=class extends I{static styles=[...I.styles,T(Qe)];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 sl({id:this.workspaceId,name:this._name.trim(),privateKeyBase64:this.privateKeyBase64,password:this._password});if(this._settled)return;this._url=al(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 are not included. 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",tc);function Zf({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(ft(i.detail?.cause))}),document.body.append(s)})}var rc=class extends I{static styles=[...I.styles,T(Ie)];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",rc);function eh({name:e,triageImpact:t,inRemote:r}={}){return q("delete-report-dialog",{reportName:e??"",orphanedTriage:t?.orphanedCount??0,sharedTriage:t?.sharedCount??0,inRemote:!!r})}var nc=class extends I{static styles=[...I.styles,T(Ie)];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",nc);function th({name:e,inRemote:t}={}){return q("delete-bundle-dialog",{bundleName:e??"",inRemote:!!t})}var oc=class extends I{static styles=[...I.styles,T(Ie)];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",oc);function rh({name:e,workspaceName:t}={}){return q("detach-bundle-dialog",{bundleName:e??"",workspaceName:t??""})}var sc=class extends I{static styles=[...I.styles,T(Ie)];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",sc);function nh({name:e,workspaceName:t}={}){return q("detach-report-dialog",{reportName:e??"",workspaceName:t??""})}var ic=class extends I{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",ic);function oh(){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 er;function Hw(){return er||(er=document.createElement("div"),er.id="styled-tooltip",document.body.append(er),er)}var $r=null,vo=null,lh=0,ch=0,sh=!1;function Vw(){sh||(sh=!0,document.addEventListener("mousemove",e=>{lh=e.clientX,ch=e.clientY},{passive:!0}))}Vw();var jw=100,Kw=14,qw=8,ih=8;function Gw(e,{placement:t="cursor"}={}){let r=Hw();if($r===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+qw)}px`,r.style.transform="translateY(-50%)"}else{r.style.transform="none",r.style.top=`${ch+Kw}px`,r.style.left="0px",r.classList.add("visible");let o=r.offsetWidth,s=window.innerWidth-o-ih,i=Math.max(ih,Math.min(lh,s));r.style.left=`${Math.round(i)}px`}r.classList.add("visible"),$r=e}}function ko(){clearTimeout(vo),vo=null,er&&er.classList.remove("visible"),$r=null}function ac(e,{gate:t,placement:r}={}){t&&!t(e)||(clearTimeout(vo),vo=setTimeout(()=>{Gw(e,{placement:r})},jw))}var ah=!1;function dh(){ah||(ah=!0,document.body.addEventListener("mouseover",e=>{let t=e.target.closest("[data-tooltip]");!t||t===$r||(ko(),ac(t))}),document.body.addEventListener("mouseout",e=>{!$r&&!vo||$r&&$r.contains(e.relatedTarget)||ko()}))}var ri=null,se=null,ti=null;dh();function Yw(){return bt().size}function Jw(){return fr().size}var $o=typeof location>"u"||location.hostname.endsWith(".github.io")?"":`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/api/sync`,pc="application/x-deepview-report",cc="application/x-deepview-source-ws",xo="application/x-deepview-bundle",ni=!1,oi=!1,Xw={default:"Reports","claude-security":"Claude Security","codex-security":"Codex Security",deepsec:"DeepSec"},uh=["default","claude-security","codex-security","deepsec"],xr="";function ph(e,t={}){let n=`file-item${e===a.currentFile&&(a.currentView==="findings"||a.currentView==="files")?" current":""}${t.indented?" indented":""}`,o=Ne(e),s=Nn(e),i=Y[Ke(e)]??Y.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}">${ue(i)}<span class="file-label">${o}</span>${s===void 0?g:c`<span class="file-count">${s}</span>`}</button></li>`}function Qw(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 Zw=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 ev(){return c`<li class="file-group-header workspace-header"><span class="group-label">Workspaces</span><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">${Zw}</button></span></li>`}function tv(){return c`<li class="file-group-header bundles-header" data-default-bundles="true"><span class="group-label">Bundles</span></li>`}var rv=c`${ue(tn)}`;function fh(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}
48
- ${r}`}">${rv}<span class="file-label">${n}</span></button></li>`}function nv(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 ov(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 · ${Ne(e)}</em></span></span></li>`}var sv=c`${ue(Os)}`,iv=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>`,av=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>`,lv=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 cv(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">${sv}<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">${lv}</button><button type="button" class="workspace-export" data-action="export-workspace" title="Export workspace" aria-label="Export workspace">${iv}</button><button type="button" class="workspace-leave" data-action="leave-workspace" title="Leave workspace" aria-label="Leave workspace">${av}</button></li>`}function ln(e){return xr?Ne(e).toLowerCase().includes(xr):!0}async function V(){await Ya(),yt().catch(()=>{});let e=await le(),t=z(),r=await lt();if(a.bundles=r,!se)return;ri.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 uh)l.set(h,[]);for(let h of e){if(o.has(h)||!ln(h))continue;let b=Ke(h);l.has(b)||l.set(b,[]),l.get(b).push(h)}let d=t.filter(h=>!xr||h.name.toLowerCase().includes(xr)||h.reports.some(b=>ln(b))?!0:h.bundles.some(b=>{let m=s.get(b);return m&&ln(m.name)})),u=r.filter(h=>!i.has(h.integrity)&&ln(h.name));W(c`${ev()} ${J(d,h=>h.id,h=>{let b=[],m=[];for(let w of h.reports)ln(w)&&(n.has(w)?b.push(w):m.push(w));let y=[],$=[];for(let w of h.bundles){let v=s.get(w);v?(!xr||ln(v.name))&&y.push(v):xr||$.push(w)}return c`${cv(h)} ${b.map(w=>ph(w,{indented:!0,workspaceId:h.id}))} ${m.map(w=>ov(w,h.id))} ${y.map(w=>fh(w,{workspaceId:h.id}))} ${$.map(w=>nv(w,h.id))}`})} ${uh.map(h=>{let b=l.get(h)??[],m=h==="default";return b.length===0&&!(m&&ni)?null:c`${Qw(Xw[h]??h,{dropTarget:m})} ${b.map(y=>ph(y))}`})} ${u.length>0||oi?tv():null} ${J(u,h=>h.integrity,h=>fh(h))}`,ti);let p=se.querySelector('sidebar-view-button[kind="packages"]');p&&(p.count=Yw());let f=se.querySelector('sidebar-view-button[kind="repositories"]');f&&(f.count=Jw()),si(),_a(e,()=>{V()})}ge(()=>{V()});async function dv(e){if(e.target.closest('[data-action="go-home"]')){await hf();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.bundleDetailsTab="overview",A.showAll=!0,a.shownTriage=null,an(d),k(),V(),Jt(d);return}let r=e.target.closest("sidebar-view-button");if(r){let d=r.getAttribute("kind");(d==="packages"||d==="repositories")&&(a.currentView=d,k(),V());return}if(e.target.closest('[data-action="new-workspace"]')){let d=await Xf();d&&(await Pl(),await Oa(d),V());return}let n=e.target.closest('[data-action="share-workspace"]');if(n){let d=n.closest("[data-workspace-id]"),u=d?z().find(p=>p.id===d.dataset.workspaceId):null;u&&Zf({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?z().find(p=>p.id===d.dataset.workspaceId):null;u&&Jf(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?z().find(y=>y.id===d.dataset.workspaceId):null;if(!u)return;let p=Array.isArray(u.reports)?u.reports:[],f;try{f=await ys(p)}catch(y){alert(`Couldn't read reports to analyze triage impact: ${y.message}`);return}let{confirmed:h,mode:b,triage:m}=await Qf({name:u.name,reportCount:p.length,bundleCount:u.bundles.length,triageImpact:f});if(!h)return;if(!z().some(y=>y.id===u.id)){alert(`Workspace "${u.name}" was removed elsewhere; nothing to leave.`);return}try{await mf(u.id,b,{triage:m})}catch(y){alert(`Failed to leave workspace: ${y.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)&&Qt(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")&&_t(d);return}if(e.target.closest("sidebar-delete-current")){if(a.currentView==="bundles"&&a.selectedBundle){let m=a.selectedBundle,y=(a.bundles??[]).find(v=>v.integrity===m)?.name??m,$=z().filter(v=>Array.isArray(v.bundles)&&v.bundles.includes(m)).filter(v=>ul(v.id,m)).map(v=>v.id),{confirmed:w}=await th({name:y,inRemote:$.length>0});if(!w)return;if(a.selectedBundle!==m){alert(`Active bundle changed during confirmation; aborting delete of "${y}".`);return}try{await gf({deleteFromRemoteWorkspaceIds:$})}catch(v){alert(`Failed to delete bundle: ${v.message}`)}return}if(!a.currentFile)return;let d=a.currentFile,u;try{u=await ys([d])}catch(m){alert(`Couldn't read reports to analyze triage impact: ${m.message}`);return}let p=z().filter(m=>Array.isArray(m.reports)&&m.reports.includes(d)).filter(m=>Zn(m.id,d)).map(m=>m.id),f=p.length>0,{confirmed:h,triage:b}=await eh({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 ff({triage:b,deleteFromRemoteWorkspaceIds:p})}catch(m){alert(`Failed to delete report: ${m.message}`)}return}if(e.target.closest("#sync-status")){D.status==="error"?D.dismissError():D.status==="off"?(!D.getServerUrl()&&$o&&D.setServerUrl($o),D.setEnabled(!0)):D.setEnabled(!1);return}if(e.target.closest("#sidebar-toggle")){ri.classList.toggle("collapsed");try{localStorage.setItem("deepview.sidebarCollapsed",ri.classList.contains("collapsed")?"1":"0")}catch{}}}function uv(e){let t=e.target.closest("[data-tooltip]");if(!t){ko();return}ac(t,{placement:"right",gate:r=>{let n=r.querySelector(".file-label");return!n||(r.dataset.tooltip??"")!==n.textContent?!0:n.scrollWidth>n.clientWidth}})}function pv(e){let t=e.target.closest("[data-tooltip]"),r=e.relatedTarget?.closest?.("[data-tooltip]")??null;t&&t===r||ko()}function fv(e){xr=e.target.value.trim().toLowerCase(),V()}var hv={off:"Sync off",online:"Online",offline:"Offline",connecting:"Connecting\u2026",error:"Sync error"};function gv(){return D.getServerUrl()||$o?z().length>0:!1}function si(e){let t=se?.querySelector("#sync-status");if(!t)return;let r=gv();if(r&&D.isEnabled()&&Ju().catch(i=>{console.warn("sync: load failed",i)}),r&&!D.getServerUrl()&&$o&&D.isEnabled()&&D.setServerUrl($o),D.setForcedOff(!r),!r){t.hidden=!0;return}t.hidden=!1;let n=e??D.status;t.dataset.status=n;let o=D.persistenceDegraded;t.toggleAttribute("data-degraded",o),t.title=o?"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.":"";let s=t.querySelector(".sync-label");s&&(s.textContent=hv[n]??"")}D.onStatusChange(si);var lc=!1,dc=!1;async function hh(){if(!D.persistenceDegraded||dc||lc)return;lc=!0;let{shown:e}=await oh();if(lc=!1,e){dc=!0;return}D.persistenceDegraded&&setTimeout(hh,1500)}D.onPersistenceDegraded(e=>{si(),e?hh():dc=!1});function mv(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=z().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 Da(n,s.value),V())};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 ii(){for(let e of se.querySelectorAll(".drag-over"))e.classList.remove("drag-over")}function gh(e){return e.dataTransfer.types.includes(pc)||e.dataTransfer.types.includes(xo)}function bv(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(xo,n),e.dataTransfer.setData(cc,t.dataset.workspaceId??""),e.dataTransfer.setData("text/plain",n),t.classList.add("dragging"),oi=!0,V();return}let r=e.target.closest(".file-item[data-file]");r&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData(pc,r.dataset.file),e.dataTransfer.setData(cc,r.dataset.workspaceId??""),e.dataTransfer.setData("text/plain",r.dataset.file),r.classList.add("dragging"),ni=!0,V())}function yv(){for(let e of se.querySelectorAll(".dragging"))e.classList.remove("dragging");ii(),(ni||oi)&&(ni=!1,oi=!1,V())}function wv(e){if(!gh(e))return;e.preventDefault();let t=e.target.closest("[data-workspace-id]"),r=se.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",ii(),!s)if(t){let i=t.dataset.workspaceId;for(let l of se.querySelectorAll(`[data-workspace-id="${CSS.escape(i)}"]`))l.classList.contains("dragging")||l.classList.add("drag-over")}else{let l=e.dataTransfer.types.includes(xo)?"[data-default-bundles]":"[data-default-reports]",d=se.querySelector(l);d&&d.classList.add("drag-over")}}function vv(e){se.contains(e.relatedTarget)||ii()}async function kv(e){if(!gh(e))return;e.preventDefault(),e.stopPropagation(),ii();let t=e.target.closest("[data-workspace-id]"),r=t?t.dataset.workspaceId:null,n=e.dataTransfer.getData(cc)||null;if(e.dataTransfer.types.includes(xo)){let s=e.dataTransfer.getData(xo);if(!s)return;if(n&&n!==r&&ul(n,s)){let i=(a.bundles??[]).find(u=>u.integrity===s)?.name??s,l=z().find(u=>u.id===n),{confirmed:d}=await rh({name:i,workspaceName:l?.name??""});if(!d)return;try{await Es(n,s)}catch(u){console.warn(`Failed to remove '${i}' from source workspace ${n} remote:`,u)}}r&&await gr(s,r),n&&n!==r&&await Va(s,n),V();return}let o=e.dataTransfer.getData(pc);if(o){if(n&&n!==r&&Zn(n,o)){let s=z().find(l=>l.id===n),{confirmed:i}=await nh({name:o,workspaceName:s?.name??""});if(!i)return;try{await Cs(n,o)}catch(l){console.warn(`Failed to remove '${o}' from source workspace ${n} remote:`,l)}}r&&await At(o,r),n&&n!==r&&await jn(o,n),V()}}function $v(e){ri=e,se=e.renderRoot,ti=se.querySelector("#file-list"),yp(se.querySelector("#encryption-toggle")),se.addEventListener("click",dv),se.addEventListener("dblclick",mv),se.addEventListener("dragstart",bv),se.addEventListener("dragend",yv),se.addEventListener("dragover",wv),se.addEventListener("dragleave",vv),se.addEventListener("drop",kv),ti.addEventListener("mouseover",uv),ti.addEventListener("mouseout",pv),se.querySelector("#sidebar-search-input")?.addEventListener("input",fv),si(D.status),V()}var uc=class extends H{static styles=[T(hp),T(fp)];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><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></div>`}firstUpdated(){$v(this)}};customElements.define("app-sidebar",uc);var mh={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 \u2014 cancelling keeps your local value (which will then propagate back to the chain on your next save).",importedSideLabel:"Apply from chain",applyButton:"Apply"}};function bh(){ap(async(e,t,r)=>{let n=Ca(e);try{return await Gs(e,n,mh[r]??mh.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 fc=class extends I{static properties={retry:{type:Boolean},_value:{state:!0}};constructor(){super(),this.retry=!1,this._value=""}_finish(t){this._value="",super._finish(t)}_onCancel=()=>this._finish(null);_onInput=t=>{this._value=t.target.value};_onSubmit=()=>{let t=this._value??"";t&&this._finish(t)};_onKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._onSubmit())};render(){let t=(this._value??"").length>0,r=this.retry?"That password didn't match. Try again, or cancel to leave the workspace unsynced for now.":"This sync server requires a password before it accepts a new workspace. Enter it to create the workspace on the server.";return 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",fc);function yh({retry:e=!1}={}){return q("sync-auth-dialog",{retry:!!e})}function wh(){ip(async({retry:e})=>{try{return await yh({retry:e})}catch(t){return console.warn("Sync auth dialog failed to open:",t),null}})}var ai="https://triage.space/",xv=[{hostname:"deepaudit.dev",pathPrefix:"/",supportsSync:!0},{hostname:"chalker.github.io",pathPrefix:"/deepview/",supportsSync:!1}];function _v(){for(let e of xv)if(location.hostname===e.hostname&&location.pathname.startsWith(e.pathPrefix))return e;return null}var Sv=["deepview.triage","deepview.triage.pending"],Cv="deepview.repoUrls";function Ev(){try{for(let e of Sv)if(localStorage.getItem(e))return!0}catch{return!0}try{let e=localStorage.getItem(Cv);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 Av(){if(Ev())return!0;let e=[];try{e=await le()}catch{return!0}if(e.length>0)return!0;try{if(z().length>0)return!0}catch{return!0}try{return await sa()}catch{return!0}}var hc=class extends H{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="${ai}" target="_blank" rel="noopener noreferrer">${ai}</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",hc);function Tv(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 vh(){let e=_v();return e?await Av()?await Tv(e)?(location.assign(ai),!0):!1:(location.replace(ai),!0):!1}var gc=class extends I{static styles=[...I.styles,T(Qe)];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 il({encoded:this.encoded,password:this._password});if(this._settled)return;let r=z().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=wt(this._name);if(!t)return;let r=z().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 z())if(r.id!==this._decoded.id&&wt(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=wt(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",gc);function kh({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(ft(o.detail?.cause))}),document.body.append(n)})}var Me=null,li=!1,_o=null;function Iv(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 Rv(){if(Me)return Me;Me=document.createElement("div"),Me.id="lock-overlay",Me.setAttribute("role","dialog"),Me.setAttribute("aria-modal","true"),Me.setAttribute("aria-label","Unlock DeepView"),Me.innerHTML=`
150
+ \u2022 Hardware security key: use the vendor's management tool`)}catch(e){alert(`Could not disable encryption: ${e?.message??e}`)}}function H4(){y1()}function j4(e){if(!e||e===gt)return;gt=e;let t=!1;gt.addEventListener("click",async()=>{if(await ht(),!_()&&!t){t=!0;try{if(!fe()){await em();return}if(!qt()){await rm();return}await K9()}finally{t=!1}}}),Je(y1),y1()}var U4,W9,gt,v1=w(()=>{"use strict";T();D();W0();q0();zn();U4=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>`,W9=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>`,gt=null});var W4,V4=w(()=>{W4=`.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}
151
+ `});function k1(){let e=navigator.userAgent;return/AppleWebKit/u.test(e)&&!/Chrome\/|Chromium|Edg\/|OPR\/|Android/u.test(e)?"webkit":/Firefox\//u.test(e)?"firefox":"chromium"}function K4(){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 w1,G4=w(()=>{"use strict";T();ue();D();V4();w1=class extends F{static styles=[...F.styles,A(W4)];static properties={_retryDenied:{state:!0}};constructor(){super(),this._retryDenied=!1}_onConfirm=()=>this._finish(null);_onRetry=async()=>{if(await Ua()){this._finish("granted");return}this._retryDenied=!0};_chromiumBody(){let t=location.hostname==="localhost"?d`Plain <code>localhost</code> can never qualify — for local testing open the app via <code>127.0.0.1</code> instead.`:m;return d`<p class="nwd-intro">Chromium-based browsers (Chrome, Edge, Brave, …) never show a prompt — persistence is granted silently, and only to sites the browser considers important. Any of these qualifies it:</p><ul class="spd-list"><li><strong>Install the app</strong> — the install icon at the right end of the address bar, or the browser menu's Install entry.</li><li><strong>Bookmark</strong> this page.</li><li>Keep using the site — regular visits raise its engagement score.</li></ul><p class="nwd-note">The browser re-evaluates on every request, so after any of the above press <strong>Try again</strong>.${t}</p>`}_firefoxBody(){return d`<p class="nwd-intro">Firefox asks with a permission prompt. A dismissed or blocked prompt is remembered, and the site can't re-ask until the old answer is cleared:</p><ol class="spd-list"><li>Click the permissions icon next to the address bar.</li><li>Clear the <strong>Store Data in Persistent Storage</strong> entry if it's blocked.</li><li>Press <strong>Try again</strong> below and choose <strong>Allow</strong>.</li></ol>`}_webkitBody(){return d`<p class="nwd-intro">Safari — and every iOS browser — additionally deletes a site's storage after <strong>7 days</strong> of browser use without interacting with the site, and no permission exempts a normal tab. Installing the app is what does:</p><ul class="spd-list"><li>On iPhone / iPad: open the <strong>Share</strong> menu, choose <strong>Add to Home Screen</strong>, and use the app from that icon.</li><li>In Safari on macOS: choose <strong>File → Add to Dock…</strong> and use the app from the Dock.</li><li>Installed web apps are exempt from the 7-day cleanup. Otherwise, use the site at least once a week.</li></ul>`}render(){let t=k1(),r=t==="webkit"?this._webkitBody():t==="firefox"?this._firefoxBody():this._chromiumBody();return d`<dialog @close="${this._onClose}"><header><h3>Protect stored data</h3></header><p class="nwd-intro">Reports, bundles and triage live in the browser's <strong>best-effort storage</strong> — the browser is allowed to delete all of it at once under disk pressure or after long inactivity, without asking. The persistent-storage request that would prevent this was just declined.</p>${r}<footer class="nwd-actions">${this._retryDenied?d`<span class="spd-denied" role="status">Still not granted.</span>`:m} <span class="nwd-spacer"></span> ${t==="webkit"?m:d`<button type="button" @click="${this._onRetry}">Try again</button>`} <button type="button" class="primary" @click="${this._onConfirm}">Got it</button></footer></dialog>`}};customElements.define("storage-persist-dialog",w1)});function $1(){return k1()==="webkit"}function q4(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 Y4(){if(!Hn)return;if(_()||!Un||Un.persisted!==!1||!_1){Hn.hidden=!0;return}Hn.hidden=!1;let e=Un.usage===null||Un.quota===null?"":` Using ${q4(Un.usage)} of ${q4(Un.quota)}.`;Hn.querySelector(".storage-label").textContent="Storage at risk",Hn.dataset.tooltip="Reports, bundles and triage are in best-effort storage \u2014 the browser may delete them all under disk pressure or after long inactivity. "+($1()?"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 J4(e,t){let r=t?" (user gesture)":"";if(e){console.info(`storage: persistent-storage request granted${r}`);return}let n=!$1()&&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 `+($1()?"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 Lm(){if(await ht(),!Hn||_()){Y4();return}let[e,t]=await Promise.all([pv(),(async()=>{try{return(await me()).length>0||await Nc()}catch{return!1}})()]);Un=e,_1=t,Y4()}function S1(){!Hn||x1||(x1=setTimeout(()=>{x1=0,Lm()},1e3))}async function X4(){if(Im||(await Lm(),_()||Un?.persisted!==!1||!_1||Im))return;Im=!0;let e=await Ua();J4(e,!1),await Lm()}async function q9(){if(Un&&Un.persisted===!1){Im=!0;let e=await Ua();J4(e,!0),e||await K4()}await Lm()}function Z4(e){Hn=e,Hn&&(Hn.addEventListener("click",()=>{q9()}),dr((t,r)=>{S1(),r==="save"&&X4()}),X4())}var Hn,Un,_1,Im,x1,Q4=w(()=>{"use strict";D();zn();G4();Hn=null,Un=null,_1=!1,Im=!1,x1=0});function C1(e){let t=document.querySelector("#landing-workspaces");if(!t)return;let r=e.filter(n=>n.reports.length>0||n.bundles?.length>0).toSorted((n,o)=>o.reports.length-n.reports.length||n.name.localeCompare(o.name)).slice(0,5);se(r.length>0?d`<nav class="landing-workspaces" aria-label="Workspaces"><div class="landing-workspace-row">${re(r,n=>n.id,n=>{let o=xs(n),i=n.reports.filter(s=>Jt(s)!==at).length;return d`<button type="button" class="landing-workspace" data-landing-workspace="${n.id}">${V(ri)} <span class="landing-workspace-text"><span class="landing-workspace-name">${n.name}</span> <span class="landing-workspace-count">${o?.appMode?`${o.appFindings.toLocaleString()} finding${o.appFindings===1?"":"s"} \xB7 `:""}${i.toLocaleString()} report${i===1?"":"s"}</span></span></button>`})}</div></nav>`:m,t)}var eA=w(()=>{"use strict";T();Mt();qe();D();ft()});function E1(e){let{serverMode:t,session:r,sessionPending:n=!1,teamsPending:o=!1,teams:i=[],alternateMode:s="local",onSwitchMode:a}=e,c=document.querySelector("#drop-zone"),u=c?.querySelector(".managed-landing");if(!u)return;let p=t==="managed",f=t==="local",h=p&&(r?r.role!=="none"&&o:n);h?Ti?Ti.options=e:Ti={options:e,elapsed:!1,timer:setTimeout(()=>{Ti.elapsed=!0,E1(Ti.options)},1e3)}:(clearTimeout(Ti?.timer),Ti=null);let g=h&&!Ti.elapsed;c.dataset.serverMode=p?"managed":"local",c.setAttribute("aria-label",p?g?r?"Loading teams":"Loading session":r?.role==="none"?"No workspace access":r?"Team findings":"Log in":"Drop reports here");let b=c.querySelector(".drop-local-copy");if(b&&(b.textContent=f?"Review locally in your browser.":"Review locally in your browser. Sync across devices when you need it."),!p||g){se(m,u);return}let y=r?.role==="admin"||r?.role==="manage",k=i.filter(v=>v.reports.length>0||v.bundles?.length>0);if(Rn()&&!r){se(d`<section class="managed-login"><h1>Public link unavailable</h1><p>This link is invalid, has been revoked, or public sharing is disabled.</p></section>`,u);return}se(r==null?d`<section class="managed-login" aria-labelledby="managed-login-title"><h1 id="managed-login-title">Log in to DeepView</h1><p>Access your team's security reports and findings.</p><button type="button" class="managed-login-button" data-managed-login><svg viewBox="0 0 16 16" width="20" height="20" 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> <span>Continue with GitHub</span></button><div class="managed-login-alternative"><span>or continue to</span> <button type="button" @click="${a}">${s} mode</button></div></section>`:r.role==="none"?d`<section class="managed-login" aria-labelledby="managed-no-access-title"><h1 id="managed-no-access-title">No workspace access</h1><p>Ask an administrator to grant access to this workspace.</p></section>`:d`<div class="managed-landing-hero"><p class="drop-eyebrow">Your security workspace</p><h1>Your team's findings, in focus.</h1><p class="drop-prompt-intro">${k.length>0?"Review the security findings shared with your account and turn them into clear next steps.":"Reports shared with your teams will appear here."}</p></div>${k.length>0?d`<nav class="managed-team-list" aria-label="Teams">${re(k,v=>v.id,v=>d`<button type="button" class="managed-team-button" data-managed-team="${v.id}"><span class="managed-team-icon" aria-hidden="true">${V(ri)}</span> <span class="managed-team-copy"><strong>${v.name}</strong> <span>${v.reports.length} ${v.reports.length===1?"report":"reports"} · Open findings</span> </span><svg class="managed-team-arrow" width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m6 4 4 4-4 4"/></svg></button>`)}</nav>`:d`<p class="managed-landing-empty">No team reports are available yet.</p>`} ${y?d`<div class="managed-landing-actions"><button type="button" class="managed-manage-button" data-managed-page="manage"><span aria-hidden="true">${V(Qf)}</span><span>Manage</span></button></div><button type="button" class="managed-scan-button" data-managed-page="manage-scans">${V(el)}<span>Scan</span></button>`:m}`,u)}var Ti,tA=w(()=>{"use strict";T();Mt();qe();ft();Cs();Ti=null});var Fm,R1=w(()=>{Fm=`.dlg-tabs{display:flex;gap:.1rem;margin:0 0 .55rem;border-bottom:1px solid var(--border)}.dlg-tab{display:inline-flex;align-items:center;gap:.35rem;background:transparent;border:none;color:var(--muted);padding:.1rem .6rem .4rem;font:inherit;font-size:.85rem;font-weight:600;border-bottom:2px solid transparent;margin-bottom:-1px;transition:color .12s,border-color .12s;&:first-child{padding-left:0}&:hover:not(:disabled){color:var(--text)}&[aria-selected=true]{color:var(--accent);border-bottom-color:var(--accent)}&:disabled{opacity:.5}& svg{display:block}}
152
+ `});function rA({workspace:e}={}){return si("workspace-export-dialog",{workspace:e??null},t=>{t.workspace=null})}var X9,M1,nA=w(()=>{"use strict";T();D();or();ue();co();Ms();R1();X9=[{id:"workspace",label:"Export workspace"},{id:"raw",label:"Raw reports export"}],M1=class extends F{static styles=[...F.styles,A(Mr),A(Fm)];static properties={workspace:{attribute:!1},_tab:{state:!0},_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._tab="workspace",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);_reportCount(){return Array.isArray(this.workspace?.reports)?this.workspace.reports.length:0}_bundleCount(){return Array.isArray(this.workspace?.bundles)?this.workspace.bundles.length:0}_selectTab(t){this._busy||this._tab===t||(this._tab=t,this._error="",t!=="workspace"&&(this._password="",this._confirm=""))}_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._tab==="raw"?this._reportCount()>0:this._noPassword?!0:(this._password??"").length>0&&this._password===this._confirm}_onExport=async()=>{if(!this._canExport())return;if(!this.workspace){this._error="No workspace selected.";return}let t=this._tab;this._busy=!0,this._error="";try{let{blob:r,filename:n}=t==="raw"?await Ev(this.workspace):await Cv(this.workspace,{password:this._noPassword?void 0:this._password,includeBundleBytes:this._includeBundleBytes});if(this._settled)return;qn(r,n),this._finish({ok:!0,tab:t})}catch(r){if(this._settled)return;this._error=r?.message??String(r)}finally{this._busy=!1}};_onKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._onExport())};_tabsTemplate(){return gh({tabs:X9,current:this._tab,prefix:"wsl",disabled:this._busy,select:t=>this._selectTab(t)})}_workspacePanel(){let t=!this._password||!this._confirm||this._password===this._confirm,r=this._bundleCount();return d`<p class="nwd-note">The export file carries this workspace's reports, triage state, comments, fixes, references to attached bundles (integrities only by default), and its private key. Encrypting the file with a password ensures only those with the password can attach the workspace after download.</p><label class="wsl-field"><span>Password</span> <input type="password" class="nwd-input" autocomplete="off" data-1p-ignore="true" data-lpignore="true" data-bwignore="true" data-form-type="other" name="dv-export-pw" maxlength="1024" ?disabled="${this._noPassword}" .value="${this._password}" @input="${this._onPasswordInput}" @keydown="${this._onKeydown}"></label> <label class="wsl-field"><span>Confirm password</span> <input type="password" class="nwd-input" autocomplete="off" data-1p-ignore="true" data-lpignore="true" data-bwignore="true" data-form-type="other" name="dv-export-pw-confirm" maxlength="1024" ?disabled="${this._noPassword}" .value="${this._confirm}" @input="${this._onConfirmInput}" @keydown="${this._onKeydown}"></label> <label class="wsl-optout"><input type="checkbox" .checked="${this._noPassword}" @change="${this._onNoPasswordToggle}"> <span>Export without password (not recommended)</span></label> ${r>0?d`<label class="wsl-optout"><input type="checkbox" .checked="${this._includeBundleBytes}" @change="${this._onIncludeBundleBytesToggle}"> <span>Include bundle bytes (${r} bundle${r===1?"":"s"}; significantly larger file)</span></label>`:m} ${this._noPassword?d`<p class="wsl-error wsl-warning">Anyone who obtains this file can attach the workspace and read every report, triage decision, comment, and fix. Only opt out when you control where the file goes.</p>`:m} ${!this._noPassword&&!t?d`<p class="wsl-error" role="alert">Passwords don't match.</p>`:m}`}_rawPanel(){let t=this._reportCount(),r=this._bundleCount();return d`<div class="wsl-error wsl-warning"><p>This is the raw form of the reports.</p><p>It carries no triage data — no markers, triage states, comments, fixes, or per-report ignores${r>0?d`— and none of this workspace's ${r} attached bundle${r===1?"":"s"}`:m}.</p><p>This file is written unencrypted: anyone who obtains it can read every report in it.</p></div>${t===0?d`<p class="wsl-error" role="alert">This workspace has no reports to export.</p>`:m}`}_primaryLabel(){return this._busy?"Exporting\u2026":this._tab==="raw"?"Download reports":this._noPassword?"Export without password":"Export"}_primaryDanger(){return this._tab==="raw"||this._noPassword}_body(){return d`<div role="tabpanel" id="${`wsl-panel-${this._tab}`}" aria-labelledby="${`wsl-tab-${this._tab}`}">${this._tab==="raw"?this._rawPanel():this._workspacePanel()}</div>${this._error?d`<p class="wsl-error" role="alert">${this._error}</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="${this._primaryDanger()?"primary danger":"primary"}" ?disabled="${!this._canExport()}" @click="${this._onExport}">${this._primaryLabel()}</button></footer>`}render(){return d`<dialog @close="${this._onClose}"><header>${this._tabsTemplate()}</header>${this._body()}</dialog>`}};customElements.define("workspace-export-dialog",M1)});async function oA(e){await rA({workspace:e})}var iA=w(()=>{"use strict";nA()});function sA(){return le("new-workspace-dialog")}var A1,aA=w(()=>{"use strict";T();ue();A1=class extends F{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",A1)});function lA({name:e,reportCount:t,bundleCount:r,triageImpact:n}={}){return le("leave-workspace-dialog",{workspaceName:e??"",reportCount:t??0,bundleCount:r??0,orphanedTriage:n?.orphanedCount??0,sharedTriage:n?.sharedCount??0})}var T1,cA=w(()=>{"use strict";T();ue();Or();T1=class extends F{static styles=[...F.styles,A(We)];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",i=t===1?"it":"them",s=t===1?"stays":"stay",a=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 ${i} out of the workspace</span> <span class="lwd-option-hint">The ${o} ${s} 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 ${i} along with the workspace</span> <span class="lwd-option-hint">The ${o} ${a} 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",T1)});function dA({id:e,name:t,privateKeyBase64:r}={}){return new Promise((n,o)=>{let i=document.createElement("workspace-share-link-dialog");i.workspaceId=e??"",i.initialName=t??"",i.privateKeyBase64=r??"",i.addEventListener("resolve",()=>{i.remove(),n()}),i.addEventListener("modal-conflict",s=>{i.privateKeyBase64="",i.remove(),o(aa(s.detail?.cause))}),document.body.append(i)})}var I1,uA=w(()=>{"use strict";T();D();or();ue();Ms();I1=class extends F{static styles=[...F.styles,A(Mr)];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 Tv({id:this.workspaceId,name:this._name.trim(),privateKeyBase64:this.privateKeyBase64,password:this._password});if(this._settled)return;this._url=Lv(t),this._password="",this._confirm=""}catch(t){if(this._settled)return;this._error=t?.message??String(t)}finally{this._busy=!1}}};_onCopy=async()=>{if(this._url){this._error="";try{if(await navigator.clipboard.writeText(this._url),this._settled)return;this._copied=!0,this._copiedTimer&&clearTimeout(this._copiedTimer),this._copiedTimer=setTimeout(()=>{this._copied=!1,this._copiedTimer=null},1500)}catch{if(this._settled)return;this._error="Copy failed \u2014 select the link and copy it manually."}}};_onKeydown=t=>{t.key==="Enter"&&!this._url&&(t.preventDefault(),this._onGenerate())};_body(){return this._url?d`<p class="nwd-note">Anyone with the link <strong>and</strong> the password can attach this workspace. Share them through separate channels.</p><label class="wsl-field"><span>Share link</span> <textarea class="wsl-link" readonly="readonly" rows="3" @focus="${t=>t.target.select()}">${this._url}</textarea></label> ${this._error?d`<p class="wsl-error" role="alert">${this._error}</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Close</button> <button type="button" class="primary" @click="${this._onCopy}">${this._copied?"Copied":"Copy link"}</button></footer>`:d`<label class="wsl-field"><span>Workspace name</span> <input type="text" class="nwd-input" data-role="name" placeholder="Workspace name" maxlength="200" .value="${this._name}" @input="${this._onNameInput}" @keydown="${this._onKeydown}"></label> <label class="wsl-field"><span>Password</span> <input type="password" class="nwd-input" autocomplete="off" data-1p-ignore="true" data-lpignore="true" data-bwignore="true" data-form-type="other" name="dv-share-link-pw" maxlength="1024" .value="${this._password}" @input="${this._onPasswordInput}" @keydown="${this._onKeydown}"></label> <label class="wsl-field"><span>Confirm password</span> <input type="password" class="nwd-input" autocomplete="off" data-1p-ignore="true" data-lpignore="true" data-bwignore="true" data-form-type="other" name="dv-share-link-pw-confirm" maxlength="1024" .value="${this._confirm}" @input="${this._onConfirmInput}" @keydown="${this._onKeydown}"></label><p class="nwd-note">The link carries the workspace's identity (id, name, and private key) so the recipient joins the same sync chain. Triage, reports, and comments aren't in the link itself — they sync over once the recipient joins. The link decrypts with the password above; without it the link is useless.</p>${this._error?d`<p class="wsl-error" role="alert">${this._error}</p>`:m} ${this._password&&this._confirm&&this._password!==this._confirm?d`<p class="wsl-error" role="alert">Passwords don't match.</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!this._canGenerate()}" @click="${this._onGenerate}">${this._busy?"Generating\u2026":"Generate link"}</button></footer>`}render(){return d`<dialog @close="${this._onClose}"><header><h3>${this._url?"Workspace share link":"Share workspace by link"}</h3></header>${this._body()}</dialog>`}};customElements.define("workspace-share-link-dialog",I1)});function pA({name:e,kindLabel:t,triageImpact:r,inRemote:n}={}){return le("delete-report-dialog",{reportName:e??"",kindLabel:t||"report",orphanedTriage:r?.orphanedCount??0,sharedTriage:r?.sharedCount??0,inRemote:!!n})}var L1,fA=w(()=>{"use strict";T();ue();Or();L1=class extends F{static styles=[...F.styles,A(We)];static properties={reportName:{type:String},kindLabel:{type:String},orphanedTriage:{type:Number},sharedTriage:{type:Number},inRemote:{type:Boolean},_triage:{state:!0}};constructor(){super(),this.reportName="",this.kindLabel="report",this.orphanedTriage=0,this.sharedTriage=0,this.inRemote=!1,this._triage="keep"}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(t){if(this._settled)return;let r=this.orphanedTriage>0?this._triage:"keep";super._finish({confirmed:!!t,triage:r})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);_onTriageChange=t=>{this._triage=t.target.value};_remoteNotice(){return this.inRemote?d`<p class="lwd-note">This report is also stored in the workspace's <strong>remote</strong> inventory and will be removed from there too. Newly synced workspace members won't see it; members who already downloaded it keep their local copy (and could re-upload).</p>`:m}_triageSection(){let t=this.orphanedTriage,r=this.sharedTriage;return t===0&&r===0?d`<p class="lwd-note">No local triage is attached to this ${this.kindLabel}.</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 ${this.kindLabel}</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",L1)});function hA({name:e,inRemote:t}={}){return le("delete-bundle-dialog",{bundleName:e??"",inRemote:!!t})}var F1,mA=w(()=>{"use strict";T();ue();Or();F1=class extends F{static styles=[...F.styles,A(We)];static properties={bundleName:{type:String},inRemote:{type:Boolean}};constructor(){super(),this.bundleName="",this.inRemote=!1}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}_finish(t){this._settled||super._finish({confirmed:!!t})}_onClose=()=>this._finish(!1);_onCancel=()=>this._finish(!1);_onConfirm=()=>this._finish(!0);_remoteNotice(){return this.inRemote?d`<p class="lwd-note">This bundle is also stored in the workspace's <strong>remote</strong> inventory and will be removed from there too. Newly synced workspace members won't see it; members who already downloaded it keep their local copy (and could re-upload).</p>`:m}render(){return d`<dialog @close="${this._onClose}"><header><h3>Delete bundle</h3></header><p class="lwd-body">Delete <strong>"${this.bundleName}"</strong>?</p>${this._remoteNotice()}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> <button type="button" class="danger" @click="${this._onConfirm}">Delete</button></footer></dialog>`}};customElements.define("delete-bundle-dialog",F1)});function gA({name:e,workspaceName:t}={}){return le("detach-bundle-dialog",{bundleName:e??"",workspaceName:t??""})}var B1,bA=w(()=>{"use strict";T();ue();Or();B1=class extends F{static styles=[...F.styles,A(We)];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",B1)});function yA({name:e,workspaceName:t}={}){return le("detach-report-dialog",{reportName:e??"",workspaceName:t??""})}var O1,vA=w(()=>{"use strict";T();ue();Or();O1=class extends F{static styles=[...F.styles,A(We)];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",O1)});function wA(){return new Promise(e=>{let t=document.createElement("persistence-degraded-dialog");t.exclusive=!0;let r=n=>{t.remove(),e({shown:n})};t.addEventListener("resolve",()=>r(!0)),t.addEventListener("modal-conflict",()=>r(!1)),document.body.append(t)})}var P1,kA=w(()=>{"use strict";T();ue();P1=class extends F{_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",P1)});function xA(){return new Promise(e=>{let t=document.createElement("proxy-auth-dialog");t.exclusive=!0;let 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 N1,$A=w(()=>{"use strict";T();ue();N1=class extends F{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",N1)});async function _A(e,{openManagedReport:t,readTeam:r=Hf,isCurrent:n=()=>!0}){let o=l.managedSession,i=()=>n()&&_()&&l.managedSession?.id===o?.id&&l.managedSession?.role===o?.role,s=l.managedTeams;if(!i())return null;async function a(g,b){return!i()||(l.currentManagedTeam!==g.id||l.currentManagedReport!==b)&&!await t(g,b)||!i()||l.currentManagedTeam!==g.id||l.currentManagedReport!==b?null:vi(e.id)}if(e.teamId){let g=s.find(b=>b.id===e.teamId);return!g||e.reportId&&!g.reports.some(b=>b.id===e.reportId)?null:a(g,e.reportId??null)}let c=s.flatMap(g=>g.reports.map(b=>({team:g,report:b}))),u=new Set,p=new Map;async function f(g){for(let{team:b,report:y}of g){if(!i())return null;if(u.has(`${b.id}:${y.id}`))continue;u.add(`${b.id}:${y.id}`),p.has(b.id)||p.set(b.id,await r(b.id));let k=p.get(b.id)?.find(x=>x.id===y.id);if(!i())return null;if(k==null)continue;let v=await N3(JSON.stringify(k.data),y.filename);if(!i())return null;if(v?.findings.some(x=>x.id===e.id))return a(b,y.id)}return null}if(e.report){let g=await Promise.all(c.map(({report:y})=>$t("report",y.filename))),b=await f(c.filter((y,k)=>g[k]===e.report));if(b||!i())return b}if(e.workspace){let g=await Promise.all(s.map(y=>$t("workspace",`managed-team:${y.id}`))),b=s[g.indexOf(e.workspace)];if(b){let y=await a(b,null);if(y||!i())return y}}if(!i())return null;let h=s.find(g=>g.id===l.currentManagedTeam);if(h&&(l.currentManagedReport==null||h.reports.some(g=>g.id===l.currentManagedReport))){let g=vi(e.id);if(g)return g}return f(c)}var SA=w(()=>{"use strict";D();j0();Zt();wi()});async function CA(e,t,r,{openReport:n,openManagedReport:o}){if(_()){let i=l.managedTeams.find(s=>s.id===l.currentManagedTeam);if(!r||!i?.reports.some(s=>s.id===r)||(l.currentManagedReport!==r||l.currentWorkspace)&&!await o(i,r)||!_()||l.currentManagedTeam!==i.id||l.currentManagedReport!==r||l.currentWorkspace)return null}else if(r||((l.currentFile!==t||l.currentWorkspace)&&await n(t),_()||l.currentFile!==t||l.currentWorkspace))return null;return vi(e)}async function EA(e,t){if(_())return _A(e,t);let{openReport:r,openWorkspace:n}=t,[o,i]=await Promise.all([jy(e.report),Hy(e.workspace)]);async function s(p){let f=yi(p,i?.id);return(l.currentFile!==p||l.currentWorkspace||l.currentReportWorkspace!==f)&&await r(p,void 0,{workspaceId:f}),vi(e.id)}if(o){let p=await s(o);if(p)return p}if(i){l.currentWorkspace!==i.id&&await n(i.id);let p=vi(e.id);if(p)return p}let a=vi(e.id);if(a)return a;let c=l.reports.map(p=>p.fileName).filter(Boolean),u=await Vy(e.id,{skip:c});return u?await s(u):null}var RA=w(()=>{"use strict";D();wi();SA()});function Z9(e){let t=AA.get(e);if(t===void 0){let r=getComputedStyle(e).overflowY;t=r==="auto"||r==="scroll"||r==="overlay",AA.set(e,t)}return t}function U1(e){let t=e.parentNode;for(;t;){if(t.nodeType===Node.DOCUMENT_FRAGMENT_NODE){t=t.host??null;continue}if(t.nodeType!==Node.ELEMENT_NODE||t===document.documentElement)return null;if(Z9(t))return t;t=t.parentNode}return null}function Q9(e){for(let t of e)Tl.get(t.target)?.cb(t.isIntersecting)}function ez(e){let t=e??document,r=MA.get(t);return r||(r=new IntersectionObserver(Q9,{root:e,rootMargin:J9,threshold:0}),MA.set(t,r)),r}function Il(e,t){let r=Tl.get(e);r?.io&&r.io.unobserve(e),Tl.set(e,{cb:t,io:null}),D1.push(e),z1||(z1=!0,queueMicrotask(tz))}function tz(){z1=!1;let e=D1;D1=[];for(let t of e){let r=Tl.get(t);!r||r.io||(r.io=ez(U1(t)),r.io.observe(t))}}function So(e){let t=Tl.get(e);t&&(t.io?.unobserve(e),Tl.delete(e))}var J9,MA,Tl,D1,z1,AA,Su=w(()=>{"use strict";J9="100% 0px",MA=new WeakMap,Tl=new WeakMap,D1=[],z1=!1,AA=new WeakMap});var IA={};kg(IA,{revealFinding:()=>H1,revealFindingInReport:()=>Pm});function az(e){Om!==null&&clearTimeout(Om);for(let t of document.querySelectorAll(`.${Bm}`))t.classList.remove(Bm);e.classList.add(Bm),Om=setTimeout(()=>{e.classList.remove(Bm),Om=null},rz)}function lz(e){return new Promise(t=>{let r=null,n=0,o=0,i=()=>{let s=Math.round(e.getBoundingClientRect().top);n=s===r?n+1:0,r=s,n>=oz||++o>=iz?t():requestAnimationFrame(i)};requestAnimationFrame(i)})}function cz(e){let t=0,r=window.innerHeight,n=U1(e);if(n){let o=n.getBoundingClientRect();t=Math.max(t,o.top),r=Math.min(r,o.bottom)}return{top:t,bottom:r}}function dz(e){let t=e.getBoundingClientRect();if(t.height===0)return!1;let{top:r,bottom:n}=cz(e);if(n<=r)return!1;let o=(r+n)/2;return t.top>=r&&t.bottom<=n||t.top<=o&&t.bottom>=o}async function uz(e){e.scrollIntoView({block:"center",behavior:"smooth"});for(let t=0;t<sz;t++){if(await lz(e),!e.isConnected||dz(e))return;e.scrollIntoView({block:"center",behavior:"instant"})}}async function pz(e){let t=CSS.escape(e);if(l.viewMode==="table"){let r=P.querySelector("finding-table");if(r){try{await r.updateComplete}catch{}for(let n of r.shadowRoot?.querySelectorAll("finding-row")??[])if(n.group&&de(n.group)===e)return n}}if(l.viewMode==="kanban"){let r=P.querySelector(`.kanban-card[data-gid="${t}"]`);if(r)return r}return P.querySelector(`finding-card[data-gid="${t}"]`)??P.querySelector(`[data-gid="${t}"]`)}async function TA(e,t,r=()=>!0){let n=C0(e.group,t),o=yr(n);if(o&&Mh(o)&&queueMicrotask(we),S(),await K({revealSelection:!0}),!r())return{ok:!1};let i=await pz(n);return r()?i?(typeof i.ensureRendered=="function"&&await i.ensureRendered(),await uz(i),r()?(az(i),{ok:!0}):{ok:!1}):{ok:!0}:{ok:!1}}async function H1(e,{openManagedReport:t=wo,isCurrent:r=()=>!0}={}){if(!e?.id)return{ok:!1,reason:"This link is missing a finding id."};let n=await EA(e,{openReport:tr,openWorkspace:Pr,openManagedReport:t,isCurrent:r});return r()?n?await TA(n,e.id,r):{ok:!1,reason:_()?"Couldn't find that finding in the team reports you can access.":nz}:{ok:!1}}async function Pm(e,t,r=null){if(!e||!t)return{ok:!1,reason:"Missing finding id or report name."};let n=await CA(e,t,r,{openReport:tr,openManagedReport:wo});return n?await TA(n,e):{ok:!1,reason:r?`Could not open that finding in "${t}". Open the team and try again.`:`Couldn't find that finding in "${t}". It may have been re-imported since this links file was written.`}}var rz,Bm,nz,Om,oz,iz,sz,Nm=w(()=>{"use strict";D();or();wi();RA();ct();xi();Su();zt();zn();rz=1600,Bm="link-target",nz="Couldn't find that finding in any of your reports. Import the report it came from, then open the link again.",Om=null,oz=3,iz=150,sz=5});function Dm(e){let t=document.querySelector("#drop-zone");t&&(e?t.dataset.serverModePending="true":delete t.dataset.serverModePending)}function fz(){return _n().size}function hz(){return ms().size}function gz(e,t){let r=l.currentView==="bundles"?l.selectedBundle:null,n=["findings","files","links"].includes(l.currentView)?l.currentFile:null,o=r?"bundles":"reports",i=n?yi(n):null,s=e.filter(c=>r?c.bundles.includes(r):c.id===i),a=JSON.stringify([o,r||n,s.map(c=>c.id)]);if(!(!t&&a===FA)){FA=a;for(let c of s){let u=Mu.get(c.id)??new Set;u.add(o),Mu.set(c.id,u)}}}function BA(e,t={}){let n=`file-item${e===l.currentFile&&(t.workspaceId??null)===yi(e)&&(l.currentView==="findings"||l.currentView==="files"||l.currentView==="links")?" current":""}${t.indented?" indented":""}`,o=Re(e),i=Kc(e),s=ke[et(e)]??ke.default;return d`<li class="${n}" data-file="${e}" data-workspace-id="${t.workspaceId??m}" draggable="true"><button type="button" class="file-name" data-tooltip="${o}">${V(s)}<span class="file-label">${o}</span>${i===void 0?m:d`<span class="file-count">${i}</span>`}</button></li>`}function UA(e,t={}){let r=`file-group-header${t.dropTarget?" default-reports":""}`;return d`<li class="${r}" data-default-reports="${t.dropTarget?"true":m}"><span class="group-label">${e}</span></li>`}function vz(){let e=_()?m:d`<span class="workspace-header-actions"><button type="button" class="workspace-add" data-action="new-workspace" aria-label="Create a new workspace">${bz}</button></span>`;return d`<li class="file-group-header workspace-header"><span class="group-label">Workspaces</span>${e}</li>`}function OA(){if(!_())return m;let e=R5(l.managedTeams,Ii);return e.length===0?m:d`${UA("Teams")} ${re(e,({team:t})=>t.id,({team:t,reports:r,bundles:n})=>d`<li class="${`file-item team-item${l.currentManagedTeam===t.id&&l.currentWorkspace&&l.currentView==="findings"?" current":""}`}"><button type="button" class="file-name" @click="${()=>{wo(t)}}">${Ez}<span class="file-label">${t.name}</span></button> ${l.managed?.allowShare&&["admin","manage"].includes(l.managedSession?.role)?d`<button type="button" class="workspace-share" aria-label="${`Share ${t.name} publicly`}" data-tooltip="Share public link" @click="${()=>{i5(t)}}">${jA}</button>`:m}</li>${re(r,o=>o.id,o=>wz(t,o))} ${re(n,o=>o.id,o=>xz(t,o))}`)}`}function wz(e,t){let r=l.currentManagedTeam===e.id&&l.currentManagedReport===t.id&&["findings","links"].includes(l.currentView);return d`<li class="${`file-item indented team-report-item${r?" current":""}`}"><button type="button" class="file-name" data-tooltip="${t.filename}" data-tooltip-repo="${cw(t)||m}" @click="${()=>{kz(e,t)}}">${V(ke.default)}<span class="file-label">${t.filename}</span></button></li>`}function kz(e,t){return wo(e,t.id)}function xz(e,t){let r=l.currentView==="bundles"&&l.currentManagedTeam===e.id&&l.bundleDetails?.managedId===t.id;return d`<li class="${`file-item indented team-bundle-item${r?" current":""}`}"><button type="button" class="file-name" data-managed-bundle="${t.id}" data-managed-team="${e.id}" data-tooltip="${t.filename}" data-tooltip-repo="${cw(t)||m}" data-tooltip-bundle="${t.kind||m}" data-tooltip-stats="${E5(t)||m}">${HA}<span class="file-label">${t.filename}</span></button></li>`}function $z(){return d`<li class="file-group-header bundles-header" data-default-bundles="true"><span class="group-label">Bundles</span></li>`}function PA(e,t={}){let{integrity:r,name:n}=e,o=l.selectedBundle===r&&l.currentView==="bundles"&&(t.workspaceId??null)===l.selectedBundleWorkspace,s=`file-item bundle-item${t.workspaceId!=null?" indented":""}${o?" current":""}`;return d`<li class="${s}" data-bundle-integrity="${r}" data-workspace-id="${t.workspaceId??m}" draggable="true"><button type="button" class="file-name" data-tooltip="${`${n}
153
+ ${r}`}">${HA}<span class="file-label">${n}</span></button></li>`}function _z(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 Sz(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 · ${Re(e)}</em></span></span></li>`}function Az(e,{app:t,compact:r,reports:n,bundles:o,showReports:i,showBundles:s}){let c=`file-item workspace-item${l.currentWorkspace===e.id&&(l.currentView==="findings"||l.currentView==="files")?" current":""}`;return d`<li class="${c}" data-workspace-id="${e.id}"><div class="workspace-heading"><button type="button" class="file-name">${Cz}<span class="file-label" .textContent="${e.name}"></span></button> <button type="button" class="workspace-share" data-action="share-workspace" data-tooltip="Share by link" aria-label="Share workspace by link">${jA}</button> <button type="button" class="workspace-export" data-action="export-workspace" data-tooltip="Export workspace" aria-label="Export workspace">${Rz}</button> <button type="button" class="workspace-leave" data-action="leave-workspace" data-tooltip="Leave workspace" aria-label="Leave workspace">${Mz}</button></div>${r?d`<div class="workspace-meta">${t?.appMode?d`<span class="workspace-findings">${t.appFindings.toLocaleString()} finding${t.appFindings===1?"":"s"}</span>`:m} <span class="workspace-sections" role="group" aria-label="Workspace files"><button type="button" data-workspace-section="reports" aria-expanded="${String(i)}" ?disabled="${Ol}">${n.toLocaleString()} report${n===1?"":"s"}</button> ${o>0?d`<button type="button" data-workspace-section="bundles" aria-expanded="${String(s)}" ?disabled="${Ol}">${o.toLocaleString()} bundle${o===1?"":"s"}</button>`:m}</span></div>`:m}</li>`}function Ll(e){return Ii?Re(e).toLowerCase().includes(Ii):!0}async function K({revealSelection:e=!1}={}){await ht();let t=mn();if(E1({serverMode:t,session:l.managedSession,teams:l.managedTeams,sessionPending:Gs,teamsPending:qs,alternateMode:Wr(l.serverModeConfig)?"e2e":"local",onSwitchMode:WA}),bm(),_()){if(!Gs&&!qs&&!Fl&&!Hm&&$i({catalogOnly:!0}),l.bundles=(l.bundles??[]).filter(b=>b.managedId),l.storedFiles=[],C1([]),!ee)return;se(d`${OA()}`,G1),ee.querySelector('sidebar-view-button[kind="packages"]')?.setAttribute("hidden",""),ee.querySelector('sidebar-view-button[kind="repositories"]')?.setAttribute("hidden",""),ee.querySelector("#storage-status")?.setAttribute("hidden",""),jn();return}if(ee?.querySelector('sidebar-view-button[kind="packages"]')?.removeAttribute("hidden"),ee?.querySelector('sidebar-view-button[kind="repositories"]')?.removeAttribute("hidden"),await cv(),t!==mn()){await K();return}Cr().catch(()=>{}),sd().catch(()=>{});let r=await me();if(t!==mn()){await K();return}let n=J();gz(n,e),C1(n);let[o]=await Promise.all([Ot(),...n.map(b=>$t("workspace",b.id))]);if(t!==mn()){await K();return}if(l.bundles=o,l.storedFiles=r,S1(),!ee)return;let i=new Set(r),s=new Set;for(let b of n)for(let y of b.reports)i.has(y)&&s.add(y);let a=new Map(o.map(b=>[b.integrity,b])),c=new Set;for(let b of n)for(let y of b.bundles)a.has(y)&&c.add(y);let u=new Map;for(let b of LA)u.set(b,[]);for(let b of r){if(s.has(b)||!Ll(b))continue;let y=et(b);u.has(y)||u.set(y,[]),u.get(y).push(b)}let p=n.filter(b=>!Ii||b.name.toLowerCase().includes(Ii)||b.reports.some(y=>Ll(y))?!0:b.bundles.some(y=>{let k=a.get(y);return k&&Ll(k.name)})),f=o.filter(b=>!c.has(b.integrity)&&Ll(b.name));se(d`${OA()} ${_()&&n.length===0?m:vz()} ${re(p,b=>b.id,b=>{let y=[],k=[];for(let B of b.reports)Ll(B)&&(i.has(B)?y.push(B):k.push(B));y.sort(j1),k.sort(j1);let v=[],x=[];for(let B of b.bundles){let ne=a.get(B);ne?(!Ii||Ll(ne.name))&&v.push(ne):Ii||x.push(B)}let $=q3(b)??xs(b),C=$?.appMode??jv(b)===!0,I=Mu.get(b.id),E=!C||Ol||I?.has("reports")===!0,R=!C||Ol||I?.has("bundles")===!0,z=[...y,...k].filter(B=>Jt(B)!==at).length,U=v.length+x.length;return d`${Az(b,{app:$,compact:C,reports:z,bundles:U,showReports:E,showBundles:R})} ${E?d`${y.map(B=>BA(B,{indented:!0,workspaceId:b.id}))}${k.map(B=>Sz(B,b.id))}`:m} ${R?d`${v.map(B=>PA(B,{workspaceId:b.id}))}${x.map(B=>_z(B,b.id))}`:m}`})} ${LA.map(b=>{let y=(u.get(b)??[]).toSorted(j1),k=b==="default";return y.length===0&&!(k&&zm)?null:d`${UA(mz[b]??b,{dropTarget:k})} ${y.map(v=>BA(v))}`})} ${f.length>0||Um?$z():null} ${re(f,b=>b.integrity,b=>PA(b))}`,G1);let h=ee.querySelector('sidebar-view-button[kind="packages"]');h&&(h.count=fz());let g=ee.querySelector('sidebar-view-button[kind="repositories"]');g&&(g.count=hz()),jn(),_y(r,VA)}function VA(){V1||(V1=!0,requestAnimationFrame(()=>{V1=!1,K().catch(e=>console.warn("counts repaint:",e))}))}async function WA(){ee?.querySelector("#user-menu")?.hidePopover?.(),Dr?await Hz():cb()&&await Wm()}async function NA(e){let t=e.target.closest("[data-workspace-section]");if(t){if(Ol||t.disabled)return;let p=t.closest("[data-workspace-id]")?.dataset.workspaceId;if(!p)return;let f=t.dataset.workspaceSection,h=Mu.get(p)??new Set;h.has(f)?h.delete(f):h.add(f),Mu.set(p,h),await K();return}if(e.target.closest('[data-action="toggle-client-mode"]')){await WA();return}if(e.target.closest('[data-action="go-home"]')){await Dn();return}let r=e.target.closest("[data-managed-bundle]");if(r){Ie.navigate(bt({view:"bundles",teamId:r.dataset.managedTeam,bundleId:r.dataset.managedBundle,bundleTab:l.currentView==="bundles"?l.bundleDetailsTab:"overview"},l.managedTeams));return}let n=e.target.closest(".file-item[data-bundle-integrity]");if(n){if(n.classList.contains("bundle-missing"))return;let p=n.dataset.bundleIntegrity,f=n.dataset.workspaceId??null;if(l.selectedBundle===p&&l.currentView==="bundles"&&l.selectedBundleWorkspace===f)return;ho(p,void 0,{workspaceId:f}),Si(p,l.bundleDetailsTab),S(),K(),mo(p);return}let o=e.target.closest("sidebar-view-button");if(o){let p=o.getAttribute("kind");(p==="packages"||p==="repositories")&&(l.currentView=p,S(),K());return}if(e.target.closest('[data-action="new-workspace"]')){if(_())return;let p=await sA();p&&(await tm(),await Fy(p),K());return}let i=e.target.closest('[data-action="share-workspace"]');if(i){let p=i.closest("[data-workspace-id]"),f=p?J().find(h=>h.id===p.dataset.workspaceId):null;f&&dA({id:f.id,name:f.name,privateKeyBase64:f.privateKey}).catch(h=>alert(`Failed to open share dialog: ${h.message}`));return}let s=e.target.closest('[data-action="export-workspace"]');if(s){let p=s.closest("[data-workspace-id]"),f=p?J().find(h=>h.id===p.dataset.workspaceId):null;f&&oA(f).catch(h=>alert(`Failed to open export dialog: ${h.message}`));return}let a=e.target.closest('[data-action="leave-workspace"]');if(a){let p=a.closest("[data-workspace-id]"),f=p?J().find(v=>v.id===p.dataset.workspaceId):null;if(!f)return;let h=Array.isArray(f.reports)?f.reports:[],g;try{g=await xf(h)}catch(v){alert(`Couldn't read reports to analyze triage impact: ${v.message}`);return}let{confirmed:b,mode:y,triage:k}=await lA({name:f.name,reportCount:h.length,bundleCount:f.bundles.length,triageImpact:g});if(!b)return;if(!J().some(v=>v.id===f.id)){alert(`Workspace "${f.name}" was removed elsewhere; nothing to leave.`);return}try{await tR(f.id,y,{triage:k})}catch(v){alert(`Failed to leave workspace: ${v.message}`)}return}let c=e.target.closest(".file-item.workspace-item[data-workspace-id]");if(c){let p=c.dataset.workspaceId,f=l.currentView==="findings"||l.currentView==="files";p&&(p!==l.currentWorkspace||!f)&&Pr(p);return}let u=e.target.closest(".file-item[data-file]");if(u){let p=u.dataset.file,f=l.currentView==="findings"||l.currentView==="links",h=u.dataset.workspaceId??null;p&&(p!==l.currentFile||h!==l.currentReportWorkspace||!f)&&tr(p,void 0,{workspaceId:h});return}if(e.target.closest("sidebar-delete-current")){if(l.currentView==="bundles"&&l.selectedBundle){let v=l.selectedBundle,x=(l.bundles??[]).find(I=>I.integrity===v)?.name??v,$=J().filter(I=>Array.isArray(I.bundles)&&I.bundles.includes(v)).filter(I=>Gv(I.id,v)).map(I=>I.id),{confirmed:C}=await hA({name:x,inRemote:$.length>0});if(!C)return;if(l.selectedBundle!==v){alert(`Active bundle changed during confirmation; aborting delete of "${x}".`);return}try{await eR({deleteFromRemoteWorkspaceIds:$})}catch(I){alert(`Failed to delete bundle: ${I.message}`)}return}if(!l.currentFile)return;let p=l.currentFile,f;try{f=await xf([p])}catch(v){alert(`Couldn't read reports to analyze triage impact: ${v.message}`);return}let h=J().filter(v=>Array.isArray(v.reports)&&v.reports.includes(p)).filter(v=>Ga(v.id,p)).map(v=>v.id),g=h.length>0,b=nh(p)?"links file":"report",{confirmed:y,triage:k}=await pA({name:p,kindLabel:b,triageImpact:f,inRemote:g});if(!y)return;if(l.currentFile!==p){alert(`Active file changed during confirmation; aborting delete of "${p}".`);return}try{await Z3({triage:k,deleteFromRemoteWorkspaceIds:h})}catch(v){alert(`Failed to delete ${b}: ${v.message}`)}return}if(e.target.closest("#sync-status")){Q.status==="error"?Q.dismissError():Q.status==="off"?(!Q.getServerUrl()&&Eu&&Q.setServerUrl(Eu),Q.setEnabled(!0)):Q.setEnabled(!1);return}for(let p of Object.keys(jm))if(e.target.closest(`[data-action="${p}"]`)){ee?.querySelector("#user-menu")?.hidePopover?.(),zs(p);return}if(e.target.closest('[data-action="managed-logout"]')){p5(l.managedSession?.csrfToken);return}if(e.target.closest("#sidebar-toggle")){if(_())return;Li.classList.toggle("collapsed");try{localStorage.setItem("deepview.sidebarCollapsed",Li.classList.contains("collapsed")?"1":"0")}catch{}}}function Iz(e){Ol=e.target.value.length>0,Ii=e.target.value.trim().toLowerCase(),K()}function KA(){return Q.getServerUrl()||Eu?J().length>0:!1}function GA(){let e=ee?.querySelector("#auth-status");if(!e)return;let t=ee?.querySelector("#manage-status"),r=ee?.querySelector("#user-menu"),n=l.managedSession;if(Li?.toggleAttribute("data-authenticated",n!=null),Li?.toggleAttribute("data-workspace-access",n!=null&&n.role!=="none"),e.hidden=n==null,n==null){t&&(t.hidden=!0),e.dataset.authed="0",e.removeAttribute("popovertarget"),e.removeAttribute("aria-label"),se(m,e),r&&se(m,r);return}if(n.publicShare){t&&(t.hidden=!0),e.removeAttribute("popovertarget"),se(d`<span class="auth-login">Public workspace · Read only</span>`,e),r&&se(m,r);return}let o=(n.login[0]??"?").toUpperCase(),i=typeof n.name=="string"&&/\s/u.test(n.name.trim())?n.name.trim():`@${n.login}`;if(e.dataset.authed="1",e.setAttribute("popovertarget","user-menu"),e.setAttribute("aria-label",`Account: ${n.login}`),se(d`${DA(o,n.id)}<span class="auth-login">${i}</span>`,e),t){let s=_()&&(n.role==="admin"||n.role==="manage");t.hidden=!s}r&&se(d`<div class="user-card">${DA(o,n.id,!0)} <span class="user-id"><span class="user-login">${n.login}</span> ${n.name?d`<span class="user-name">${n.name}</span>`:m}</span></div><button type="button" class="user-menu-row" data-action="toggle-client-mode">${Wr(l.serverModeConfig)?"e2e mode":"Local mode"}</button> <button type="button" class="user-menu-row logout-row" data-action="managed-logout">${yz}<span>Log out</span></button>`,r)}function DA(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> ${Zv()||l.managedSession?.role==="none"?m:d`<img alt="" src="${n}" @error="${Fz}">`}</span>`}function Fz(e){e.currentTarget.classList.add("broken")}function qA(){let e=ee?.querySelector(".brand-tag");if(e){let t=l.serverMode==="managed"||Wr(l.serverModeConfig);e.textContent=mn(),t?(e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.setAttribute("aria-label",`Switch from ${mn()} mode`)):(e.removeAttribute("role"),e.removeAttribute("tabindex"),e.removeAttribute("aria-label"))}}function Bz(){Li&&(Li.dataset.mode=mn()),_()?(Li?.classList.remove("collapsed"),ee?.querySelector("sidebar-delete-current")?.setAttribute("hidden",""),ee?.querySelector("#encryption-toggle")?.setAttribute("hidden",""),ee?.querySelector("#auth-status")?.removeAttribute("hidden")):(ee?.querySelector("sidebar-delete-current")?.removeAttribute("hidden"),ee?.querySelector("#encryption-toggle")?.removeAttribute("hidden"),ee?.querySelector("#manage-status")?.setAttribute("hidden",""),ee?.querySelector("#auth-status")?.setAttribute("hidden","")),H4()}function jn(e){let t=ee?.querySelector("#sync-status");if(!t)return;if(qA(),Bz(),l.serverMode==="managed"&&l.localMode){t.hidden=!0,Q.setForcedOff(!0);let p=ee?.querySelector("#auth-status");p&&(p.hidden=!0);return}if(_()){t.hidden=!0,Q.setForcedOff(!0),GA();return}if(l.serverMode==="standalone"){t.hidden=!0;let p=ee?.querySelector("#auth-status");p&&(p.hidden=!0);return}let r=ee?.querySelector("#auth-status");r&&(r.hidden=!0);let n=KA(),o=sr()!=null;if(n&&o&&Q.isEnabled()&&pd().catch(p=>{console.warn("sync: load failed",p)}),n&&o&&!Q.getServerUrl()&&Eu&&Q.isEnabled()&&Q.setServerUrl(Eu),Q.setForcedOff(!n),!n){t.hidden=!0;return}t.hidden=!1;let i=e??Q.status;t.dataset.status=i;let s=Q.persistenceDegraded;t.toggleAttribute("data-degraded",s);let a=Q.proxyAuthRequired;t.toggleAttribute("data-proxy-auth",a);let c=s?"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.":a?"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.":"";c?t.dataset.tooltip=c:delete t.dataset.tooltip;let u=t.querySelector(".sync-label");u&&(u.textContent=Lz[i]??"")}async function YA(){if(!Q.persistenceDegraded||Y1||W1)return;W1=!0;let{shown:e}=await wA();if(W1=!1,e){Y1=!0;return}Q.persistenceDegraded&&setTimeout(YA,1500)}async function XA(){if(!Q.proxyAuthRequired||X1||K1)return;K1=!0;let{shown:e,reload:t}=await xA();if(K1=!1,!e){Q.proxyAuthRequired&&setTimeout(XA,1500);return}X1=!0,t&&location.reload()}function Oz(e){if(e.target.closest("[data-workspace-section], [data-action]"))return;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=J().find(c=>c.id===n);if(!o)return;e.preventDefault();let i=document.createElement("input");i.type="text",i.value=o.name,i.className="workspace-rename-input",r.textContent="",r.append(i),i.focus(),i.select();let s=!1,a=async c=>{if(!s){s=!0;try{c&&await Oy(n,i.value)}catch(u){alert(`Failed to rename workspace: ${u.message}`)}finally{r.contains(i)&&(r.textContent=J().find(u=>u.id===n)?.name??o.name),K()}}};i.addEventListener("keydown",c=>{c.key==="Enter"?(c.preventDefault(),a(!0)):c.key==="Escape"&&(c.preventDefault(),a(!1))}),i.addEventListener("blur",()=>a(!0)),i.addEventListener("click",c=>c.stopPropagation()),i.addEventListener("dblclick",c=>c.stopPropagation())}function Vm(){for(let e of ee.querySelectorAll(".drag-over"))e.classList.remove("drag-over")}function JA(e){return e.dataTransfer.types.includes(Q1)||e.dataTransfer.types.includes(Ru)}function Pz(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(Ru,n),e.dataTransfer.setData(q1,t.dataset.workspaceId??""),e.dataTransfer.setData("text/plain",n),t.classList.add("dragging"),Um=!0,K();return}let r=e.target.closest(".file-item[data-file]");r&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData(Q1,r.dataset.file),e.dataTransfer.setData(q1,r.dataset.workspaceId??""),e.dataTransfer.setData("text/plain",r.dataset.file),r.classList.add("dragging"),zm=!0,K())}function Nz(){for(let e of ee.querySelectorAll(".dragging"))e.classList.remove("dragging");Vm(),(zm||Um)&&(zm=!1,Um=!1,K())}function Dz(e){if(!JA(e))return;e.preventDefault();let t=e.target.closest("[data-workspace-id]"),r=ee.querySelector(".dragging")?.closest("[data-workspace-id]")?.dataset.workspaceId??null,i=t&&r&&t.dataset.workspaceId===r||!t&&!r;if(e.dataTransfer.dropEffect=i?"none":"move",Vm(),!i)if(t){let s=t.dataset.workspaceId;for(let a of ee.querySelectorAll(`[data-workspace-id="${CSS.escape(s)}"]`))a.classList.contains("dragging")||a.classList.add("drag-over")}else{let a=e.dataTransfer.types.includes(Ru)?"[data-default-bundles]":"[data-default-reports]",c=ee.querySelector(a);c&&c.classList.add("drag-over")}}function zz(e){ee.contains(e.relatedTarget)||Vm()}async function Uz(e){if(!JA(e))return;e.preventDefault(),e.stopPropagation(),Vm();let t=e.target.closest("[data-workspace-id]"),r=t?t.dataset.workspaceId:null,n=e.dataTransfer.getData(q1)||null;if(e.dataTransfer.types.includes(Ru)){let s=e.dataTransfer.getData(Ru);if(!s)return;if(n&&n!==r&&Gv(n,s)){let a=(l.bundles??[]).find(p=>p.integrity===s)?.name??s,c=J().find(p=>p.id===n),{confirmed:u}=await gA({name:a,workspaceName:c?.name??""});if(!u)return;try{await Nf(n,s)}catch(p){console.warn(`Failed to remove '${a}' from source workspace ${n} remote:`,p)}}r&&await vs(s,r),n&&n!==r&&await Uy(s,n),K();return}let o=e.dataTransfer.getData(Q1);if(!o)return;if(n&&n!==r&&Ga(n,o)){let s=J().find(c=>c.id===n),{confirmed:a}=await yA({name:o,workspaceName:s?.name??""});if(!a)return;try{await Pf(n,o)}catch(c){console.warn(`Failed to remove '${o}' from source workspace ${n} remote:`,c)}}r&&await ys(o,r),n&&n!==r&&await td(o,n),l.currentWorkspace&&(l.currentWorkspace===r||l.currentWorkspace===n)?await Pr(l.currentWorkspace):K()}async function Wm({forgetLastView:e=!0,resetNavigation:t=!0}={}){Ie.reset({force:t}),Cu?.remove(),Cu=null;let r=++jt;if(qs=!0,Hm=!1,ZC(),iw(),Ds(),$u(),Bf(l.serverMode!=="e2e"),Q.setForcedOff(!0),Q.setProtocolLocked(l.serverMode!=="e2e"||!!Dr),Q3({forgetLastView:e}),l.triage.clear(),_()){let n=Xs();if(Zv()&&(await n,r!==jt))return}else{if(l.managedSession=null,l.managedTeams=[],await hn(),r!==jt||(await ad(),r!==jt))return;Qc()}document.dispatchEvent(new CustomEvent("managed-client-mode-change")),bm(),qA(),jn(Q.status),S(),await K()}async function ZA(e){if(e!==void 0&&!T5(e))throw new TypeError(`Unknown managed preview role: ${e}. Expected ${yd.join(", ")}.`);if(await ht(),e===void 0&&(Dr||_()))return;let t=jt,r=e===void 0?null:await He();t===jt&&(Dr??={serverMode:l.serverMode,serverModeConfig:l.serverModeConfig,serverModeSelection:l.serverModeSelection,localMode:l.localMode,managed:l.managed},r&&r.setPreviewRole(e),l.serverMode="managed",Xn(!1),l.managedSession=null,l.managedTeams=[],await Wm({forgetLastView:!1}))}async function Hz(){let e=Dr,t=J1;Dr=null,J1=null,JC(),Object.assign(l,e),await Wm({forgetLastView:!1}),t&&Ks(t)}function Ks(e,{runtime:t=!0}={}){if(Dr){J1=e;return}Dm(!1);let r=sr()!=null,n=_(),o=l.serverMode;Rn()&&e.managed&&(l.serverModeSelection="managed"),Ep(e.mode),Rn()&&e.managed&&Xn(!1);let i=o!==l.serverMode;if(l.managed=e.managed,t&&(l.deepviewScanServer=e.mode==="managed"?null:e.deepviewScanServer??null),bm(),Bf(l.serverMode!=="e2e"),Q.setProtocolLocked(l.serverMode!=="e2e"),ib(e),n!==_()){Wm({forgetLastView:!1,resetNavigation:r&&!Rn()&&!ha(e.mode,location.pathname)}).catch(s=>console.warn("client mode transition:",s));return}jn(Q.status),i&&l.serverMode==="e2e"&&KA()&&Q.isEnabled()&&pd().then(s=>{if(!(!s||l.serverMode!=="e2e"))for(let a of s.triageSync.openSessions)s.openWorkspace(a.workspaceId)}).catch(s=>console.warn("sync: resume failed",s)),i&&K(),_()&&Xs()}function Xs(){if(Fl?.generation===jt)return Fl.promise;Gs=!0;let e={generation:jt,promise:null};return Fl=e,e.promise=jz().finally(()=>{Fl===e&&(Fl=null,K())}),e.promise}async function jz(){let e=jt,t=++zA,r=()=>e===jt&&t===zA&&_();try{let n=l.managedSession,o=await r5({fallback:n});if(!r()||(l.managedSession=o,Gs=!1,(!n||n.id!==o?.id||n.role!==o?.role)&&(qs=!0),K(),QC(o),n&&(n.id!==o?.id||n.role!==o?.role)?(l.managedTeams=[],l.bundles=[],Ds(),$u(),Ie.reset(),Dn({history:!1})):l.currentView in jm&&Ys(l.currentView)&&S({animate:!1}),GA(),b1(),!await ex(r)))return;document.querySelector("base")||(Cu=document.createElement("base"),Cu.href="/",document.head.prepend(Cu)),Ie.active&&Object.hasOwn(Xi,l.currentView)&&!Ys(l.currentView)?await Ie.navigate({view:Ys("manage")?"manage":"home"},{replace:!0}):o&&await Ie.start(Kz)}catch(n){console.warn("managed: session probe failed:",n)}finally{r()&&(Gs||qs)&&(Gs=!1,qs=!1,K())}}async function ex(e,{strict:t=!1,signal:r=Es(),reuse:n=!1,revision:o=null}={}){let i=jt,s=l.managedSession,c=await Vz({generation:i,session:s,signal:r,reuse:n,revision:o})??(t?null:l.managedTeams);if(r.aborted||c===null||!e()||i!==jt||!_())return!1;let u=l.managedTeams.find(h=>h.id===l.currentManagedTeam)?.name,p=e5(c);l.managedTeams=c,qs=!1;let f=l.currentView==="bundles"?l.bundleDetails?.managedId:null;if(x5(l,c,p)||f&&p.has(`bundle:${f}`)){let h=c.find(v=>v.id===l.currentManagedTeam),g=h&&(l.currentManagedReport===null||h.reports.some(v=>v.id===l.currentManagedReport)),b=f?bt({view:"bundles",teamId:l.currentManagedTeam,bundleId:f,bundleTab:l.bundleDetailsTab},c):g?bt({view:l.currentView==="links"?"findings":l.currentView,teamId:h.id,reportId:l.currentManagedReport},c):null;Bl=null;let y=Dn({history:!1}),k=Ze();if(await y,t)return k===Ze()&&i===jt&&l.managedSession?.id===s?.id&&l.managedSession?.role===s?.role&&_()&&await Ie.navigate(b??{view:"home"},{replace:!0}),e();if(!e())return!1}return u!==c.find(h=>h.id===l.currentManagedTeam)?.name&&S({animate:!1}),K(),!0}function Ys(e){let t=l.managedSession?.role;return e==="manage-links"&&!l.managed?.allowShare?!1:["admin","manage"].includes(t)&&(!Wz.has(e)||t==="admin")}async function Kz(e,t){Hm=!0;try{return await Gz(e,t)}finally{t()&&(Hm=!1,K())}}async function Gz(e,t){let r=Bl===Ze()?Bl:null;if(St(),(["findings","files","bundles"].includes(e?.view)||e?.finding)&&!await ex(t,{reuse:!0}))return!1;let n=[];if(e?.view==="bundles"&&e.teamSlug==null&&(!Ys("manage-bundles")||(n=await o5(),!t()||!_()))||(e=Ap(e,l.managedTeams,n),!e))return!1;let o=r!==null&&Bl===r&&l.currentManagedTeam===e.teamId&&l.currentManagedReport===e.reportId;if(!t()||!_()||e.view!=="home"&&(!l.managedSession||l.managedSession.role==="none"))return!1;if(e.finding){let{revealFinding:s}=await Promise.resolve().then(()=>(Nm(),IA));if(!t())return!1;let a=await s({...e.finding,teamId:e.teamId,reportId:e.reportId},{openManagedReport:(c,u)=>wo(c,u,{history:!1}),isCurrent:t});return t()?a.ok?(Bl=Ze(),$i(),bt({view:"findings",teamId:l.currentManagedTeam,reportId:l.currentManagedReport,finding:{id:e.finding.id}},l.managedTeams)):(a.reason&&_t(a.reason),!1):!1}if(e.view==="bundles"){let s=e.teamId==null?n.map(qf):k5(l.managedTeams);return await qz(e,s,t)?bt({...e,bundleTab:l.bundleDetailsTab},l.managedTeams,n):!1}if(e.view==="home")return Dn({history:!1});if(Object.hasOwn(Xi,e.view))return zs(e.view,{...e,history:!1});let i=l.managedTeams.find(s=>s.id===e.teamId);return!i||!o&&!await wo(i,e.reportId,{history:!1})||!t()?!1:(l.currentView!==e.view&&Ye(),l.currentView=l.currentLinks?"links":e.view,document.body.classList.remove("report-fullscreen"),S({animate:!1}),Bl=Ze(),$i(),K(),document.querySelector("#main-content")?.scrollTo({top:0}),bt({...e,view:l.currentView==="links"?"findings":l.currentView},l.managedTeams))}async function qz({bundleId:e,teamId:t,bundleTab:r},n,o){let i=Ze(),s;try{s=await Uf(e)}catch{return!1}try{if(!o()||i!==Ze()||!_())return!1;let a=Vd(s,s.integrity);a.managedId=e;let c=n.find(u=>u.managedId===e);return!c||c.integrity!==s.integrity?!1:(l.bundles=n,Ye(),ho(c.integrity,r),l.bundleDetails=a,l.currentManagedTeam=t,l.currentManagedReport=null,l.reports=[],document.body.classList.remove("report-fullscreen"),S({animate:!1}),K(),document.querySelector("#main-content")?.scrollTo({top:0}),!0)}catch(a){return o()&&a.name!=="AbortError"&&_t(`Couldn't open bundle: ${a.message}`,{kind:"error"}),!1}}async function zs(e,t={}){if(t.history!==!1&&_()&&(Ie.active||await Xs(),Ie.active))return Ie.navigate({view:e,...t.actor?{actor:t.actor}:{},...t.bundleId?{bundleId:t.bundleId}:{}});if(!(e in jm)||!_()||!Ys(e))return!1;let r=St(),n=jt;try{let o=await He();e==="manage-import"&&Ys(e)&&await o.loadWorkspaceImportPage()}catch(o){return console.warn(jm[e],o),!1}return n!==jt||r!==Ze()||!_()||!Ys(e)?!1:(l.currentView=e,l.scanSelection=e==="manage-scans"&&t.bundleId?{bundleId:t.bundleId}:null,S({animate:!1}),K(),Xs(),document.querySelector("#main-content")?.scrollTo({top:0}),e==="manage-history"&&document.dispatchEvent(new CustomEvent("managed-history-filter",{detail:{actor:t.actor??""},bubbles:!0,composed:!0})),!0)}function ht(){return Yz??=Xz().then(()=>document.querySelector("app-sidebar")?.removeAttribute("inert"))}async function Xz(){let e=sr();if(e){Ep(e.mode),l.managed=e.managed,bp().then(o=>{if(o&&o!=="standalone")return Ks(o)}).catch(o=>console.warn("server mode revalidation:",o));return}Dm(!uc());let t=bp(),r=await ob(t,uc()?0:3e3),n=sr();if(n)return r&&r!=="standalone"?Ks(r):Ks(n,{runtime:!1});if(r&&r!=="standalone")return Ks(r);r==="standalone"&&gp(),l.serverMode="standalone",l.serverModeConfig=null,l.serverModeSelection=null,Xn(r===null),Bf(!0),Dm(!1),jn(Q.status),K(),r===null&&t.then(o=>{let i=sr(),s=o&&o!=="standalone"?o:i??o;if(s==="standalone"){if(gp(),Dr){Dr.serverMode="standalone",Dr.serverModeConfig=null,Dr.serverModeSelection=null,Dr.localMode=!1;return}return Xn(!1),jn(Q.status),K()}if(s)return Ks(s,{runtime:s!==i})}).catch(o=>console.warn("server mode probe:",o))}function Jz(){let e=ee?.querySelector("#user-menu"),t=ee?.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 Zz(e){Li=e,ee=e.renderRoot,G1=ee.querySelector("#file-list"),j4(ee.querySelector("#encryption-toggle")),Z4(ee.querySelector("#storage-status")),ee.addEventListener("click",NA),ee.addEventListener("keydown",t=>{(t.key==="Enter"||t.key===" ")&&t.target.closest?.('[data-action="toggle-client-mode"]')&&(t.preventDefault(),NA(t))}),ee.addEventListener("dblclick",Oz),ee.addEventListener("dragstart",Pz),ee.addEventListener("dragend",Nz),ee.addEventListener("dragover",Dz),ee.addEventListener("dragleave",zz),ee.addEventListener("drop",Uz),Dt(ee,Tz),ee.querySelector("#sidebar-search-input")?.addEventListener("input",Iz),Jz(),jn(Q.status),sr()||Dm(!uc()),K(),Q.onServerInfo(t=>{if(l.serverMode!=="e2e")return;let r=sr(),n=r&&{...r,...l.deepviewScanServer?{deepviewScanServer:l.deepviewScanServer}:{}};return Ks(rb(n,t))}),ht(),l.serverMode==="managed"&&Xs()}var Li,ee,G1,Eu,Q1,q1,Ru,zm,Um,mz,LA,Ii,Ol,Mu,FA,bz,yz,HA,Cz,Ez,Rz,Mz,jA,j1,V1,Tz,Lz,W1,Y1,K1,X1,Dr,J1,jt,zA,Fl,Gs,qs,Hm,Cu,Vz,jm,Wz,Bl,Yz,Z1,zn=w(()=>{"use strict";Cs();Zt();T();Mt();qe();D();Qr();Zt();Kf();Xa();qa();Yf();$5();S5();Za();M5();ao();Jn();Jf();om();Z0();D4();_u();v1();Q4();zt();eA();nk();tA();ym();xi();wi();iA();K0();aA();cA();uA();fA();mA();bA();vA();kA();$A();en();ft();pl();go();lo();Li=null,ee=null,G1=null;J5();Eu=typeof location>"u"||location.hostname.endsWith(".github.io")?"":`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/api/sync`,Q1="application/x-deepview-report",q1="application/x-deepview-source-ws",Ru="application/x-deepview-bundle",zm=!1,Um=!1,mz={default:"Reports","claude-security":"Claude Security","codex-security":"Codex Security",deepsec:"DeepSec",piolium:"Piolium",[at]:"Links"},LA=["default","claude-security","codex-security","deepsec","piolium",at],Ii="",Ol=!1,Mu=new Map,FA="";bz=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>`,yz=d`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.35" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2.5H3.5v11H8M10 5l3 3-3 3M13 8H6"/></svg>`;HA=d`${V(Er)}`;Cz=d`${V(ri)}`,Ez=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>`,Rz=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>`,Mz=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>`,jA=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>`;j1=(e,t)=>Re(e).localeCompare(Re(t));V1=!1;Je(()=>{K()});Wv(VA);Tz={placement:"right",gate:e=>{if(e.dataset.tooltipRepo||e.dataset.tooltipBundle)return!0;let t=e.querySelector(".file-label");return!t||(e.dataset.tooltip??"")!==t.textContent?!0:t.scrollWidth>t.clientWidth}};Lz={off:"Sync off",online:"Online",offline:"Offline",connecting:"Connecting\u2026",error:"Sync error"};Q.onStatusChange(jn);W1=!1,Y1=!1;Q.onPersistenceDegraded(e=>{jn(),e?YA():Y1=!1});K1=!1,X1=!1;Q.onProxyAuthRequired(e=>{jn(),e?XA():X1=!1});Dr=null,J1=null,jt=0,zA=0,Fl=null,Gs=!0,qs=!0,Hm=!1,Cu=null;V3((e,t,r)=>ex(e,{strict:!0,signal:t,revision:r}));Vz=_5(n5);jm={manage:"admin: bundle load failed:","admin-users":"admin: bundle load failed:","manage-repos":"admin: repos bundle load failed:","manage-reports":"admin: reports bundle load failed:","manage-bundles":"admin: bundles bundle load failed:","manage-history":"admin: history bundle load failed:","manage-teams":"admin: teams bundle load failed:","manage-import":"admin: import bundle load failed:","manage-links":"admin: links bundle load failed:","manage-scans":"admin: scans bundle load failed:"},Wz=new Set(["admin-users","manage-repos","manage-teams","manage-import"]),Bl=null;document.addEventListener("managed-bundle-open",e=>{if(_()&&typeof e.detail?.id=="string"){let t=qf(e.detail),r=l.managedTeams,n=r.find(o=>o.id===l.currentManagedTeam&&o.bundles?.some(i=>i.id===t.managedId))??r.find(o=>o.bundles?.some(i=>i.id===t.managedId));Ie.navigate(Ja(r,t,n?.id,l.currentView==="bundles"?l.bundleDetailsTab:"overview"))}});document.addEventListener("managed-import-complete",()=>{Xs()});document.addEventListener("managed-feed-closed",()=>{Gs=!0,Ds(),$u(),Dn({history:!1}).then(()=>Xs()),_t("Workspace access changed. Refreshing your session.")});document.addEventListener("managed-notice",e=>_t(e.detail.message,{kind:"error"}));document.addEventListener("managed-admin-navigate",e=>{let t=e.detail?.view,r=e.detail?.actor;typeof t=="string"&&zs(t,{actor:r})});Z1=class extends X{static styles=[A(Ai),A(z4)];render(){return d`<div class="sidebar-header"><h2 class="brand"><button class="brand-button" type="button" data-action="go-home"><img class="brand-icon" src="./icon.svg" width="18" height="18" alt=""> <span class="brand-name">DeepView</span></button> <span class="brand-tag" data-action="toggle-client-mode">${mn()}</span></h2><button id="encryption-toggle" type="button" hidden></button> <button id="sidebar-toggle" type="button" 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…" aria-label="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> <button id="manage-status" type="button" hidden data-action="manage" aria-label="Manage">${V(Qf)}</button></div><div id="user-menu" popover class="user-menu"></div>`}firstUpdated(){Zz(this)}};customElements.define("app-sidebar",Z1)});var qm,sx=w(()=>{qm=`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)}}
154
+ `});var Pl,Jm=w(()=>{Pl=`.managed-comment{container:managed-comment / inline-size;white-space:normal}.managed-comment-row{display:grid;grid-template-columns:minmax(0,max-content) minmax(0,1fr) auto;align-items:start;gap:.35rem .65rem;line-height:1.5}.managed-comment-author{grid-column:1;grid-row:1;display:flex;align-items:center;gap:.45rem;min-width:0;max-width:14rem;& strong{overflow:hidden;text-overflow:ellipsis;font-weight:600}}.managed-comment-avatar{position:relative;display:inline-flex;align-items:center;justify-content:center;flex:none;width:1.3rem;height:1.3rem;overflow:hidden;border-radius:50%;background:rgb(from var(--muted) r g b / .15);color:var(--muted);font-size:.65rem;font-weight:600;& img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}& img[hidden]{display:none}}.managed-comment-body{grid-column:2;grid-row:1;min-width:0;white-space:pre-wrap;overflow-wrap:anywhere;& 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}}.managed-comment-time{color:var(--muted);font-size:.7rem;font-weight:400;white-space:nowrap;text-align:right}.managed-comment-meta{grid-column:3;grid-row:1;justify-self:end;display:flex;align-items:center;gap:.5rem;min-height:1.3rem}.managed-comment-actions{display:flex;align-items:center;gap:.15rem}.managed-comment-row:not(:has(.managed-comment-author)){grid-template-columns:minmax(0,1fr) auto;.managed-comment-body{grid-column:1}.managed-comment-meta{grid-column:2}}@container managed-comment (max-width: 28rem){.managed-comment-row:has(.managed-comment-meta){grid-template-columns:minmax(0,max-content) minmax(0,1fr);.managed-comment-meta{grid-column:1 / -1;grid-row:1}.managed-comment-author,.managed-comment-body{grid-row:2}}.managed-comment-row:not(:has(.managed-comment-author)){grid-template-columns:minmax(0,1fr)}.managed-comment-author{max-width:9rem}}
155
+ `});var FT,LT=w(()=>{FT=`dialog{width:min(94vw,800px);max-width:800px;max-height:calc(100dvh - 4rem);margin-block:2rem;padding:0}dialog[open]{display:flex;flex-direction:column}.discussion-header{display:flex;align-items:start;gap:1rem;padding:1rem 1.25rem;border-bottom:1px solid var(--border)}.discussion-heading{flex:1;min-width:0}header h3{display:flex;align-items:center;gap:.5rem;margin:0;line-height:1.5}.comment-count{padding:.05rem .4rem;border-radius:1rem;background:rgb(from var(--muted) r g b / .12);color:var(--muted);font-size:.72rem;font-weight:400}.discussion-finding{margin-top:.4rem;font-size:.85rem;overflow-wrap:anywhere}.loc{margin-top:.25rem;color:var(--muted)}.header-actions{display:flex;flex:none;align-items:center;gap:.7rem}.header-actions button{display:inline-flex;flex:none;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:0;border:0;background:transparent;color:var(--muted);line-height:0;& svg{display:block;width:1rem;height:1rem}&:hover:not(:disabled){color:var(--text)}&:disabled{opacity:.5}}.comment-action{display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:.2rem;border:1px solid transparent;border-radius:4px;background:transparent;color:var(--muted);cursor:default;& svg{width:.9rem;height:.9rem}&:hover:not(:disabled),&[aria-pressed=true]{border-color:var(--border);background:rgb(from var(--muted) r g b / .08);color:var(--text)}&.danger:hover:not(:disabled),&[aria-expanded=true]{color:var(--critical, #f87171)}&:disabled{opacity:.5}}button:focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:3px}.discussion-log{min-height:0;max-height:50dvh;overflow-y:auto;overscroll-behavior:contain;padding:.5rem;scrollbar-gutter:stable}.comments{display:flex;flex-direction:column;gap:.15rem;list-style:none}.comment{padding:.6rem .75rem;border-radius:6px;font-size:.84rem}.comment:hover{background:rgb(from var(--muted) r g b / .035)}.comment.editing{background:rgb(from var(--accent) r g b / .08);box-shadow:inset 0 0 0 1px rgb(from var(--accent) r g b / .2)}.delete-confirm{display:flex;align-items:center;justify-content:end;flex-wrap:wrap;gap:.5rem;margin-top:.6rem;color:var(--muted);font-size:.75rem;& button{padding:.25rem .55rem;border:1px solid var(--border);border-radius:4px;background:transparent;color:var(--text);font:inherit;&:hover:not(:disabled){background:rgb(from var(--muted) r g b / .08)}&.danger{color:var(--critical, #f87171)}&:disabled{opacity:.5}}}.empty-discussion{padding:2.5rem 0;color:var(--muted);text-align:center;font-size:.85rem}.composer{padding:1rem 1.25rem;border-top:1px solid var(--border)}.composer-label{display:flex;align-items:center;gap:.45rem;margin-bottom:.6rem;font-size:.78rem}.composer-label strong{font-weight:600}textarea{min-height:4.5rem;max-height:25dvh;font-size:.84rem}.nwd-actions{border:0;padding-top:0;margin-top:.65rem}.shortcut{color:var(--muted);font-size:.7rem}.error{padding:.65rem 1.25rem;color:var(--danger, #c44);font-size:.8rem}.read-only{padding:1rem 1.25rem;border-top:1px solid var(--border);color:var(--muted);font-size:.8rem}@media(width<=480px){.discussion-header,.composer{padding:.8rem}.discussion-log{padding-inline:.3rem}.comment{padding-inline:.5rem}.shortcut{max-width:8rem}}
156
+ `});var OT={};kg(OT,{openManagedCommentsDialog:()=>IU});function IU(e,t){return le("managed-comments-dialog",{finding:e,changed:t})}var vx,PT=w(()=>{"use strict";T();qe();D();E0();bl();wl();qh();ft();ue();sx();Jm();LT();vx=class extends F{static styles=[...F.styles,A(qm),A(Pl),A(FT)];static properties={finding:{attribute:!1},changed:{attribute:!1},_comments:{state:!0},_value:{state:!0},_editing:{state:!0},_busy:{state:!0},_error:{state:!0},_deleting:{state:!0}};constructor(){super(),this.finding=null,this.changed=null,this._comments=[],this._value="",this._editing=null,this._busy=!1,this._error="",this._deleting=null}connectedCallback(){super.connectedCallback(),document.addEventListener("managed-comments-reset",this._close)}disconnectedCallback(){this._unsubscribeComments?.(),this._unsubscribeComments=null,document.removeEventListener("managed-comments-reset",this._close),super.disconnectedCallback()}beforeOpen(){this._current=Zd(this.finding?._managedReportId),this._comments=Pn(this.finding),this._unsubscribeComments?.(),this._unsubscribeComments=Wh(this.finding.id,this._commentsChanged),this._refresh({scroll:!0})}_commentsChanged=()=>{if(!this.isConnected)return;if(!this._current()){this._close();return}let t=this.renderRoot.querySelector(".discussion-log"),r=t&&t.scrollHeight-t.scrollTop-t.clientHeight<32;this._comments=Pn(this.finding),r&&this._scrollToLatest()};_close=()=>this._finish(null);_scrollToLatest=async()=>{await this.updateComplete;let t=this.renderRoot.querySelector(".discussion-log");t&&(t.scrollTop=t.scrollHeight)};_refresh=async({scroll:t=!1}={})=>{if(!this._current()){this._close();return}let r=this.renderRoot.querySelector(".discussion-log"),n=r&&r.scrollHeight-r.scrollTop-r.clientHeight<32;this._busy=!0,this._error="";let o=await gl(this.finding._managedReportId);if(this.isConnected){if(!this._current()){this._close();return}if(this._busy=!1,!o){this._error="Could not load comments. Please retry.";return}this._comments=Pn(this.finding),this.changed?.(),(t||n)&&this._scrollToLatest()}};_edit(t){this._deleting=null,this._editing=t,this._value=t.body,this._error="",this.updateComplete.then(()=>this.renderRoot.querySelector("textarea")?.focus())}_cancelEdit=()=>{this._editing=null,this._value="",this._error=""};_delete=async t=>{if(this._busy||!this._current())return;this._busy=!0,this._error="";let r=await u3(this.finding,t);if(!this.isConnected){r===204&&this._current()&&this.changed?.();return}if(!this._current()){this._close();return}if(this._busy=!1,this._deleting=null,r===409){await this._refresh(),this.isConnected&&(this._error="This comment changed elsewhere. Review the latest version before deleting it.");return}if(r!==204){this._error=r===403||r===404?"This comment is unavailable or you no longer have permission to delete it.":"Could not delete the comment. Please retry.";return}this._comments=Pn(this.finding),this._editing?.id===t.id&&this._cancelEdit(),this.changed?.()};_save=async()=>{let t=this._value.trim();if(this._busy||!t||t.length>1e4||!this._current())return;this._busy=!0,this._error="";let r=await d3(this.finding,t,this._editing);if(!this.isConnected)return;if(!this._current()){this._close();return}if(this._busy=!1,r.status===409){if(await this._refresh(),!this.isConnected)return;this._editing=this._comments.find(o=>o.id===this._editing?.id)??this._editing,this._error="This comment changed elsewhere. Your draft is kept. Review the latest version above before saving again.";return}if(!r.comment){this._error=r.status===403||r.status===404?"You no longer have permission to save this comment.":"Could not save the comment. Your draft is kept; please retry.";return}let n=this._editing!=null;this._comments=Pn(this.finding),this._cancelEdit(),this.changed?.(),n||await this._scrollToLatest(),await this.updateComplete,this.renderRoot.querySelector("textarea")?.focus()};_keydown=t=>{t.key==="Enter"&&(t.ctrlKey||t.metaKey)&&(t.preventDefault(),this._save())};_commentActions(t,r){let n=r&&t.authorId===l.managedSession?.id,o=Gh(t);return!n&&!o?m:d`${n?d`<button type="button" class="comment-action" aria-label="Edit comment" aria-pressed="${this._editing?.id===t.id}" ?disabled="${this._busy}" @click="${()=>this._edit(t)}">${V(O5)}</button>`:m} ${o?d`<button type="button" class="comment-action danger" aria-label="Delete comment" aria-expanded="${this._deleting===t.id}" ?disabled="${this._busy}" @click="${()=>{this._deleting=this._deleting===t.id?null:t.id}}">${V(P5)}</button>`:m}`}_deleteConfirmation(t){return this._deleting!==t.id||!Gh(t)?m:d`<div class="delete-confirm" role="group" aria-label="Confirm comment deletion"><span>Delete this comment?</span> <button type="button" ?disabled="${this._busy}" @click="${()=>{this._deleting=null}}">Cancel</button> <button type="button" class="danger" ?disabled="${this._busy}" @click="${()=>this._delete(t)}">Delete</button></div>`}render(){let t=Kh();return d`<dialog aria-labelledby="comments-title" @close="${this._onClose}"><header class="discussion-header"><div class="discussion-heading"><h3 id="comments-title">Discussion <span class="comment-count">${this._comments.length}</span></h3>${this.finding?.title?d`<p class="discussion-finding">${this.finding.title}</p>`:m}<p class="loc">${this.finding?.file??""}</p></div><div class="header-actions"><button type="button" class="refresh" aria-label="Refresh discussion" ?disabled="${this._busy}" @click="${()=>this._refresh()}"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8M21 3v5h-5"/></svg></button> <button type="button" class="close" aria-label="Close discussion" @click="${this._close}"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="m6 6 12 12M6 18 18 6"/></svg></button></div></header><section class="discussion-log" role="log" aria-label="Discussion" aria-relevant="additions text" aria-busy="${this._busy}"><ol class="comments">${this._comments.map(r=>d`<li class="${`comment${this._editing?.id===r.id?" editing":""}`}">${yl(r,yo(r.body),this._commentActions(r,t))} ${this._deleteConfirmation(r)}</li>`)}</ol>${this._comments.length===0?d`<p class="empty-discussion">${this._busy?"Loading discussion\u2026":t?"No comments yet. Start the discussion below.":"No comments yet."}</p>`:m}</section>${this._error?d`<p class="error" role="alert">${this._error}</p>`:m} ${t?d`<form class="composer" @submit="${r=>{r.preventDefault(),this._save()}}"><label class="composer-label" for="comment-body">${M0(l.managedSession.id,l.managedSession.login)} ${this._editing?"Edit your comment":d`Reply as <strong>${l.managedSession.login}</strong>`}</label> <textarea id="comment-body" rows="3" maxlength="${1e4}" .value="${this._value}" placeholder="Write a comment…" aria-describedby="comment-shortcut" ?disabled="${this._busy}" @input="${r=>{this._value=r.target.value}}" @keydown="${this._keydown}"></textarea><footer class="nwd-actions"><span id="comment-shortcut" class="shortcut">Ctrl / ⌘ + Enter to send</span><span class="nwd-spacer"></span> ${this._editing?d`<button type="button" class="quiet" ?disabled="${this._busy}" @click="${this._cancelEdit}">Cancel edit</button>`:m} <button type="submit" class="primary" ?disabled="${this._busy||!this._value.trim()}">${this._editing?"Save changes":"Comment"}</button></footer></form>`:d`<p class="read-only">You have read-only access to this discussion.</p>`}</dialog>`}};customElements.define("managed-comments-dialog",vx)});T();Ne();Mt();Gn();Ce();globalThis[Symbol.for("@rray/frontend")]={LitElement:X,html:d,nothing:m,render:se,unsafeCSS:A,StateElement:G,classMap:N,repeat:re,styleMap:Se};or();D();Qr();zn();xi();go();Nm();wf();D();Qr();Ad();var QA={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 eT(){HC(async(e,t,r)=>{let n=Ky(e);try{return await nl(e,n,QA[r]??QA.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}})}Qr();T();ue();var tx=class extends F{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",tx);function tT({retry:e=!1}={}){return le("sync-auth-dialog",{retry:!!e})}function rT(){UC(async({retry:e})=>{try{return await tT({retry:e})}catch(t){return console.warn("Sync auth dialog failed to open:",t),null}})}T();D();var Km="https://triage.space/",Qz=[{hostname:"deepaudit.dev",pathPrefix:"/",supportsSync:!0},{hostname:"chalker.github.io",pathPrefix:"/deepview/",supportsSync:!1}];function eU(){for(let e of Qz)if(location.hostname===e.hostname&&location.pathname.startsWith(e.pathPrefix))return e;return null}var tU=["deepview.triage","deepview.triage.pending"],rU="deepview.repoUrls";function nU(){try{for(let e of tU)if(localStorage.getItem(e))return!0}catch{return!0}try{let e=localStorage.getItem(rU);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 oU(){if(nU())return!0;let e=[];try{e=await me()}catch{return!0}if(e.length>0)return!0;try{if(J().length>0)return!0}catch{return!0}try{return await Nc()}catch{return!0}}var rx=class extends X{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="${Km}" target="_blank" rel="noopener noreferrer">${Km}</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",rx);function iU(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 nT(){let e=eU();return e?await oU()?await iU(e)?(location.assign(Km),!0):!1:(location.replace(Km),!0):!1}zt();T();D();ue();Ms();var nx=class extends F{static styles=[...F.styles,A(Mr)];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 Iv({encoded:this.encoded,password:this._password});if(this._settled)return;let r=J().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=Sn(this._name);if(!t)return;let r=J().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 J())if(r.id!==this._decoded.id&&Sn(r.name)===t)return r;return null}_onKeydown=t=>{t.key==="Enter"&&(t.preventDefault(),this._stage==="password"?this._onUnlock():this._stage==="name"&&this._onAttach())};_passwordStage(){return d`<p class="nwd-note">Someone shared a workspace with you. Enter the password they sent separately to attach it to this browser.</p><label class="wsl-field"><span>Password</span> <input type="password" class="nwd-input" autocomplete="off" data-1p-ignore="true" data-lpignore="true" data-bwignore="true" data-form-type="other" name="dv-share-link-unlock" maxlength="1024" .value="${this._password}" @input="${this._onPasswordInput}" @keydown="${this._onKeydown}"></label> ${this._error?d`<p class="wsl-error" role="alert">${this._error}</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!this._password||this._busy}" @click="${this._onUnlock}">${this._busy?"Unlocking\u2026":"Unlock"}</button></footer>`}_alreadyAttachedStage(){let t=this._existingById;return d`<p class="nwd-note">This workspace is already attached as <strong>"${t?.name??""}"</strong>. Open it from the sidebar.</p><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" class="primary" @click="${this._onCancel}">Close</button></footer>`}_nameStage(){if(this._existingById)return this._alreadyAttachedStage();let t=Sn(this._name),r=this._nameCollision(t),n=!!t&&!r;return d`<p class="nwd-note">Pick a name for the workspace on this device. The shared identity is preserved either way — only the visible label changes.</p><label class="wsl-field"><span>Workspace name</span> <input type="text" class="nwd-input" data-role="name" placeholder="Workspace name" maxlength="200" .value="${this._name}" @input="${this._onNameInput}" @keydown="${this._onKeydown}"></label> ${r?d`<p class="wsl-error" role="alert">A workspace named "${t}" already exists on this device. Pick a different name.</p>`:m}<footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" ?disabled="${!n}" @click="${this._onAttach}">Attach</button></footer>`}render(){let t=this._stage==="password"?"Attach shared workspace":this._existingById?"Workspace already attached":"Name the workspace";return d`<dialog @close="${this._onClose}"><header><h3>${t}</h3></header>${this._stage==="password"?this._passwordStage():this._nameStage()}</dialog>`}};customElements.define("workspace-unlock-link-dialog",nx);function oT({encoded:e}={}){return si("workspace-unlock-link-dialog",{encoded:e??""},t=>{t.encoded=""})}v1();D();zn();var Vt=null,Gm=!1,Au=null;function sU(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 aU(){if(Vt)return Vt;Vt=document.createElement("div"),Vt.id="lock-overlay",Vt.setAttribute("role","dialog"),Vt.setAttribute("aria-modal","true"),Vt.setAttribute("aria-label","Unlock DeepView"),Vt.innerHTML=`
49
157
  <div class="lock-overlay-card">
50
158
  <div class="lock-overlay-icon" aria-hidden="true">
51
159
  <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>
@@ -62,31 +170,58 @@ ${r}`}">${rv}<span class="file-label">${n}</span></button></li>`}function nv(e,t
62
170
  <a href="#" class="lock-overlay-wipe">Wipe local data and start over</a>
63
171
  </p>
64
172
  </div>
65
- `;let e=Me.querySelector("button"),t=Me.querySelector(".lock-overlay-error");return e.addEventListener("click",async()=>{if(!li){li=!0,t.hidden=!0,t.textContent="",e.disabled=!0,e.textContent="Waiting\u2026",_o=new AbortController;try{let n=await Sn({signal:_o.signal})}catch(n){let o=Iv(n);t.textContent=o,t.hidden=!o}finally{li=!1,_o=null,e.disabled=!1,e.textContent="Unlock with passkey"}}}),Me.querySelector(".lock-overlay-wipe").addEventListener("click",async n=>{if(n.preventDefault(),!li&&confirm(`Wipe ALL local DeepView data and start over?
173
+ `;let e=Vt.querySelector("button"),t=Vt.querySelector(".lock-overlay-error");return e.addEventListener("click",async()=>{if(!(Gm||!ox())){Gm=!0,t.hidden=!0,t.textContent="",e.disabled=!0,e.textContent="Waiting\u2026",Au=new AbortController;try{await Yi({signal:Au.signal})}catch(n){let o=sU(n);t.textContent=o,t.hidden=!o}finally{Gm=!1,Au=null,e.disabled=!1,e.textContent="Unlock with passkey"}}}),Vt.querySelector(".lock-overlay-wipe").addEventListener("click",async n=>{if(n.preventDefault(),!(Gm||!ox())&&confirm(`Wipe ALL local DeepView data and start over?
66
174
 
67
175
  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.
68
176
 
69
- 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 Cn()}catch(o){alert(`Wipe failed: ${o?.message??o}. Try again or clear localStorage manually via DevTools.`);return}location.reload()}}),document.body.append(Me),Me}function Bv(){return mt()?X()&&!st():!1}function $h(){if(Bv()){let e=Rv();e.hidden=!1;let t=e.querySelector("button");t&&t.focus()}else if(Me&&(Me.hidden=!0,_o))try{_o.abort()}catch{}}ge($h);$h();var xh=`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)}}
70
- `;var mc=class extends I{static styles=[...I.styles,T(on),T(xh)];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">${sn(t.severity)} ${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",mc);function _h({initial:e="",finding:t=null}={}){return q("comment-dialog",{initial:e,finding:t})}var Sh=`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}
71
- `;var bc=class extends I{static styles=[...I.styles,T(on),T(Sh)];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=Jr(o);return c`<dialog @close="${this._onClose}"><header><h3>${n?"Edit fix link":"Add fix link"}</h3><div class="finding">${sn(t.severity)} ${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",bc);function Ch({initial:e="",finding:t=null}={}){return q("fix-link-dialog",{initial:e,finding:t})}var Lv={critical:"Critical",high:"High",medium:"Medium",low:"Low",high_bug:"High Bug",bug:"Bug",informational:"Informational"},Pv=["critical","high","medium","low","high_bug","bug","informational"];function Ov(e){return Lv[e]??e}function Eh(e){let t=Pv.indexOf(e);return t===-1?999:t}function Ah(e){let t=parseInt(e.line,10);return Number.isFinite(t)?`${e.file}:${t}`:e.file}function Nv(e){let t=P(e),r=a.triage.get(t),n=r?.triage,o=Xr(e),s=r?.color,i=r?.comment??"",l=Ze(e.description??"",e),d=mr(e),p=[d?`### ${Ah(e)} - ${d}`:`### ${Ah(e)}`,""],f=[];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}`),f.length>0&&(p.push(f.join(", ")),p.push("")),l&&(p.push(l.trim()),p.push("")),e.recommendation&&(p.push(`**Recommendation:** ${Ze(e.recommendation,e).trim()}`),p.push("")),e.confidenceReason&&(p.push(`**Confidence reason:** ${Ze(e.confidenceReason,e).trim()}`),p.push("")),e.fix&&(p.push(`**Fix:** ${Ze(e.fix,e).trim()}`),p.push("")),i&&(p.push(`**Comment:** ${i.trim()}`),p.push("")),p.join(`
72
- `)}function Dv(e){let t=(e.groups??[]).flat(),r=[`# ${e.fileName}`,""];if(e.source&&(r.push(`**Source:** ${e.source}`),r.push("")),r.push(`**Findings:** ${t.length}`),r.push(""),t.length===0)return r.join(`
73
- `);let n=new Map;for(let s of t){let i=s.severity??"informational";n.has(i)||n.set(i,[]),n.get(i).push(s)}let o=[...n.keys()].toSorted((s,i)=>Eh(s)-Eh(i));for(let s of o){let i=n.get(s);r.push(`## ${Ov(s)} (${i.length})`),r.push("");for(let l of i)r.push(Nv(l))}return r.join(`
74
- `).trimEnd()+`
75
- `}function Uv(e){return e.map(Dv).join(`
76
- ---
77
-
78
- `)}function zv(e){let t=e.map(n=>n.fileName),r="";return t.length===1?r=t[0]:t.length>1&&(r=Fs(t)),r=r.replace(/\.json$/u,""),`${r||"deepview-report"}.md`}function Th(e){if(e.length===0)return;let t=Uv(e),r=new Blob([t],{type:"text/markdown;charset=utf-8"});Rr(r,zv(e))}ga(()=>{a.currentView==="bundles"&&a.selectedBundle?k():a.currentView==="packages"?k():a.currentView==="repositories"?k():(a.currentView==="findings"||a.currentView==="files")&&V().catch(()=>{})});function Ih(){a.currentView==="bundles"&&a.bundleDetailsTab==="graph"?Qs():Jl()}function pi(){a.currentView==="bundles"&&a.bundleDetailsTab==="graph"?Zs():Xl()}function So(){let e=document.querySelector(".bundle-source-code-wrap"),t=e?.scrollTop??0,r=e?.scrollLeft??0;k();let n=document.querySelector(".bundle-source-code-wrap");n&&(n.scrollTop=t,n.scrollLeft=r)}function wc(e){let r=document.querySelector(e)?.scrollTop??0;k();let n=document.querySelector(e);n&&(n.scrollTop=r)}function _r(){a.viewMode==="table"?wc(".findings-table-list"):k()}function Q(e,t){for(let r of e.composedPath())if(r?.matches?.(t))return r;return null}function Rh(e){let r=Q(e,"[data-gid]")?.dataset?.gid,n=r?yr(r):null;if(!n)return null;let o=Ae(n),s=!1,i=null;for(let d of bt().values())if(d.files.has(o.file)){s=!0,d.repos&&d.repos.size===1&&(i=[...d.repos][0]);break}s||(i=o.repo?.github??o._repoFallback??a.repoUrl??null,i||(i=null));let l=[];return i&&l.push(`Repo: ${i}`),o.file&&l.push(`File: ${o.file}`),o.line!==void 0&&o.line!==null&&o.line!==""&&l.push(`Line: ${o.line}`),o.description&&l.push(`Description: ${o.description}`),o.confidence!==void 0&&o.confidence!==null&&l.push(`Confidence: ${o.confidence}/10`),l.join(`
79
- `)}E.addEventListener("click",e=>{let t=Q(e,"[data-finding-code-bundle]");if(t){let _=t.dataset.findingCodeBundle,j=t.dataset.findingCodeFile,Z=t.dataset.findingCodeLine,ie=Z?parseInt(Z,10):null;a.bundleSourceFile=j||null,a.bundleSourceFindingIdx=null,a.bundleDetailsTab==="code"&&(a.bundleDetailsTab="overview");let pe=()=>{Number.isFinite(ie)&&queueMicrotask(()=>{let te=document.querySelector(`.bundle-source-lineno-row[data-line="${ie}"]`);te&&te.scrollIntoView({block:"start",behavior:"instant"})})};if(a.selectedBundle===_&&a.bundleDetails?.integrity===_){k(),pe();return}a.selectedBundle=_,a.bundleDetails=null,k(),(async()=>(await Jt(_),pe()))();return}let r=e.target.closest("[data-package-expand]");if(r){let _=r.dataset.packageExpand;a.expandedPackages.has(_)?a.expandedPackages.delete(_):a.expandedPackages.add(_),k();return}let n=e.target.closest("[data-package-row-issues]");if(n){let _=n.dataset.packageRowIssues,j=n.dataset.packageRowIssuesVersion;a.selectedPackage=_,a.selectedPackageVersion=j||null,a.packageDetailsTab="issues",a.packageSlideTriage=null,a.packageSlideTransient=!0,k();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,k();return}let s=e.target.closest("[data-select-package]");if(s){let _=s.dataset.selectPackage,j=s.dataset.selectPackageVersion??"",Z=j===""?null:j;if(a.selectedPackage===_&&a.selectedPackageVersion===Z)return;a.selectedPackage=_,a.selectedPackageVersion=Z,a.packageDetailsTab="overview",a.packageSlideTriage=null,a.packageSlideTransient=!1,k();return}if(e.target.closest("[data-deselect-package]")){a.selectedPackage=null,a.selectedPackageVersion=null,k();return}let i=e.target.closest("[data-package-tab]");if(i){let _=i.dataset.packageTab;(_==="overview"||_==="issues")&&a.packageDetailsTab!==_&&(a.packageDetailsTab=_,k());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),k();return}let l=e.target.closest("[data-package-report]");if(l){let _=l.dataset.packageReport;_&&_t(_);return}let d=e.target.closest("[data-select-repository]");if(d){let _=d.dataset.selectRepository;if(a.selectedRepository===_)return;a.selectedRepository=_,a.repositoryDetailsTab="overview",a.repositorySlideTriage=null,a.repositorySlideTransient=!1,k();return}if(e.target.closest("[data-deselect-repository]")){a.selectedRepository=null,k();return}let u=e.target.closest("[data-repository-tab]");if(u){let _=u.dataset.repositoryTab;(_==="overview"||_==="issues")&&a.repositoryDetailsTab!==_&&(a.repositoryDetailsTab=_,k());return}if(e.target.closest('[data-action="repository-slide-back"]')){a.repositoryDetailsTab="overview",a.repositorySlideTriage=null,a.repositorySlideTransient&&(a.selectedRepository=null,a.repositorySlideTransient=!1),k();return}let p=e.target.closest("[data-bundle-tab]");if(p){let _=p.dataset.bundleTab;po.has(_)&&(a.bundleDetailsTab==="graph"&&_!=="graph"&&ze(),a.bundleDetailsTab=_,a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.selectedBundle&&an(a.selectedBundle,_),k());return}if(e.target.closest("[data-advisories-consent]")){wf(),k();return}let f=e.target.closest("[data-bundle-issue-report]");if(f){let _=f.dataset.bundleIssueReport;_&&_t(_);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,k());return}if(e.target.closest('[data-action="bundle-source-panel-close"]')){a.bundleSourceFindingIdx!=null&&(a.bundleSourceFindingIdx=null,So());return}let h=e.target.closest("[data-bundle-source-finding]");if(h){let _=parseInt(h.dataset.bundleSourceFinding,10);Number.isFinite(_)&&(a.bundleSourceFindingIdx=a.bundleSourceFindingIdx===_?null:_,So());return}let b=Q(e,"[data-bundle-view-source]");if(b){let _=b.dataset.bundleViewSource;if(!_)return;let j=b.dataset.bundleViewFindingIdx,Z=j===void 0?null:parseInt(j,10),ie=b.dataset.bundleViewLine,pe=ie?parseInt(ie,10):null;if(a.bundleSourceFile=_,Number.isFinite(Z)&&(a.bundleSourceFindingIdx=Z),b.closest(".bundle-code-rail")?wc(".bundle-code-rail-body"):b.closest(".bundles-slide-body")?wc(".bundles-slide-body"):k(),Number.isFinite(pe)){let te=b.dataset.bundleViewScrollBlock||"center";queueMicrotask(()=>{let We=document.querySelector(`.bundle-source-lineno-row[data-line="${pe}"]`);We&&We.scrollIntoView({block:te,behavior:"smooth"})})}return}if(e.target.closest('[data-action="toggle-files"]')){a.currentView==="files"?a.currentView="findings":(a.viewMode==="graph"&&ze(),a.currentView="files"),document.body.classList.remove("report-fullscreen"),k();return}let y=Q(e,"[data-g2-pkg]");if(y){let _=y.dataset.g2Pkg;A.solo=A.solo===_?null:_,A.solo&&(A.selected=null),Ih(),pi(),A.graphState?.requestDraw?.();return}let $=Q(e,"[data-g2-select]");if($){A.selected=$.dataset.g2Select,Ih();return}let w=Q(e,"[data-g2-top-pkgs]");if(w){A.topPkgsTab=w.dataset.g2TopPkgs,pi();return}let v=Q(e,"[data-g2-jump-findings]");if(v){if(a.currentView==="bundles"){a.bundleDetailsTab==="graph"&&ze(),a.bundleDetailsTab="issues",a.bundleSourceFile=null,a.bundleSourceFindingIdx=null,a.selectedBundle&&an(a.selectedBundle,"issues"),k();return}Ls(),a.filterConfMin=0,a.filterInclude=v.dataset.g2JumpFindings,a.currentView="findings",a.viewMode==="graph"&&(a.viewMode="table"),ze(),k();return}let S=Q(e,"[data-g2-jump-file]");if(S){let _=S.dataset.g2JumpFile;a.currentView="files",ze(),k(),requestAnimationFrame(()=>{let j=document.querySelector(`#${ao(_)}`);j&&j.scrollIntoView({behavior:"smooth",block:"start"})});return}if(Q(e,"#g2-path-filter-clear")){A.pathFilter="";let _=document.querySelector("graph-layout")?.shadowRoot?.querySelector("#g2-path-filter");_&&(_.value=""),A.graphState?.requestDraw?.();return}if(Q(e,"#g2-fullscreen")){document.body.classList.toggle("report-fullscreen");return}if(Q(e,"[data-g2-show-all]")){A.showAll=!A.showAll,A.layoutCache=null,A.selected=null,ze(),k();return}let R=Q(e,".graph2-triage-selector [data-triage-show]");if(R){let _=R.dataset.triageShow;a.shownTriage=a.shownTriage===_?null:_,A.layoutCache=null,A.selected=null,ze(),k();return}let O=Q(e,"[data-g2-focus-pkg]");if(O){A.focusedPkg=O.dataset.g2FocusPkg,A.layoutCache=null,ze(),k();return}if(Q(e,"#g2-back-to-full")){A.focusedPkg=null,A.layoutCache=null,ze(),k();return}let ye=Q(e,".tab");if(ye&&Q(e,".tabs")){let j=Q(e,"[data-gid]").dataset.gid,Z=ye.dataset.tid;a.activeTabByGroup.set(j,Z),_r();return}let K=Q(e,"[data-triage-action]");if(K){let _=K.closest(".triage-menu"),j=_?.dataset.gid;if(!j)return;let Z=yr(j);if(!Z)return;let ie=K.dataset.triageAction;if(!["fixed","invalid","deleted","ignored","restore"].includes(ie))return;let te=be(Z).hasConflict?[Ae(Z)]:Z;for(let We of te){let Ye=P(We),Er=Ms(We);ie==="restore"?(M(a.triage,Ye,{triage:void 0}),ne(a.triage,Ye,Er,!1)):ie==="ignored"?Tt(a.triage,Ye,Er)?ne(a.triage,Ye,Er,!1):(M(a.triage,Ye,{triage:void 0}),ne(a.triage,Ye,Er,!0)):a.triage.get(Ye)?.triage===ie?M(a.triage,Ye,{triage:void 0}):(M(a.triage,Ye,{triage:ie}),ne(a.triage,Ye,Er,!1))}try{_.hidePopover()}catch{}oe(),_r();return}if(Q(e,".mark-comment")){let j=Q(e,"[data-gid]").dataset.gid,Z=yr(j);if(!Z)return;let ie=Ae(Z),pe=P(ie),te=a.triage.get(pe)?.comment??"";_h({initial:te,finding:ie}).then(We=>(We===null||(M(a.triage,pe,{comment:We||void 0}),oe(),_r()),null)).catch(()=>{});return}let Re=Q(e,".mark-copy");if(Re){let _=Rh(e);if(_===null)return;try{navigator.clipboard.writeText(_).then(()=>(Re.classList.add("copied"),setTimeout(()=>Re.classList.remove("copied"),1e3),null)).catch(()=>{})}catch{}return}let rt=Q(e,".mark-claude");if(rt){let _=Rh(e);if(_===null)return;let j=`claude://code/new?q=${encodeURIComponent(`Confirm and fix:
80
-
81
- ${_}`)}`;try{window.location.href=j,rt.classList.add("copied"),setTimeout(()=>rt.classList.remove("copied"),1e3)}catch{}return}if(Q(e,".mark-fix")){let j=Q(e,"[data-gid]").dataset.gid,Z=yr(j);if(!Z)return;let ie=Ae(Z),pe=P(ie),te=a.triage.get(pe)?.fix??"";Ch({initial:te,finding:ie}).then(We=>(We===null||(M(a.triage,pe,{fix:We||void 0}),oe(),_r()),null)).catch(()=>{});return}let Mt=e.target.closest("[data-triage-show]");if(Mt&&!Mt.closest(".graph2-triage-selector")){let _=Mt.dataset.triageShow;a.shownTriage=a.shownTriage===_?null:_,k();return}if(e.target.closest("[data-table-deselect]")){a.tableSelectedGid=null,_r();return}let ut=e.target.closest("[data-tree-select]");if(ut){let _=ut.dataset.treeSelect;a.filesSelectedFile=a.filesSelectedFile===_?null:_,k();return}e.target.closest("[data-tree-deselect]")&&(a.filesSelectedFile=null,k())});var Bh=document.querySelector("#bundle-source-overlay-slot");Bh&&Bh.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,k());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,_r())});var fi="application/x-deepview-kanban-gid";function Wv(e,t){let n=be(e).hasConflict?[Ae(e)]:e;for(let o of n){let s=P(o),i=Ms(o);t==="untriaged"?(M(a.triage,s,{triage:void 0}),ne(a.triage,s,i,!1)):t==="ignored"?(M(a.triage,s,{triage:void 0}),ne(a.triage,s,i,!0)):(M(a.triage,s,{triage:t}),ne(a.triage,s,i,!1))}}function vc(){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(fi,r),e.dataTransfer.setData("text/plain",r),e.dataTransfer.effectAllowed="move",t.classList.add("dragging"))});E.addEventListener("dragend",()=>{vc()});E.addEventListener("dragover",e=>{if(!e.dataTransfer?.types.includes(fi))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(fi))return;let t=e.target.closest?.(".kanban-column[data-kanban-target]");if(!t){vc();return}e.preventDefault();let r=e.dataTransfer.getData(fi),n=t.dataset.kanbanTarget;if(vc(),!r||!n)return;let o=yr(r);!o||(be(o).commonTriage??"untriaged")===n||(Wv(o,n),k(),queueMicrotask(oe))});var yc=!1;function ci(e){return e?E.querySelector(`.kanban-card[data-gid="${CSS.escape(e)}"]`):null}function di(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 ui(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,k();return}if(yc)return;yc=!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),yc=!1};if(r){let u=ci(e);u?(di(u),u.style.viewTransitionName="kanban-detail-modal",u.getBoundingClientRect()):di(),a.kanbanPopoverGid=e;let p=document.startViewTransition(()=>{k(),u&&(u.style.viewTransitionName="")}),f=setTimeout(()=>s(u),600);(async()=>{try{await p.finished}catch{}clearTimeout(f),s(u)})();return}di(),a.kanbanPopoverGid=e;let i=null,l=document.startViewTransition(()=>{k(),i=ci(t),i&&(di(i),i.style.viewTransitionName="kanban-detail-modal")}),d=setTimeout(()=>s(i??ci(t)),600);(async()=>{try{await l.finished}catch{}clearTimeout(d),s(i??ci(t))})()}E.addEventListener("click",e=>{if(e.target.closest?.(".kanban-detail-close")){ui(null);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;ui(a.kanbanPopoverGid===r?null:r);return}e.target.closest?.(".kanban-detail-modal")||a.kanbanPopoverGid&&ui(null)});document.addEventListener("keydown",e=>{e.key==="Escape"&&a.kanbanPopoverGid&&ui(null)});function Fh(e){if(!e||a.focusGid===e)return;a.focusGid=e,k();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 Mh(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&&Fh(o)}E.addEventListener("click",e=>{let t=e.target.closest?.("[data-focus-nav]");if(t){Mh(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&&Fh(n)});function Hv(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"||t.isContentEditable)return!0}return!1}document.addEventListener("keydown",e=>{if(a.viewMode!=="focus"||a.currentView!=="findings"||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||Hv(e))return;let t=0;if(e.key==="ArrowRight")t=1;else if(e.key==="ArrowLeft")t=-1;else return;e.preventDefault(),Mh(t)});E.addEventListener("mark-color",e=>{let t=Q(e,"[data-gid]");if(!t)return;let r=t.dataset.gid,n=yr(r);if(!n)return;let o=P(Ae(n)),s=e.detail?.color;if(!s)return;a.triage.get(o)?.color===s?M(a.triage,o,{color:void 0}):M(a.triage,o,{color:s}),oe(),_r()});var Sr=null,kc=null;function Lh(){if(Sr!==null||a.reports.length===0)return;Sr=a.viewMode,kc=document.title,a.viewMode==="table"&&(a.viewMode="list",k());let e=a.reports.map(r=>r.fileName),t="";e.length===1?t=e[0]:e.length>1&&(t=Fs(e)),t=t.replace(/\.json$/u,""),t&&(document.title=t)}function Ph(){Sr!==null&&(a.viewMode!==Sr&&(a.viewMode=Sr,k()),document.title=kc,Sr=null,kc=null)}window.addEventListener("beforeprint",Lh);window.addEventListener("afterprint",Ph);document.addEventListener("print-requested",async()=>{if(a.reports.length!==0&&Sr===null){Lh();try{await Promise.all([...E.querySelectorAll("finding-card")].map(e=>e.updateComplete)),window.print()}catch(e){throw Ph(),e}}});document.addEventListener("download-requested",()=>{a.reports.length!==0&&Th(a.reports)});E.addEventListener("analyzer-change",e=>{a.filterAnalyzer=e.detail.value,k()});E.addEventListener("repo-change",e=>{a.filterRepo=e.detail.value,k()});E.addEventListener("bundle-search-mode-change",e=>{let t=e.detail?.mode;t!=="files"&&t!=="code"&&t!=="issues"||(a.bundleCodeSearchMode=t,k())});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;k()});E.addEventListener("range-change",e=>{e.target.id==="conf-range"&&(a.filterConfMin=e.detail.low,a.filterConfMax=e.detail.high,k())});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;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 return;k()});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?.(),pi();return}a.filterSeverities.has(t)?a.filterSeverities.delete(t):a.filterSeverities.add(t),k()});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?.(),pi();return}a.filterColors.has(t)?a.filterColors.delete(t):a.filterColors.add(t),k()});E.addEventListener("source-toggle",e=>{let t=e.detail.source,r=a.filterSources.has(t);a.filterSources.clear(),r||a.filterSources.add(t),k()});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;k()});E.addEventListener("view-mode-change",e=>{if(e.detail.kind==="files"){a.filesViewMode=e.detail.mode,k();return}a.viewMode=e.detail.mode;try{localStorage.setItem(is,a.viewMode)}catch{}a.viewMode!=="kanban"&&(a.kanbanPopoverGid=null),a.viewMode!=="focus"&&(a.focusGid=null),k()});E.addEventListener("repo-edit-start",()=>{a.repoEditing=!0,k()});E.addEventListener("repo-input",e=>{a.repoUrl=e.detail.url,Ve(a.currentFile,a.repoUrl)});E.addEventListener("repo-commit",e=>{a.repoUrl=e.detail.url,Ve(a.currentFile,a.repoUrl),a.repoEditing=!1,k()});E.addEventListener("repo-cancel",e=>{a.repoUrl=e.detail.url,Ve(a.currentFile,a.repoUrl),a.repoEditing=!1,k()});document.addEventListener("keydown",e=>{if(e.key==="Escape"){if(a.bundleSourceFindingIdx!=null){a.bundleSourceFindingIdx=null,So();return}a.bundleSourceFile&&(a.bundleSourceFile=null,k())}});var Oh=`: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}}
82
- `;var $c="deepview.theme",cn=Object.freeze(["dark","light","green","pink"]),jv={dark:{base:"#1a1a1b",dim:"#0a0a0a"},light:{base:"#f6f6fa",dim:"#646464"},green:{base:"#0a140a",dim:"#050a05"},pink:{base:"#ffe4ee",dim:"#a3727f"}},Kv="\u2600",qv="\u263E",xc="deepview-theme-changed",hi="dark",Sc=!1;function Gv(){try{let e=localStorage.getItem($c);return cn.includes(e)?e:"dark"}catch{return"dark"}}function Co(e){cn.includes(e)||(e="dark"),hi=e;for(let r of cn)r!=="dark"&&document.body.classList.remove(`theme-${r}`);e!=="dark"&&document.body.classList.add(`theme-${e}`);try{e==="dark"?localStorage.removeItem($c):localStorage.setItem($c,e)}catch{}let t=document.querySelector('meta[name="theme-color"]');if(t){let{base:r,dim:n}=jv[e];t.setAttribute("content",Sc?n:r)}window.dispatchEvent(new CustomEvent(xc,{detail:{theme:e}}))}Co(Gv());window.addEventListener("beforeprint",()=>{Sc=!0,Co(hi)});window.addEventListener("afterprint",()=>{Sc=!1,Co(hi)});function Nh(e){if(!cn.includes(e))throw new TypeError(`DeepView.setTheme: unknown theme ${JSON.stringify(e)} (expected one of ${cn.map(t=>JSON.stringify(t)).join(", ")})`);Co(e)}function Dh(){return hi}var Uh=cn,_c=class extends H{static properties={_light:{state:!0}};static styles=T(Oh);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(xc,this._onThemeChanged)}disconnectedCallback(){window.removeEventListener(xc,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");Co(t?"dark":"light")};_onKeydown=t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this._toggle())};render(){return c`${this._light?qv:Kv}`}};customElements.define("theme-toggle",_c);var zh=`: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}}.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-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)}}.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;.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}}}.mark-action-group{display:inline-flex;border:1px solid var(--border);border-radius:3px;overflow:hidden;margin-right:.25rem}.mark-comment,.mark-fix,.mark-copy,.mark-claude{background:transparent;border:0;color:var(--muted);padding:0 .25rem;height:1.4rem;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-comment.has-comment,.mark-fix.has-fix{color:var(--accent)}.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{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}.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-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-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}}a,.line-num,.line-num a{color:inherit}}
83
- `;var Jv=["is-critical","mark-red","mark-blue","mark-green","mark-gray","has-conflict","triage-fixed","triage-invalid","triage-deleted","triage-ignored","selected"],Cc=class extends L{static properties={group:{attribute:!1},selected:{type:Boolean}};static styles=T(zh);constructor(){super(),this.group=null,this.selected=!1}render(){if(!this.group)return c``;this.dataset.gid=io(this.group);let t=new Set(Pp(this.group));this.selected&&t.add("selected");for(let r of Jv)this.classList.toggle(r,t.has(r));return c`<div class="row">${Op(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",Cc);var Wh=`: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}
84
- `;var Ec=class extends H{static properties={items:{attribute:!1},selectedGid:{attribute:!1}};static styles=T(Wh);constructor(){super(),this.items=[],this.selectedGid=null}render(){return c`${J(this.items??[],t=>io(t),t=>c`<finding-row .group="${t}" ?selected="${io(t)===this.selectedGid}"></finding-row>`)}`}};customElements.define("finding-table",Ec);var Hh=`: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}.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}}.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-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)}}.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;.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}}}.mark-action-group{display:inline-flex;border:1px solid var(--border);border-radius:3px;overflow:hidden;margin-right:.25rem}.mark-comment,.mark-fix,.mark-copy,.mark-claude{background:transparent;border:0;color:var(--muted);padding:0 .25rem;height:1.4rem;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-comment.has-comment,.mark-fix.has-fix{color:var(--accent)}.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{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}.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-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-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-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-copy,: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}.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-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}.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}}a,.line-num,.line-num a{color:inherit}.inline-code{border:0;background:transparent;padding:0}}
85
- `;var Zv=["finding","is-critical","mark-red","mark-blue","mark-green","mark-gray","has-conflict","triage-fixed","triage-invalid","triage-deleted","triage-ignored","multi-case"],Ac=class extends L{static properties={group:{attribute:!1},inGroup:{type:Boolean,attribute:"in-group",reflect:!0},context:{type:String,reflect:!0}};static styles=T(Hh);constructor(){super(),this.group=null,this.inGroup=!1,this.context=null}render(){if(!this.group)return c``;this.dataset.gid=Zr(this.group);let t=new Set(Mp(this.group));for(let r of Zv)this.classList.toggle(r,t.has(r));return c`<div class="card">${Lp(this.group,{context:this.context})}</div>`}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.requestUpdate()}};customElements.define("finding-card",Ac);var Vh=`:host{display:inline-flex;gap:4px;align-items:center}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)}
86
- `;var t0=["red","blue","green","gray"],Tc=class extends H{static properties={selected:{type:String}};static styles=T(Vh);constructor(){super(),this.selected=null}render(){return c`${t0.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",Tc);var Ic=class extends L{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",Ic);var jh={files:"Filter files\u2026",code:"Search code\u2026",issues:"Search issues\u2026"},Kh={files:"Filter files",code:"Search code",issues:"Search issues"},r0=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>`,n0={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>`},Rc=class extends L{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=jh[n]??jh.files;return c`${r0} <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="${F({"bundle-code-search-mode":!0,active:n===s})}" role="tab" aria-selected="${String(n===s)}" title="${Kh[s]??s}" aria-label="${Kh[s]??s}" @click="${()=>this._selectMode(s)}">${n0[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",Rc);var qh={packages:{stateKey:"packagesSearchQuery",label:"Filter packages"},repositories:{stateKey:"repositoriesSearchQuery",label:"Filter repositories"}},Bc=class extends L{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let t=qh[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(qh).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",Bc);var o0=[["findings-desc","Findings \u2193"],["files-desc","Files \u2193"],["reports-desc","Reports \u2193"],["name-asc","Name A\u2192Z"]],Gh={packages:{stateKey:"packagesSortBy",aria:"Sort packages"},repositories:{stateKey:"repositoriesSortBy",aria:"Sort repositories"}},Fc=class extends L{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let t=Gh[this.kind];return t?c`<select class="packages-sort" aria-label="${t.aria}" .value="${Te(a[t.stateKey])}" @change="${this._onChange}">${o0.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(Gh).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",Fc);var Mc=class extends L{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",Mc);var Yh=`: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)}
87
- `;var Lc=class extends H{static properties={min:{type:Number},max:{type:Number},step:{type:Number},low:{type:Number},high:{type:Number}};static styles=T(Yh);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",Lc);var Pc=class extends H{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",Pc);var Jh=`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)}}
88
- `;var Oc=class extends I{static styles=[...I.styles,T(Jh)];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 Xa();Rr(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 Qa(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 Za(this.parsed,this.mode);k(),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",Oc);function Xh(){return q("triage-export-dialog")}var Qh=`:host{display:inline-block;vertical-align:middle;position:relative}.chip{display:inline-flex;align-items:center;gap:.375rem;cursor:default;user-select:none;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}.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}}
89
- `;function Nc(e){if(!e)return"";let t=e.match(/github\.com\/([^/?#]+\/[^/?#]+?)(?:\.git)?(?:[/?#]|$)/iu);return t?t[1]:e}var Dc=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>`,Zh=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>`,Uc=class extends H{static properties={url:{type:String},editable:{type:Boolean,reflect:!0},editing:{type:Boolean,reflect:!0}};static styles=T(Qh);constructor(){super(),this.url="",this.editable=!1,this.editing=!1,this._opener=""}render(){if(this.editable&&this.editing){let t=!!this.url,r=t?Nc(this.url):"Set repo";return c`<span class="${t?"chip":"chip empty"}" aria-hidden="true" inert>${Dc} <span class="label">${r}</span> <button type="button" class="edit-btn">${Zh}</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?Nc(this.url):"Set repo";return c`<span class="${t?"chip":"chip empty"}" @click="${t?null:this._onEdit}">${Dc} <span class="label">${r}</span> <button type="button" class="edit-btn" title="Edit repo URL" aria-label="Edit repo URL" @click="${this._onEdit}">${Zh}</button></span>`}return this.url?c`<span class="chip readonly" title="Repo from findings (read-only)">${Dc} <span class="label">${Nc(this.url)}</span></span>`:g}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")};_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",Uc);function tt(e,t){for(let[r,n]of Object.entries(t))e.hasAttribute(r)||e.setAttribute(r,n)}var l0=[["critical","Critical"],["high","High"],["medium","Medium"],["low","Low"],["high_bug","High bug"],["bug","Bug"],["informational","Info"]],zc=class extends L{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(),tt(this,{role:"group","aria-label":"Filter by severity"})}render(){let t=this.kind==="graph"?new Set(this.selected):a.filterSeverities,r=l0.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="${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",zc);var c0=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>`,Wc=class extends L{createRenderRoot(){return this}render(){let t=a.currentView==="bundles"&&a.selectedBundle,r=!a.currentFile&&!t;return c`<button type="button" class="danger" ?disabled="${r}">${c0}<span>Delete current</span></button>`}};customElements.define("sidebar-delete-current",Wc);var d0=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>`,u0=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>`,eg={packages:{title:"Show packages",icon:d0,view:"packages"},repositories:{title:"Show repositories",icon:u0,view:"repositories"}},Hc=class extends L{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=eg[this.kind];if(!t)return console.warn(`<sidebar-view-button>: unknown kind ${JSON.stringify(this.kind)}; expected one of ${Object.keys(eg).map(n=>JSON.stringify(n)).join(", ")}.`),g;let r=a.currentView===t.view;return c`<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",Hc);var p0=["invalid","deleted"],tg={package:{stateKey:"packageSlideTriage"},repository:{stateKey:"repositorySlideTriage"}},Vc=class extends L{static properties={counts:{attribute:!1},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.kind=""}connectedCallback(){super.connectedCallback(),tt(this,{role:"group","aria-label":"Triage view"})}render(){let t=tg[this.kind];if(!t)return console.warn(`<slide-triage-tabs>: unknown kind ${JSON.stringify(this.kind)}; expected one of ${Object.keys(tg).map(o=>JSON.stringify(o)).join(", ")}.`),g;let r=a[t.stateKey],n=p0.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="${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",Vc);var f0=[["own","Sources"],["modules","Dependencies"]],jc=class extends L{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),tt(this,{role:"group","aria-label":"Source filter"})}render(){return c`${f0.map(([t,r])=>{let n=a.filterSources.has(t);return c`<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",jc);var h0=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>`,rg={findings:{stateKey:"filterInclude",placeholder:"Search findings\u2026"},files:{stateKey:"filesSearch",placeholder:"Search files\u2026"}},Kc=class extends L{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let t=rg[this.kind];return t?c`${h0} <input type="text" aria-label="${t.placeholder}" placeholder="${t.placeholder}" .value="${Te(a[t.stateKey])}" @input="${this._onInput}">`:(console.warn(`<toolbar-search>: unknown kind ${JSON.stringify(this.kind)}; expected one of ${Object.keys(rg).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("toolbar-search",Kc);function g0(e){if(!e)return"";let t=e.match(/github\.com\/([^/?#]+\/[^/?#]+?)(?:\.git)?(?:[/?#]|$)/iu);return t?t[1]:e}var qc=class extends L{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??so,n=t==null?"(no repo)":g0(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",qc);var ng=[["none","none","unmarked"],["red","r","red"],["blue","b","blue"],["green","g","green"],["gray","x","gray"]],Gc=class extends L{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(),tt(this,{role:"group","aria-label":"Filter by mark color"})}render(){let t=this.kind==="graph"?new Set(this.selected):a.filterColors;return ng.some(([n])=>(this.counts[n]??0)||t.has(n))?c`${ng.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",Gc);var m0=["fixed","invalid","deleted","ignored"],Yc={graph:"graph2-triage-selector",packages:"packages-triage-selector"},Jc=class extends L{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(),tt(this,{role:"group","aria-label":"Triage view"})}render(){let t=this.states??m0,r=t.reduce((o,s)=>o+(this.counts[s]??0),0),n=this.variant?Yc[this.variant]:null;this.variant&&n===void 0&&console.warn(`<triage-selector>: unknown variant ${JSON.stringify(this.variant)}; expected one of ${Object.keys(Yc).map(o=>JSON.stringify(o)).join(", ")} or "".`);for(let o of Object.values(Yc))this.classList.toggle(o,o===n);return r===0&&!a.shownTriage?g:c`${t.map(o=>{let s=this.counts[o]??0,i=a.shownTriage===o;return s===0&&!i?g:c`<button type="button" class="${F({"triage-state-btn":!0,[`triage-state-${o}`]:!0,active:i})}" data-triage-show="${o}" title="${i?`Exit ${o} view`:`Show ${o} (${s})`}" aria-pressed="${String(i)}">${o.charAt(0).toUpperCase()+o.slice(1)} (${s})</button>`})}`}};customElements.define("triage-selector",Jc);var b0={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>`},og={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)"},Xc=["table","list","grouped","focus","kanban","graph"],Qc=class extends L{static properties={modes:{type:String},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.modes=Xc.join(","),this.kind="findings"}connectedCallback(){super.connectedCallback(),tt(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=>Xc.includes(o)),n=r.length>0?r:Xc;return c`${n.map(o=>c`<button type="button" class="${F({"view-mode-btn":!0,active:t===o})}" title="${og[o]}" aria-label="${og[o]}" aria-pressed="${String(t===o)}" @click="${()=>this._select(o,t)}">${b0[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",Qc);var y0=6,sg=14,gi=2,ig=24,Eo=4;function w0(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 v0(e,t,r,n){let o=r*r,s=n*n;return Math.max(s*e/o,o/(s*t))}function ag(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,y=1/0,$=1/0;for(;h<n.length;){let v=n[h].value*u,S=v>m?v:m,C=v<y?v:y,R=v0(S,C,b+v,f);if(h===p||R<=$)$=R,b+=v,m=S,y=C,h++;else break}let w=b/f;if(i>=l){let v=s;for(let S=p;S<h;S++){let C=S===h-1?s+l-v:n[S].value*u/w;r.push({node:n[S],x:o,y:v,w,h:C}),v+=C}o+=w,i-=w}else{let v=o;for(let S=p;S<h;S++){let C=S===h-1?o+i-v:n[S].value*u/w;r.push({node:n[S],x:v,y:s,w:C,h:w}),v+=C}s+=w,l-=w}p=h}return r}function lg(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())lg(t)}function cg(e,t){if(e.path=e.name?t?`${t}/${e.name}`:e.name:t,e.isFile)return e.count=1,e.value;let r=0,n=0;for(let o of e.children.values())r+=cg(o,e.path),n+=o.count;return e.value=r,e.count=n,r}function dg(e,t,r,n,o,s,i){if(n<Eo||o<Eo)return;if(e.isFile){i.push({kind:"file",node:e,x:t,y:r,w:n,h:o});return}if(!(s<y0&&n>=ig&&o>=ig&&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>=sg+Eo+gi?sg:0,u=t+gi,p=r+d,f=n-gi*2,h=o-d-gi;if(f<Eo||h<Eo)return;let b=[...e.children.values()].toSorted((m,y)=>y.value-m.value);for(let m of ag(b,{x:u,y:p,w:f,h}))dg(m.node,m.x,m.y,m.w,m.h,s+1,i)}var Zc=class extends H{static properties={details:{attribute:!1},_w:{state:!0},_h:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.details=null,this._w=0,this._h=0,this._root=null,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)}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;W(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._meta={files:0,total:0,prefix:""},!this.details){this._status="loading";return}let t=dt(this.details);if(!t||t.size===0){this._status="empty";return}let r=[...t.keys()],{prefix:n,stripped:o}=Rt(r),s=new TextEncoder,i={name:"",children:new Map,value:0,isFile:!1},l=0,d=0;for(let u=0;u<r.length;u++){let p=t.get(r[u]),f=typeof p=="string"?s.encode(p).byteLength:0;if(f<=0)continue;let h=o[u].split("/"),b=i,m=!1;for(let w=0;w<h.length-1;w++){let v=b.children.get(h[w]);if(v&&v.isFile){m=!0;break}v||(v={name:h[w],children:new Map,value:0,isFile:!1},b.children.set(h[w],v)),b=v}if(m)continue;let y=h.at(-1),$=b.children.get(y);$&&!$.isFile||($||($={name:y,isFile:!0,value:0,origPath:r[u]},b.children.set(y,$)),$.value+=f,l+=f,d++)}if(l===0){this._status="empty";return}for(let u of i.children.values())lg(u);cg(i,""),this._root=i,this._meta={files:d,total:l,prefix:n},this._status="ok"}_cell(t){let r=this._meta.total||1,n=t.node.value/r*100,o=n>=10?n.toFixed(0):n.toFixed(n>=1?1:2),s={left:`${t.x}px`,top:`${t.y}px`,width:`${t.w}px`,height:`${t.h}px`},i=`${t.node.count} ${t.node.count===1?"file":"files"}`;if(t.kind==="dir")return c`<div class="bundle-treemap-node bundle-treemap-dir" style="${we(s)}" data-tt-path="${`${t.node.path}/`}" data-tt-meta="${`${De(t.node.value)} \xB7 ${i} \xB7 ${o}%`}"><span class="bundle-treemap-dirname">${t.node.name}</span></div>`;let l=ho(t.node.path),d=Ft(l),u=we({...s,background:d,color:w0(d)}),p=l==="__own__"?"own source":l;return t.kind==="agg"?c`<div class="bundle-treemap-node bundle-treemap-leaf bundle-treemap-agg" style="${u}" data-tt-path="${`${t.node.path}/`}" data-tt-pkg="${p}" data-tt-color="${d}" data-tt-meta="${`${De(t.node.value)} \xB7 ${i} \xB7 ${o}%`}"><span class="bundle-treemap-label">${t.node.name}/</span></div>`:c`<button type="button" class="bundle-treemap-node bundle-treemap-leaf bundle-treemap-file" style="${u}" data-bundle-view-source="${t.node.origPath}" data-tt-path="${t.node.path}" data-tt-pkg="${p}" data-tt-color="${d}" data-tt-meta="${`${De(t.node.value)} \xB7 ${o}% of bundle`}"><span class="bundle-treemap-label">${t.node.name}</span></button>`}render(){let t=[];if(this._status==="ok"&&this._root&&this._w>0&&this._h>0){let s=[...this._root.children.values()].toSorted((i,l)=>l.value-i.value);for(let i of ag(s,{x:0,y:0,w:this._w,h:this._h}))dg(i.node,i.x,i.y,i.w,i.h,1,t)}let{files:r,total:n,prefix:o}=this._meta;return c`<header class="bundle-treemap-head"><span class="bundle-treemap-title">Source treemap</span> <span class="bundle-treemap-sub">${r} ${r===1?"file":"files"} · ${De(n)}${o?c`· <span class="mono">${o}</span>`:""}</span></header><div class="bundle-treemap-plot" @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>`:t.map(s=>this._cell(s))}<div class="bundle-treemap-tooltip"></div></div>`}};customElements.define("bundle-treemap",Zc);var k0=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>`,ed=class extends L{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}">${k0}</button>`:g}_onClick=()=>{this.dispatchEvent(new CustomEvent("print-requested",{bubbles:!0,composed:!0}))}};customElements.define("print-button",ed);var $0=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>`,td=class extends L{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}">${$0}</button>`:g}_onClick=()=>{this.dispatchEvent(new CustomEvent("download-requested",{bubbles:!0,composed:!0}))}};customElements.define("download-button",td);function mi(e){let t=new Map;for(let[r,n]of a.triage)n[e]&&t.set(r,n[e]);return t}var x0={get markers(){return mi("color")},get triageState(){return mi("triage")},get comments(){return mi("comment")},get fixes(){return mi("fix")},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),r},async set(e,{color:t,triage:r,comment:n,fix:o}={}){let s=!1;if(t!==void 0&&(t===null||t===""?M(a.triage,e,{color:void 0})&&(s=!0):a.triage.get(e)?.color!==t&&(M(a.triage,e,{color:t}),s=!0)),r!==void 0)if(r===null||r===""||r===!1)M(a.triage,e,{triage:void 0})&&(s=!0);else if(r==="fixed"||r==="invalid"||r==="deleted")a.triage.get(e)?.triage!==r&&(M(a.triage,e,{triage:r}),s=!0);else throw new TypeError(`DeepView.triage.set: unknown triage value ${JSON.stringify(r)} (expected 'fixed' | 'invalid' | 'deleted' | null)`);if(n!==void 0){let i=n?String(n):"";i?a.triage.get(e)?.comment!==i&&(M(a.triage,e,{comment:i}),s=!0):M(a.triage,e,{comment:void 0})&&(s=!0)}if(o!==void 0){let i=o?String(o):"";i?a.triage.get(e)?.fix!==i&&(M(a.triage,e,{fix:i}),s=!0):M(a.triage,e,{fix:void 0})&&(s=!0)}return s&&(await oe(),k()),s}};window.DeepView={get reports(){return a.reports.slice()},get groups(){return Bt()},get findings(){return Bt().flat()},get currentFile(){return a.currentFile},get currentWorkspace(){return a.currentWorkspace},triage:x0,themes:Uh,setTheme:Nh,get theme(){return Dh()},triageSync:D,refresh(){k()},export(){return Xh()}};var _0={default:Y.default,"claude-security":Y["claude-security"],"codex-security":Y["codex-security"],deepsec:Y.deepsec,bundle:tn,workspace:Os};for(let e of document.querySelectorAll(".drop-supported-icon[data-icon]")){let t=_0[e.dataset.icon];t&&(e.innerHTML=t)}sp(k);op(k);D.onStatusChange(k);rp(async(e,t)=>{a.currentWorkspace===e?await Qt(e):a.currentFile&&a.currentFile===t?await _t(t):await V()});np(async()=>{await V(),a.currentView==="bundles"&&k()});bh();wh();async function S0(){let e=ll();if(!e)return!1;try{history.replaceState(null,"",location.pathname)}catch{}let t;try{t=await kh({encoded:e})}catch(n){return alert(`Couldn't open the share-link unlock prompt: ${n.message}`),!1}if(!t)return!1;let r=await Ua({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 Qt(r.workspace.id):await V(),!0}var Ao=!1;async function hg(){if(Ao||(Ao=!0,await Lr(),La(),await V(),await S0()))return;let t=he(Xt);if(t)if(t.startsWith("ws:")){let r=t.slice(3);z().some(n=>n.id===r)&&await Qt(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=po.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.bundleDetailsTab=i,a.shownTriage=null,A.showAll=!0,k(),Jt(o))}else(await le()).includes(t)&&await _t(t)}var ug=X(),pg=!1;function fg(e){pg||(pg=!0,queueMicrotask(()=>{alert(e+" This tab will reload to refresh its state. Any unsaved edits in this tab will be lost."),location.reload()}))}ge(()=>{let e=ug,t=X();if(ug=t,k(),!Ao&&st()){hg().catch(r=>console.warn("continueBoot:",r));return}if(Ao&&t&&!st()){fg("Encryption was just enabled in another tab.");return}Ao&&e&&!t&&!Ki()&&fg("Encryption was disabled in another tab.")});(async()=>{if(!await vh()){try{let e=window.matchMedia?.("(display-mode: window-controls-overlay)").matches;if(!e&&localStorage.getItem("deepview.sidebarCollapsed")==="1"&&Dd.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{}X()&&!st()||await hg()}})();
177
+ 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 cc()}catch(o){alert(`Wipe failed: ${o?.message??o}. Try again or clear localStorage manually via DevTools.`);return}location.reload()}}),document.body.append(Vt),Vt}function ox(){return _()||!pn()?!1:fe()&&!qt()}async function ix(){if(await ht(),ox()){let e=aU();e.hidden=!1;let t=e.querySelector("button");t&&t.focus()}else if(Vt&&(Vt.hidden=!0,Au))try{Au.abort()}catch{}}Je(ix);document.addEventListener("managed-client-mode-change",ix);ix();Jn();Yf();qa();D();or();pe();ct();tn();Vh();Hh();zt();vu();jk();T();D();pe();ue();Md();sx();co();var ax=class extends F{static styles=[...F.styles,A(li),A(qm)];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">${ci(ce(t,l.severityMode))} ${r?d`<span class="loc" title="${r}">${r}</span>`:m}</div>${t.description?d`<div class="desc" title="${t.description}">${t.description}</div>`:m}</header><textarea rows="6" placeholder="Write your notes here. Markdown is not rendered. Ctrl/⌘+Enter to save, Esc to cancel." .value="${this._value}" @input="${this._onInput}" @keydown="${this._onKeydown}"></textarea><footer class="nwd-actions">${n?d`<button type="button" class="danger" @click="${this._onClear}">Clear</button>`:m} <span class="nwd-spacer"></span> <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" @click="${this._onSave}">Save</button></footer></dialog>`}};customElements.define("comment-dialog",ax);function iT({initial:e="",finding:t=null}={}){return le("comment-dialog",{initial:e,finding:t})}T();qe();ue();Zt();pe();Os();jh();var sT=`dialog{width:min(96vw,1400px);max-width:1400px;height:min(88dvh,1000px);max-height:92dvh;margin:auto;padding:0;overflow:hidden}dialog[open]{display:flex;flex-direction:column}header{display:flex;align-items:center;gap:1rem;padding:.7rem 1rem;border-bottom:1px solid var(--border);flex:0 0 auto;& h3{margin:0;min-width:0;flex:1;overflow-wrap:anywhere;font:.85rem ui-monospace,monospace}& button{border:0;background:transparent;color:var(--muted);font-size:1.4rem;padding:0 .3rem;&:hover{color:var(--text)}}}.source-scroll{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain}.source-status{padding:1rem;color:var(--muted)}.source-lines{display:flex;min-width:100%;width:max-content;font:.8rem/1.6 ui-monospace,monospace;& aside{position:sticky;left:0;align-self:stretch;flex:0 0 auto;padding:.75rem 0;background:var(--surface);color:var(--muted);border-right:1px solid var(--border);text-align:right;user-select:none;& div{padding:0 .75rem}.cited{background:rgb(from var(--accent) r g b / .18);color:var(--accent);font-weight:700}}& pre{padding:.75rem 1rem;margin:0;tab-size:4}& pre,code{font:inherit;white-space:pre}}
178
+ `;var Fi=`.token.comment,.token.prolog,.token.cdata{color:var(--code-comment);font-style:italic}.token.punctuation{color:var(--muted)}.token.string,.token.attr-value,.token.char,.token.regex{color:var(--code-string)}.token.number,.token.boolean,.token.constant,.token.symbol{color:var(--code-number)}.token.keyword,.token.builtin,.token.important,.token.atrule{color:var(--code-keyword)}.token.function,.token.class-name,.token.tag{color:var(--code-function)}.token.operator,.token.entity,.token.url,.token.attr-name,.token.selector{color:var(--code-operator)}.token.variable,.token.property,.token.parameter{color:var(--code-variable)}.token.annotation{color:var(--code-function)}.token.deleted{color:var(--code-deleted)}.token.inserted{color:var(--code-inserted)}.token.italic{font-style:italic}.token.bold{font-weight:700}
179
+ `;var lx=class extends F{static styles=[...F.styles,A(sT),A(Fi)];static properties={reportId:{attribute:!1},file:{attribute:!1},line:{attribute:!1},_path:{state:!0},_content:{state:!0},_highlighted:{state:!0},_loading:{state:!0}};constructor(){super(),this.reportId="",this.file="",this.line="",this._path="",this._content=null,this._highlighted=null,this._loading=!0}beforeOpen(){this._load()}async _load(){try{let{data:t,error:r}=await zf(this.reportId).then(s=>({data:s}),s=>({error:s}));if(this._settled||!this.isConnected)return;let n=Ya(this.reportId),o=r?n?.error===r:n?.data===t||t===null&&!!n?.error;if(!n||!o||r?.name==="AbortError"||n.controller?.signal.aborted){this._finish(null);return}if(this._sourceSignal=n.controller?.signal,this._sourceSignal?.addEventListener("abort",this._onClose,{once:!0}),this._path=t?.paths.get(this.file)??this.file,this._content=t?.sources.get(this._path)??null,this._loading=!1,await this.updateComplete,this._settled||!this.isConnected)return;fl(this.renderRoot.querySelector(".source-scroll"),this.renderRoot.querySelectorAll(".cited"));let i=rn(this._path);if(i&&this._content!==null){let s=await Ir(this._content,i);!this._settled&&this.isConnected&&(this._highlighted=s)}}catch(t){t.name==="AbortError"?this._finish(null):this._loading=!1}}disconnectedCallback(){this._sourceSignal?.removeEventListener("abort",this._onClose),this._content=null,this._highlighted=null,super.disconnectedCallback()}_onKeydown=t=>{t.key==="Escape"&&t.stopPropagation()};_onBackdrop=t=>{if(t.target!==t.currentTarget)return;let{left:r,right:n,top:o,bottom:i}=t.currentTarget.getBoundingClientRect();(t.clientX<r||t.clientX>n||t.clientY<o||t.clientY>i)&&this._finish(null)};render(){let t=Ct(this.line);return d`<dialog aria-labelledby="source-title" @close="${this._onClose}" @keydown="${this._onKeydown}" @click="${this._onBackdrop}"><header><h3 id="source-title">${this._path||this.file}</h3><button type="button" aria-label="Close source viewer" @click="${this._onClose}">×</button></header><div class="source-scroll" tabindex="0" aria-label="Full source code" aria-busy="${String(this._loading)}">${this._content===null?d`<p class="source-status" role="status">${this._loading?"Loading source\u2026":"Source unavailable"}</p>`:d`<div class="source-lines"><aside aria-hidden="true">${this._content.split(`
180
+ `).map((r,n)=>d`<div class="${t&&n+1>=t.start&&n+1<=t.end?"cited":""}">${n+1}</div>`)}</aside><pre><code>${typeof this._highlighted=="string"?V(this._highlighted):this._content}</code></pre></div>`}</div></dialog>`}};customElements.define("finding-source-dialog",lx);function aT({reportId:e,file:t,line:r}){return le("finding-source-dialog",{reportId:e,file:t,line:r})}T();ue();Or();var cx=class extends F{static styles=[...F.styles,A(We)];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",cx);function lT({name:e,encrypted:t}={}){return le("download-bundle-dialog",{bundleName:e??"",encrypted:!!t})}T();ue();co();T();var cT=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>`,dT=d`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="1.8" y="5" width="20.4" height="14" rx="2"/><path d="M5.6 15.6V8.4l3.1 3.6 3.1-3.6v7.2"/><path d="M16.9 8.4v7.2m-2.6-2.9 2.6 2.9 2.6-2.9"/></svg>`,uT=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>`;D();tn();pe();ct();Ee();function uU(e,t){let r=ah.find(n=>n.value===e)?.label??e;return lh(e)?.includes("partial")?t==="exclude"?`${r} (full only)`:t==="only"?`${r} (partial only)`:r:r}function pU(e){return Le.filter(t=>e.has(t)).map(t=>va[t]??t).join(", ")}function dx(e=l){let t=[];if(e.filterSeverities.size>0&&t.push({key:"severity",label:"Severity",value:pU(e.filterSeverities),clear:{filterSeverities:new Set}}),e.filterColors.size>0&&t.push({key:"marks",label:"Marks",value:[...e.filterColors].map(r=>$c[r]??r).join(", "),clear:{filterColors:new Set}}),e.filterSources.size===1&&t.push({key:"source",label:"Source",value:e.filterSources.has("own")?"Sources only":"Dependencies only",clear:{filterSources:new Set}}),e.filterAnalyzer&&t.push({key:"analyzer",label:"Analyzer",value:e.filterAnalyzer===ui?"(none)":e.filterAnalyzer,clear:{filterAnalyzer:""}}),e.filterModel&&t.push({key:"model",label:"Model",value:e.filterModel===pi?"(none)":e.filterModel,clear:{filterModel:""}}),e.filterRepo&&t.push({key:"repo",label:"Repository",value:e.filterRepo===Ls?"(no repo)":e.filterRepo,clear:{filterRepo:""}}),lh(e.filterRevalidate)&&t.push({key:"revalidate",label:"Revalidation",value:uU(e.filterRevalidate,e.filterPartial),clear:{filterRevalidate:"",filterPartial:""}}),!e.filterRevalidate&&(e.filterConfMin>0||e.filterConfMax<10)){let r;e.filterConfMin>0&&e.filterConfMax<10?r=`${e.filterConfMin}\u2013${e.filterConfMax}`:e.filterConfMin>0?r=`\u2265 ${e.filterConfMin}`:r=`\u2264 ${e.filterConfMax}`,t.push({key:"confidence",label:"Confidence",value:r,clear:{filterConfMin:0,filterConfMax:10}})}e.filterInclude&&t.push({key:"search",label:e.filterIncludeNegate?"Excluding":"Search",value:`"${e.filterInclude}"`,clear:{filterInclude:"",filterIncludeNegate:!1}});for(let[r,n]of[["filterComment","comment"],["filterFix","fix"],["filterFlagged","flag"]]){let o=e[r];o&&t.push({key:`annotation:${n}`,label:"Annotation",value:`${o==="with"?"With":"Without"} ${n}`,clear:{[r]:""}})}return!l.currentWorkspace&&e.filterDuplicates&&t.push({key:"duplicates",label:"Duplicates",value:e.filterDuplicates==="with"?"Only rows linked to other reports":"Exclude rows linked to other reports",clear:{filterDuplicates:""}}),e.filterCrossContext&&t.push({key:"cross-context",label:"Context",value:e.filterCrossContext==="with"?"Only rows across multiple repos or packages":"Exclude rows across multiple repos or packages",clear:{filterCrossContext:""}}),e.filterAppStacked&&t.push({key:"app-stacked",label:"App stack",value:e.filterAppStacked==="with"?"Only rows with multiple App findings":"Exclude rows with multiple App findings",clear:{filterAppStacked:""}}),e.filterSecurity&&t.push({key:"security",label:"Security",value:e.filterSecurity==="with"?"Only security-related rows":"Exclude security-related rows",clear:{filterSecurity:""}}),t}function ux(){return br().filter(e=>Ve(e).commonTriage===l.shownTriage)}function px(){return l.shownTriage?No[l.shownTriage]??l.shownTriage:null}function Ym(e,t=KE()){let r=ux(),n=r.length;Ld(t);let o;try{o=fi(r).length}finally{Fd()}return{included:o,total:n,excluded:n-o,fields:t,filters:dx(t),bucketLabel:px(),focusedOnly:e==="print"&&l.viewMode==="focus"}}var pT=`dialog{max-width:515px;width:min(94vw,515px)}.ecd-count{margin:0;font-size:1.02rem;color:var(--text);& strong{color:var(--accent);font-weight:700}}.ecd-excluded{margin:.25rem 0 0;color:var(--muted);font-size:.82rem}.ecd-filters{margin:.9rem 0 0;display:grid;grid-template-columns:auto minmax(0,1fr);gap:.3rem .7rem;font-size:.82rem}.ecd-filters dt{color:var(--muted);font-weight:600;white-space:nowrap}.ecd-filters dd{display:flex;align-items:baseline;gap:.5rem;color:var(--text);overflow-wrap:anywhere}.ecd-filter-value{min-width:0}.ecd-filter-drop{margin-left:auto;flex:none;padding:0 .2rem;border:0;border-radius:4px;background:none;color:var(--muted);font:inherit;font-size:1rem;line-height:1;&:hover{color:var(--critical, #f87171)}&:focus-visible{outline:2px solid var(--accent);outline-offset:1px}}.ecd-filters-label{margin:.9rem 0 0;font-size:.76rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--muted)}.ecd-filters-label+.ecd-filters{margin-top:.35rem}
181
+ `;R1();var hU=[{id:"download",label:"Markdown",icon:dT},{id:"print",label:"Print",icon:uT}],fx=class extends F{static styles=[...F.styles,A(pT),A(Fm)];static properties={mode:{type:String},included:{type:Number},excluded:{type:Number},total:{type:Number},filters:{attribute:!1},fields:{attribute:!1},bucketLabel:{type:String},focusedOnly:{type:Boolean}};constructor(){super(),this.mode="download",this.included=0,this.excluded=0,this.total=0,this.filters=[],this.fields=null,this._relaxed=!1,this.bucketLabel=null,this.focusedOnly=!1}get _focusedOnly(){return this.mode==="print"&&this.focusedOnly}_selectTab(t){this.mode!==t&&(this.mode=t)}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==="confirm",view:t==="view",fields:this._relaxed?this.fields:null,mode:this.mode})}_onClose=()=>this._finish("cancel");_onCancel=()=>this._finish("cancel");_onView=()=>this._finish("view");_onConfirm=()=>this._finish("confirm");async _onDropFilter(t){let r=this.filters.findIndex(s=>s.key===t);if(r===-1)return;let n=Ym(this.mode,{...this.fields,...this.filters[r].clear});this._relaxed=!0,this.fields=n.fields,this.filters=n.filters,this.included=n.included,this.excluded=n.excluded,this.total=n.total,await this.updateComplete;let o=[...this.renderRoot.querySelectorAll("button[data-drop]")];(o[Math.min(r,o.length-1)]??this.renderRoot.querySelector("button.primary")??this.renderRoot.querySelector('button[data-role="cancel"]'))?.focus()}_countSection(){if(this.total===0)return d`<p class="ecd-count">No findings to ${this.mode==="print"?"print":"download"}.</p>`;if(this._focusedOnly&&this.included>0)return d`<p class="ecd-count">Only the <strong>focused</strong> finding will be printed.</p><p class="ecd-excluded">Focus mode prints just the finding you're viewing. Switch to the list or grouped view to print all ${this.included} matching ${this.included===1?"finding":"findings"}.</p>`;let r=this.excluded===0&&this.filters.length===0?d`All <strong>${this.included}</strong> ${this.included===1?"finding":"findings"} included.`:d`<strong>${this.included}</strong> of ${this.total} ${this.total===1?"finding":"findings"} included.`;return d`<p class="ecd-count">${r}</p>${this.excluded>0?d`<p class="ecd-excluded">${this.excluded} filtered out and ${this.mode==="print"?"won't be printed":"won't be downloaded"}.</p>`:m}`}_filtersSection(){return this.filters.length===0?d`<p class="ecd-filters-label">No filters active — the full ${this.bucketLabel?`${this.bucketLabel.toLowerCase()} `:""}set is included.</p>`:d`<p class="ecd-filters-label">Active filters</p><dl class="ecd-filters">${this.filters.map(t=>d`<dt>${t.label}</dt><dd><span class="ecd-filter-value">${t.value}</span> <button type="button" class="ecd-filter-drop" data-drop="${t.key}" aria-label="${`Drop the ${t.label.toLowerCase()} filter (${t.value}) from this export`}" @click="${()=>this._onDropFilter(t.key)}">×</button></dd>`)}</dl>`}render(){let t=this.mode==="print",r=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>${gh({tabs:hU,current:this.mode,prefix:"ecd",select:n=>this._selectTab(n)})}</header><div role="tabpanel" id="${`ecd-panel-${this.mode}`}" aria-labelledby="${`ecd-tab-${this.mode}`}"><p class="nwd-intro">${r}</p>${this._countSection()} ${this.bucketLabel?d`<p class="nwd-note">Scoped to the <strong>${this.bucketLabel}</strong> list — live findings are not included.</p>`:m} ${this._filtersSection()}</div><footer class="nwd-actions"><span class="nwd-spacer"></span> <button type="button" data-role="cancel" @click="${this._onCancel}">Cancel</button> ${t?m:d`<button type="button" data-role="view" ?disabled="${this.included===0}" @click="${this._onView}">View</button>`} <button type="button" class="primary" ?disabled="${this.included===0}" @click="${this._onConfirm}">${t?"Print":"Download"}</button></footer></dialog>`}};customElements.define("export-confirm-dialog",fx);function fT(e="download"){let t=Ym(e),r=e==="print"?t.focusedOnly:Ym("print").focusedOnly;return new Promise(n=>{let o=document.createElement("export-confirm-dialog");Object.assign(o,{mode:e,included:t.included,excluded:t.excluded,total:t.total,filters:t.filters,fields:t.fields,bucketLabel:t.bucketLabel,focusedOnly:r});let i=s=>{o.remove(),n(s)};o.addEventListener("resolve",s=>i({confirmed:!!s.detail?.confirmed,view:!!s.detail?.view,fields:s.detail?.fields??null,mode:s.detail?.mode??e})),o.addEventListener("modal-conflict",()=>i({confirmed:!1,view:!1,fields:null,mode:e})),document.body.append(o)})}T();ue();Os();Su();Ee();var mU=160,gU=320,bU=/^ {0,3}#{1,6}(?: |$)/u,yU=/^ {0,3}(?:=+|-+) *$/u,Xm=/^\|?[^|\n]+(?:\|[^|\n]+)+\|?$/u,hT=/^\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?$/u;function mT(e,t=e.join(`
182
+ `),{target:r=mU,max:n=gU}={}){let o=e.length;if(o===0)return[];let i=ut(t),s=0,a=0,c=()=>{for(;s<i.length&&i[s][1]<=a-1;)s++;return s<i.length&&a-1>=i[s][0]},u=y=>e[y].trim()==="",p=y=>Xm.test(e[y]),f=y=>!c()&&!(hT.test(e[y])&&p(y-1))&&!(yU.test(e[y])&&!u(y-1)),h=y=>u(y-1)||bU.test(e[y]),g=[],b=0;for(let y=1;y<o;y++){a+=e[y-1].length+1;let k=y-b;k<r||!f(y)||(k>=n||h(y))&&(g.push([b,y]),b=y)}return g.push([b,o]),g}function gT(e,t){if(t<2||!Xm.test(e[t])||!Xm.test(e[t-1]))return null;let r=t-1;for(;r>0&&Xm.test(e[r-1]);)r--;for(let n=r+1;n<t;n++)if(hT.test(e[n]))return[n-1,n+1];return null}function bT(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}var yT=`dialog{max-width:none;max-height:none;width:calc(100vw - 4rem);height:calc(100vh - 4rem);margin:2rem auto;position:relative;padding:12px}dialog[open]{display:flex;flex-direction:column}dialog::backdrop{backdrop-filter:none}header{display:flex;align-items:center;gap:.45rem;margin-bottom:.6rem;padding-right:3rem;user-select:none}header h3{margin:0}.evd-close{position:absolute;top:6px;right:6px;z-index:1;width:22px;height:22px;display:grid;place-items:center;background:transparent;border:0;border-radius:4px;color:var(--muted);font:500 16px/1 ui-monospace,monospace;cursor:default;&:hover{color:var(--accent);background:var(--surface-active)}&:focus-visible{outline:2px solid var(--accent);outline-offset:1px}}.evd-code{flex:1 1 auto;min-height:0;margin:0;overflow:auto;border:1px solid var(--border);border-radius:6px;background:var(--bg, var(--surface));color:var(--text);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.78rem;line-height:1.55;scrollbar-width:thin;scrollbar-color:var(--border) transparent;&::-webkit-scrollbar{width:6px;height:6px}&::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}}.evd-lines{--evd-gutter: calc(var(--evd-lineno-width, 3ch) + 1.4rem);padding:.5rem 0;background-image:linear-gradient(to right,rgb(from var(--text) r g b / .03) 0 calc(var(--evd-gutter) - 1px),var(--border) calc(var(--evd-gutter) - 1px) var(--evd-gutter),transparent var(--evd-gutter))}.evd-chunk{display:grid;grid-template-columns:var(--evd-gutter) minmax(0,1fr);align-items:start;content-visibility:auto;contain-intrinsic-size:auto calc(var(--evd-chunk-lines, 1) * 1.55em)}.evd-chunk.evd-pending{display:block;padding:0 .75rem 0 calc(var(--evd-gutter) + .6rem);white-space:pre-wrap;overflow-wrap:anywhere}.evd-lineno{padding:0 .55rem 0 .4rem;color:var(--muted);text-align:right;font-variant-numeric:tabular-nums;user-select:none}.evd-line{padding:0 .75rem 0 .6rem;font:inherit;background:none;white-space:pre-wrap;overflow-wrap:anywhere}.evd-meta{color:var(--muted);font-size:.74rem;font-variant-numeric:tabular-nums}.evd-copy{margin-left:auto;flex-shrink:0;height:1.75rem;padding:0 .55rem;gap:.35rem;display:inline-flex;align-items:center;background:transparent;color:var(--muted);border:1px solid var(--border);border-radius:3px;font:inherit;font-size:.72rem;font-weight:500;letter-spacing:.02em;cursor:default;&:hover{color:var(--accent);background:var(--surface-active)}&:focus-visible{outline:2px solid var(--accent);outline-offset:1px}&.evd-done{color:var(--green, #4ade80);background:color-mix(in srgb,var(--green, #4ade80) 14%,transparent)}&.evd-failed{color:var(--critical, #f87171);background:color-mix(in srgb,var(--critical, #f87171) 14%,transparent)}}
183
+ `;var wU=d`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><rect x="3" y="2.5" width="8" height="10" rx="1" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/><rect x="5.5" y="5" width="8" height="9" rx="1" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`;function kU(e,t,r,n=null){let o="";for(let i=t;i<r;i++){let s=n===null?bT(e[i]):n[i-t];o+=`<span class="evd-lineno" aria-hidden="true">${i+1}</span><code class="evd-line">${s}
184
+ </code>`}return o}var hx=class extends F{static styles=[...F.styles,A(Fi),A(yT)];static properties={markdown:{attribute:!1},_copied:{state:!0}};_lines=[];_kb="0.0";_chunks=[];_copiedTimer=null;constructor(){super(),this.markdown="",this._copied=""}focusInitial(){this.renderRoot.querySelector('button[data-role="cancel"]')?.focus()}willUpdate(t){if(!t.has("markdown"))return;let r=this.markdown.split(`
185
+ `),n=r.length>1&&r.at(-1)===""?r.length-1:r.length;this._lines=r.slice(0,n),this._kb=(new TextEncoder().encode(this.markdown).length/1024).toFixed(1),this._chunks=mT(this._lines,this.markdown).map(([o,i])=>({start:o,end:i,asked:!1}))}render(){let t=this._lines.length,r=this._copied==="done"?"Copied":this._copied==="failed"?"Copy failed":"Copy",n=this._copied==="failed"?"Select the text and copy it by hand":m;return d`<dialog @close="${this._onClose}"><button type="button" class="evd-close" data-role="cancel" aria-label="Close" @click="${this._onClose}">×</button><header><h3>Report markdown</h3><span class="evd-meta">· ${t} ${t===1?"line":"lines"} · ${this._kb} KB</span> <button type="button" class="evd-copy ${this._copied==="done"?"evd-done":this._copied==="failed"?"evd-failed":""}" data-role="copy" data-tooltip="${n}" @click="${this._onCopy}">${wU}${r}</button></header><div class="evd-code" tabindex="0"><div class="evd-lines" style="--evd-lineno-width: ${String(t).length}ch">${this._chunks.map((o,i)=>d`<div class="evd-chunk evd-pending" data-chunk="${i}" style="--evd-chunk-lines: ${o.end-o.start}"></div>`)}</div></div></dialog>`}updated(){if(this.isConnected)for(let t of this.renderRoot.querySelectorAll(".evd-chunk:not([data-watched])")){t.dataset.watched="";let r=Number(t.dataset.chunk),n=this._chunks[r];t.textContent=`${this._lines.slice(n.start,n.end).join(`
186
+ `)}
187
+ `,Il(t,o=>{o&&(So(t),this._paint(t,r))})}}disconnectedCallback(){for(let t of this.renderRoot.querySelectorAll(".evd-chunk[data-watched]"))So(t);clearTimeout(this._copiedTimer),super.disconnectedCallback()}_onCopy=async()=>{let t="done";try{await navigator.clipboard.writeText(this.markdown)}catch{t="failed"}this.isConnected&&(this._copied=t,clearTimeout(this._copiedTimer),this._copiedTimer=setTimeout(()=>{this._copied="",this._copiedTimer=null},1500))};async _paint(t,r){let n=this._chunks[r];if(!n||n.asked)return;n.asked=!0;let o=gT(this._lines,n.start),i=[...o?this._lines.slice(o[0],o[1]):[],...this._lines.slice(n.start,n.end)].join(`
188
+ `),s=await Ir(i,"markdown");if(!this.isConnected)return;let a=s===null?null:R6(s).slice(o?o[1]-o[0]:0);t.innerHTML=kU(this._lines,n.start,n.end,a?.length===n.end-n.start?a:null),t.classList.remove("evd-pending")}};customElements.define("export-view-dialog",hx);function vT(e){return new Promise(t=>{let r=document.createElement("export-view-dialog");r.markdown=e;let n=()=>{r.remove(),t()};r.addEventListener("resolve",n),r.addEventListener("modal-conflict",n),document.body.append(r)})}T();D();pe();ue();Md();var wT=`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}
189
+ `;co();var mx=class extends F{static styles=[...F.styles,A(li),A(wT)];static properties={initial:{attribute:!1},finding:{attribute:!1},canApplyToGroup:{attribute:!1},_value:{state:!0}};constructor(){super(),this.initial="",this.finding=null,this.canApplyToGroup=!1,this._value=""}beforeOpen(){this._value=this.initial??""}focusInitial(){let t=this.renderRoot.querySelector('input[type="url"]');if(t){t.focus();try{t.select()}catch{}}}_onInput=t=>{this._value=t.target.value};get _trimmed(){return(this._value??"").trim()}_onSave=()=>{let t=(this.initial??"").trim();if(this._trimmed===t){this._finish(null);return}this._finish({value:this._trimmed,scope:"finding"})};_onApplyToGroup=()=>{this._trimmed&&this._finish({value:this._trimmed,scope:"group"})};_onClear=()=>this._finish({value:"",scope:"finding"});_onCancel=()=>this._finish(null);_onKeydown=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._trimmed,i=Fe(o);return d`<dialog @close="${this._onClose}"><header><h3>${n?"Edit fix link":"Add fix link"}</h3><div class="finding">${ci(ce(t,l.severityMode))} ${r?d`<span class="loc" title="${r}">${r}</span>`:m}</div>${t.description?d`<div class="desc" title="${t.description}">${t.description}</div>`:m}</header><div class="input-row"><input type="url" inputmode="url" autocomplete="off" spellcheck="false" placeholder="https://github.com/owner/repo/pull/123" .value="${this._value}" @input="${this._onInput}" @keydown="${this._onKeydown}"> ${i?d`<a class="open" href="${o}" target="_blank" rel="noopener noreferrer">Open ↗</a>`:m}</div><p class="hint">PR URL, issue link, commit, or any free-form reference. Enter to save, Esc to cancel.</p><footer class="nwd-actions">${n?d`<button type="button" class="danger" @click="${this._onClear}">Clear</button>`:m} <span class="nwd-spacer"></span> ${this.canApplyToGroup?d`<button type="button" class="quiet" ?disabled="${!o}" @click="${this._onApplyToGroup}">Apply to whole group</button> <span class="nwd-spacer"></span>`:m} <button type="button" @click="${this._onCancel}">Cancel</button> <button type="button" class="primary" @click="${this._onSave}">Save</button></footer></dialog>`}};customElements.define("fix-link-dialog",mx);function kT({initial:e="",finding:t=null,canApplyToGroup:r=!1}={}){return le("fix-link-dialog",{initial:e,finding:t,canApplyToGroup:r})}T();qe();ue();co();en();pe();Ow();Md();_u();var xT=`dialog{width:min(94vw,880px);max-width:880px}.conflicts-list{list-style:none;display:flex;flex-direction:column;gap:.6rem;max-height:65vh;overflow-y:auto;overscroll-behavior:contain}.conflict-card{padding:.6rem .7rem;border:1px solid var(--border);border-radius:6px}.finding-meta{display:flex;flex-wrap:wrap;align-items:center;gap:.4rem;color:var(--muted);font-size:.72rem}.location,code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;overflow-wrap:anywhere}.location{flex:1}h4{margin:.4rem 0 .55rem;font-size:.88rem;font-weight:600;overflow-wrap:anywhere}dt{margin-top:.5rem;color:var(--muted);font-size:.72rem}.variant{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,15rem);gap:.65rem;padding:.4rem 0;font-size:.8rem;+&{border-top:1px solid var(--border)}}.value{white-space:pre-wrap;overflow-wrap:anywhere}.reports{display:flex;flex-wrap:wrap;place-content:start flex-end;gap:.3rem}.report-button{display:inline-flex;align-items:center;gap:.4rem;max-width:100%;min-height:22px;padding:0 .4rem 0 0;border:1px solid var(--border);border-radius:4px;overflow:hidden;background:var(--bg);color:var(--text);font:inherit;font-size:.72rem;cursor:default;text-align:left;>span:last-child{min-width:0;overflow-wrap:anywhere}&:hover{border-color:var(--accent)}}
190
+ `;var _U={revalidate:"Outcome",revalidateVerdict:"Explanation",revalidateRecommendation:"Recommendation"},gx=class extends F{static styles=[...F.styles,A(li),A(Ai),A(xT)];static properties={conflicts:{attribute:!1}};constructor(){super(),this.conflicts=[]}render(){return d`<dialog aria-labelledby="revalidation-conflicts-title" @close="${this._onClose}"><header><h3 id="revalidation-conflicts-title">Revalidation conflicts</h3><p class="nwd-intro">Reports disagree about ${this.conflicts.length} finding${this.conflicts.length===1?"":"s"}. App view is unavailable until the conflicting reports are separated or updated.</p></header><ul class="conflicts-list">${this.conflicts.map(({finding:t,copies:r})=>d`<li class="conflict-card"><div class="finding-meta">${ci(t.severity)} ${t.file?d`<span class="location">${t.file}${Ct(t.line)?`:${fh(Ct(t.line))}`:""}</span>`:m} <code>${Is(t.id)??t.id}</code></div><h4>${lt(t)}</h4><dl>${a6(r).map(({field:n,variants:o})=>d`<dt>${_U[n]??n}</dt>${o.map(({value:i,reports:s})=>d`<dd class="variant"><div class="value">${i||d`<em>Empty</em>`}</div><div class="reports">${s.map(a=>a?d`<button type="button" class="report-button" aria-label="${`Open ${Re(a)} at this finding`}" @click="${()=>this._finish({id:t.id,reportName:a})}">${V(Qe[et(a)]??Qe.default)}<span>${Re(a)}</span></button>`:d`<span>Loaded report</span>`)}</div></dd>`)}`)}</dl></li>`)}</ul><footer class="nwd-actions"><span class="nwd-spacer"></span><button type="button" @click="${this._onClose}">Close</button></footer></dialog>`}};customElements.define("revalidation-conflicts-dialog",gx);function $T(e){return le("revalidation-conflicts-dialog",{conflicts:[...e.values()]})}wi();Nm();Ch();D();var _T=2;function ST(e,t){l.focusSplit=t,e.closest(".focus-main")?.style.setProperty("--focus-split",String(t)),e.setAttribute("aria-valuenow",String(Math.round(t)))}function CT(){try{localStorage.setItem(wp,String(l.focusSplit))}catch{}}function ET(e,t){ST(e,hc(t)),CT()}function RT(e,t){ET(e,l.focusSplit+t)}function MT(e){ET(e,fc)}function AT(e,t){let r=e.closest(".focus-main");if(!r)return;t.preventDefault(),e.classList.add("dragging");try{e.setPointerCapture(t.pointerId)}catch{}let n=i=>{let s=r.getBoundingClientRect();s.width!==0&&ST(e,hc((i.clientX-s.left)/s.width*100))},o=()=>{e.removeEventListener("pointermove",n),e.removeEventListener("pointerup",o),e.removeEventListener("pointercancel",o),e.classList.remove("dragging"),CT()};e.addEventListener("pointermove",n),e.addEventListener("pointerup",o),e.addEventListener("pointercancel",o)}D();or();tn();pe();ct();Ee();function SU(e){return $h(fi(e)).map(t=>Ln(t))}var CU={annotation(e){let t=xe(e),r=Kw(e);return!t&&!r?null:{triage:t?.triage,color:t?.color,comment:t?.comment,fix:t?.fix,flagged:t?.flagged===!0,ignored:r}},location:e=>Tn(e,Tr(e)),evidence:(e,t,r)=>hh(e,t,Tr(t),r),commit:e=>mh(e.repo?.github,e.commitHash),report:e=>e._reportName??null};function EU(e,t){let r=new Set(e.map(i=>i.repo??null)),n=r.size===1?[...r][0]:null;if(n)return n;let o=new Set;for(let i of t)for(let s of i)s.repo?.github&&!Qt(s.file)&&o.add(s.repo.github);return o.size===1?[...o][0]:o.size===0&&!l.currentWorkspace&&l.repoUrl?l.repoUrl:null}function bx(e){return e.replace(/\.(?:json|md|codex)$/iu,"")}function TT(){return l.currentWorkspace?J().find(e=>e.id===l.currentWorkspace)??null:null}function RU(e,t){if(t)return t.name;let r=e.map(o=>o.fileName);return r.length===1?bx(r[0]):Ed(r).replace(/[-_. ]+$/u,"")||`${r.length} reports`}function yx(){let e=l.reports,t=In(),r=ux(),n=SU(r),o=TT(),i=e.flatMap(c=>c.groups??[]),s=i.some(c=>c.some(cr)),a=i.some(c=>c.some(hE));return Nb({title:RU(e,o),workspace:o?.name??null,reports:e.map(c=>({name:c.fileName,source:c.source})),repo:EU(e,n),generatedAt:new Date,view:{bucket:px(),severityMode:s?l.severityMode:null,revalidation:a?l.showRevalidation:null,revalidationDetail:a&&l.showRevalidation!==!1?po():null},filters:dx(t),counts:{included:n.length,total:r.length},groups:n},CU)}function MU(){let e=TT(),t=l.reports.map(n=>n.fileName),r="";return e?r=e.name:t.length===1?r=bx(t[0]):t.length>1&&(r=bx(Ed(t))),r=r.replaceAll(/[\\/:*?"<>|\p{Cc}]/gu,"-").trim(),`${r||"deepview-report"}.md`}function IT(){if(l.reports.length===0)return;let e=new Blob([yx()],{type:"text/markdown;charset=utf-8"});qn(e,MU())}Dk();go();zn();xi();nu();ao();Xa();function wx(e){return!_()||!Ie.active||!l.currentManagedTeam?null:Ie.navigate(bt({view:e,teamId:l.currentManagedTeam,reportId:l.currentManagedReport},l.managedTeams))}var Cx=!1;cy(()=>{if(Cx)return;Cx=!0;let e=2;function t(){--e===0&&LU()}requestAnimationFrame(t),setTimeout(t,350)});function LU(){Cx=!1,l.findingIndexTick++,l.currentView==="bundles"&&l.selectedBundle?S():l.currentView==="packages"?S():l.currentView==="repositories"?S():l.currentView==="links"?S():(l.currentView==="findings"||l.currentView==="files")&&(K().catch(()=>{}),S())}var kx=!1;yy(()=>{l.currentView!=="findings"&&l.currentView!=="files"&&!mr()||kx||(kx=!0,queueMicrotask(()=>{kx=!1,!(l.currentView!=="findings"&&l.currentView!=="files"&&!mr())&&(l.bundleHashTick++,S())}))});ws(()=>{l.linksTick++,S()});function NT(){l.currentView==="bundles"&&l.bundleDetailsTab==="graph"?Cm():d1()}function tg(){l.currentView==="bundles"&&l.bundleDetailsTab==="graph"?Em():u1()}function rg(){let e=document.querySelector(".bundle-source-code-wrap"),t=e?.scrollTop??0,r=e?.scrollLeft??0;S();let n=document.querySelector(".bundle-source-code-wrap");n&&(n.scrollTop=t,n.scrollLeft=r)}function Tu(e){let r=document.querySelector(e)?.scrollTop??0;S();let n=document.querySelector(e);n&&(n.scrollTop=r)}function Co(){l.viewMode==="table"?Tu(".findings-table-list"):S()}var xx=0;function DT(){xx||(xx=requestAnimationFrame(()=>{xx=0,S()}))}function ae(e,t){for(let r of e.composedPath())if(r?.matches?.(t))return r;return null}function $x(e,t){queueMicrotask(()=>{let r=document.querySelector(`.bundle-source-lineno-row[data-line="${e}"]`);r&&r.scrollIntoView(t)})}function VT(e){e.classList.add("copied"),setTimeout(()=>e.classList.remove("copied"),1e3)}function Zm(e,t){try{navigator.clipboard.writeText(t).then(()=>(VT(e),null)).catch(()=>{})}catch{}}function WT(e){if(e.target.classList?.contains("bundle-source-overlay")||e.target.closest('[data-action="bundle-source-close"]'))return l.bundleSourceFile&&(Kd(l.bundleDetailsTab),S()),!0;if(e.target.closest('[data-action="bundle-source-panel-close"]'))return l.bundleSourceFindingIdx!=null&&(l.bundleSourceFindingIdx=null,rg()),!0;let t=e.target.closest("[data-bundle-source-finding]");if(t){let r=parseInt(t.dataset.bundleSourceFinding,10);return Number.isFinite(r)&&(l.bundleSourceFindingIdx=l.bundleSourceFindingIdx===r?null:r,rg()),!0}return!1}function zT(e){let t=Ax(e);if(!t)return null;let r=rt(t);return FE(r,Rh(r))}P.addEventListener("click",e=>{let t=ae(e,"[data-code-nav-file]");if(t){qT(Ax(e),{integrity:t.dataset.codeNavIntegrity,file:t.dataset.codeNavFile,range:Ct(t.dataset.codeNavLine)});return}let r=ae(e,"[data-code-history]");if(r){BU(r.dataset.codeHistory==="forward"?1:-1);return}let n=ae(e,"[data-code-preview]");if(n){let M=n.dataset.codePreview,H=new Set(l.codePreviews);H.delete(M)||H.add(M),l.codePreviews=H,S();return}let o=ae(e,"[data-finding-code-report]");if(o&&_()){aT({reportId:o.dataset.findingCodeReport,file:o.dataset.findingCodeFile,line:o.dataset.findingCodeLine});return}let i=ae(e,"[data-finding-code-bundle]");if(i){let M=i.dataset.findingCodeBundle,H=i.dataset.findingCodeFile,Y=i.dataset.findingCodeLine,q=Y?parseInt(Y,10):null;l.bundleSourceFile=H||null,l.bundleSourceFindingIdx=null,(l.bundleDetailsTab==="code"||l.bundleDetailsTab==="search")&&(l.bundleDetailsTab="overview");let Pe=()=>{Number.isFinite(q)&&$x(q,{block:"start",behavior:"instant"})};if(l.selectedBundle===M&&l.bundleDetails?.integrity===M){S(),Ps().then(()=>(l.selectedBundle===M&&l.bundleSourceFile===H&&Pe(),null));return}l.selectedBundle=M,l.selectedBundleWorkspace=null,l.bundleDetails=null,S(),(async()=>(await mo(M),Pe()))();return}let s=e.target.closest("[data-package-expand]");if(s){let M=s.dataset.packageExpand;l.expandedPackages.has(M)?l.expandedPackages.delete(M):l.expandedPackages.add(M),S();return}let a=e.target.closest("[data-package-row-issues]");if(a){let M=a.dataset.packageRowIssues,H=a.dataset.packageRowIssuesVersion;l.selectedPackage=M,l.selectedPackageVersion=H||null,l.packageDetailsTab="issues",l.packageSlideTriage=null,l.packageSlideTransient=!0,S();return}let c=e.target.closest("[data-repository-row-issues]");if(c){let M=c.dataset.repositoryRowIssues;l.selectedRepository=M,l.repositoryDetailsTab="issues",l.repositorySlideTriage=null,l.repositorySlideTransient=!0,S();return}let u=e.target.closest("[data-select-package]");if(u){let M=u.dataset.selectPackage,H=u.dataset.selectPackageVersion??"",Y=H===""?null:H;if(l.selectedPackage===M&&l.selectedPackageVersion===Y)return;l.selectedPackage=M,l.selectedPackageVersion=Y,l.packageDetailsTab="overview",l.packageSlideTriage=null,l.packageSlideTransient=!1,S();return}if(e.target.closest("[data-deselect-package]")){l.selectedPackage=null,l.selectedPackageVersion=null,S();return}let p=e.target.closest("[data-package-tab]");if(p){let M=p.dataset.packageTab;(M==="overview"||M==="issues")&&l.packageDetailsTab!==M&&(l.packageDetailsTab=M,S());return}if(e.target.closest('[data-action="package-slide-back"]')){l.packageDetailsTab="overview",l.packageSlideTriage=null,l.packageSlideTransient&&(l.selectedPackage=null,l.selectedPackageVersion=null,l.packageSlideTransient=!1),S();return}let f=ae(e,"[data-links-report][data-links-finding]");if(f){e.preventDefault();let{linksReport:M,linksFinding:H,managedReport:Y}=f.dataset;M&&H&&(async()=>{let q=await Pm(H,M,Y);q.ok||alert(q.reason)})().catch(q=>console.warn("links: reveal in report failed:",q));return}let h=e.target.closest("[data-package-report]");if(h){let M=h.dataset.packageReport;M&&tr(M);return}let g=e.target.closest("[data-select-repository]");if(g){let M=g.dataset.selectRepository;if(l.selectedRepository===M)return;l.selectedRepository=M,l.repositoryDetailsTab="overview",l.repositorySlideTriage=null,l.repositorySlideTransient=!1,S();return}if(e.target.closest("[data-deselect-repository]")){l.selectedRepository=null,S();return}let b=e.target.closest("[data-repository-tab]");if(b){let M=b.dataset.repositoryTab;(M==="overview"||M==="issues")&&l.repositoryDetailsTab!==M&&(l.repositoryDetailsTab=M,S());return}if(e.target.closest('[data-action="repository-slide-back"]')){l.repositoryDetailsTab="overview",l.repositorySlideTriage=null,l.repositorySlideTransient&&(l.selectedRepository=null,l.repositorySlideTransient=!1),S();return}let y=e.target.closest("[data-bundle-tab]");if(y){let M=y.dataset.bundleTab;if(gn.has(M)){if(M===l.bundleDetailsTab){l.selectedBundle&&Si(l.selectedBundle,M);return}l.bundleDetailsTab==="graph"&&M!=="graph"&&(Ye(),document.body.classList.remove("report-fullscreen")),Kd(M),l.selectedBundle&&Si(l.selectedBundle,M),S(),M==="code"&&Ps().then(()=>(l.bundleDetailsTab==="code"&&gu(),null))}return}if(e.target.closest("[data-bundle-retry-sources]")){l.bundleDetails&&delete l.bundleDetails.sourceError,S();return}let k=e.target.closest("[data-bundle-download]");if(k){let M=k.dataset.bundleDownload,H=(l.bundles??[]).find(Y=>Y.integrity===M);if(!H)return;(async()=>{let{confirmed:Y}=await lT({name:H.name,encrypted:fe()});if(Y)try{let q=await Xr(M);qn(new Blob([q],{type:"application/octet-stream"}),H.name)}catch(q){alert(`Failed to download bundle: ${q.message}`)}})();return}let v=e.target.closest("[data-bundle-export-sbom]");if(v){let M=v.dataset.bundleExportSbom,H=l.bundleDetails,Y=(l.bundles??[]).find(q=>q.integrity===l.selectedBundle);if(!Y||!H||H.integrity!==Y.integrity)return;try{let q=M==="cyclonedx",Pe=q?vM(H,Y):wM(H,Y),ot=`${vm(Y.name)}.${q?"cdx":"spdx"}.json`;qn(new Blob([Pe],{type:"application/json"}),ot)}catch(q){alert(`Failed to export ${M==="cyclonedx"?"CycloneDX":"SPDX"}: ${q.message}`)}return}if(ae(e,"[data-bundle-search-context]")){l.bundleSearchContext=!l.bundleSearchContext,Tu(".bundle-search-results");return}if(e.target.closest("[data-advisories-consent]")){CM(),S();return}if(e.target.closest("[data-advisories-retry]")){RM(l.bundleDetails,S).catch(()=>{}),S();return}let $=e.target.closest("[data-bundle-issue-report]");if($){let M=$.dataset.bundleIssueReport;M&&tr(M);return}if(WT(e))return;let C=e.target.closest("[data-bundle-code-issue-step]");if(C){let M=C.closest("[data-bundle-code-issue-order]"),H=null;try{H=JSON.parse(M?.dataset.bundleCodeIssueOrder??"null")}catch{}if(Array.isArray(H)&&H.length>0){let Y=C.dataset.bundleCodeIssueStep==="-1"?-1:1,q=H.findIndex(ot=>ot.idx===l.bundleSourceFindingIdx),Pe=q===-1?Y>0?H[0]:H.at(-1):H[(q+Y+H.length)%H.length];l.bundleSourceFindingIdx=Pe.idx,rg(),Pe.line>0&&$x(Pe.line,{block:"center",behavior:"smooth"})}return}let I=ae(e,"[data-bundle-view-source]");if(I){let M=I.dataset.bundleViewSource;if(!M)return;let H=I.dataset.bundleViewFindingIdx,Y=H===void 0?null:parseInt(H,10),q=I.dataset.bundleViewLine,Pe=q?parseInt(q,10):null,ot=l.bundleSourceFile!==M;if(l.bundleSourceFile=M,Number.isFinite(Y)?l.bundleSourceFindingIdx=Y:ot&&(l.bundleSourceFindingIdx=null),I.closest(".bundle-code-rail")?Tu(".bundle-code-rail-body"):I.closest(".bundle-search-results")?Tu(".bundle-search-results"):I.closest(".bundles-slide-body")?Tu(".bundles-slide-body"):S(),Number.isFinite(Pe)){let Et=I.dataset.bundleViewScrollBlock||"center";Ps().then(()=>(l.bundleSourceFile===M&&$x(Pe,{block:Et,behavior:"smooth"}),null))}return}if(e.target.closest('[data-action="toggle-files"]')){if(wx(l.currentView==="files"?"findings":"files"))return;l.currentView==="files"?l.currentView="findings":(l.viewMode==="graph"&&Ye(),l.currentView="files"),document.body.classList.remove("report-fullscreen"),S();return}let R=ae(e,"[data-g2-pkg]");if(R){let M=R.dataset.g2Pkg;L.solo=L.solo===M?null:M,L.solo&&(L.selected=null),NT(),tg(),L.graphState?.requestDraw?.();return}let z=ae(e,"[data-g2-select]");if(z){L.selected=z.dataset.g2Select,NT(),L.graphState?.requestDraw?.();return}let U=ae(e,"[data-g2-top-pkgs]");if(U){L.topPkgsTab=U.dataset.g2TopPkgs,tg();return}let B=ae(e,"[data-g2-jump-findings]");if(B){if(l.currentView==="bundles"){l.bundleDetailsTab==="graph"&&Ye(),Kd("issues"),l.selectedBundle&&Si(l.selectedBundle,"issues"),S();return}if(ol(),l.filterConfMin=0,l.filterInclude=B.dataset.g2JumpFindings,l.currentView="findings",l.viewMode==="graph"&&(l.viewMode="table"),Ye(),wx("findings"))return;S();return}let ne=ae(e,"[data-g2-jump-file]");if(ne){let M=ne.dataset.g2JumpFile;Ye();let H=()=>requestAnimationFrame(()=>{let q=document.querySelector(`#${ru(M)}`);q&&q.scrollIntoView({behavior:"smooth",block:"start"})}),Y=wx("files");if(Y){Y.then(q=>q?H():void 0);return}l.currentView="files",S(),H();return}if(ae(e,"#g2-path-filter-clear")){L.pathFilter="";let M=document.querySelector("graph-layout")?.shadowRoot?.querySelector("#g2-path-filter");M&&(M.value=""),L.graphState?.requestDraw?.();return}if(ae(e,"#g2-fullscreen")){document.body.classList.toggle("report-fullscreen");return}if(ae(e,"[data-g2-show-all]")){L.showAll=!L.showAll,L.layoutCache=null,L.selected=null,Ye(),S();return}if(ae(e,"[data-g2-split-own]")){L.splitOwnDirs=!L.splitOwnDirs,L.layoutCache=null,L.solo=null,L.focusedPkg=null,(L.packagesView||L.bundleLayout==="layers")&&(L.selected=null),Ye(),S();return}if(ae(e,"[data-g2-packages-view]")){L.bundleLayout==="dependencies"?(L.dependencyPackagesView=!L.dependencyPackagesView,L.solo=null):L.packagesView=!L.packagesView,L.layoutCache=null,L.selected=null,L.focusedPkg=null,Ye(),S();return}let ln=ae(e,"[data-g2-layout]");if(ln){let M=ln.dataset.g2Layout;if(M!=="graph"&&M!=="layers"&&M!=="matrix"&&M!=="dependencies"||L.bundleLayout===M&&!L.focusedPkg)return;L.bundleLayout=M,M==="dependencies"&&(L.dependencyPackagesView=!1),L.layoutCache=null,L.selected=null,L.solo=null,L.focusedPkg=null,Ye(),S();return}let Ke=ae(e,".graph2-triage-selector [data-triage-show]");if(Ke){let M=Ke.dataset.triageShow;l.shownTriage=l.shownTriage===M?null:M,L.layoutCache=null,L.selected=null,Ye(),S();return}let nr=ae(e,"[data-g2-focus-pkg]");if(nr){L.focusedPkg=nr.dataset.g2FocusPkg,L.layoutCache=null,Ye(),S();return}if(ae(e,"#g2-back-to-full")){L.focusedPkg=null,L.layoutCache=null,(L.packagesView||L.bundleLayout==="layers")&&(L.selected=null),Ye(),S();return}let Pi=ae(e,".tab");if(Pi&&ae(e,".tabs")){let H=ae(e,"[data-gid]").dataset.gid,Y=Pi.dataset.tid;l.activeTabByGroup.set(H,Y),Co();return}let Mo=ae(e,"[data-triage-action]");if(Mo){let M=Mo.closest(".triage-menu"),H=M?.dataset.gid;if(!H)return;let Y=yr(H);if(!Y)return;let q=Mo.dataset.triageAction;if(!["inprogress","fixed","invalid","deleted","ignored","restore"].includes(q))return;let{targets:Pe,clearing:ot}=b6(Y,q);if(Pe.length===0)return;KT(Pe,ot?"untriaged":q);try{M.hidePopover()}catch{}we(),Co();return}if(ae(e,".mark-comment")){let H=ae(e,"[data-gid]").dataset.gid,Y=yr(H);if(!Y)return;let q=rt(Y);if(!Oe(q))return;if(_()){Promise.resolve().then(()=>(PT(),OT)).then(({openManagedCommentsDialog:Et})=>Et(q,Co)).catch(()=>_t("Could not open comments. Please retry."));return}let Pe=W(q),ot=xe(q)?.comment??"";iT({initial:ot,finding:q}).then(Et=>(Et===null||!Oe(q)||(Z(l.triage,Pe,{comment:Et||void 0}),we(),Co()),null)).catch(()=>{});return}let jl=ae(e,".mark-copy");if(jl){let M=zT(e);if(M===null)return;Zm(jl,M);return}let Pu=ae(e,".mark-link");if(Pu){let M=ae(e,"[data-gid]"),H=M?yr(M.dataset.gid):null;if(!H)return;let Y=ml(rt(H));if(!Y)return;Zm(Pu,Y);return}let Vl=ae(e,"[data-copy-report]");if(Vl){Zm(Vl,Vl.dataset.copyReport);return}let ta=ae(e,"[data-copy-path]");if(ta){Zm(ta,ta.dataset.copyPath);return}let Wl=ae(e,".mark-claude");if(Wl){let M=zT(e);if(M===null)return;let H=`claude://code/new?q=${encodeURIComponent(`Confirm and fix:
191
+
192
+ ${M}`)}`;try{window.location.href=H,VT(Wl)}catch{}return}if(ae(e,".mark-fix")){let H=ae(e,"[data-gid]")?.dataset.gid,Y=H?yr(H):null;if(!Y)return;let q=rt(Y);if(!Oe(q))return;let Pe=w6(Y),ot=xe(q)?.fix??"";kT({initial:ot,finding:q,canApplyToGroup:g6(Pe,ot)}).then(Et=>{if(Et===null||!Oe(q))return null;let Gl=Et.scope==="group"?Pe.filter(Ao=>Oe(Ao)&&(Ao===q||Gw(Ao,ot))):[q],ra=!1;for(let Ao of Gl)Z(l.triage,W(Ao),{fix:Et.value||void 0})&&(ra=!0);return ra&&(Gl.length>1&&l.activeTabByGroup.set(H,W(q)),Co(),queueMicrotask(we)),null}).catch(()=>{});return}let Nu=ae(e,"[data-flag-toggle]");if(Nu){let M=Nu.dataset.flagToggle,H=ae(e,"[data-gid]")?.dataset.gid,Y=(H?yr(H):null)?.find(Pe=>W(Pe)===M);if(!Y||!Oe(Y))return;let q=xe(Y)?.flagged;Z(l.triage,M,{flagged:q!==!0}),we(),Co();return}let Du=e.target.closest("[data-triage-show]");if(Du&&!Du.closest(".graph2-triage-selector")){let M=Du.dataset.triageShow;l.shownTriage=l.shownTriage===M?null:M,S();return}if(e.target.closest("[data-table-deselect]")){l.tableSelectedGid=null,Co();return}let Kl=e.target.closest("[data-tree-select]");if(Kl){let M=Kl.dataset.treeSelect;l.filesSelectedFile=l.filesSelectedFile===M?null:M,S();return}e.target.closest("[data-tree-deselect]")&&(l.filesSelectedFile=null,S())});var UT=document.querySelector("#bundle-source-overlay-slot");UT&&UT.addEventListener("click",WT);function ng(e){let t=e?yr(e):null;t&&Mh(t)&&queueMicrotask(we)}P.addEventListener("row-select",e=>{let t=e.detail?.gid;if(!t)return;let r=l.tableSelectedGid!==t;l.tableSelectedGid=r?t:null,r&&ng(t),Co()});var og="application/x-deepview-kanban-gid";function KT(e,t){for(let r of e){if(!Oe(r))continue;let n=W(r),o=Ww(r);t==="untriaged"?(Z(l.triage,n,{triage:void 0}),wt(l.triage,n,o,!1)):t==="ignored"?(Z(l.triage,n,{triage:void 0}),wt(l.triage,n,o,!0)):(Z(l.triage,n,{triage:t}),wt(l.triage,n,o,!1))}}function Ex(){for(let e of P.querySelectorAll(".kanban-card.dragging"))e.classList.remove("dragging");for(let e of P.querySelectorAll(".kanban-column.drag-over"))e.classList.remove("drag-over")}P.addEventListener("dragstart",e=>{let t=e.target.closest?.(".kanban-card[data-kanban-source]");if(!t||!e.dataTransfer)return;let r=t.dataset.gid;if(!r)return;let n=yr(r);if(!n||hi(n).length===0){e.preventDefault();return}e.dataTransfer.setData(og,r),e.dataTransfer.setData("text/plain",r),e.dataTransfer.effectAllowed="move",t.classList.add("dragging")});P.addEventListener("dragend",Ex);P.addEventListener("dragover",e=>{if(!e.dataTransfer?.types.includes(og))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 P.querySelectorAll(".kanban-column.drag-over"))r!==t&&r.classList.remove("drag-over");t.classList.add("drag-over")}});P.addEventListener("dragleave",e=>{let t=e.target.closest?.(".kanban-column[data-kanban-target]");t&&(t.contains(e.relatedTarget)||t.classList.remove("drag-over"))});P.addEventListener("drop",e=>{if(!e.dataTransfer?.types.includes(og))return;let t=e.target.closest?.(".kanban-column[data-kanban-target]");if(!t){Ex();return}e.preventDefault();let r=e.dataTransfer.getData(og),n=t.dataset.kanbanTarget;if(Ex(),!r||!n)return;let o=yr(r);if(!o||(Ve(o).commonTriage??"untriaged")===n)return;let s=hi(o);s.length!==0&&(KT(s,n),S(),queueMicrotask(we))});var _x=!1;function Js(e){return e?P.querySelector(`.kanban-card[data-gid="${CSS.escape(e)}"]`):null}function Qm(e){let t=e??P.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`),document.documentElement.style.setProperty("--kanban-return-card-bg",getComputedStyle(t).backgroundColor))}function FU(){let e=P.querySelector(".kanban-detail-side [data-kanban-select].active");e&&e.scrollIntoView({block:"nearest",behavior:"instant"})}function Sx(e){l.kanbanPopoverGid=e,l.focusCodeStack=[],l.focusCodeAt=0}function HT(){FU(),bo()}function Zs(e){let t=l.kanbanPopoverGid;if(t===e)return;let r=t===null&&e!==null,n=t!==null&&e===null;if(!document.startViewTransition||!r&&!n){ng(e),Sx(e),S(),HT();return}if(_x)return;ng(e),_x=!0;let o=r?"kanban-opening":"kanban-closing";document.documentElement.classList.add(o);let i=u=>{u&&(u.style.viewTransitionName=""),document.documentElement.classList.remove(o),_x=!1};if(r){let u=Js(e);u?(Qm(u),u.style.viewTransitionName="kanban-detail-modal",u.getBoundingClientRect()):Qm(),Sx(e);let p=document.startViewTransition(()=>{S(),HT(),u&&(u.style.viewTransitionName="")}),f=setTimeout(()=>i(u),600);(async()=>{try{await p.finished}catch{}clearTimeout(f),i(u)})();return}Qm(),Sx(e);let s=null,a=document.startViewTransition(()=>{S(),s=Js(t),s&&(Qm(s),s.style.viewTransitionName="kanban-detail-modal")}),c=setTimeout(()=>i(s??Js(t)),600);(async()=>{try{await a.finished}catch{}clearTimeout(c),i(s??Js(t))})()}function GT(e){let t=Js(l.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 i=Math.min(Math.max(o+e,0),n.length-1);if(i===o)return;let s=n[i].dataset.gid;if(!s)return;Zs(s);let a=Js(s);a&&(a.focus({preventScroll:!0}),a.scrollIntoView({block:"nearest",behavior:"instant"}))}var eg=null;function Rx(){Sh(),l.focusCodeStack=[],l.focusCodeAt=0,S(),eg?.isConnected&&eg.focus({preventScroll:!0}),eg=null}P.addEventListener("click",e=>{let t=e.target.closest?.("[data-links-preview]");if(t){e.preventDefault(),eg=t;let s=t.dataset.previewRow,a=d6(t.dataset.linksPreview,t.dataset.previewReport,s===void 0?void 0:Number(s),t.dataset.previewManagedReport);S(),P.querySelector(".kanban-detail-close")?.focus({preventScroll:!0}),a.then(()=>{S(),bo();let c=mr()?.group?.[0]._bundleHashes;if(Array.isArray(c))for(let u of c)k0(u).catch(()=>{});return null});return}if(e.target.closest?.(".kanban-detail-close")){if(mr()){Rx();return}Zs(null);return}if(e.target.closest?.("[data-kanban-detail-fullscreen]")){l.kanbanDetailFullscreen=!l.kanbanDetailFullscreen;try{localStorage.setItem(kp,String(l.kanbanDetailFullscreen))}catch{}S(),bo();return}let r=e.target.closest?.("[data-kanban-expand]");if(r){let s=r.dataset.kanbanExpand,a=l.kanbanExpandedColumn===s?null:s;l.kanbanExpandedColumn=a,a&&l.kanbanPopoverGid&&Js(l.kanbanPopoverGid)?.closest(".kanban-column")?.dataset.kanbanTarget!==a&&(l.kanbanPopoverGid=null),S();return}let n=e.target.closest?.("[data-kanban-nav]");if(n){GT(n.dataset.kanbanNav==="next"?1:-1);return}let o=e.target.closest?.("[data-kanban-select]");if(o){if(window.getSelection?.()?.toString())return;let s=o.dataset.gid;s&&Zs(s);return}if(e.target.closest?.(".kanban-action"))return;let i=e.target.closest?.(".kanban-card[data-kanban-source]");if(i){if(window.getSelection?.()?.toString())return;let s=i.dataset.gid;if(!s)return;Zs(l.kanbanPopoverGid===s?null:s);return}if(!e.target.closest?.(".kanban-detail-modal, .kanban-detail-side")){if(mr()){Rx();return}l.kanbanPopoverGid&&Zs(null)}});P.addEventListener("change",e=>{let t=e.target.closest?.("[data-kanban-column]");if(!t)return;let r=t.selectedOptions[0]?.dataset.gid;r&&Zs(r)});document.addEventListener("keydown",e=>{if(e.key==="Escape"){if(mr()){!e.defaultPrevented&&!JT(e)&&!document.querySelector(":popover-open:not(#styled-tooltip)")&&Rx();return}if(l.kanbanPopoverGid){Zs(null);return}l.viewMode!=="kanban"||l.kanbanExpandedColumn===null||(l.kanbanExpandedColumn=null,S())}});function Ax(e){let r=ae(e,"[data-gid]")?.dataset?.gid;return r?yr(r):null}function qT(e,t){if(!t.integrity||!t.file)return;let r=Xd(e);if(!r)return;let n=e3(r,t);n&&(l.focusCodeStack=n.stack,l.focusCodeAt=n.at,S()),bo()}P.addEventListener("keydown",e=>{if(e.key!=="Enter"&&e.key!==" ")return;let t=ae(e,"[data-code-nav-file]");t&&(e.preventDefault(),qT(Ax(e),{integrity:t.dataset.codeNavIntegrity,file:t.dataset.codeNavFile,range:Ct(t.dataset.codeNavLine)}))});function BU(e){let t=t3(l.focusCodeStack,l.focusCodeAt,e);t!==l.focusCodeAt&&(l.focusCodeAt=t,S(),bo())}function YT(e){if(!e||l.focusGid===e)return;ng(e),l.focusGid=e,l.focusCodeStack=[],l.focusCodeAt=0,S();let t=P.querySelector(".focus-side-card.active");t&&t.scrollIntoView({block:"nearest",behavior:"instant"}),bo()}function XT(e){let t=[...P.querySelectorAll(".focus-side-card[data-focus-select]")];if(t.length===0)return;let r=t.findIndex(i=>i.classList.contains("active")),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&&YT(o)}P.addEventListener("click",e=>{let t=e.target.closest?.("[data-focus-nav]");if(t){XT(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&&YT(n)});P.addEventListener("pointerdown",e=>{if(e.button!==0)return;let t=e.target.closest?.("[data-focus-splitter]");t&&AT(t,e)});P.addEventListener("dblclick",e=>{let t=e.target.closest?.("[data-focus-splitter]");t&&MT(t)});function JT(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(l.currentView!=="findings")return;let t=l.viewMode==="focus",r=l.viewMode==="kanban"&&l.kanbanPopoverGid!==null;if(!t&&!r||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||JT(e))return;let n=0;if(e.key==="ArrowRight")n=1;else if(e.key==="ArrowLeft")n=-1;else return;e.preventDefault();let o=e.target?.closest?.("[data-focus-splitter]");if(o){RT(o,n*_T);return}t?XT(n):GT(n)});P.addEventListener("mark-color",e=>{let t=ae(e,"[data-gid]");if(!t)return;let r=t.dataset.gid,n=yr(r);if(!n)return;let o=rt(n);if(!Oe(o))return;let i=W(o),s=e.detail?.color;if(!s)return;xe(o)?.color===s?Z(l.triage,i,{color:void 0}):Z(l.triage,i,{color:s}),we(),Co()});var Qs=null,Mx=null,Nl=null;function ZT(){if(Qs!==null)return;if(l.reports.length===0){Nl=null;return}Qs=l.viewMode,Mx=document.title;let e=!1;l.viewMode==="table"&&(l.viewMode="list",e=!0),Nl&&(Ld(Nl),e=!0),e&&S();for(let n of P.querySelectorAll("finding-card"))n.ensureRendered({sync:!0});let t=l.reports.map(n=>n.fileName),r="";t.length===1?r=t[0]:t.length>1&&(r=Ed(t)),r=r.replace(/\.json$/u,""),r&&(document.title=r)}function QT(){if(Qs===null)return;let e=!1;l.viewMode!==Qs&&(l.viewMode=Qs,e=!0),Nl&&(Fd(),Nl=null,e=!0),e&&S(),document.title=Mx,Qs=null,Mx=null}window.addEventListener("beforeprint",ZT);window.addEventListener("afterprint",QT);async function OU(e){if(Qs===null){Nl=e,ZT();try{await Promise.all([...P.querySelectorAll("finding-card")].map(t=>t.ensureRendered())),window.print()}catch(t){throw QT(),t}}}function jT(e,t){if(!e)return t();Ld(e);try{return t()}finally{Fd()}}document.addEventListener("download-requested",async()=>{if(l.reports.length===0)return;let{confirmed:e,view:t,fields:r,mode:n}=await fT("download");if(t){await vT(jT(r,()=>yx()));return}if(e){if(n==="print"){await OU(r);return}jT(r,()=>IT())}});P.addEventListener("analyzer-change",e=>{l.filterAnalyzer=e.detail.analyzer,l.filterModel=e.detail.model,S()});P.addEventListener("repo-change",e=>{l.filterRepo=e.detail.value,S()});P.addEventListener("revalidate-change",e=>{l.filterRevalidate=e.detail.value,S()});P.addEventListener("partial-change",e=>{l.filterPartial=e.detail.value,S()});P.addEventListener("revalidation-change",e=>{l.showRevalidation=e.detail.on,!e.detail.on&&l.reports.some(r=>(r.groups??[]).some(n=>n.some(o=>!o.isApp&&(o.isUpstream||Qt(o.file)))))?_t("App mode off is not recommended; it can conflate triage for issues in dependencies.",{kind:"warning"}):e.detail.on&&aw(),ai(l.showRevalidation,l.upstreamOnly),Fs(Fn(),{resetSort:!1}),S()});P.addEventListener("revalidation-conflicts-open",()=>{(async()=>{let e=await $T(l.revalidateConflicts);if(!e)return;let t=await Pm(e.id,e.reportName);t.ok||alert(t.reason)})().catch(e=>console.warn("revalidation: open conflicting finding failed:",e))});P.addEventListener("revalidation-detail-change",e=>{l.revalidationDetailed=e.detail.on===!0,S()});P.addEventListener("upstream-only-change",e=>{if(l.upstreamOnly=e.detail.on===!0,ai(l.showRevalidation,l.upstreamOnly),!l.upstreamOnly){let t=Fn();Tw(t,kh(t))==="confirmed"&&(l.filterRevalidate="confirmed",l.filterPartial="")}S()});P.addEventListener("bundle-search-mode-change",e=>{let t=e.detail?.mode;t!=="files"&&t!=="code"&&t!=="issues"||(l.bundleCodeSearchMode=t,S(),t==="files"&&gu())});P.addEventListener("bundle-graph-reason-change",e=>{let t=e.detail?.reason;t!==null&&typeof t!="string"||(L.bundleReason=t,L.layoutCache=null,L.selected=null,L.solo=null,L.focusedPkg=null,Ye(),S())});P.addEventListener("bundle-search-regex-toggle",()=>{l.bundleSearchRegex=!l.bundleSearchRegex,S()});P.addEventListener("bundle-search-case-toggle",()=>{l.bundleSearchCase=!l.bundleSearchCase,S()});P.addEventListener("bundle-swap",e=>{let t=e.detail?.integrity;if(!t||!(l.bundles??[]).some(n=>n.integrity===t))return;let r=l.bundles.find(n=>n.integrity===t);if(r.managedId){Ie.navigate(Ja(l.managedTeams,r,l.currentManagedTeam,"compare"));return}ho(t,"compare"),Si(t,"compare"),S(),K(),mo(t)});P.addEventListener("sort-change",e=>{let{kind:t,value:r}=e.detail;if(t==="findings")l.sortBy=r;else if(t==="packages")l.packagesSortBy=r;else if(t==="repositories")l.repositoriesSortBy=r;else return;S()});P.addEventListener("range-change",e=>{e.target.id==="conf-range"&&(l.filterConfMin=e.detail.low,l.filterConfMax=e.detail.high,S())});P.addEventListener("input",e=>{let t=e.composedPath()[0],r=t?.id,n=t?.value;r==="g2-path-filter"&&(L.pathFilter=n,L.graphState?.requestDraw?.())});P.addEventListener("search-input",e=>{if(!e.detail)return;let{kind:t,value:r}=e.detail;if(t==="findings"){l.filterInclude=r,r||(l.filterIncludeNegate=!1),DT();return}else if(t==="files")l.filesSearch=r;else if(t==="packages")l.packagesSearchQuery=r;else if(t==="repositories")l.repositoriesSearchQuery=r;else if(t==="bundle-code")l.bundleCodeSearchQuery=r;else if(t==="bundle-search"){l.bundleSearchQuery=r,DT();return}else return;S()});P.addEventListener("search-negate-toggle",()=>{l.filterIncludeNegate=!l.filterIncludeNegate,S()});P.addEventListener("severity-toggle",e=>{let t=e.detail.severity;if(e.detail.kind==="graph"){L.selectedSeverities.has(t)?L.selectedSeverities.delete(t):L.selectedSeverities.add(t),e.composedPath()[0].selected=[...L.selectedSeverities],L.graphState?.requestDraw?.(),tg();return}l.filterSeverities.has(t)?l.filterSeverities.delete(t):l.filterSeverities.add(t),S()});P.addEventListener("color-toggle",e=>{let t=e.detail.color;if(e.detail.kind==="graph"){L.selectedColors.has(t)?L.selectedColors.delete(t):L.selectedColors.add(t),e.composedPath()[0].selected=[...L.selectedColors],L.graphState?.requestDraw?.(),tg();return}l.filterColors.has(t)?l.filterColors.delete(t):l.filterColors.add(t),S()});P.addEventListener("source-toggle",e=>{let t=e.detail.source,r=l.filterSources.has(t);l.filterSources.clear(),r||l.filterSources.add(t),S()});P.addEventListener("annotation-filter-toggle",e=>{let t=e.detail?.key,r=n=>n===""?"with":n==="with"?"without":"";if(t==="comment")l.filterComment=r(l.filterComment);else if(t==="fix")l.filterFix=r(l.filterFix);else if(t==="flag")l.filterFlagged=r(l.filterFlagged);else if(t==="duplicates"&&!l.currentWorkspace)l.filterDuplicates=r(l.filterDuplicates);else if(t==="cross-context")l.filterCrossContext=r(l.filterCrossContext);else if(t==="app-stacked")l.filterAppStacked=r(l.filterAppStacked);else if(t==="security")l.filterSecurity=r(l.filterSecurity);else return;S()});P.addEventListener("slide-triage-toggle",e=>{let{kind:t,value:r}=e.detail;if(t==="package")l.packageSlideTriage=l.packageSlideTriage===r?null:r;else if(t==="repository")l.repositorySlideTriage=l.repositorySlideTriage===r?null:r;else return;S()});P.addEventListener("view-mode-change",e=>{if(e.detail.kind==="files"){l.filesViewMode=e.detail.mode,S();return}l.viewMode=e.detail.mode,l.viewMode!=="kanban"&&(l.kanbanPopoverGid=null),l.viewMode!=="focus"&&(l.focusGid=null),S()});P.addEventListener("severity-mode-change",e=>{let t=e.detail?.mode;if(!(t!=="corrected"&&t!=="original")){l.severityMode=t;try{localStorage.setItem(vp,t)}catch{}S()}});P.addEventListener("repo-edit-start",()=>{_()||(l.repoEditing=!0,S())});P.addEventListener("repo-input",e=>{_()||(l.repoUrl=e.detail.url,Kr(l.currentFile,l.repoUrl))});P.addEventListener("repo-commit",e=>{_()||(l.repoUrl=e.detail.url,Kr(l.currentFile,l.repoUrl),l.repoEditing=!1,S())});P.addEventListener("repo-cancel",e=>{_()||(l.repoUrl=e.detail.url,Kr(l.currentFile,l.repoUrl),l.repoEditing=!1,S())});document.addEventListener("keydown",e=>{if(e.key==="Escape"){if(l.bundleSourceFindingIdx!=null){l.bundleSourceFindingIdx=null,rg();return}if(l.bundleSourceFile){if(l.currentView==="bundles"&&l.bundleDetailsTab==="code")return;Kd(l.bundleDetailsTab),S()}}});T();function nt(e,t){for(let[r,n]of Object.entries(t))e.hasAttribute(r)||e.setAttribute(r,n)}var eI=`: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}}@media(display-mode:window-controls-overlay){:host{-webkit-app-region:no-drag;app-region:no-drag}}
193
+ `;var Tx="deepview.theme",ig=Object.freeze(["dark","light","green","pink"]),NU={dark:{base:"#1a1a1b",dim:"#0a0a0a"},light:{base:"#f6f6fa",dim:"#646464"},green:{base:"#0a140a",dim:"#050a05"},pink:{base:"#ffe4ee",dim:"#a3727f"}},DU="\u2600",zU="\u263E",Ix="deepview-theme-changed",sg="dark",Fx=!1;function UU(){try{let e=localStorage.getItem(Tx);return ig.includes(e)?e:"dark"}catch{return"dark"}}function Iu(e){ig.includes(e)||(e="dark"),sg=e;for(let r of ig)r!=="dark"&&document.body.classList.remove(`theme-${r}`);e!=="dark"&&document.body.classList.add(`theme-${e}`);try{e==="dark"?localStorage.removeItem(Tx):localStorage.setItem(Tx,e)}catch{}let t=document.querySelector('meta[name="theme-color"]');if(t){let{base:r,dim:n}=NU[e];t.setAttribute("content",Fx?n:r)}window.dispatchEvent(new CustomEvent(Ix,{detail:{theme:e}}))}Iu(UU());window.addEventListener("beforeprint",()=>{Fx=!0,Iu(sg)});window.addEventListener("afterprint",()=>{Fx=!1,Iu(sg)});function tI(e){if(!ig.includes(e))throw new TypeError("unknown theme");Iu(e)}function rI(){return sg}var Lx=class extends X{static properties={_light:{state:!0}};static styles=A(eI);constructor(){super(),this._light=document.body.classList.contains("theme-light")}connectedCallback(){super.connectedCallback(),nt(this,{role:"button",tabindex:"0","aria-label":"toggle theme"}),this.addEventListener("click",this._toggle),this.addEventListener("keydown",this._onKeydown),window.addEventListener(Ix,this._onThemeChanged)}disconnectedCallback(){window.removeEventListener(Ix,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");Iu(t?"dark":"light")};_onKeydown=t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this._toggle())};render(){return d`${this._light?zU:DU}`}};customElements.define("theme-toggle",Lx);T();Mt();ct();T();Ce();lo();Su();ct();wl();var nI=`:host{display:block}.row{display:grid;grid-template-columns:5.5rem minmax(0,1fr);gap:.2rem .85rem;padding:.25rem .7rem;font-size:.8rem;border-bottom:1px solid var(--border);transition:background .12s}:host(:last-child) .row{border-bottom:none}.row.row-pending{min-height:3rem}:host(:hover) .row{background:rgb(from var(--text) r g b / .04)}:host(.mark-red) .row{background:var(--mark-red-bg)}:host(.mark-blue) .row{background:var(--mark-blue-bg)}:host(.mark-green) .row{background:var(--mark-green-bg)}:host(.mark-gray) .row{background:var(--mark-gray-bg)}:host(.has-conflict) .row{outline:2px dashed var(--accent);outline-offset:-2px}:host(.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:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;& a{color:inherit;text-decoration:none;cursor:default}& a:hover{color:var(--accent)}}.marks{display:flex;gap:.35rem;align-items:center;min-width:0;margin-left:auto;user-select:none}}.gh-ref-btn{display:inline-flex;align-items:center;position:relative;flex-shrink:0;padding:0 .15rem;color:var(--muted);cursor:default;&:before{content:"";position:absolute;inset:-.25rem -2px}&:hover{color:var(--accent)}&:focus-visible{outline:1px solid var(--accent);outline-offset:1px;border-radius:2px}}.tabs-row{grid-column:2;grid-row:3;min-width:0;.tabs{display:flex;gap:.25rem;flex-wrap:wrap}}.badge,.tabs,.tab,.row-type{cursor:default;user-select:none}.badge{display:inline-block;font-size:.7rem;font-weight:600;text-transform:uppercase;padding:.15rem .45rem;border-radius:3px;letter-spacing:.03em;line-height:1;&.critical{background:var(--critical);color:#fff}&.high{background:var(--high);color:#fff}&.medium{background:var(--medium);color:#000}&.low{background:var(--low);color:var(--badge-low-text)}&.high_bug{background:var(--high-bug);color:#fff}&.bug{background:var(--bug);color:#fff}&.informational{background:var(--info);color:#fff}}.badge-pair{display:inline-flex;align-items:center;gap:.25rem}.badge-pair-full,.badge-pair-compact{flex-direction:column;gap:.15rem}.badge-orig-wrap{display:inline-flex;align-items:center;gap:.15rem;line-height:1}.badge-arrow,.badge-corr-mark{font-size:.6rem;line-height:1;color:var(--muted)}.badge-arrow.up,.badge-corr-mark.up{color:var(--high)}.badge-pre{font-size:.55rem;text-transform:uppercase;letter-spacing:.03em;color:var(--muted)}.badge-orig{display:inline-block;font-size:.58rem;font-weight:600;text-transform:uppercase;padding:.08rem .3rem;border-radius:3px;letter-spacing:.03em;line-height:1;background:transparent;color:var(--muted);border:1px solid var(--border);&.struck{text-decoration:line-through;text-decoration-thickness:1px}&.critical{border-color:rgb(from var(--critical) r g b / .55)}&.high{border-color:rgb(from var(--high) r g b / .55)}&.medium{border-color:rgb(from var(--medium) r g b / .55)}&.low{border-color:rgb(from var(--low) r g b / .55)}&.high_bug{border-color:rgb(from var(--high-bug) r g b / .55)}&.bug{border-color:rgb(from var(--bug) r g b / .55)}&.informational{border-color:rgb(from var(--info) r g b / .55)}}.badge-varies{font-size:.55rem;font-weight:600;text-transform:uppercase;letter-spacing:.03em;padding:.08rem .3rem;border-radius:3px;line-height:1;background:transparent;color:var(--muted);border:1px dashed var(--border)}.mark-action-group{display:inline-flex;border:1px solid var(--border);border-radius:3px;background:linear-gradient(var(--surface),var(--surface)),var(--bg);overflow:hidden;margin-right:.25rem;flex-shrink:0}.mark-comment,.mark-fix,.mark-flag,.mark-copy,.mark-link,.mark-issue,.mark-claude{background:transparent;border:0;color:var(--muted);padding:0 .25rem;height:1.4rem;cursor:default;display:inline-flex;align-items:center;justify-content:center;&:not(:last-child){border-right:1px solid var(--border)}&:not(:disabled):hover{color:var(--accent);background:var(--surface-active)}}.mark-issue{text-decoration:none}.mark-comment.has-comment,.mark-fix.has-fix,.mark-flag.flagged{color:var(--accent)}.mark-flag svg{display:block}.mark-copy.copied,.mark-link.copied,.mark-claude.copied{color:var(--green, #4ade80);background:color-mix(in srgb,var(--green, #4ade80) 14%,transparent)}.mark-comment.has-comment .bubble,.mark-fix.has-fix .wrench,.mark-flag.flagged .flag-cloth{fill:var(--accent);fill-opacity:.15}.triage-menu-wrap{position:relative;display:inline-flex;margin-left:.25rem;flex-shrink:0}.mark-triage-menu{cursor:default;background:linear-gradient(var(--surface),var(--surface)),var(--bg);border:1px solid var(--border);color:var(--muted);border-radius:3px;padding:0 .3rem;height:1.5rem;display:inline-flex;align-items:center;justify-content:center;gap:.25rem;font:inherit}.mark-triage-menu:not(:disabled):hover{color:var(--text);border-color:var(--accent)}.mark-comment:disabled,.mark-fix:disabled,.mark-flag:disabled,.mark-triage-menu:disabled,.triage-menu-item:disabled{opacity:.4}.mark-triage-menu.with-label{padding:0 .35rem 0 .5rem;font-size:.72rem;height:1.5rem}.mark-triage-menu .mark-triage-label{text-transform:uppercase;letter-spacing:.05em;font-weight:600}.mark-triage-menu.triage-state-deleted{border-color:var(--critical);color:var(--critical)}.mark-triage-menu.triage-state-fixed{border-color:var(--green, #4ade80);color:var(--green, #4ade80)}.mark-triage-menu.triage-state-inprogress{border-color:var(--warning, #d97706);color:var(--warning, #d97706)}.mark-triage-menu.triage-state-invalid{border-color:var(--muted);color:var(--text)}.mark-triage-menu.triage-state-ignored{border-color:var(--accent, #2563eb);color:var(--accent, #2563eb)}.triage-menu[popover]{position:fixed;inset:auto;margin:0;min-width:7rem;background:var(--bg);border:1px solid var(--border);border-radius:4px;padding:.25rem;box-shadow:0 4px 12px #00000040;display:flex;flex-direction:column;gap:1px;-webkit-app-region:no-drag;app-region:no-drag}.triage-menu[popover]:not(:popover-open){display:none}.triage-menu[popover]:popover-open{display:flex}.triage-menu-item{cursor:default;background:transparent;border:0;padding:.35rem .5rem;font-size:.78rem;color:var(--text);text-align:left;border-radius:3px;font-family:inherit}.triage-menu-item:not(:disabled):hover{background:var(--surface)}.triage-menu-item.active:before{content:"\\2713 ";color:var(--accent)}.triage-menu-inprogress:not(:disabled):hover{color:var(--warning, #d97706)}.triage-menu-fixed:not(:disabled):hover{color:var(--green, #4ade80)}.triage-menu-invalid:not(:disabled):hover{color:var(--muted)}.triage-menu-deleted:not(:disabled):hover{color:var(--critical)}.line-num{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{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}}
194
+ `;var ag=`.tab-level-separator{align-self:center;padding-inline:.125rem;color:var(--muted);font-size:.75rem;line-height:1}.tab{--tab-severity: var(--bg);position:relative;display:inline-flex;align-items:center;gap:.35rem;border:1px solid transparent;border-radius:4px;padding-block:calc(.35rem - .1em);padding-inline:.5rem;min-width:0;font-family:inherit;font-size:.75rem;line-height:1.3;color:var(--text);background:var(--tab-severity);background-image:linear-gradient(135deg,var(--tab-marker, transparent) 50%,var(--tab-marker-shadow, transparent) 50%,transparent 60%);background-size:12px 12px;background-repeat:no-repeat;background-origin:border-box;&.tab-with-confidence{padding-right:1rem;min-width:3.25rem}&.tab-with-analyzer{padding-right:calc(.5rem + 20px)}&.tab-severity-critical{--tab-severity: var(--critical);color:#fff}&.tab-severity-high{--tab-severity: var(--high);color:#fff}&.tab-severity-medium{--tab-severity: var(--medium);color:#000}&.tab-severity-low{--tab-severity: var(--low);color:var(--badge-low-text)}&.tab-severity-high_bug{--tab-severity: var(--high-bug);color:#fff}&.tab-severity-bug{--tab-severity: var(--bug);color:#fff}&.tab-severity-informational{--tab-severity: var(--info);color:#fff}&.tab-mark-red{--tab-marker: var(--marker-red)}&.tab-mark-blue{--tab-marker: var(--marker-blue)}&.tab-mark-green{--tab-marker: var(--marker-green)}&.tab-mark-gray{--tab-marker: var(--marker-gray)}&:is(.tab-mark-red,.tab-mark-blue,.tab-mark-green,.tab-mark-gray){--tab-marker-shadow: rgb(0 0 0 / .3)}&:hover{border-color:var(--muted)}&.active{border-color:var(--text);box-shadow:inset 0 0 0 1px var(--text)}&.active:before{content:"";position:absolute;z-index:1;top:-1px;left:-1px;width:12px;height:12px;border-top-left-radius:inherit;background:var(--tab-marker, transparent);clip-path:polygon(0 0,100% 0,0 100%);pointer-events:none}&.tab-with-analyzer:is(:hover,.active):after{content:"";position:absolute;inset:-1px;border:1px solid var(--muted);border-radius:inherit;pointer-events:none}&.tab-with-analyzer.active:after{border-color:var(--text);box-shadow:inset 0 0 0 1px var(--text)}&.tab-deleted .tab-label{text-decoration:line-through;opacity:.6}&.tab-inprogress .tab-label:after{content:" \\25d0";opacity:.6}&.tab-fixed .tab-label{opacity:.65}&.tab-fixed .tab-label:after{content:" \\2713";opacity:.6}&.tab-invalid .tab-label{opacity:.65}&.tab-invalid .tab-label:after{content:" \\2298";opacity:.6}&.tab-ignored .tab-label{opacity:.55}&.tab-ignored .tab-label:after{content:" \\1f441";opacity:.6;font-size:.7em}.tab-label{display:flex;align-items:center;gap:.35rem;text-align:left}.tab-conf{position:absolute;right:.25rem;bottom:.15rem;font-size:.6rem;line-height:1;color:inherit}.tab-analyzer{position:absolute;inset:-1px -1px -1px auto;width:20px;display:flex;overflow:hidden;border-radius:0 4px 4px 0;box-shadow:0 0 2px #0003}.tab-analyzer .report-logo{flex:1;border:0}.tab-analyzer svg{display:block}.tab-conf-max{display:none}.tab-severity{display:inline-flex}.badge{padding:0;background:none;color:inherit}.tab-indicators{display:inline-flex;align-items:center;gap:.25rem}.tab-indicators:empty{display:none}.tab-marks{display:inline-flex;align-items:center;gap:.15rem;color:inherit}.tab-marks svg{display:block}.tab-marks :is(.bubble,.wrench,.flag-cloth){fill:currentcolor;fill-opacity:.15}.badge-corr-mark{color:inherit}}
195
+ `;_u();var lg=`.report-button{display:inline-flex;align-items:center;max-width:16rem;padding:0;overflow:hidden;background:transparent;border:1px solid var(--border);border-radius:3px;color:var(--muted);font:inherit;font-size:.7rem;text-decoration:none;cursor:default;transition:border-color .12s,color .12s;&:hover{border-color:var(--accent);color:var(--accent)}&:focus-visible{outline:2px solid var(--accent);outline-offset:1px}}.report-button-label{min-width:0;padding:.1rem .4rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
196
+ `;var cg=`a{cursor:default}.finding-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:.25rem 1rem;min-width:0;max-width:100%}.finding-action-controls{display:flex;flex:0 0 auto;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:.35rem;max-width:100%}.finding-actions .report-chip{flex:0 1 auto;width:max-content;min-width:0;max-width:100%;min-height:1.4rem}.finding-actions .report-chip-label{white-space:normal;overflow-wrap:anywhere;text-align:left}
197
+ `;var KU=["is-critical","mark-red","mark-blue","mark-green","mark-gray","has-conflict","triage-inprogress","triage-fixed","triage-invalid","triage-deleted","triage-ignored","selected"],Bx=class extends G{static properties={group:{attribute:!1},selected:{type:Boolean}};static styles=[A(Ai),A(lg),A(nI),A(cg),A(ag)];_near=!1;_watching=!1;constructor(){super(),this.group=null,this.selected=!1}render(){if(!this.group)return d``;if(this.dataset.gid=de(this.group),!this._near)return this.classList.toggle("selected",this.selected),d`<div class="row row-pending" aria-busy="true"></div>`;let t=new Set(I0(this.group));this.selected&&t.add("selected");for(let r of KU)this.classList.toggle(r,t.has(r));return d`<div class="row">${$3(this.group)}</div>`}connectedCallback(){super.connectedCallback(),Dt(this.renderRoot),this.addEventListener("click",this._onClick),this._watching=!0,Il(this,t=>this._onNear(t))}disconnectedCallback(){this.removeEventListener("click",this._onClick),this._watching&&(So(this),this._watching=!1),super.disconnectedCallback()}_onNear(t){t?(this._watching&&(So(this),this._watching=!1),this._near=!0,this.requestUpdate()):this._near&&(this._near=!1,this.requestUpdate())}ensureRendered({sync:t=!1}={}){return this._near||this._onNear(!0),t&&this.isConnected&&this.isUpdatePending&&this.performUpdate(),this.updateComplete}_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",Bx);var oI=`: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}}
198
+ `;var Ox=class extends X{static properties={items:{attribute:!1},selectedGid:{attribute:!1}};static styles=A(oI);constructor(){super(),this.items=[],this.selectedGid=null}render(){return d`${re(this.items??[],t=>de(t),t=>d`<finding-row .group="${t}" ?selected="${de(t)===this.selectedGid}"></finding-row>`)}`}};customElements.define("finding-table",Ox);T();Ce();lo();Su();ct();wl();jh();var iI=`:host{display:block}:host(.hidden){display:none}:host([lazy]:not(.content-ready)){visibility:hidden}:host(.triage-fixed),:host(.triage-invalid),:host(.triage-deleted),:host(.triage-ignored){opacity:.75}.card{padding:.5rem .75rem;padding-bottom:var(--finding-card-pad-bottom, .5rem);border-bottom:1px solid var(--border);font-size:.875rem;display:var(--finding-card-display, block);flex-direction:column;flex:1}:host(:last-child) .card{border-bottom:none}.card.card-pending{min-height:8rem}:host(.has-conflict) .card{outline:2px dashed var(--accent);outline-offset:-2px}:host(.has-conflict[popup][context="kanban-detail"]) .card{outline:none}:host(.link-target) .card{animation:link-target-flash 1.6s ease-out}@keyframes link-target-flash{0%,30%{box-shadow:inset 0 0 0 2px var(--accent)}to{box-shadow:inset 0 0 0 2px rgb(from var(--accent) r g b / 0)}}@media(prefers-reduced-motion:reduce){:host(.link-target) .card{animation:none;box-shadow:inset 0 0 0 2px var(--accent)}}:host([in-group]) .line-row{display:none}@media not print{:host([in-group]) .line-row+*{margin-top:0}:host([in-group]) .line-row+:is(.conf-reason,.revalidate-verdict,.severity-reason){padding-top:0;border-top:0}}.tabs{display:flex;gap:.25rem;flex-wrap:wrap}.marks-left{display:flex;align-items:center;gap:.5rem;margin-right:auto;flex-wrap:wrap}.commit-ref{color:var(--muted);font-size:.8rem;& a{color:var(--accent);font-family:ui-monospace,SFMono-Regular,Menlo,monospace}& a:hover{text-decoration:underline}& span{font-family:ui-monospace,SFMono-Regular,Menlo,monospace}}.marks-commit-row{margin-top:.4rem;padding-left:4.75rem}.tab-body{display:none;grid-template-columns:auto 1fr;gap:.25rem .75rem;&.active{display:grid}}.tab-body>:not(.finding-left){min-width:0;overflow-wrap:break-word}.desc-title{grid-column:2;font-size:1.08em;font-weight:600;letter-spacing:-.005em;line-height:1.35;color:var(--text)}.desc{grid-column:2;white-space:pre-wrap;font-size:.96em;line-height:1.6;color:rgb(from var(--text) r g b / .82);margin-top:.4rem}.section,.evidence,.recommendation{grid-column:2;margin-top:.55rem;font-size:.92em}.section-label{display:flex;align-items:center;gap:.3rem;color:var(--muted);font-weight:600;font-size:.62rem;text-transform:uppercase;letter-spacing:.06em;&:before{content:"";flex:none;width:2px;height:.58rem;margin-left:calc((2px + .3rem)*-1);border-radius:1px;background:currentcolor;opacity:.75;-webkit-print-color-adjust:exact;print-color-adjust:exact}}.code-preview-btn{display:inline-flex;align-items:center;margin-left:.35rem;padding:0 .15rem;border:0;background:transparent;color:var(--muted);vertical-align:-2px;&.open{color:var(--accent)}}.gh-ref-btn{display:inline-flex;align-items:center;margin-left:.25rem;padding:0 .15rem;color:var(--muted);vertical-align:-2px}:is(.code-preview-btn,.gh-ref-btn){position:relative;&:before{content:"";position:absolute;inset:-.25rem -2px}&:hover{color:var(--accent)}&:focus-visible{outline:1px solid var(--accent);outline-offset:1px;border-radius:2px}}.code-preview-tip{position:absolute;z-index:20;top:100%;left:0;margin-top:.3rem;width:max-content;max-width:min(100%,46rem);visibility:hidden;filter:drop-shadow(0 2px 6px rgb(0 0 0 / .35));background:var(--bg);border-radius:4px;.code-preview{margin:0}}:is(.line-row,.evidence-list li):has(.code-preview-btn:is(:hover,:focus-visible))>.code-preview-tip{visibility:visible}.code-preview{margin:.3rem 0 .1rem;border:1px solid var(--border);border-radius:4px;background:var(--surface);backdrop-filter:var(--glass-blur);max-height:calc(10lh + .7rem);overflow:auto;display:flex;align-items:flex-start;white-space:normal;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.75rem;line-height:1.5}.code-preview-pending{display:block;padding:.35rem .5rem;color:var(--muted);font-style:italic}.code-preview-gutter{flex:none;padding:.35rem .45rem .35rem .5rem;border-right:1px solid var(--border);color:var(--muted);text-align:right;user-select:none;position:sticky;left:0;z-index:1;background-color:var(--bg);background-image:linear-gradient(rgb(from var(--text) r g b / .03),rgb(from var(--text) r g b / .03)),linear-gradient(var(--surface),var(--surface));.code-preview-lineno{width:var(--lineno-width, 3ch);opacity:.7}.cited{opacity:1;color:var(--accent);font-weight:600}}.code-preview-source{margin:0;padding:.35rem .6rem;white-space:pre;color:var(--text);font:inherit;& code{font:inherit}}summary.section-label{cursor:default;list-style:none;&::-webkit-details-marker{display:none}&:after{content:"";flex:none;width:.3rem;height:.3rem;margin-left:.05rem;border-right:1.5px solid currentcolor;border-bottom:1.5px solid currentcolor;transform:translateY(-1px) rotate(-45deg);transition:transform .12s;opacity:.8}}details[open]>summary.section-label:after{transform:translateY(-2px) rotate(45deg)}.evidence-count{font-weight:500;opacity:.8}.section-body{white-space:pre-wrap;line-height:1.55;color:rgb(from var(--text) r g b / .82);margin-top:.1rem}.para+.para{margin-top:.5lh}.md-list{margin:0;padding-inline-start:1.2em}.md-list li+li{margin-top:.25lh}.para+.md-list,.md-list+.para,.md-list+.md-list{margin-top:.5lh}.md-list li::marker{color:rgb(from currentcolor r g b / .45)}.recommendation .section-label,.recommendation .section-body{color:var(--green)}.conf-reason,.revalidate-verdict{grid-column:2;white-space:pre-wrap;font-size:.92em;font-style:italic;color:var(--muted);margin-top:.6rem;padding-top:.55rem;border-top:1px dashed var(--border)}.revalidate-stamp{display:inline-block;margin-top:.1rem;font-size:.55rem;font-weight:600;line-height:1;text-transform:uppercase;letter-spacing:.03em;padding:.14rem .3rem;border-radius:3px;background:transparent;color:var(--muted);border:1px solid var(--border);white-space:nowrap;&.confirmed{color:var(--critical);border-color:rgb(from var(--critical) r g b / .55)}&.partial{color:var(--yellow);border-color:rgb(from var(--yellow) r g b / .55)}&.unknown{color:var(--warning);border-color:rgb(from var(--warning) r g b / .55)}}.evidence-list{margin:.25rem 0 0;padding-left:1.6rem;display:flex;flex-direction:column;gap:.15rem;>li{position:relative}& li::marker{color:var(--muted);font-size:.9em}>li.current:before{content:"";position:absolute;left:-1.5rem;top:.58em;width:.35rem;height:.35rem;border-radius:50%;background:var(--accent)}>li.current::marker{color:var(--accent)}& li:has(.evidence-note):not(:last-child){margin-bottom:.3rem}}.evidence-ref{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.92em;overflow-wrap:anywhere;color:var(--accent);text-decoration:none;&:is(a,[role=link]):hover{text-decoration:underline}&:focus-visible{outline:1px solid var(--accent);outline-offset:1px;border-radius:2px}}:is(.line-num a,.evidence-ref,.gh-ref-btn){cursor:default}span.evidence-ref:not([role]){color:var(--muted)}.evidence-note{white-space:pre-wrap;line-height:1.5;color:rgb(from var(--text) r g b / .78);margin-top:.1rem}.desc-title a,.desc a,.section-body a,.conf-reason a,.revalidate-verdict a{color:var(--accent);text-decoration:none;&:hover{text-decoration:underline}}.inline-quote{background:rgb(from var(--accent) r g b / .1);padding:1px;border-radius:3px;color:var(--text)}.inline-code{background:var(--surface-active);border-radius:3px;border:1px solid var(--border);padding:0 .25em;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.9em;color:var(--text)}.code-block{white-space:normal;margin:.5rem 0;border:1px solid var(--border);border-radius:4px;background:rgb(from var(--text) r g b / .05);overflow:hidden;width:fit-content;max-width:100%;.code-block-lang{padding:.15rem .5rem;border-bottom:1px solid var(--border);color:var(--muted);font-size:.62rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em}& pre{margin:0;padding:.45rem .6rem;overflow-x:auto;white-space:pre;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.85em;line-height:1.5;color:var(--text)}& code{font:inherit}}.line-row{display:flex;justify-content:space-between;align-items:baseline;gap:.5rem;flex-wrap:wrap;padding-right:var(--finding-line-end-inset, 0);position:relative}.run-meta{color:var(--muted);font-size:.65rem}.finding-code-btn{display:inline-block;margin-top:.35rem;padding:.1rem .45rem;background:transparent;border:1px solid var(--border);border-radius:999px;color:var(--muted);font:inherit;font-size:.65rem;font-weight:500;white-space:nowrap}.finding-code-btn:hover{border-color:var(--accent);color:var(--accent)}.marks{display:flex;gap:.35rem;justify-content:flex-end;margin-top:.4rem;align-items:center;position:var(--finding-marks-position, static);bottom:0;background:var(--finding-marks-bg, transparent);padding-bottom:var(--finding-marks-pad-bottom, 0);padding-left:4.75rem;user-select:none}.finding-left{align-self:start;text-align:center;min-width:4rem;padding-top:var(--finding-left-inset, 0);position:var(--finding-left-position, relative);top:var(--finding-mark-sticky-top, 0);.value-label:last-child{margin-bottom:0}}:host(:not([popup])) .finding-left{padding-top:calc(var(--finding-left-inset, 0px) + 2px)}.conf-score{font-size:.75rem;color:var(--muted);margin-top:.3rem;& strong{color:var(--text);font-size:.85rem}}.conf-ring{--col: var(--muted);position:relative;width:3rem;height:3rem;margin:.7rem auto .15rem;display:flex;align-items:center;justify-content:center;& svg{position:absolute;inset:0;width:100%;height:100%;transform:rotate(-90deg)}& circle{fill:none;stroke-width:4}.conf-ring-track{stroke:var(--border)}.conf-ring-arc{stroke:var(--col);stroke-linecap:round}& span{position:relative;z-index:1;font-size:.8rem;font-weight:700;color:var(--text);font-variant-numeric:tabular-nums}& small{font-size:.55rem;color:var(--muted);font-weight:500}&.critical{--col: var(--critical)}&.high{--col: var(--high)}&.medium{--col: var(--medium)}&.low{--col: var(--low)}&.high_bug{--col: var(--high-bug)}&.bug{--col: var(--bug)}&.informational{--col: var(--info)}}.value-label{display:block;font-size:.45rem;color:var(--muted);text-transform:uppercase;letter-spacing:.04em;margin-top:.1rem;margin-bottom:.3rem;font-weight:500}.print-case-label{display:none}.badge,.tabs,.tab,.value-label,.run-meta,.conf-ring{cursor:default;user-select:none}.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}.duplicates-block .file-icon{flex-shrink:0}.mark-action-group{display:inline-flex;border:1px solid var(--border);border-radius:3px;background:linear-gradient(var(--surface),var(--surface)),var(--bg);overflow:hidden;margin-right:.25rem;flex-shrink:0}.mark-comment,.mark-fix,.mark-flag,.mark-copy,.mark-link,.mark-issue,.mark-claude{background:transparent;border:0;color:var(--muted);padding:0 .25rem;height:1.4rem;cursor:default;display:inline-flex;align-items:center;justify-content:center;&:not(:last-child){border-right:1px solid var(--border)}&:not(:disabled):hover{color:var(--accent);background:var(--surface-active)}}.mark-issue{text-decoration:none}.mark-comment.has-comment,.mark-fix.has-fix,.mark-flag.flagged{color:var(--accent)}.mark-flag svg{display:block}.mark-copy.copied,.mark-link.copied,.mark-claude.copied{color:var(--green, #4ade80);background:color-mix(in srgb,var(--green, #4ade80) 14%,transparent)}.mark-comment.has-comment .bubble,.mark-fix.has-fix .wrench,.mark-flag.flagged .flag-cloth{fill:var(--accent);fill-opacity:.15}.triage-menu-wrap{position:relative;display:inline-flex;margin-left:.25rem;flex-shrink:0}.mark-triage-menu{cursor:default;background:linear-gradient(var(--surface),var(--surface)),var(--bg);border:1px solid var(--border);color:var(--muted);border-radius:3px;padding:0 .3rem;height:1.5rem;display:inline-flex;align-items:center;justify-content:center;gap:.25rem;font:inherit}.mark-triage-menu:not(:disabled):hover{color:var(--text);border-color:var(--accent)}.mark-comment:disabled,.mark-fix:disabled,.mark-flag:disabled,.mark-triage-menu:disabled,.triage-menu-item:disabled{opacity:.4}.mark-triage-menu.with-label{padding:0 .35rem 0 .5rem;font-size:.72rem;height:1.5rem}.mark-triage-menu .mark-triage-label{text-transform:uppercase;letter-spacing:.05em;font-weight:600}.mark-triage-menu.triage-state-deleted{border-color:var(--critical);color:var(--critical)}.mark-triage-menu.triage-state-fixed{border-color:var(--green, #4ade80);color:var(--green, #4ade80)}.mark-triage-menu.triage-state-inprogress{border-color:var(--warning, #d97706);color:var(--warning, #d97706)}.mark-triage-menu.triage-state-invalid{border-color:var(--muted);color:var(--text)}.mark-triage-menu.triage-state-ignored{border-color:var(--accent, #2563eb);color:var(--accent, #2563eb)}.triage-menu[popover]{position:fixed;inset:auto;margin:0;min-width:7rem;background:var(--bg);border:1px solid var(--border);border-radius:4px;padding:.25rem;box-shadow:0 4px 12px #00000040;display:flex;flex-direction:column;gap:1px;-webkit-app-region:no-drag;app-region:no-drag}.triage-menu[popover]:not(:popover-open){display:none}.triage-menu[popover]:popover-open{display:flex}.triage-menu-item{cursor:default;background:transparent;border:0;padding:.35rem .5rem;font-size:.78rem;color:var(--text);text-align:left;border-radius:3px;font-family:inherit}.triage-menu-item:not(:disabled):hover{background:var(--surface)}.triage-menu-item.active:before{content:"\\2713 ";color:var(--accent)}.triage-menu-inprogress:not(:disabled):hover{color:var(--warning, #d97706)}.triage-menu-fixed:not(:disabled):hover{color:var(--green, #4ade80)}.triage-menu-invalid:not(:disabled):hover{color:var(--muted)}.triage-menu-deleted:not(:disabled):hover{color:var(--critical)}: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:not(:disabled):hover{background:var(--surface-active)}:host([context="focus"]) .triage-menu-inprogress.active{background:rgb(from var(--warning, #d97706) r g b / .12);border-color:var(--warning, #d97706);color:var(--warning, #d97706)}:host([context="focus"]) .triage-menu-fixed.active{background:rgb(from var(--green, #4ade80) r g b / .12);border-color:var(--green, #4ade80);color:var(--green, #4ade80)}:host([context="focus"]) .triage-menu-deleted.active{background:rgb(from var(--critical) r g b / .12);border-color:var(--critical);color:var(--critical)}:host([context="focus"]) .triage-menu-item.active:before{content:"";margin:0}:host([context="focus"]) .marks{gap:.5rem;margin-top:var(--finding-marks-margin-top, .65rem);padding-left:0;padding-top:.55rem;border-top:1px solid var(--border);flex-wrap:wrap}:host([context="focus"]) .marks-commit-row{padding-left:0}:host([context="focus"]) .mark-comment,:host([context="focus"]) .mark-fix,:host([context="focus"]) .mark-flag,:host([context="focus"]) .mark-copy,:host([context="focus"]) .mark-link,:host([context="focus"]) .mark-issue,:host([context="focus"]) .mark-claude{height:1.75rem;padding:0 .55rem;gap:.35rem;display:inline-flex;align-items:center;font-size:.72rem}:host([context="focus"]) .mark-btn-label{color:inherit;font-weight:500;letter-spacing:.02em}.finding-top-marks{position:absolute;top:calc(var(--finding-left-inset, 0px) - var(--finding-mark-inset, .5rem));left:calc(.75rem - var(--finding-mark-inset, .5rem));display:grid;grid-template-columns:24px 12px;column-gap:31px;&.color-red{color:var(--marker-red)}&.color-blue{color:var(--marker-blue)}&.color-green{color:var(--marker-green)}&.color-gray{color:var(--marker-gray)}}.finding-color-mark{grid-column:1;display:block;width:24px;height:12px;border-radius:0 0 6px 6px;background:currentcolor;box-shadow:inset 0 0 0 1px rgb(from var(--text) r g b / .15)}.finding-bookmark-mark{grid-column:2;display:block;width:12px;height:12px;background:var(--bookmark-color);clip-path:polygon(0 0,100% 0,100% 100%,50% 75%,0 100%)}:host(:not([popup])) :is(.finding-color-mark,.finding-bookmark-mark){height:10px}.comment-block,.fix-block{margin-top:.5rem;padding:.35rem .55rem;border-left:3px solid var(--accent);background:rgb(from var(--accent) r g b / .08);border-radius:0 4px 4px 0;font-size:.82rem;color:var(--text)}.comment-block{white-space:pre-wrap;& a{color:var(--accent);text-decoration:none}& a:hover{text-decoration:underline}& a.comment-self-ref{text-decoration:underline dotted;text-underline-offset:2px}& a.comment-self-ref:hover{text-decoration:underline solid}}.comment-block:has(.managed-comment){white-space:normal}.fix-block{word-break:break-all;& a{color:var(--accent);text-decoration:none}& a:hover{text-decoration:underline}}.fix-block:has(managed-fix-link){display:flex;align-items:center;gap:.6rem;padding:.45rem .65rem;border:1px solid var(--border);border-radius:6px;background:rgb(from var(--muted) r g b / .04);word-break:normal;.fix-label{flex:none;font-size:.75rem;font-weight:500}& managed-fix-link{flex:1;min-width:0}}.duplicates-block{display:flex;align-items:baseline;flex-wrap:wrap;gap:.1rem .4rem;margin-top:.5rem;padding:.35rem .55rem;border-left:3px solid var(--muted);background:rgb(from var(--muted) r g b / .1);border-radius:0 4px 4px 0;font-size:.82rem;color:var(--text);.duplicates-label{color:var(--muted);font-weight:600}& a.duplicate-ref{display:inline-flex;align-items:center;gap:.25rem;color:var(--accent);text-decoration:none}& a.duplicate-ref .duplicate-ref-id{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.78rem;text-decoration:underline dotted;text-underline-offset:2px}& a.duplicate-ref:hover .duplicate-ref-id{text-decoration:underline solid}}.comment-label,.fix-label{color:var(--muted);font-weight:600;margin-right:.35rem}.line-num{color:var(--muted);font-size:.8rem}.line-num a{color:inherit;text-decoration:none}.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:var(--finding-print-break, avoid);box-decoration-break:clone;padding:.45rem .25rem}.finding-code-btn,.mark-copy,.mark-link,.mark-issue,.mark-claude{display:none!important}.npm-link{border:0;padding:0}:host(.triage-fixed),:host(.triage-invalid),:host(.triage-deleted),:host(.triage-ignored){opacity:1}:host(.link-target) .card{animation:none;box-shadow:none!important}:host(.multi-case) .card:before{content:"Multiple reports of one finding";display:block;font-size:.7rem;font-weight:700;color:#555;text-transform:uppercase;letter-spacing:.06em;border-bottom:1px solid #bbb;padding-bottom:.2rem;margin-bottom:.35rem;-webkit-print-color-adjust:exact;print-color-adjust:exact}.marks,.tabs{display:none!important}.tab-body{display:grid!important;break-inside:var(--finding-print-break, avoid)}:host(.multi-case) .tab-body{break-inside:auto}:host(.multi-case) .tab-body+.tab-body{break-inside:avoid}.tab-body+.tab-body{margin-top:.5rem;padding-top:.5rem;border-top:1px dashed #999}.finding-body{display:flex;flex-direction:column;>*{flex-shrink:0}}.line-row,.desc-title,.conf-reason,.severity-reason{break-inside:avoid}.section-label{break-after:avoid}.desc,.section-body{orphans:2;widows:2}.section,.recommendation,.evidence{break-inside:avoid}.evidence{order:99}.evidence>summary{break-after:avoid}.evidence-list>li{break-inside:avoid}:host([in-group].multi-case) .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;break-after:avoid;font-size:.65rem;font-weight:600;color:#555;background:#eee;padding:.1rem .35rem;border-radius:3px;margin-bottom:.25rem;letter-spacing:.04em;-webkit-print-color-adjust:exact;print-color-adjust:exact}.value-label{color:#777}.badge{-webkit-print-color-adjust:exact;print-color-adjust:exact;&.critical{background:#a30b0f!important;color:#fff!important}&.high{background:#b8400a!important;color:#fff!important}&.medium{background:#855107!important;color:#fff!important}&.low{background:#374151!important;color:#fff!important}&.high_bug{background:#7a3e0c!important;color:#fff!important}&.bug{background:#4d4538!important;color:#fff!important}&.informational{background:#0550ae!important;color:#fff!important}}.badge-orig{background:transparent!important;color:#555!important;border-color:#999!important}.badge-varies,.revalidate-stamp{color:#555!important;border-color:#999!important}.badge-arrow,.badge-corr-mark,.badge-pre,.severity-reason{color:#555!important}a,.line-num,.line-num a,.desc-title a,.desc a,.section-body a,.conf-reason a,.revalidate-verdict a,.evidence-ref{color:inherit}details:not([open])>:not(summary){display:block}details::details-content{content-visibility:visible}summary.section-label{cursor:auto;&:after{display:none}}.code-preview-btn,.gh-ref-btn{display:none}.inline-code{border:0;background:transparent}.code-block{background:transparent;border-color:#bbb;.code-block-lang{color:#555;border-bottom-color:#bbb}& pre{white-space:pre-wrap;overflow:visible}.token{color:#333!important}.token.comment,.token.prolog,.token.cdata{color:#666!important}}}
199
+ `;_u();Jm();var YU=["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"],Px=class extends G{static properties={group:{attribute:!1},inGroup:{type:Boolean,attribute:"in-group",reflect:!0},context:{type:String,reflect:!0},lazy:{type:Boolean}};static styles=[A(Ai),A(lg),A(iI),A(cg),A(ag),A(Fi),A(Pl)];_near=!1;_watched=null;constructor(){super(),this.group=null,this.inGroup=!1,this.context=null,this.lazy=!1}render(){if(!this.group)return d``;if(this.dataset.gid=de(this.group),this.lazy&&!this._near)return this.classList.add("finding"),d`<div class="card card-pending" aria-busy="true"></div>`;let t=new Set(k3(this.group));for(let r of YU)this.classList.toggle(r,t.has(r));return d`<div class="card">${x3(this.group,{context:this.context})}</div>`}updated(){this.classList.toggle("content-ready",!!this.group&&(!this.lazy||this._near));for(let t of this.renderRoot.querySelectorAll(".code-preview")){let r=t.dataset.revealedTo;if(r!==void 0&&Math.round(t.scrollTop)!==Number(r))continue;let n=t.querySelectorAll(".code-preview-lineno.cited");n.length!==0&&(fl(t,n),t.dataset.revealedTo=String(Math.round(t.scrollTop)))}}connectedCallback(){if(super.connectedCallback(),Dt(this.renderRoot),this.lazy){this._watched=this.closest(".flat-group")??this,Il(this._watched,t=>this._onNear(t));return}this.hasUpdated&&this.requestUpdate()}disconnectedCallback(){this._watched&&(So(this._watched),this._watched=null),super.disconnectedCallback()}_onNear(t){t?(this._watched&&(So(this._watched),this._watched=null),this._near=!0,this.requestUpdate()):this._near&&(this._near=!1,this.requestUpdate())}ensureRendered({sync:t=!1}={}){return this.lazy&&!this._near&&this._onNear(!0),t&&this.isConnected&&this.isUpdatePending&&this.performUpdate(),this.updateComplete}};customElements.define("finding-card",Px);T();var sI=`: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:not(:disabled):hover{opacity:1;transform:scale(1.12)}button:disabled{opacity:.25}button.active{background:currentcolor;opacity:1;box-shadow:0 0 0 2px var(--surface),0 0 0 3px currentcolor}.color-red{color:var(--marker-red)}.color-blue{color:var(--marker-blue)}.color-green{color:var(--marker-green)}.color-gray{color:var(--marker-gray)}
200
+ `;lo();var JU=["red","blue","green","gray"],Nx=class extends X{static properties={selected:{type:String},disabled:{type:Boolean}};static styles=A(sI);constructor(){super(),this.selected=null,this.disabled=!1}connectedCallback(){super.connectedCallback(),Dt(this.renderRoot)}render(){return d`${JU.map(t=>d`<button type="button" class="${`color-${t}${this.selected===t?" active":""}`}" data-color="${t}" aria-label="${`mark ${t}`}" data-tooltip="${`mark ${t}`}" ?disabled="${this.disabled}" @click="${this._onClick}"></button>`)}`}_onClick=t=>{if(this.disabled)return;let r=t.currentTarget.dataset.color;this.dispatchEvent(new CustomEvent("mark-color",{detail:{color:r},bubbles:!0,composed:!0}))}};customElements.define("color-marker",Nx);Zw();T();Ne();Ce();D();var Dx=class extends G{static properties={rangeDisabled:{type:Boolean,attribute:"range-disabled"},revalidateOptions:{attribute:!1},hasPartial:{type:Boolean,attribute:"has-partial"}};createRenderRoot(){return this}constructor(){super(),this.rangeDisabled=!1,this.revalidateOptions=[],this.hasPartial=!1}render(){let t=l.filterConfMin,r=l.filterConfMax,n=this.revalidateOptions??[],o=this.rangeDisabled,i=n.length>0&&!!l.filterRevalidate,s=o?"No confidence range: some findings on screen carry no confidence score":m;return d`<span class="${N({"conf-range-label":!0,replaced:i,disabled:o})}">Confidence</span> <span class="${N({"conf-range":!0,replaced:i,disabled:o})}" title="${s}" ?inert="${o||i}"><range-slider id="conf-range" min="0" max="10" step="1" low="${t}" high="${r}" aria-label="Confidence range"></range-slider><conf-range-mirror id="conf-range-vals" class="conf-vals" for="conf-range" .low="${t}" .high="${r}"></conf-range-mirror></span>${n.length>0?d`<revalidate-filter class="${N({replaces:i})}" .options="${n}" ?has-partial="${this.hasPartial}"></revalidate-filter>`:m}`}};customElements.define("conf-filter",Dx);T();Ne();wr();Ce();D();var aI={files:"Filter files\u2026",code:"Search code\u2026",issues:"Search issues\u2026"},lI={files:"Filter files",code:"Search code",issues:"Search issues"},ZU=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>`,QU={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>`},zx=class extends G{static properties={modes:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.modes=[]}render(){let t=l.bundleCodeSearchQuery,r=l.bundleCodeSearchMode,n=this.modes.includes(r)?r:"files",o=aI[n]??aI.files;return d`${ZU} <input type="text" class="bundle-code-search-input" placeholder="${o}" aria-label="${o}" .value="${$e(t)}" @input="${this._onInput}"> ${t?d`<button type="button" class="bundle-code-search-clear" aria-label="Clear search" @click="${this._onClear}">×</button>`:m} ${this.modes.length>0?d`<span class="bundle-code-search-modes" role="tablist">${this.modes.map(i=>d`<button type="button" class="${N({"bundle-code-search-mode":!0,active:n===i})}" role="tab" aria-selected="${String(n===i)}" data-tooltip="${lI[i]??i}" aria-label="${lI[i]??i}" @click="${()=>this._selectMode(i)}">${QU[i]??m}</button>`)}</span>`:m}`}_onInput=t=>{this._dispatchInput(t.target.value)};_onClear=()=>{this._dispatchInput("")};_dispatchInput(t){this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:"bundle-code",value:t},bubbles:!0,composed:!0}))}_selectMode(t){this.dispatchEvent(new CustomEvent("bundle-search-mode-change",{detail:{mode:t},bubbles:!0,composed:!0}))}};customElements.define("bundle-code-search",zx);T();Ne();wr();Ce();D();var eH=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>`,Ux=class extends G{createRenderRoot(){return this}render(){let t=l.bundleSearchQuery,r=l.bundleSearchRegex,n=l.bundleSearchCase,o=r?"Search by regular expression\u2026":"Search all source\u2026";return d`${eH} <input type="text" class="bundle-search-input" placeholder="${o}" aria-label="${o}" spellcheck="false" autocapitalize="off" autocomplete="off" .value="${$e(t)}" @input="${this._onInput}"> ${t?d`<button type="button" class="bundle-search-clear" aria-label="Clear search" @click="${this._onClear}">×</button>`:m} <span class="bundle-search-mods"><button type="button" class="${N({"bundle-search-mod":!0,active:n})}" data-tooltip="${n?"Case-sensitive on \u2014 click to ignore case":"Match case"}" aria-label="Match case" aria-pressed="${String(n)}" @click="${this._onToggleCase}">Aa</button> <button type="button" class="${N({"bundle-search-mod":!0,active:r})}" data-tooltip="${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",Ux);T();wr();Ce();D();function Vn(e,t,r){let n=t[r];return n||console.warn(`<${e}>: unknown kind ${JSON.stringify(r)}; expected one of ${Object.keys(t).map(o=>JSON.stringify(o)).join(", ")}.`),n}var tH={packages:{stateKey:"packagesSearchQuery",label:"Filter packages"},repositories:{stateKey:"repositoriesSearchQuery",label:"Filter repositories"}},Hx=class extends G{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let t=Vn("entity-search",tH,this.kind);return t?d`<input type="search" class="packages-search" placeholder="${`${t.label}\u2026`}" aria-label="${t.label}" .value="${$e(l[t.stateKey])}" @input="${this._onInput}">`:m}_onInput=t=>{this.dispatchEvent(new CustomEvent("search-input",{detail:{kind:this.kind,value:t.target.value},bubbles:!0,composed:!0}))}};customElements.define("entity-search",Hx);T();wr();Ce();D();var rH=[["findings-desc","Findings \u2193"],["files-desc","Files \u2193"],["reports-desc","Reports \u2193"],["name-asc","Name A\u2192Z"]],nH={packages:{stateKey:"packagesSortBy",aria:"Sort packages"},repositories:{stateKey:"repositoriesSortBy",aria:"Sort repositories"}},jx=class extends G{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let t=Vn("entity-sort",nH,this.kind);return t?d`<select class="packages-sort" aria-label="${t.aria}" .value="${$e(l[t.stateKey])}" @change="${this._onChange}">${rH.map(([r,n])=>d`<option value="${r}" ?selected="${l[t.stateKey]===r}">${n}</option>`)}</select>`:m}_onChange=t=>{this.dispatchEvent(new CustomEvent("sort-change",{detail:{kind:this.kind,value:t.target.value},bubbles:!0,composed:!0}))}};customElements.define("entity-sort",jx);T();wr();Ce();D();var Vx=class extends G{static properties={showFile:{type:Boolean,attribute:"show-file"},showConfidence:{type:Boolean,attribute:"show-confidence"},showPriority:{type:Boolean,attribute:"show-priority"}};createRenderRoot(){return this}constructor(){super(),this.showFile=!1,this.showConfidence=!1,this.showPriority=!1}render(){let t=(r,n)=>d`<option value="${r}" ?selected="${l.sortBy===r}">${n}</option>`;return d`<select class="sort-select" aria-label="Sort findings" .value="${$e(l.sortBy)}" @change="${this._onChange}">${t("severity","Severity \u2193")} ${this.showFile?t("file","File \u2191"):m} ${this.showConfidence?d`${t("confidence-desc","Confidence \u2193")}${t("confidence-asc","Confidence \u2191")}`:m} ${this.showPriority?d`${t("priority-desc","Priority \u2193")}${t("priority-asc","Priority \u2191")}`:m}</select>`}_onChange=t=>{this.dispatchEvent(new CustomEvent("sort-change",{detail:{kind:"findings",value:t.target.value},bubbles:!0,composed:!0}))}};customElements.define("findings-sort",Vx);T();var cI=`: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)}
201
+ `;var Wx=class extends X{static properties={min:{type:Number},max:{type:Number},step:{type:Number},low:{type:Number},high:{type:Number}};static styles=A(cI);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(s=>Number(s.value)),n=r[0]>r[1],o=n?1:0,i=n?0:1;this.low!==r[o]&&(this._inputs[o].value=this.low),this.high!==r[i]&&(this._inputs[i].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",Wx);T();var Kx=class extends X{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",Kx);Ad();T();D();or();zt();ue();var dI=`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)}}
202
+ `;var Gx=class extends F{static styles=[...F.styles,A(dI)];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 vv();qn(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 wv(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 kv(this.parsed,this.mode);S(),this.status=t.repoUrlError?{kind:"err",text:`Applied ${t.triageEntries} triage entries (${this.mode}), but saving repo URLs failed: ${t.repoUrlError.message}`}:{kind:"ok",text:`Applied ${t.triageEntries} triage entries and ${t.repoUrls} repo URLs (${this.mode}).`},this.parsed=null;let r=this.renderRoot.querySelector('input[type="file"]');r&&(r.value="")}catch(t){this.status={kind:"err",text:`Import failed: ${t.message}`}}finally{this.busy=!1}}}render(){let t=this.parsed;return d`<dialog @close="${this._onClose}"><header><h3>Triage backup</h3><p>Bundles every triage entry (markers, triage states, comments, fixes, per-report ignores) and all saved repo URLs into a single gzipped JSON file.</p></header><section class="section"><h4>Export</h4><p>Download the current triage + repo-URL set as a portable backup.</p><button type="button" class="primary" @click="${this._onDownload}" ?disabled="${this.busy}">${this.busy?"Working\u2026":"Download backup"}</button></section><hr><section class="section"><h4>Import</h4><p>Pick a previously-exported backup. Nothing is applied until you click Apply.</p><input type="file" accept=".gz,application/gzip" @change="${this._onFile}" ?disabled="${this.busy}"> ${this.parseError?d`<div class="error">Failed to parse: ${this.parseError}</div>`:m} ${t?d`<div class="summary">Found <strong>${Object.keys(t.triage).length}</strong> triage entries and <strong>${Object.keys(t.repoUrls).length}</strong> repo URLs. ${t.exportedAt?d`<span class="meta">Exported ${t.exportedAt}.</span>`:m}</div><fieldset class="mode"><legend>Merge mode</legend><label><input type="radio" name="te-mode" value="prefer-current" .checked="${this.mode==="prefer-current"}" @change="${this._onMode}"> <span>Merge — keep current on conflict <em>(safest, only fills gaps)</em></span></label> <label><input type="radio" name="te-mode" value="prefer-imported" .checked="${this.mode==="prefer-imported"}" @change="${this._onMode}"> <span>Merge — prefer imported on conflict <em>(overwrites where both have a value)</em></span></label> <label><input type="radio" name="te-mode" value="replace" .checked="${this.mode==="replace"}" @change="${this._onMode}"> <span>Replace all <em>(drops every current persisted entry first — destructive)</em></span></label></fieldset><button type="button" class="primary" @click="${this._onApply}" ?disabled="${this.busy}">${this.busy?"Applying\u2026":"Apply import"}</button>`:m}</section>${this.status?d`<div class="${`status status-${this.status.kind}`}">${this.status.text}</div>`:m}<footer class="actions"><button type="button" @click="${this._onClose}">Close</button></footer></dialog>`}};customElements.define("triage-export-dialog",Gx);function uI(){return le("triage-export-dialog")}T();wr();var pI=`: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)}@media(display-mode:window-controls-overlay){.edit-btn,.url-input,input{-webkit-app-region:no-drag;app-region:no-drag}}.chip[inert]{visibility:hidden;min-width:19rem}input{position:absolute;inset:0;box-sizing:border-box;padding:0 .55rem;background:var(--surface);border:1px solid var(--accent);border-radius: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}}
203
+ `;pe();var qx=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>`,fI=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>`,Yx=class extends X{static properties={url:{type:String},editable:{type:Boolean,reflect:!0},editing:{type:Boolean,reflect:!0},_copied:{state:!0}};static styles=A(pI);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?tt(this.url):"Set repo";return d`<span class="${t?"chip":"chip empty"}" aria-hidden="true" inert>${qx} <span class="label">${r}</span> <button type="button" class="edit-btn">${fI}</button> </span><input type="text" .value="${$e(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?tt(this.url):"Set repo",n=t?this._copied?"chip copied":"chip":"chip empty";return d`<span class="${n}" @click="${t?null:this._onEdit}">${qx} ${t?this._slugLabel(r):d`<span class="label">${r}</span>`} <button type="button" class="edit-btn" aria-label="Edit repo URL" @click="${this._onEdit}">${fI}</button></span>`}if(this.url){let t=this._copied?"chip readonly copied":"chip readonly";return d`<span class="${t}">${qx} ${this._slugLabel(tt(this.url))}</span>`}return m}_slugLabel(t){return d`<span class="label" title="Copy repo name" @click="${this._onCopyLabel}">${t}</span>`}updated(t){if(t.has("editing")&&this.editing){let r=this.renderRoot.querySelector("input");r&&(r.focus(),r.select())}}_onEdit=t=>{t&&t.stopPropagation(),this._emit("repo-edit-start")};_onCopyLabel=t=>{t&&t.stopPropagation();let r=tt(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",Yx);T();Ne();qe();Ce();D();ft();var aH=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>`,lH=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>`,cH=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>`,dH=V(Qa.replace('width="14" height="14"','width="12" height="12"')),uH=d`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-width="1.15" stroke-linecap="round" stroke-linejoin="round"><path d="M5 1.2 1.3 3.1v5.7L5 10.7l3.7-1.9V3.1Z M1.3 3.1 5 5l3.7-1.9 M5 5v5.7"/><path d="M11 5.2 7.3 7.1v5.7l3.7 1.9 3.7-1.9V7.1Z M7.3 7.1 11 9l3.7-1.9 M11 9v5.7"/></g></svg>`,pH=d`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"><rect x="3.4" y="1.5" width="10" height="3.6" rx=".8"/><rect x="2.2" y="5.3" width="10" height="3.6" rx=".8"/><rect x="1" y="9.1" width="10" height="3.6" rx=".8"/></g></svg>`,fH=d`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path d="M8 1.5 13 3.5v4c0 3-2.1 5.5-5 7-2.9-1.5-5-4-5-7v-4Z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>`,hH=[{key:"comment",glyph:aH,label:"commented",stateKey:"filterComment",hasKey:"hasComment"},{key:"fix",glyph:lH,label:"fixed",stateKey:"filterFix",hasKey:"hasFix"},{key:"flag",glyph:cH,label:"flagged",stateKey:"filterFlagged",hasKey:"hasFlagged"},{key:"duplicates",glyph:dH,label:"rows with duplicates in other reports",stateKey:"filterDuplicates",hasKey:"hasDuplicates"},{key:"cross-context",glyph:uH,label:"rows across multiple repos or packages",stateKey:"filterCrossContext",hasKey:"hasCrossContext"},{key:"app-stacked",glyph:pH,label:"stacked App rows",stateKey:"filterAppStacked",hasKey:"hasAppStacked"},{key:"security",glyph:fH,label:"security-related rows",stateKey:"filterSecurity",hasKey:"hasSecurityContrast"}],hI=new Set(["duplicates","cross-context","app-stacked","security"]),Xx=class extends G{static properties={group:{type:String},hasComment:{attribute:!1},hasFix:{attribute:!1},hasFlagged:{attribute:!1},hasDuplicates:{attribute:!1},hasCrossContext:{attribute:!1},hasAppStacked:{attribute:!1},hasSecurityContrast:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.group="marks",this.hasComment=!1,this.hasFix=!1,this.hasFlagged=!1,this.hasDuplicates=!1,this.hasCrossContext=!1,this.hasAppStacked=!1,this.hasSecurityContrast=!1}connectedCallback(){super.connectedCallback(),nt(this,{role:"group","aria-label":this.group==="context"?"Finding row filters":"Annotation filter"})}render(){let t=hH.filter(n=>this.group==="context"===hI.has(n.key)).filter(n=>n.key==="security"?this.hasSecurityContrast:n.key==="duplicates"?!l.currentWorkspace&&(this.hasDuplicates||l[n.stateKey]):this[n.hasKey]||l[n.stateKey]);if(t.length===0)return m;let r=n=>{let o=l[n.stateKey],i=hI.has(n.key)?n.label:`${n.label} findings`,s=o==="with"?`Showing only ${i} \u2014 click to exclude them`:o==="without"?`Excluding ${i} \u2014 click to clear`:`Show only ${i}`;return d`<button type="button" class="${N({"annotation-chip":!0,"sel-with":o==="with","sel-without":o==="without"})}" aria-label="${s}" aria-pressed="${String(o!=="")}" @click="${()=>this._toggle(n.key)}">${n.glyph}</button>`};return d`${t.map(r)}`}_toggle(t){this.dispatchEvent(new CustomEvent("annotation-filter-toggle",{detail:{key:t},bubbles:!0,composed:!0}))}};customElements.define("annotation-filter",Xx);T();Ne();Ce();D();var mH=[["critical","Critical"],["high","High"],["medium","Medium"],["low","Low"],["high_bug","High bug"],["bug","Bug"],["informational","Info"]],Jx=class extends G{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(),nt(this,{role:"group","aria-label":"Filter by severity"})}render(){let t=this.kind==="graph"?new Set(this.selected):l.filterSeverities,r=mH.filter(([n])=>(this.counts[n]??0)||t.has(n));return r.length===0?m:d`${r.map(([n,o])=>{let i=this.counts[n]??0,s=t.has(n);return d`<button type="button" class="${N({"sev-chip":!0,[n]:!0,active:s})}" aria-pressed="${String(s)}" @click="${()=>this._toggle(n)}"><span class="sd"></span><span class="name">${o}</span><span class="n">${i}</span></button>`})}`}_toggle(t){this.dispatchEvent(new CustomEvent("severity-toggle",{detail:{severity:t,kind:this.kind},bubbles:!0,composed:!0}))}};customElements.define("severity-chips",Jx);T();Ne();Ce();D();var gH=[["corrected","Corrected","Show corrected severities (application-specific re-ratings)"],["original","Original",m]],Zx=class extends G{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),nt(this,{role:"group","aria-label":"Severity display mode"})}render(){let t=l.severityMode;return d`<span class="severity-mode-label">Severity</span><span class="severity-mode-chips">${gH.map(([r,n,o])=>{let i=t===r;return d`<button type="button" class="${N({"severity-mode-chip":!0,active:i})}" aria-pressed="${String(i)}" data-tooltip="${o}" @click="${()=>this._select(r)}">${n}</button>`})}</span>`}_select(t){t!==l.severityMode&&this.dispatchEvent(new CustomEvent("severity-mode-change",{detail:{mode:t},bubbles:!0,composed:!0}))}};customElements.define("severity-mode-switch",Zx);T();Ne();Ce();D();var bH=d`<svg viewBox="0 0 16 16" width="13" height="13" aria-hidden="true"><path d="M8 1.8 14.4 5 8 8.2 1.6 5z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/><path d="M2.6 8 8 10.7 13.4 8" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/><path d="M2.6 11 8 13.7 13.4 11" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/></svg>`,mI="Show underlying code findings",yH=d`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 5.5v2h10v-2M8 7.5v3"/><rect x="1" y="1.5" width="4" height="4" rx=".6"/><rect x="11" y="1.5" width="4" height="4" rx=".6"/><rect x="6" y="10.5" width="4" height="4" rx=".6"/></svg>`,gI="Show only upstream dependency findings",Qx=class extends G{static properties={canDrop:{type:Boolean,attribute:"can-drop"},canDetail:{type:Boolean,attribute:"can-detail"},canUpstream:{type:Boolean,attribute:"can-upstream"},upstreamDisabled:{type:Boolean,attribute:"upstream-disabled"}};createRenderRoot(){return this}constructor(){super(),this.canDrop=!1,this.canDetail=!1,this.canUpstream=!1,this.upstreamDisabled=!1}connectedCallback(){super.connectedCallback(),nt(this,{role:"group","aria-label":"Revalidation layer"})}render(){let t=l.revalidateConflicts.size,r=t>0?d`<button type="button" class="revalidation-toggle revalidation-conflicts" aria-haspopup="dialog" aria-label="${`View ${t} revalidation conflict${t===1?"":"s"}`}" @click="${this._openConflicts}">${t} ${t===1?"conflict":"conflicts"}</button>`:m,n=l.showRevalidation!==!1,o=n&&l.revalidationDetailed===!0,i=l.upstreamOnly===!0,s=i&&!this.upstreamDisabled;return d`${r}${t===0&&this.canDrop?d`<mode-switch class="revalidation-toggle" label="App" borderless .checked="${n}" accessible-label="App view — hide the issues the revalidation pass ruled out" .disabled="${i}" @click="${this._toggle}"></mode-switch>`:m}${t===0&&this.canDrop&&this.canDetail?d`<button type="button" class="${N({"revalidation-detail":!0,on:o})}" aria-pressed="${String(o)}" aria-label="${mI}" data-tooltip="${mI}" ?disabled="${!n||i}" @click="${this._toggleDetail}">${bH}</button>`:m}${this.canUpstream?d`<button type="button" class="${N({"revalidation-upstream":!0,on:s})}" aria-pressed="${String(s)}" aria-label="${gI}" data-tooltip="${gI}" ?disabled="${this.upstreamDisabled}" @click="${this._toggleUpstream}">${yH}</button>`:m}`}_toggle=()=>{this.dispatchEvent(new CustomEvent("revalidation-change",{detail:{on:l.showRevalidation===!1},bubbles:!0,composed:!0}))};_openConflicts=()=>{this.dispatchEvent(new CustomEvent("revalidation-conflicts-open",{bubbles:!0,composed:!0}))};_toggleDetail=()=>{this.dispatchEvent(new CustomEvent("revalidation-detail-change",{detail:{on:l.revalidationDetailed!==!0},bubbles:!0,composed:!0}))};_toggleUpstream=()=>{this.upstreamDisabled||this.dispatchEvent(new CustomEvent("upstream-only-change",{detail:{on:l.upstreamOnly!==!0},bubbles:!0,composed:!0}))}};customElements.define("revalidation-switch",Qx);hw();var bI=`:host{display:inline-flex;flex-shrink:0;vertical-align:middle;--switch-track-width: 26px;--switch-track-height: 14px}button{display:inline-flex;align-items:center;gap:8px;box-sizing:border-box;height:30px;margin:0;padding:0 .6rem;border:1px solid var(--border);border-radius:4px;background:transparent;color:var(--muted);font:inherit;font-size:.78rem;font-weight:500;line-height:1;white-space:nowrap;cursor:default;&:hover:not(:disabled){color:var(--text);background:rgb(from var(--text) r g b / .04)}&[aria-pressed=true]{color:var(--text)}&:disabled{opacity:.4}&:focus-visible{outline:1px solid var(--accent);outline-offset:-2px}}.track{position:relative;flex-shrink:0;width:var(--switch-track-width);height:var(--switch-track-height);background:var(--border);border-radius:8px;transition:background .15s;&:after{content:"";position:absolute;top:2px;left:2px;width:calc(var(--switch-track-height) - 4px);height:calc(var(--switch-track-height) - 4px);border-radius:50%;background:var(--muted);transition:transform .15s,background .15s}}button[aria-pressed=true] .track{background:color-mix(in oklch,var(--accent) 22%,transparent);&:after{transform:translate(calc(var(--switch-track-width) - var(--switch-track-height)));background:var(--accent)}}:host([borderless]) button{height:100%;border:0;border-radius:0}:host([compact]){--switch-track-width: 22px;--switch-track-height: 12px}:host([compact]) button{height:auto;gap:7px;padding:2px 8px;border-radius:6px;font-size:.68rem;line-height:1.2}
204
+ `;var e$=class extends tE{static properties={checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},label:{type:String},accessibleLabel:{type:String,attribute:"accessible-label"}};static styles=nE(bI);constructor(){super(),this.checked=!1,this.disabled=!1,this.label="",this.accessibleLabel=""}render(){return $d`<button type="button" part="button" aria-pressed="${String(this.checked)}" aria-label="${this.accessibleLabel||this.label}" ?disabled="${this.disabled}"><span>${this.label}</span><span class="track" part="track" aria-hidden="true"></span></button>`}};customElements.get("mode-switch")||customElements.define("mode-switch",e$);Ce();D();var wH=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>`,t$=class extends G{createRenderRoot(){return this}render(){let t=l.currentView==="bundles"&&l.selectedBundle,r=!l.currentFile&&!t;return d`<button type="button" class="danger" ?disabled="${r}">${wH}<span>Delete current</span></button>`}};customElements.define("sidebar-delete-current",t$);T();Ne();Ce();D();var kH=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>`,xH=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>`,$H={packages:{title:"Show packages",icon:kH,view:"packages"},repositories:{title:"Show repositories",icon:xH,view:"repositories"}},r$=class extends G{static properties={kind:{type:String},count:{type:Number}};createRenderRoot(){return this}constructor(){super(),this.kind="",this.count=0}render(){if(this.count===0)return m;let t=Vn("sidebar-view-button",$H,this.kind);if(!t)return m;let r=l.currentView===t.view;return d`<button type="button" class="${N({"sidebar-view-btn":!0,active:r})}" data-tooltip="${t.title}" aria-label="${t.title}">${t.icon}<span class="view-btn-count">${this.count}</span></button>`}};customElements.define("sidebar-view-button",r$);T();Ne();Ce();D();var _H=["invalid","deleted"],SH={package:{stateKey:"packageSlideTriage"},repository:{stateKey:"repositorySlideTriage"}},n$=class extends G{static properties={counts:{attribute:!1},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.counts={},this.kind=""}connectedCallback(){super.connectedCallback(),nt(this,{role:"group","aria-label":"Triage view"})}render(){let t=Vn("slide-triage-tabs",SH,this.kind);if(!t)return m;let r=l[t.stateKey],n=_H.filter(o=>(this.counts[o]??0)>0||r===o);return n.length===0?m:d`${n.map(o=>{let i=r===o,s=this.counts[o]??0;return d`<button type="button" class="${N({"triage-state-btn":!0,[`triage-state-${o}`]:!0,active:i})}" aria-pressed="${String(i)}" @click="${()=>this._toggle(o)}">${o.charAt(0).toUpperCase()+o.slice(1)} (${s})</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",n$);Ne();Ce();D();var CH=[["own","Sources"],["modules","Deps"]],o$=class extends G{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),nt(this,{role:"group","aria-label":"Source filter"})}render(){return d`${CH.map(([t,r])=>{let n=l.filterSources.has(t);return d`<button type="button" class="${N({"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",o$);T();Ne();wr();Ce();D();var EH=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>`,RH=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>`,MH={findings:{stateKey:"filterInclude",placeholder:"Search findings\u2026"},files:{stateKey:"filesSearch",placeholder:"Search files\u2026"}},i$=class extends G{static properties={kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.kind=""}render(){let t=Vn("toolbar-search",MH,this.kind);if(!t)return m;let r=l[t.stateKey];return d`${EH} <input type="text" aria-label="${t.placeholder}" placeholder="${t.placeholder}" .value="${$e(r)}" @input="${this._onInput}"> ${this.kind==="findings"&&r?this._negateToggle():m}`}_negateToggle(){let t=l.filterIncludeNegate;return d`<button type="button" class="${N({"search-negate-btn":!0,active:t})}" data-tooltip="${t?"Negation on \u2014 click to undo":"Negate: show non-matching findings"}" aria-label="Negate search" aria-pressed="${String(t)}" @click="${this._onToggleNegate}">${RH}</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",i$);Ce();D();tn();pe();pm();var s$=class extends G{static properties={options:{attribute:!1}};createRenderRoot(){return this}constructor(){super(),this.options=[]}render(){let t=[{value:"",label:"All repositories",special:!0,reset:!0},...this.options.map(r=>({value:r??Ls,label:r==null?"(no repo)":tt(r),special:r==null}))];return d`<repository-selector variant="filter" label="Filter by repository" .options="${t}" .value="${l.filterRepo}" @repository-change="${r=>this.dispatchEvent(new CustomEvent("repo-change",{detail:{value:r.detail.value},bubbles:!0,composed:!0}))}"></repository-selector>`}};customElements.define("repo-filter",s$);T();wr();Ne();Ce();pe();D();var yI={"":{cls:"included",label:"+ Partial",title:"Confirmed, partial and revalidation rows \u2014 click for full confirmations only"},exclude:{cls:"excluded",label:"\u2212 Partial",title:"Full confirmations only \u2014 click to show the partial ones only"},only:{cls:"only",label:"only Partial",title:"Partial confirmations only \u2014 click to show all of them again"}},a$=class extends G{static properties={options:{attribute:!1},hasPartial:{type:Boolean,attribute:"has-partial"}};createRenderRoot(){return this}constructor(){super(),this.options=[],this.hasPartial=!1}render(){return d`<select class="sort-select" aria-label="Filter by revalidation outcome" .value="${$e(l.filterRevalidate)}" @change="${this._onChange}"><option value="" hidden ?selected="${l.filterRevalidate===""}"></option><option value="">Confidence</option>${this.options.map(t=>d`<option value="${t.value}" ?selected="${l.filterRevalidate===t.value}">${t.label}</option>`)}</select> ${this.hasPartial&&l.filterRevalidate==="confirmed"?this._partialChip():m}`}_partialChip(){let t=yI[l.filterPartial]??yI[""];return d`<button type="button" class="${N({"partial-cycle":!0,[t.cls]:!0})}" data-tooltip="${t.title}" @click="${this._onPartial}">${t.label}</button>`}_onPartial=()=>{let t=ch.indexOf(l.filterPartial),r=ch[(t+1)%ch.length];this.dispatchEvent(new CustomEvent("partial-change",{detail:{value:r},bubbles:!0,composed:!0}))};_onChange=t=>{let{value:r}=t.target;r||(t.target.selectedIndex=0),this.dispatchEvent(new CustomEvent("revalidate-change",{detail:{value:r},bubbles:!0,composed:!0}))}};customElements.define("revalidate-filter",a$);T();Ce();D();var vI=[["none","none","unmarked"],["red","r","red"],["blue","b","blue"],["green","g","green"],["gray","x","gray"]],l$=class extends G{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(),nt(this,{role:"group","aria-label":"Filter by mark color"})}render(){let t=this.kind==="graph"?new Set(this.selected):l.filterColors;return vI.some(([n])=>(this.counts[n]??0)||t.has(n))?d`${vI.map(([n,o,i])=>{let s=this.counts[n]??0,a=t.has(n);return d`<button type="button" class="${a?"active":""}" aria-label="${`${i} (${s})`}" data-tooltip="${`${i} (${s})`}" aria-pressed="${String(a)}" @click="${()=>this._toggle(n)}"><span class="${`td ${o}`}"></span><span class="count">${s}</span></button>`})}`:m}_toggle(t){this.dispatchEvent(new CustomEvent("color-toggle",{detail:{color:t,kind:this.kind},bubbles:!0,composed:!0}))}};customElements.define("triage-filter",l$);T();Ne();Ce();D();var AH=["inprogress","fixed","invalid","deleted","ignored"],c$={graph:"graph2-triage-selector",packages:"packages-triage-selector"},TH={inprogress:"In progress"},IH=e=>TH[e]??e.charAt(0).toUpperCase()+e.slice(1),d$=class extends G{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(),nt(this,{role:"group","aria-label":"Triage view"})}render(){let t=this.states??AH,r=t.reduce((i,s)=>i+(this.counts[s]??0),0),n=this.variant?c$[this.variant]:null;this.variant&&n===void 0&&console.warn(`<triage-selector>: unknown variant ${JSON.stringify(this.variant)}; expected one of ${Object.keys(c$).map(i=>JSON.stringify(i)).join(", ")} or "".`);for(let i of Object.values(c$))this.classList.toggle(i,i===n);let o=r===0&&!l.shownTriage;return this.classList.toggle("is-empty",o),o?m:d`${t.map(i=>{let s=this.counts[i]??0,a=l.shownTriage===i;if(s===0&&!a)return m;let c=IH(i);return d`<button type="button" class="${N({"triage-state-btn":!0,[`triage-state-${i}`]:!0,active:a})}" data-triage-show="${i}" aria-pressed="${String(a)}"><span>${c}</span><span class="n">${s}</span></button>`})}`}};customElements.define("triage-selector",d$);Ne();Ce();D();qe();ft();var LH={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`${V(L5)}`},FH={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)"},u$=["kanban","focus","table","list","grouped","graph"],p$=class extends G{static properties={modes:{type:String},kind:{type:String}};createRenderRoot(){return this}constructor(){super(),this.modes=u$.join(","),this.kind="findings"}connectedCallback(){super.connectedCallback(),nt(this,{role:"group","aria-label":"View mode"})}render(){let t=this.kind==="files"?l.filesViewMode:l.viewMode,r=this.modes.split(",").map(o=>o.trim()).filter(o=>u$.includes(o)),n=r.length>0?r:u$;return d`${n.map(o=>d`<button type="button" class="${N({"view-mode-btn":!0,active:t===o})}" aria-label="${FH[o]}" aria-pressed="${String(t===o)}" @click="${()=>this._select(o,t)}">${LH[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",p$);T();Gn();Ne();on();mm();pe();Ns();$l();var $I=6,wI=14,dg=2,kI=24,Lu=4,BH=1.5,ug=new Map,pg=new Map,xI="treemap";function OH(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,i=r&255;return(.2126*n+.7152*o+.0722*i)/255>.6?"#1a1a1a":"#fff"}function PH(e,t,r,n){let o=r*r,i=n*n;return Math.max(i*e/o,o/(i*t))}function _I(e,t){let r=[],n=e.filter(f=>f.value>0),{x:o,y:i,w:s,h:a}=t;if(n.length===0||s<=0||a<=0)return r;let c=0;for(let f of n)c+=f.value;let u=s*a/c,p=0;for(;p<n.length&&s>.5&&a>.5;){let f=Math.min(s,a),h=p,g=0,b=0,y=1/0,k=1/0;for(;h<n.length;){let x=n[h].value*u,$=x>b?x:b,C=x<y?x:y,I=PH($,C,g+x,f);if(h===p||I<=k)k=I,g+=x,b=$,y=C,h++;else break}let v=g/f;if(s>=a){let x=i;for(let $=p;$<h;$++){let C=$===h-1?i+a-x:n[$].value*u/v;r.push({node:n[$],x:o,y:x,w:v,h:C}),x+=C}o+=v,s-=v}else{let x=o;for(let $=p;$<h;$++){let C=$===h-1?o+s-x:n[$].value*u/v;r.push({node:n[$],x,y:i,w:C,h:v}),x+=C}i+=v,a-=v}p=h}return r}function SI(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())SI(t)}function CI(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,i=0,s;for(let a of e.children.values())o+=CI(a,e.path,e,n),i+=a.count,s===void 0?s=a.pkg:s!==a.pkg&&(s=null);return e.value=o,e.count=i,e.pkg=s??null,o}function EI(e,t,r,n,o,i,s){if(n<Lu||o<Lu)return;if(e.isFile){s.push({kind:"file",node:e,x:t,y:r,w:n,h:o});return}if(!(i<$I&&n>=kI&&o>=kI&&e.children.size>0)){s.push({kind:"agg",node:e,x:t,y:r,w:n,h:o});return}s.push({kind:"dir",node:e,x:t,y:r,w:n,h:o});let c=o>=wI+Lu+dg?wI:0,u=t+dg,p=r+c,f=n-dg*2,h=o-c-dg;if(f<Lu||h<Lu)return;let g=[...e.children.values()].toSorted((b,y)=>y.value-b.value);for(let b of _I(g,{x:u,y:p,w:f,h}))EI(b.node,b.x,b.y,b.w,b.h,i+1,s)}function f$(e,t){let r=e/(t||1)*100;return r>=10?r.toFixed(0):r.toFixed(r>=1?1:2)}function RI(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+RI(n,t-1);o>r&&(r=o)}return r}function NH(e,t,r,n,o,i){let s=Math.min(i-o,Math.PI*2-1e-4),a=o+s,c=s>Math.PI?1:0,u=Math.cos(o),p=Math.sin(o),f=Math.cos(a),h=Math.sin(a),g=b=>b.toFixed(2);return`M${g(e+n*u)} ${g(t+n*p)}A${g(n)} ${g(n)} 0 ${c} 1 ${g(e+n*f)} ${g(t+n*h)}L${g(e+r*f)} ${g(t+r*h)}A${g(r)} ${g(r)} 0 ${c} 0 ${g(e+r*u)} ${g(t+r*p)}Z`}function DH(e,t){let r=Math.max(4,Math.floor(t/6.4));return e.length>r?`${e.slice(0,r-1)}\u2026`:e}var h$=class extends X{static properties={details:{attribute:!1},_w:{state:!0},_h:{state:!0},_focus:{state:!0},_mode:{state:!0},_reason:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.details=null,this._w=0,this._h=0,this._root=null,this._focus=[],this._mode=xI,this._reason="",this._reasons=new Map,this._dirByPath=new Map,this._status="loading",this._meta={total:0,prefix:""},this._ro=null,this._plot=null,this._tooltip=null,this._ttCell=null}willUpdate(t){t.has("details")&&(this._reason=pg.get(this.details?.integrity)??""),(t.has("details")||t.has("_reason"))&&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;se(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(),i=t-o.left,s=r-o.top,a=12,c=i+a;c+n.offsetWidth>o.width-4&&(c=i-n.offsetWidth-a),c<4&&(c=4);let u=s+a;u+n.offsetHeight>o.height-4&&(u=s-n.offsetHeight-a),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._reasons=new Map,this._meta={total:0,prefix:""},this._hideTooltip(),!this.details){this._status="loading";return}let t=Ut(this.details),r=[...t.keys()].filter(h=>t.get(h)!==null);if(r.length===0){this._status="empty";return}this._reasons=xo(this.details,r),this._reasons.has(this._reason)||(this._reason="",pg.delete(this.details.integrity));let n=this._reasons.get(this._reason),o=nn(this.details),i=ul(this.details),{prefix:s,stripped:a}=hr(r),c={name:"",children:new Map,value:0,isFile:!1},u=0;for(let h=0;h<r.length;h++){if(n&&!n.has(r[h]))continue;let g=t.get(r[h]);if(g<=0)continue;let b=a[h].split("/"),y=c,k=!1;for(let $=0;$<b.length-1;$++){let C=y.children.get(b[$]);if(C&&C.isFile){k=!0;break}C||(C={name:b[$],children:new Map,value:0,isFile:!1},y.children.set(b[$],C)),y=C}if(k)continue;let v=b.at(-1),x=y.children.get(v);if(!(x&&!x.isFile)){if(!x){let $=mt(a[h],{packageDir:o?.get(r[h])});x={name:v,isFile:!0,value:0,origPath:r[h],pkg:$,resource:i.get(r[h])==="resource"},y.children.set(v,x)}x.value+=g,u+=g}}if(u===0){this._status="empty";return}for(let h of c.children.values())SI(h);let p=new Map;CI(c,"",null,p),this._root=c,this._dirByPath=p,this._meta={total:u,prefix:s},this._status="ok";let f=this.details?.integrity?ug.get(this.details.integrity):null;if(f){let h=p.get(f);h?this._focus=this._chainTo(h):ug.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?ug.set(t,r):ug.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",xI=this._mode,this._hideTooltip()}_changeReason(t){this._reason=t.target.value;let r=this.details?.integrity;r&&(this._reason?pg.set(r,this._reason):pg.delete(r))}_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="${N({"bundle-treemap-crumb-home":!0,"at-root":r})}" @click="${()=>this._focusTo(-1)}">Source ${this._mode==="sunburst"?"sunburst":"treemap"}</button> ${n.map((i,s)=>d`<span class="bundle-treemap-crumb-sep" aria-hidden="true">›</span><button type="button" class="bundle-treemap-crumb" @click="${()=>this._focusTo(s)}" data-tooltip="${i.path}">${i.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=f$(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="${Se(n)}" data-treemap-into="${t.node.path}" data-tt-path="${`${t.node.path}/`}" data-tt-meta="${`${ye(t.node.value)} \xB7 ${o} \xB7 ${r}%`}"><span class="bundle-treemap-dirname">${t.node.name}</span></div>`;let i=t.node.pkg??mt(t.node.path),s=er(i),a=Se({...n,background:s,color:OH(s)}),c=Ei(i);return t.kind==="agg"?d`<div class="bundle-treemap-node bundle-treemap-leaf bundle-treemap-agg" style="${a}" data-treemap-into="${t.node.path}" data-tt-path="${`${t.node.path}/`}" data-tt-pkg="${c}" data-tt-color="${s}" data-tt-meta="${`${ye(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="${a}" data-bundle-view-source="${t.node.resource?m:t.node.origPath}" data-tt-path="${t.node.path}" data-tt-pkg="${c}" data-tt-color="${s}" data-tt-meta="${`${ye(t.node.value)} \xB7 ${r}% of bundle`}"><span class="bundle-treemap-label">${t.node.name}</span></div>`}_arc(t,r,n){let o=f$(t.value,n),i=t.pkg??mt(t.path),s=er(i),a=Ei(i);if(t.isFile)return To`<path class="bundle-treemap-node bundle-treemap-arc" d="${r}" fill="${s}" data-bundle-view-source="${t.resource?m:t.origPath}" data-tt-path="${t.path}" data-tt-pkg="${a}" data-tt-color="${s}" data-tt-meta="${`${ye(t.value)} \xB7 ${o}% of bundle`}"></path>`;let c=`${t.count} ${t.count===1?"file":"files"}`;return To`<path class="bundle-treemap-node bundle-treemap-arc" d="${r}" fill="${s}" data-treemap-into="${t.path}" data-tt-path="${`${t.path}/`}" data-tt-pkg="${t.pkg?a:m}" data-tt-color="${t.pkg?s:m}" data-tt-meta="${`${ye(t.value)} \xB7 ${c} \xB7 ${o}%`}"></path>`}_renderSunburst(t){let r=this._w,n=this._h,o=r/2,i=n/2,s=Math.min(r,n)/2-6;if(s<30)return m;let a=RI(t,$I),c=Math.min(Math.max(s*.18,26),s*.45),u=(s-c)/a,p=this._meta.total||1,f=[],h=(v,x,$,C)=>{let I=[...v.children.values()].toSorted((z,U)=>U.value-z.value),E=$-x,R=x;for(let z of I){let U=E*(z.value/v.value),B=c+(C-1)*u,ne=B+u;U*ne>=BH&&(f.push(this._arc(z,NH(o,i,B,ne,R,R+U),p)),!z.isFile&&C<a&&z.children.size>0&&h(z,R,R+U,C+1)),R+=U}};h(t,-Math.PI/2,Math.PI*1.5,1);let g=this._focus.length>0,b=Math.max(c-4,10),y=g?To`<circle class="bundle-treemap-node bundle-treemap-center" cx="${o}" cy="${i}" r="${b}" data-treemap-into="${t.parent.path}" data-tt-path="${`${t.path}/`}" data-tt-meta="${`${ye(t.value)} \xB7 ${t.count} ${t.count===1?"file":"files"} \xB7 ${f$(t.value,p)}%`}"></circle>`:To`<circle class="bundle-treemap-center" cx="${o}" cy="${i}" r="${b}"></circle>`,k=To`<text class="bundle-treemap-center-label" x="${o}" y="${i}" text-anchor="middle">${g?To`<tspan x="${o}" dy="-0.3em">${DH(t.name,b*2-12)}</tspan><tspan class="bundle-treemap-center-sub" x="${o}" dy="1.5em">${ye(t.value)}</tspan>`:To`<tspan x="${o}" dy="0.35em">${ye(t.value)}</tspan>`}</text>`;return d`<svg class="bundle-treemap-sunburst" width="${r}" height="${n}" viewBox="${`0 0 ${r} ${n}`}">${f}${y}${k}</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 c=[...t.children.values()].toSorted((u,p)=>p.value-u.value);for(let u of _I(c,{x:0,y:0,w:this._w,h:this._h}))EI(u.node,u.x,u.y,u.w,u.h,1,o)}let{prefix:i}=this._meta,s=t?t.count:0,a=t?t.value:0;return d`<header class="bundle-treemap-head">${this._renderCrumbs()} <span class="bundle-treemap-head-right"><span class="bundle-treemap-sub">${s} ${s===1?"file":"files"} · ${ye(a)}${i?d`· <span class="mono">${i}</span>`:""}</span> ${this._reasons.size>0?d`<select class="bundle-treemap-reason" aria-label="Filter files" @change="${this._changeReason}"><option value="" ?selected="${!this._reason}">All</option>${[...this._reasons.keys()].map(c=>d`<option value="${c}" ?selected="${this._reason===c}">${c}</option>`)}</select>`:m}<mode-switch compact="compact" label="Sunburst" .checked="${r}" accessible-label="Toggle sunburst view" @click="${this._toggleMode}"></mode-switch></span></header><div class="bundle-treemap-plot" @click="${this._onPlotClick}" @pointermove="${this._onPointerMove}" @pointerleave="${this._onPointerLeave}">${this._status==="loading"?d`<div class="bundle-treemap-empty">Loading…</div>`:this._status==="empty"?d`<div class="bundle-treemap-empty">This bundle doesn't carry any source content.</div>`:r?n?this._renderSunburst(t):m:o.map(c=>this._cell(c))}<div class="bundle-treemap-tooltip"></div></div>`}};customElements.define("bundle-treemap",h$);T();Mt();Gn();D();pe();Ns();$l();on();go();Pk();on();function fg(e){return zd(e)??0}function zH(e,t){return e===t||e?.format==="base64"&&t?.format==="base64"&&e.data===t.data}function MI(e){return(t,r)=>Math.abs(r.delta)-Math.abs(t.delta)||t[e].localeCompare(r[e])}function hg(e){return(t,r)=>r.bytes-t.bytes||t[e].localeCompare(r[e])}function UH(){return{baseBytes:0,otherBytes:0,onlyBaseFiles:0,onlyOtherFiles:0,changedFiles:0}}function TI(e,t,r){let n=[],o=[],i=[],s=0,a=0,c=0,u=0,p=0,f=0,h=new Map,g=x=>{let $=r(x),C=h.get($);return C||(C=UH(),h.set($,C)),C},b=new Set([...e.keys(),...t.keys()]);for(let x of b){let $=e.has(x),C=t.has(x),I=g(x);if($&&C){let E=e.get(x),R=t.get(x),z=zH(E,R),U=fg(E),B=z?U:fg(R);if(s+=U,a+=B,I.baseBytes+=U,I.otherBytes+=B,z)f++;else{let ne=B-U;i.push({path:x,baseBytes:U,otherBytes:B,delta:ne}),p+=ne,I.changedFiles++}}else if($){let E=fg(e.get(x));s+=E,c+=E,I.baseBytes+=E,I.onlyBaseFiles++,n.push({path:x,bytes:E})}else{let E=fg(t.get(x));a+=E,u+=E,I.otherBytes+=E,I.onlyOtherFiles++,o.push({path:x,bytes:E})}}let y=[],k=[],v=[];for(let[x,$]of h){let C=$.baseBytes>0||$.onlyBaseFiles>0||$.changedFiles>0,I=$.otherBytes>0||$.onlyOtherFiles>0||$.changedFiles>0,E=$.onlyBaseFiles+$.onlyOtherFiles+$.changedFiles;C&&!I?y.push({pkg:x,bytes:$.baseBytes}):I&&!C?k.push({pkg:x,bytes:$.otherBytes}):(E>0||$.baseBytes!==$.otherBytes)&&v.push({pkg:x,baseBytes:$.baseBytes,otherBytes:$.otherBytes,delta:$.otherBytes-$.baseBytes})}return n.sort(hg("path")),o.sort(hg("path")),i.sort(MI("path")),y.sort(hg("pkg")),k.sort(hg("pkg")),v.sort(MI("pkg")),{totals:{baseFiles:e.size,baseBytes:s,otherFiles:t.size,otherBytes:a,onlyBaseFiles:n.length,onlyBaseBytes:c,onlyOtherFiles:o.length,onlyOtherBytes:u,changedFiles:i.length,changedDelta:p,unchangedFiles:f,fileDelta:t.size-e.size,byteDelta:a-s,identical:n.length===0&&o.length===0&&i.length===0},files:{onlyBase:n,onlyOther:o,changed:i},packages:{onlyBase:y,onlyOther:k,changed:v}}}function AI(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 Fu(e,t){if(e===t)return 0;let r=AI(e),n=AI(t),o=r.core.split("."),i=n.core.split(".");for(let c=0;c<Math.max(o.length,i.length);c++){let u=Number(o[c]??0),p=Number(i[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 s=r.pre.split("."),a=n.pre.split(".");for(let c=0;c<Math.max(s.length,a.length);c++){let u=s[c],p=a[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 HH(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 jH(e,t){let r=Fu(t.at(-1),e.at(-1));return r>0?"up":r<0?"down":"changed"}function II(e,t){let r=[],n=[],o=[],i=new Set([...e.keys(),...t.keys()]);for(let a of i){let c=e.get(a),u=t.get(a);if(c&&u){let p=[...c].toSorted(Fu),f=[...u].toSorted(Fu);if(HH(p,f))continue;r.push({pkg:a,baseVersions:p,otherVersions:f,direction:jH(p,f)})}else c?o.push({pkg:a,versions:[...c].toSorted(Fu)}):n.push({pkg:a,versions:[...u].toSorted(Fu)})}let s=(a,c)=>a.pkg.localeCompare(c.pkg);return r.sort(s),n.sort(s),o.sort(s),{updated:r,added:n,removed:o,totals:{baseDeps:e.size,otherDeps:t.size}}}on();function m$(...e){let t=new Set;for(let r of e){let n=On(r);for(let[o,i]of Object.entries(r?.bundle?.reason??{}))Array.isArray(i)&&i.some(s=>n.has(s))&&t.add(o)}return[...t].toSorted().map(r=>({id:`reason:${r}`,label:r}))}function g$(e,t=""){let r=On(e);if(!t)return r;let n=e?.bundle?.reason?.[t.replace(/^reason:/u,"")],o=new Set(Array.isArray(n)?n:[]);return new Map([...r].filter(([i])=>o.has(i)))}T();qe();ue();var VH=/[ \t\n\v\f\r]/gu,WH=/[ \t\n\v\f\r]+/gu,LI=/[ \t\n\v\f\r]+$/u,FI=e=>e.replace(/[A-Z]/gu,t=>t.toLowerCase());function mg({ignoreCase:e=!1,whitespace:t="none"}={}){let r=null;return t==="all"?r=n=>n.replace(VH,""):t==="change"?r=n=>n.replace(LI,"").replace(WH," "):t==="trailing"&&(r=n=>n.replace(LI,"")),e?r?n=>FI(r(n)):FI:r}function Bi(e){let t=[];for(let r=0;r<e.length;){let n=e.indexOf(`
205
+ `,r),o=n<0?e.length:n+1;t.push(e.slice(r,o)),r=o}return t}var Dl=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: ?(.*?))?\n?$/u,ea=/^\*{15,}(?: (.*?))?\n?$/u,gg=/^\*{3} (\d+)(?:,(\d+))? \*{4}\n?$/u,Bu=/^--- (\d+)(?:,(\d+))? ----\n?$/u,zl=/^(\d+)(?:,(\d+))?([acd])(\d+)(?:,(\d+))?[ \t]*\r?\n?$/u;var zr=class extends Error{constructor(t,r){super(r===void 0?t:`${t} at line ${r+1}`),this.name="PatchError",this.line=r}},BI=(e,t)=>t===0?Number(e):Number(e)-1,b$=e=>e!==void 0&&e.startsWith("\\"),y$=e=>e.replace(/\n$/u,"");function v$(e){let t=Bi(e),r=[],n={old:null,new:null},o=!1;for(let i=0;i<t.length;){let s=t[i],a=OI(s,o);if(o=s.startsWith("***************")?!1:s.startsWith("*** "),a){n=a.names??{...n,[a.slot]:a.name},i++;continue}let c=Dl.test(s)?"unified":ea.test(s)?"context":zl.test(s)?"normal":null;if(c===null){i++;continue}let u=[],p=JH[c];for(let f=p(t,i);f!==null&&(u.push(f.hunk),i=f.next,!(i>=t.length||OI(t[i],!1)));f=p(t,i));r.push({old:n.old,new:n.new,format:c,hunks:u,blocks:KH(u)}),n={old:null,new:null}}return r}function OI(e,t){let r=/^diff --git (\S+) (\S+)\n?$/u.exec(e);if(r)return{names:{old:r[1],new:r[2]}};if(gg.test(e)||Bu.test(e))return null;let n=/^(\*\*\* |--- |\+\+\+ )(.*?)(?:\t.*)?\n?$/u.exec(e);return n?n[1]==="--- "?{slot:t?"new":"old",name:n[2]}:{slot:n[1]==="*** "?"old":"new",name:n[2]}:null}function KH(e){let t=[];for(let r of e){let n=r.oldStart,o=r.newStart,i=null,s=()=>{i&&(t.push(i),n=i.a1,o=i.b1,i=null)};for(let{tag:a,text:c}of r.lines){if(a===" "){s(),n++,o++;continue}a==="-"&&i?.insert.length&&s(),i??={a0:n,a1:n,b0:o,b1:o,remove:[],insert:[]},a==="-"?(i.a1++,i.remove.push(c)):(i.b1++,i.insert.push(c))}s()}return t}function GH(e,t){let r=Dl.exec(e[t]??"");if(!r)return null;let n=r[2]===void 0?1:Number(r[2]),o=r[4]===void 0?1:Number(r[4]),i={oldStart:BI(r[1],n),newStart:BI(r[3],o),label:r[5]||null,lines:[]},s=0,a=t+1,c=0;for(;c<n||s<o;a++){let u=e[a];if(u===void 0)throw new zr("the patch ends inside a hunk",a);let p=u===`
206
+ `?" ":u[0];if(p!==" "&&p!=="-"&&p!=="+")throw new zr(`a hunk line begins with ${JSON.stringify(p)}`,a);let f=u===`
207
+ `?u:u.slice(1);if(b$(e[a+1])&&(f=y$(f),a++),p!=="+"&&c++,p!=="-"&&s++,c>n||s>o)throw new zr("a hunk has more lines than its header says",a);i.lines.push({tag:p,text:f})}return{hunk:i,next:a}}function qH(e,t){let r=zl.exec(e[t]??"");if(!r)return null;let[,n,o,i,s,a]=r,c=i==="a"?0:Number(o??n)-Number(n)+1,u=i==="d"?0:Number(a??s)-Number(s)+1;if(c<0||u<0)throw new zr("a change command counts backwards",t);let p={oldStart:i==="a"?Number(n):Number(n)-1,newStart:i==="d"?Number(s):Number(s)-1,label:null,lines:[]},f=t+1,h=(g,b,y)=>{for(let k=0;k<g;k++,f++){let v=e[f];if(v===void 0)throw new zr("the patch ends inside a hunk",f);if(v[0]!==b)throw new zr(`${JSON.stringify(b)} expected`,f);let x=v.slice(2);b$(e[f+1])&&(x=y$(x),f++),p.lines.push({tag:y,text:x})}};if(h(c,"<","-"),i==="c"){if(e[f]!==`---
208
+ `)throw new zr("'---' expected",f);f++}return h(u,">","+"),{hunk:p,next:f}}function YH(e,t){let r=ea.exec(e[t]??"");if(!r)return null;let n=gg.exec(e[t+1]??"");if(!n)throw new zr("'*** ' range expected",t+1);let o=t+2,i=NI(e,o,Bu,"-");o=i.next;let s=Bu.exec(e[o]??"");if(!s)throw new zr("'--- ' range expected",o);let a=NI(e,o+1,null,"+"),c=i.lines.length===0?a.lines.filter(h=>h.tag===" "):i.lines,u=a.lines.length===0?i.lines.filter(h=>h.tag===" "):a.lines,p=PI(n,c.length),f=PI(s,u.length);return{hunk:{oldStart:p,newStart:f,label:r[1]||null,lines:XH(c,u)},next:a.next}}var PI=(e,t)=>t===0?Number(e[1]):Number(e[1])-1;function NI(e,t,r,n){let o=[],i=t;for(;i<e.length;i++){let s=e[i];if(r&&r.test(s)||ea.test(s)||gg.test(s)||!r&&Bu.test(s))break;if(b$(s)){o[o.length-1].text=y$(o.at(-1).text);continue}let a=s===`
209
+ `?" ":s[0];if(a!==" "&&a!=="!"&&a!=="-"&&a!=="+")break;o.push({tag:a===" "?" ":n,text:s===`
210
+ `?s:s.slice(2)})}return{lines:o,next:i}}function XH(e,t){let r=[],n=0,o=0;for(;n<e.length||o<t.length;){if(e[n]?.tag===" "&&t[o]?.tag===" "){r.push(e[n]),n++,o++;continue}for(;n<e.length&&e[n].tag!==" ";)r.push(e[n]),n++;for(;o<t.length&&t[o].tag!==" ";)r.push(t[o]),o++;e[n]?.tag===" "&&t[o]===void 0?(r.push(e[n]),n++):t[o]?.tag===" "&&e[n]===void 0&&(r.push(t[o]),o++)}return r}var JH={unified:GH,context:YH,normal:qH};var Eo=class extends Error{constructor(t){super(`the rendered diff does not say what the change set says (${t})`),this.name="FormatError"}};function w$(e,t,r,n){if(r.length===0){if(n!=="")throw new Eo("there was nothing to print, and something was printed");return}let o;try{o=v$(n)}catch(s){throw new Eo(`it does not read back (${s.message})`)}if(o.length!==1)throw new Eo(`${o.length} files read back, not one`);let i=o[0].blocks;if(i.length!==r.length)throw new Eo(`${i.length} blocks read back, not ${r.length}`);for(let[s,a]of i.entries()){let c=r[s];if(a.a0!==c.a0||a.a1!==c.a1||a.b0!==c.b0||a.b1!==c.b1)throw new Eo(`block ${s+1} reads back somewhere else`)}for(let s of o[0].hunks){let a=s.oldStart,c=s.newStart;for(let{tag:u,text:p}of s.lines){let f=u==="+"?t[c]:e[a];if(p!==f)throw new Eo(`a ${u==="+"?"added":u==="-"?"removed":"kept"} line is not the line it stands for`);u!=="+"&&a++,u!=="-"&&c++}}}function jI(e,t,r,n){let o=[],i=0;for(;i<e.length;){let s=i;for(;s+1<e.length&&e[s+1].a0-e[s].a1<=2*t;)s++;let a=e[i],c=e[s];o.push({blocks:e.slice(i,s+1),a0:Math.max(0,a.a0-t),a1:Math.min(r,c.a1+t),b0:Math.max(0,a.b0-t),b1:Math.min(n,c.b1+t)}),i=s+1}return o}var ZH=`
211
+ \
212
+ `,Ro=(e,t)=>e+t+(t.endsWith(`
213
+ `)?"":ZH);function DI(e,t){return t>e+1?`${e+1},${t}`:`${t>e?e+1:e}`}function VI(e,t,r){let n="";for(let{a0:o,a1:i,b0:s,b1:a}of r){let c=o===i?"a":s===a?"d":"c";n+=DI(o,i)+c+DI(s,a)+`
214
+ `;for(let u=o;u<i;u++)n+=Ro("< ",e[u]);c==="c"&&(n+=`---
215
+ `);for(let u=s;u<a;u++)n+=Ro("> ",t[u])}return w$(e,t,r,n),n}function zI(e,t){return t<=e?`${e},0`:t===e+1?`${e+1}`:`${e+1},${t-e}`}function WI(e,t,r,{context:n,label:o=null}){let i="";for(let s of jI(r,n,e.length,t.length)){let a=o?o(s.a0):null;i+=`@@ -${zI(s.a0,s.a1)} +${zI(s.b0,s.b1)} @@${a===null?"":" "+a}
216
+ `;let c=s.a0,u=s.b0;for(let{a0:p,a1:f,b1:h}of s.blocks){for(;c<p;c++,u++)i+=Ro(" ",e[c]);for(;c<f;c++)i+=Ro("-",e[c]);for(;u<h;u++)i+=Ro("+",t[u])}for(;c<s.a1;c++,u++)i+=Ro(" ",e[c])}return w$(e,t,r,i),i}function UI(e,t){return t<=e?`${e}`:t===e+1?`${e+1}`:`${e+1},${t}`}function KI(e,t,r,{context:n,label:o=null}){let i="";for(let s of jI(r,n,e.length,t.length)){let a=o?o(s.a0):null;i+=`***************${a===null?"":" "+a}
217
+ `,i+=`*** ${UI(s.a0,s.a1)} ****
218
+ `,s.blocks.some(c=>c.a0<c.a1)&&(i+=HI(e,s.a0,s.a1,s.blocks,"a")),i+=`--- ${UI(s.b0,s.b1)} ----
219
+ `,s.blocks.some(c=>c.b0<c.b1)&&(i+=HI(t,s.b0,s.b1,s.blocks,"b"))}return w$(e,t,r,i),i}function HI(e,t,r,n,o){let i=o+"1",s=o+"0",a=o==="a"?"b":"a",c="",u=t;for(let p of n){for(;u<p[s];u++)c+=Ro(" ",e[u]);let f=p[a+"0"]<p[a+"1"]?"! ":o==="a"?"- ":"+ ";for(;u<p[i];u++)c+=Ro(f,e[u])}for(;u<r;u++)c+=Ro(" ",e[u]);return c}function QH(e){let t=[];for(let r=0;;){let n=r;for(;r<e.length&&e[r];)r++;if(t.push(r>n),r===e.length)return t;r++}}function k$(e,t,r){let n=t.length,o=QH(r),i=0,s=0,a=0,c=()=>{if(i===n||e[a]!==e[i])return!1;for(t[a++]=0,t[i++]=1,s++;i<n&&t[i];)i++;return!0},u=()=>{if(a===0||e[a-1]!==e[i-1])return!1;for(t[--a]=1,t[--i]=0,s--;a>0&&t[a-1];)a--;return!0};for(let p=0;p<n;p++){if(!t[p]){s++;continue}for(a=p,i=p;i<n&&t[i];i++);let f=-1;for(let h=-1;h!==i-a;){for(h=i-a;u(););for(f=o[s]?i:-1;c();)o[s]&&(f=i)}if(f!==-1)for(let h=i-f;h>0;h--)u();p=i-1}}function ej(e){let t=1;for(let r=e;r!==0;r>>=2)t<<=1;return Math.max(256,t)}function GI(e,t,{ignoreCase:r=!1,whitespace:n="none",minimal:o=!1,slide:i=!0}={}){let s=mg({ignoreCase:r,whitespace:n});if(s===null&&x$(e,t,null))return[];let{A:a,B:c}=tj(e,t,s),u=new Uint8Array(a.length),p=new Uint8Array(c.length);rj(a,c,u,p,o),i&&(k$(a,u,p),k$(c,p,u));let f=ij(u,p);return sj(e,t,f,s),f}function x$(e,t,r=null){if(e.length!==t.length)return!1;let n=r?(o,i)=>r(o)===r(i):(o,i)=>o===i;for(let o=0;o<e.length;o++)if(!n(e[o],t[o]))return!1;return!0}function tj(e,t,r){let n=new Map,o=a=>{let c=r?r(a):a,u=n.get(c);return u===void 0&&(u=n.size,n.set(c,u)),u},i=new Int32Array(e.length),s=new Int32Array(t.length);for(let a=0;a<e.length;a++)i[a]=o(e[a]);for(let a=0;a<t.length;a++)s[a]=o(t[a]);return{A:i,B:s}}function rj(e,t,r,n,o){let i=e.length+t.length+3,s={A:e,B:t,fd:new Int32Array(i),bd:new Int32Array(i),base:t.length+1,limit:ej(e.length+t.length)},a=[{xoff:0,xlim:e.length,yoff:0,ylim:t.length,minimal:o}],c={xmid:0,ymid:0,loMinimal:!1,hiMinimal:!1};for(;a.length;){let{xoff:u,xlim:p,yoff:f,ylim:h,minimal:g}=a.pop();for(;u<p&&f<h&&e[u]===t[f];)u++,f++;for(;u<p&&f<h&&e[p-1]===t[h-1];)p--,h--;if(u===p){for(;f<h;f++)n[f]=1;continue}if(f===h){for(;u<p;u++)r[u]=1;continue}nj(s,u,p,f,h,g,c),a.push({xoff:c.xmid,xlim:p,yoff:c.ymid,ylim:h,minimal:c.hiMinimal}),a.push({xoff:u,xlim:c.xmid,yoff:f,ylim:c.ymid,minimal:c.loMinimal})}}function nj(e,t,r,n,o,i,s){let{A:a,B:c,fd:u,bd:p,base:f,limit:h}=e,g=r-n,b=t-o,y=r-o,k=t-n,v=y,x=y,$=k,C=k,I=(k-y&1)!==0;u[f+k]=t,p[f+y]=r;for(let E=1;;E++){C>b?u[f+--C-1]=-1:++C,$<g?u[f+ ++$+1]=-1:--$;for(let R=$;R>=C;R-=2){let z=u[f+R+1],U=u[f+R-1],B=U<z?z:U+1,ne=B-R;for(;B<r&&ne<o&&a[B]===c[ne];)B++,ne++;if(u[f+R]=B,I&&x<=R&&R<=v&&p[f+R]<=B){s.xmid=B,s.ymid=ne,s.loMinimal=s.hiMinimal=!0;return}}x>b?p[f+--x-1]=2147483647:++x,v<g?p[f+ ++v+1]=2147483647:--v;for(let R=v;R>=x;R-=2){let z=p[f+R+1],U=p[f+R-1],B=U<z?U:z-1,ne=B-R;for(;t<B&&n<ne&&a[B-1]===c[ne-1];)B--,ne--;if(p[f+R]=B,!I&&C<=R&&R<=$&&B<=u[f+R]){s.xmid=B,s.ymid=ne,s.loMinimal=s.hiMinimal=!0;return}}if(!(i||E<h)){oj(e,{xoff:t,xlim:r,yoff:n,ylim:o,fmin:C,fmax:$,bmin:x,bmax:v},s);return}}}function oj(e,t,r){let{fd:n,bd:o,base:i}=e,{xoff:s,xlim:a,yoff:c,ylim:u,fmin:p,fmax:f,bmin:h,bmax:g}=t,b=0,y=-1;for(let x=f;x>=p;x-=2){let $=Math.min(n[i+x],a),C=$-x;u<C&&($=u+x,C=u),y<$+C&&(y=$+C,b=$)}let k=0,v=2147483647;for(let x=g;x>=h;x-=2){let $=Math.max(s,o[i+x]),C=$-x;C<c&&($=c+x,C=c),$+C<v&&(v=$+C,k=$)}a+u-v<y-(s+c)?(r.xmid=b,r.ymid=y-b,r.loMinimal=!0,r.hiMinimal=!1):(r.xmid=k,r.ymid=v-k,r.loMinimal=!1,r.hiMinimal=!0)}function ij(e,t){let r=[],n=t.length,o=e.length,i=0,s=0;for(;i<o||s<n;){if(i<o&&s<n&&!e[i]&&!t[s]){i++,s++;continue}let a=i,c=s;for(;i<o&&e[i];)i++;for(;s<n&&t[s];)s++;if(a===i&&c===s)throw new an("a kept line has no counterpart");r.push({a0:a,a1:i,b0:c,b1:s})}return r}function sj(e,t,r,n=null){let o=n?(a,c)=>n(a)===n(c):(a,c)=>a===c,i=0,s=0;for(let{a0:a,a1:c,b0:u,b1:p}of r){if(a<i||u<s||c<a||p<u||c>e.length||p>t.length)throw new an("a block is out of order or out of range");if(a===c&&u===p)throw new an("a block changes nothing");if(a-i!==u-s)throw new an("the kept lines before a block differ in count");for(;i<a;i++,s++)if(!o(e[i],t[s]))throw new an(`kept line ${i+1} does not match`);i=c,s=p}if(e.length-i!==t.length-s)throw new an("the kept lines after the last block differ in count");for(;i<e.length;i++,s++)if(!o(e[i],t[s]))throw new an(`kept line ${i+1} does not match`)}var an=class extends Error{constructor(t){super(`the computed change set does not reconstruct the second file (${t})`),this.name="DiffError"}};var aj={unified:WI,context:KI},qI=`Files differ
220
+ `;function lj(e,t,r){if(e===t)return"";let n=mg(r);return n===null?qI:x$(Bi(e),Bi(t),n)?"":qI}function $$(e,t,{format:r="unified",context:n=3,label:o=null,...i}={}){if(r==="brief")return lj(e,t,i);let s=Bi(e),a=Bi(t),{slide:c=r!=="normal"&&n>0,...u}=i,p=GI(s,a,{...u,slide:c});return p.length===0?"":r==="normal"?VI(s,a,p):aj[r](s,a,p,{context:n,label:o})}var cj={unified:[[/^--- /u,"bold"],[/^\+\+\+ /u,"bold"],[Dl,"cyan"],[/^\+/u,"green"],[/^-/u,"red"],[/^\\ /u,"gray"]],context:[[ea,"cyan"],[/^\*{3} \d/u,"cyan"],[/^--- \d/u,"cyan"],[/^\*{3} /u,"bold"],[/^--- /u,"bold"],[/^! /u,"yellow"],[/^\+ /u,"green"],[/^- /u,"red"]],normal:[[zl,"cyan"],[/^< /u,"red"],[/^> /u,"green"],[/^---$/u,"gray"]]};function dj(e){return e.some(t=>ea.test(t))?"context":e.some(t=>Dl.test(t))?"unified":e.some(t=>zl.test(t))?"normal":null}function YI(e){let t=e.split(`
221
+ `),r=cj[dj(t)];return r===void 0?null:t.map(n=>r.find(([o])=>o.test(n))?.[1]??null)}var uj={bold:"head",cyan:"hunk",green:"add",red:"del",yellow:"chg",gray:"meta"};function XI(e){let t=YI(e);return t===null?null:e.split(`
222
+ `).map((r,n)=>({text:r,kind:t[n]===null?"":uj[t[n]]??""}))}function JI(e,t){if(typeof e!="string"||typeof t!="string")return null;let r=$$(e,t,{format:"unified",context:3});return XI(r)??r.split(`
223
+ `).map(n=>({text:n,kind:""}))}on();pe();Os();var ZI=`dialog{width:min(96vw,90rem);max-width:none;max-height:90dvh;margin:auto;padding:0;overflow:hidden}dialog[open]{display:flex;flex-direction:column}header{padding:.8rem 1rem;border-bottom:1px solid var(--border);flex-shrink:0}.file-heading{display:flex;align-items:center;gap:1rem}.file-heading h3{margin:0;flex:1;min-width:0;overflow-wrap:anywhere;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.85rem}.file-heading button{display:grid;place-items:center;flex-shrink:0;width:1.8rem;height:1.8rem;padding:0;border:0;border-radius:4px;color:var(--muted);background:transparent}.file-heading button svg{display:block}.file-heading button:hover{color:var(--text);background:var(--surface-active)}.file-details{display:flex;flex-wrap:wrap;align-items:baseline;gap:.35rem 1.2rem;margin-top:.35rem}.file-context,.file-legend{margin:0;color:var(--muted);font-size:.72rem;overflow-wrap:anywhere}.file-context{flex:1;min-width:min(100%,16rem)}.file-legend{display:flex;flex-wrap:wrap;gap:.8rem;margin-left:auto;font-variant-numeric:tabular-nums}.file-legend span{white-space:nowrap}.removed{color:var(--critical)}.added{color:var(--green)}.file-code{min-height:0;overflow:auto;overscroll-behavior:contain;margin:0;padding:.8rem 0;background:var(--bg);tab-size:2;font:.76rem/1.55 ui-monospace,SFMono-Regular,Menlo,monospace}.file-code code{display:block;min-width:100%;width:max-content;padding-inline:1rem;font:inherit}.diff-line{display:block;min-height:1.55em}.diff-line.add{color:var(--green);background:rgb(from var(--green) r g b / .08)}.diff-line.del{color:var(--critical);background:rgb(from var(--critical) r g b / .08)}.diff-line.hunk{color:var(--accent);background:rgb(from var(--accent) r g b / .06)}.diff-line.meta{color:var(--muted)}.file-message{padding:2rem 1rem;color:var(--muted);font-size:.8rem}button:focus-visible,pre:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
224
+ `;var _$=class extends F{static properties={path:{},before:{attribute:!1},after:{attribute:!1},baseName:{},otherName:{},kind:{},_lines:{state:!0},_error:{state:!0},_highlighted:{state:!0}};static styles=[...F.styles,A(Fi),A(ZI)];constructor(){super(),this._lines=null,this._error=null,this._highlighted=null}beforeOpen(){if(this.kind==="changed")try{this._lines=JI(this.before,this.after)}catch{this._error="Could not calculate this diff."}else{let t=this.kind==="removed"?this.before:this.after;typeof t=="string"&&this._highlight(t)}}async _highlight(t){let r=await Ir(t,rn(this.path));this.isConnected&&(this._highlighted=r)}render(){let t=this.kind==="changed",r=this.kind==="removed"?this.before:this.after,n=t?this._lines===null:typeof r!="string",o=i=>ye(zd(i)??0);return d`<dialog aria-labelledby="file-title" @close="${this._onClose}"><header><div class="file-heading"><h3 id="file-title">${this.path}</h3><button type="button" aria-label="Close file" @click="${this._onClose}"><svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="m4 4 8 8m0-8-8 8"/></svg></button></div><div class="file-details"><p class="file-context">${t?`${this.baseName} \u2192 ${this.otherName}`:this.kind==="removed"?this.baseName:this.otherName}</p>${t?d`<p class="file-legend"><span class="removed">− Before</span><span class="added">+ After</span><span>${o(this.before)} → ${o(this.after)}</span></p>`:m}</div></header>${this._error?d`<p class="file-message" role="alert">${this._error}</p>`:n?d`<p class="file-message">${t?"Binary file changed. A text diff is not available.":`Binary file \xB7 ${o(r)}`}</p>`:t?d`<pre class="file-code" tabindex="0" aria-label="File diff"><code>${this._lines.map(i=>d`<span class="${`diff-line ${i.kind}`}">${i.text}</span>`)}</code></pre>`:d`<pre class="file-code" tabindex="0" aria-label="File contents"><code>${this._highlighted?V(this._highlighted):r||"Empty file"}</code></pre>`}</dialog>`}};customElements.define("bundle-file-dialog",_$);function QI(e){return si("bundle-file-dialog",e,t=>{t.before=null,t.after=null})}Xa();fm();hm();var e8=400,Ul=null;function C$(e){return e===0?"\xB10":`${e>0?"+":"\u2212"}${Math.abs(e).toLocaleString()}`}function t8(e){return`${C$(e)} B`}function bg(e){return e>0?"up":e<0?"down":""}function fj(e,t){if(!t)return"";let r=e/t*100;return`${r>0?"+":r<0?"\u2212":"\xB1"}${Math.abs(r).toFixed(1)}%`}function S$(e){return e.join(", ")}var E$=class extends X{static properties={details:{attribute:!1},integrity:{attribute:!1},_targetIntegrity:{state:!0},_otherDetails:{state:!0},_status:{state:!0},_scope:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.details=null,this.integrity=null,this._targetIntegrity=null,this._otherDetails=null,this._status="idle",this._scope="",this._diff=null,this._diffKey=null}willUpdate(t){if((t.has("_otherDetails")||t.has("details"))&&this._status==="ready"&&!m$(this.details,this._otherDetails).some(r=>r.id===this._scope)&&(this._scope=""),!!t.has("integrity")){if(Ul&&this.integrity===Ul.base){let r=Ul.target;this._scope=Ul.scope,Ul=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._scope="",this._diff=null,this._diffKey=null}}_swap(){let t=this._targetIntegrity;!t||t===this.integrity||_l(l.bundles??[],this.integrity).some(r=>r.integrity===t)&&(Ul={base:t,target:this.integrity,scope:this._scope},this.dispatchEvent(new CustomEvent("bundle-swap",{bubbles:!0,composed:!0,detail:{integrity:t}})))}_nameFor(t){return(l.bundles??[]).find(n=>n.integrity===t)?.name??`${t.slice(0,15)}\u2026`}_pick(t){let r=t||null;if(this._targetIntegrity=r,this._otherDetails=null,this._diff=null,this._diffKey=null,!r){this._status="idle",this._scope="";return}this._status="loading",this._loadOther(r)}async _loadOther(t){let r=_l(l.bundles??[],this.integrity).find(o=>o.integrity===t);if(!r){this._status="idle",this._targetIntegrity=null;return}let n;try{n=await fo(t,r)}catch(o){if(o.name==="AbortError")return;throw o}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))}_openFile(t,r){QI({path:t,kind:r,baseName:this._nameFor(this.integrity),otherName:this._nameFor(this._targetIntegrity),before:On(this.details).get(t),after:On(this._otherDetails).get(t)}).catch(n=>_t(n.message,{kind:"error"}))}_fileRow(t,r,n,o){let i=d`<span class="bundle-compare-row-path mono">${r}</span>${o}`;return n==="removed"&&ul(this.details).get(t)!=="resource"?d`<li><button type="button" class="bundle-compare-row bundle-compare-row-link" data-bundle-view-source="${t}" data-tooltip="${t}">${i}</button></li>`:d`<li><button type="button" class="bundle-compare-row bundle-compare-row-link" data-tooltip="${t}" @click="${()=>this._openFile(t,n)}">${i}</button></li>`}_group(t,r,n,o,i){if(r.length===0)return m;let s=r.slice(0,e8),a=r.length-s.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">${re(s,o,i)}</ul>${a>0?d`<div class="bundle-compare-more">and ${a.toLocaleString()} more…</div>`:m}</section>`}_sizeCells(t){return t.delta===void 0?d`<span class="bundle-compare-row-size">${ye(t.bytes)}</span>`:d`<span class="bundle-compare-row-size">${ye(t.baseBytes)} → ${ye(t.otherBytes)}</span> <span class="${`bundle-compare-row-delta ${bg(t.delta)}`}">${t8(t.delta)}</span>`}_fileGroup(t,r,n,o){return this._group(t,r,n,i=>i.path,i=>this._fileRow(i.path,o(i.path),n,this._sizeCells(i)))}_pkgGroup(t,r,n){return this._group(t,r,n,o=>o.pkg,o=>d`<li><div class="bundle-compare-row" title="${Ei(o.pkg)}"><span class="bundle-compare-pkg-dot" style="${Se({background:er(o.pkg)})}"></span> <span class="bundle-compare-row-path">${Ei(o.pkg)}</span> ${this._sizeCells(o)}</div></li>`)}_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="${Se({background:er(t.pkg)})}"></span> <span class="bundle-compare-row-path">${t.pkg}</span> <span class="bundle-compare-ver"><span class="bundle-compare-ver-from">${S$(t.baseVersions)}</span> <span class="bundle-compare-ver-arrow" aria-hidden="true">→</span> <span class="${`bundle-compare-ver-to ${t.direction}`}">${S$(t.otherVersions)}</span> <span class="${`bundle-compare-ver-dir ${t.direction}`}" aria-hidden="true">${r}</span></span></div></li>`}_depGroup(t,r,n){return this._group(t,r,n,o=>o.pkg,o=>d`<li><div class="bundle-compare-row" title="${o.pkg}"><span class="bundle-compare-pkg-dot" style="${Se({background:er(o.pkg)})}"></span> <span class="bundle-compare-row-path">${o.pkg}</span> <span class="bundle-compare-dep-ver">${S$(o.versions)}</span></div></li>`)}_renderVersionUpdates(t,r,n){let{updated:o,added:i,removed:s}=t;if(o.length===0&&i.length===0&&s.length===0)return m;let a=o.slice(0,e8),c=o.length-a.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">${re(a,u=>u.pkg,u=>this._versionRow(u))}</ul>${c>0?d`<div class="bundle-compare-more">and ${c.toLocaleString()} more…</div>`:m}</div>`:m} ${i.length>0||s.length>0?d`<div class="bundle-compare-cols">${this._depGroup(`Removed \xB7 only in ${r}`,s,"removed")} ${this._depGroup(`Added \xB7 only in ${n}`,i,"added")}</div>`:m}</section>`}_diffFor(){let t=`${this.integrity}|${this._targetIntegrity}|${this._scope}`;if(this._diffKey!==t||!this._diff){let r=g$(this.details,this._scope),n=g$(this._otherDetails,this._scope),{prefix:o}=hr([...r.keys(),...n.keys()]),i=nn(this.details),s=nn(this._otherDetails),a=i||s?new Map([...i??[],...s??[]]):null,c=u=>mt(o&&u.startsWith(o)?u.slice(o.length):u,{packageDir:a?.get(u)});this._diff=TI(r,n,c),this._diff.versionUpdates=II(Ud(this.details,this._scope?r.keys():null),Ud(this._otherDetails,this._scope?n.keys():null)),this._diffKey=t}return this._diff}_renderSummary(t){let r=t.totals,n=t.versionUpdates.totals,o=n.baseDeps>0||n.otherDeps>0,i=n.otherDeps-n.baseDeps,s=fj(r.byteDelta,r.baseBytes);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 ${bg(r.fileDelta)}`}">${C$(r.fileDelta)}</span></div><div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Size</span> <span class="bundle-compare-metric-value">${ye(r.baseBytes)} → ${ye(r.otherBytes)}</span> <span class="${`bundle-compare-metric-delta ${bg(r.byteDelta)}`}">${t8(r.byteDelta)}${s?d`${" "}<span class="bundle-compare-pct">(${s})</span>`:m}</span></div>${o?d`<div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Deps</span> <span class="bundle-compare-metric-value">${n.baseDeps.toLocaleString()} → ${n.otherDeps.toLocaleString()}</span> <span class="${`bundle-compare-metric-delta ${bg(i)}`}">${C$(i)}</span></div>`:m}<div class="bundle-compare-chips"><span class="bundle-compare-chip removed">−${r.onlyBaseFiles.toLocaleString()} removed</span> <span class="bundle-compare-chip added">+${r.onlyOtherFiles.toLocaleString()} added</span> <span class="bundle-compare-chip changed">${r.changedFiles.toLocaleString()} changed</span> <span class="bundle-compare-chip unchanged">${r.unchangedFiles.toLocaleString()} unchanged</span></div></div>`}_renderPicker(t,r){let n=this._nameFor(this.integrity);return d`<div class="bundle-compare-picker"><span class="bundle-compare-base" title="${n}">${n}</span> <span class="bundle-compare-arrow" aria-hidden="true">→</span><div class="bundle-compare-select-wrap"><span class="bundle-compare-select-hint">Compare with</span><bundle-selector .bundles="${t}" .value="${this._targetIntegrity}" label="Bundle to compare with" placeholder="Choose a bundle…" @bundle-change="${o=>this._pick(o.detail.value)}"></bundle-selector>${r?d`<button type="button" class="bundle-compare-clear" aria-label="Clear comparison" @click="${()=>this._pick(null)}">×</button>`:m}</div>${r?d`<button type="button" class="bundle-compare-swap" @click="${()=>this._swap()}" aria-label="Swap the two bundles"><span class="bundle-compare-swap-icon" aria-hidden="true">↔</span>Swap</button>`:m}</div>`}_otherOptions(){let t=_l(l.bundles??[],this.integrity),r=new Map;for(let n of t)r.set(n.name,(r.get(n.name)??0)+1);return t.map(n=>({id:n.integrity,integrity:n.integrity,kind:n.kind??(n.name.toLowerCase().endsWith(".map")?"sourcemap":"stasis"),summary:n.summary,size:typeof n.size=="number"?ye(n.size):"\u2014",filename: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(a=>a.integrity===this._targetIntegrity),n=t.length>0?this._renderPicker(t,r):m,o=this._baseReady?m$(this.details,r?this._otherDetails:null):[],i=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} ${o.length>0?d`<bundle-scope-selector .reasons="${o}" .value="${this._scope}" label="Compare scope" @scope-change="${a=>{this._scope=a.detail.value}}"></bundle-scope-selector>`:m} ${this._baseReady&&i?this._renderSummary(this._diffFor()):m}</header><div class="bundle-compare-body">${s}</div></div>`}_renderDiff(){let t=this._diffFor(),r=this._nameFor(this._targetIntegrity),n=this._nameFor(this.integrity),o=[...t.files.onlyBase.map(p=>p.path),...t.files.onlyOther.map(p=>p.path),...t.files.changed.map(p=>p.path)],{prefix:i,stripped:s}=hr(o),a=new Map;for(let p=0;p<o.length;p++)a.set(o[p],s[p]);let c=p=>a.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> ${i?d`· <span class="mono">${i}</span>`:m}</div>${this._renderVersionUpdates(t.versionUpdates,n,r)} ${t.totals.identical?d`<div class="bundle-compare-identical">These two bundles carry identical files (${t.totals.unchangedFiles.toLocaleString()} ${t.totals.unchangedFiles===1?"file":"files"}).</div>`:d`${u?d`<section class="bundle-compare-section"><h3 class="bundle-compare-section-head">Packages</h3><div class="bundle-compare-cols">${this._pkgGroup(`Removed \xB7 only in ${n}`,t.packages.onlyBase,"removed")} ${this._pkgGroup(`Added \xB7 only in ${r}`,t.packages.onlyOther,"added")} ${this._pkgGroup("Changed size",t.packages.changed,"changed")}</div></section>`:m}<section class="bundle-compare-section"><h3 class="bundle-compare-section-head">Files</h3><div class="bundle-compare-cols bundle-compare-cols--files">${this._fileGroup(`Removed \xB7 only in ${n}`,t.files.onlyBase,"removed",c)} ${this._fileGroup(`Added \xB7 only in ${r}`,t.files.onlyOther,"added",c)} ${this._fileGroup("Changed",t.files.changed,"changed",c)}</div></section>`}`}};customElements.define("bundle-compare",E$);T();Ce();D();var R$=class extends G{createRenderRoot(){return this}render(){return l.reports.length>0&&l.currentView==="findings"&&l.viewMode!=="graph"&&l.viewMode!=="kanban"?d`<button type="button" class="toolbar-export-btn" aria-label="Download or print report" @click="${this._onClick}">${cT}</button>`:m}_onClick=()=>{this.dispatchEvent(new CustomEvent("download-requested",{bubbles:!0,composed:!0}))}};customElements.define("download-button",R$);T();qe();T();Ce();lo();var Oi=class extends G{static styles=Me`.preview{position:fixed;inset:auto;margin:0;padding:14px;box-sizing:border-box;width:min(24rem,calc(100vw - 24px));max-height:calc(100vh - 24px);overflow:auto;border:1px solid var(--border);border-radius:10px;background:var(--bg);color:var(--text);box-shadow:0 8px 28px #00000040;font:13px/1.45 system-ui,sans-serif;text-align:left;white-space:normal;overflow-wrap:anywhere;letter-spacing:normal;cursor:default}.preview.wide{width:min(36rem,calc(100vw - 24px))}@media print{.preview{display:none}}`;constructor(){super(),this.showTimer=null,this.hideTimer=null}connectedCallback(){super.connectedCallback(),Dt(this.renderRoot)}disconnectedCallback(){this._hidePreview(),super.disconnectedCallback()}updated(){let t=this.renderRoot.querySelector(".preview");t?t.matches(":popover-open")&&this._positionPreview():this._hidePreview()}_schedulePreview(){clearTimeout(this.hideTimer),clearTimeout(this.showTimer),this.renderRoot.querySelector(".preview")&&(this.showTimer=setTimeout(()=>{if(!this.isConnected)return;let t=this.renderRoot.querySelector(".preview");t&&(ii(),t.showPopover(),this._positionPreview(),document.addEventListener("keydown",this._previewKeyDown,!0),window.addEventListener("scroll",this._previewScroll,!0),window.addEventListener("resize",this._hidePreview))},150))}_keepPreview(){clearTimeout(this.hideTimer)}_leavePreview(){clearTimeout(this.showTimer),clearTimeout(this.hideTimer),this.hideTimer=setTimeout(()=>{this.renderRoot.querySelector(".preview")?.contains(this.renderRoot.activeElement)||this._hidePreview()},150)}_hidePreview=()=>{clearTimeout(this.showTimer),clearTimeout(this.hideTimer);let t=this.renderRoot?.querySelector(".preview");t?.matches(":popover-open")&&t.hidePopover(),document.removeEventListener("keydown",this._previewKeyDown,!0),window.removeEventListener("scroll",this._previewScroll,!0),window.removeEventListener("resize",this._hidePreview)};_previewKeyDown=t=>{t.key==="Escape"&&(t.preventDefault(),t.stopPropagation(),this.renderRoot.querySelector(".preview")?.contains(this.renderRoot.activeElement)&&this.renderRoot.querySelector("[aria-details]").focus({preventScroll:!0}),this._hidePreview())};_previewScroll=t=>{t.composedPath().includes(this.renderRoot.querySelector(".preview"))||this._hidePreview()};_positionPreview(){let t=this.renderRoot.querySelector(".preview"),r=this.renderRoot.querySelector("[aria-details]").getBoundingClientRect(),{width:n,height:o}=t.getBoundingClientRect(),i=8,s=12,a=Math.max(s,Math.min(r.left,window.innerWidth-n-s)),c=r.bottom+i+o<=window.innerHeight-s?r.bottom+i:Math.max(s,r.top-i-o);t.style.left=`${a}px`,t.style.top=`${c}px`}};Ee();nw();Kf();ft();var M$={open:"Open",draft:"Draft",closed:"Closed",merged:"Merged",completed:"Completed",not_planned:"Not planned",duplicate:"Duplicate",unknown:"Closed"},hj=d`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="4" cy="3" r="1.75"/><circle cx="4" cy="13" r="1.75"/><circle cx="12" cy="13" r="1.75"/><path d="M4 4.75v6.5M12 11.25V5a2 2 0 0 0-2-2H8m2-2L8 3l2 2"/></svg>`,mj=d`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="8" cy="8" r="6.25"/><circle cx="8" cy="8" r="1.5" fill="currentColor" stroke="none"/></svg>`,gj=d`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="8" cy="8" r="6.25"/><path d="m5 8 2 2 4-4"/></svg>`,bj=d`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="8" cy="8" r="6.25"/><path d="m3.5 12.5 9-9"/></svg>`,yj={completed:gj,not_planned:bj},A$=class extends Oi{static properties={url:{type:String},compact:{type:Boolean,reflect:!0}};static styles=[Oi.styles,Me`:host{display:inline;word-break:normal}a{color:var(--accent);text-decoration:none;overflow-wrap:anywhere;cursor:default}.status{display:inline-flex;align-items:center;gap:.3em;vertical-align:text-bottom;margin-right:.35em;font-weight:600;white-space:nowrap}svg{flex:none}.open{color:light-dark(#1a7f37,#3fb950)}.draft,.not_planned,.duplicate,.unknown,.unavailable{color:var(--muted)}.closed{color:light-dark(#d1242f,#f85149)}.merged,.completed{color:light-dark(#8250df,#a371f7)}:host(:not([compact])){display:block}:host(:not([compact])) .fix-link{display:flex;align-items:center;gap:.55rem;min-width:0}.link-icon{flex:none;line-height:1}.link-icon svg{display:block}.link-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text);font-weight:500;line-height:1.5}.link-icon.unavailable+.link-title{color:var(--accent)}.ref{min-width:0;max-width:32%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted);font-size:.74rem}.link-status{flex:none;padding:.15rem .4rem;border-radius:999px;background:color-mix(in srgb,currentColor 10%,transparent);font-size:.7rem;font-weight:500;line-height:1.3}:host([compact]){display:inline-flex}:host([compact]) .fix-link{display:inline-flex;align-items:center;justify-content:center;width:100%;height:100%}:host([compact]) .fix-link svg{width:14px;height:14px}:host([compact]) .status{margin:0;font-size:1rem;line-height:1}.preview-header{display:flex;align-items:center;justify-content:space-between;gap:12px}.preview-ref{display:inline-flex;align-items:center;gap:.4rem;min-width:0;color:var(--muted);font-size:12px;line-height:1.4}.preview-ref span{min-width:0}.preview-description{margin-top:8px;white-space:pre-wrap}.preview-title{margin-top:8px;font-size:15px;font-weight:600;line-height:1.4}.preview .preview-header .status{flex:none;margin:0;font-size:12px;line-height:1.4}@media print{:host(:not([compact])) .fix-link{display:block}.link-title,.ref{white-space:normal;overflow:visible;text-overflow:clip;max-width:none}.link-icon{display:inline-block;vertical-align:middle;margin-right:.55rem}.ref,.link-status{margin-left:.55rem}.preview{display:none}}`];constructor(){super(),this.url="",this.compact=!1,this.unsubscribe=null}connectedCallback(){super.connectedCallback(),this.unsubscribe=w5(()=>this.requestUpdate()),this.hasUpdated&&this.requestUpdate()}disconnectedCallback(){this.unsubscribe?.(),this.unsubscribe=null,super.disconnectedCallback()}updated(t){t.has("url")||t.has("compact")?this._hidePreview():super.updated(t)}render(){if(!Fe(this.url))return d`${this.url}`;let t=ew(this.url),r=!t&&tw(this.url),n=t||r,o=ow.read(this.url);if(!o&&!n){let p=`Open fix link: ${this.url}`;return d`<a class="${this.compact?"fix-link":""}" href="${this.url}" target="_blank" rel="noopener noreferrer" draggable="false" data-tooltip="${this.compact?p:m}" aria-label="${p}">${this.compact?d`<slot></slot>`:this.url}</a>`}let i=o?r&&o.status==="closed"?o.stateReason??"unknown":o.status:"unavailable",s=t?hj:r?yj[i]??mj:null,a=n?`${n.repo}#${n.number}`:"",c=(o?.title.length??0)>40||(o?.description??"").split(/[\r\n]/u).some(p=>p.length>100),u=o?`${M$[i]} ${t?"pull request":"issue"}: ${o.title} (${a})`:n?`Open ${t?"pull request":"issue"}: ${a}`:`Open fix link: ${this.url}`;return d`<a class="fix-link" href="${this.url}" target="_blank" rel="noopener noreferrer" draggable="false" aria-label="${u}" aria-details="${this.compact&&n?"fix-preview":m}" data-tooltip="${this.compact&&!n?u:m}" @mouseenter="${this._schedulePreview}" @mouseleave="${this._leavePreview}" @focus="${this._schedulePreview}" @blur="${this._leavePreview}" @click="${this._hidePreview}">${this.compact?s?d`<span class="${`status ${i}`}">${s}</span>`:d`<slot></slot>`:d`${s?d`<span class="${`link-icon ${i}`}">${s}</span>`:m} <span class="link-title">${o?.title??(a||this.url)}</span> ${o?d`<span class="ref">${a}</span><span class="${`link-status ${i}`}">${M$[i]}</span>`:m}`} </a>${this.compact&&n?d`<a class="${c?"preview wide":"preview"}" id="fix-preview" popover="manual" href="${this.url}" target="_blank" rel="noopener noreferrer" draggable="false" aria-label="${`Open ${t?"pull request":"issue"} ${a} on GitHub`}" @mouseenter="${this._keepPreview}" @mouseleave="${this._leavePreview}" @focusin="${this._keepPreview}" @focusout="${this._leavePreview}" @click="${p=>{p.stopPropagation(),this._hidePreview()}}"><div class="preview-header"><span class="preview-ref">${V(ni)}<span>${a}</span></span> <span class="${`status ${i}`}">${s}${o?M$[i]:t?"Pull request":"Issue"}</span></div>${o?d`<div class="preview-title">${o.title}</div>`:m} ${o?.description?d`<div class="preview-description">${o.description}</div>`:m}</a>`:m}`}};customElements.define("managed-fix-link",A$);T();D();bl();qh();Yh();Jm();var T$=class extends Oi{static properties={finding:{attribute:!1},comment:{type:String}};static styles=[Oi.styles,A(Pl),Me`:host{display:inline-flex}:host([hidden]){display:none!important}button{border:0;padding:0;background:none;color:inherit;font:inherit;cursor:default}.preview-trigger{display:inline-flex;align-items:center;justify-content:center;line-height:0}.preview-trigger:hover{color:var(--accent)}.managed-comment+.managed-comment{margin-top:12px;padding-top:12px;border-top:1px solid var(--border)}.comment-body{white-space:pre-wrap}.comment-body a{color:var(--accent);text-decoration:none}.comment-body a:hover{text-decoration:underline}.preview-footer{display:flex;justify-content:flex-end;margin-top:8px}.edit-hint{color:var(--muted);font-size:12px}.edit-hint:hover{color:var(--accent)}`];constructor(){super(),this.finding=null,this.comment="",this.unsubscribe=null}connectedCallback(){super.connectedCallback(),this._subscribe(),document.addEventListener("managed-comments-reset",this._resetComments),this.hasUpdated&&this.requestUpdate()}disconnectedCallback(){this.unsubscribe?.(),this.unsubscribe=null,document.removeEventListener("managed-comments-reset",this._resetComments),super.disconnectedCallback()}updated(t){this.hidden=!this.renderRoot.querySelector(".preview"),t.has("finding")&&(this._hidePreview(),this._subscribe()),super.updated(t)}_subscribe(){this.unsubscribe?.(),this.unsubscribe=this.finding?.id?Wh(this.finding.id,()=>this.requestUpdate()):null}_resetComments=()=>{this._hidePreview(),this.requestUpdate()};_previewClick(t){if(t.target.closest("a, button")){this._hidePreview();return}window.getSelection?.()?.toString()||(t.stopPropagation(),this.renderRoot.querySelector(".preview-trigger").click())}render(){let t=_(),r=t?Pn(this.finding):[];if(!(t?r.length>0:!!this.comment))return m;let i=(t?r.map(s=>s.body):[this.comment]).some(s=>s.split(/[\r\n]/u).some(a=>a.length>100));return d`<button type="button" class="preview-trigger mark-comment" aria-label="${t?"View comments":"Edit comment"}" aria-details="comment-preview" @mouseenter="${this._schedulePreview}" @mouseleave="${this._leavePreview}" @focus="${this._schedulePreview}" @blur="${this._leavePreview}" @click="${this._hidePreview}"><slot></slot></button><div class="${i?"preview wide":"preview"}" id="comment-preview" popover="manual" role="region" aria-label="${t?"Comments":"Comment"}" @mouseenter="${this._keepPreview}" @mouseleave="${this._leavePreview}" @focusin="${this._keepPreview}" @focusout="${this._leavePreview}" @click="${this._previewClick}">${t?r.map(s=>yl(s,yo(s.body))):d`<div class="comment-body">${yo(this.comment)}</div><div class="preview-footer"><button type="button" class="mark-comment edit-hint">Edit</button></div>`}</div>`}};customElements.define("comment-preview",T$);D();Qr();zt();zn();ct();function Ou(e){let t=new Map;for(let[r,n]of l.triage)n[e]&&t.set(r,n[e]);return t}var vj={get markers(){return Ou("color")},get triageState(){return Ou("triage")},get comments(){return Ou("comment")},get fixes(){return Ou("fix")},get flags(){return Ou("flagged")},get(e){let t=l.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:i}={}){let s=!1;if(t!==void 0&&(t===null||t===""?Z(l.triage,e,{color:void 0})&&(s=!0):l.triage.get(e)?.color!==t&&(Z(l.triage,e,{color:t}),s=!0)),r!==void 0)if(r===null||r===""||r===!1)Z(l.triage,e,{triage:void 0})&&(s=!0);else if(r==="inprogress"||r==="fixed"||r==="invalid"||r==="deleted")l.triage.get(e)?.triage!==r&&(Z(l.triage,e,{triage:r}),s=!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 a=n?String(n):"";a?l.triage.get(e)?.comment!==a&&(Z(l.triage,e,{comment:a}),s=!0):Z(l.triage,e,{comment:void 0})&&(s=!0)}if(o!==void 0){let a=o?String(o):"";a?l.triage.get(e)?.fix!==a&&(Z(l.triage,e,{fix:a}),s=!0):Z(l.triage,e,{fix:void 0})&&(s=!0)}if(i!==void 0){let a=i===null||i===""?void 0:!!i;l.triage.get(e)?.flagged!==a&&(Z(l.triage,e,{flagged:a}),s=!0)}return s&&(await we(),S()),s}};window.DeepView={get reports(){return l.reports.slice()},get groups(){return br()},get findings(){return br().flat()},get currentFile(){return l.currentFile},get currentWorkspace(){return l.currentWorkspace},triage:vj,forceManagedMode:ZA,setTheme:tI,get theme(){return rI()},triageSync:Q,refresh(){S()},export(){return uI()}};c0();en();ft();var wj={default:ke.default,"claude-security":ke["claude-security"],"codex-security":ke["codex-security"],deepsec:ke.deepsec,piolium:ke.piolium,bundle:Er,workspace:ri,links:Qa,github:ni};for(let e of document.querySelectorAll(".drop-supported-icon[data-icon]")){let t=wj[e.dataset.icon];t&&(e.innerHTML=t)}ym();zC(S);iv(S);DC(S);Q.onStatusChange(S);PC(async(e,t)=>{l.currentWorkspace===e?await Pr(e):l.currentFile&&l.currentFile===t?await tr(t):await K()});NC(async()=>{await K(),l.currentView==="bundles"&&S()});eT();rT();async function o8(){let e=Fv();if(!e)return!1;try{history.replaceState(null,"",location.pathname)}catch{}let t;try{t=await oT({encoded:e})}catch(n){return alert(`Couldn't open the share-link unlock prompt: ${n.message}`),!1}if(!t)return!1;let r=await Py({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 Pr(r.workspace.id):await K(),!0}async function i8(){let e=Po();if(!e)return!1;try{history.replaceState(null,"",location.pathname)}catch{}let t=await H1(e);return t.ok?!0:(alert(t.reason),!1)}var Hl=!1;async function s8(){if(await ht(),!Hl&&!(!_()&&fe()&&!qt())){Hl=!0;try{await kj()}finally{Ge.hidden=!1}}}async function kj(){let e=Ze(),t=()=>e===Ze()&&!_();if(_()){await K();return}if(await hn(),!t()||(Qc(),await Promise.all([K(),mf().catch(i=>console.warn("initial linked findings:",i))]),!t())||await o8()||!t()||await i8()||!t())return;let o=Ae(_i);if(o)if(o.startsWith("ws:")){let i=o.slice(3);J().some(s=>s.id===i)&&await Pr(i)}else if(o.startsWith("b:")){let i=o.slice(2),s=i.indexOf(" "),a=s>=0?i.slice(0,s):i,c=s>=0?i.slice(s+1):"",u=gn.has(c)?c:"overview";(l.bundles??[]).some(p=>p.integrity===a)&&(ho(a,u),S(),mo(a),await K())}else{let i=await me();if(!t())return;let s=vf(o);s&&i.includes(s.name)&&await tr(s.name,void 0,{workspaceId:s.workspaceId})}}var yg=!1,r8=!1;document.addEventListener("managed-client-mode-change",()=>{yg=!_()&&fe()});function n8(e){r8||(r8=!0,queueMicrotask(()=>{alert(e+" This tab will reload to refresh its state. Any unsaved edits in this tab will be lost."),location.reload()}))}Je(async()=>{if(await ht(),_()){S();return}let e=yg,t=fe();if(yg=t,S(),!Hl&&qt()){s8().catch(r=>console.warn("continueBoot:",r));return}if(Hl&&t&&!qt()){n8("Encryption was just enabled in another tab.");return}Hl&&e&&!t&&!Wg()&&n8("Encryption was disabled in another tab.")});window.addEventListener("hashchange",()=>{!Hl||_()||(async()=>{await o8()||await i8()})().catch(e=>console.warn("deep-link hashchange:",e))});(async()=>{if(!await nT()){await ht(),yg=!_()&&fe();try{let e=window.matchMedia?.("(display-mode: window-controls-overlay)").matches;if(!e&&!_()&&localStorage.getItem("deepview.sidebarCollapsed")==="1"&&S_.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{}!_()&&fe()&&!qt()||await s8()}})();
90
225
  /*! Bundled license information:
91
226
 
92
227
  @lit/reactive-element/css-tag.js:
@@ -132,6 +267,7 @@ lit-html/directives/live.js:
132
267
  *)
133
268
 
134
269
  lit-html/directives/map.js:
270
+ lit-html/directives/keyed.js:
135
271
  lit-html/directives/choose.js:
136
272
  (**
137
273
  * @license