@preventive/triage 1.0.0-alpha.49 → 1.0.0-alpha.50
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/common/managed/finding-detail.d.ts +2 -0
- package/common/managed/finding-detail.js +32 -0
- package/common/managed/github-agents.ts +6 -3
- package/common/managed/routes.js +14 -2
- package/out/activity.js +4 -4
- package/out/{chunk-ULIF7A7N.js → chunk-2WDZPXVL.js} +1 -1
- package/out/chunk-4XMP7YVH.js +36 -0
- package/out/chunk-6S2U2UYG.js +232 -0
- package/out/{chunk-IO7JTZ6O.js → chunk-75YLHBCM.js} +1 -1
- package/out/chunk-FC65TPUB.js +1 -0
- package/out/{chunk-O6M574JI.js → chunk-FKBXNUW4.js} +1 -1
- package/out/{chunk-PBSOL2SL.js → chunk-HTBYHSPG.js} +1 -1
- package/out/{chunk-SZD5CW5R.js → chunk-UK7RGJT6.js} +2 -2
- package/out/client-managed-import.js +1 -1
- package/out/client-managed.js +2 -2
- package/out/compare.js +14 -14
- package/out/dialogs.js +34 -30
- package/out/graph.js +1 -1
- package/out/index.html +6 -6
- package/out/scan.js +2 -2
- package/out/view.css +1 -1
- package/out/view.js +15 -15
- package/package.json +4 -1
- package/server-managed/agent-merges.ts +31 -136
- package/server-managed/app-agents.ts +4 -0
- package/server-managed/commit-coauthors.ts +46 -24
- package/server-managed/http.ts +115 -37
- package/server-managed/npm-kept.ts +8 -0
- package/server-managed/public-workspace.ts +2 -2
- package/server-managed/repository-agents.ts +189 -57
- package/server-managed/repository-history.ts +51 -13
- package/server-managed/repository-pulls.ts +156 -0
- package/server-managed/repository-pulse.ts +3 -2
- package/server-managed/repository-squashes.ts +29 -6
- package/server-managed/team-reports.ts +33 -18
- package/out/chunk-BC2UCLFJ.js +0 -1
- package/out/chunk-C2AVODGZ.js +0 -36
- package/out/chunk-JEAUAJVF.js +0 -232
package/out/compare.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import{a as e,b as t,f as n,g as r,j as i,k as a,l as o}from"./chunk-TQJDYHVE.js";import{f as s}from"./chunk-4HI2MSAV.js";import"./chunk-PXK7EU4V.js";import"./chunk-R3NZFXVR.js";import{$a as c,$d as l,Ad as u,
|
|
2
|
-
`)),i>=n))return!1;return!0}function
|
|
3
|
-
`);return t.at(-1)===``&&t.pop(),t}var
|
|
4
|
-
`),
|
|
1
|
+
import{a as e,b as t,f as n,g as r,j as i,k as a,l as o}from"./chunk-TQJDYHVE.js";import{f as s}from"./chunk-4HI2MSAV.js";import"./chunk-PXK7EU4V.js";import"./chunk-R3NZFXVR.js";import{$a as c,$d as l,Ad as u,Ae as d,Bd as f,Be as p,Gd as m,Hd as h,Id as g,Jd as _,Ma as v,Md as y,Na as b,Nd as x,Oa as ee,Od as S,Pa as te,Pc as C,Qa as ne,Qc as re,Ra as ie,Rc as w,Sa as ae,Sc as oe,Ta as se,Tc as ce,Td as le,Uc as ue,Ud as de,Vd as fe,Wd as pe,Xd as me,Yd as he,Za as ge,Zd as _e,_a as ve,_c as ye,_d as be,ab as xe,ae as Se,bb as Ce,be as we,cd as Te,ce as Ee,dd as De,ed as Oe,ee as ke,fd as Ae,gd as je,hd as Me,id as Ne,ja as Pe,jd as Fe,kd as Ie,ld as Le,md as Re,od as ze,pd as Be,qd as Ve,qf as He,rd as Ue,rf as We,sd as Ge,td as Ke,uc as qe,ud as Je,va as Ye,vc as Xe,vd as Ze,w as T,wc as Qe,wd as $e,xd as et,yd as tt,zd as nt}from"./chunk-6S2U2UYG.js";import"./chunk-JCIIBLKR.js";import"./chunk-VH4XMZIW.js";import"./chunk-FKBXNUW4.js";import{$ as rt,_ as E,aa as it,ba as at,ea as ot,qa as st,s as ct,ta as lt}from"./chunk-6LNQTKAV.js";import{b as ut,c as dt,j as D,k as O}from"./chunk-7VAWINQF.js";import"./chunk-NRPC74AM.js";import"./chunk-7BKKYVWR.js";import"./chunk-7C7DWL7I.js";import"./chunk-PNHBZGDD.js";import"./chunk-VFWMQ3LG.js";import{F as k,G as ft,a as A,ta as pt}from"./chunk-4XMP7YVH.js";import"./chunk-75YLHBCM.js";import"./chunk-WCPJDAYA.js";import{e as mt}from"./chunk-IYPY47MC.js";import{a as j,d as M}from"./chunk-PWFUOLZK.js";import{g as ht,k as gt}from"./chunk-FC65TPUB.js";import{a as _t}from"./chunk-SXV2T5C4.js";import{C as vt,d as yt}from"./chunk-WFYLMF6Z.js";import"./chunk-C4Z6ZBXV.js";import{c as N,g as P,j as bt}from"./chunk-2XUEZHIP.js";import{b as xt}from"./chunk-TUII34K2.js";import"./chunk-OOJM4CTU.js";function St(e){return e===0?`±0`:`${e>0?`+`:`−`}${Math.abs(e).toLocaleString()}`}function Ct(e){return e===0?`±0 B`:`${e>0?`+`:`−`}${k(Math.abs(e))}`}function F(e){return e>0?`up`:e<0?`down`:``}function wt(e,t){if(!t)return``;let n=e/t*100;return`${n>0?`+`:n<0?`−`:`±`}${Math.abs(n).toFixed(1)}%`}function Tt(e){let t=e.totals,n=e.versionUpdates?.totals??{baseDeps:0,otherDeps:0},r=n.baseDeps>0||n.otherDeps>0,i=n.otherDeps-n.baseDeps,a=wt(t.byteDelta,t.baseBytes);return N`<div class="bundle-compare-stats">${r?N`<div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Deps</span> <span class="bundle-compare-metric-value">${n.baseDeps.toLocaleString()} → ${n.otherDeps.toLocaleString()}</span> <span class="${`bundle-compare-metric-delta ${F(i)}`}">${St(i)}</span></div>`:P}<div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Size</span> <span class="bundle-compare-metric-value">${k(t.baseBytes)} → ${k(t.otherBytes)}</span> <span class="${`bundle-compare-metric-delta ${F(t.byteDelta)}`}">${Ct(t.byteDelta)}${a?N`${` `}<span class="bundle-compare-pct">(${a})</span>`:P}</span></div>${t.baseLines>0||t.otherLines>0?N`<div class="bundle-compare-metric"><span class="bundle-compare-metric-label">LoC</span> <span class="bundle-compare-metric-value">${t.baseLines.toLocaleString()} → ${t.otherLines.toLocaleString()}</span> <span class="${`bundle-compare-metric-delta ${F(t.otherLines-t.baseLines)}`}">${St(t.otherLines-t.baseLines)}</span></div>`:P}<div class="bundle-compare-files"><div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Files</span> <span class="bundle-compare-metric-value">${t.baseFiles.toLocaleString()} → ${t.otherFiles.toLocaleString()}</span> <span class="${`bundle-compare-metric-delta ${F(t.fileDelta)}`}">${St(t.fileDelta)}</span></div><div class="bundle-compare-chips">${t.onlyBaseFiles>0?N`<span class="bundle-compare-chip removed">−${t.onlyBaseFiles.toLocaleString()} removed</span>`:P} ${t.onlyOtherFiles>0?N`<span class="bundle-compare-chip added">+${t.onlyOtherFiles.toLocaleString()} added</span>`:P} ${t.changedFiles>0?N`<span class="bundle-compare-chip changed">${t.changedFiles.toLocaleString()} changed${t.renamedFiles>0?` (${t.renamedFiles.toLocaleString()} renamed)`:``}</span>`:P} <span class="bundle-compare-chip unchanged">${t.unchangedFiles.toLocaleString()} unchanged</span> ${e.resolutions?.totalChanges>0?N`<span class="bundle-compare-chip changed">${e.resolutions.totalChanges.toLocaleString()} repointed ${e.resolutions.totalChanges===1?`resolution`:`resolutions`}</span>`:P}</div></div></div>`}var Et=24;function I(e,t=e=>e.id){return e.map(e=>({id:t(e),integrity:t(e),kind:e.format,format:e.format,detail:e.detail,...e.date&&{date:e.date},...e.dateWarning&&{dateWarning:e.dateWarning},filename:e.name,displayLabel:e.displayLabel,size:`—`,summary:null}))}function Dt(e){if(!e)return P;let t=({name:e=``,detail:t=``}={})=>e.length+Math.min(t.length,Et)*.87+1,n=(e.choices??[]).reduce((e,n)=>Math.max(e,t(n)),Math.max(`Choose a ${e.noun??`bundle`}\u2026`.length,t(e.widest)));return j({"--compare-select-chars":`${Math.ceil(n)}`})}function Ot({source:e,label:t=`Compare`,from:n,to:r,clear:i,swap:a,extras:o=P,comparison:s=null,disabled:c=!1,openLine:l}){let u=e?.noun??`bundle`,d=`${u[0].toUpperCase()}${u.slice(1)}`,f=(t,n)=>e?.select?e.select(t,t.label??n):N`<bundle-selector .bundles="${t.options}" .value="${t.value}" .noun="${u}" .versions="${!!e}" label="${t.label??n}" placeholder="${t.placeholder??`Choose a ${u}\u2026`}" ?disabled="${c}" @bundle-change="${e=>{e.stopPropagation(),t.pick(e.detail.value)}}"></bundle-selector>`;return N`<div class="${e?`bundle-compare-picker is-versions`:`bundle-compare-picker`}" style="${Dt(e)}" @compare-open-line="${e=>l?.(e.detail)}"><div class="bundle-compare-select-wrap"><span class="bundle-compare-select-hint">${t}</span> ${f(n,`${d} to compare with`)} ${i?N`<button type="button" class="bundle-compare-clear" aria-label="${i.label??`Clear comparison`}" ?disabled="${c}" @click="${i.run}">×</button>`:P}</div><span class="bundle-compare-arrow" aria-hidden="true">→</span><div class="bundle-compare-select-wrap">${f(r,`${d} to compare`)} ${a?N`<button type="button" class="bundle-compare-swap" ?disabled="${c}" @click="${a}" aria-label="${`Swap the two ${u}s`}"><span class="bundle-compare-swap-icon" aria-hidden="true">↔</span>Swap</button>`:P}</div>${o}${s?e?.badges?.(s.base,s.other,s.files)??P:P}</div>`}function kt(e,t=P){return N`<div class="bundle-compare-summary">${Tt(e)}${t}</div>`}function At(e,t=P){return N`<header class="bundle-compare-head">${e}${t}</header>`}var jt=4,Mt=5e3,Nt=3e5,Pt=e=>!(e>=400&&e<500&&e!==429),Ft=e=>e?.integrity===`(empty)`,L=new Map;function It(){for(let[e,t]of L){if(L.size<=jt)break;t.state.status!==`loading`&&L.delete(e)}}function Lt(e){e.notify?.();for(let t of e.waiting.splice(0))t()}var Rt=null,zt=(e,t)=>!!(e.managedId&&t.managedId)||!!(t.npm&&(e.npm||Ft(e)));function Bt(e,t,n){return e.managedId&&t.managedId?ae(e.managedId,t.managedId,{scope:n}):zt(e,t)?se(t.npm.name,t.npm.version,e.npm?.version??`(empty)`,{otherName:e.npm?.name??t.npm.name}):import(`./chunk-WYLQWYLA.js`).then(r=>(Rt=r,r.prepareComparison(e,t,n)))}async function Vt(e,t,n,r,i){let a;try{a={status:`ready`,diff:await Bt(n,r,i)}}catch(n){if(n?.name===`AbortError`){L.get(e)===t&&L.delete(e),Lt(t);return}if(a={status:`error`,message:n?.message??String(n)},Pt(n?.status)){let e=Math.min(Mt*2**t.failures,Nt);Object.assign(t,{retryAt:Date.now()+e,failures:t.failures+1}),setTimeout(()=>{t.notify?.()},e)?.unref?.()}}a.status===`ready`&&(t.failures=0),t.state=a,Lt(t),It()}var Ht=new WeakMap,Ut=0,Wt=e=>(Ht.has(e)||Ht.set(e,++Ut),Ht.get(e));function Gt(e,t,n,r=!1){let i=zt(e,t)?`${e.integrity}\0${t.integrity}\0${n??``}`:`${Wt(e)}\0${Wt(t)}\0${n??``}\0here`,a=L.get(i);return L.delete(i),(!a||r&&a.state.status===`error`||a.retryAt!==void 0&&Date.now()>=a.retryAt)&&(a={state:{status:`loading`},notify:a?.notify??null,waiting:[],failures:a?.failures??0},Rt&&!zt(e,t)?a.state={status:`ready`,diff:Rt.prepareComparison(e,t,n??``)}:Vt(i,a,e,t,n??``)),L.set(i,a),It(),a}function Kt(e,t,n,r){let i=Gt(e,t,n);return i.notify=r,i.state}function qt(e,t,n=null){return new Promise((r,i)=>{let a=(o=!1)=>{let s=Gt(e,t,n,o),{state:c}=s;c.status===`loading`?s.waiting.push(()=>a()):c.status===`ready`?r(c.diff):i(Error(c.message))};a(!0)})}function Jt(e,t){let{head:n,from:i,to:a,tail:o}=r(e,t);return N`${n}{<span class="bundle-compare-rename-from">${i}</span> → <span class="bundle-compare-rename-to">${a}</span>}${o}`}function Yt({from:e,to:t}){return N`<span class="bundle-compare-rename-from">${e}</span> → <span class="bundle-compare-rename-to">${t}</span>`}function Xt(e){let t=new Map;if(!e)return t;for(let n of e.onlyBase)t.set(n.path,{kind:`removed`,basePath:n.basePath,baseBytes:n.bytes,otherBytes:null});for(let n of e.onlyOther)t.set(n.path,{kind:`added`,baseBytes:null,otherBytes:n.bytes});for(let n of e.changed){let e={...n.meta?{meta:n.meta}:{}};t.set(n.path,n.renamedFrom==null?{kind:`changed`,basePath:n.basePath,baseBytes:n.baseBytes,otherBytes:n.otherBytes,...n.modified===!1?{modified:!1}:{},...e}:{kind:`renamed`,basePath:n.basePath,renamedFrom:n.renamedFrom,modified:n.modified,baseBytes:n.baseBytes,otherBytes:n.otherBytes,...e})}return t}function R(e,t,n,{kind:r,basePath:i=n}){let a=r===`added`?``:D(e).get(i),o=r===`removed`?``:D(t).get(n);return r===`repointed`&&(a=o??=a),{before:a,after:o}}function Zt(e,t,n,r=[]){let i=Xt(n);if(!n)return i;for(let n of r){if(!i.has(n.parent)){let r=O(D(t).get(n.parent)??D(e).get(n.parent));i.set(n.parent,{kind:`repointed`,baseBytes:r,otherBytes:r})}let r=i.get(n.parent);r.repointed=[...r.repointed??[],n]}return i}function Qt(e,t,n){return[...Zt(e,t,n.files,n.resolutions?.changed)].map(([n,r])=>({path:n,...r,...R(e,t,n,r)}))}function $t(e,{maxBytes:t,maxLines:n}){let r=0,i=0;for(let{before:a,after:o}of e)for(let e of[a,o])if(r+=O(e)??0,r>=t||(typeof e==`string`&&e!==``&&(i+=(e.match(/\n/gu)?.length??0)+ +!e.endsWith(`
|
|
2
|
+
`)),i>=n))return!1;return!0}function z(e){if(e===``)return[];let t=e.split(`
|
|
3
|
+
`);return t.at(-1)===``&&t.pop(),t}var en=e=>e===``||e.endsWith(`
|
|
4
|
+
`),tn=e=>e.replace(/[ \t\n\v\f\r]+$/u,``).replaceAll(/[ \t\n\v\f\r]+/gu,` `);function B(e,t,n=!1){return s(e,t,{horizon:0,whitespace:n?`change`:`none`}).map(({a0:e,a1:t,b0:n,b1:r})=>({a0:e,a1:t,b0:n,b1:r}))}function nn(e,t,n,r=!1){if(!Array.isArray(n))return!1;let i=z(e),a=z(t),o=r?(e,t)=>tn(e)===tn(t):(e,t)=>e===t,s=0,c=0;for(let l of[...n,{a0:i.length,a1:i.length,b0:a.length,b1:a.length,last:!0}]){let{a0:n,a1:u,b0:d,b1:f}=l??{};if(![n,u,d,f].every(Number.isInteger)||n<s||d<c||u<n||f<d||u>i.length||f>a.length||!l.last&&u===n&&f===d||n-s!==d-c||l.last&&n>s&&!r&&en(e)!==en(t))return!1;for(;s<n;s++,c++)if(!o(i[s],a[c]))return!1;s=u,c=f}return!0}var rn=3,V=20,an=4;function on(e,t,{ignoreWhitespace:n=!1,changes:r=null,marks:i=null}={}){let a=z(e),o=z(t),s=r?.blocks??B(e,t,n),c={a:e!==``&&!e.endsWith(`
|
|
5
5
|
`),b:t!==``&&!t.endsWith(`
|
|
6
|
-
`)};return{a,b:o,blocks:s,...
|
|
6
|
+
`)};return{a,b:o,blocks:s,...sn(s,i),noEol:c,words:new Map}}function sn(e,t){let n=new Set((t??[]).map(({a0:e,a1:t,b0:n,b1:r})=>`${e},${t},${n},${r}`)),r=new Set,i=0,a=0,o=0;return e.forEach(({a0:e,a1:t,b0:s,b1:c},l)=>{n.has(`${e},${t},${s},${c}`)&&t-e===c-s?(r.add(l),o+=c-s):(i+=c-s,a+=t-e)}),{additions:i,deletions:a,renamed:o,marked:r}}var cn=2e6,ln=2e4,un=e=>{let t=+(e!==``&&!e.endsWith(`
|
|
7
7
|
`));for(let n=e.indexOf(`
|
|
8
8
|
`);n!==-1;n=e.indexOf(`
|
|
9
|
-
`,n+1))t++;return t};function
|
|
10
|
-
`,1)[0])}function yn(e,t=new Map,{context:n=an,split:r=!1}={}){let{a:i,blocks:a}=e,o=[],s=0,c=0;for(let l=0;l<=a.length;l++){let u=a[l],d=(u?u.a0:i.length)-s,f=l===0,p=l===a.length,m=t.get(l),h=f?0:n+(m?.top??0),g=p?0:n+(m?.bottom??0);if(m?.all||d-h-g<on)for(let e=0;e<d;e++)o.push({kind:`ctx`,a:s+e,b:c+e});else{for(let e=0;e<h;e++)o.push({kind:`ctx`,a:s+e,b:c+e});o.push({kind:`fold`,run:l,a:s+h,b:c+h,count:d-h-g,up:!p,down:!f});for(let e=d-g;e<d;e++)o.push({kind:`ctx`,a:s+e,b:c+e})}if(!u)break;let _=Sn(e,l);if(r)for(let[e,t,n]of _)o.push({kind:`change`,change:l,left:e,right:t,paired:n});else{let e=new Map,t=new Map;for(let[n,r,i]of _)i&&(e.set(n,r),t.set(r,n));for(let t=u.a0;t<u.a1;t++)o.push({kind:`del`,a:t,change:l,pair:e.get(t)??null});for(let e=u.b0;e<u.b1;e++)o.push({kind:`add`,b:e,change:l,pair:t.get(e)??null})}s=u.a1,c=u.b1}return o}function bn(e,t){return xn(e.a,e.b,t)}function xn(e,n,r){let i=t(e.slice(r.a0,r.a1),n.slice(r.b0,r.b1)).map(([e,t])=>[r.a0+e,r.b0+t]),a=[],o=r.a0,s=r.b0;for(let[e,t]of[...i,[r.a1,r.b1]]){for(;o<e||s<t;)a.push([o<e?o++:null,s<t?s++:null,!1]);e<r.a1&&(a.push([e,t,!0]),o=e+1,s=t+1)}return a}function Sn(e,t){return e.aligned??=new Map,e.aligned.has(t)||e.aligned.set(t,bn(e,e.blocks[t])),e.aligned.get(t)}function Cn(e,t,n=`<mark class="diff-word">`,r=`</mark>`){if(!t||t.length===0)return e;let i=!1,a=``,o=0,s=0,c=()=>{for(;s<t.length&&o>=t[s][1];)i&&=(a+=r,!1),s++};for(let l=0;l<e.length;){if(c(),e[l]===`<`){let t=e.indexOf(`>`,l),o=t===-1?e.slice(l):e.slice(l,t+1);a+=i?r+o+n:o,l+=o.length;continue}!i&&s<t.length&&o>=t[s][0]&&(a+=n,i=!0);let u=e[l]===`&`?e.indexOf(`;`,l):-1,d=u===-1||u-l>10?e[l]:e.slice(l,u+1);a+=d,l+=d.length,o++}return c(),i?a+r:a}function wn(e,t){if(!t||t.length===0)return[{text:e,marked:!1}];let n=[],r=0;for(let[i,a]of t)i>r&&n.push({text:e.slice(r,i),marked:!1}),a>i&&n.push({text:e.slice(i,a),marked:!0}),r=a;return r<e.length&&n.push({text:e.slice(r),marked:!1}),n}var Tn=100,En=20;function V(e,t,n=En,r=0,i=e.length){let a=[];for(let o=r;o<Math.min(i,e.length)&&a.length<n;o++){let n=t.ranges(e[o]);n.length>0&&a.push({line:o,text:e[o],ranges:n})}return a}var Dn=(e,t,n,r)=>xn(e,t,r);function On(e,t,n,r,{split:i=!1,align:a=Dn}={}){return e===t?V(R(t),n).map(e=>({...e,side:`b`,sign:` `})):e===``?V(R(t),n).map(e=>({...e,side:`b`,sign:`+`})):t===``?V(R(e),n).map(e=>({...e,side:`a`,sign:`−`})):kn(R(e),R(t),n,r,i,a)}function kn(e,t,n,r,i,a){let o=V(t,n);if(!r)return o.map(e=>({...e,side:`b`,sign:null}));let s=(e,t)=>{let[n,i]=e===`a`?[`a0`,`a1`]:[`b0`,`b1`],a=r.length,o=0;for(;o<a;){let e=o+a>>1;r[e][i]<=t?o=e+1:a=e}return o<r.length&&r[o][n]<=t?r[o]:null},c=[];for(let{a0:t,a1:i}of r){if(c.length===En)break;c.push(...V(e,n,En-c.length,t,i))}let l=new Map;if(i){let n=new Set([...o.map(({line:e})=>s(`b`,e)),...c.map(({line:e})=>s(`a`,e))]);for(let i of n)i&&a(e,t,r,i).forEach(([e,t],n)=>{e!==null&&l.set(`a${e}`,n),t!==null&&l.set(`b${t}`,n)})}let u=e=>{let t=s(e.side,e.line);return t?i?[t.b0,0,l.get(`${e.side}${e.line}`),e.side===`a`?0:1]:e.side===`a`?[t.b0,0,0,e.line]:[e.line,1,0,0]:[e.line,1,0,0]};return[...o.map(e=>({...e,side:`b`,sign:s(`b`,e.line)?`+`:` `})),...c.map(e=>({...e,side:`a`,sign:`−`}))].toSorted((e,t)=>{let n=u(e),r=u(t);return n[0]-r[0]||n[1]-r[1]||n[2]-r[2]||n[3]-r[3]}).slice(0,En)}function An(e,t,n,{split:r=!1,align:i=Dn}={}){let a=[],o=0,s=e=>e!==``&&t.ranges(e).length>0;for(let{path:c,before:l,after:u}of e){if(typeof l!=`string`||typeof u!=`string`||!s(l)&&(l===u||!s(u)))continue;let e;if(l===u||l===``||u===``)e=On(l,u,t,null);else{let a=R(l),o=R(u),s=n(c,l,u);if(s?.length===0)continue;e=kn(a,o,t,s,r,i)}if(e.length!==0){if(a.length===Tn)return{files:a,hits:o,truncated:!0};a.push({path:c,hits:e}),o+=e.length}}return{files:a,hits:o,truncated:!1}}var jn=2,Mn=2,Nn=5e3,Pn=3e5,Fn=30,In=`The server's diff doesn't match this file as shown.`,Ln=(e,t)=>!!(e?.managedId&&t?.managedId)||!!e?.npm&&!!t?.npm&&e.npm.name===t.npm.name,Rn=e=>!(e>=400&&e<500&&e!==429),H=new Map;function zn(e,t,n){let{before:r,reason:i,reads:a,prettyHash:o,otherPrettyHash:s,ignoringWhitespace:c}=e??{},l=[e,c].map(e=>Array.isArray(e?.blocks)&&Array.isArray(e.marks)?{blocks:e.blocks,marks:e.marks}:null);if(!(e?.hash===t&&e.otherHash===n&&typeof r==`string`&&(i==null||typeof i==`string`)&&Array.isArray(a)&&a.every(e=>typeof e==`string`)&&l.every(Boolean)&&typeof o==`string`&&typeof s==`string`))return null;let u=l.map(e=>({status:`ready`,before:r,...e,reason:i??null,reads:a}));return{status:`ready`,before:r,reason:i??null,reads:a,copies:[o,s],settings:u}}var Bn=(e,t,n)=>e.fileHashes?.get(t)??vt(n),Vn=new Set;function Hn(e){e&&(Vn.size===0&&setTimeout(()=>{let e=[...Vn];Vn.clear();for(let t of e)t()},Fn),Vn.add(e))}function Un(e,t,n=0){let r=Math.min(Nn*2**n,Pn);return Object.assign(t,{until:Date.now()+r,tries:n+1}),setTimeout(()=>{e.notify?.()},r)?.unref?.(),t}function Wn(){for(let[e,t]of H){if(H.size<=jn)break;t.ended&&H.delete(e)}}async function Gn(e,t,n,r,i){let a=null;try{let e=async({path:e,otherPath:i,hash:a,otherHash:o,status:s,message:c,...l})=>{if(typeof e!=`string`||typeof i!=`string`)return;let u=`${e}\0${i}`,d=t.diffs.get(u);if((d?.status??`loading`)!==`loading`)return;let[f,p]=[E(n).get(e),E(r).get(i)],m=c===void 0?typeof f==`string`&&typeof p==`string`&&zn({...l,hash:a,otherHash:o},await Bn(n,e,f),await Bn(r,i,p)):!Rn(s)&&{status:`error`,message:c,retry:!1};!m||t.diffs.get(u)!==d||(m.tries=t.diffs.get(u)?.tries,t.diffs.set(u,m),Hn(t.notify))};await(n.npm?te(n.npm.name,n.npm.version,r.npm.version,e):b(n.managedId,r.managedId,e,{scope:i}))}catch(n){if(n?.name===`AbortError`){H.get(e)===t&&H.delete(e);return}a={status:`error`,message:n?.message??String(n),retry:Rn(n?.status)}}Object.assign(t,{ended:!0,rest:a}),a?.retry&&Un(t,a,t.tries),Hn(t.notify),Wn()}var Kn=0,qn=[];async function Jn(e){Kn<Mn?Kn++:await new Promise(e=>{qn.push(e)});try{return await e()}finally{let e=qn.shift();e?e():Kn--}}async function Yn(e,t,n,r,i,a,o,s,c){let l;try{let[e,t]=await Promise.all([Bn(r,i,a),Bn(o,s,c)]),u={path:i,hash:e,otherPath:s,otherHash:t};l=zn(await Jn(()=>r.npm?v(r.npm.name,r.npm.version,o.npm.version,u):g(r.managedId,o.managedId,u)),e,t)??{status:`error`,message:In,retry:!0},l.tries=n.tries}catch(r){if(r?.name===`AbortError`){e.diffs.get(t)===n&&e.diffs.delete(t);return}l={status:`error`,message:r?.message??String(r),retry:Rn(r?.status)}}e.diffs.get(t)===n&&(l.status===`error`&&l.retry&&Un(e,l,n.tries),e.diffs.set(t,l),Hn(e.notify))}function Xn(e,t,n,r,i,a,o,s,c,l=!1,u=``){let d=`${e.integrity}\0${r.integrity}\0${u}`,f=H.get(d);if(H.delete(d),(!f||f.rest?.until!==void 0&&Date.now()>=f.rest.until)&&(f={diffs:f?.diffs??new Map,notify:null,ended:!1,rest:null,tries:f?.rest?.tries},Gn(d,f,e,r,u)),H.set(d,f),Wn(),f.notify=s,n!==E(e).get(t)||a!==E(r).get(i))return{status:`error`,message:In,retry:!1};let p=`${t}\0${i}`,m=f.diffs.get(p);if(!m&&!f.ended&&!l)return{status:`loading`};if(!m&&f.rest)return f.rest;if(m?.status===`ready`){if(m.copies[0]===c?.[0]&&m.copies[1]===c?.[1])return m.tries=0,m.settings[Number(o)];m=Un(f,{status:`error`,message:In,retry:!0},m.tries),f.diffs.set(p,m)}if(m&&!(m.status===`error`&&m.until!==void 0&&Date.now()>=m.until))return m;let h={status:`loading`,tries:m?.tries};return f.diffs.set(p,h),Yn(f,p,h,e,t,n,r,i,a),h}function Zn(){for(let[e,t]of H)if(t.rest?.retry)H.delete(e);else for(let[e,n]of t.diffs)n.status===`error`&&n.retry&&t.diffs.delete(e)}var Qn=2,$n=5e3,er=3e5,tr=new Set([`ts`,`mts`,`cts`]),nr=e=>!(e>=400&&e<500&&e!==429),rr=(e,t)=>`${e??``}\0${t??``}`,U=new Map,ir=new Map;function ar(){for(let[e,t]of U){if(U.size<=Qn)break;t.ended&&U.delete(e)}}async function or(e,t,n){if(t===null)return n===null;let r=typeof t==`string`?E(e).get(t):void 0;return typeof r==`string`&&n===await(e.fileHashes?.get(t)??vt(r))}async function sr(e,t,n,r,i){let a=!1,o=new Set;try{let e=async({path:e,hash:t,otherPath:i,otherHash:a})=>{e===void 0||i===void 0||(e??i)===null||await or(n,e,t)&&await or(r,i,a)&&o.add(rr(e,i))};await(n.npm?ie(n.npm.name,n.npm.version,r.npm.version,e):ne(n.managedId,r.managedId,e,{scope:i}))}catch(n){if(n?.name===`AbortError`){U.get(e)===t&&U.delete(e);return}a=nr(n?.status)}if(Object.assign(t,{files:o,ended:!0}),a){let n=ir.get(e)??0;ir.set(e,n+1),setTimeout(()=>{U.get(e)===t&&(U.delete(e),t.notify?.())},Math.min($n*2**n,er))?.unref?.()}else ir.delete(e);t.notify?.(),ar()}function cr(e,t,n,{kind:r,basePath:i=n},{before:a,after:o},s,c=``){if(r===`repointed`||!Ln(e,t))return!1;let l=[r===`added`?null:i,r===`removed`?null:n];if(!l.every(e=>e===null||tr.has(Ve(e)))||l[0]!==null&&a!==E(e).get(i)||l[1]!==null&&o!==E(t).get(n))return!1;let u=`${e.integrity}\0${t.integrity}\0${c}`,d=U.get(u);return U.delete(u),d||(d={files:new Set,notify:null,ended:!1},sr(u,d,e,t,c)),U.set(u,d),ar(),d.notify=s,d.files.has(rr(...l))}function lr(e,t){let n=t===void 0?`The bundle records no format for it now`:`The bundle loads it as ${t}`,r=e===void 0?`no format recorded before`:t===void 0?`${e} before`:`as ${e} before`,[i,a]=[dt.isResourceFormat(e),dt.isResourceFormat(t)];return`${n}, ${r}${i===a?``:i?`, carried as data before, run as code now`:`, run as code before, carried as data now`}`}function ur(e=[],t=!1){return e.map(({field:e,from:n,to:r})=>e===`format`?M`<span class="bundle-compare-code-meta">${t?`format`:`${n??`none`} \u2192 ${r??`none`}`}</span>`:M`<span class="${`bundle-compare-code-meta${r?``:` is-dropped`}`}">${e===`executable`?r?`+x`:`−x`:r?`new entry`:`entry`}</span>`)}var dr=(e=[])=>e.filter(({field:e,to:t})=>e===`format`||t).map(({field:e,from:t,to:n})=>({name:e===`format`?`${t??`none`} \u2192 ${n??`none`}`:e===`executable`?`+x`:`new entry`,severity:`high`}));function fr(e=[]){return e.map(({field:e,from:t,to:n})=>e===`format`?`${lr(t,n)}.`:e===`executable`?n?`It is now executable.`:`It is no longer executable.`:n?`It is now an entry point of the bundle.`:`It is no longer an entry point of the bundle.`).join(` `)}var pr=[{kind:`changed`,label:`Modified`,letter:`M`},{kind:`renamed`,label:`Renamed`,letter:`→`},{kind:`added`,label:`Added`,letter:`A`},{kind:`removed`,label:`Removed`,letter:`D`},{kind:`repointed`,label:`Repointed`,letter:`R`}],mr=Object.fromEntries(pr.map(e=>[e.kind,e])),W=2e3,hr=1e5,gr=16777216,_r=24,vr=3,yr=300,br=30,xr=[{mode:`files`,label:`Filter files`,placeholder:`Filter changed files`,icon:ue},{mode:`code`,label:`Search code`,placeholder:`Search changed code`,icon:fe}],Sr=B/2,Cr=65536,wr=new WeakSet,Tr={large:`A large diff, not shown yet: the lines it removed aren't searched.`,printed:`Shown pretty-printed: its lines as published, unsigned, the lines it removed not searched.`,numbered:`Shown pretty-printed: its lines numbered as published.`},Er={"+":{name:`add`,label:`Added`},"−":{name:`del`,label:`Removed`}," ":{name:`ctx`,label:`Unchanged`}},G={layout:`unified`,ignoreWhitespace:!1,ignoreRenames:!1,ignoreTypes:!1},Dr=()=>`${G.ignoreWhitespace}\0${G.ignoreRenames}`,Or=`Hide renamed names`,kr=`Hide type-only changes`,Ar=`Hide whitespace changes`,jr=()=>`${!!w.bundleSourcePretty}\0${G.ignoreWhitespace}\0${G.ignoreRenames}\0${G.ignoreTypes}`,Mr=({pretty:e,spacesHidden:t,hiding:n,typesHidden:r})=>[e?.status===`ready`&&`Pretty-print`,t&&Ar,n&&Or,r&&kr].filter(Boolean),Nr={mixed:`Whitespace changes are shown: hiding them would hide blanks of more than one kind changing.`},Pr=(e,t)=>e?.kind===`stasis`?e.bundle?.formats?.get(t):void 0,Fr=e=>/\.[cm]?js$/iu.test(e),Ir=(e,{ignoreRenames:t}=G)=>t&&Fr(e),Lr=(e,t,n)=>Ue(e,t,n).category===`minified`,Rr=`A license file`,zr=new WeakMap;function Br(e){let t=zr.get(e);if(t)return t;t=new Map;let n=(e,n,r)=>{e&&t.set(e,[...t.get(e)??[],{label:n,note:r}])};if(e?.kind===`stasis`)for(let t of e.bundle?.entries??[])n(t,`entry`,`An entry point of the bundle`);let r=e?.npm?.manifest;if(r){let t=new Set(E(e).keys());for(let e of[`main`,`module`,`types`])typeof r[e]==`string`&&n(p(r[e],t),e,`package.json "${e}": ${r[e]}`);for(let[e,i]of Object.entries(r.bin??{}))typeof i==`string`&&n(p(i,t),`bin`,`package.json "bin" ${e}: ${i}`);let i=Map.groupBy(typeof r.license==`string`?h(r.license,[...t]).filter(e=>e.file):[],e=>e.file);for(let e of t)m.test(e)&&n(e,`license`,i.has(e)?`License: ${i.get(e).map(e=>e.text).join(`, `)}`:Rr)}else for(let t of E(e).keys())m.test(t.slice(t.lastIndexOf(`/`)+1))&&n(t,`license`,Rr);return zr.set(e,t),t}var Vr=/(?:^|\/)package\.json$/u,Hr=new WeakMap;function Ur(e,t,n){let r=Hr.get(e);return r||Hr.set(e,r=new Map),r.has(t)||r.set(t,f(n,E(e).has(`${t.slice(0,-12)}binding.gyp`))),r.get(t)}var Wr={unparsed:`the file couldn't be parsed`,dynamic:`the file reads names by their spelling (eval or with)`,jsx:`the file holds JSX`,"block-function":`the file declares a function in a block outside strict code`,unverified:`the old side with the new names couldn't be checked to read as before`},Gr=e=>`Renamed names are hidden, though the file reads ${e.map(e=>`.${e}`).join(`, `)}, which a rename may change.`,Kr=(e,t,n=G)=>`${e}\0${n.ignoreWhitespace}\0${Ir(e,n)}\0${!!n.markRenames}\0${t}`,qr=new Map,Jr=new Set,Yr=new WeakMap;function Xr(e){let t=0;for(let n=e.indexOf(`
|
|
9
|
+
`,n+1))t++;return t};function dn(e,t){if(typeof e!=`string`||typeof t!=`string`)return null;if(e===t)return{additions:0,deletions:0};if(e===``)return{additions:un(t),deletions:0};if(t===``)return{additions:0,deletions:un(e)};if(e.length+t.length>cn||un(e)+un(t)>ln)return null;let n=0,r=0;for(let{a0:i,a1:a,b0:o,b1:s}of B(e,t))n+=s-o,r+=a-i;return{additions:n,deletions:r}}var fn=(e,t,n=B(e,t,!0))=>!nn(e,t,n);function pn(e,t){let r=B(e,t,!0);return{hides:fn(e,t,r),mixed:n(e,t,r)}}var mn=new Set([`module`,`commonjs`,`module-typescript`,`commonjs-typescript`,`json`,`solidity`,`php`,`shell`,`rust`,`java`,`kotlin`,`gradle`,`objc`,`objcpp`,`swift`,`c`,`cpp`,`c-header`,`cpp-header`,`xml`,`cmake`,`pbxproj`]),hn=/\.(?:[cm]?js|jsx|[cm]?ts|tsx|json5?|jsonc|css|scss|less|html?|xhtml|xml|svg|c|h|cc|cpp|cxx|hh|hpp|hxx|java|kts?|go|rs|cs|swift|php|sh|bash|zsh)$/u,gn=new Set([`#!/usr/bin/env node`,`#! /usr/bin/env node`,`#!/usr/bin/node`,`#!/usr/local/bin/node`,`#!/usr/bin/env nodejs`,`#!/usr/bin/env deno`,`#!/usr/bin/env bun`,`#!/bin/sh`,`#! /bin/sh`,`#!/bin/sh -e`,`#!/usr/bin/env sh`,`#!/bin/bash`,`#! /bin/bash`,`#!/bin/bash -e`,`#!/usr/bin/env bash`,`#!/bin/zsh`,`#!/usr/bin/env zsh`,`#!/bin/dash`]);function _n(e,t=``,n=void 0){return typeof n==`string`?mn.has(n):hn.test(e.toLowerCase())||typeof t==`string`&&gn.has(t.split(`
|
|
10
|
+
`,1)[0])}function vn(e,t=new Map,{context:n=rn,split:r=!1}={}){let{a:i,blocks:a}=e,o=[],s=0,c=0;for(let l=0;l<=a.length;l++){let u=a[l],d=(u?u.a0:i.length)-s,f=l===0,p=l===a.length,m=t.get(l),h=f?0:n+(m?.top??0),g=p?0:n+(m?.bottom??0);if(m?.all||d-h-g<an)for(let e=0;e<d;e++)o.push({kind:`ctx`,a:s+e,b:c+e});else{for(let e=0;e<h;e++)o.push({kind:`ctx`,a:s+e,b:c+e});o.push({kind:`fold`,run:l,a:s+h,b:c+h,count:d-h-g,up:!p,down:!f});for(let e=d-g;e<d;e++)o.push({kind:`ctx`,a:s+e,b:c+e})}if(!u)break;let _=xn(e,l);if(r)for(let[e,t,n]of _)o.push({kind:`change`,change:l,left:e,right:t,paired:n});else{let e=new Map,t=new Map;for(let[n,r,i]of _)i&&(e.set(n,r),t.set(r,n));for(let t=u.a0;t<u.a1;t++)o.push({kind:`del`,a:t,change:l,pair:e.get(t)??null});for(let e=u.b0;e<u.b1;e++)o.push({kind:`add`,b:e,change:l,pair:t.get(e)??null})}s=u.a1,c=u.b1}return o}function yn(e,t){return bn(e.a,e.b,t)}function bn(e,n,r){let i=t(e.slice(r.a0,r.a1),n.slice(r.b0,r.b1)).map(([e,t])=>[r.a0+e,r.b0+t]),a=[],o=r.a0,s=r.b0;for(let[e,t]of[...i,[r.a1,r.b1]]){for(;o<e||s<t;)a.push([o<e?o++:null,s<t?s++:null,!1]);e<r.a1&&(a.push([e,t,!0]),o=e+1,s=t+1)}return a}function xn(e,t){return e.aligned??=new Map,e.aligned.has(t)||e.aligned.set(t,yn(e,e.blocks[t])),e.aligned.get(t)}function Sn(e,t,n=`<mark class="diff-word">`,r=`</mark>`){if(!t||t.length===0)return e;let i=!1,a=``,o=0,s=0,c=()=>{for(;s<t.length&&o>=t[s][1];)i&&=(a+=r,!1),s++};for(let l=0;l<e.length;){if(c(),e[l]===`<`){let t=e.indexOf(`>`,l),o=t===-1?e.slice(l):e.slice(l,t+1);a+=i?r+o+n:o,l+=o.length;continue}!i&&s<t.length&&o>=t[s][0]&&(a+=n,i=!0);let u=e[l]===`&`?e.indexOf(`;`,l):-1,d=u===-1||u-l>10?e[l]:e.slice(l,u+1);a+=d,l+=d.length,o++}return c(),i?a+r:a}function Cn(e,t){if(!t||t.length===0)return[{text:e,marked:!1}];let n=[],r=0;for(let[i,a]of t)i>r&&n.push({text:e.slice(r,i),marked:!1}),a>i&&n.push({text:e.slice(i,a),marked:!0}),r=a;return r<e.length&&n.push({text:e.slice(r),marked:!1}),n}var wn=100,Tn=20;function H(e,t,n=Tn,r=0,i=e.length){let a=[];for(let o=r;o<Math.min(i,e.length)&&a.length<n;o++){let n=t.ranges(e[o]);n.length>0&&a.push({line:o,text:e[o],ranges:n})}return a}var En=(e,t,n,r)=>bn(e,t,r);function Dn(e,t,n,r,{split:i=!1,align:a=En}={}){return e===t?H(z(t),n).map(e=>({...e,side:`b`,sign:` `})):e===``?H(z(t),n).map(e=>({...e,side:`b`,sign:`+`})):t===``?H(z(e),n).map(e=>({...e,side:`a`,sign:`−`})):On(z(e),z(t),n,r,i,a)}function On(e,t,n,r,i,a){let o=H(t,n);if(!r)return o.map(e=>({...e,side:`b`,sign:null}));let s=(e,t)=>{let[n,i]=e===`a`?[`a0`,`a1`]:[`b0`,`b1`],a=r.length,o=0;for(;o<a;){let e=o+a>>1;r[e][i]<=t?o=e+1:a=e}return o<r.length&&r[o][n]<=t?r[o]:null},c=[];for(let{a0:t,a1:i}of r){if(c.length===Tn)break;c.push(...H(e,n,Tn-c.length,t,i))}let l=new Map;if(i){let n=new Set([...o.map(({line:e})=>s(`b`,e)),...c.map(({line:e})=>s(`a`,e))]);for(let i of n)i&&a(e,t,r,i).forEach(([e,t],n)=>{e!==null&&l.set(`a${e}`,n),t!==null&&l.set(`b${t}`,n)})}let u=e=>{let t=s(e.side,e.line);return t?i?[t.b0,0,l.get(`${e.side}${e.line}`),e.side===`a`?0:1]:e.side===`a`?[t.b0,0,0,e.line]:[e.line,1,0,0]:[e.line,1,0,0]};return[...o.map(e=>({...e,side:`b`,sign:s(`b`,e.line)?`+`:` `})),...c.map(e=>({...e,side:`a`,sign:`−`}))].toSorted((e,t)=>{let n=u(e),r=u(t);return n[0]-r[0]||n[1]-r[1]||n[2]-r[2]||n[3]-r[3]}).slice(0,Tn)}function kn(e,t,n,{split:r=!1,align:i=En}={}){let a=[],o=0,s=e=>e!==``&&t.ranges(e).length>0;for(let{path:c,before:l,after:u}of e){if(typeof l!=`string`||typeof u!=`string`||!s(l)&&(l===u||!s(u)))continue;let e;if(l===u||l===``||u===``)e=Dn(l,u,t,null);else{let a=z(l),o=z(u),s=n(c,l,u);if(s?.length===0)continue;e=On(a,o,t,s,r,i)}if(e.length!==0){if(a.length===wn)return{files:a,hits:o,truncated:!0};a.push({path:c,hits:e}),o+=e.length}}return{files:a,hits:o,truncated:!1}}var An=2,jn=2,Mn=5e3,Nn=3e5,Pn=30,Fn=`The server's diff doesn't match this file as shown.`,In=(e,t)=>!!(e?.managedId&&t?.managedId)||!!e?.npm&&!!t?.npm&&e.npm.name===t.npm.name,Ln=e=>!(e>=400&&e<500&&e!==429),U=new Map;function Rn(e,t,n){let{before:r,reason:i,reads:a,prettyHash:o,otherPrettyHash:s,ignoringWhitespace:c}=e??{},l=[e,c].map(e=>Array.isArray(e?.blocks)&&Array.isArray(e.marks)?{blocks:e.blocks,marks:e.marks}:null);if(!(e?.hash===t&&e.otherHash===n&&typeof r==`string`&&(i==null||typeof i==`string`)&&Array.isArray(a)&&a.every(e=>typeof e==`string`)&&l.every(Boolean)&&typeof o==`string`&&typeof s==`string`))return null;let u=l.map(e=>({status:`ready`,before:r,...e,reason:i??null,reads:a}));return{status:`ready`,before:r,reason:i??null,reads:a,copies:[o,s],settings:u}}var zn=(e,t,n)=>e.fileHashes?.get(t)??_t(n),Bn=new Set;function Vn(e){e&&(Bn.size===0&&setTimeout(()=>{let e=[...Bn];Bn.clear();for(let t of e)t()},Pn),Bn.add(e))}function Hn(e,t,n=0){let r=Math.min(Mn*2**n,Nn);return Object.assign(t,{until:Date.now()+r,tries:n+1}),setTimeout(()=>{e.notify?.()},r)?.unref?.(),t}function Un(){for(let[e,t]of U){if(U.size<=An)break;t.ended&&U.delete(e)}}async function Wn(e,t,n,r,i){let a=null;try{let e=async({path:e,otherPath:i,hash:a,otherHash:o,status:s,message:c,...l})=>{if(typeof e!=`string`||typeof i!=`string`)return;let u=`${e}\0${i}`,d=t.diffs.get(u);if((d?.status??`loading`)!==`loading`)return;let[f,p]=[D(n).get(e),D(r).get(i)],m=c===void 0?typeof f==`string`&&typeof p==`string`&&Rn({...l,hash:a,otherHash:o},await zn(n,e,f),await zn(r,i,p)):!Ln(s)&&{status:`error`,message:c,retry:!1};!m||t.diffs.get(u)!==d||(m.tries=t.diffs.get(u)?.tries,t.diffs.set(u,m),Vn(t.notify))};await(n.npm?te(n.npm.name,n.npm.version,r.npm.version,e):ee(n.managedId,r.managedId,e,{scope:i}))}catch(n){if(n?.name===`AbortError`){U.get(e)===t&&U.delete(e);return}a={status:`error`,message:n?.message??String(n),retry:Ln(n?.status)}}Object.assign(t,{ended:!0,rest:a}),a?.retry&&Hn(t,a,t.tries),Vn(t.notify),Un()}var Gn=0,Kn=[];async function qn(e){Gn<jn?Gn++:await new Promise(e=>{Kn.push(e)});try{return await e()}finally{let e=Kn.shift();e?e():Gn--}}async function Jn(e,t,n,r,i,a,o,s,c){let l;try{let[e,t]=await Promise.all([zn(r,i,a),zn(o,s,c)]),u={path:i,hash:e,otherPath:s,otherHash:t};l=Rn(await qn(()=>r.npm?b(r.npm.name,r.npm.version,o.npm.version,u):v(r.managedId,o.managedId,u)),e,t)??{status:`error`,message:Fn,retry:!0},l.tries=n.tries}catch(r){if(r?.name===`AbortError`){e.diffs.get(t)===n&&e.diffs.delete(t);return}l={status:`error`,message:r?.message??String(r),retry:Ln(r?.status)}}e.diffs.get(t)===n&&(l.status===`error`&&l.retry&&Hn(e,l,n.tries),e.diffs.set(t,l),Vn(e.notify))}function Yn(e,t,n,r,i,a,o,s,c,l=!1,u=``){let d=`${e.integrity}\0${r.integrity}\0${u}`,f=U.get(d);if(U.delete(d),(!f||f.rest?.until!==void 0&&Date.now()>=f.rest.until)&&(f={diffs:f?.diffs??new Map,notify:null,ended:!1,rest:null,tries:f?.rest?.tries},Wn(d,f,e,r,u)),U.set(d,f),Un(),f.notify=s,n!==D(e).get(t)||a!==D(r).get(i))return{status:`error`,message:Fn,retry:!1};let p=`${t}\0${i}`,m=f.diffs.get(p);if(!m&&!f.ended&&!l)return{status:`loading`};if(!m&&f.rest)return f.rest;if(m?.status===`ready`){if(m.copies[0]===c?.[0]&&m.copies[1]===c?.[1])return m.tries=0,m.settings[Number(o)];m=Hn(f,{status:`error`,message:Fn,retry:!0},m.tries),f.diffs.set(p,m)}if(m&&!(m.status===`error`&&m.until!==void 0&&Date.now()>=m.until))return m;let h={status:`loading`,tries:m?.tries};return f.diffs.set(p,h),Jn(f,p,h,e,t,n,r,i,a),h}function Xn(){for(let[e,t]of U)if(t.rest?.retry)U.delete(e);else for(let[e,n]of t.diffs)n.status===`error`&&n.retry&&t.diffs.delete(e)}var Zn=2,Qn=5e3,$n=3e5,er=new Set([`ts`,`mts`,`cts`]),tr=e=>!(e>=400&&e<500&&e!==429),nr=(e,t)=>`${e??``}\0${t??``}`,W=new Map,rr=new Map;function ir(){for(let[e,t]of W){if(W.size<=Zn)break;t.ended&&W.delete(e)}}async function ar(e,t,n){if(t===null)return n===null;let r=typeof t==`string`?D(e).get(t):void 0;return typeof r==`string`&&n===await(e.fileHashes?.get(t)??_t(r))}async function or(e,t,n,r,i){let a=!1,o=new Set;try{let e=async({path:e,hash:t,otherPath:i,otherHash:a})=>{e===void 0||i===void 0||(e??i)===null||await ar(n,e,t)&&await ar(r,i,a)&&o.add(nr(e,i))};await(n.npm?ie(n.npm.name,n.npm.version,r.npm.version,e):ne(n.managedId,r.managedId,e,{scope:i}))}catch(n){if(n?.name===`AbortError`){W.get(e)===t&&W.delete(e);return}a=tr(n?.status)}if(Object.assign(t,{files:o,ended:!0}),a){let n=rr.get(e)??0;rr.set(e,n+1),setTimeout(()=>{W.get(e)===t&&(W.delete(e),t.notify?.())},Math.min(Qn*2**n,$n))?.unref?.()}else rr.delete(e);t.notify?.(),ir()}function sr(e,t,n,{kind:r,basePath:i=n},{before:a,after:o},s,c=``){if(r===`repointed`||!In(e,t))return!1;let l=[r===`added`?null:i,r===`removed`?null:n];if(!l.every(e=>e===null||er.has(Be(e)))||l[0]!==null&&a!==D(e).get(i)||l[1]!==null&&o!==D(t).get(n))return!1;let u=`${e.integrity}\0${t.integrity}\0${c}`,d=W.get(u);return W.delete(u),d||(d={files:new Set,notify:null,ended:!1},or(u,d,e,t,c)),W.set(u,d),ir(),d.notify=s,d.files.has(nr(...l))}function cr(e,t){let n=t===void 0?`The bundle records no format for it now`:`The bundle loads it as ${t}`,r=e===void 0?`no format recorded before`:t===void 0?`${e} before`:`as ${e} before`,[i,a]=[ut.isResourceFormat(e),ut.isResourceFormat(t)];return`${n}, ${r}${i===a?``:i?`, carried as data before, run as code now`:`, run as code before, carried as data now`}`}function lr(e=[],t=!1){return e.map(({field:e,from:n,to:r})=>e===`format`?N`<span class="bundle-compare-code-meta">${t?`format`:`${n??`none`} \u2192 ${r??`none`}`}</span>`:N`<span class="${`bundle-compare-code-meta${r?``:` is-dropped`}`}">${e===`executable`?r?`+x`:`−x`:r?`new entry`:`entry`}</span>`)}var ur=(e=[])=>e.filter(({field:e,to:t})=>e===`format`||t).map(({field:e,from:t,to:n})=>({name:e===`format`?`${t??`none`} \u2192 ${n??`none`}`:e===`executable`?`+x`:`new entry`,severity:`high`}));function dr(e=[]){return e.map(({field:e,from:t,to:n})=>e===`format`?`${cr(t,n)}.`:e===`executable`?n?`It is now executable.`:`It is no longer executable.`:n?`It is now an entry point of the bundle.`:`It is no longer an entry point of the bundle.`).join(` `)}var fr=[{kind:`changed`,label:`Modified`,letter:`M`},{kind:`renamed`,label:`Renamed`,letter:`→`},{kind:`added`,label:`Added`,letter:`A`},{kind:`removed`,label:`Removed`,letter:`D`},{kind:`repointed`,label:`Repointed`,letter:`R`}],pr=Object.fromEntries(fr.map(e=>[e.kind,e])),G=2e3,mr=1e5,hr=16777216,gr=24,_r=3,vr=300,yr=30,br=[{mode:`files`,label:`Filter files`,placeholder:`Filter changed files`,icon:ce},{mode:`code`,label:`Search code`,placeholder:`Search changed code`,icon:ue}],xr=V/2,Sr=65536,Cr=new WeakSet,wr={large:`A large diff, not shown yet: the lines it removed aren't searched.`,printed:`Shown pretty-printed: its lines as published, unsigned, the lines it removed not searched.`,numbered:`Shown pretty-printed: its lines numbered as published.`},Tr={"+":{name:`add`,label:`Added`},"−":{name:`del`,label:`Removed`}," ":{name:`ctx`,label:`Unchanged`}},K={layout:`unified`,ignoreWhitespace:!1,ignoreRenames:!1,ignoreTypes:!1},Er=()=>`${K.ignoreWhitespace}\0${K.ignoreRenames}`,Dr=`Hide renamed names`,Or=`Hide type-only changes`,kr=`Hide whitespace changes`,Ar=()=>`${!!T.bundleSourcePretty}\0${K.ignoreWhitespace}\0${K.ignoreRenames}\0${K.ignoreTypes}`,jr=({pretty:e,spacesHidden:t,hiding:n,typesHidden:r})=>[e?.status===`ready`&&`Pretty-print`,t&&kr,n&&Dr,r&&Or].filter(Boolean),Mr={mixed:`Whitespace changes are shown: hiding them would hide blanks of more than one kind changing.`},Nr=(e,t)=>e?.kind===`stasis`?e.bundle?.formats?.get(t):void 0,Pr=e=>/\.[cm]?js$/iu.test(e),Fr=(e,{ignoreRenames:t}=K)=>t&&Pr(e),Ir=(e,t,n)=>Ue(e,t,n).category===`minified`,Lr=`A license file`,Rr=new WeakMap;function zr(e){let t=Rr.get(e);if(t)return t;t=new Map;let n=(e,n,r)=>{e&&t.set(e,[...t.get(e)??[],{label:n,note:r}])};if(e?.kind===`stasis`)for(let t of e.bundle?.entries??[])n(t,`entry`,`An entry point of the bundle`);let r=e?.npm?.manifest;if(r){let t=new Set(D(e).keys());for(let e of[`main`,`module`,`types`])typeof r[e]==`string`&&n(h(r[e],t),e,`package.json "${e}": ${r[e]}`);for(let[e,i]of Object.entries(r.bin??{}))typeof i==`string`&&n(h(i,t),`bin`,`package.json "bin" ${e}: ${i}`);let i=Map.groupBy(typeof r.license==`string`?_(r.license,[...t]).filter(e=>e.file):[],e=>e.file);for(let e of t)g.test(e)&&n(e,`license`,i.has(e)?`License: ${i.get(e).map(e=>e.text).join(`, `)}`:Lr)}else for(let t of D(e).keys())g.test(t.slice(t.lastIndexOf(`/`)+1))&&n(t,`license`,Lr);return Rr.set(e,t),t}var Br=/(?:^|\/)package\.json$/u,Vr=new WeakMap;function Hr(e,t,n){let r=Vr.get(e);return r||Vr.set(e,r=new Map),r.has(t)||r.set(t,m(n,D(e).has(`${t.slice(0,-12)}binding.gyp`))),r.get(t)}var Ur={unparsed:`the file couldn't be parsed`,dynamic:`the file reads names by their spelling (eval or with)`,jsx:`the file holds JSX`,"block-function":`the file declares a function in a block outside strict code`,unverified:`the old side with the new names couldn't be checked to read as before`},Wr=e=>`Renamed names are hidden, though the file reads ${e.map(e=>`.${e}`).join(`, `)}, which a rename may change.`,Gr=(e,t,n=K)=>`${e}\0${n.ignoreWhitespace}\0${Fr(e,n)}\0${!!n.markRenames}\0${t}`,Kr=new Map,qr=new Set,Jr=new WeakMap;function Yr(e){let t=0;for(let n=e.indexOf(`
|
|
11
11
|
`);n!==-1;n=e.indexOf(`
|
|
12
|
-
`,n+1))t++;return t}var
|
|
12
|
+
`,n+1))t++;return t}var Xr=e=>e.length*3<=ze||e.length<=ze&&xt(e)<=ze,Zr=e=>e.printing?.applies?e.pretty??{status:`off`}:null,Qr=5,$r=e=>e?e.length>Qr?`
|
|
13
13
|
Affects files: ${e.length.toLocaleString()}`:`
|
|
14
14
|
Affects files:
|
|
15
15
|
${e.join(`
|
|
16
|
-
`)}`:``,ti=(e,t)=>M`<span class="bundle-compare-code-counts" aria-label="${`${e} added, ${t} removed lines`}"><span class="add">+${e.toLocaleString()}</span><span class="del">−${t.toLocaleString()}</span></span>`,ni=(e,t,n)=>e.hideable??=pn(t,n,e.blocks),K=(e,t)=>e.length+t.length>gr||Xr(e)+Xr(t)>hr,ri=e=>e.kind===`repointed`||e.kind===`renamed`&&!e.modified&&!!e.repointed&&!e.meta,ii=e=>Array.isArray(e)?e.some(ii):e?.strings?e.strings.some(e=>e.trim()!==``)||e.values.some(ii):e!=null&&e!==N&&e!==!1&&e!==``,ai=new WeakMap;function oi(e,t){if(ai.has(e))return ai.get(e);let n=new Set;for(let e of t)for(let t=e.lastIndexOf(`/`);t>0&&!n.has(e.slice(0,t));t=e.lastIndexOf(`/`,t-1))n.add(e.slice(0,t));return ai.set(e,n),n}function si(e){let t=E(e);return oi(t,t.keys())}function ci(e,t){for(let n of e.files.values())if(n===t)return!0;for(let n of e.dirs.values())if(ci(n,t))return!0;return!1}var li=class extends xt{static properties={base:{attribute:!1},other:{attribute:!1},files:{attribute:!1},scope:{attribute:!1},resolutions:{attribute:!1},baseAlerts:{attribute:!1},otherAlerts:{attribute:!1},alertTags:{attribute:!1},newHosts:{attribute:!1},newHostTag:{attribute:!1},dependencies:{attribute:!1},openDependency:{attribute:!1},dependencyTags:{attribute:!1},extensions:{attribute:!1},baseName:{},otherName:{},path:{},seek:{attribute:!1},_query:{state:!0},_kinds:{state:!0},_mode:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.base=null,this.other=null,this.files=null,this.scope=``,this.resolutions=[],this.baseAlerts=null,this.otherAlerts=null,this.alertTags=null,this.newHosts=null,this.newHostTag=null,this.extensions=null,this._treeLimit=300,this._treeRemaining=1/0,this.path=null,this._query=``,this._kinds=new Set(pr.map(e=>e.kind)),this._mode=`files`,this._blocks=new Map,this._found=null,this._rowless=new Map,this._rowlessCount=0,this._aligned=new WeakMap,this._sought=null,this._soughtRow=null,this._open=new Map,this._models=new Map,this._modelCap=_r,this._counted=new Map,this._countModels=new Map,this._drawnCounts=new Map,this._drawnTotals=new Map,this._spaced=new Map,this._shorter=new Map,this._larges=new Map,this._expansions=new Map,this._limits=new Map,this._forced=new Set,this._shownPath=null}willUpdate(e){let t=`${this.base?.integrity}|${this.other?.integrity}`;if((t!==this._pair||e.has(`files`))&&(this._pair=t,this._models.clear(),this._spaced.clear(),this._shorter.clear(),this._larges.clear(),this._expansions.clear(),this._limits.clear(),this._forced.clear()),[`files`,`resolutions`,`base`,`other`].some(t=>e.has(t))&&(this._entries=Qt(this.base,this.other,this.files,this.resolutions??[]),this._counted=new Map,this._countModels=new Map,this._drawnCounts=new Map,this._drawnTotals=new Map,this._treeLimit=this.extensions?.treePageSize??1/0,this._blocks.clear(),this._rowless.clear(),this._sought=this._soughtRow=null,this._soughtSettling=!1),e.has(`seek`)&&this.seek&&!wr.has(this.seek)){wr.add(this.seek);let{path:e,line:t,query:n}=this.seek,r=this._entries?.get(e),i=r?L(this.base,this.other,e,r).after:null,a=typeof i==`string`?R(i)[t]?.toLowerCase().indexOf(n.toLowerCase())??-1:-1;this._sought={path:e,side:`b`,line:t,at:Math.max(a,0),query:n},this._soughtRow=null,this._soughtSettling=!1}}updated(){if(this._current!==this._shownPath){this._shownPath=this._current;let e=this.querySelector(`.bundle-compare-diff`);e&&(e.scrollTop=0),this.querySelector(`.bundle-compare-code-tree .bundle-code-tree-link.current`)?.scrollIntoView({block:`nearest`})}this._scrollSought()}_scrollSought(){if(this._sought?.path===this._current&&!this._soughtSettling&&(this._sought=null),!this._soughtRow)return;let{path:e,index:t}=this._soughtRow;this._soughtRow=null;let n=[...this.querySelectorAll(`.bundle-compare-diff-table`)].find(t=>t.dataset.path===e)?.children[t];if(!n)return;let r=n.closest(`.bundle-compare-diff`);n.scrollIntoView({block:r&&n.offsetHeight>r.clientHeight/2?`start`:`center`}),n.classList.remove(`is-sought`),n.offsetWidth,n.classList.add(`is-sought`),n.addEventListener(`animationend`,()=>n.classList.remove(`is-sought`),{once:!0})}_shown(e){return this._kinds.has(e.kind)||!!e.modified&&this._kinds.has(`changed`)||!!e.repointed&&this._kinds.has(`repointed`)}_modules(){let e=this.base?.kind===`stasis`?this.base.bundle?.modules:null,t=this.other?.kind===`stasis`?this.other.bundle?.modules:null,n={root:this.files?.root,paths:this.files?.basePaths??new Map};return e||t?new Map([...[...e??[]].map(([e,t])=>[i(n,e,Object.keys(t.files??{})),t]),...t??[]]):null}_baseDirs(){let e=this.files?.root?this.files.basePaths:null;return e?oi(e,e.values()):si(this.base)}_format(e){let t=this._entries.get(e),n=at(this.base,t?.basePath??e),r=at(this.other,e);return[n,r].find(it)??(t?.kind===`removed`?n:r)}_tree(){let e=[this._entries,`${[...this._kinds].join()}:${!!this.extensions?.fullPaths}`];if(this._treeKey?.[0]===e[0]&&this._treeKey[1]===e[1])return this._treeMemo;let t=[...this._entries.keys()],n=this._modules(),r=a(this.files?.root,this.extensions?.fullPaths?``:ke(pt(t).prefix,n,t)),{prefix:i}=r,o=t.filter(e=>this._shown(this._entries.get(e))),s=Oe(o.map(e=>i&&e.startsWith(i)?e.slice(i.length):e),o,n);return this._treeKey=e,this._treeMemo={prefix:i,root:r,tree:s,shown:o.length,allOrder:Fe(s)},this._treeMemo}_select(e){!e||e===this._current||this.extensions?.canSelect?.()===!1||this.dispatchEvent(new CustomEvent(`compare-code-select`,{detail:{path:e},bubbles:!0,composed:!0}))}_reveal(e,t){let n=(t&&e.startsWith(t)?e.slice(t.length):e).split(`/`);for(let e=1;e<n.length;e++)this._open.set(n.slice(0,e).join(`/`),!0)}_railState(){let{prefix:e,root:t,tree:n,shown:r,allOrder:i}=this._tree(),a=Ae(n,this._mode===`files`?this._query:``,e,this.extensions?.fileFilter);return{prefix:e,root:t,tree:n,shown:r,filtered:a,order:a===n?i:a?Fe(a):[],allOrder:i}}_renderRail({prefix:e,root:t,tree:n,shown:r,filtered:i,order:a},o){this._countUntil=null,this._treeRemaining=this.extensions?.treePageSize?this._treeLimit:1/0,this._treeTruncated=!1;let s=this._mode===`code`?N:i?this._renderTree(i,o,0,!!this._query||r<=(this.extensions?.openAllMax??yr)):M`<div class="bundle-code-search-empty">No changed files match.</div>`,c=Object.fromEntries(pr.map(({kind:e})=>[e,0]));for(let e of this._entries.values())e.kind!==`repointed`&&c[e.kind]++,e.modified&&c.changed++,e.repointed&&c.repointed++;let l=xr.find(({mode:e})=>e===this._mode);return M`<aside class="bundle-code-rail"><div class="bundle-code-rail-head"><span class="bundle-code-rail-label">${this.extensions?.railLabel??`Changes`}</span> <span class="bundle-code-rail-count">${this._entries.size.toLocaleString()}</span> <span class="bundle-code-rail-actions"><button type="button" class="bundle-code-rail-action" aria-label="${this.extensions?.collapseLabel??`Collapse directories`}" data-tooltip="Collapse directories" ?disabled="${this._mode!==`files`||!!this._query&&!this.extensions?.collapseClearsSearch||n.dirs.size===0}" @click="${()=>this._collapseAll(n)}">${se}</button></span></div>${t.from?M`<div class="bundle-code-rail-prefix mono" data-tooltip="${`Root moved: ${t.from} \u2192 ${t.to}`}">${Xt(t)}</div>`:e?M`<div class="bundle-code-rail-prefix mono" data-tooltip-truncated data-tooltip="${e}">${e}</div>`:N}<div class="bundle-compare-code-filter"><label class="bundle-compare-code-search"><svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true"><circle cx="7" cy="7" r="4.5"/><path d="m10.5 10.5 3.5 3.5"/></svg> <input type="search" placeholder="${this._mode===`files`?this.extensions?.searchPlaceholder??l.placeholder:l.placeholder}" aria-label="${this._mode===`files`?this.extensions?.searchLabel??l.placeholder:l.placeholder}" spellcheck="false" autocomplete="off" .value="${T(this._query)}" @input="${e=>{this._query=e.target.value,this._treeLimit=this.extensions?.treePageSize??1/0}}"> <span class="bundle-code-search-modes" role="tablist">${xr.map(({mode:e,label:t,icon:n})=>M`<button type="button" class="${k({"bundle-code-search-mode":!0,active:e===this._mode})}" role="tab" aria-selected="${String(e===this._mode)}" aria-label="${t}" data-tooltip="${t}" @click="${()=>{this._mode=e}}">${n}</button>`)}</span></label> ${this.extensions?.filters??M`<div class="bundle-compare-code-kinds" role="group" aria-label="Show changes">${pr.filter(({kind:e})=>c[e]>0).map(({kind:e,label:t})=>M`<button type="button" class="${`bundle-compare-code-kind ${e}`}" aria-pressed="${String(this._kinds.has(e))}" data-tooltip="${`${this._kinds.has(e)?`Hide`:`Show`} ${t.toLowerCase()} files`}" @click="${()=>this._toggleKind(e)}">${t.toLowerCase()}</button>`)}</div>`}</div><div class="bundle-code-rail-body bundle-compare-code-tree">${this._mode===`code`?this._renderSearch(a,o,e):s} ${this._mode===`files`&&this._treeTruncated?M`<button type="button" class="bundle-compare-code-action" @click="${()=>{this._treeLimit+=this.extensions.treePageSize,this.requestUpdate()}}">Show more files</button>`:N}</div>${this.extensions?.footer?.(e=>{this._query=``,this._select(e)})??N}</aside><bundle-code-splitter role="separator" tabindex="0" aria-orientation="vertical" aria-label="Resize file tree" data-tooltip="Drag to resize · double-click to reset"></bundle-code-splitter>`}_arrived=0;_renamesAlone=!0;_repaint=()=>{this._arrived++,this.isConnected&&this.requestUpdate()};disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this._countLater),clearTimeout(this._searchLater),this._countLater=this._searchLater=null}render(){let e=this._railState(),t=this._entries.has(this.path)?this.path:e.order[0]??null;t&&t!==this._current&&this._reveal(t,e.prefix),this._current=t,this._order=this.extensions?.filterContent===!1?e.allOrder:e.order;let n=t?M`${this._renderFile(t,this.extensions?.fullPaths?``:e.prefix)}${this.extensions?.fileActions?.(t,!1)??N}`:M`<div class="bundle-code-placeholder">No files differ in this comparison.</div>`;return M`<div class="bundle-code-view bundle-compare-code">${this._renderRail(e,t)}<div class="bundle-code-main">${n}</div></div>`}_toggleKind(e){let t=new Set(this._kinds);t.has(e)?t.delete(e):t.add(e),this._kinds=t}_collapseAll(e){this.extensions?.collapseClearsSearch&&(this._query=``),this._treeLimit=this.extensions?.treePageSize??1/0;let t=e=>{for(let n of e.dirs.values())this._open.set(n.path,!1),t(n)};t(e),this.requestUpdate()}_renderSearch(e,t,n){if(!this._query)return M`<div class="bundle-code-search-hint">Type to search the code of the changed files.</div>`;let{files:r,hits:i,truncated:a,unsigned:o}=this._searchResults(e);if(r.length===0)return M`<div class="bundle-code-search-empty">No matches.</div>`;let s=e=>n&&e.startsWith(n)?e.slice(n.length):e;return M`<div class="bundle-code-search-results bundle-compare-search"><div class="bundle-code-search-summary">${i.toLocaleString()} ${i===1?`hit`:`hits`} in ${r.length.toLocaleString()} ${r.length===1?`file`:`files`}${a?`, the first ${Tn}`:``}</div>${j(r,e=>e.path,({path:e,hits:n})=>M`<div class="${k({"bundle-code-search-file":!0,current:e===t})}"><button type="button" class="${`bundle-code-search-file-name bundle-compare-code-name ${this._entries.get(e).kind}`}" data-tooltip-truncated data-tooltip="${e}" @click="${()=>this._select(e)}">${s(e)}</button> ${o.has(e)?M`<p class="bundle-compare-search-note">${Tr[o.get(e)]}</p>`:N}<ul class="bundle-code-search-hits">${n.map(t=>M`<li class="bundle-code-search-hit"><button type="button" class="bundle-code-search-hit-link" aria-label="${`${Er[t.sign]?.label??`Line`} ${t.line+1}${t.side===`a`?` of the old text`:``}: ${t.text.trim().slice(0,80)}`}" @click="${()=>this._seek(e,t)}"><span class="bundle-code-search-hit-ln">${t.line+1}</span> <span class="${`bundle-compare-search-sign ${Er[t.sign]?.name??``}`}" aria-hidden="true">${t.sign??``}</span> <span class="bundle-code-search-hit-text mono">${tt(t.text,t.ranges)}</span></button></li>`)}</ul></div>`)}</div>`}_searchResults(e){let t=Dr(),r=`${this._query}\0${this._forced.size}\0${t}\0${G.layout}\0${!!w.bundleSourcePretty}\0${nt()}\0${this._rowlessCount}\0${e.join(`\0`)}`;if(this._found?.key===r&&this._found.entries===this._entries)return this._found.result;let i=null,a=!0,o=new Map,s={...An(e.flatMap(e=>{let n=this._entries.get(e);if(!this._searchable(n))return[];let r=L(this.base,this.other,e,n),{before:i,after:a}=r;if(this._prettyShown(e,n,r)){if(!/\S/u.test(this._query))return[];let n=i!==``&&a!==``&&i!==a;if(n&&this._rowless.get(e)===t)return[];o.set(e,n?`printed`:`numbered`)}return[{path:e,...r}]}),$e(this._query,!1,!1),(e,t,r)=>{if(o.get(e)===`printed`)return null;let s=`${G.ignoreWhitespace}\0${e}`;if(this._blocks.has(s))return this._blocks.get(s);if(!this._forced.has(e)&&K(t,r))return o.set(e,`large`),null;let c=performance.now();if(i??=c+br,c>i)return a=!1,null;let l=G.ignoreWhitespace&&!this._unlisted(e,this._entries.get(e),{before:t,after:r}),u=z(t,r,l);return l&&n(t,r,u)&&(u=z(t,r)),this._blocks.set(s,u),u},{split:G.layout===`split`,align:(e,t,n,r)=>{let i=this._aligned.get(n);return i||this._aligned.set(n,i={a:e,b:t,blocks:n}),Sn(i,n.indexOf(r))}}),unsigned:o};return a?this._found={key:r,entries:this._entries,result:s}:this._searchLater??=setTimeout(()=>{this._searchLater=null,this.requestUpdate()}),s}_searchable(e){return e.modified!==!1||ri(e)}_prettyShown(e,t,n){if(!w.bundleSourcePretty)return!1;let r=this._printing(e,t,n);return!!r?.applies&&r.copies.status!==`error`}_noteRowless(e,t){let n=t?Dr():void 0;this._rowless.get(e)!==n&&(n===void 0?this._rowless.delete(e):this._rowless.set(e,n),this._rowlessCount++)}_seek(e,t){this._sought={path:e,side:t.side,line:t.line,at:t.ranges[0]?.[0]??0,query:this._query},e===this._current?this.requestUpdate():this._select(e,!1)}_soughtLine(e,t,n,r){let{side:i,line:a,at:o,query:s}=this._sought;if(n?.status!==`ready`)return{side:i,line:a};let c=e=>e.replaceAll(/\s+/gu,``),l=R(L(this.base,this.other,e,t)[i===`a`?`before`:`after`]??``),u=l.slice(0,a).reduce((e,t)=>e+c(t).length,0)+c(l[a]?.slice(0,o)??``).length,d=c(s).toLowerCase(),f=(e,t)=>{if(!d)return null;let n=0,r=0,i=0,a=``;for(let o of e)for(let e=0;e<o.length;e+=Cr){a+=c(o.slice(e,e+Cr)).toLowerCase();for(let e=a.indexOf(d,n);e!==-1;e=a.indexOf(d,n),r++){if(t(r,i+e))return{index:r,start:i+e};n=e+d.length}let s=Math.max(n,a.length-d.length+1);a=a.slice(s),i+=s,n=Math.max(0,n-s)}return null},p=f(l,(e,t)=>t>=u),m=(p&&f(r[i],e=>e===p.index)?.start)??u;for(let e=0;e<r[i].length;e++)if(m-=c(r[i][e]).length,m<0)return{side:i,line:e};return null}_seekRows(e,t,{side:n,line:r},i){let a=e=>n===`b`?(e.kind===`ctx`||e.kind===`add`)&&e.b===r||e.kind===`change`&&e.right===r:(e.kind===`ctx`||e.kind===`del`)&&e.a===r||e.kind===`change`&&e.left===r,o=this._expansions.get(e)??new Map,s=yn(t,o,{split:i}),c=s.findIndex(a);if(c===-1){let l=s.find(e=>e.kind===`fold`&&r>=e[n]&&r<e[n]+e.count);if(l){let u=o.get(l.run)??{},d=r-l[n];o=new Map(o).set(l.run,l.down?{...u,top:(u.top??0)+d+1+Sr}:l.up?{...u,bottom:(u.bottom??0)+l.count-d+Sr}:{all:!0}),this._expansions.set(e,o),s=yn(t,o,{split:i}),c=s.findIndex(a)}}let l=this._limits.get(e)??W;return c>=l&&this._limits.set(e,Math.ceil((c+1)/W)*W),{rows:s,index:c}}_takeTreeRow(e=!1){return this._treeRemaining-->0||(this._treeTruncated=!0,e)}_renderTree(e,t,n,i){let a=[...e.dirs.entries()].toSorted(Pe),o=[...e.files.entries()].toSorted(([e],[t])=>e.localeCompare(t)),s=a.flatMap(([e,r])=>{let a=je(e,r,n),o=r.package,s=o?.ecosystem===`cargo`||o?.ecosystem===`composer`||o?.ecosystem===`soldeer`,c=this._query?!0:this._open.get(r.path)??(i||n===0||ci(r,t)),l=this._baseDirs().has(r.sourcePath)?si(this.other).has(r.sourcePath)?null:`removed`:`added`;if(!this._takeTreeRow(ci(r,t)))return[];let u=M`<li class="bundle-code-tree-dir"><details .open="${T(c)}" @toggle="${e=>{let t=e.currentTarget.open;this._open.get(r.path)!==t&&(this._open.set(r.path,t),this.extensions?.treePageSize&&this.requestUpdate())}}"><summary aria-label="${this.extensions?.directoryLabel?.(a.node)??N}"><span class="bundle-code-tree-chevron" aria-hidden="true"></span> ${o?st(o.ecosystem):N} <span class="${k({"bundle-code-tree-dirname":!0,"bundle-code-tree-package":!!o,"bundle-code-tree-package-vendored":s,"bundle-compare-code-name":!0,removed:l===`removed`})}" data-tooltip-truncated data-tooltip="${a.node.sourcePath}">${o?M`<span class="bundle-code-tree-package-name">${o.name}</span>${o.version?M`<span class="bundle-code-tree-package-version">${s?`- `:`@`}${o.version}</span>`:N}`:a.names.map((e,t)=>M`${t>0?M`<span class="bundle-code-tree-separator">/</span>`:N}${e}`)} </span>${o?.variant?M`<span class="bundle-code-tree-variant">variant ${o.variant}</span>`:N} <span class="bundle-compare-code-dir-count" data-tooltip="${`${r.fileCount} changed ${r.fileCount===1?`file`:`files`}`}">${this.extensions?.directorySummary?.(a.node)??r.fileCount}</span> ${l?M`<span class="${`bundle-compare-code-letter ${l}`}" data-tooltip="${`${o?`Package`:`Directory`} ${l}`}">${mr[l].letter}</span>`:N}</summary>${c||!this.extensions?.treePageSize?this._renderTree(a.node,t,n+1,i):N}</details></li>`;return[{key:r.path,content:u}]}),c=o.flatMap(([e,n])=>{if(!this._takeTreeRow(n===t))return[];let{kind:i,repointed:a,renamedFrom:o,modified:s}=this._entries.get(n),c=a?`${a.length} repointed ${a.length===1?`import`:`imports`}`:``;return[{key:n,content:M`<li class="bundle-code-tree-file"><button type="button" class="${k({"bundle-code-tree-link":!0,current:n===t})}" aria-label="${this.extensions?.fileLabel?.(n)??N}" aria-current="${n===t?`true`:N}" @click="${()=>this._select(n)}">${this.extensions?.filePrefix?.(n)??N}${ot(n,this._format(n))}<span class="${`bundle-code-tree-name bundle-compare-code-name ${i}`}" data-tooltip-truncated data-tooltip="${n}">${e}</span> ${this.extensions?.fileSuffix?.(n)??N} ${o?M`<span class="bundle-compare-code-oldname" data-tooltip-truncated data-tooltip="${`Renamed from ${o}`}">← ${r(o,n,{extension:!1}).from}</span>`:N} ${this._fileTags(n,this._entries.get(n),!0)} ${this._treeCounts(n,this._entries.get(n))} ${a&&i!==`repointed`?M`<span class="bundle-compare-code-letter repointed" data-tooltip="${c}">R</span>`:N} <span class="${k({"bundle-compare-code-letter":!0,[i]:!0,pure:i===`renamed`&&!s})}" data-tooltip="${i===`repointed`?c:o?`Renamed${s?` and modified`:``} from ${o}`:mr[i].label}">${mr[i].letter}</span></button></li>`}]});return M`<ul class="${k({"bundle-code-tree":!0,root:n===0})}" aria-label="${n===0?this.extensions?.treeLabel??`Changed files`:N}" @keydown="${n===0?Me:N}">${j(s,e=>e.key,e=>e.content)}${j(c,e=>e.key,e=>e.content)}</ul>`}_treeCounts(e,t){if(t.kind===`repointed`)return N;let n=this._lineCounts(e,t),r;if(n===null&&this._counted.has(e)?{published:n,shown:r}=this._largeCounts(e,t):r=n&&this._shownCounts(e,t),!(n||r)||r===void 0)return N;let{additions:i,deletions:a}=r??n,o=!n||n.additions>0||n.deletions>0,s=t.kind===`renamed`,c=r?.renamed>0?`
|
|
16
|
+
`)}`:``,ei=(e,t)=>N`<span class="bundle-compare-code-counts" aria-label="${`${e} added, ${t} removed lines`}"><span class="add">+${e.toLocaleString()}</span><span class="del">−${t.toLocaleString()}</span></span>`,ti=(e,t,n)=>e.hideable??=fn(t,n,e.blocks),q=(e,t)=>e.length+t.length>hr||Yr(e)+Yr(t)>mr,ni=e=>e.kind===`repointed`||e.kind===`renamed`&&!e.modified&&!!e.repointed&&!e.meta,ri=e=>Array.isArray(e)?e.some(ri):e?.strings?e.strings.some(e=>e.trim()!==``)||e.values.some(ri):e!=null&&e!==P&&e!==!1&&e!==``,ii=new WeakMap;function ai(e,t){if(ii.has(e))return ii.get(e);let n=new Set;for(let e of t)for(let t=e.lastIndexOf(`/`);t>0&&!n.has(e.slice(0,t));t=e.lastIndexOf(`/`,t-1))n.add(e.slice(0,t));return ii.set(e,n),n}function oi(e){let t=D(e);return ai(t,t.keys())}function si(e,t){for(let n of e.files.values())if(n===t)return!0;for(let n of e.dirs.values())if(si(n,t))return!0;return!1}var ci=class extends bt{static properties={base:{attribute:!1},other:{attribute:!1},files:{attribute:!1},scope:{attribute:!1},resolutions:{attribute:!1},baseAlerts:{attribute:!1},otherAlerts:{attribute:!1},alertTags:{attribute:!1},newHosts:{attribute:!1},newHostTag:{attribute:!1},dependencies:{attribute:!1},openDependency:{attribute:!1},dependencyTags:{attribute:!1},extensions:{attribute:!1},baseName:{},otherName:{},path:{},seek:{attribute:!1},_query:{state:!0},_kinds:{state:!0},_mode:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.base=null,this.other=null,this.files=null,this.scope=``,this.resolutions=[],this.baseAlerts=null,this.otherAlerts=null,this.alertTags=null,this.newHosts=null,this.newHostTag=null,this.extensions=null,this._treeLimit=300,this._treeRemaining=1/0,this.path=null,this._query=``,this._kinds=new Set(fr.map(e=>e.kind)),this._mode=`files`,this._blocks=new Map,this._found=null,this._rowless=new Map,this._rowlessCount=0,this._aligned=new WeakMap,this._sought=null,this._soughtRow=null,this._open=new Map,this._models=new Map,this._modelCap=gr,this._counted=new Map,this._countModels=new Map,this._drawnCounts=new Map,this._drawnTotals=new Map,this._spaced=new Map,this._shorter=new Map,this._larges=new Map,this._expansions=new Map,this._limits=new Map,this._forced=new Set,this._shownPath=null}willUpdate(e){let t=`${this.base?.integrity}|${this.other?.integrity}`;if((t!==this._pair||e.has(`files`))&&(this._pair=t,this._models.clear(),this._spaced.clear(),this._shorter.clear(),this._larges.clear(),this._expansions.clear(),this._limits.clear(),this._forced.clear()),[`files`,`resolutions`,`base`,`other`].some(t=>e.has(t))&&(this._entries=Zt(this.base,this.other,this.files,this.resolutions??[]),this._counted=new Map,this._countModels=new Map,this._drawnCounts=new Map,this._drawnTotals=new Map,this._treeLimit=this.extensions?.treePageSize??1/0,this._blocks.clear(),this._rowless.clear(),this._sought=this._soughtRow=null,this._soughtSettling=!1),e.has(`seek`)&&this.seek&&!Cr.has(this.seek)){Cr.add(this.seek);let{path:e,line:t,query:n}=this.seek,r=this._entries?.get(e),i=r?R(this.base,this.other,e,r).after:null,a=typeof i==`string`?z(i)[t]?.toLowerCase().indexOf(n.toLowerCase())??-1:-1;this._sought={path:e,side:`b`,line:t,at:Math.max(a,0),query:n},this._soughtRow=null,this._soughtSettling=!1}}updated(){if(this._current!==this._shownPath){this._shownPath=this._current;let e=this.querySelector(`.bundle-compare-diff`);e&&(e.scrollTop=0),this.querySelector(`.bundle-compare-code-tree .bundle-code-tree-link.current`)?.scrollIntoView({block:`nearest`})}this._scrollSought()}_scrollSought(){if(this._sought?.path===this._current&&!this._soughtSettling&&(this._sought=null),!this._soughtRow)return;let{path:e,index:t}=this._soughtRow;this._soughtRow=null;let n=[...this.querySelectorAll(`.bundle-compare-diff-table`)].find(t=>t.dataset.path===e)?.children[t];if(!n)return;let r=n.closest(`.bundle-compare-diff`);n.scrollIntoView({block:r&&n.offsetHeight>r.clientHeight/2?`start`:`center`}),n.classList.remove(`is-sought`),n.offsetWidth,n.classList.add(`is-sought`),n.addEventListener(`animationend`,()=>n.classList.remove(`is-sought`),{once:!0})}_shown(e){return this._kinds.has(e.kind)||!!e.modified&&this._kinds.has(`changed`)||!!e.repointed&&this._kinds.has(`repointed`)}_modules(){let e=this.base?.kind===`stasis`?this.base.bundle?.modules:null,t=this.other?.kind===`stasis`?this.other.bundle?.modules:null,n={root:this.files?.root,paths:this.files?.basePaths??new Map};return e||t?new Map([...[...e??[]].map(([e,t])=>[i(n,e,Object.keys(t.files??{})),t]),...t??[]]):null}_baseDirs(){let e=this.files?.root?this.files.basePaths:null;return e?ai(e,e.values()):oi(this.base)}_format(e){let t=this._entries.get(e),n=it(this.base,t?.basePath??e),r=it(this.other,e);return[n,r].find(rt)??(t?.kind===`removed`?n:r)}_tree(){let e=[this._entries,`${[...this._kinds].join()}:${!!this.extensions?.fullPaths}`];if(this._treeKey?.[0]===e[0]&&this._treeKey[1]===e[1])return this._treeMemo;let t=[...this._entries.keys()],n=this._modules(),r=a(this.files?.root,this.extensions?.fullPaths?``:Ae(ft(t).prefix,n,t)),{prefix:i}=r,o=t.filter(e=>this._shown(this._entries.get(e))),s=Oe(o.map(e=>i&&e.startsWith(i)?e.slice(i.length):e),o,n);return this._treeKey=e,this._treeMemo={prefix:i,root:r,tree:s,shown:o.length,allOrder:Ie(s)},this._treeMemo}_select(e){!e||e===this._current||this.extensions?.canSelect?.()===!1||this.dispatchEvent(new CustomEvent(`compare-code-select`,{detail:{path:e},bubbles:!0,composed:!0}))}_reveal(e,t){let n=(t&&e.startsWith(t)?e.slice(t.length):e).split(`/`);for(let e=1;e<n.length;e++)this._open.set(n.slice(0,e).join(`/`),!0)}_railState(){let{prefix:e,root:t,tree:n,shown:r,allOrder:i}=this._tree(),a=je(n,this._mode===`files`?this._query:``,e,this.extensions?.fileFilter);return{prefix:e,root:t,tree:n,shown:r,filtered:a,order:a===n?i:a?Ie(a):[],allOrder:i}}_renderRail({prefix:e,root:t,tree:n,shown:r,filtered:i,order:a},o){this._countUntil=null,this._treeRemaining=this.extensions?.treePageSize?this._treeLimit:1/0,this._treeTruncated=!1;let s=this._mode===`code`?P:i?this._renderTree(i,o,0,!!this._query||r<=(this.extensions?.openAllMax??vr)):N`<div class="bundle-code-search-empty">No changed files match.</div>`,c=Object.fromEntries(fr.map(({kind:e})=>[e,0]));for(let e of this._entries.values())e.kind!==`repointed`&&c[e.kind]++,e.modified&&c.changed++,e.repointed&&c.repointed++;let l=br.find(({mode:e})=>e===this._mode);return N`<aside class="bundle-code-rail"><div class="bundle-code-rail-head"><span class="bundle-code-rail-label">${this.extensions?.railLabel??`Changes`}</span> <span class="bundle-code-rail-count">${this._entries.size.toLocaleString()}</span> <span class="bundle-code-rail-actions"><button type="button" class="bundle-code-rail-action" aria-label="${this.extensions?.collapseLabel??`Collapse directories`}" data-tooltip="Collapse directories" ?disabled="${this._mode!==`files`||!!this._query&&!this.extensions?.collapseClearsSearch||n.dirs.size===0}" @click="${()=>this._collapseAll(n)}">${oe}</button></span></div>${t.from?N`<div class="bundle-code-rail-prefix mono" data-tooltip="${`Root moved: ${t.from} \u2192 ${t.to}`}">${Yt(t)}</div>`:e?N`<div class="bundle-code-rail-prefix mono" data-tooltip-truncated data-tooltip="${e}">${e}</div>`:P}<div class="bundle-compare-code-filter"><label class="bundle-compare-code-search"><svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true"><circle cx="7" cy="7" r="4.5"/><path d="m10.5 10.5 3.5 3.5"/></svg> <input type="search" placeholder="${this._mode===`files`?this.extensions?.searchPlaceholder??l.placeholder:l.placeholder}" aria-label="${this._mode===`files`?this.extensions?.searchLabel??l.placeholder:l.placeholder}" spellcheck="false" autocomplete="off" .value="${E(this._query)}" @input="${e=>{this._query=e.target.value,this._treeLimit=this.extensions?.treePageSize??1/0}}"> <span class="bundle-code-search-modes" role="tablist">${br.map(({mode:e,label:t,icon:n})=>N`<button type="button" class="${A({"bundle-code-search-mode":!0,active:e===this._mode})}" role="tab" aria-selected="${String(e===this._mode)}" aria-label="${t}" data-tooltip="${t}" @click="${()=>{this._mode=e}}">${n}</button>`)}</span></label> ${this.extensions?.filters??N`<div class="bundle-compare-code-kinds" role="group" aria-label="Show changes">${fr.filter(({kind:e})=>c[e]>0).map(({kind:e,label:t})=>N`<button type="button" class="${`bundle-compare-code-kind ${e}`}" aria-pressed="${String(this._kinds.has(e))}" data-tooltip="${`${this._kinds.has(e)?`Hide`:`Show`} ${t.toLowerCase()} files`}" @click="${()=>this._toggleKind(e)}">${t.toLowerCase()}</button>`)}</div>`}</div><div class="bundle-code-rail-body bundle-compare-code-tree">${this._mode===`code`?this._renderSearch(a,o,e):s} ${this._mode===`files`&&this._treeTruncated?N`<button type="button" class="bundle-compare-code-action" @click="${()=>{this._treeLimit+=this.extensions.treePageSize,this.requestUpdate()}}">Show more files</button>`:P}</div>${this.extensions?.footer?.(e=>{this._query=``,this._select(e)})??P}</aside><bundle-code-splitter role="separator" tabindex="0" aria-orientation="vertical" aria-label="Resize file tree" data-tooltip="Drag to resize · double-click to reset"></bundle-code-splitter>`}_arrived=0;_renamesAlone=!0;_repaint=()=>{this._arrived++,this.isConnected&&this.requestUpdate()};disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this._countLater),clearTimeout(this._searchLater),this._countLater=this._searchLater=null}render(){let e=this._railState(),t=this._entries.has(this.path)?this.path:e.order[0]??null;t&&t!==this._current&&this._reveal(t,e.prefix),this._current=t,this._order=this.extensions?.filterContent===!1?e.allOrder:e.order;let n=t?N`${this._renderFile(t,this.extensions?.fullPaths?``:e.prefix)}${this.extensions?.fileActions?.(t,!1)??P}`:N`<div class="bundle-code-placeholder">No files differ in this comparison.</div>`;return N`<div class="bundle-code-view bundle-compare-code">${this._renderRail(e,t)}<div class="bundle-code-main">${n}</div></div>`}_toggleKind(e){let t=new Set(this._kinds);t.has(e)?t.delete(e):t.add(e),this._kinds=t}_collapseAll(e){this.extensions?.collapseClearsSearch&&(this._query=``),this._treeLimit=this.extensions?.treePageSize??1/0;let t=e=>{for(let n of e.dirs.values())this._open.set(n.path,!1),t(n)};t(e),this.requestUpdate()}_renderSearch(e,t,n){if(!this._query)return N`<div class="bundle-code-search-hint">Type to search the code of the changed files.</div>`;let{files:r,hits:i,truncated:a,unsigned:o}=this._searchResults(e);if(r.length===0)return N`<div class="bundle-code-search-empty">No matches.</div>`;let s=e=>n&&e.startsWith(n)?e.slice(n.length):e;return N`<div class="bundle-code-search-results bundle-compare-search"><div class="bundle-code-search-summary">${i.toLocaleString()} ${i===1?`hit`:`hits`} in ${r.length.toLocaleString()} ${r.length===1?`file`:`files`}${a?`, the first ${wn}`:``}</div>${M(r,e=>e.path,({path:e,hits:n})=>N`<div class="${A({"bundle-code-search-file":!0,current:e===t})}"><button type="button" class="${`bundle-code-search-file-name bundle-compare-code-name ${this._entries.get(e).kind}`}" data-tooltip-truncated data-tooltip="${e}" @click="${()=>this._select(e)}">${s(e)}</button> ${o.has(e)?N`<p class="bundle-compare-search-note">${wr[o.get(e)]}</p>`:P}<ul class="bundle-code-search-hits">${n.map(t=>N`<li class="bundle-code-search-hit"><button type="button" class="bundle-code-search-hit-link" aria-label="${`${Tr[t.sign]?.label??`Line`} ${t.line+1}${t.side===`a`?` of the old text`:``}: ${t.text.trim().slice(0,80)}`}" @click="${()=>this._seek(e,t)}"><span class="bundle-code-search-hit-ln">${t.line+1}</span> <span class="${`bundle-compare-search-sign ${Tr[t.sign]?.name??``}`}" aria-hidden="true">${t.sign??``}</span> <span class="bundle-code-search-hit-text mono">${p(t.text,t.ranges)}</span></button></li>`)}</ul></div>`)}</div>`}_searchResults(e){let t=Er(),r=`${this._query}\0${this._forced.size}\0${t}\0${K.layout}\0${!!T.bundleSourcePretty}\0${tt()}\0${this._rowlessCount}\0${e.join(`\0`)}`;if(this._found?.key===r&&this._found.entries===this._entries)return this._found.result;let i=null,a=!0,o=new Map,s={...kn(e.flatMap(e=>{let n=this._entries.get(e);if(!this._searchable(n))return[];let r=R(this.base,this.other,e,n),{before:i,after:a}=r;if(this._prettyShown(e,n,r)){if(!/\S/u.test(this._query))return[];let n=i!==``&&a!==``&&i!==a;if(n&&this._rowless.get(e)===t)return[];o.set(e,n?`printed`:`numbered`)}return[{path:e,...r}]}),d(this._query,!1,!1),(e,t,r)=>{if(o.get(e)===`printed`)return null;let s=`${K.ignoreWhitespace}\0${e}`;if(this._blocks.has(s))return this._blocks.get(s);if(!this._forced.has(e)&&q(t,r))return o.set(e,`large`),null;let c=performance.now();if(i??=c+yr,c>i)return a=!1,null;let l=K.ignoreWhitespace&&!this._unlisted(e,this._entries.get(e),{before:t,after:r}),u=B(t,r,l);return l&&n(t,r,u)&&(u=B(t,r)),this._blocks.set(s,u),u},{split:K.layout===`split`,align:(e,t,n,r)=>{let i=this._aligned.get(n);return i||this._aligned.set(n,i={a:e,b:t,blocks:n}),xn(i,n.indexOf(r))}}),unsigned:o};return a?this._found={key:r,entries:this._entries,result:s}:this._searchLater??=setTimeout(()=>{this._searchLater=null,this.requestUpdate()}),s}_searchable(e){return e.modified!==!1||ni(e)}_prettyShown(e,t,n){if(!T.bundleSourcePretty)return!1;let r=this._printing(e,t,n);return!!r?.applies&&r.copies.status!==`error`}_noteRowless(e,t){let n=t?Er():void 0;this._rowless.get(e)!==n&&(n===void 0?this._rowless.delete(e):this._rowless.set(e,n),this._rowlessCount++)}_seek(e,t){this._sought={path:e,side:t.side,line:t.line,at:t.ranges[0]?.[0]??0,query:this._query},e===this._current?this.requestUpdate():this._select(e,!1)}_soughtLine(e,t,n,r){let{side:i,line:a,at:o,query:s}=this._sought;if(n?.status!==`ready`)return{side:i,line:a};let c=e=>e.replaceAll(/\s+/gu,``),l=z(R(this.base,this.other,e,t)[i===`a`?`before`:`after`]??``),u=l.slice(0,a).reduce((e,t)=>e+c(t).length,0)+c(l[a]?.slice(0,o)??``).length,d=c(s).toLowerCase(),f=(e,t)=>{if(!d)return null;let n=0,r=0,i=0,a=``;for(let o of e)for(let e=0;e<o.length;e+=Sr){a+=c(o.slice(e,e+Sr)).toLowerCase();for(let e=a.indexOf(d,n);e!==-1;e=a.indexOf(d,n),r++){if(t(r,i+e))return{index:r,start:i+e};n=e+d.length}let s=Math.max(n,a.length-d.length+1);a=a.slice(s),i+=s,n=Math.max(0,n-s)}return null},p=f(l,(e,t)=>t>=u),m=(p&&f(r[i],e=>e===p.index)?.start)??u;for(let e=0;e<r[i].length;e++)if(m-=c(r[i][e]).length,m<0)return{side:i,line:e};return null}_seekRows(e,t,{side:n,line:r},i){let a=e=>n===`b`?(e.kind===`ctx`||e.kind===`add`)&&e.b===r||e.kind===`change`&&e.right===r:(e.kind===`ctx`||e.kind===`del`)&&e.a===r||e.kind===`change`&&e.left===r,o=this._expansions.get(e)??new Map,s=vn(t,o,{split:i}),c=s.findIndex(a);if(c===-1){let l=s.find(e=>e.kind===`fold`&&r>=e[n]&&r<e[n]+e.count);if(l){let u=o.get(l.run)??{},d=r-l[n];o=new Map(o).set(l.run,l.down?{...u,top:(u.top??0)+d+1+xr}:l.up?{...u,bottom:(u.bottom??0)+l.count-d+xr}:{all:!0}),this._expansions.set(e,o),s=vn(t,o,{split:i}),c=s.findIndex(a)}}let l=this._limits.get(e)??G;return c>=l&&this._limits.set(e,Math.ceil((c+1)/G)*G),{rows:s,index:c}}_takeTreeRow(e=!1){return this._treeRemaining-->0||(this._treeTruncated=!0,e)}_renderTree(e,t,n,i){let a=[...e.dirs.entries()].toSorted(Fe),o=[...e.files.entries()].toSorted(([e],[t])=>e.localeCompare(t)),s=a.flatMap(([e,r])=>{let a=Me(e,r,n),o=r.package,s=o?.ecosystem===`cargo`||o?.ecosystem===`composer`||o?.ecosystem===`soldeer`,c=this._query?!0:this._open.get(r.path)??(i||n===0||si(r,t)),l=this._baseDirs().has(r.sourcePath)?oi(this.other).has(r.sourcePath)?null:`removed`:`added`;if(!this._takeTreeRow(si(r,t)))return[];let u=N`<li class="bundle-code-tree-dir"><details .open="${E(c)}" @toggle="${e=>{let t=e.currentTarget.open;this._open.get(r.path)!==t&&(this._open.set(r.path,t),this.extensions?.treePageSize&&this.requestUpdate())}}"><summary aria-label="${this.extensions?.directoryLabel?.(a.node)??P}"><span class="bundle-code-tree-chevron" aria-hidden="true"></span> ${o?ot(o.ecosystem):P} <span class="${A({"bundle-code-tree-dirname":!0,"bundle-code-tree-package":!!o,"bundle-code-tree-package-vendored":s,"bundle-compare-code-name":!0,removed:l===`removed`})}" data-tooltip-truncated data-tooltip="${a.node.sourcePath}">${o?N`<span class="bundle-code-tree-package-name">${o.name}</span>${o.version?N`<span class="bundle-code-tree-package-version">${s?`- `:`@`}${o.version}</span>`:P}`:a.names.map((e,t)=>N`${t>0?N`<span class="bundle-code-tree-separator">/</span>`:P}${e}`)} </span>${o?.variant?N`<span class="bundle-code-tree-variant">variant ${o.variant}</span>`:P} <span class="bundle-compare-code-dir-count" data-tooltip="${`${r.fileCount} changed ${r.fileCount===1?`file`:`files`}`}">${this.extensions?.directorySummary?.(a.node)??r.fileCount}</span> ${l?N`<span class="${`bundle-compare-code-letter ${l}`}" data-tooltip="${`${o?`Package`:`Directory`} ${l}`}">${pr[l].letter}</span>`:P}</summary>${c||!this.extensions?.treePageSize?this._renderTree(a.node,t,n+1,i):P}</details></li>`;return[{key:r.path,content:u}]}),c=o.flatMap(([e,n])=>{if(!this._takeTreeRow(n===t))return[];let{kind:i,repointed:a,renamedFrom:o,modified:s}=this._entries.get(n),c=a?`${a.length} repointed ${a.length===1?`import`:`imports`}`:``;return[{key:n,content:N`<li class="bundle-code-tree-file"><button type="button" class="${A({"bundle-code-tree-link":!0,current:n===t})}" aria-label="${this.extensions?.fileLabel?.(n)??P}" aria-current="${n===t?`true`:P}" @click="${()=>this._select(n)}">${this.extensions?.filePrefix?.(n)??P}${at(n,this._format(n))}<span class="${`bundle-code-tree-name bundle-compare-code-name ${i}`}" data-tooltip-truncated data-tooltip="${n}">${e}</span> ${this.extensions?.fileSuffix?.(n)??P} ${o?N`<span class="bundle-compare-code-oldname" data-tooltip-truncated data-tooltip="${`Renamed from ${o}`}">← ${r(o,n,{extension:!1}).from}</span>`:P} ${this._fileTags(n,this._entries.get(n),!0)} ${this._treeCounts(n,this._entries.get(n))} ${a&&i!==`repointed`?N`<span class="bundle-compare-code-letter repointed" data-tooltip="${c}">R</span>`:P} <span class="${A({"bundle-compare-code-letter":!0,[i]:!0,pure:i===`renamed`&&!s})}" data-tooltip="${i===`repointed`?c:o?`Renamed${s?` and modified`:``} from ${o}`:pr[i].label}">${pr[i].letter}</span></button></li>`}]});return N`<ul class="${A({"bundle-code-tree":!0,root:n===0})}" aria-label="${n===0?this.extensions?.treeLabel??`Changed files`:P}" @keydown="${n===0?Ne:P}">${M(s,e=>e.key,e=>e.content)}${M(c,e=>e.key,e=>e.content)}</ul>`}_treeCounts(e,t){if(t.kind===`repointed`)return P;let n=this._lineCounts(e,t),r;if(n===null&&this._counted.has(e)?{published:n,shown:r}=this._largeCounts(e,t):r=n&&this._shownCounts(e,t),!(n||r)||r===void 0)return P;let{additions:i,deletions:a}=r??n,o=!n||n.additions>0||n.deletions>0,s=t.kind===`renamed`,c=r?.renamed>0?`
|
|
17
17
|
\u2248${r.renamed.toLocaleString()} lines differing in renamed names alone, marked`:``,l=n?`
|
|
18
|
-
As published: +${n.additions.toLocaleString()} \u2212${n.deletions.toLocaleString()}`:``,u=r?`${r.aside.join(`, `)}${c}${l}`:null;if(i===0&&a===0){if((s||t.modified===!1)&&!o)return M`<span class="bundle-compare-code-line-counts unchanged" aria-label="No line changes">=</span>`;if(r&&o)return M`<span class="bundle-compare-code-line-counts unchanged" aria-label="${`No line changes with ${r.aside.join(`, `)}`}" data-tooltip="${`No line changes with ${u}`}">≈</span>`}let d=r&&(!n||i!==n.additions||a!==n.deletions);return M`<span class="bundle-compare-code-line-counts" aria-label="${`${i} added, ${a} removed lines`}" data-tooltip="${d?`With ${u}`:N}"><span class="${k({add:!0,empty:s&&i===0})}">+${i.toLocaleString()}</span> <span class="${k({del:!0,empty:t.kind===`added`||s&&a===0})}">−${a.toLocaleString()}</span></span>`}_countingState(e,t){return this._fileState(e,t,!0)}_shownCounts(e,t){if(!(w.bundleSourcePretty||G.ignoreWhitespace||G.ignoreRenames||G.ignoreTypes))return null;let n=`${jr()}\0${this._arrived}\0${this._forced.size}`,r=this._drawnCounts.get(e);if(r?.settings===n)return r.counts;let i=performance.now();if(this._countUntil??=i+br,i>this._countUntil){this._countLater??=setTimeout(()=>{this._countLater=null,this.requestUpdate()});return}let a=this._countingState(e,t),{model:o}=a,s=Mr(a),c=o&&s.length>0?{additions:o.additions,deletions:o.deletions,renamed:o.renamed,aside:s}:null;return this._drawnCounts.set(e,{settings:n,counts:c}),c}_lineCounts(e,t){if(this._counted.has(e))return this._counted.get(e);let n=performance.now();if(this._countUntil??=n+br,n>this._countUntil)return this._countLater??=setTimeout(()=>{this._countLater=null,this.requestUpdate()}),null;let{before:r,after:i}=L(this.base,this.other,e,t),a=fn(r,i);return this._counted.set(e,a),a}_noteDrawn(e,t){let{model:n}=t;return n&&this._drawnTotals.set(e,{settings:jr(),counts:{additions:n.additions,deletions:n.deletions,renamed:n.renamed,aside:Mr(t)}}),t}_largeCounts(e,t){let n=this._drawnTotals.get(e);if(n?.settings===jr())return n.counts.aside.length===0?{published:n.counts,shown:null}:{published:null,shown:n.counts};let r=G.ignoreTypes?L(this.base,this.other,e,t):null;return{published:null,shown:typeof r?.before==`string`&&typeof r.after==`string`&&cr(this.base,this.other,e,t,r,this._repaint,this.scope)?{additions:0,deletions:0,renamed:0,aside:[kr]}:null}}_model(e,t,n,r={},i=G.ignoreWhitespace){let a=r.changes?.blocks??r.marks??null,o=this._models.get(e);return this._models.delete(e),o?.before===t&&o.after===n&&o.given===a||(o={model:sn(t,n,{...r,ignoreWhitespace:i}),before:t,after:n,given:a}),this._models.set(e,o),this._models.size>this._modelCap&&this._models.delete(this._models.keys().next().value),o.model}_counts(e,t,n,r,i){let a=r.changes?.blocks??r.marks??null,o=this._countModels.get(e);if(o?.before===t&&o.after===n&&o.given===a)return o.model;let s=r.changes?.blocks??z(t,n,i),c={blocks:s,...cn(s,r.marks)};return this._countModels.set(e,{model:c,before:t,after:n,given:a}),c}_fileState(e,t,r=!1){let i=L(this.base,this.other,e,t),a=typeof i.before==`string`&&typeof i.after==`string`,o=a&&cr(this.base,this.other,e,t,i,this._repaint,this.scope);if(o&&G.ignoreTypes){let t={a:[],b:[],blocks:[],additions:0,deletions:0,renamed:0,marked:new Set,noEol:{a:!1,b:!1},words:new Map};return r?{pretty:null,hiding:!1,model:t,spacesHidden:!1,typesHidden:!0}:this._noteDrawn(e,{...i,textual:a,large:!1,printing:null,pretty:null,key:null,generated:!1,renamed:!1,warned:[],hiding:!1,changes:null,model:t,whitespace:null,spacesHidden:!1,types:o,typesHidden:!0})}let s=a&&(!r||w.bundleSourcePretty)?this._printing(e,t,i):null,c=w.bundleSourcePretty&&s?.applies?s.copies:null,{before:l,after:u}=c?.status===`ready`?c:i,d=a&&Fr(e)&&Fr(t.basePath??e)&&[`ready`,`loading`,`error`].includes(c?.status)&&this._generated(e,t,i),f=d&&c.status===`ready`;!r&&a&&this._sought?.path===e&&!this._forced.has(e)&&this._large(e,l,u)&&this._forced.add(e);let p=a&&!this._forced.has(e)&&this._large(e,l,u),{basePath:m=e}=t,h=t=>{let n=f&&!p?Xn(this.base,m,i.before,this.other,e,i.after,t,this._repaint,c.hashes,!r&&this._renamesAlone,this.scope):null,o=n?.status===`ready`,s=o&&G.ignoreRenames,h=o&&!s,g=s&&n.reason===null?n.reads:[],_=o&&n.reason===null?n.marks.length>0||G.ignoreRenames&&n.before!==l:G.ignoreRenames&&d,v=Kr(e,c?.status===`ready`,{...G,ignoreWhitespace:t,ignoreRenames:s,markRenames:h}),y=s?n.before:l,b=s?{changes:{blocks:n.blocks}}:h?{marks:n.marks}:{};return{key:v,changes:n,warned:g,renamed:_,hiding:s,shown:y,model:a&&!p&&(!n||o||!G.ignoreRenames)?r?this._counts(v,y,u,b,t):this._model(v,y,u,b,t):null,ignoreWhitespace:t}},g=this._unlisted(e,t,i),_=h(G.ignoreWhitespace&&!g),v=G.ignoreWhitespace&&!g&&!!_.model&&(_.model.mixed??=n(_.shown,u,_.model.blocks));v&&(_=h(!1));let{key:y,changes:b,warned:ee,renamed:te,hiding:x,shown:ne,model:S}=_;if(r)return{pretty:c,hiding:x,model:S,spacesHidden:_.ignoreWhitespace};c?.status===`ready`&&S?this._noteRowless(e,S.blocks.length===0):S&&(this._blocks.set(`${G.ignoreWhitespace}\0${e}`,S.blocks),this._aligned.set(S.blocks,S));let re=S&&!g&&!G.ignoreWhitespace?this._whitespaceHidden(`${e}\0${c?.status===`ready`}\0${x}`,ne,u):null,ie=S===null||g?null:v?`mixed`:G.ignoreWhitespace?ni(S,ne,u)?`hideable`:null:re.hides&&!re.mixed?`hideable`:null;return this._sought?.path===e&&(this._soughtSettling=c?.status===`loading`||G.ignoreRenames&&(b?.status===`loading`||b?.status===`error`)),this._noteDrawn(e,{before:ne,after:u,textual:a,large:p,printing:s,pretty:c,key:y,generated:d,renamed:te,warned:ee,hiding:x,changes:b,model:S,whitespace:ie,spacesHidden:_.ignoreWhitespace,types:o})}_unlisted(e,{basePath:t=e},{before:n,after:r}){return!vn(e,r,Pr(this.other,e))||!vn(t,n,Pr(this.base,t))}_whitespaceHidden(e,t,n){let r=this._spaced.get(e);return r?.before===t&&r.after===n||(r={before:t,after:n,hidden:mn(t,n)}),this._spaced.delete(e),this._spaced.set(e,r),this._spaced.size>this._modelCap&&this._spaced.delete(this._spaced.keys().next().value),r.hidden}_generated(e,{kind:t,basePath:n=e},{before:r,after:i}){return t!==`repointed`&&Ln(this.base,this.other)&&Lr(this.base,n,r)&&Lr(this.other,e,i)}_printing(e,t,n){let{kind:r,basePath:i=e,modified:a}=t,{before:o,after:s}=n;if(r===`repointed`||a===!1||typeof o!=`string`||typeof s!=`string`||o===s||!Ln(this.base,this.other))return null;let c=[[`base`,this.base,i,o],[`other`,this.other,e,s]];if(!c.every(([,,e,t])=>t===``||Ve(e)!==null&&Zr(t)))return null;let l=c.some(([,e,t,n])=>n!==``&&rt(e,e,t,n)),d=c.map(([e,,t,n])=>n===``?{status:`ready`,text:n}:u(this.base,this.other,e,t,n,this._repaint)),f=d.find(e=>e.status===`error`)??d.find(e=>e.status===`loading`)??{status:`ready`,before:d[0].text,after:d[1].text,hashes:d.map(e=>e.hash)},p=!l&&o!==``&&s!==``&&f.status===`ready`&&this._smaller(e,n,f);return{copies:f,minified:l,smaller:p,applies:l||p}}_large(e,t,n){let r=this._larges.get(e);if(r?.before===t&&r.after===n)return r.large;let i=K(t,n);return this._larges.set(e,{before:t,after:n,large:i}),i}_smaller(e,{before:t,after:n},r){let i=this._shorter.get(e);if(i?.before===t&&i.after===n&&i.printed===r.before&&i.printedAfter===r.after)return i.smaller;let a=(e,t)=>z(e,t).reduce((e,{a0:t,a1:n,b0:r,b1:i})=>e+n-t+i-r,0),o=!K(t,n)&&!K(r.before,r.after)&&a(r.before,r.after)<a(t,n);return this._shorter.set(e,{before:t,after:n,printed:r.before,printedAfter:r.after,smaller:o}),o}_fileMessage(e,{kind:t,modified:n,meta:r},{before:i,after:a,textual:o,large:s,model:c,pretty:l,hiding:u,warned:f=[],changes:p,whitespace:m,typesHidden:h=!1}){let g=e=>O(e??0),_=fr(r),v=`${t===`renamed`?_?`Renamed, its contents the same.`:`Renamed without changes.`:`The contents are the same.`}${_?` ${_}`:``}`;if(o&&n===!1)return M`<div class="bundle-compare-code-message"><p>${v}</p></div>`;if(!o){if(t===`changed`&&n===!1)return M`<div class="bundle-compare-code-message">Binary file, its bytes the same · ${g(D(a))}. ${_}</div>`;let e=t===`added`?g(D(a)):t===`removed`?g(D(i)):`${g(D(i))} \u2192 ${g(D(a))}`;return M`<div class="bundle-compare-code-message">Binary file ${t} · ${e}. A text diff is not available.${_?` ${_}`:``}</div>`}if(s)return M`<div class="bundle-compare-code-message"><p>This diff is large (${(Xr(i)+Xr(a)).toLocaleString()} lines across both sides) and may take a few seconds to compute.</p><button type="button" class="bundle-compare-code-action" @click="${()=>{this._forced.add(e),this.requestUpdate()}}">Show diff</button></div>`;if(h)return M`<div class="bundle-compare-code-message"><p>Only types changed in this file.${_?` ${_}`:``}</p><button type="button" class="bundle-compare-code-action" @click="${()=>this._setTypes(!1)}">Show type-only changes</button></div>`;if(p?.status===`loading`&&G.ignoreRenames)return M`<div class="bundle-compare-code-message" aria-busy="true">Hiding renamed names…</div>`;if(p?.status===`error`&&G.ignoreRenames)return M`<div class="bundle-compare-code-message"><p>Couldn't hide renamed names: ${p.message}</p><button type="button" class="bundle-compare-code-action" @click="${()=>this._setRenames(!1)}">Show renamed names</button></div>`;if(c.blocks.length>0)return null;let y=l?.status===`ready`&&l.before===l.after,b=!y&&G.ignoreWhitespace&&m===`hideable`,ee=!y&&u,te=[b&&`whitespace`,ee&&`renamed names`].filter(Boolean),x=y?`No actual code changes in this file.`:te.length>0?`Only ${te.join(` and `)} changed in this file.`:null;return M`<div class="bundle-compare-code-message"><p>${x?`${x}${_?` ${_}`:``}`:v}</p>${f.length>0?M`<p>${Gr(f)}</p>`:N} ${y?M`<button type="button" class="bundle-compare-code-action" @click="${()=>{d(),this.requestUpdate()}}">Show as published</button>`:N} ${b?M`<button type="button" class="bundle-compare-code-action" @click="${()=>this._setWhitespace(!1)}">Show whitespace changes</button>`:N} ${ee?M`<button type="button" class="bundle-compare-code-action" @click="${()=>this._setRenames(!1)}">Show renamed names</button>`:N}</div>`}_fileName(e,t,n){let r=e=>n&&e.startsWith(n)?e.slice(n.length):e;return M`<span class="${k({"bundle-compare-code-pill":!0,[t.kind]:!0,pure:t.kind===`renamed`&&!t.modified})}">${mr[t.kind].label}</span> ${ot(e,this._format(e))} <span class="bundle-code-main-path mono" data-tooltip-truncated data-tooltip="${t.renamedFrom?`${t.renamedFrom} \u2192 ${e}`:e}">${t.renamedFrom?Yt(r(t.renamedFrom),r(e)):r(e)}</span> ${this._fileTags(e,t)}${this._githubLink(e,t)}`}_fileTags(e,t,n=!1){if(!n)return M`${this._entryTags(e,t)}${this._alertTags(e,t)}${this._runsTags(e,t)}${this._newHostTags(e,t)}${this._flagTags(e,t)}${this._readability(e,t)}${this._installTags(e,t)}${ur(t.meta)}`;let r=[this._alertTags(e,t),this._runsTags(e,t),this._newHostTags(e,t),this._flagTags(e,t,!1),this._treeTag(e,t),this._installTags(e,t,!0),ur(t.meta,!0)];return ii(r)?r:this._flagTags(e,t)}_githubLink(e,{kind:t,basePath:n=e}){let r=t===`removed`?Ie(this.base,n):Ie(this.other,e);return r?Le(r):N}_alertTags(e,{kind:t,basePath:n=e}){let r=t===`removed`?this.baseAlerts?.get(n):this.otherAlerts?.get(e);return r?.length>0&&this.alertTags?this.alertTags(r):N}_newHostTags(e,{kind:t}){let n=t===`removed`?null:this.newHosts?.get(e);return n&&this.newHostTag?this.newHostTag(n):N}_runsTags(e,t){return[[re,ae],[ce,de]].map(([n,r])=>{let{was:i,now:a}=this._reads(e,t,n);return t.kind===`removed`?r(i):r(a,i)})}_entryTags(e,{kind:t,basePath:n=e}){let r=Br(t===`removed`?this.base:this.other).get(t===`removed`?n:e)??[];return[...Map.groupBy(r,({label:e})=>e)].map(([e,t])=>M`<span class="${`bundle-compare-code-entry${e===`license`?` is-license`:``}`}" data-tooltip="${t.map(({note:e})=>e).join(` · `)}">${e}</span>`)}_installTags(e,t,n=!1){if(!Vr.test(e))return N;let{kind:r,basePath:i=e}=t,{before:a,after:o}=L(this.base,this.other,e,t),s=new Map(r===`added`||a===void 0?[]:Ur(this.base,i,a)),c=new Map(r===`removed`||o===void 0?[]:Ur(this.other,e,o)),l=[...r===`removed`?s:c].map(([e,t])=>{let n=r===`removed`?t:s.get(e),i=n===void 0?`, new`:n===t?``:`, was: ${n}`;return M`<span class="bundle-compare-code-install" data-tooltip="${`${t}${i}`}">${e}</span>`});if(!n&&r!==`removed`)for(let[e,t]of s)c.has(e)||l.push(M`<span class="bundle-compare-code-install is-dropped" data-tooltip="${`No longer run on install: ${t}`}">${e}</span>`);return l}_reads(e,t,n=He){let{kind:r,basePath:i=e}=t,{before:a,after:o}=L(this.base,this.other,e,t);return{was:r===`added`?null:a===void 0?void 0:n(this.base,i,a),now:r===`removed`||o===void 0?null:n(this.other,e,o)}}_readability(e,t){let{was:n,now:r}=this._reads(e,t),i=e=>M`${We(e)}${Ge(e)}`,a=!n||!r||ct(n)===ct(r)&&n.kind===r.kind?i(r??n):M`<span class="bundle-compare-code-readability">${i(n)}<span aria-hidden="true">→</span>${i(r)}</span>`;return M`${qe(r??n)}${a}`}_flagTags(e,t,n=!0){return t.kind===`removed`?Xe(this.base,t.basePath??e,t.baseBytes,n):Xe(this.other,e,t.otherBytes,n)}_treeTag(e,t){let{was:n,now:r}=this._reads(e,t),i=r??n;if(!i)return N;let a=i.category!==`map`&&ut.get(ct(i)).mark;return M`${qe(i,[`warn`])}${a?We(i,!0):N}`}_fileFigures({kind:e,baseBytes:t,otherBytes:n},r){let i=e=>O(e??0);return M`${r?.blocks.length>(r?.marked?.size??0)?ti(r.additions,r.deletions):N} ${r?.renamed>0?M`<span class="bundle-compare-code-renamed" aria-label="${`${r.renamed} lines differing in renamed names alone`}" data-tooltip="Lines differing in renamed names alone, marked">≈${r.renamed}</span>`:N} <span class="bundle-code-main-stats">${e===`added`?i(n):e===`removed`?i(t):`${i(t)} \u2192 ${i(n)}`}</span>`}_highlighted(e,t,n,r=``){if(!n)return null;let i=ft(t,Pr(e,t),n);if(!i)return null;let a=`${e.integrity}\0${t}${r?`\0${r}`:``}`,o=qr.get(a);return o?.text===n?o.lines:(Jr.has(a)||(Jr.add(a),(async()=>{let e=await Ke(n,i),t=typeof e==`string`?Ye(e):null;qr.set(a,{text:n,lines:t?.length===n.split(`
|
|
19
|
-
`).length?t:null}),
|
|
20
|
-
`):[],a=n?this._highlighted(this._textSide(e),e,n):null,o=this._importLines(t,i),s=e=>e||`(empty target)`;return M`<section class="bundle-compare-code-repointed" aria-label="Repointed imports"><h4>Repointed ${t.length===1?`import`:`imports`} <b>${t.length}</b></h4><ul>${t.map(e=>{let t=o.get(e.specifier),n=`${e.conditions}${e.platform===null?``:` \xB7 Platform: ${e.platform}`}`;return M`<li><div class="bundle-compare-code-repointed-spec"><code data-tooltip-truncated data-tooltip="${e.specifier}">${e.specifier}</code> <span data-tooltip-truncated data-tooltip="${n}">${n}</span></div><div class="bundle-compare-code-repointed-targets"><span class="before"><span>Before</span><code data-tooltip-truncated data-tooltip="${s(e.baseTarget)}">${s(e.baseTarget)}</code></span> <span aria-hidden="true">→</span> <span class="after"><span>After</span><code data-tooltip-truncated data-tooltip="${s(e.otherTarget)}">${s(e.otherTarget)}</code></span></div>${t.slice(0,vr).map(t=>this._importLine(t,i[t],a?.[t],e.specifier,r))} ${t.length>vr?M`<span class="bundle-compare-code-repointed-more">and ${t.length-vr} more ${t.length-vr===1?`line`:`lines`}</span>`:N}</li>`})}</ul></section>`}_importLine(e,t,n,r,i){let a=t.length>240?Math.max(0,t.indexOf(r)-80):0;return M`<button type="button" class="bundle-compare-code-repointed-line bundle-compare-diff-table" ?disabled="${!i}" aria-label="${`Go to line ${e+1}`}" @click="${()=>this._goToLine(e+1)}"><span class="diff-num">${e+1}</span> <code>${t.length<=240&&typeof n==`string`?bt(Ze(n,!0)):De(`${a>0?`…`:``}${t.slice(a,a+240)}${t.length>a+240?`…`:``}`,!0)}</code></button>`}_goToLine(e){let t=`${this._current}\0source`;e>(this._limits.get(t)??W)&&(this._limits.set(t,Math.ceil(e/W)*W),this.requestUpdate()),this.updateComplete.then(()=>this.querySelector(`.bundle-compare-diff [data-line="${e}"]`)?.scrollIntoView({block:`center`}))}_renderSource(e,t,n,{key:r,pretty:i}){let a=this._model(r,t,t),o={model:a,b:this._highlighted(this._textSide(e),e,t,i?.status===`ready`?`pretty`:``)},s=new Set([...this._importLines(n,a.b).values()].flat()),c=`${e}\0source`,l=this._sought?.path===e&&this._sought.key!==r?this._soughtLine(e,this._entries.get(e),i,a):null;this._sought?.path===e&&(this._sought.key=r),l&&l.line<a.b.length&&(l.line>=(this._limits.get(c)??W)&&this._limits.set(c,Math.ceil((l.line+1)/W)*W),this._soughtRow={path:e,index:l.line});let u=this._limits.get(c)??W,d=a.b.length>u?a.b.slice(0,u):a.b;return M`<div class="bundle-compare-diff-table single" data-path="${e}" style="${A({"--diff-num-width":`${String(a.b.length).length+1}ch`})}" role="table" aria-label="Source">${j(d,(e,t)=>t,(e,t)=>M`<div class="${k({"diff-row":!0,ctx:!0,"is-import":s.has(t)})}" role="row" data-line="${t+1}"><span class="diff-num">${t+1}</span>${this._codeCell(o,`b`,t,null)}</div>`)}</div>${a.b.length>d.length?M`<div class="bundle-compare-code-more"><button type="button" class="bundle-compare-code-action" @click="${()=>{this._limits.set(c,u+W),this.requestUpdate()}}">Show ${Math.min(W,a.b.length-d.length).toLocaleString()} more lines</button> <span>${(a.b.length-d.length).toLocaleString()} not shown</span></div>`:N}`}_hides(e,t,n){let r=[e&&[`Renames`,Or,G.ignoreRenames,()=>this._setRenames(!G.ignoreRenames)],t&&[`Whitespace`,Ar,G.ignoreWhitespace,()=>this._setWhitespace(!G.ignoreWhitespace)],n&&[`Type-only`,kr,G.ignoreTypes,()=>this._setTypes(!G.ignoreTypes)]].filter(Boolean);return r.length===0?N:M`<span class="bundle-compare-code-hide" role="group" aria-label="Hide"><span class="bundle-compare-code-hide-label" aria-hidden="true">Hide:</span>${r.map(([e,t,n,r])=>M`<mode-switch compact="compact" borderless .checked="${n}" accessible-label="${t}" label="${e}" @click="${r}"></mode-switch>`)}</span>`}_setWhitespace(e){G.ignoreWhitespace=e,this.requestUpdate()}_setTypes(e){G.ignoreTypes=e,this.requestUpdate()}_setRenames(e){G.ignoreRenames=e,e&&Zn(),this.requestUpdate()}_renderDiff(e,t,{after:n,before:r,key:i,model:a,pretty:o,changes:s,hiding:c,warned:l=[],whitespace:u=null}){let{kind:d,basePath:f=e}=t,p=G.layout===`split`,m=this._sought?.path===e&&this._sought.key!==i?this._soughtLine(e,t,o,a):null;this._sought?.path===e&&(this._sought.key=i);let h=m?this._seekRows(i,a,m,p):null;h?.index>=0&&(this._soughtRow={path:e,index:h.index+ +!!p});let g=this._expansions.get(i)??new Map,_=h?.rows??yn(a,g,{split:p}),v=this._limits.get(i)??W,y=_.length>v?_.slice(0,v):_,b={model:a,a:d===`added`?null:this._highlighted(this.base,f,r,c?`renamed\0${this.other.integrity}\0${e}`:o?.status===`ready`?`pretty`:``),b:d===`removed`?null:this._highlighted(this.other,e,n,o?.status===`ready`?`pretty`:``),expand:(e,t)=>{let n=new Map(g);n.set(e,t===`all`?{all:!0}:{...n.get(e),[t]:(n.get(e)?.[t]??0)+B}),this._expansions.set(i,n),this.requestUpdate()}},ee=String(Math.max(a.a.length,a.b.length,1)).length;return M`${G.ignoreRenames&&s?.reason?M`<p class="bundle-compare-code-note">Renamed names are shown: ${Wr[s.reason]??s.reason}.</p>`:N} ${Nr[u]?M`<p class="bundle-compare-code-note">${Nr[u]}</p>`:N} ${l.length>0?M`<p class="bundle-compare-code-note">${Gr(l)} <button type="button" @click="${()=>this._setRenames(!1)}">Show them marked</button></p>`:N}<div class="${k({"bundle-compare-diff-table":!0,split:p,unified:!p})}" data-path="${e}" style="${A({"--diff-num-width":`${ee+1}ch`})}" role="table" aria-label="Diff">${p?M`<div class="diff-row diff-split-head" role="row"><span class="diff-half">Before<strong data-tooltip-truncated data-tooltip="${this.baseName}">${this.baseName}</strong></span> <span class="diff-half">After<strong data-tooltip-truncated data-tooltip="${this.otherName}">${this.otherName}</strong></span></div>`:N} ${j(y,e=>this._rowKey(e),e=>p?this._splitRow(e,b):this._unifiedRow(e,b))}</div>${_.length>y.length?M`<div class="bundle-compare-code-more"><button type="button" class="bundle-compare-code-action" @click="${()=>{this._limits.set(i,v+W),this.requestUpdate()}}">Show ${Math.min(W,_.length-y.length).toLocaleString()} more rows</button> <span>${(_.length-y.length).toLocaleString()} not shown</span></div>`:N}`}_rowKey(e){return e.kind===`fold`?`f${e.run}:${e.a}`:e.kind===`change`?`c${e.left??``}:${e.right??``}`:`${e.kind}${e.a??``}:${e.b??``}`}_words(t,n,r){if(n==null||r==null)return null;let i=`${n}:${r}`;return t.words.has(i)||t.words.set(i,e(t.a[n],t.b[r])),t.words.get(i)}_code(e,t,n,r){let i=r&&!(e.endsWith(`\r`)&&n?.at(-1)?.[1]===e.length);if(typeof t==`string`)return bt(Ze(Cn(t,n),i));if(n){let t=wn(e,n);return t.map((e,n)=>{let r=De(e.text,i&&n===t.length-1);return e.marked?M`<mark class="diff-word">${r}</mark>`:r})}return De(e,i)}_cell(e,t,n,r,i){return n==null?M`<span class="diff-num"></span><span class="diff-sign"></span><span class="diff-code diff-empty"></span>`:M`<span class="diff-num">${n+1}</span><span class="diff-sign">${r}</span>${this._codeCell(e,t,n,i)}`}_noEol(e,t,n){return n!=null&&e.noEol[t]&&n===e[t].length-1}_fold(e,t){let n=e.count<=B;return M`<div class="diff-row diff-fold" role="row"><span class="diff-fold-actions">${!n&&e.down?M`<button type="button" aria-label="${`Show ${B} more lines below`}" data-tooltip="${`Show ${B} more lines`}" @click="${()=>t.expand(e.run,`top`)}"><svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 3v9m-4-4 4 4 4-4"/></svg></button>`:N} ${!n&&e.up?M`<button type="button" aria-label="${`Show ${B} more lines above`}" data-tooltip="${`Show ${B} more lines`}" @click="${()=>t.expand(e.run,`bottom`)}"><svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 13V4M4 8l4-4 4 4"/></svg></button>`:N} <button type="button" aria-label="${`Show all ${e.count} unchanged lines`}" data-tooltip="Show all" @click="${()=>t.expand(e.run,`all`)}"><svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m4 6 4-4 4 4M4 10l4 4 4-4"/></svg></button> </span><span class="diff-fold-label">${e.count.toLocaleString()} unchanged ${e.count===1?`line`:`lines`} · ${e.b+1}–${e.b+e.count}</span></div>`}_unifiedRow(e,t){let{model:n}=t;if(e.kind===`fold`)return this._fold(e,t);if(e.kind===`ctx`)return M`<div class="diff-row ctx" role="row"><span class="diff-num">${e.a+1}</span>${this._cell(t,`b`,e.b,` `,null)}</div>`;let r=e.kind===`del`,i=r?this._words(n,e.a,e.pair)?.a:this._words(n,e.pair,e.b)?.b,a=n.marked?.has(e.change);return M`<div class="${`diff-row ${e.kind}${a?` renamed`:``}`}" role="row" data-tooltip="${a?`Renamed names alone`:N}">${r?M`<span class="diff-num">${e.a+1}</span><span class="diff-num"></span><span class="diff-sign">−</span>${this._codeCell(t,`a`,e.a,i)}`:M`<span class="diff-num"></span><span class="diff-num">${e.b+1}</span><span class="diff-sign">+</span>${this._codeCell(t,`b`,e.b,i)}`}</div>`}_codeCell(e,t,n,r){let i=e.model[t],a=e[t]?.[n],o=i[n],s=this._noEol(e.model,t,n),c=Yr.get(i);c||Yr.set(i,c=new Map);let l=c.get(n);return(!l||l.markup!==a||l.ranges!==r||l.noEol!==s)&&c.set(n,l={markup:a,ranges:r,noEol:s,drawn:this._code(o,a,r,!s)}),M`<span class="${k({"diff-code":!0,"diff-long":o.length>Ee})}">${l.drawn}${s?M`<span class="diff-no-eol" data-tooltip="No newline at end of file" aria-label="No newline at end of file">⊘</span>`:N}</span>`}_splitRow(e,t){let{model:n}=t;if(e.kind===`fold`)return this._fold(e,t);if(e.kind===`ctx`)return M`<div class="diff-row ctx" role="row"><span class="diff-half">${this._cell(t,`a`,e.a,` `,null)}</span> <span class="diff-half">${this._cell(t,`b`,e.b,` `,null)}</span></div>`;let r=e.paired?this._words(n,e.left,e.right):null,i=n.marked?.has(e.change);return M`<div class="${`diff-row change${i?` renamed`:``}`}" role="row" data-tooltip="${i?`Renamed names alone`:N}"><span class="${k({"diff-half":!0,del:e.left!==null,blank:e.left===null})}">${this._cell(t,`a`,e.left,`−`,r?.a)}</span> <span class="${k({"diff-half":!0,add:e.right!==null,blank:e.right===null})}">${this._cell(t,`b`,e.right,`+`,r?.b)}</span></div>`}};customElements.define(`bundle-compare-code`,li);var ui=Symbol.for(``),di=e=>{if(e?.r===ui)return e?._$litStatic$},fi=(e,...t)=>({_$litStatic$:t.reduce((t,n,r)=>t+(e=>{if(e._$litStatic$!==void 0)return e._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${e}. Use 'unsafeStatic' to pass non-literal values, but
|
|
21
|
-
take care to ensure page security.`)})(n)+e[r+1],e[0]),r:
|
|
18
|
+
As published: +${n.additions.toLocaleString()} \u2212${n.deletions.toLocaleString()}`:``,u=r?`${r.aside.join(`, `)}${c}${l}`:null;if(i===0&&a===0){if((s||t.modified===!1)&&!o)return N`<span class="bundle-compare-code-line-counts unchanged" aria-label="No line changes">=</span>`;if(r&&o)return N`<span class="bundle-compare-code-line-counts unchanged" aria-label="${`No line changes with ${r.aside.join(`, `)}`}" data-tooltip="${`No line changes with ${u}`}">≈</span>`}let d=r&&(!n||i!==n.additions||a!==n.deletions);return N`<span class="bundle-compare-code-line-counts" aria-label="${`${i} added, ${a} removed lines`}" data-tooltip="${d?`With ${u}`:P}"><span class="${A({add:!0,empty:s&&i===0})}">+${i.toLocaleString()}</span> <span class="${A({del:!0,empty:t.kind===`added`||s&&a===0})}">−${a.toLocaleString()}</span></span>`}_countingState(e,t){return this._fileState(e,t,!0)}_shownCounts(e,t){if(!(T.bundleSourcePretty||K.ignoreWhitespace||K.ignoreRenames||K.ignoreTypes))return null;let n=`${Ar()}\0${this._arrived}\0${this._forced.size}`,r=this._drawnCounts.get(e);if(r?.settings===n)return r.counts;let i=performance.now();if(this._countUntil??=i+yr,i>this._countUntil){this._countLater??=setTimeout(()=>{this._countLater=null,this.requestUpdate()});return}let a=this._countingState(e,t),{model:o}=a,s=jr(a),c=o&&s.length>0?{additions:o.additions,deletions:o.deletions,renamed:o.renamed,aside:s}:null;return this._drawnCounts.set(e,{settings:n,counts:c}),c}_lineCounts(e,t){if(this._counted.has(e))return this._counted.get(e);let n=performance.now();if(this._countUntil??=n+yr,n>this._countUntil)return this._countLater??=setTimeout(()=>{this._countLater=null,this.requestUpdate()}),null;let{before:r,after:i}=R(this.base,this.other,e,t),a=dn(r,i);return this._counted.set(e,a),a}_noteDrawn(e,t){let{model:n}=t;return n&&this._drawnTotals.set(e,{settings:Ar(),counts:{additions:n.additions,deletions:n.deletions,renamed:n.renamed,aside:jr(t)}}),t}_largeCounts(e,t){let n=this._drawnTotals.get(e);if(n?.settings===Ar())return n.counts.aside.length===0?{published:n.counts,shown:null}:{published:null,shown:n.counts};let r=K.ignoreTypes?R(this.base,this.other,e,t):null;return{published:null,shown:typeof r?.before==`string`&&typeof r.after==`string`&&sr(this.base,this.other,e,t,r,this._repaint,this.scope)?{additions:0,deletions:0,renamed:0,aside:[Or]}:null}}_model(e,t,n,r={},i=K.ignoreWhitespace){let a=r.changes?.blocks??r.marks??null,o=this._models.get(e);return this._models.delete(e),o?.before===t&&o.after===n&&o.given===a||(o={model:on(t,n,{...r,ignoreWhitespace:i}),before:t,after:n,given:a}),this._models.set(e,o),this._models.size>this._modelCap&&this._models.delete(this._models.keys().next().value),o.model}_counts(e,t,n,r,i){let a=r.changes?.blocks??r.marks??null,o=this._countModels.get(e);if(o?.before===t&&o.after===n&&o.given===a)return o.model;let s=r.changes?.blocks??B(t,n,i),c={blocks:s,...sn(s,r.marks)};return this._countModels.set(e,{model:c,before:t,after:n,given:a}),c}_fileState(e,t,r=!1){let i=R(this.base,this.other,e,t),a=typeof i.before==`string`&&typeof i.after==`string`,o=a&&sr(this.base,this.other,e,t,i,this._repaint,this.scope);if(o&&K.ignoreTypes){let t={a:[],b:[],blocks:[],additions:0,deletions:0,renamed:0,marked:new Set,noEol:{a:!1,b:!1},words:new Map};return r?{pretty:null,hiding:!1,model:t,spacesHidden:!1,typesHidden:!0}:this._noteDrawn(e,{...i,textual:a,large:!1,printing:null,pretty:null,key:null,generated:!1,renamed:!1,warned:[],hiding:!1,changes:null,model:t,whitespace:null,spacesHidden:!1,types:o,typesHidden:!0})}let s=a&&(!r||T.bundleSourcePretty)?this._printing(e,t,i):null,c=T.bundleSourcePretty&&s?.applies?s.copies:null,{before:l,after:u}=c?.status===`ready`?c:i,d=a&&Pr(e)&&Pr(t.basePath??e)&&[`ready`,`loading`,`error`].includes(c?.status)&&this._generated(e,t,i),f=d&&c.status===`ready`;!r&&a&&this._sought?.path===e&&!this._forced.has(e)&&this._large(e,l,u)&&this._forced.add(e);let p=a&&!this._forced.has(e)&&this._large(e,l,u),{basePath:m=e}=t,h=t=>{let n=f&&!p?Yn(this.base,m,i.before,this.other,e,i.after,t,this._repaint,c.hashes,!r&&this._renamesAlone,this.scope):null,o=n?.status===`ready`,s=o&&K.ignoreRenames,h=o&&!s,g=s&&n.reason===null?n.reads:[],_=o&&n.reason===null?n.marks.length>0||K.ignoreRenames&&n.before!==l:K.ignoreRenames&&d,v=Gr(e,c?.status===`ready`,{...K,ignoreWhitespace:t,ignoreRenames:s,markRenames:h}),y=s?n.before:l,b=s?{changes:{blocks:n.blocks}}:h?{marks:n.marks}:{};return{key:v,changes:n,warned:g,renamed:_,hiding:s,shown:y,model:a&&!p&&(!n||o||!K.ignoreRenames)?r?this._counts(v,y,u,b,t):this._model(v,y,u,b,t):null,ignoreWhitespace:t}},g=this._unlisted(e,t,i),_=h(K.ignoreWhitespace&&!g),v=K.ignoreWhitespace&&!g&&!!_.model&&(_.model.mixed??=n(_.shown,u,_.model.blocks));v&&(_=h(!1));let{key:y,changes:b,warned:x,renamed:ee,hiding:S,shown:te,model:C}=_;if(r)return{pretty:c,hiding:S,model:C,spacesHidden:_.ignoreWhitespace};c?.status===`ready`&&C?this._noteRowless(e,C.blocks.length===0):C&&(this._blocks.set(`${K.ignoreWhitespace}\0${e}`,C.blocks),this._aligned.set(C.blocks,C));let ne=C&&!g&&!K.ignoreWhitespace?this._whitespaceHidden(`${e}\0${c?.status===`ready`}\0${S}`,te,u):null,re=C===null||g?null:v?`mixed`:K.ignoreWhitespace?ti(C,te,u)?`hideable`:null:ne.hides&&!ne.mixed?`hideable`:null;return this._sought?.path===e&&(this._soughtSettling=c?.status===`loading`||K.ignoreRenames&&(b?.status===`loading`||b?.status===`error`)),this._noteDrawn(e,{before:te,after:u,textual:a,large:p,printing:s,pretty:c,key:y,generated:d,renamed:ee,warned:x,hiding:S,changes:b,model:C,whitespace:re,spacesHidden:_.ignoreWhitespace,types:o})}_unlisted(e,{basePath:t=e},{before:n,after:r}){return!_n(e,r,Nr(this.other,e))||!_n(t,n,Nr(this.base,t))}_whitespaceHidden(e,t,n){let r=this._spaced.get(e);return r?.before===t&&r.after===n||(r={before:t,after:n,hidden:pn(t,n)}),this._spaced.delete(e),this._spaced.set(e,r),this._spaced.size>this._modelCap&&this._spaced.delete(this._spaced.keys().next().value),r.hidden}_generated(e,{kind:t,basePath:n=e},{before:r,after:i}){return t!==`repointed`&&In(this.base,this.other)&&Ir(this.base,n,r)&&Ir(this.other,e,i)}_printing(e,t,n){let{kind:r,basePath:i=e,modified:a}=t,{before:o,after:s}=n;if(r===`repointed`||a===!1||typeof o!=`string`||typeof s!=`string`||o===s||!In(this.base,this.other))return null;let c=[[`base`,this.base,i,o],[`other`,this.other,e,s]];if(!c.every(([,,e,t])=>t===``||Be(e)!==null&&Xr(t)))return null;let l=c.some(([,e,t,n])=>n!==``&&nt(e,e,t,n)),d=c.map(([e,,t,n])=>n===``?{status:`ready`,text:n}:u(this.base,this.other,e,t,n,this._repaint)),f=d.find(e=>e.status===`error`)??d.find(e=>e.status===`loading`)??{status:`ready`,before:d[0].text,after:d[1].text,hashes:d.map(e=>e.hash)},p=!l&&o!==``&&s!==``&&f.status===`ready`&&this._smaller(e,n,f);return{copies:f,minified:l,smaller:p,applies:l||p}}_large(e,t,n){let r=this._larges.get(e);if(r?.before===t&&r.after===n)return r.large;let i=q(t,n);return this._larges.set(e,{before:t,after:n,large:i}),i}_smaller(e,{before:t,after:n},r){let i=this._shorter.get(e);if(i?.before===t&&i.after===n&&i.printed===r.before&&i.printedAfter===r.after)return i.smaller;let a=(e,t)=>B(e,t).reduce((e,{a0:t,a1:n,b0:r,b1:i})=>e+n-t+i-r,0),o=!q(t,n)&&!q(r.before,r.after)&&a(r.before,r.after)<a(t,n);return this._shorter.set(e,{before:t,after:n,printed:r.before,printedAfter:r.after,smaller:o}),o}_fileMessage(e,{kind:t,modified:n,meta:r},{before:i,after:a,textual:o,large:s,model:c,pretty:l,hiding:u,warned:d=[],changes:p,whitespace:m,typesHidden:h=!1}){let g=e=>k(e??0),_=dr(r),v=`${t===`renamed`?_?`Renamed, its contents the same.`:`Renamed without changes.`:`The contents are the same.`}${_?` ${_}`:``}`;if(o&&n===!1)return N`<div class="bundle-compare-code-message"><p>${v}</p></div>`;if(!o){if(t===`changed`&&n===!1)return N`<div class="bundle-compare-code-message">Binary file, its bytes the same · ${g(O(a))}. ${_}</div>`;let e=t===`added`?g(O(a)):t===`removed`?g(O(i)):`${g(O(i))} \u2192 ${g(O(a))}`;return N`<div class="bundle-compare-code-message">Binary file ${t} · ${e}. A text diff is not available.${_?` ${_}`:``}</div>`}if(s)return N`<div class="bundle-compare-code-message"><p>This diff is large (${(Yr(i)+Yr(a)).toLocaleString()} lines across both sides) and may take a few seconds to compute.</p><button type="button" class="bundle-compare-code-action" @click="${()=>{this._forced.add(e),this.requestUpdate()}}">Show diff</button></div>`;if(h)return N`<div class="bundle-compare-code-message"><p>Only types changed in this file.${_?` ${_}`:``}</p><button type="button" class="bundle-compare-code-action" @click="${()=>this._setTypes(!1)}">Show type-only changes</button></div>`;if(p?.status===`loading`&&K.ignoreRenames)return N`<div class="bundle-compare-code-message" aria-busy="true">Hiding renamed names…</div>`;if(p?.status===`error`&&K.ignoreRenames)return N`<div class="bundle-compare-code-message"><p>Couldn't hide renamed names: ${p.message}</p><button type="button" class="bundle-compare-code-action" @click="${()=>this._setRenames(!1)}">Show renamed names</button></div>`;if(c.blocks.length>0)return null;let y=l?.status===`ready`&&l.before===l.after,b=!y&&K.ignoreWhitespace&&m===`hideable`,x=!y&&u,ee=[b&&`whitespace`,x&&`renamed names`].filter(Boolean),S=y?`No actual code changes in this file.`:ee.length>0?`Only ${ee.join(` and `)} changed in this file.`:null;return N`<div class="bundle-compare-code-message"><p>${S?`${S}${_?` ${_}`:``}`:v}</p>${d.length>0?N`<p>${Wr(d)}</p>`:P} ${y?N`<button type="button" class="bundle-compare-code-action" @click="${()=>{f(),this.requestUpdate()}}">Show as published</button>`:P} ${b?N`<button type="button" class="bundle-compare-code-action" @click="${()=>this._setWhitespace(!1)}">Show whitespace changes</button>`:P} ${x?N`<button type="button" class="bundle-compare-code-action" @click="${()=>this._setRenames(!1)}">Show renamed names</button>`:P}</div>`}_fileName(e,t,n){let r=e=>n&&e.startsWith(n)?e.slice(n.length):e;return N`<span class="${A({"bundle-compare-code-pill":!0,[t.kind]:!0,pure:t.kind===`renamed`&&!t.modified})}">${pr[t.kind].label}</span> ${at(e,this._format(e))} <span class="bundle-code-main-path mono" data-tooltip-truncated data-tooltip="${t.renamedFrom?`${t.renamedFrom} \u2192 ${e}`:e}">${t.renamedFrom?Jt(r(t.renamedFrom),r(e)):r(e)}</span> ${this._fileTags(e,t)}${this._githubLink(e,t)}`}_fileTags(e,t,n=!1){if(!n)return N`${this._entryTags(e,t)}${this._alertTags(e,t)}${this._runsTags(e,t)}${this._newHostTags(e,t)}${this._flagTags(e,t)}${this._readability(e,t)}${this._installTags(e,t)}${lr(t.meta)}`;let r=[this._alertTags(e,t),this._runsTags(e,t),this._newHostTags(e,t),this._flagTags(e,t,!1),this._treeTag(e,t),this._installTags(e,t,!0),lr(t.meta,!0)];return ri(r)?r:this._flagTags(e,t)}_githubLink(e,{kind:t,basePath:n=e}){let r=t===`removed`?Le(this.base,n):Le(this.other,e);return r?Re(r):P}_alertTags(e,{kind:t,basePath:n=e}){let r=t===`removed`?this.baseAlerts?.get(n):this.otherAlerts?.get(e);return r?.length>0&&this.alertTags?this.alertTags(r):P}_newHostTags(e,{kind:t}){let n=t===`removed`?null:this.newHosts?.get(e);return n&&this.newHostTag?this.newHostTag(n):P}_runsTags(e,t){return[[le,de],[fe,pe]].map(([n,r])=>{let{was:i,now:a}=this._reads(e,t,n);return t.kind===`removed`?r(i):r(a,i)})}_entryTags(e,{kind:t,basePath:n=e}){let r=zr(t===`removed`?this.base:this.other).get(t===`removed`?n:e)??[];return[...Map.groupBy(r,({label:e})=>e)].map(([e,t])=>N`<span class="${`bundle-compare-code-entry${e===`license`?` is-license`:``}`}" data-tooltip="${t.map(({note:e})=>e).join(` · `)}">${e}</span>`)}_installTags(e,t,n=!1){if(!Br.test(e))return P;let{kind:r,basePath:i=e}=t,{before:a,after:o}=R(this.base,this.other,e,t),s=new Map(r===`added`||a===void 0?[]:Hr(this.base,i,a)),c=new Map(r===`removed`||o===void 0?[]:Hr(this.other,e,o)),l=[...r===`removed`?s:c].map(([e,t])=>{let n=r===`removed`?t:s.get(e),i=n===void 0?`, new`:n===t?``:`, was: ${n}`;return N`<span class="bundle-compare-code-install" data-tooltip="${`${t}${i}`}">${e}</span>`});if(!n&&r!==`removed`)for(let[e,t]of s)c.has(e)||l.push(N`<span class="bundle-compare-code-install is-dropped" data-tooltip="${`No longer run on install: ${t}`}">${e}</span>`);return l}_reads(e,t,n=Ve){let{kind:r,basePath:i=e}=t,{before:a,after:o}=R(this.base,this.other,e,t);return{was:r===`added`?null:a===void 0?void 0:n(this.base,i,a),now:r===`removed`||o===void 0?null:n(this.other,e,o)}}_readability(e,t){let{was:n,now:r}=this._reads(e,t),i=e=>N`${Ge(e)}${Ke(e)}`,a=!n||!r||st(n)===st(r)&&n.kind===r.kind?i(r??n):N`<span class="bundle-compare-code-readability">${i(n)}<span aria-hidden="true">→</span>${i(r)}</span>`;return N`${Je(r??n)}${a}`}_flagTags(e,t,n=!0){return t.kind===`removed`?Ze(this.base,t.basePath??e,t.baseBytes,n):Ze(this.other,e,t.otherBytes,n)}_treeTag(e,t){let{was:n,now:r}=this._reads(e,t),i=r??n;if(!i)return P;let a=i.category!==`map`&<.get(st(i)).mark;return N`${Je(i,[`warn`])}${a?Ge(i,!0):P}`}_fileFigures({kind:e,baseBytes:t,otherBytes:n},r){let i=e=>k(e??0);return N`${r?.blocks.length>(r?.marked?.size??0)?ei(r.additions,r.deletions):P} ${r?.renamed>0?N`<span class="bundle-compare-code-renamed" aria-label="${`${r.renamed} lines differing in renamed names alone`}" data-tooltip="Lines differing in renamed names alone, marked">≈${r.renamed}</span>`:P} <span class="bundle-code-main-stats">${e===`added`?i(n):e===`removed`?i(t):`${i(t)} \u2192 ${i(n)}`}</span>`}_highlighted(e,t,n,r=``){if(!n)return null;let i=dt(t,Nr(e,t),n);if(!i)return null;let a=`${e.integrity}\0${t}${r?`\0${r}`:``}`,o=Kr.get(a);return o?.text===n?o.lines:(qr.has(a)||(qr.add(a),(async()=>{let e=await qe(n,i),t=typeof e==`string`?Xe(e):null;Kr.set(a,{text:n,lines:t?.length===n.split(`
|
|
19
|
+
`).length?t:null}),qr.delete(a),this.isConnected&&this.requestUpdate()})()),null)}_renderFile(e,t){let n=this._entries.get(e),{kind:r}=n,i=this._fileState(e,n),{after:a,before:o,textual:s,model:c}=i,l=ni(n),u=s&&(!l||c?.blocks.length>0),d=this._order.indexOf(e),f=t&&e.startsWith(t)?e.slice(t.length):e,p=r===`repointed`&&o===void 0?N`<div class="bundle-compare-code-message">Neither bundle carries this importer's source.</div>`:l&&c?.blocks.length===0?this._renderSource(e,a,n.repointed,i):this._fileMessage(e,n,i)??this._renderDiff(e,n,i);return N`<header class="bundle-code-main-bar bundle-compare-code-bar"><span class="bundle-code-file-nav"><button type="button" class="focus-code-nav-btn" aria-label="Previous file" data-tooltip="Previous file" ?disabled="${d<=0}" @click="${()=>this._select(this._order[d-1])}">${re}</button> <button type="button" class="focus-code-nav-btn" aria-label="Next file" data-tooltip="Next file" ?disabled="${d===-1?this._order.length===0:d>=this._order.length-1}" @click="${()=>this._select(this._order[d+1])}">${w}</button> </span>${this._fileName(e,n,t)} <button type="button" class="bundle-code-copy-path" data-copy-path="${e}" aria-label="Copy file path">${C}</button> <span class="bundle-code-main-spacer"></span> ${this._fileFigures(n,c)} ${this._toggles(u,Zr(i),i.renamed,i.whitespace===`hideable`,i.types)}</header><div class="bundle-compare-diff" tabindex="0" aria-label="${`Changes in ${f}`}">${this._dependencyChanges(e)} ${n.repointed?this._renderRepointed(e,n.repointed,[a,o].find(e=>typeof e==`string`&&e!==``)??null,s&&!u):P} ${p}</div>`}_toggles(e,t=null,n=!1,r=!1,i=!1){return N`${e?this._hides(n,r,i):P} ${t?N`<button type="button" class="${A({"bundle-compare-code-toggle":!0,"is-loading":t.status===`loading`,"is-error":t.status===`error`})}" aria-pressed="${String(!!T.bundleSourcePretty)}" aria-busy="${t.status===`loading`?`true`:P}" aria-label="Pretty-print" data-tooltip="${`${et(t)}${$r(t.affects)}`}" @click="${()=>{f(),this.requestUpdate()}}">${$e}</button>`:P} ${e?N`<span class="bundles-overview-sort bundle-compare-code-layout" role="group" aria-label="Diff layout">${[[`unified`,`Unified`],[`split`,`Split`]].map(([e,t])=>N`<button type="button" aria-pressed="${String(K.layout===e)}" @click="${()=>{K.layout=e,this.requestUpdate()}}">${t}</button>`)}</span>`:P}`}_importLines(e,t){let n=new Map;for(let{specifier:r}of e){if(n.has(r))continue;let e=[`'`,`"`,"`"].map(e=>`${e}${r}${e}`);n.set(r,t.flatMap((t,n)=>e.some(e=>t.includes(e))?[n]:[]))}return n}_textSide(e){return D(this.other).has(e)?this.other:this.base}_dependencyChanges(e){if(e!==`package.json`||!this.dependencies)return P;let{added:t,changed:n,removed:r}=this.dependencies,i=[...t.map(e=>[`added`,e]),...n.map(e=>[`changed`,e]),...r.map(e=>[`removed`,e])];if(i.length===0)return P;let a=[[t,`new`],[n,`updated`],[r,`removed`]].filter(([e])=>e.length>0).map(([e,t])=>`${e.length} ${t}`),o=Map.groupBy(i.flatMap(([,e])=>e.flags??[]),({label:e})=>e),s=this.openDependency;return N`<section class="bundle-compare-code-deps" aria-label="Dependency changes"><h4>Dependencies <span>${a.join(` · `)}</span>${[...o].map(([e,t])=>N`<span class="bundle-compare-code-deps-flagged">${t.length} ${e}</span>`)}</h4><ul>${i.map(([e,t])=>{let n=e===`changed`?N`<span class="bundle-compare-code-dep-range">${t.from} → <b>${t.to}</b></span>`:N`<span class="bundle-compare-code-dep-range">${t.range}</span>`,r=N`<span class="bundle-compare-code-dep-name">${t.name}</span>${t.kind?N`<span class="npm-dependency-kind">${t.kind}</span>`:P}${n}${this.dependencyTags?.(t,e)??P}`,i=`${{added:`New`,changed:`Updated`,removed:`Removed`}[e]}: ${t.name}`;return N`<li>${s&&t.opens?N`<button type="button" class="${`bundle-compare-code-dep is-${e}`}" aria-label="${i}" @click="${()=>s(t)}">${r}</button>`:N`<span class="${`bundle-compare-code-dep is-${e}`}" aria-label="${i}">${r}</span>`}</li>`})}</ul></section>`}_renderRepointed(e,t,n,r){let i=n?n.split(`
|
|
20
|
+
`):[],a=n?this._highlighted(this._textSide(e),e,n):null,o=this._importLines(t,i),s=e=>e||`(empty target)`;return N`<section class="bundle-compare-code-repointed" aria-label="Repointed imports"><h4>Repointed ${t.length===1?`import`:`imports`} <b>${t.length}</b></h4><ul>${t.map(e=>{let t=o.get(e.specifier),n=`${e.conditions}${e.platform===null?``:` \xB7 Platform: ${e.platform}`}`;return N`<li><div class="bundle-compare-code-repointed-spec"><code data-tooltip-truncated data-tooltip="${e.specifier}">${e.specifier}</code> <span data-tooltip-truncated data-tooltip="${n}">${n}</span></div><div class="bundle-compare-code-repointed-targets"><span class="before"><span>Before</span><code data-tooltip-truncated data-tooltip="${s(e.baseTarget)}">${s(e.baseTarget)}</code></span> <span aria-hidden="true">→</span> <span class="after"><span>After</span><code data-tooltip-truncated data-tooltip="${s(e.otherTarget)}">${s(e.otherTarget)}</code></span></div>${t.slice(0,_r).map(t=>this._importLine(t,i[t],a?.[t],e.specifier,r))} ${t.length>_r?N`<span class="bundle-compare-code-repointed-more">and ${t.length-_r} more ${t.length-_r===1?`line`:`lines`}</span>`:P}</li>`})}</ul></section>`}_importLine(e,t,n,r,i){let a=t.length>240?Math.max(0,t.indexOf(r)-80):0;return N`<button type="button" class="bundle-compare-code-repointed-line bundle-compare-diff-table" ?disabled="${!i}" aria-label="${`Go to line ${e+1}`}" @click="${()=>this._goToLine(e+1)}"><span class="diff-num">${e+1}</span> <code>${t.length<=240&&typeof n==`string`?yt(Qe(n,!0)):De(`${a>0?`…`:``}${t.slice(a,a+240)}${t.length>a+240?`…`:``}`,!0)}</code></button>`}_goToLine(e){let t=`${this._current}\0source`;e>(this._limits.get(t)??G)&&(this._limits.set(t,Math.ceil(e/G)*G),this.requestUpdate()),this.updateComplete.then(()=>this.querySelector(`.bundle-compare-diff [data-line="${e}"]`)?.scrollIntoView({block:`center`}))}_renderSource(e,t,n,{key:r,pretty:i}){let a=this._model(r,t,t),o={model:a,b:this._highlighted(this._textSide(e),e,t,i?.status===`ready`?`pretty`:``)},s=new Set([...this._importLines(n,a.b).values()].flat()),c=`${e}\0source`,l=this._sought?.path===e&&this._sought.key!==r?this._soughtLine(e,this._entries.get(e),i,a):null;this._sought?.path===e&&(this._sought.key=r),l&&l.line<a.b.length&&(l.line>=(this._limits.get(c)??G)&&this._limits.set(c,Math.ceil((l.line+1)/G)*G),this._soughtRow={path:e,index:l.line});let u=this._limits.get(c)??G,d=a.b.length>u?a.b.slice(0,u):a.b;return N`<div class="bundle-compare-diff-table single" data-path="${e}" style="${j({"--diff-num-width":`${String(a.b.length).length+1}ch`})}" role="table" aria-label="Source">${M(d,(e,t)=>t,(e,t)=>N`<div class="${A({"diff-row":!0,ctx:!0,"is-import":s.has(t)})}" role="row" data-line="${t+1}"><span class="diff-num">${t+1}</span>${this._codeCell(o,`b`,t,null)}</div>`)}</div>${a.b.length>d.length?N`<div class="bundle-compare-code-more"><button type="button" class="bundle-compare-code-action" @click="${()=>{this._limits.set(c,u+G),this.requestUpdate()}}">Show ${Math.min(G,a.b.length-d.length).toLocaleString()} more lines</button> <span>${(a.b.length-d.length).toLocaleString()} not shown</span></div>`:P}`}_hides(e,t,n){let r=[e&&[`Renames`,Dr,K.ignoreRenames,()=>this._setRenames(!K.ignoreRenames)],t&&[`Whitespace`,kr,K.ignoreWhitespace,()=>this._setWhitespace(!K.ignoreWhitespace)],n&&[`Type-only`,Or,K.ignoreTypes,()=>this._setTypes(!K.ignoreTypes)]].filter(Boolean);return r.length===0?P:N`<span class="bundle-compare-code-hide" role="group" aria-label="Hide"><span class="bundle-compare-code-hide-label" aria-hidden="true">Hide:</span>${r.map(([e,t,n,r])=>N`<mode-switch compact="compact" borderless .checked="${n}" accessible-label="${t}" label="${e}" @click="${r}"></mode-switch>`)}</span>`}_setWhitespace(e){K.ignoreWhitespace=e,this.requestUpdate()}_setTypes(e){K.ignoreTypes=e,this.requestUpdate()}_setRenames(e){K.ignoreRenames=e,e&&Xn(),this.requestUpdate()}_renderDiff(e,t,{after:n,before:r,key:i,model:a,pretty:o,changes:s,hiding:c,warned:l=[],whitespace:u=null}){let{kind:d,basePath:f=e}=t,p=K.layout===`split`,m=this._sought?.path===e&&this._sought.key!==i?this._soughtLine(e,t,o,a):null;this._sought?.path===e&&(this._sought.key=i);let h=m?this._seekRows(i,a,m,p):null;h?.index>=0&&(this._soughtRow={path:e,index:h.index+ +!!p});let g=this._expansions.get(i)??new Map,_=h?.rows??vn(a,g,{split:p}),v=this._limits.get(i)??G,y=_.length>v?_.slice(0,v):_,b={model:a,a:d===`added`?null:this._highlighted(this.base,f,r,c?`renamed\0${this.other.integrity}\0${e}`:o?.status===`ready`?`pretty`:``),b:d===`removed`?null:this._highlighted(this.other,e,n,o?.status===`ready`?`pretty`:``),expand:(e,t)=>{let n=new Map(g);n.set(e,t===`all`?{all:!0}:{...n.get(e),[t]:(n.get(e)?.[t]??0)+V}),this._expansions.set(i,n),this.requestUpdate()}},x=String(Math.max(a.a.length,a.b.length,1)).length;return N`${K.ignoreRenames&&s?.reason?N`<p class="bundle-compare-code-note">Renamed names are shown: ${Ur[s.reason]??s.reason}.</p>`:P} ${Mr[u]?N`<p class="bundle-compare-code-note">${Mr[u]}</p>`:P} ${l.length>0?N`<p class="bundle-compare-code-note">${Wr(l)} <button type="button" @click="${()=>this._setRenames(!1)}">Show them marked</button></p>`:P}<div class="${A({"bundle-compare-diff-table":!0,split:p,unified:!p})}" data-path="${e}" style="${j({"--diff-num-width":`${x+1}ch`})}" role="table" aria-label="Diff">${p?N`<div class="diff-row diff-split-head" role="row"><span class="diff-half">Before<strong data-tooltip-truncated data-tooltip="${this.baseName}">${this.baseName}</strong></span> <span class="diff-half">After<strong data-tooltip-truncated data-tooltip="${this.otherName}">${this.otherName}</strong></span></div>`:P} ${M(y,e=>this._rowKey(e),e=>p?this._splitRow(e,b):this._unifiedRow(e,b))}</div>${_.length>y.length?N`<div class="bundle-compare-code-more"><button type="button" class="bundle-compare-code-action" @click="${()=>{this._limits.set(i,v+G),this.requestUpdate()}}">Show ${Math.min(G,_.length-y.length).toLocaleString()} more rows</button> <span>${(_.length-y.length).toLocaleString()} not shown</span></div>`:P}`}_rowKey(e){return e.kind===`fold`?`f${e.run}:${e.a}`:e.kind===`change`?`c${e.left??``}:${e.right??``}`:`${e.kind}${e.a??``}:${e.b??``}`}_words(t,n,r){if(n==null||r==null)return null;let i=`${n}:${r}`;return t.words.has(i)||t.words.set(i,e(t.a[n],t.b[r])),t.words.get(i)}_code(e,t,n,r){let i=r&&!(e.endsWith(`\r`)&&n?.at(-1)?.[1]===e.length);if(typeof t==`string`)return yt(Qe(Sn(t,n),i));if(n){let t=Cn(e,n);return t.map((e,n)=>{let r=De(e.text,i&&n===t.length-1);return e.marked?N`<mark class="diff-word">${r}</mark>`:r})}return De(e,i)}_cell(e,t,n,r,i){return n==null?N`<span class="diff-num"></span><span class="diff-sign"></span><span class="diff-code diff-empty"></span>`:N`<span class="diff-num">${n+1}</span><span class="diff-sign">${r}</span>${this._codeCell(e,t,n,i)}`}_noEol(e,t,n){return n!=null&&e.noEol[t]&&n===e[t].length-1}_fold(e,t){let n=e.count<=V;return N`<div class="diff-row diff-fold" role="row"><span class="diff-fold-actions">${!n&&e.down?N`<button type="button" aria-label="${`Show ${V} more lines below`}" data-tooltip="${`Show ${V} more lines`}" @click="${()=>t.expand(e.run,`top`)}"><svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 3v9m-4-4 4 4 4-4"/></svg></button>`:P} ${!n&&e.up?N`<button type="button" aria-label="${`Show ${V} more lines above`}" data-tooltip="${`Show ${V} more lines`}" @click="${()=>t.expand(e.run,`bottom`)}"><svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 13V4M4 8l4-4 4 4"/></svg></button>`:P} <button type="button" aria-label="${`Show all ${e.count} unchanged lines`}" data-tooltip="Show all" @click="${()=>t.expand(e.run,`all`)}"><svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m4 6 4-4 4 4M4 10l4 4 4-4"/></svg></button> </span><span class="diff-fold-label">${e.count.toLocaleString()} unchanged ${e.count===1?`line`:`lines`} · ${e.b+1}–${e.b+e.count}</span></div>`}_unifiedRow(e,t){let{model:n}=t;if(e.kind===`fold`)return this._fold(e,t);if(e.kind===`ctx`)return N`<div class="diff-row ctx" role="row"><span class="diff-num">${e.a+1}</span>${this._cell(t,`b`,e.b,` `,null)}</div>`;let r=e.kind===`del`,i=r?this._words(n,e.a,e.pair)?.a:this._words(n,e.pair,e.b)?.b,a=n.marked?.has(e.change);return N`<div class="${`diff-row ${e.kind}${a?` renamed`:``}`}" role="row" data-tooltip="${a?`Renamed names alone`:P}">${r?N`<span class="diff-num">${e.a+1}</span><span class="diff-num"></span><span class="diff-sign">−</span>${this._codeCell(t,`a`,e.a,i)}`:N`<span class="diff-num"></span><span class="diff-num">${e.b+1}</span><span class="diff-sign">+</span>${this._codeCell(t,`b`,e.b,i)}`}</div>`}_codeCell(e,t,n,r){let i=e.model[t],a=e[t]?.[n],o=i[n],s=this._noEol(e.model,t,n),c=Jr.get(i);c||Jr.set(i,c=new Map);let l=c.get(n);return(!l||l.markup!==a||l.ranges!==r||l.noEol!==s)&&c.set(n,l={markup:a,ranges:r,noEol:s,drawn:this._code(o,a,r,!s)}),N`<span class="${A({"diff-code":!0,"diff-long":o.length>Te})}">${l.drawn}${s?N`<span class="diff-no-eol" data-tooltip="No newline at end of file" aria-label="No newline at end of file">⊘</span>`:P}</span>`}_splitRow(e,t){let{model:n}=t;if(e.kind===`fold`)return this._fold(e,t);if(e.kind===`ctx`)return N`<div class="diff-row ctx" role="row"><span class="diff-half">${this._cell(t,`a`,e.a,` `,null)}</span> <span class="diff-half">${this._cell(t,`b`,e.b,` `,null)}</span></div>`;let r=e.paired?this._words(n,e.left,e.right):null,i=n.marked?.has(e.change);return N`<div class="${`diff-row change${i?` renamed`:``}`}" role="row" data-tooltip="${i?`Renamed names alone`:P}"><span class="${A({"diff-half":!0,del:e.left!==null,blank:e.left===null})}">${this._cell(t,`a`,e.left,`−`,r?.a)}</span> <span class="${A({"diff-half":!0,add:e.right!==null,blank:e.right===null})}">${this._cell(t,`b`,e.right,`+`,r?.b)}</span></div>`}};customElements.define(`bundle-compare-code`,ci);var li=Symbol.for(``),ui=e=>{if(e?.r===li)return e?._$litStatic$},di=(e,...t)=>({_$litStatic$:t.reduce((t,n,r)=>t+(e=>{if(e._$litStatic$!==void 0)return e._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${e}. Use 'unsafeStatic' to pass non-literal values, but
|
|
21
|
+
take care to ensure page security.`)})(n)+e[r+1],e[0]),r:li}),fi=new Map,pi=(e=>(t,...n)=>{let r=n.length,i,a,o=[],s=[],c,l=0,u=!1;for(;l<r;){for(c=t[l];l<r&&(a=n[l],(i=ui(a))!==void 0);)c+=i+t[++l],u=!0;l!==r&&s.push(a),o.push(c),l++}if(l===r&&o.push(t[r]),u){let e=o.join(`$$lit$$`);(t=fi.get(e))===void 0&&(o.raw=o,fi.set(e,t=o)),n=s}return e(t,...n)})(N),mi=25e3,J=40,hi=e=>[...e].toSorted(([e],[t])=>e.localeCompare(t));function gi(e,t,n,{resolutions:r=[],max:i=mi}={}){let a=new Map,o=Xt(n);if(o.size*2>=i)return{rows:1/0,models:a};let s=new Set(r.map(e=>e.parent).filter(e=>!o.has(e))),c=r.length*2+s.size;for(let[n,r]of hi(o)){c++;let{before:o,after:s}=R(e,t,n,r);if(r.modified===!1)c++;else if(typeof o==`string`&&typeof s==`string`){if(q(o,s))return{rows:1/0,models:a};let e=on(o,s);a.set(n,e),c+=Math.max(vn(e).length,1)}else c++;if(c>=i)break}return{rows:c,models:a}}var _i=class extends ci{static properties={...ci.properties,models:{attribute:!1}};constructor(){super(),this.models=null,this._modelCap=1/0,this._fileLimit=J}_renamesAlone=!1;willUpdate(e){if(super.willUpdate(e),e.has(`models`))for(let[e,t]of this.models??[]){let n=this._entries.get(e);if(!n)continue;let{before:r,after:i}=R(this.base,this.other,e,n);this._models.set(Gr(e,!1,{ignoreWhitespace:!1,ignoreRenames:!1}),{model:t,before:r,after:i,given:null})}e.has(`files`)&&(this._fileLimit=J,this._current=this._picked=null),(e.has(`path`)||e.has(`files`))&&this.path&&this.path!==this._current&&(this._goTo=this.path),e.has(`files`)&&(this._toTop=!0)}updated(){let e=this._goTo&&this._section(this._goTo);if(e)this._picked=this._goTo,e.scrollIntoView({block:`start`});else if(this._toTop){let e=this.querySelector(`.bundle-compare-diff`);e&&(e.scrollTop=0)}this._goTo=null,this._toTop=!1,this._current!==this._shownPath&&(this._shownPath=this._current,this.querySelector(`.bundle-compare-code-tree .bundle-code-tree-link.current`)?.scrollIntoView({block:`nearest`})),this._scrollSought()}_select(e,t=!0){!e||this.extensions?.canSelect?.()===!1||(this._current=this._picked=e,this.requestUpdate(),t&&this.updateComplete.then(()=>this._section(e)?.scrollIntoView({block:`start`})),this.dispatchEvent(new CustomEvent(`compare-code-select`,{detail:{path:e},bubbles:!0,composed:!0})))}_more(){this._fileLimit+=J,this.requestUpdate()}_searchable(e){return e.modified!==!1&&e.kind!==`repointed`}_countingState(e,t){return this._states?.get(e)??super._countingState(e,t)}_section(e){return[...this.querySelectorAll(`.bundle-compare-all-file`)].find(t=>t.dataset.path===e)??null}_spy(){this._spying||this.extensions?.canSelect?.()===!1||(this._spying=requestAnimationFrame(()=>{this._spying=0;let e=this.querySelector(`.bundle-compare-diff`);if(!e||this.extensions?.canSelect?.()===!1)return;this._fileLimit<this._order.length&&e.scrollTop+2*e.clientHeight>=e.scrollHeight&&this._more();let{top:t,bottom:n}=e.getBoundingClientRect(),r=this._picked&&this._section(this._picked)?.getBoundingClientRect();if(r&&r.bottom>t&&r.top<n)return;this._picked=null;let i=null;for(let n of e.querySelectorAll(`:scope > .bundle-compare-all-file`)){if(n.getBoundingClientRect().top>t+4)break;i=n}let a=i?.dataset.path??this._order[0]??null;a!==this._current&&(this._current=a,this.requestUpdate(),this.dispatchEvent(new CustomEvent(`compare-code-select`,{detail:{path:a},bubbles:!0,composed:!0})))}))}_fileBody(e,t,n){let r=t.repointed?this._renderRepointed(e,t.repointed,[n.after,n.before].find(e=>typeof e==`string`&&e!==``)??null,!1):P,i=t.kind===`repointed`||t.kind===`renamed`&&!t.modified&&!!t.repointed&&!t.meta&&!(n.model?.blocks.length>0);return N`${this._dependencyChanges(e)}${r}${i?P:this._fileMessage(e,t,n)??this._renderDiff(e,t,n)}`}_fileContent(e,t,n,r){return N`<header class="bundle-code-main-bar bundle-compare-all-file-head">${this._fileName(e,t,r)} <span class="bundle-code-main-spacer"></span> ${this._fileFigures(t,n.model)}</header>${this._fileBody(e,t,n)}`}_layout(e,t){return N`<div class="bundle-code-view bundle-compare-code">${this._renderRail(e,this._current)}<div class="bundle-code-main">${t}</div></div>`}render(){let e=this._railState(),t=this.extensions?.fullPaths?``:e.prefix,n=this.extensions?.filterContent===!1?e.allOrder:e.order;this._order=n,this._goTo&&n.includes(this._goTo)&&(this._current=this._goTo),n.includes(this._current)||(this._current=n[0]??null),this._current&&(this._goTo||this._current!==this._shownPath)&&this._reveal(this._current,e.prefix);let r=n.indexOf(this._current);r>=this._fileLimit&&(this._fileLimit=Math.ceil((r+1)/J)*J);let i=n.map(e=>[e,this._entries.get(e)]),a=i.map(([e,t])=>({path:e,entry:t,file:this._fileState(e,t)})),o=a.reduce((e,{file:t})=>e+(t.model?.additions??0),0),s=a.reduce((e,{file:t})=>e+(t.model?.deletions??0),0);this._states=new Map(a.map(({path:e,file:t})=>[e,t]));let c=a.filter(({file:e})=>Zr(e)),l=c.map(({file:e})=>Zr(e)),u=l.filter(e=>e.status===`error`),d=u.length>0?{...u[0],failed:u.length,of:l.length}:l.find(e=>e.status===`loading`)??l[0]??null,f=d&&{...d,affects:c.map(({path:e})=>e)},p=a.some(({file:e})=>e.model?.blocks.length>0||e.whitespace||e.hiding||e.types);return this._layout(e,N`<header class="bundle-code-main-bar bundle-compare-code-bar"><span class="bundle-compare-all-title">${i.length.toLocaleString()} ${i.length===1?`file`:`files`} changed</span> ${o+s>0?ei(o,s):P} <span class="bundle-code-main-spacer"></span> ${this._toggles(p,f,a.some(({file:e})=>e.renamed),a.some(({file:e})=>e.whitespace===`hideable`),a.some(({file:e})=>e.types))}</header><div class="bundle-compare-diff" tabindex="0" aria-label="Every change" @scroll="${()=>this._spy()}">${i.length===0?N`<div class="bundle-code-placeholder">${this._entries.size===0?`No files differ in this comparison.`:`No changed files match.`}</div>`:M(a.slice(0,this._fileLimit),({path:e})=>e,({path:e,entry:n,file:r})=>N`<section class="bundle-compare-all-file" aria-label="${e}" data-path="${e}">${this.extensions?.fileActions?N`<div class="bundle-compare-file-content">${this._fileContent(e,n,r,t)}</div>${this.extensions.fileActions(e,!0)}`:this._fileContent(e,n,r,t)}</section>`)} ${a.length>this._fileLimit?N`<button type="button" class="bundle-compare-code-action bundle-compare-all-more" @click="${()=>this._more()}">Show more files (${(a.length-this._fileLimit).toLocaleString()} remaining)</button>`:P}</div>`)}};customElements.define(`bundle-compare-all`,_i);function vi({base:e,other:t,diff:n,source:r,path:i,seek:a,baseName:o,otherName:s,select:c,extensions:l=null,mode:u}){let d=u?null:n.combined??=gi(e,t,n.files,{resolutions:n.resolutions?.changed??[]});u??=d.rows<mi?`diff`:`code`;let f=u===`diff`?di`bundle-compare-all`:di`bundle-compare-code`;return pi`<${f} .base=${e} .other=${t} .files=${n.files} .scope=${n.scope??``} .resolutions=${n.resolutions?.changed??[]}
|
|
22
22
|
.baseAlerts=${r?.files?.alerts?.(e)??null} .otherAlerts=${r?.files?.alerts?.(t)??null} .alertTags=${r?.files?.alertTags??null}
|
|
23
23
|
.newHosts=${r?.files?.newHosts?.(e,t)??null} .newHostTag=${r?.files?.newHostTag??null}
|
|
24
24
|
.dependencies=${r?.dependencies?.(e,t)??null} .openDependency=${r?.openDependency??null} .dependencyTags=${r?.dependencyTags??null}
|
|
25
25
|
.models=${d?.models??null} .path=${i} .seek=${a} .extensions=${l} baseName=${o} otherName=${s}
|
|
26
|
-
@compare-code-select=${e=>{e.stopPropagation(),c(e.detail.path)}}></${f}>`}var bi=400,xi=24,Si=[`removed`,`added`,`changed`],J=null;function Y(e){return e.join(`, `)}var Ci=class extends xt{static properties={details:{attribute:!1},integrity:{attribute:!1},request:{attribute:!1},source:{attribute:!1},review:{attribute:!1},_targetIntegrity:{state:!0},_otherDetails:{state:!0},_status:{state:!0},_scope:{state:!0},_fileSort:{state:!0},_pkgSort:{state:!0},_openSections:{state:!0},_mode:{state:!0},_codePath:{state:!0},_codeSeek:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.details=null,this.integrity=null,this.request=null,this.source=null,this._targetIntegrity=null,this._otherDetails=null,this._status=`idle`,this._scope=``,this._fileSort={removed:`name`,added:`name`,changed:`name`},this._pkgSort={removed:`size`,added:`size`,changed:`size`},this._openSections=new Set,this._mode=`overview`,this._codePath=null,this._codeSeek=null,this._repaint=()=>this.requestUpdate(),this._fitBody=null,this._fitObserver=null}connectedCallback(){super.connectedCallback(),this._fitBody&&this._fitObserver?.observe(this._fitBody)}disconnectedCallback(){super.disconnectedCallback(),this._fitObserver?.disconnect()}willUpdate(e){e.has(`source`)&&this.source&&!e.get(`source`)&&(this._openSections=new Set([...this._openSections,`files`])),(e.has(`_otherDetails`)||e.has(`details`))&&this._status===`ready`&&!o(this.details,this._otherDetails).some(e=>e.id===this._scope)&&(this._scope=``),e.has(`integrity`)&&this._rebase(),(e.has(`request`)||e.has(`integrity`))&&this.integrity&&this.request?.bundle===this.integrity?(this.request.target!==this._targetIntegrity&&this._choose(this.request.target),this._mode=gt(this.request.mode)):e.has(`request`)&&!e.has(`integrity`)&&e.get(`request`)?.bundle===this.integrity&&(this._targetIntegrity&&this._choose(null),this._mode=`overview`)}updated(){let e=this.querySelector(`.bundle-compare-body`);e!==this._fitBody&&typeof ResizeObserver==`function`&&(this._fitObserver??=new ResizeObserver(()=>this._fitLists()),this._fitObserver.disconnect(),e&&this._fitObserver.observe(e),this._fitBody=e),this._fitLists()}_fitLists(){let e=this._fitBody;if(!e)return;let t=getComputedStyle(e),n=e.getBoundingClientRect().top+e.clientTop+parseFloat(t.paddingTop)-e.scrollTop,r=e=>{let t=e.getBoundingClientRect();return t.top-n+e.parentElement.getBoundingClientRect().bottom-t.bottom},i=e.querySelector(`.bundle-compare-rows--fill`);if(i){let t=r(i),n=i.closest(`.bundle-compare-section`);for(let e=n;e;e=e.nextElementSibling){let r=e.matches(`details[open]`)&&e.querySelector(`:scope > summary`),i=e===n?0:r?r.getBoundingClientRect().bottom+parseFloat(getComputedStyle(r).marginBottom)-e.getBoundingClientRect().top:e.getBoundingClientRect().height;t+=i+parseFloat(getComputedStyle(e).marginBottom)}e.style.setProperty(`--compare-fill-around`,`${t}px`)}let a=[...e.querySelectorAll(`.bundle-compare-rows--scroll:not(.bundle-compare-rows--fill)`)];if(a.length===0)return;let o=e.lastElementChild,s=new Map(a.filter(e=>o.contains(e)).map(e=>[e,e.parentElement.getBoundingClientRect().top])),c=Math.max(...s.values()),l=e.clientHeight-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom),u=parseFloat(getComputedStyle(o).marginBottom);for(let e of a)s.get(e)>=c-1?e.style.setProperty(`--compare-rest`,`${l-r(e)-u}px`):e.style.removeProperty(`--compare-rest`)}_rebase(){let e=this._baseKey;if(J&&e&&e!==J.base&&(J=null),J&&e===J.base){let{target:e}=J;if(this._scope=J.scope,this._mode=J.mode,this._codePath=J.codePath,J=null,!e){this._targetIntegrity=null,this._otherDetails=null,this._status=`idle`;return}this._targetIntegrity=e;let t=this.source?null:Re(e,e=>!!(e.json||e.bundle));t?(this._otherDetails=t,this._status=`ready`):(this._otherDetails=null,this._status=`loading`,this._loadOther(e));return}this._targetIntegrity=null,this._otherDetails=null,this._status=`idle`,this._scope=``,this._codePath=null}get _baseKey(){return this.source?this.source.base:this.integrity}_swap(){let e=this._targetIntegrity;e&&e!==this._baseKey&&this._reopen(e,this._baseKey)}_pickBase(e){!e||e===this._baseKey||(e===this._targetIntegrity?this._swap():this._reopen(e,this._targetIntegrity))}_reopen(e,t){if(this.source){J={base:e,target:t,scope:this._scope,mode:this._mode,codePath:this._codePath},this.source.open(e,t,this._mode);return}if(!xe(w.bundles??[],this.integrity).some(t=>t.integrity===e))return;J={base:e,target:t,scope:this._scope,mode:this._mode,codePath:this._codePath};let n=[this._otherDetails,this._baseReady?this.details:null].filter(n=>n&&!n.error&&(n.json||n.bundle)&&[e,t].includes(n.integrity));this.dispatchEvent(new CustomEvent(`bundle-swap`,{bubbles:!0,composed:!0,detail:{integrity:e,target:t,bundles:n,mode:this._mode}}))}_nameFor(e){return this.source?this.source.name(e):(w.bundles??[]).find(t=>t.integrity===e)?.name??`${e.slice(0,15)}\u2026`}_pick(e){this._choose(e),this._notify()}_notify(){this.dispatchEvent(new CustomEvent(`bundle-compare-change`,{bubbles:!0,composed:!0,detail:{base:this.integrity,target:this._targetIntegrity,mode:this._mode}}))}_choose(e){let t=e||null;if(this._targetIntegrity=t,this._otherDetails=null,this._codePath=null,!t){this._status=`idle`,this._scope=``;return}this._status=`loading`,this._loadOther(t)}async _loadOther(e){if(this.source){let t;try{t=await this.source.load(e)}catch(e){if(e.name===`AbortError`)return;t={error:e.message}}if(this._targetIntegrity!==e)return;this._otherDetails=t,this._status=`ready`,t?.compareId&&t.compareId!==e&&(this._targetIntegrity=t.compareId,this._notify());return}let t=xe(w.bundles??[],this.integrity).find(t=>t.integrity===e);if(!t){this._status=`idle`,this._targetIntegrity=null,this._notify();return}let n;try{n=await ze(e,t)}catch(e){if(e.name===`AbortError`)return;throw e}this._targetIntegrity===e&&(this._otherDetails=n,this._status=`ready`)}get _baseReady(){return!!(this.details&&this.details.integrity===this.integrity&&(this.details.json||this.details.bundle))}_openFile(e){this._codePath=e,this._mode=`code`,this._notify()}_openLine({path:e,line:t,query:n}){this._codeSeek={path:e,line:t-1,query:n},this._openFile(e)}_fileRow(e,t,n,r=e,i=!1,a=void 0,o=e,s=void 0){let c=this.source?.files;return M`<li><button type="button" class="bundle-compare-row bundle-compare-row-link" @click="${()=>this._openFile(e)}">${c?c.icon(e,[[this._otherDetails,o],[this.details,e]]):N}<span class="bundle-compare-row-path mono" data-tooltip-truncated data-tooltip="${r}">${t}</span>${i?c?.tag?.(this.details,e,s)??N:N}${ur(a)}${n}</button></li>`}_group(e,t,n,r,i,a=N,{fill:o=!1,lanes:s=Si,style:c={}}={}){return t.length===0?N:M`<section class="${`bundle-compare-group bundle-compare-${n}`}" style="${A({"--compare-lane":String(s.indexOf(n)+1),...c})}"><header class="bundle-compare-group-head"><span class="bundle-compare-dot" aria-hidden="true"></span> <span class="bundle-compare-group-title" data-tooltip-truncated data-tooltip="${e}">${e}</span> <span class="bundle-compare-group-count">${t.length}</span> ${a}</header><ul class="${o?`bundle-compare-rows bundle-compare-rows--scroll bundle-compare-rows--fill`:`bundle-compare-rows bundle-compare-rows--scroll`}">${j(t,r,i)}</ul></section>`}_sizeCells(e){let t=e=>e==null?`—`:O(e),n=e=>`${e.toLocaleString()} LoC`;return e.delta===void 0?M`<span class="bundle-compare-row-size" data-tooltip="${e.lines>0?n(e.lines):N}">${t(e.bytes)}</span>`:M`<span class="${`bundle-compare-row-delta ${e.delta===null?``:P(e.delta)}`}" data-tooltip="${`${t(e.baseBytes)} \u2192 ${t(e.otherBytes)}${e.baseLines>0||e.otherLines>0?` \xB7 ${e.baseLines.toLocaleString()} \u2192 ${n(e.otherLines)}`:``}`}">${e.delta===null?`—`:wt(e.delta)}</span>`}_sortActions(e,t,n,r=!1,i=this[e][t]){return M`<span class="bundles-overview-sort" role="group" aria-label="${`${t} ${n} order`}">${[[`name`,`Name`],[`size`,`Size`],...r?[[`flags`,`Flags`]]:[]].map(([n,r])=>M`<button type="button" aria-pressed="${String(i===n)}" @click="${()=>{this[e]={...this[e],[t]:n}}}">${r}</button>`)}</span>`}_fileGroup(e,t,n,r,i){let a=this.source?.files,o=n!==`removed`,s=e=>n===`added`?null:{details:this._otherDetails,path:e.basePath??e.path},c=e=>[...o&&a?.flags?a.flags(this.details,e.path,s(e)):[],...dr(e.meta)],l=t.some(e=>c(e).length>0),u=this._fileSort[n]===`flags`&&!l?`name`:this._fileSort[n],d=e=>n===`changed`?Math.abs(e.delta):e.bytes,f=u===`flags`?Se(t,c,e=>e.path):t.toSorted((e,t)=>(u===`size`?d(t)-d(e):0)||e.path.localeCompare(t.path));return this._group(e,f,n,e=>e.path,e=>e.renamedFrom==null?this._fileRow(e.path,r(e.path),this._sizeCells(e),e.path,o,e.meta,e.basePath??e.path,s(e)):this._fileRow(e.path,Yt(r(e.renamedFrom),r(e.path)),this._sizeCells(e),`${e.renamedFrom} \u2192 ${e.path}`,o,e.meta,e.basePath??e.path,s(e)),this._sortActions(`_fileSort`,n,`file`,l,u),{lanes:i})}_pkgGroup(e,t,n,r){let i=this._pkgSort[n],a=e=>{let t=n===`changed`?e.delta:e.bytes;return t==null?-1:Math.abs(t)},o=t.toSorted((e,t)=>(i===`size`?a(t)-a(e):0)||ht(e.pkg).localeCompare(ht(t.pkg))),s=n===`changed`?0:Math.min(xi,Math.max(0,...t.map(e=>Y(e.versions).length)));return this._group(e,o,n,e=>e.pkg,e=>M`<li><div class="bundle-compare-row"><span class="bundle-compare-pkg-dot" style="${A({background:mt(e.pkg)})}"></span> <span class="bundle-compare-row-path" data-tooltip-truncated data-tooltip="${ht(e.pkg)}">${ht(e.pkg)}</span> ${n===`changed`?this._versionCell(e):s>0?M`<span class="bundle-compare-dep-ver" data-tooltip-truncated data-tooltip="${Y(e.versions)}">${Y(e.versions)}</span>`:N} ${this._sizeCells(n===`changed`?e:{bytes:e.bytes})}</div></li>`,this._sortActions(`_pkgSort`,n,`package`),{fill:!0,lanes:r,style:s>0?{"--compare-version-width":`${s}ch`}:{}})}_versionCell(e){let t=e.otherVersions,n=e.baseVersions;if(n.join()===t.join())return n.length>0?M`<span class="bundle-compare-dep-ver">${Y(n)}</span>`:N;let r=e.direction??`changed`,i=r===`up`?`↑`:r===`down`?`↓`:`±`;return M`<span class="bundle-compare-ver" aria-label="${`${r===`up`?`Upgraded`:r===`down`?`Downgraded`:`Changed`}: ${Y(n)||`none`} to ${Y(t)||`none`}`}"><span class="bundle-compare-ver-from">${Y(n)||`—`}</span> <span class="bundle-compare-ver-arrow" aria-hidden="true">→</span> <span class="${`bundle-compare-ver-to ${r}`}">${Y(t)||`—`}</span> <span class="${`bundle-compare-ver-dir ${r}`}" aria-hidden="true">${i}</span></span>`}_depGroup(e,t,n,r){let i=n===`changed`?0:Math.min(xi,Math.max(0,...t.map(e=>e.range.length))),a=e=>M`<span class="bundle-compare-row-path" data-tooltip-truncated data-tooltip="${e.name}">${e.name}</span> ${this.source?.dependencyTags?.(e,n)??N}${e.kind?M`<span class="npm-dependency-kind">${e.kind}</span>`:N} ${n===`changed`?M`<span class="bundle-compare-ver" aria-label="${`Changed: ${e.from} to ${e.to}`}"><span class="bundle-compare-ver-from">${e.from}</span> <span class="bundle-compare-ver-arrow" aria-hidden="true">→</span> <span class="bundle-compare-ver-to changed">${e.to}</span></span>`:M`<span class="bundle-compare-dep-ver" data-tooltip-truncated data-tooltip="${e.range}">${e.range}</span>`}`,o=this.source?.openDependency;return this._group(e,t,n,e=>e.key,e=>M`<li>${o&&e.opens?M`<button type="button" class="bundle-compare-row bundle-compare-row-link" @click="${()=>o(e)}">${a(e)}</button>`:M`<div class="bundle-compare-row">${a(e)}</div>`}</li>`,N,{fill:!0,lanes:r,style:i>0?{"--compare-version-width":`${i}ch`}:{}})}_renderDependencies(e,t,n,r){return r.length===0?N:M`<section class="bundle-compare-section"><h3 class="bundle-compare-section-head">Dependencies</h3>${this._cols(r,M`${this._depGroup(`Removed \xB7 only in ${t}`,e.removed,`removed`,r)} ${this._depGroup(`Added \xB7 only in ${n}`,e.added,`added`,r)} ${this._depGroup(`Changed`,e.changed,`changed`,r)}`,`dependencies`)}</section>`}_renderPackages(e,t,n,r=Si){return e.removed.length===0&&e.added.length===0&&e.changed.length===0?N:M`<section class="bundle-compare-section"><h3 class="bundle-compare-section-head">Packages</h3>${this._cols(r,M`${this._pkgGroup(`Removed \xB7 only in ${t}`,e.removed,`removed`,r)} ${this._pkgGroup(`Added \xB7 only in ${n}`,e.added,`added`,r)} ${this._pkgGroup(`Changed`,e.changed,`changed`,r)}`,`packages`)}</section>`}_cols(e,t,n){let r=e.map(e=>e===`changed`?`minmax(0, 5fr)`:`minmax(0, 4fr)`).join(` `);return M`<div class="bundle-compare-cols" data-lanes="${e.length}" data-section="${n}" style="${A({"--compare-lanes":r})}">${t}</div>`}_collapsible(e,t,n,r,i=``){let a=this._openSections.has(e);return M`<details class="bundle-compare-section bundle-compare-collapsible" .open="${T(a)}" @toggle="${t=>this._setSection(e,t.currentTarget.open)}"><summary class="bundle-compare-section-head" @click="${t=>{t.preventDefault(),this._setSection(e,!a)}}">${t} <span class="bundle-compare-section-count">${n.toLocaleString()}</span>${i?M`<span class="bundle-compare-section-note" data-tooltip-truncated data-tooltip="${i}">${i}</span>`:N}</summary>${a?r():N}</details>`}_setSection(e,t){if(t===this._openSections.has(e))return;let n=new Set(this._openSections);t?n.add(e):n.delete(e),this._openSections=n}_renderResolutions(e){if(e.totalChanges===0)return N;let t=e.changed,n=t.slice(0,bi),r=t.length-n.length,i=(e,t=``)=>M`<td class="${t}"><code data-tooltip-truncated data-tooltip="${e}">${e}</code></td>`,a=e=>`${e.conditions}${e.platform===null?``:` \xB7 Platform: ${e.platform}`}`,o=n.some(e=>a(e)!==`*`);return this._collapsible(`resolutions`,`Import resolutions`,t.length,()=>M`<section class="bundle-compare-group bundle-compare-changed bundle-compare-resolutions"><header class="bundle-compare-group-head"><span class="bundle-compare-dot" aria-hidden="true"></span> <span class="bundle-compare-group-title">Repointed</span> <span class="bundle-compare-group-count">${t.length}</span></header><table class="${o?``:`bundle-compare-resolutions--no-context`}"><thead><tr><th>File</th><th>Import</th><th>Before</th><th>After</th>${o?M`<th>Conditions</th>`:N}</tr></thead><tbody>${j(n,e=>e.key,e=>{let t=a(e);return M`<tr><td><button type="button" class="bundle-compare-resolution-parent" data-tooltip-truncated data-tooltip="${e.parent}" @click="${()=>this._openFile(e.parent)}">${e.parent}</button></td>${i(e.specifier)} ${i(e.baseTarget||`(empty target)`,`bundle-compare-resolution-before`)} ${i(e.otherTarget||`(empty target)`,`bundle-compare-resolution-after`)} ${o?M`<td class="bundle-compare-resolution-context"><span data-tooltip-truncated data-tooltip="${t}">${t}</span></td>`:N}</tr>`})}</tbody></table>${r>0?M`<div class="bundle-compare-more">and ${r.toLocaleString()} more…</div>`:N}</section>`)}_comparison(){return qt(this._otherDetails,this.details,this._scope,this._repaint)}_renderSummary(e){return At(e,M`<div class="bundle-compare-modes" role="tablist" aria-label="Comparison view">${[[`overview`,`Overview`],[`code`,`Code`]].map(([e,t])=>M`<button type="button" role="tab" aria-selected="${String(this._mode===e)}" @click="${()=>{this._mode=e,this._notify()}}">${t}</button>`)}</div>`)}_renderPicker(e,t,n,r){return kt({source:this.source,from:{options:e,value:this._targetIntegrity,pick:e=>this._pick(e)},to:{options:this._baseOptions(),value:this._baseKey,placeholder:this._nameFor(this.integrity),pick:e=>this._pickBase(e)},clear:t?{run:()=>this._pick(null)}:null,swap:t&&this.source?.canSwap?.(this._targetIntegrity)!==!1?()=>this._swap():null,extras:n,comparison:r,openLine:e=>this._openLine(e)})}_baseOptions(){if(this.source)return F(this.source.choices??[]);let e=(w.bundles??[]).find(e=>e.integrity===this.integrity),t=xe(w.bundles??[],this.integrity);return this._bundleOptions(e?[e,...t]:t)}_otherOptions(){return this.source?F(this.source.options):this._bundleOptions(xe(w.bundles??[],this.integrity))}_bundleOptions(e){let t=new Map;for(let n of e)t.set(n.name,(t.get(n.name)??0)+1);return e.map(e=>({id:e.integrity,integrity:e.integrity,kind:e.kind??(e.name.toLowerCase().endsWith(`.map`)?`sourcemap`:`stasis`),summary:e.summary,size:typeof e.size==`number`?O(e.size):`—`,filename:t.get(e.name)>1?`${e.name} \xB7 ${e.integrity.slice(7,13)}\u2026`:e.name}))}render(){let e=this._otherOptions(),t=!!this._targetIntegrity&&(!!this.source||e.some(e=>e.integrity===this._targetIntegrity)),n=this._baseReady?o(this.details,t?this._otherDetails:null):[],r=n.length>0?M`<bundle-scope-selector .reasons="${n}" .value="${this._scope}" label="Compare scope" @scope-change="${e=>{this._scope=e.detail.value}}"></bundle-scope-selector>`:N,i=this.source?.noun??`bundle`,a=t&&this._status===`ready`&&this._otherDetails&&(this._otherDetails.json||this._otherDetails.bundle)&&!this._otherDetails.error,s=this._baseReady&&a?this._comparison():null,c=s?.status===`ready`?s.diff:null,l=c?{base:this._otherDetails,other:this.details,files:c.files}:null,u=e.length>0||this.source?this._renderPicker(e,t,r,l):r,d=c?this._mode:`overview`,f;return this._baseReady?this.source&&!t&&(this.source.pending||this.source.error||!this.source.select&&e.length===0)?f=M`<div class="${`bundle-compare-empty${this.source.error?` is-error`:``}`}">${this.source.pending?`Loading ${i}s\u2026`:this.source.error??M`No other ${i}s to compare <strong>${this._nameFor(this.integrity)}</strong> with.`}</div>`:e.length===0&&!this.source?f=M`<div class="bundle-compare-empty">No other bundles to compare with. Drop a second <code>.map</code> or <code>.stasis.code.br</code> bundle to diff against this one.</div>`:t?this._status===`loading`||!this._otherDetails?f=M`<div class="bundle-compare-empty">Comparing…</div>`:this._otherDetails.error?f=M`<div class="bundle-compare-empty is-error">Couldn't read the selected ${i}: ${this._otherDetails.error}</div>`:!this._otherDetails.json&&!this._otherDetails.bundle?f=M`<div class="bundle-compare-empty is-error">The selected ${i} couldn't be parsed.</div>`:s?.status===`error`?f=M`<div class="bundle-compare-empty is-error">Couldn't compare the ${i}s: ${s.message}</div>`:c?d!==`code`&&(f=this._renderDiff(c)):f=M`<div class="bundle-compare-empty">Comparing…</div>`:f=M`<div class="bundle-compare-empty">Pick a ${i} above to compare <strong>${this._nameFor(this.integrity)}</strong> against.</div>`:f=M`<div class="bundle-compare-empty">Loading bundle…</div>`,M`<div class="bundle-compare">${jt(u,c?this._renderSummary(c):N)} ${d===`code`?yi({base:this._otherDetails,other:this.details,diff:c,source:this.source,path:this._codePath,seek:this._codeSeek,baseName:this._nameFor(this._targetIntegrity),otherName:this._nameFor(this.integrity),select:e=>{this._codePath=e}}):M`<div class="bundle-compare-body">${f}</div>`}</div>`}_renderDiff(e){let t=this._nameFor(this._targetIntegrity),n=this._nameFor(this.integrity),r=[...e.files.onlyBase.map(e=>e.path),...e.files.onlyOther.map(e=>e.path),...e.files.changed.flatMap(e=>e.renamedFrom==null?[e.path]:[e.path,e.renamedFrom])],i=a(e.files.root,pt(r).prefix),{prefix:o}=i,s=e=>o&&e.startsWith(o)?e.slice(o.length):e,c=e.files.onlyBase.length+e.files.onlyOther.length+e.files.changed.length,l={removed:e.files.onlyBase,added:e.files.onlyOther,changed:e.files.changed},u=!e.totals.identical,d=this.source?.dependencies?.(this._otherDetails,this.details)??null,f=Si.filter(t=>(d??e.packageRows)[t].length>0),p=u?Si.filter(e=>l[e].length>0):[],m=p.every(e=>f.includes(e))?f:p,h=u?this.source?.files?.warning?.(this.details,[...l.added,...l.changed].map(e=>e.path)):N;return M`${d?this._renderDependencies(d,t,n,f):this._renderPackages(e.packageRows,t,n,f)} ${h??N} ${e.totals.identical?e.resolutions.totalChanges>0?M`<div class="bundle-compare-caption">File contents are unchanged; import resolutions differ.</div>`:M`<div class="bundle-compare-identical">These two ${this.source?.noun??`bundle`}s carry identical files (${e.totals.unchangedFiles.toLocaleString()} ${e.totals.unchangedFiles===1?`file`:`files`})${i.from?M`, moved <span class="mono">${Xt(i)}</span>`:``}.</div>`:this._collapsible(`files`,`Files`,c,()=>this._cols(m,M`${this._fileGroup(`Removed \xB7 only in ${t}`,l.removed,`removed`,s,m)} ${this._fileGroup(`Added \xB7 only in ${n}`,l.added,`added`,s,m)} ${this._fileGroup(`Changed`,l.changed,`changed`,s,m)}`,`files`),i.from?`${i.from} \u2192 ${i.to}`:o)} ${this._renderResolutions(e.resolutions)}`}};customElements.define(`bundle-compare`,Ci);var X={...pe,"accept-with-nits":`Accept with nits`},wi=e=>e.revokedAt===null?e.publishedAt===null?`Draft`:`Published`:`Revoked`,Ti={accept:`✓`,"accept-with-nits":`·`,"request-changes":`!`,reject:`×`},Ei=e=>M`<span class="${`npm-review-verdict-icon ${e??`unchecked`}`}" aria-hidden="true">${Ti[e]??``}</span>`,Di=e=>M`<span class="npm-review-verdict">${Ei(e)}${X[e]??`Not reviewed`}</span>`,Oi=e=>M`<span class="${`npm-review-badge ${e.revokedAt===null?e.publishedAt===null?``:`published`:`revoked`}`}">${wi(e)}</span>`,ki=e=>e.user?Je({id:e.user,login:e.userLogin,name:e.userName?.trim()||null}):e.userLogin,Ai=e=>M`<time datetime="${new Date(e).toISOString()}">${new Date(e).toLocaleString()}</time>`,ji=(e,t)=>M`<div class="npm-review-progress" role="progressbar" aria-label="Files checked" aria-valuemin="0" aria-valuemax="${t||1}" aria-valuenow="${e}"><span style="${A({width:`${t?e/t*100:0}%`})}"></span></div>`;function Mi(e=[],t=[]){let n=new Set(t);return new Map(e.filter(e=>e.status&&!n.has(e.file)).map(e=>[e.file,{status:e.status,notes:+!!e.comment.trim()}]))}function Ni(e){let t=ye(e);if(t.length===0)return N;let n=t.filter(e=>e.bullet);return M`${t.filter(e=>!e.bullet).map(e=>M`<p class="npm-review-note">${e.text}</p>`)} ${n.length>0?M`<ul class="npm-review-note npm-review-note-list">${n.map(e=>M`<li>${e.text}</li>`)}</ul>`:N}`}var Pi=null,Z=(e,t)=>[`ecosystem`,`package`,`version`,`integrity`,`basePackage`,`baseVersion`,`baseIntegrity`].every(n=>e[n]===t[n]);function Fi(e,t=!1){Pi={review:e,continueReview:t}}function Ii(e){if(!Pi||!Z(Pi.review,e))return null;let t=Pi;return Pi=null,t}function Q(e){let t=`${e.package} ${e.version}`;return e.basePackage?e.basePackage===e.package?`${e.package} ${e.baseVersion} -> ${e.version}`:`${e.basePackage} ${e.baseVersion} -> ${t}`:t}var $=e=>e._blocked||e._loading,Li=e=>e._shownReview?.publishedAt!=null,Ri=e=>e.coverage===`full`?`Full`:`Partial`,zi=e=>e._error?M`<p class="npm-review-error" role="alert">${e._error}</p>`:N,Bi=e=>e._saveBlocked?M`<div class="npm-review-saving" role="status">Saving changes…</div>`:N,Vi=e=>[e._continuation?.review,...e._reviews].filter(Boolean).toSorted((e,t)=>+(e.publishedAt!==null)-(t.publishedAt!==null)||(t.publishedAt??t.time)-(e.publishedAt??e.time)),Hi=e=>`npm-review-button npm-review-primary npm-review-finalize ${e._allowedVerdicts[0]}`,Ui=(e,t,n,r,i=Object.keys(X),a=!1)=>M`<div class="npm-review-verdict-options" role="group" aria-label="Verdict">${Object.entries(a?{"":`Not checked`,...X}:X).map(([a,o])=>M`<label class="${`npm-review-verdict-choice ${a||`unchecked`}`}"><input type="radio" name="${e}" aria-label="${o}" value="${a}" .checked="${T(t===a)}" ?disabled="${r||a!==``&&!i.includes(a)}" @change="${()=>n(a)}">${o}</label>`)}</div>`;function Wi(e){let t=Li(e),n=e._shownReview,r=e._summary,i=e._canEdit?{label:`Finalize review`,run:()=>e._beginPublish(),disabled:!r.checkedFiles}:!t||!e._writable?null:e._activeReview||e._ownPublished.length===0?{label:`Resume your review`,run:()=>e._resume()}:n.user===e.session?.id?{label:`Revise review`,run:()=>e._change({action:`continue`,reviewId:n.id,revision:n.revision})}:null;return M`<div class="npm-review-summary-actions">${t||e._draftStarted?Oi(n??{publishedAt:null,revokedAt:null}):N}<div class="npm-review-progress-block"><span>${e._unsaved&&(e._saveBlocked||e._error)?M`<button type="button" class="npm-review-button npm-review-text-button" @click="${()=>e._openPanel(`unsaved`)}">Unsaved changes</button>`:M`<strong>${r.checkedFiles} of ${r.totalFiles}</strong> files checked`}</span> ${ji(r.checkedFiles,r.totalFiles)}</div>${i?M`<button type="button" class="${e._canEdit?Hi(e):`npm-review-button`}" ?disabled="${$(e)||i.disabled}" @click="${i.run}">${i.label} ${C}</button>`:N}</div>`}function Gi(e){let t=e.source??l(e.entry),n=!!(e._target&&e._target!==`(empty)`),r=F(t.options,t=>`${e.entry.npm.name}@${t.id}`);n&&!r.some(t=>t.id===e._target)&&r.push(...F([{id:e._target,name:e._target,format:`npm`}]));let i=F(t.choices);return i.some(t=>t.id===e.entry.npm.version)||i.push(...F([{id:e.entry.npm.version,name:e.entry.npm.version,format:`npm`}])),jt(kt({source:t,label:`Review`,disabled:$(e),from:{options:r,value:n?e._target:null,label:`Review base`,pick:t=>{e._navigate(t)}},to:{options:i,value:e.entry.npm.version,label:`Version to review`,pick:t=>{e._navigateTo({view:`npm`,packageName:e.entry.npm.name,packageSpec:t,bundleTab:`review`,...e._location(e._target)})}},clear:n?{label:`Clear review base`,run:()=>{e._navigate(`(empty)`)}}:null,openLine:t=>e._openLine(t),comparison:{base:e._base,other:e.details,files:e._diff.files}}),At(e._diff))}function Ki(e){return M`<div class="npm-review-toolbar"><nav class="npm-review-toolbar-group" aria-label="Review breadcrumbs"><button type="button" class="npm-review-button npm-review-text-button" ?disabled="${$(e)}" @click="${()=>{e._navigateTo({view:`reviews`})}}">My reviews</button> ${C}<button type="button" class="npm-review-button npm-review-text-button npm-review-package" aria-haspopup="dialog" ?disabled="${e._blocked}" @click="${()=>e._openPanel(`reviews`)}"><span>${e.entry.npm.name}@${e.entry.npm.version}</span><span class="npm-review-count">${Vi(e).length}</span></button></nav>${Wi(e)}</div>`}function qi(e,t=e._file,n=!1){let r=e._editorState(t),i=e._shownReview?.entries.find(e=>e.file===t),a=e._nonTextFiles.includes(t),o=!a&&[`accept-with-nits`,`request-changes`,`reject`].includes(r.status);return M`<section class="${`npm-review-decision${n?` npm-review-inline-decision`:``}`}" aria-label="File decision">${e._canEdit?M`${Ui(`file:${t}`,a?``:r.status,n=>{e._setFileStatus(t,n)},$(e)||a,void 0,!0)} ${a?M`<p class="npm-review-help">Non-text file. Verdicts are not supported yet; this file remains unchecked.</p>`:N} ${o?M`<textarea aria-label="File note" rows="2" maxlength="20000" placeholder="Add a note (optional)…" .value="${T(r.comment)}" ?disabled="${$(e)}" @input="${n=>e._editFile(t,{comment:n.target.value})}" @blur="${()=>{e._saveFile(t)}}"></textarea>`:N}`:M`${n?N:M`<header><strong>File review</strong><span class="npm-review-muted">${Li(e)?`Frozen`:`Read only`}</span></header>`} ${i?.status&&!a?M`${Di(i.status)}${Ni(i.comment)}`:M`<p class="npm-review-muted">This file was not reviewed.</p>`} ${e._reviewer||e._loading?N:M`<p class="npm-review-help">${e._writable?`Reviewing needs a team that reviews dependencies, where you manage or have Dependencies.`:`Triage access is required to add a review.`}</p>`}`}</section>`}function Ji(e,t,n,r,i,a){return M`<fieldset class="npm-review-team-options"><legend>${t}</legend>${n.map(t=>M`<mode-switch label="${t.name}" .checked="${r.has(t.id)}" .disabled="${$(e)}" @click="${()=>{if($(e))return;let n=new Set(r);n.has(t.id)?n.delete(t.id):n.add(t.id),i(n)}}"></mode-switch>`)}${a}</fieldset>`}function Yi(e,t){let n=e._allowedVerdicts,r=he(t.entries,e._files,e._nonTextFiles),i=t.entries.filter(t=>t.status&&t.comment.trim()&&!e._nonTextFiles.includes(t.file));return M`<form class="npm-review-publish-form" @submit="${t=>{t.preventDefault(),e._publish()}}"><div class="npm-review-dialog-body"><section class="npm-review-coverage"><div><strong>${Ri(r)} review</strong><span>${r.checkedFiles} of ${r.totalFiles} files checked</span></div>${ji(r.checkedFiles,r.totalFiles)}<p>${r.totalFiles>r.checkedFiles?M`${r.totalFiles-r.checkedFiles} files not checked. <button type="button" class="npm-review-button npm-review-text-button" @click="${()=>{e._unchecked=!0,e._closePanel()}}">View files</button>`:`Every file has a verdict.`}</p>${e._needsPackageJson?M`<p class="npm-review-error">Review ${e._files.includes(`package.json`)?M`<button type="button" class="npm-review-button npm-review-text-button" @click="${()=>{e._closePanel(),e._selectFile(`package.json`)}}">package.json</button>`:`package.json`} before publishing a partial review.</p>`:N}</section>${i.length>0?M`<section aria-label="File notes"><strong>File notes</strong><ul class="npm-review-publish-notes" tabindex="0" aria-label="Saved file notes">${i.map(e=>M`<li><span class="dependency-review-entry-file">${ot(e.file)}<span>${e.file}</span></span> ${Ni(e.comment)}</li>`)}</ul></section>`:N}<div><strong>Final verdict</strong>${Ui(`final-verdict`,e._finalStatus,t=>{e._finalStatus=t},$(e),n)}</div>${e._securityLimit===`reject`?M`<p class="npm-review-help">Malware detected. Only Reject is available.</p>`:e._securityLimit===`request-changes`?M`<p class="npm-review-help">Critical vulnerabilities detected.</p>`:N} <label>Final note <span class="npm-review-muted">· optional</span><textarea aria-label="Final comment" rows="3" maxlength="20000" .value="${T(e._finalComment)}" placeholder="Summarize your findings or explain what remains…" ?disabled="${$(e)}" @input="${t=>{e._finalComment=t.target.value}}"></textarea></label> ${e._unchangedContinuation?M`<p class="npm-review-help">Change a verdict or note to publish a new review.</p>`:N} ${Ji(e,`Publish to teams`,e._teams,e._selectedTeams,t=>{e._selectedTeams=t},e._selectedTeams.size>0?N:M`<p class="npm-review-error">${e._teams.length===0?`No teams you belong to have dependency review enabled.`:`Select at least one team to publish.`}</p>`)} ${zi(e)}</div><footer class="npm-review-dialog-footer"><p>Publishing freezes your verdicts and notes.<br>You can continue in a new review to make changes.</p><button type="submit" class="${Hi(e)}" ?disabled="${$(e)||!e._canPublish}">Publish to ${e._selectedTeams.size} ${e._selectedTeams.size===1?`team`:`teams`} ${C}</button></footer></form>`}function Xi(e,t){let n=t===e._shownReview,r=t.publishedAt!==null,i=r?t:Z(t,e._context)?he(t.entries,e._files,e._nonTextFiles):{checkedFiles:t.entries.filter(e=>e.status).length,totalFiles:null},a=[e._continuation?.review,...e._reviews].some(n=>n?.publishedAt===null&&n.user===e.session?.id&&Z(n,t)),o=t.user===e.session?.id,s=e._teams.filter(e=>!t.teams.some(t=>t.id===e.id)),c=e._additionalTeams.get(t.id)??new Set(s.length===1?s.map(e=>e.id):[]),l=s.filter(e=>c.has(e.id)).map(e=>e.id);return M`<section class="npm-review-entry" aria-current="${String(n)}"><div class="npm-review-history-heading"><strong>${ki(t)}</strong>${n?M`<span class="npm-review-current">Current</span>`:N}${Oi(t)}</div><p class="npm-review-help">${t.basePackage?`${t.basePackage===t.package?t.baseVersion:`${t.basePackage}@${t.baseVersion}`} \u2192 ${t.version}`:`All package files`}</p><div class="npm-review-entry-result">${r?Di(t.status):N}<span class="dependency-review-coverage"> ${r?M`${i.coverage===`full`?`Full`:M`<span class="dependency-review-partial">Partial</span>`} · `:N}${i.checkedFiles}${i.totalFiles===null?N:`/${i.totalFiles}`} files checked</span></div><p class="npm-review-help">${t.teams.length>0?`${t.teams.map(e=>e.name).join(`, `)} \xB7 `:``}${Ai(t.publishedAt??t.time)}</p>${Ni(t.comment)}<div class="npm-review-entry-actions"><button type="button" class="npm-review-button" ?disabled="${$(e)}" @click="${()=>{e._openReview(t)}}">Open ${C}</button> ${r&&o&&!a&&e._reviewer?M`<button type="button" class="npm-review-button" aria-label="Revise in a new draft" ?disabled="${$(e)}" @click="${()=>{e._openReview(t,!0)}}">Revise</button>`:N} ${r&&o&&e._writable&&t.revokedAt===null?M`<button type="button" class="npm-review-button npm-review-danger" ?disabled="${$(e)}" @click="${()=>e._change({action:`revoke`,reviewId:t.id,revision:t.revision})}">Revoke</button>`:N} ${o?M`<dependency-review-copy .text="${t.formatted}"></dependency-review-copy>`:N} ${!r&&o&&e._writable?M`<button type="button" class="dependency-review-discard" aria-label="Discard review" ?disabled="${$(e)}" @click="${()=>{e._discard(t)}}">${bt(yt)}</button>`:N}</div>${r&&o&&e._writable&&t.revokedAt===null&&s.length>0?M`<details class="npm-review-share"><summary>Publish to more teams</summary>${Ji(e,`Teams`,s,c,n=>{e._additionalTeams=new Map(e._additionalTeams).set(t.id,n)},M`<button type="button" class="npm-review-button" ?disabled="${$(e)||l.length===0}" @click="${()=>e._change({action:`publish`,reviewId:t.id,revision:t.revision,teamIds:l})}">Publish to more teams</button>`)}</details>`:N} ${t.revokedAt===null?N:M`<p class="npm-review-help">Revoked ${Ai(t.revokedAt)}. Content and team links remain frozen.</p>`}</section>`}function Zi(e){if(!e._panel)return N;let t={publish:`Publish review`,reviews:`Reviews`,unsaved:`Unsaved changes`};return M`<dialog class="npm-review-dialog" aria-label="${t[e._panel]}" @cancel="${t=>{t.preventDefault(),e._closePanel()}}"><button type="button" class="detail-action npm-review-close" aria-label="Close panel" ?disabled="${e._blocked}" @click="${()=>e._closePanel()}">×</button><header class="npm-review-dialog-head"><h2>${t[e._panel]}</h2><p>${e._panel===`reviews`?`${e.entry.npm.name}@${e.entry.npm.version}`:Q(e._context)}</p></header>${e._panel===`publish`?Yi(e,e._activeReview):M`<div class="${`npm-review-dialog-body${e._panel===`reviews`?` npm-review-entries`:``}`}">${e._panel===`unsaved`?M`${e._dirtyFiles.map(t=>M`<button type="button" class="npm-review-button" @click="${()=>{e._closePanel(),e._selectFile(t)}}">${t} ${C}</button>`)}`:Vi(e).map(t=>Xi(e,t))} ${e._panel===`reviews`&&Vi(e).length===0?M`<p class="npm-review-muted">No reviews yet.</p>`:N}${zi(e)}</div>`} ${Bi(e)}</dialog>`}function Qi(e){let t=e._shownReview?.entries,n=e._files,r=e._nonTextFiles;if(e._treeProgress?.entries!==t||e._treeProgress?.files!==n||e._treeProgress?.nonTextFiles!==r){let i=Mi(t,r),a=new Map,o=0;for(let t of e._files){let e=t.split(`/`),n=+!!i.get(t)?.status;o+=n;for(let t=1;t<e.length;t++){let r=e.slice(0,t).join(`/`),i=a.get(r)??{total:0,checked:0};i.total++,i.checked+=n,a.set(r,i)}}e._treeProgress={entries:t,files:n,nonTextFiles:r,states:i,directories:a,checked:o}}let{states:i,directories:a,checked:o}=e._treeProgress;return{railLabel:`Files`,treeLabel:`Review files`,collapseLabel:`Collapse folders`,searchLabel:`Find a file`,searchPlaceholder:`Find a file…`,treePageSize:300,filterContent:!1,fullPaths:!0,collapseClearsSearch:!0,canSelect:()=>!e._blocked&&!e._panel,fileFilter:e._unchecked?e=>!i.get(e)?.status:null,fileLabel:e=>`${e}, ${X[i.get(e)?.status]??`Not reviewed`}`,filePrefix:e=>Ei(i.get(e)?.status),fileSuffix:e=>i.get(e)?.notes?M`<span class="npm-review-note-dot" aria-label="Has notes">•</span>`:N,directoryLabel:e=>{let t=a.get(e.sourcePath);return`${e.sourcePath}, ${t?.checked??0} of ${t?.total??0} checked`},directorySummary:e=>{let t=a.get(e.sourcePath);return`${t?.checked??0}/${t?.total??0}`},filters:M`<div class="npm-review-filters" aria-label="Filter review files"><button type="button" class="npm-review-button" aria-pressed="${String(!e._unchecked)}" @click="${()=>{e._unchecked=!1}}">All ${e._files.length}</button> <button type="button" class="npm-review-button" aria-pressed="${String(!!e._unchecked)}" @click="${()=>{e._unchecked=!0}}">Unchecked ${e._files.length-o}</button></div>`,fileActions:(t,n)=>qi(e,t,n)}}function $i(e){return e._base?M`${Gi(e)}${Ki(e)}${e._panel?N:zi(e)} ${yi({base:e._base,other:e.details,diff:e._diff,source:e.source,path:e._path,seek:e._seek,baseName:e._base.npm?`${e._base.npm.name}@${e._base.npm.version}`:`Empty package`,otherName:`${e.entry.npm.name}@${e.entry.npm.version}`,select:t=>e._selectFile(t),extensions:Qi(e),mode:e._mode})} <span class="npm-review-announcement" role="status">${e._notice??``}</span>${e._panel?N:Bi(e)}${Zi(e)}`:M`<div class="npm-review-empty" role="${e._baseError?`alert`:`status`}">${e._baseError??`Loading comparison…`} ${e._baseError?M`<button type="button" class="npm-review-button" @click="${()=>{e._baseKey=null,e._loadBase(e._target,e.request?.resume)}}">Retry</button>`:N}</div>`}var ea={maxLines:5e4,maxBytes:2097152},ta={integrity:`(empty)`,kind:`sourcemap`,json:{version:3,sources:[],sourcesContent:[]},fileSizes:new Map},na=(e,t)=>({ecosystem:`npm`,package:e.npm.name,version:e.npm.version,integrity:e.integrity,basePackage:t?.npm?.name??null,baseVersion:t?.npm?.version??null,baseIntegrity:t?.npm?t.integrity:null}),ra=(e,t)=>`${e}@${t??`latest`}`,ia=class extends xt{static properties={entry:{attribute:!1},details:{attribute:!1},request:{attribute:!1},session:{attribute:!1},source:{attribute:!1},_teams:{state:!0},_selectedTeams:{state:!0},_additionalTeams:{state:!0},_reviews:{state:!0},_loading:{state:!0},_error:{state:!0},_saving:{state:!0},_saveBlocked:{state:!0},_file:{state:!0},_seek:{state:!0},_finalStatus:{state:!0},_finalComment:{state:!0},_base:{state:!0},_baseError:{state:!0},_panel:{state:!0},_path:{state:!0},_selectedReview:{state:!0},_unchecked:{state:!0},_notice:{state:!0},_continuation:{state:!0}};createRenderRoot(){return this}constructor(){super(),this._teams=[],this._reviews=[],this._files=[],this._nonTextFiles=[],this._selectedTeams=new Set,this._additionalTeams=new Map,this._editors=new Map,this._file=null,this._path=null,this._loading=!1,this._saving=!1,this._error=null,this._context=null,this._key=null,this._controller=new AbortController,this._mode=`code`,this._panel=null,this._selectedReview=null,this._unchecked=!1,this._pendingSaves=[],this._saveBlocked=!1}disconnectedCallback(){super.disconnectedCallback(),this._controller.abort(),this._cancelSaves(),this._dismissLoading?.(),this._key=null,this._baseKey=null}updated(){let e=this.querySelector(`dialog`);e&&!e.open&&e.showModal(),this._rememberBase()}_rememberBase(){w.bundleDetailsTab!==`review`||w.selectedBundle!==this.entry?.integrity||!this._context||!this._activeReview&&this._ownPublished.length===0&&!this._unsaved||(w.npmReview={bundle:this.entry.integrity,...this._context.basePackage?{reviewPackage:this._context.basePackage,reviewSpec:this._context.baseVersion}:{},started:!0,user:this.session?.id})}get _writable(){return[`triage`,`manage`,`admin`].includes(this.session?.role)&&!this.session?.viewer}get _reviewer(){return this._writable&&this._teams.length>0}get _activeReview(){return this._reviews.find(e=>e.user===this.session?.id&&e.publishedAt===null&&Z(e,this._context))??(this._continuation&&this._continuation.review.user===this.session?.id?this._continuation.review:null)}get _ownPublished(){return this._reviews.filter(e=>e.user===this.session?.id&&e.publishedAt!==null&&Z(e,this._context)).toSorted((e,t)=>t.publishedAt-e.publishedAt)}get _shownReview(){return this._selectedReview?this._reviews.find(e=>e.id===this._selectedReview):this._activeReview??this._ownPublished[0]??null}get _canEdit(){return this._reviewer&&!this._selectedReview&&(this._activeReview!==null||this._ownPublished.length===0)}_isDirty(e,t){return!this._nonTextFiles.includes(e)&&(t.comment!==(t.edit?.comment??``)||t.status!==(t.edit?.status??``))}get _dirtyFiles(){return[...this._editors].filter(([e,t])=>this._isDirty(e,t)).map(([e])=>e)}get _blocked(){return this._saving||this._saveBlocked}get _unsaved(){return this._pendingSaves.length>0||this._dirtyFiles.length>0}get _draftStarted(){return this._canEdit&&(this._unsaved||this._activeReview&&!this._continuation||this._continuation&&this._publishRevision!=null&&!this._unchangedContinuation)}get _summary(){return he(this._shownReview?.entries??[],this._files,this._nonTextFiles)}get _securityLimit(){return this.source?.reviewVerdictLimit?.(this.entry,this._base)??`accept`}get _allowedVerdicts(){let e=new Map((this._shownReview?.entries??[]).map(e=>[e.file,e]));if(this._canEdit)for(let[t,n]of this._editors)e.set(t,{file:t,status:n.status||null});return ge([...e.values()].filter(e=>!this._nonTextFiles.includes(e.file)),this._securityLimit)}get _needsPackageJson(){return _e(this._activeReview?.entries??[],this._files,this._nonTextFiles)}get _unchangedContinuation(){let e=this._continuation?.source;return!!(e&&this._finalStatus===e.status&&this._finalComment===e.comment)}get _canPublish(){return this._canEdit&&this._panel===`publish`&&this._activeReview?.revision===this._publishRevision&&this._summary.checkedFiles>0&&!this._needsPackageJson&&!this._unchangedContinuation&&this._selectedTeams.size>0&&!this._unsaved&&this._allowedVerdicts.includes(this._finalStatus)}_location(e){let t=e&&e!==`(empty)`?_(e):null;return t?{reviewPackage:t.name,reviewSpec:t.spec}:{}}_navigate(e){return this._navigateTo(y(this.entry,`review`,this._location(e)))}async _navigateTo(e){if(this._blocked||this._loading)return;let t=this._key,n=this._navigation={};this._unsaved&&!await this._saveAll()||t===this._key&&n===this._navigation&&!this._unsaved&&await Ne?.navigate(e)}async _loadBase(e,t=!1){let n=JSON.stringify([this.entry.integrity,e,this.session?.id,this.session?.role]);if(this._baseKey!==n){this._baseKey=n,this._base=null,this._baseError=null,this._controller.abort(),this._cancelSaves(),this._key=null,this._controller=new AbortController;try{let r=t?await we(na(this.entry,null),this._controller.signal):null;if(this._baseKey!==n)return;r&&(e=r.basePackage?ra(r.basePackage,r.baseVersion):`(empty)`);let i=e===`(empty)`?null:_(e),a=i?(await ee(i.name,i.spec??`latest`)).details:ta;if(this._baseKey!==n)return;let o=await Jt(a,this.details);if(this._baseKey!==n)return;t&&(r&&Fi(r),this._target=e,this.request={bundle:this.entry.integrity,...this._location(e)},this._baseKey=JSON.stringify([this.entry.integrity,e,this.session?.id,this.session?.role])),this._base=a,this._ensureContext(a,o)}catch(e){this._baseKey===n&&(this._baseError=e.message)}}}_ensureContext(e,t){let n=na(this.entry,e),r=JSON.stringify([this.session?.id,this.session?.role,n]);if(r===this._key)return;this._controller.abort(),this._cancelSaves(),this._controller=new AbortController,this._context=n,this._diff=t;let i=$t(e,this.details,this._diff);this._files=Fe(Oe(i.map(e=>e.path)));let a=new Set(i.filter(e=>!me(e.before,e.after)).map(e=>e.path));if(this._nonTextFiles=this._files.filter(e=>a.has(e)),this._mode=en(i,ea)?`diff`:`code`,this._key=r,this._teams=[],this._reviews=[],this._selectedTeams=new Set,this._additionalTeams=new Map,this._selectedReview=null,this._continuation=null,this._editors.clear(),this._path=this._files[0]??null,this._panel=null,this._notice=``,this._resetEditor(this._path),this._saving=!1,this._refresh(!0),w.bundleDetailsTab===`review`&&w.selectedBundle===this.entry.integrity){let t=this._location(e.npm?ra(e.npm.name,e.npm.version):`(empty)`);w.npmReview={bundle:this.entry.integrity,...t},this._baseKey=JSON.stringify([this.entry.integrity,e.npm?ra(e.npm.name,e.npm.version):`(empty)`,this.session?.id,this.session?.role]),Ne?.replaceRoute(y(this.entry,`review`,t))}}async _refresh(e=!1){let t=this._key;for(;t===this._key&&this._pendingSaves.length>0;)if((await Promise.all(this._pendingSaves.map(e=>e.promise))).some(e=>!e))return;if(t!==this._key)return;this._dismissLoading?.();let n=this._dismissLoading=Te(`Loading reviews…`,{duration:0});this._loading=!0,this._error=null;try{let{reviews:n,teams:r}=await ve({...this._context,allBases:!0},null,null,this._controller.signal);if(t===this._key){let t=this._unsaved;this._reviews=n,this._teams=r,n.some(e=>e.user===this.session?.id&&e.publishedAt===null&&Z(e,this._context))&&(this._continuation=null),this._rememberBase();let i=Ii(this._context),a=i&&n.find(e=>e.id===i.review.id);a?.publishedAt!=null&&(i.continueReview?this._continue(a.id,a.revision):this._selectedReview=a.id),this._selectedTeams=new Set(r.filter(t=>e?r.length===1:this._selectedTeams.has(t.id)).map(e=>e.id)),t||(this._editors.clear(),this._resetEditor(this._file))}}catch(e){t===this._key&&e.name!==`AbortError`&&(this._error=e.message)}finally{n(),t===this._key&&(this._loading=!1)}}_resetEditor(e=null){this._publishRevision=null,this._file=e,this._editorState(e)}_editorState(e){let t=this._canEdit?this._editors.get(e):null;if(!t){let n=this._shownReview?.entries.find(t=>t.file===e&&t.status)??null;t={edit:n,revision:this._activeReview?.revision??null,comment:this._nonTextFiles.includes(e)?``:n?.comment??``,status:this._nonTextFiles.includes(e)?``:n?.status??``},this._canEdit&&this._editors.set(e,t)}return{...t,dirty:this._isDirty(e,t)}}_editFile(e,t){!this._canEdit||this._blocked||(this._resetEditor(e),Object.assign(this._editors.get(e),t),this.requestUpdate())}_setFileStatus(e,t){if(!(this._blocked||this._nonTextFiles.includes(e)))return this._editFile(e,{status:t,...t?{}:{comment:``}}),this._saveFile(e)}_selectFile(e){this._blocked||!this._files.includes(e)||(this._path=e,this._resetEditor(e))}_openLine({path:e,line:t,query:n}){this._blocked||!this._files.includes(e)||(this._seek={path:e,line:t-1,query:n},this._selectFile(e))}_openPanel(e){this._panel=e}async _openReview(e,t=!1){if(this._blocked||this._loading)return;if(Z(e,this._context)){t?this._continue(e.id,e.revision):e.publishedAt===null?this._resume():this._showPublished(e);return}let n=this._key;this._unsaved&&!await this._saveAll()||n!==this._key||(Fi(e,t),await this._navigate(e.basePackage?ra(e.basePackage,e.baseVersion):`(empty)`))}_closePanel(){this._blocked||(this.querySelector(`dialog`)?.close(),this._panel=null)}_showPublished(e){this._selectedReview=e.id,this._panel=null,this._file=this._path}_resume(){this._selectedReview=null,this._panel=null,this._resetEditor(this._path)}async _discard(e){if(this._blocked||this._loading||!this._writable||e.user!==this.session.id||e.publishedAt!==null)return;let t=e===this._activeReview,n=this._key,r=this._controller.signal;this._saving=!0,this._error=null;try{let{confirmed:i}=await lt({reviewTitle:Q(e),signal:r});if(!i||r.aborted||n!==this._key||(await Promise.all(this._pendingSaves.map(e=>e.promise)),r.aborted||n!==this._key||!this._writable)||(e=t?this._activeReview:this._reviews.find(t=>t.id===e.id),!e||e.user!==this.session.id||e.publishedAt!==null))return;let a=e===this._continuation?.review;if(a||await Ce(e.id,e.revision,this.session.csrfToken,r),r.aborted||n!==this._key)return;a||(this._reviews=this._reviews.filter(t=>t.id!==e.id)),Z(e,this._context)&&(this._continuation=null,this._selectedReview=null,this._editors.clear(),this._resetEditor(this._path),this._finalStatus=null,this._finalComment=``,this._panel=null,this._ownPublished.length===0&&w.npmReview?.bundle===this.entry.integrity&&delete w.npmReview.started),this._notice=`Draft discarded.`}catch(e){n===this._key&&e.name!==`AbortError`&&(this._error=e.message)}finally{n===this._key&&(this._saving=!1)}}_continue(e,t){let n=this._reviews.find(n=>n.id===e&&n.revision===t&&n.user===this.session?.id&&n.publishedAt!==null&&Z(n,this._context));return!n||this._activeReview||!this._reviewer?null:(this._continuation={source:n,review:{...n,publishedAt:null,revokedAt:null,status:null,teams:[]}},this._selectedTeams=new Set(this._teams.length===1?this._teams.map(e=>e.id):[]),this._selectedReview=null,this._panel=null,this._editors.clear(),this._resetEditor(this._path),this._notice=`A new draft will be saved when you make a change.`,this._activeReview)}async _persistContinuation(e){let t=this._continuation,n=this._key,{review:r}=await ve(this._context,{action:`continue`,reviewId:t.source.id,revision:t.source.revision},this.session.csrfToken,this._controller.signal);return n!==this._key||this._continuation!==t||e&&this._pendingSaves[0]!==e?null:(this._acceptSave(r,{revision:t.source.revision}),r)}_cancelSaves(){for(let e of this._pendingSaves)clearTimeout(e.timer),e.resolve(null);this._pendingSaves=[],this._saveBlocked=!1}_queueSave(e){let t=this._pendingSaves.findLast(t=>t.change.file===e.file);if(t&&t.change.comment===e.comment&&t.change.status===e.status)return t.promise;let n={change:e,slow:!1};return n.promise=new Promise(e=>{n.resolve=e}),n.timer=setTimeout(()=>{n.slow=!0,this._saveBlocked=!0},3e3),this._pendingSaves.push(n),this.requestUpdate(),this._pendingSaves.length===1&&this._flushSaves(),n.promise}_acceptSave(e,t){this._reviews=[...this._reviews.filter(t=>t.id!==e.id),e],this._continuation=null;for(let[n,r]of this._editors)r.revision===t.revision&&(r.revision=e.revision,r.edit=e.entries.find(e=>e.file===n&&e.status)??null);for(let{change:n}of this._pendingSaves.slice(1))n.revision===t.revision&&(n.revision=e.revision,n.reviewId=e.id,n.entryId=e.entries.find(e=>e.file===n.file)?.id??null);this._canEdit&&this._resetEditor(this._file),this._notice=`Saved privately.`,this._rememberBase()}async _flushSaves(){for(;this._pendingSaves.length>0;){let e=this._pendingSaves[0];this._error=null;try{if(this._continuation){let t=await this._persistContinuation(e);if(!t||this._pendingSaves[0]!==e)return;Object.assign(e.change,{reviewId:t.id,revision:t.revision,entryId:t.entries.find(t=>t.file===e.change.file)?.id??null})}let{review:t}=await ve(this._context,e.change,this.session.csrfToken,this._controller.signal);if(this._pendingSaves[0]!==e)return;this._acceptSave(t,e.change),clearTimeout(e.timer),this._pendingSaves.shift(),e.resolve(t),this._saveBlocked=this._pendingSaves.some(e=>e.slow),this.requestUpdate()}catch(t){if(this._pendingSaves[0]!==e)return;this._cancelSaves(),t.name!==`AbortError`&&(this._error=t.message),this.requestUpdate();return}}}async _change(e){if(this._blocked||this._pendingSaves.length>0||this._loading||!this._writable)return null;if(e.action===`continue`)return this._continue(e.reviewId,e.revision);let t=this._key;this._saving=!0,this._error=null;try{if(e.action===`publish`&&e.finalStatus&&this._continuation){let t=await this._persistContinuation();if(!t)return null;e={...e,reviewId:t.id,revision:t.revision}}let n=this._reviews.find(t=>t.id===e.reviewId)??this._context,r=Object.fromEntries(Object.keys(this._context).map(e=>[e,n[e]])),{review:i}=await ve(r,e,this.session.csrfToken,this._controller.signal);return t===this._key?(this._reviews=[...this._reviews.filter(e=>e.id!==i.id),i],e.action===`publish`&&e.finalStatus&&Z(i,this._context)&&(this._selectedReview=i.id,this._panel=null,this._editors.clear(),this._notice=`Published. Verdicts and notes are now frozen.`),this._rememberBase(),i):null}catch(e){return t===this._key&&e.name!==`AbortError`&&(this._error=e.message),null}finally{t===this._key&&(this._saving=!1)}}_saveFile(e){if(!this._canEdit||this._saving||this._loading)return null;let t=this._editorState(e),n=this._pendingSaves.some(t=>t.change.file===e),r=this._activeReview;return!t.dirty&&!n?r:!t.status&&!t.comment.trim()&&!t.edit?.id&&!n?(this._editors.delete(e),e===this._file&&this._resetEditor(e),r):this._queueSave({action:`save`,reviewId:r?.id??null,revision:t.revision,entryId:t.edit?.id??null,file:e,comment:t.comment,status:this._nonTextFiles.includes(e)?null:t.status||null})}async _saveAll(){let e=this._key;for(;e===this._key&&this._canEdit;){if(this._pendingSaves.length>0){if((await Promise.all(this._pendingSaves.map(e=>e.promise))).some(e=>!e))return!1;continue}let e=this._dirtyFiles;if(e.length===0)return!0;if(!await this._saveFile(e[0]))return!1}return!1}async _beginPublish(){if(!this._canEdit||this._saving||this._loading||this._finalizing||!this._summary.checkedFiles)return;let e=this._key;this._finalizing=!0;try{if(this._unsaved&&!await this._saveAll()||e!==this._key||!this._canEdit||this._unsaved||!this._summary.checkedFiles)return;let t=this._activeReview;if(!t)return;let n=this._allowedVerdicts,r=this._continuation?.source.status;this._finalStatus=n.includes(r)?r:n[0],this._finalComment=t.comment??``,this._publishRevision=t.revision,this._panel=`publish`}finally{this._finalizing=!1}}_publish(){if(this._canPublish)return this._change({action:`publish`,reviewId:this._activeReview.id,revision:this._publishRevision,teamIds:[...this._selectedTeams],finalStatus:this._finalStatus,finalComment:this._finalComment})}render(){if(!this.entry?.npm||!this.details)return N;let e=this.request?.bundle===this.entry.integrity?this.request:{};return this._target=e.reviewPackage?ra(e.reviewPackage,e.reviewSpec):`(empty)`,this._loadBase(this._target,e.resume),$i(this)}};customElements.define(`npm-review`,ia);var aa=e=>({view:`npm`,packageName:e.package,packageSpec:e.version,bundleTab:`review`,...e.basePackage===null?{}:{reviewPackage:e.basePackage,reviewSpec:e.baseVersion}}),oa=e=>{let t=new Date(e);return M`<time datetime="${t.toISOString()}" data-tooltip="${t.toLocaleString()}">${t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,...t.getFullYear()===new Date().getFullYear()?{}:{year:`numeric`}})} <span>${t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}</span></time>`},sa=class extends xt{static properties={session:{attribute:!1},team:{attribute:!1},_reviews:{state:!0},_loading:{state:!0},_error:{state:!0},_next:{state:!0},_discarding:{state:!0},_expanded:{state:!0}};constructor(){super(),this._reviews=[],this._next=null,this._expanded=new Set,this._controller=new AbortController}createRenderRoot(){return this}disconnectedCallback(){super.disconnectedCallback(),this._controller.abort(),this._dismissLoading?.(),this._key=null}_canDiscard(e){return e.publishedAt===null&&e.user===this.session?.id&&[`triage`,`manage`,`admin`].includes(this.session?.role)}async _discard(e){if(!this._canDiscard(e)||this._discarding||this._loading)return;let t=this._key,n=this._controller.signal;this._discarding=e.id,this._error=null;try{let{confirmed:r}=await lt({reviewTitle:Q(e),signal:n});if(!r||n.aborted||t!==this._key||!this._canDiscard(e)||(await Ce(e.id,e.revision,this.session.csrfToken,n),t!==this._key||n.aborted))return;this._reviews=this._reviews.filter(t=>t.id!==e.id)}catch(e){t===this._key&&e.name!==`AbortError`&&(this._error=e.message)}finally{t===this._key&&(this._discarding=null)}}async _load(e=!1){let t=this._key;this._dismissLoading?.();let n=this._dismissLoading=Te(`Loading reviews…`,{duration:0});this._loading=!0,this._error=null;try{let n=e?this._next:null,{reviews:r,next:i}=await(this.team?c(this.team,n,this._controller.signal):be(n,this._controller.signal));if(t!==this._key)return;this._reviews=[...new Map([...e?this._reviews:[],...r].map(e=>[e.id,e])).values()],this._next=i}catch(e){t===this._key&&e.name!==`AbortError`&&(this._error=e.message)}finally{n(),t===this._key&&(this._loading=!1)}}_toggleDetails(e){let t=new Set(this._expanded);t.has(e)?t.delete(e):t.add(e),this._expanded=t}_details(e){let t=e.entries.filter(e=>e.status);return M`<section id="${`review-details-${e.id}`}" class="dependency-review-details" aria-label="${`Details for ${Q(e)}`}">${e.comment?M`<div class="dependency-review-final-note" role="note" aria-label="Final note">${Ni(e.comment)}</div>`:N} ${t.length>0?M`<ul class="dependency-review-entries">${t.map(e=>M`<li><span class="dependency-review-entry-file">${ot(e.file)}<span>${e.file}</span></span> ${Di(e.status)}<div>${Ni(e.comment)}</div></li>`)}</ul>`:M`<p class="npm-review-muted">No file reviews yet.</p>`}</section>`}_row(e){let t=aa(e),n=this._expanded.has(e.id),r=e.publishedAt!==null,i=new Set(e.entries.filter(e=>e.status).map(e=>e.file)).size,a=e.entries.filter(e=>e.status&&e.comment.trim()).length+ +!!e.comment.trim(),o=n=>{n.button===0&&!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&!n.altKey&&Ne?.active&&(n.preventDefault(),Fi(e),Ne.navigate(t))};return M`<li class="${`dependency-review-row${n?` is-expanded`:``}${e.revokedAt===null?``:` is-revoked`}`}"><div class="dependency-review-row-main"><button type="button" class="dependency-review-expand" aria-expanded="${n}" aria-controls="${`review-details-${e.id}`}" aria-label="${`${n?`Hide`:`Show`} details for ${Q(e)}`}" @click="${()=>this._toggleDetails(e.id)}">${C}</button><div class="dependency-review-identity"><a class="dependency-review-title" href="${_t(t)}" @click="${o}">${e.basePackage!==null&&e.basePackage!==e.package?M`<span>${e.basePackage} ${e.baseVersion} →</span>`:N} <strong>${e.package}</strong> <span>${e.basePackage===e.package?`${e.baseVersion} \u2192 `:``}${e.version}</span></a><div class="dependency-review-meta">${oa(e.publishedAt??e.time)} ${this.team?M`<span class="dependency-review-author">${ki(e)}</span>`:N} ${r&&e.teams.length>0?M`<span class="dependency-review-teams">${e.teams.map(e=>e.name).join(`, `)}</span>`:N} ${r&&a>0?M`<span class="dependency-review-note-count">${a} ${a===1?`note`:`notes`}</span>`:N} ${e.revokedAt===null?N:Oi(e)}</div></div><div class="dependency-review-result">${r?Di(e.status):M`<span class="dependency-review-checked">${i} ${i===1?`file`:`files`} checked</span>`} <span class="dependency-review-coverage">${r?M`${e.coverage===`full`?`Full`:M`<span class="dependency-review-partial">Partial</span>`} · ${e.checkedFiles}/${e.totalFiles} files checked`:a?`${a} ${a===1?`note`:`notes`}`:`No notes`}</span></div><div class="dependency-review-row-actions">${this.team?N:M`<dependency-review-copy .text="${e.formatted}"></dependency-review-copy>`} ${this._canDiscard(e)?M`<button type="button" class="dependency-review-discard" aria-label="Discard review" ?disabled="${this._loading||!!this._discarding}" @click="${()=>this._discard(e)}">${bt(yt)}</button>`:N} <a class="dependency-review-open" href="${_t(t)}" @click="${o}" aria-label="${`${r?`Open`:`Continue`} review for ${Q(e)}`}"><span aria-hidden="true">→</span></a></div></div>${n?this._details(e):N}</li>`}render(){let e=JSON.stringify([this.session?.id,this.session?.role,this.team??null]);return e!==this._key&&(this._controller.abort(),this._controller=new AbortController,this._key=e,this._reviews=[],this._next=null,this._discarding=null,this._expanded=new Set,this._load()),this.team?M`<section class="dependency-review-list is-team">${this._error?M`<p role="alert">${this._error}</p>`:N} ${!this._loading&&!this._error&&this._reviews.length===0?M`<p class="npm-review-muted">No reviews are published to this team yet.</p>`:N}<ol>${this._reviews.map(e=>this._row(e))}</ol>${this._next?M`<button type="button" class="npm-review-button" ?disabled="${this._loading}" @click="${()=>this._load(!0)}">Load more</button>`:N}</section>`:M`<section class="dependency-review-list"><header><h1>My reviews</h1></header><p>Your private work and the reviews you’ve shared with teams.</p>${this._error?M`<p role="alert">${this._error}</p>`:N} ${!this._loading&&!this._error&&this._reviews.length===0?M`<p>No reviews yet. Open a package’s Review tab to begin.</p>`:N} ${[[`Drafts`,!1],[`Published reviews`,!0]].map(([e,t])=>{let n=this._reviews.filter(e=>e.publishedAt!==null===t);return M`<section class="dependency-review-section"><h2>${e}<span class="npm-review-count">${n.length}</span></h2><ol>${n.map(e=>this._row(e))}</ol>${n.length===0&&!this._loading?M`<p class="npm-review-muted">${t?`No published reviews yet.`:`No drafts.`}</p>`:N}</section>`})} ${this._next?M`<button type="button" class="npm-review-button" ?disabled="${this._loading||!!this._discarding}" @click="${()=>this._load(!0)}">Load more</button>`:N}</section>`}};customElements.define(`dependency-review-list`,sa);
|
|
26
|
+
@compare-code-select=${e=>{e.stopPropagation(),c(e.detail.path)}}></${f}>`}var yi=400,bi=24,xi=[`removed`,`added`,`changed`],Y=null;function X(e){return e.join(`, `)}var Si=class extends bt{static properties={details:{attribute:!1},integrity:{attribute:!1},request:{attribute:!1},source:{attribute:!1},review:{attribute:!1},_targetIntegrity:{state:!0},_otherDetails:{state:!0},_status:{state:!0},_scope:{state:!0},_fileSort:{state:!0},_pkgSort:{state:!0},_openSections:{state:!0},_mode:{state:!0},_codePath:{state:!0},_codeSeek:{state:!0}};createRenderRoot(){return this}constructor(){super(),this.details=null,this.integrity=null,this.request=null,this.source=null,this._targetIntegrity=null,this._otherDetails=null,this._status=`idle`,this._scope=``,this._fileSort={removed:`name`,added:`name`,changed:`name`},this._pkgSort={removed:`size`,added:`size`,changed:`size`},this._openSections=new Set,this._mode=`overview`,this._codePath=null,this._codeSeek=null,this._repaint=()=>this.requestUpdate(),this._fitBody=null,this._fitObserver=null}connectedCallback(){super.connectedCallback(),this._fitBody&&this._fitObserver?.observe(this._fitBody)}disconnectedCallback(){super.disconnectedCallback(),this._fitObserver?.disconnect()}willUpdate(e){e.has(`source`)&&this.source&&!e.get(`source`)&&(this._openSections=new Set([...this._openSections,`files`])),(e.has(`_otherDetails`)||e.has(`details`))&&this._status===`ready`&&!o(this.details,this._otherDetails).some(e=>e.id===this._scope)&&(this._scope=``),e.has(`integrity`)&&this._rebase(),(e.has(`request`)||e.has(`integrity`))&&this.integrity&&this.request?.bundle===this.integrity?(this.request.target!==this._targetIntegrity&&this._choose(this.request.target),this._mode=ht(this.request.mode)):e.has(`request`)&&!e.has(`integrity`)&&e.get(`request`)?.bundle===this.integrity&&(this._targetIntegrity&&this._choose(null),this._mode=`overview`)}updated(){let e=this.querySelector(`.bundle-compare-body`);e!==this._fitBody&&typeof ResizeObserver==`function`&&(this._fitObserver??=new ResizeObserver(()=>this._fitLists()),this._fitObserver.disconnect(),e&&this._fitObserver.observe(e),this._fitBody=e),this._fitLists()}_fitLists(){let e=this._fitBody;if(!e)return;let t=getComputedStyle(e),n=e.getBoundingClientRect().top+e.clientTop+parseFloat(t.paddingTop)-e.scrollTop,r=e=>{let t=e.getBoundingClientRect();return t.top-n+e.parentElement.getBoundingClientRect().bottom-t.bottom},i=e.querySelector(`.bundle-compare-rows--fill`);if(i){let t=r(i),n=i.closest(`.bundle-compare-section`);for(let e=n;e;e=e.nextElementSibling){let r=e.matches(`details[open]`)&&e.querySelector(`:scope > summary`),i=e===n?0:r?r.getBoundingClientRect().bottom+parseFloat(getComputedStyle(r).marginBottom)-e.getBoundingClientRect().top:e.getBoundingClientRect().height;t+=i+parseFloat(getComputedStyle(e).marginBottom)}e.style.setProperty(`--compare-fill-around`,`${t}px`)}let a=[...e.querySelectorAll(`.bundle-compare-rows--scroll:not(.bundle-compare-rows--fill)`)];if(a.length===0)return;let o=e.lastElementChild,s=new Map(a.filter(e=>o.contains(e)).map(e=>[e,e.parentElement.getBoundingClientRect().top])),c=Math.max(...s.values()),l=e.clientHeight-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom),u=parseFloat(getComputedStyle(o).marginBottom);for(let e of a)s.get(e)>=c-1?e.style.setProperty(`--compare-rest`,`${l-r(e)-u}px`):e.style.removeProperty(`--compare-rest`)}_rebase(){let e=this._baseKey;if(Y&&e&&e!==Y.base&&(Y=null),Y&&e===Y.base){let{target:e}=Y;if(this._scope=Y.scope,this._mode=Y.mode,this._codePath=Y.codePath,Y=null,!e){this._targetIntegrity=null,this._otherDetails=null,this._status=`idle`;return}this._targetIntegrity=e;let t=this.source?null:He(e,e=>!!(e.json||e.bundle));t?(this._otherDetails=t,this._status=`ready`):(this._otherDetails=null,this._status=`loading`,this._loadOther(e));return}this._targetIntegrity=null,this._otherDetails=null,this._status=`idle`,this._scope=``,this._codePath=null}get _baseKey(){return this.source?this.source.base:this.integrity}_swap(){let e=this._targetIntegrity;e&&e!==this._baseKey&&this._reopen(e,this._baseKey)}_pickBase(e){!e||e===this._baseKey||(e===this._targetIntegrity?this._swap():this._reopen(e,this._targetIntegrity))}_reopen(e,t){if(this.source){Y={base:e,target:t,scope:this._scope,mode:this._mode,codePath:this._codePath},this.source.open(e,t,this._mode);return}if(!ye(T.bundles??[],this.integrity).some(t=>t.integrity===e))return;Y={base:e,target:t,scope:this._scope,mode:this._mode,codePath:this._codePath};let n=[this._otherDetails,this._baseReady?this.details:null].filter(n=>n&&!n.error&&(n.json||n.bundle)&&[e,t].includes(n.integrity));this.dispatchEvent(new CustomEvent(`bundle-swap`,{bubbles:!0,composed:!0,detail:{integrity:e,target:t,bundles:n,mode:this._mode}}))}_nameFor(e){return this.source?this.source.name(e):(T.bundles??[]).find(t=>t.integrity===e)?.name??`${e.slice(0,15)}\u2026`}_pick(e){this._choose(e),this._notify()}_notify(){this.dispatchEvent(new CustomEvent(`bundle-compare-change`,{bubbles:!0,composed:!0,detail:{base:this.integrity,target:this._targetIntegrity,mode:this._mode}}))}_choose(e){let t=e||null;if(this._targetIntegrity=t,this._otherDetails=null,this._codePath=null,!t){this._status=`idle`,this._scope=``;return}this._status=`loading`,this._loadOther(t)}async _loadOther(e){if(this.source){let t;try{t=await this.source.load(e)}catch(e){if(e.name===`AbortError`)return;t={error:e.message}}if(this._targetIntegrity!==e)return;this._otherDetails=t,this._status=`ready`,t?.compareId&&t.compareId!==e&&(this._targetIntegrity=t.compareId,this._notify());return}let t=ye(T.bundles??[],this.integrity).find(t=>t.integrity===e);if(!t){this._status=`idle`,this._targetIntegrity=null,this._notify();return}let n;try{n=await We(e,t)}catch(e){if(e.name===`AbortError`)return;throw e}this._targetIntegrity===e&&(this._otherDetails=n,this._status=`ready`)}get _baseReady(){return!!(this.details&&this.details.integrity===this.integrity&&(this.details.json||this.details.bundle))}_openFile(e){this._codePath=e,this._mode=`code`,this._notify()}_openLine({path:e,line:t,query:n}){this._codeSeek={path:e,line:t-1,query:n},this._openFile(e)}_fileRow(e,t,n,r=e,i=!1,a=void 0,o=e,s=void 0){let c=this.source?.files;return N`<li><button type="button" class="bundle-compare-row bundle-compare-row-link" @click="${()=>this._openFile(e)}">${c?c.icon(e,[[this._otherDetails,o],[this.details,e]]):P}<span class="bundle-compare-row-path mono" data-tooltip-truncated data-tooltip="${r}">${t}</span>${i?c?.tag?.(this.details,e,s)??P:P}${lr(a)}${n}</button></li>`}_group(e,t,n,r,i,a=P,{fill:o=!1,lanes:s=xi,style:c={}}={}){return t.length===0?P:N`<section class="${`bundle-compare-group bundle-compare-${n}`}" style="${j({"--compare-lane":String(s.indexOf(n)+1),...c})}"><header class="bundle-compare-group-head"><span class="bundle-compare-dot" aria-hidden="true"></span> <span class="bundle-compare-group-title" data-tooltip-truncated data-tooltip="${e}">${e}</span> <span class="bundle-compare-group-count">${t.length}</span> ${a}</header><ul class="${o?`bundle-compare-rows bundle-compare-rows--scroll bundle-compare-rows--fill`:`bundle-compare-rows bundle-compare-rows--scroll`}">${M(t,r,i)}</ul></section>`}_sizeCells(e){let t=e=>e==null?`—`:k(e),n=e=>`${e.toLocaleString()} LoC`;return e.delta===void 0?N`<span class="bundle-compare-row-size" data-tooltip="${e.lines>0?n(e.lines):P}">${t(e.bytes)}</span>`:N`<span class="${`bundle-compare-row-delta ${e.delta===null?``:F(e.delta)}`}" data-tooltip="${`${t(e.baseBytes)} \u2192 ${t(e.otherBytes)}${e.baseLines>0||e.otherLines>0?` \xB7 ${e.baseLines.toLocaleString()} \u2192 ${n(e.otherLines)}`:``}`}">${e.delta===null?`—`:Ct(e.delta)}</span>`}_sortActions(e,t,n,r=!1,i=this[e][t]){return N`<span class="bundles-overview-sort" role="group" aria-label="${`${t} ${n} order`}">${[[`name`,`Name`],[`size`,`Size`],...r?[[`flags`,`Flags`]]:[]].map(([n,r])=>N`<button type="button" aria-pressed="${String(i===n)}" @click="${()=>{this[e]={...this[e],[t]:n}}}">${r}</button>`)}</span>`}_fileGroup(e,t,n,r,i){let a=this.source?.files,o=n!==`removed`,s=e=>n===`added`?null:{details:this._otherDetails,path:e.basePath??e.path},c=e=>[...o&&a?.flags?a.flags(this.details,e.path,s(e)):[],...ur(e.meta)],l=t.some(e=>c(e).length>0),u=this._fileSort[n]===`flags`&&!l?`name`:this._fileSort[n],d=e=>n===`changed`?Math.abs(e.delta):e.bytes,f=u===`flags`?we(t,c,e=>e.path):t.toSorted((e,t)=>(u===`size`?d(t)-d(e):0)||e.path.localeCompare(t.path));return this._group(e,f,n,e=>e.path,e=>e.renamedFrom==null?this._fileRow(e.path,r(e.path),this._sizeCells(e),e.path,o,e.meta,e.basePath??e.path,s(e)):this._fileRow(e.path,Jt(r(e.renamedFrom),r(e.path)),this._sizeCells(e),`${e.renamedFrom} \u2192 ${e.path}`,o,e.meta,e.basePath??e.path,s(e)),this._sortActions(`_fileSort`,n,`file`,l,u),{lanes:i})}_pkgGroup(e,t,n,r){let i=this._pkgSort[n],a=e=>{let t=n===`changed`?e.delta:e.bytes;return t==null?-1:Math.abs(t)},o=t.toSorted((e,t)=>(i===`size`?a(t)-a(e):0)||mt(e.pkg).localeCompare(mt(t.pkg))),s=n===`changed`?0:Math.min(bi,Math.max(0,...t.map(e=>X(e.versions).length)));return this._group(e,o,n,e=>e.pkg,e=>N`<li><div class="bundle-compare-row"><span class="bundle-compare-pkg-dot" style="${j({background:pt(e.pkg)})}"></span> <span class="bundle-compare-row-path" data-tooltip-truncated data-tooltip="${mt(e.pkg)}">${mt(e.pkg)}</span> ${n===`changed`?this._versionCell(e):s>0?N`<span class="bundle-compare-dep-ver" data-tooltip-truncated data-tooltip="${X(e.versions)}">${X(e.versions)}</span>`:P} ${this._sizeCells(n===`changed`?e:{bytes:e.bytes})}</div></li>`,this._sortActions(`_pkgSort`,n,`package`),{fill:!0,lanes:r,style:s>0?{"--compare-version-width":`${s}ch`}:{}})}_versionCell(e){let t=e.otherVersions,n=e.baseVersions;if(n.join()===t.join())return n.length>0?N`<span class="bundle-compare-dep-ver">${X(n)}</span>`:P;let r=e.direction??`changed`,i=r===`up`?`↑`:r===`down`?`↓`:`±`;return N`<span class="bundle-compare-ver" aria-label="${`${r===`up`?`Upgraded`:r===`down`?`Downgraded`:`Changed`}: ${X(n)||`none`} to ${X(t)||`none`}`}"><span class="bundle-compare-ver-from">${X(n)||`—`}</span> <span class="bundle-compare-ver-arrow" aria-hidden="true">→</span> <span class="${`bundle-compare-ver-to ${r}`}">${X(t)||`—`}</span> <span class="${`bundle-compare-ver-dir ${r}`}" aria-hidden="true">${i}</span></span>`}_depGroup(e,t,n,r){let i=n===`changed`?0:Math.min(bi,Math.max(0,...t.map(e=>e.range.length))),a=e=>N`<span class="bundle-compare-row-path" data-tooltip-truncated data-tooltip="${e.name}">${e.name}</span> ${this.source?.dependencyTags?.(e,n)??P}${e.kind?N`<span class="npm-dependency-kind">${e.kind}</span>`:P} ${n===`changed`?N`<span class="bundle-compare-ver" aria-label="${`Changed: ${e.from} to ${e.to}`}"><span class="bundle-compare-ver-from">${e.from}</span> <span class="bundle-compare-ver-arrow" aria-hidden="true">→</span> <span class="bundle-compare-ver-to changed">${e.to}</span></span>`:N`<span class="bundle-compare-dep-ver" data-tooltip-truncated data-tooltip="${e.range}">${e.range}</span>`}`,o=this.source?.openDependency;return this._group(e,t,n,e=>e.key,e=>N`<li>${o&&e.opens?N`<button type="button" class="bundle-compare-row bundle-compare-row-link" @click="${()=>o(e)}">${a(e)}</button>`:N`<div class="bundle-compare-row">${a(e)}</div>`}</li>`,P,{fill:!0,lanes:r,style:i>0?{"--compare-version-width":`${i}ch`}:{}})}_renderDependencies(e,t,n,r){return r.length===0?P:N`<section class="bundle-compare-section"><h3 class="bundle-compare-section-head">Dependencies</h3>${this._cols(r,N`${this._depGroup(`Removed \xB7 only in ${t}`,e.removed,`removed`,r)} ${this._depGroup(`Added \xB7 only in ${n}`,e.added,`added`,r)} ${this._depGroup(`Changed`,e.changed,`changed`,r)}`,`dependencies`)}</section>`}_renderPackages(e,t,n,r=xi){return e.removed.length===0&&e.added.length===0&&e.changed.length===0?P:N`<section class="bundle-compare-section"><h3 class="bundle-compare-section-head">Packages</h3>${this._cols(r,N`${this._pkgGroup(`Removed \xB7 only in ${t}`,e.removed,`removed`,r)} ${this._pkgGroup(`Added \xB7 only in ${n}`,e.added,`added`,r)} ${this._pkgGroup(`Changed`,e.changed,`changed`,r)}`,`packages`)}</section>`}_cols(e,t,n){let r=e.map(e=>e===`changed`?`minmax(0, 5fr)`:`minmax(0, 4fr)`).join(` `);return N`<div class="bundle-compare-cols" data-lanes="${e.length}" data-section="${n}" style="${j({"--compare-lanes":r})}">${t}</div>`}_collapsible(e,t,n,r,i=``){let a=this._openSections.has(e);return N`<details class="bundle-compare-section bundle-compare-collapsible" .open="${E(a)}" @toggle="${t=>this._setSection(e,t.currentTarget.open)}"><summary class="bundle-compare-section-head" @click="${t=>{t.preventDefault(),this._setSection(e,!a)}}">${t} <span class="bundle-compare-section-count">${n.toLocaleString()}</span>${i?N`<span class="bundle-compare-section-note" data-tooltip-truncated data-tooltip="${i}">${i}</span>`:P}</summary>${a?r():P}</details>`}_setSection(e,t){if(t===this._openSections.has(e))return;let n=new Set(this._openSections);t?n.add(e):n.delete(e),this._openSections=n}_renderResolutions(e){if(e.totalChanges===0)return P;let t=e.changed,n=t.slice(0,yi),r=t.length-n.length,i=(e,t=``)=>N`<td class="${t}"><code data-tooltip-truncated data-tooltip="${e}">${e}</code></td>`,a=e=>`${e.conditions}${e.platform===null?``:` \xB7 Platform: ${e.platform}`}`,o=n.some(e=>a(e)!==`*`);return this._collapsible(`resolutions`,`Import resolutions`,t.length,()=>N`<section class="bundle-compare-group bundle-compare-changed bundle-compare-resolutions"><header class="bundle-compare-group-head"><span class="bundle-compare-dot" aria-hidden="true"></span> <span class="bundle-compare-group-title">Repointed</span> <span class="bundle-compare-group-count">${t.length}</span></header><table class="${o?``:`bundle-compare-resolutions--no-context`}"><thead><tr><th>File</th><th>Import</th><th>Before</th><th>After</th>${o?N`<th>Conditions</th>`:P}</tr></thead><tbody>${M(n,e=>e.key,e=>{let t=a(e);return N`<tr><td><button type="button" class="bundle-compare-resolution-parent" data-tooltip-truncated data-tooltip="${e.parent}" @click="${()=>this._openFile(e.parent)}">${e.parent}</button></td>${i(e.specifier)} ${i(e.baseTarget||`(empty target)`,`bundle-compare-resolution-before`)} ${i(e.otherTarget||`(empty target)`,`bundle-compare-resolution-after`)} ${o?N`<td class="bundle-compare-resolution-context"><span data-tooltip-truncated data-tooltip="${t}">${t}</span></td>`:P}</tr>`})}</tbody></table>${r>0?N`<div class="bundle-compare-more">and ${r.toLocaleString()} more…</div>`:P}</section>`)}_comparison(){return Kt(this._otherDetails,this.details,this._scope,this._repaint)}_renderSummary(e){return kt(e,N`<div class="bundle-compare-modes" role="tablist" aria-label="Comparison view">${[[`overview`,`Overview`],[`code`,`Code`]].map(([e,t])=>N`<button type="button" role="tab" aria-selected="${String(this._mode===e)}" @click="${()=>{this._mode=e,this._notify()}}">${t}</button>`)}</div>`)}_renderPicker(e,t,n,r){return Ot({source:this.source,from:{options:e,value:this._targetIntegrity,pick:e=>this._pick(e)},to:{options:this._baseOptions(),value:this._baseKey,placeholder:this._nameFor(this.integrity),pick:e=>this._pickBase(e)},clear:t?{run:()=>this._pick(null)}:null,swap:t&&this.source?.canSwap?.(this._targetIntegrity)!==!1?()=>this._swap():null,extras:n,comparison:r,openLine:e=>this._openLine(e)})}_baseOptions(){if(this.source)return I(this.source.choices??[]);let e=(T.bundles??[]).find(e=>e.integrity===this.integrity),t=ye(T.bundles??[],this.integrity);return this._bundleOptions(e?[e,...t]:t)}_otherOptions(){return this.source?I(this.source.options):this._bundleOptions(ye(T.bundles??[],this.integrity))}_bundleOptions(e){let t=new Map;for(let n of e)t.set(n.name,(t.get(n.name)??0)+1);return e.map(e=>({id:e.integrity,integrity:e.integrity,kind:e.kind??(e.name.toLowerCase().endsWith(`.map`)?`sourcemap`:`stasis`),summary:e.summary,size:typeof e.size==`number`?k(e.size):`—`,filename:t.get(e.name)>1?`${e.name} \xB7 ${e.integrity.slice(7,13)}\u2026`:e.name}))}render(){let e=this._otherOptions(),t=!!this._targetIntegrity&&(!!this.source||e.some(e=>e.integrity===this._targetIntegrity)),n=this._baseReady?o(this.details,t?this._otherDetails:null):[],r=n.length>0?N`<bundle-scope-selector .reasons="${n}" .value="${this._scope}" label="Compare scope" @scope-change="${e=>{this._scope=e.detail.value}}"></bundle-scope-selector>`:P,i=this.source?.noun??`bundle`,a=t&&this._status===`ready`&&this._otherDetails&&(this._otherDetails.json||this._otherDetails.bundle)&&!this._otherDetails.error,s=this._baseReady&&a?this._comparison():null,c=s?.status===`ready`?s.diff:null,l=c?{base:this._otherDetails,other:this.details,files:c.files}:null,u=e.length>0||this.source?this._renderPicker(e,t,r,l):r,d=c?this._mode:`overview`,f;return this._baseReady?this.source&&!t&&(this.source.pending||this.source.error||!this.source.select&&e.length===0)?f=N`<div class="${`bundle-compare-empty${this.source.error?` is-error`:``}`}">${this.source.pending?`Loading ${i}s\u2026`:this.source.error??N`No other ${i}s to compare <strong>${this._nameFor(this.integrity)}</strong> with.`}</div>`:e.length===0&&!this.source?f=N`<div class="bundle-compare-empty">No other bundles to compare with. Drop a second <code>.map</code> or <code>.stasis.code.br</code> bundle to diff against this one.</div>`:t?this._status===`loading`||!this._otherDetails?f=N`<div class="bundle-compare-empty">Comparing…</div>`:this._otherDetails.error?f=N`<div class="bundle-compare-empty is-error">Couldn't read the selected ${i}: ${this._otherDetails.error}</div>`:!this._otherDetails.json&&!this._otherDetails.bundle?f=N`<div class="bundle-compare-empty is-error">The selected ${i} couldn't be parsed.</div>`:s?.status===`error`?f=N`<div class="bundle-compare-empty is-error">Couldn't compare the ${i}s: ${s.message}</div>`:c?d!==`code`&&(f=this._renderDiff(c)):f=N`<div class="bundle-compare-empty">Comparing…</div>`:f=N`<div class="bundle-compare-empty">Pick a ${i} above to compare <strong>${this._nameFor(this.integrity)}</strong> against.</div>`:f=N`<div class="bundle-compare-empty">Loading bundle…</div>`,N`<div class="bundle-compare">${At(u,c?this._renderSummary(c):P)} ${d===`code`?vi({base:this._otherDetails,other:this.details,diff:c,source:this.source,path:this._codePath,seek:this._codeSeek,baseName:this._nameFor(this._targetIntegrity),otherName:this._nameFor(this.integrity),select:e=>{this._codePath=e}}):N`<div class="bundle-compare-body">${f}</div>`}</div>`}_renderDiff(e){let t=this._nameFor(this._targetIntegrity),n=this._nameFor(this.integrity),r=[...e.files.onlyBase.map(e=>e.path),...e.files.onlyOther.map(e=>e.path),...e.files.changed.flatMap(e=>e.renamedFrom==null?[e.path]:[e.path,e.renamedFrom])],i=a(e.files.root,ft(r).prefix),{prefix:o}=i,s=e=>o&&e.startsWith(o)?e.slice(o.length):e,c=e.files.onlyBase.length+e.files.onlyOther.length+e.files.changed.length,l={removed:e.files.onlyBase,added:e.files.onlyOther,changed:e.files.changed},u=!e.totals.identical,d=this.source?.dependencies?.(this._otherDetails,this.details)??null,f=xi.filter(t=>(d??e.packageRows)[t].length>0),p=u?xi.filter(e=>l[e].length>0):[],m=p.every(e=>f.includes(e))?f:p,h=u?this.source?.files?.warning?.(this.details,[...l.added,...l.changed].map(e=>e.path)):P;return N`${d?this._renderDependencies(d,t,n,f):this._renderPackages(e.packageRows,t,n,f)} ${h??P} ${e.totals.identical?e.resolutions.totalChanges>0?N`<div class="bundle-compare-caption">File contents are unchanged; import resolutions differ.</div>`:N`<div class="bundle-compare-identical">These two ${this.source?.noun??`bundle`}s carry identical files (${e.totals.unchangedFiles.toLocaleString()} ${e.totals.unchangedFiles===1?`file`:`files`})${i.from?N`, moved <span class="mono">${Yt(i)}</span>`:``}.</div>`:this._collapsible(`files`,`Files`,c,()=>this._cols(m,N`${this._fileGroup(`Removed \xB7 only in ${t}`,l.removed,`removed`,s,m)} ${this._fileGroup(`Added \xB7 only in ${n}`,l.added,`added`,s,m)} ${this._fileGroup(`Changed`,l.changed,`changed`,s,m)}`,`files`),i.from?`${i.from} \u2192 ${i.to}`:o)} ${this._renderResolutions(e.resolutions)}`}};customElements.define(`bundle-compare`,Si);var Ci={...me,"accept-with-nits":`Accept with nits`},wi=e=>e.revokedAt===null?e.publishedAt===null?`Draft`:`Published`:`Revoked`,Ti={accept:`✓`,"accept-with-nits":`·`,"request-changes":`!`,reject:`×`},Ei=e=>N`<span class="${`npm-review-verdict-icon ${e??`unchecked`}`}" aria-hidden="true">${Ti[e]??``}</span>`,Di=e=>N`<span class="npm-review-verdict">${Ei(e)}${Ci[e]??`Not reviewed`}</span>`,Oi=e=>N`<span class="${`npm-review-badge ${e.revokedAt===null?e.publishedAt===null?``:`published`:`revoked`}`}">${wi(e)}</span>`,ki=e=>e.user?Ye({id:e.user,login:e.userLogin,name:e.userName?.trim()||null}):e.userLogin,Ai=e=>N`<time datetime="${new Date(e).toISOString()}">${new Date(e).toLocaleString()}</time>`,ji=(e,t)=>N`<div class="npm-review-progress" role="progressbar" aria-label="Files checked" aria-valuemin="0" aria-valuemax="${t||1}" aria-valuenow="${e}"><span style="${j({width:`${t?e/t*100:0}%`})}"></span></div>`;function Mi(e=[],t=[]){let n=new Set(t);return new Map(e.filter(e=>e.status&&!n.has(e.file)).map(e=>[e.file,{status:e.status,notes:+!!e.comment.trim()}]))}function Ni(e){let t=Se(e);if(t.length===0)return P;let n=t.filter(e=>e.bullet);return N`${t.filter(e=>!e.bullet).map(e=>N`<p class="npm-review-note">${e.text}</p>`)} ${n.length>0?N`<ul class="npm-review-note npm-review-note-list">${n.map(e=>N`<li>${e.text}</li>`)}</ul>`:P}`}var Pi=null,Z=(e,t)=>[`ecosystem`,`package`,`version`,`integrity`,`basePackage`,`baseVersion`,`baseIntegrity`].every(n=>e[n]===t[n]);function Fi(e,t=!1){Pi={review:e,continueReview:t}}function Ii(e){if(!Pi||!Z(Pi.review,e))return null;let t=Pi;return Pi=null,t}function Q(e){let t=`${e.package} ${e.version}`;return e.basePackage?e.basePackage===e.package?`${e.package} ${e.baseVersion} -> ${e.version}`:`${e.basePackage} ${e.baseVersion} -> ${t}`:t}var $=e=>e._blocked||e._loading,Li=e=>e._shownReview?.publishedAt!=null,Ri=e=>e.coverage===`full`?`Full`:`Partial`,zi=e=>e._error?N`<p class="npm-review-error" role="alert">${e._error}</p>`:P,Bi=e=>e._saveBlocked?N`<div class="npm-review-saving" role="status">Saving changes…</div>`:P,Vi=e=>[e._continuation?.review,...e._reviews].filter(Boolean).toSorted((e,t)=>+(e.publishedAt!==null)-(t.publishedAt!==null)||(t.publishedAt??t.time)-(e.publishedAt??e.time)),Hi=e=>`npm-review-button npm-review-primary npm-review-finalize ${e._allowedVerdicts[0]}`,Ui=(e,t,n,r,i=Object.keys(Ci),a=!1)=>N`<div class="npm-review-verdict-options" role="group" aria-label="Verdict">${Object.entries(a?{"":`Not checked`,...Ci}:Ci).map(([a,o])=>N`<label class="${`npm-review-verdict-choice ${a||`unchecked`}`}"><input type="radio" name="${e}" aria-label="${o}" value="${a}" .checked="${E(t===a)}" ?disabled="${r||a!==``&&!i.includes(a)}" @change="${()=>n(a)}">${o}</label>`)}</div>`;function Wi(e){let t=Li(e),n=e._shownReview,r=e._summary,i=e._canEdit?{label:`Finalize review`,run:()=>e._beginPublish(),disabled:!r.checkedFiles}:!t||!e._writable?null:e._activeReview||e._ownPublished.length===0?{label:`Resume your review`,run:()=>e._resume()}:n.user===e.session?.id?{label:`Revise review`,run:()=>e._change({action:`continue`,reviewId:n.id,revision:n.revision})}:null;return N`<div class="npm-review-summary-actions">${t||e._draftStarted?Oi(n??{publishedAt:null,revokedAt:null}):P}<div class="npm-review-progress-block"><span>${e._unsaved&&(e._saveBlocked||e._error)?N`<button type="button" class="npm-review-button npm-review-text-button" @click="${()=>e._openPanel(`unsaved`)}">Unsaved changes</button>`:N`<strong>${r.checkedFiles} of ${r.totalFiles}</strong> files checked`}</span> ${ji(r.checkedFiles,r.totalFiles)}</div>${i?N`<button type="button" class="${e._canEdit?Hi(e):`npm-review-button`}" ?disabled="${$(e)||i.disabled}" @click="${i.run}">${i.label} ${w}</button>`:P}</div>`}function Gi(e){let t=e.source??Ee(e.entry),n=!!(e._target&&e._target!==`(empty)`),r=I(t.options,t=>`${e.entry.npm.name}@${t.id}`);n&&!r.some(t=>t.id===e._target)&&r.push(...I([{id:e._target,name:e._target,format:`npm`}]));let i=I(t.choices);return i.some(t=>t.id===e.entry.npm.version)||i.push(...I([{id:e.entry.npm.version,name:e.entry.npm.version,format:`npm`}])),At(Ot({source:t,label:`Review`,disabled:$(e),from:{options:r,value:n?e._target:null,label:`Review base`,pick:t=>{e._navigate(t)}},to:{options:i,value:e.entry.npm.version,label:`Version to review`,pick:t=>{e._navigateTo({view:`npm`,packageName:e.entry.npm.name,packageSpec:t,bundleTab:`review`,...e._location(e._target)})}},clear:n?{label:`Clear review base`,run:()=>{e._navigate(`(empty)`)}}:null,openLine:t=>e._openLine(t),comparison:{base:e._base,other:e.details,files:e._diff.files}}),kt(e._diff))}function Ki(e){return N`<div class="npm-review-toolbar"><nav class="npm-review-toolbar-group" aria-label="Review breadcrumbs"><button type="button" class="npm-review-button npm-review-text-button" ?disabled="${$(e)}" @click="${()=>{e._navigateTo({view:`reviews`})}}">My reviews</button> ${w}<button type="button" class="npm-review-button npm-review-text-button npm-review-package" aria-haspopup="dialog" ?disabled="${e._blocked}" @click="${()=>e._openPanel(`reviews`)}"><span>${e.entry.npm.name}@${e.entry.npm.version}</span><span class="npm-review-count">${Vi(e).length}</span></button></nav>${Wi(e)}</div>`}function qi(e,t=e._file,n=!1){let r=e._editorState(t),i=e._shownReview?.entries.find(e=>e.file===t),a=e._nonTextFiles.includes(t),o=!a&&[`accept-with-nits`,`request-changes`,`reject`].includes(r.status);return N`<section class="${`npm-review-decision${n?` npm-review-inline-decision`:``}`}" aria-label="File decision">${e._canEdit?N`${Ui(`file:${t}`,a?``:r.status,n=>{e._setFileStatus(t,n)},$(e)||a,void 0,!0)} ${a?N`<p class="npm-review-help">Non-text file. Verdicts are not supported yet; this file remains unchecked.</p>`:P} ${o?N`<textarea aria-label="File note" rows="2" maxlength="20000" placeholder="Add a note (optional)…" .value="${E(r.comment)}" ?disabled="${$(e)}" @input="${n=>e._editFile(t,{comment:n.target.value})}" @blur="${()=>{e._saveFile(t)}}"></textarea>`:P}`:N`${n?P:N`<header><strong>File review</strong><span class="npm-review-muted">${Li(e)?`Frozen`:`Read only`}</span></header>`} ${i?.status&&!a?N`${Di(i.status)}${Ni(i.comment)}`:N`<p class="npm-review-muted">This file was not reviewed.</p>`} ${e._reviewer||e._loading?P:N`<p class="npm-review-help">${e._writable?`Reviewing needs a team that reviews dependencies, where you manage or have Dependencies.`:`Triage access is required to add a review.`}</p>`}`}</section>`}function Ji(e,t,n,r,i,a){return N`<fieldset class="npm-review-team-options"><legend>${t}</legend>${n.map(t=>N`<mode-switch label="${t.name}" .checked="${r.has(t.id)}" .disabled="${$(e)}" @click="${()=>{if($(e))return;let n=new Set(r);n.has(t.id)?n.delete(t.id):n.add(t.id),i(n)}}"></mode-switch>`)}${a}</fieldset>`}function Yi(e,t){let n=e._allowedVerdicts,r=_e(t.entries,e._files,e._nonTextFiles),i=t.entries.filter(t=>t.status&&t.comment.trim()&&!e._nonTextFiles.includes(t.file));return N`<form class="npm-review-publish-form" @submit="${t=>{t.preventDefault(),e._publish()}}"><div class="npm-review-dialog-body"><section class="npm-review-coverage"><div><strong>${Ri(r)} review</strong><span>${r.checkedFiles} of ${r.totalFiles} files checked</span></div>${ji(r.checkedFiles,r.totalFiles)}<p>${r.totalFiles>r.checkedFiles?N`${r.totalFiles-r.checkedFiles} files not checked. <button type="button" class="npm-review-button npm-review-text-button" @click="${()=>{e._unchecked=!0,e._closePanel()}}">View files</button>`:`Every file has a verdict.`}</p>${e._needsPackageJson?N`<p class="npm-review-error">Review ${e._files.includes(`package.json`)?N`<button type="button" class="npm-review-button npm-review-text-button" @click="${()=>{e._closePanel(),e._selectFile(`package.json`)}}">package.json</button>`:`package.json`} before publishing a partial review.</p>`:P}</section>${i.length>0?N`<section aria-label="File notes"><strong>File notes</strong><ul class="npm-review-publish-notes" tabindex="0" aria-label="Saved file notes">${i.map(e=>N`<li><span class="dependency-review-entry-file">${at(e.file)}<span>${e.file}</span></span> ${Ni(e.comment)}</li>`)}</ul></section>`:P}<div><strong>Final verdict</strong>${Ui(`final-verdict`,e._finalStatus,t=>{e._finalStatus=t},$(e),n)}</div>${e._securityLimit===`reject`?N`<p class="npm-review-help">Malware detected. Only Reject is available.</p>`:e._securityLimit===`request-changes`?N`<p class="npm-review-help">Critical vulnerabilities detected.</p>`:P} <label>Final note <span class="npm-review-muted">· optional</span><textarea aria-label="Final comment" rows="3" maxlength="20000" .value="${E(e._finalComment)}" placeholder="Summarize your findings or explain what remains…" ?disabled="${$(e)}" @input="${t=>{e._finalComment=t.target.value}}"></textarea></label> ${e._unchangedContinuation?N`<p class="npm-review-help">Change a verdict or note to publish a new review.</p>`:P} ${Ji(e,`Publish to teams`,e._teams,e._selectedTeams,t=>{e._selectedTeams=t},e._selectedTeams.size>0?P:N`<p class="npm-review-error">${e._teams.length===0?`No teams you belong to have dependency review enabled.`:`Select at least one team to publish.`}</p>`)} ${zi(e)}</div><footer class="npm-review-dialog-footer"><p>Publishing freezes your verdicts and notes.<br>You can continue in a new review to make changes.</p><button type="submit" class="${Hi(e)}" ?disabled="${$(e)||!e._canPublish}">Publish to ${e._selectedTeams.size} ${e._selectedTeams.size===1?`team`:`teams`} ${w}</button></footer></form>`}function Xi(e,t){let n=t===e._shownReview,r=t.publishedAt!==null,i=r?t:Z(t,e._context)?_e(t.entries,e._files,e._nonTextFiles):{checkedFiles:t.entries.filter(e=>e.status).length,totalFiles:null},a=[e._continuation?.review,...e._reviews].some(n=>n?.publishedAt===null&&n.user===e.session?.id&&Z(n,t)),o=t.user===e.session?.id,s=e._teams.filter(e=>!t.teams.some(t=>t.id===e.id)),c=e._additionalTeams.get(t.id)??new Set(s.length===1?s.map(e=>e.id):[]),l=s.filter(e=>c.has(e.id)).map(e=>e.id);return N`<section class="npm-review-entry" aria-current="${String(n)}"><div class="npm-review-history-heading"><strong>${ki(t)}</strong>${n?N`<span class="npm-review-current">Current</span>`:P}${Oi(t)}</div><p class="npm-review-help">${t.basePackage?`${t.basePackage===t.package?t.baseVersion:`${t.basePackage}@${t.baseVersion}`} \u2192 ${t.version}`:`All package files`}</p><div class="npm-review-entry-result">${r?Di(t.status):P}<span class="dependency-review-coverage"> ${r?N`${i.coverage===`full`?`Full`:N`<span class="dependency-review-partial">Partial</span>`} · `:P}${i.checkedFiles}${i.totalFiles===null?P:`/${i.totalFiles}`} files checked</span></div><p class="npm-review-help">${t.teams.length>0?`${t.teams.map(e=>e.name).join(`, `)} \xB7 `:``}${Ai(t.publishedAt??t.time)}</p>${Ni(t.comment)}<div class="npm-review-entry-actions"><button type="button" class="npm-review-button" ?disabled="${$(e)}" @click="${()=>{e._openReview(t)}}">Open ${w}</button> ${r&&o&&!a&&e._reviewer?N`<button type="button" class="npm-review-button" aria-label="Revise in a new draft" ?disabled="${$(e)}" @click="${()=>{e._openReview(t,!0)}}">Revise</button>`:P} ${r&&o&&e._writable&&t.revokedAt===null?N`<button type="button" class="npm-review-button npm-review-danger" ?disabled="${$(e)}" @click="${()=>e._change({action:`revoke`,reviewId:t.id,revision:t.revision})}">Revoke</button>`:P} ${o?N`<dependency-review-copy .text="${t.formatted}"></dependency-review-copy>`:P} ${!r&&o&&e._writable?N`<button type="button" class="dependency-review-discard" aria-label="Discard review" ?disabled="${$(e)}" @click="${()=>{e._discard(t)}}">${yt(vt)}</button>`:P}</div>${r&&o&&e._writable&&t.revokedAt===null&&s.length>0?N`<details class="npm-review-share"><summary>Publish to more teams</summary>${Ji(e,`Teams`,s,c,n=>{e._additionalTeams=new Map(e._additionalTeams).set(t.id,n)},N`<button type="button" class="npm-review-button" ?disabled="${$(e)||l.length===0}" @click="${()=>e._change({action:`publish`,reviewId:t.id,revision:t.revision,teamIds:l})}">Publish to more teams</button>`)}</details>`:P} ${t.revokedAt===null?P:N`<p class="npm-review-help">Revoked ${Ai(t.revokedAt)}. Content and team links remain frozen.</p>`}</section>`}function Zi(e){if(!e._panel)return P;let t={publish:`Publish review`,reviews:`Reviews`,unsaved:`Unsaved changes`};return N`<dialog class="npm-review-dialog" aria-label="${t[e._panel]}" @cancel="${t=>{t.preventDefault(),e._closePanel()}}"><button type="button" class="detail-action npm-review-close" aria-label="Close panel" ?disabled="${e._blocked}" @click="${()=>e._closePanel()}">×</button><header class="npm-review-dialog-head"><h2>${t[e._panel]}</h2><p>${e._panel===`reviews`?`${e.entry.npm.name}@${e.entry.npm.version}`:Q(e._context)}</p></header>${e._panel===`publish`?Yi(e,e._activeReview):N`<div class="${`npm-review-dialog-body${e._panel===`reviews`?` npm-review-entries`:``}`}">${e._panel===`unsaved`?N`${e._dirtyFiles.map(t=>N`<button type="button" class="npm-review-button" @click="${()=>{e._closePanel(),e._selectFile(t)}}">${t} ${w}</button>`)}`:Vi(e).map(t=>Xi(e,t))} ${e._panel===`reviews`&&Vi(e).length===0?N`<p class="npm-review-muted">No reviews yet.</p>`:P}${zi(e)}</div>`} ${Bi(e)}</dialog>`}function Qi(e){let t=e._shownReview?.entries,n=e._files,r=e._nonTextFiles;if(e._treeProgress?.entries!==t||e._treeProgress?.files!==n||e._treeProgress?.nonTextFiles!==r){let i=Mi(t,r),a=new Map,o=0;for(let t of e._files){let e=t.split(`/`),n=+!!i.get(t)?.status;o+=n;for(let t=1;t<e.length;t++){let r=e.slice(0,t).join(`/`),i=a.get(r)??{total:0,checked:0};i.total++,i.checked+=n,a.set(r,i)}}e._treeProgress={entries:t,files:n,nonTextFiles:r,states:i,directories:a,checked:o}}let{states:i,directories:a,checked:o}=e._treeProgress;return{railLabel:`Files`,treeLabel:`Review files`,collapseLabel:`Collapse folders`,searchLabel:`Find a file`,searchPlaceholder:`Find a file…`,treePageSize:300,filterContent:!1,fullPaths:!0,collapseClearsSearch:!0,canSelect:()=>!e._blocked&&!e._panel,fileFilter:e._unchecked?e=>!i.get(e)?.status:null,fileLabel:e=>`${e}, ${Ci[i.get(e)?.status]??`Not reviewed`}`,filePrefix:e=>Ei(i.get(e)?.status),fileSuffix:e=>i.get(e)?.notes?N`<span class="npm-review-note-dot" aria-label="Has notes">•</span>`:P,directoryLabel:e=>{let t=a.get(e.sourcePath);return`${e.sourcePath}, ${t?.checked??0} of ${t?.total??0} checked`},directorySummary:e=>{let t=a.get(e.sourcePath);return`${t?.checked??0}/${t?.total??0}`},filters:N`<div class="npm-review-filters" aria-label="Filter review files"><button type="button" class="npm-review-button" aria-pressed="${String(!e._unchecked)}" @click="${()=>{e._unchecked=!1}}">All ${e._files.length}</button> <button type="button" class="npm-review-button" aria-pressed="${String(!!e._unchecked)}" @click="${()=>{e._unchecked=!0}}">Unchecked ${e._files.length-o}</button></div>`,fileActions:(t,n)=>qi(e,t,n)}}function $i(e){return e._base?N`${Gi(e)}${Ki(e)}${e._panel?P:zi(e)} ${vi({base:e._base,other:e.details,diff:e._diff,source:e.source,path:e._path,seek:e._seek,baseName:e._base.npm?`${e._base.npm.name}@${e._base.npm.version}`:`Empty package`,otherName:`${e.entry.npm.name}@${e.entry.npm.version}`,select:t=>e._selectFile(t),extensions:Qi(e),mode:e._mode})} <span class="npm-review-announcement" role="status">${e._notice??``}</span>${e._panel?P:Bi(e)}${Zi(e)}`:N`<div class="npm-review-empty" role="${e._baseError?`alert`:`status`}">${e._baseError??`Loading comparison…`} ${e._baseError?N`<button type="button" class="npm-review-button" @click="${()=>{e._baseKey=null,e._loadBase(e._target,e.request?.resume)}}">Retry</button>`:P}</div>`}var ea={maxLines:5e4,maxBytes:2097152},ta={integrity:`(empty)`,kind:`sourcemap`,json:{version:3,sources:[],sourcesContent:[]},fileSizes:new Map},na=(e,t)=>({ecosystem:`npm`,package:e.npm.name,version:e.npm.version,integrity:e.integrity,basePackage:t?.npm?.name??null,baseVersion:t?.npm?.version??null,baseIntegrity:t?.npm?t.integrity:null}),ra=(e,t)=>`${e}@${t??`latest`}`,ia=class extends bt{static properties={entry:{attribute:!1},details:{attribute:!1},request:{attribute:!1},session:{attribute:!1},source:{attribute:!1},_teams:{state:!0},_selectedTeams:{state:!0},_additionalTeams:{state:!0},_reviews:{state:!0},_loading:{state:!0},_error:{state:!0},_saving:{state:!0},_saveBlocked:{state:!0},_file:{state:!0},_seek:{state:!0},_finalStatus:{state:!0},_finalComment:{state:!0},_base:{state:!0},_baseError:{state:!0},_panel:{state:!0},_path:{state:!0},_selectedReview:{state:!0},_unchecked:{state:!0},_notice:{state:!0},_continuation:{state:!0}};createRenderRoot(){return this}constructor(){super(),this._teams=[],this._reviews=[],this._files=[],this._nonTextFiles=[],this._selectedTeams=new Set,this._additionalTeams=new Map,this._editors=new Map,this._file=null,this._path=null,this._loading=!1,this._saving=!1,this._error=null,this._context=null,this._key=null,this._controller=new AbortController,this._mode=`code`,this._panel=null,this._selectedReview=null,this._unchecked=!1,this._pendingSaves=[],this._saveBlocked=!1}disconnectedCallback(){super.disconnectedCallback(),this._controller.abort(),this._cancelSaves(),this._dismissLoading?.(),this._key=null,this._baseKey=null}updated(){let e=this.querySelector(`dialog`);e&&!e.open&&e.showModal(),this._rememberBase()}_rememberBase(){T.bundleDetailsTab!==`review`||T.selectedBundle!==this.entry?.integrity||!this._context||!this._activeReview&&this._ownPublished.length===0&&!this._unsaved||(T.npmReview={bundle:this.entry.integrity,...this._context.basePackage?{reviewPackage:this._context.basePackage,reviewSpec:this._context.baseVersion}:{},started:!0,user:this.session?.id})}get _writable(){return[`triage`,`manage`,`admin`].includes(this.session?.role)&&!this.session?.viewer}get _reviewer(){return this._writable&&this._teams.length>0}get _activeReview(){return this._reviews.find(e=>e.user===this.session?.id&&e.publishedAt===null&&Z(e,this._context))??(this._continuation&&this._continuation.review.user===this.session?.id?this._continuation.review:null)}get _ownPublished(){return this._reviews.filter(e=>e.user===this.session?.id&&e.publishedAt!==null&&Z(e,this._context)).toSorted((e,t)=>t.publishedAt-e.publishedAt)}get _shownReview(){return this._selectedReview?this._reviews.find(e=>e.id===this._selectedReview):this._activeReview??this._ownPublished[0]??null}get _canEdit(){return this._reviewer&&!this._selectedReview&&(this._activeReview!==null||this._ownPublished.length===0)}_isDirty(e,t){return!this._nonTextFiles.includes(e)&&(t.comment!==(t.edit?.comment??``)||t.status!==(t.edit?.status??``))}get _dirtyFiles(){return[...this._editors].filter(([e,t])=>this._isDirty(e,t)).map(([e])=>e)}get _blocked(){return this._saving||this._saveBlocked}get _unsaved(){return this._pendingSaves.length>0||this._dirtyFiles.length>0}get _draftStarted(){return this._canEdit&&(this._unsaved||this._activeReview&&!this._continuation||this._continuation&&this._publishRevision!=null&&!this._unchangedContinuation)}get _summary(){return _e(this._shownReview?.entries??[],this._files,this._nonTextFiles)}get _securityLimit(){return this.source?.reviewVerdictLimit?.(this.entry,this._base)??`accept`}get _allowedVerdicts(){let e=new Map((this._shownReview?.entries??[]).map(e=>[e.file,e]));if(this._canEdit)for(let[t,n]of this._editors)e.set(t,{file:t,status:n.status||null});return be([...e.values()].filter(e=>!this._nonTextFiles.includes(e.file)),this._securityLimit)}get _needsPackageJson(){return l(this._activeReview?.entries??[],this._files,this._nonTextFiles)}get _unchangedContinuation(){let e=this._continuation?.source;return!!(e&&this._finalStatus===e.status&&this._finalComment===e.comment)}get _canPublish(){return this._canEdit&&this._panel===`publish`&&this._activeReview?.revision===this._publishRevision&&this._summary.checkedFiles>0&&!this._needsPackageJson&&!this._unchangedContinuation&&this._selectedTeams.size>0&&!this._unsaved&&this._allowedVerdicts.includes(this._finalStatus)}_location(e){let t=e&&e!==`(empty)`?y(e):null;return t?{reviewPackage:t.name,reviewSpec:t.spec}:{}}_navigate(e){return this._navigateTo(x(this.entry,`review`,this._location(e)))}async _navigateTo(e){if(this._blocked||this._loading)return;let t=this._key,n=this._navigation={};this._unsaved&&!await this._saveAll()||t===this._key&&n===this._navigation&&!this._unsaved&&await Pe?.navigate(e)}async _loadBase(e,t=!1){let n=JSON.stringify([this.entry.integrity,e,this.session?.id,this.session?.role]);if(this._baseKey!==n){this._baseKey=n,this._base=null,this._baseError=null,this._controller.abort(),this._cancelSaves(),this._key=null,this._controller=new AbortController;try{let r=t?await Ce(na(this.entry,null),this._controller.signal):null;if(this._baseKey!==n)return;r&&(e=r.basePackage?ra(r.basePackage,r.baseVersion):`(empty)`);let i=e===`(empty)`?null:y(e),a=i?(await S(i.name,i.spec??`latest`)).details:ta;if(this._baseKey!==n)return;let o=await qt(a,this.details);if(this._baseKey!==n)return;t&&(r&&Fi(r),this._target=e,this.request={bundle:this.entry.integrity,...this._location(e)},this._baseKey=JSON.stringify([this.entry.integrity,e,this.session?.id,this.session?.role])),this._base=a,this._ensureContext(a,o)}catch(e){this._baseKey===n&&(this._baseError=e.message)}}}_ensureContext(e,t){let n=na(this.entry,e),r=JSON.stringify([this.session?.id,this.session?.role,n]);if(r===this._key)return;this._controller.abort(),this._cancelSaves(),this._controller=new AbortController,this._context=n,this._diff=t;let i=Qt(e,this.details,this._diff);this._files=Ie(Oe(i.map(e=>e.path)));let a=new Set(i.filter(e=>!he(e.before,e.after)).map(e=>e.path));if(this._nonTextFiles=this._files.filter(e=>a.has(e)),this._mode=$t(i,ea)?`diff`:`code`,this._key=r,this._teams=[],this._reviews=[],this._selectedTeams=new Set,this._additionalTeams=new Map,this._selectedReview=null,this._continuation=null,this._editors.clear(),this._path=this._files[0]??null,this._panel=null,this._notice=``,this._resetEditor(this._path),this._saving=!1,this._refresh(!0),T.bundleDetailsTab===`review`&&T.selectedBundle===this.entry.integrity){let t=this._location(e.npm?ra(e.npm.name,e.npm.version):`(empty)`);T.npmReview={bundle:this.entry.integrity,...t},this._baseKey=JSON.stringify([this.entry.integrity,e.npm?ra(e.npm.name,e.npm.version):`(empty)`,this.session?.id,this.session?.role]),Pe?.replaceRoute(x(this.entry,`review`,t))}}async _refresh(e=!1){let t=this._key;for(;t===this._key&&this._pendingSaves.length>0;)if((await Promise.all(this._pendingSaves.map(e=>e.promise))).some(e=>!e))return;if(t!==this._key)return;this._dismissLoading?.();let n=this._dismissLoading=ke(`Loading reviews…`,{duration:0});this._loading=!0,this._error=null;try{let{reviews:n,teams:r}=await ge({...this._context,allBases:!0},null,null,this._controller.signal);if(t===this._key){let t=this._unsaved;this._reviews=n,this._teams=r,n.some(e=>e.user===this.session?.id&&e.publishedAt===null&&Z(e,this._context))&&(this._continuation=null),this._rememberBase();let i=Ii(this._context),a=i&&n.find(e=>e.id===i.review.id);a?.publishedAt!=null&&(i.continueReview?this._continue(a.id,a.revision):this._selectedReview=a.id),this._selectedTeams=new Set(r.filter(t=>e?r.length===1:this._selectedTeams.has(t.id)).map(e=>e.id)),t||(this._editors.clear(),this._resetEditor(this._file))}}catch(e){t===this._key&&e.name!==`AbortError`&&(this._error=e.message)}finally{n(),t===this._key&&(this._loading=!1)}}_resetEditor(e=null){this._publishRevision=null,this._file=e,this._editorState(e)}_editorState(e){let t=this._canEdit?this._editors.get(e):null;if(!t){let n=this._shownReview?.entries.find(t=>t.file===e&&t.status)??null;t={edit:n,revision:this._activeReview?.revision??null,comment:this._nonTextFiles.includes(e)?``:n?.comment??``,status:this._nonTextFiles.includes(e)?``:n?.status??``},this._canEdit&&this._editors.set(e,t)}return{...t,dirty:this._isDirty(e,t)}}_editFile(e,t){!this._canEdit||this._blocked||(this._resetEditor(e),Object.assign(this._editors.get(e),t),this.requestUpdate())}_setFileStatus(e,t){if(!(this._blocked||this._nonTextFiles.includes(e)))return this._editFile(e,{status:t,...t?{}:{comment:``}}),this._saveFile(e)}_selectFile(e){this._blocked||!this._files.includes(e)||(this._path=e,this._resetEditor(e))}_openLine({path:e,line:t,query:n}){this._blocked||!this._files.includes(e)||(this._seek={path:e,line:t-1,query:n},this._selectFile(e))}_openPanel(e){this._panel=e}async _openReview(e,t=!1){if(this._blocked||this._loading)return;if(Z(e,this._context)){t?this._continue(e.id,e.revision):e.publishedAt===null?this._resume():this._showPublished(e);return}let n=this._key;this._unsaved&&!await this._saveAll()||n!==this._key||(Fi(e,t),await this._navigate(e.basePackage?ra(e.basePackage,e.baseVersion):`(empty)`))}_closePanel(){this._blocked||(this.querySelector(`dialog`)?.close(),this._panel=null)}_showPublished(e){this._selectedReview=e.id,this._panel=null,this._file=this._path}_resume(){this._selectedReview=null,this._panel=null,this._resetEditor(this._path)}async _discard(e){if(this._blocked||this._loading||!this._writable||e.user!==this.session.id||e.publishedAt!==null)return;let t=e===this._activeReview,n=this._key,r=this._controller.signal;this._saving=!0,this._error=null;try{let{confirmed:i}=await ct({reviewTitle:Q(e),signal:r});if(!i||r.aborted||n!==this._key||(await Promise.all(this._pendingSaves.map(e=>e.promise)),r.aborted||n!==this._key||!this._writable)||(e=t?this._activeReview:this._reviews.find(t=>t.id===e.id),!e||e.user!==this.session.id||e.publishedAt!==null))return;let a=e===this._continuation?.review;if(a||await xe(e.id,e.revision,this.session.csrfToken,r),r.aborted||n!==this._key)return;a||(this._reviews=this._reviews.filter(t=>t.id!==e.id)),Z(e,this._context)&&(this._continuation=null,this._selectedReview=null,this._editors.clear(),this._resetEditor(this._path),this._finalStatus=null,this._finalComment=``,this._panel=null,this._ownPublished.length===0&&T.npmReview?.bundle===this.entry.integrity&&delete T.npmReview.started),this._notice=`Draft discarded.`}catch(e){n===this._key&&e.name!==`AbortError`&&(this._error=e.message)}finally{n===this._key&&(this._saving=!1)}}_continue(e,t){let n=this._reviews.find(n=>n.id===e&&n.revision===t&&n.user===this.session?.id&&n.publishedAt!==null&&Z(n,this._context));return!n||this._activeReview||!this._reviewer?null:(this._continuation={source:n,review:{...n,publishedAt:null,revokedAt:null,status:null,teams:[]}},this._selectedTeams=new Set(this._teams.length===1?this._teams.map(e=>e.id):[]),this._selectedReview=null,this._panel=null,this._editors.clear(),this._resetEditor(this._path),this._notice=`A new draft will be saved when you make a change.`,this._activeReview)}async _persistContinuation(e){let t=this._continuation,n=this._key,{review:r}=await ge(this._context,{action:`continue`,reviewId:t.source.id,revision:t.source.revision},this.session.csrfToken,this._controller.signal);return n!==this._key||this._continuation!==t||e&&this._pendingSaves[0]!==e?null:(this._acceptSave(r,{revision:t.source.revision}),r)}_cancelSaves(){for(let e of this._pendingSaves)clearTimeout(e.timer),e.resolve(null);this._pendingSaves=[],this._saveBlocked=!1}_queueSave(e){let t=this._pendingSaves.findLast(t=>t.change.file===e.file);if(t&&t.change.comment===e.comment&&t.change.status===e.status)return t.promise;let n={change:e,slow:!1};return n.promise=new Promise(e=>{n.resolve=e}),n.timer=setTimeout(()=>{n.slow=!0,this._saveBlocked=!0},3e3),this._pendingSaves.push(n),this.requestUpdate(),this._pendingSaves.length===1&&this._flushSaves(),n.promise}_acceptSave(e,t){this._reviews=[...this._reviews.filter(t=>t.id!==e.id),e],this._continuation=null;for(let[n,r]of this._editors)r.revision===t.revision&&(r.revision=e.revision,r.edit=e.entries.find(e=>e.file===n&&e.status)??null);for(let{change:n}of this._pendingSaves.slice(1))n.revision===t.revision&&(n.revision=e.revision,n.reviewId=e.id,n.entryId=e.entries.find(e=>e.file===n.file)?.id??null);this._canEdit&&this._resetEditor(this._file),this._notice=`Saved privately.`,this._rememberBase()}async _flushSaves(){for(;this._pendingSaves.length>0;){let e=this._pendingSaves[0];this._error=null;try{if(this._continuation){let t=await this._persistContinuation(e);if(!t||this._pendingSaves[0]!==e)return;Object.assign(e.change,{reviewId:t.id,revision:t.revision,entryId:t.entries.find(t=>t.file===e.change.file)?.id??null})}let{review:t}=await ge(this._context,e.change,this.session.csrfToken,this._controller.signal);if(this._pendingSaves[0]!==e)return;this._acceptSave(t,e.change),clearTimeout(e.timer),this._pendingSaves.shift(),e.resolve(t),this._saveBlocked=this._pendingSaves.some(e=>e.slow),this.requestUpdate()}catch(t){if(this._pendingSaves[0]!==e)return;this._cancelSaves(),t.name!==`AbortError`&&(this._error=t.message),this.requestUpdate();return}}}async _change(e){if(this._blocked||this._pendingSaves.length>0||this._loading||!this._writable)return null;if(e.action===`continue`)return this._continue(e.reviewId,e.revision);let t=this._key;this._saving=!0,this._error=null;try{if(e.action===`publish`&&e.finalStatus&&this._continuation){let t=await this._persistContinuation();if(!t)return null;e={...e,reviewId:t.id,revision:t.revision}}let n=this._reviews.find(t=>t.id===e.reviewId)??this._context,r=Object.fromEntries(Object.keys(this._context).map(e=>[e,n[e]])),{review:i}=await ge(r,e,this.session.csrfToken,this._controller.signal);return t===this._key?(this._reviews=[...this._reviews.filter(e=>e.id!==i.id),i],e.action===`publish`&&e.finalStatus&&Z(i,this._context)&&(this._selectedReview=i.id,this._panel=null,this._editors.clear(),this._notice=`Published. Verdicts and notes are now frozen.`),this._rememberBase(),i):null}catch(e){return t===this._key&&e.name!==`AbortError`&&(this._error=e.message),null}finally{t===this._key&&(this._saving=!1)}}_saveFile(e){if(!this._canEdit||this._saving||this._loading)return null;let t=this._editorState(e),n=this._pendingSaves.some(t=>t.change.file===e),r=this._activeReview;return!t.dirty&&!n?r:!t.status&&!t.comment.trim()&&!t.edit?.id&&!n?(this._editors.delete(e),e===this._file&&this._resetEditor(e),r):this._queueSave({action:`save`,reviewId:r?.id??null,revision:t.revision,entryId:t.edit?.id??null,file:e,comment:t.comment,status:this._nonTextFiles.includes(e)?null:t.status||null})}async _saveAll(){let e=this._key;for(;e===this._key&&this._canEdit;){if(this._pendingSaves.length>0){if((await Promise.all(this._pendingSaves.map(e=>e.promise))).some(e=>!e))return!1;continue}let e=this._dirtyFiles;if(e.length===0)return!0;if(!await this._saveFile(e[0]))return!1}return!1}async _beginPublish(){if(!this._canEdit||this._saving||this._loading||this._finalizing||!this._summary.checkedFiles)return;let e=this._key;this._finalizing=!0;try{if(this._unsaved&&!await this._saveAll()||e!==this._key||!this._canEdit||this._unsaved||!this._summary.checkedFiles)return;let t=this._activeReview;if(!t)return;let n=this._allowedVerdicts,r=this._continuation?.source.status;this._finalStatus=n.includes(r)?r:n[0],this._finalComment=t.comment??``,this._publishRevision=t.revision,this._panel=`publish`}finally{this._finalizing=!1}}_publish(){if(this._canPublish)return this._change({action:`publish`,reviewId:this._activeReview.id,revision:this._publishRevision,teamIds:[...this._selectedTeams],finalStatus:this._finalStatus,finalComment:this._finalComment})}render(){if(!this.entry?.npm||!this.details)return P;let e=this.request?.bundle===this.entry.integrity?this.request:{};return this._target=e.reviewPackage?ra(e.reviewPackage,e.reviewSpec):`(empty)`,this._loadBase(this._target,e.resume),$i(this)}};customElements.define(`npm-review`,ia);var aa=e=>({view:`npm`,packageName:e.package,packageSpec:e.version,bundleTab:`review`,...e.basePackage===null?{}:{reviewPackage:e.basePackage,reviewSpec:e.baseVersion}}),oa=e=>{let t=new Date(e);return N`<time datetime="${t.toISOString()}" data-tooltip="${t.toLocaleString()}">${t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,...t.getFullYear()===new Date().getFullYear()?{}:{year:`numeric`}})} <span>${t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}</span></time>`},sa=class extends bt{static properties={session:{attribute:!1},team:{attribute:!1},_reviews:{state:!0},_loading:{state:!0},_error:{state:!0},_next:{state:!0},_discarding:{state:!0},_expanded:{state:!0}};constructor(){super(),this._reviews=[],this._next=null,this._expanded=new Set,this._controller=new AbortController}createRenderRoot(){return this}disconnectedCallback(){super.disconnectedCallback(),this._controller.abort(),this._dismissLoading?.(),this._key=null}_canDiscard(e){return e.publishedAt===null&&e.user===this.session?.id&&[`triage`,`manage`,`admin`].includes(this.session?.role)}async _discard(e){if(!this._canDiscard(e)||this._discarding||this._loading)return;let t=this._key,n=this._controller.signal;this._discarding=e.id,this._error=null;try{let{confirmed:r}=await ct({reviewTitle:Q(e),signal:n});if(!r||n.aborted||t!==this._key||!this._canDiscard(e)||(await xe(e.id,e.revision,this.session.csrfToken,n),t!==this._key||n.aborted))return;this._reviews=this._reviews.filter(t=>t.id!==e.id)}catch(e){t===this._key&&e.name!==`AbortError`&&(this._error=e.message)}finally{t===this._key&&(this._discarding=null)}}async _load(e=!1){let t=this._key;this._dismissLoading?.();let n=this._dismissLoading=ke(`Loading reviews…`,{duration:0});this._loading=!0,this._error=null;try{let n=e?this._next:null,{reviews:r,next:i}=await(this.team?c(this.team,n,this._controller.signal):ve(n,this._controller.signal));if(t!==this._key)return;this._reviews=[...new Map([...e?this._reviews:[],...r].map(e=>[e.id,e])).values()],this._next=i}catch(e){t===this._key&&e.name!==`AbortError`&&(this._error=e.message)}finally{n(),t===this._key&&(this._loading=!1)}}_toggleDetails(e){let t=new Set(this._expanded);t.has(e)?t.delete(e):t.add(e),this._expanded=t}_details(e){let t=e.entries.filter(e=>e.status);return N`<section id="${`review-details-${e.id}`}" class="dependency-review-details" aria-label="${`Details for ${Q(e)}`}">${e.comment?N`<div class="dependency-review-final-note" role="note" aria-label="Final note">${Ni(e.comment)}</div>`:P} ${t.length>0?N`<ul class="dependency-review-entries">${t.map(e=>N`<li><span class="dependency-review-entry-file">${at(e.file)}<span>${e.file}</span></span> ${Di(e.status)}<div>${Ni(e.comment)}</div></li>`)}</ul>`:N`<p class="npm-review-muted">No file reviews yet.</p>`}</section>`}_row(e){let t=aa(e),n=this._expanded.has(e.id),r=e.publishedAt!==null,i=new Set(e.entries.filter(e=>e.status).map(e=>e.file)).size,a=e.entries.filter(e=>e.status&&e.comment.trim()).length+ +!!e.comment.trim(),o=n=>{n.button===0&&!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&!n.altKey&&Pe?.active&&(n.preventDefault(),Fi(e),Pe.navigate(t))};return N`<li class="${`dependency-review-row${n?` is-expanded`:``}${e.revokedAt===null?``:` is-revoked`}`}"><div class="dependency-review-row-main"><button type="button" class="dependency-review-expand" aria-expanded="${n}" aria-controls="${`review-details-${e.id}`}" aria-label="${`${n?`Hide`:`Show`} details for ${Q(e)}`}" @click="${()=>this._toggleDetails(e.id)}">${w}</button><div class="dependency-review-identity"><a class="dependency-review-title" href="${gt(t)}" @click="${o}">${e.basePackage!==null&&e.basePackage!==e.package?N`<span>${e.basePackage} ${e.baseVersion} →</span>`:P} <strong>${e.package}</strong> <span>${e.basePackage===e.package?`${e.baseVersion} \u2192 `:``}${e.version}</span></a><div class="dependency-review-meta">${oa(e.publishedAt??e.time)} ${this.team?N`<span class="dependency-review-author">${ki(e)}</span>`:P} ${r&&e.teams.length>0?N`<span class="dependency-review-teams">${e.teams.map(e=>e.name).join(`, `)}</span>`:P} ${r&&a>0?N`<span class="dependency-review-note-count">${a} ${a===1?`note`:`notes`}</span>`:P} ${e.revokedAt===null?P:Oi(e)}</div></div><div class="dependency-review-result">${r?Di(e.status):N`<span class="dependency-review-checked">${i} ${i===1?`file`:`files`} checked</span>`} <span class="dependency-review-coverage">${r?N`${e.coverage===`full`?`Full`:N`<span class="dependency-review-partial">Partial</span>`} · ${e.checkedFiles}/${e.totalFiles} files checked`:a?`${a} ${a===1?`note`:`notes`}`:`No notes`}</span></div><div class="dependency-review-row-actions">${this.team?P:N`<dependency-review-copy .text="${e.formatted}"></dependency-review-copy>`} ${this._canDiscard(e)?N`<button type="button" class="dependency-review-discard" aria-label="Discard review" ?disabled="${this._loading||!!this._discarding}" @click="${()=>this._discard(e)}">${yt(vt)}</button>`:P} <a class="dependency-review-open" href="${gt(t)}" @click="${o}" aria-label="${`${r?`Open`:`Continue`} review for ${Q(e)}`}"><span aria-hidden="true">→</span></a></div></div>${n?this._details(e):P}</li>`}render(){let e=JSON.stringify([this.session?.id,this.session?.role,this.team??null]);return e!==this._key&&(this._controller.abort(),this._controller=new AbortController,this._key=e,this._reviews=[],this._next=null,this._discarding=null,this._expanded=new Set,this._load()),this.team?N`<section class="dependency-review-list is-team">${this._error?N`<p role="alert">${this._error}</p>`:P} ${!this._loading&&!this._error&&this._reviews.length===0?N`<p class="npm-review-muted">No reviews are published to this team yet.</p>`:P}<ol>${this._reviews.map(e=>this._row(e))}</ol>${this._next?N`<button type="button" class="npm-review-button" ?disabled="${this._loading}" @click="${()=>this._load(!0)}">Load more</button>`:P}</section>`:N`<section class="dependency-review-list"><header><h1>My reviews</h1></header><p>Your private work and the reviews you’ve shared with teams.</p>${this._error?N`<p role="alert">${this._error}</p>`:P} ${!this._loading&&!this._error&&this._reviews.length===0?N`<p>No reviews yet. Open a package’s Review tab to begin.</p>`:P} ${[[`Drafts`,!1],[`Published reviews`,!0]].map(([e,t])=>{let n=this._reviews.filter(e=>e.publishedAt!==null===t);return N`<section class="dependency-review-section"><h2>${e}<span class="npm-review-count">${n.length}</span></h2><ol>${n.map(e=>this._row(e))}</ol>${n.length===0&&!this._loading?N`<p class="npm-review-muted">${t?`No published reviews yet.`:`No drafts.`}</p>`:P}</section>`})} ${this._next?N`<button type="button" class="npm-review-button" ?disabled="${this._loading||!!this._discarding}" @click="${()=>this._load(!0)}">Load more</button>`:P}</section>`}};customElements.define(`dependency-review-list`,sa);
|
|
27
27
|
/*! Bundled license information:
|
|
28
28
|
|
|
29
29
|
lit-html/static.js:
|