epiq 1.15.1 → 1.15.2

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.
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import{$b as Ge,A as kt,Aa as rt,B as Nt,Ba as de,C as Pt,Ca as Qt,D as ye,Da as ue,E as P,Ea as ne,F as Ot,Fa as Zt,G as Mt,Ga as en,H as te,Ha as S,I as Dt,J as D,K as Fe,Lb as bn,M as Re,Ma as tn,N as Ft,Na as nn,O as _t,P as tt,Pa as sn,Q as $t,Qa as on,Qb as yn,R as Wt,Ra as rn,Rb as at,S as Gt,Sa as an,Sb as Rn,T as _,Ta as ln,Ua as dn,V as Q,Va as un,W,Wa as cn,Wb as We,Xb as An,_ as C,_b as Tn,ab as it,ac as lt,b as Pe,bb as mn,c as le,ca as jt,cb as O,d as Oe,dc as dt,e as Me,ec as je,f as wt,fa as L,g as J,ga as Ut,ha as Ht,hc as F,i as St,ic as En,jc as wn,k as De,ka as zt,la as nt,lb as ce,ma as _e,mb as Te,n as ee,na as Kt,o as xt,oa as Xt,ob as me,pa as Ae,q as et,qa as $e,ra as qt,rb as pn,s as Ct,sa as Vt,sb as fn,ta as st,tb as gn,ua as ot,va as A,wa as Yt,wb as In,xa as w,xb as vn,y as Bt,ya as Jt,yb as hn,z as Lt}from"./chunk-HI7MEHSQ.js";import{g as Et}from"./chunk-WUCQWBQE.js";import{b as d,c as p,d as l}from"./chunk-5RIQL7P4.js";var Ss=e=>e.payload??{},ut=e=>{let t=new Map,n={},s=new Set,o=new Set,a=new Set;for(let r of e){let{id:i,name:u}=Ss(r);if(i)switch(r.action){case"create.contributor":case"create.tag":t.set(i,u??""),s.add(i),o.delete(i);break;case"rename.contributor":u!==void 0&&s.has(i)&&!o.has(i)&&t.set(i,u);break;case"tombstone.contributor":s.has(i)&&(t.set(i,Fe),o.add(i));break;case"restore.contributor":case"restore.tag":u!==void 0&&s.has(i)&&(t.set(i,u),o.delete(i));break;case"add.board":u!==void 0&&(t.set(i,u),a.add(i));break;case"add.swimlane":u!==void 0&&(t.set(i,u),a.add(i),n[i]=u);break;case"edit.title":u!==void 0&&a.has(i)&&(t.set(i,u),i in n&&(n[i]=u));break;default:break}}return{byId:t,lanes:n}};var xs=e=>{let t=new Map,n=new Map;for(let s of e){let o=s.payload;!o?.id||!o.parent||(s.action==="move.node"&&t.set(s.id,n.get(o.id)),n.set(o.id,o.parent))}return t},xn=e=>{let t=e.payload;return e.action==="tombstone.tag"||e.action==="restore.tag"?t?.id:t?.tag},Cs=e=>{let t=new Set,n=new Map;for(let s of e){let o=s.payload,a=o?.id;a&&(s.action==="add.issue"&&t.add(a),o.parent&&n.set(a,o.parent))}return{issueIds:t,parentById:n}},Bs=(e,{issueIds:t,parentById:n})=>{let s=e.payload;if(s?.issue)return s.issue;let o=new Set,a=s?.id;for(;a!==void 0&&!o.has(a);){if(t.has(a))return a;o.add(a),a=n.get(a)}return null},Ls=new Set(["add.issue.comment","edit.issue.comment","delete.issue.comment"]),ks=e=>Ls.has(e.action)?e.payload?.id??null:null,Ns=new Set(["add.issue","move.node","close.issue","reopen.issue"]),Ps=(e,t)=>{let n=new Map;return e.map((s,o)=>{let a=t[o]??null;if(a===null)return{lane:null,laneBefore:null};let r=s.payload,i=null;if(Ns.has(s.action)&&r?.id===a&&r.parent){let u=n.get(a);u!==void 0&&u!==r.parent&&(i=u),n.set(a,r.parent)}return{lane:n.get(a)??null,laneBefore:i}})},Os=e=>{let t=new Map,n=new Map;return e.map(s=>{let{id:o,name:a}=s.payload??{};if(!o)return null;s.action==="add.board"&&t.set(o,"board"),s.action==="add.swimlane"&&t.set(o,"swimlane");let r=t.get(o);if(!r)return null;let i={kind:r,name:n.get(o)??a};return(s.action==="edit.title"||s.action.startsWith("add."))&&a!==void 0&&n.set(o,a),i})},Sn=90,Ms=e=>{let t=e.trim().split(`
3
- `)[0]?.trim()??"";return t.length>Sn?`${t.slice(0,Sn).trimEnd()}\u2026`:t},Cn=({kind:e,name:t})=>t===void 0?e:`${e} "${t}"`,Ds=(e,t,n,s)=>{let{name:o,parent:a}=e.payload??{},r=Cn(t);switch(e.action){case"move.node":{if(t.kind==="board"||!a)return`Moved ${r}`;let i=n.get(a);return i?s.get(e.id)===a?`Moved ${r} within ${i}`:`Moved ${r} to ${i}`:`Moved ${r}`}case"edit.title":return o===void 0?`Renamed ${r}`:`Renamed ${r} to "${o}"`;case"delete.node":return`Deleted ${r}`;case"lock.node":return`Locked ${r}`;default:return null}},Fs=(e,t,n,s,o)=>{let a=e.payload,r=xn(e),i=e.action?En(e.action):"";if(a?.md!==void 0){let g=Ms(a.md),f=e.action==="edit.description"&&!s&&o?`${i} of ${Cn(o)}`:i;return g?`${f}: ${g}`:f}if(o&&!s){let g=Ds(e,o,t,n);if(g)return g}if(e.action==="move.node"&&a?.parent){let g=t.get(a.parent);return g?n.get(e.id)===a.parent?`Moved within ${g}`:`Moved to ${g}`:i}if(Nt(e.action))return[i,Pt(e)].filter(Boolean).join(" ");let u=r!==void 0?t.get(r)??"":a?.assignee!==void 0?t.get(a.assignee)??"":a?.email!==void 0?a.email:a?.name!==void 0?`"${a.name}"`:"";return[i,u].filter(Boolean).join(" ")},ct=(e,t)=>e?D(e,t.get(e)):null,_s=(e,t)=>{let n=e.payload;return{actor:ct(e.userId,t),tag:ct(xn(e),t),assignee:ct(n?.assignee,t)}},Bn=e=>{let t=new Map,n=new Set,s=o=>{let a=new Set,r=o;for(;r&&!a.has(r);){if(n.has(r))return r;a.add(r),r=t.get(r)}return null};return e.map(o=>{let a=o.payload,r=a?.id;if(!r)return null;o.action==="add.board"&&n.add(r);let i=o.action==="close.issue"?s(r):null,u=a.parent??a.issue;return u&&t.set(r,u),i!==null?i:n.has(r)?r:s(r)})},Ln=e=>$s.has(e),$s=new Set(["create.contributor","rename.contributor","tombstone.contributor","restore.contributor","link.contributor.user","link.contributor.email","unlink.contributor.email","connect.repo","edit.repo","disconnect.repo"]),kn=(e,t)=>{let n=Bn(e);return e.filter((s,o)=>n[o]===t)},Ws=(e,t=new Map)=>{let n=new Map([...t,...ut(e).byId]),s=xs(e),o=Cs(e),a=e.map(c=>Bs(c,o)),r=Os(e),i=Ps(e,a),u=Bn(e),g=Ot(e.map(c=>te(c)));return e.flatMap((c,I)=>{let v=g[I]??null;return v===null?[]:[{id:c.id,t:v,action:c.action,label:Fs(c,n,s,a[I]??null,r[I]??null),issue:a[I]??null,target:ks(c),...i[I],board:u[I]??null,..._s(c,n)}]}).sort((c,I)=>c.t-I.t)},Gs=e=>{let t=new Map;for(let s of e){if(s.issue===null||s.lane===null)continue;let o=t.get(s.issue)??[],a=o[o.length-1];(a===void 0||a.lane!==s.lane)&&(o.push({t:s.t,lane:s.lane,board:s.board}),t.set(s.issue,o))}let n=new Map;for(let[s,o]of t){let a=o[o.length-1];n.set(s,{changes:o,from:o[0].t,closedFrom:a.lane===L?a.t:null})}return n},js=(e,t)=>{let n=0,s=e.length;for(;n<s;){let o=n+s>>1;e[o].t<t?n=o+1:s=o}return e[n-1]},Nn=(e,t,n)=>{let s={};for(let[o,a]of e){if(a.from>=t||a.closedFrom!==null&&a.closedFrom<t)continue;let r=js(a.changes,t);r===void 0||r.lane===L||n&&r.board!==n||(s[o]=r.lane)}return s},Us=e=>ut(e).lanes,Ee=null,Pn=e=>{let t=$e(e);if(Ee&&Ee.root===e&&Ee.signature===t)return p("Timeline entries, cached",Ee.index);let n=ne(e);if(l(n))return d(n.message);let s=Ws(n.value,ue(e)),o={entries:s,lanes:Gs(s),laneNames:Us(n.value)};return Ee={root:e,signature:t,index:o},p("Timeline entries, built",o)};var On=1e5,Hs=2e4,Ue=null,Mn=Promise.resolve(),Fn=e=>{let t=Mn.then(e,e);return Mn=t.then(()=>{},()=>{}),t},He=e=>{let t=Ae(e);return l(t)?t:J({repoRoot:t.value})},U=()=>{if(!je())return{mode:"live",asOfTime:null};let{timeMode:e}=Tn();return e==="live"?{mode:"live",asOfTime:null}:{mode:"scrub",asOfTime:Ue}},Dn=(e,t)=>{let n=0,s=e.length;for(;n<s;){let o=n+s>>1;e[o].t<t?n=o+1:s=o}return n},di=async(e={})=>{let t=He(e.repoRoot);if(l(t))return d(t.message);let n=Pn(t.value);if(l(n))return d(n.message);let s=n.value.entries,o=Date.now(),a=e.end??o,r=e.start??s[0]?.t??a;if(a<=r)return p("Empty time window",{bucketMs:0,buckets:[],capped:!1,events:[],lanesAtStart:{},laneNames:n.value.laneNames,closedLane:L,earliest:r,latest:a});let i=Dn(s,r),u=Dn(s,a),g=s.slice(i,u).filter(m=>!e.boardId||m.board===e.boardId||Ln(m.action)),f=g.map(m=>m.t),c=Math.max(1,Math.ceil((a-r)/On)),I=new Map;for(let m of f){let b=Math.min(On-1,Math.floor((m-r)/c)),y=r+b*c;I.set(y,(I.get(y)??0)+1)}let v=[...I.entries()].sort(([m],[b])=>m-b).map(([m,b])=>({t:m,count:b})),h=g.length>Hs;return p("Computed event timeline",{bucketMs:c,buckets:v,capped:h,events:h?[]:g,lanesAtStart:Nn(n.value.lanes,r,e.boardId),laneNames:n.value.laneNames,closedLane:L,earliest:r,latest:a})},_n=e=>{let t=ne(e);if(l(t))return d(t.message);let n=dt();if(l(n))return d(n.message);Ue=null;let s=rt(t.value),{fatal:o,skipped:a}=st(s);return o.length>0?d(o.map(r=>r.message).join(", ")):(ot(a),lt({readOnly:!1,readOnlyReason:void 0,timeMode:"live",unappliedEvents:[],replay:null}),p("Restored live state",!0))},zs=(e,t)=>{Ue=null;let n=_n(e);return l(n)?d(`${t} (recovery to live also failed: ${n.message})`):d(t)},Ks=e=>Fn(async()=>{let t=He(e.repoRoot);if(l(t))return d(t.message);let n=Zt(t.value,e.targetTime);if(l(n))return d(n.message);let{appliedEvents:s,unappliedEvents:o}=n.value,a=dt();if(l(a))return a;let r=rt(s),{fatal:i,skipped:u}=st(r);return i.length>0?zs(t.value,i.map(g=>g.message).join(", ")):(ot(u),lt({readOnly:!0,timeMode:"peek",unappliedEvents:o,replay:null}),Ue=e.targetTime,p("Checked out historical state",{asOfTime:e.targetTime}))}),ui=async e=>{let t=He(e.repoRoot);if(l(t))return d(t.message);let n=en(t.value);if(l(n))return d(n.message);let s=n.value.get(e.eventId)??null;return s===null?d("Event not found in the log"):Ks({repoRoot:e.repoRoot,targetTime:s+1})},ci=(e={})=>Fn(async()=>{let t=He(e.repoRoot);if(l(t))return d(t.message);let n=_n(t.value);return l(n)?d(n.message):p("Returned to live state",!0)});import{ulid as Ys}from"ulid";import qs from"node:fs";var $n=new Map,Xs=3e4,Wn=async e=>{let t=$n.get(e);if(t&&Date.now()-t.readAt<Xs)return{name:t.name,email:t.email};let n=await Me({args:["config","--get-regexp","^user\\.(name|email)$"],cwd:e}),s=null,o=null;if(n.exitCode===0)for(let a of(n.stdout??"").split(`
2
+ import{$b as Ge,A as kt,Aa as rt,B as Nt,Ba as de,C as Pt,Ca as Qt,D as ye,Da as ue,E as P,Ea as ne,F as Ot,Fa as Zt,G as Mt,Ga as en,H as te,Ha as S,I as Dt,J as D,K as Fe,Lb as bn,M as Re,Ma as tn,N as Ft,Na as nn,O as _t,P as tt,Pa as sn,Q as $t,Qa as on,Qb as yn,R as Wt,Ra as rn,Rb as at,S as Gt,Sa as an,Sb as Rn,T as _,Ta as ln,Ua as dn,V as Q,Va as un,W,Wa as cn,Wb as We,Xb as An,_ as C,_b as Tn,ab as it,ac as lt,b as Pe,bb as mn,c as le,ca as jt,cb as O,d as Oe,dc as dt,e as Me,ec as je,f as wt,fa as L,g as J,ga as Ut,ha as Ht,hc as F,i as St,ic as En,jc as wn,k as De,ka as zt,la as nt,lb as ce,ma as _e,mb as Te,n as ee,na as Kt,o as xt,oa as Xt,ob as me,pa as Ae,q as et,qa as $e,ra as qt,rb as pn,s as Ct,sa as Vt,sb as fn,ta as st,tb as gn,ua as ot,va as A,wa as Yt,wb as In,xa as w,xb as vn,y as Bt,ya as Jt,yb as hn,z as Lt}from"./chunk-VRDQK5QD.js";import{g as Et}from"./chunk-WUCQWBQE.js";import{b as d,c as p,d as l}from"./chunk-5RIQL7P4.js";var Ss=e=>e.payload??{},ut=e=>{let t=new Map,n={},s=new Set,o=new Set,a=new Set;for(let r of e){let{id:i,name:u}=Ss(r);if(i)switch(r.action){case"create.contributor":case"create.tag":t.set(i,u??""),s.add(i),o.delete(i);break;case"rename.contributor":u!==void 0&&s.has(i)&&!o.has(i)&&t.set(i,u);break;case"tombstone.contributor":s.has(i)&&(t.set(i,Fe),o.add(i));break;case"restore.contributor":case"restore.tag":u!==void 0&&s.has(i)&&(t.set(i,u),o.delete(i));break;case"add.board":u!==void 0&&(t.set(i,u),a.add(i));break;case"add.swimlane":u!==void 0&&(t.set(i,u),a.add(i),n[i]=u);break;case"edit.title":u!==void 0&&a.has(i)&&(t.set(i,u),i in n&&(n[i]=u));break;default:break}}return{byId:t,lanes:n}};var xs=e=>{let t=new Map,n=new Map;for(let s of e){let o=s.payload;!o?.id||!o.parent||(s.action==="move.node"&&t.set(s.id,n.get(o.id)),n.set(o.id,o.parent))}return t},xn=e=>{let t=e.payload;return e.action==="tombstone.tag"||e.action==="restore.tag"?t?.id:t?.tag},Cs=e=>{let t=new Set,n=new Map;for(let s of e){let o=s.payload,a=o?.id;a&&(s.action==="add.issue"&&t.add(a),o.parent&&n.set(a,o.parent))}return{issueIds:t,parentById:n}},Bs=(e,{issueIds:t,parentById:n})=>{let s=e.payload;if(s?.issue)return s.issue;let o=new Set,a=s?.id;for(;a!==void 0&&!o.has(a);){if(t.has(a))return a;o.add(a),a=n.get(a)}return null},Ls=new Set(["add.issue.comment","edit.issue.comment","delete.issue.comment"]),ks=e=>Ls.has(e.action)?e.payload?.id??null:null,Ns=new Set(["add.issue","move.node","close.issue","reopen.issue"]),Ps=(e,t)=>{let n=new Map;return e.map((s,o)=>{let a=t[o]??null;if(a===null)return{lane:null,laneBefore:null};let r=s.payload,i=null;if(Ns.has(s.action)&&r?.id===a&&r.parent){let u=n.get(a);u!==void 0&&u!==r.parent&&(i=u),n.set(a,r.parent)}return{lane:n.get(a)??null,laneBefore:i}})},Os=e=>{let t=new Map,n=new Map;return e.map(s=>{let{id:o,name:a}=s.payload??{};if(!o)return null;s.action==="add.board"&&t.set(o,"board"),s.action==="add.swimlane"&&t.set(o,"swimlane");let r=t.get(o);if(!r)return null;let i={kind:r,name:n.get(o)??a};return(s.action==="edit.title"||s.action.startsWith("add."))&&a!==void 0&&n.set(o,a),i})},Sn=90,Ms=e=>{let t=e.trim().split(`
3
+ `)[0]?.trim()??"";return t.length>Sn?`${t.slice(0,Sn).trimEnd()}\u2026`:t},Cn=({kind:e,name:t})=>t===void 0?e:`${e} "${t}"`,Ds=(e,t,n,s)=>{let{name:o,parent:a}=e.payload??{},r=Cn(t);switch(e.action){case"move.node":{if(t.kind==="board"||!a)return`Moved ${r}`;let i=n.get(a);return i?s.get(e.id)===a?`Moved ${r} within ${i}`:`Moved ${r} to ${i}`:`Moved ${r}`}case"edit.title":return o===void 0?`Renamed ${r}`:`Renamed ${r} to "${o}"`;case"delete.node":return`Deleted ${r}`;case"lock.node":return`Locked ${r}`;default:return null}},Fs=(e,t,n,s,o)=>{let a=e.payload,r=xn(e),i=e.action?En(e.action):"";if(a?.md!==void 0){let g=Ms(a.md),f=e.action==="edit.description"&&!s&&o?`${i} of ${Cn(o)}`:i;return g?`${f}: ${g}`:f}if(o&&!s){let g=Ds(e,o,t,n);if(g)return g}if(e.action==="move.node"&&a?.parent){let g=t.get(a.parent),f=s?`${w(s)} moved`:"Moved";return g?n.get(e.id)===a.parent?`${f} within ${g}`:`${f} to ${g}`:s?f:i}if(Nt(e.action))return[i,Pt(e)].filter(Boolean).join(" ");let u=r!==void 0?t.get(r)??"":a?.assignee!==void 0?t.get(a.assignee)??"":a?.email!==void 0?a.email:a?.name!==void 0?`"${a.name}"`:"";return[i,u].filter(Boolean).join(" ")},ct=(e,t)=>e?D(e,t.get(e)):null,_s=(e,t)=>{let n=e.payload;return{actor:ct(e.userId,t),tag:ct(xn(e),t),assignee:ct(n?.assignee,t)}},Bn=e=>{let t=new Map,n=new Set,s=o=>{let a=new Set,r=o;for(;r&&!a.has(r);){if(n.has(r))return r;a.add(r),r=t.get(r)}return null};return e.map(o=>{let a=o.payload,r=a?.id;if(!r)return null;o.action==="add.board"&&n.add(r);let i=o.action==="close.issue"?s(r):null,u=a.parent??a.issue;return u&&t.set(r,u),i!==null?i:n.has(r)?r:s(r)})},Ln=e=>$s.has(e),$s=new Set(["create.contributor","rename.contributor","tombstone.contributor","restore.contributor","link.contributor.user","link.contributor.email","unlink.contributor.email","connect.repo","edit.repo","disconnect.repo","create.tag","tombstone.tag","restore.tag"]),kn=(e,t)=>{let n=Bn(e);return e.filter((s,o)=>n[o]===t)},Ws=(e,t=new Map)=>{let n=new Map([...t,...ut(e).byId]),s=xs(e),o=Cs(e),a=e.map(c=>Bs(c,o)),r=Os(e),i=Ps(e,a),u=Bn(e),g=Ot(e.map(c=>te(c)));return e.flatMap((c,I)=>{let v=g[I]??null;return v===null?[]:[{id:c.id,t:v,action:c.action,label:Fs(c,n,s,a[I]??null,r[I]??null),issue:a[I]??null,target:ks(c),...i[I],board:u[I]??null,..._s(c,n)}]}).sort((c,I)=>c.t-I.t)},Gs=e=>{let t=new Map;for(let s of e){if(s.issue===null||s.lane===null)continue;let o=t.get(s.issue)??[],a=o[o.length-1];(a===void 0||a.lane!==s.lane)&&(o.push({t:s.t,lane:s.lane,board:s.board}),t.set(s.issue,o))}let n=new Map;for(let[s,o]of t){let a=o[o.length-1];n.set(s,{changes:o,from:o[0].t,closedFrom:a.lane===L?a.t:null})}return n},js=(e,t)=>{let n=0,s=e.length;for(;n<s;){let o=n+s>>1;e[o].t<t?n=o+1:s=o}return e[n-1]},Nn=(e,t,n)=>{let s={};for(let[o,a]of e){if(a.from>=t||a.closedFrom!==null&&a.closedFrom<t)continue;let r=js(a.changes,t);r===void 0||r.lane===L||n&&r.board!==n||(s[o]=r.lane)}return s},Us=e=>ut(e).lanes,Ee=null,Pn=e=>{let t=$e(e);if(Ee&&Ee.root===e&&Ee.signature===t)return p("Timeline entries, cached",Ee.index);let n=ne(e);if(l(n))return d(n.message);let s=Ws(n.value,ue(e)),o={entries:s,lanes:Gs(s),laneNames:Us(n.value)};return Ee={root:e,signature:t,index:o},p("Timeline entries, built",o)};var On=1e5,Hs=2e4,Ue=null,Mn=Promise.resolve(),Fn=e=>{let t=Mn.then(e,e);return Mn=t.then(()=>{},()=>{}),t},He=e=>{let t=Ae(e);return l(t)?t:J({repoRoot:t.value})},U=()=>{if(!je())return{mode:"live",asOfTime:null};let{timeMode:e}=Tn();return e==="live"?{mode:"live",asOfTime:null}:{mode:"scrub",asOfTime:Ue}},Dn=(e,t)=>{let n=0,s=e.length;for(;n<s;){let o=n+s>>1;e[o].t<t?n=o+1:s=o}return n},ui=async(e={})=>{let t=He(e.repoRoot);if(l(t))return d(t.message);let n=Pn(t.value);if(l(n))return d(n.message);let s=n.value.entries,o=Date.now(),a=e.end??o,r=e.start??s[0]?.t??a;if(a<=r)return p("Empty time window",{bucketMs:0,buckets:[],capped:!1,events:[],lanesAtStart:{},laneNames:n.value.laneNames,closedLane:L,earliest:r,latest:a});let i=Dn(s,r),u=Dn(s,a),g=s.slice(i,u).filter(m=>!e.boardId||m.board===e.boardId||Ln(m.action)),f=g.map(m=>m.t),c=Math.max(1,Math.ceil((a-r)/On)),I=new Map;for(let m of f){let b=Math.min(On-1,Math.floor((m-r)/c)),y=r+b*c;I.set(y,(I.get(y)??0)+1)}let v=[...I.entries()].sort(([m],[b])=>m-b).map(([m,b])=>({t:m,count:b})),h=g.length>Hs;return p("Computed event timeline",{bucketMs:c,buckets:v,capped:h,events:h?[]:g,lanesAtStart:Nn(n.value.lanes,r,e.boardId),laneNames:n.value.laneNames,closedLane:L,earliest:r,latest:a})},_n=e=>{let t=ne(e);if(l(t))return d(t.message);let n=dt();if(l(n))return d(n.message);Ue=null;let s=rt(t.value),{fatal:o,skipped:a}=st(s);return o.length>0?d(o.map(r=>r.message).join(", ")):(ot(a),lt({readOnly:!1,readOnlyReason:void 0,timeMode:"live",unappliedEvents:[],replay:null}),p("Restored live state",!0))},zs=(e,t)=>{Ue=null;let n=_n(e);return l(n)?d(`${t} (recovery to live also failed: ${n.message})`):d(t)},Ks=e=>Fn(async()=>{let t=He(e.repoRoot);if(l(t))return d(t.message);let n=Zt(t.value,e.targetTime);if(l(n))return d(n.message);let{appliedEvents:s,unappliedEvents:o}=n.value,a=dt();if(l(a))return a;let r=rt(s),{fatal:i,skipped:u}=st(r);return i.length>0?zs(t.value,i.map(g=>g.message).join(", ")):(ot(u),lt({readOnly:!0,timeMode:"peek",unappliedEvents:o,replay:null}),Ue=e.targetTime,p("Checked out historical state",{asOfTime:e.targetTime}))}),ci=async e=>{let t=He(e.repoRoot);if(l(t))return d(t.message);let n=en(t.value);if(l(n))return d(n.message);let s=n.value.get(e.eventId)??null;return s===null?d("Event not found in the log"):Ks({repoRoot:e.repoRoot,targetTime:s+1})},mi=(e={})=>Fn(async()=>{let t=He(e.repoRoot);if(l(t))return d(t.message);let n=_n(t.value);return l(n)?d(n.message):p("Returned to live state",!0)});import{ulid as Ys}from"ulid";import qs from"node:fs";var $n=new Map,Xs=3e4,Wn=async e=>{let t=$n.get(e);if(t&&Date.now()-t.readAt<Xs)return{name:t.name,email:t.email};let n=await Me({args:["config","--get-regexp","^user\\.(name|email)$"],cwd:e}),s=null,o=null;if(n.exitCode===0)for(let a of(n.stdout??"").split(`
4
4
  `)){let r=a.indexOf(" ");if(r===-1)continue;let i=a.slice(0,r),u=a.slice(r+1);i==="user.name"&&(s=u.trim()||null),i==="user.email"&&(o=Re(u)||null)}return $n.set(e,{name:s,email:o,readAt:Date.now()}),{name:s,email:o}},Gn=async e=>(await Wn(e)).email,pe=async e=>(await Wn(e)).name;var se=e=>{let t=De(e??process.cwd());return l(t)?d(t.message):p("Resolved Epiq repo root",t.value)},ze=null,Vs=async(e,t)=>{let n=se(e);if(l(n))return n;let s=J({repoRoot:n.value});if(l(s))return d(s.message);let o=le(n.value);if(l(o))return d(o.message);if(!(ze!==null&&ze.repoRoot===n.value&&ze.stateBranchRoot===s.value&&qs.existsSync(St(s.value)))){let c=await In({repoRoot:n.value,stateBranchName:o.value});if(l(c))return d(c.message);let I=await vn({repoRoot:n.value,stateBranchRoot:s.value,stateBranchName:o.value});if(l(I))return d(I.message);ze={repoRoot:n.value,stateBranchRoot:s.value}}if(t?.pull??!1){let c=await Oe({cwd:s.value,args:["pull","--ff-only"]});l(c)&&Pe.info(3,c.message)}let r={repoRoot:n.value,stateBranchRoot:s.value},i=ee();l(i)||et(i.value),et({gitEmail:await Gn(n.value),gitName:await pe(n.value)});let u=$e(s.value);if(qt(s.value)===u&&je()&&U().mode==="live")return p("Booted Epiq state, unchanged",r);let g=de(s.value);if(l(g))return d(g.message);let f=me(g.value.events,g.value.unreadable);return l(f)?d(f.message):(Vt(s.value,u),p("Booted Epiq state",r))},G=()=>{let e=ee();return l(e)?d(e.message):e.value.userId?e.value.userName?p("Resolved actor",{userId:e.value.userId,userName:e.value.userName}):d("Unable to retrieve user name"):d("Unable to retrieve user id")},B=()=>{let e=Ge();return l(e)?d(e.message):e},M=e=>Vs(e,{pull:!1}),T=async e=>{let t=await M(e);if(l(t))return t;let n=G();if(l(n))return n;let s=B();return l(s)?s:p("Booted",{boot:t.value,actor:n.value,state:s.value})};var k=e=>{let t=B();if(l(t))return t;let n=t.value.nodes[e];return!n||n.isDeleted?d("Issue not found"):_(n)?n.readonly?d("Issue is readonly"):p("Found issue",n):d("Target must be an issue")},X=e=>{let t=B();if(l(t))return t;let n=t.value.nodes[e];return!n||n.isDeleted?d("Swimlane not found"):Q(n)?n.readonly?d("Swimlane is readonly"):p("Found swimlane",n):d("Target must be a swimlane")},we=e=>{let t=B();if(l(t))return t;let n=t.value.nodes[e];return!n||n.isDeleted?d("Board not found"):W(n)?n.readonly?d("Board is readonly"):p("Found board",n):d("Target must be a board")};var mt=e=>{if(!e)return;let t=B();if(l(t))return;let n=t.value.nodes[e];if(!n||!(W(n)||Q(n)))return;let s=n.props?.description;return s?.trim()?s:void 0},Ke=e=>{let t=mt(e);return t?{laneDescription:t}:{}},Se=e=>{let t=mt(e);return t?{boardDescription:t}:{}},fe=e=>{let t=mt(e);return t?{description:t}:{}},Xe=({node:e,label:t,max:n,description:s,actor:o,stateBranchRoot:a})=>{let r=mn(s),i=O(t,r,n);if(i)return d(i);if(U().mode!=="live")return d(`Cannot edit the ${t.toLowerCase()} while time travelling`);let u={id:e.id,ref:w(e.id),description:r};if((e.props?.description??"")===r)return p("No changes made",u);let g={id:Ys(),...A(o),action:"edit.description",payload:{id:e.id,md:r}},f=S([g],a);return l(f)?d(f.message):p(`Edited ${t.toLowerCase()}`,u)},Js=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let n=we(e.boardId);return l(n)?n:Xe({node:n.value,label:"Board description",max:it("board"),description:e.description,actor:t.value.actor,stateBranchRoot:t.value.boot.stateBranchRoot})},Qs=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let n=X(e.swimlaneId);return l(n)?n:Xe({node:n.value,label:"Swimlane description",max:it("swimlane"),description:e.description,actor:t.value.actor,stateBranchRoot:t.value.boot.stateBranchRoot})};import Zs from"node:fs";import eo from"node:path";import{ulid as pt}from"ulid";var to=e=>{if(e.filePath)try{return p("Read attachment file",{data:Zs.readFileSync(e.filePath),name:e.name??eo.basename(e.filePath)})}catch(t){return d(`Unable to read ${e.filePath}: ${t instanceof Error?t.message:String(t)}`)}return e.dataBase64?p("Decoded attachment data",{data:Buffer.from(e.dataBase64,"base64"),name:e.name??"image"}):d("Provide either filePath or dataBase64")},qe=()=>{let e=ee();return l(e)?nt:e.value.attachmentMaxKb??nt},no=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let n=k(e.issueId);if(l(n))return n;let s=to(e);if(l(s))return s;let o=Kt(t.value.boot.stateBranchRoot,s.value.data,qe());if(l(o))return o;let a=C(s.value.name).trim()||"image",r=pt(),i={id:pt(),...A(t.value.actor),action:"add.issue.attachment",payload:{id:r,issue:e.issueId,author:t.value.actor.userId,hash:o.value.hash,ext:o.value.ext,name:a,bytes:o.value.bytes}},u=S([i],t.value.boot.stateBranchRoot);if(l(u))return d(u.message);let g=_e(o.value.hash,o.value.ext);return p("Added issue attachment",{id:r,issueId:e.issueId,fileName:g,bytes:o.value.bytes,markdown:zt(a,g)})},so=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let n=t.value.state.eventLog.find(i=>i.action==="add.issue.attachment"&&i.payload.id===e.attachmentId);if(!n)return d("Unable to resolve attachment");if(n.payload.author!==t.value.actor.userId)return d("You can only delete your own attachments");let s=k(n.payload.issue);if(l(s))return s;if(t.value.state.eventLog.some(i=>i.action==="delete.issue.attachment"&&i.payload.id===e.attachmentId))return p("Attachment already deleted",{id:e.attachmentId,issueId:n.payload.issue});let a={id:pt(),...A(t.value.actor),action:"delete.issue.attachment",payload:{id:e.attachmentId,issue:n.payload.issue}},r=S([a],t.value.boot.stateBranchRoot);return l(r)?d(r.message):p("Deleted issue attachment",{id:e.attachmentId,issueId:n.payload.issue})},oo=async e=>{let t=await M(e.repoRoot);return l(t)?t:Xt(t.value.stateBranchRoot,e.fileName,qe())};var ro=e=>{switch(e.action){case"add.issue":case"move.node":case"close.issue":case"reopen.issue":return e.payload.parent;default:return null}},ft=(e,t)=>{let n=[];for(let s of e){let o=ro(s);if(o===null||o===n.at(-1)?.laneId)continue;let a=te(s);n.push({laneId:o,enteredAt:a===null?t:ye(a)})}return n},jn=(e,t)=>e.reduce((n,s)=>{let o=te(s);return o===null?n:Math.max(n,ye(o))},t),xe=(e,t)=>ft(e,t).at(-1)?.enteredAt??t;var Un=new WeakMap,io=e=>{let t=F.getNode(e);if(!t)return[];let n=Un.get(t);if(n)return n;let s=new Set;t.parentNodeId&&s.add(t.parentNodeId);for(let a of t.log??[]){let r=a.payload;r.id===e&&r.parent&&s.add(r.parent)}let o=[...s];return Un.set(t,o),o},Ce=e=>{let t=new Set;e.parentNodeId&&t.add(e.parentNodeId);for(let s of e.log??[]){let o=s.payload;o.id===e.id&&o.parent&&t.add(o.parent)}let n=new Set;for(let s of t)for(let o of io(s))n.add(o);return[...n]},oe=e=>Ut(e).map(t=>D(t.id,t.name)),Hn=e=>F.getCommentsByIssue(e).sort((t,n)=>t.id<n.id?-1:t.id>n.id?1:0).map(t=>({id:t.id,author:Dt(t.authorId,F.getContributor(t.authorId)?.name),createdAt:P(t.id),body:t.md})),re=e=>Ht(e).map(({id:t,name:n})=>D(t,n));var ao=async(e={})=>{let t=await M(e.repoRoot);if(l(t))return t;let n=B();return l(n)?n:p("Retrieved Epiq state",{root:t.value.repoRoot,stateBranchRoot:t.value.stateBranchRoot,nodes:n.value.nodes,rootNodeId:n.value.rootNodeId,contextNode:n.value.contextNode,selectedIndex:n.value.selectedIndex,eventLog:n.value.eventLog})},lo=365*24*60*60*1e3,uo=e=>{let t=B();if(l(t))return t;let n=t.value.nodes[e];return p("Issue description",n&&_(n)&&!n.isDeleted?n.props.description??"":"")},gt=()=>{let e=B();if(l(e))return e;let t=U(),n=t.mode!=="live",s=Object.values(e.value.nodes),o=s.filter(m=>W(m)&&!m.isDeleted),a=Date.now()-lo,r=new Map,i=new Map;for(let m of s)if(!m.isDeleted){if(Q(m)&&m.parentNodeId){let b=r.get(m.parentNodeId)??[];b.push(m),r.set(m.parentNodeId,b)}if(_(m)&&m.parentNodeId){if(m.parentNodeId===L&&P(m.id)<a)continue;let b=i.get(m.parentNodeId)??[];b.push(m),i.set(m.parentNodeId,b)}}let u=new Set;for(let m of i.values())for(let b of m)u.add(b.id);let g=ee();if(l(g))return g;let f={},c=F.getCommentsGroupedByIssue();for(let m of s.filter(_))m.isDeleted||!u.has(m.id)||(f[m.id]=(c.get(m.id)??[]).map(b=>{let y=F.getContributor(b.authorId);return{id:b.id,issueId:b.issue,body:b.md,author:D(b.authorId,y?.name),createdAt:P(b.id)}}));let I=new Map;for(let m of e.value.eventLog)m.action==="add.issue.attachment"&&I.set(m.payload.id,m.payload.author);let v={},h=F.getAttachmentsGroupedByIssue();for(let m of s.filter(_))m.isDeleted||!u.has(m.id)||(v[m.id]=(h.get(m.id)??[]).map(b=>({id:b.id,issueId:b.issue,name:b.name,fileName:_e(b.hash,b.ext),bytes:b.bytes,createdAt:P(b.id),canDelete:I.get(b.id)===g.value.userId})));return p("Retrieved Epiq GUI state",{boards:o.sort((m,b)=>m.rank.localeCompare(b.rank)).map(m=>({id:m.id,ref:w(m.id),title:m.title,readonly:!!m.readonly||n,...fe(m.id),swimlanes:(r.get(m.id)??[]).sort((b,y)=>b.rank.localeCompare(y.rank)).map(b=>({id:b.id,title:b.title,readonly:!!b.readonly||n,issues:(i.get(b.id)??[]).sort((y,V)=>y.rank.localeCompare(V.rank)).map(y=>({id:y.id,ref:w(y.id),title:C(y.title),description:y.props.description??"",createdAt:P(y.id),enteredLaneAt:xe(y.log??[],P(y.id)),lastEventAt:jn(y.log??[],P(y.id)),readonly:!!y.readonly||n,tags:oe(y),assignees:re(y),parentNodeId:y.parentNodeId,isClosed:y.parentNodeId===L,boardIds:Ce(y)})),parentNodeId:b.parentNodeId,...fe(b.id)}))})),tags:F.getTags().map(m=>({...m,...D(m.id,m.name)})),contributors:Object.values(e.value.contributors).map(m=>({...m,...D(m.id,m.name)})),user:{id:g.value.userId??"",name:g.value.userName??"",color:Ct(g.value.userName??"")},commentsByIssueId:f,attachmentsByIssueId:v,attachmentMaxKb:qe(),timeTravel:t})},zn=null,co=e=>{if(e===zn)return;let t=jt({root:e});if(l(t)){Pe.info(t.message);return}zn=e},mo=async(e={})=>{if(U().mode!=="live")return gt();let t=await M(e.repoRoot);return l(t)?t:(co(t.value.repoRoot),gt())},po=async(e={})=>{pn();let t=se(e.repoRoot);if(l(t))return d("Sync failed");let n=G();if(l(n))return n;let s=await hn({cwd:t.value,ownEventFileName:Yt(n.value)});return l(s)?(gn(s.message),s):(fn(),p("Synced",s.value))};import{ulid as H}from"ulid";var Be=e=>{let t=[...new Set([...e.issueIds??[],...e.issueId?[e.issueId]:[]])];return t.length?p("Resolved targets",t):d("Provide issueId or issueIds")},ge=(e,t)=>{let n=t.done.length,s=`${e} ${n} issue${n===1?"":"s"}`+(t.failed.length?`, ${t.failed.length} failed`:"");return n?p(s,t):d(`${s}: ${t.failed.map(o=>`${o.ref} ${o.reason}`).join("; ")}`)},Le=(e,t)=>{let n={done:[],failed:[]};for(let s of e){let o=t(s);l(o)?n.failed.push({id:s,ref:w(s),reason:o.message}):n.done.push({id:s,ref:w(s)})}return n};var fo=async e=>{let t=await M(e.repoRoot);if(l(t))return t;let n=B();if(l(n))return n;let s=e.idOrRef.trim();if(!s)return d("Provide an issue id or ref");let o=Object.values(n.value.nodes).filter(_).filter(u=>!u.isDeleted),a=o.find(u=>u.id===s),r=a?[a]:o.filter(u=>Jt(u.id,s));if(r.length===0)return d(`No issue matches "${s}"`);if(r.length>1)return d(`"${s}" matches ${r.length} issues: ${r.map(u=>`${w(u.id)} (${C(u.title)})`).join(", ")}. Use a full ref or id.`);let i=r[0];return p("Found issue",{id:i.id,ref:w(i.id),title:C(i.title),description:i.props.description??"",createdAt:P(i.id),enteredLaneAt:xe(i.log??[],P(i.id)),parentNodeId:i.parentNodeId,isClosed:i.parentNodeId===L,boardIds:Ce(i),readonly:!!i.readonly,tags:oe(i),assignees:re(i),comments:Hn(i.id),...Ke(i.parentNodeId)})},qn=(e,t)=>e.trim().toLowerCase()===t.trim().toLowerCase();async function go(e){let t=await M(e.repoRoot);if(l(t))return t;let n=B();if(l(n))return n;let s=n.value.nodes,o=e.query?.trim().toLowerCase(),a=Object.values(s).filter(_).filter(i=>!i.isDeleted).filter(i=>e.includeClosed||i.parentNodeId!==L).filter(i=>e.boardId?(i.parentNodeId?s[i.parentNodeId]:void 0)?.parentNodeId===e.boardId:!0).filter(i=>!e.swimlaneId||i.parentNodeId===e.swimlaneId).filter(i=>!e.tag||oe(i).some(u=>qn(u.name,e.tag))).filter(i=>!e.assignee||re(i).some(u=>qn(u.name,e.assignee))).filter(i=>!o||i.title.toLowerCase().includes(o)||(i.props.description??"").toLowerCase().includes(o)),r=i=>C((i.parentNodeId?s[i.parentNodeId]?.title:void 0)??"");return e.brief?p("Listed issues",a.map(i=>({id:i.id,ref:w(i.id),title:C(i.title),swimlane:r(i),tags:oe(i).map(u=>u.name),assignees:re(i).map(u=>u.name)}))):p("Listed issues",a.map(i=>({id:i.id,ref:w(i.id),title:C(i.title),description:i.props.description??"",createdAt:P(i.id),enteredLaneAt:xe(i.log??[],P(i.id)),parentNodeId:i.parentNodeId,isClosed:i.parentNodeId===L,boardIds:Ce(i),readonly:!!i.readonly,tags:oe(i),assignees:re(i)})))}var Io=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let n=C(e.title);if(!n)return d("Issue title cannot be empty");let s=e.description??"",o=O("Issue title",n,300)??O("Issue description",s,2e4);if(o)return d(o);if((e.tagNames?.length??0)>20)return d(`Cannot set more than ${20} tags at once`);if((e.assigneeNames?.length??0)>20)return d(`Cannot set more than ${20} assignees at once`);let a=X(e.parentId);if(l(a))return a;let r=Te(e.parentId,t.value.actor,t.value.boot.stateBranchRoot);if(l(r))return r;let i=bn({name:n,parent:e.parentId,user:t.value.actor,rank:r.value});if(l(i))return i;let u=[...i.value],g=u.find(v=>v.action==="add.issue")?.payload.id;if(!g)return d("Unable to determine created issue id");s&&u.push({id:H(),...A(t.value.actor),action:"edit.description",payload:{id:g,md:s}});let f=[];for(let v of e.tagNames??[]){let h=C(v).trim();if(!h||f.some(V=>V.name===h))continue;let m=O("Tag name",h,60);if(m)return d(m);let b=F.findTagByName(h),y=b?.id??H();b||u.push({id:H(),...A(t.value.actor),action:"create.tag",payload:{id:y,name:h}}),u.push({id:H(),...A(t.value.actor),action:"add.issue.tag",payload:{id:g,tag:y}}),f.push({id:y,name:h})}let c=[];for(let v of e.assigneeNames??[]){let h=C(v).trim();if(!h||c.some(V=>V.name===h))continue;let m=O("Assignee name",h,80);if(m)return d(m);let b=Object.values(t.value.state.contributors).find(V=>V.name===h),y=b?.id??H();b||u.push({id:H(),...A(t.value.actor),action:"create.contributor",payload:{id:y,name:h}}),u.push({id:H(),...A(t.value.actor),action:"add.issue.assignee",payload:{id:g,assignee:y}}),c.push({id:y,name:h})}let I=S(u,t.value.boot.stateBranchRoot);return l(I)?d(I.message):p("Created issue",{id:g,ref:w(g),title:n,parentId:e.parentId,description:s,tags:f,assignees:c,...Ke(e.parentId),...Se(t.value.state.nodes[e.parentId]?.parentNodeId)})},vo=(e,t,n)=>{let s=k(e);if(l(s))return s;let o=ce(L,e,{at:"end"},t,n);if(l(o))return o;let a={id:H(),...A(t),action:"close.issue",payload:{id:e,parent:L,rank:o.value}},r=S([a],n);return l(r)?d(r.message):p("Closed issue",{id:e,ref:w(e)})};async function ho(e){let t=await M(e.repoRoot);if(l(t))return t;let n=G();if(l(n))return n;let s=Be(e);if(l(s))return s;let o=a=>vo(a,n.value,t.value.stateBranchRoot);return e.issueIds?ge("Closed",Le(s.value,o)):o(s.value[0])}var bo=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let n=t.value.state.nodes[e.issueId];if(!n||n.isDeleted)return d("Issue not found");if(!_(n))return d("Target must be an issue");if(n.parentNodeId!==L)return d("Issue is not closed");let s=yn(n);if(!s)return d("Unable to resolve previous parent from issue history");if(s===L)return d("Previous parent resolves to closed swimlane");let o=X(s);if(l(o))return o;let a=o.value,r=ce(a.id,n.id,{at:"end"},t.value.actor,t.value.boot.stateBranchRoot);if(l(r))return r;let i={id:H(),...A(t.value.actor),action:"reopen.issue",payload:{id:n.id,parent:a.id,rank:r.value}},u=S([i],t.value.boot.stateBranchRoot);return l(u)?d(u.message):p("Reopened issue",{id:n.id,ref:w(n.id),parentId:a.id})},yo=(e,t,n,s)=>{let o=k(e);if(l(o))return o;let a=X(t.parentId);if(l(a))return a;let r=ce(t.parentId,e,t.position??{at:"end"},n,s);if(l(r))return r;let i={id:H(),...A(n),action:"move.node",payload:{id:e,parent:t.parentId,rank:r.value}},u=S([i],s);return l(u)?d(u.message):p("Moved issue",{id:e,ref:w(e),parentId:t.parentId})};async function Ro(e){let t=se(e.repoRoot);if(l(t))return t;let n=G();if(l(n))return n;let s=J({repoRoot:t.value});if(l(s))return s;let o=de(s.value);if(l(o))return o;let a=me(o.value.events,o.value.unreadable);if(l(a))return a;let r=Be(e);if(l(r))return r;let i=(()=>{let f=B();if(l(f))return()=>({});let{nodes:c}=f.value,I=m=>m?c[m]?.parentNodeId:void 0,v=I(e.parentId),h=r.value.some(m=>I(c[m]?.parentNodeId)!==v);return()=>({...Ke(e.parentId),...h?Se(v):{}})})(),u=f=>yo(f,e,n.value,s.value);if(!e.issueIds){let f=u(r.value[0]);return l(f)?f:p(f.message,{...f.value,...i()})}let g=ge("Moved",Le(r.value,u));return l(g)?g:p(g.message,{...g.value,...i()})}var Ao=e=>{let t=B();if(l(t))return t;let n=t.value.nodes[e];return n?p("Read issue history",(n.log??[]).map(s=>({id:s.id,t:P(s.id),action:s.action,label:wn(s),...s.action==="move.node"?{parentId:s.payload.parent}:{},actor:D(s.userId,t.value.contributors[s.userId]?.name)}))):d("Issue not found")},To=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let n=k(e.issueId);return l(n)?n:Xe({node:n.value,label:"Issue description",max:2e4,description:e.description,actor:t.value.actor,stateBranchRoot:t.value.boot.stateBranchRoot})},Eo=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let n=k(e.issueId);if(l(n))return n;let s=n.value,o=C(e.title);if(!o.trim())return d("Issue title cannot be empty");let a=O("Issue title",o,300);if(a)return d(a);if(s.title===o)return p("No changes made",{id:e.issueId,ref:w(e.issueId),title:o});let r={id:H(),...A(t.value.actor),action:"edit.title",payload:{id:e.issueId,name:o}},i=S([r],t.value.boot.stateBranchRoot);return l(i)?d(i.message):p("Edited issue title",{id:e.issueId,ref:w(e.issueId),title:o})};import{ulid as Z}from"ulid";var wo=async(e={})=>{let t=await M(e.repoRoot);if(l(t))return t;let n=B();if(l(n))return n;let s=Object.values(n.value.nodes).filter(o=>o.context==="BOARD"&&!o.isDeleted).map(o=>({id:o.id,ref:w(o.id),title:o.title,parentId:o.parentNodeId,readonly:!!o.readonly,...fe(o.id)}));return p("Listed boards",s)},So=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let n=t.value.state.nodes[t.value.state.rootNodeId];if(!n)return d("Workspace not found");if(U().mode!=="live")return d("Cannot add a board while time travelling");let s=C(e.title);if(!s.trim())return d("Board title cannot be empty");let o=O("Board title",s,300);if(o)return d(o);let a=Te(n.id,t.value.actor,t.value.boot.stateBranchRoot);if(l(a))return a;let r=Z(),i={id:Z(),...A(t.value.actor),action:"add.board",payload:{id:r,name:s,parent:n.id,rank:a.value}},u=S([i],t.value.boot.stateBranchRoot);return l(u)?d(u.message):p("Created board",{id:r,ref:w(r),title:s})},xo=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let n=t.value.state.nodes[e.boardId];if(!n||n.isDeleted)return d("Board not found");if(!W(n))return d("Edit target must be a board");if(n.readonly)return d("Cannot edit readonly board");if(U().mode!=="live")return d("Cannot rename a board while time travelling");let s=C(e.title);if(!s.trim())return d("Board title cannot be empty");let o=O("Board title",s,300);if(o)return d(o);if(n.title===s)return p("No changes made",{id:e.boardId,ref:w(e.boardId),title:s});let a={id:Z(),...A(t.value.actor),action:"edit.title",payload:{id:e.boardId,name:s}},r=S([a],t.value.boot.stateBranchRoot);return l(r)?d(r.message):p("Edited board title",{id:e.boardId,ref:w(e.boardId),title:s})},Co=async(e={})=>{let t=await M(e.repoRoot);if(l(t))return t;let n=B();if(l(n))return n;let s=Object.values(n.value.nodes).filter(o=>o.context==="SWIMLANE"&&!o.isDeleted).filter(o=>!e.boardId||o.parentNodeId===e.boardId).map(o=>({id:o.id,title:o.title,boardId:o.parentNodeId,isClosed:o.id===L,readonly:!!o.readonly,...fe(o.id)}));return p("Listed swimlanes",s)},Bo=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let n=we(e.boardId);if(l(n))return n;if(U().mode!=="live")return d("Cannot add a swimlane while time travelling");let s=C(e.title);if(!s.trim())return d("Swimlane title cannot be empty");let o=O("Swimlane title",s,300);if(o)return d(o);let a=Te(e.boardId,t.value.actor,t.value.boot.stateBranchRoot);if(l(a))return a;let r=Z(),i={id:Z(),...A(t.value.actor),action:"add.swimlane",payload:{id:r,name:s,parent:e.boardId,rank:a.value}},u=S([i],t.value.boot.stateBranchRoot);return l(u)?d(u.message):p("Created swimlane",{id:r,ref:w(r),title:s,boardId:e.boardId})},Lo=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let n=X(e.swimlaneId);if(l(n))return n;let s=n.value,o=C(e.title);if(!o.trim())return d("Swimlane title cannot be empty");let a=O("Swimlane title",o,300);if(a)return d(a);if(s.title===o)return p("No changes made",{id:e.swimlaneId,ref:w(e.swimlaneId),title:o});let r={id:Z(),...A(t.value.actor),action:"edit.title",payload:{id:e.swimlaneId,name:o}},i=S([r],t.value.boot.stateBranchRoot);return l(i)?d(i.message):p("Edited swimlane title",{id:e.swimlaneId,ref:w(e.swimlaneId),title:o})},ko=async e=>{let t=se(e.repoRoot);if(l(t))return t;let n=G();if(l(n))return n;let s=J({repoRoot:t.value});if(l(s))return s;let o=de(s.value);if(l(o))return o;let a=me(o.value.events,o.value.unreadable);if(l(a))return a;let r=X(e.swimlaneId);if(l(r))return r;let i=we(e.boardId);if(l(i))return i;let u=ce(e.boardId,e.swimlaneId,e.position??{at:"end"},n.value,s.value);if(l(u))return u;let g={id:Z(),...A(n.value),action:"move.node",payload:{id:e.swimlaneId,parent:e.boardId,rank:u.value}},f=S([g],s.value);return l(f)?d(f.message):p("Moved swimlane",{id:e.swimlaneId,ref:w(e.swimlaneId),boardId:e.boardId})},No=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let n=X(e.swimlaneId);if(l(n))return n;let s={id:Z(),...A(t.value.actor),action:"delete.node",payload:{id:e.swimlaneId}},o=S([s],t.value.boot.stateBranchRoot);return l(o)?d(o.message):p("Deleted swimlane",{id:e.swimlaneId,ref:w(e.swimlaneId)})};import{ulid as Ie}from"ulid";async function Po(e){let t=await M(e.repoRoot);if(l(t))return t;let n=G();if(l(n))return n;let s=Be(e);if(l(s))return s;let o=C(e.tagName).trim();if(!o)return d("Tag name cannot be empty");let a=O("Tag name",o,60);if(a)return d(a);let r=Le(s.value,k);if(!e.issueIds&&r.failed[0])return d(r.failed[0].reason);if(r.done.length===0)return d(ge("Tagged",r).message);let i=F.findTagByName(o),u=i?.id??Ie(),g=[...i?[]:[{id:Ie(),...A(n.value),action:"create.tag",payload:{id:u,name:o}}],...r.done.map(({id:v})=>({id:Ie(),...A(n.value),action:"add.issue.tag",payload:{id:v,tag:u}}))],f=S(g,t.value.stateBranchRoot);if(l(f))return d(f.message);let c={id:u,name:o};if(!e.issueIds)return p("Added issue tag",{...r.done[0],tag:c});let I=ge("Tagged",r);return l(I)?I:p(I.message,{...I.value,tag:c})}var Oo=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let n=t.value.state.tags[e.tagId];if(!n)return d("Tag not found");if(n.tombstoned)return d("Tag is already deleted");let s=[{id:Ie(),...A(t.value.actor),action:"tombstone.tag",payload:{id:e.tagId}}],o=S(s,t.value.boot.stateBranchRoot);return l(o)?d(o.message):p("Deleted tag",{id:n.id,name:n.name})},Mo=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let n=t.value.state.tags[e.tagId];if(!n)return d("Tag not found");if(!n.tombstoned)return d("Tag is not deleted");if(F.findTagByName(n.name))return d(`Cannot restore: another tag is already named "${n.name}"`);let s=[{id:Ie(),...A(t.value.actor),action:"restore.tag",payload:{id:e.tagId,name:n.name}}],o=S(s,t.value.boot.stateBranchRoot);return l(o)?d(o.message):p("Restored tag",{id:n.id,name:n.name})},Do=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let n=k(e.issueId);if(l(n))return n;if(!t.value.state.tags[e.tagId])return d("Tag not found");let s={id:Ie(),...A(t.value.actor),action:"remove.issue.tag",payload:{id:e.issueId,tag:e.tagId}},o=S([s],t.value.boot.stateBranchRoot);return l(o)?d(o.message):p("Removed issue tag",{id:e.issueId,ref:w(e.issueId),tagId:e.tagId})};import{ulid as Y}from"ulid";var Fo=async e=>{let t=Et(e.name,"name");if(l(t))return d(t.message);let n=await T(e.repoRoot);if(l(n))return n;let s=n.value.actor,o=!!n.value.state.contributors[s.userId];if(!o){let r=S([{id:Y(),...A(s),action:"create.contributor",payload:{id:s.userId,name:s.userName}}],n.value.boot.stateBranchRoot);if(l(r))return d(r.message)}let a=Object.values(n.value.state.nodes).filter(r=>W(r)&&!r.isDeleted).flatMap(r=>{let{boardDescription:i}=Se(r.id);return i?[{id:r.id,title:C(r.title),boardDescription:i}]:[]});return p(`Assumed ${s.userName}`,{...s,registered:!o,...a.length?{boards:a}:{}})},Yn=async(e,t)=>{let n=ue(e).get(t);return n===void 0?void 0:{id:t,name:n}},_o=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let n=k(e.issueId);if(l(n))return n;let s=e.self?t.value.actor.userId:e.assigneeId;if(s){let v=t.value.state.contributors[s],h=v?void 0:await Yn(t.value.boot.stateBranchRoot,s);if(!v&&!h)return d("Unknown assignee id");let m=v??h,b=[...v?[]:[{id:Y(),...A(t.value.actor),action:"create.contributor",payload:{id:m.id,name:m.name}}],{id:Y(),...A(t.value.actor),action:"add.issue.assignee",payload:{id:e.issueId,assignee:m.id}}],y=S(b,t.value.boot.stateBranchRoot);return l(y)?d(y.message):p("Added issue assignee",{id:e.issueId,ref:w(e.issueId),assignee:{id:m.id,name:m.name}})}let o=C(e.assigneeName??"").trim();if(!o)return d("Provide assigneeId, self or assigneeName");let a=O("Assignee name",o,80);if(a)return d(a);let r=at({events:t.value.state.eventLog??[],registry:t.value.state.contributors,logFileNames:ue(t.value.boot.stateBranchRoot)}).filter(v=>v.name===o);if(r.length>1)return d(`"${o}" matches ${r.length} contributors (${r.map(({id:v})=>v).join(", ")}). Assign by assigneeId to choose.`);let i=r[0];if(!i&&!e.createUnlinked)return d(`No contributor named "${o}". Assign by id, or pass createUnlinked to add them as an external assignee.`);let u=i?.id??Y(),g=i?.name??o,c=[...!!t.value.state.contributors[u]?[]:[{id:Y(),...A(t.value.actor),action:"create.contributor",payload:{id:u,name:g}}],{id:Y(),...A(t.value.actor),action:"add.issue.assignee",payload:{id:e.issueId,assignee:u}}],I=S(c,t.value.boot.stateBranchRoot);return l(I)?d(I.message):p("Added issue assignee",{id:e.issueId,ref:w(e.issueId),assignee:{id:u,name:g}})},$o=async e=>{let t=await T(e.repoRoot);if(l(t))return t;if(!t.value.state.contributors[e.contributorId])return d("Contributor not found");if(await Yn(t.value.boot.stateBranchRoot,e.contributorId))return d("Cannot remove a contributor who has authored events \u2014 their name appears throughout the log");let o=[{id:Y(),...A(t.value.actor),action:"tombstone.contributor",payload:{id:e.contributorId}}],a=S(o,t.value.boot.stateBranchRoot);return l(a)?d(a.message):p("Tombstoned contributor",{id:e.contributorId,name:Fe})},Wo=async(e,t)=>{let n=ne(e);if(l(n))return;let s;for(let o of n.value){if(o.action!=="create.contributor")continue;let a=o.payload;a.id===t&&a.name&&(s=a.name)}return s},Go=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let n=t.value.state.contributors[e.contributorId];if(!n)return d("Contributor not found");if(!n.tombstoned)return d("Contributor is not tombstoned");let s=await Wo(t.value.boot.stateBranchRoot,e.contributorId);if(!s)return d("Cannot restore this contributor \u2014 no original name found in the event log");let o=[{id:Y(),...A(t.value.actor),action:"restore.contributor",payload:{id:e.contributorId,name:s}}],a=S(o,t.value.boot.stateBranchRoot);return l(a)?d(a.message):p("Restored contributor",{id:e.contributorId,name:s})},jo=async(e={})=>{let t=await T(e.repoRoot);if(l(t))return t;let n=ne(t.value.boot.stateBranchRoot);if(l(n))return d(n.message);let s=e.boardId?kn(n.value,e.boardId):n.value,o=new Set,a=Qt(t.value.boot.stateBranchRoot);if(l(a))return d(a.message);for(let u of a.value)u.userId&&o.add(u.userId);let r=t.value.state.contributors,i=at({events:s,registry:r,logFileNames:ue(t.value.boot.stateBranchRoot)}).map(({id:u,name:g,isExternal:f})=>({...D(u,g),isSelf:u===t.value.actor.userId,isExternal:f,isRemoved:r[u]?.tombstoned===!0,hasAuthoredAnywhere:o.has(u)}));return p("Listed board contributors",i)},Uo=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let n=k(e.issueId);if(l(n))return n;if(!t.value.state.contributors[e.assigneeId])return d("Assignee not found");let s={id:Y(),...A(t.value.actor),action:"remove.issue.assignee",payload:{id:e.issueId,assignee:e.assigneeId}},o=S([s],t.value.boot.stateBranchRoot);return l(o)?d(o.message):p("Removed issue assignee",{id:e.issueId,ref:w(e.issueId),assigneeId:e.assigneeId})};import{ulid as Ye}from"ulid";var Ho=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let n=k(e.issueId);if(l(n))return n;let s=e.body.trim();if(!s)return d("Comment cannot be empty");if(s.length>4e3)return d(`Comment cannot exceed ${4e3} characters (got ${s.length})`);let o=Ye(),a={id:Ye(),...A(t.value.actor),action:"add.issue.comment",payload:{id:o,issue:e.issueId,md:s,author:t.value.actor.userId}},r=S([a],t.value.boot.stateBranchRoot);return l(r)?d(r.message):p("Added issue comment",{id:o,issueId:e.issueId,body:s})},zo=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let n=t.value.state.eventLog.find(i=>i.action==="add.issue.comment"&&i.payload.id===e.commentId);if(!n)return d("Unable to resolve comment");if(n.payload.author!==t.value.actor.userId)return d("You can only delete your own comments");let s=k(n.payload.issue);if(l(s))return s;if(t.value.state.eventLog.some(i=>i.action==="delete.issue.comment"&&i.payload.id===e.commentId))return p("Comment already deleted",{id:e.commentId,issueId:n.payload.issue});let a={id:Ye(),...A(t.value.actor),action:"delete.issue.comment",payload:{id:e.commentId,issue:n.payload.issue}},r=S([a],t.value.boot.stateBranchRoot);return l(r)?d(r.message):p("Deleted issue comment",{id:e.commentId,issueId:n.payload.issue})},Ko=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let n=t.value.state.eventLog.find(u=>u.action==="add.issue.comment"&&u.payload.id===e.commentId);if(!n)return d("Unable to resolve comment");if(n.payload.author!==t.value.actor.userId)return d("You can only edit your own comments");let s=k(n.payload.issue);if(l(s))return s;if(t.value.state.eventLog.some(u=>u.action==="delete.issue.comment"&&u.payload.id===e.commentId))return d("Comment was deleted");let a=e.body.trim();if(!a)return d("Comment cannot be empty");if(a.length>4e3)return d(`Comment cannot exceed ${4e3} characters (got ${a.length})`);let r={id:Ye(),...A(t.value.actor),action:"edit.issue.comment",payload:{id:e.commentId,issue:n.payload.issue,md:a}},i=S([r],t.value.boot.stateBranchRoot);return l(i)?d(i.message):p("Edited issue comment",{id:e.commentId,issueId:n.payload.issue,body:a})};import{ulid as Jn}from"ulid";var Xo=async e=>{let t=await T(e.repoRoot);if(l(t))return t;if(!Ft(e.email))return d(`Not an email address: ${e.email}`);let n=Re(e.email),s=e.contributorId??t.value.actor.userId;if(!t.value.state.contributors[s])return d(`Unknown contributor: ${s}`);let o=tt(t.value.state.emailLinks,n);if(o.includes(s))return p(`${n} is already yours`,{contributor:s,email:n,contested:o.filter(r=>r!==s)});let a=S([{id:Jn(),action:"link.contributor.email",payload:{contributor:s,email:n},userId:t.value.actor.userId}],t.value.boot.stateBranchRoot);return l(a)?d(a.message):p(o.length>0?`Claimed ${n}, but somebody else claims it too, so it now resolves to neither of you`:`Claimed ${n}`,{contributor:s,email:n,contested:o})},qo=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let n=Re(e.email),s=e.contributorId??t.value.actor.userId,o=t.value.state.emailLinks[_t(n,s)];if(!o||o.tombstoned)return d(`No such link: ${n} to ${s}`);if(!Gt(t.value.actor.userId,o))return d("Only whoever made a claim, or the contributor it names, may undo it");let a=S([{id:Jn(),action:"unlink.contributor.email",payload:{contributor:s,email:n},userId:t.value.actor.userId}],t.value.boot.stateBranchRoot);return l(a)?d(a.message):p(`Unclaimed ${n}`,{contributor:s,email:n})},Vo=async(e={})=>{let t=await M(e.repoRoot);if(l(t))return t;let n=B();if(l(n))return n;let{emailLinks:s,contributors:o}=n.value,a=new Map;for(let c of Object.values(s)){if(c.tombstoned)continue;let I=a.get(c.email)??new Set;I.add(c.contributor),a.set(c.email,I)}let r=[...a.entries()].map(([c,I])=>({email:c,contested:I.size>1,claimants:[...I].map(v=>D(v,o[v]?.name))})).sort((c,I)=>c.email.localeCompare(I.email)),i=G(),u=l(i)?[]:$t(s,i.value.userId),g=xt().gitEmail,f=g?tt(s,g).filter(c=>l(i)||c!==i.value.userId):[];return p("Listed contributor emails",{emails:r,mine:u,git:g?{email:g,linkedToMe:u.includes(g),heldByOthers:f.map(c=>D(c,o[c]?.name))}:null})},Yo=async(e={})=>{let t=await T(e.repoRoot);if(l(t))return t;let{userId:n,userName:s}=t.value.actor,o=le(t.value.boot.repoRoot),a=await We({repoRoot:t.value.boot.repoRoot,stateBranch:l(o)?void 0:o.value,names:[s,await pe(t.value.boot.repoRoot)],links:t.value.state.emailLinks});if(l(a))return a;let r=An(a.value),i=r.filter(u=>u.looksLikeYours);return p(r.length===0?"No unclaimed addresses in this history":`${r.length} unclaimed address(es) in this history, ${i.length>0?`${i.length} of which look like yours`:"none obviously yours"}. Show them to the user and link only the ones they confirm; each is a permanent event that replicates to every clone.`,{contributor:n,candidates:r,likely:i.length})};var ht=e=>{let t=on(e);return l(t)?d(t.message):p("Listed repos",{repos:t.value,claimedBytes:un(e),limit:Lt,allowLocal:Bt()})},Jo=async(e={})=>{let t=Ae(e.repoRoot);return l(t)?d(t.message):ht(t.value)},Qo=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let{repoRoot:n}=t.value.boot,s=await cn({repoRoot:n,actorId:t.value.actor.userId,url:e.url,branches:e.branches,since:e.since,label:e.label,mode:e.previewOnly?"preview":e.confirm?"confirm":"auto"});if(l(s))return d(s.message);let o=ht(n);return l(o)?d(o.message):p(s.message,{...o.value,...s.value.kind==="preview"?{preview:s.value.preview}:{}})},Zo=async e=>{let t=await T(e.repoRoot);if(l(t))return t;let{repoRoot:n}=t.value.boot,s=rn({repoRoot:n,actorId:t.value.actor.userId,repo:e.repo});if(l(s))return d(s.message);let o=ht(n);return l(o)?d(o.message):p(s.message,o.value)},er=e=>(dn("repo"in e?e.repo:kt(e.url.trim())),p("Cancelled",null)),tr=async(e,t={},n=2e4)=>{if(l(e))return e;let s,o=await Promise.race([Qn(t),new Promise(a=>{s=setTimeout(()=>a(null),n)})]);return clearTimeout(s),o===null?p(`${e.message} \xB7 still fetching other repos; epiq_repo_list shows how they stand`,e.value):l(o)||o.value.length===0?e:p([e.message,ln(o.value)].filter(Boolean).join(" \xB7 "),{...e.value,repos:o.value})},Qn=async(e={})=>{let t=Ae(e.repoRoot);return l(t)?d(t.message):an({repoRoot:t.value,minIntervalMs:e.minIntervalMs})};var Zn=(e,t)=>{let n=0,s=0,o=null;for(let a of e){if(a.userId!==t)continue;a.action==="add.issue"&&n++,a.action==="add.issue.comment"&&s++;let r=Mt(a.id);if(l(r))continue;let i=r.value.getTime();(o===null||i<o)&&(o=i)}return{tickets:n,comments:s,joinedAt:o}};var nr=async(e={})=>{let t=await T(e.repoRoot);if(l(t))return t;let{userId:n,userName:s}=t.value.actor,o=Zn(t.value.state.eventLog,n),a=le(t.value.boot.repoRoot),r=await We({repoRoot:t.value.boot.repoRoot,stateBranch:l(a)?void 0:a.value,names:[s,await pe(t.value.boot.repoRoot)],links:t.value.state.emailLinks}),i=l(r)?[]:r.value.filter(u=>u.claimedBy.length===1&&u.claimedBy[0]===n);return p("Derived personal stats",{...o,scanned:!l(r),commits:i.reduce((u,g)=>u+g.commits,0),claimedEmails:i.length})};var es=e=>{if(e.length===0)return null;let t=Math.floor(e.length/2);return e.length%2===0?(e[t-1]+e[t])/2:e[t]};var sr=8,or=(e,t)=>{let n=new Date(e);return n.setHours(0,0,0,0),n.setDate(n.getDate()-(n.getDay()+6)%7),Array.from({length:t},(s,o)=>{let a=new Date(n);return a.setDate(n.getDate()-7*(t-1-o)),a.getTime()})},rr=e=>es([...e].sort((t,n)=>t-n)),ts=({boardId:e,lanes:t,formerLaneIds:n=[],tickets:s,now:o})=>{let a=new Map(t.map((E,x)=>[E.id,x])),r=new Set(n),i=E=>E!=null&&(a.has(E)||r.has(E)),g=s.map(E=>({ticket:E,visits:ft(E.log,E.createdAt)})).filter(({visits:E})=>E.some(x=>i(x.laneId))),f=E=>{let x=te(E);return x===null?null:Math.min(ye(x,o),o)},c=E=>{let x=E.flatMap(K=>{let $=a.get(K.laneId);return $===void 0?[]:[$]});return x.some((K,$)=>$>0&&K<x[$-1])},I=g.flatMap(({ticket:E,visits:x})=>{let K=E.log.findLast(be=>be.action==="close.issue");if(!K||i(E.parentNodeId))return[];let $=f(K),Ts=x.at(-2)?.laneId;if($===null||!i(Ts))return[];let Es=x.slice(0,-1).flatMap((be,ws)=>i(be.laneId)?[{laneId:be.laneId,ms:x[ws+1].enteredAt-be.enteredAt}]:[]);return[{closedAt:$,leadTime:$-E.createdAt,sentBack:c(x),stays:Es}]}),v=or(o,sr),h=v[0],m=I.filter(E=>E.closedAt>=h),b=v.map((E,x)=>{let K=v[x+1]??1/0;return{t:E,closed:m.filter($=>$.closedAt>=E&&$.closedAt<K).length}}),y=new Map;for(let{stays:E}of m)for(let{laneId:x,ms:K}of E)y.set(x,(y.get(x)??0)+K);let V=t.reduce((E,x)=>E+(y.get(x.id)??0),0),As=t.flatMap(E=>{let x=y.get(E.id)??0;return x<=0?[]:[{laneId:E.id,title:E.title,meanMs:x/m.length,share:x/V}]});return{boardId:e,throughput:b,filed:g.filter(({ticket:E,visits:x})=>E.createdAt>=h&&i(x[0]?.laneId)).length,closed:m.length,medianLeadTimeMs:rr(m.map(E=>E.leadTime)),sentBackShare:m.length===0?null:m.filter(E=>E.sentBack).length/m.length,laneTime:As}};var ir=e=>{let t=B();if(l(t))return t;let n=Object.values(t.value.nodes),s=n.find(r=>r.id===e.boardId);if(!s||s.isDeleted||!W(s))return d("Board not found");let o=n.filter(r=>Q(r)&&r.parentNodeId===s.id),a=o.filter(r=>!r.isDeleted).sort((r,i)=>r.rank.localeCompare(i.rank));return p("Derived board overview",ts({boardId:s.id,lanes:a,formerLaneIds:o.filter(r=>r.isDeleted).map(r=>r.id),tickets:n.filter(r=>!r.isDeleted).filter(_).map(r=>({id:r.id,parentNodeId:r.parentNodeId,log:r.log??[],createdAt:P(r.id)})),now:Date.now()}))};var q=e=>({path:e.path,sha:e.shas[e.shas.length-1]??""});var ar=e=>{let t=e.lastIndexOf("/");return t===-1?".":e.slice(0,t)},ns=({commits:e,patch:t})=>{let n=e.map(r=>r.time),o=t.files.map(r=>({...q(r),changed:r.addedCount+r.removed})).reduce((r,i)=>r===null||i.changed>r.changed?i:r,null),a=t.insertions+t.deletions;return{commits:e.length,authors:[...new Set(e.map(r=>r.author))].sort(),firstCommitAt:n.length?Math.min(...n):null,lastCommitAt:n.length?Math.max(...n):null,files:t.files.length,filesAdded:t.files.filter(r=>r.status==="added").length,filesModified:t.files.filter(r=>r.status==="modified").length,filesDeleted:t.files.filter(r=>r.status==="deleted").length,binaryFiles:t.files.filter(r=>r.binary).length,directories:new Set(t.files.map(r=>ar(r.path))).size,insertions:t.insertions,deletions:t.deletions,net:t.insertions-t.deletions,largestFile:o,concentration:o&&a>0?o.changed/a:0,selfChurn:t.selfChurn,truncated:t.truncated}};var N={line:["//"],block:[["/*","*/"]]},j={line:["#"],block:[]},bt={line:["--"],block:[]},ve={line:[],block:[["<!--","-->"]]},lr={line:[],block:[]},R=(e,t)=>({name:e,comment:t}),Je=R("TypeScript",N),Qe=R("JavaScript",N),ss={ts:Je,tsx:Je,mts:Je,cts:Je,js:Qe,jsx:Qe,mjs:Qe,cjs:Qe,py:R("Python",{line:["#"],block:[['"""','"""']]}),rb:R("Ruby",{line:["#"],block:[["=begin","=end"]]}),go:R("Go",N),rs:R("Rust",N),java:R("Java",N),kt:R("Kotlin",N),swift:R("Swift",N),c:R("C",N),h:R("C",N),cc:R("C++",N),cpp:R("C++",N),hpp:R("C++",N),cs:R("C#",N),php:R("PHP",N),scala:R("Scala",N),dart:R("Dart",N),lua:R("Lua",bt),hs:R("Haskell",bt),sql:R("SQL",bt),ex:R("Elixir",j),exs:R("Elixir",j),pl:R("Perl",j),r:R("R",j),jl:R("Julia",j),sh:R("Shell",j),bash:R("Shell",j),zsh:R("Shell",j),vue:R("Vue",ve),svelte:R("Svelte",ve),html:R("HTML",ve),xml:R("XML",ve),md:R("Markdown",ve),mdx:R("Markdown",ve),css:R("CSS",{line:[],block:[["/*","*/"]]}),scss:R("CSS",N),less:R("CSS",N),yml:R("YAML",j),yaml:R("YAML",j),toml:R("TOML",j),ini:R("INI",j),json:R("JSON",lr)},dr="Other",os=e=>{let t=e.slice(e.lastIndexOf("/")+1),n=t.lastIndexOf(".");return n<=0?"":t.slice(n+1).toLowerCase()},ae=e=>ss[os(e)]?.name??dr,ke=e=>ss[os(e)]?.comment??null,ur=[/\.(test|spec)\.[a-z0-9]+$/i,/(^|\/)test_[^/]+\.py$/,/_test\.[a-z0-9]+$/i,/(^|\/)conftest\.py$/,/Tests?\.(java|kt|cs|scala)$/],cr=/(^|\/)(tests?|__tests__|spec|specs|e2e|src\/test|features)\//i,he=e=>cr.test(e)||ur.some(t=>t.test(e)),mr=/(^|\/)(package-lock\.json|npm-shrinkwrap\.json|yarn\.lock|pnpm-lock\.yaml|Cargo\.lock|go\.sum|poetry\.lock|Gemfile\.lock|composer\.lock)$/,pr=/(^|\/)(node_modules|dist|build|out|target|vendor|coverage|\.next|__snapshots__)\//,fr=/(\.min\.(js|css)|\.map|\.snap|\.pb\.go|_pb2\.py)$/,z=e=>mr.test(e)||pr.test(e)||fr.test(e),rs=e=>/(^|\/)(package\.json|go\.mod|Cargo\.toml|requirements[^/]*\.txt|pyproject\.toml|Gemfile|composer\.json|pom\.xml|build\.gradle(\.kts)?)$/.test(e),is=e=>/(^|\/)\.github\/workflows\//.test(e)||/(^|\/)(Dockerfile|docker-compose[^/]*\.ya?ml|Makefile|Jenkinsfile|\.gitlab-ci\.yml)$/.test(e)||/\.tf$/.test(e),as=e=>/\.(md|mdx|rst|txt)$/i.test(e)||/(^|\/)docs?\//i.test(e),gr=/\b(it|test|describe|context|suite)\.skip\b|\bx(it|describe|test)\s*\(|@pytest\.mark\.skip|@unittest\.skip|\bt\.Skip\s*\(|@(Ignore|Disabled)\b/,Ir=/\b(it|test|describe|context|suite)\.only\b|\bf(it|describe|test)\s*\(/,ls=e=>gr.test(e),ds=e=>Ir.test(e);var us=/\b(TODO|FIXME|HACK|XXX)\b/,vr=/[;{}]\s*$|^\s*(const|let|var|function|def|class|if|for|while|return|import|export|await|print)\b.*[=(]/,yt=(e,t)=>{let n=e.trim();return n===""?"blank":t&&(t.line.some(s=>n.startsWith(s))||t.block.some(([s])=>n.startsWith(s))||t.block.some(([s])=>s==="/*")&&(n.startsWith("*")||n.startsWith("*/")))?"comment":"code"},hr=(e,t)=>{let n=e.trim();for(let s of[...t.line,...t.block.flat(),"*"])if(n.startsWith(s)){n=n.slice(s.length).trim();break}return n},cs=({patch:e,repoShareByLanguage:t})=>{let n=new Map,s=0,o=0,a=0,r=0,i=0,u=0;for(let f of e.files){if(f.binary||z(f.path))continue;let c=ke(f.path);if(!c||c.line.length===0&&c.block.length===0)continue;let I=ae(f.path),v=n.get(I)??{comment:0,code:0};for(let{text:h}of f.added){let m=yt(h,c);if(us.test(h)&&r++,m==="blank"){a++;continue}if(m==="comment"){s++,v.comment++,c&&vr.test(hr(h,c))&&u++;continue}o++,v.code++}for(let{text:h}of f.removedLines)us.test(h)&&i++;n.set(I,v)}let g=s+o;return{byLanguage:[...n.entries()].map(([f,c])=>({name:f,commentLines:c.comment,codeLines:c.code,share:c.comment+c.code===0?0:c.comment/(c.comment+c.code),repoShare:t?.get(f)??null})).sort((f,c)=>c.commentLines+c.codeLines-(f.commentLines+f.codeLines)),commentLines:s,codeLines:o,blankLines:a,share:g===0?0:s/g,todoLinesAdded:r,todoLinesRemoved:i,commentedOutCodeLines:u}};var br=/\bconsole\.(log|debug|dir)\s*\(|\bdebugger\b|^\s*print\s*\(|\bfmt\.Print(ln|f)?\s*\(|\bSystem\.out\.print|\bdbg!\s*\(/,Ze=6,Rt=10,yr=e=>{let t=0;for(let n of e){if(n.trim()===""||n.startsWith(" "))continue;let s=n.length-n.trimStart().length;s>0&&(t===0||s<t)&&(t=s)}return Math.min(Math.max(t,2),8)},Rr=(e,t)=>{let n=e.length-e.trimStart().length;if(n===0)return 0;let s=e.slice(0,n).split(" ").length-1;return s>0?s:Math.floor(n/t)},Ar=e=>{if(e.length<Ze*2)return 0;let t=new Map,n=new Array(e.length).fill(!1);for(let s=0;s+Ze<=e.length;s++){let o=e.slice(s,s+Ze);if(o.some(i=>i.text.length<3))continue;let a=o.map(i=>i.text).join(`
5
5
  `),r=t.get(a);if(r===void 0){t.set(a,{...o[0],at:s});continue}if(r.file!==o[0]?.file)for(let i=0;i<Ze;i++)n[r.at+i]=!0,n[s+i]=!0}return n.filter(Boolean).length},ms=({patch:e})=>{let t=[],n=[],s=[],o=!1,a=0,r=0,i=null,u=[];for(let[g,f]of e.files.entries()){if(z(f.path)&&t.push(q(f)),rs(f.path)&&n.push(q(f)),is(f.path)&&s.push(q(f)),as(f.path)&&(o=!0),f.binary||z(f.path))continue;let c=f.added.map(h=>h.text),I=yr(c),v=f.status!=="deleted";for(let h of c){br.test(h)&&a++;let m=Rr(h,I);m>r&&(r=m,i=q(f)),v&&u.push({text:h.trim(),file:g})}u.push({text:" ",file:g})}return{generatedPaths:t.slice(0,Rt),dependencyManifests:n.slice(0,Rt),buildOrCiPaths:s.slice(0,Rt),docsTouched:o,debugPrintLinesAdded:a,maxIndentLevels:r,deepestFile:i,duplicatedLines:Ar(u)}};var ps=({patch:e,languagesBefore:t})=>{let n=new Map,s=0;for(let r of e.files){if(r.binary)continue;let i=r.addedCount+r.removed;if(z(r.path)){s+=i;continue}let u=ae(r.path),g=n.get(u)??{name:u,added:0,removed:0,addedInTests:0,share:0};g.added+=r.addedCount,g.removed+=r.removed,he(r.path)&&(g.addedInTests+=r.addedCount),n.set(u,g)}let o=[...n.values()].reduce((r,i)=>r+i.added+i.removed,0),a=[...n.values()].map(r=>({...r,share:o===0?0:(r.added+r.removed)/o})).sort((r,i)=>i.added+i.removed-(r.added+r.removed));return{languages:a,introduced:t===null?[]:a.filter(r=>!t.has(r.name)).map(r=>r.name),generatedLines:s}};var Tr=200,At=2e5,Er=5e4,wr=25,fs=64*1024*1024,Tt="",Sr=/^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/,xr=/^diff --git a\/(.+) b\/\1$/,gs=(e,t)=>e==="/dev/null"?null:e.startsWith(t)?e.slice(2):e,Is=(e,t)=>e===null?"added":t===null?"deleted":"modified",Cr=()=>({byPath:new Map,insertions:0,deletions:0,selfChurn:0,retainedLines:0}),Br=(e,t)=>{let n=e.byPath,s="",o=null,a=null,r=null,i=!1,u=0,g=(c,I)=>I==="modified"&&c==="added"?"added":I,f=(c,I)=>{let v=n.get(c);if(v)return v.entry.status=g(v.entry.status,I),v.entry.shas.includes(s)||v.entry.shas.push(s),v;let m={entry:{path:c,status:I,binary:!1,added:[],addedCount:0,removed:0,removedLines:[],shas:[s]},pendingByText:new Map};return n.set(c,m),m};for(let c of t.split(`
6
6
  `)){if(c.startsWith(Tt)){s=c.slice(Tt.length).trim(),o=null,a=null,r=null,i=!1;continue}if(c.startsWith("diff --git ")){o=null,r=null,i=!0,a=xr.exec(c)?.[1]??null;continue}if(i&&c.startsWith("Binary files ")&&a){let[,v=""]=/^Binary files (.*) differ$/.exec(c)??[],[h="",m=""]=v.split(" and ");o=f(a,Is(h==="/dev/null"?null:h,m==="/dev/null"?null:m)),o.entry.binary=!0;continue}if(i&&c.startsWith("--- ")){r=gs(c.slice(4),"a/");continue}if(i&&c.startsWith("+++ ")){let v=gs(c.slice(4),"b/"),h=v??r??a;h&&(o=f(h,Is(r,v)));continue}let I=Sr.exec(c);if(I){u=Number(I[1]),i=!1;continue}if(o){if(c.startsWith("+")){let v=c.slice(1);e.insertions++,o.entry.addedCount++,e.retainedLines<At&&(o.entry.added.push({sha:s,line:u,text:v}),e.retainedLines++),o.pendingByText.size<Er&&o.pendingByText.set(v,(o.pendingByText.get(v)??0)+1),u++;continue}if(c.startsWith("-")){let v=c.slice(1);e.deletions++,o.entry.removed++,e.retainedLines<At&&(o.entry.removedLines.push({sha:s,line:0,text:v}),e.retainedLines++);let h=o.pendingByText.get(v)??0;h>0&&v.trim().length>2&&(e.selfChurn++,o.pendingByText.set(v,h-1))}}}},Lr=e=>({files:[...e.byPath.values()].map(t=>t.entry),insertions:e.insertions,deletions:e.deletions,selfChurn:e.selfChurn,retainedLines:e.retainedLines});var vs=async({repoRoot:e,shas:t,cwdOf:n=()=>e})=>{if(t.length===0)return p("No commits to scan",{files:[],insertions:0,deletions:0,selfChurn:0,scannedCommits:0,truncated:!1});let s=t.slice(0,Tr).reverse(),o=Cr(),a=0,r=0,i=!1,u=[];for(let f of s){let c=n(f),I=u[u.length-1];I&&I.cwd===c&&I.shas.length<wr?I.shas.push(f):u.push({cwd:c,shas:[f]})}for(let{cwd:f,shas:c}of u){let I=await Oe({cwd:f,maxOutput:Math.max(1,fs-a),keepPartial:!0,args:["-c","core.quotePath=false","show","--unified=0","--no-renames","--no-color",`--format=${Tt}%H`,...c]});if(l(I)){if(f!==e)continue;return d(I.message)}if(Br(o,I.value.stdout),a+=I.value.stdout.length,r+=c.length,I.value.truncated||a>fs){i=!0;break}}let g=Lr(o);return p("Scanned ticket patch",{files:g.files,insertions:g.insertions,deletions:g.deletions,selfChurn:g.selfChurn,scannedCommits:r,truncated:i||r<t.length||g.retainedLines>=At})};var kr=40,Nr=/^\d{6} blob ([0-9a-f]{40})\t(.+)$/,hs=async({repoRoot:e,sha:t})=>{let n=await Me({cwd:e,args:["-c","core.quotePath=false","ls-tree","-r",`${t}~1`]});if(n.exitCode!==0)return null;let s=new Set,o=new Map;for(let f of n.stdout.split(`
7
7
  `)){let c=Nr.exec(f);if(!c)continue;let[,I="",v=""]=c;if(z(v))continue;let h=ae(v);if(s.add(h),he(v)||!ke(v))continue;let m=o.get(h)??[];m.length<kr&&(m.push({blob:I,path:v}),o.set(h,m))}let a=[...o.values()].flat(),r=await wt(a.map(f=>f.blob),e);if(l(r))return{languages:s,commentShareByLanguage:new Map};let i=r.value,u=new Map;for(let{blob:f,path:c}of a){let I=i.get(f);if(I===void 0)continue;let v=ke(c),h=ae(c),m=u.get(h)??{comment:0,code:0};for(let b of I.split(`
8
- `)){let y=yt(b,v);y==="comment"&&m.comment++,y==="code"&&m.code++}u.set(h,m)}let g=new Map;for(let[f,c]of u){let I=c.comment+c.code;I>0&&g.set(f,c.comment/I)}return{languages:s,commentShareByLanguage:g}};var bs=({patch:e})=>{let t=0,n=0,s=[],o=[],a=0,r=0;for(let i of e.files)if(!(i.binary||z(i.path))&&he(i.path)){t+=i.addedCount,n+=i.removed,i.status==="added"&&s.push(q(i)),i.status==="deleted"&&o.push(q(i));for(let{text:u}of i.added)ls(u)&&a++,ds(u)&&r++}return{testLinesAdded:t,testLinesRemoved:n,addedTestFiles:s,deletedTestFiles:o,skippedTestLinesAdded:a,focusedTestLinesAdded:r}};var Pr=e=>e.reduce((t,n)=>t===null||n.time<t.time?n:t,null),ys=async({repoRoot:e,ref:t,commits:n})=>{let s=await tn(e);if(l(s))return d(s.message);let o=nn(s.value),a=new Map(n.map(c=>[c.sha,c.repo])),r=c=>o(a.get(c))??e,i=await vs({repoRoot:e,shas:n.map(c=>c.sha),cwdOf:r});if(l(i))return d(i.message);let u=i.value,g=Pr(n),f=g?await hs({repoRoot:r(g.sha),sha:g.sha}):null;return p("Derived issue stats",{ref:t,shape:ns({commits:n,patch:u}),languages:ps({patch:u,languagesBefore:f?.languages??null}),tests:bs({patch:u}),comments:cs({patch:u,repoShareByLanguage:f?.commentShareByLanguage??null}),flags:ms({patch:u})})};var Rs=e=>{if(l(e))return e;let t=Ge(),n=l(t)?{}:t.value.emailLinks,s=l(t)?{}:t.value.contributors,o=Wt(n),a=e.value.map(r=>({...r,authorIdentity:Rn({authorName:r.author,authorEmail:r.authorEmail,owners:o,registry:s})}));return p(e.message,a)};var Mr=32,Ne=new Map;var Dr=(e,t)=>{if(Ne.set(e,t),Ne.size>Mr){let n=Ne.keys().next();n.done||Ne.delete(n.value)}return t},tm=async(e={idOrRef:""})=>{let t=e.idOrRef.trim();if(!t)return d("idOrRef must not be empty");let n=t.length>7?w(t):t.toUpperCase(),s=De(e.repoRoot??process.cwd());if(l(s))return d(s.message);let o=s.value,a=Rs(await sn({repoRoot:o,ref:n}));if(l(a))return d(a.message);let r=a.value.map(f=>({sha:f.sha,...f.repo?{repo:f.repo}:{},time:f.time,author:f.authorIdentity?.resolved?f.authorIdentity.name:f.author,subject:f.subject})),i=[o,n,r.map(f=>`${f.sha}:${f.author}`).join(",")].join(" "),u=Ne.get(i);if(u)return p("Derived issue stats",u);let g=await ys({repoRoot:o,ref:n,commits:r});return l(g)?d(g.message):p("Derived issue stats",Dr(i,g.value))};export{ft as a,Fn as b,U as c,di as d,Ks as e,ui as f,ci as g,Gn as h,pe as i,B as j,Js as k,Qs as l,no as m,so as n,oo as o,ao as p,uo as q,gt as r,mo as s,po as t,fo as u,go as v,Io as w,ho as x,bo as y,Ro as z,Ao as A,To as B,Eo as C,wo as D,So as E,xo as F,Co as G,Bo as H,Lo as I,ko as J,No as K,Po as L,Oo as M,Mo as N,Do as O,Fo as P,_o as Q,$o as R,Go as S,jo as T,Uo as U,Ho as V,zo as W,Ko as X,Xo as Y,qo as Z,Vo as _,Yo as $,nr as aa,Jo as ba,Qo as ca,Zo as da,er as ea,tr as fa,Qn as ga,es as ha,ir as ia,Rs as ja,tm as ka};
8
+ `)){let y=yt(b,v);y==="comment"&&m.comment++,y==="code"&&m.code++}u.set(h,m)}let g=new Map;for(let[f,c]of u){let I=c.comment+c.code;I>0&&g.set(f,c.comment/I)}return{languages:s,commentShareByLanguage:g}};var bs=({patch:e})=>{let t=0,n=0,s=[],o=[],a=0,r=0;for(let i of e.files)if(!(i.binary||z(i.path))&&he(i.path)){t+=i.addedCount,n+=i.removed,i.status==="added"&&s.push(q(i)),i.status==="deleted"&&o.push(q(i));for(let{text:u}of i.added)ls(u)&&a++,ds(u)&&r++}return{testLinesAdded:t,testLinesRemoved:n,addedTestFiles:s,deletedTestFiles:o,skippedTestLinesAdded:a,focusedTestLinesAdded:r}};var Pr=e=>e.reduce((t,n)=>t===null||n.time<t.time?n:t,null),ys=async({repoRoot:e,ref:t,commits:n})=>{let s=await tn(e);if(l(s))return d(s.message);let o=nn(s.value),a=new Map(n.map(c=>[c.sha,c.repo])),r=c=>o(a.get(c))??e,i=await vs({repoRoot:e,shas:n.map(c=>c.sha),cwdOf:r});if(l(i))return d(i.message);let u=i.value,g=Pr(n),f=g?await hs({repoRoot:r(g.sha),sha:g.sha}):null;return p("Derived issue stats",{ref:t,shape:ns({commits:n,patch:u}),languages:ps({patch:u,languagesBefore:f?.languages??null}),tests:bs({patch:u}),comments:cs({patch:u,repoShareByLanguage:f?.commentShareByLanguage??null}),flags:ms({patch:u})})};var Rs=e=>{if(l(e))return e;let t=Ge(),n=l(t)?{}:t.value.emailLinks,s=l(t)?{}:t.value.contributors,o=Wt(n),a=e.value.map(r=>({...r,authorIdentity:Rn({authorName:r.author,authorEmail:r.authorEmail,owners:o,registry:s})}));return p(e.message,a)};var Mr=32,Ne=new Map;var Dr=(e,t)=>{if(Ne.set(e,t),Ne.size>Mr){let n=Ne.keys().next();n.done||Ne.delete(n.value)}return t},nm=async(e={idOrRef:""})=>{let t=e.idOrRef.trim();if(!t)return d("idOrRef must not be empty");let n=t.length>7?w(t):t.toUpperCase(),s=De(e.repoRoot??process.cwd());if(l(s))return d(s.message);let o=s.value,a=Rs(await sn({repoRoot:o,ref:n,end:e.end}));if(l(a))return d(a.message);let r=a.value.map(f=>({sha:f.sha,...f.repo?{repo:f.repo}:{},time:f.time,author:f.authorIdentity?.resolved?f.authorIdentity.name:f.author,subject:f.subject})),i=[o,n,r.map(f=>`${f.sha}:${f.author}`).join(",")].join(" "),u=Ne.get(i);if(u)return p("Derived issue stats",u);let g=await ys({repoRoot:o,ref:n,commits:r});return l(g)?d(g.message):p("Derived issue stats",Dr(i,g.value))};export{ft as a,Fn as b,U as c,ui as d,Ks as e,ci as f,mi as g,Gn as h,pe as i,B as j,Js as k,Qs as l,no as m,so as n,oo as o,ao as p,uo as q,gt as r,mo as s,po as t,fo as u,go as v,Io as w,ho as x,bo as y,Ro as z,Ao as A,To as B,Eo as C,wo as D,So as E,xo as F,Co as G,Bo as H,Lo as I,ko as J,No as K,Po as L,Oo as M,Mo as N,Do as O,Fo as P,_o as Q,$o as R,Go as S,jo as T,Uo as U,Ho as V,zo as W,Ko as X,Xo as Y,qo as Z,Vo as _,Yo as $,nr as aa,Jo as ba,Qo as ca,Zo as da,er as ea,tr as fa,Qn as ga,es as ha,ir as ia,Rs as ja,nm as ka};
@@ -0,0 +1,92 @@
1
+ Copyright (c) 2016-2018 The Inter Project Authors (me@rsms.me)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+ -----------------------------------------------------------
8
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
9
+ -----------------------------------------------------------
10
+
11
+ PREAMBLE
12
+ The goals of the Open Font License (OFL) are to stimulate worldwide
13
+ development of collaborative font projects, to support the font creation
14
+ efforts of academic and linguistic communities, and to provide a free and
15
+ open framework in which fonts may be shared and improved in partnership
16
+ with others.
17
+
18
+ The OFL allows the licensed fonts to be used, studied, modified and
19
+ redistributed freely as long as they are not sold by themselves. The
20
+ fonts, including any derivative works, can be bundled, embedded,
21
+ redistributed and/or sold with any software provided that any reserved
22
+ names are not used by derivative works. The fonts and derivatives,
23
+ however, cannot be released under any other type of license. The
24
+ requirement for fonts to remain under this license does not apply
25
+ to any document created using the fonts or their derivatives.
26
+
27
+ DEFINITIONS
28
+ "Font Software" refers to the set of files released by the Copyright
29
+ Holder(s) under this license and clearly marked as such. This may
30
+ include source files, build scripts and documentation.
31
+
32
+ "Reserved Font Name" refers to any names specified as such after the
33
+ copyright statement(s).
34
+
35
+ "Original Version" refers to the collection of Font Software components as
36
+ distributed by the Copyright Holder(s).
37
+
38
+ "Modified Version" refers to any derivative made by adding to, deleting,
39
+ or substituting -- in part or in whole -- any of the components of the
40
+ Original Version, by changing formats or by porting the Font Software to a
41
+ new environment.
42
+
43
+ "Author" refers to any designer, engineer, programmer, technical
44
+ writer or other person who contributed to the Font Software.
45
+
46
+ PERMISSION AND CONDITIONS
47
+ Permission is hereby granted, free of charge, to any person obtaining
48
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
49
+ redistribute, and sell modified and unmodified copies of the Font
50
+ Software, subject to the following conditions:
51
+
52
+ 1) Neither the Font Software nor any of its individual components,
53
+ in Original or Modified Versions, may be sold by itself.
54
+
55
+ 2) Original or Modified Versions of the Font Software may be bundled,
56
+ redistributed and/or sold with any software, provided that each copy
57
+ contains the above copyright notice and this license. These can be
58
+ included either as stand-alone text files, human-readable headers or
59
+ in the appropriate machine-readable metadata fields within text or
60
+ binary files as long as those fields can be easily viewed by the user.
61
+
62
+ 3) No Modified Version of the Font Software may use the Reserved Font
63
+ Name(s) unless explicit written permission is granted by the corresponding
64
+ Copyright Holder. This restriction only applies to the primary font name as
65
+ presented to the users.
66
+
67
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
68
+ Software shall not be used to promote, endorse or advertise any
69
+ Modified Version, except to acknowledge the contribution(s) of the
70
+ Copyright Holder(s) and the Author(s) or with their explicit written
71
+ permission.
72
+
73
+ 5) The Font Software, modified or unmodified, in part or in whole,
74
+ must be distributed entirely under this license, and must not be
75
+ distributed under any other license. The requirement for fonts to
76
+ remain under this license does not apply to any document created
77
+ using the Font Software.
78
+
79
+ TERMINATION
80
+ This license becomes null and void if any of the above conditions are
81
+ not met.
82
+
83
+ DISCLAIMER
84
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
85
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
86
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
87
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
88
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
89
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
90
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
91
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
92
+ OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file