@preventive/triage 1.0.0-alpha.32 → 1.0.0-alpha.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/client-managed.js +4 -4
- package/out/view.css +1 -1
- package/out/view.js +172 -164
- package/package.json +3 -2
- package/server-managed/brotli.ts +3 -3
- package/server-managed/config.ts +2 -2
- package/server-managed/db-methods.ts +2 -0
- package/server-managed/object-storage-disk.ts +7 -3
- package/server-managed/object-storage-vercel.ts +6 -2
- package/server-managed/object-storage.ts +3 -2
- package/server-managed/report-store.ts +47 -0
- package/server-managed/storage-encryption.ts +72 -6
- package/server-managed/storage-maintenance.ts +64 -49
- package/server-managed/storage-payload.ts +11 -10
- package/server-managed/storage-stores.ts +3 -1
- package/server-managed/workspace-shares.ts +1 -1
package/out/client-managed.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var xc=Object.defineProperty;var w=(r,e,t)=>()=>{if(t)throw t[0];try{return r&&(e=r(r=0)),e}catch(i){throw t=[i],i}};var vr=(r,e)=>{for(var t in e)xc(r,t,{get:e[t],enumerable:!0})};function Ts(r){return typeof r=="string"&&_e.includes(r)}function je(r,e){let t=_e.indexOf(r);return t!==-1&&t<=_e.indexOf(e)}var _e,yr=w(()=>{"use strict";_e=["admin","manage","triage","view","none"]});var Ns,wr,_r=w(()=>{"use strict";Ns=["dependencies","security"],wr={dependencies:"Dependencies",security:"Security"}});function Bs(r=null){let e=["anthropic/claude-opus-5.5","anthropic/claude-fable-5.1","anthropic/claude-sonnet-5.5","anthropic/claude-haiku-4.5","openai/gpt-6-astra","openai/gpt-6-astra-pro","openai/gpt-6.1-sol","openai/gpt-6.1-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"],t=r==="moonshot"?"moonshotai":r,i=e.filter(s=>!["anthropic","openai","moonshot"].includes(r??"")||s.startsWith(`${t}/`)).map(s=>({id:s,efforts:["low","medium","high","xhigh","max"]}));return{models:i,defaultModel:i[0].id}}var Ps=w(()=>{"use strict"});var Ds,js,Us,Fs=w(()=>{"use strict";Ps();Ds=Bs(),js=Object.freeze(Ds.models),Us=Ds.defaultModel});function $c(r){if(!r?.startsWith("#public="))return null;let e=/^#public=([A-Za-z0-9_-]+)\.([A-Za-z0-9_-]{43})$/u.exec(r);return e?{id:e[1],token:e[2]}:{id:"",token:""}}function Z(){return qs}function xr(r=qs){return`/api/shares/${encodeURIComponent(r.id)}/workspace`}var Hs,qs,kt=w(()=>{"use strict";Hs=globalThis.location?.hash,qs=$c(Hs);globalThis.addEventListener?.("hashchange",()=>{let r=globalThis.location?.hash;r?.startsWith("#public=")&&r!==Hs&&globalThis.location.reload()})});function xe(){return le?.user.role??null}function kc(r){if(r!==null&&!Ts(r))throw new TypeError(`Unknown managed preview role: ${r}. Expected ${_e.join(", ")}.`);St++,le=r===null?null:{user:{id:`preview:${r}`,login:r,name:r[0].toUpperCase()+r.slice(1),role:r,avatarUrl:null,lastSeenAt:Date.now(),lastActivityAt:null},csrfToken:null}}function Sc(r,e){let t=new URL(r,"http://managed-preview.invalid").pathname,i=(e?.method??"GET").toUpperCase();if(i==="POST"&&t==="/api/auth/logout")return Response.json({ok:!0});if(i!=="GET")throw new Error("Changes are not saved in the managed UI preview");if(t==="/api/auth/session")return Response.json(le);if(t==="/api/teams")return Response.json({teams:[]});if(t.startsWith("/api/admin/")&&!je(le.user.role,"manage"))return Response.json({error:"forbidden"},{status:403});if(["/api/admin/users","/api/admin/teams","/api/admin/repositories"].includes(t)&&le.user.role!=="admin")return Response.json({error:"forbidden"},{status:403});let s={"/api/admin/users":{users:[le.user]},"/api/admin/teams":{teams:[],users:[le.user],repos:[],permissions:Ns},"/api/admin/links":{shares:[]},"/api/admin/repositories":{repositories:[],total:0,connectedCount:0,installUrl:null,tokenMissing:!1},"/api/admin/reports":{reports:[],repos:[],maxBytes:10485760},"/api/admin/bundles":{bundles:[],repos:[],maxBytes:209715200},"/api/admin/history":{history:[],total:0,page:1,limit:100,filters:{repos:[],users:[]}},"/api/admin/scan/models":{models:js,defaultModel:Us},"/api/admin/scan-results":{bundles:[],results:[]}};return Object.hasOwn(s,t)?Response.json(s[t]):Response.json({error:"not-found"},{status:404})}async function Cc(r,e,t){let i=await t("/api/config",{credentials:"same-origin",signal:e.signal});if(!i.ok)return i;let s=(await i.json()).managed,o=s?.uploadChunkBytes;if(!Number.isSafeInteger(o)||o<=0||o>3*1024*1024)return t(r,e);let n=e.body,a=crypto.randomUUID(),l=r.endsWith("/reports")?"reports":"bundles",d=s?.uploadMaxBytes?.[l];if(Number.isSafeInteger(d)&&d>0&&n.size>d)return Response.json({error:"too-large"},{status:413});let m=Math.ceil(n.size/o),p=new Headers(e.headers);p.set("content-type","application/octet-stream");let h=0,f=!1;try{for(let v=0;v<m;v++){h=v+1;let b=await t(`/api/admin/uploads/${l}/${a}/${v}`,{...e,headers:p,body:n.slice(v*o,(v+1)*o)});if(!b.ok)return b}let g=new Headers(e.headers);g.set("x-upload-id",a),g.set("x-upload-parts",String(m)),g.set("x-upload-size",String(n.size));let y=await t(r,{...e,headers:g,body:""});return f=y.ok,y}finally{if(!f&&h>0){let g=new Headers(e.headers);g.set("x-upload-parts",String(h)),await t(`/api/admin/uploads/${l}/${a}`,{...e,method:"DELETE",headers:g,body:void 0,signal:AbortSignal.timeout(1e4)}).catch(()=>{})}}}async function $(r,e){if(e?.signal?.throwIfAborted(),le)return Sc(r,e);let t=St;async function i(s,o){if(t!==St)throw new DOMException("Managed session changed","AbortError");let n=Z();if(n){if(new URL(s,globalThis.location.origin).origin!==globalThis.location.origin)throw new Error("Public workspace requests must be same-origin");let d=new Headers(o?.headers);d.set("x-deepview-share",n.token),o={...o,headers:d,credentials:"omit",redirect:"error"}}let a=await fetch(s,{...o,cache:"no-store"});if(t!==St)throw new DOMException("Managed session changed","AbortError");return a}return e?.method==="POST"&&["/api/admin/reports","/api/admin/bundles"].includes(r)&&e.body instanceof Blob&&e.body.size>3*1024*1024?Cc(r,e,i):await i(r,e)}var le,St,B=w(()=>{"use strict";yr();_r();Fs();kt();le=null,St=0});var Ct,Et,$r,Vs,tt,x,I,Gs,kr,Sr=w(()=>{Ct=globalThis,Et=Ct.ShadowRoot&&(Ct.ShadyCSS===void 0||Ct.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,$r=Symbol(),Vs=new WeakMap,tt=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==$r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Et&&e===void 0){let i=t!==void 0&&t.length===1;i&&(e=Vs.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Vs.set(t,e))}return e}toString(){return this.cssText}},x=r=>new tt(typeof r=="string"?r:r+"",void 0,$r),I=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((i,s,o)=>i+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+r[o+1],r[0]);return new tt(t,r,$r)},Gs=(r,e)=>{if(Et)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let i=document.createElement("style"),s=Ct.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=t.cssText,r.appendChild(i)}},kr=Et?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let i of e.cssRules)t+=i.cssText;return x(t)})(r):r});var Ec,Rc,Ac,Mc,Ic,Lc,Rt,Ks,zc,Oc,rt,Cr,Zs,Ws,ee,At=w(()=>{Sr();Sr();({is:Ec,defineProperty:Rc,getOwnPropertyDescriptor:Ac,getOwnPropertyNames:Mc,getOwnPropertySymbols:Ic,getPrototypeOf:Lc}=Object),Rt=globalThis,Ks=Rt.trustedTypes,zc=Ks?Ks.emptyScript:"",Oc=Rt.reactiveElementPolyfillSupport,rt=(r,e)=>r,Cr={toAttribute(r,e){switch(e){case Boolean:r=r?zc:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Zs=(r,e)=>!Ec(r,e),Ws={attribute:!0,type:String,converter:Cr,reflect:!1,useDefault:!1,hasChanged:Zs};Symbol.metadata??=Symbol("metadata"),Rt.litPropertyMetadata??=new WeakMap;ee=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ws){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let i=Symbol(),s=this.getPropertyDescriptor(e,i,t);s!==void 0&&Rc(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){let{get:s,set:o}=Ac(this.prototype,e)??{get(){return this[t]},set(n){this[t]=n}};return{get:s,set(n){let a=s?.call(this);o?.call(this,n),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ws}static _$Ei(){if(this.hasOwnProperty(rt("elementProperties")))return;let e=Lc(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(rt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(rt("properties"))){let t=this.properties,i=[...Mc(t),...Ic(t)];for(let s of i)this.createProperty(s,t[s])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[i,s]of t)this.elementProperties.set(i,s)}this._$Eh=new Map;for(let[t,i]of this.elementProperties){let s=this._$Eu(t,i);s!==void 0&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let i=new Set(e.flat(1/0).reverse());for(let s of i)t.unshift(kr(s))}else e!==void 0&&t.push(kr(e));return t}static _$Eu(e,t){let i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.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(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Gs(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){let i=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,i);if(s!==void 0&&i.reflect===!0){let o=(i.converter?.toAttribute!==void 0?i.converter:Cr).toAttribute(t,i.type);this._$Em=e,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(e,t){let i=this.constructor,s=i._$Eh.get(e);if(s!==void 0&&this._$Em!==s){let o=i.getPropertyOptions(s),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:Cr;this._$Em=s;let a=n.fromAttribute(t,o.type);this[s]=a??this._$Ej?.get(s)??a,this._$Em=null}}requestUpdate(e,t,i,s=!1,o){if(e!==void 0){let n=this.constructor;if(s===!1&&(o=this[e]),i??=n.getPropertyOptions(e),!((i.hasChanged??Zs)(o,t)||i.useDefault&&i.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(n._$Eu(e,i))))return;this.C(e,t,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:s,wrapped:o},n){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,n??t??this[e]),o!==!0||n!==void 0)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),s===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[s,o]of this._$Ep)this[s]=o;this._$Ep=void 0}let i=this.constructor.elementProperties;if(i.size>0)for(let[s,o]of i){let{wrapped:n}=o,a=this[s];n!==!0||this._$AL.has(s)||a===void 0||this.C(s,void 0,o,a)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(t)):this._$EM()}catch(i){throw e=!1,this._$EM(),i}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};ee.elementStyles=[],ee.shadowRootOptions={mode:"open"},ee[rt("elementProperties")]=new Map,ee[rt("finalized")]=new Map,Oc?.({ReactiveElement:ee}),(Rt.reactiveElementVersions??=[]).push("2.1.2")});function oo(r,e){if(!Ir(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ys!==void 0?Ys.createHTML(e):e}function Ce(r,e,t=r,i){if(e===O)return e;let s=i!==void 0?t._$Co?.[i]:t._$Cl,o=ot(e)?void 0:e._$litDirective$;return s?.constructor!==o&&(s?._$AO?.(!1),o===void 0?s=void 0:(s=new o(r),s._$AT(r,t,i)),i!==void 0?(t._$Co??=[])[i]=s:t._$Cl=s),s!==void 0&&(e=Ce(r,s._$AS(r,e.values),s,i)),e}var Rr,Js,Mt,Ys,Ar,te,Mr,Tc,Se,st,ot,Ir,io,Er,it,Xs,Qs,$e,eo,to,so,Lr,c,H,Ch,O,u,ro,ke,no,nt,It,Ue,Ee,Lt,zt,Ot,Tt,ao,Nc,zr,J=w(()=>{Rr=globalThis,Js=r=>r,Mt=Rr.trustedTypes,Ys=Mt?Mt.createPolicy("lit-html",{createHTML:r=>r}):void 0,Ar="$lit$",te=`lit$${Math.random().toFixed(9).slice(2)}$`,Mr="?"+te,Tc=`<${Mr}>`,Se=document,st=()=>Se.createComment(""),ot=r=>r===null||typeof r!="object"&&typeof r!="function",Ir=Array.isArray,io=r=>Ir(r)||typeof r?.[Symbol.iterator]=="function",Er=`[
|
|
1
|
+
var xc=Object.defineProperty;var w=(r,e,t)=>()=>{if(t)throw t[0];try{return r&&(e=r(r=0)),e}catch(i){throw t=[i],i}};var vr=(r,e)=>{for(var t in e)xc(r,t,{get:e[t],enumerable:!0})};function Ts(r){return typeof r=="string"&&_e.includes(r)}function je(r,e){let t=_e.indexOf(r);return t!==-1&&t<=_e.indexOf(e)}var _e,yr=w(()=>{"use strict";_e=["admin","manage","triage","view","none"]});var Ns,wr,_r=w(()=>{"use strict";Ns=["dependencies","security"],wr={dependencies:"Dependencies",security:"Security"}});function Bs(r=null){let e=["anthropic/claude-opus-5.5","anthropic/claude-fable-5.1","anthropic/claude-sonnet-5.5","anthropic/claude-haiku-4.5","openai/gpt-6-astra","openai/gpt-6-astra-pro","openai/gpt-6.1-sol","openai/gpt-6.1-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"],t=r==="moonshot"?"moonshotai":r,i=e.filter(s=>!["anthropic","openai","moonshot"].includes(r??"")||s.startsWith(`${t}/`)).map(s=>({id:s,efforts:["low","medium","high","xhigh","max"]}));return{models:i,defaultModel:i[0].id}}var Ps=w(()=>{"use strict"});var Ds,js,Us,Fs=w(()=>{"use strict";Ps();Ds=Bs(),js=Object.freeze(Ds.models),Us=Ds.defaultModel});function $c(r){if(!r?.startsWith("#public="))return null;let e=/^#public=([A-Za-z0-9_-]+)\.([A-Za-z0-9_-]{43})$/u.exec(r);return e?{id:e[1],token:e[2]}:{id:"",token:""}}function Z(){return qs}function xr(r=qs){return`/api/shares/${encodeURIComponent(r.id)}/workspace`}var Hs,qs,kt=w(()=>{"use strict";Hs=globalThis.location?.hash,qs=$c(Hs);globalThis.addEventListener?.("hashchange",()=>{let r=globalThis.location?.hash;r?.startsWith("#public=")&&r!==Hs&&globalThis.location.reload()})});function xe(){return le?.user.role??null}function kc(r){if(r!==null&&!Ts(r))throw new TypeError(`Unknown managed preview role: ${r}. Expected ${_e.join(", ")}.`);St++,le=r===null?null:{user:{id:`preview:${r}`,login:r,name:r[0].toUpperCase()+r.slice(1),role:r,avatarUrl:null,lastSeenAt:Date.now(),lastActivityAt:null},csrfToken:null}}function Sc(r,e){let t=new URL(r,"http://managed-preview.invalid").pathname,i=(e?.method??"GET").toUpperCase();if(i==="POST"&&t==="/api/auth/logout")return Response.json({ok:!0});if(i!=="GET")throw new Error("Changes are not saved in the managed UI preview");if(t==="/api/auth/session")return Response.json(le);if(t==="/api/teams")return Response.json({teams:[]});if(t.startsWith("/api/admin/")&&!je(le.user.role,"manage"))return Response.json({error:"forbidden"},{status:403});if(["/api/admin/users","/api/admin/teams","/api/admin/repositories"].includes(t)&&le.user.role!=="admin")return Response.json({error:"forbidden"},{status:403});let s={"/api/admin/users":{users:[le.user]},"/api/admin/teams":{teams:[],users:[le.user],repos:[],permissions:Ns},"/api/admin/links":{shares:[]},"/api/admin/repositories":{repositories:[],total:0,connectedCount:0,installUrl:null,tokenMissing:!1},"/api/admin/reports":{reports:[],repos:[],maxBytes:26214400},"/api/admin/bundles":{bundles:[],repos:[],maxBytes:209715200},"/api/admin/history":{history:[],total:0,page:1,limit:100,filters:{repos:[],users:[]}},"/api/admin/scan/models":{models:js,defaultModel:Us},"/api/admin/scan-results":{bundles:[],results:[]}};return Object.hasOwn(s,t)?Response.json(s[t]):Response.json({error:"not-found"},{status:404})}async function Cc(r,e,t){let i=await t("/api/config",{credentials:"same-origin",signal:e.signal});if(!i.ok)return i;let s=(await i.json()).managed,o=s?.uploadChunkBytes;if(!Number.isSafeInteger(o)||o<=0||o>3*1024*1024)return t(r,e);let n=e.body,a=crypto.randomUUID(),l=r.endsWith("/reports")?"reports":"bundles",d=s?.uploadMaxBytes?.[l];if(Number.isSafeInteger(d)&&d>0&&n.size>d)return Response.json({error:"too-large"},{status:413});let m=Math.ceil(n.size/o),p=new Headers(e.headers);p.set("content-type","application/octet-stream");let h=0,f=!1;try{for(let v=0;v<m;v++){h=v+1;let b=await t(`/api/admin/uploads/${l}/${a}/${v}`,{...e,headers:p,body:n.slice(v*o,(v+1)*o)});if(!b.ok)return b}let g=new Headers(e.headers);g.set("x-upload-id",a),g.set("x-upload-parts",String(m)),g.set("x-upload-size",String(n.size));let y=await t(r,{...e,headers:g,body:""});return f=y.ok,y}finally{if(!f&&h>0){let g=new Headers(e.headers);g.set("x-upload-parts",String(h)),await t(`/api/admin/uploads/${l}/${a}`,{...e,method:"DELETE",headers:g,body:void 0,signal:AbortSignal.timeout(1e4)}).catch(()=>{})}}}async function $(r,e){if(e?.signal?.throwIfAborted(),le)return Sc(r,e);let t=St;async function i(s,o){if(t!==St)throw new DOMException("Managed session changed","AbortError");let n=Z();if(n){if(new URL(s,globalThis.location.origin).origin!==globalThis.location.origin)throw new Error("Public workspace requests must be same-origin");let d=new Headers(o?.headers);d.set("x-deepview-share",n.token),o={...o,headers:d,credentials:"omit",redirect:"error"}}let a=await fetch(s,{...o,cache:"no-store"});if(t!==St)throw new DOMException("Managed session changed","AbortError");return a}return e?.method==="POST"&&["/api/admin/reports","/api/admin/bundles"].includes(r)&&e.body instanceof Blob&&e.body.size>3*1024*1024?Cc(r,e,i):await i(r,e)}var le,St,B=w(()=>{"use strict";yr();_r();Fs();kt();le=null,St=0});var Ct,Et,$r,Vs,tt,x,I,Gs,kr,Sr=w(()=>{Ct=globalThis,Et=Ct.ShadowRoot&&(Ct.ShadyCSS===void 0||Ct.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,$r=Symbol(),Vs=new WeakMap,tt=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==$r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Et&&e===void 0){let i=t!==void 0&&t.length===1;i&&(e=Vs.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Vs.set(t,e))}return e}toString(){return this.cssText}},x=r=>new tt(typeof r=="string"?r:r+"",void 0,$r),I=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((i,s,o)=>i+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+r[o+1],r[0]);return new tt(t,r,$r)},Gs=(r,e)=>{if(Et)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let i=document.createElement("style"),s=Ct.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=t.cssText,r.appendChild(i)}},kr=Et?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let i of e.cssRules)t+=i.cssText;return x(t)})(r):r});var Ec,Rc,Ac,Mc,Ic,Lc,Rt,Ks,zc,Oc,rt,Cr,Zs,Ws,ee,At=w(()=>{Sr();Sr();({is:Ec,defineProperty:Rc,getOwnPropertyDescriptor:Ac,getOwnPropertyNames:Mc,getOwnPropertySymbols:Ic,getPrototypeOf:Lc}=Object),Rt=globalThis,Ks=Rt.trustedTypes,zc=Ks?Ks.emptyScript:"",Oc=Rt.reactiveElementPolyfillSupport,rt=(r,e)=>r,Cr={toAttribute(r,e){switch(e){case Boolean:r=r?zc:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Zs=(r,e)=>!Ec(r,e),Ws={attribute:!0,type:String,converter:Cr,reflect:!1,useDefault:!1,hasChanged:Zs};Symbol.metadata??=Symbol("metadata"),Rt.litPropertyMetadata??=new WeakMap;ee=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ws){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let i=Symbol(),s=this.getPropertyDescriptor(e,i,t);s!==void 0&&Rc(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){let{get:s,set:o}=Ac(this.prototype,e)??{get(){return this[t]},set(n){this[t]=n}};return{get:s,set(n){let a=s?.call(this);o?.call(this,n),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ws}static _$Ei(){if(this.hasOwnProperty(rt("elementProperties")))return;let e=Lc(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(rt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(rt("properties"))){let t=this.properties,i=[...Mc(t),...Ic(t)];for(let s of i)this.createProperty(s,t[s])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[i,s]of t)this.elementProperties.set(i,s)}this._$Eh=new Map;for(let[t,i]of this.elementProperties){let s=this._$Eu(t,i);s!==void 0&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let i=new Set(e.flat(1/0).reverse());for(let s of i)t.unshift(kr(s))}else e!==void 0&&t.push(kr(e));return t}static _$Eu(e,t){let i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.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(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Gs(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){let i=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,i);if(s!==void 0&&i.reflect===!0){let o=(i.converter?.toAttribute!==void 0?i.converter:Cr).toAttribute(t,i.type);this._$Em=e,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(e,t){let i=this.constructor,s=i._$Eh.get(e);if(s!==void 0&&this._$Em!==s){let o=i.getPropertyOptions(s),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:Cr;this._$Em=s;let a=n.fromAttribute(t,o.type);this[s]=a??this._$Ej?.get(s)??a,this._$Em=null}}requestUpdate(e,t,i,s=!1,o){if(e!==void 0){let n=this.constructor;if(s===!1&&(o=this[e]),i??=n.getPropertyOptions(e),!((i.hasChanged??Zs)(o,t)||i.useDefault&&i.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(n._$Eu(e,i))))return;this.C(e,t,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:s,wrapped:o},n){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,n??t??this[e]),o!==!0||n!==void 0)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),s===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[s,o]of this._$Ep)this[s]=o;this._$Ep=void 0}let i=this.constructor.elementProperties;if(i.size>0)for(let[s,o]of i){let{wrapped:n}=o,a=this[s];n!==!0||this._$AL.has(s)||a===void 0||this.C(s,void 0,o,a)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(t)):this._$EM()}catch(i){throw e=!1,this._$EM(),i}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};ee.elementStyles=[],ee.shadowRootOptions={mode:"open"},ee[rt("elementProperties")]=new Map,ee[rt("finalized")]=new Map,Oc?.({ReactiveElement:ee}),(Rt.reactiveElementVersions??=[]).push("2.1.2")});function oo(r,e){if(!Ir(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ys!==void 0?Ys.createHTML(e):e}function Ce(r,e,t=r,i){if(e===O)return e;let s=i!==void 0?t._$Co?.[i]:t._$Cl,o=ot(e)?void 0:e._$litDirective$;return s?.constructor!==o&&(s?._$AO?.(!1),o===void 0?s=void 0:(s=new o(r),s._$AT(r,t,i)),i!==void 0?(t._$Co??=[])[i]=s:t._$Cl=s),s!==void 0&&(e=Ce(r,s._$AS(r,e.values),s,i)),e}var Rr,Js,Mt,Ys,Ar,te,Mr,Tc,Se,st,ot,Ir,io,Er,it,Xs,Qs,$e,eo,to,so,Lr,c,H,Ch,O,u,ro,ke,no,nt,It,Ue,Ee,Lt,zt,Ot,Tt,ao,Nc,zr,J=w(()=>{Rr=globalThis,Js=r=>r,Mt=Rr.trustedTypes,Ys=Mt?Mt.createPolicy("lit-html",{createHTML:r=>r}):void 0,Ar="$lit$",te=`lit$${Math.random().toFixed(9).slice(2)}$`,Mr="?"+te,Tc=`<${Mr}>`,Se=document,st=()=>Se.createComment(""),ot=r=>r===null||typeof r!="object"&&typeof r!="function",Ir=Array.isArray,io=r=>Ir(r)||typeof r?.[Symbol.iterator]=="function",Er=`[
|
|
2
2
|
\f\r]`,it=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Xs=/-->/g,Qs=/>/g,$e=RegExp(`>|${Er}(?:([^\\s"'>=/]+)(${Er}*=${Er}*(?:[^
|
|
3
3
|
\f\r"'\`<>=]|("|')|))|$)`,"g"),eo=/'/g,to=/"/g,so=/^(?:script|style|textarea|title)$/i,Lr=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),c=Lr(1),H=Lr(2),Ch=Lr(3),O=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),ro=new WeakMap,ke=Se.createTreeWalker(Se,129);no=(r,e)=>{let t=r.length-1,i=[],s,o=e===2?"<svg>":e===3?"<math>":"",n=it;for(let a=0;a<t;a++){let l=r[a],d,m,p=-1,h=0;for(;h<l.length&&(n.lastIndex=h,m=n.exec(l),m!==null);)h=n.lastIndex,n===it?m[1]==="!--"?n=Xs:m[1]!==void 0?n=Qs:m[2]!==void 0?(so.test(m[2])&&(s=RegExp("</"+m[2],"g")),n=$e):m[3]!==void 0&&(n=$e):n===$e?m[0]===">"?(n=s??it,p=-1):m[1]===void 0?p=-2:(p=n.lastIndex-m[2].length,d=m[1],n=m[3]===void 0?$e:m[3]==='"'?to:eo):n===to||n===eo?n=$e:n===Xs||n===Qs?n=it:(n=$e,s=void 0);let f=n===$e&&r[a+1].startsWith("/>")?" ":"";o+=n===it?l+Tc:p>=0?(i.push(d),l.slice(0,p)+Ar+l.slice(p)+te+f):l+te+(p===-2?a:f)}return[oo(r,o+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]},nt=class r{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let o=0,n=0,a=e.length-1,l=this.parts,[d,m]=no(e,t);if(this.el=r.createElement(d,i),ke.currentNode=this.el.content,t===2||t===3){let p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(s=ke.nextNode())!==null&&l.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(let p of s.getAttributeNames())if(p.endsWith(Ar)){let h=m[n++],f=s.getAttribute(p).split(te),g=/([.?@])?(.*)/.exec(h);l.push({type:1,index:o,name:g[2],strings:f,ctor:g[1]==="."?Lt:g[1]==="?"?zt:g[1]==="@"?Ot:Ee}),s.removeAttribute(p)}else p.startsWith(te)&&(l.push({type:6,index:o}),s.removeAttribute(p));if(so.test(s.tagName)){let p=s.textContent.split(te),h=p.length-1;if(h>0){s.textContent=Mt?Mt.emptyScript:"";for(let f=0;f<h;f++)s.append(p[f],st()),ke.nextNode(),l.push({type:2,index:++o});s.append(p[h],st())}}}else if(s.nodeType===8)if(s.data===Mr)l.push({type:2,index:o});else{let p=-1;for(;(p=s.data.indexOf(te,p+1))!==-1;)l.push({type:7,index:o}),p+=te.length-1}o++}}static createElement(e,t){let i=Se.createElement("template");return i.innerHTML=e,i}};It=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:i}=this._$AD,s=(e?.creationScope??Se).importNode(t,!0);ke.currentNode=s;let o=ke.nextNode(),n=0,a=0,l=i[0];for(;l!==void 0;){if(n===l.index){let d;l.type===2?d=new Ue(o,o.nextSibling,this,e):l.type===1?d=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(d=new Tt(o,this,e)),this._$AV.push(d),l=i[++a]}n!==l?.index&&(o=ke.nextNode(),n++)}return ke.currentNode=Se,s}p(e){let t=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}},Ue=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,s){this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Ce(this,e,t),ot(e)?e===u||e==null||e===""?(this._$AH!==u&&this._$AR(),this._$AH=u):e!==this._$AH&&e!==O&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):io(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==u&&ot(this._$AH)?this._$AA.nextSibling.data=e:this.T(Se.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:i}=e,s=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=nt.createElement(oo(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(t);else{let o=new It(s,this),n=o.u(this.options);o.p(t),this.T(n),this._$AH=o}}_$AC(e){let t=ro.get(e.strings);return t===void 0&&ro.set(e.strings,t=new nt(e)),t}k(e){Ir(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,i,s=0;for(let o of e)s===t.length?t.push(i=new r(this.O(st()),this.O(st()),this,this.options)):i=t[s],i._$AI(o),s++;s<t.length&&(this._$AR(i&&i._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let i=Js(e).nextSibling;Js(e).remove(),e=i}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},Ee=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,s,o){this.type=1,this._$AH=u,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=o,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=u}_$AI(e,t=this,i,s){let o=this.strings,n=!1;if(o===void 0)e=Ce(this,e,t,0),n=!ot(e)||e!==this._$AH&&e!==O,n&&(this._$AH=e);else{let a=e,l,d;for(e=o[0],l=0;l<o.length-1;l++)d=Ce(this,a[i+l],t,l),d===O&&(d=this._$AH[l]),n||=!ot(d)||d!==this._$AH[l],d===u?e=u:e!==u&&(e+=(d??"")+o[l+1]),this._$AH[l]=d}n&&!s&&this.j(e)}j(e){e===u?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Lt=class extends Ee{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===u?void 0:e}},zt=class extends Ee{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==u)}},Ot=class extends Ee{constructor(e,t,i,s,o){super(e,t,i,s,o),this.type=5}_$AI(e,t=this){if((e=Ce(this,e,t,0)??u)===O)return;let i=this._$AH,s=e===u&&i!==u||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,o=e!==u&&(i===u||s);s&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Tt=class{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){Ce(this,e)}},ao={M:Ar,P:te,A:Mr,C:1,L:no,R:It,D:io,V:Ce,I:Ue,H:Ee,N:zt,U:Ot,B:Lt,F:Tt},Nc=Rr.litHtmlPolyfillSupport;Nc?.(nt,Ue),(Rr.litHtmlVersions??=[]).push("3.3.3");zr=(r,e,t)=>{let i=t?.renderBefore??e,s=i._$litPart$;if(s===void 0){let o=t?.renderBefore??null;i._$litPart$=s=new Ue(e.insertBefore(st(),o),o,void 0,t??{})}return s._$AI(r),s}});var Or,A,Bc,lo=w(()=>{At();At();J();J();Or=globalThis,A=class extends ee{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=zr(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return O}};A._$litElement$=!0,A.finalized=!0,Or.litElementHydrateSupport?.({LitElement:A});Bc=Or.litElementPolyfillSupport;Bc?.({LitElement:A});(Or.litElementVersions??=[]).push("4.2.2")});var co=w(()=>{});var S=w(()=>{At();J();lo();co()});function Nt(r){if(r._idBasis)return r._idBasis;let{severity:e,description:t}=r;return r.fileHash?{severity:e,description:t,fileHash:r.fileHash}:r.location?{severity:e,description:t,location:r.location}:{severity:e,description:t,file:r.file,line:r.line}}var Tr=w(()=>{});function Bt(r,e,t=e){let i=/^ */u.exec(r)[0].length;if(i>3)return null;if(e&&t&&Dc.test(r))return!0;let s=uo.exec(r);if(s&&!(s[2][0]==="`"&&s[3].includes("`")))return{fence:s[2]};let o=r.slice(i);for(let[l,d,m]of Uc){let p=l.exec(o);if(p)return{html:d,close:typeof m=="function"?m(p):m}}if(!e&&Fc.test(o))return{html:ho,close:null};let n=po.test(r)?null:Re.exec(r);if(n&&!(e&&t&&/^ *(?:\d*[02-9]|\d+\d)[.)]/u.test(n[0]))){let l=/ +$/u.exec(n[0])[0].length;return{item:l>4?n[0].length-l+1:n[0].length}}let a=po.test(r)||e&&t?null:jc.exec(r);return a?{item:a[0].trimEnd().length+1}:Pc.test(r)||null}function ce(r){return Nr(r).ranges}function Hc(r,e){let t=r.replace(/^(?: {0,3}> ?)+/u,""),i=Bt(t,e);for(;i?.item;)t=t.slice(i.item),i=Bt(t,!1);return t.trim()!==""&&!i&&/^ */u.exec(t)[0].length<4}function Nr(r){let e=[],t=-1,i="",s=null,o=0,n=[],a=!1,l=!1,d=!1,m=0;for(let h of r.split(`
|
|
4
4
|
`)){let f=m;m+=h.length+1;let g=/^ */u.exec(h)[0].length;if(t!==-1||s){let L=o>0&&h.trim()!==""&&g<o,R=!L&&(s?s.ends.test(h):g<=o+3&&mo(i,h));if((L||R)&&(t!==-1&&e.push([t,L?f-1:f+h.length]),t=-1,s=null),!L)continue}if(!h.trim()){d&&n.pop(),d=!1,a=!1;continue}let y=n.length;for(;y>0&&g<n[y-1];)y--;let v=y>0?n[y-1]:0,b=h.slice(v),k=Bt(b,a,y===n.length&&!l);if(a&&!k)continue;for(n.length=y;k?.item;)v+=k.item,b=b.slice(k.item),n.push(v),k=Bt(b,!1);d=b.trim()==="",k?.fence?[t,i,o]=[f,k.fence,v]:k?.html&&([s,o]=[k.html.test(b)?null:{ends:k.html,close:k.close},v]);let E=a&&l;l=/^ {0,3}>/u.test(b),a=l?Hc(b,E):!k&&!d&&/^ */u.exec(b)[0].length<4}t!==-1&&e.push([t,r.length]);let p=t===-1?s?.close:i;return{ranges:e,closer:p?" ".repeat(o)+p:null}}function mo(r,e){let t=uo.exec(e);return t!==null&&t[2][0]===r[0]&&t[2].length>=r.length&&!t[3].trim()}function Ae(r,e){let t=0,i=r.length;for(;t<i;){let s=t+i>>>1;r[s][1]<=e?t=s+1:i=s}return t<r.length&&e>=r[t][0]}var uo,Pc,po,Dc,Re,jc,ho,Uc,Fc,Br=w(()=>{uo=/^( *)(`{3,}|~{3,})(.*)$/u,Pc=/^ {0,3}(?:#{1,6}(?:[ \t]|$)|>|([-*_])(?:[ \t]*\1){2,}[ \t]*$)/u,po=/^ {0,3}([-*_])(?:[ \t]*\1){2,}[ \t]*$/u,Dc=/^ {0,3}(?:=+|-+)[ \t]*$/u,Re=/^( *)(?:[-*+]|\d{1,9}[.)]) +(?=\S)/u,jc=/^ *(?:[-*+]|\d{1,9}[.)])[ \t]*$/u,ho=/^\s*$/u,Uc=[[/^<(script|pre|textarea|style)(?:\s|>|$)/iu,/<\/(?:script|pre|textarea|style)>/iu,r=>`</${r[1].toLowerCase()}>`],[/^<!--/u,/-->/u,"-->"],[/^<\?/u,/\?>/u,"?>"],[/^<![A-Za-z]/u,/>/u,"<!-- -->"],[/^<!\[CDATA\[/u,/\]\]>/u,"]]>"],[/^<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|search|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/iu,ho,null]],Fc=/^(?:<[A-Za-z][\dA-Za-z-]*(?:\s+[:A-Z_a-z][\w.:-]*(?:\s*=\s*(?:[^\s"'<=>`]+|'[^']*'|"[^"]*"))?)*\s*\/?>|<\/[A-Za-z][\dA-Za-z-]*\s*>)\s*$/u});function re(r){return String(r??"").replaceAll(/\r\n?/gu,`
|
|
@@ -47,8 +47,8 @@ ${d.rest}`:d.rest||v||d.id}let h=t.get(m),{severity:f,identitySeverity:g}=pt(me(
|
|
|
47
47
|
`).trim(),b=ri({ref:ei.map(R=>d[R]).find(Boolean)??"",lineBullet:g,id:o,severity:h,identitySeverity:f,description:sp(n||o,d,m,v)}),k=d["poc status"]||d.poc||l?.pocStatus;k&&(b.pocStatus=k);let E=d["detailed report"]||(a.endsWith("report.md")?a:"");E&&(b.reportPath=E),l?.status&&(b.status=l.status);let L=l?.parent||(y?ht(y[1]):"");return L&&(b.parent=L),{id:o,finding:U(b)}}function rp(r){let e=Object.create(null);for(let{heading:t,body:i}of r){let s=t.trim().toLowerCase();s&&(e[s]=s in e?`${e[s]}
|
|
48
48
|
${i}`:i)}return e}function sp(r,e,t,i){let s=[r];e.summary&&s.push(e.summary),i&&s.push(i);for(let[o,n]of Object.entries(e))!n||ip.has(o)||s.push(`**${t[o]||o}:** ${n}`);return s.filter(Boolean).join(`
|
|
49
49
|
|
|
50
|
-
`)}var Jd,Yd,ip,dn=w(()=>{Y();he();nn();ti();Jd=new Set(["technical findings detail","technical findings","detailed findings","findings detail","findings"]),Yd=/^(?:summary of findings\b|deferred|methodolog|executive|conclusion|attack surface|coverage|discoveries|scope\b|table of contents|contents\b|appendix|recommendation|remediation)/u;ip=new Set([...ei,"severity","summary","files","poc","poc status","line","lines","detailed report","proof of concept","evidence","variant of","pattern","status","id","title"])});function Ve(r){return Array.isArray(r?.findings)?r.findings:Array.isArray(r?.groups)?r.groups:null}function pn(r){let e;try{let t=JSON.parse(r);if(Ve(t)){for(let i of np(Ve(t)))U(i);return{data:t,format:"json",reason:null}}return{data:null,format:null,reason:"JSON, but not a report: no findings array"}}catch(t){e=t}for(let[t,i]of op){let s=i(r);if(s)return{data:s,format:t,reason:null}}return{data:null,format:null,reason:`Not JSON, and not a recognized markdown format. (JSON error: ${e.message})`}}function np(r){return r.flat().filter(e=>e&&typeof e=="object")}var op,mt=w(()=>{Eo();Ko();en();dn();he();Wr();dt();op=[["deepview-md",Go],["deepsec",Co],["piolium",ln],["claude-security",Xo]]});function ap(r){C.setSession(r)}function lp(r){return C.setReportCatalog(r)}function cp(){C.reset()}var ai,C,ie=w(()=>{"use strict";ai=class{constructor(e=()=>{}){this.resources=new Map,this.session=null,this.teamCatalog=null,this.reportCatalog=null,this.bundleCatalog=null,this.generation=0,this.sessionController=new AbortController,this.notify=e}setSession(e){(this.session?.id!==e?.id||this.session?.role!==e?.role)&&this.reset(),this.session=e}reset(){this.generation++,this.sessionController.abort(),this.sessionController=new AbortController,this.invalidate(),this.session=null,this.teamCatalog=null,this.reportCatalog=null,this.bundleCatalog=null}setReportCatalog(e){let t=new Set,i=new Map(e.map(p=>[p.id,JSON.stringify([p.cacheKey??null,p.reports.map(h=>[h.id,h.cacheKey??null]).toSorted(),(p.bundles??[]).map(h=>[h.id,h.filename,h.repoFullName,h.repoDirectory??""]).toSorted()])]));for(let p of new Set([...this.teamCatalog?.keys()??[],...i.keys()]))this.teamCatalog?.get(p)!==i.get(p)&&t.add(`team:${p}`);for(let p of this.resources.keys()){let h="reports:content:team:";if(p.startsWith(h)){let f=p.slice(h.length);(!i.has(f)||this.teamCatalog?.get(f)!==i.get(f))&&this.invalidate([p])}}this.teamCatalog=i;let s=new Map;for(let p of e)for(let h of p.reports){let f=s.get(h.id)??[];f.push(JSON.stringify([p.id,h.cacheKey??null])),s.set(h.id,f)}let o=new Map([...s].map(([p,h])=>[p,JSON.stringify(h.toSorted())])),n=this.reportCatalog;this.reportCatalog=o;let a=new Set(t);for(let p of new Set([...n?.keys()??[],...o.keys()]))n?.get(p)!==o.get(p)&&a.add(p);for(let p of this.resources.keys()){if(!p.startsWith("reports:content:")||p.startsWith("reports:content:team:"))continue;let h=p.slice(16);(!o.has(h)||a.has(h))&&(this.invalidate([p]),a.add(h))}let l=new Map;for(let p of e)for(let h of p.bundles??[]){let f=l.get(h.id)??[];f.push(JSON.stringify([p.id,p.cacheKey??null,h.filename,h.repoFullName,h.repoDirectory??""])),l.set(h.id,f)}let d=!1,m=new Map([...l].map(([p,h])=>[p,JSON.stringify(h.toSorted())]));for(let p of new Set([...this.bundleCatalog?.keys()??[],...m.keys()]))this.bundleCatalog?.get(p)!==m.get(p)&&(d=!0,a.add(`bundle:${p}`),this.invalidate([`bundle-metadata:${p}`]));this.bundleCatalog=m;for(let p of this.resources.keys()){if(!p.startsWith("report-sources:")&&!p.startsWith("finding-history:"))continue;let[,h,f]=p.split(":");(h?t.has(`team:${h}`):d||a.has(f))&&this.invalidate([p])}return a}read(e){return this.resources.get(e)?.data}invalidate(e){for(let[t,i]of this.resources)e&&!e.some(s=>t===s||t.startsWith(`${s}:`))||(i.controller?.abort(),this.resources.delete(t))}async mutate(e,t){let i=this.generation,s;try{s=await e()}catch(o){throw i===this.generation&&o?.name!=="AbortError"&&this.notify(`Couldn't save changes: ${o?.message??o}`),o}if(i!==this.generation)throw new DOMException("Managed session changed","AbortError");return this.invalidate(t),s}async load(e,t,i,{signal:s,apply:o=()=>{}}={}){s?.throwIfAborted();let n=this.resources.get(e);if(n||(n={},this.resources.set(e,n)),n.data!==void 0&&o(n.data),!n.pending){let l=n.controller=new AbortController;n.pending=(async()=>{try{let d=await i(l.signal);return l.signal.throwIfAborted(),n.data=d,d}catch(d){throw!l.signal.aborted&&d?.name!=="AbortError"&&this.notify(`Couldn't refresh ${t}: ${d?.message??d}`),d}})().finally(()=>{n.pending=null})}let a=await n.pending;if(s?.throwIfAborted(),this.resources.get(e)!==n)throw new DOMException("Managed data changed","AbortError");return o(a),a}},C=new ai(r=>{document.dispatchEvent(new CustomEvent("managed-notice",{detail:{message:r}}))})});var G,fe,X,ft=w(()=>{G={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},fe=r=>(...e)=>({_$litDirective$:r,values:e}),X=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}});var un,ge,hn,mn,Ge,Qt,fn,gn,bn,vn,yn,be=w(()=>{"use strict";un="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",ge='<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>',hn='<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>',mn='<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>',Ge='<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>',Qt='<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>',fn='<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>',gn='<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>',bn='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" aria-hidden="true"><path d="M1 8h3.5m7 0H15"/><circle cx="8" cy="8" r="3.5"/></svg>',vn='<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>',yn='<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 up,_n,$n,xn,Ke,ve,hp,We,kn,er,tr=w(()=>{J();({I:up}=ao),_n=r=>r,$n=r=>r.strings===void 0,xn=()=>document.createComment(""),Ke=(r,e,t)=>{let i=r._$AA.parentNode,s=e===void 0?r._$AB:e._$AA;if(t===void 0){let o=i.insertBefore(xn(),s),n=i.insertBefore(xn(),s);t=new up(o,n,r,r.options)}else{let o=t._$AB.nextSibling,n=t._$AM,a=n!==r;if(a){let l;t._$AQ?.(r),t._$AM=r,t._$AP!==void 0&&(l=r._$AU)!==n._$AU&&t._$AP(l)}if(o!==s||a){let l=t._$AA;for(;l!==o;){let d=_n(l).nextSibling;_n(i).insertBefore(l,s),l=d}}}return t},ve=(r,e,t=r)=>(r._$AI(e,t),r),hp={},We=(r,e=hp)=>r._$AH=e,kn=r=>r._$AH,er=r=>{r._$AR(),r._$AA.remove()}});function Ki(r){return typeof r=="string"&&/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/u.test(r)?r:null}var Wi=w(()=>{"use strict"});var pr,$l=w(()=>{J();ft();tr();pr=fe(class extends X{constructor(){super(...arguments),this.key=u}render(r,e){return this.key=r,e}update(r,[e,t]){return e!==this.key&&(We(r),this.key=e),t}})});var ls=w(()=>{$l()});var $v,kv,Sv,Ol=w(()=>{"use strict";S();$v=document.querySelector("#drop-zone"),kv=document.querySelector("#report"),Sv=document.querySelector("app-sidebar")});function xs(r=document){if(r.querySelector(":modal"))return!0;for(let e of r.querySelectorAll("*"))if(e.shadowRoot&&xs(e.shadowRoot))return!0;return!1}var Tl=w(()=>{"use strict"});function Tu(){return V||(V=document.createElement("div"),V.id="styled-tooltip",V.setAttribute("popover","manual"),document.body.append(V),V)}function Nu(r){typeof r.showPopover=="function"&&(r.matches(":popover-open")&&r.hidePopover(),r.showPopover())}function ju(r,{placement:e="cursor"}={}){e=r.dataset.tooltipPlacement??e;let t=Tu(),i=r.dataset.tooltip??"",s=r.dataset.tooltipRepo??"",o=Ki(r.dataset.tooltipCommit),n=["stasis","sourcemap"].includes(r.dataset.tooltipBundle)?r.dataset.tooltipBundle:"",a=r.dataset.tooltipStats??"",l=r.dataset.tooltipPackage??"",d=r.dataset.tooltipEcosystem??"",m=r.dataset.tooltipVersion??"",p=r.dataset.tooltipFiles??"",h=JSON.stringify([i,s,o,n,a,l,d,m,p]);if(!i||hr===r&&Nl===h)return;if(t.textContent=i,l){let R=document.createElement("div");R.className="tooltip-package";let M=r.querySelector("svg")?.cloneNode(!0);M&&R.append(M);let j=document.createElement("span");j.className="tooltip-package-details";for(let et of[l,m,/^\d+$/u.test(p)?`${p} ${p==="1"?"file":"files"}`:""].filter(Boolean)){let Os=document.createElement("span");Os.textContent=et,j.append(Os)}R.append(j),t.append(R)}if(s||o){let R=document.createElement("div");if(R.className="tooltip-repo",s){R.innerHTML=gn;let M=document.createElement("span");M.textContent=s,R.append(M)}if(o){let M=document.createElement("span");M.className="tooltip-commit",M.innerHTML=bn;let j=document.createElement("span");j.textContent=o.slice(0,7),M.append(j),R.append(M)}t.append(R)}if(n||a){let R=document.createElement("div");if(R.className="tooltip-bundle",n==="stasis"){let et=document.createElement("img");et.src="./stasis.svg",et.alt="",R.append(et)}else R.innerHTML=ge;let M=document.createElement("span"),j=n==="stasis"?"Stasis":n==="sourcemap"?"Sourcemap":"";M.textContent=[j,a].filter(Boolean).join(" \xB7 "),R.append(M),t.append(R)}Nu(t),t.style.left="0px",t.style.top="0px",t.style.transform="none",t.classList.add("visible");let f=jl,g=Ul+Pu;if(e==="right"||e==="right-start"){let R=r.getBoundingClientRect();f=R.right+Du,g=R.top+(e==="right"?R.height/2:0)}let y=window.innerWidth-t.offsetWidth-ur,v=Math.max(ur,Math.min(f,y));t.style.left=`${Math.round(v)}px`;let b=t.offsetHeight,k=e==="right"?g-b/2:g,E=window.innerHeight-b-ur,L=Math.max(ur,Math.min(k,E));t.style.top=`${Math.round(L)}px`,hr=r,Nl=h}function Bl(){clearTimeout(mr),mr=null,V&&(V.classList.remove("visible"),typeof V.hidePopover=="function"&&V.matches(":popover-open")&&V.hidePopover()),hr=null}function Uu(r,{gate:e,placement:t}={}){Object.hasOwn(r.dataset,"tooltipTruncated")&&r.scrollWidth<=r.clientWidth&&r.scrollHeight<=r.clientHeight||e&&!e(r)||(clearTimeout(mr),mr=setTimeout(()=>{ju(r,{placement:t})},Bu))}function Dl(r,e){for(let t of r.composedPath()){if(t===e)break;if(t.nodeType===1&&Object.hasOwn(t.dataset,"tooltip"))return t}return null}function Fl(r,e){!r||Pl.has(r)||(Pl.add(r),r.addEventListener("mouseover",t=>{let i=Dl(t,r);if(!i){Bl();return}i!==hr&&Uu(i,e)}),r.addEventListener("mouseout",t=>{let i=Dl(t,r),s=t.relatedTarget?.closest?.("[data-tooltip]")??null;i&&i===s||Bl()}))}var V,hr,Nl,mr,jl,Ul,Bu,Pu,Du,ur,Pl,Hl=w(()=>{"use strict";be();Wi();hr=null,Nl="",mr=null,jl=0,Ul=0;document.addEventListener("mousemove",r=>{jl=r.clientX,Ul=r.clientY},{passive:!0});Bu=100,Pu=14,Du=8,ur=8;Pl=new WeakSet});var Vl,ql=w(()=>{Vl=`a{cursor:default}*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}button,summary,select,label,legend,header h3,.section-title,.ui-hint,.hint,.note,.lwd-note,.lwd-empty,.empty:not(.error,[role=alert]),.empty-discussion,.history-state[role=status],.history-summary{cursor:default;user-select:none;-webkit-user-select:none}input:not([type=checkbox],[type=radio]),textarea,[contenteditable],pre,code,.mono{cursor:text;user-select:text;-webkit-user-select:text}dialog{margin-top:5rem;margin-inline:auto;border:1px solid var(--border);border-radius:var(--ui-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:var(--ui-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:var(--ui-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}}
|
|
51
|
-
`});function Qe(r,e={}){return new Promise(t=>{let i=document.createElement(r);Object.assign(i,e),i.addEventListener("resolve",s=>{i.remove(),t(s.detail)}),document.body.append(i)})}var W,fr=w(()=>{"use strict";S();Ol();Tl();Hl();ql();W=class extends A{static styles=[x(Vl)];exclusive=!1;firstUpdated(){Fl(this.renderRoot),this.beforeOpen();let e=this.renderRoot.querySelector("dialog");if(e){if(this.exclusive&&xs()){this._conflict(new DOMException("Another modal dialog is already open","InvalidStateError"));return}try{e.showModal()}catch(t){this._conflict(t);return}this.focusInitial()}}_conflict(e){this._settled=!0,this.dispatchEvent(new CustomEvent("modal-conflict",{detail:{cause:e}}))}beforeOpen(){}focusInitial(){(this.renderRoot.querySelector("input, textarea")??this.renderRoot.querySelector("button.primary")??this.renderRoot.querySelector("button"))?.focus()}_finish(e){this._settled||(this._settled=!0,this.renderRoot.querySelector("dialog")?.close(),this.dispatchEvent(new CustomEvent("resolve",{detail:e})))}_onClose=()=>this._finish(null)}});async function ae(r,e=null,t={}){let i;try{i=await $(r,{credentials:"same-origin",headers:{accept:"application/json"},...t})}catch{return e}if(i.status===401||i.status===403)return null;if(!i.ok)return e;try{return await i.json()}catch{return e}}async function Fv({fallback:r=null}={}){let e;try{let i=Z(),s=await $(i?xr(i):"/api/auth/session",{credentials:"same-origin",headers:{accept:"application/json"}});if(s.status===401||s.status===403)return null;if(!s.ok)return r;e=await s.json()}catch{return r}let t=e?.user;return t===null?null:t===void 0||typeof t.login!="string"?r:{id:t.id,login:t.login,name:typeof t.name=="string"?t.name:null,avatarUrl:typeof t.avatarUrl=="string"?t.avatarUrl:null,role:typeof t.role=="string"?t.role:"none",csrfToken:typeof e.csrfToken=="string"?e.csrfToken:null,...Z()?{publicShare:!0}:{}}}async function Hv({fallback:r=[],signal:e,onRevision:t}={}){let i=Z(),s=i?await ae(xr(i),null,{signal:e}):null,o=i?{teams:s?.team?[s.team]:[]}:await ae("/api/teams",{teams:r},{signal:e}),n=o?.teams;return Array.isArray(n)?(t?.(typeof o.revision=="string"?o.revision:null),n.filter(a=>a!=null&&typeof a.id=="string"&&typeof a.name=="string").map(a=>({id:a.id,slug:a.slug,name:a.name,...typeof a.cacheKey=="string"?{cacheKey:a.cacheKey}:{},reports:Array.isArray(a.reports)?a.reports.filter(l=>l!=null&&typeof l.id=="string"&&typeof l.filename=="string").map(l=>({id:l.id,slug:l.slug,filename:l.filename,...l.analyzer===null||typeof l.analyzer=="string"?{analyzer:l.analyzer}:{},repoFullName:typeof l.repoFullName=="string"?l.repoFullName:"",repoDirectory:typeof l.repoDirectory=="string"?l.repoDirectory:"",...typeof l.cacheKey=="string"?{cacheKey:l.cacheKey}:{}})):[],bundles:Array.isArray(a.bundles)?a.bundles.filter(l=>l!=null&&typeof l.id=="string"&&typeof l.filename=="string").map(l=>({id:l.id,slug:l.slug,integrity:l.integrity,byteSize:l.byteSize,repoId:l.repoId,filename:l.filename,kind:l.kind,summary:l.summary??null,summaryRetryAt:Number.isSafeInteger(l.summaryRetryAt)&&l.summaryRetryAt>0?l.summaryRetryAt:null,repoDirectory:typeof l.repoDirectory=="string"?l.repoDirectory:"",repoFullName:typeof l.repoFullName=="string"?l.repoFullName:""})):[]}))):o==null?[]:r}function $s(r){return Ve(r?.data)===null||typeof r.repo?.directory!="string"||r.repo.github!==null&&typeof r.repo.github!="string"?null:{data:r.data,repo:r.repo}}async function Gl(r,{signal:e}={}){return $s(await ae(`/api/reports/${encodeURIComponent(r)}`,null,{signal:e}))}async function Kl(r,{signal:e}={}){let t=[...new Set(r)];if(t.length===0)return[];let i=await ae("/api/reports/query",null,{method:"POST",signal:e,headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({ids:t})});if(!Array.isArray(i?.reports)||i.reports.length!==t.length)return null;let s=new Map;for(let o of i.reports){let n=$s(o);if(!n||!t.includes(o.id)||s.has(o.id))return null;s.set(o.id,n)}return r.map(o=>s.get(o))}async function Wl(r,{signal:e}={}){let t=await ae(`/api/teams/${encodeURIComponent(r)}/reports`,null,{signal:e});if(!Array.isArray(t?.reports))return null;let i=[],s=new Set;for(let o of t.reports){let n=$s(o);if(!n||typeof o.id!="string"||typeof o.filename!="string"||s.has(o.id))return null;s.add(o.id),i.push({id:o.id,filename:o.filename,...n})}return i}function De(r){return r?`?team=${encodeURIComponent(r)}`:""}async function qv(r,{reportId:e,...t}={}){let i=e==null?"":`?reportId=${encodeURIComponent(e)}`,s=await ae(`/api/teams/${encodeURIComponent(r)}/annotations${i}`,null,t),{reports:o,entries:n,comments:a}=s??{};if(!o||typeof o!="object"||Array.isArray(o)||!n||typeof n!="object"||Array.isArray(n)||!Array.isArray(a)||Object.values(o).some(p=>!Array.isArray(p)||p.some(h=>typeof h!="string"))||a.some(p=>!p||typeof p.findingId!="string"))return null;let l=new Map;for(let[p,h]of a.entries()){let f=h.findingId,g=l.get(f)??[];g.push(p),l.set(f,g)}let d=new Map,m=new Map;return p=>{if(!Object.hasOwn(o,p))return null;if(m.has(p))return m.get(p);let h=JSON.stringify(o[p]),f=d.get(h);if(!f){let g=[...new Set(o[p])],y=g.flatMap(v=>l.get(v)??[]);f={entries:Object.fromEntries(g.filter(v=>Object.hasOwn(n,v)).map(v=>[v,n[v]])),comments:y.toSorted((v,b)=>v-b).map(v=>a[v])},d.set(h,f)}return m.set(p,f),f}}async function Vv(r,e,t){let s=(await ae(`/api/reports/${encodeURIComponent(r)}/triage${De(e)}`,null,t))?.entries;return s!=null&&typeof s=="object"&&!Array.isArray(s)?s:null}async function Gv(r,e){if(Z())return[];let t=await ae(`/api/teams/${encodeURIComponent(r)}/fixes`,null,{signal:e});return Array.isArray(t?.fixes)?t.fixes:null}async function Kv(r,e,t){let i=await ae(`/api/reports/${encodeURIComponent(r)}/comments${De(e)}`,null,t);return Array.isArray(i?.comments)?i.comments:null}async function Wv(r,{findingId:e,body:t,commentId:i=null,version:s},o,n){let a=i==null?"":`/${encodeURIComponent(i)}`;try{let l=await $(`/api/reports/${encodeURIComponent(r)}/comments${a}${De(n)}`,{method:i==null?"POST":"PATCH",credentials:"same-origin",headers:{"content-type":"application/json",...o?{"x-csrf-token":o}:{}},body:JSON.stringify(i==null?{findingId:e,body:t}:{body:t,version:s})});return{status:l.status,comment:l.ok?(await l.json()).comment:null}}catch{return{status:0,comment:null}}}async function Zv(r,e,t,i,s){try{return(await $(`/api/reports/${encodeURIComponent(r)}/comments/${encodeURIComponent(e)}${De(s)}`,{method:"DELETE",credentials:"same-origin",headers:{"content-type":"application/json",...i?{"x-csrf-token":i}:{}},body:JSON.stringify({version:t})})).status}catch{return 0}}async function Jv(r,e,t,i){try{return(await $(`/api/reports/${encodeURIComponent(r)}/triage${De(i)}`,{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json",...t?{"x-csrf-token":t}:{}},body:JSON.stringify({entries:e})})).status}catch{return 0}}function Yv(r){r&&(location.href=r)}async function Xv(r){if(Z()){location.href="/";return}try{await $("/api/auth/logout",{method:"POST",credentials:"same-origin",headers:r?{"x-csrf-token":r}:{}})}catch{}location.reload()}async function Zl(r){let e=await $(`/api/teams/${encodeURIComponent(r)}/share`,{credentials:"same-origin"});if(!e.ok)throw new Error(`Could not load public links (${e.status})`);return(await e.json()).shares}async function Jl(r,e,{id:t,revoke:i=!1,dependencies:s=!1,security:o=!1}={}){let n=t?`/${encodeURIComponent(t)}`:"",a=await $(`/api/teams/${encodeURIComponent(r)}/share${n}`,{method:i?"DELETE":t?"PATCH":"POST",credentials:"same-origin",headers:{"x-csrf-token":e,"content-type":"application/json"},...i?{}:{body:JSON.stringify({dependencies:s,security:o})}});if(!a.ok)throw new Error(`Could not ${i?"revoke":t?"update":"create"} public link (${a.status})`);return a.json()}async function Qv(r,e){let t=await $(`/api/bundles/${encodeURIComponent(r)}/download`,{credentials:"same-origin"});if(!t.ok)throw new Error(`Could not download bundle (${t.status})`);let i=URL.createObjectURL(await t.blob()),s=document.createElement("a");s.href=i,s.download=e,s.click(),setTimeout(()=>URL.revokeObjectURL(i),6e4)}var $t=w(()=>{"use strict";B();kt();mt()});var Xl,Yl=w(()=>{Xl=`.share-field{display:grid;gap:.35rem;margin-top:.8rem;font-size:.82rem}fieldset{display:grid;gap:.55rem;border:0;margin-top:1rem;font-size:.82rem}legend{margin-bottom:.55rem;font-weight:600}fieldset label{display:flex;align-items:center;gap:.5rem}input[type=checkbox]{accent-color:var(--accent)}.nwd-actions{flex-wrap:wrap}.revoke-all{margin-top:.75rem;border:0;background:none;color:var(--muted);font:inherit;font-size:.74rem}.revoke-all:hover:not(:disabled){color:var(--critical)}
|
|
50
|
+
`)}var Jd,Yd,ip,dn=w(()=>{Y();he();nn();ti();Jd=new Set(["technical findings detail","technical findings","detailed findings","findings detail","findings"]),Yd=/^(?:summary of findings\b|deferred|methodolog|executive|conclusion|attack surface|coverage|discoveries|scope\b|table of contents|contents\b|appendix|recommendation|remediation)/u;ip=new Set([...ei,"severity","summary","files","poc","poc status","line","lines","detailed report","proof of concept","evidence","variant of","pattern","status","id","title"])});function Ve(r){return Array.isArray(r?.findings)?r.findings:Array.isArray(r?.groups)?r.groups:null}function pn(r){let e;try{let t=JSON.parse(r);if(Ve(t)){for(let i of np(Ve(t)))U(i);return{data:t,format:"json",reason:null}}return{data:null,format:null,reason:"JSON, but not a report: no findings array"}}catch(t){e=t}for(let[t,i]of op){let s=i(r);if(s)return{data:s,format:t,reason:null}}return{data:null,format:null,reason:`Not JSON, and not a recognized markdown format. (JSON error: ${e.message})`}}function np(r){return r.flat().filter(e=>e&&typeof e=="object")}var op,mt=w(()=>{Eo();Ko();en();dn();he();Wr();dt();op=[["deepview-md",Go],["deepsec",Co],["piolium",ln],["claude-security",Xo]]});function ap(r){C.setSession(r)}function lp(r){return C.setReportCatalog(r)}function cp(){C.reset()}var ai,C,ie=w(()=>{"use strict";ai=class{constructor(e=()=>{}){this.resources=new Map,this.session=null,this.teamCatalog=null,this.reportCatalog=null,this.bundleCatalog=null,this.generation=0,this.sessionController=new AbortController,this.notify=e}setSession(e){(this.session?.id!==e?.id||this.session?.role!==e?.role)&&this.reset(),this.session=e}reset(){this.generation++,this.sessionController.abort(),this.sessionController=new AbortController,this.invalidate(),this.session=null,this.teamCatalog=null,this.reportCatalog=null,this.bundleCatalog=null}setReportCatalog(e){let t=new Set,i=new Map(e.map(p=>[p.id,JSON.stringify([p.cacheKey??null,p.reports.map(h=>[h.id,h.cacheKey??null]).toSorted(),(p.bundles??[]).map(h=>[h.id,h.filename,h.repoFullName,h.repoDirectory??""]).toSorted()])]));for(let p of new Set([...this.teamCatalog?.keys()??[],...i.keys()]))this.teamCatalog?.get(p)!==i.get(p)&&t.add(`team:${p}`);for(let p of this.resources.keys()){let h="reports:content:team:";if(p.startsWith(h)){let f=p.slice(h.length);(!i.has(f)||this.teamCatalog?.get(f)!==i.get(f))&&this.invalidate([p])}}this.teamCatalog=i;let s=new Map;for(let p of e)for(let h of p.reports){let f=s.get(h.id)??[];f.push(JSON.stringify([p.id,h.cacheKey??null])),s.set(h.id,f)}let o=new Map([...s].map(([p,h])=>[p,JSON.stringify(h.toSorted())])),n=this.reportCatalog;this.reportCatalog=o;let a=new Set(t);for(let p of new Set([...n?.keys()??[],...o.keys()]))n?.get(p)!==o.get(p)&&a.add(p);for(let p of this.resources.keys()){if(!p.startsWith("reports:content:")||p.startsWith("reports:content:team:"))continue;let h=p.slice(16);(!o.has(h)||a.has(h))&&(this.invalidate([p]),a.add(h))}let l=new Map;for(let p of e)for(let h of p.bundles??[]){let f=l.get(h.id)??[];f.push(JSON.stringify([p.id,p.cacheKey??null,h.filename,h.repoFullName,h.repoDirectory??""])),l.set(h.id,f)}let d=!1,m=new Map([...l].map(([p,h])=>[p,JSON.stringify(h.toSorted())]));for(let p of new Set([...this.bundleCatalog?.keys()??[],...m.keys()]))this.bundleCatalog?.get(p)!==m.get(p)&&(d=!0,a.add(`bundle:${p}`),this.invalidate([`bundle-metadata:${p}`]));this.bundleCatalog=m;for(let p of this.resources.keys()){if(!p.startsWith("report-sources:")&&!p.startsWith("finding-history:"))continue;let[,h,f]=p.split(":");(h?t.has(`team:${h}`):d||a.has(f))&&this.invalidate([p])}return a}read(e){return this.resources.get(e)?.data}invalidate(e){for(let[t,i]of this.resources)e&&!e.some(s=>t===s||t.startsWith(`${s}:`))||(i.controller?.abort(),this.resources.delete(t))}async mutate(e,t){let i=this.generation,s;try{s=await e()}catch(o){throw i===this.generation&&o?.name!=="AbortError"&&this.notify(`Couldn't save changes: ${o?.message??o}`),o}if(i!==this.generation)throw new DOMException("Managed session changed","AbortError");return this.invalidate(t),s}async load(e,t,i,{signal:s,apply:o=()=>{},retryInvalidated:n=!1}={}){let a=this.generation;for(;;){s?.throwIfAborted();let l=this.resources.get(e);if(l||(l={},this.resources.set(e,l)),l.data!==void 0&&o(l.data),!l.pending){let d=l.controller=new AbortController;l.pending=(async()=>{try{let m=await i(d.signal);return d.signal.throwIfAborted(),l.data=m,m}catch(m){throw!d.signal.aborted&&m?.name!=="AbortError"&&this.notify(`Couldn't refresh ${t}: ${m?.message??m}`),m}})().finally(()=>{l.pending=null})}try{let d=await l.pending;if(s?.throwIfAborted(),this.resources.get(e)!==l)throw new DOMException("Managed data changed","AbortError");return o(d),d}catch(d){if(!n||d?.name!=="AbortError"||s?.aborted||a!==this.generation||this.resources.get(e)===l)throw d}}}},C=new ai(r=>{document.dispatchEvent(new CustomEvent("managed-notice",{detail:{message:r}}))})});var G,fe,X,ft=w(()=>{G={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},fe=r=>(...e)=>({_$litDirective$:r,values:e}),X=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}});var un,ge,hn,mn,Ge,Qt,fn,gn,bn,vn,yn,be=w(()=>{"use strict";un="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",ge='<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>',hn='<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>',mn='<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>',Ge='<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>',Qt='<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>',fn='<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>',gn='<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>',bn='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" aria-hidden="true"><path d="M1 8h3.5m7 0H15"/><circle cx="8" cy="8" r="3.5"/></svg>',vn='<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>',yn='<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 up,_n,$n,xn,Ke,ve,hp,We,kn,er,tr=w(()=>{J();({I:up}=ao),_n=r=>r,$n=r=>r.strings===void 0,xn=()=>document.createComment(""),Ke=(r,e,t)=>{let i=r._$AA.parentNode,s=e===void 0?r._$AB:e._$AA;if(t===void 0){let o=i.insertBefore(xn(),s),n=i.insertBefore(xn(),s);t=new up(o,n,r,r.options)}else{let o=t._$AB.nextSibling,n=t._$AM,a=n!==r;if(a){let l;t._$AQ?.(r),t._$AM=r,t._$AP!==void 0&&(l=r._$AU)!==n._$AU&&t._$AP(l)}if(o!==s||a){let l=t._$AA;for(;l!==o;){let d=_n(l).nextSibling;_n(i).insertBefore(l,s),l=d}}}return t},ve=(r,e,t=r)=>(r._$AI(e,t),r),hp={},We=(r,e=hp)=>r._$AH=e,kn=r=>r._$AH,er=r=>{r._$AR(),r._$AA.remove()}});function Ki(r){return typeof r=="string"&&/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/u.test(r)?r:null}var Wi=w(()=>{"use strict"});var pr,$l=w(()=>{J();ft();tr();pr=fe(class extends X{constructor(){super(...arguments),this.key=u}render(r,e){return this.key=r,e}update(r,[e,t]){return e!==this.key&&(We(r),this.key=e),t}})});var ls=w(()=>{$l()});var $v,kv,Sv,Ol=w(()=>{"use strict";S();$v=document.querySelector("#drop-zone"),kv=document.querySelector("#report"),Sv=document.querySelector("app-sidebar")});function xs(r=document){if(r.querySelector(":modal"))return!0;for(let e of r.querySelectorAll("*"))if(e.shadowRoot&&xs(e.shadowRoot))return!0;return!1}var Tl=w(()=>{"use strict"});function Tu(){return V||(V=document.createElement("div"),V.id="styled-tooltip",V.setAttribute("popover","manual"),document.body.append(V),V)}function Nu(r){typeof r.showPopover=="function"&&(r.matches(":popover-open")&&r.hidePopover(),r.showPopover())}function ju(r,{placement:e="cursor"}={}){e=r.dataset.tooltipPlacement??e;let t=Tu(),i=r.dataset.tooltip??"",s=r.dataset.tooltipRepo??"",o=Ki(r.dataset.tooltipCommit),n=["stasis","sourcemap"].includes(r.dataset.tooltipBundle)?r.dataset.tooltipBundle:"",a=r.dataset.tooltipStats??"",l=r.dataset.tooltipPackage??"",d=r.dataset.tooltipEcosystem??"",m=r.dataset.tooltipVersion??"",p=r.dataset.tooltipFiles??"",h=JSON.stringify([i,s,o,n,a,l,d,m,p]);if(!i||hr===r&&Nl===h)return;if(t.textContent=i,l){let R=document.createElement("div");R.className="tooltip-package";let M=r.querySelector("svg")?.cloneNode(!0);M&&R.append(M);let j=document.createElement("span");j.className="tooltip-package-details";for(let et of[l,m,/^\d+$/u.test(p)?`${p} ${p==="1"?"file":"files"}`:""].filter(Boolean)){let Os=document.createElement("span");Os.textContent=et,j.append(Os)}R.append(j),t.append(R)}if(s||o){let R=document.createElement("div");if(R.className="tooltip-repo",s){R.innerHTML=gn;let M=document.createElement("span");M.textContent=s,R.append(M)}if(o){let M=document.createElement("span");M.className="tooltip-commit",M.innerHTML=bn;let j=document.createElement("span");j.textContent=o.slice(0,7),M.append(j),R.append(M)}t.append(R)}if(n||a){let R=document.createElement("div");if(R.className="tooltip-bundle",n==="stasis"){let et=document.createElement("img");et.src="./stasis.svg",et.alt="",R.append(et)}else R.innerHTML=ge;let M=document.createElement("span"),j=n==="stasis"?"Stasis":n==="sourcemap"?"Sourcemap":"";M.textContent=[j,a].filter(Boolean).join(" \xB7 "),R.append(M),t.append(R)}Nu(t),t.style.left="0px",t.style.top="0px",t.style.transform="none",t.classList.add("visible");let f=jl,g=Ul+Pu;if(e==="right"||e==="right-start"){let R=r.getBoundingClientRect();f=R.right+Du,g=R.top+(e==="right"?R.height/2:0)}let y=window.innerWidth-t.offsetWidth-ur,v=Math.max(ur,Math.min(f,y));t.style.left=`${Math.round(v)}px`;let b=t.offsetHeight,k=e==="right"?g-b/2:g,E=window.innerHeight-b-ur,L=Math.max(ur,Math.min(k,E));t.style.top=`${Math.round(L)}px`,hr=r,Nl=h}function Bl(){clearTimeout(mr),mr=null,V&&(V.classList.remove("visible"),typeof V.hidePopover=="function"&&V.matches(":popover-open")&&V.hidePopover()),hr=null}function Uu(r,{gate:e,placement:t}={}){Object.hasOwn(r.dataset,"tooltipTruncated")&&r.scrollWidth<=r.clientWidth&&r.scrollHeight<=r.clientHeight||e&&!e(r)||(clearTimeout(mr),mr=setTimeout(()=>{ju(r,{placement:t})},Bu))}function Dl(r,e){for(let t of r.composedPath()){if(t===e)break;if(t.nodeType===1&&Object.hasOwn(t.dataset,"tooltip"))return t}return null}function Fl(r,e){!r||Pl.has(r)||(Pl.add(r),r.addEventListener("mouseover",t=>{let i=Dl(t,r);if(!i){Bl();return}i!==hr&&Uu(i,e)}),r.addEventListener("mouseout",t=>{let i=Dl(t,r),s=t.relatedTarget?.closest?.("[data-tooltip]")??null;i&&i===s||Bl()}))}var V,hr,Nl,mr,jl,Ul,Bu,Pu,Du,ur,Pl,Hl=w(()=>{"use strict";be();Wi();hr=null,Nl="",mr=null,jl=0,Ul=0;document.addEventListener("mousemove",r=>{jl=r.clientX,Ul=r.clientY},{passive:!0});Bu=100,Pu=14,Du=8,ur=8;Pl=new WeakSet});var Vl,ql=w(()=>{Vl=`a{cursor:default}*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}button,summary,select,label,legend,header h3,.section-title,.ui-hint,.hint,.note,.lwd-note,.lwd-empty,.empty:not(.error,[role=alert]),.empty-discussion,.history-state[role=status],.history-summary{cursor:default;user-select:none;-webkit-user-select:none}input:not([type=checkbox],[type=radio]),textarea,[contenteditable],pre,code,.mono{cursor:text;user-select:text;-webkit-user-select:text}dialog{margin-top:5rem;margin-inline:auto;border:1px solid var(--border);border-radius:var(--ui-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:var(--ui-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:var(--ui-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}}
|
|
51
|
+
`});function Qe(r,e={}){return new Promise(t=>{let i=document.createElement(r);Object.assign(i,e),i.addEventListener("resolve",s=>{i.remove(),t(s.detail)}),document.body.append(i)})}var W,fr=w(()=>{"use strict";S();Ol();Tl();Hl();ql();W=class extends A{static styles=[x(Vl)];exclusive=!1;firstUpdated(){Fl(this.renderRoot),this.beforeOpen();let e=this.renderRoot.querySelector("dialog");if(e){if(this.exclusive&&xs()){this._conflict(new DOMException("Another modal dialog is already open","InvalidStateError"));return}try{e.showModal()}catch(t){this._conflict(t);return}this.focusInitial()}}_conflict(e){this._settled=!0,this.dispatchEvent(new CustomEvent("modal-conflict",{detail:{cause:e}}))}beforeOpen(){}focusInitial(){(this.renderRoot.querySelector("input, textarea")??this.renderRoot.querySelector("button.primary")??this.renderRoot.querySelector("button"))?.focus()}_finish(e){this._settled||(this._settled=!0,this.renderRoot.querySelector("dialog")?.close(),this.dispatchEvent(new CustomEvent("resolve",{detail:e})))}_onClose=()=>this._finish(null)}});async function ae(r,e=null,t={}){let i;try{i=await $(r,{credentials:"same-origin",headers:{accept:"application/json"},...t})}catch{return e}if(i.status===401||i.status===403)return null;if(!i.ok)return e;try{return await i.json()}catch{return e}}async function Fv({fallback:r=null}={}){let e;try{let i=Z(),s=await $(i?xr(i):"/api/auth/session",{credentials:"same-origin",headers:{accept:"application/json"}});if(s.status===401||s.status===403)return null;if(!s.ok)return r;e=await s.json()}catch{return r}let t=e?.user;return t===null?null:t===void 0||typeof t.login!="string"?r:{id:t.id,login:t.login,name:typeof t.name=="string"?t.name:null,avatarUrl:typeof t.avatarUrl=="string"?t.avatarUrl:null,role:typeof t.role=="string"?t.role:"none",csrfToken:typeof e.csrfToken=="string"?e.csrfToken:null,...Z()?{publicShare:!0}:{}}}async function Hv({fallback:r=[],signal:e,onRevision:t}={}){let i=Z(),s=i?await ae(xr(i),null,{signal:e}):null,o=i?{teams:s?.team?[s.team]:[]}:await ae("/api/teams",{teams:r},{signal:e}),n=o?.teams;return Array.isArray(n)?(t?.(typeof o.revision=="string"?o.revision:null),n.filter(a=>a!=null&&typeof a.id=="string"&&typeof a.name=="string").map(a=>({id:a.id,slug:a.slug,name:a.name,...a.permissions?{permissions:{dependencies:a.permissions.dependencies===!0,security:a.permissions.security===!0}}:{},...typeof a.cacheKey=="string"?{cacheKey:a.cacheKey}:{},reports:Array.isArray(a.reports)?a.reports.filter(l=>l!=null&&typeof l.id=="string"&&typeof l.filename=="string").map(l=>({id:l.id,slug:l.slug,filename:l.filename,...l.analyzer===null||typeof l.analyzer=="string"?{analyzer:l.analyzer}:{},repoFullName:typeof l.repoFullName=="string"?l.repoFullName:"",repoDirectory:typeof l.repoDirectory=="string"?l.repoDirectory:"",...typeof l.cacheKey=="string"?{cacheKey:l.cacheKey}:{}})):[],bundles:Array.isArray(a.bundles)?a.bundles.filter(l=>l!=null&&typeof l.id=="string"&&typeof l.filename=="string").map(l=>({id:l.id,slug:l.slug,integrity:l.integrity,byteSize:l.byteSize,repoId:l.repoId,filename:l.filename,kind:l.kind,summary:l.summary??null,summaryRetryAt:Number.isSafeInteger(l.summaryRetryAt)&&l.summaryRetryAt>0?l.summaryRetryAt:null,repoDirectory:typeof l.repoDirectory=="string"?l.repoDirectory:"",repoFullName:typeof l.repoFullName=="string"?l.repoFullName:""})):[]}))):o==null?[]:r}function $s(r){return Ve(r?.data)===null||typeof r.repo?.directory!="string"||r.repo.github!==null&&typeof r.repo.github!="string"?null:{data:r.data,repo:r.repo}}async function Gl(r,{signal:e}={}){return $s(await ae(`/api/reports/${encodeURIComponent(r)}`,null,{signal:e}))}async function Kl(r,{signal:e}={}){let t=[...new Set(r)];if(t.length===0)return[];let i=await ae("/api/reports/query",null,{method:"POST",signal:e,headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({ids:t})});if(!Array.isArray(i?.reports)||i.reports.length!==t.length)return null;let s=new Map;for(let o of i.reports){let n=$s(o);if(!n||!t.includes(o.id)||s.has(o.id))return null;s.set(o.id,n)}return r.map(o=>s.get(o))}async function Wl(r,{signal:e}={}){let t=await ae(`/api/teams/${encodeURIComponent(r)}/reports`,null,{signal:e});if(!Array.isArray(t?.reports))return null;let i=[],s=new Set;for(let o of t.reports){let n=$s(o);if(!n||typeof o.id!="string"||typeof o.filename!="string"||s.has(o.id))return null;s.add(o.id),i.push({id:o.id,filename:o.filename,...n})}return i}function De(r){return r?`?team=${encodeURIComponent(r)}`:""}async function qv(r,{reportId:e,...t}={}){let i=e==null?"":`?reportId=${encodeURIComponent(e)}`,s=await ae(`/api/teams/${encodeURIComponent(r)}/annotations${i}`,null,t),{reports:o,entries:n,comments:a}=s??{};if(!o||typeof o!="object"||Array.isArray(o)||!n||typeof n!="object"||Array.isArray(n)||!Array.isArray(a)||Object.values(o).some(p=>!Array.isArray(p)||p.some(h=>typeof h!="string"))||a.some(p=>!p||typeof p.findingId!="string"))return null;let l=new Map;for(let[p,h]of a.entries()){let f=h.findingId,g=l.get(f)??[];g.push(p),l.set(f,g)}let d=new Map,m=new Map;return p=>{if(!Object.hasOwn(o,p))return null;if(m.has(p))return m.get(p);let h=JSON.stringify(o[p]),f=d.get(h);if(!f){let g=[...new Set(o[p])],y=g.flatMap(v=>l.get(v)??[]);f={entries:Object.fromEntries(g.filter(v=>Object.hasOwn(n,v)).map(v=>[v,n[v]])),comments:y.toSorted((v,b)=>v-b).map(v=>a[v])},d.set(h,f)}return m.set(p,f),f}}async function Vv(r,e,t){let s=(await ae(`/api/reports/${encodeURIComponent(r)}/triage${De(e)}`,null,t))?.entries;return s!=null&&typeof s=="object"&&!Array.isArray(s)?s:null}async function Gv(r,e){if(Z())return[];let t=await ae(`/api/teams/${encodeURIComponent(r)}/fixes`,null,{signal:e});return Array.isArray(t?.fixes)?t.fixes:null}async function Kv(r,e,t){let i=await ae(`/api/reports/${encodeURIComponent(r)}/comments${De(e)}`,null,t);return Array.isArray(i?.comments)?i.comments:null}async function Wv(r,{findingId:e,body:t,commentId:i=null,version:s},o,n){let a=i==null?"":`/${encodeURIComponent(i)}`;try{let l=await $(`/api/reports/${encodeURIComponent(r)}/comments${a}${De(n)}`,{method:i==null?"POST":"PATCH",credentials:"same-origin",headers:{"content-type":"application/json",...o?{"x-csrf-token":o}:{}},body:JSON.stringify(i==null?{findingId:e,body:t}:{body:t,version:s})});return{status:l.status,comment:l.ok?(await l.json()).comment:null}}catch{return{status:0,comment:null}}}async function Zv(r,e,t,i,s){try{return(await $(`/api/reports/${encodeURIComponent(r)}/comments/${encodeURIComponent(e)}${De(s)}`,{method:"DELETE",credentials:"same-origin",headers:{"content-type":"application/json",...i?{"x-csrf-token":i}:{}},body:JSON.stringify({version:t})})).status}catch{return 0}}async function Jv(r,e,t,i){try{return(await $(`/api/reports/${encodeURIComponent(r)}/triage${De(i)}`,{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json",...t?{"x-csrf-token":t}:{}},body:JSON.stringify({entries:e})})).status}catch{return 0}}function Yv(r){r&&(location.href=r)}async function Xv(r){if(Z()){location.href="/";return}try{await $("/api/auth/logout",{method:"POST",credentials:"same-origin",headers:r?{"x-csrf-token":r}:{}})}catch{}location.reload()}async function Zl(r){let e=await $(`/api/teams/${encodeURIComponent(r)}/share`,{credentials:"same-origin"});if(!e.ok)throw new Error(`Could not load public links (${e.status})`);return(await e.json()).shares}async function Jl(r,e,{id:t,revoke:i=!1,dependencies:s=!1,security:o=!1}={}){let n=t?`/${encodeURIComponent(t)}`:"",a=await $(`/api/teams/${encodeURIComponent(r)}/share${n}`,{method:i?"DELETE":t?"PATCH":"POST",credentials:"same-origin",headers:{"x-csrf-token":e,"content-type":"application/json"},...i?{}:{body:JSON.stringify({dependencies:s,security:o})}});if(!a.ok)throw new Error(`Could not ${i?"revoke":t?"update":"create"} public link (${a.status})`);return a.json()}async function Qv(r,e){let t=await $(`/api/bundles/${encodeURIComponent(r)}/download`,{credentials:"same-origin"});if(!t.ok)throw new Error(`Could not download bundle (${t.status})`);let i=URL.createObjectURL(await t.blob()),s=document.createElement("a");s.href=i,s.download=e,s.click(),setTimeout(()=>URL.revokeObjectURL(i),6e4)}var $t=w(()=>{"use strict";B();kt();mt()});var Xl,Yl=w(()=>{Xl=`.share-field{display:grid;gap:.35rem;margin-top:.8rem;font-size:.82rem}fieldset{display:grid;gap:.55rem;border:0;margin-top:1rem;font-size:.82rem}legend{margin-bottom:.55rem;font-weight:600}fieldset label{display:flex;align-items:center;gap:.5rem}input[type=checkbox]{accent-color:var(--accent)}.nwd-actions{flex-wrap:wrap}.revoke-all{margin-top:.75rem;border:0;background:none;color:var(--muted);font:inherit;font-size:.74rem}.revoke-all:hover:not(:disabled){color:var(--critical)}
|
|
52
52
|
`});var Ss={};vr(Ss,{openManagedShareDialog:()=>qu});function qu(r,e="",t=null){return Qe("managed-share-dialog",{team:r,initialId:e,session:t})}var ks,Cs=w(()=>{"use strict";S();fr();$t();ie();Yl();ks=class extends W{static styles=[...W.styles,x(Xl)];static properties={team:{attribute:!1},session:{attribute:!1},initialId:{attribute:!1},selectedId:{state:!0},links:{state:!0},dependencies:{state:!0},security:{state:!0},busy:{state:!0},message:{state:!0}};constructor(){super(),this.team=null,this.initialId="",this.selectedId="",this.links=[],this.dependencies=!1,this.security=!1,this.busy=!0,this.message="",this.urls=new Map}beforeOpen(){this.load(this.initialId)}select(e){let t=this.links.find(i=>i.id===e);this.selectedId=t?.id??"",this.dependencies=t?.permissions.dependencies===!0,this.security=t?.permissions.security===!0,this.message=""}async load(e=this.selectedId){this.busy=!0;try{let t=await Zl(this.team.id);return this._settled?void 0:(this.links=t,this.select(e),!0)}catch(t){return this.message=t.message,!1}finally{this.busy=!1}}async change(e=!1,t=!1){if(!this.busy){this.busy=!0,this.message="";try{let i=await Jl(this.team.id,this.session?.csrfToken,{id:t?void 0:this.selectedId||void 0,revoke:e,dependencies:this.dependencies,security:this.security});if(C.invalidate(["links","history"]),this._settled)return;i.path&&(this.urls.set(i.id,new URL(i.path,location.origin).href),this.links=[{id:i.id,createdAt:Date.now(),createdBy:this.session?.login??"",permissions:{dependencies:this.dependencies,security:this.security}},...this.links],this.selectedId=i.id),e&&(t?this.urls.clear():this.urls.delete(this.selectedId)),await this.load(e?"":i.id??this.selectedId)&&(this.message=e?t?"All public links revoked.":"Link revoked.":i.path?"Link created.":"Permissions saved. The link URL is unchanged.")}catch(i){this.message=i.message}finally{this.busy=!1}}}async copy(){try{await navigator.clipboard.writeText(this.urls.get(this.selectedId)),this.message="Link copied."}catch{this.message="Select the link and copy it."}}render(){let e=this.urls.get(this.selectedId);return c`<dialog @close="${this._onClose}"><header><h3>Share ${this.team?.name}</h3></header><p class="nwd-intro ui-hint">Anyone with this link can read this workspace’s published reports, comments, triage, and available source files without signing in.<br>New published reports will also be included.</p><label class="share-field">Public links <select class="nwd-input" ?disabled="${this.busy}" @change="${t=>this.select(t.target.value)}"><option value="" ?selected="${!this.selectedId}">Create a new link</option>${this.links.map(t=>c`<option value="${t.id}" ?selected="${this.selectedId===t.id}">${new Date(t.createdAt).toLocaleString()} · ${t.createdBy} · ${t.id.slice(0,8)}</option>`)}</select></label><fieldset ?disabled="${this.busy}"><legend>Include in this link</legend><label><input type="checkbox" .checked="${this.security}" @change="${t=>{this.security=t.target.checked}}"> Security findings and advisories</label> <label><input type="checkbox" .checked="${this.dependencies}" @change="${t=>{this.dependencies=t.target.checked}}"> Findings in dependencies</label></fieldset><p class="nwd-note ui-hint">Both options are off for new links.<br>Existing links keep their URL when permissions change.</p>${e?c`<label class="share-field">Public link<input class="nwd-input" readonly="readonly" .value="${e}" @focus="${t=>t.target.select()}"></label>`:u} ${this.message?c`<p class="nwd-note" role="status">${this.message}</p>`:u}<footer class="nwd-actions">${this.selectedId?c`<button class="danger" ?disabled="${this.busy}" @click="${()=>this.change(!0)}">Revoke link</button>`:u} <span class="nwd-spacer"></span> ${e?c`<button @click="${()=>this.copy()}">Copy link</button>`:u} <button class="primary" ?disabled="${this.busy}" @click="${()=>this.change()}">${this.selectedId?"Save changes":"Create public link"}</button> <button @click="${()=>this._finish(null)}">Close</button></footer>${this.links.length>0?c`<button class="revoke-all" ?disabled="${this.busy}" @click="${()=>this.change(!0,!0)}">Revoke all links for this workspace</button>`:u}</dialog>`}};customElements.define("managed-share-dialog",ks)});async function As(r,e,t,i=null){let s=`/api/teams/${encodeURIComponent(r)}/issues`,o,n;try{o=await $(i?s:`${s}?${new URLSearchParams(e)}`,{method:i?"POST":"GET",credentials:"same-origin",headers:{accept:"application/json",...i?{"content-type":"application/json","x-csrf-token":t}:{}},...i?{body:JSON.stringify({...e,...i})}:{}}),n=await o.json()}catch{throw new Error(i?"github-create-uncertain":"github-unavailable")}if(!o.ok){let a=typeof n?.error=="string"&&n.error?n.error:null;throw new Error(i&&o.status>=500&&!eh.has(a)?"github-create-uncertain":a??(i?"github-create-uncertain":"github-unavailable"))}return n}var eh,ec=w(()=>{"use strict";B();eh=new Set(["github-unavailable","unavailable","shutting-down","github-create-failed"])});function rc(r,{sourceUrl:e,evidence:t="",showRevalidation:i=!0}={}){let s=[],o=new Map,n=(p,h,f)=>{if(!f?.trim())return;let g=o.get(p)??{id:p,label:h,parts:[]};g.parts.includes(f.trim())||g.parts.push(f.trim()),o.set(p,g)},a=ct(r);r.file&&s.push(`File: ${e?`[${a}](${e})`:a}`);let l=null;for(let p of qr(Ht(r.description,r))){if(p.label!==null){let h=tc(p.label);l=["description","details","summary"].includes(h)?null:{id:th.get(h)??h,label:p.label}}l?n(l.id,l.label,p.body):s.push(p.label?`**${p.label}:** ${p.body}`:p.body)}r.confidence!=null&&s.push(`Confidence: ${r.confidence}/10`);for(let[p,h]of br){if(p.startsWith("revalidate")&&!i){o.delete(p);continue}let f=p==="evidence"?t.replace(/^\*\*Evidence:\*\*\n/u,""):Ht(r[p],r);n(p,h,f)}let d=[...br.map(([p])=>o.get(p)).filter(Boolean),...[...o.values()].filter(p=>!br.some(([h])=>h===p.id))],m={body:s.join(`
|
|
53
53
|
|
|
54
54
|
`),sections:d.map(({id:p,label:h,parts:f})=>({id:p,label:h,text:`**${h}:**
|
|
@@ -64,7 +64,7 @@ ${f.join(`
|
|
|
64
64
|
`});var ac={};vr(ac,{openManagedIssueDialog:()=>ih});function ih(r){return Qe("managed-issue-dialog",r)}var Is,Ls,lc=w(()=>{"use strict";S();ec();fr();sc();oc();Is={"github-unavailable":"GitHub could not be reached. Try checking again.","github-issue-forbidden":"GitHub did not permit issue creation. Check your repository access and authorization.","github-create-uncertain":"GitHub may have created this issue. Check the repository before trying again.","github-create-failed":"GitHub could not create the issue. Check the title and description before trying again.",unauthenticated:"Your session expired. Sign in again before creating an issue.","workspace-changed":"Your workspace access changed. Reopen the finding before creating an issue.","bad-issue-repository":"The finding\u2019s repository changed. Reopen the finding before creating an issue.","no-finding":"This finding is no longer available in this workspace."},Ls=class extends W{static styles=[...W.styles,x(nc)];static properties={teamId:{attribute:!1},context:{attribute:!1},session:{attribute:!1},formUrl:{attribute:!1},title:{state:!0},body:{state:!0},prepared:{state:!0},busy:{state:!0},creating:{state:!0},message:{state:!0},uncertain:{state:!0},createdUrl:{state:!0},createdIssue:{state:!0},detailsUnavailable:{state:!0},sections:{state:!0}};constructor(){super(),this.title="",this.body="",this.prepared=null,this.busy=!1,this.creating=!1,this.message="",this.uncertain=!1,this.createdUrl="",this.createdIssue=null,this.detailsUnavailable=!1,this.sections=[]}beforeOpen(){this.finding&&Object.assign(this,rc(this.finding,this.draftOptions)),this.check(!0)}editBody(e){Object.assign(this,ic(this,e))}toggleSection(e,t){Object.assign(this,Ms(this,e,t))}current(){return!this._settled&&this.isCurrent()}fallbackUrl(){let e=new URL(this.formUrl);return e.searchParams.set("title",this.title),e.searchParams.set("body",this.body),this.prepared?.labels&&e.searchParams.set("labels",this.prepared.labels.join(",")),e.href}async check(e=!1){if(!(this.busy||!this.current())){this.busy=!0,this.message="";try{let t=await As(this.teamId,this.context,this.session.csrfToken);if(!this.current())return;this.prepared=t,this.uncertain=!1,t.mode==="existing"&&window.location.assign(t.url),e&&t.mode==="form"&&window.location.assign(this.fallbackUrl())}catch(t){!this.uncertain&&!["pending","created-unavailable"].includes(this.prepared?.mode)&&(this.prepared=null),this.message=Is[t.message]??"Unable to check this issue. Please retry."}finally{this.busy=!1}}}async create(){if(!(this.busy||this.uncertain||this.createdUrl||this.prepared?.mode!=="api")){if(!this.current()){this.message=Is["workspace-changed"],this.prepared=null;return}this.busy=!0,this.creating=!0,this.message="";try{let e=await As(this.teamId,this.context,this.session.csrfToken,{title:this.title,body:this.body});if(!this.current())return;e.mode==="existing"?window.location.assign(e.url):e.url?(this.createdUrl=e.url,this.createdIssue=e.issue,this.detailsUnavailable=e.detailsUnavailable===!0):this.prepared=e}catch(e){e.message==="github-authorization-required"?this.prepared={mode:"authorize",authorizationPath:"/api/oauth/github/issues/login"}:(this.uncertain=e.message==="github-create-uncertain",["workspace-changed","bad-issue-repository","no-team","no-report","no-finding","unauthenticated","forbidden"].includes(e.message)&&(this.prepared=null),this.message=Is[e.message]??"Could not create this issue. Check the title, description, and repository access.")}finally{this.busy=!1,this.creating=!1}}}render(){let e=this.createdIssue,t=this.prepared,i=t?.mode==="created-unavailable",s=this.createdUrl||i,o=this.uncertain||t?.mode==="pending",n=this.creating||o,a=!this.busy&&!o&&t?.mode==="form";return c`<dialog aria-labelledby="issue-dialog-title" @close="${this._onClose}" @cancel="${l=>{this.creating&&l.preventDefault()}}"><header><h3 id="issue-dialog-title">${s?"Issue created":"Create a GitHub issue"}</h3></header><div class="dialog-content"><p class="nwd-intro">${s?"Created":"Create"} in <strong>${this.context?.repository}</strong> as <strong>@${this.session?.login}</strong>.</p>${this.createdUrl?c`<section class="created-issue" aria-label="Created GitHub issue"><div class="issue-heading"><span class="${`issue-status ${e?.status??"open"} ${e?.stateReason??""}`}">${e?.status==="closed"?e.stateReason==="not_planned"?"Not planned":e.stateReason==="duplicate"?"Duplicate":e.stateReason==="completed"?"Completed":"Closed":"Open"}</span> <span class="issue-number">${e?.number?`#${e.number}`:""}</span></div><h4><a href="${this.createdUrl}" target="_blank" rel="noopener">${e?.title??this.title}</a></h4><p class="nwd-note">Opened by @${e?.author??this.session?.login}</p>${e?.labels?.length?c`<div class="issue-labels">${e.labels.map(l=>c`<span>${l}</span>`)}</div>`:u}<div class="issue-description">${this.renderBody?this.renderBody(e?.description??this.body):e?.description??this.body}</div><p class="nwd-note ui-hint">Linked permanently to this finding. The Issue button will open this issue next time.</p>${this.detailsUnavailable?c`<p class="nwd-note">GitHub’s latest details could not be loaded. The issue was created and its link is saved.</p>`:u}</section>`:i?c`<p role="status">The issue was created and linked permanently to this finding. Its details cannot be shown because workspace access could not be confirmed. Check its status again once workspace access is available.</p>`:c`<label>Title<input class="nwd-input" maxlength="256" .value="${this.title}" ?disabled="${n}" @input="${l=>{this.title=l.target.value}}"></label><div class="description-heading"><label for="issue-description">Description</label> ${this.sections.length>0?c`<div class="description-sections" role="group" aria-label="Include in description">${this.sections.map(l=>c`<label><input type="checkbox" .checked="${l.selected}" ?disabled="${n}" @change="${d=>this.toggleSection(l.id,d.target.checked)}">${l.label}</label>`)}</div>`:u}</div><p id="description-help" class="nwd-note description-help ui-hint">${this.sections.length>0?"Add or remove sections above. Your edits are kept when toggling them.":"Edit the description before creating the issue."}</p><textarea id="issue-description" class="nwd-input" maxlength="65536" .value="${this.body}" aria-describedby="description-help" ?disabled="${n}" @input="${l=>this.editBody(l.target.value)}"></textarea> ${t?.labels?.length?c`<p class="nwd-note">Labels: ${t.labels.join(", ")}</p>`:u} ${t?.mode==="permissions"?c`<p>Ask a repository owner to approve the app’s Issues read and write permission. ${t.authorizationPath?c`<a href="${t.authorizationPath}" target="_blank" rel="noopener">Review repository permissions</a>`:u}</p>`:u} ${t?.mode==="authorize"?c`<p><a href="${t.authorizationPath}" target="_blank" rel="noopener">Authorize GitHub</a>, then check authorization here.</p>`:u} ${t?.mode==="pending"?c`<p role="status">An issue is being created, or its creation could not be confirmed. Check its status before continuing; another issue will not be created.</p>`:u} ${t?.mode==="unavailable"?c`<p role="status">This finding already has a managed issue in a repository outside this workspace.</p>`:u}`} ${!this.createdUrl&&this.message?c`<p class="nwd-note" role="status">${this.message}</p>`:u} ${!this.createdUrl&&this.busy?c`<p role="status">${this.creating?"Creating issue\u2026":"Checking repository access\u2026"}</p>`:u}</div><footer class="nwd-actions">${this.createdUrl?c`<a href="${this.createdUrl}" target="_blank" rel="noopener">Open issue on GitHub</a>`:!this.busy&&o?c`<a href="${t?.repositoryUrl??`https://github.com/${this.context?.repository}/issues`}" target="_blank" rel="noopener">Check repository issues</a>`:a?c`<a href="${this.fallbackUrl()}" target="_blank" rel="noopener">Use GitHub form</a>`:u} <span class="nwd-spacer"></span> ${!this.createdUrl&&t?.mode!=="unavailable"?t?.mode==="api"&&!this.uncertain?c`<button class="primary" ?disabled="${this.busy||!this.title.trim()}" @click="${this.create}">Create issue</button>`:c`<button ?disabled="${this.busy}" @click="${()=>this.check()}">${o||i?"Check issue status":"Check authorization"}</button>`:u} <button ?disabled="${this.creating}" @click="${()=>this._finish(null)}">${s?"Close":"Cancel"}</button></footer></dialog>`}};customElements.define("managed-issue-dialog",Ls)});function cc(r,e){return e==="triage"?oh[r?.triage]??"Untriaged":e==="flagged"?r?.flagged?"Yes":"No":r?.[e]||"None"}function dc(r,e){return Object.entries(sh).flatMap(([t,i])=>{let s=cc(r,t);if(e===void 0)return r?.[t]===void 0?[]:[{label:i,after:s}];let o=cc(e,t);return o===s?[]:[{label:i,before:o,after:s}]})}var sh,oh,pc=w(()=>{"use strict";sh={triage:"Status",color:"Label",flagged:"Flagged",fix:"Fix",comment:"Comment"},oh={inprogress:"In progress",fixed:"Fixed",invalid:"Invalid",deleted:"Deleted"}});function uc(r,e){return r?pr(r,c`<span class="managed-comment-avatar" aria-hidden="true"><span>${(e?.[0]??"?").toUpperCase()}</span> ${Z()?u:c`<img alt="" src="${`/api/avatar/${encodeURIComponent(r)}`}" loading="lazy" @error="${t=>{t.currentTarget.hidden=!0}}">`}</span>`):u}var hc=w(()=>{"use strict";kt();S();ls()});var fc,mc=w(()=>{fc=`.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}}
|
|
65
65
|
`});var bc,gc=w(()=>{bc=`.detail-action{width:22px;height:22px;display:grid;place-items:center;padding:0;background:transparent;border:0;border-radius:var(--ui-radius, 4px);color:var(--muted);font:500 16px/1 ui-monospace,monospace;cursor:default;&:hover{color:var(--accent);background:var(--surface-active)}&:focus-visible{outline:2px solid var(--accent);outline-offset:1px}}
|
|
66
66
|
`});var yc,vc=w(()=>{yc=`dialog{width:min(94vw,720px);max-width:720px;max-height:calc(100dvh - 4rem);margin-block:2rem;padding:0;overflow:hidden;background:rgb(from var(--surface) r g b / 1)}dialog[open]{display:flex;flex-direction:column}header{display:flex;align-items:start;justify-content:space-between;gap:1rem;padding:.75rem 1rem;border-bottom:1px solid var(--border);flex:none}.history-heading{min-width:0}header h3{display:flex;align-items:center;gap:.55rem;margin:0;line-height:1.5}header svg{flex:none;color:var(--muted)}header .detail-action{flex:none;width:1.75rem;height:1.75rem}.location{margin-top:.4rem;color:var(--muted);font:.76rem/1.5 ui-monospace,monospace;overflow-wrap:anywhere}.history-summary{display:flex;justify-content:space-between;gap:.5rem;flex:none;padding:.5rem 1rem .25rem;color:var(--muted);font-size:.72rem}.history-body{min-height:0;overflow:auto;overscroll-behavior:contain;padding:.75rem 1rem 1rem;font-size:.82rem;line-height:1.5}.timeline{list-style:none}.event{position:relative;display:grid;grid-template-columns:2rem minmax(0,1fr);gap:.75rem;padding-bottom:1rem}.event:last-child{padding-bottom:0}.event:not(:last-child):before{content:"";position:absolute;top:2.4rem;bottom:.4rem;left:calc(1rem - .5px);width:1px;background:var(--border)}.managed-comment-avatar{width:2rem;height:2rem;font-size:.8rem;background:var(--surface-active)}.event-content{min-width:0}.event-meta{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:.15rem .75rem}.event-user{display:flex;flex-wrap:wrap;align-items:baseline;gap:.1rem .45rem;min-width:0;overflow-wrap:anywhere}.event-user strong{font-weight:600}.username{color:var(--muted);font-size:.75rem}time{color:var(--muted);font-size:.7rem;white-space:nowrap}.event-action{margin-top:.1rem;color:var(--muted);font-size:.75rem}.changes{margin-top:.65rem;border:1px solid var(--border);border-radius:var(--ui-radius, 7px);overflow:hidden}.change{display:grid;grid-template-columns:4.5rem minmax(0,1fr);align-items:baseline;gap:.65rem;padding:.4rem .6rem}.change+.change{border-top:1px solid var(--border)}dt{color:var(--muted);font-size:.75rem}dd{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:baseline;gap:.65rem}dd.snapshot{grid-template-columns:minmax(0,1fr)}.before,.after{white-space:pre-wrap;overflow-wrap:anywhere}.before,.change-arrow{color:var(--muted)}.after{font-weight:500}.history-state{padding:1.5rem .5rem;text-align:center;color:var(--muted)}.history-state strong{display:block;margin-bottom:.35rem;color:var(--text);font-weight:500}.sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}@media(width<=540px){dialog{margin-block:1rem;max-height:calc(100dvh - 2rem)}header{padding:.65rem}.history-summary{padding-inline:.65rem}.history-body{padding:.65rem}.event{gap:.6rem}.event-meta{flex-direction:column}.change{grid-template-columns:minmax(0,1fr);gap:.3rem;padding:.35rem .5rem}dd{gap:.45rem}}
|
|
67
|
-
`});var wc={};vr(wc,{openFindingHistoryDialog:()=>ch});function ch(r){return r.isCurrent()?Qe("finding-history-dialog",r):Promise.resolve(null)}var zs,_c=w(()=>{"use strict";S();B();ie();fr();pc();hc();mc();gc();vc();zs=class extends W{static styles=[...W.styles,x(bc),x(fc),x(yc)];static properties={finding:{attribute:!1},teamId:{attribute:!1},_events:{state:!0},_loading:{state:!0},_error:{state:!0}};constructor(){super(),this._events=[],this._loading=!0,this._error=!1}beforeOpen(){this._load()}async _load(){if(!this.isCurrent()){this._finish(null);return}this._loading=!0,this._error=!1;let{_managedReportId:e,id:t}=this.finding;this._key=`finding-history:${this.teamId??""}:${e}:${t}`,C.invalidate([this._key]);let i=C.load(this._key,"issue history",async s=>{let o=new URLSearchParams({finding:t});this.teamId&&o.set("team",this.teamId);let n=await $(`/api/reports/${encodeURIComponent(e)}/triage/history?${o}`,{credentials:"same-origin",signal:s});if(!n.ok)throw new Error(`History request failed (${n.status})`);let a=await n.json();if(a.finding!==t||!Array.isArray(a.events))throw new Error("Invalid history response");return a.events});this._owner=C.resources.get(this._key),this._signal=this._owner.controller.signal,this._signal.addEventListener("abort",this._onClose,{once:!0});try{let s=await i;if(this._settled||!this.isConnected)return;if(!this.isCurrent()){this._finish(null);return}this._events=s}catch(s){if(this._settled||!this.isConnected)return;s.name==="AbortError"||!this.isCurrent()?this._finish(null):this._error=!0}finally{this._loading=!1}}disconnectedCallback(){this._signal?.removeEventListener("abort",this._onClose),this._owner&&C.resources.get(this._key)===this._owner&&C.invalidate([this._key]),this._events=[],super.disconnectedCallback()}_onKeydown=e=>{e.key==="Escape"&&e.stopPropagation()};_renderEvent(e,t){let i=this._events[t+1],s=dc(e.entry,i?.entry),o=new Date(e.at),n=e.actorLogin?`@${e.actorLogin}`:"";return c`<li class="event">${e.actorId?uc(e.actorId,e.actorName||e.actorLogin):c`<span class="managed-comment-avatar" aria-hidden="true">${(e.actorLogin?.[0]||"?").toUpperCase()}</span>`}<div class="event-content"><div class="event-meta"><div class="event-user"><strong>${e.actorName||n||"Unknown user"}</strong> ${e.actorName&&n?c`<span class="username">${n}</span>`:u}</div><time datetime="${o.toISOString()}" data-tooltip="${o.toLocaleString()}">${o.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}</time></div><p class="event-action">${e.entry===null?"Cleared triage":i?"Updated triage":"Recorded triage state"}</p>${s.length>0?c`<dl class="changes">${s.map(a=>c`<div class="change"><dt>${a.label}</dt><dd class="${a.before===void 0?"snapshot":""}">${a.before===void 0?u:c`<span class="before"><span class="sr-only">Previously: </span>${a.before}</span> <span class="change-arrow" aria-hidden="true">→</span>`} <span class="after"><span class="sr-only">${a.before===void 0?"Recorded: ":"Changed to: "}</span>${a.after}</span></dd></div>`)}</dl>`:u}</div></li>`}render(){let e=this.finding??{};return c`<dialog aria-labelledby="history-title" @close="${this._onClose}" @keydown="${this._onKeydown}"><header><div class="history-heading"><h3 id="history-title"><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 11a9 9 0 1 1 2.5 7M3 5v6h6M12 7v5l3 2"/></svg>Issue history</h3><p class="location">${e.file}${e.line?`:${e.line}`:""}</p></div><button type="button" class="detail-action" aria-label="Close issue history" @click="${this._onClose}">×</button></header>${!this._loading&&!this._error&&this._events.length>0?c`<div class="history-summary"><span>${this._events.length} ${this._events.length===1?"record":"records"}</span><span>Newest first</span></div>`:u}<div class="history-body" aria-busy="${String(this._loading)}">${this._loading?c`<p class="history-state" role="status">Loading history…</p>`:this._error?c`<div class="history-state" role="alert"><strong>Couldn’t load issue history</strong><p>Close and reopen to try again.</p></div>`:this._events.length===0?c`<div class="history-state" role="status"><strong>No triage changes yet</strong><p>Changes to status, labels, flags, and fixes will appear here.</p></div>`:c`<ol class="timeline">${this._events.map((t,i)=>this._renderEvent(t,i))}</ol>`}</div></dialog>`}};customElements.define("finding-history-dialog",zs)});B();S();mt();S();ie();var T=class extends A{static properties={session:{attribute:!1},allowShare:{attribute:!1},_loading:{state:!0}};constructor(){super(),this.session=null,this.allowShare=!1,this.appState=C,this._loading=!1,this._loadRequest=null}get _role(){return this.session?.role??null}get _csrf(){return this.session?.csrfToken??null}get _me(){return this.session?.id??null}disconnectedCallback(){this._loadRequest?.abort(),super.disconnectedCallback()}async _loadCollection(e,t,i,s){this._loadRequest?.abort();let o=new AbortController;this._loadRequest=o,this._loading=!0;try{await this.appState.load(e,t,i,{signal:o.signal,apply:s})}catch(n){!o.signal.aborted&&n?.name!=="AbortError"&&this.appState.read(e)===void 0&&(this._error=String(n?.message??n))}finally{this._loadRequest===o&&(this._loading=!1)}}};function se(r){return c`<div class="loading-rows" role="status"><span class="sr-only">${r}</span><div aria-hidden="true">${[0,1,2,3].map(()=>c`<div class="loading-row"><span></span><span></span></div>`)}</div></div>`}J();ft();var gt=class extends X{constructor(e){if(super(e),this.it=u,e.type!==G.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===u||e==null)return this._t=void 0,this.it=e;if(e===O)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};gt.directiveName="unsafeHTML",gt.resultType=1;var z=fe(gt);yr();_r();be();var wn={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="${un}"/>`},"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"/>'}},dp={default:["#2563eb","#fff"],"claude-security":["#d97757","#fff"],"codex-security":["#fff","#000"],deepsec:["#000","#fff"],piolium:["#fbb829","#1c1b19"]},li=Object.fromEntries(Object.entries(wn).map(([r,{className:e,mark:t}])=>{let[i,s]=dp[r],o=r==="codex-security"||r==="deepsec"?` stroke="${s}" stroke-width=".5"`:"";return[r,`<svg class="file-icon ${e}" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path class="bg" fill="${i}"${o} d="M3 2h6l4 4v8H3z"/><path fill="rgba(0,0,0,.18)" d="M9 2v4h4Z"/><g fill="${s}">${t}</g></svg>`]})),ci=Object.fromEntries(Object.entries(wn).map(([r,{className:e,mark:t}])=>[r,`<span class="report-logo ${e}" aria-hidden="true"><svg viewBox="${r==="default"?"3.5 4 9 9":"4 5 8 8"}" width="14" height="14">${t}</svg></span>`]));be();S();be();var pp=[["manage","Overview"],["manage-bundles","Bundles"],["manage-scans","Scans"],["manage-reports","Reports"],["manage-repos","Repositories","admin"],["admin-users","Users","admin"],["manage-teams","Teams","admin"],["manage-import","Import","admin"],["manage-links","Links"],["manage-history","History"]];function F(r,e,t=!1){return c`<header class="manage-header"><nav class="manage-nav" aria-label="Management pages">${pp.filter(([i,,s])=>(s==null||s===e)&&(i!=="manage-links"||t)).map(([i,s])=>c`<button type="button" aria-current="${r===i?"page":u}" @click="${()=>{document.dispatchEvent(new CustomEvent("managed-admin-navigate",{detail:{view:i},bubbles:!0,composed:!0}))}}">${s}</button>`)}</nav></header>`}function P(r){if(r==="bundle")return z(ge);if(r==="report"||r==="preview")return z(Ge);if(r==="scan")return z(mn);let e={users:"M10.75 4.75a2.75 2.75 0 1 1-5.5 0 2.75 2.75 0 0 1 5.5 0ZM3 14v-1.5A3.5 3.5 0 0 1 6.5 9h3a3.5 3.5 0 0 1 3.5 3.5V14",team:"M8.5 5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0ZM1.5 14v-1.5A3.5 3.5 0 0 1 5 9h2a3.5 3.5 0 0 1 3.5 3.5V14M11 2.75a2.5 2.5 0 0 1 0 4.5m1 2a3 3 0 0 1 2.5 3V14",repo:"M3 12.5V3a1.5 1.5 0 0 1 1.5-1.5H13v13H4.5a1.5 1.5 0 0 1 0-3H13M7 1.5v6l2-1.5 2 1.5v-6",history:"M2 5a6.25 6.25 0 1 1-.25 5M1.5 1.5V5H5M8 4.5V8l3 1.5",arrow:"M3 8h10M9 4l4 4-4 4",show:"M1 8s2.5-4.5 7-4.5S15 8 15 8s-2.5 4.5-7 4.5S1 8 1 8Zm9 0a2 2 0 1 0-4 0 2 2 0 0 0 4 0",hide:"m2 2 12 12M6 3.75A8 8 0 0 1 8 3.5c4.5 0 7 4.5 7 4.5a12 12 0 0 1-2 2.5M3.5 5A13 13 0 0 0 1 8s2.5 4.5 7 4.5a8 8 0 0 0 3-.6",download:"M8 2v8M5 7l3 3 3-3M2 11v3h12v-3",upload:"M8 11V2m-3 3 3-3 3 3M2 10v4h12v-4"};return c`<svg class="${r==="repo"?"repo-icon":u}" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${e[r]??e.repo}"></path></svg>`}S();S();J();ft();tr();var q=fe(class extends X{constructor(r){if(super(r),r.type!==G.PROPERTY&&r.type!==G.ATTRIBUTE&&r.type!==G.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!$n(r))throw Error("`live` bindings can only contain a single expression")}render(r){return r}update(r,[e]){if(e===O||e===u)return e;let t=r.element,i=r.name;if(r.type===G.PROPERTY){if(e===t[i])return O}else if(r.type===G.BOOLEAN_ATTRIBUTE){if(!!e===t.hasAttribute(i))return O}else if(r.type===G.ATTRIBUTE&&t.getAttribute(i)===e+"")return O;return We(r),e}});var D=class extends A{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=I`:host{display:block;min-width:0}:host,.menu{-webkit-app-region:no-drag;app-region:no-drag}*{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:var(--ui-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:var(--ui-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:var(--ui-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:var(--ui-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:var(--ui-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(),this.dispatchEvent(new CustomEvent("tooltip-root-connected",{bubbles:!0,composed:!0})),window.addEventListener("resize",this._onViewport),window.addEventListener("scroll",this._onViewport,!0),this._scrollRoots=[];for(let e=this.getRootNode();e.host;e=e.host.getRootNode())e.addEventListener("scroll",this._onViewport,!0),this._scrollRoots.push(e)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this._onViewport),window.removeEventListener("scroll",this._onViewport,!0);for(let e of this._scrollRoots??[])e.removeEventListener("scroll",this._onViewport,!0);this._scrollRoots=[]}render(){let e=this.options.find(n=>n.value===this.value),t=this.choices(),s=[...t.pinned,...t.sections.flatMap(n=>n.options)].filter(n=>!n.disabled),o=s.find(n=>n.value===this.value)?.value??s[0]?.value;return c`<button type="button" class="trigger" popovertarget="selector-menu" aria-label="${this.label}" aria-haspopup="dialog" aria-expanded="${this._open}" ?disabled="${this.disabled}">${e?this.optionIcon(e):u}<span class="name" data-tooltip-truncated data-tooltip="${e?.label??u}">${e?.label??this.placeholder}</span>${e?.detail?c`<span class="detail">${e.detail}</span>`:u} <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="${q(this._query)}" @input="${n=>{this._query=n.target.value}}"> <span class="count" role="status">${t.count}${t.count===t.total?"":` / ${t.total}`}</span></div><div class="body">${t.showFacets?c`<div class="facets" role="group" aria-label="${this.facetLabel}"><button type="button" class="org" aria-pressed="${t.activeFacet==null}" @click="${()=>this._filterFacet(null)}"><span class="name">${this.allFacetsLabel}</span><span class="count">${t.total}</span></button> ${t.facets.map(n=>c`<button type="button" class="org" aria-pressed="${t.activeFacet===n.value}" @click="${()=>this._filterFacet(n.value)}"><span class="name" data-tooltip-truncated data-tooltip="${n.name}">${n.name}</span><span class="count">${n.count}</span></button>`)}</div>`:u}<div class="results" id="selector-options" role="listbox" aria-label="${this.optionsLabel}">${t.pinned.length>0?c`<div class="pinned">${t.pinned.map(n=>this._option(n,!1,o))}</div>`:u} ${t.sections.map((n,a)=>c`<div class="group" role="group" aria-labelledby="${n.label?`selector-group-${a}`:u}">${n.label?c`<h3 class="heading" id="${`selector-group-${a}`}">${n.organization?c`<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>`:u}${n.label}</h3>`:u} ${n.options.map(l=>this._option(l,n.organization,o))}</div>`)} ${t.count?u:c`<p class="empty">${this.options.length>0?this.noMatchesLabel:this.emptyLabel}</p>`}</div></div></div>`}optionIcon(e){return e.initials?c`<span class="avatar" aria-hidden="true">${e.initials}</span>`:u}optionTooltip(e){return e.label}_option(e,t,i){let s=e.displayLabel??(t?e.name:e.label),o=this.optionTooltip(e);return c`<button type="button" class="option" role="option" ?data-reset="${e.reset}" ?disabled="${e.disabled}" aria-label="${e.label}" aria-selected="${e.value===this.value}" tabindex="${e.value===i?0:-1}" @click="${()=>this._pick(e.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(e)}<span class="option-copy"><span class="name" ?data-tooltip-truncated="${s===o}" data-tooltip="${o}">${s}</span>${e.secondary?c`<span class="secondary" data-tooltip-truncated data-tooltip="${e.secondary}">${e.secondary}</span>`:u}</span>${e.detail?c`<span class="detail">${e.detail}</span>`:u}</button>`}updated(e){this.disabled&&this._open&&this._close(!1),e.has("options")&&(this._menuHeight=null),this._position(),(e.has("_query")||e.has("_facet"))&&(this.renderRoot.querySelector(".results").scrollTop=0)}_beforeToggle(e){this._open=e.newState==="open",delete e.target.dataset.positioned,this._open&&(this._query="",this._facet=null,this._menuHeight=null)}async _toggle(e){e.newState==="open"&&(await this.updateComplete,!(!this._open||!this.isConnected)&&(this._position(),this.renderRoot.querySelector("input").focus({preventScroll:!0})))}_position(){let e=this.renderRoot.querySelector(".menu");if(!e?.matches(":popover-open"))return;let t=this.renderRoot.querySelector(".trigger").getBoundingClientRect(),i=8,s=e.querySelector(".facets")!=null,o=Math.min(Math.max(t.width,s?560:360),window.innerWidth-i*2),n=window.innerHeight-t.bottom-i-4,a=t.top-i-4;e.style.width=`${o}px`,this._menuHeight??=Math.min(480,e.querySelector(".search").offsetHeight+Math.max(e.querySelector(".results").scrollHeight,e.querySelector(".facets")?.scrollHeight??0)+2);let l=this._menuHeight,d=n<l&&a>n;e.style.maxHeight=`${Math.max(0,Math.min(l,d?a:n))}px`,e.style.left=`${Math.max(i,Math.min(t.left,window.innerWidth-o-i))}px`,e.style.top=`${Math.max(i,d?t.top-e.offsetHeight-4:t.bottom+4)}px`,e.dataset.positioned=""}_filterFacet(e){this._facet=e,this.renderRoot.querySelector("input").focus({preventScroll:!0})}_keyDown(e){if(e.stopPropagation(),e.key==="Escape"){e.preventDefault(),this._close();return}let t=this.renderRoot.querySelector("input"),i=this.renderRoot.activeElement,s=[...this.renderRoot.querySelectorAll(".option:not(:disabled)")],o=s.indexOf(i);if(i!==t&&o<0)return;if(e.key==="Enter"&&i===t){e.preventDefault(),(this.renderRoot.querySelector(".option:not([data-reset]):not(:disabled)")??s[0])?.click();return}let n;if(e.key==="ArrowDown")n=Math.min(o+1,s.length-1);else if(e.key==="ArrowUp")n=o-1;else if(i!==t&&e.key==="Home")n=0;else if(i!==t&&e.key==="End")n=s.length-1;else if(i!==t&&e.key.length===1&&e.key!==" "&&!e.ctrlKey&&!e.metaKey&&!e.altKey){e.preventDefault(),this._query+=e.key,t.focus();return}else return;e.preventDefault();for(let[a,l]of s.entries())l.tabIndex=a===n?0:-1;n<0?t.focus():s[n]?.focus()}_pick(e){this.disabled||!this.options.some(t=>t.value===e&&!t.disabled)||(this._close(),this.dispatchEvent(new CustomEvent(this.changeEvent,{detail:{value:e},bubbles:!0,composed:!0})))}_close(e=!0){this.renderRoot.querySelector(".menu").hidePopover(),this._open=!1,e&&this.renderRoot.querySelector(".trigger").focus({preventScroll:!0})}};var di=class extends D{get changeEvent(){return"local-item-change"}get searchLabel(){return"Search local files"}get optionsLabel(){return"Local files"}get noMatchesLabel(){return"No matching files."}get emptyLabel(){return"No local files available."}choices(){let e=this._query.trim().toLocaleLowerCase(),t=this.options.filter(i=>`${i.label} ${i.secondary??""}`.toLocaleLowerCase().includes(e));return{pinned:[],sections:[{options:t}],count:t.length,total:this.options.length,showFacets:!1}}};customElements.define("managed-local-item-selector",di);var bt=class{constructor(e,t,i){this.host=e,this.kind=t,this.upload=i,this.source=null,this.hasData=!1,this.open=!1,this.options=[],this.value=null,this.busy=!1,this.loading=!1,this.error="",this.success="",this.generation=0,this.readAbort=null,this.onChange=s=>{if(s?.kind){if(s.kind!==this.kind)return;if(s.value!==this.value){this.refresh();return}}this.readAbort&&!this.readAbort.signal.aborted&&(this.readAbort.abort(),this.error=`The local ${this.kind} changed or the list was refreshed. Select it again before importing.`),this.options=[],this.value=null,this.success="",this.refresh()},this.onBlur=()=>{this.readAbort&&!this.readAbort.signal.aborted&&this.onChange()},this.onVisibilityChange=()=>{globalThis.document?.visibilityState==="hidden"&&this.onBlur()},e.addController(this)}hostConnected(){globalThis.addEventListener("focus",this.onChange),globalThis.addEventListener("blur",this.onBlur),globalThis.addEventListener("storage",this.onChange),globalThis.document?.addEventListener("visibilitychange",this.onVisibilityChange),this.connectSource()}hostUpdated(){this.connectSource()}connectSource(){this.source!==this.host.localImportSource&&(this.unsubscribe?.(),this.abort?.abort(),this.source=this.host.localImportSource,this.unsubscribe=this.source?.subscribe(this.onChange),this.onChange())}hostDisconnected(){++this.generation,this.abort?.abort(),this.unsubscribe?.(),this.source=null,globalThis.removeEventListener("focus",this.onChange),globalThis.removeEventListener("blur",this.onBlur),globalThis.removeEventListener("storage",this.onChange),globalThis.document?.removeEventListener("visibilitychange",this.onVisibilityChange)}async refresh(){let e=++this.generation,t=this.source;this.loading=!0,this.host.requestUpdate();try{let i=t?await t.hasData(this.kind):!1;if(e!==this.generation)return;this.hasData=i;let s=this.open&&!t?.locked?await t?.list(this.kind)??[]:[];if(e!==this.generation)return;this.options=s,s.some(o=>o.value===this.value)||(this.value=null)}catch(i){e===this.generation&&(this.error=String(i?.message??i))}finally{e===this.generation&&(this.loading=!1,this.host.requestUpdate())}}toggle(){this.busy||(this.open=!this.open,this.error="",this.success="",this.options=[],this.value=null,this.refresh())}async unlock(){if(this.busy)return;this.busy=!0,this.error="";let e=this.abort=new AbortController;this.host.requestUpdate();try{await this.source.unlock({signal:e.signal})&&!e.signal.aborted&&await this.refresh()}catch(t){e.signal.aborted||(this.error=String(t?.message??t))}finally{this.busy=!1,this.host.requestUpdate()}}async importSelected(){if(this.busy||this.loading||!this.value||this.source?.locked)return;this.busy=!0,this.error="",this.success="";let e=this.options.find(i=>i.value===this.value)?.label,t=this.abort=new AbortController;this.readAbort=t,this.host.requestUpdate();try{await this.source.importItem(this.kind,this.value,i=>(this.readAbort=null,this.upload(i)),{signal:t.signal}),!t.signal.aborted&&!this.source?.locked&&(this.success=`Imported ${e}.`,this.value=null)}catch(i){t.signal.aborted||(this.error=String(i?.message??i))}finally{this.readAbort===t&&(this.readAbort=null),this.busy=!1,this.host.requestUpdate()}}renderAction(){return this.hasData||this.open?c`<button type="button" class="local-import-toggle" aria-expanded="${this.open}" aria-controls="local-import-panel" ?disabled="${this.busy}" @click="${()=>this.toggle()}">Import</button>`:u}renderPanel(e){if(!this.open)return u;let t=this.source?.locked;return c`<section class="local-import-panel" id="local-import-panel" aria-label="${`Import local ${this.kind}`}"><div class="local-import-copy"><strong>Import local ${this.kind}</strong><p>${t?"Unlock local data with your passkey to choose a file.":"Copy a file from this browser to the managed workspace. The local copy stays on this device."}</p></div><div class="local-import-controls">${t?c`<button type="button" class="local-import-submit" ?disabled="${this.busy}" @click="${()=>this.unlock()}">${this.busy?"Waiting for passkey\u2026":"Unlock with passkey"}</button>`:c`<managed-local-item-selector label="${`Choose local ${this.kind}`}" placeholder="${this.loading?"Loading local files\u2026":`Choose local ${this.kind}\u2026`}" .options="${this.options}" .value="${this.value}" ?disabled="${this.busy||this.loading}" @local-item-change="${i=>{this.value=i.detail.value,this.success="",this.host.requestUpdate()}}"></managed-local-item-selector><button type="button" class="local-import-submit" ?disabled="${e||this.busy||this.loading||!this.value}" @click="${()=>this.importSelected()}">${this.busy?"Importing\u2026":`Import ${this.kind}`}</button>`} <button type="button" class="local-import-close" ?disabled="${this.busy}" @click="${()=>this.toggle()}">Close</button></div>${!t&&!this.loading&&this.options.length===0?c`<p class="local-import-message">No local ${this.kind}s available.</p>`:u} ${this.error?c`<p class="local-import-message error" role="alert">${this.error} <button type="button" ?disabled="${this.busy}" @click="${()=>{this.error="",this.refresh()}}">Retry</button></p>`:u} ${this.success?c`<p class="local-import-message" role="status">${this.success}</p>`:u}</section>`}};B();ie();async function mp({signal:r}={}){r=r?AbortSignal.any([r,C.sessionController.signal]):C.sessionController.signal,r.throwIfAborted();let e=await $("/api/admin/bundles",{credentials:"same-origin",signal:r});if(r.throwIfAborted(),!e.ok)throw Object.assign(new Error(`Bundle catalogue request failed (${e.status})`),{status:e.status});let t=await e.json();return r.throwIfAborted(),t.bundles??[]}async function rr(r,e,t){let i=C.generation,s=await $(`/api/bundles/${encodeURIComponent(r)}/${e}`,{credentials:"same-origin",signal:t});if(t?.throwIfAborted(),!s.ok)throw Object.assign(new Error(`Bundle ${e} request failed (${s.status})`),{status:s.status});let o=e==="contents"?await s.text():await s.json();if(t?.throwIfAborted(),i!==C.generation)throw new DOMException("Managed session changed","AbortError");return o}function pi(r,{signal:e}={}){return C.load(`bundle-metadata:${r}`,"bundle metadata",t=>rr(r,"metadata",t),{signal:e})}async function Sn(r,{signal:e}={}){return e=e?AbortSignal.any([e,C.sessionController.signal]):C.sessionController.signal,(await rr(r,"metadata",e))?.bundle?.repo??null}async function fp(r,{signal:e}={}){e=e?AbortSignal.any([e,C.sessionController.signal]):C.sessionController.signal;try{return await rr(r,"contents",e)}catch(t){throw t.name!=="AbortError"&&C.notify(`Couldn't load bundle contents: ${t.message}`),t}}function gp(r,e,t="",i=!1){let s=[e?`team=${encodeURIComponent(e)}`:"",t?`reason=${encodeURIComponent(t)}`:"",i?"repoAdvisories=true":""].filter(Boolean).join("&"),o=`advisories${s?`?${s}`:""}`;return rr(r,o,C.sessionController.signal)}B();async function ze(r,e){let t=await $(r,{signal:e,credentials:"same-origin",headers:{accept:"application/json"}});if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function Oe(r,e,t){let i={"content-type":"application/json"};return e&&(i["x-csrf-token"]=e),$(r,{method:"POST",credentials:"same-origin",headers:i,body:JSON.stringify(t)})}async function Cn(r,e,t){let i=t?{"x-csrf-token":t}:{},s=await $(`/api/admin/${r}/${encodeURIComponent(e)}`,{method:"DELETE",credentials:"same-origin",headers:i});if(!s.ok)throw new Error(`HTTP ${s.status}`)}async function En(r,e,t,i,s,o){let n=new URLSearchParams({page:String(e),limit:"100",kind:t,q:i.trim()});s&&n.set("repo",s),o&&n.set("actor",o);let a=await ze(`/api/admin/history?${n}`,r);if(!Array.isArray(a?.history)||!Number.isSafeInteger(a.total)||a.total<0||!Number.isSafeInteger(a.page)||a.page<1)throw new Error("No history returned");return a}async function Rn(r){let e=await ze("/api/admin/users",r);return Array.isArray(e?.users)?e.users:[]}async function An(r,e,t){let i=await Oe("/api/admin/set-role",t,{userId:r,role:e});if(!i.ok)throw new Error(`HTTP ${i.status}`)}async function Mn(r,e,t,i){let s=new URLSearchParams({scope:r});return r==="installed"&&s.set("showAll",String(e)),t&&s.set("refresh","true"),await ze(`/api/admin/repositories?${s}`,i)}async function In(r,e,t){let i=await Oe("/api/admin/repositories/select",t,{repoId:r,selected:e});if(!i.ok)throw new Error(`HTTP ${i.status}`)}async function Ln(r,e){let t=await $("/api/admin/repositories/add-public",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json","x-csrf-token":e},body:JSON.stringify({repository:r})});if(!t.ok){let i={400:"Enter a repository as owner/repo or a GitHub repository URL.",403:"You do not have permission to add arbitrary public repositories.",404:"No public repository was found at that address.",409:"Choose a public, non-archived repository."};throw new Error(i[t.status]??`GitHub lookup failed (HTTP ${t.status}). Try again.`)}}async function zn(r,e){let t=await ze(`/api/admin/repositories/impact?repoId=${encodeURIComponent(r)}`,e);if(t?.repoId!==r||!Array.isArray(t.reports)||!Array.isArray(t.bundles)||!Number.isSafeInteger(t.triageCount)||t.triageCount<0)throw new Error("Invalid repository data");return t}async function On(r,e){let t=await $("/api/admin/repositories/connect-app",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json","x-csrf-token":e},body:JSON.stringify({repoId:r})}),i=await t.json();if(!t.ok){let s={"github-app-not-configured":"The GitHub App is not configured on this server.","repo-identity-changed":"The repository has changed on GitHub. Refresh and check its connection.","repo-connection-changed":"The connection or your permissions changed. Refresh and try again.","repo-not-connected":"This repository is no longer connected.",forbidden:"Administrator access is required to connect the GitHub App."};throw new Error(s[i.error]??`Could not connect the GitHub App (HTTP ${t.status}). Try again.`)}if(i.connected===!0)return i;if(i.connected!==!1||typeof i.installUrl!="string"||!/^https:\/\/github\.com\/apps\/[^/?#]+\/installations\/new$/u.test(i.installUrl))throw new Error("Invalid GitHub installation response.");return i}async function Tn(r,e,t,i){let s=await Oe("/api/admin/repositories/remove",i,{repoId:r,fullName:e,acknowledge:!0,deleteTriage:t});if(!s.ok)throw new Error(`HTTP ${s.status}`);return s.json()}async function Nn(r){return await ze("/api/admin/reports",r)}async function Bn(r,e,t){let i=await $("/api/admin/bundles/create",{method:"POST",credentials:"same-origin",signal:t,headers:{"content-type":"application/json","x-csrf-token":e},body:JSON.stringify(r)}),s=await i.json();if(!i.ok){let o={"unsupported-entries":"Select JavaScript/TypeScript files or Solidity files. Stasis cannot mix languages or use JSON, JSX, TSX, or Rust as remote entry points.","bad-conditions":"Check the export conditions and selected platforms.","metro-conditions":"Stasis\u2019s Metro preset requires the react-native condition without manual changes.","build-lockfile":"Stasis needs a supported lockfile: pnpm-lock.yaml, yarn.lock (Yarn 1), package-lock.json, or soldeer.lock.","build-scope":"Your team needs access to the bundle\u2019s project root, including its lockfile and dependencies.","build-busy":"A bundle is already being built, or the server is busy. Try again shortly.","build-timeout":"The bundle build timed out. Try a smaller selection or retry.","too-large":"This bundle exceeds the server\u2019s size limit.","github-rate-limited":"GitHub\u2019s API rate limit has been reached. Retry after the limit resets.","github-build-failed":"Could not fetch the repository from GitHub. Check access and retry.","repository-changed":"The repository connection changed during the build. Reload and try again.","bundle-conflict":"This bundle already exists but is outside your current access.","build-failed":"Stasis could not build this selection. Check that its lockfile is supported and all entry points and imports exist at this commit."};throw new Error(o[s.error]??(i.status===401?"Sign in again to create a bundle.":i.status===403||i.status===404?"Repository access is required to create this bundle.":"Could not create the bundle. Try again."))}return s}async function ui(r,e,t=null,i=""){let s={"content-type":r.type||"application/json","x-report-filename":encodeURIComponent(r.name)};e&&(s["x-csrf-token"]=e),t!=null&&(s["x-repo-id"]=String(t)),i!==""&&(s["x-repo-directory"]=encodeURIComponent(i));let o=await $("/api/admin/reports",{method:"POST",credentials:"same-origin",headers:s,body:r});if(!o.ok){if(o.status===413)throw new Error("too large");if(o.status===403)throw new Error("choose a repository and directory within your team access");let n="";try{let a=await o.json();a?.error==="repo-not-connected"&&typeof a.repo=="string"&&(n=`: ${a.repo} is not connected`)}catch{}throw new Error(`HTTP ${o.status}${n}`)}return o.json()}async function Pn(r,e,t){let i=await Oe("/api/admin/reports/set-visible",t,{reportId:r,visible:e});if(!i.ok)throw new Error(`HTTP ${i.status}`)}async function Dn(r,e,t,i){let s=await Oe("/api/admin/reports/set-repo",i,{reportId:r,repoId:e,directory:t});if(!s.ok)throw s.status===409?new Error("this report already defines its repository"):s.status===403?new Error("choose a repository and directory within your team access"):new Error(s.status===400?"invalid repository or directory":`HTTP ${s.status}`);return s.json()}async function jn(r,e){await Cn("reports",r,e)}async function hi(r){return await ze("/api/admin/bundles",r)}async function mi(r,e,t,i=""){let s={"content-type":"application/octet-stream","x-bundle-filename":encodeURIComponent(r.name)};e&&(s["x-csrf-token"]=e),t!=null&&(s["x-repo-id"]=String(t)),i&&(s["x-repo-directory"]=encodeURIComponent(i));let o=await $("/api/admin/bundles",{method:"POST",credentials:"same-origin",headers:s,body:r});if(!o.ok)throw new Error(o.status===413?"too large":o.status===403?"choose a repository and directory within your team access":`HTTP ${o.status}`);return o.json()}async function Un(r,e){await Cn("bundles",r,e)}async function Fn(r,e,t,i){let s=await Oe("/api/admin/bundles/set-repo",i,{bundleId:r,repoId:e,directory:t});if(!s.ok)throw new Error(s.status===403?"choose a repository and directory within your team access":s.status===400?"invalid repository or directory":`HTTP ${s.status}`)}async function fi(r){return await ze("/api/admin/teams",r)}async function oe(r,e,t){let i=await Oe(r,e,t);if(!i.ok)throw new Error(i.status===409?"name already taken":`HTTP ${i.status}`)}function gi(r,e=!0){let t=document.createElement("input");t.type="file",t.multiple=e,t.addEventListener("change",()=>{r([...t.files])},{once:!0}),t.click()}function bi(r,e,t){let i=0,s=d=>Array.from(d.dataTransfer?.types??[]).includes("Files"),o=d=>{s(d)&&(d.preventDefault(),i+=1,t(!0))},n=d=>{s(d)&&d.preventDefault()},a=d=>{s(d)&&(i=Math.max(0,i-1),i===0&&t(!1))},l=d=>{s(d)&&(d.preventDefault(),d.stopPropagation(),i=0,t(!1),e([...d.dataTransfer.files]))};return r.addEventListener("dragenter",o),r.addEventListener("dragover",n),r.addEventListener("dragleave",a),r.addEventListener("drop",l),()=>{r.removeEventListener("dragenter",o),r.removeEventListener("dragover",n),r.removeEventListener("dragleave",a),r.removeEventListener("drop",l)}}async function vi(r,e,t,i){if(r._busy||!r._csrf)throw new Error("Wait for the current operation to finish, then try again.");r._busy=!0;try{await r.appState.mutate(()=>t(e),i)}finally{await r._load(),r._busy=!1;let s=r._queue.splice(0);s.length>0&&r._upload(s)}}async function yi(r,e,t,i){if(e.length!==0&&(r._queue.push(...e),!r._busy)){r._busy=!0,r._error=null;try{for(;r._queue.length>0;){let s=r._queue.shift();await r.appState.mutate(()=>t(s),i)}}catch(s){r._queue=[],r._error=`Upload failed: ${String(s?.message??s)}`}finally{r._busy=!1,await r._load({preserveError:!0})}}}var wi=`.local-import-toggle{flex-shrink:0;margin-block:calc(-.25rem - 1px);margin-left:auto;padding:.25rem .6rem;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);background:transparent;color:var(--muted);font:inherit;font-size:.75rem;line-height:1.5}.local-import-toggle:hover,.local-import-toggle[aria-expanded=true]{color:var(--text);background:rgb(from var(--text) r g b / .06)}.local-import-panel{display:grid;gap:.8rem;padding:1rem;margin-bottom:1.25rem;border:1px solid var(--border);border-radius:var(--ui-radius, 8px);background:rgb(from var(--accent) r g b / .025)}.local-import-copy strong{font-size:.82rem;font-weight:600}.local-import-copy p,.local-import-message{margin:.3rem 0 0;color:var(--muted);font-size:.75rem;line-height:1.5}.local-import-controls{display:flex;align-items:center;flex-wrap:wrap;gap:.5rem}managed-local-item-selector{flex:1 1 16rem;min-width:0}.local-import-controls button,.local-import-message button{padding:.35rem .7rem;border:1px solid var(--border);border-radius:var(--ui-radius, 5px);background:transparent;color:var(--text);font:inherit;font-size:.75rem;line-height:1.5}.local-import-controls .local-import-submit{border-color:rgb(from var(--accent) r g b / .4);background:rgb(from var(--accent) r g b / .1);color:var(--accent)}.local-import-controls .local-import-close{color:var(--muted)}.local-import-panel button:disabled,.local-import-toggle:disabled{opacity:.5}.local-import-panel button:focus-visible,.local-import-toggle:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.local-import-message.error{color:var(--critical)}
|
|
67
|
+
`});var wc={};vr(wc,{openFindingHistoryDialog:()=>ch});function ch(r){return r.isCurrent()?Qe("finding-history-dialog",r):Promise.resolve(null)}var zs,_c=w(()=>{"use strict";S();B();ie();fr();pc();hc();mc();gc();vc();zs=class extends W{static styles=[...W.styles,x(bc),x(fc),x(yc)];static properties={finding:{attribute:!1},teamId:{attribute:!1},_events:{state:!0},_loading:{state:!0},_error:{state:!0}};constructor(){super(),this._events=[],this._loading=!0,this._error=!1}beforeOpen(){this._load()}async _load(){if(!this.isCurrent()){this._finish(null);return}this._loading=!0,this._error=!1;let{_managedReportId:e,id:t}=this.finding;this._key=`finding-history:${this.teamId??""}:${e}:${t}`,C.invalidate([this._key]);let i=C.load(this._key,"issue history",async s=>{let o=new URLSearchParams({finding:t});this.teamId&&o.set("team",this.teamId);let n=await $(`/api/reports/${encodeURIComponent(e)}/triage/history?${o}`,{credentials:"same-origin",signal:s});if(!n.ok)throw new Error(`History request failed (${n.status})`);let a=await n.json();if(a.finding!==t||!Array.isArray(a.events))throw new Error("Invalid history response");return a.events});this._owner=C.resources.get(this._key),this._signal=this._owner.controller.signal,this._signal.addEventListener("abort",this._onClose,{once:!0});try{let s=await i;if(this._settled||!this.isConnected)return;if(!this.isCurrent()){this._finish(null);return}this._events=s}catch(s){if(this._settled||!this.isConnected)return;s.name==="AbortError"||!this.isCurrent()?this._finish(null):this._error=!0}finally{this._loading=!1}}disconnectedCallback(){this._signal?.removeEventListener("abort",this._onClose),this._owner&&C.resources.get(this._key)===this._owner&&C.invalidate([this._key]),this._events=[],super.disconnectedCallback()}_onKeydown=e=>{e.key==="Escape"&&e.stopPropagation()};_renderEvent(e,t){let i=this._events[t+1],s=dc(e.entry,i?.entry),o=new Date(e.at),n=e.actorLogin?`@${e.actorLogin}`:"";return c`<li class="event">${e.actorId?uc(e.actorId,e.actorName||e.actorLogin):c`<span class="managed-comment-avatar" aria-hidden="true">${(e.actorLogin?.[0]||"?").toUpperCase()}</span>`}<div class="event-content"><div class="event-meta"><div class="event-user"><strong>${e.actorName||n||"Unknown user"}</strong> ${e.actorName&&n?c`<span class="username">${n}</span>`:u}</div><time datetime="${o.toISOString()}" data-tooltip="${o.toLocaleString()}">${o.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}</time></div><p class="event-action">${e.entry===null?"Cleared triage":i?"Updated triage":"Recorded triage state"}</p>${s.length>0?c`<dl class="changes">${s.map(a=>c`<div class="change"><dt>${a.label}</dt><dd class="${a.before===void 0?"snapshot":""}">${a.before===void 0?u:c`<span class="before"><span class="sr-only">Previously: </span>${a.before}</span> <span class="change-arrow" aria-hidden="true">→</span>`} <span class="after"><span class="sr-only">${a.before===void 0?"Recorded: ":"Changed to: "}</span>${a.after}</span></dd></div>`)}</dl>`:u}</div></li>`}render(){let e=this.finding??{};return c`<dialog aria-labelledby="history-title" @close="${this._onClose}" @keydown="${this._onKeydown}"><header><div class="history-heading"><h3 id="history-title"><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 11a9 9 0 1 1 2.5 7M3 5v6h6M12 7v5l3 2"/></svg>Issue history</h3><p class="location">${e.file}${e.line?`:${e.line}`:""}</p></div><button type="button" class="detail-action" aria-label="Close issue history" @click="${this._onClose}">×</button></header>${!this._loading&&!this._error&&this._events.length>0?c`<div class="history-summary"><span>${this._events.length} ${this._events.length===1?"record":"records"}</span><span>Newest first</span></div>`:u}<div class="history-body" aria-busy="${String(this._loading)}">${this._loading?c`<p class="history-state" role="status">Loading history…</p>`:this._error?c`<div class="history-state" role="alert"><strong>Couldn’t load issue history</strong><p>Close and reopen to try again.</p></div>`:this._events.length===0?c`<div class="history-state" role="status"><strong>No triage changes yet</strong><p>Changes to status, labels, flags, and fixes will appear here.</p></div>`:c`<ol class="timeline">${this._events.map((t,i)=>this._renderEvent(t,i))}</ol>`}</div></dialog>`}};customElements.define("finding-history-dialog",zs)});B();S();mt();S();ie();var T=class extends A{static properties={session:{attribute:!1},allowShare:{attribute:!1},_loading:{state:!0}};constructor(){super(),this.session=null,this.allowShare=!1,this.appState=C,this._loading=!1,this._loadRequest=null}get _role(){return this.session?.role??null}get _csrf(){return this.session?.csrfToken??null}get _me(){return this.session?.id??null}disconnectedCallback(){this._loadRequest?.abort(),super.disconnectedCallback()}async _loadCollection(e,t,i,s){this._loadRequest?.abort();let o=new AbortController;this._loadRequest=o,this._loading=!0;try{await this.appState.load(e,t,i,{signal:o.signal,apply:s})}catch(n){!o.signal.aborted&&n?.name!=="AbortError"&&this.appState.read(e)===void 0&&(this._error=String(n?.message??n))}finally{this._loadRequest===o&&(this._loading=!1)}}};function se(r){return c`<div class="loading-rows" role="status"><span class="sr-only">${r}</span><div aria-hidden="true">${[0,1,2,3].map(()=>c`<div class="loading-row"><span></span><span></span></div>`)}</div></div>`}J();ft();var gt=class extends X{constructor(e){if(super(e),this.it=u,e.type!==G.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===u||e==null)return this._t=void 0,this.it=e;if(e===O)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};gt.directiveName="unsafeHTML",gt.resultType=1;var z=fe(gt);yr();_r();be();var wn={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="${un}"/>`},"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"/>'}},dp={default:["#2563eb","#fff"],"claude-security":["#d97757","#fff"],"codex-security":["#fff","#000"],deepsec:["#000","#fff"],piolium:["#fbb829","#1c1b19"]},li=Object.fromEntries(Object.entries(wn).map(([r,{className:e,mark:t}])=>{let[i,s]=dp[r],o=r==="codex-security"||r==="deepsec"?` stroke="${s}" stroke-width=".5"`:"";return[r,`<svg class="file-icon ${e}" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path class="bg" fill="${i}"${o} d="M3 2h6l4 4v8H3z"/><path fill="rgba(0,0,0,.18)" d="M9 2v4h4Z"/><g fill="${s}">${t}</g></svg>`]})),ci=Object.fromEntries(Object.entries(wn).map(([r,{className:e,mark:t}])=>[r,`<span class="report-logo ${e}" aria-hidden="true"><svg viewBox="${r==="default"?"3.5 4 9 9":"4 5 8 8"}" width="14" height="14">${t}</svg></span>`]));be();S();be();var pp=[["manage","Overview"],["manage-bundles","Bundles"],["manage-scans","Scans"],["manage-reports","Reports"],["manage-repos","Repositories","admin"],["admin-users","Users","admin"],["manage-teams","Teams","admin"],["manage-import","Import","admin"],["manage-links","Links"],["manage-history","History"]];function F(r,e,t=!1){return c`<header class="manage-header"><nav class="manage-nav" aria-label="Management pages">${pp.filter(([i,,s])=>(s==null||s===e)&&(i!=="manage-links"||t)).map(([i,s])=>c`<button type="button" aria-current="${r===i?"page":u}" @click="${()=>{document.dispatchEvent(new CustomEvent("managed-admin-navigate",{detail:{view:i},bubbles:!0,composed:!0}))}}">${s}</button>`)}</nav></header>`}function P(r){if(r==="bundle")return z(ge);if(r==="report"||r==="preview")return z(Ge);if(r==="scan")return z(mn);let e={users:"M10.75 4.75a2.75 2.75 0 1 1-5.5 0 2.75 2.75 0 0 1 5.5 0ZM3 14v-1.5A3.5 3.5 0 0 1 6.5 9h3a3.5 3.5 0 0 1 3.5 3.5V14",team:"M8.5 5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0ZM1.5 14v-1.5A3.5 3.5 0 0 1 5 9h2a3.5 3.5 0 0 1 3.5 3.5V14M11 2.75a2.5 2.5 0 0 1 0 4.5m1 2a3 3 0 0 1 2.5 3V14",repo:"M3 12.5V3a1.5 1.5 0 0 1 1.5-1.5H13v13H4.5a1.5 1.5 0 0 1 0-3H13M7 1.5v6l2-1.5 2 1.5v-6",history:"M2 5a6.25 6.25 0 1 1-.25 5M1.5 1.5V5H5M8 4.5V8l3 1.5",arrow:"M3 8h10M9 4l4 4-4 4",show:"M1 8s2.5-4.5 7-4.5S15 8 15 8s-2.5 4.5-7 4.5S1 8 1 8Zm9 0a2 2 0 1 0-4 0 2 2 0 0 0 4 0",hide:"m2 2 12 12M6 3.75A8 8 0 0 1 8 3.5c4.5 0 7 4.5 7 4.5a12 12 0 0 1-2 2.5M3.5 5A13 13 0 0 0 1 8s2.5 4.5 7 4.5a8 8 0 0 0 3-.6",download:"M8 2v8M5 7l3 3 3-3M2 11v3h12v-3",upload:"M8 11V2m-3 3 3-3 3 3M2 10v4h12v-4"};return c`<svg class="${r==="repo"?"repo-icon":u}" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${e[r]??e.repo}"></path></svg>`}S();S();J();ft();tr();var q=fe(class extends X{constructor(r){if(super(r),r.type!==G.PROPERTY&&r.type!==G.ATTRIBUTE&&r.type!==G.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!$n(r))throw Error("`live` bindings can only contain a single expression")}render(r){return r}update(r,[e]){if(e===O||e===u)return e;let t=r.element,i=r.name;if(r.type===G.PROPERTY){if(e===t[i])return O}else if(r.type===G.BOOLEAN_ATTRIBUTE){if(!!e===t.hasAttribute(i))return O}else if(r.type===G.ATTRIBUTE&&t.getAttribute(i)===e+"")return O;return We(r),e}});var D=class extends A{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=I`:host{display:block;min-width:0}:host,.menu{-webkit-app-region:no-drag;app-region:no-drag}*{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:var(--ui-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:var(--ui-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:var(--ui-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:var(--ui-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:var(--ui-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(),this.dispatchEvent(new CustomEvent("tooltip-root-connected",{bubbles:!0,composed:!0})),window.addEventListener("resize",this._onViewport),window.addEventListener("scroll",this._onViewport,!0),this._scrollRoots=[];for(let e=this.getRootNode();e.host;e=e.host.getRootNode())e.addEventListener("scroll",this._onViewport,!0),this._scrollRoots.push(e)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this._onViewport),window.removeEventListener("scroll",this._onViewport,!0);for(let e of this._scrollRoots??[])e.removeEventListener("scroll",this._onViewport,!0);this._scrollRoots=[]}render(){let e=this.options.find(n=>n.value===this.value),t=this.choices(),s=[...t.pinned,...t.sections.flatMap(n=>n.options)].filter(n=>!n.disabled),o=s.find(n=>n.value===this.value)?.value??s[0]?.value;return c`<button type="button" class="trigger" popovertarget="selector-menu" aria-label="${this.label}" aria-haspopup="dialog" aria-expanded="${this._open}" ?disabled="${this.disabled}">${e?this.optionIcon(e):u}<span class="name" data-tooltip-truncated data-tooltip="${e?.label??u}">${e?.label??this.placeholder}</span>${e?.detail?c`<span class="detail">${e.detail}</span>`:u} <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="${q(this._query)}" @input="${n=>{this._query=n.target.value}}"> <span class="count" role="status">${t.count}${t.count===t.total?"":` / ${t.total}`}</span></div><div class="body">${t.showFacets?c`<div class="facets" role="group" aria-label="${this.facetLabel}"><button type="button" class="org" aria-pressed="${t.activeFacet==null}" @click="${()=>this._filterFacet(null)}"><span class="name">${this.allFacetsLabel}</span><span class="count">${t.total}</span></button> ${t.facets.map(n=>c`<button type="button" class="org" aria-pressed="${t.activeFacet===n.value}" @click="${()=>this._filterFacet(n.value)}"><span class="name" data-tooltip-truncated data-tooltip="${n.name}">${n.name}</span><span class="count">${n.count}</span></button>`)}</div>`:u}<div class="results" id="selector-options" role="listbox" aria-label="${this.optionsLabel}">${t.pinned.length>0?c`<div class="pinned">${t.pinned.map(n=>this._option(n,!1,o))}</div>`:u} ${t.sections.map((n,a)=>c`<div class="group" role="group" aria-labelledby="${n.label?`selector-group-${a}`:u}">${n.label?c`<h3 class="heading" id="${`selector-group-${a}`}">${n.organization?c`<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>`:u}${n.label}</h3>`:u} ${n.options.map(l=>this._option(l,n.organization,o))}</div>`)} ${t.count?u:c`<p class="empty">${this.options.length>0?this.noMatchesLabel:this.emptyLabel}</p>`}</div></div></div>`}optionIcon(e){return e.initials?c`<span class="avatar" aria-hidden="true">${e.initials}</span>`:u}optionTooltip(e){return e.label}_option(e,t,i){let s=e.displayLabel??(t?e.name:e.label),o=this.optionTooltip(e);return c`<button type="button" class="option" role="option" ?data-reset="${e.reset}" ?disabled="${e.disabled}" aria-label="${e.label}" aria-selected="${e.value===this.value}" tabindex="${e.value===i?0:-1}" @click="${()=>this._pick(e.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(e)}<span class="option-copy"><span class="name" ?data-tooltip-truncated="${s===o}" data-tooltip="${o}">${s}</span>${e.secondary?c`<span class="secondary" data-tooltip-truncated data-tooltip="${e.secondary}">${e.secondary}</span>`:u}</span>${e.detail?c`<span class="detail">${e.detail}</span>`:u}</button>`}updated(e){this.disabled&&this._open&&this._close(!1),e.has("options")&&(this._menuHeight=null),this._position(),(e.has("_query")||e.has("_facet"))&&(this.renderRoot.querySelector(".results").scrollTop=0)}_beforeToggle(e){this._open=e.newState==="open",delete e.target.dataset.positioned,this._open&&(this._query="",this._facet=null,this._menuHeight=null)}async _toggle(e){e.newState==="open"&&(await this.updateComplete,!(!this._open||!this.isConnected)&&(this._position(),this.renderRoot.querySelector("input").focus({preventScroll:!0})))}_position(){let e=this.renderRoot.querySelector(".menu");if(!e?.matches(":popover-open"))return;let t=this.renderRoot.querySelector(".trigger").getBoundingClientRect(),i=8,s=e.querySelector(".facets")!=null,o=Math.min(Math.max(t.width,s?560:360),window.innerWidth-i*2),n=window.innerHeight-t.bottom-i-4,a=t.top-i-4;e.style.width=`${o}px`,this._menuHeight??=Math.min(480,e.querySelector(".search").offsetHeight+Math.max(e.querySelector(".results").scrollHeight,e.querySelector(".facets")?.scrollHeight??0)+2);let l=this._menuHeight,d=n<l&&a>n;e.style.maxHeight=`${Math.max(0,Math.min(l,d?a:n))}px`,e.style.left=`${Math.max(i,Math.min(t.left,window.innerWidth-o-i))}px`,e.style.top=`${Math.max(i,d?t.top-e.offsetHeight-4:t.bottom+4)}px`,e.dataset.positioned=""}_filterFacet(e){this._facet=e,this.renderRoot.querySelector("input").focus({preventScroll:!0})}_keyDown(e){if(e.stopPropagation(),e.key==="Escape"){e.preventDefault(),this._close();return}let t=this.renderRoot.querySelector("input"),i=this.renderRoot.activeElement,s=[...this.renderRoot.querySelectorAll(".option:not(:disabled)")],o=s.indexOf(i);if(i!==t&&o<0)return;if(e.key==="Enter"&&i===t){e.preventDefault(),(this.renderRoot.querySelector(".option:not([data-reset]):not(:disabled)")??s[0])?.click();return}let n;if(e.key==="ArrowDown")n=Math.min(o+1,s.length-1);else if(e.key==="ArrowUp")n=o-1;else if(i!==t&&e.key==="Home")n=0;else if(i!==t&&e.key==="End")n=s.length-1;else if(i!==t&&e.key.length===1&&e.key!==" "&&!e.ctrlKey&&!e.metaKey&&!e.altKey){e.preventDefault(),this._query+=e.key,t.focus();return}else return;e.preventDefault();for(let[a,l]of s.entries())l.tabIndex=a===n?0:-1;n<0?t.focus():s[n]?.focus()}_pick(e){this.disabled||!this.options.some(t=>t.value===e&&!t.disabled)||(this._close(),this.dispatchEvent(new CustomEvent(this.changeEvent,{detail:{value:e},bubbles:!0,composed:!0})))}_close(e=!0){this.renderRoot.querySelector(".menu").hidePopover(),this._open=!1,e&&this.renderRoot.querySelector(".trigger").focus({preventScroll:!0})}};var di=class extends D{get changeEvent(){return"local-item-change"}get searchLabel(){return"Search local files"}get optionsLabel(){return"Local files"}get noMatchesLabel(){return"No matching files."}get emptyLabel(){return"No local files available."}choices(){let e=this._query.trim().toLocaleLowerCase(),t=this.options.filter(i=>`${i.label} ${i.secondary??""}`.toLocaleLowerCase().includes(e));return{pinned:[],sections:[{options:t}],count:t.length,total:this.options.length,showFacets:!1}}};customElements.define("managed-local-item-selector",di);var bt=class{constructor(e,t,i){this.host=e,this.kind=t,this.upload=i,this.source=null,this.hasData=!1,this.open=!1,this.options=[],this.value=null,this.busy=!1,this.loading=!1,this.error="",this.success="",this.generation=0,this.readAbort=null,this.onChange=s=>{if(s?.kind){if(s.kind!==this.kind)return;if(s.value!==this.value){this.refresh();return}}this.readAbort&&!this.readAbort.signal.aborted&&(this.readAbort.abort(),this.error=`The local ${this.kind} changed or the list was refreshed. Select it again before importing.`),this.options=[],this.value=null,this.success="",this.refresh()},this.onBlur=()=>{this.readAbort&&!this.readAbort.signal.aborted&&this.onChange()},this.onVisibilityChange=()=>{globalThis.document?.visibilityState==="hidden"&&this.onBlur()},e.addController(this)}hostConnected(){globalThis.addEventListener("focus",this.onChange),globalThis.addEventListener("blur",this.onBlur),globalThis.addEventListener("storage",this.onChange),globalThis.document?.addEventListener("visibilitychange",this.onVisibilityChange),this.connectSource()}hostUpdated(){this.connectSource()}connectSource(){this.source!==this.host.localImportSource&&(this.unsubscribe?.(),this.abort?.abort(),this.source=this.host.localImportSource,this.unsubscribe=this.source?.subscribe(this.onChange),this.onChange())}hostDisconnected(){++this.generation,this.abort?.abort(),this.unsubscribe?.(),this.source=null,globalThis.removeEventListener("focus",this.onChange),globalThis.removeEventListener("blur",this.onBlur),globalThis.removeEventListener("storage",this.onChange),globalThis.document?.removeEventListener("visibilitychange",this.onVisibilityChange)}async refresh(){let e=++this.generation,t=this.source;this.loading=!0,this.host.requestUpdate();try{let i=t?await t.hasData(this.kind):!1;if(e!==this.generation)return;this.hasData=i;let s=this.open&&!t?.locked?await t?.list(this.kind)??[]:[];if(e!==this.generation)return;this.options=s,s.some(o=>o.value===this.value)||(this.value=null)}catch(i){e===this.generation&&(this.error=String(i?.message??i))}finally{e===this.generation&&(this.loading=!1,this.host.requestUpdate())}}toggle(){this.busy||(this.open=!this.open,this.error="",this.success="",this.options=[],this.value=null,this.refresh())}async unlock(){if(this.busy)return;this.busy=!0,this.error="";let e=this.abort=new AbortController;this.host.requestUpdate();try{await this.source.unlock({signal:e.signal})&&!e.signal.aborted&&await this.refresh()}catch(t){e.signal.aborted||(this.error=String(t?.message??t))}finally{this.busy=!1,this.host.requestUpdate()}}async importSelected(){if(this.busy||this.loading||!this.value||this.source?.locked)return;this.busy=!0,this.error="",this.success="";let e=this.options.find(i=>i.value===this.value)?.label,t=this.abort=new AbortController;this.readAbort=t,this.host.requestUpdate();try{await this.source.importItem(this.kind,this.value,i=>(this.readAbort=null,this.upload(i)),{signal:t.signal}),!t.signal.aborted&&!this.source?.locked&&(this.success=`Imported ${e}.`,this.value=null)}catch(i){t.signal.aborted||(this.error=String(i?.message??i))}finally{this.readAbort===t&&(this.readAbort=null),this.busy=!1,this.host.requestUpdate()}}renderAction(){return this.hasData||this.open?c`<button type="button" class="local-import-toggle" aria-expanded="${this.open}" aria-controls="local-import-panel" ?disabled="${this.busy}" @click="${()=>this.toggle()}">Import</button>`:u}renderPanel(e){if(!this.open)return u;let t=this.source?.locked;return c`<section class="local-import-panel" id="local-import-panel" aria-label="${`Import local ${this.kind}`}"><div class="local-import-copy"><strong>Import local ${this.kind}</strong><p>${t?"Unlock local data with your passkey to choose a file.":"Copy a file from this browser to the managed workspace. The local copy stays on this device."}</p></div><div class="local-import-controls">${t?c`<button type="button" class="local-import-submit" ?disabled="${this.busy}" @click="${()=>this.unlock()}">${this.busy?"Waiting for passkey\u2026":"Unlock with passkey"}</button>`:c`<managed-local-item-selector label="${`Choose local ${this.kind}`}" placeholder="${this.loading?"Loading local files\u2026":`Choose local ${this.kind}\u2026`}" .options="${this.options}" .value="${this.value}" ?disabled="${this.busy||this.loading}" @local-item-change="${i=>{this.value=i.detail.value,this.success="",this.host.requestUpdate()}}"></managed-local-item-selector><button type="button" class="local-import-submit" ?disabled="${e||this.busy||this.loading||!this.value}" @click="${()=>this.importSelected()}">${this.busy?"Importing\u2026":`Import ${this.kind}`}</button>`} <button type="button" class="local-import-close" ?disabled="${this.busy}" @click="${()=>this.toggle()}">Close</button></div>${!t&&!this.loading&&this.options.length===0?c`<p class="local-import-message">No local ${this.kind}s available.</p>`:u} ${this.error?c`<p class="local-import-message error" role="alert">${this.error} <button type="button" ?disabled="${this.busy}" @click="${()=>{this.error="",this.refresh()}}">Retry</button></p>`:u} ${this.success?c`<p class="local-import-message" role="status">${this.success}</p>`:u}</section>`}};B();ie();async function mp({signal:r}={}){r=r?AbortSignal.any([r,C.sessionController.signal]):C.sessionController.signal,r.throwIfAborted();let e=await $("/api/admin/bundles",{credentials:"same-origin",signal:r});if(r.throwIfAborted(),!e.ok)throw Object.assign(new Error(`Bundle catalogue request failed (${e.status})`),{status:e.status});let t=await e.json();return r.throwIfAborted(),t.bundles??[]}async function rr(r,e,t){let i=C.generation,s=await $(`/api/bundles/${encodeURIComponent(r)}/${e}`,{credentials:"same-origin",signal:t});if(t?.throwIfAborted(),!s.ok)throw Object.assign(new Error(`Bundle ${e} request failed (${s.status})`),{status:s.status});let o=e==="contents"?await s.text():await s.json();if(t?.throwIfAborted(),i!==C.generation)throw new DOMException("Managed session changed","AbortError");return o}function pi(r,{signal:e}={}){return C.load(`bundle-metadata:${r}`,"bundle metadata",t=>rr(r,"metadata",t),{signal:e,retryInvalidated:!0})}async function Sn(r,{signal:e}={}){return e=e?AbortSignal.any([e,C.sessionController.signal]):C.sessionController.signal,(await rr(r,"metadata",e))?.bundle?.repo??null}async function fp(r,{signal:e}={}){e=e?AbortSignal.any([e,C.sessionController.signal]):C.sessionController.signal;try{return await rr(r,"contents",e)}catch(t){throw t.name!=="AbortError"&&C.notify(`Couldn't load bundle contents: ${t.message}`),t}}function gp(r,e,t="",i=!1){let s=[e?`team=${encodeURIComponent(e)}`:"",t?`reason=${encodeURIComponent(t)}`:"",i?"repoAdvisories=true":""].filter(Boolean).join("&"),o=`advisories${s?`?${s}`:""}`;return rr(r,o,C.sessionController.signal)}B();async function ze(r,e){let t=await $(r,{signal:e,credentials:"same-origin",headers:{accept:"application/json"}});if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function Oe(r,e,t){let i={"content-type":"application/json"};return e&&(i["x-csrf-token"]=e),$(r,{method:"POST",credentials:"same-origin",headers:i,body:JSON.stringify(t)})}async function Cn(r,e,t){let i=t?{"x-csrf-token":t}:{},s=await $(`/api/admin/${r}/${encodeURIComponent(e)}`,{method:"DELETE",credentials:"same-origin",headers:i});if(!s.ok)throw new Error(`HTTP ${s.status}`)}async function En(r,e,t,i,s,o){let n=new URLSearchParams({page:String(e),limit:"100",kind:t,q:i.trim()});s&&n.set("repo",s),o&&n.set("actor",o);let a=await ze(`/api/admin/history?${n}`,r);if(!Array.isArray(a?.history)||!Number.isSafeInteger(a.total)||a.total<0||!Number.isSafeInteger(a.page)||a.page<1)throw new Error("No history returned");return a}async function Rn(r){let e=await ze("/api/admin/users",r);return Array.isArray(e?.users)?e.users:[]}async function An(r,e,t){let i=await Oe("/api/admin/set-role",t,{userId:r,role:e});if(!i.ok)throw new Error(`HTTP ${i.status}`)}async function Mn(r,e,t,i){let s=new URLSearchParams({scope:r});return r==="installed"&&s.set("showAll",String(e)),t&&s.set("refresh","true"),await ze(`/api/admin/repositories?${s}`,i)}async function In(r,e,t){let i=await Oe("/api/admin/repositories/select",t,{repoId:r,selected:e});if(!i.ok)throw new Error(`HTTP ${i.status}`)}async function Ln(r,e){let t=await $("/api/admin/repositories/add-public",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json","x-csrf-token":e},body:JSON.stringify({repository:r})});if(!t.ok){let i={400:"Enter a repository as owner/repo or a GitHub repository URL.",403:"You do not have permission to add arbitrary public repositories.",404:"No public repository was found at that address.",409:"Choose a public, non-archived repository."};throw new Error(i[t.status]??`GitHub lookup failed (HTTP ${t.status}). Try again.`)}}async function zn(r,e){let t=await ze(`/api/admin/repositories/impact?repoId=${encodeURIComponent(r)}`,e);if(t?.repoId!==r||!Array.isArray(t.reports)||!Array.isArray(t.bundles)||!Number.isSafeInteger(t.triageCount)||t.triageCount<0)throw new Error("Invalid repository data");return t}async function On(r,e){let t=await $("/api/admin/repositories/connect-app",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json","x-csrf-token":e},body:JSON.stringify({repoId:r})}),i=await t.json();if(!t.ok){let s={"github-app-not-configured":"The GitHub App is not configured on this server.","repo-identity-changed":"The repository has changed on GitHub. Refresh and check its connection.","repo-connection-changed":"The connection or your permissions changed. Refresh and try again.","repo-not-connected":"This repository is no longer connected.",forbidden:"Administrator access is required to connect the GitHub App."};throw new Error(s[i.error]??`Could not connect the GitHub App (HTTP ${t.status}). Try again.`)}if(i.connected===!0)return i;if(i.connected!==!1||typeof i.installUrl!="string"||!/^https:\/\/github\.com\/apps\/[^/?#]+\/installations\/new$/u.test(i.installUrl))throw new Error("Invalid GitHub installation response.");return i}async function Tn(r,e,t,i){let s=await Oe("/api/admin/repositories/remove",i,{repoId:r,fullName:e,acknowledge:!0,deleteTriage:t});if(!s.ok)throw new Error(`HTTP ${s.status}`);return s.json()}async function Nn(r){return await ze("/api/admin/reports",r)}async function Bn(r,e,t){let i=await $("/api/admin/bundles/create",{method:"POST",credentials:"same-origin",signal:t,headers:{"content-type":"application/json","x-csrf-token":e},body:JSON.stringify(r)}),s=await i.json();if(!i.ok){let o={"unsupported-entries":"Select JavaScript/TypeScript files or Solidity files. Stasis cannot mix languages or use JSON, JSX, TSX, or Rust as remote entry points.","bad-conditions":"Check the export conditions and selected platforms.","metro-conditions":"Stasis\u2019s Metro preset requires the react-native condition without manual changes.","build-lockfile":"Stasis needs a supported lockfile: pnpm-lock.yaml, yarn.lock (Yarn 1), package-lock.json, or soldeer.lock.","build-scope":"Your team needs access to the bundle\u2019s project root, including its lockfile and dependencies.","build-busy":"A bundle is already being built, or the server is busy. Try again shortly.","build-timeout":"The bundle build timed out. Try a smaller selection or retry.","too-large":"This bundle exceeds the server\u2019s size limit.","github-rate-limited":"GitHub\u2019s API rate limit has been reached. Retry after the limit resets.","github-build-failed":"Could not fetch the repository from GitHub. Check access and retry.","repository-changed":"The repository connection changed during the build. Reload and try again.","bundle-conflict":"This bundle already exists but is outside your current access.","build-failed":"Stasis could not build this selection. Check that its lockfile is supported and all entry points and imports exist at this commit."};throw new Error(o[s.error]??(i.status===401?"Sign in again to create a bundle.":i.status===403||i.status===404?"Repository access is required to create this bundle.":"Could not create the bundle. Try again."))}return s}async function ui(r,e,t=null,i=""){let s={"content-type":r.type||"application/json","x-report-filename":encodeURIComponent(r.name)};e&&(s["x-csrf-token"]=e),t!=null&&(s["x-repo-id"]=String(t)),i!==""&&(s["x-repo-directory"]=encodeURIComponent(i));let o=await $("/api/admin/reports",{method:"POST",credentials:"same-origin",headers:s,body:r});if(!o.ok){if(o.status===413)throw new Error("too large");if(o.status===403)throw new Error("choose a repository and directory within your team access");let n="";try{let a=await o.json();a?.error==="repo-not-connected"&&typeof a.repo=="string"&&(n=`: ${a.repo} is not connected`)}catch{}throw new Error(`HTTP ${o.status}${n}`)}return o.json()}async function Pn(r,e,t){let i=await Oe("/api/admin/reports/set-visible",t,{reportId:r,visible:e});if(!i.ok)throw new Error(`HTTP ${i.status}`)}async function Dn(r,e,t,i){let s=await Oe("/api/admin/reports/set-repo",i,{reportId:r,repoId:e,directory:t});if(!s.ok)throw s.status===409?new Error("this report already defines its repository"):s.status===403?new Error("choose a repository and directory within your team access"):new Error(s.status===400?"invalid repository or directory":`HTTP ${s.status}`);return s.json()}async function jn(r,e){await Cn("reports",r,e)}async function hi(r){return await ze("/api/admin/bundles",r)}async function mi(r,e,t,i=""){let s={"content-type":"application/octet-stream","x-bundle-filename":encodeURIComponent(r.name)};e&&(s["x-csrf-token"]=e),t!=null&&(s["x-repo-id"]=String(t)),i&&(s["x-repo-directory"]=encodeURIComponent(i));let o=await $("/api/admin/bundles",{method:"POST",credentials:"same-origin",headers:s,body:r});if(!o.ok)throw new Error(o.status===413?"too large":o.status===403?"choose a repository and directory within your team access":`HTTP ${o.status}`);return o.json()}async function Un(r,e){await Cn("bundles",r,e)}async function Fn(r,e,t,i){let s=await Oe("/api/admin/bundles/set-repo",i,{bundleId:r,repoId:e,directory:t});if(!s.ok)throw new Error(s.status===403?"choose a repository and directory within your team access":s.status===400?"invalid repository or directory":`HTTP ${s.status}`)}async function fi(r){return await ze("/api/admin/teams",r)}async function oe(r,e,t){let i=await Oe(r,e,t);if(!i.ok)throw new Error(i.status===409?"name already taken":`HTTP ${i.status}`)}function gi(r,e=!0){let t=document.createElement("input");t.type="file",t.multiple=e,t.addEventListener("change",()=>{r([...t.files])},{once:!0}),t.click()}function bi(r,e,t){let i=0,s=d=>Array.from(d.dataTransfer?.types??[]).includes("Files"),o=d=>{s(d)&&(d.preventDefault(),i+=1,t(!0))},n=d=>{s(d)&&d.preventDefault()},a=d=>{s(d)&&(i=Math.max(0,i-1),i===0&&t(!1))},l=d=>{s(d)&&(d.preventDefault(),d.stopPropagation(),i=0,t(!1),e([...d.dataTransfer.files]))};return r.addEventListener("dragenter",o),r.addEventListener("dragover",n),r.addEventListener("dragleave",a),r.addEventListener("drop",l),()=>{r.removeEventListener("dragenter",o),r.removeEventListener("dragover",n),r.removeEventListener("dragleave",a),r.removeEventListener("drop",l)}}async function vi(r,e,t,i){if(r._busy||!r._csrf)throw new Error("Wait for the current operation to finish, then try again.");r._busy=!0;try{await r.appState.mutate(()=>t(e),i)}finally{await r._load(),r._busy=!1;let s=r._queue.splice(0);s.length>0&&r._upload(s)}}async function yi(r,e,t,i){if(e.length!==0&&(r._queue.push(...e),!r._busy)){r._busy=!0,r._error=null;try{for(;r._queue.length>0;){let s=r._queue.shift();await r.appState.mutate(()=>t(s),i)}}catch(s){r._queue=[],r._error=`Upload failed: ${String(s?.message??s)}`}finally{r._busy=!1,await r._load({preserveError:!0})}}}var wi=`.local-import-toggle{flex-shrink:0;margin-block:calc(-.25rem - 1px);margin-left:auto;padding:.25rem .6rem;border:1px solid var(--border);border-radius:var(--ui-radius, 6px);background:transparent;color:var(--muted);font:inherit;font-size:.75rem;line-height:1.5}.local-import-toggle:hover,.local-import-toggle[aria-expanded=true]{color:var(--text);background:rgb(from var(--text) r g b / .06)}.local-import-panel{display:grid;gap:.8rem;padding:1rem;margin-bottom:1.25rem;border:1px solid var(--border);border-radius:var(--ui-radius, 8px);background:rgb(from var(--accent) r g b / .025)}.local-import-copy strong{font-size:.82rem;font-weight:600}.local-import-copy p,.local-import-message{margin:.3rem 0 0;color:var(--muted);font-size:.75rem;line-height:1.5}.local-import-controls{display:flex;align-items:center;flex-wrap:wrap;gap:.5rem}managed-local-item-selector{flex:1 1 16rem;min-width:0}.local-import-controls button,.local-import-message button{padding:.35rem .7rem;border:1px solid var(--border);border-radius:var(--ui-radius, 5px);background:transparent;color:var(--text);font:inherit;font-size:.75rem;line-height:1.5}.local-import-controls .local-import-submit{border-color:rgb(from var(--accent) r g b / .4);background:rgb(from var(--accent) r g b / .1);color:var(--accent)}.local-import-controls .local-import-close{color:var(--muted)}.local-import-panel button:disabled,.local-import-toggle:disabled{opacity:.5}.local-import-panel button:focus-visible,.local-import-toggle:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.local-import-message.error{color:var(--critical)}
|
|
68
68
|
`;var N=`:host{display:flex;flex-direction:column;position:relative;padding:0 clamp(1rem,3vw,3rem) 3rem;color:var(--text);container-type:inline-size;font-family:var(--sans, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);font-size:.875rem;line-height:1.5;--panel:color-mix(in srgb, var(--bg) 50%, var(--surface));--panel-hover:color-mix(in srgb, var(--text) 3%, var(--panel))}*,*:before,*:after{box-sizing:border-box}button,summary,select,label,legend,h1,h2,h3,.section-heading,.ui-hint,.page-intro>.intro,.count,.result-count,.repository-count,.breadcrumb-separator,.list-head,.report-list-head,.history-head,.drop-copy,.local-import-copy,.location-field>span,.empty:not(.error,[role=alert]),.msg:not(.error,[role=alert]),.local-import-message:not(.error,[role=status]),.data-empty,.revision-empty{cursor:default;user-select:none;-webkit-user-select:none}input:not([type=checkbox],[type=radio]),textarea,[contenteditable],pre,code,.mono{cursor:text;user-select:text;-webkit-user-select:text}.wrap{width:100%;max-width:76rem;margin:0 auto;flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable}.manage-header{position:sticky;top:0;z-index:2}.wrap:has(>.manage-list){display:flex;flex-direction:column;overflow:hidden;scrollbar-gutter:auto}.wrap:has(>.manage-list)>:not(.manage-list){flex-shrink:0}.manage-list{position:relative;flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}.manage-nav button{flex:0 0 auto;position:relative;min-height:3.7rem;padding:.9rem 0;border:0;border-radius:0;color:var(--muted);background:none;font-size:.8rem;font-weight:500;white-space:nowrap}.manage-nav button:hover,.manage-nav button[aria-current=page]{color:var(--text)}.manage-nav button[aria-current=page]:after{content:"";position:absolute;bottom:.6rem;inset-inline:0;height:2px;background:var(--accent);border-radius:var(--ui-radius, 2px)}.manage-nav button:focus-visible{outline-offset:-3px}.head{display:flex;align-items:center;flex-wrap:wrap;gap:.7rem;margin:0 0 .5rem}h1,.head h1{margin:0;font-size:1.9rem;font-weight:600;letter-spacing:-.045em;line-height:1.2}.count{display:inline-flex;align-items:center;justify-content:center;min-width:1.6rem;padding:.12rem .5rem;border:1px solid var(--border);border-radius:6px;color:var(--muted);background:var(--surface);font-size:.73rem;font-weight:500;font-variant-numeric:tabular-nums}button,input,select{font:inherit}button,select,input[type=checkbox]{cursor:default}button,a,input,select{-webkit-app-region:no-drag}button,a{transition:background .15s,color .15s,border-color .15s}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid var(--accent);outline-offset:3px}button:disabled,select:disabled{opacity:.45}input:not([type=checkbox]),select{min-width:0;min-height:2.25rem;padding:.45rem .65rem;border:1px solid var(--border);border-radius:var(--ui-radius, 7px);background:var(--bg);color:var(--text);font-size:.8rem}input::placeholder{color:var(--muted)}input[type=checkbox]{accent-color:var(--accent)}.btn,.drop-browse{display:inline-flex;align-items:center;justify-content:center;gap:.45rem;min-height:2.25rem;height:auto;padding:.45rem .8rem;border:1px solid var(--border);border-radius:var(--ui-radius, 7px);background:var(--surface);color:var(--text);font-size:.8rem;font-weight:500;text-decoration:none;white-space:nowrap}.btn:hover:not(:disabled),.drop-browse:hover:not(:disabled){background:var(--surface-active);border-color:var(--muted)}.btn.primary,.drop-browse{color:var(--bg);background:var(--accent);border-color:var(--accent)}.btn.primary:hover:not(:disabled),.drop-browse:hover:not(:disabled){background:var(--accent);filter:brightness(1.08)}.btn svg,.icon-btn svg{width:1rem;height:1rem}.icon-btn{width:2rem;height:2rem}.avatar{color:var(--accent);background:color-mix(in srgb,var(--accent) 12%,var(--bg));border:1px solid color-mix(in srgb,var(--accent) 16%,var(--border))}.breadcrumb{display:flex;align-items:center;flex-basis:100%;gap:.4rem;margin-bottom:.8rem}.breadcrumb-manage{padding:.1rem 0;border:0;background:transparent;color:var(--muted);font-size:.78rem}.breadcrumb-manage:hover{color:var(--text)}.breadcrumb-separator{color:var(--muted)}.msg{margin:1rem 0;padding:1.1rem 1.25rem;border:1px solid var(--border);border-radius:var(--ui-radius, 9px);color:var(--muted);font-size:.85rem}.msg.error{color:var(--critical);border-color:color-mix(in srgb,var(--critical) 35%,var(--border))}.empty{padding:3.5rem 1.5rem;border:1px dashed var(--border);border-radius:var(--ui-radius, 10px);color:var(--muted);text-align:center}.empty strong{display:block;margin-bottom:.4rem;color:var(--text);font-size:.95rem;font-weight:500}.empty p{margin:0;font-size:.85rem}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}@container (max-width: 35rem){.drop-copy>span{display:none}.manage-nav{gap:1.2rem;margin-bottom:1.75rem}.manage-nav button{min-height:3.25rem}h1,.head h1{font-size:1.65rem}.intro{margin-bottom:1.5rem}}@media(prefers-reduced-motion:reduce){button,a{transition:none}}.collection-toolbar input{flex:1;max-width:26rem;min-width:10rem}.collection-toolbar select{min-width:10rem}.result-count{text-align:right;white-space:nowrap;margin-left:auto;color:var(--muted);font-size:.75rem;font-variant-numeric:tabular-nums}@container (max-width: 35rem){.collection-toolbar input{flex-basis:100%;max-width:none}}.manage-nav{display:flex;gap:1.35rem;align-items:stretch;overflow-x:auto;scrollbar-width:thin;border-bottom:1px solid var(--border);margin-bottom:1.5rem;padding:0 .1rem}.wrap>:not(.manage-header),.manage-nav{-webkit-app-region:no-drag;app-region:no-drag}@media(display-mode:window-controls-overlay){.manage-header{display:flow-root}.manage-header:before{content:"";float:right;width:var(--wco-right-toolbar, 0px);height:var(--wco-titlebar-height)}.manage-nav{width:max-content;max-width:100%;border-bottom:0}.manage-nav button{min-height:var(--wco-titlebar-height);padding-block:.35rem}.manage-nav button[aria-current=page]:after{bottom:0}}.intro{margin:0 0 1.25rem;max-width:46rem;color:var(--muted);font-size:.875rem;line-height:1.65}.collection-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:.75rem;margin-bottom:.85rem}.page-intro{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:.5rem 1rem;margin-bottom:1.25rem}.page-intro .intro{margin:0}a{cursor:default}.loading-rows{border:1px solid var(--border);border-radius:var(--ui-radius, 10px);overflow:hidden}.loading-row{display:grid;align-content:center;gap:.6rem;min-height:4.25rem;padding:.85rem 1rem}.loading-row+.loading-row{border-top:1px solid var(--border)}.loading-row span{width:40%;height:.65rem;border-radius:3px;background:color-mix(in srgb,var(--muted) 15%,transparent)}.loading-row span+span{width:65%;height:.5rem}.drop-card{display:flex;align-items:center;gap:.75rem;margin-bottom:1rem;padding:.7rem .85rem;border:1px dashed color-mix(in srgb,var(--muted) 35%,var(--border));border-radius:var(--ui-radius, 8px);background:var(--panel)}.drop-icon{display:grid;place-items:center;flex-shrink:0;width:1.8rem;height:1.8rem;color:var(--muted)}.drop-icon svg{width:1.1rem;height:1.1rem}.drop-copy{min-width:0;display:flex;align-items:baseline;flex-wrap:wrap;gap:.2rem .6rem}.drop-copy strong{font-size:.8rem;font-weight:500}.drop-copy>span{color:var(--muted);font-size:.75rem}.drop-browse{min-width:7rem;margin-left:auto;flex-shrink:0}
|
|
69
69
|
`;var Hn=`.home-section{margin-top:1.1rem;margin-bottom:2rem}.section-heading{display:flex;align-items:baseline;gap:1rem;margin-bottom:.85rem}.section-heading h2{margin:0;font-size:.86rem;font-weight:600}.section-heading>span{color:var(--muted);font-size:.75rem}.pages{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.9rem}.page{display:flex;flex-direction:column;gap:.85rem;padding:1.35rem;border:1px solid var(--border);border-radius:var(--ui-radius, 12px);color:var(--text);background:var(--panel);text-align:left;font:inherit}.page:hover{background:var(--panel-hover);border-color:color-mix(in srgb,var(--muted) 60%,var(--border))}.page-top{display:flex;align-items:center;gap:.75rem;width:100%}.page-icon{display:grid;place-items:center;flex-shrink:0;width:2.5rem;height:2.5rem;border:1px solid color-mix(in srgb,var(--accent) 16%,var(--border));border-radius:var(--ui-radius, 9px);background:color-mix(in srgb,var(--accent) 7%,var(--panel));color:var(--accent)}.page-bundle .page-icon{color:var(--green);border-color:color-mix(in srgb,var(--green) 18%,var(--border));background:color-mix(in srgb,var(--green) 6%,var(--panel))}.page-scan .page-icon{color:var(--scan-icon-color, var(--yellow));border-color:color-mix(in srgb,var(--scan-icon-color, var(--yellow)) 18%,var(--border));background:color-mix(in srgb,var(--scan-icon-color, var(--yellow)) 6%,var(--panel))}:host-context(body.theme-light) .page-scan .page-icon{--scan-icon-color: #bf8700}:host-context(body.theme-green) :is(.page-bundle,.page-scan) .page-icon,:host-context(body.theme-pink) :is(.page-bundle,.page-scan) .page-icon{color:var(--accent);border-color:color-mix(in srgb,var(--accent) 16%,var(--border));background:color-mix(in srgb,var(--accent) 7%,var(--panel))}.page-icon svg{width:1.2rem;height:1.2rem}.arrow{display:flex;margin-left:auto;flex-shrink:0;color:var(--muted)}.arrow svg{width:1rem;height:1rem}.page:hover .arrow{color:var(--text)}.page-copy{display:grid;gap:.45rem}.page>.page-copy{margin-inline-start:3.25rem}.page-copy strong,.page-title{font-size:1rem;font-weight:600;letter-spacing:-.015em}.page-copy>span{color:var(--muted);font-size:.8rem;line-height:1.65}.workspace-pages .page{gap:.85rem;padding:1.2rem 1.35rem}.workspace-pages .page-icon{width:2rem;height:2rem;color:var(--muted);background:transparent;border-color:var(--border)}.workspace-pages .page-title{font-size:.9rem}.workspace-pages .page-copy{margin-inline-start:2.75rem}.history-link{display:flex;align-items:center;gap:1rem;width:100%;padding:1.25rem 0;border:0;border-top:1px solid var(--border);text-align:left;color:var(--text);background:transparent}.history-link>.page-icon{color:var(--muted);background:transparent;border-color:var(--border)}.history-link .page-copy strong{font-size:.85rem}.history-cta{display:flex;align-items:center;gap:.6rem;flex-shrink:0;margin-left:auto;color:var(--muted);font-size:.78rem}.history-cta svg{width:1rem;height:1rem}.history-link:hover .history-cta{color:var(--accent)}@container (max-width: 48rem){.pages{grid-template-columns:1fr;gap:.65rem}.page,.workspace-pages .page{gap:.65rem;padding:1.15rem}.page-top .arrow{display:none}.workspace-pages .page-icon{width:2.5rem;height:2.5rem}.workspace-pages .page-copy{margin-inline-start:3.25rem}.page-copy{gap:.2rem}.page-copy strong,.page-title{font-size:.95rem}.section-heading>span{display:none}.history-cta{font-size:0}}
|
|
70
70
|
`;var qn=`.toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:.65rem;margin-bottom:.9rem}.toolbar input{flex:2 1 12rem}.toolbar select{flex:0 1 9rem}.toolbar repository-selector{flex:1 1 12rem}.toolbar user-selector{flex:1.5 1 16rem}.toolbar>*{min-width:0}.toolbar input[type=search],.toolbar select,.toolbar .btn{min-height:2rem;padding:.28rem .5rem;border-radius:var(--ui-radius, 5px)}.history{overflow-x:auto;border:1px solid var(--border);border-radius:var(--ui-radius, 9px);background:var(--panel)}.row,.history-head{display:grid;grid-template-columns:4.7rem minmax(16rem,1fr) minmax(12rem,1fr) 12rem;align-items:center;gap:.85rem;min-width:52rem;padding:.45rem .85rem}.history-head{background:rgb(from var(--text) r g b / .025);color:var(--muted);font-size:.7rem}.row{border-top:1px solid var(--border);min-height:2.35rem}.row:hover{background:var(--panel-hover)}.kind{display:inline-flex;align-items:center;justify-content:center;width:fit-content;padding:.05rem .35rem;border:1px solid var(--border);border-radius:4px;color:var(--muted);font-size:.65rem;text-transform:capitalize}.kind.triage{color:var(--accent);border-color:rgb(from var(--accent) r g b / .25);background:rgb(from var(--accent) r g b / .06)}.kind.upload{color:var(--green);border-color:rgb(from var(--green) r g b / .25);background:rgb(from var(--green) r g b / .06)}.kind.visibility{color:var(--yellow);border-color:rgb(from var(--yellow) r g b / .25);background:rgb(from var(--yellow) r g b / .06)}.activity-description,.detail{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.75rem}.actor{color:var(--text);font-weight:500}.action,.detail{color:var(--muted)}.history-time{display:flex;align-items:center;gap:.35rem;color:var(--muted);font-size:.7rem;white-space:nowrap;font-variant-numeric:tabular-nums}.history .empty{border:0;margin:0}.pagination{display:flex;align-items:center;flex-wrap:wrap;gap:.65rem;margin-top:1rem;color:var(--muted);font-size:.75rem}.pagination>span:first-child{margin-right:auto}
|