@preventive/triage 1.0.0-alpha.44 → 1.0.0-alpha.46
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/client/linked-findings.js +3 -0
- package/common/bundle-metadata.d.ts +1 -0
- package/common/bundle-metadata.js +1 -1
- package/common/bundle-sources.js +25 -2
- package/common/default-scan-models.ts +1 -1
- package/common/dependency-reviews.d.ts +0 -5
- package/common/dependency-reviews.js +0 -17
- package/common/line-diff.js +5 -4
- package/common/managed/agent-tasks.ts +292 -0
- package/common/managed/github-agents.ts +92 -0
- package/common/managed/github-logins.ts +49 -0
- package/common/managed/roles.ts +7 -0
- package/common/managed/routes.js +88 -7
- package/common/managed/team-app.d.ts +5 -2
- package/common/managed/team-app.js +2 -2
- package/common/server-info.ts +3 -0
- package/common/workspace-app.js +6 -3
- package/out/brotli-fallback.js +3 -3
- package/out/chunk-2XUEZHIP.js +18 -18
- package/out/chunk-2ZDZWLFY.js +1 -0
- package/out/chunk-3PS4KWD2.js +10 -0
- package/out/chunk-4HI2MSAV.js +17 -0
- package/out/chunk-4UFAMJAX.js +1 -0
- package/out/chunk-7C7DWL7I.js +1 -0
- package/out/chunk-7XRR4OFU.js +1 -0
- package/out/chunk-BC2UCLFJ.js +1 -0
- package/out/chunk-BOIXMUU5.js +3 -0
- package/out/chunk-C4Z6ZBXV.js +6 -6
- package/out/chunk-CC4OM6TZ.js +3 -0
- package/out/chunk-G24A42V6.js +2 -0
- package/out/chunk-GDPCLSOS.js +2 -0
- package/out/chunk-GO7FT4OD.js +1 -0
- package/out/chunk-I2MDGSQX.js +3 -0
- package/out/chunk-IYPY47MC.js +1 -0
- package/out/chunk-IZ7POWI3.js +18 -0
- package/out/chunk-JCIIBLKR.js +1 -1
- package/out/chunk-JKGQ3O7O.js +6 -0
- package/out/chunk-LE5ZWLG4.js +235 -0
- package/out/chunk-MSION3G4.js +36 -0
- package/out/chunk-NRPC74AM.js +1 -1
- package/out/chunk-OKRLLE5I.js +17 -0
- package/out/chunk-OOJM4CTU.js +1 -1
- package/out/chunk-PNHBZGDD.js +1 -1
- package/out/chunk-PXK7EU4V.js +1 -0
- package/out/chunk-QB4CBOX2.js +1 -0
- package/out/chunk-R3NZFXVR.js +1 -0
- package/out/chunk-R5O6FAW4.js +1 -1
- package/out/chunk-S6GIXWQW.js +52 -0
- package/out/chunk-SXV2T5C4.js +80 -0
- package/out/chunk-TUII34K2.js +1 -1
- package/out/chunk-V3KWNNMY.js +1 -0
- package/out/chunk-VFWMQ3LG.js +2 -0
- package/out/chunk-VH4XMZIW.js +2 -0
- package/out/chunk-WFYLMF6Z.js +10 -0
- package/out/chunk-WQ74ZBZF.js +7 -0
- package/out/client-managed-import.js +3 -3
- package/out/client-managed.js +31 -35
- package/out/client-sync.js +11 -11
- package/out/compare.js +35 -0
- package/out/dialogs.js +51 -0
- package/out/github-issue-authorized.html +1 -1
- package/out/github-issue-authorized.js +1 -1
- package/out/graph.js +17 -17
- package/out/index.html +30 -34
- package/out/prism.js +14 -14
- package/out/scan.js +2 -0
- package/out/terminal.js +294 -293
- package/out/view.css +1 -1
- package/out/view.js +16 -107
- package/package.json +53 -6
- package/risk/actions/findings.js +161 -0
- package/risk/actions/resolve.js +219 -0
- package/risk/actions/scripts/commands.js +182 -0
- package/risk/actions/scripts/grade.js +113 -0
- package/risk/actions/scripts/packages.js +123 -0
- package/risk/actions/scripts/shell.js +169 -0
- package/risk/actions/uses.js +76 -0
- package/risk/actions/workflow.js +110 -0
- package/risk/files/hosts.js +6 -6
- package/risk/files/readability.js +23 -17
- package/risk/files/runs-code.js +18 -6
- package/risk/files/script.js +7 -3
- package/risk/files/stamps.js +8 -7
- package/risk/index.d.ts +71 -1
- package/risk/index.js +6 -2
- package/risk/npm/assess.js +1 -1
- package/risk/npm/compare.js +34 -10
- package/risk/npm/files.js +413 -2
- package/risk/npm/tarball.js +56 -73
- package/server-e2e/app.ts +5 -4
- package/server-e2e/http.ts +5 -2
- package/server-managed/agent-merges.ts +198 -0
- package/server-managed/app-agents.ts +30 -0
- package/server-managed/avatar-store.ts +1 -0
- package/server-managed/bundle-cache.ts +7 -1
- package/server-managed/combined.ts +3 -2
- package/server-managed/commit-coauthors.ts +83 -0
- package/server-managed/commit-lockfiles.ts +72 -0
- package/server-managed/config.ts +6 -0
- package/server-managed/db-methods.ts +66 -19
- package/server-managed/db-neon.ts +89 -21
- package/server-managed/db-schema.ts +13 -2
- package/server-managed/db.ts +9 -1
- package/server-managed/dependabot-access.ts +60 -0
- package/server-managed/dependabot-alerts.ts +185 -0
- package/server-managed/dependency-review-comments.ts +97 -0
- package/server-managed/dependency-reviews.ts +78 -18
- package/server-managed/github-accounts.ts +33 -0
- package/server-managed/github-actions.ts +71 -0
- package/server-managed/github-app.ts +33 -13
- package/server-managed/github-errors.ts +2 -0
- package/server-managed/github-issue-links.ts +11 -5
- package/server-managed/github-link-oauth.ts +69 -0
- package/server-managed/github-links.ts +204 -0
- package/server-managed/github-oauth.ts +5 -2
- package/server-managed/github-pulls.ts +2 -2
- package/server-managed/github-requests.ts +39 -0
- package/server-managed/github-users.ts +30 -0
- package/server-managed/http-response.ts +10 -2
- package/server-managed/http.ts +1251 -97
- package/server-managed/index.ts +13 -8
- package/server-managed/kept-briefly.ts +37 -0
- package/server-managed/locked-packages.ts +37 -16
- package/server-managed/lockfile-scope.ts +49 -0
- package/server-managed/npm-delta-worker.js +23 -0
- package/server-managed/npm-delta.ts +178 -0
- package/server-managed/npm-insights.ts +20 -11
- package/server-managed/npm-kept.ts +83 -6
- package/server-managed/npm-loads.ts +114 -37
- package/server-managed/npm-packages.ts +110 -64
- package/server-managed/npm-risk.ts +4 -1
- package/server-managed/pretty-print.ts +67 -23
- package/server-managed/pull-comment-reviews.ts +161 -0
- package/server-managed/pull-dependencies.ts +300 -0
- package/server-managed/pull-dependency-reviews.ts +318 -0
- package/server-managed/pull-reviews.ts +205 -0
- package/server-managed/queue.ts +16 -0
- package/server-managed/release-commits.ts +84 -0
- package/server-managed/rename-diff.ts +22 -13
- package/server-managed/report-sources.ts +1 -1
- package/server-managed/report-store.ts +42 -9
- package/server-managed/repository-actions.ts +218 -0
- package/server-managed/repository-agents.ts +220 -0
- package/server-managed/repository-browser.ts +166 -37
- package/server-managed/repository-changes.ts +284 -0
- package/server-managed/repository-code.ts +52 -0
- package/server-managed/repository-dependency-reviews.ts +157 -0
- package/server-managed/repository-history.ts +461 -0
- package/server-managed/repository-issues.ts +181 -0
- package/server-managed/repository-pulse.ts +439 -0
- package/server-managed/repository-risk-audit.ts +13 -0
- package/server-managed/repository-risk-read.ts +170 -0
- package/server-managed/repository-risk.ts +133 -118
- package/server-managed/reviewed-dependencies.ts +149 -0
- package/server-managed/session.ts +27 -9
- package/server-managed/sql.ts +6 -3
- package/server-managed/storage-stores.ts +5 -0
- package/server-managed/storage.ts +4 -2
- package/server-managed/team-app.ts +19 -3
- package/server-managed/team-reports.ts +24 -12
- package/server-managed/upstream-cache.ts +12 -0
- package/server-managed/workspace-shares.ts +4 -1
- package/server.ts +25 -5
- package/out/chunk-2ABLKCOY.js +0 -46
- package/out/chunk-2KBF5TZ7.js +0 -2
- package/out/chunk-35VE6CDH.js +0 -2
- package/out/chunk-3BZ7JERB.js +0 -1
- package/out/chunk-4XCDFGDP.js +0 -10
- package/out/chunk-5LSXOLUS.js +0 -1
- package/out/chunk-5RCM2J63.js +0 -1
- package/out/chunk-7B6HB4D7.js +0 -1
- package/out/chunk-AJ4GTATZ.js +0 -3
- package/out/chunk-CH4UN6WK.js +0 -225
- package/out/chunk-CMQA4DM6.js +0 -1
- package/out/chunk-CVVJAXVY.js +0 -2
- package/out/chunk-DIJJNTRH.js +0 -10
- package/out/chunk-EDKLBQQN.js +0 -17
- package/out/chunk-F47DXCEV.js +0 -33
- package/out/chunk-FK3DZEKL.js +0 -1
- package/out/chunk-G6AJWENO.js +0 -1
- package/out/chunk-GJ4IUCNS.js +0 -1
- package/out/chunk-GNXOKIGP.js +0 -80
- package/out/chunk-GZ4MS3TE.js +0 -13
- package/out/chunk-GZWM7UQM.js +0 -2
- package/out/chunk-IU3CCINR.js +0 -3
- package/out/chunk-K3X5EJBQ.js +0 -2
- package/out/chunk-KEX2ATEW.js +0 -2
- package/out/chunk-KYCNJVB7.js +0 -1
- package/out/chunk-LPCTJYNA.js +0 -7
- package/out/chunk-O4RJY5TP.js +0 -2
- package/out/chunk-OD4LPN3H.js +0 -1
- package/out/chunk-QWDWTBM7.js +0 -1
- package/out/chunk-QYWKC557.js +0 -1
- package/out/chunk-R75XOKUP.js +0 -1
- package/out/chunk-SWTLADW5.js +0 -1
- package/out/chunk-T7OKH4VW.js +0 -1
- package/out/chunk-TZ5KB2Y5.js +0 -10
- package/out/chunk-UNTRGE26.js +0 -2
- package/out/chunk-UTR2LVME.js +0 -2
- package/out/chunk-UYAXVRVL.js +0 -1
- package/out/chunk-V3ME6FI5.js +0 -2
- package/out/chunk-V5O7M2YT.js +0 -1
- package/out/chunk-VIHGO77Y.js +0 -1
- package/out/chunk-W4J3MGLB.js +0 -1
- package/out/chunk-WGG7KQUH.js +0 -1
- package/out/chunk-XYFXXB2G.js +0 -10
- package/out/chunk-ZESLQCTF.js +0 -6
package/out/chunk-LPCTJYNA.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk-TUII34K2.js";var v="deepview-objstore.v1.put",y="deepview-objstore.v1.delete",h="deepview-objstore.v1.fetch",w="deepview-objstore.v1.fetch-rest",I="deepview-objstore.v1.put-rest",j="deepview-objstore.v1.delete-rest";function l(e){return e==null?"":String(e)}function g(e){return e??""}function x(e,n){return a([v,e.workspaceTag,e.resourceTag,l(e.prevVersion),g(e.prevIncarnation),e.contentHash,String(e.expectedLength),n].join(`
|
|
2
|
-
`))}function O(e,n){return a([y,e.workspaceTag,e.resourceTag,l(e.prevVersion),g(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([w,e,n,String(r)].join(`
|
|
5
|
-
`))}function _(e,n,r,o){return i(e,A(n,r,o))}function T(e,n){return a([I,e.workspaceTag,e.resourceTag,l(e.prevVersion),g(e.prevIncarnation),e.contentHash,String(e.expectedLength),String(n)].join(`
|
|
6
|
-
`))}function U(e,n,r){return i(e,T(n,r))}function N(e,n){return a([j,e.workspaceTag,e.resourceTag,l(e.prevVersion),g(e.prevIncarnation),String(n)].join(`
|
|
7
|
-
`))}function L(e,n,r){return i(e,N(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",p="deepview.sync.standaloneProbe";function $(){try{return localStorage.getItem(p)==="1"}catch{return!1}}function X(){try{localStorage.setItem(p,"1")}catch{}}function f(e){return e==="managed+e2e"||e==="e2e+managed"}function q(e,n){return(e==="managed"||f(e))&&/^\/(?:team|manage|npm|my)(?:\/|$)/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"}});if(e.status===404)return"standalone";if(!e.ok)return null;let n=await e.json(),r=S(n);return r&&n.session!==void 0?{...r,session:n.session}:r}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(p)}catch{}}var E="deepview.objstore-presence.";function M(e){return E+e}function k(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:C(r.baselines,r.localVersions)}}catch{return null}}function C(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=k(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,k as v,oe as w};
|
package/out/chunk-O4RJY5TP.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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-CH4UN6WK.js";import"./chunk-JCIIBLKR.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-SWTLADW5.js";import"./chunk-2ABLKCOY.js";import"./chunk-ZESLQCTF.js";import"./chunk-UYAXVRVL.js";import"./chunk-NRPC74AM.js";import"./chunk-LPCTJYNA.js";import"./chunk-W4J3MGLB.js";import"./chunk-GJ4IUCNS.js";import"./chunk-PNHBZGDD.js";import"./chunk-F47DXCEV.js";import"./chunk-R5O6FAW4.js";import"./chunk-CMQA4DM6.js";import"./chunk-AJ4GTATZ.js";import"./chunk-R75XOKUP.js";import"./chunk-OD4LPN3H.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-QYWKC557.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};
|
package/out/chunk-OD4LPN3H.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function r(n,{packageDir:e=null}={}){if(e){if(e!=="."){let o=e.match(/(?:^|\/)node_modules\/(@[^/]+\/[^/]+|[^/]+)$/u);return o&&o[1]!==".pnpm"?o[1]:e}}else{let o=/\.sol$/iu.test(n)?/(?:^|\/)(?:node_modules\/(@[^/]+\/[^/]+|[^/]+)|dependencies\/(@[^/]+\/[^/]+|[^/]+)\/)/gu:/(?:^|\/)node_modules\/(@[^/]+\/[^/]+|[^/]+)/gu,t;for(;(t=o.exec(n))!==null;){let u=t[1]??t[2];if(u!==".pnpm")return u}}return"__own__"}function s(n,e=null){return r(n,{packageDir:e})==="__own__"||!!e&&!/(?:^|\/)(?:node_modules|dependencies|vendor)(?:\/|$)/u.test(e)}function l(n,e=null){let o=[],t=[];for(let u of n)(s(u,e?.get(u))?o:t).push(u);return[...o,...t]}function d(n){return n==="__own__"?"Own source":typeof n!="string"?n:n.match(/^(?:.*\/)?vendor\/(.+)$/u)?.[1]??n}export{r as a,s as b,l as c,d};
|
package/out/chunk-QWDWTBM7.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$c as D,Fa as N,Ja as H,Kc as R,Mc as v,Nc as U,db as I,eb as p,fb as B,h as o,i as f,od as G,pa as q,q as A,r as C,s as _,vd as P,x as $}from"./chunk-CH4UN6WK.js";import{b as M}from"./chunk-CVVJAXVY.js";import{u as x}from"./chunk-SWTLADW5.js";import{c as b}from"./chunk-AJ4GTATZ.js";async function V(e,{openManagedReport:n,readTeam:t=G,isCurrent:i=()=>!0}){let c=o.managedSession,r=()=>i()&&f()&&o.managedSession?.id===c?.id&&o.managedSession?.role===c?.role,u=o.managedTeams;if(!r())return null;async function m(a,s){return!r()||(o.currentManagedTeam!==a.id||o.currentManagedReport!==s)&&!await n(a,s)||!r()||o.currentManagedTeam!==a.id||o.currentManagedReport!==s?null:p(e.id)}if(e.teamId){let a=u.find(s=>s.id===e.teamId);return!a||e.reportId&&!a.reports.some(s=>s.id===e.reportId)?null:m(a,e.reportId??null)}let w=u.flatMap(a=>a.reports.map(s=>({team:a,report:s}))),h=new Set,d=new Map;async function k(a){for(let{team:s,report:l}of a){if(!r())return null;if(h.has(`${s.id}:${l.id}`))continue;h.add(`${s.id}:${l.id}`),d.has(s.id)||d.set(s.id,await t(s.id));let y=d.get(s.id)?.find(S=>S.id===l.id);if(!r())return null;if(y==null)continue;let j=await x(JSON.stringify(y.data),l.filename);if(!r())return null;if(j?.findings.some(S=>S.id===e.id))return m(s,l.id)}return null}if(e.report){let a=await Promise.all(w.map(({report:l})=>b("report",l.filename))),s=await k(w.filter((l,y)=>a[y]===e.report));if(s||!r())return s}if(e.workspace){let a=await Promise.all(u.map(l=>b("workspace",`managed-team:${l.id}`))),s=u[a.indexOf(e.workspace)];if(s){let l=await m(s,null);if(l||!r())return l}}if(!r())return null;let O=u.find(a=>a.id===o.currentManagedTeam);if(O&&(o.currentManagedReport==null||O.reports.some(a=>a.id===o.currentManagedReport))){let a=p(e.id);if(a)return a}return k(w)}async function J(e,n,t,{openReport:i,openManagedReport:c}){if(f()){let r=o.managedTeams.find(u=>u.id===o.currentManagedTeam);if(!t||!r?.reports.some(u=>u.id===t)||(o.currentManagedReport!==t||o.currentWorkspace)&&!await c(r,t)||!f()||o.currentManagedTeam!==r.id||o.currentManagedReport!==t||o.currentWorkspace)return null}else if(t||((o.currentFile!==n||o.currentWorkspace)&&await i(n),f()||o.currentFile!==n||o.currentWorkspace))return null;return p(e)}async function K(e,n){if(f())return V(e,n);let{openReport:t,openWorkspace:i}=n,[c,r]=await Promise.all([C(e.report),A(e.workspace)]);async function u(d){let k=I(d,r?.id);return(o.currentFile!==d||o.currentWorkspace||o.currentReportWorkspace!==k)&&await t(d,void 0,{workspaceId:k}),p(e.id)}if(c){let d=await u(c);if(d)return d}if(r){o.currentWorkspace!==r.id&&await i(r.id);let d=p(e.id);if(d)return d}let m=p(e.id);if(m)return m;let w=o.reports.map(d=>d.fileName).filter(Boolean),h=await _(e.id,{skip:w});return h?await u(h):null}var z="100% 0px",Q=new WeakMap,g=new WeakMap,L=[],E=!1,X=new WeakMap;function Z(e){let n=X.get(e);if(n===void 0){let t=getComputedStyle(e).overflowY;n=t==="auto"||t==="scroll"||t==="overlay",X.set(e,n)}return n}function W(e){let n=e.parentNode;for(;n;){if(n.nodeType===Node.DOCUMENT_FRAGMENT_NODE){n=n.host??null;continue}if(n.nodeType!==Node.ELEMENT_NODE||n===document.documentElement)return null;if(Z(n))return n;n=n.parentNode}return null}function ee(e){for(let n of e)g.get(n.target)?.cb(n.isIntersecting)}function ne(e){let n=e??document,t=Q.get(n);return t||(t=new IntersectionObserver(ee,{root:e,rootMargin:z,threshold:0}),Q.set(n,t)),t}function Se(e,n){let t=g.get(e);t?.io&&t.io.unobserve(e),g.set(e,{cb:n,io:null}),L.push(e),E||(E=!0,queueMicrotask(te))}function te(){E=!1;let e=L;L=[];for(let n of e){let t=g.get(n);!t||t.io||(t.io=ne(W(n)),t.io.observe(n))}}function be(e){let n=g.get(e);n&&(n.io?.unobserve(e),g.delete(e))}var oe=1600,F="link-target",ie="Couldn't find that finding in any of your reports. Import the report it came from, then open the link again.",T=null,re=3,ae=150,se=5;function ce(e){T!==null&&clearTimeout(T);for(let n of document.querySelectorAll(`.${F}`))n.classList.remove(F);e.classList.add(F),T=setTimeout(()=>{e.classList.remove(F),T=null},oe)}function ue(e){return new Promise(n=>{let t=null,i=0,c=0,r=()=>{let u=Math.round(e.getBoundingClientRect().top);i=u===t?i+1:0,t=u,i>=re||++c>=ae?n():requestAnimationFrame(r)};requestAnimationFrame(r)})}function de(e){let n=0,t=window.innerHeight,i=W(e);if(i){let c=i.getBoundingClientRect();n=Math.max(n,c.top),t=Math.min(t,c.bottom)}return{top:n,bottom:t}}function le(e){let n=e.getBoundingClientRect();if(n.height===0)return!1;let{top:t,bottom:i}=de(e);if(i<=t)return!1;let c=(t+i)/2;return n.top>=t&&n.bottom<=i||n.top<=c&&n.bottom>=c}async function fe(e){e.scrollIntoView({block:"center",behavior:"smooth"});for(let n=0;n<se;n++){if(await ue(e),!e.isConnected||le(e))return;e.scrollIntoView({block:"center",behavior:"instant"})}}async function pe(e){let n=CSS.escape(e);if(o.viewMode==="table"){let t=M.querySelector("finding-table");if(t){try{await t.updateComplete}catch{}for(let i of t.shadowRoot?.querySelectorAll("finding-row")??[])if(i.group&&q(i.group)===e)return i}}if(o.viewMode==="kanban"){let t=M.querySelector(`.kanban-card[data-gid="${n}"]`);if(t)return t}return M.querySelector(`finding-card[data-gid="${n}"]`)??M.querySelector(`[data-gid="${n}"]`)}async function Y(e,n,t=()=>!0){let i=B(e.group,n),c=H(i);if(c&&N(c)&&queueMicrotask($),D(),await P({revealSelection:!0}),!t())return{ok:!1};let r=await pe(i);return t()?r?(typeof r.ensureRendered=="function"&&await r.ensureRendered(),await fe(r),t()?(ce(r),{ok:!0}):{ok:!1}):{ok:!0}:{ok:!1}}async function $e(e,{openManagedReport:n=v,isCurrent:t=()=>!0}={}){if(!e?.id)return{ok:!1,reason:"This link is missing a finding id."};let i=await K(e,{openReport:R,openWorkspace:U,openManagedReport:n,isCurrent:t});return t()?i?await Y(i,e.id,t):{ok:!1,reason:f()?"Couldn't find that finding in the team reports you can access.":ie}:{ok:!1}}async function qe(e,n,t=null){if(!e||!n)return{ok:!1,reason:"Missing finding id or report name."};let i=await J(e,n,t,{openReport:R,openManagedReport:v});return i?await Y(i,e):{ok:!1,reason:t?`Could not open that finding in "${n}". Open the team and try again.`:`Couldn't find that finding in "${n}". It may have been re-imported since this links file was written.`}}export{Se as a,be as b,$e as c,qe as d};
|
package/out/chunk-QYWKC557.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var A=new Set(["overview","graph","treemap","compare","advisories","issues","code","search","terminal"]);var Z=/^\d+$/u;function D(e){for(let l=0;l<e.length;l++){let a=e.codePointAt(l);if(a<32||a===127)return!0}return!1}var L=512;function G(e){return typeof e=="string"&&e.length>0&&e.length<=L&&!D(e)}function E(e){return G(e)&&!Z.test(e)}var F=/^(?=.{1,214}$)(?:@[\w.-]+\/[\w-]|[\dA-Za-z])[\w.-]*$/u,j=/^(?=.{1,256}$)[\dA-Za-z][\w.+-]*$/u,X=/^@[\da-z~-][\w.~-]*$/u;function $(e){return typeof e=="string"&&F.test(e)}function m(e){return typeof e=="string"&&j.test(e)}function J(e){if(typeof e!="string")return null;let l=e.trim().toLowerCase(),a=l.startsWith("@")?l:`@${l}`;return a.length<=214&&X.test(a)?a:null}var h=new Set(["code","diff"]),ne=e=>h.has(e)?"code":"overview",x=e=>h.has(e)?{compareMode:"code"}:{},y=e=>h.has(e)?"/code":"",M=Object.freeze({manage:"/manage","manage-bundles":"/manage/bundle","manage-scans":"/manage/scans","manage-reports":"/manage/report","manage-repos":"/manage/repositories","manage-repo-risk":"/manage/repositories/risk","admin-users":"/manage/users","manage-teams":"/manage/team","manage-import":"/manage/import","manage-links":"/manage/links","manage-deduplication":"/manage/deduplication","manage-history":"/manage/history"});function O(e){if(!E(e)||e==="."||e==="..")return null;try{return`/finding/${encodeURIComponent(e)}`}catch{return null}}function ae(e){if(!e)return null;if(e.view==="home")return"/";if(e.view==="reviews")return"/my/reviews";if(e.view==="npm")return H(e);if(e.view==="workspace-reports"||e.view==="workspace-bundles")return/^[A-Za-z0-9_-]+$/u.test(e.teamSlug??"")?`/team/${e.teamSlug}/${e.view.slice(10)}`:null;if(e.view==="bundles"){if(!/^[A-Za-z0-9_-]+$/u.test(e.bundleSlug??"")||[e.teamSlug,e.compareSlug].some(u=>u!=null&&!/^[A-Za-z0-9_-]+$/u.test(u)))return null;let n=e.bundleTab??"overview";if(!A.has(n))return null;let r=e.teamSlug?`/team/${e.teamSlug}`:"/manage",o=n==="code"&&g(e.file)?`/${e.file}`:"",s=o&&g(e.line)?`#L${e.line}${g(e.endLine)&&e.endLine>e.line?`-L${e.endLine}`:""}`:"",t=n==="compare"&&e.compareSlug!=null?`/${e.compareSlug}${y(e.compareMode)}`:"";return`${r}/bundle/${e.bundleSlug}${n==="overview"?"":`/${n}`}${o}${t}${s}`}if(Object.hasOwn(M,e.view)){let n=M[e.view];return e.view==="manage-deduplication"&&e.linkId?`${n}?report=${encodeURIComponent(e.linkId)}`:e.view==="manage-bundles"&&Number.isSafeInteger(e.createRepoId)&&e.createRepoId>0?`${n}?createRepo=${e.createRepoId}`:e.view==="manage-scans"&&e.scanMode==="link"?`${n}?mode=link`:e.view==="manage-scans"&&e.bundleId?`${n}?bundle=${encodeURIComponent(e.bundleId)}${e.scanMode==="dependencies"?"&mode=dependencies":""}`:e.view==="manage-history"&&e.actor?`${n}?actor=${encodeURIComponent(e.actor)}`:n}if(!["findings","files"].includes(e.view)||!e.teamSlug||[e.teamSlug,e.reportSlug].some(n=>n!=null&&!/^[A-Za-z0-9_-]+$/u.test(n)))return null;let l=`/team/${encodeURIComponent(e.teamSlug)}`,a=e.reportSlug?`/report/${encodeURIComponent(e.reportSlug)}`:"";if(e.finding){let n=O(e.finding.id);return e.view==="findings"&&n?`${l}${a}${n}`:null}return`${l}${a}${e.view==="files"?"/files":""}`}var B=new Set(["overview","code","search","compare","review","treemap"]);function H(e){if(e.packageName==null)return"/npm";let l=e.bundleTab??"overview";if(!$(e.packageName)||e.packageSpec!=null&&!m(e.packageSpec)||!B.has(l)||e.compareSpec!=null&&!m(e.compareSpec))return null;if(l==="review"){if(e.reviewPackage!=null&&!$(e.reviewPackage)||e.reviewSpec!=null&&!m(e.reviewSpec))return null;let o=e.reviewPackage==null?"":`/${e.reviewPackage}${e.reviewSpec==null?"":`@${e.reviewSpec}`}`;return`/npm/${e.packageName}${e.packageSpec==null?"":`@${e.packageSpec}`}/review${o}`}let a=l==="code"&&g(e.file)?`/${e.file}`:"",n=a&&g(e.line)?`#L${e.line}${g(e.endLine)&&e.endLine>e.line?`-L${e.endLine}`:""}`:"",r=l==="compare"&&e.compareSpec!=null?`/${e.compareSpec}${y(e.compareMode)}`:"";return`/npm/${e.packageName}${e.packageSpec==null?"":`@${e.packageSpec}`}${l==="overview"?"":`/${l}`}${a}${r}${n}`}function K(e,l){let a=/^\/npm\/((?:@[^/@]+\/)?[^/@]+)(?:@([^/]+))?\/review(?:\/((?:@[^/@]+\/)?[^/@]+)(?:@([^/]+))?)?$/u.exec(e);if(a){if(!$(a[1])||a[2]!=null&&!m(a[2])||a[3]!=null&&!$(a[3])||a[4]!=null&&!m(a[4]))return null;let s=a[3]&&/^\d+\.\d+\.\d+(?:[-+].*)?$/u.test(a[3])&&a[4]==null;return{view:"npm",packageName:a[1],packageSpec:a[2]??null,bundleTab:"review",...a[3]?{reviewPackage:s?a[1]:a[3],reviewSpec:s?a[3]:a[4]??null}:{}}}let n=/^\/npm(?:\/((?:@[^/@]+\/)?[^/@]+)(?:@([^/]+))?(?:\/(code|search|compare|treemap)(?:\/([^/]+)(?:\/([a-z]+))?)?)?)?$/u.exec(e);if(!n)return;if(n[1]==null)return{view:"npm"};if(!$(n[1])||n[2]!=null&&!m(n[2]))return null;let r={view:"npm",packageName:n[1],packageSpec:n[2]??null,bundleTab:n[3]??"overview"};if(n[4]==null)return r;if(r.bundleTab==="compare")return m(n[4])&&(n[5]==null||h.has(n[5]))?{...r,compareSpec:n[4],...x(n[5])}:null;if(r.bundleTab!=="code")return null;let o=Number(n[4]);return!n[5]&&/^[1-9]\d*$/u.test(n[4])&&Number.isSafeInteger(o)?{...r,file:o,...T(l)}:null}function g(e){return Number.isSafeInteger(e)&&e>0}function T(e){let l=/^#L([1-9]\d*)(?:-L([1-9]\d*))?$/u.exec(e),[a,n]=l?[Number(l[1]),Number(l[2]??l[1])]:[];return!g(a)||!g(n)?{}:a===n?{line:a}:{line:Math.min(a,n),endLine:Math.max(a,n)}}function le(e){let l=e.pathname.replace(/\/$/u,"")||"/";if(l==="/"||l==="/index.html")return{view:"home"};if(l==="/my/reviews")return{view:"reviews"};let a=Object.keys(M).find(t=>M[t]===l);if(a){let t=Number(e.searchParams.get("createRepo"));return{view:a,...a==="manage-deduplication"&&e.searchParams.get("report")?{linkId:e.searchParams.get("report")}:{},...a==="manage-bundles"&&Number.isSafeInteger(t)&&t>0?{createRepoId:t}:{},...a==="manage-history"&&e.searchParams.get("actor")?{actor:e.searchParams.get("actor")}:{},...a==="manage-scans"?e.searchParams.get("mode")==="link"?{scanMode:"link"}:e.searchParams.get("bundle")?{bundleId:e.searchParams.get("bundle"),...e.searchParams.get("mode")==="dependencies"?{scanMode:"dependencies"}:{}}:{}:{}}}let n=/^(?:\/team\/([A-Za-z0-9_-]+)|\/manage)\/bundle\/([A-Za-z0-9_-]+)(?:\/([a-z]+)(?:\/([A-Za-z0-9_-]+)(?:\/([a-z]+))?)?)?$/u.exec(l);if(n){let t=n[3]??"overview";if(!A.has(t))return null;let u={view:"bundles",teamSlug:n[1]??null,bundleSlug:n[2],bundleTab:t};if(n[4]==null)return u;if(t==="compare")return n[5]==null||h.has(n[5])?{...u,compareSlug:n[4],...x(n[5])}:null;let c=Number(n[4]);return t!=="code"||n[5]||!/^[1-9]\d*$/u.test(n[4])||!Number.isSafeInteger(c)?null:{...u,file:c,...T(e.hash)}}let r=K(l,e.hash);if(r!==void 0)return r;let o=/^\/team\/([A-Za-z0-9_-]+)\/(reports|bundles)$/u.exec(l);if(o)return{view:`workspace-${o[2]}`,teamSlug:o[1]};let s=/^\/team\/([^/]+)(?:\/report\/([^/]+))?(?:\/(files)|\/finding\/([^/]+))?$/u.exec(l);if(!s)return null;try{let t=decodeURIComponent(s[1]),u=s[2]?decodeURIComponent(s[2]):null;if([t,u].some(p=>p!=null&&!/^[A-Za-z0-9_-]+$/u.test(p))||s[4]?.length>L*9)return null;let c=s[4]?decodeURIComponent(s[4]):null;return c!=null&&!O(c)?null:{view:s[3]?"files":"findings",teamSlug:t,reportSlug:u,...c==null?{}:{finding:{id:c}}}}catch{return null}}function R(e,l,a=[]){if(e.view==="workspace-reports"||e.view==="workspace-bundles"){let i=l.filter(f=>f.slug===e.teamSlug);return i.length===1?{view:e.view,teamId:i[0].id}:null}if(e.view==="bundles"){let{teamSlug:i,bundleSlug:f,compareSlug:I,compareMode:v,...k}=e,b=i==null?[]:l.filter(S=>S.slug===i);if(i!=null&&b.length!==1)return null;let w=b[0],N=i==null?a:l.flatMap(S=>S.bundles??[]),d=S=>new Set(N.filter(_=>_.slug===S).map(_=>_.id)),z=d(f),P=(w?.bundles??a).find(S=>S.slug===f);if(!f||!P||z.size!==1)return null;let C=I==null?null:d(I),U=C?.size===1?{compareId:[...C][0],...x(v)}:{};return{...k,teamId:w?.id??null,bundleId:P.id,...U}}if(!["findings","files"].includes(e.view))return e;let{teamSlug:n,reportSlug:r,...o}=e,s=l.filter(i=>i.slug===n);if(!n||s.length!==1)return null;let t=s[0];if(r==null)return{...o,teamId:t.id,reportId:null};let u=l.flatMap(i=>i.reports??[]).filter(i=>i.slug===r),c=new Set(u.map(i=>i.id)),p=(t.reports??[]).find(i=>i.slug===r);return p&&c.size===1?{...o,teamId:t.id,reportId:p.id}:null}function ie(e,l,a=[]){if(e.view==="workspace-reports"||e.view==="workspace-bundles"){let c=l.find(i=>i.id===e.teamId),p={view:e.view,teamSlug:c?.slug};return c?.slug&&R(p,l)?p:null}if(e.view==="bundles"){let{teamId:c,bundleId:p,compareId:i,compareMode:f,...I}=e,v=l.find(d=>d.id===c);if(c!=null&&!v?.slug)return null;let k=(v?.bundles??a).find(d=>d.id===p);if(!k?.slug)return null;let b=i==null?null:(c==null?a:l.flatMap(d=>d.bundles??[])).find(d=>d.id===i),w={...I,teamSlug:v?.slug??null,bundleSlug:k.slug,...b?.slug?{compareSlug:b.slug,...x(f)}:{}},N=R(w,l,a);if(!N)return null;if(w.compareSlug!=null&&N.compareId!==i){let{compareSlug:d,compareMode:z,...P}=w;return P}return w}if(!["findings","files"].includes(e.view))return e;let{teamId:n,reportId:r,...o}=e,s=l.find(c=>c.id===n),t=r==null?null:s?.reports?.find(c=>c.id===r);if(!s?.slug||r!=null&&!t?.slug)return null;let u={...o,teamSlug:s.slug,reportSlug:t?.slug??null};return R(u,l)?u:null}export{A as a,L as b,E as c,$ as d,m as e,J as f,ne as g,x as h,M as i,ae as j,B as k,le as l,R as m,ie as n};
|
package/out/chunk-R75XOKUP.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function l(e){return!Number.isFinite(e)||e<0?"\u2014":e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KiB`:e<1073741824?`${(e/1048576).toFixed(1)} MiB`:`${(e/1073741824).toFixed(1)} GiB`}function u(e){return Array.isArray(e)?e.reduce((r,n)=>({bytes:r.bytes!=null&&Number.isFinite(n.bytes)?r.bytes+n.bytes:null,lines:r.lines!=null&&Number.isFinite(n.lines)?r.lines+n.lines:null}),{bytes:0,lines:0}):{bytes:null,lines:null}}function o(e,r,n){if(Array.isArray(e?.files))return{files:r.length,lines:u(r).lines,packages:new Set(r.map(i=>i.module)).size};let s=i=>Number.isSafeInteger(i)&&i>=0?i:null,t=e?.summary;return{files:s(t?.[n==="code"?"codeFiles":"files"]),lines:s(t?.lines),packages:null}}function c(e){return(e??[]).filter(r=>!["resource:base64","directory"].includes(r.format))}export{l as a,u as b,o as c,c as d};
|
package/out/chunk-SWTLADW5.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as P}from"./chunk-NRPC74AM.js";import{a as b,d as x,f as h,h as y}from"./chunk-W4J3MGLB.js";import{d as B}from"./chunk-PNHBZGDD.js";import{a as g,b as d}from"./chunk-AJ4GTATZ.js";import{c as O}from"./chunk-QYWKC557.js";import{C as k,D as R,G as S,J as I,K as N,L as M,O as m,q as _}from"./chunk-GNXOKIGP.js";import{a as v}from"./chunk-TUII34K2.js";var H=["inprogress","fixed","invalid","deleted","ignored"];function Q(e){return typeof e=="string"&&H.includes(e)}function ue(e){if(e===null)return null;if(typeof e!="object"||Array.isArray(e))return"invalid";let r=e,n={},t=r.color;if(t!=null){if(typeof t!="string"||t.length>50)return"invalid";t!==""&&(n.color=t)}let o=r.triage;if(o!=null){if(!Q(o))return"invalid";n.triage=o}for(let a of["comment","fix"]){let c=r[a];if(c!=null){if(typeof c!="string"||c.length>1e4)return"invalid";c!==""&&(n[a]=c)}}let s=r.flagged;if(s!=null){if(typeof s!="boolean")return"invalid";n.flagged=s}return n}function ge(e,r){let n=d([{groups:[e],tree:r.tree}]);for(let t of e)k(t,r),t.isApp??=_(t,t.source??r.source),t._depsDirectory=n}function w(e,r){return!(e.isApp??_(e,e._source??e.source))&&g(e.file,e._depsDirectory??r??d([{groups:[[e]]}]))}function ye(e,r,n){let t=b(r);return t==="ignored"&&w(e,n)?void 0:t}function we(e,r,n,t){let o=r.id??String(r._id),s=r._reportName??"";w(r,t)&&(n==="ignored"||n==="untriaged")?(b(e.get(o))!=="ignored"&&h(e,o,{triage:void 0}),y(e,o,s,n==="ignored",!0)):(h(e,o,{triage:n==="untriaged"?void 0:n}),n!=="ignored"&&n!=="untriaged"&&y(e,o,s,!1))}function Z(e,r){if(![...e.values()].some(t=>t?.ignoredReports?.length))return!1;let n=!1;for(let t of r){let o=d([t]),s=(t.groups??[]).flat(),a=i=>({...i,_source:i._source??i.source??t.source}),c=new Set(s.filter(i=>w(a(i),o)).map(i=>i.id??String(i._id)));for(let i of s){let l=i.id??String(i._id),p=i._reportName??t.name??t.fileName??"",A=e.get(l);A?.ignoredReports?.includes(p)&&(x(A,p)||w(a(i),o)||(b(A)||(n=h(e,l,{triage:"ignored"})||n),c.has(l)||(n=y(e,l,p,!1)||n)))}for(let i of s){if(!w(a(i),o))continue;let l=i.id??String(i._id),p=i._reportName??t.name??t.fileName??"";e.get(l)?.ignoredReports?.includes(p)&&(n=y(e,l,p,!0,!0)||n)}}return n}async function ee(e,r){let n=new Set(Object.values(e??{}).flatMap(o=>Array.isArray(o?.ignoredReports)?o.ignoredReports.filter(s=>typeof s=="string"&&!x(o,s)):[])),t=[];for(let o of n){let s;try{let a=await r(o);if(typeof a!="string")continue;s=await m(a)}catch{continue}s&&t.push({...s.data,name:o,groups:[s.findings]})}return t}async function me(e,r){if(e!=null&&(typeof e!="object"||Array.isArray(e)))return{entries:e,changed:!1};let n=new Map(Object.entries(e??{})),t=await ee(e,r),o=Z(n,t);return{entries:Object.fromEntries(n),changed:o}}var T=1,f=16,D=12,L=1+f+D+16,u=1+f+D;async function F(e,r){let n=await crypto.subtle.importKey("raw",v(e),"PBKDF2",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"PBKDF2",hash:"SHA-256",salt:r,iterations:3e6},n,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}function X(e){return!(e instanceof Uint8Array)||e.length<L?!1:e[0]===T}async function W(e,r){if(!(e instanceof Uint8Array))throw new TypeError("encryptWithPassword: plaintext Uint8Array required");if(typeof r!="string"||!r)throw new TypeError("encryptWithPassword: password required");let n=new Uint8Array(u+e.length+16);n[0]=T,crypto.getRandomValues(n.subarray(1,1+f)),crypto.getRandomValues(n.subarray(1+f,u));let t=n.subarray(1,1+f),o=n.subarray(1+f,u),s=await F(r,t),a=new Uint8Array(await crypto.subtle.encrypt({name:"AES-GCM",iv:o,additionalData:n.subarray(0,u)},s,e));return n.set(a,u),n}async function ne(e,r){if(typeof r!="string"||!r)throw new TypeError("tryDecryptWithPassword: password required");if(!(e instanceof Uint8Array)||e.length<L)return{ok:!1,reason:"malformed"};if(e[0]!==T)return{ok:!1,reason:"malformed"};let n=e.subarray(1,1+f),t=e.subarray(1+f,u),o=e.subarray(u),s=await F(r,n),a;try{a=new Uint8Array(await crypto.subtle.decrypt({name:"AES-GCM",iv:t,additionalData:e.subarray(0,u)},s,o))}catch{return{ok:!1,reason:"wrong-password"}}return{ok:!0,plaintext:a}}async function U(e,r,n){if(!n||typeof n.malformedMsg!="string"||typeof n.wrongPasswordMsg!="string")throw new TypeError("decryptWithPasswordOrThrow: { malformedMsg, wrongPasswordMsg } strings required");let t=await ne(e,r);if(t.ok)return t.plaintext;throw t.reason==="wrong-password"?new Error(n.wrongPasswordMsg):new Error(n.malformedMsg)}var K=X,Be=W;function j(e,r){return U(e,r,{malformedMsg:"malformed encrypted bundle",wrongPasswordMsg:"wrong password or corrupt bundle"})}var te=1,C=1024,G=1024,E=200,J=100*1024*1024,oe=Math.ceil(J*4/3)+16,$=512,z=64;function se(e){if(!e||typeof e!="object")return"payload is not an object";if(e.version!==te)return`unsupported export version: ${e.version}`;if(!e.workspace||typeof e.workspace!="object")return"workspace metadata missing";if(typeof e.workspace.id!="string")return"workspace.id must be a string";if(typeof e.workspace.name!="string")return"workspace.name must be a string";if(typeof e.workspace.privateKey!="string")return"workspace.privateKey must be a string";if(e.workspace.createdAt!==void 0&&!Number.isFinite(e.workspace.createdAt))return"workspace.createdAt must be a finite number or omitted";if(!Array.isArray(e.reports))return"reports field must be an array";if(e.reports.length>G)return`reports count (${e.reports.length}) exceeds cap (${G})`;if(e.bundles!==void 0){if(!Array.isArray(e.bundles))return"bundles field must be an array when present";if(e.bundles.length>C)return`bundles count (${e.bundles.length}) exceeds cap (${C})`;for(let r of e.bundles){if(typeof r!="string")return"bundles entries must be strings";if(r.length>E)return`bundle integrity exceeds per-entry length cap (${E})`}}if(e.bundleBlobs!==void 0){if(!Array.isArray(e.bundleBlobs))return"bundleBlobs field must be an array when present";if(e.bundleBlobs.length>z)return`bundleBlobs count (${e.bundleBlobs.length}) exceeds cap (${z})`;for(let r of e.bundleBlobs){if(!r||typeof r!="object"||Array.isArray(r))return"bundleBlobs entries must be objects";if(typeof r.integrity!="string"||r.integrity.length===0)return"bundleBlobs.integrity must be a non-empty string";if(r.integrity.length>E)return`bundleBlobs.integrity exceeds per-entry length cap (${E})`;if(typeof r.name!="string"||r.name.length===0)return"bundleBlobs.name must be a non-empty string";if(r.name.length>$)return`bundleBlobs.name exceeds per-entry length cap (${$})`;if(r.name.includes("\0"))return"bundleBlobs.name cannot contain NUL";if(typeof r.data!="string")return"bundleBlobs.data must be a base64 string";if(r.data.length>oe)return`bundleBlobs.data exceeds per-blob size cap (${J} bytes raw)`}}return null}async function Se(e){return new Uint8Array(await e.arrayBuffer())}async function Ie(e,r){if(K(e)){if(typeof r!="string"||!r)throw new TypeError("parseWorkspaceBundleBytes: password required for encrypted bundle");let t=await j(e,r);try{return q(await B(t))}catch(o){throw new Error("wrong password or corrupt bundle",{cause:o})}}let n;try{n=await B(e)}catch(t){throw new Error(`gzip decompression failed: ${t.message}`,{cause:t})}return q(n)}function q(e){let r;try{r=JSON.parse(e)}catch(o){throw new Error(`payload is not JSON: ${o.message}`,{cause:o})}let n=se(r);if(n===null)return r;let t=n.includes("exceeds cap");throw new Error(t?n:`not a deepview workspace export: ${n}`)}var ve="links";function ie(e){if(typeof e=="string")return e.length>0?e:null;if(!e||typeof e!="object"||Array.isArray(e))return null;let{id:r}=e;return typeof r=="string"&&r.length>0?r:null}function V(e){let r;try{r=JSON.parse(e)}catch{return null}if(!Array.isArray(r)||r.length===0)return null;let n=[],t=0;for(let o of r){if(!Array.isArray(o))return null;let s=new Set;for(let a of o){let c=ie(a);if(c===null)return null;O(c)?s.add(c):t++}s.size>1&&n.push([...s])}return{groups:n,skipped:t}}function Oe(e){let r=new Set;for(let n of e)for(let t of n)r.add(t);return r.size}function Pe(e,r){for(let n of e)for(let t of n){let o=r.get(t);o||r.set(t,o=new Set);for(let s of n)s!==t&&o.add(s)}return r}function ae(e,r){let n=e.trimStart().startsWith("[")?V(e):null;if(n)return{data:{source:"links",findings:[],links:n.groups},format:"links",reason:null};let t=M(e);if(t.data!=null||N(e,r)!=="codex")return t;try{return{data:{type:"security",source:"codex-security",findings:S(e).flatMap(s=>s.data.findings)},format:"codex",reason:null}}catch(o){return{data:null,format:null,reason:o instanceof Error?o.message:"Invalid Codex CSV"}}}function Ue(e,r){let n=ae(e,r);return n.data==null?Promise.resolve(null):m(JSON.stringify(n.data))}function ce(e){let r=new Set;for(let n of e){if(!n||typeof n!="object")continue;let t=n;typeof t.file=="string"&&t.file&&r.add(t.file);for(let o of Array.isArray(t.evidence)?t.evidence:[])typeof o?.file=="string"&&o.file&&r.add(o.file)}return r}function Y(e){let r=(I(e)??[]).flat().filter(t=>t!=null&&typeof t=="object"),n=d([{groups:[r],tree:e?.tree}]);return{directory:n,own:r.filter(t=>!g(t.file,n))}}function Ke(e){let r=new Map;for(let n of Y(e).own){let t=R(n);t&&r.set(t.toLowerCase(),t)}return r.size===1?[...r.values()][0]:null}function je(e){let{directory:r,own:n}=Y(e);return P([...ce(n)].filter(t=>!g(t,r)))}export{ge as a,w as b,ye as c,we as d,Z as e,ee as f,me as g,W as h,U as i,K as j,Be as k,G as l,Se as m,Ie as n,q as o,ve as p,V as q,Oe as r,Pe as s,ae as t,Ue as u,Ke as v,je as w,ue as x};
|
package/out/chunk-T7OKH4VW.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$c as c,Zc as a,_c as b,ad as d,bd as e}from"./chunk-CH4UN6WK.js";import"./chunk-JCIIBLKR.js";import"./chunk-K3X5EJBQ.js";import"./chunk-CVVJAXVY.js";import"./chunk-VIHGO77Y.js";import"./chunk-SWTLADW5.js";import"./chunk-2ABLKCOY.js";import"./chunk-ZESLQCTF.js";import"./chunk-UYAXVRVL.js";import"./chunk-NRPC74AM.js";import"./chunk-LPCTJYNA.js";import"./chunk-W4J3MGLB.js";import"./chunk-GJ4IUCNS.js";import"./chunk-PNHBZGDD.js";import"./chunk-F47DXCEV.js";import"./chunk-R5O6FAW4.js";import"./chunk-CMQA4DM6.js";import"./chunk-AJ4GTATZ.js";import"./chunk-R75XOKUP.js";import"./chunk-OD4LPN3H.js";import"./chunk-4XCDFGDP.js";import"./chunk-3BZ7JERB.js";import"./chunk-TZ5KB2Y5.js";import"./chunk-XYFXXB2G.js";import"./chunk-DIJJNTRH.js";import"./chunk-QYWKC557.js";import"./chunk-GNXOKIGP.js";import"./chunk-C4Z6ZBXV.js";import"./chunk-2XUEZHIP.js";import"./chunk-TUII34K2.js";import"./chunk-V5O7M2YT.js";import"./chunk-OOJM4CTU.js";export{e as configureReportRevalidation,a as refreshGraph2Sidebar,b as refreshGraph2TopPkgs,c as render,d as renderEmptyWorkspace};
|
package/out/chunk-TZ5KB2Y5.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
*/
|
package/out/chunk-UNTRGE26.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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};
|
package/out/chunk-UTR2LVME.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{g as a,h as u}from"./chunk-CVVJAXVY.js";import{r as o,s as h}from"./chunk-5LSXOLUS.js";import{a as c}from"./chunk-KYCNJVB7.js";import"./chunk-IU3CCINR.js";import"./chunk-UYAXVRVL.js";import"./chunk-PNHBZGDD.js";import"./chunk-CMQA4DM6.js";import"./chunk-3BZ7JERB.js";import"./chunk-QYWKC557.js";import"./chunk-GNXOKIGP.js";import{a as d,c as i,g as n}from"./chunk-2XUEZHIP.js";import"./chunk-TUII34K2.js";import"./chunk-V5O7M2YT.js";import"./chunk-OOJM4CTU.js";var p=`.share-field{display:grid;gap:.35rem;margin-top:.8rem;font-size:.82rem}fieldset{display:grid;gap:.55rem;border:0;margin-top:1rem;font-size:.82rem}legend{margin-bottom:.55rem;font-weight:600}fieldset label{display:flex;align-items:center;gap:.5rem}input[type=checkbox]{accent-color:var(--accent)}.nwd-actions{flex-wrap:wrap}.revoke-all{margin-top:.75rem;border:0;background:none;color:var(--muted);font:inherit;font-size:.74rem}.revoke-all:hover:not(:disabled){color:var(--critical)}
|
|
2
|
-
`;var l=class extends a{static styles=[...a.styles,d(p)];static properties={team:{attribute:!1},session:{attribute:!1},initialId:{attribute:!1},selectedId:{state:!0},links:{state:!0},dependencies:{state:!0},security:{state:!0},busy:{state:!0},message:{state:!0}};constructor(){super(),this.team=null,this.initialId="",this.selectedId="",this.links=[],this.dependencies=!1,this.security=!1,this.busy=!0,this.message="",this.urls=new Map}beforeOpen(){this.load(this.initialId)}select(s){let e=this.links.find(t=>t.id===s);this.selectedId=e?.id??"",this.dependencies=e?.permissions.dependencies===!0,this.security=e?.permissions.security===!0,this.message=""}async load(s=this.selectedId){this.busy=!0;try{let e=await o(this.team.id);return this._settled?void 0:(this.links=e,this.select(s),!0)}catch(e){return this.message=e.message,!1}finally{this.busy=!1}}async change(s=!1,e=!1){if(!this.busy){this.busy=!0,this.message="";try{let t=await h(this.team.id,this.session?.csrfToken,{id:e?void 0:this.selectedId||void 0,revoke:s,dependencies:this.dependencies,security:this.security});if(c.invalidate(["links","history"]),this._settled)return;t.path&&(this.urls.set(t.id,new URL(t.path,location.origin).href),this.links=[{id:t.id,createdAt:Date.now(),createdBy:this.session?.login??"",permissions:{dependencies:this.dependencies,security:this.security}},...this.links],this.selectedId=t.id),s&&(e?this.urls.clear():this.urls.delete(this.selectedId)),await this.load(s?"":t.id??this.selectedId)&&(this.message=s?e?"All public links revoked.":"Link revoked.":t.path?"Link created.":"Permissions saved. The link URL is unchanged.")}catch(t){this.message=t.message}finally{this.busy=!1}}}async copy(){try{await navigator.clipboard.writeText(this.urls.get(this.selectedId)),this.message="Link copied."}catch{this.message="Select the link and copy it."}}render(){let s=this.urls.get(this.selectedId);return i`<dialog @close="${this._onClose}"><header><h3>Share ${this.team?.name}</h3></header><p class="nwd-intro ui-hint">Anyone with this link can read this workspace’s published reports, comments, triage, and available source files without signing in.<br>New published reports will also be included.</p><label class="share-field">Public links <select class="nwd-input" ?disabled="${this.busy}" @change="${e=>this.select(e.target.value)}"><option value="" ?selected="${!this.selectedId}">Create a new link</option>${this.links.map(e=>i`<option value="${e.id}" ?selected="${this.selectedId===e.id}">${new Date(e.createdAt).toLocaleString()} · ${e.createdBy} · ${e.id.slice(0,8)}</option>`)}</select></label><fieldset ?disabled="${this.busy}"><legend>Include in this link</legend><label><input type="checkbox" .checked="${this.security}" @change="${e=>{this.security=e.target.checked}}"> Security findings and advisories</label> <label><input type="checkbox" .checked="${this.dependencies}" @change="${e=>{this.dependencies=e.target.checked}}"> Findings in dependencies</label></fieldset><p class="nwd-note ui-hint">Both options are off for new links.<br>Existing links keep their URL when permissions change.</p>${s?i`<label class="share-field">Public link<input class="nwd-input" readonly="readonly" .value="${s}" @focus="${e=>e.target.select()}"></label>`:n} ${this.message?i`<p class="nwd-note" role="status">${this.message}</p>`:n}<footer class="nwd-actions">${this.selectedId?i`<button class="danger" ?disabled="${this.busy}" @click="${()=>this.change(!0)}">Revoke link</button>`:n} <span class="nwd-spacer"></span> ${s?i`<button @click="${()=>this.copy()}">Copy link</button>`:n} <button class="primary" ?disabled="${this.busy}" @click="${()=>this.change()}">${this.selectedId?"Save changes":"Create public link"}</button> <button @click="${()=>this._finish(null)}">Close</button></footer>${this.links.length>0?i`<button class="revoke-all" ?disabled="${this.busy}" @click="${()=>this.change(!0,!0)}">Revoke all links for this workspace</button>`:n}</dialog>`}};customElements.define("managed-share-dialog",l);function w(r,s="",e=null){return u("managed-share-dialog",{team:r,initialId:s,session:e})}export{w as openManagedShareDialog};
|
package/out/chunk-UYAXVRVL.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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};
|
package/out/chunk-V3ME6FI5.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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);
|
package/out/chunk-V5O7M2YT.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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};
|
package/out/chunk-VIHGO77Y.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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};
|
package/out/chunk-W4J3MGLB.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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};
|
package/out/chunk-WGG7KQUH.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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};
|
package/out/chunk-XYFXXB2G.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{h as _}from"./chunk-2XUEZHIP.js";var{I:c}=_,o=e=>e;var v=e=>e.strings===void 0,A=()=>document.createComment(""),u=(e,s,t)=>{let a=e._$AA.parentNode,l=s===void 0?e._$AB:s._$AA;if(t===void 0){let r=a.insertBefore(A(),l),$=a.insertBefore(A(),l);t=new c(r,$,e,e.options)}else{let r=t._$AB.nextSibling,$=t._$AM,n=$!==e;if(n){let i;t._$AQ?.(e),t._$AM=e,t._$AP!==void 0&&(i=e._$AU)!==$._$AU&&t._$AP(i)}if(r!==l||n){let i=t._$AA;for(;i!==r;){let m=o(i).nextSibling;o(a).insertBefore(i,l),i=m}}}return t},f=(e,s,t=e)=>(e._$AI(s,t),e),p={},T=(e,s=p)=>e._$AH=s,P=e=>e._$AH,g=e=>{e._$AR(),e._$AA.remove()};export{v as a,u as b,f as c,T as d,P as e,g as f};
|
|
2
|
-
/*! Bundled license information:
|
|
3
|
-
|
|
4
|
-
lit-html/directive-helpers.js:
|
|
5
|
-
(**
|
|
6
|
-
* @license
|
|
7
|
-
* Copyright 2020 Google LLC
|
|
8
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*)
|
|
10
|
-
*/
|
package/out/chunk-ZESLQCTF.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{a as Ae}from"./chunk-GNXOKIGP.js";import{b as B}from"./chunk-TUII34K2.js";var Dt={__proto__:null,js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"jsx",ts:"typescript",mts:"typescript",cts:"typescript",tsx:"tsx",json:"json",css:"css",html:"markup",htm:"markup",xml:"markup",svg:"markup",yml:"yaml",yaml:"yaml",sh:"bash",bash:"bash",md:"markdown",markdown:"markdown",sol:"solidity",php:"php",phtml:"php",rs:"rust",rb:"ruby",py:"python",pyw:"python",pyi:"python",java:"java",cpp:"cpp",cc:"cpp",cxx:"cpp","c++":"cpp",hpp:"cpp",hh:"cpp",hxx:"cpp","h++":"cpp",h:"cpp",c:"c",m:"objectivec",mm:"objectivec"},_e={__proto__:null,module:"javascript",commonjs:"javascript","module-typescript":"typescript","commonjs-typescript":"typescript",json:"json",solidity:"solidity",php:"php",shell:"bash",rust:"rust",java:"java",objc:"objectivec",objcpp:"objectivec",c:"c","c-header":"c",cpp:"cpp","cpp-header":"cpp",ruby:"ruby",podspec:"ruby",podfile:"ruby",fastlane:"ruby","podfile-lock":"yaml",xml:"markup"};function Wt(e){if(typeof e!="string")return!1;let t=e.length-1,n=0;for(;n<t&&/\s/u.test(e[n]);)n++;for(;t>n&&/\s/u.test(e[t]);)t--;return n<t&&e[n]==="{"&&e[t]==="}"}function ze(e,t,n){if(typeof t=="string"&&_e[t])return _e[t];if(typeof e!="string")return null;let s=e.slice(e.lastIndexOf("/")+1),o=s.lastIndexOf(".");if(o<=0)return null;let r=s.slice(o+1).toLowerCase();return r==="map"?Wt(n)?"json":null:Dt[r]??null}var Ut=Object.freeze({javascript:"JavaScript",jsx:"JSX",typescript:"TypeScript",tsx:"TSX",json:"JSON",css:"CSS",markup:"HTML",yaml:"YAML",bash:"Shell",markdown:"Markdown",solidity:"Solidity",php:"PHP",rust:"Rust",ruby:"Ruby",java:"Java",cpp:"C++",c:"C",objectivec:"Objective-C",python:"Python",go:"Go",kotlin:"Kotlin",swift:"Swift",dart:"Dart",sql:"SQL",lua:"Lua",csharp:"C#",scala:"Scala",vue:"Vue",svelte:"Svelte"}),Jt=Object.freeze({py:"python",pyw:"python",go:"go",kt:"kotlin",kts:"kotlin",swift:"swift",dart:"dart",sql:"sql",lua:"lua",cs:"csharp",scala:"scala",sc:"scala",vue:"vue",svelte:"svelte"});function Gt(e){let t=typeof e=="string"?e.slice(e.lastIndexOf("/")+1):"",n=t.lastIndexOf("."),s=n>0?t.slice(n+1).trim().toLowerCase():"",o=ze(e)??Jt[s];return o?{key:o,label:Ut[o]??o}:s?{key:`extension:${s}`,label:`.${s}`}:{key:"other",label:"Other"}}function Q(e,t){let n=new Map,s=0,o=0;for(let[r,i]of e){let c=Gt(r),a=n.get(c.key)??{...c,files:0,lines:0,bytes:0};a.files++,a.lines+=i,a.bytes+=t.get(r)??0,n.set(c.key,a),o+=i,s+=t.get(r)??0}return{files:e.size,lines:o,bytes:s,languages:[...n.values()].toSorted((r,i)=>i.lines-r.lines||r.label.localeCompare(i.label))}}var Kt=new Set(["module","commonjs","json","module-typescript","commonjs-typescript"]),qt=new Set(["solidity","php","shell","rust"]),Ht=new Set(["java","kotlin","gradle","objc","objcpp","swift","c","cpp","c-header","cpp-header","ruby","python","cmake","podspec","podfile","podfile-lock","template","xml","env","fastlane","pbxproj"]),Vt=new Set(["resource","resource:base64"]),Ce=new Set(["stat:file","stat:directory"]),Zt=new Set([...Kt,...qt,...Ht,...Vt,"patch","directory",...Ce]),ee=e=>Ce.has(e);var Ie=e=>e==="directory"||e==="stat:directory"?"directory":"file";function Xt(e,t,n){if(e===t)return e;let s=ee(e);if(s!==ee(t)&&Ie(e)===Ie(t))return s?t:e;throw new Error(`format conflict for '${n}' ('${t}' vs '${e}')`)}function $(e,t){return t===""?e:e==="."?t:`${e}/${t}`}var Yt=/^(?=[A-Za-z0-9-]{1,39}\/)[A-Za-z0-9](?:-?[A-Za-z0-9])*\/(?!\.\.?$)[\w.-]{1,100}$/u,Qt=/^(?!\.\.?(?:\/|$))[\w.~@+-]+(?:\/(?!\.\.?(?:\/|$))[\w.~@+-]+)*$/u,en=/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/u,I={github:e=>typeof e=="string"&&Yt.test(e),directory:e=>typeof e=="string"&&e.length<=1024&&(e===""||Qt.test(e)),commit:e=>typeof e=="string"&&en.test(e)},Pe=(e,t)=>e?.toLowerCase()===t?.toLowerCase();var U=(e,t,n)=>{if(e===void 0)return;v(e)||m(!1,`${n} must be an object`);for(let o of Object.keys(e))Object.hasOwn(t,o)||m(!1,`unknown ${n} key '${o}'`);let s=Object.entries(t).map(([o,r])=>typeof r=="object"?[o,U(e[o],r,`${n}.${o}`)]:(e[o]!==void 0&&!r(e[o])&&m(!1,`invalid ${n}.${o}: ${JSON.stringify(e[o])}`),[o,e[o]])).filter(([,o])=>o!==void 0);return s.length===0?void 0:Object.freeze(y(s))},J=(e,t="bundle repo")=>U(e,I,t),tn=(e,t)=>t??(E(e)?"npm":void 0),Le=(e,{ecosystem:t,repo:n},s)=>{if(n===void 0)return;tn(e,t)===void 0&&m(!1,`${s}: '${e}' is no dependency's bucket, and carries no repo`);let o=J(n,`${s} module '${e}' repo`);return o?.github===void 0&&m(!1,`${s} module '${e}' repo has no github`),o},W=({name:e,version:t,ecosystem:n,repo:s,files:o})=>({name:e,version:t,...n===void 0?{}:{ecosystem:n},...s===void 0?{}:{repo:s},files:o});function te({name:e,version:t,ecosystem:n,repo:s,files:o},r,i){return m(n===void 0||typeof n=="string"),W({name:e,version:t??void 0,ecosystem:n,repo:Le(r,{ecosystem:n,repo:s},i),files:y(Object.entries(o))})}function Fe(e,{scope:t="full"}={}){let n=new Set;for(let[s,{files:o}]of e)if(!(t!=="full"&&!E(s)))for(let r of Object.keys(o))n.add($(s,r));return n}function nn(e,{what:t,files:n,formats:s,scope:o}){if(e.includes("\\"))return"holds a '\\'";if(R(e))return"escapes the root";if(o!=="full"&&!E(e))return`is outside node_modules, which a '${o}'-scope ${t} does not record`;if(!n.has(e))return`names no file the ${t} records`;let r=s.get(e);return r==="directory"?"is a directory capture, not a file":ee(r)?`is a payload-free '${r}' record, not a file`:null}function Te(e,{what:t,files:n,formats:s,scope:o}){for(let r of e){let i=nn(r,{what:t,files:n,formats:s,scope:o});m(i===null,`${t}: executable entry '${r}' ${i}`)}}function Be(e,{what:t,files:n,formats:s,scope:o="full"}){if(e===void 0)return new Set;let r=`${t}: executable`;m(Array.isArray(e),`${r} must be an array of file paths`);let i=new Set;for(let c of e)m(typeof c=="string"&&c!=="",`${r} entry must be a non-empty string`),m(!i.has(c),`${r} entry '${c}' is listed twice`),i.add(c);return Te(i,{what:t,files:n,formats:s,scope:o}),i}function De(e,{what:t,modules:n,formats:s,scope:o}){if(e.size!==0)return Te(e,{what:t,files:Fe(n,{scope:o}),formats:s,scope:o}),G(e)}function m(e,t){if(!e)throw new Error(t)}function We(e,t){let[n,s]=[e.split("/"),t.split("/")];for(;n.length>0&&n[0]===s[0];)n.shift(),s.shift();if(n.length===0&&s.length===0)return 0;if(n.length<2)return s.length<2&&n>s?1:-1;if(s.length<2)return 1;if(n[0]==="*")return-1;if(s[0]==="*"||n[0]==="node_modules")return 1;if(s[0]==="node_modules")return-1;let[o,r]=[n,s].map(i=>i.join(String.fromCodePoint(0)));if(o<r)return-1;if(o>r)return 1;throw new Error("Unreachable")}var D=(e,t)=>We(e[0],t[0]),v=e=>e&&[null,Object.prototype].includes(Object.getPrototypeOf(e)),y=e=>Object.setPrototypeOf(Object.fromEntries(e),null),G=e=>[...e].toSorted(We),ne=(e,{sorted:t=!0}={})=>{let n=t?[...e].toSorted(D):[...e];return y(n.map(([s,o])=>[s,o instanceof Map?ne(o,{sorted:t}):o]))},Re=(e,t)=>e.get(t)??e.set(t,new Map).get(t),Ue=e=>new Map(Object.entries(e).map(([t,n])=>[t,v(n)?Ue(n):n]));function R(e){if(e.startsWith("/"))return!0;if(!e.includes(".."))return!1;let t=0;for(let n of e.split("/"))if(!(n==="."||n==="")){if(n!=="..")t++;else if(--t<0)return!0}return!1}var Je=e=>e.includes("\\")||R(e),x=(e,t)=>m(!Je(e),`${t}: path '${e}' escapes the root or holds a '\\'`),Ge=(e,t)=>m(typeof e=="string"&&e!==""&&!Je(e),`${t}: invalid entry ${JSON.stringify(e)}`);function Ke(e,t){m(Array.isArray(e),`${t}: entries must be an array of file paths`);let n=new Set;for(let s of e)Ge(s,t),m(!n.has(s),`${t}: entry '${s}' is listed twice`),n.add(s);return n}function qe(e,t){for(let n of e)Ge(n,t);return G(e)}function He(e,t){x(e,"formats"),m(Zt.has(t),`unknown format '${t}' for ${e}`)}function Ve(e){m(v(e));let t=new Map;for(let[n,s]of Object.entries(e)){He(n,s);let o=n===""?".":n;m(!t.has(o),`duplicate format key '${o}'`),t.set(o,s)}return t}function Ze(e){for(let[t,n]of e)He(t,n);return ne(e)}function Xe(e){for(let[,t]of e){m(t instanceof Map);for(let[n,s]of t){x(n,"imports"),m(s instanceof Map);for(let[,o]of s){if(typeof o=="string"){x(o,"imports");continue}m(o instanceof Map&&o.size>0,"import target must be a file or a non-empty {platform: file} map");for(let[r,i]of o)m(typeof r=="string"&&r.length>0&&!r.includes("/"),`invalid platform key '${r}'`),m(typeof i=="string"),x(i,"imports")}}}}function Ye(e){m(v(e));let t=Ue(e);return Xe(t),t}function Qe(e){return Xe(e),ne(e)}function et(e,{skipEmpty:t=!1,repo:n=!0,what:s}={}){let o={modules:[],sources:[]};for(let[r,i]of e){if(t&&Object.keys(i.files).length===0)continue;let c=E(r);c&&m(i.name&&i.version&&i.files);let a=y(Object.entries(i.files).toSorted(D));o[c?"modules":"sources"].push([r,W({...i,repo:n?Le(r,i,s):void 0,files:a})])}return{modules:y(o.modules.toSorted(D)),sources:y(o.sources.toSorted(D))}}function sn(e,t){let n=e instanceof Map;if(n!==t instanceof Map)return!1;if(!n)return e===t;if(e.size!==t.size)return!1;for(let[s,o]of e)if(t.get(s)!==o)return!1;return!0}var Ne=e=>e instanceof Map?`{${[...e].map(([t,n])=>`${t}: ${n}`).join(", ")}}`:e;function tt(e,t,n){let s=new Map,o=r=>{for(let[i,c]of r){let a=Re(s,i);for(let[u,f]of c){let l=Re(a,u);for(let[p,d]of f)l.has(p)?m(sn(l.get(p),d),`${n}: import '${p}' from '${u}' resolves differently ('${Ne(l.get(p))}' vs '${Ne(d)}')`):l.set(p,d instanceof Map?new Map(d):d)}}};return o(e),o(t),s}function nt(e,t,n){let s=new Map,o=r=>{for(let[i,c]of r){let a=s.get(i);if(a===void 0){s.set(i,c);continue}try{s.set(i,Xt(c,a,i))}catch(u){throw new Error(`${n}: ${u.message}`,{cause:u})}}};return o(e),o(t),s}function st(e,t,n,s){if(e.size===0)return new Set(t);let o=Fe(n,{scope:s}),r=new Set(t);for(let i of e)o.has(i)||r.add(i);return r}var on=/(?:^|\/)\.{0,2}(?:\/|$)/u;function K(e,t,n){let s=$(e,t);return(s!=="."||t!=="")&&on.test(s)&&m(!1,`${n}: non-canonical file key ${JSON.stringify(s)}`),s.includes("\\")&&m(!1,`${n}: file key '${s}' holds a '\\', which no path may`),s}function q(e,t,n){let s=new Map;for(let[o,{files:r}]of e){typeof o!="string"&&m(!1,`${t}: bucket dir ${String(o)} is not a string`),x(o,t);for(let i of Object.keys(r)){let c=K(o,i,t),a=s.get(c);a!==void 0&&n(c,a,o),s.set(c,o)}}return s}var ot=(e,t)=>n=>m(!1,`duplicate file key '${n}' across ${e} buckets -- module bucketing changed between writes (a workspace package without a version now owns its own bucket); regenerate the ${t}`);function rt(e,t,n){let s=new Map,o=r=>{for(let[i,c]of r){let a=s.get(i);if(a===void 0){s.set(i,W({...c,files:Object.assign(Object.create(null),c.files)}));continue}m(a.name===c.name,`${n}: module '${i}' name mismatch ('${a.name}' vs '${c.name}')`),m(a.version===c.version,`${n}: module '${i}' version mismatch ('${a.version}' vs '${c.version}')`+(a.version==null==(c.version==null)?"":" -- an artifact from an older stasis may record a placeholder version for a workspace package without one; regenerate it (bundle=replace / lock=replace)")),m(a.ecosystem===c.ecosystem,`${n}: module '${i}' ecosystem mismatch ('${a.ecosystem??"(none)"}' vs '${c.ecosystem??"(none)"}')`),a.repo===void 0&&c.repo!==void 0&&s.set(i,W({...a,repo:c.repo}));for(let[u,f]of Object.entries(c.files))Object.hasOwn(a.files,u)?m(a.files[u]===f,`${n}: content mismatch for '${$(i,u)}'`):a.files[u]=f}};return o(e),o(t),q(s,n,(r,i,c)=>m(!1,`${n}: file '${r}' is bucketed under both '${i}' and '${c}' -- module bucketing changed between the artifacts (a workspace package without a version now owns its own bucket); regenerate the artifact (bundle=replace / lock=replace)`)),s}function E(e){return e.split("/").includes("node_modules")}function rn(e){let t="node_modules/",n=e.length;for(;(n=e.lastIndexOf(t,n-1))!==-1;)if(n===0||e[n-1]==="/")return n;return-1}function it(e){let t="node_modules/",n=rn(e);if(n===-1)return null;let s=n+t.length,o=e.slice(s).split("/"),r=o[0].startsWith("@")?2:1;if(o.length<=r||o.slice(0,r).some(c=>!c))return null;let i=o.slice(0,r).join("/");return{dir:e.slice(0,s)+i,rel:o.slice(r).join("/"),name:i}}var O=1,ct=0,ut=ot("bundle","artifact (bundle=replace)"),lt=e=>it(e)??{dir:".",rel:e==="."?"":e,name:null};function cn(){throw new Error("bundle: file contents are not retained by this contents-free Bundle")}var un=(e,{files:t,...n})=>{let s=Object.create(null);for(let[o,r]of Object.entries(t))typeof r!="symbol"&&m(!1,`bundle: file '${$(e,o)}' is not a placeholder`),Object.defineProperty(s,o,{get:cn,enumerable:!0});return{...n,files:Object.freeze(s)}},se=(e,t)=>{if(e===void 0&&t===void 0)return;let n=new Map;for(let s of[e,t])for(let[o,r]of Object.entries(s??{})){if(!Array.isArray(r))continue;let i=n.get(o);i===void 0&&n.set(o,i=new Set);for(let c of r)i.add(c)}return y([...n.keys()].toSorted().map(s=>[s,G(n.get(s))]))},Ns=(e,t)=>Object.hasOwn(I,e)&&I[e](t),ln=(e,t)=>{if(e?.github===void 0||!Pe(e.github,t?.github))return;let n=Object.keys(I).filter(s=>e[s]!==void 0&&(s==="github"||e[s]===t[s]));return y(n.map(s=>[s,e[s]]))},an=e=>{if(!v(e)||e.root!==!0||Object.hasOwn(e,"directory"))return e;let{root:t,...n}=e;return n},at=e=>typeof e=="string"&&/^[\w.+@/~'!()*-]+$/u.test(e),oe={name:at,version:at},ft={npm:oe,composer:oe,cargo:oe},fn=(e,t)=>y(Object.keys(ft).map(n=>{let[s,o]=[e?.[n],t?.[n]];return[n,s?.name!==void 0&&s.name===o?.name?y(Object.entries(s).filter(([r,i])=>i===o[r])):void 0]})),S=class e{static VERSION=O;version=O;config;entries;modules;formats;imports;executable;reason;#e;get repo(){return this.#e}set repo(t){this.#e=J(t)}#t;get package(){return this.#t}set package(t){this.#t=U(t,ft,"bundle package")}constructor({config:t={scope:"full"},entries:n,modules:s,formats:o,imports:r,executable:i,reason:c,repo:a,package:u,version:f=O}={}){m([ct,O].includes(f)),m(["node_modules","full"].includes(t.scope)),this.version=f,this.config=t,this.entries=n??new Set,this.modules=s??new Map,this.formats=o??new Map,this.imports=r??new Map,this.executable=i??new Set,this.reason=c,this.repo=J(a),this.package=u}get sources(){let t=new Map;for(let[n,{files:s}]of this.modules)for(let[o,r]of Object.entries(s))t.set($(n,o),r);return t}static isResourceFormat(t){return t==="resource"||t==="resource:base64"||t==="directory"}get hasCode(){for(let[t,{files:n}]of this.modules)for(let s of Object.keys(n))if(!e.isResourceFormat(this.formats.get($(t,s))))return!0;return!1}static parse(t){return e.fromJSON(JSON.parse(t))}static fileKeyAt(t){let[n,s,o,r]=t;if(typeof s=="string"){if(t.length===2&&n==="sources"){let i=lt(s);return K(i.dir,i.rel,"bundle")}if(t.length===4&&(n==="sources"||n==="modules")&&o==="files"&&typeof r=="string")return K(s,r,"bundle")}}static fromJSON(t,{contents:n=!0}={}){m(t.version===O||t.version===ct),m(["node_modules","full"].includes(t.config?.scope));let s=Ve(t.formats),o=new Map,r=new Set;if(t.version===O){let a=t.config.scope==="full";if(t.modules!==void 0){m(typeof t.modules=="object"&&t.modules!==null);for(let[u,f]of Object.entries(t.modules))m(E(u)),x(u,"bundle"),m(f?.name&&f.version&&f.files),o.set(u,te(f,u,"bundle"))}if(a){m(t.sources&&typeof t.sources=="object");for(let[u,f]of Object.entries(t.sources))m(!E(u)),x(u,"bundle"),m(f?.name&&f.files),o.set(u,te(f,u,"bundle"));t.entries!==void 0&&(r=Ke(t.entries,"bundle"))}else m(t.entries===void 0),m(t.sources===void 0)}else{m(t.sources);for(let[a,u]of Object.entries(t.sources)){x(a,"bundle");let{dir:f,rel:l,name:p}=lt(a);m(!R(f)&&!R(l)),o.has(f)||o.set(f,{name:p,version:null,files:Object.create(null)});let{files:d}=o.get(f);m(!Object.hasOwn(d,l),"bundle: duplicate file key '.' (v0 '' and '.')"),d[l]=u}}let i=q(o,"bundle",ut),c=Ye(t.imports);if(!n)for(let[a,u]of o)o.set(a,un(a,u));return new e({version:t.version,config:t.config,entries:r,modules:o,formats:s,imports:c,executable:t.version===O?Be(t.executable,{what:"bundle",files:i,formats:s,scope:t.config.scope}):new Set,reason:v(t.reason)?t.reason:void 0,repo:an(t.repo),package:t.package})}serialize(){q(this.modules,"bundle",ut);let{modules:t,sources:n}=et(this.modules,{skipEmpty:!0,what:"bundle"}),s=this.config.scope==="full",o={version:O,config:this.config};this.repo!==void 0&&(o.repo=this.repo),this.package!==void 0&&(o.package=this.package),s&&(o.entries=qe(this.entries,"bundle")),o.formats=Ze(this.formats),o.imports=Qe(this.imports);let r=De(this.executable,{what:"bundle",modules:this.modules,formats:this.formats,scope:this.config.scope});return r!==void 0&&(o.executable=r),this.reason!==void 0&&(o.reason=se(this.reason,void 0)),s&&(o.sources=n),o.modules=t,JSON.stringify(o,void 0,2)}withReason(t){let{version:n,config:s,entries:o,modules:r,formats:i,imports:c,executable:a,repo:u,package:f}=this,l=se(this.reason,{[t]:[...this.sources.keys()]});return new e({version:n,config:s,entries:o,modules:r,formats:i,imports:c,executable:a,reason:l,repo:u,package:f})}merge(t){return m(this.config.scope===t.config.scope,`bundle merge: scope mismatch ('${this.config.scope}' vs '${t.config.scope}')`),new e({config:{scope:this.config.scope},entries:new Set([...this.entries,...t.entries]),modules:rt(this.modules,t.modules,"bundle merge"),formats:nt(this.formats,t.formats,"bundle merge"),imports:tt(this.imports,t.imports,"bundle merge"),executable:st(this.executable,t.executable,t.modules,this.config.scope),reason:se(this.reason,t.reason),repo:ln(this.repo,t.repo),package:fn(this.package,t.package)})}};var pt=/^webpack(?:-internal)?:\/\/[^/]*\//u,dt=/^[a-z][\d+.a-z-]*:/iu,pn=/^file:/iu,mt=/^(?:file|ftp|https?|wss?):/iu,dn=/^(?:[a-z][\d+.a-z-]*:\/\/[^/]*\/?|\/\/[^/]+\/|[a-z]:\/|\/)?/iu,M=e=>dn.exec(e)[0],V=e=>M(e).includes("://"),z=e=>e.replace(V(e)?/[#?].*$/su:/\?.*$/su,""),gt=e=>e.slice(e.lastIndexOf("/")+1),H=(e,t)=>URL.parse(e,t)?.href??null;function k(e){let t=M(e),n=t.includes("://")&&H(e);if(n)return n;let s=[];for(let r of e.slice(t.length).split("/"))r===""||r==="."||(r!==".."?s.push(r):s.length>0&&s.at(-1)!==".."?s.pop():t||s.push(".."));let o=/^[a-z]:\/$/iu.test(t)?t.toUpperCase():t.startsWith("//")?t.toLowerCase():t;return o?o.replace(/\/?$/u,"/")+s.join("/"):s.join("/")||"."}function ht(e,t){let n=M(t);return V(e)&&!n.includes(":")?H(t,e)??k(`${e}/../${t}`):k(n==="/"?M(e).replace(/\/?$/u,"")+t:n?t:`${e}/../${t}`)}function mn(e){try{return decodeURIComponent(e)}catch{return e}}function C(e,t){let n=e.replaceAll("\\","/");if(pt.test(n))return k(n.replace(pt,""));let s=mt.test(n)?H(n)??n:n,o=/^file:\/\/([^/#]*)([^#]*)/isu.exec(s);if(o){let[,i,c]=o;return k(mn(i&&i.toLowerCase()!=="localhost"?`//${i}${c}`:c).replace(/^\/(?=[a-z]:\/)/iu,""))}if(dt.test(s)&&!M(s).includes(":"))return s;if(t===void 0)return k(s);if(pn.test(t)&&!M(s))return C(H(s,t)??s);let r=C(t);return M(s)&&!V(r)?k(s):ht(r,s)}var gn=/^(?:@[\dA-Za-z~-][\w.~-]*\/)?[\dA-Za-z~-][\w.~-]*$/u;function re(e){let t=e.split("/").slice(0,e.startsWith("@")?2:1).join("/");return gn.test(t)?t:null}var hn=new Set([".pnpm",".bun",".deno"]),bn=/^\d+\.\d+\.\d+(?:-[\d.a-z-]+)?(?:\+[\d.a-z-]+)?$/iu;function yn(e,t){let n=`${t.replace("/","+")}@`,s=e.startsWith(n)?e.slice(n.length).split(/[(_]/u)[0]:null;return bn.test(s)?s:null}function bt(e){let t=z(e).split("/"),n=t.lastIndexOf("node_modules"),s=n<0?null:re(t.slice(n+1).join("/"));if(s===null)return null;let o=n+1+s.split("/").length;if(o>=t.length||t.slice(o).includes(""))return null;let r=t.slice(0,o).join("/");return{name:s,version:hn.has(t[n-2])?yn(t[n-1],s):null,root:r,path:e.slice(r.length+1)}}var wn=new Map([["js","jsx"],["mjs","jsx"],["cjs","jsx"],["jsx","jsx"],["es","jsx"],["es6","jsx"],["ts","ts"],["mts","ts"],["cts","ts"],["tsx","tsx"],["json","json"]]);function ie(e){let t=gt(z(e));return/^[\w-]+$/u.test(t)?"jsx":wn.get(/\.([\da-z]+)$/iu.exec(t)?.[1].toLowerCase())??null}var Sn=[".js",".mjs",".cjs",".jsx",".ts",".tsx",".mts",".cts",".json"],xn=[".ios",".android",".web"];function On(e){let t=e.map(i=>/\.[a-z]+(?=\.\w+$)/u.exec(gt(z(i.path??"")))?.[0]),n=xn.map(i=>[i,t.filter(c=>c===i).length]).toSorted((i,c)=>c[1]-i[1]),[[s,o],[,r]]=n;return[...o===r?[]:[s],".native","",".browser",".node"]}var $n=new Map([[".js",[".ts",".tsx"]],[".jsx",[".tsx"]],[".mjs",[".mts"]],[".cjs",[".cts"]]]),vn=["index","main","browser","node"],En=["","src/","lib/","dist/","build/"],kn=new Set(["lib","dist","build","out","esm","cjs"]);function*Mn(e,t){yield e;let n=/\.[^./]+$/u.exec(e)?.[0];for(let s of $n.get(n)??[])yield e.slice(0,-n.length)+s;for(let s of e.endsWith("/")?[`${e}index`]:[e,`${e}/index`])for(let o of Sn)for(let r of t)yield s+r+o;if(n)for(let s of t.filter(Boolean))yield e.slice(0,-n.length)+s+n}function*jn(e){let t=e;for(;;){t.startsWith("src/")||(yield`src/${t}`),t!==e&&(yield t);let n=t.indexOf("/");if(n<0||!kn.has(t.slice(0,n)))return;t=t.slice(n+1)}}function yt(e){let t=new Map,n=new Map,s=new Map;for(let o of e){if(o.path!==null&&t.set(o.path,o),!o.package)continue;n.set(o.package.name,(n.get(o.package.name)??new Set).add(o.package.root)),(s.get(o.package.root)??s.set(o.package.root,[]).get(o.package.root)).push(o)}return{byPath:t,roots:n,byRoot:s,platforms:On(e),found:new Map}}function N(e,t){if(!e.found.has(t)){let n=z(t),s=Mn(n,e.platforms).map(o=>o+t.slice(n.length));e.found.set(t,e.byPath.get(s.find(o=>e.byPath.has(o)))??null)}return e.found.get(t)}function An(e,t,n){let s=e.roots.get(n);if(!s)return null;let o=t.path.split("/");for(let r=o.length-1;r>=0;r--){let i=[...o.slice(0,r),"node_modules",n].join("/");if(s.has(i))return i}return s.size===1?[...s][0]:null}var _n=new Set(["assert","async_hooks","buffer","child_process","cluster","console","constants","crypto","dgram","diagnostics_channel","dns","domain","events","fs","http","http2","https","inspector","module","net","os","path","perf_hooks","process","punycode","querystring","readline","repl","stream","string_decoder","sys","timers","tls","trace_events","tty","url","util","v8","vm","wasi","worker_threads","zlib","_http_agent","_http_client","_http_common","_http_incoming","_http_outgoing","_http_server","_stream_duplex","_stream_passthrough","_stream_readable","_stream_transform","_stream_wrap","_stream_writable","_tls_common","_tls_wrap","assert/strict","dns/promises","fs/promises","inspector/promises","path/posix","path/win32","readline/promises","stream/consumers","stream/promises","stream/web","timers/promises","util/types"]);function zn(e){if(e.startsWith("node:")||_n.has(e))return{builtin:!0};let t=re(z(e));return t===null?{}:{package:t}}function ce(){let e=[],t=new Map,n=(o,r,i)=>{let c=t.get(o)??t.set(o,new Set).get(o);c.has(r)||(c.add(r),e.push(i))};return{edges:e,add:n,link:(o,r,i)=>{o&&r&&r!==o&&n(o,r,{from:o,to:r,kind:i})}}}function In(e,t){for(let s of vn)for(let o of En){let r=N(e,`${t}/${o}${s}`);if(r)return r}let n=e.byRoot.get(t);return n?.length===1?n[0]:null}function Rn(e,t,n,s){return/^\/[^?]/u.test(n)?N(e,t+n)??jn(n.slice(1)).map(o=>N(e,`${t}/${o}`)).find(Boolean):N(e,t+n)??s(e,t)}function ue(e,t,n,s=In){let o=/^(?:\.{1,2}|[a-z]:)?\\/iu.test(n)?n.replaceAll("\\","/"):n,r=mt.test(o);if(r||/^(?:\.{1,2}(?:\/|$)|\/|[a-z]:\/)/iu.test(o)||V(o)){let u=r?C(o):ht(t.path,o),f=N(e,u);return f?{to:f}:{to:null,path:u}}if(dt.test(o)&&e.byPath.has(o))return{to:e.byPath.get(o)};let i=re(z(n)),c=i===null?null:An(e,t,i);if(c===null)return{to:null,...zn(n)};let a=Rn(e,c,n.slice(i.length),s);return a?{to:a}:{to:null,package:i}}var h=class extends Error{name="SourceMapError"},St=new Uint8Array(128).fill(255);for(let[e,t]of[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/,;"].entries())St[t.codePointAt(0)]=e;function le(e){let t=new Int32Array(e.length*2);return t.set(e),t}function Nn(e){let{starts:t,columns:n,sources:s,names:o}=e;for(let r=0;r+1<t.length;r++){let[i,c]=[t[r],t[r+1]],a=i+1;for(;a<c&&n[a-1]<=n[a];)a++;if(a>=c)continue;let u=Array.from(n.subarray(i,c),(f,l)=>[f,s[i+l],o[i+l]]).sort((f,l)=>f[0]-l[0]);for(let[f,[l,p,d]]of u.entries())[n[i+f],s[i+f],o[i+f]]=[l,p,d]}return e}function Cn(e){let t=[0],n=new Int32Array(1024),s=new Int32Array(1024),o=new Int32Array(1024),r=0;for(let{mappings:i,files:c,line:a,column:u,names:f,nameCount:l}of e){if(typeof i!="string")throw new h("mappings is not a string");for(;t.length<=a;)t.push(r);let p=[0,0,0,0,0],d=0,g=0,A=1,Me=u;for(let b=0;b<=i.length;b++){let _=b<i.length?St[i.codePointAt(b)]??255:64;if(_<32){if(g+=_*A,d===5)throw new h(`mappings: a segment of more than 5 fields at ${b}`);p[d++]+=g%2?(1-g)/2:g/2,g=0,A=1;continue}if(_<64){if(g+=(_-32)*A,A*=32,A>2**30)throw new h(`mappings: a value at ${b} runs past 32 bits`);continue}if(_===255)throw new h(`mappings: ${JSON.stringify(i[b])} at ${b} is not a base64 digit`);if(A!==1)throw new h(`mappings: the value before ${b} is cut off`);if(d>0){if(d===2||d===3)throw new h(`mappings: a segment of ${d} fields before ${b}`);let je=d===1?-1:c[p[1]];if(je===void 0)throw new h(`mappings: source ${p[1]} before ${b} is not in sources`);if(p[0]<0)throw new h(`mappings: a negative generated column before ${b}`);r===n.length&&([n,s,o]=[le(n),le(s),le(o)]),n[r]=p[0]+Me,s[r]=je,o[r++]=d===5&&p[4]>=0&&p[4]<l?f+p[4]:-1,d=0}_===65&&(t.push(r),p[0]=0,Me=0)}}return t.push(r),Nn({starts:Int32Array.from(t),columns:n.slice(0,r),sources:s.slice(0,r),names:o.slice(0,r)})}var xt=new WeakMap,ae=e=>xt.get(e),P=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function w(e,t){if(!e)throw new h(t)}function wt(e,t){if(e===void 0)return[];w(Array.isArray(e),`${t} is not an array`);for(let n of e)w(typeof n=="string"||n===null,`${t} holds ${JSON.stringify(n)}`);return e}function Pn(e,t,n,s){let o=e.bySource.get(t);if(o!==void 0)return e.files[o].content??=n,e.files[o].ignored||=s,o;let r=t===null?null:C(t,e.mapPath);return e.files.push({source:t,path:r,package:r===null?null:bt(r),content:n,ignored:s}),t!==null&&e.bySource.set(t,e.files.length-1),e.files.length-1}function Ot(e,t,n,s){w(e.version===3,`version ${JSON.stringify(e.version)} is not 3`),w(e.sourceRoot===void 0||typeof e.sourceRoot=="string","sourceRoot is not a string");let o=wt(e.sources,"sources"),r=wt(e.sourcesContent,"sourcesContent"),i=e.ignoreList??e.x_google_ignoreList??[];w(Array.isArray(i)&&i.every(l=>Number.isInteger(l)&&l>=0&&l<o.length),"ignoreList is not a list of indices into sources");let c=new Set(i),a=e.sourceRoot?e.sourceRoot.replace(/\/?$/u,"/"):"",u=o.map((l,p)=>Pn(t,l===null?null:a+l,r[p]??null,c.has(p))),f=Array.isArray(e.names)?e.names:[];t.parts.push({mappings:e.mappings,files:u,line:n,column:s,names:t.names.length,nameCount:f.length}),t.names.push(...f)}function Ln(e,t){w(e.version===3,`version ${JSON.stringify(e.version)} is not 3`),w(Array.isArray(e.sections),"sections is not an array");for(let[n,s]of e.sections.entries()){let{offset:o,map:r}=P(s)?s:{};w(P(o)&&[o.line,o.column].every(c=>Number.isInteger(c)&&c>=0),`sections[${n}].offset is not a line and a column`),w(P(r)&&r.sections===void 0,`sections[${n}].map is not a plain source map`);let i=e.sections[n-1]?.offset;w(!i||i.line<o.line||i.line===o.line&&i.column<=o.column,`sections[${n}] starts before sections[${n-1}]`),Ot(r,t,o.line,o.column)}}function fe(e,t={}){if(!P(t))throw new TypeError("readSourceMap: options is not an object");if(t.path!==void 0&&typeof t.path!="string")throw new TypeError("readSourceMap: options.path is not a string");let n=e;if(typeof e=="string"||e instanceof Uint8Array)try{let r=typeof e=="string"?e:new TextDecoder("utf-8",{fatal:!0}).decode(e);n=JSON.parse(r.replace(/^\)\]\}'[^\n]*\n/u,""))}catch(r){throw new h(`not JSON: ${r.message}`,{cause:r})}w(P(n),"not a JSON object");let s={files:[],bySource:new Map,mapPath:t.path,parts:[],names:[]};n.sections===void 0?Ot(n,s,0,0):Ln(n,s);let o={files:s.files};return xt.set(o,{...Cn(s.parts),nameList:s.names}),o}var Fn=/\r\n?|[\n\u2028\u2029]/gu;function $t(e){let t=[0];for(let n of e.matchAll(Fn))t.push(n.index+n[0].length);return t}function vt(e,t,n,s){let[o,r]=[t,n];for(;o<r;){let i=o+r>>1;e[i]<=s?o=i+1:r=i}return o-1}function L(e,t){let n=vt(e,0,e.length,t);return[n,t-e[n]]}function Tn(e,[t,n]){if(t>=e.starts.length-1)return-1;let s=e.starts[t],o=vt(e.columns,s,e.starts[t+1],n);return o<s?-1:o}function Et(e,t,n,s){let o=ae(e),r=L(t,n),[i,c]=L(t,s),a=new Map,u=Tn(o,r);for(let l=r[0];l<=i&&l<o.starts.length-1;l++){let p=l===r[0]&&u>=0?u:o.starts[l];for(let d=p;d<o.starts[l+1];d++){let g=o.sources[d];if(l===i&&o.columns[d]>=c)break;g>=0&&a.set(g,(a.get(g)??0)+1)}}let[f]=[...a].reduce((l,p)=>p[1]>l[1]?p:l,[-1,0]);return f<0?null:e.files[f]}var pe=/\s+/uy,Mt=`
|
|
2
|
-
\r\u2028\u2029`,de=/[\n\r\u2028\u2029]/gu,kt=/[\n\r\u2028\u2029]/u,j=/[\w$\u0080-]+/uy,jt=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","default","extends","do","else","yield","await"]),Bn=new Set(["if","while","for","with"]),At=new Set(["break","continue","debugger"]),Dn=new Set(["(","[","${",",","=",":","?","!","~","+","-","*","/","%","&","|","^","<",">"]);function Wn(e,t){return e?.type!=="word"?Dn.has(e?.value):t&&["return","yield"].includes(e.value)?!1:jt.has(e.value)&&!["do","else"].includes(e.value)}function Un(e){let t=e.at(-1);return t?.type==="word"&&(Bn.has(t.value)||t.value==="await"&&e.at(-2)?.value==="for")}function Jn(e){return e?e.type==="word"?jt.has(e.value)||At.has(e.value)||e.label===!0:e.value===")"?e.control:e.value==="}"?!e.object:e.type==="punctuator"&&!["++","--","]"].includes(e.value):!0}var Gn=(e,t)=>e.startsWith(`\r
|
|
3
|
-
`,t+1)?3:2,Kn=/\\(?:u\{([\da-f]+)\}|u([\da-f]{4})|x([\da-f]{2})|([0-3][0-7]{0,2}|[4-7][0-7]?)|(\r\n|[\n\r\u2028\u2029])|(.))/giu,qn={b:"\b",f:"\f",n:`
|
|
4
|
-
`,r:"\r",t:" ",v:"\v"};function _t(e){return e.includes("\\")?e.replace(Kn,(t,n,s,o,r,i,c)=>{if(i!==void 0)return"";if(r!==void 0)return String.fromCodePoint(Number.parseInt(r,8));let a=Number.parseInt(n??s??o,16);return Number.isNaN(a)?qn[c]??c:String.fromCodePoint(Math.min(a,1114111))}):e}function Hn(e,t){let n=e[t],s=t+1;for(;s<e.length&&e[s]!==n&&!Mt.includes(e[s]);)s+=e[s]==="\\"?Gn(e,s):1;return[e[s]===n?_t(e.slice(t+1,s)):null,s+1]}function Vn(e,t){let n=t+1,s=!1;for(;n<e.length&&!Mt.includes(e[n])&&(s||e[n]!=="/");)e[n]==="\\"?n++:e[n]==="["?s=!0:e[n]==="]"&&(s=!1),n++;return j.lastIndex=n+1,j.test(e)?j.lastIndex:n+1}function Zn(e,t,n){for(let s=t;s<e.length;s++)if(e[s]==="\\")s++;else{if(e[s]==="`")return s+1;if(e[s]==="$"&&e[s+1]==="{")return n.push("template"),s+2}return e.length}function Xn(e){let t=[],n=[],s=[],o=0,r=0;for(;o<e.length;){let i=t.length;if(pe.lastIndex=o,pe.test(e)&&(o=pe.lastIndex),o>=e.length)break;let c=e[o],a=e[o+1];if(j.lastIndex=o,c==="/"&&a==="/")de.lastIndex=o+2,o=de.test(e)?de.lastIndex-1:e.length;else if(c==="/"&&a==="*"){let u=e.indexOf("*/",o+2);o=u<0?e.length:u+2}else if(c==='"'||c==="'"){let[u,f]=Hn(e,o);t.push({type:"string",value:u}),o=f}else if(c==="`"||c==="}"&&n.at(-1)==="template"){c==="}"&&n.pop();let u=n.length,f=Zn(e,o+1,n),l=c==="`"&&n.length===u&&e[f-1]==="`";t.push({type:"string",value:l?_t(e.slice(o+1,f-1)):null}),n.length>u&&t.push({type:"punctuator",value:"${"}),o=f}else if(c==="/"&&Jn(t.at(-1)))o=Vn(e,o),t.push({type:"regex"});else if(j.test(e)){let u=At.has(t.at(-1)?.value)&&!kt.test(e.slice(r,o));t.push({type:"word",value:e.slice(o,j.lastIndex),...u&&{label:u}}),o=j.lastIndex}else{c==="{"&&n.push(Wn(t.at(-1),kt.test(e.slice(r,o)))?"object":"block");let u=c==="}"?n.pop():void 0;c==="("&&s.push(Un(t));let f=(c==="+"||c==="-")&&a===c||c==="="&&a===">"?c+a:c;t.push({type:"punctuator",value:f,...c===")"&&{control:s.pop()===!0},...c==="}"&&{object:u==="object"}}),o+=f.length}t.length>i&&(r=o)}return t}var me=e=>e?.type==="string"&&e.value!==null,zt=new Set(["type","typeof"]),Yn=(e,t)=>e[t+1]?.type==="word"&&!(e[t+1].value==="as"&&e[t+2]?.type==="word"&&e[t+2].value!=="as");function Qn(e,t){let n=!1;for(let s=t+1;s<e.length&&e[s].value!=="}";s++)if(!(s>t+1&&e[s-1].value!==",")){if(!zt.has(e[s].value)||!Yn(e,s))return!1;n=!0}return n}function es(e,t){for(let n=t;n<e.length;n++){let{value:s}=e[n];if(s===";"||n>t&&(s==="import"||s==="export"))return null;if(s==="from"&&me(e[n+1]))return e[n+1].value}return null}function ts(e,t){let[n,s,o]=[e[t].value,e[t+1],e[t+2]],r=n==="import"?"import":"export-from";if(n==="import"&&me(s))return{kind:r,specifier:s.value};if(zt.has(s?.value)&&![",","from"].includes(o?.value)||s?.value==="{"&&Qn(e,t+1)||n==="export"&&!["{","*"].includes(s?.value)||n==="import"&&s?.type!=="word"&&!["{","*"].includes(s?.value))return null;let i=es(e,t+1);return i===null?null:{kind:r,specifier:i}}function ns(e,t){let[n,s]=[e[t+2],e[t+3]];if(n?.value!==")")return me(n)&&[")",","].includes(s?.value)?n.value:null}function It(e,t=new Set){let n=Xn(e),s=[];for(let[o,r]of n.entries()){if(r.type!=="word"||[".","#","function"].includes(n[o-1]?.value)||n[o-1]?.value==="="&&n[o-3]?.value==="type"&&n[o-4]?.value==="import")continue;let i=n[o+1]?.value==="(",c=i?ns(n,o):void 0;if((r.value==="require"||t.has(r.value))&&c!==void 0)s.push({kind:"require",specifier:c,...r.value!=="require"&&{callee:r.value}});else if(r.value==="import"&&i)c!==void 0&&s.push({kind:"dynamic-import",specifier:c});else if(r.value==="import"||r.value==="export"){let a=ts(n,o);a&&s.push(a)}}return s}var ss=/^[\w$]*__d\(/gmu,os=([e,t,n,...s])=>(typeof e=="number"||typeof e=="string")&&(t===void 0||typeof t=="object")&&(n===void 0||typeof n=="string")&&s.length===0;function Rt(e){let t=/\);?\s*$/u.exec(e)?.index,n=null,s=t===void 0?-1:e.lastIndexOf("},",t);for(;s>=0&&/[\d"]/u.test(e[s+2]);){let o;try{o=JSON.parse(`[${e.slice(s+2,t)}]`)}catch{break}if(!os(o))break;n=o,s=s>0?e.lastIndexOf("},",s-1):-1}return n}function rs(e){let t=/^[^(]*\(\s*(?:function\s*[\w$]*\s*)?\(([^)]*)\)/u.exec(e)?.[1].split(",").slice(1,4).map(s=>s.trim().replaceAll("$","\\$"));if(!t?.length)return[];let n=e.matchAll(new RegExp(`(?<=[^\\w$.#]|\\.\\.\\.)(?:${t.join("|")})\\((\\d+|"(?:[^"\\\\]|\\\\.)*")[,)]`,"gu"));return[...new Set([...n].map(s=>JSON.parse(s[1])))]}function is(e,t){if(Array.isArray(e))return e;let n=Object.entries(e??{}).filter(([s])=>/^\d+$/u.test(s)).map(([,s])=>s);return n.length>0?n:rs(t)}function cs(e,t){let n=new Map(t.files.map((o,r)=>[o,r])),s=e.flatMap((o,r)=>o.file?[{k:r,at:n.get(o.file)}]:[]);for(let o=0;o<(s[0]?.k??0);o++)e[o].file=t.files[s[0].at-s[0].k+o]??null;for(let[o,{k:r,at:i}]of s.entries()){let c=s[o+1];if(!(c&&c.at-i!==c.k-r))for(let a=r+1;a<(c?.k??e.length);a++)e[a].file=t.files[i+a-r]??null}}function us(e,t){let n=[...e.matchAll(ss)].map(u=>u.index);if(n.length===0)return null;let s=$t(e),o=u=>e.slice(s[u],s[u+1]),r=[];for(let[u,f]of n.entries()){let[l]=L(s,f),[p]=L(s,(n[u+1]??e.length)-1),d=Rt(o(p));for(;!d&&p>l;)d=Rt(o(--p));if(!d)throw new Error(`bundleEdges: the Metro module at line ${l+1} ends in no define params`);let g=s[p+1]??e.length;r.push({id:d[0],file:Et(t,s,f,g),dependencies:is(d[1],e.slice(f,g))})}cs(r,t);let i=new Map(r.map(u=>[u.id,u])),{edges:c,link:a}=ce();for(let{file:u,dependencies:f}of r)for(let l of f)a(u,i.get(l)?.file,"dependency");return c}var ls=e=>e.path!==null&&!["json",null].includes(ie(e.path)),Nt=e=>e.path!==null&&ie(e.path)===null;function Ct(e){let t=/^_([A-Za-z]+)\d+$/u.exec(e)?.[1];if(t)return[t,"interopRequireDefault"];let n=/^_(interopRequire(?:Default|Wildcard)|jsx(?:Dev)?Runtime|callSuper)$/u.exec(e)?.[1];return n==="callSuper"?["getPrototypeOf","possibleConstructorReturn","interopRequireDefault"]:n?[n]:[]}var as={jsxRuntime:"react/jsx-runtime",jsxDevRuntime:"react/jsx-dev-runtime"};function fs(e){let{sources:t,names:n,nameList:s}=ae(e),o=new Map,r=new Map,i=e.files.map(()=>new Set);for(let c=0;c<n.length;c++)n[c]<0||t[c]<0||(r.has(n[c])||r.set(n[c],Ct(s[n[c]]).length>0),r.get(n[c])&&i[t[c]].add(s[n[c]]));for(let[c,a]of i.entries()){if(a.size===0)continue;let u=e.files[c],f=new Set(Array.from((u.content??"").matchAll(/(?:function|var|let|const)\s+(_[A-Za-z]+\d*)\b/gu),p=>p[1])),l=[...a].filter(p=>!f.has(p)&&!f.has(p.replace(/\d+$/u,""))).flatMap(Ct);l.length>0&&o.set(u,l.map(p=>as[p]??`@babel/runtime/helpers/${p}`))}return o}function ps(e,t){let n=new Map;for(let[r,i]of e){let c=n.get(r)??n.set(r,new Map).get(r);for(let a of i)c.set(a,ue(t,r,a,()=>null))}let s=new Set([...n.values()].flatMap(r=>[...r.values()].map(i=>i.to))),o=(r,i)=>t.byRoot.get(i).find(c=>!s.has(c))??t.byRoot.get(i)[0];return(r,i)=>{let c=n.get(r)?.get(i);return c?.to?c:ue(t,r,i,o)}}var Pt=e=>/(?:^|\/)__prelude__$/u.test(e.source??""),Lt=e=>e?.package?.name==="metro-runtime"&&e.package.path==="src/polyfills/require.js";function ds(e){if(!e.files.some(Pt)&&!Lt(e.files[0]))return null;if(!e.files.some(l=>l.content!==null&&!Pt(l)&&!Lt(l)))throw new Error("bundleEdges: the Metro map carries no sourcesContent, which its edges are read from; pass the bundle as `code`");let t=yt(e.files),n=e.files[e.files.findIndex(Nt)+1],s=e.files.find(l=>l.package?.name==="metro-runtime"&&l.package.path==="src/modules/asyncRequire.js"),o=new Map(e.files.filter(l=>l.content!==null&&ls(l)).map(l=>[l,It(l.content)])),r=fs(e),i=[...o].map(([l,p])=>[l,p.flatMap(({specifier:d})=>d===null?[]:[d])]),c=ps([...i,...r],t),{edges:a,add:u,link:f}=ce();for(let l of e.files){Nt(l)&&f(l,n,"dependency");for(let{kind:p,specifier:d}of o.get(l)??[]){let g=d===null?{to:null}:c(l,d);g.to!==l&&u(l,`${p}\0${JSON.stringify(d)}`,{from:l,kind:p,specifier:d,...g}),p==="dynamic-import"&&f(l,s,"dependency")}for(let p of r.get(l)??[])f(l,c(l,p).to,"dependency")}return a}var ms=(e,t)=>t==null?ds(e):us(t,e);function ge(e,t){let n=ms(e,t);if(!n)throw new Error(`bundleEdges: not a Metro ${t==null?"map":"bundle"}; edges-lite.js reads only those, edges.js reads others`);return{edges:n}}function Ft(e){let t=JSON.parse(e.replace(/^\)\]\}'[^\n]*\n/u,"")),n=fe(t),s=t.sections?t.sections.reduce((o,r)=>o+(r.map.names?.length??0),0):t.names?.length??null;return{json:{version:t.version,file:t.file,sourceRoot:t.sourceRoot},map:n,namesCount:s}}function F(e){if(e.map)return e.map.files.flatMap(n=>n.source===null?[]:[[n.source,n.content]]);let t=e.json?.sourcesContent??[];return(e.json?.sources??[]).map((n,s)=>[n,t[s]??null])}function gs(e,t){let n=new Map;for(let{from:s,to:o,specifier:r}of t(e).edges){if(s.source===null||o?.source==null||o.source===s.source)continue;let i=typeof r=="string"?[s.source,o.source,r]:[s.source,o.source];n.set(i.join("\0"),i)}return[...n.values()]}function hs(e){try{return ge(e)}catch{return{edges:[]}}}var bs=Object.freeze([]);function Z(e){return e?.edges?e.edges:e?.map?(e.edges=gs(e.map,hs),e.edges):bs}var he=new WeakMap,be=new WeakMap;function Zs(e){let t=Z(e);if(!he.has(t)){let n=new Map;for(let[s,o]of t)n.has(s)||n.set(s,new Set),n.get(s).add(o);he.set(t,n)}return he.get(t)}function Xs(e){let t=Z(e);if(!be.has(t)){let n=new Map;for(let[s,o,r]of t)r!==void 0&&(n.has(s)||n.set(s,new Map),n.get(s).set(r,o));be.set(t,n)}return be.get(t)}var ye=new WeakMap,we=new WeakMap,Se=new WeakMap,xe=new WeakMap,Oe=new WeakMap,$e=new WeakMap;function X(e){if(e?.metadataOnly)return new Map;let t=e?.bundle??e?.json;if(t&&ye.has(t))return ye.get(t);let n=new Map;if(!e)return n;if(e.kind==="stasis"){if(!e.bundle)return n;let s=e.bundle.formats;for(let[o,r]of e.bundle.sources)typeof r=="string"&&(S.isResourceFormat(s?.get(o))||n.set(o,r))}else if(e.kind==="sourcemap")for(let[s,o]of F(e))typeof o=="string"&&n.set(s,o);return t&&ye.set(t,n),n}function no(e){let t=1;for(let n=e.indexOf(`
|
|
5
|
-
`);n!==-1;n=e.indexOf(`
|
|
6
|
-
`,n+1))t++;return t}var Tt=new WeakMap;function so(e){let t=Tt.get(e);if(!t){let n=[...e.keys()].toSorted();t={paths:n,numbers:new Map(n.map((s,o)=>[s,o+1]))},Tt.set(e,t)}return t}function Bt(e){let t=e?.bundle??e?.json;if(t&&we.has(t))return we.get(t);let n=new Map(X(e));for(let[s,o]of e?.npmBinaries??[])n.set(s,{format:"digest",...o});if(e?.kind==="stasis"&&e.bundle){let s=e.bundle.formats;for(let[o,r]of e.bundle.sources){if(typeof r!="string")continue;let i=s?.get(o);i==="resource"?n.set(o,r):i==="resource:base64"&&n.set(o,{format:"base64",data:r})}}return t&&we.set(t,n),n}var ys="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function ws(e){let t=e.endsWith("=");if(t?e.length%4!==0||e.at(-3)==="=":e.length%4===1)return null;let n=t?e.slice(0,e.endsWith("==")?-2:-1):e;if(/[^A-Za-z0-9+/]/u.test(n))return null;let s=n.length%4;return s>1&&ys.indexOf(n.at(-1))&(s===2?15:3)?null:Math.floor(n.length*3/4)}function Ss(e){return typeof e=="string"?B(e):e?.format==="digest"?e.size:e?.format==="base64"?ws(e.data):null}function T(e){if(e?.fileSizes)return e.fileSizes;let t=e?.bundle??e?.json;if(t&&Se.has(t))return Se.get(t);let n=new Map,s=Bt(e),o=e?.kind==="stasis"?e.bundle?.sources.keys():e&&F(e).map(([r])=>r);for(let r of o??[])n.set(r,Ss(s.get(r)));return t&&Se.set(t,n),n}function ve(e){if(e?.metadataOnly)return e.unsizedFiles??new Set;let t=T(e);if($e.has(t))return $e.get(t);let n=new Set;for(let s of Bt(e).keys())t.get(s)===null&&n.add(s);return $e.set(t,n),n}function oo(e){let t=T(e);if(Oe.has(t))return Oe.get(t);let n=ve(e),s=e?.kind==="stasis"?e.bundle?.formats:null,o=new Map;for(let[r,i]of t)i===null&&!n.has(r)||o.set(r,S.isResourceFormat(s?.get(r))||e?.npmBinaries?.has(r)?"resource":"source");return Oe.set(t,o),o}function ro(e){let t=T(e),n=e?.kind==="stasis"?e.bundle?.formats:null;if(!n||n.size===0)return t;if(xe.has(t))return xe.get(t);let s=new Map;for(let[o,r]of t)S.isResourceFormat(n.get(o))||s.set(o,r);return xe.set(t,s),s}function xs(e){if(e?.kind!=="stasis"||!e.bundle?.modules)return null;let t=new Map;for(let[n,s]of e.bundle.modules)for(let o of Object.keys(s.files))t.set(n==="."?o:`${n}/${o}`,n);return t}function io(e,t=null,n=(s,o)=>o.name){let s=new Map;if(e?.kind!=="stasis"||!e.bundle?.modules)return s;let o=t===null?null:xs(e),r=t===null?null:new Set([...t].map(i=>o?.get(i)));for(let[i,c]of e.bundle.modules){if(r&&!r.has(i)||!i.includes("node_modules")||!c?.name||typeof c.version!="string"||!c.version)continue;let a=n(i,c),u=s.get(a);u||(u=new Set,s.set(a,u)),u.add(c.version)}return s}var Os=6,Ee=Os,Y=new WeakMap,$s=new Set(["terminal","code","search","compare"]);function bo(e,t=null){return!!t||$s.has(e)}var vs=/^sha512-[A-Za-z0-9+/]{86}==$/u;function Es(e){if(e.fileHashes)return Promise.resolve(e.fileHashes);if(Y.has(e))return Y.get(e);let t=(async()=>{let n=[...X(e)],s=new Map;for(let o=0;o<n.length;o+=32){let r=await Promise.all(n.slice(o,o+32).map(async([i,c])=>[i,await Ae(c)]));for(let[i,c]of r)s.set(i,c)}return e.fileHashes=s,s})();return Y.set(e,t),t.catch(()=>Y.delete(e)),t}function ks(e){if(typeof e!="string")return 0;let t=/\S/gu,n=/[\r\n]/gu,s=0;for(;t.test(e)&&(s++,n.lastIndex=t.lastIndex,!!n.test(e));)t.lastIndex=n.lastIndex;return s}function Ms(e){return e.lineCounts??=new Map([...X(e)].map(([t,n])=>[t,ks(n)]))}function ke(e){return e instanceof Map?Object.fromEntries([...e].map(([t,n])=>[t,ke(n)])):e}async function yo(e){let t=await Es(e),n=T(e),s=Ms(e),o={version:Ee,integrity:e.integrity,kind:e.kind,size:e.size,codeStats:Q(s,n),files:[...n].map(([i,c])=>[i,c,t.get(i)??null,s.get(i)??null])},r=ve(e);if(r.size>0&&(o.unsized=[...r]),e.kind==="sourcemap"){let{version:i,file:c,sourceRoot:a,names:u}=e.json,f=F(e);o.json={version:i,file:c,sourceRoot:a,sources:f.map(([p])=>p)},o.sourceSizes=f.map(([,p])=>typeof p=="string"?B(p):null),o.namesCount=e.namesCount??u?.length??null;let l=new Map(o.files.map(([p],d)=>[p,d]));o.edges=Z(e).map(([p,d,...g])=>[l.get(p),l.get(d),...g])}else{let i=e.bundle,c={version:i.version,config:i.config,repo:i.repo,package:i.package,formats:ke(i.formats),imports:ke(i.imports),reason:i.reason,executable:[...i.executable]};if(i.version===0)c.sources=Object.fromEntries([...n.keys()].map(a=>[a,null]));else{let a={},u={};for(let[f,l]of i.modules){let p=f.split("/").includes("node_modules")?a:u;Object.defineProperty(p,f,{enumerable:!0,value:{name:l.name,version:l.version,ecosystem:l.ecosystem,repo:l.repo,files:Object.fromEntries(Object.keys(l.files).map(d=>[d,null]))}})}c.modules=a,i.config.scope==="full"&&(c.sources=u,c.entries=[...i.entries])}o.bundle=c}return o}function wo(e,t){if(![1,2,3,4,5,Ee].includes(e?.version)||e.integrity!==t||!["stasis","sourcemap"].includes(e.kind)||!Number.isSafeInteger(e.size)||e.size<0||!Array.isArray(e.files))throw new Error("Invalid bundle metadata");let n=e.version!==Ee,s=e.version===1,o=new Map,r=new Map,i=new Map;for(let u of e.files){if(!Array.isArray(u)||u.length!==4&&!(s&&u.length===3))throw new Error("Invalid bundle metadata file");let[f,l,p,d]=u;if(typeof f!="string"||r.has(f)||l!==null&&(!Number.isSafeInteger(l)||l<0)||p!==null&&(typeof p!="string"||!vs.test(p))||l===null&&p!==null||s&&l!==null&&p===null||d!=null&&(!Number.isSafeInteger(d)||d<0))throw new Error("Invalid bundle metadata file");r.set(f,l),p!==null&&o.set(f,p),d!=null&&i.set(f,d)}let c=new Set(e.unsized??[]);if(e.unsized!==void 0&&(s||!Array.isArray(e.unsized)||c.size!==e.unsized.length)||[...c].some(u=>typeof u!="string"||!r.has(u)||r.get(u)!==null))throw new Error("Invalid bundle metadata");let a={integrity:t,kind:e.kind,size:e.size,metadataOnly:!0,fileSizes:r,fileHashes:o,lineCounts:i,unsizedFiles:c,stale:n};if(e.kind==="stasis"){a.bundle=S.parse(JSON.stringify(e.bundle));let u=a.bundle.sources;if(u.size!==r.size||[...u.keys()].some(l=>!r.has(l)))throw new Error("Invalid bundle metadata inventory");let f=a.bundle.formats;if(!s&&[...r].some(([l,p])=>o.has(l)!==(p!==null&&!S.isResourceFormat(f.get(l)))))throw new Error("Invalid bundle metadata inventory");if([...c].some(l=>f.get(l)!=="resource:base64"))throw new Error("Invalid bundle metadata inventory")}else{if(!e.json||typeof e.json!="object"||![null,void 0].includes(e.namesCount)&&(!Number.isSafeInteger(e.namesCount)||e.namesCount<0))throw new Error("Invalid sourcemap metadata");if(!Array.isArray(e.json.sources)||e.json.sources.some(u=>!r.has(u))||!Array.isArray(e.sourceSizes)||e.sourceSizes.length!==e.json.sources.length||e.sourceSizes.some(u=>u!==null&&(!Number.isSafeInteger(u)||u<0))||[...r].some(([u,f])=>o.has(u)!==(f!==null))||c.size>0)throw new Error("Invalid sourcemap inventory");a.json=e.json,a.sourceSizes=e.sourceSizes,a.namesCount=e.namesCount,e.edges!==void 0&&(a.edges=js(e.edges,e.files))}if(e.codeStats===void 0)a.codeStats=Q(i,r);else{let u=e.codeStats,f=l=>Number.isSafeInteger(l)&&l>=0;if(!u||![u.files,u.lines,u.bytes].every(f)||!Array.isArray(u.languages)||u.languages.some(l=>!l||typeof l.key!="string"||typeof l.label!="string"||![l.files,l.lines,l.bytes].every(f)))throw new Error("Invalid bundle code stats");a.codeStats=u}return a}function js(e,t){if(!Array.isArray(e))throw new Error("Invalid sourcemap edges");return e.map(n=>{if(!Array.isArray(n)||![2,3].includes(n.length)||n[0]===n[1]||n.length===3&&typeof n[2]!="string"||n.slice(0,2).some(s=>!Number.isSafeInteger(s)||s<0||s>=t.length))throw new Error("Invalid sourcemap edges");return[t[n[0]][0],t[n[1]][0],...n.slice(2)]})}function So(e,{integrity:t,kind:n,size:s}){if(n==="stasis")return{integrity:t,kind:n,size:s,bundle:S.parse(e)};if(n!=="sourcemap")throw new Error("Unsupported bundle format");return{integrity:t,kind:n,size:s,...Ft(e)}}export{ze as a,Q as b,Ns as c,S as d,Zs as e,Xs as f,X as g,no as h,so as i,Bt as j,Ss as k,T as l,oo as m,ro as n,xs as o,io as p,bo as q,Es as r,ks as s,Ms as t,yo as u,wo as v,So as w};
|