@preventive/triage 1.0.0-alpha.37 → 1.0.0-alpha.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/common/bundle-compare-diff.d.ts +3 -0
- package/common/bundle-compare-diff.js +522 -0
- package/common/bundle-compare-inputs.d.ts +2 -0
- package/common/bundle-compare-inputs.js +65 -0
- package/common/bundle-metadata.d.ts +6 -2
- package/common/bundle-metadata.js +63 -20
- package/common/bundle-pkg-of.d.ts +1 -0
- package/common/bundle-pkg-of.js +90 -0
- package/common/bundle-source-links.js +7 -0
- package/common/bundle-sourcemap.d.ts +10 -0
- package/common/bundle-sourcemap.js +100 -0
- package/common/bundle-sources.d.ts +3 -1
- package/common/bundle-sources.js +47 -19
- package/common/code-language.js +16 -2
- package/common/default-scan-models.ts +2 -1
- package/common/dependency-reviews.d.ts +23 -0
- package/common/dependency-reviews.js +81 -0
- package/common/finding-duplicates.js +58 -0
- package/common/finding-filters.js +274 -0
- package/common/github-pr.ts +1 -1
- package/common/gzip.js +59 -0
- package/common/line-diff.d.ts +8 -0
- package/common/line-diff.js +56 -0
- package/common/linked-workspace-groups.js +63 -0
- package/common/managed/npm-packages.d.ts +5 -0
- package/common/managed/npm-packages.js +34 -0
- package/common/managed/permissions.ts +1 -5
- package/common/managed/routes.js +123 -12
- package/common/managed/team-app.d.ts +2 -0
- package/common/managed/team-app.js +31 -0
- package/common/managed/triage.ts +1 -1
- package/common/managed/upload-seal.ts +126 -0
- package/common/pretty-print.d.ts +5 -0
- package/common/pretty-print.js +24 -0
- package/common/revalidation-conflicts.js +48 -0
- package/common/revalidation-input-groups.js +56 -0
- package/common/workspace-app.js +23 -0
- package/common/workspace-groups.js +176 -0
- package/out/brotli-fallback.js +3 -3
- package/out/chunk-2KBF5TZ7.js +2 -0
- package/out/chunk-2XUEZHIP.js +28 -0
- package/out/chunk-35VE6CDH.js +2 -0
- package/out/chunk-3BZ7JERB.js +1 -0
- package/out/chunk-45WIN3SW.js +1 -0
- package/out/chunk-4XCDFGDP.js +10 -0
- package/out/chunk-6C76GAXK.js +1 -0
- package/out/chunk-7ZKDKGAH.js +1 -0
- package/out/chunk-ABW5FVSN.js +1 -0
- package/out/chunk-C4Z6ZBXV.js +10 -0
- package/out/chunk-CMQA4DM6.js +1 -0
- package/out/chunk-CVVJAXVY.js +2 -0
- package/out/chunk-DIJJNTRH.js +10 -0
- package/out/chunk-F4OMDNEY.js +1 -0
- package/out/chunk-GJ4IUCNS.js +1 -0
- package/out/chunk-GMFXFEUA.js +2 -0
- package/out/chunk-GNXOKIGP.js +80 -0
- package/out/chunk-GZ4MS3TE.js +13 -0
- package/out/chunk-HIV7SVI7.js +1 -0
- package/out/chunk-IU3CCINR.js +3 -0
- package/out/chunk-JVBB4LZX.js +1 -0
- package/out/chunk-K3X5EJBQ.js +2 -0
- package/out/chunk-KEX2ATEW.js +2 -0
- package/out/chunk-KYCNJVB7.js +1 -0
- package/out/chunk-NRPC74AM.js +1 -0
- package/out/chunk-OOJM4CTU.js +1 -0
- package/out/chunk-PNHBZGDD.js +1 -0
- package/out/chunk-QSLWGJBQ.js +223 -0
- package/out/chunk-R5O6FAW4.js +2 -0
- package/out/chunk-RFZQQXSG.js +17 -0
- package/out/chunk-TINZZKP5.js +33 -0
- package/out/chunk-TUII34K2.js +1 -0
- package/out/chunk-TZ5KB2Y5.js +10 -0
- package/out/chunk-UNTRGE26.js +2 -0
- package/out/chunk-UYAXVRVL.js +1 -0
- package/out/chunk-V3ME6FI5.js +2 -0
- package/out/chunk-V5O7M2YT.js +1 -0
- package/out/chunk-VIHGO77Y.js +1 -0
- package/out/chunk-W4J3MGLB.js +1 -0
- package/out/chunk-WGG7KQUH.js +1 -0
- package/out/chunk-XNGEQO7Y.js +2 -0
- package/out/chunk-XRWAV3DX.js +7 -0
- package/out/chunk-XYDGU6BM.js +51 -0
- package/out/chunk-XYFXXB2G.js +10 -0
- package/out/chunk-YVZH5SHP.js +1 -0
- package/out/chunk-ZPD5R5RP.js +3 -0
- package/out/client-managed-import.js +3 -87
- package/out/client-managed.js +26 -338
- package/out/client-sync.js +8 -14
- package/out/graph.js +17 -30
- package/out/index.html +34 -0
- package/out/prism.js +6 -2
- package/out/terminal.js +241 -257
- package/out/view.css +1 -1
- package/out/view.js +76 -520
- package/package.json +89 -7
- package/risk/files/characters.js +196 -0
- package/risk/files/hosts.js +205 -0
- package/risk/files/readability.js +171 -0
- package/risk/files/runs-code.js +358 -0
- package/risk/files/script.js +114 -0
- package/risk/files/stamps.js +46 -0
- package/risk/index.d.ts +142 -0
- package/risk/index.js +7 -0
- package/risk/npm/assess.js +219 -0
- package/risk/npm/combined.js +65 -0
- package/risk/npm/compare.js +228 -0
- package/risk/npm/dependencies.js +153 -0
- package/risk/npm/diff.js +43 -0
- package/risk/npm/downloads.js +84 -0
- package/risk/npm/files.js +34 -0
- package/risk/npm/held.js +60 -0
- package/risk/npm/install-scripts.js +34 -0
- package/risk/npm/malware.js +36 -0
- package/risk/npm/manifest.js +65 -0
- package/risk/npm/new-dependency.js +30 -0
- package/risk/npm/old-version.js +108 -0
- package/risk/npm/registry.js +282 -0
- package/risk/npm/release.js +85 -0
- package/risk/npm/specs.js +124 -0
- package/risk/npm/tarball.js +113 -0
- package/server-e2e/http.ts +7 -7
- package/server-e2e/npm-proxy.ts +1 -1
- package/server-e2e/objstore/fetch-mint-guard.ts +2 -2
- package/server-e2e/objstore/handlers.ts +1 -1
- package/server-e2e/objstore/tokens.ts +1 -1
- package/server-e2e/sign.ts +1 -1
- package/server-managed/bundle-advisories.ts +74 -12
- package/server-managed/bundle-cache.ts +37 -4
- package/server-managed/bundle-commits.ts +140 -0
- package/server-managed/bundle-summary-cache.ts +24 -10
- package/server-managed/config.ts +4 -0
- package/server-managed/db-methods.ts +98 -11
- package/server-managed/db-neon.ts +39 -4
- package/server-managed/db-schema.ts +14 -2
- package/server-managed/db-table-names.ts +1 -1
- package/server-managed/db.ts +7 -3
- package/server-managed/dependency-reviews.ts +248 -0
- package/server-managed/github-app.ts +9 -3
- package/server-managed/github-errors.ts +21 -2
- package/server-managed/github-issue-oauth.ts +5 -6
- package/server-managed/github-metadata.ts +115 -0
- package/server-managed/github-oauth.ts +38 -2
- package/server-managed/http-response.ts +26 -0
- package/server-managed/http.ts +952 -53
- package/server-managed/index.ts +11 -5
- package/server-managed/kept.ts +28 -0
- package/server-managed/locked-packages.ts +85 -0
- package/server-managed/lru.ts +30 -0
- package/server-managed/npm-insights.ts +440 -0
- package/server-managed/npm-kept.ts +65 -0
- package/server-managed/npm-loads.ts +167 -0
- package/server-managed/npm-manifest.ts +115 -0
- package/server-managed/npm-packages.ts +378 -0
- package/server-managed/npm-provenance.ts +123 -0
- package/server-managed/npm-risk.ts +177 -0
- package/server-managed/pretty-print.ts +352 -0
- package/server-managed/public-workspace.ts +78 -7
- package/server-managed/rename-diff-worker.js +26 -0
- package/server-managed/rename-diff.ts +270 -0
- package/server-managed/report-sources.ts +13 -2
- package/server-managed/repository-browser.ts +19 -5
- package/server-managed/repository-risk.ts +418 -0
- package/server-managed/session.ts +16 -2
- package/server-managed/sql.ts +5 -2
- package/server-managed/storage-encryption.ts +5 -3
- package/server-managed/storage-payload.ts +4 -0
- package/server-managed/storage-stores.ts +2 -0
- package/server-managed/storage.ts +6 -3
- package/server-managed/team-app.ts +94 -0
- package/server-managed/team-feed.ts +1 -1
- package/server-managed/team-npm-scopes.ts +77 -0
- package/server-managed/type-only-worker.js +19 -0
- package/server-managed/type-only.ts +103 -0
- package/server-managed/uploads.ts +25 -4
- package/server-managed/upstream-cache.ts +147 -5
- package/server-managed/view-as.ts +58 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=`.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}}
|
|
2
|
+
`;export{e as a};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var{Buffer:se}=globalThis,ce=se&&!se.TYPED_ARRAY_SUPPORT;var j=new Uint8Array(Uint16Array.of(258).buffer)[0]===2,le=e=>e&&(ce||`${e}`.includes("[native code]"));!ce&&le(()=>{})&&(le=()=>!1);function B(e,t,n,r){let i="",o=t;for(let f=n-3;o<f;o+=4){let s=e[o],l=e[o+1],c=e[o+2],a=e[o+3];i+=r[s],i+=r[l],i+=r[c],i+=r[a]}for(;o<n;)i+=r[e[o++]];return i}function Me(e,t){let n=e.length;for(let r=0;r<n;r++)t[r]=e.charCodeAt(r);return t}var bt=null,k=!1,yt=!1,H=new TextEncoder,L=new TextDecoder("utf-8",{ignoreBOM:!0}),Tt=new TextDecoder("latin1",{ignoreBOM:!0});function Et(e,t,n,r){if(n-t>3e4){let i=[];for(let f=t;f<n;){let s=f+500,l=s>n?n:s;i.push(B(e,f,l,r)),f=l}let o=i.join("");return i.length=0,o}return B(e,t,n,r)}var W=globalThis.Buffer;function D(e){if(!(e&&e instanceof Uint8Array))throw new TypeError("Expected an Uint8Array")}var ue="Input is not a string",X="Input is not well-formed Unicode";function z(e,t){switch(t){case"uint8":if(e.constructor!==Uint8Array)throw new Error("Unexpected");return e;case"arraybuffer":if(e.byteLength!==e.buffer.byteLength)throw new Error("Unexpected");return e.buffer;case"buffer":return e.length<=64?W.from(e):W.from(e.buffer,e.byteOffset,e.byteLength)}throw new TypeError("Unexpected format")}function _t(e,t){switch(t){case"uint8":return e.length<=64||e.byteOffset!==0||e.byteLength!==e.buffer.byteLength?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength);case"arraybuffer":return e.buffer.byteLength===e.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);case"buffer":if(e.constructor!==W)throw new Error("Unexpected");return e}throw new TypeError("Unexpected format")}var Oe=L,Le=L?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):null,{isWellFormed:he}=String.prototype;function Ue(e,t,n){if(t||e.length===n.length)return n;if(he){if(he.call(e))return n;throw new TypeError(X)}let r=0,i=n.length-3;for(;r<=i;){let o=n.indexOf(239,r);if(o===-1||o>i)break;if(r=o+1,n[o+1]===191&&n[o+2]===189){if(null)try{if(encodeURI(e)!==null)return n}catch{}else if(e===K(n))return n;throw new TypeError(X)}}return n}function de(e,t=!1){if(typeof e!="string")throw new TypeError(ue);return e.length===0?new Uint8Array:H||!null?Ue(e,t,H.encode(e)):null(e,t)}function K(e,t=!1){return D(e),e.byteLength===0?"":L||!null?t?Oe.decode(e):Le.decode(e):null(e,t)}var Ft=(e,t="uint8")=>z(de(e,!1),t),Ot=(e,t="uint8")=>z(de(e,!0),t),Lt=e=>K(e,!1),Ut=e=>K(e,!0);var q=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: ?(.*?))?\n?$/u,I=/^\*{15,}(?: (.*?))?\n?$/u,v=/^\*{3} (\d+)(?:,(\d+))? \*{4}\n?$/u,U=/^--- (\d+)(?:,(\d+))? ----\n?$/u,G=/^(\d+)(?:,(\d+))?([acd])(\d+)(?:,(\d+))?[ \t]*\r?\n?$/u;var Re=/[ \t\n\v\f\r]/gu,ke=/[ \t\n\v\f\r]+/gu,me=/[ \t\n\v\f\r]+$/u,xe=e=>e.replace(/[A-Z]/gu,t=>t.toLowerCase());function R({ignoreCase:e=!1,whitespace:t="none"}={}){let n=null;return t==="all"?n=r=>r.replace(Re,""):t==="change"?n=r=>r.replace(me,"").replace(ke," "):t==="trailing"&&(n=r=>r.replace(me,"")),e?n?r=>xe(n(r)):xe:n}function N(e){let t=[];for(let n=0;n<e.length;){let r=e.indexOf(`
|
|
2
|
+
`,n),i=r<0?e.length:r+1;t.push(e.slice(n,i)),n=i}return t}var _=class extends Error{constructor(t,n){super(n===void 0?t:`${t} at line ${n+1}`),this.name="PatchError",this.line=n}},P=(e,t)=>t===0?Number(e):Number(e)-1,Y=e=>e!==void 0&&e.startsWith("\\"),J=e=>e.replace(/\n$/u,"");function V(e){let t=N(e),n=[],r={old:null,new:null},i=!1;for(let o=0;o<t.length;){let f=t[o],s=pe(f,i);if(i=f.startsWith("***************")?!1:f.startsWith("*** "),s){r=s.names??{...r,[s.slot]:s.name},o++;continue}let l=q.test(f)?"unified":I.test(f)?"context":G.test(f)?"normal":null;if(l===null){o++;continue}let c=[],a=Be[l];for(let u=a(t,o);u!==null&&(c.push(u.hunk),o=u.next,!(o>=t.length||pe(t[o],!1)));u=a(t,o));n.push({old:r.old,new:r.new,format:l,hunks:c,blocks:De(c)}),r={old:null,new:null}}return n}function pe(e,t){let n=/^diff --git (\S+) (\S+)\n?$/u.exec(e);if(n)return{names:{old:n[1],new:n[2]}};if(v.test(e)||U.test(e))return null;let r=/^(\*\*\* |--- |\+\+\+ )(.*?)(?:\t.*)?\n?$/u.exec(e);return r?r[1]==="--- "?{slot:t?"new":"old",name:r[2]}:{slot:r[1]==="*** "?"old":"new",name:r[2]}:null}function De(e){let t=[];for(let n of e){let r=n.oldStart,i=n.newStart,o=null,f=()=>{o&&(t.push(o),r=o.a1,i=o.b1,o=null)};for(let{tag:s,text:l}of n.lines){if(s===" "){f(),r++,i++;continue}s==="-"&&o?.insert.length&&f(),o??={a0:r,a1:r,b0:i,b1:i,remove:[],insert:[]},s==="-"?(o.a1++,o.remove.push(l)):(o.b1++,o.insert.push(l))}f()}return t}function Ie(e,t){let n=q.exec(e[t]??"");if(!n)return null;let r=n[2]===void 0?1:Number(n[2]),i=n[4]===void 0?1:Number(n[4]),o={oldStart:P(n[1],r),newStart:P(n[3],i),label:n[5]||null,lines:[]},f=0,s=t+1,l=0;for(;l<r||f<i;s++){let c=e[s];if(c===void 0)throw new _("the patch ends inside a hunk",s);let a=c===`
|
|
3
|
+
`?" ":c[0];if(a!==" "&&a!=="-"&&a!=="+")throw new _(`a hunk line begins with ${JSON.stringify(a)}`,s);let u=c===`
|
|
4
|
+
`?c:c.slice(1);if(Y(e[s+1])&&(u=J(u),s++),a!=="+"&&l++,a!=="-"&&f++,l>r||f>i)throw new _("a hunk has more lines than its header says",s);o.lines.push({tag:a,text:u})}return{hunk:o,next:s}}function ve(e,t){let n=G.exec(e[t]??"");if(!n)return null;let[,r,i,o,f,s]=n,l=o==="a"?0:Number(i??r)-Number(r)+1,c=o==="d"?0:Number(s??f)-Number(f)+1;if(l<0||c<0)throw new _("a change command counts backwards",t);let a={oldStart:o==="a"?Number(r):Number(r)-1,newStart:o==="d"?Number(f):Number(f)-1,label:null,lines:[]},u=t+1,h=(g,d,m)=>{for(let b=0;b<g;b++,u++){let E=e[u];if(E===void 0)throw new _("the patch ends inside a hunk",u);if(E[0]!==d)throw new _(`${JSON.stringify(d)} expected`,u);let x=E.slice(2);Y(e[u+1])&&(x=J(x),u++),a.lines.push({tag:m,text:x})}};if(h(l,"<","-"),o==="c"){if(e[u]!==`---
|
|
5
|
+
`)throw new _("'---' expected",u);u++}return h(c,">","+"),{hunk:a,next:u}}function Pe(e,t){let n=I.exec(e[t]??"");if(!n)return null;let r=v.exec(e[t+1]??"");if(!r)throw new _("'*** ' range expected",t+1);let i=t+2,o=ge(e,i,U,"-");i=o.next;let f=U.exec(e[i]??"");if(!f)throw new _("'--- ' range expected",i);let s=ge(e,i+1,null,"+"),l=o.lines.length===0?s.lines.filter(h=>h.tag===" "):o.lines,c=s.lines.length===0?o.lines.filter(h=>h.tag===" "):s.lines,a=P(r[1],l.length),u=P(f[1],c.length);return{hunk:{oldStart:a,newStart:u,label:n[1]||null,lines:je(l,c)},next:s.next}}function ge(e,t,n,r){let i=[],o=t;for(;o<e.length;o++){let f=e[o];if(n&&n.test(f)||I.test(f)||v.test(f)||!n&&U.test(f))break;if(Y(f)){i[i.length-1].text=J(i.at(-1).text);continue}let s=f===`
|
|
6
|
+
`?" ":f[0];if(s!==" "&&s!=="!"&&s!=="-"&&s!=="+")break;i.push({tag:s===" "?" ":r,text:f===`
|
|
7
|
+
`?f:f.slice(2)})}return{lines:i,next:o}}function je(e,t){let n=[],r=0,i=0;for(;r<e.length||i<t.length;){if(e[r]?.tag===" "&&t[i]?.tag===" "){n.push(e[r]),r++,i++;continue}for(;r<e.length&&e[r].tag!==" ";)n.push(e[r]),r++;for(;i<t.length&&t[i].tag!==" ";)n.push(t[i]),i++;e[r]?.tag===" "&&t[i]===void 0?(n.push(e[r]),r++):t[i]?.tag===" "&&e[r]===void 0&&(n.push(t[i]),i++)}return n}var Be={unified:Ie,context:Pe,normal:ve};var A=class extends Error{constructor(t){super(`the rendered diff does not say what the change set says (${t})`),this.name="FormatError"}};function Ee(e,t,n,r){if(n.length===0){if(r!=="")throw new A("there was nothing to print, and something was printed");return}let i;try{i=V(r)}catch(f){throw new A(`it does not read back (${f.message})`)}if(i.length!==1)throw new A(`${i.length} files read back, not one`);let o=i[0].blocks;if(o.length!==n.length)throw new A(`${o.length} blocks read back, not ${n.length}`);for(let[f,s]of o.entries()){let l=n[f];if(s.a0!==l.a0||s.a1!==l.a1||s.b0!==l.b0||s.b1!==l.b1)throw new A(`block ${f+1} reads back somewhere else`)}for(let f of i[0].hunks){let s=f.oldStart,l=f.newStart;for(let{tag:c,text:a}of f.lines){let u=c==="+"?t[l]:e[s];if(a!==u)throw new A(`a ${c==="+"?"added":c==="-"?"removed":"kept"} line is not the line it stands for`);c!=="+"&&s++,c!=="-"&&l++}}}function He(e,t,n,r){let i=[],o=0;for(;o<e.length;){let f=o;for(;f+1<e.length&&e[f+1].a0-e[f].a1<=2*t;)f++;let s=e[o],l=e[f];i.push({blocks:e.slice(o,f+1),a0:Math.max(0,s.a0-t),a1:Math.min(n,l.a1+t),b0:Math.max(0,s.b0-t),b1:Math.min(r,l.b1+t)}),o=f+1}return i}var $e=e=>(t,n,r,{context:i,label:o=null})=>{let f="";for(let s of He(r,i,t.length,n.length))f+=e(t,n,s,o?o(s.a0):null);return Ee(t,n,r,f),f},We=`
|
|
8
|
+
\
|
|
9
|
+
`,M=(e,t)=>e+t+(t.endsWith(`
|
|
10
|
+
`)?"":We);function we(e,t){return t>e+1?`${e+1},${t}`:`${t>e?e+1:e}`}function Ne(e,t,n){let r="";for(let{a0:i,a1:o,b0:f,b1:s}of n){let l=i===o?"a":f===s?"d":"c";r+=we(i,o)+l+we(f,s)+`
|
|
11
|
+
`;for(let c=i;c<o;c++)r+=M("< ",e[c]);l==="c"&&(r+=`---
|
|
12
|
+
`);for(let c=f;c<s;c++)r+=M("> ",t[c])}return Ee(e,t,n,r),r}function be(e,t){return t<=e?`${e},0`:t===e+1?`${e+1}`:`${e+1},${t-e}`}var _e=$e((e,t,n,r)=>{let i=`@@ -${be(n.a0,n.a1)} +${be(n.b0,n.b1)} @@${r===null?"":" "+r}
|
|
13
|
+
`,o=n.a0,f=n.b0;for(let{a0:s,a1:l,b1:c}of n.blocks){for(;o<s;o++,f++)i+=M(" ",e[o]);for(;o<l;o++)i+=M("-",e[o]);for(;f<c;f++)i+=M("+",t[f])}for(;o<n.a1;o++,f++)i+=M(" ",e[o]);return i});function ye(e,t){return t<=e?`${e}`:t===e+1?`${e+1}`:`${e+1},${t}`}var Ce=$e((e,t,n,r)=>{let i=`***************${r===null?"":" "+r}
|
|
14
|
+
`;return i+=`*** ${ye(n.a0,n.a1)} ****
|
|
15
|
+
`,n.blocks.some(o=>o.a0<o.a1)&&(i+=Te(e,n.a0,n.a1,n.blocks,"a")),i+=`--- ${ye(n.b0,n.b1)} ----
|
|
16
|
+
`,n.blocks.some(o=>o.b0<o.b1)&&(i+=Te(t,n.b0,n.b1,n.blocks,"b")),i});function Te(e,t,n,r,i){let o=i+"1",f=i+"0",s=i==="a"?"b":"a",l="",c=t;for(let a of r){for(;c<a[f];c++)l+=M(" ",e[c]);let u=a[s+"0"]<a[s+"1"]?"! ":i==="a"?"- ":"+ ";for(;c<a[o];c++)l+=M(u,e[c])}for(;c<n;c++)l+=M(" ",e[c]);return l}function Xe(e){let t=[];for(let n=0;;){let r=n;for(;n<e.length&&e[n];)n++;if(t.push(n>r),n===e.length)return t;n++}}function Z(e,t,n){let r=t.length,i=Xe(n),o=0,f=0,s=0,l=()=>{if(o===r||e[s]!==e[o])return!1;for(t[s++]=0,t[o++]=1,f++;o<r&&t[o];)o++;return!0},c=()=>{if(s===0||e[s-1]!==e[o-1])return!1;for(t[--s]=1,t[--o]=0,f--;s>0&&t[s-1];)s--;return!0};for(let a=0;a<r;a++){if(!t[a]){f++;continue}for(s=a,o=a;o<r&&t[o];o++);let u=-1;for(let h=-1;h!==o-s;){for(h=o-s;c(););for(u=i[f]?o:-1;l();)i[f]&&(u=o)}if(u!==-1)for(let h=o-u;h>0;h--)c();a=o-1}}function ze(e){let t=1;for(let n=e;n!==0;n>>=2)t<<=1;return Math.max(256,t)}function Q(e,t,{ignoreCase:n=!1,whitespace:r="none",minimal:i=!1,slide:o=!0,horizon:f=1/0}={}){let s=R({ignoreCase:n,whitespace:r});if(s===null&&ee(e,t,null))return[];let{A:l,B:c}=qe(e,t,s),a=new Uint8Array(l.length),u=new Uint8Array(c.length),h=Ke(e,t,f);if(Ge(l,c,a,u,i,h),o){let{lo:d,hiA:m,hiB:b}=h;Z(l.subarray(d,m),a.subarray(d,m),u.subarray(d,b)),Z(c.subarray(d,b),u.subarray(d,b),a.subarray(d,m))}let g=Ve(a,u);return te(e,t,g,s),g}function Ke(e,t,n){let r=Math.min(e.length,t.length),i=0;for(;i<r&&e[i]===t[i];)i++;let o=Math.max(0,i-n),f=0;for(;f<r-o&&e[e.length-1-f]===t[t.length-1-f];)f++;let s=Math.max(0,f-n);return{lo:o,hiA:e.length-s,hiB:t.length-s}}function ee(e,t,n=null){if(e.length!==t.length)return!1;let r=n?(i,o)=>n(i)===n(o):(i,o)=>i===o;for(let i=0;i<e.length;i++)if(!r(e[i],t[i]))return!1;return!0}function qe(e,t,n){let r=new Map,i=f=>{let s=n?n(f):f,l=r.get(s);return l===void 0&&(l=r.size,r.set(s,l)),l};return{A:Int32Array.from(e,i),B:Int32Array.from(t,i)}}function Ge(e,t,n,r,i,{lo:o,hiA:f,hiB:s}){let l=e.length+t.length+3,c={A:e,B:t,fd:new Int32Array(l),bd:new Int32Array(l),base:t.length+1,limit:ze(e.length+t.length)},a=[{xoff:o,xlim:f,yoff:o,ylim:s,minimal:i}],u={xmid:0,ymid:0,loMinimal:!1,hiMinimal:!1};for(;a.length;){let{xoff:h,xlim:g,yoff:d,ylim:m,minimal:b}=a.pop();for(;h<g&&d<m&&e[h]===t[d];)h++,d++;for(;h<g&&d<m&&e[g-1]===t[m-1];)g--,m--;if(h===g){for(;d<m;d++)r[d]=1;continue}if(d===m){for(;h<g;h++)n[h]=1;continue}Ye(c,h,g,d,m,b,u),a.push({xoff:u.xmid,xlim:g,yoff:u.ymid,ylim:m,minimal:u.hiMinimal}),a.push({xoff:h,xlim:u.xmid,yoff:d,ylim:u.ymid,minimal:u.loMinimal})}}function Ye(e,t,n,r,i,o,f){let{A:s,B:l,fd:c,bd:a,base:u,limit:h}=e,g=n-r,d=t-i,m=n-i,b=t-r,E=m,x=m,w=b,T=b,ie=(b-m&1)!==0;c[u+b]=t,a[u+m]=n;for(let fe=1;;fe++){T>d?c[u+--T-1]=-1:++T,w<g?c[u+ ++w+1]=-1:--w;for(let p=w;p>=T;p-=2){let F=c[u+p+1],O=c[u+p-1],$=O<F?F:O+1,S=$-p;for(;$<n&&S<i&&s[$]===l[S];)$++,S++;if(c[u+p]=$,ie&&x<=p&&p<=E&&a[u+p]<=$){f.xmid=$,f.ymid=S,f.loMinimal=f.hiMinimal=!0;return}}x>d?a[u+--x-1]=2147483647:++x,E<g?a[u+ ++E+1]=2147483647:--E;for(let p=E;p>=x;p-=2){let F=a[u+p+1],O=a[u+p-1],$=O<F?O:F-1,S=$-p;for(;t<$&&r<S&&s[$-1]===l[S-1];)$--,S--;if(a[u+p]=$,!ie&&T<=p&&p<=w&&$<=c[u+p]){f.xmid=$,f.ymid=S,f.loMinimal=f.hiMinimal=!0;return}}if(!(o||fe<h)){Je(e,{xoff:t,xlim:n,yoff:r,ylim:i,fmin:T,fmax:w,bmin:x,bmax:E},f);return}}}function Je(e,t,n){let{fd:r,bd:i,base:o}=e,{xoff:f,xlim:s,yoff:l,ylim:c,fmin:a,fmax:u,bmin:h,bmax:g}=t,d=0,m=-1;for(let x=u;x>=a;x-=2){let w=Math.min(r[o+x],s),T=w-x;c<T&&(w=c+x,T=c),m<w+T&&(m=w+T,d=w)}let b=0,E=2147483647;for(let x=g;x>=h;x-=2){let w=Math.max(f,i[o+x]),T=w-x;T<l&&(w=l+x,T=l),w+T<E&&(E=w+T,b=w)}s+c-E<m-(f+l)?(n.xmid=d,n.ymid=m-d,n.loMinimal=!0,n.hiMinimal=!1):(n.xmid=b,n.ymid=E-b,n.loMinimal=!1,n.hiMinimal=!0)}function Ve(e,t){let n=[],r=t.length,i=e.length,o=0,f=0;for(;o<i||f<r;){if(o<i&&f<r&&!e[o]&&!t[f]){o++,f++;continue}let s=o,l=f;for(;o<i&&e[o];)o++;for(;f<r&&t[f];)f++;if(s===o&&l===f)throw new C("a kept line has no counterpart");n.push({a0:s,a1:o,b0:l,b1:f})}return n}function te(e,t,n,r=null){let i=r?(s,l)=>r(s)===r(l):(s,l)=>s===l,o=0,f=0;for(let{a0:s,a1:l,b0:c,b1:a}of n){if(s<o||c<f||l<s||a<c||l>e.length||a>t.length)throw new C("a block is out of order or out of range");if(s===l&&c===a)throw new C("a block changes nothing");if(s-o!==c-f)throw new C("the kept lines before a block differ in count");for(;o<s;o++,f++)if(!i(e[o],t[f]))throw new C(`kept line ${o+1} does not match`);o=l,f=a}if(e.length-o!==t.length-f)throw new C("the kept lines after the last block differ in count");for(;o<e.length;o++,f++)if(!i(e[o],t[f]))throw new C(`kept line ${o+1} does not match`)}var C=class extends Error{constructor(t){super(`the computed change set does not reconstruct the second file (${t})`),this.name="DiffError"}};var ne={unified:_e,context:Ce,normal:Ne},Se=`Files differ
|
|
17
|
+
`;function Ze(e,t,n){if(e===t)return"";let r=R(n);return r===null?Se:ee(N(e),N(t),r)?"":Se}function oe(e,t){if(!(Number.isInteger(e)&&e>=0)&&e!==1/0)throw new RangeError(`${t} is a number of lines, not ${e}`);return e}function Qe(e,t,{slide:n=!0,horizon:r=3,...i}={}){let o=N(e),f=N(t);return Q(o,f,{...i,slide:n,horizon:oe(r,"horizon")}).map(({a0:s,a1:l,b0:c,b1:a})=>({a0:s,a1:l,b0:c,b1:a,remove:o.slice(s,l),insert:f.slice(c,a)}))}function et(e,t,n,{format:r="unified",context:i=3,label:o=null,...f}={}){if(!Object.hasOwn(ne,r))throw new RangeError(`a change set prints as unified, context or normal, not ${r}`);let s=N(e),l=N(t);return te(s,l,n,R(f)),n.length===0?"":ne[r](s,l,n,{context:i,label:o})}function tt(e,t,{format:n="unified",context:r=3,label:i=null,...o}={}){if(n==="brief")return Ze(e,t,o);let f=N(e),s=N(t),{slide:l=!0,horizon:c=0,...a}=o,u=oe(c,"horizon"),h=Q(f,s,{...a,slide:l,horizon:n==="normal"?u:Math.max(u,oe(r,"context"))});return h.length===0?"":ne[n](f,s,h,{context:r,label:i})}function Ae(){let e=new(k?Uint32Array:Int32Array)(4096);for(let t=0;t<256;t++){let n=t;for(let r=0;r<8;r++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n}for(let t=0;t<256;t++){let n=e[t];for(let r=256+t;r<e.length;r+=256)n=e[r]=n>>>8^e[n&255]}return e}var y=Ae(),[re,nt,ot,rt,it,ft,st,lt,ct,ut,at,ht,dt,mt,xt,pt]=Array.from({length:16},(e,t)=>y.subarray(t*256,t*256+256));function xn(e){D(e);let t=-1,n=0,r=e.length;if(j&&r>1024){let i=4-(e.byteOffset&3)&3;for(;n<i;n++)t=re[(t^e[n])&255]^t>>>8;let o=r-n>>>2,f=new(k?Uint32Array:Int32Array)(e.buffer,e.byteOffset+n,o),s=0;for(let l=o-3;s<l;s+=4){let c=f[s]^t,a=f[s+1],u=f[s+2],h=f[s+3];t=y[3840+(c&255)]^y[3584+(c>>>8&255)]^y[3328+(c>>>16&255)]^y[3072+(c>>>24)]^y[2816+(a&255)]^y[2560+(a>>>8&255)]^y[2304+(a>>>16&255)]^y[2048+(a>>>24)]^y[1792+(u&255)]^y[1536+(u>>>8&255)]^y[1280+(u>>>16&255)]^y[1024+(u>>>24)]^y[768+(h&255)]^y[512+(h>>>8&255)]^y[256+(h>>>16&255)]^y[h>>>24]}n+=s*4}else for(let i=r-15;n<i;n+=16)t=pt[(e[n]^t)&255]^xt[(e[n+1]^t>>>8)&255]^mt[(e[n+2]^t>>>16)&255]^dt[e[n+3]^t>>>24]^ht[e[n+4]]^at[e[n+5]]^ut[e[n+6]]^ct[e[n+7]]^lt[e[n+8]]^st[e[n+9]]^ft[e[n+10]]^it[e[n+11]]^rt[e[n+12]]^ot[e[n+13]]^nt[e[n+14]]^re[e[n+15]];for(let i=n;i<r;i++)t=re[(t^e[i])&255]^t>>>8;return~t>>>0}export{Me as a,bt as b,k as c,yt as d,H as e,L as f,Tt as g,Et as h,D as i,ue as j,z as k,_t as l,Ft as m,Ot as n,Lt as o,Ut as p,xn as q,q as r,I as s,G as t,V as u,A as v,C as w,Qe as x,et as y,tt as z};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import{b as _e,h as Ee}from"./chunk-ZPD5R5RP.js";import{a as Le,e as Ce,h as Ie}from"./chunk-YVZH5SHP.js";import{A as Re,B as z,E as Se,b as G,c as ee,d as ye,j as L,m as C,p as I,s as xe,t as $e,w as ke,z as te}from"./chunk-GNXOKIGP.js";import{a as P,b as U,c as B}from"./chunk-C4Z6ZBXV.js";import{c as Q,f as N,g as ve}from"./chunk-2XUEZHIP.js";var tn=U(class extends B{constructor(e){if(super(e),e.type!==P.ATTRIBUTE||e.name!=="class"||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter(t=>e[t]).join(" ")+" "}update(e,[t]){if(this.st===void 0){this.st=new Set,e.strings!==void 0&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter(o=>o!=="")));for(let o in t)t[o]&&!this.nt?.has(o)&&this.st.add(o);return this.render(t)}let n=e.element.classList;for(let o of this.st)o in t||(n.remove(o),this.st.delete(o));for(let o in t){let i=!!t[o];i===this.st.has(o)||this.nt?.has(o)||(i?(n.add(o),this.st.add(o)):(n.remove(o),this.st.delete(o)))}return N}});var Me="important",ut=" !"+Me,ln=U(class extends B{constructor(e){if(super(e),e.type!==P.ATTRIBUTE||e.name!=="style"||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce((t,n)=>{let o=e[n];return o==null?t:t+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${o};`},"")}update(e,[t]){let{style:n}=e.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let o of this.ft)t[o]==null&&(this.ft.delete(o),o.includes("-")?n.removeProperty(o):n[o]=null);for(let o in t){let i=t[o];if(i!=null){this.ft.add(o);let r=typeof i=="string"&&i.endsWith(ut);o.includes("-")||r?n.setProperty(o,r?i.slice(0,-11):i,r?Me:""):n[o]=i}}return N}});function H(e){return e.id??String(e._id)}function ne(e){let t=I(e);return t!==""&&t!=="revalidation"}var K=[{value:"confirmed",label:"Confirmed",kinds:["confirmed","partial","revalidation"]},{value:"unreachable",label:"Unreachable",kinds:["unreachable"]},{value:"refuted",label:"Refuted",kinds:["refuted"]}];function Ae(e){return K.find(t=>t.value===e)?.kinds??null}var ft=["","exclude","only"];function oe(e,t){let n=Ae(e);return n?.includes("partial")?t==="only"?["partial"]:t==="exclude"?["confirmed"]:n:n}function V(e){if(e.confidence!==void 0)return e.confidence;if(e.critical===!0||e._source)return 10}var pt=e=>e.confidence!==void 0||e.critical===!0;function dt(e){return e.every(t=>t.every(n=>V(n)!==void 0))&&e.some(t=>t.some(pt))}function Te(e,t,n){return e.some(o=>{let i=["refuted","unreachable"].includes(n(o))?0:V(o);return i===void 0?t===0:i>=t})}function gt(e,t){let n=e.map(t).filter(r=>r.length>0);if(!n.some(r=>r.some(s=>V(s)!==void 0)))return 0;let o=r=>n.reduce((s,l)=>s+(l.some(a=>(V(a)??-1)>=r)?1:0),0),i;for(o(6)<=25?i=6:o(7)<=25?i=7:i=8;i>0&&o(i-1)===o(i);)i--;return i}function je(e,t){return dt(e)?t:0}function ht(e,t,n){let o=new Set(e.ruledOutIds??[]);for(let i of e)for(let r of i)["refuted","unreachable"].includes(n(r))&&o.add(H(r));for(let i of e){let r=t(i);if(r.length!==0&&r.some(s=>oe("confirmed","").includes(n(s)||(s._source&&!s._sourcePass?"revalidation":"")))){for(let s of i)if(o.add(H(s)),s.isApp&&Array.isArray(s.revalidateInputs))for(let l of s.revalidateInputs)l&&o.add(l)}}return o}function mt(e,t,n,o){let i=je(e,t),r=e.filter(l=>Te(l,i,o));if(r.length===0)return!1;let s=new Set(oe("confirmed",""));return e.some(l=>l.some(a=>s.has(o(a))))?r.every(l=>l.every(a=>n.has(H(a)))):!1}function hn(e,{tabs:t,kindOf:n,severityMode:o}){let i=e.map(t).filter(l=>l.length>0),r=ht(e,t,n);if(!mt(i,gt(e,t),r,n))return!1;let s=je(i,6);return i.every(l=>!Te(l,s,n)||!l.some(a=>C(a,o)!=="low")||l.every(a=>r.has(H(a))))}var S=!0;function jn(e,t=!1){S=e!==!1&&!t}function Fn(){return S}function A(e){return S?I(e):""}function Dn(e){return I(e)!==""}function On(e){return e.some(t=>(t.groups??[]).some(n=>n.some(ne)))}function bt(e){let t=A(e);return t&&t!=="revalidation"?t:null}function Nn(e){return A(e)==="revalidation"}var Ve=new Set(["refuted","unreachable"]);function Pn(e){return Ve.has(A(e))}function Un(e){return Ve.has(A(e))}function Bn(e){let t=new Set(e);return K.filter(n=>n.kinds.some(o=>t.has(o)))}function Z(e){return new RegExp(`(^|/)${e}/`,"u")}function Ke(e){return new RegExp(`^(?:.*/)?${e}/(?:@[^/]+/[^/]+|[^/]+)/(.*)$`,"u")}var wt=Z("node_modules"),vt=Z("vendor"),M="node_modules",ae=Z(M),We=Ke(M);function yt(e){e!==M&&(M=e,ae=Z(e),We=Ke(e))}function Gn(e){yt(_e(e))}function Ze(){return M}function q(e){return ae.test(e)}var ie=new WeakSet;function zn(e){let t=!1;for(let n of e??[])for(let o of n.groups??[])for(let i of o){if(i.isApp!==!1)continue;let r=ie.has(i);"isUpstream"in i&&!r||(q(i.file)?(i.isUpstream!==!0&&(t=!0),i.isUpstream=!0,ie.add(i)):r&&(t=!0,delete i.isUpstream,ie.delete(i)))}return t}function Fe(e){let t=typeof e=="string"?e:"";return wt.test(t)||vt.test(t)||ae.test(t)}var xt=/^(.*(?:^|\/)node_modules\/(?:@[^/]+\/[^/]+|[^/]+))(?:\/|$)/u;function De(e){return xt.exec(typeof e=="string"?e:"")?.[1]??null}function Hn(e){return typeof e!="number"||!Number.isFinite(e)?null:Le(e)}function Vn(e){if(e.length<=1)return{prefix:"",stripped:[...e]};let t=e.map(s=>s.split("/")),n=Math.min(...t.map(s=>s.length)),o=0;for(let s=0;s<n-1&&t.every(l=>l[s]===t[0][s]);s++)o=s+1;if(o>0&&t[0][o-1].startsWith("@")&&o--,o>0&&t[0][o-1]==="node_modules"&&o--,o===0)return{prefix:"",stripped:[...e]};let i=`${t[0].slice(0,o).join("/")}/`,r=t.map(s=>s.slice(o).join("/"));return{prefix:i,stripped:r}}function $t(e){return e.match(We)?.[1]??e}function Kn(e){let t=S?[bt(e),e.revalidateVerdict,e.revalidateRecommendation]:[];return[e.file,e.title,e.description,e.impact,e.reproduction,Ft(e),e.recommendation,e.confidenceReason,...t,e.discoveredIn,e.repo?.github].filter(Boolean).join(`
|
|
2
|
+
`).toLowerCase()}function Wn(e){return[typeof e?.category=="string"?e.category.trim():"",xe(e,S)].filter(Boolean).join(" \xB7 ")}function Zn(e){if(e.length===0)return"";let t=e[0];for(let n=1;n<e.length;n++){for(;t&&!e[n].startsWith(t);)t=t.slice(0,-1);if(!t)return""}return t}function qn(e){if(!e)return"";let t=e.match(/github\.com\/([^/?#]+\/[^/?#]+?)(?:\.git)?(?:[/?#]|$)/iu);return t?t[1]:e}function qe(e){if(!e)return null;let t=e.trim().replace(/\/$/u,"");return t?/^https?:\/\//iu.test(t)?t:/^github\.com\//iu.test(t)?`https://${t}`:`https://github.com/${t}`:null}var kt=/^(?:@[\w.-]+\/)?[\w.-]+@[^/\s@]+$/u;function Rt(e){return kt.test(e||"")}function Oe(e){if(e==null||typeof e=="string")return{id:e??"",prefix:""};let t=Se(e);return{id:typeof e.github=="string"?e.github:"",prefix:t?`${t}/`:""}}function St(e,t,n){if(Rt(e))return null;let o=Oe(t);if(o.id)return`https://github.com/${o.id}/blob/HEAD/${o.prefix}${$t(e)}`;if(q(e))return null;let i=Oe(n),r=qe(i.id);return r?`${r}/blob/HEAD/${i.prefix}${e}`:null}function Yn(e,t){let n=e?.file??"",o=W(e,t);return o?Q`<a href="${_t(o)}" target="_blank" rel="noopener">${n}</a>`:n}function _t(e){return e.replace(/#L\d+(?:-L?\d+)?$/u,"")}function W(e,t){if(!e)return null;if(z(e.location))return e.location;let n=St(e.file,e.repo,t);if(!n)return null;let o=parseInt(e.line,10);return Number.isFinite(o)?`${n}#L${o}`:n}var Et=/^https?:\/\/(?:www\.)?github\.com\/([^/\s]+\/[^/\s]+)\/(?:blob|tree|blame)\/[^/\s]+\/(\S+)$/u,Lt=/#L(\d+)(?:-L?(\d+))?$/u;function Jn(e){let t=typeof e=="string"?Et.exec(e):null;if(!t)return"";let n=t[2],o=Lt.exec(n);if(!o)return`${t[1]}/${n}`;n=n.slice(0,o.index);let i=o[2]?`${o[1]}-${o[2]}`:o[1];return`${t[1]}/${n}:${i}`}var Ct=/^(?:\s+\S|[-*+] |\d+[.)] |>|#{1,6} |\||`{3}|~{3})/u;function Ye(e){return e.split(/(\n{2,})/u).map(t=>{if(/^\n+$/u.test(t))return t;let n=t.split(`
|
|
3
|
+
`);return n.some(o=>Ct.test(o))?t:n.map(o=>o.trim()).filter(Boolean).join(" ")}).join("")}function Ne(e,t,n){let o=t?/^\n*/u.exec(e)[0]:"",i=e.slice(o.length),r=n?/\n*$/u.exec(i)[0]:"";return o+Ye(i.slice(0,i.length-r.length))+r}function Xn(e){if(!e)return e;let t=G(e);if(t.length===0)return Ye(e);let n=[],o=0;for(let[i,r]of t)i>o&&n.push(Ne(e.slice(o,i),o>0,!0)),n.push(e.slice(i,r)),o=r;return o<e.length&&n.push(Ne(e.slice(o),!0,!1)),n.join("")}var Pe=/^( *)(`{3,}|~{3,})(.*)$/u,It=/^[a-z0-9+#._-]{1,20}$/u;function Je(e,t){let n=0;for(;n<t&&e[n]===" ";)n++;return e.slice(n)}function Mt(e){let t=e.split(`
|
|
4
|
+
`),n=Pe.exec(t[0]),o=(n?.[2]??"```").slice(0,3),i=(n?.[3]??"").trim().split(/\s+/u)[0].toLowerCase(),s=!!(t.length>1?Pe.exec(t.at(-1)):null)?.[2].startsWith(o),l=n?.[1].length??0,a=t.slice(1,s?-1:void 0);return{lang:It.test(i)?i:"",code:(l>0?a.map(u=>Je(u,l)):a).join(`
|
|
5
|
+
`)}}function Qn(e){let t=G(e||"");if(t.length===0)return[e];let n=[],o=0,i=(r,s)=>{let l=(s?r.replace(/^\n+/u,""):r).replace(/\n+$/u,"");l&&n.push(l)};for(let[r,s]of t)r>o&&i(e.slice(o,r),o>0),n.push(Mt(e.slice(r,s))),o=s;return o<e.length&&i(e.slice(o),!0),n}var re=/^( *)(?:[-*+]|(\d{1,9})[.)]) +(?=\S)/u,Ue=/^ {0,3}([-*_])(?: *\1){2,} *$/u;function At(e){return/^ */u.exec(e)[0].length}function Be(e){let t=e.length;for(;t>0&&!e[t-1].trim();)t--;return e.slice(0,t).join(`
|
|
6
|
+
`)}function eo(e){let t=typeof e=="string"?e:"";if(!t)return[e];let n=G(t),o=t.split(`
|
|
7
|
+
`),i=[],r=0;for(let g of o)i.push(r),r+=g.length+1;let s=g=>!ee(n,i[g])&&!Ue.test(o[g])&&re.test(o[g]),l=[],a=0,u=0,p=g=>{let h=o.slice(a,g).join(`
|
|
8
|
+
`).replace(/^\n+/u,"").replace(/\n+$/u,"");h.trim()&&l.push(h)};for(;u<o.length;){if(!s(u)){u++;continue}p(u);let g=re.exec(o[u]),h=!!g[2],y=[],w=null,m=!1;for(;u<o.length;){let x=o[u];if(!ee(n,i[u])){if(!x.trim()){w.lines.push(""),m=!0,u++;continue}let $=At(x),R=Ue.test(x)?null:re.exec(x);if(R&&(!w||$<w.column)){if(!!R[2]!==h)break;w&&y.push(Be(w.lines)),w={column:R[0].length,lines:[x.slice(R[0].length)]},m=!1,u++;continue}if($<w.column&&m)break}w.lines.push(Je(x,w.column)),m=!1,u++}w&&y.push(Be(w.lines)),l.push({ordered:h,start:h?Number(g[2]):null,items:y}),a=u}return l.length===0?[e]:(p(o.length),l)}var Tt=/^(\d+)(?:\s*-\s*(\d+))?$/u;function se(e){if(typeof e=="number")return Number.isFinite(e)&&e>=1?{start:Math.floor(e),end:Math.floor(e)}:null;let t=Tt.exec(String(e??"").trim());if(!t)return null;let n=parseInt(t[1],10),o=t[2]===void 0?n:parseInt(t[2],10);return!Number.isFinite(n)||n<1||!Number.isFinite(o)||o<1?null:{start:Math.min(n,o),end:Math.max(n,o)}}function to(e){return e?e.start===e.end?String(e.start):`${e.start}-${e.end}`:""}function jt(e){if(e&&typeof e=="object"){let t=se(e.start);if(!t)return null;let n=se(e.end)??t;return{start:t.start,end:Math.max(t.start,n.end)}}return se(e)}function no(e,t,n=4){let o=typeof e=="string"&&e!==""?e.split(`
|
|
9
|
+
`):[];if(o.length===0)return{text:"",startLine:1,lines:[]};let i=jt(t),r=i&&{start:Math.min(i.start,o.length),end:Math.min(i.end,o.length)},s=r?Math.max(1,r.start-n):1,l=r?Math.min(o.length,r.end+n):Math.min(o.length,n*2+1),a=o.slice(s-1,l);return{text:a.join(`
|
|
10
|
+
`),startLine:s,lines:a}}function oo(e,t,n,o){if(z(e?.url))return e.url;let i=e?.file;if(typeof i!="string"||i==="")return null;let r=t?.file??"",s=t?.repo?.github,l=()=>s?W({file:i,line:e?.line,repo:t.repo},null):null;if(o===0&&i===r)return l();let a=De(i);return a!==null&&a===De(r)?l():Fe(i)?null:s&&!Fe(r)?l():W({file:i,line:e?.line},n)}function Xe(e,{spaced:t=!1}={}){let n=Array.isArray(e?.evidence)?e.evidence:[];return n.length===0?"":n.map((o,i)=>{let r=te(o),s=[`${i+1}. ${o.url?`[${r}](${o.url})`:r}`],l=Re(o);if(l)for(let a of l.split(`
|
|
11
|
+
`))s.push(` ${a}`);return s.join(`
|
|
12
|
+
`)}).join(t?`
|
|
13
|
+
|
|
14
|
+
`:`
|
|
15
|
+
`)}function Ft(e){let t=Xe(e);return t?`**Evidence:**
|
|
16
|
+
${t}`:""}function io(e){let t=/^\[([^\]]+)\]\(([^)\s]+)\)$/u.exec(e);return!t||!z(t[2])?null:{label:ye(t[1].trim())||t[2],url:t[2]}}function ro(e,t){let n=parseInt(e?.line,10);if(!Number.isFinite(n))return ve;let o=W(e,t),i=`line ${n}`;return o?Q`<a href="${o}" target="_blank" rel="noopener">${i}</a>`:i}function so(e,t){return!e||!t?null:`${/^https?:/iu.test(e)?e.replace(/\/$/u,""):`https://github.com/${e}`}/commit/${t}`}var Dt=[["Impact","impact"],["Reproduction","reproduction"],["Recommendation","recommendation"],["Confidence reason","confidenceReason"],["Revalidation verdict","revalidateVerdict"],["Revalidation recommendation","revalidateRecommendation"]];function co(e,t){let n=[];t&&n.push(`Repo: ${t}`);let o=te(e);o&&n.push(`Location: ${o}`),e?.confidence!=null&&n.push(`Confidence: ${e.confidence}/10`);let i=A(e);i&&n.push(`Revalidation: ${i}`);let r=[];n.length>0&&r.push(n.join(`
|
|
17
|
+
`));let{title:s,body:l}=ke(e);s&&r.push(`# ${s}`),l&&r.push(l.trim());let a=Xe(e,{spaced:!0});a&&r.push(`# Evidence
|
|
18
|
+
|
|
19
|
+
${a}`);for(let[u,p]of Dt){if(!S&&p.startsWith("revalidate"))continue;let g=$e(e?.[p],e)?.trim();g&&r.push(`# ${u}
|
|
20
|
+
|
|
21
|
+
${g}`)}return r.join(`
|
|
22
|
+
|
|
23
|
+
`)}function ao(e,{title:t,body:n,labels:o=[]}={}){let i=qe(e);if(!i)return null;let r;try{r=new URL(i).host.toLowerCase()}catch{return null}if(r!=="github.com")return null;let s=new URLSearchParams;t&&s.set("title",t),n&&s.set("body",n),o.length>0&&s.set("labels",o.join(","));let l=s.toString();return l?`${i}/issues/new?${l}`:`${i}/issues/new`}var Ot=/^[a-zA-Z\d](?:-?[a-zA-Z\d])*$/u,Nt=/^[a-zA-Z\d._-]+$/u,Pt=/^[1-9]\d{0,9}$/u,Ut=/^[a-fA-F\d]{7,40}$/u,Bt=/^#[\w-]+$/u,Ge=/^GHSA(?:-[0-9a-z]{4}){3}$/u;function ze(e){return e.length<=39&&Ot.test(e)}function He(e){return e.length<=100&&e!=="."&&e!==".."&&Nt.test(e)}function Gt(e){let t;try{t=new URL(e)}catch{return null}if(t.href!==e||t.protocol!=="https:"||t.hostname.toLowerCase()!=="github.com"||t.port||t.username||t.password)return null;let n=t.pathname.split("/");if(n.at(-1)===""&&n.pop(),n.length===3&&n[1]==="advisories"){let p=n[2];return Ge.test(p)?{url:`https://github.com/advisories/${p}`,label:p}:null}if(n.length===6&&n[3]==="security"&&n[4]==="advisories"){let[,p,g,,,h]=n;return!ze(p)||!He(g)||!Ge.test(h)?null:{url:`https://github.com/${p}/${g}/security/advisories/${h}`,label:h}}if(n.length!==5)return null;let[,o,i,r,s]=n;if(!ze(o)||!He(i))return null;let l;if(r==="issues"||r==="pull"){if(!Pt.test(s))return null;l=`${o}/${i}#${s}`}else if(r==="commit"){if(!Ut.test(s))return null;l=`${o}/${i}@${s.slice(0,7)}`}else return null;let a=Bt.test(t.hash)?t.hash:"";return{url:`https://github.com/${o}/${i}/${r}/${s}${a}`,label:l}}var zt=/^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/u;function Ht(e){if(typeof e!="string")return null;let t=Vt(e);return t!==e||zt.test(e)?t.slice(0,8):null}function Vt(e){let t=String(e),n="https://chatgpt.com/codex/cloud/security/findings/";return t.startsWith(n)?t.slice(n.length):t}function Kt(e,t){let n=Ee(e,{managed:t});if(!n)return null;let o=Ht(n.id);return{url:t?n.path:`#${n.fragment}`,label:o?`finding ${o}`:"finding",self:!0}}var ce=/https?:\/\/[^\s<>"'`(){}[\]|\\^]+/giu,Wt=new Set([")",".",",","!","?",";",":","'",'"',"*","]","}",">"]);function Zt(e){let t=e.length;for(;t>0&&Wt.has(e[t-1]);)t--;return t===e.length?e:e.slice(0,t)}function lo(e,{managed:t=!1}={}){if(typeof e!="string"||e.length===0)return[];let n=[],o=0;ce.lastIndex=0;let i;for(;(i=ce.exec(e))!==null;){let r=Zt(i[0]),s=r?Gt(r)??Kt(r,t):null;s&&(i.index>o&&n.push(e.slice(o,i.index)),n.push(s),o=i.index+r.length,ce.lastIndex=o)}return o<e.length&&n.push(e.slice(o)),n}var Y={showAll:!1,packagesView:!1,dependencyPackagesView:!1,flowPackagesView:!1,bundleIssues:!1,bundleLayout:"graph",bundleReason:null,bundleReasonFor:null,selected:null,focusedPkg:null,topPkgsTab:"issues",edgeOpacity:.22,nodeSize:1,showLabels:!1,selectedSeverities:new Set,selectedColors:new Set,pathFilter:"",hidden:new Set,solo:null,graphState:null,layoutCache:null,keptViewport:null};function po({keepViewport:e=!1}={}){Y.graphState?._cleanup?Y.graphState._cleanup({keepViewport:e}):e||(Y.keptViewport=null),Y.graphState=null}function mo(e){if(!e)return null;let t=Ze(),n=new RegExp(`^(?:.*/)?${t}/(@[^/]+/[^/]+|[^/]+)`,"u"),o=e.match(n);return o?o[1]:"__own__"}function bo(e){return new Set(e.filter(t=>!q(t)))}var Qe=["#4e9af1","#f28e2b","#59a14f","#e15759","#76b7b2","#edc948","#b07aa1","#ff9da7","#9c755f","#5cd1e5","#f1ce63","#d37295","#a0cbe8","#86bcb6","#8cd17d","#b6992d","#499894","#e15759","#e879c7","#d4a6c8"],et=["#2f8aef","#d2691e","#2ea043","#e63946","#2e9a92","#b88817","#9560e8","#d24a9c","#8a5d40","#0891b2","#a07a14","#c14e8e","#1f7ad0","#549b94","#3fb95f","#a07a14","#2a8278","#cb2c40","#c026d3","#965f93"];function ue(){if(typeof document>"u")return!1;let e=document.body?.classList;return!!e&&(e.contains("theme-light")||e.contains("theme-pink")||e.contains("theme-paper"))}var le=new Map;function wo(e){let t=ue()?et:Qe;return t[e%t.length]}var vo=()=>ue()?"#8c959f":"#6e7681";function yo(e){let t=ue(),n=t?et:Qe,o=e??"__own__",i=`${t?"l":"d"}:${o}`;if(le.has(i))return le.get(i);let r=0;for(let u of o)r=r*37+u.codePointAt(0)|0;let l=((r%n.length+n.length)%n.length*7+3)%n.length,a=n[l];return le.set(i,a),a}function ko(e){return"tree-"+e.replaceAll(/[^\w-]+/gu,"_")}var nt=()=>Object.fromEntries(L.map(e=>[e,0]));function Ro(e,t){let n=new Map;for(let o of e)for(let i of o){n.has(i.file)||n.set(i.file,nt());let r=n.get(i.file),s=C(i,t);r[s]!==void 0&&r[s]++}return n}function So(e){let t=null;for(let n of e)if(n?.tree){t||(t={});for(let o of Object.keys(n.tree)){let i=n.tree[o];if(!t[o]){t[o]={...i,imports:[...i.imports??[]]};continue}let r=new Set(t[o].imports);for(let s of i.imports??[])r.has(s)||(r.add(s),t[o].imports.push(s));t[o].size==null&&i.size!=null&&(t[o].size=i.size)}}return t}function _o(e,t){let n=Object.keys(e),o=new Map(n.map((a,u)=>[a,u])),i=n.map(()=>nt()),r=n.map(()=>[]);for(let[a,u]of n.entries())for(let p of e[u].imports??[]){let g=o.get(p);g!==void 0&&r[g].push(a)}let s=new Uint32Array(n.length),l=0;for(let[a,u]of t){let p=o.get(a);if(p===void 0||!u)continue;let g=L.map(m=>[m,u[m]??0]).filter(([,m])=>m!==0);if(g.length===0)continue;let h=++l,y=[],w=m=>{s[m]!==h&&(s[m]=h,y.push(m))};for(let m of r[p])w(m);for(;y.length>0;){let m=y.pop();for(let[x,$]of g)i[m][x]+=$;for(let x of r[m])w(x)}}return new Map(n.map((a,u)=>[a,i[u]]))}function Eo(e,t,n){let o=t.get(e),i=n.get(e);return tt(o)>0||tt(i)>0}function tt(e){if(!e)return 0;let t=0;for(let n of L)t+=e[n]??0;return t}var ot={package:"@babel/core",path:/^lib\/config\//u},fe={package:"@babel/core",path:/^lib\/config\/files\/(?:module-types|plugins)\.js$/u},st=Object.freeze([{id:"react-native-codegen-discovery",reason:"Codegen discovers package metadata and React Native configuration.",from:{package:"react-native",path:/^scripts\/codegen\/generate-artifacts-executor\.js$/u},to:{path:/(?:^|\/)(?:package\.json|react-native\.config\.js)$/u}},{id:"react-native-release-version",reason:"The CLI release checker reads the installed React Native version.",from:{package:"@react-native-community/cli-tools",path:/^build\/releaseChecker\/index\.js$/u},to:{package:"react-native",path:/^package\.json$/u}},{id:"react-native-platform-config",reason:"React Native configuration loads platform CLIs supplied by the host project.",from:{package:"react-native",path:/^react-native\.config\.js$/u},to:{package:/^@react-native-community\/cli-platform-(?:android|ios)$/u,path:/^build\/index\.js$/u}},{id:"babel-project-config",reason:"Babel discovers project configuration.",from:ot,to:{path:/(?:^|\/)babel\.config\.js$/u}},{id:"babel-typescript-preset",reason:"Babel configuration loads the TypeScript preset.",from:ot,to:{package:"@babel/preset-typescript",path:/./u}},{id:"babel-react-native-preset",reason:"Babel config loaders load the configured React Native preset.",from:fe,to:{package:"@react-native/babel-preset",path:/^(?:src\/)?index\.js$/u}},{id:"babel-reanimated-plugin",reason:"Babel config loaders load the configured Reanimated plugin, including scoped copies.",from:fe,to:{package:/^(?:@[^/]+\/)?react-native-reanimated$/u,path:/^plugin\/index\.js$/u}},{id:"babel-transform-plugin",reason:"Babel config loaders load configured transform plugins.",from:fe,to:{package:/^@babel\/plugin-transform-[^/]+$/u,path:/^lib\/index\.js$/u}},{id:"cosmiconfig-config",reason:"Cosmiconfig loads discovered configuration, including dependency configuration.",from:{package:"cosmiconfig",path:/^dist\/loaders\.js$/u},to:{path:/\.config\.js$/u}},{id:"import-fresh-own-config",reason:"import-fresh loads host-project configuration.",from:{package:"import-fresh",path:/./u},to:{path:/\.config\.js$/u},ownSourceOnly:!0}].map(e=>Object.freeze({...e,from:Object.freeze(e.from),to:Object.freeze(e.to)})));function it(e){return typeof e=="string"&&!e.includes("\\")&&!e.includes(":")&&e.split("/").every(t=>t!==""&&t!=="."&&t!==".."&&t!=="node_modules")}function rt(e,t){let n=e.package;return n!==void 0&&t.ownSource===!0?!1:(n===void 0||(typeof n=="string"?n===t.package:n.test(t.package??"")))&&e.path.test(t.path)}function pe(e,t){if(!(e?.ownSource===!0||!it(e?.path)||!it(t?.path)))return st.find(n=>(!n.ownSourceOnly||t.ownSource===!0)&&rt(n.from,e)&&rt(n.to,t))}function ct(e,t){let o=e.split(/(?:^|\/)node_modules\//u).slice(1).at(-1)?.match(/^(@[^/]+\/[^/]+|[^/]+)\/(.+)$/u);return{package:o?.[1],path:o?.[2]??e.replace(/^\/+/u,""),ownSource:t??Ce(e)==="__own__"}}function de(e,t,n,o){return!pe(ct(e,o),ct(t,n))}function jo(e,t=n=>n.file){let n=new Map(e.nodes.map(i=>[i.file,i])),o=new Map(e.nodes.map(i=>[t(i),new Set]));for(let[i,r]of e.importsOf){let s=n.get(i);if(s)for(let l of r){let a=n.get(l);a&&de(s.origFile??i,a.origFile??l,e.ownSourceFiles?.has(l),e.ownSourceFiles?.has(i))&&o.get(t(s)).add(t(a))}}return o}var ge=class{constructor(t){this.nodes=[...t];for(let[n,o]of this.nodes.entries())o.position=n;for(let n=(this.nodes.length>>1)-1;n>=0;n--)this.down(n)}before(t,n){return Math.abs(t.balance)>Math.abs(n.balance)||Math.abs(t.balance)===Math.abs(n.balance)&&(t.balance>n.balance||t.balance===n.balance&&t.tie<n.tie)}swap(t,n){let o=this.nodes,i=o[t];o[t]=o[n],o[n]=i,o[t].position=t,o[n].position=n}down(t){let n=this.nodes;for(;2*t+1<n.length;){let o=2*t+1;if(o+1<n.length&&this.before(n[o+1],n[o])&&o++,!this.before(n[o],n[t]))break;this.swap(t,o),t=o}}update(t){if(t.position<0)return;let n=t.position;for(;n>0;){let o=n-1>>1;if(!this.before(t,this.nodes[o]))break;this.swap(n,o),n=o}this.down(n)}take(){let t=this.nodes[0],n=this.nodes.pop();return t.position=-1,this.nodes.length>0&&(this.nodes[0]=n,n.position=0,this.down(0)),t}};function qt(e,t){for(let n=0;n<8;n++){let o=!1;for(let i=0;i<e.length-1;i++){let r=n%2?e.length-2-i:i,s=e[r],l=e[r+1];(t.get(l)?.get(s)?.cycleCount??0)<=(t.get(s)?.get(l)?.cycleCount??0)||(e[r]=l,e[r+1]=s,o=!0)}if(!o)break}return e}function Yt(e){let t=[],n=new Set;for(let o of e.values())o.outgoing.sort((i,r)=>r[1]-i[1]||i[0].tie-r[0].tie);for(let o of e.values()){if(n.has(o))continue;let i=[{node:o,next:0}];for(n.add(o);i.length>0;){let r=i.at(-1);if(r.next===r.node.outgoing.length){t.push(r.node.id),i.pop();continue}let s=r.node.outgoing[r.next++][0];n.has(s)||(n.add(s),i.push({node:s,next:0}))}}return t.toReversed()}function he(e,t){let n=new Map(e.map((i,r)=>[i,r])),o=0;for(let i of t.values())for(let[r,s]of i.outgoing)n.get(i.id)<n.get(r.id)&&(o+=s);return o}function Jt(e,t){let n=he(e,t),o=n,i=0;for(let r=0;r<e.length-1;r++)n-=t.get(e[r]).originalBalance,n>o&&(o=n,i=r+1);return[...e.slice(i),...e.slice(0,i)]}function at(e,t){if(e.length<2)return e;let n=new Map(e.map((a,u)=>[a,{id:a,tie:u,balance:0,incoming:[],outgoing:[]}]));for(let a of n.values())for(let u of t.get(a.id)?.values()??[]){let p=n.get(u.to);!p||p===a||!u.cycleCount||(a.outgoing.push([p,u.cycleCount]),p.incoming.push([a,u.cycleCount]),a.balance+=u.cycleCount,p.balance-=u.cycleCount)}for(let a of n.values())a.originalBalance=a.balance;let o=[],i=new ge(n.values()),r=[];for(;i.nodes.length>0;){let a=i.take();a.balance>=0?o.push(a.id):r.push(a.id);for(let[u,p]of a.outgoing)u.position<0||(u.balance+=p,i.update(u));for(let[u,p]of a.incoming)u.position<0||(u.balance-=p,i.update(u))}let s=e,l=he(e,n);for(let a of[[...o,...r.toReversed()],Yt(n),e,e.toReversed()]){let u=qt(Jt(a,n),t),p=he(u,n);p>l&&(s=u,l=p)}return s}function Xt(e,t){let n=new Set(e),o=new Map(e.map(a=>[a,[]]));for(let[a,u]of t)for(let p of u)n.has(a)&&n.has(p)&&o.get(p).push(a);let i=[],r=new Set;for(let a of e){if(r.has(a))continue;r.add(a);let u=[[a,(t.get(a)??[])[Symbol.iterator]()]];for(;u.length>0;){let[p,g]=u.at(-1),h=g.next();if(h.done){i.push(p),u.pop();continue}n.has(h.value)&&!r.has(h.value)&&(r.add(h.value),u.push([h.value,(t.get(h.value)??[])[Symbol.iterator]()]))}}let s=new Map,l=[];for(let a of i.toReversed()){if(s.has(a))continue;let u=[],p=l.length,g=[a];for(s.set(a,p);g.length>0;){let h=g.pop();u.push(h);for(let y of o.get(h))s.has(y)||(s.set(y,p),g.push(y))}l.push(u.toSorted())}return{groups:l,componentOf:s}}function Uo(e,{expanded:t=new Set,order:n="structure",query:o="",neighborhood:i=null,cyclesOnly:r=!1}={}){let s=new Map,l=new Map,a=new Map;for(let c of e.nodes){let d=t.has(c.pkg),f=`${d?"f":"p"}:${d?c.file:c.pkg}`;s.has(f)||s.set(f,{id:f,pkg:c.pkg,file:d?c.file:null,label:d?c.file:Ie(c.pkg),files:[],size:0,issues:0,incoming:0,outgoing:0,importers:0,dependencies:0});let v=s.get(f);v.files.push(c.file),v.size+=c.size??0,v.issues+=c.totalIssues??0,l.set(c.file,f),a.set(c.file,c.origFile??c.file)}let u=new Map,p=new Set,g=new Set,h=new Map([...s.keys()].map(c=>[c,new Set])),y=0;for(let[c,d]of e.importsOf){let f=l.get(c);if(f)for(let v of new Set(d)){let b=l.get(v);if(!b)continue;u.has(f)||u.set(f,new Map),u.get(f).has(b)||u.get(f).set(b,{from:f,to:b,count:0,cycleCount:0,examples:[]});let k=u.get(f).get(b);k.count++;let E=de(a.get(c),a.get(v),e.ownSourceFiles?.has(v),e.ownSourceFiles?.has(c));k.examples.length<80&&(!r||E)&&k.examples.push([c,v]),y++,s.get(f).outgoing++,s.get(b).incoming++,f!==b&&(g.add(f),p.add(b)),E&&(k.cycleCount++,(f!==b||s.get(f).file)&&h.get(f).add(b))}}let w=[...s.keys()].toSorted(),{groups:m,componentOf:x}=Xt(w,h),$=new Set(m.flatMap(c=>c.length>1||h.get(c[0]).has(c[0])?c:[]));for(let c of s.values())c.cyclic=$.has(c.id),c.component=x.get(c.id);let R=e.ownSourcePackages??new Set(e.layerRoots?.roots??[]),T=c=>c.pkg==="__own__"?0:R.has(c.pkg)?1:2,j=c=>p.has(c.id)&&g.has(c.id)?0:1,me=new Map(m.map((c,d)=>[d,c.reduce((f,v)=>Math.min(f,T(s.get(v))),2)])),F=(c,d)=>c.pkg.localeCompare(d.pkg)||c.label.localeCompare(d.label),J=new Map;if(n==="structure"){for(let c of m)if(!(c.length<2))for(let d of Map.groupBy(c,f=>T(s.get(f))).values()){let f=d.toSorted((v,b)=>F(s.get(v),s.get(b)));at(f,u).forEach((v,b)=>J.set(v,b))}}if(r){y=0,p.clear(),g.clear();for(let c of s.values())c.incoming=0,c.outgoing=0}for(let[c,d]of u){for(let f of d.values())if(f.cyclic=f.cycleCount>0&&$.has(c)&&x.get(c)===x.get(f.to)&&(c!==f.to||s.get(c).file!==null),!!r){if(!f.cyclic){d.delete(f.to);continue}f.count=f.cycleCount,y+=f.count,s.get(c).outgoing+=f.count,s.get(f.to).incoming+=f.count,c!==f.to&&(g.add(c),p.add(f.to))}d.size===0&&u.delete(c)}for(let[c,d]of u)for(let f of d.keys())c!==f&&(s.get(c).dependencies++,s.get(f).importers++);let D=o.trim().toLowerCase(),O=new Set(w.filter(c=>!D||s.get(c).files.some(d=>d.toLowerCase().includes(D))||s.get(c).label.toLowerCase().includes(D))),X=new Set(i?[i]:O);if(D||i)for(let[c,d]of u)for(let f of d.keys())(i?c===i:O.has(c))&&X.add(f),(i?f===i:O.has(f))&&X.add(c);let lt=(c,d)=>{if(n==="structure"){let b=me.get(c.component)-me.get(d.component);if(b)return b;let k=j(c)-j(d);if(k)return k;let E=c.component-d.component;if(E)return E}let f=T(c)-T(d);if(f)return f;if(n==="importers")return d.importers-c.importers||F(c,d);if(n==="imports")return d.dependencies-c.dependencies||F(c,d);let v=j(c)-j(d);if(v)return v;if(n==="structure"&&c.component===d.component){let b=(J.get(c.id)??0)-(J.get(d.id)??0);if(b)return b}return F(c,d)},be=[...s.values()].filter(c=>X.has(c.id)&&(!r||c.cyclic)).toSorted(lt),_=new Map(be.map((c,d)=>[c.id,d])),we=[];for(let[c,d]of u)if(_.has(c))for(let f of d.values())_.has(f.to)&&we.push({...f,row:_.get(c),col:_.get(f.to)});return{rows:be,byId:s,cells:u,visibleCells:we,index:_,matches:O,importCount:y,totalRows:s.size,cycleCount:m.filter(c=>$.has(c[0])).length}}export{tn as a,ln as b,H as c,ne as d,K as e,Ae as f,ft as g,oe as h,V as i,dt as j,gt as k,ht as l,mt as m,hn as n,jn as o,Fn as p,A as q,Dn as r,On as s,bt as t,Nn as u,Pn as v,Un as w,Bn as x,Gn as y,Ze as z,q as A,zn as B,Hn as C,Vn as D,Kn as E,Wn as F,Zn as G,qn as H,Yn as I,W as J,Jn as K,Xn as L,Qn as M,eo as N,se as O,to as P,no as Q,oo as R,Ft as S,io as T,ro as U,so as V,co as W,ao as X,Ht as Y,Vt as Z,lo as _,Y as $,po as aa,mo as ba,bo as ca,wo as da,vo as ea,yo as fa,ko as ga,Ro as ha,So as ia,_o as ja,Eo as ka,tt as la,de as ma,jo as na,at as oa,Xt as pa,Uo as qa};
|
|
24
|
+
/*! Bundled license information:
|
|
25
|
+
|
|
26
|
+
lit-html/directives/class-map.js:
|
|
27
|
+
lit-html/directives/style-map.js:
|
|
28
|
+
(**
|
|
29
|
+
* @license
|
|
30
|
+
* Copyright 2018 Google LLC
|
|
31
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
32
|
+
*)
|
|
33
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var f=new TextEncoder,c=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function u(e){if(typeof e!="string")throw new TypeError(`encodeUtf8 expects a string, got ${typeof e}`);if(!e.isWellFormed())throw new TypeError("encodeUtf8: input contains lone surrogates");return f.encode(e)}var i=2;function d(e){if(typeof e!="string")throw new TypeError(`utf8ByteLength expects a string, got ${typeof e}`);if(/[\u0100-\uFFFF]/.test(e))return f.encode(e).byteLength;let n=/[\u0080-\u00FF]/gu,r=e.length;for(;n.test(e);){let t=n.lastIndex-1;for(let o=0;t<e.length&&o<i;t++)e.codePointAt(t)>127?(r++,o=0):o++;n.lastIndex=t}return r}function l(e){if(!ArrayBuffer.isView(e)&&!(e instanceof ArrayBuffer))throw new TypeError(`decodeUtf8 expects a BufferSource, got ${e===null?"null":typeof e}`);return c.decode(e)}export{u as a,d as b,l as c};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{b as m,c as h,d as A,e as D,f as y}from"./chunk-XYFXXB2G.js";import{a as k,b as w,c as V}from"./chunk-C4Z6ZBXV.js";import{f as P}from"./chunk-2XUEZHIP.js";var b=(s,f,c)=>{let p=new Map;for(let e=f;e<=c;e++)p.set(s[e],e);return p},I=w(class extends V{constructor(s){if(super(s),s.type!==k.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,f,c){let p;c===void 0?c=f:f!==void 0&&(p=f);let e=[],n=[],o=0;for(let a of s)e[o]=p?p(a,o):o,n[o]=c(a,o),o++;return{values:n,keys:e}}render(s,f,c){return this.dt(s,f,c).values}update(s,[f,c,p]){let e=D(s),{values:n,keys:o}=this.dt(f,c,p);if(!Array.isArray(e))return this.ut=o,n;let a=this.ut??=[],u=[],v,g,t=0,l=e.length-1,r=0,i=n.length-1;for(;t<=l&&r<=i;)if(e[t]===null)t++;else if(e[l]===null)l--;else if(a[t]===o[r])u[r]=h(e[t],n[r]),t++,r++;else if(a[l]===o[i])u[i]=h(e[l],n[i]),l--,i--;else if(a[t]===o[i])u[i]=h(e[t],n[i]),m(s,u[i+1],e[t]),t++,i--;else if(a[l]===o[r])u[r]=h(e[l],n[r]),m(s,e[t],e[l]),l--,r++;else if(v===void 0&&(v=b(o,r,i),g=b(a,t,l)),v.has(a[t]))if(v.has(a[l])){let d=g.get(o[r]),x=d!==void 0?e[d]:null;if(x===null){let C=m(s,e[t]);h(C,n[r]),u[r]=C}else u[r]=h(x,n[r]),m(s,e[t],x),e[d]=null;r++}else y(e[l]),l--;else y(e[t]),t++;for(;r<=i;){let d=m(s,u[i+1]);h(d,n[r]),u[r++]=d}for(;t<=l;){let d=e[t++];d!==null&&y(d)}return this.ut=o,A(s,u),P}});export{I as a};
|
|
2
|
+
/*! Bundled license information:
|
|
3
|
+
|
|
4
|
+
lit-html/directives/repeat.js:
|
|
5
|
+
(**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2017 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
+
*)
|
|
10
|
+
*/
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as v}from"./chunk-2KBF5TZ7.js";import{a as u}from"./chunk-K3X5EJBQ.js";import{g,h as f}from"./chunk-CVVJAXVY.js";import{a as l}from"./chunk-KYCNJVB7.js";import{d as p}from"./chunk-IU3CCINR.js";import"./chunk-UYAXVRVL.js";import"./chunk-PNHBZGDD.js";import{a as y}from"./chunk-R5O6FAW4.js";import"./chunk-CMQA4DM6.js";import"./chunk-4XCDFGDP.js";import"./chunk-3BZ7JERB.js";import"./chunk-XYFXXB2G.js";import"./chunk-C4Z6ZBXV.js";import{a as h,c as t,g as m}from"./chunk-2XUEZHIP.js";import"./chunk-TUII34K2.js";import"./chunk-V5O7M2YT.js";import"./chunk-OOJM4CTU.js";var x={triage:"Status",color:"Label",flagged:"Flagged",fix:"Fix",comment:"Comment"},$={inprogress:"In progress",fixed:"Fixed",invalid:"Invalid",deleted:"Deleted",ignored:"Ignored"};function w(a,e){return e==="triage"?$[a?.triage]??"Untriaged":e==="flagged"?a?.flagged?"Yes":"No":a?.[e]||"None"}function b(a,e){return Object.entries(x).flatMap(([i,s])=>{let r=w(a,i);if(e===void 0)return a?.[i]===void 0?[]:[{label:s,after:r}];let o=w(e,i);return o===r?[]:[{label:s,before:o,after:r}]})}var _=`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}}
|
|
2
|
+
`;var c=class extends g{static styles=[...g.styles,h(y),h(v),h(_)];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:i}=this.finding;this._key=`finding-history:${this.teamId??""}:${e}:${i}`,l.invalidate([this._key]);let s=l.load(this._key,"issue history",async r=>{let o=new URLSearchParams({finding:i});this.teamId&&o.set("team",this.teamId);let d=await p(`/api/reports/${encodeURIComponent(e)}/triage/history?${o}`,{credentials:"same-origin",signal:r});if(!d.ok)throw new Error(`History request failed (${d.status})`);let n=await d.json();if(n.finding!==i||!Array.isArray(n.events))throw new Error("Invalid history response");return n.events});this._owner=l.resources.get(this._key),this._signal=this._owner.controller.signal,this._signal.addEventListener("abort",this._onClose,{once:!0});try{let r=await s;if(this._settled||!this.isConnected)return;if(!this.isCurrent()){this._finish(null);return}this._events=r}catch(r){if(this._settled||!this.isConnected)return;r.name==="AbortError"||!this.isCurrent()?this._finish(null):this._error=!0}finally{this._loading=!1}}disconnectedCallback(){this._signal?.removeEventListener("abort",this._onClose),this._owner&&l.resources.get(this._key)===this._owner&&l.invalidate([this._key]),this._events=[],super.disconnectedCallback()}_onKeydown=e=>{e.key==="Escape"&&e.stopPropagation()};_renderEvent(e,i){let s=this._events[i+1],r=b(e.entry,s?.entry),o=new Date(e.at),d=e.actorLogin?`@${e.actorLogin}`:"";return t`<li class="event">${e.actorId?u(e.actorId,e.actorName||e.actorLogin):t`<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||d||"Unknown user"}</strong> ${e.actorName&&d?t`<span class="username">${d}</span>`:m}</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":s?"Updated triage":"Recorded triage state"}</p>${r.length>0?t`<dl class="changes">${r.map(n=>t`<div class="change"><dt>${n.label}</dt><dd class="${n.before===void 0?"snapshot":""}">${n.before===void 0?m:t`<span class="before"><span class="sr-only">Previously: </span>${n.before}</span> <span class="change-arrow" aria-hidden="true">→</span>`} <span class="after"><span class="sr-only">${n.before===void 0?"Recorded: ":"Changed to: "}</span>${n.after}</span></dd></div>`)}</dl>`:m}</div></li>`}render(){let e=this.finding??{};return t`<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?t`<div class="history-summary"><span>${this._events.length} ${this._events.length===1?"record":"records"}</span><span>Newest first</span></div>`:m}<div class="history-body" aria-busy="${String(this._loading)}">${this._loading?t`<p class="history-state" role="status">Loading history…</p>`:this._error?t`<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?t`<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>`:t`<ol class="timeline">${this._events.map((i,s)=>this._renderEvent(i,s))}</ol>`}</div></dialog>`}};customElements.define("finding-history-dialog",c);function F(a){return a.isCurrent()?f("finding-history-dialog",a):Promise.resolve(null)}export{F as openFindingHistoryDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var a=["admin","manage","triage","view","none"];function p(e){return typeof e=="string"&&a.includes(e)}function c(e,o){let n=a.indexOf(e);return n!==-1&&n<=a.indexOf(o)}function s(e){if(!e?.startsWith("#public="))return null;let o=/^#public=([A-Za-z0-9_-]+)\.([A-Za-z0-9_-]{43})$/u.exec(e);return o?{id:o[1],token:o[2]}:{id:"",token:""}}var l=globalThis.location?.hash,i=s(l);globalThis.addEventListener?.("hashchange",()=>{let e=globalThis.location?.hash;e?.startsWith("#public=")&&e!==l&&globalThis.location.reload()});function h(){return i}function d(e=i){return`/api/shares/${encodeURIComponent(e.id)}/workspace`}function g(e,o=i){return o?`${e.replace(/#.*$/su,"")}#public=${o.id}.${o.token}`:e}function f(e=null){let o=["anthropic/claude-opus-5.5","anthropic/claude-fable-5.1","anthropic/claude-sonnet-5.5","anthropic/claude-haiku-5.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","mistralai/mistral-large-4-0"],n=e==="moonshot"?"moonshotai":e,r=o.filter(t=>!["anthropic","openai","moonshot"].includes(e??"")||t.startsWith(`${n}/`)).map(t=>({id:t,efforts:["low","medium","high","xhigh","max"]}));return{models:r,defaultModel:r[0].id}}export{a,p as b,c,f as d,s as e,h as f,d as g,g as h};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a,c as i,j as r}from"./chunk-2XUEZHIP.js";var s=`:host{display:inline-flex;flex-shrink:0;vertical-align:middle;--switch-track-width: 26px;--switch-track-height: 14px}button,.checkbox-mode{align-items:center;gap:8px;box-sizing:border-box;height:30px;margin:0;padding:0 .6rem;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);background:transparent;color:var(--muted);font:inherit;font-size:.78rem;font-weight:500;line-height:1;white-space:nowrap;cursor:default}button{display:var(--switch-button-display, inline-flex);&:hover:not(:disabled){color:var(--text);background:rgb(from var(--text) r g b / .04)}&[aria-pressed=true]{color:var(--text)}&:disabled{opacity:.4}&:focus-visible{outline:1px solid var(--accent);outline-offset:-2px}}.checkbox-mode{display:var(--switch-checkbox-display, none);border:0;color:var(--text);&:has(:disabled){opacity:.4}& input{width:.85rem;height:.85rem;margin:0;accent-color:var(--accent)}}.track{position:relative;flex-shrink:0;width:var(--switch-track-width);height:var(--switch-track-height);background:var(--border);border-radius:var(--ui-radius, 8px);transition:background .15s;&:after{content:"";position:absolute;top:2px;left:2px;width:calc(var(--switch-track-height) - 4px);height:calc(var(--switch-track-height) - 4px);border-radius:50%;background:var(--muted);transition:transform .15s,background .15s}}button[aria-pressed=true] .track{background:color-mix(in oklch,var(--accent) 22%,transparent);&:after{transform:translate(calc(var(--switch-track-width) - var(--switch-track-height)));background:var(--accent)}}:host([borderless]) :is(button,.checkbox-mode){height:100%;border:0;border-radius:0}:host([compact]){--switch-track-width: 22px;--switch-track-height: 12px}:host([compact]) :is(button,.checkbox-mode){height:auto;gap:7px;padding:2px 8px;border-radius:var(--ui-radius, 6px);font-size:.68rem;line-height:1.2}
|
|
2
|
+
`;var t=class extends r{static properties={checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},label:{type:String},accessibleLabel:{type:String,attribute:"accessible-label"}};static styles=a(s);constructor(){super(),this.checked=!1,this.disabled=!1,this.label="",this.accessibleLabel=""}_checkboxClick(e){(this.disabled||e.target.tagName!=="INPUT")&&e.stopPropagation()}render(){return i`<button type="button" part="button" aria-pressed="${String(this.checked)}" aria-label="${this.accessibleLabel||this.label}" ?disabled="${this.disabled}"><span>${this.label}</span><span class="track" part="track" aria-hidden="true"></span></button> <label class="checkbox-mode" @click="${this._checkboxClick}"><input type="checkbox" part="checkbox" .checked="${this.checked}" ?disabled="${this.disabled}" aria-label="${this.accessibleLabel||this.label}"> <span>${this.label}</span></label>`}};customElements.get("mode-switch")||customElements.define("mode-switch",t);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r="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",e="M11.998 24c-.321 0-.641-.084-.922-.247l-2.936-1.737c-.438-.245-.224-.332-.08-.383c.585-.203.703-.25 1.328-.604c.065-.037.151-.023.218.017l2.256 1.339c.082.045.197.045.272 0l8.795-5.076c.082-.047.134-.141.134-.238V6.921c0-.099-.053-.192-.137-.242l-8.791-5.072c-.081-.047-.189-.047-.271 0L3.075 6.68C2.99 6.729 2.936 6.825 2.936 6.921v10.15c0 .097.054.189.139.235l2.409 1.392c1.307.654 2.108-.116 2.108-.89V7.787c0-.142.114-.253.256-.253h1.115c.139 0 .255.112.255.253v10.021c0 1.745-.95 2.745-2.604 2.745c-.508 0-.909 0-2.026-.551L2.28 18.675c-.57-.329-.922-.945-.922-1.604V6.921c0-.659.353-1.275.922-1.603l8.795-5.082c.557-.315 1.296-.315 1.848 0l8.794 5.082c.57.329.924.944.924 1.603v10.15c0 .659-.354 1.273-.924 1.604l-8.794 5.078C12.643 23.916 12.324 24 11.998 24zM19.099 13.993c0-1.9-1.284-2.406-3.987-2.763c-2.731-.361-3.009-.548-3.009-1.187c0-.528.235-1.233 2.258-1.233c1.807 0 2.473.389 2.747 1.607c.024.115.129.199.247.199h1.141c.071 0 .138-.031.186-.081c.048-.054.074-.123.067-.196c-.177-2.098-1.571-3.076-4.388-3.076c-2.508 0-4.004 1.058-4.004 2.833c0 1.925 1.488 2.457 3.895 2.695c2.88.282 3.103.703 3.103 1.269c0 .983-.789 1.402-2.642 1.402c-2.327 0-2.839-.584-3.011-1.742c-.02-.124-.126-.215-.253-.215h-1.137c-.141 0-.254.112-.254.253c0 1.482.806 3.248 4.655 3.248C17.501 17.007 19.099 15.91 19.099 13.993z",t='<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>',o='<svg class="file-icon" viewBox="0 0 16 16" width="14" height="14" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M1 1h14v14H1Zm3 3v8h4V6h2v6h2V4Z"/></svg>',i='<svg class="file-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2.5" y="4" width="11" height="9" rx="1.2"/><path d="M6 4V3h4v1"/></svg>',l='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" aria-hidden="true"><path d="m4.5 4.5 7 2-5 5z"/><circle cx="4.5" cy="4.5" r="2" fill="currentColor"/><circle cx="11.5" cy="6.5" r="2" fill="currentColor"/><circle cx="6.5" cy="11.5" r="2" fill="currentColor"/></svg>',h='<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><rect x="1" y="1.5" width="14" height="3" rx=".5"/><rect x="1" y="6.5" width="8" height="3" rx=".5"/><rect x="11" y="6.5" width="4" height="3" rx=".5"/><rect x="1" y="11.5" width="4" height="3" rx=".5"/><rect x="7" y="11.5" width="8" height="3" rx=".5"/></svg>',n='<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M1 1h4v4H1zm5 5h4v4H6zm5 5h4v4h-4z"/><path d="M6 1h4v4H6zm5 0h4v4h-4zM1 6h4v4H1zm10 0h4v4h-4zM1 11h4v4H1zm5 0h4v4H6z" opacity=".35"/></svg>',c='<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>',d='<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.38a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg>',s='<svg class="file-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6.67 8.67a3.33 3.33 0 0 0 5.03.36l2-2a3.33 3.33 0 0 0-4.71-4.71l-1.15 1.14"/><path d="M9.33 7.33a3.33 3.33 0 0 0-5.03-.36l-2 2a3.33 3.33 0 0 0 4.71 4.71l1.14-1.14"/></svg>',a='<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>',v='<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>',u='<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>',x='<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>',g='<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>',p='<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>',w='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linejoin="round" aria-hidden="true"><path d="M2 2h5.5l6.5 6.5-5.5 5.5L2 7.5Z"/><circle cx="5" cy="5" r="1"/></svg>',C='<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>',k='<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>';export{r as a,e as b,t as c,o as d,i as e,l as f,h as g,n as h,c as i,d as j,s as k,a as l,v as m,u as n,x as o,g as p,p as q,w as r,C as s,k as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Ne}from"./chunk-GJ4IUCNS.js";import{a as V,b as N}from"./chunk-PNHBZGDD.js";import{a as d,c as m}from"./chunk-TUII34K2.js";var v=new Uint8Array([68,86,69,49]),$=12,st=32,ct="deepview-passkey.v1.content-key";function q(){return!(typeof window>"u"||typeof PublicKeyCredential>"u"||typeof navigator>"u"||!navigator.credentials)}async function $e(){if(typeof PublicKeyCredential>"u")return!1;let e=PublicKeyCredential.getClientCapabilities;if(typeof e!="function")return null;try{let t=await e.call(PublicKeyCredential);if(!t||typeof t!="object")return null;let r=t["extension:prf"],n=t.prf;return r===!0||n===!0?!0:r===!1||n===!1?!1:null}catch{return null}}function Z(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),t}async function he(e){if(e.length<32)throw new Error(`PRF output too short (${e.length} bytes; need \u2265 32)`);let t=await crypto.subtle.importKey("raw",e,"HKDF",!1,["deriveBits"]),r=await crypto.subtle.deriveBits({name:"HKDF",hash:"SHA-256",salt:new Uint8Array,info:d(ct)},t,st*8);return new Uint8Array(r)}function ve(e){return crypto.subtle.importKey("raw",e,{name:"AES-GCM"},!1,["encrypt","decrypt"])}async function A(e,t,r){let n=Z($),a=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:n,additionalData:r},e,t)),o=new Uint8Array(v.length+$+a.length);return o.set(v,0),o.set(n,v.length),o.set(a,v.length+$),o}async function O(e,t,r){if(!E(t))throw new Error("passkey: missing envelope magic");if(t.length<v.length+$+16)throw new Error("passkey: envelope too short");let n=t.subarray(v.length,v.length+$),a=t.subarray(v.length+$);return new Uint8Array(await crypto.subtle.decrypt({name:"AES-GCM",iv:n,additionalData:r},e,a))}function E(e){if(e.length<v.length)return!1;for(let t=0;t<v.length;t++)if(e[t]!==v[t])return!1;return!0}async function Te(e){if(!q())throw new Error("passkey: not supported in this environment");let t=Z(32),r=Z(32),n=await navigator.credentials.create({publicKey:{challenge:t,rp:{name:e.rpName,id:e.rpId},user:{id:e.userId,name:e.userName,displayName:e.userName},pubKeyCredParams:[{type:"public-key",alg:-7},{type:"public-key",alg:-257}],authenticatorSelection:{residentKey:"required",userVerification:"required"},extensions:{prf:{eval:{first:r}}},timeout:e.timeoutMs??12e4},...e.signal?{signal:e.signal}:{}});if(!(n instanceof PublicKeyCredential))throw new Error("passkey: registration returned no credential");let a=new Uint8Array(n.rawId).toBase64({alphabet:"base64url",omitPadding:!0}),o=n.getClientExtensionResults().prf,i=o?.results?.first?new Uint8Array(o.results.first):null;return{credentialId:a,prfSalt:r.toBase64({alphabet:"base64url",omitPadding:!0}),prfOutput:i}}async function Ee(e){if(!q())throw new Error("passkey: not supported in this environment");let t=Z(32),r=Uint8Array.fromBase64(e.credentialId,{alphabet:"base64url"}),n=Uint8Array.fromBase64(e.prfSalt,{alphabet:"base64url"}),a=await navigator.credentials.get({publicKey:{challenge:t,rpId:e.rpId,allowCredentials:[{type:"public-key",id:r}],userVerification:"required",extensions:{prf:{eval:{first:n}}},timeout:e.timeoutMs??12e4},...e.signal?{signal:e.signal}:{}});if(!(a instanceof PublicKeyCredential))throw new Error("passkey: assertion returned no credential");let i=a.getClientExtensionResults().prf?.results?.first;if(!i)throw new Error("passkey: authenticator did not return PRF output (extension unsupported)");return new Uint8Array(i)}var T=Object.freeze(["deepview.workspaces","deepview.sync.sessions","deepview.sync.userEnabled","deepview.sync.password","deepview.repoUrls","deepview.fileCounts","deepview.workspaceApp","deepview.lastFile","deepview.scan.access"]),p=new Map,ee=!1,S=new Map,w=new Map,Q=new Set;function Kt(e){let t=()=>e();return Q.add(t),ee&&queueMicrotask(()=>{if(Q.has(t))try{t()}catch(r){console.warn("secure-storage after-hydrate listener:",r)}}),()=>Q.delete(t)}function lt(){for(let e of Q)try{e()}catch(t){console.warn("secure-storage after-hydrate listener:",t)}}function re(e){let t=Re()??"";return d(`deepview.secure.v1|${t}|${e}`)}function be(e){try{let t=Uint8Array.fromBase64(e);if(E(t))return t}catch{}return null}function me(e){return p.get(e)??null}async function He(e,t){if(typeof t!="string")throw new TypeError("secure-storage: value must be a string");if(x()&&!y())throw new Error(`secure-storage: vault locked, cannot save "${e}"`);if(Le())throw new Error(`secure-storage: wipe in progress, cannot save "${e}"`);let r=p.has(e),n=p.get(e);p.set(e,t),w.set(e,t);let a=S.get(e)??Promise.resolve(),o=()=>{w.get(e)===t&&w.delete(e)},i=a.catch(()=>{}).then(()=>ut(e,t)).then(()=>o(),s=>{throw o(),p.get(e)===t&&(r?p.set(e,n):p.delete(e)),s});S.set(e,i.catch(()=>{})),await i}async function _t(e){let t=Symbol("secure-storage:removed");p.delete(e),w.set(e,t);let r=S.get(e)??Promise.resolve(),n=()=>{try{localStorage.removeItem(e)}catch{}w.get(e)===t&&(w.delete(e),p.delete(e))},a=r.catch(()=>{}).then(()=>n());S.set(e,a.catch(()=>{})),await a}async function ut(e,t){let r=y();if(r){let n=await A(r,d(t),re(e));localStorage.setItem(e,n.toBase64())}else localStorage.setItem(e,t)}async function Se(){ee||te(()=>{Se().catch(e=>console.warn("secure-storage rehydrate:",e))}),ee=!0;for(let e of[...p.keys()])w.has(e)||p.delete(e);await Ve(T,!0)}async function Mt(e){if(!T.includes(e))throw new Error(`secure-storage: unknown secure key "${e}"`);return w.has(e)||p.delete(e),(await Ve([e],!1)).get(e)??null}async function Ve(e,t){let r=y(),n=[],a=new Map;for(let o of e){if(w.has(o)){a.set(o,me(o));continue}let i=localStorage.getItem(o);if(i===null)continue;let s=be(i);if(s){if(!r)continue;try{let c=await O(r,s,re(o));if(w.has(o)){a.set(o,me(o));continue}let u=m(c);p.set(o,u),a.set(o,u)}catch(c){console.warn(`secure-storage: decrypt failed for "${o}":`,c)}}else p.set(o,i),a.set(o,i),r&&x()&&n.push([o,i])}return t&<(),n.length>0&&queueMicrotask(()=>{for(let[o,i]of n)p.get(o)===i&&He(o,i).catch(s=>{console.warn(`secure-storage: self-heal failed for "${o}":`,s)})}),a}async function qe(e,t){let r=S.get(e)??Promise.resolve(),n=async()=>{if(w.has(e))return;let o=localStorage.getItem(e);if(o===null)return;let i=await t(o);i!==null&&(w.has(e)||(localStorage.setItem(e,i.storageValue),p.set(e,i.cacheValue)))},a=r.catch(()=>{}).then(n);S.set(e,a.catch(()=>{})),await a}async function Nt({seal:e}){for(let t of T)await qe(t,async r=>{if(be(r))return null;let n=y();return n?{storageValue:(await A(n,d(r),re(t))).toBase64(),cacheValue:r}:null})}async function $t({open:e}){for(let t of T)await qe(t,async r=>{let n=be(r);if(!n)return null;let a=await e(n,re(t)),o=m(a);return{storageValue:o,cacheValue:o}})}var ft="deepview.secure.v1.mutate:";function Tt(e,t){return T.includes(e)?navigator.locks.request(ft+e,async()=>{let r=S.get(e);r&&await r.catch(()=>{}),await Se();let n=me(e),a=await t(n);if(!(a==null||a===n)){if(typeof a!="string")throw new TypeError(`secure-storage: mutate updater for "${e}" must return a string`);await He(e,a)}}):Promise.reject(new Error(`secure-storage: mutate() called with non-secure key "${e}"`))}async function We(){await Promise.allSettled([...S.values()]),w.clear(),S.clear()}typeof window<"u"&&window.addEventListener("storage",e=>{!ee||!e.key||!T.includes(e.key)||Se().catch(()=>{})});var G="deepview.passkey.v1",L="deepview.passkey.userId",ae="deepview.passkey.cleanDisable",F="deepview.passkey.v1.write",dt="deepview.triage.v1|",pt="deepview.opfs.v1|",wt="deepview.bundle.v1|",l=null,b=null,I=null,j=0;function qt(){return j>0}var xe=0;function Le(){return xe>0}function C(){try{let e=localStorage.getItem(G);if(!e)return null;let t=JSON.parse(e);return t&&typeof t=="object"&&t.enabled===!0&&typeof t.credentialId=="string"&&t.credentialId.length>0&&typeof t.prfSalt=="string"&&t.prfSalt.length>0&&typeof t.userId=="string"&&t.userId.length>0?t:null}catch{return null}}function je(e){localStorage.setItem(G,JSON.stringify(e))}function yt(){localStorage.removeItem(G)}function gt(){try{let t=localStorage.getItem(L);if(t){let r=Uint8Array.fromBase64(t,{alphabet:"base64url"});if(r.length===16)return r}}catch{}let e=new Uint8Array(16);crypto.getRandomValues(e);try{localStorage.setItem(L,e.toBase64({alphabet:"base64url",omitPadding:!0}))}catch{}return e}function oe(){return typeof location>"u"?"":location.hostname}function x(){return C()!==null}function ht(){return l!==null}function Wt(){return!(!q()||typeof navigator>"u"||!navigator.locks?.request||!oe())}function Re(){return b}function vt(){if(C()!==null)return!1;try{return localStorage.getItem(ae)==="1"?!1:localStorage.getItem(L)!==null}catch{return!1}}function y(){return l}function Ge(){return d(dt+(b??""))}function ie(e){if(typeof e!="string")throw new TypeError("passkey vault: OPFS AAD requires a filename string");return d(pt+(b??"")+"|"+e)}function se(e){if(typeof e!="string")throw new TypeError("passkey vault: bundle AAD requires a slot string");return d(wt+(b??"")+"|"+e)}var Ae=new Set;function te(e){return Ae.add(e),()=>Ae.delete(e)}function R(){for(let e of Ae)try{e()}catch(t){console.warn("passkey vault listener:",t)}}async function jt({signal:e}={}){let t=C();if(!t)return!1;let r;try{r=await Ee({credentialId:t.credentialId,prfSalt:t.prfSalt,rpId:t.rpId??oe(),...e?{signal:e}:{}})}catch(a){if(a&&a.name==="NotAllowedError"||a&&a.name==="AbortError")return!1;throw a&&a.message?.includes("PRF")?W(a):a}if(!r||r.length<32)throw W();let n=await he(r);return r.fill(0),navigator.locks.request(F,async()=>{let a=C();if(!a||a.credentialId!==t.credentialId)throw n.fill(0),new Error("passkey: vault state changed during unlock (another tab wiped or re-enabled it). Reload this page and try again.");return l=await ve(n),n.fill(0),b=a.userId,I=a.credentialId,R(),!0})}function W(e){let t=new Error("Your browser or authenticator doesn't support passkey-derived encryption keys (the WebAuthn PRF extension). Try Chrome 116+, Safari 18+, or Firefox 130+ on a device with a platform authenticator (TouchID / Windows Hello).");return e&&(t.cause=e),t}function Gt({migrate:e,userName:t,rpName:r,signal:n,acknowledgeOrphan:a}){if(!q())throw new Error("passkey: WebAuthn unavailable in this environment");if(vt()&&!a)throw new Error("passkey: a previous vault exists on this device with no metadata. Any data encrypted under the old passkey will be unreadable after a new setup. Call enableEncryption({acknowledgeOrphan: true}) to proceed, or wipeAllVaultData() to start clean first.");let o=oe();return navigator.locks.request(F,async()=>{if(x())throw new Error("passkey: encryption is already enabled");if(await $e()===!1)throw W();let s=gt(),c=await Te({userName:t||"DeepView user",userId:s,rpName:r||"DeepView",rpId:o,...n?{signal:n}:{}}),u=c.prfOutput;if(!u)try{u=await Ee({credentialId:c.credentialId,prfSalt:c.prfSalt,rpId:o,...n?{signal:n}:{}})}catch(P){let ge=s.toBase64({alphabet:"base64url",omitPadding:!0});await ne({credentialId:c.credentialId,rpId:o,userId:ge}).catch(()=>{});try{localStorage.removeItem(L)}catch{}throw P&&P.message?.includes("PRF")?W(P):P}if(!u||u.length<32){let P=s.toBase64({alphabet:"base64url",omitPadding:!0});await ne({credentialId:c.credentialId,rpId:o,userId:P}).catch(()=>{});try{localStorage.removeItem(L)}catch{}throw W()}let h=await he(u);u.fill(0);let M=await ve(h);h.fill(0);let Me=s.toBase64({alphabet:"base64url",omitPadding:!0}),ot={enabled:!0,credentialId:c.credentialId,prfSalt:c.prfSalt,userId:Me,rpId:o,createdAt:Date.now()};l=M,b=Me,I=c.credentialId,je(ot),typeof e=="function"&&await e({seal:(ge,it)=>A(M,ge,it)});try{localStorage.removeItem(ae)}catch{}return R(),!0})}async function Jt({migrate:e}){if(!x())return{disabled:!1,signalAttempted:!1};if(!ht())throw new Error("passkey: must unlock before disabling encryption");j+=1;try{return await navigator.locks.request(F,async()=>{let t=C();if(!t)return{disabled:!1,signalAttempted:!1};let r=l;if(!r)return{disabled:!1,signalAttempted:!1};if(yt(),l=null,I=null,typeof e=="function"){let a=(o,i)=>O(r,o,i);try{await e({open:a})}catch(o){throw je(t),l=r,I=t.credentialId,R(),o}}b=null;try{localStorage.setItem(ae,"1")}catch{}let n=await ne(t).catch(()=>!1);return R(),{disabled:!0,signalAttempted:n}})}finally{j-=1}}async function ne({credentialId:e,rpId:t,userId:r}){if(typeof PublicKeyCredential>"u"||!t)return!1;let n=PublicKeyCredential,a=!1;if(typeof n.signalUnknownCredential=="function"){a=!0;try{await n.signalUnknownCredential({rpId:t,credentialId:e})}catch{}}if(typeof n.signalAllAcceptedCredentials=="function"&&r){a=!0;try{await n.signalAllAcceptedCredentials({rpId:t,userId:r,allAcceptedCredentialIds:[]})}catch{}}return a}async function Et(e,t){try{return await e.removeEntry(t,{recursive:!0}),null}catch(r){return r?.name==="NotFoundError"?null:`${t}: ${r?.message??String(r)}`}}async function mt(e){let t=[];if(typeof navigator>"u"||!navigator.storage?.getDirectory)return t;let r;try{r=await navigator.storage.getDirectory()}catch(n){return t.push(`storage root: ${n?.message??String(n)}`),t}for(let n of e){let a=await Et(r,n);a&&t.push(a)}return t}async function Xt({refuseIfEnabled:e=!1}={}){j+=1,xe+=1;try{return await navigator.locks.request(F,async()=>{if(e&&x())throw new Error("passkey: encryption was just enabled in another tab. Reload this page to unlock instead of wiping.");await We();let t=C();if(t)try{await ne({credentialId:t.credentialId,rpId:t.rpId??oe(),userId:t.userId})}catch{}try{localStorage.removeItem(G)}catch{}try{localStorage.removeItem(L)}catch{}try{localStorage.removeItem(ae)}catch{}for(let n of["deepview.workspaces","deepview.sync.sessions","deepview.sync.userEnabled","deepview.repoUrls","deepview.fileCounts","deepview.workspaceApp","deepview.lastFile","deepview.scan.access","deepview.triage","deepview.triage.pending","deepview.passkey.firstImportPrompted","deepview.viewMode"])try{localStorage.removeItem(n)}catch{}try{let n=[];for(let a=0;a<localStorage.length;a+=1){let o=localStorage.key(a);o&&o.startsWith("deepview.report:")&&n.push(o)}for(let a of n)try{localStorage.removeItem(a)}catch{}}catch{}l=null,b=null,I=null,R();let r=await mt(["deepview-reports","deepview-bundles"]);if(r.length>0)throw new Error(`passkey: wipe partially succeeded \u2014 localStorage cleared but the following OPFS paths could not be removed: ${r.join("; ")}. Open DevTools \u2192 Application \u2192 Storage \u2192 Origin Private File System to inspect, or use the browser's site-data clear tool to finish.`)})}finally{j-=1,xe-=1}}function zt(e){return l?A(l,e,Ge()):Promise.reject(new Error("passkey: vault locked, cannot seal triage"))}function Yt(e){return l?O(l,e,Ge()):Promise.reject(new Error("passkey: vault locked, cannot open triage"))}function ce(e,t){return l?A(l,e,ie(t)):Promise.reject(new Error("passkey: vault locked, cannot seal OPFS file"))}function Je(e,t){return l?O(l,e,ie(t)):Promise.reject(new Error("passkey: vault locked, cannot open OPFS file"))}function le(e,t){return l?A(l,e,se(t)):Promise.reject(new Error("passkey: vault locked, cannot seal bundle"))}function ue(e,t){return l?O(l,e,se(t)):Promise.reject(new Error("passkey: vault locked, cannot open bundle"))}typeof window<"u"&&window.addEventListener("storage",e=>{if(e.key!==G)return;let t=C();(!t&&l||t&&l&&t.credentialId!==I)&&(l=null,b=null,I=null),R()});var ke="__meta__",bt="deepview-reports",Ue="deepview-bundles",k="deepview.report:";function Ze(e,t,r,n){return navigator.locks.request(`deepview-storage/${e}/${t}`,{mode:r},n)}function nr(e,t,r){return Ze(e,t,"shared",r)}function z(e,t,r){return Ze(e,t,"exclusive",()=>navigator.locks.request(F,{mode:"shared"},r))}var Xe=!1;async function Pe(e,{create:t,warnOnce:r=!1}={}){try{return await(await navigator.storage.getDirectory()).getDirectoryHandle(e,{create:t})}catch(n){return r&&!Xe&&(Xe=!0,console.warn("OPFS unavailable, falling back to gzipped localStorage (limited quota).",n)),null}}async function Y(e,t){let r=await e.createWritable();try{await r.write(t),await r.close()}catch(n){try{await r.abort(n)}catch{}throw n}}async function Oe(e,t){if(!E(e))return e;if(!y())throw new Error(`storage: vault locked, cannot decrypt "${t}"`);return await Je(e,t)}function we(e){return e.length===0?!0:e.length>=18&&e[0]===31&&e[1]===139&&e.at(-4)===0&&e.at(-3)===0&&e.at(-2)===0&&e.at(-1)===0}async function Ce(e,t){J(e)===t&&(console.warn(`storage: report "${e}" is an empty/corrupt on-disk entry \u2014 quarantining, will read as missing`),await navigator.locks.request(F,{mode:"exclusive"},async()=>{if(J(e)!==t)return;f(e),g.delete(e);let r=await U();if(r)try{await r.removeEntry(e)}catch{}ye(e),f(e),D(e,"delete")}))}async function De(e,t,r){try{(await t.getFile()).size===0&&await e.removeEntry(r)}catch{}}async function H(e,t,r,n,a=()=>{}){if(x()&&!y())throw a(),new Error(`storage: vault locked, cannot save ${n}`);let o=y(),i=o?await t(e,r):e;if(y()!==o)throw a(),new Error(`storage: vault state changed mid-save for ${n}; retry`);return i}function U(){return Pe(bt,{create:!0,warnOnce:!0})}function fe(e){try{return localStorage.getItem(k+e)}catch{return null}}function ye(e){try{localStorage.removeItem(k+e)}catch{}}function St(){let e=[];for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);r&&r.startsWith(k)&&e.push(r.slice(k.length))}return e}var g=new Map,B=new Map,Ie=new Map;function f(e){Ie.set(e,(Ie.get(e)??0)+1)}function J(e){return Ie.get(e)??0}var Fe=new Set;function ar(e){return Fe.add(e),()=>Fe.delete(e)}function D(e,t){for(let r of Fe)try{r(e,t)}catch(n){console.warn("storage file-change listener:",n)}}async function xt(){let e=new Set(St()),t=await U();if(t)for await(let[r]of t.entries())e.add(r);return[...e].toSorted()}async function ze(e,t){if(typeof e!="string"||e.includes("\0"))throw new Error("Invalid report name: contains NUL byte or is not a string");if(t==="")throw new Error(`Refusing to save empty report "${e}"`);return f(e),z("report",e,async()=>{let r=await U();if(r){let o=await V(d(t));o=await H(o,ce,e,`"${e}"`,()=>f(e));let i=await r.getFileHandle(e,{create:!0}),s=await i.createWritable();try{await s.write(o),await s.close()}catch(c){g.delete(e),f(e);try{await s.abort(c)}catch{}throw await De(r,i,e),c}g.set(e,t),f(e),ye(e),D(e,"save");return}let n=d(t);n=await V(n),n=await H(n,ce,e,`"${e}"`,()=>f(e));let a=n.toBase64();try{localStorage.setItem(k+e,a),g.set(e,t),f(e),D(e,"save")}catch(o){throw f(e),new Error(`localStorage write failed for ${e}: ${o.message}`,{cause:o})}})}async function Ye(e,t){let r=fe(e);if(r===null)return null;let n=Uint8Array.fromBase64(r);if(n=await Oe(n,e),we(n))throw await Ce(e,t),new Error(`File not found: ${e}`);return m(await N(n))}async function or(e){if(g.has(e))return g.get(e);if(B.has(e))return B.get(e);let t=J(e),r=(async()=>{let n=await U();if(n){let o;try{o=await n.getFileHandle(e)}catch(u){if(u instanceof DOMException&&u.name==="NotFoundError"){let h=await Ye(e,t);if(h!==null)return ze(e,h).catch(M=>{console.warn(`storage: stranded-localStorage migration of "${e}" failed:`,M)}),h}throw u}let i=await o.getFile(),s=new Uint8Array(await i.arrayBuffer());if(s=await Oe(s,e),we(s))throw await Ce(e,t),new Error(`File not found: ${e}`);if(s.length>=2&&s[0]===31&&s[1]===139){let u=await N(s);return m(u)}let c=m(s);return ze(e,c).catch(u=>{console.warn(`storage: legacy-uncompressed migration of "${e}" failed:`,u)}),c}let a=await Ye(e,t);if(a===null)throw new Error(`File not found: ${e}`);return a})();B.set(e,r);try{let n=await r;return J(e)===t&&g.set(e,n),n}finally{B.delete(e)}}async function At(e){let t=J(e),r=await U(),n;if(r){let a=null;try{a=await r.getFileHandle(e)}catch(o){if(!(o instanceof DOMException)||o.name!=="NotFoundError")throw o;let i=fe(e);if(i===null)throw o;n=Uint8Array.fromBase64(i)}if(a){let o=await a.getFile();n=new Uint8Array(await o.arrayBuffer())}}else{let a=fe(e);if(a===null)throw new Error(`File not found: ${e}`);n=Uint8Array.fromBase64(a)}if(n=await Oe(n,e),we(n))throw await Ce(e,t),new Error(`File not found: ${e}`);return n}async function ir(e){let t=await At(e),r=t[0]===31&&t[1]===139?await N(t):t;return m(r)}async function sr(e,t){if(typeof e!="string"||e.includes("\0"))throw new Error("Invalid report name: contains NUL byte or is not a string");if(we(t))throw new Error(`Refusing to save empty report bytes for "${e}"`);return f(e),g.delete(e),z("report",e,async()=>{let r=await H(t,ce,e,`"${e}"`,()=>f(e)),n=await U();if(n){let a=await n.getFileHandle(e,{create:!0}),o=await a.createWritable();try{await o.write(r),await o.close()}catch(i){f(e);try{await o.abort(i)}catch{}throw await De(n,a,e),i}f(e),ye(e),D(e,"save");return}try{localStorage.setItem(k+e,r.toBase64()),f(e),D(e,"save")}catch(a){throw f(e),new Error(`localStorage write failed for ${e}: ${a.message}`,{cause:a})}})}async function cr(e){return f(e),g.delete(e),B.delete(e),z("report",e,async()=>{let t=await U();if(t){try{await t.removeEntry(e)}catch(r){if(!(r instanceof DOMException)||r.name!=="NotFoundError")throw f(e),r}ye(e),f(e),D(e,"delete");return}localStorage.removeItem(k+e),f(e),D(e,"delete")})}var X="_meta.json",de=".index-v1",Be=new Set;function lr(e){return Be.add(e),()=>Be.delete(e)}function pe(e,t){for(let r of Be)try{r(e,t)}catch(n){console.warn("storage bundle-change listener:",n)}}function _(){return Pe(Ue,{create:!0})}function K(e){return e.replaceAll("/","_")}async function Ke(e){let t;try{let a=await(await e.getFileHandle(X)).getFile();t=new Uint8Array(await a.arrayBuffer())}catch(n){return n instanceof DOMException&&n.name==="NotFoundError"?[]:(console.warn("readBundleMeta: failed to read _meta.json:",n),[])}let r=t;if(E(t)){if(!y())return console.warn("readBundleMeta: vault locked, returning empty bundle list"),[];try{r=await ue(t,ke)}catch(a){return console.warn("readBundleMeta: decrypt failed (tampering, key mismatch, or vault identity drift):",a),[]}}try{let n=JSON.parse(m(r));return Array.isArray(n)?n:[]}catch(n){return console.warn("readBundleMeta: JSON.parse failed:",n),[]}}async function Qe(e,t){let r=d(JSON.stringify(t));r=await H(r,le,ke,"bundle metadata");try{await e.removeEntry(X)}catch{}let n=await e.getFileHandle(X,{create:!0});await Y(n,r)}var et=`${Ue}/${X}`;function _e(e){return navigator.locks.request(et,e)}async function ur(){let e=await _();return e?[...await navigator.locks.request(et,{mode:"shared"},()=>Ke(e))].toSorted((r,n)=>r.name.localeCompare(n.name)):[]}function fr(){return tt(()=>!0)}function dr(){return tt((e,t)=>t.kind==="file"&&/^sha512-[A-Za-z0-9+_]{86}==$/u.test(e))}async function tt(e){if(typeof navigator>"u"||!navigator.storage?.getDirectory)return!1;let t=await Pe(Ue,{create:!1});if(!t)return!1;try{for await(let[r,n]of t.entries())if(e(r,n))return!0}catch{}return!1}async function pr(e,t){let r=await _();if(!r)throw new Error(`Cannot save bundle ${e}: OPFS unavailable`);let n=t instanceof Uint8Array?t:d(t),a=await Ne(n),o=K(a),i=e.toLowerCase().endsWith(".map")?await V(n):n;return z("bundle",a,async()=>{i=await H(i,le,a,`bundle "${e}"`);try{await r.removeEntry(o)}catch{}let s=await r.getFileHandle(o,{create:!0});await Y(s,i);try{await _e(async()=>{let c=await Ke(r),u=c.findIndex(h=>h.integrity===a);u>=0?c[u]={integrity:a,name:e}:c.push({integrity:a,name:e}),await Qe(r,c)})}catch(c){try{await r.removeEntry(o),pe(a,"delete")}catch{}throw c}return pe(a,"save"),{integrity:a,name:e}})}async function wr(e){let t=await _();if(t)return z("bundle",e,async()=>{try{await t.removeEntry(K(e))}catch(r){if(!(r instanceof DOMException)||r.name!=="NotFoundError")throw r}pe(e,"delete");try{await _e(async()=>{try{await t.removeEntry(K(e)+de)}catch(a){if(!(a instanceof DOMException)||a.name!=="NotFoundError")throw a}let r=await Ke(t),n=r.filter(a=>a.integrity!==e);n.length!==r.length&&await Qe(t,n)})}finally{pe(e,"delete")}})}async function yr(e){let t=await _();if(!t)throw new Error("OPFS unavailable");let n=await(await t.getFileHandle(K(e))).getFile(),a=new Uint8Array(await n.arrayBuffer());if(E(a)){if(!y())throw new Error(`storage: vault locked, cannot read bundle "${e}"`);a=await ue(a,e)}return a.length>=2&&a[0]===31&&a[1]===139?await N(a):a}async function gr(e){let t=await _();if(!t||x()&&!y())return null;try{let r=await t.getFileHandle(K(e)+de),n=new Uint8Array(await(await r.getFile()).arrayBuffer());return E(n)&&(n=await ue(n,e+de)),JSON.parse(m(await N(n)))}catch{return null}}async function hr(e,t){let r=await V(d(JSON.stringify(t)));return navigator.locks.request(F,{mode:"shared"},()=>_e(async()=>{let n=await _();if(!n)return;await n.getFileHandle(K(e));let a=e+de,o=await H(r,le,a,"bundle index"),i=await n.getFileHandle(K(a),{create:!0});await Y(i,o)}))}async function It(e,t){let r=await U();if(r){let i=null;try{i=await r.getFileHandle(e)}catch(s){if(!(s instanceof DOMException)||s.name!=="NotFoundError")throw s}if(i){let s=await i.getFile(),c=new Uint8Array(await s.arrayBuffer()),u=await t(c);if(u===null)return;g.delete(e),B.delete(e),f(e);let h=await r.getFileHandle(e,{create:!0});try{await Y(h,u)}catch(M){throw await De(r,h,e),M}f(e);return}}let n=fe(e);if(n===null)return;let a=Uint8Array.fromBase64(n),o=await t(a);o!==null&&(g.delete(e),B.delete(e),f(e),localStorage.setItem(k+e,o.toBase64()),f(e))}function rt(e,t){return e.seal?r=>E(r)?null:e.seal(r,t):r=>E(r)?e.open(r,t):null}async function nt(e){let t=await xt();for(let r of t)try{await It(r,rt(e,ie(r)))}catch(n){if(n instanceof DOMException&&n.name==="NotFoundError")continue;throw n}}var vr=({seal:e})=>nt({seal:e}),Er=({open:e})=>nt({open:e});async function Ft(){let e=await _();if(!e)return{dir:null,keys:[]};let t=[];for await(let[r]of e.entries())t.push(r);return{dir:e,keys:t}}function Bt(e){return e===X?ke:e.startsWith("sha512-")?e.replaceAll("_","/"):null}async function kt(e,t,r){let a=await(await e.getFileHandle(t)).getFile(),o=new Uint8Array(await a.arrayBuffer()),i=await r(o);if(i===null)return;let s=await e.getFileHandle(t,{create:!0});await Y(s,i)}async function at(e){let{dir:t,keys:r}=await Ft();if(t)for(let n of r){let a=Bt(n);if(a!==null)try{await kt(t,n,rt(e,se(a)))}catch(o){if(o instanceof DOMException&&o.name==="NotFoundError")continue;throw o}}}var mr=({seal:e})=>at({seal:e}),br=({open:e})=>at({open:e});te(()=>{g.clear(),B.clear()});export{E as a,F as b,qt as c,x as d,ht as e,Wt as f,vt as g,y as h,Ge as i,te as j,jt as k,Gt as l,Jt as m,Xt as n,zt as o,Yt as p,Kt as q,me as r,He as s,_t as t,Se as u,Mt as v,Nt as w,$t as x,Tt as y,nr as z,ar as A,xt as B,ze as C,or as D,At as E,ir as F,sr as G,cr as H,lr as I,ur as J,fr as K,dr as L,pr as M,wr as N,yr as O,gr as P,hr as Q,vr as R,Er as S,mr as T,br as U};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function f(e){return e==="inprogress"||e==="fixed"||e==="invalid"||e==="deleted"||e==="ignored"?e:void 0}function d(e){if(e)return f(e.triage)??(e.deleted?"deleted":void 0)}function l(e){let n=d(e);return n===void 0||n==="ignored"}function c(e){return e?!e.color&&!d(e)&&!e.comment&&!e.fix&&!(e.ignoredReports&&e.ignoredReports.length>0)&&e.flagged===void 0:!0}function R(e,n,r){let t=e.get(n)?.ignoredReports;return Array.isArray(t)&&t.includes(r)}function y(e,n){return Array.isArray(e?.scopedIgnoredReports)&&e.scopedIgnoredReports.includes(n)}function u(e){if(!e||typeof e!="object")return;let n=e,r={};typeof n.color=="string"&&n.color&&(r.color=n.color);let t=f(n.triage)??(n.deleted?"deleted":void 0);if(t&&(r.triage=t),typeof n.comment=="string"&&n.comment&&(r.comment=n.comment),typeof n.fix=="string"&&n.fix&&(r.fix=n.fix),typeof n.flagged=="boolean"&&(r.flagged=n.flagged),Array.isArray(n.ignoredReports)){let o=n.ignoredReports.filter(i=>typeof i=="string"&&i.length>0);o.length>0&&(r.ignoredReports=o)}if(Array.isArray(n.scopedIgnoredReports)&&r.ignoredReports){let o=[...new Set(n.scopedIgnoredReports.filter(i=>typeof i=="string"&&r.ignoredReports.includes(i)))];o.length>0&&(r.scopedIgnoredReports=o)}return c(r)?void 0:r}function g(e,n){let r=e??[],t=n??[];if(r.length!==t.length)return!1;if(r.length===0)return!0;let o=new Set(r);for(let i of t)if(!o.has(i))return!1;return!0}function a(e,n){let r=e??{},t=n??{};return(r.color??"")===(t.color??"")&&(d(r)??"")===(d(t)??"")&&(r.comment??"")===(t.comment??"")&&(r.fix??"")===(t.fix??"")&&r.flagged===t.flagged&&g(r.ignoredReports,t.ignoredReports)&&g(r.scopedIgnoredReports,t.scopedIgnoredReports)}function p(e,n,r){let t=e.get(n),o=u({...t,...r});return o===void 0?e.delete(n):a(t,o)?!1:(e.set(n,o),!0)}function T(e,n,r){let t=u(r),o=e.get(n);return t===void 0?e.delete(n):a(o,t)?!1:(e.set(n,t),!0)}function x(e,n,r,t,o=!1){let i=new Set(e.get(n)?.ignoredReports??[]);t?i.add(r):i.delete(r);let s=new Set(e.get(n)?.scopedIgnoredReports??[]);return t&&o&&s.add(r),p(e,n,{ignoredReports:i.size>0?[...i]:void 0,scopedIgnoredReports:[...s]})}export{d as a,l as b,R as c,y as d,u as e,p as f,T as g,x as h};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as d,B as e,C as f,D as g,E as h,F as i,G as j,H as k,I as l,J as m,K as n,L as o,M as p,N as q,O as r,P as s,Q as t,R as u,S as v,T as w,U as x,d as b,z as c}from"./chunk-VIHGO77Y.js";import"./chunk-GJ4IUCNS.js";import{b as a}from"./chunk-PNHBZGDD.js";import"./chunk-TUII34K2.js";import"./chunk-OOJM4CTU.js";export{q as deleteBundle,k as deleteFile,a as gunzipBytes,n as hasAnyBundles,o as hasStoredBundleBytes,b as isEncryptionEnabled,m as listBundles,e as listFiles,x as migrateOpfsBundlesDecrypt,w as migrateOpfsBundlesEncrypt,v as migrateOpfsFilesDecrypt,u as migrateOpfsFilesEncrypt,l as onBundleMutated,d as onFileMutated,r as readBundle,s as readBundleIndex,g as readFile,h as readFileBytes,i as readFileFresh,p as saveBundle,t as saveBundleIndex,f as saveFile,j as saveFileBytes,c as withStoredItem};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as E}from"./chunk-KEX2ATEW.js";import{gb as y,h as a,hb as o,ib as x,jb as m,kb as C,lb as $,mb as w,nb as k,ob as S}from"./chunk-QSLWGJBQ.js";import{a as v}from"./chunk-2KBF5TZ7.js";import{a as f,b as _}from"./chunk-K3X5EJBQ.js";import{g as c,h as b}from"./chunk-CVVJAXVY.js";import"./chunk-VIHGO77Y.js";import"./chunk-RFZQQXSG.js";import"./chunk-F4OMDNEY.js";import"./chunk-XYDGU6BM.js";import"./chunk-UYAXVRVL.js";import"./chunk-NRPC74AM.js";import"./chunk-XRWAV3DX.js";import"./chunk-W4J3MGLB.js";import"./chunk-GJ4IUCNS.js";import"./chunk-PNHBZGDD.js";import"./chunk-TINZZKP5.js";import"./chunk-R5O6FAW4.js";import"./chunk-CMQA4DM6.js";import"./chunk-ZPD5R5RP.js";import"./chunk-YVZH5SHP.js";import"./chunk-4XCDFGDP.js";import"./chunk-3BZ7JERB.js";import"./chunk-TZ5KB2Y5.js";import"./chunk-XYFXXB2G.js";import{a as l}from"./chunk-DIJJNTRH.js";import"./chunk-HIV7SVI7.js";import"./chunk-GNXOKIGP.js";import"./chunk-C4Z6ZBXV.js";import{a as d,c as i,g as s}from"./chunk-2XUEZHIP.js";import"./chunk-TUII34K2.js";import{s as g,t as p}from"./chunk-V5O7M2YT.js";import"./chunk-OOJM4CTU.js";var T=`dialog{width:min(94vw,800px);max-width:800px;max-height:calc(100dvh - 4rem);margin-block:2rem;padding:0}dialog[open]{display:flex;flex-direction:column}.discussion-header{display:flex;align-items:start;gap:1rem;padding:1rem 1.25rem;border-bottom:1px solid var(--border)}.discussion-heading{flex:1;min-width:0}header h3{display:flex;align-items:center;gap:.5rem;margin:0;line-height:1.5}.comment-count{padding:.05rem .4rem;border-radius:1rem;background:rgb(from var(--muted) r g b / .12);color:var(--muted);font-size:.72rem;font-weight:400}.discussion-finding{margin-top:.4rem;font-size:.85rem;overflow-wrap:anywhere}.loc{margin-top:.25rem;color:var(--muted)}.header-actions{display:flex;flex:none;align-items:center;gap:.7rem}.header-actions button{display:inline-flex;flex:none;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:0;border:0;background:transparent;color:var(--muted);line-height:0;& svg{display:block;width:1rem;height:1rem}&:hover:not(:disabled){color:var(--text)}&:disabled{opacity:.5}}.comment-action{display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:.2rem;border:1px solid transparent;border-radius:var(--ui-radius, 4px);background:transparent;color:var(--muted);cursor:default;& svg{width:.9rem;height:.9rem}&:hover:not(:disabled),&[aria-pressed=true]{border-color:var(--border);background:rgb(from var(--muted) r g b / .08);color:var(--text)}&.danger:hover:not(:disabled),&[aria-expanded=true]{color:var(--critical, #f87171)}&:disabled{opacity:.5}}button:focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:var(--ui-radius, 3px)}.discussion-log{min-height:0;max-height:50dvh;overflow-y:auto;overscroll-behavior:contain;padding:.5rem;scrollbar-gutter:stable}.comments{display:flex;flex-direction:column;gap:.15rem;list-style:none}.comment{padding:.6rem .75rem;border-radius:var(--ui-radius, 6px);font-size:.84rem}.comment:hover{background:rgb(from var(--muted) r g b / .035)}.comment.editing{background:rgb(from var(--accent) r g b / .08);box-shadow:inset 0 0 0 1px rgb(from var(--accent) r g b / .2)}.delete-confirm{display:flex;align-items:center;justify-content:end;flex-wrap:wrap;gap:.5rem;margin-top:.6rem;color:var(--muted);font-size:.75rem;& button{padding:.25rem .55rem;border:1px solid var(--border);border-radius:var(--ui-radius, 4px);background:transparent;color:var(--text);font:inherit;&:hover:not(:disabled){background:rgb(from var(--muted) r g b / .08)}&.danger{color:var(--critical, #f87171)}&:disabled{opacity:.5}}}.empty-discussion{padding:2.5rem 0;color:var(--muted);text-align:center;font-size:.85rem}.composer{padding:1rem 1.25rem;border-top:1px solid var(--border)}.composer-label{display:flex;align-items:center;gap:.45rem;margin-bottom:.6rem;font-size:.78rem}.composer-label strong{font-weight:600}textarea{min-height:4.5rem;max-height:25dvh;font-size:.84rem}.nwd-actions{border:0;padding-top:0;margin-top:.65rem}.shortcut{color:var(--muted);font-size:.7rem}.error{padding:.65rem 1.25rem;color:var(--danger, #c44);font-size:.8rem}.read-only{padding:1rem 1.25rem;border-top:1px solid var(--border);color:var(--muted);font-size:.8rem}@media(width<=480px){.discussion-header,.composer{padding:.8rem}.discussion-log{padding-inline:.3rem}.comment{padding-inline:.5rem}.shortcut{max-width:8rem}}
|
|
2
|
+
`;var h=class extends c{static styles=[...c.styles,d(E),d(v),d(T)];static properties={finding:{attribute:!1},changed:{attribute:!1},_comments:{state:!0},_value:{state:!0},_editing:{state:!0},_busy:{state:!0},_error:{state:!0},_deleting:{state:!0}};constructor(){super(),this.finding=null,this.changed=null,this._comments=[],this._value="",this._editing=null,this._busy=!1,this._error="",this._deleting=null}connectedCallback(){super.connectedCallback(),document.addEventListener("managed-comments-reset",this._close)}disconnectedCallback(){this._unsubscribeComments?.(),this._unsubscribeComments=null,document.removeEventListener("managed-comments-reset",this._close),super.disconnectedCallback()}beforeOpen(){this._current=C(this.finding?._managedReportId),this._comments=o(this.finding),this._unsubscribeComments?.(),this._unsubscribeComments=y(this.finding.id,this._commentsChanged),this._refresh({scroll:!0})}_commentsChanged=()=>{if(!this.isConnected)return;if(!this._current()){this._close();return}let e=this.renderRoot.querySelector(".discussion-log"),t=e&&e.scrollHeight-e.scrollTop-e.clientHeight<32;this._comments=o(this.finding),t&&this._scrollToLatest()};_close=()=>this._finish(null);_scrollToLatest=async()=>{await this.updateComplete;let e=this.renderRoot.querySelector(".discussion-log");e&&(e.scrollTop=e.scrollHeight)};_refresh=async({scroll:e=!1}={})=>{if(!this._current()){this._close();return}let t=this.renderRoot.querySelector(".discussion-log"),r=t&&t.scrollHeight-t.scrollTop-t.clientHeight<32;this._busy=!0,this._error="";let n=await $(this.finding._managedReportId);if(this.isConnected){if(!this._current()){this._close();return}if(this._busy=!1,!n){this._error="Could not load comments. Please retry.";return}this._comments=o(this.finding),this.changed?.(),(e||r)&&this._scrollToLatest()}};_edit(e){this._deleting=null,this._editing=e,this._value=e.body,this._error="",this.updateComplete.then(()=>this.renderRoot.querySelector("textarea")?.focus())}_cancelEdit=()=>{this._editing=null,this._value="",this._error=""};_delete=async e=>{if(this._busy||!this._current())return;this._busy=!0,this._error="";let t=await k(this.finding,e);if(!this.isConnected){t===204&&this._current()&&this.changed?.();return}if(!this._current()){this._close();return}if(this._busy=!1,this._deleting=null,t===409){await this._refresh(),this.isConnected&&(this._error="This comment changed elsewhere. Review the latest version before deleting it.");return}if(t!==204){this._error=t===403||t===404?"This comment is unavailable or you no longer have permission to delete it.":"Could not delete the comment. Please retry.";return}this._comments=o(this.finding),this._editing?.id===e.id&&this._cancelEdit(),this.changed?.()};_save=async()=>{let e=this._value.trim();if(this._busy||!e||e.length>1e4||!this._current())return;this._busy=!0,this._error="";let t=await w(this.finding,e,this._editing);if(!this.isConnected)return;if(!this._current()){this._close();return}if(this._busy=!1,t.status===409){if(await this._refresh(),!this.isConnected)return;this._editing=this._comments.find(n=>n.id===this._editing?.id)??this._editing,this._error="This comment changed elsewhere. Your draft is kept. Review the latest version above before saving again.";return}if(!t.comment){this._error=t.status===403||t.status===404?"You no longer have permission to save this comment.":"Could not save the comment. Your draft is kept; please retry.";return}let r=this._editing!=null;this._comments=o(this.finding),this._cancelEdit(),this.changed?.(),r||await this._scrollToLatest(),await this.updateComplete,this.renderRoot.querySelector("textarea")?.focus()};_keydown=e=>{e.key==="Enter"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this._save())};_commentActions(e,t){let r=t&&e.authorId===a.managedSession?.id,n=m(e);return!r&&!n?s:i`${r?i`<button type="button" class="comment-action" aria-label="Edit comment" aria-pressed="${this._editing?.id===e.id}" ?disabled="${this._busy}" @click="${()=>this._edit(e)}">${l(g)}</button>`:s} ${n?i`<button type="button" class="comment-action danger" aria-label="Delete comment" aria-expanded="${this._deleting===e.id}" ?disabled="${this._busy}" @click="${()=>{this._deleting=this._deleting===e.id?null:e.id}}">${l(p)}</button>`:s}`}_deleteConfirmation(e){return this._deleting!==e.id||!m(e)?s:i`<div class="delete-confirm" role="group" aria-label="Confirm comment deletion"><span>Delete this comment?</span> <button type="button" ?disabled="${this._busy}" @click="${()=>{this._deleting=null}}">Cancel</button> <button type="button" class="danger" ?disabled="${this._busy}" @click="${()=>this._delete(e)}">Delete</button></div>`}render(){let e=x();return i`<dialog aria-labelledby="comments-title" @close="${this._onClose}"><header class="discussion-header"><div class="discussion-heading"><h3 id="comments-title">Discussion <span class="comment-count">${this._comments.length}</span></h3>${this.finding?.title?i`<p class="discussion-finding">${this.finding.title}</p>`:s}<p class="loc">${this.finding?.file??""}</p></div><div class="header-actions"><button type="button" class="refresh" aria-label="Refresh discussion" ?disabled="${this._busy}" @click="${()=>this._refresh()}"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8M21 3v5h-5"/></svg></button> <button type="button" class="close" aria-label="Close discussion" @click="${this._close}"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="m6 6 12 12M6 18 18 6"/></svg></button></div></header><section class="discussion-log" role="log" aria-label="Discussion" aria-relevant="additions text" aria-busy="${this._busy}"><ol class="comments">${this._comments.map(t=>i`<li class="${`comment${this._editing?.id===t.id?" editing":""}`}">${_(t,S(t.body),this._commentActions(t,e))} ${this._deleteConfirmation(t)}</li>`)}</ol>${this._comments.length===0?i`<p class="empty-discussion">${this._busy?"Loading discussion\u2026":e?"No comments yet. Start the discussion below.":"No comments yet."}</p>`:s}</section>${this._error?i`<p class="error" role="alert">${this._error}</p>`:s} ${e?i`<form class="composer" @submit="${t=>{t.preventDefault(),this._save()}}"><label class="composer-label" for="comment-body">${f(a.managedSession.id,a.managedSession.login)} ${this._editing?"Edit your comment":i`Reply as <strong>${a.managedSession.login}</strong>`}</label> <textarea id="comment-body" rows="3" maxlength="${1e4}" .value="${this._value}" placeholder="Write a comment…" aria-describedby="comment-shortcut" ?disabled="${this._busy}" @input="${t=>{this._value=t.target.value}}" @keydown="${this._keydown}"></textarea><footer class="nwd-actions"><span id="comment-shortcut" class="shortcut">Ctrl / ⌘ + Enter to send</span><span class="nwd-spacer"></span> ${this._editing?i`<button type="button" class="quiet" ?disabled="${this._busy}" @click="${this._cancelEdit}">Cancel edit</button>`:s} <button type="submit" class="primary" ?disabled="${this._busy||!this._value.trim()}">${this._editing?"Save changes":"Comment"}</button></footer></form>`:i`<p class="read-only">You have read-only access to this discussion.</p>`}</dialog>`}};customElements.define("managed-comments-dialog",h);function G(u,e){return b("managed-comments-dialog",{finding:u,changed:e})}export{G as openManagedCommentsDialog};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{a}from"./chunk-TUII34K2.js";var v="deepview-objstore.v1.put",y="deepview-objstore.v1.delete",h="deepview-objstore.v1.fetch",I="deepview-objstore.v1.fetch-rest",w="deepview-objstore.v1.put-rest",j="deepview-objstore.v1.delete-rest";function l(e){return e==null?"":String(e)}function p(e){return e??""}function x(e,n){return a([v,e.workspaceTag,e.resourceTag,l(e.prevVersion),p(e.prevIncarnation),e.contentHash,String(e.expectedLength),n].join(`
|
|
2
|
+
`))}function O(e,n){return a([y,e.workspaceTag,e.resourceTag,l(e.prevVersion),p(e.prevIncarnation),n].join(`
|
|
3
|
+
`))}function P(e,n,r){return a([h,e,n,r].join(`
|
|
4
|
+
`))}async function i(e,n){return new Uint8Array(await crypto.subtle.sign({name:"Ed25519"},e,n)).toBase64({alphabet:"base64url",omitPadding:!0})}function B(e,n,r){return i(e,x(n,r))}function D(e,n,r){return i(e,O(n,r))}function R(e,n,r,o){return i(e,P(n,r,o))}function A(e,n,r){return a([I,e,n,String(r)].join(`
|
|
5
|
+
`))}function _(e,n,r,o){return i(e,A(n,r,o))}function N(e,n){return a([w,e.workspaceTag,e.resourceTag,l(e.prevVersion),p(e.prevIncarnation),e.contentHash,String(e.expectedLength),String(n)].join(`
|
|
6
|
+
`))}function U(e,n,r){return i(e,N(n,r))}function T(e,n){return a([j,e.workspaceTag,e.resourceTag,l(e.prevVersion),p(e.prevIncarnation),String(n)].join(`
|
|
7
|
+
`))}function L(e,n,r){return i(e,T(n,r))}async function H(e){let n=await crypto.subtle.digest("SHA-256",e);return new Uint8Array(n).toBase64({alphabet:"base64url",omitPadding:!0})}var d="/api/config";var J="http://127.0.0.1:3123/";function m(e){if(typeof e!="string"||!e.trim())return null;try{let n=new URL(e);return!["http:","https:"].includes(n.protocol)||n.username||n.password||n.search||n.hash?null:(n.pathname=n.pathname.replace(/\/+$/u,"")+"/",n.href)}catch{return null}}var b="deepview.sync.serverInfo",g="deepview.sync.standaloneProbe";function $(){try{return localStorage.getItem(g)==="1"}catch{return!1}}function X(){try{localStorage.setItem(g,"1")}catch{}}function f(e){return e==="managed+e2e"||e==="e2e+managed"}function q(e,n){return(e==="managed"||f(e))&&/^\/(?:team|manage|npm)(?:\/|$)/u.test(n)}function Q(e,n=null){return n&&(f(e)||e===n)?n:e==="managed"||e==="managed+e2e"?"managed":"e2e"}function W(e,n){return e&&f(e.mode)&&n.mode==="e2e"?{...e,githubNewIssueLabels:n.githubNewIssueLabels??"",...n.deepviewScanServer?{deepviewScanServer:n.deepviewScanServer}:{}}:n}function S(e){if(e==null||typeof e!="object")return null;let n=e.mode;if(n!=="e2e"&&n!=="managed"&&n!=="managed+e2e"&&n!=="e2e+managed")return null;let r=null,o=e.managed;if(o!=null&&typeof o=="object"){let u=o.loginPath,c=o.cookieName;typeof u=="string"&&typeof c=="string"&&(r={loginPath:u,cookieName:c},o.allowShare===!0&&(r.allowShare=!0))}let t=n==="managed"?null:m(e.deepviewScanServer),s=e.githubNewIssueLabels;return{mode:n,managed:r,...t?{deepviewScanServer:t}:{},...typeof s=="string"&&s.length<=4096?{githubNewIssueLabels:s}:{}}}async function Z(){try{let e=await fetch(d,{credentials:"same-origin",cache:"no-store",headers:{accept:"application/json"}});return e.status===404?"standalone":e.ok?S(await e.json()):null}catch{return null}}async function ee(e,n=3e3){let r;try{return await Promise.race([e,new Promise(o=>{r=setTimeout(()=>o(null),n)})])}catch{return null}finally{clearTimeout(r)}}function ne(){try{let e=localStorage.getItem(b);if(e==null)return null;let n=S(JSON.parse(e));return n?{mode:n.mode,managed:n.managed}:null}catch{return null}}function re(e){try{localStorage.setItem(b,JSON.stringify({mode:e.mode,managed:e.managed})),localStorage.removeItem(g)}catch{}}var E="deepview.objstore-presence.";function M(e){return E+e}function C(e){try{let n=localStorage.getItem(M(e));if(!n)return null;let r=JSON.parse(n);return!r||typeof r!="object"?null:{names:r.names&&typeof r.names=="object"?r.names:{},bundles:r.bundles&&typeof r.bundles=="object"?r.bundles:{},bundleNames:r.bundleNames&&typeof r.bundleNames=="object"?r.bundleNames:{},baselines:k(r.baselines,r.localVersions)}}catch{return null}}function k(e,n){let r={};if(n&&typeof n=="object")for(let[o,t]of Object.entries(n))Number.isSafeInteger(t)&&t>=0&&(r[o]={version:t,incarnation:null,synced:!0,hash:null});if(e&&typeof e=="object")for(let[o,t]of Object.entries(e))!t||typeof t!="object"||!Number.isSafeInteger(t.version)||t.version<0||t.incarnation!=null&&typeof t.incarnation!="string"||(r[o]={version:t.version,incarnation:t.incarnation??null,synced:t.synced===!0,hash:typeof t.hash=="string"?t.hash:null});return r}function oe(e,n,r,o){let t=C(e),s=Object.entries((n==="bundle"?t?.bundles:t?.names)??{}).find(([,c])=>c===r)?.[0],u=t?.baselines?.[s];return{synced:s!==void 0&&(n==="bundle"||u?.synced===!0&&u.hash===o),cached:!0}}export{B as a,D as b,R as c,_ as d,U as e,L as f,H as g,J as h,m as i,$ as j,X as k,f as l,q as m,Q as n,W as o,S as p,Z as q,ee as r,ne as s,re as t,M as u,C as v,oe as w};
|