@fullstackhouse/cerber 1.6.2-pr.91.45d4d8c → 1.6.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.
- package/dist/core/artifact.js +0 -2
- package/dist/core/state.js +7 -18
- package/dist/server/index.js +33 -58
- package/package.json +1 -1
- package/web/dist/assets/{abnfDiagram-WEYOIA3C-DDWiBgJ_.js → abnfDiagram-WEYOIA3C-D5wm8458.js} +1 -1
- package/web/dist/assets/{arc-CXTmovRq.js → arc-CvrQr7ke.js} +1 -1
- package/web/dist/assets/{architectureDiagram-ZHVYKT53-DPwB58EC.js → architectureDiagram-ZHVYKT53-gshkv72h.js} +1 -1
- package/web/dist/assets/{blockDiagram-RJAE7QA3-BbdcPjtf.js → blockDiagram-RJAE7QA3-CPLPXHoV.js} +1 -1
- package/web/dist/assets/{c4Diagram-XDPPPE54-DHzjA55M.js → c4Diagram-XDPPPE54-B1A-GePa.js} +1 -1
- package/web/dist/assets/channel-4aSA0AsI.js +1 -0
- package/web/dist/assets/{chunk-2E7WHVMD-X1BSLNbz.js → chunk-2E7WHVMD-DZv4SQeE.js} +1 -1
- package/web/dist/assets/{chunk-2Q5K7J3B-4uva6Krv.js → chunk-2Q5K7J3B-BN5MFEGk.js} +1 -1
- package/web/dist/assets/{chunk-4EMNKR2T-DFnlUBTZ.js → chunk-4EMNKR2T-CQ9OTS_Y.js} +1 -1
- package/web/dist/assets/{chunk-55XCU76K-Cu8cVLZy.js → chunk-55XCU76K-DqGA3I0P.js} +1 -1
- package/web/dist/assets/{chunk-5VM5RSS4-B9WXEPBE.js → chunk-5VM5RSS4-B0DDtSF3.js} +1 -1
- package/web/dist/assets/{chunk-JWPE2WC7-CCsYBl0M.js → chunk-JWPE2WC7-DyJGNKay.js} +1 -1
- package/web/dist/assets/{chunk-VQ5W62QI-DBHQMI3P.js → chunk-VQ5W62QI-BVaZfdlJ.js} +1 -1
- package/web/dist/assets/{chunk-XXDRQBXY-DFB2lFGh.js → chunk-XXDRQBXY-BijU5AbR.js} +1 -1
- package/web/dist/assets/{chunk-ZCHMQSOR-dvczqjG8.js → chunk-ZCHMQSOR-CJNtblBl.js} +2 -2
- package/web/dist/assets/{classDiagram-v2-4MYWR3UA-Ck2KUiuM.js → classDiagram-v2-4MYWR3UA-31c0fLuG.js} +1 -1
- package/web/dist/assets/{cose-bilkent-JH36ORCC-DcMTug3a.js → cose-bilkent-JH36ORCC-BeI79iat.js} +1 -1
- package/web/dist/assets/{cynefin-EF2NZ3EQ-BG2opkNs.js → cynefin-EF2NZ3EQ-Dj_GKCLo.js} +1 -1
- package/web/dist/assets/{cynefinDiagram-WF24UDRP-BTIMNySy.js → cynefinDiagram-WF24UDRP-DJVl-Cha.js} +1 -1
- package/web/dist/assets/{dagre-NK4GIZVX-1qi-5iCE.js → dagre-NK4GIZVX-YIVvO6e5.js} +1 -1
- package/web/dist/assets/{diagram-CBK3MWTC-CSH989hb.js → diagram-CBK3MWTC-CXGhjXyi.js} +1 -1
- package/web/dist/assets/{diagram-I5XIIV2D-Z_1T8l7R.js → diagram-I5XIIV2D-3iO5MZue.js} +1 -1
- package/web/dist/assets/{diagram-ODIL2UCW-B8jB07f-.js → diagram-ODIL2UCW-C7F71C5O.js} +1 -1
- package/web/dist/assets/{diagram-PFBEJUXE-B9qraPmL.js → diagram-PFBEJUXE-p8y7_tW-.js} +1 -1
- package/web/dist/assets/{diagram-RJA3I4VV-CFhy381H.js → diagram-RJA3I4VV-DJTwvrGz.js} +1 -1
- package/web/dist/assets/{diagram-TYUNFSNR-DYEBj8MB.js → diagram-TYUNFSNR-Byl5ie3W.js} +1 -1
- package/web/dist/assets/{ebnfDiagram-V4P3TTPT-DGtaeIoV.js → ebnfDiagram-V4P3TTPT-kA-zQKdf.js} +1 -1
- package/web/dist/assets/{elk-QONTBCTQ-Cpcx9jQq.js → elk-QONTBCTQ-C7AEE2dT.js} +1 -1
- package/web/dist/assets/{erDiagram-KYQIGQAA-BFMhv1lb.js → erDiagram-KYQIGQAA-CUL9JFt9.js} +1 -1
- package/web/dist/assets/{flowDiagram-IUGLLWBU-ZvrIwHpb.js → flowDiagram-IUGLLWBU-CEOMISZC.js} +1 -1
- package/web/dist/assets/{ganttDiagram-R7GPNTJY-CMElMuNb.js → ganttDiagram-R7GPNTJY-CUs9OnoQ.js} +1 -1
- package/web/dist/assets/{gitGraphDiagram-PDYL7XHY-C2YKWJEE.js → gitGraphDiagram-PDYL7XHY-DbXbR_7n.js} +1 -1
- package/web/dist/assets/{index-CcSO4iOX.js → index-DIVX8aC0.js} +2 -2
- package/web/dist/assets/{infoDiagram-MVDRKAX5-Cekh0IW0.js → infoDiagram-MVDRKAX5-D5gtX5ay.js} +1 -1
- package/web/dist/assets/{ishikawaDiagram-HPEHV2GE-BoxRJEa6.js → ishikawaDiagram-HPEHV2GE-B0vcKoPQ.js} +1 -1
- package/web/dist/assets/{journeyDiagram-BOSHW7O7-kDJSSn-6.js → journeyDiagram-BOSHW7O7-BfKDxBMF.js} +1 -1
- package/web/dist/assets/{kanban-definition-FNSA4HC5-CBQ3lPM5.js → kanban-definition-FNSA4HC5-CmO-kBIa.js} +1 -1
- package/web/dist/assets/{linear-DSIqP0TT.js → linear-DgRqIxsJ.js} +1 -1
- package/web/dist/assets/{mermaid.core-wbwCbWuQ.js → mermaid.core-C6m6PWvg.js} +4 -4
- package/web/dist/assets/{mindmap-definition-6OY57UG3-C2PqDFz9.js → mindmap-definition-6OY57UG3-UFy1BwHP.js} +1 -1
- package/web/dist/assets/{pegDiagram-ECIUJNBX-S9r7bybM.js → pegDiagram-ECIUJNBX-CRD8kT1M.js} +1 -1
- package/web/dist/assets/{pieDiagram-GNMPY74T-C1DFot1v.js → pieDiagram-GNMPY74T-D9KIqFbC.js} +1 -1
- package/web/dist/assets/{quadrantDiagram-D57K4MC3-QaUZgGzi.js → quadrantDiagram-D57K4MC3-0JrGawCn.js} +1 -1
- package/web/dist/assets/{railroadDiagram-Y72NRBL7-BTsaNbut.js → railroadDiagram-Y72NRBL7-ThzD7FI4.js} +1 -1
- package/web/dist/assets/{requirementDiagram-EQYSW5RA-Bul4YAfK.js → requirementDiagram-EQYSW5RA-DcvLUCnu.js} +1 -1
- package/web/dist/assets/{sankeyDiagram-SY24JHO5-J8X2PWDq.js → sankeyDiagram-SY24JHO5-CRT8v_qw.js} +1 -1
- package/web/dist/assets/{sequenceDiagram-BLEHNHQU-CTX4Y6no.js → sequenceDiagram-BLEHNHQU-CySzt9Lb.js} +1 -1
- package/web/dist/assets/{sizeCapture-INFHLROL-CXfB7h8n.js → sizeCapture-INFHLROL-iXzfbVam.js} +1 -1
- package/web/dist/assets/{stateDiagram-v2-A6IESKWZ-Kr5pKDbm.js → stateDiagram-v2-A6IESKWZ-Cb6vX2Os.js} +1 -1
- package/web/dist/assets/{swimlanes-B3ENRKFQ-DDWGDYUC.js → swimlanes-B3ENRKFQ-DFA5myHp.js} +1 -1
- package/web/dist/assets/swimlanesDiagram-AYQRV4AK-BR6137mV.js +8 -0
- package/web/dist/assets/{timeline-definition-JXYKGLGB-BAKElQ5f.js → timeline-definition-JXYKGLGB-D5gGfOD0.js} +1 -1
- package/web/dist/assets/{usecaseDiagram-WPOLBNNX-Dlw_OwnV.js → usecaseDiagram-WPOLBNNX-CnLV1r1M.js} +1 -1
- package/web/dist/assets/{vennDiagram-Q3Y3IDCW-bTukfT0U.js → vennDiagram-Q3Y3IDCW-BYaMLGyP.js} +1 -1
- package/web/dist/assets/{wardleyDiagram-IVAIDKWA-DeM6AGmO.js → wardleyDiagram-IVAIDKWA-DYfnIgdf.js} +1 -1
- package/web/dist/assets/{xychartDiagram-4URNHDU4-CVYyvgbH.js → xychartDiagram-4URNHDU4-C1i9x7_b.js} +1 -1
- package/web/dist/index.html +1 -1
- package/web/dist/assets/channel-Bc1egjP3.js +0 -1
- package/web/dist/assets/swimlanesDiagram-AYQRV4AK-BkmYK-f1.js +0 -8
|
@@ -238,13 +238,13 @@ ${this.parser.parse(i)}</blockquote>
|
|
|
238
238
|
${i}</tr>
|
|
239
239
|
`}tablecell(i){let a=this.parser.parseInline(i.tokens),r=i.header?"th":"td";return(i.align?`<${r} align="${i.align}">`:`<${r}>`)+a+`</${r}>
|
|
240
240
|
`}strong({tokens:i}){return`<strong>${this.parser.parseInline(i)}</strong>`}em({tokens:i}){return`<em>${this.parser.parseInline(i)}</em>`}codespan({text:i}){return`<code>${Da(i,!0)}</code>`}br(i){return"<br>"}del({tokens:i}){return`<del>${this.parser.parseInline(i)}</del>`}link({href:i,title:a,tokens:r}){let s=this.parser.parseInline(r),u=_b(i);if(u===null)return s;i=u;let f='<a href="'+i+'"';return a&&(f+=' title="'+Da(a)+'"'),f+=">"+s+"</a>",f}image({href:i,title:a,text:r,tokens:s}){s&&(r=this.parser.parseInline(s,this.parser.textRenderer));let u=_b(i);if(u===null)return Da(r);i=u;let f=`<img src="${i}" alt="${Da(r)}"`;return a&&(f+=` title="${Da(a)}"`),f+=">",f}text(i){return"tokens"in i&&i.tokens?this.parser.parseInline(i.tokens):"escaped"in i&&i.escaped?i.text:Da(i.text)}},ff=class{strong({text:i}){return i}em({text:i}){return i}codespan({text:i}){return i}del({text:i}){return i}html({text:i}){return i}text({text:i}){return i}link({text:i}){return""+i}image({text:i}){return""+i}br(){return""}checkbox({raw:i}){return i}},wa=class Hd{constructor(a){At(this,"options");At(this,"renderer");At(this,"textRenderer");this.options=a||al,this.options.renderer=this.options.renderer||new go,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ff}static parse(a,r){return new Hd(r).parse(a)}static parseInline(a,r){return new Hd(r).parseInline(a)}parse(a){var s,u;this.renderer.parser=this;let r="";for(let f=0;f<a.length;f++){let h=a[f];if((u=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&u[h.type]){let g=h,m=this.options.extensions.renderers[g.type].call({parser:this},g);if(m!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(g.type)){r+=m||"";continue}}let y=h;switch(y.type){case"space":{r+=this.renderer.space(y);break}case"hr":{r+=this.renderer.hr(y);break}case"heading":{r+=this.renderer.heading(y);break}case"code":{r+=this.renderer.code(y);break}case"table":{r+=this.renderer.table(y);break}case"blockquote":{r+=this.renderer.blockquote(y);break}case"list":{r+=this.renderer.list(y);break}case"checkbox":{r+=this.renderer.checkbox(y);break}case"html":{r+=this.renderer.html(y);break}case"def":{r+=this.renderer.def(y);break}case"paragraph":{r+=this.renderer.paragraph(y);break}case"text":{r+=this.renderer.text(y);break}default:{let g='Token with "'+y.type+'" type was not found.';if(this.options.silent)return console.error(g),"";throw new Error(g)}}}return r}parseInline(a,r=this.renderer){var u,f;this.renderer.parser=this;let s="";for(let h=0;h<a.length;h++){let y=a[h];if((f=(u=this.options.extensions)==null?void 0:u.renderers)!=null&&f[y.type]){let m=this.options.extensions.renderers[y.type].call({parser:this},y);if(m!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(y.type)){s+=m||"";continue}}let g=y;switch(g.type){case"escape":{s+=r.text(g);break}case"html":{s+=r.html(g);break}case"link":{s+=r.link(g);break}case"image":{s+=r.image(g);break}case"checkbox":{s+=r.checkbox(g);break}case"strong":{s+=r.strong(g);break}case"em":{s+=r.em(g);break}case"codespan":{s+=r.codespan(g);break}case"br":{s+=r.br(g);break}case"del":{s+=r.del(g);break}case"text":{s+=r.text(g);break}default:{let m='Token with "'+g.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return s}},so,Hs=(so=class{constructor(i){At(this,"options");At(this,"block");this.options=i||al}preprocess(i){return i}postprocess(i){return i}processAllTokens(i){return i}emStrongMask(i){return i}provideLexer(i=this.block){return i?Sa.lex:Sa.lexInline}provideParser(i=this.block){return i?wa.parse:wa.parseInline}},At(so,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),At(so,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),so),fN=class{constructor(...i){At(this,"defaults",lf());At(this,"options",this.setOptions);At(this,"parse",this.parseMarkdown(!0));At(this,"parseInline",this.parseMarkdown(!1));At(this,"Parser",wa);At(this,"Renderer",go);At(this,"TextRenderer",ff);At(this,"Lexer",Sa);At(this,"Tokenizer",mo);At(this,"Hooks",Hs);this.use(...i)}walkTokens(i,a){var s,u;let r=[];for(let f of i)switch(r=r.concat(a.call(this,f)),f.type){case"table":{let h=f;for(let y of h.header)r=r.concat(this.walkTokens(y.tokens,a));for(let y of h.rows)for(let g of y)r=r.concat(this.walkTokens(g.tokens,a));break}case"list":{let h=f;r=r.concat(this.walkTokens(h.items,a));break}default:{let h=f;(u=(s=this.defaults.extensions)==null?void 0:s.childTokens)!=null&&u[h.type]?this.defaults.extensions.childTokens[h.type].forEach(y=>{let g=h[y].flat(1/0);r=r.concat(this.walkTokens(g,a))}):h.tokens&&(r=r.concat(this.walkTokens(h.tokens,a)))}}return r}use(...i){let a=this.defaults.extensions||{renderers:{},childTokens:{}};return i.forEach(r=>{let s={...r};if(s.async=this.defaults.async||s.async||!1,r.extensions&&(r.extensions.forEach(u=>{if(!u.name)throw new Error("extension name required");if("renderer"in u){let f=a.renderers[u.name];f?a.renderers[u.name]=function(...h){let y=u.renderer.apply(this,h);return y===!1&&(y=f.apply(this,h)),y}:a.renderers[u.name]=u.renderer}if("tokenizer"in u){if(!u.level||u.level!=="block"&&u.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let f=a[u.level];f?f.unshift(u.tokenizer):a[u.level]=[u.tokenizer],u.start&&(u.level==="block"?a.startBlock?a.startBlock.push(u.start):a.startBlock=[u.start]:u.level==="inline"&&(a.startInline?a.startInline.push(u.start):a.startInline=[u.start]))}"childTokens"in u&&u.childTokens&&(a.childTokens[u.name]=u.childTokens)}),s.extensions=a),r.renderer){let u=this.defaults.renderer||new go(this.defaults);for(let f in r.renderer){if(!(f in u))throw new Error(`renderer '${f}' does not exist`);if(["options","parser"].includes(f))continue;let h=f,y=r.renderer[h],g=u[h];u[h]=(...m)=>{let b=y.apply(u,m);return b===!1&&(b=g.apply(u,m)),b||""}}s.renderer=u}if(r.tokenizer){let u=this.defaults.tokenizer||new mo(this.defaults);for(let f in r.tokenizer){if(!(f in u))throw new Error(`tokenizer '${f}' does not exist`);if(["options","rules","lexer"].includes(f))continue;let h=f,y=r.tokenizer[h],g=u[h];u[h]=(...m)=>{let b=y.apply(u,m);return b===!1&&(b=g.apply(u,m)),b}}s.tokenizer=u}if(r.hooks){let u=this.defaults.hooks||new Hs;for(let f in r.hooks){if(!(f in u))throw new Error(`hook '${f}' does not exist`);if(["options","block"].includes(f))continue;let h=f,y=r.hooks[h],g=u[h];Hs.passThroughHooks.has(f)?u[h]=m=>{if(this.defaults.async&&Hs.passThroughHooksRespectAsync.has(f))return(async()=>{let v=await y.call(u,m);return g.call(u,v)})();let b=y.call(u,m);return g.call(u,b)}:u[h]=(...m)=>{if(this.defaults.async)return(async()=>{let v=await y.apply(u,m);return v===!1&&(v=await g.apply(u,m)),v})();let b=y.apply(u,m);return b===!1&&(b=g.apply(u,m)),b}}s.hooks=u}if(r.walkTokens){let u=this.defaults.walkTokens,f=r.walkTokens;s.walkTokens=function(h){let y=[];return y.push(f.call(this,h)),u&&(y=y.concat(u.call(this,h))),y}}this.defaults={...this.defaults,...s}}),this}setOptions(i){return this.defaults={...this.defaults,...i},this}lexer(i,a){return Sa.lex(i,a??this.defaults)}parser(i,a){return wa.parse(i,a??this.defaults)}parseMarkdown(i){return(a,r)=>{let s={...r},u={...this.defaults,...s},f=this.onError(!!u.silent,!!u.async);if(this.defaults.async===!0&&s.async===!1)return f(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof a>"u"||a===null)return f(new Error("marked(): input parameter is undefined or null"));if(typeof a!="string")return f(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(a)+", string expected"));if(u.hooks&&(u.hooks.options=u,u.hooks.block=i),u.async)return(async()=>{let h=u.hooks?await u.hooks.preprocess(a):a,y=await(u.hooks?await u.hooks.provideLexer(i):i?Sa.lex:Sa.lexInline)(h,u),g=u.hooks?await u.hooks.processAllTokens(y):y;u.walkTokens&&await Promise.all(this.walkTokens(g,u.walkTokens));let m=await(u.hooks?await u.hooks.provideParser(i):i?wa.parse:wa.parseInline)(g,u);return u.hooks?await u.hooks.postprocess(m):m})().catch(f);try{u.hooks&&(a=u.hooks.preprocess(a));let h=(u.hooks?u.hooks.provideLexer(i):i?Sa.lex:Sa.lexInline)(a,u);u.hooks&&(h=u.hooks.processAllTokens(h)),u.walkTokens&&this.walkTokens(h,u.walkTokens);let y=(u.hooks?u.hooks.provideParser(i):i?wa.parse:wa.parseInline)(h,u);return u.hooks&&(y=u.hooks.postprocess(y)),y}catch(h){return f(h)}}}onError(i,a){return r=>{if(r.message+=`
|
|
241
|
-
Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error occurred:</p><pre>"+Da(r.message+"",!0)+"</pre>";return a?Promise.resolve(s):s}if(a)return Promise.reject(r);throw r}}},nl=new fN;function yt(i,a){return nl.parse(i,a)}yt.options=yt.setOptions=function(i){return nl.setOptions(i),yt.defaults=nl.defaults,dy(yt.defaults),yt};yt.getDefaults=lf;yt.defaults=al;function hN(...i){return nl.use(...i),yt.defaults=nl.defaults,dy(yt.defaults),yt}yt.use=hN;yt.walkTokens=function(i,a){return nl.walkTokens(i,a)};yt.parseInline=nl.parseInline;yt.Parser=wa;yt.parser=wa.parse;yt.Renderer=go;yt.TextRenderer=ff;yt.Lexer=Sa;yt.lexer=Sa.lex;yt.Tokenizer=mo;yt.Hooks=Hs;yt.parse=yt;yt.options;yt.setOptions;yt.walkTokens;yt.parseInline;wa.parse;Sa.lex;const pN="modulepreload",mN=function(i){return"/"+i},xb={},gN=function(a,r,s){let u=Promise.resolve();if(r&&r.length>0){let h=function(m){return Promise.all(m.map(b=>Promise.resolve(b).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const y=document.querySelector("meta[property=csp-nonce]"),g=(y==null?void 0:y.nonce)||(y==null?void 0:y.getAttribute("nonce"));u=h(r.map(m=>{if(m=mN(m),m in xb)return;xb[m]=!0;const b=m.endsWith(".css"),v=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${v}`))return;const _=document.createElement("link");if(_.rel=b?"stylesheet":pN,b||(_.as="script"),_.crossOrigin="",_.href=m,g&&_.setAttribute("nonce",g),document.head.appendChild(_),b)return new Promise((T,S)=>{_.addEventListener("load",T),_.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${m}`)))})}))}function f(h){const y=new Event("vite:preloadError",{cancelable:!0});if(y.payload=h,window.dispatchEvent(y),!y.defaultPrevented)throw h}return u.then(h=>{for(const y of h||[])y.status==="rejected"&&f(y.reason);return a().catch(f)})};let bN=0;async function yN(i){const a=[...i.querySelectorAll("pre > code.language-mermaid")];if(a.length===0)return;const{default:r}=await gN(async()=>{const{default:s}=await import("./mermaid.core-
|
|
241
|
+
Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error occurred:</p><pre>"+Da(r.message+"",!0)+"</pre>";return a?Promise.resolve(s):s}if(a)return Promise.reject(r);throw r}}},nl=new fN;function yt(i,a){return nl.parse(i,a)}yt.options=yt.setOptions=function(i){return nl.setOptions(i),yt.defaults=nl.defaults,dy(yt.defaults),yt};yt.getDefaults=lf;yt.defaults=al;function hN(...i){return nl.use(...i),yt.defaults=nl.defaults,dy(yt.defaults),yt}yt.use=hN;yt.walkTokens=function(i,a){return nl.walkTokens(i,a)};yt.parseInline=nl.parseInline;yt.Parser=wa;yt.parser=wa.parse;yt.Renderer=go;yt.TextRenderer=ff;yt.Lexer=Sa;yt.lexer=Sa.lex;yt.Tokenizer=mo;yt.Hooks=Hs;yt.parse=yt;yt.options;yt.setOptions;yt.walkTokens;yt.parseInline;wa.parse;Sa.lex;const pN="modulepreload",mN=function(i){return"/"+i},xb={},gN=function(a,r,s){let u=Promise.resolve();if(r&&r.length>0){let h=function(m){return Promise.all(m.map(b=>Promise.resolve(b).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const y=document.querySelector("meta[property=csp-nonce]"),g=(y==null?void 0:y.nonce)||(y==null?void 0:y.getAttribute("nonce"));u=h(r.map(m=>{if(m=mN(m),m in xb)return;xb[m]=!0;const b=m.endsWith(".css"),v=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${v}`))return;const _=document.createElement("link");if(_.rel=b?"stylesheet":pN,b||(_.as="script"),_.crossOrigin="",_.href=m,g&&_.setAttribute("nonce",g),document.head.appendChild(_),b)return new Promise((T,S)=>{_.addEventListener("load",T),_.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${m}`)))})}))}function f(h){const y=new Event("vite:preloadError",{cancelable:!0});if(y.payload=h,window.dispatchEvent(y),!y.defaultPrevented)throw h}return u.then(h=>{for(const y of h||[])y.status==="rejected"&&f(y.reason);return a().catch(f)})};let bN=0;async function yN(i){const a=[...i.querySelectorAll("pre > code.language-mermaid")];if(a.length===0)return;const{default:r}=await gN(async()=>{const{default:s}=await import("./mermaid.core-C6m6PWvg.js").then(u=>u.bA);return{default:s}},[]);r.initialize({startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,theme:"neutral",htmlLabels:!1,flowchart:{htmlLabels:!1,useMaxWidth:!1}});for(const s of a){const u=s.textContent??"";try{const{svg:f}=await r.render(`cerber-diagram-${++bN}`,u),h=s.parentElement;if(!(h!=null&&h.isConnected))continue;const y=document.createElement("figure");y.className="md-diagram",y.innerHTML=uy.sanitize(f,{USE_PROFILES:{svg:!0,svgFilters:!0}}),h.replaceWith(y)}catch(f){console.warn("cerber: could not draw a diagram",f)}}}yt.setOptions({gfm:!0,breaks:!1});function hf(i){const a=yt.parse(i??"",{async:!1});return uy.sanitize(a)}function _y(i){const a=H.useRef(null);return H.useEffect(()=>{a.current&&yN(a.current)},[i]),a}function ai({text:i,className:a}){const r=H.useMemo(()=>({__html:hf(i)}),[i]),s=_y(r.__html);return i!=null&&i.trim()?d.jsx("div",{ref:s,className:`md ${a??""}`,dangerouslySetInnerHTML:r}):null}const vN={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ","#39":"'"};function EN(i){return i.replace(/<[^>]*>/g," ").replace(/&([a-z]+|#\d+);/gi,(a,r)=>vN[r.toLowerCase()]??a).replace(/\s+/g," ").trim()}function _N(i,a){return EN(a)!==i.replace(/\s+/g," ").trim()}function Ps({text:i,className:a}){const r=H.useMemo(()=>({__html:i!=null&&i.trim()?hf(i):""}),[i]),s=_y(r.__html);return!r.__html||!_N(i,r.__html)?null:d.jsxs("div",{className:"md-preview",children:[d.jsx("div",{className:"lab",children:"preview"}),d.jsx("div",{ref:s,className:`md prose ${a??""}`,dangerouslySetInnerHTML:r})]})}const SN=/\.(md|markdown)$/i;function pf(i){return SN.test(i)}function wN(i){return/^new file mode /m.test(i)||/^--- \/dev\/null$/m.test(i)}function NN(i){const a=[];let r=0,s=!1;const u=i.split(`
|
|
242
242
|
`);for(let f=0;f<u.length;f++){const h=u[f],y=h.match(/^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(y){r=Number(y[1]),s=!0;continue}s&&(h===""&&f===u.length-1||h.startsWith("\\")||h.startsWith("-")||(h.startsWith("+")||h.startsWith(" ")||h==="")&&(a.push({n:r,text:h===""?"":h.slice(1),added:h.startsWith("+")}),r++))}return a}const lo=i=>(i.match(/\n/g)??[]).length;function mf(i){const a=NN(i),r=wN(i),s=[];let u=[];const f=()=>{if(u.length===0)return;const h=u[0].n,y=new Set(u.filter(b=>b.added).map(b=>b.n)),g=u.map(b=>b.text).join(`
|
|
243
243
|
`)+`
|
|
244
244
|
`;let m=h;for(const b of yt.lexer(g)){const v=b.raw,_=v.trimEnd();if(_===""){m+=lo(v);continue}const T=v.length-v.trimStart().length,S=m+lo(v.slice(0,T)),C=S+lo(_.slice(T));let A=!1;for(let R=S;R<=C&&!A;R++)A=y.has(R);s.push({kind:"block",raw:_.slice(T),from:S,to:C,changed:A}),m+=lo(v)}u=[]};for(const h of a){const y=u[u.length-1];if(y&&h.n!==y.n+1){const g=h.n-y.n-1;f(),s.push({kind:"gap",lines:g})}u.push(h)}return f(),{items:s,isNew:r,lines:a.length}}const qd="cerber.stickyChapters";function xN(i){return i!=="off"}function TN(){try{return xN(localStorage.getItem(qd))}catch{return!0}}function Sy(){const[i,a]=H.useState(TN);return[i,s=>{try{s?localStorage.removeItem(qd):localStorage.setItem(qd,"off")}catch{}a(s)}]}function oo(i){const a=i.alreadyRaised;return!a||a.decision==="send"?"post":a.decision==="reply"?a.where.kind==="thread"?"reply":"hold":a.where.kind==="thread"&&a.where.state==="resolved"?"post":"hold"}const Gd={APPROVE:"approve",COMMENT:"comment",REQUEST_CHANGES:"request changes"},AN={APPROVE:"approve",COMMENT:"comment",REQUEST_CHANGES:"changes"};function wy(i,a=!1){return a?"COMMENT":(i==null?void 0:i.recommendation)==="approve"?"APPROVE":(i==null?void 0:i.recommendation)==="request_changes"?"REQUEST_CHANGES":"COMMENT"}function Ny(i,a){const r=B_(i);return a.filter(s=>{var u;return!s.drifted&&s.line!=null&&((u=r.get(s.path))==null?void 0:u.has(s.line))})}function Tb(i,a){const r=f=>{const h=Number((f??"").trim());return Number.isInteger(h)&&h>0?h:null},s=r(a);if(s!=null)return{line:s,side:"new"};const u=r(i);return u!=null?{line:u,side:"old"}:null}function xy(i){const a=i.comments.filter(y=>y.status==="dropped"),r=i.comments.filter(y=>y.status!=="dropped"),s=r.filter(y=>oo(y)==="reply"),u=r.filter(y=>oo(y)==="hold"),f=r.filter(y=>oo(y)==="post"),h=Ny(i.diff,f);return{inline:h,folded:f.filter(y=>!h.includes(y)),dropped:a,replies:s,held:u}}function Ab(i){return i.sent!=null||(i.priorSends??[]).length>0}function Rb(i){return(i.priorSends??[]).length+(i.sent?1:0)}function RN(i,a){if(i.sent==null)return!1;const r=a==null?void 0:a.headSha;return r!=null&&i.pr.headSha!==""&&r!==i.pr.headSha}function kN(i,a){const r=i.alreadyRaised;if(!r)return null;if(i.status==="dropped")return a?"dropped — not posted":"dropped — never posts";if(r.replied)return"replied in their thread";const s=oo(i);return a?s==="reply"?"the reply in their thread did not post":s==="hold"?"left out of the review":"posted as a comment of its own":s==="reply"?"replies in their thread when you send":s==="hold"?"left out of Send":r.decision==="send"?"posts as a comment of its own":"posts — their thread was resolved, and the problem is still here"}function ON(i){return i.where.kind==="thread"?`${i.where.state} thread`:"review"}function Rd(i){const a=i.comments.filter(u=>u.status!=="dropped");return["blocker","minor","nit"].map(u=>({tier:u,n:a.filter(f=>f.severity===u).length})).filter(({n:u})=>u>0).map(({tier:u,n:f})=>`${Zb[u]} ${f} ${u}${f===1?"":"s"}`).join(" · ")}function CN(i){if(!i.comments.some(s=>s.severity!=null))return null;const r=i.comments.filter(s=>s.status!=="dropped"&&s.severity==="blocker").length;return r===0?"no blockers":`${r} blocker${r===1?"":"s"}`}function MN(i){if(!i.verdict||!i.comments.some(u=>u.severity!=null))return null;const r=i.comments.filter(u=>u.status!=="dropped"&&u.severity==="blocker").length,s=i.verdict.recommendation;return s==="approve"&&r>0?`the verdict says approve, but ${r} blocker${r===1?"":"s"} still stand${r===1?"s":""}`:s==="request_changes"&&r===0?"the verdict says request changes, but no blocker still stands":null}function $d(i){const{inline:a,folded:r,replies:s,held:u}=xy(i),f=[s.length>0?`${s.length} ${s.length===1?"reply":"replies"} in another reviewer's thread`:"",u.length>0?`${u.length} already raised, left out`:""].filter(Boolean);return[DN(i,a,r),...f].join(" · ")}function DN(i,a,r){if(i.bodyOverride!=null)return`${a.length===0?"no inline comments":`${a.length} inline`} · body you wrote`;if(a.length===0&&r.length===0)return"no inline comments · body only";const s=[`${a.length} inline`];return r.length>0&&s.push(`${r.length} folded into the body`),s.join(" · ")}const Yd="cerber.sendKey";function LN(i){return i==="enter"?i:"mod-enter"}function zN(i,a){return a.key!=="Enter"||a.isComposing||a.keyCode===229?!1:a.metaKey||a.ctrlKey?!0:i==="enter"&&!a.shiftKey}let bo=null;function jN(i){if(bo)return bo;try{return LN((i??localStorage).getItem(Yd))}catch{return"mod-enter"}}function UN(i,a){try{const r=a??localStorage;i==="mod-enter"?r.removeItem(Yd):r.setItem(Yd,i),bo=null}catch{bo=i}}function Ty(){const[i,a]=H.useState(()=>jN());return[i,s=>{UN(s),a(s)}]}const kb={approve:"approve",comment:"comment",request_changes:"changes"},BN={approve:"approve",comment:"comment",request_changes:"changes"};function IN(i,a){return i.status==="dropped"?"none":i.drifted?"comment":i.origin==="user"?"awaiting":a}function Ay(i,a=20){const r=document.getElementById(`c-${i}`);if(r){r.scrollIntoView({behavior:"smooth",block:"center"});return}a>0&&requestAnimationFrame(()=>Ay(i,a-1))}function HN(i){const a=i,r=a==null?void 0:a.tagName;return r==="INPUT"||r==="TEXTAREA"||r==="SELECT"||(a==null?void 0:a.isContentEditable)===!0}function Ob(i,a){const r=document.createElement("tr");r.className=a;const s=document.createElement("td");s.colSpan=2;const u=document.createElement("div");return s.appendChild(u),r.appendChild(s),i.after(r),{tr:r,holder:u}}function Cb(i,a,r){i.querySelectorAll(".d2h-file-wrapper").forEach(s=>{const u=s.dataset.path;if(!u)return;const f=a.has(u);s.classList.toggle("file-viewed-on",f),s.classList.toggle("file-peek",f&&r.has(u));const h=s.querySelector("input[data-viewed-path]");h&&(h.checked=f)})}function yo(i,a){!i||!a||i.getBoundingClientRect().top<parseFloat(getComputedStyle(a).top)&&requestAnimationFrame(()=>i.scrollIntoView({block:"start"}))}function qN(i){const a=document.createElement("label");a.className="file-viewed",a.title="Mark as viewed — folds the file until its diff changes";const r=document.createElement("input");return r.type="checkbox",r.dataset.viewedPath=i,a.append(r," Viewed"),a}function Ry({pick:i,chatBusy:a,onAdd:r,onAsk:s,onClose:u}){const[f,h]=H.useState(""),y=H.useRef(null);H.useEffect(()=>{var m;return(m=y.current)==null?void 0:m.focus()},[]);const g=f.trim();return d.jsxs("div",{className:"line-composer",children:[d.jsxs("div",{className:"line-composer-head",children:[d.jsxs("span",{className:"comment-loc",children:[i.path,":",i.line]}),i.side==="old"&&d.jsx("span",{className:"faint",title:"GitHub only takes inline comments on the new side of a diff.",children:"this line is gone from the new file — a comment on it posts on the file, not the line"})]}),d.jsx("textarea",{ref:y,className:"comment-edit",rows:3,placeholder:"what about this line?",value:f,onChange:m=>h(m.target.value),onKeyDown:m=>{m.key==="Escape"&&u(),m.key==="Enter"&&(m.metaKey||m.ctrlKey)&&g&&(m.preventDefault(),r(g))}}),d.jsx(Ps,{className:"comment-body",text:f}),d.jsxs("div",{className:"line-composer-actions",children:[d.jsxs("button",{className:"btn",disabled:!g,onClick:()=>r(g),children:[d.jsx(Xe,{name:"plus"}),"add comment",d.jsx(za,{children:"⌘↵"})]}),d.jsxs("button",{className:"btn btn-accent",disabled:!g||a,title:a?"the reviewer is still answering the last question":"Ask the reviewer about this line — the answer lands in the chat below",onClick:()=>s(g),children:[d.jsx(Xe,{name:"comment"}),"ask the reviewer"]}),d.jsx("span",{className:"grow"}),d.jsx("button",{className:"btn btn-sm",onClick:u,children:"cancel"})]})]})}function GN({patch:i,comments:a,renderComment:r,readOnly:s,chatBusy:u,onAddLineComment:f,onAskAboutLine:h,onRead:y,viewedState:g}){const m=H.useMemo(()=>i.trim()?L_(i,{drawFileList:!1,matching:"lines",outputFormat:"line-by-line"}):"",[i]),b=H.useMemo(()=>ja(i).map(j=>j.path),[i]),v=H.useMemo(()=>new Set(ja(i).filter(j=>pf(j.path)&&mf(j.patch).lines>0).map(j=>j.path)),[i]),_=H.useMemo(()=>a.map(j=>`${j.id}@${j.path}:${j.line}`).join("|"),[a]),T=H.useRef(null),S=H.useRef(y);S.current=y;const C=H.useRef(g);C.current=g;const[A,R]=H.useState([]),[$,U]=H.useState([]),[W,z]=H.useState(null),[ae,se]=H.useState(null);H.useEffect(()=>{var De,w;const j=T.current;if(!j)return;j.innerHTML=m,TS(j);const le=new Map,fe=[];j.querySelectorAll(".d2h-file-wrapper").forEach((L,I)=>{var ve,X,be,xe,Ge;const oe=(X=(ve=L.querySelector(".d2h-file-name"))==null?void 0:ve.textContent)==null?void 0:X.trim(),me=oe&&b.includes(oe)?oe:b[I];if(oe&&le.set(oe,L),me){le.set(me,L),L.dataset.path=me;const $e=document.createElement("div");if($e.className="file-comments",(be=L.querySelector(".d2h-file-header"))==null||be.after($e),fe.push({path:me,el:$e}),v.has(me)){const Ce=document.createElement("button");Ce.type="button",Ce.className="btn btn-sm md-read-toggle",Ce.dataset.readPath=me,Ce.textContent="read as a document",Ce.title="Render this markdown instead of showing it line by line",(xe=L.querySelector(".d2h-file-header"))==null||xe.appendChild(Ce)}(Ge=L.querySelector(".d2h-file-header"))==null||Ge.appendChild(qN(me))}}),Cb(j,C.current.viewed,C.current.peeked);const M=[],Q=new Map;for(const L of a){if(L.line==null)continue;const I=le.get(L.path);if(!I)continue;const oe=Array.from(I.querySelectorAll(".d2h-diff-tbody > tr")).find(ve=>{var X,be;return((be=(X=ve.querySelector(".line-num2"))==null?void 0:X.textContent)==null?void 0:be.trim())===String(L.line)});if(!oe)continue;const me=Ob(Q.get(oe)??oe,"inline-comment-row");Q.set(oe,me.tr),M.push({id:L.id,el:me.holder})}R(M),U(fe);const pe=L=>{var $e;const I=L.target,oe=I.closest(".md-read-toggle");if(oe!=null&&oe.dataset.readPath){S.current(oe.dataset.readPath);return}const me=I.closest(".d2h-file-wrapper");if(I instanceof HTMLInputElement&&I.dataset.viewedPath){I.checked&&yo(me,(me==null?void 0:me.querySelector(".d2h-file-header"))??null),C.current.onToggleViewed(I.dataset.viewedPath);return}if(I.closest(".file-viewed"))return;const ve=($e=I.closest(".d2h-file-header"))==null?void 0:$e.closest(".file-viewed-on");if(ve!=null&&ve.dataset.path){yo(me,(me==null?void 0:me.querySelector(".d2h-file-header"))??null),C.current.onTogglePeek(ve.dataset.path);return}const X=L.target.closest(".line-add");if(!X)return;const{path:be,line:xe,side:Ge}=X.dataset;!be||!xe||z({path:be,line:Number(xe),side:Ge==="old"?"old":"new"})};j.addEventListener("click",pe);const we=()=>j.removeEventListener("click",pe);if(s)return z(null),se(null),we;for(const L of j.querySelectorAll(".d2h-file-wrapper")){const I=L.dataset.path;if(I)for(const oe of L.querySelectorAll(".d2h-diff-tbody > tr > td.d2h-code-linenumber")){const me=Tb((De=oe.querySelector(".line-num1"))==null?void 0:De.textContent,(w=oe.querySelector(".line-num2"))==null?void 0:w.textContent);if(!me)continue;const ve=document.createElement("button");ve.type="button",ve.className="line-add";const X=`Say something about ${I}:${me.line}`;ve.title=X,ve.setAttribute("aria-label",X),ve.tabIndex=-1,ve.dataset.path=I,ve.dataset.line=String(me.line),ve.dataset.side=me.side,oe.appendChild(ve)}}return se(null),we},[m,_,b,v,s]);const x=b.filter(j=>g.viewed.has(j)).join(`
|
|
245
245
|
`),G=b.filter(j=>g.peeked.has(j)).join(`
|
|
246
246
|
`);H.useEffect(()=>{T.current&&Cb(T.current,g.viewed,g.peeked)},[x,G]),H.useEffect(()=>{const j=T.current;if(!j||!W||s){se(null);return}const le=Array.from(j.querySelectorAll(".d2h-file-wrapper")).find(Q=>Q.dataset.path===W.path),fe=Array.from((le==null?void 0:le.querySelectorAll(".d2h-diff-tbody > tr"))??[]).find(Q=>{var De,w;const pe=Q.querySelector(".d2h-code-linenumber"),we=Tb((De=pe==null?void 0:pe.querySelector(".line-num1"))==null?void 0:De.textContent,(w=pe==null?void 0:pe.querySelector(".line-num2"))==null?void 0:w.textContent);return(we==null?void 0:we.line)===W.line&&we.side===W.side});if(!fe){z(null);return}const M=Ob(fe,"line-composer-row");return se(M.holder),()=>M.tr.remove()},[W,A,s]);const ee=a.filter(j=>!A.some(le=>le.id===j.id)),ue=$.map(j=>({...j,comments:ee.filter(le=>le.path===j.path)})).filter(j=>j.comments.length>0),Ee=ee.filter(j=>!$.some(le=>le.path===j.path));return d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"diff",ref:T}),A.map(({id:j,el:le})=>{const fe=a.find(M=>M.id===j);return fe?Lu.createPortal(r(fe),le,j):null}),ue.map(({path:j,el:le,comments:fe})=>Lu.createPortal(d.jsx(d.Fragment,{children:fe.map(r)}),le,`file:${j}`)),W&&ae&&Lu.createPortal(d.jsx(Ry,{pick:W,chatBusy:u,onAdd:j=>{f(W,j),z(null)},onAsk:j=>{h(W,j),z(null)},onClose:()=>z(null)}),ae,`pick-${W.path}-${W.side}-${W.line}`),Ee.map(j=>r(j))]})}function $N({block:i,path:a,changed:r,readOnly:s,onPick:u}){const f=H.useMemo(()=>hf(i.raw),[i.raw]),h=`Say something about ${a}:${i.from}`;return d.jsxs("div",{className:`md-block${r?" md-block-changed":""}`,children:[!s&&d.jsx("button",{type:"button",className:"md-block-add",title:h,"aria-label":h,tabIndex:-1,onClick:u,children:d.jsx(Xe,{name:"plus"})}),d.jsx("div",{className:"md md-doc prose",dangerouslySetInnerHTML:{__html:f}})]})}function YN({path:i,doc:a,comments:r,renderComment:s,readOnly:u,chatBusy:f,onAddLineComment:h,onAskAboutLine:y,onShowDiff:g,viewedState:m}){const[b,v]=H.useState(null),_=H.useRef(null),T=H.useRef(null),S=m.viewed.has(i),C=S&&!m.peeked.has(i),A=H.useMemo(()=>{const R=new Map,$=a.items.flatMap((W,z)=>W.kind==="block"?[{item:W,i:z}]:[]),U=[];for(const W of r){const z=W.line==null?void 0:$.filter(ae=>ae.item.from<=W.line).pop()??$[0];if(!z){U.push(W);continue}R.set(z.i,[...R.get(z.i)??[],W])}return{at:R,rest:U}},[a,r]);return d.jsxs("div",{className:"md-file",ref:_,children:[d.jsxs("div",{ref:T,className:`md-file-head${S?" md-file-head-viewed":""}${C?" md-file-head-folded":""}`,onClick:R=>{S&&!R.target.closest("button, label")&&(yo(_.current,T.current),m.onTogglePeek(i))},children:[d.jsx(Xe,{name:"file"}),d.jsx("span",{className:"md-file-name",children:i}),a.isNew?d.jsx("span",{className:"tag tag-added",children:"new file"}):d.jsx("span",{className:"faint",title:"A diff carries the lines around a change, not the file.",children:"the diff's lines only — what the PR removed isn't here"}),d.jsx("span",{className:"grow"}),d.jsx("button",{className:"btn btn-sm",onClick:g,title:"Back to the line-by-line diff",children:"show the diff"}),d.jsxs("label",{className:"file-viewed",title:"Mark as viewed — folds the file until its diff changes",children:[d.jsx("input",{type:"checkbox",checked:S,onChange:()=>{S||yo(_.current,T.current),m.onToggleViewed(i)}})," ","Viewed"]})]}),!C&&A.rest.length>0&&d.jsx("div",{className:"file-comments",children:A.rest.map(s)}),!C&&a.items.map((R,$)=>d.jsxs(H.Fragment,{children:[R.kind==="gap"?d.jsxs("div",{className:"md-gap",title:"These lines are in the file but not in the diff.",children:["⋯ ",R.lines.toLocaleString()," line",R.lines===1?"":"s"," the diff skips"]}):d.jsx($N,{block:R,path:i,changed:R.changed&&!a.isNew,readOnly:u,onPick:()=>v({path:i,line:R.from,side:"new"})}),(A.at.get($)??[]).map(s),R.kind==="block"&&(b==null?void 0:b.line)===R.from&&d.jsx(Ry,{pick:b,chatBusy:f,onAdd:U=>{h(b,U),v(null)},onAsk:U=>{y(b,U),v(null)},onClose:()=>v(null)})]},$))]})}function FN({patch:i,comments:a,renderComment:r,readOnly:s,chatBusy:u,onAddLineComment:f,onAskAboutLine:h,viewedState:y}){const g=H.useMemo(()=>i.trim()?ja(i):[],[i]),m=H.useMemo(()=>new Map(g.filter(A=>pf(A.path)).map(A=>[A.path,mf(A.patch)]).filter(([,A])=>A.lines>0)),[g]),[b,v]=H.useState({}),_=A=>{var R;return b[A]??((R=m.get(A))==null?void 0:R.isNew)??!1},T=[];for(const A of g){const R=T[T.length-1];if(m.has(A.path)&&_(A.path)){T.push({kind:"read",paths:[A.path],patch:A.patch});continue}(R==null?void 0:R.kind)==="diff"?(R.paths.push(A.path),R.patch+=`
|
|
247
247
|
${A.patch}`):T.push({kind:"diff",paths:[A.path],patch:A.patch})}if(g.length===0)return d.jsx("p",{className:"muted",children:"No diff for this chapter."});const S=new Set(g.map(A=>A.path)),C=A=>a.filter(R=>A(R.path));return d.jsxs(d.Fragment,{children:[T.map(A=>{const R=new Set(A.paths);if(A.kind==="read"){const $=A.paths[0];return d.jsx(YN,{path:$,doc:m.get($),comments:C(U=>U===$),renderComment:r,readOnly:s,chatBusy:u,onAddLineComment:f,onAskAboutLine:h,onShowDiff:()=>v(U=>({...U,[$]:!1})),viewedState:y},`read:${$}`)}return d.jsx(GN,{patch:A.patch,comments:C($=>R.has($)),renderComment:r,readOnly:s,chatBusy:u,onAddLineComment:f,onAskAboutLine:h,onRead:$=>v(U=>({...U,[$]:!0})),viewedState:y},`diff:${A.paths[0]}`)}),C(A=>!S.has(A)).map(r)]})}function PN({check:i,raised:a,held:r,replies:s}){if(!i)return null;const u=[r>0&&`${r} left out`,s>0&&`${s} as replies`].filter(Boolean),f=a>0?d.jsxs("div",{className:"warn",title:"Findings another reviewer already raised on the PR — each card says who, and what Send does with it.",children:[a," already raised",u.length>0?` · ${u.join(" · ")}`:""]}):null;return i.checkingSince?d.jsxs(d.Fragment,{children:[f,d.jsx("div",{className:"faint",children:"checking what others already raised…"})]}):i.error?d.jsxs(d.Fragment,{children:[f,d.jsx("div",{className:"warn",title:i.error,children:"couldn't check what others already raised"})]}):f||(i.remarks.length>0?d.jsx("div",{className:"faint",children:"none already raised by others"}):null)}function KN({comment:i,readOnly:a,onDecide:r}){var y;const s=i.alreadyRaised;if(!s)return null;const u=kN(i,a),f=s.where.kind==="thread",h=!a&&i.status!=="dropped";return d.jsxs("div",{className:"raised",children:[d.jsxs("div",{className:"raised-head",children:[d.jsxs("span",{className:"tag tag-raised",children:[d.jsx(Xe,{name:"comment"}),"already raised by @",s.by," · ",ON(s)]}),s.url&&d.jsxs("a",{href:s.url,target:"_blank",rel:"noreferrer",className:"faint",children:["see it on GitHub ",d.jsx(Xe,{name:"external"})]}),d.jsx("span",{className:"grow"}),h&&d.jsxs(d.Fragment,{children:[f&&d.jsx("button",{className:`btn btn-sm${s.decision==="reply"?" btn-keep-on":""}`,title:"Send posts this as a reply in their thread instead of a new comment — for when it adds something",onClick:()=>r(s.decision==="reply"?null:"reply"),children:"reply in their thread"}),d.jsx("button",{className:`btn btn-sm${s.decision==="send"?" btn-keep-on":""}`,title:"Send posts it as a comment of its own all the same",onClick:()=>r(s.decision==="send"?null:"send"),children:"send anyway"})]})]}),d.jsxs("p",{className:"raised-reason",children:[s.reason,u&&d.jsxs("span",{className:"raised-fate",children:[" — ",(y=s.replied)!=null&&y.url?d.jsx("a",{href:s.replied.url,target:"_blank",rel:"noreferrer",children:u}):u,"."]})]})]})}function ky({comment:i,onUpdate:a,onDelete:r,onDiscuss:s,readOnly:u,flash:f}){const[h,y]=H.useState(!1),[g,m]=H.useState(i.body),b=i.status==="dropped",v=i.origin==="user"?"yours":b?"dropped":"drafted";return d.jsxs("div",{id:`c-${i.id}`,className:`comment comment-${i.status}${f?" comment-flash":""}`,children:[d.jsxs("div",{className:"comment-head",children:[d.jsxs("span",{className:"comment-loc",children:[i.path,i.line!=null?`:${i.line}`:""]}),d.jsx("span",{className:`tag tag-${i.origin==="user"?"yours":v}`,children:v}),i.drifted?d.jsx("span",{className:"tag tag-drift",title:"The code this comment pointed at is gone from the diff, so it can't post inline.",children:"drifted — posts in the body"}):i.line==null&&d.jsx("span",{className:"tag tag-drift",title:"A comment with no line — either about the file as a whole, or on a line the PR removed, which GitHub can't take inline.",children:"on the file — posts in the body"}),!i.drifted&&i.originalLine!=null&&i.originalLine!==i.line&&d.jsxs("span",{className:"faint",title:"This comment followed its code to a new line.",children:["was :",i.originalLine]}),d.jsx("span",{className:"grow"}),!u&&(h?d.jsxs(d.Fragment,{children:[d.jsx("button",{className:"btn btn-sm",onClick:()=>{a({body:g}),y(!1)},children:"save"}),d.jsx("button",{className:"btn btn-sm",onClick:()=>{m(i.body),y(!1)},children:"cancel"})]}):d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:"btn btn-sm",title:"Edit the wording",onClick:()=>y(!0),children:[d.jsx(Xe,{name:"edit"}),"edit"]}),d.jsxs("button",{className:`btn btn-sm${b?" btn-drop-on":""}`,title:"Drop it — stays local, never posts",onClick:()=>a({status:b?"draft":"dropped"}),children:[d.jsx(Xe,{name:"drop"}),b?"dropped":"drop"]}),s&&d.jsxs("button",{className:"btn btn-sm btn-accent",title:"Point the chat at this comment",onClick:s,children:[d.jsx(Xe,{name:"comment"}),"discuss"]}),i.origin==="user"&&d.jsx("button",{className:"btn btn-sm",title:"Delete the comment you wrote",onClick:r,children:"✕"})]}))]}),d.jsx(KN,{comment:i,readOnly:u,onDecide:_=>a({raisedDecision:_})}),h?d.jsxs(d.Fragment,{children:[d.jsx("textarea",{className:"comment-edit",value:g,onChange:_=>m(_.target.value),rows:Math.max(3,g.split(`
|
|
248
|
-
`).length)}),d.jsx(Ps,{className:"comment-body",text:fg(g,i.severity??null)})]}):d.jsx(ai,{className:"comment-body prose",text:fg(i.body,i.severity??null)})]})}function ZN({files:i,chapterId:a,onAdd:r}){const[s,u]=H.useState(!1),[f,h]=H.useState(i[0]??""),[y,g]=H.useState(""),[m,b]=H.useState("");return s?d.jsxs("div",{className:"add-comment",children:[d.jsxs("div",{className:"add-comment-row",children:[d.jsx("select",{value:f,onChange:v=>h(v.target.value),children:i.map(v=>d.jsx("option",{value:v,children:v},v))}),d.jsx("input",{placeholder:"line (optional)",value:y,onChange:v=>g(v.target.value.replace(/\D/g,"")),size:12})]}),d.jsx("textarea",{placeholder:"Your comment…",value:m,onChange:v=>b(v.target.value),rows:3}),d.jsx(Ps,{className:"comment-body",text:m}),d.jsxs("div",{className:"add-comment-row",children:[d.jsx("button",{className:"btn",disabled:!m.trim()||!f,onClick:()=>{r({path:f,line:y?Number(y):null,body:m.trim(),chapterId:a}),b(""),g(""),u(!1)},children:"add"}),d.jsx("button",{className:"btn",onClick:()=>u(!1),children:"cancel"})]})]}):d.jsxs("button",{className:"btn btn-dashed",onClick:()=>u(!0),children:[d.jsx(Xe,{name:"plus"}),"add a comment of your own"]})}const XN=2e3;function VN({chapter:i,n:a,diff:r,comments:s,open:u,heavy:f,onToggle:h,onUpdateComment:y,onDeleteComment:g,onAddComment:m,onDiscuss:b,onAskAboutLine:v,chatBusy:_,readOnly:T,anchorRef:S,flash:C,viewedState:A,sticky:R,stuck:$}){const[U,W]=H.useState(!1);H.useEffect(()=>{$||W(!1)},[$]);const z=R&&$&&u,ae=H.useRef(null),se=H.useRef(null);H.useEffect(()=>{const M=ae.current,Q=se.current;if(!R||!M||!Q)return;const pe=()=>M.style.setProperty("--chapter-head-h",`${Q.offsetHeight}px`);pe();const we=new ResizeObserver(pe);return we.observe(Q),()=>{we.disconnect(),M.style.removeProperty("--chapter-head-h")}},[R]);const x=()=>{h(),z&&requestAnimationFrame(()=>{var M;return(M=ae.current)==null?void 0:M.scrollIntoView({block:"start"})})},G=H.useMemo(()=>z_(r,i.files),[r,i.files]),ee=i.files.filter(M=>A.viewed.has(M)).length,ue=H.useMemo(()=>Ny(G,s),[G,s]),Ee=H.useMemo(()=>new Set(ja(G).map(M=>M.path)),[G]),j=s.filter(M=>!ue.includes(M)&&!Ee.has(M.path)),le=s.filter(M=>ue.includes(M)||Ee.has(M.path)),fe=M=>d.jsx(ky,{comment:M,onUpdate:Q=>y(M.id,Q),onDelete:()=>g(M.id),onDiscuss:b&&(()=>b({target:"comment",id:M.id})),readOnly:T,flash:C===M.id},M.id);return d.jsxs("section",{className:`chapter${R?" chapter-sticky":""}`,ref:M=>{ae.current=M,S(M)},children:[d.jsxs("header",{ref:se,className:`chapter-head${R?" chapter-head-sticky":""}${z?" chapter-head-stuck":""}`,onClick:x,children:[d.jsx("span",{className:"faint",children:u?"▾":"▸"}),d.jsxs("h3",{children:[a," · ",i.title]}),d.jsxs("span",{className:"faint chapter-meta",children:[i.files.length," file",i.files.length===1?"":"s",s.length>0?` · ${s.length} comment${s.length===1?"":"s"}`:" · no comments",ee>0&&` · ${ee}/${i.files.length} viewed`,f!=null&&!u&&d.jsx("span",{title:"Drawing this many lines at once would leave the page too slow to scroll. Open it if you want it — nothing else on the page is affected.",children:` · ${f.toLocaleString()} lines to draw, folded to keep the page quick`})]}),d.jsx("span",{className:"grow"}),R&&u&&d.jsx("button",{className:`btn btn-sm${z?"":" chapter-about-idle"}`,"aria-expanded":U,onClick:M=>{M.stopPropagation(),W(Q=>!Q)},children:U?"hide explanation":"what this chapter is about"}),b&&d.jsxs("button",{className:"btn btn-sm",onClick:M=>{M.stopPropagation(),b({target:"chapter",id:i.id})},children:[d.jsx(Xe,{name:"comment"}),"discuss"]}),z&&U&&d.jsx("div",{className:"chapter-head-about",onClick:M=>M.stopPropagation(),children:d.jsx(ai,{className:"prose",text:i.explanation})})]}),u&&d.jsxs("div",{className:"chapter-body",children:[d.jsx(ai,{className:"prose chapter-explanation",text:i.explanation}),j.map(fe),d.jsx(FN,{patch:G,comments:le,renderComment:fe,readOnly:T,chatBusy:_,onAddLineComment:(M,Q)=>m({path:M.path,line:M.side==="new"?M.line:null,body:Q,chapterId:i.id}),onAskAboutLine:v,viewedState:A}),!T&&i.files.length>0&&d.jsx(ZN,{files:i.files,chapterId:i.id,onAdd:m})]})]})}function QN(i,a){switch(i.kind){case"summary":return"rewrote the summary";case"verdict":return`changed the verdict to ${i.verdict.recommendation.replace("_"," ")}`;case"chapter":{const r=a.chapters.find(s=>s.id===i.chapterId);return`rewrote the "${(r==null?void 0:r.title)??i.chapterId}" chapter`}case"comment-edit":{const r=a.comments.find(s=>s.id===i.commentId);return r?`rewrote the comment on ${r.path}:${r.line??"file"}`:"rewrote a comment"}case"comment-drop":{const r=a.comments.find(s=>s.id===i.commentId);return r?`dropped the comment on ${r.path}:${r.line??"file"}`:"dropped a comment"}case"comment-add":return`added a comment on ${i.path}:${i.line??"file"}`}}function Fd(i,a){var s;if(i.target==="summary")return"the summary";if(i.target==="verdict")return"the verdict";if(i.target==="chapter")return((s=a.chapters.find(u=>u.id===i.id))==null?void 0:s.title)??"a chapter";if(i.target==="line")return i.path==null||i.line==null?"a line of the diff":`${i.path}:${i.line}${i.side==="old"?" (removed)":""}`;const r=a.comments.find(u=>u.id===i.id);return r?`${r.path}:${r.line??"file"}`:"a comment"}function WN({turn:i,artifact:a}){return d.jsxs("div",{className:`chat-turn chat-turn-${i.role}`,children:[d.jsx("div",{className:"chat-turn-who",children:i.role==="user"?i.steer?"You, while it worked":"You":"Reviewer"}),i.refs.length>0&&d.jsx("div",{className:"chat-refs",children:i.refs.map((r,s)=>d.jsx("span",{className:"chat-ref",children:Fd(r,a)},s))}),d.jsx(ai,{className:"chat-turn-body prose",text:i.body}),i.revisions.map((r,s)=>d.jsxs("div",{className:"chat-revision",children:["↳ ",QN(r,a)]},s)),i.refused.map((r,s)=>d.jsxs("div",{className:"chat-refusal",title:r.reason,children:["⃠ left alone — ",r.reason]},s))]})}function JN({artifact:i,reviewKey:a,refs:r,onClearRefs:s,onDropRef:u,onArtifact:f,readOnly:h,inputRef:y,anchorRef:g}){var Ee;const[m,b]=H.useState(""),[v,_]=H.useState(!1),[T,S]=H.useState(null),[C]=Ty(),A=i.chat??[],R=i.pendingChat??null,$=R!=null&&R.error==null,U=v||$,W=H.useRef(null),z=H.useRef(!0),ae=()=>{const j=W.current;j&&(j.scrollTop=j.scrollHeight)},se=R!=null;H.useLayoutEffect(()=>{z.current=!0,ae()},[a,A.length,se,(Ee=R==null?void 0:R.steers)==null?void 0:Ee.length,R==null?void 0:R.error]),H.useLayoutEffect(()=>{z.current&&ae()},[R==null?void 0:R.progress.length]);const x=A.length>0||se;H.useEffect(()=>{const j=W.current;if(!j)return;const le=new ResizeObserver(()=>z.current&&ae());return le.observe(j),()=>le.disconnect()},[x]);const G=(j,le,fe)=>{!j||U||(_(!0),S(null),Dd(a,{message:j,refs:le}).then(M=>{f(M),fe==null||fe()}).catch(M=>S(String(M.message??M))).finally(()=>_(!1)))},ee=j=>{_(!0),S(null),E0(a,j).then(le=>{var fe;f(le),b(""),(fe=y.current)==null||fe.focus()}).catch(le=>S(String(le.message??le))).finally(()=>_(!1))},ue=()=>{const j=m.trim();if(!(!j||v)){if($)return ee(j);G(j,r,()=>{var le;b(""),s(),(le=y.current)==null||le.focus()})}};return d.jsxs("section",{className:"card chat-panel",ref:g,children:[d.jsxs("header",{className:"card-head",children:[d.jsx("h2",{children:"talk to the reviewer"}),d.jsx("span",{className:"faint",children:"it revises the draft as you go · nothing here reaches GitHub — only send does"})]}),d.jsxs("div",{className:"card-body",children:[x&&d.jsxs("div",{className:"chat-log",ref:W,onScroll:j=>{const le=j.currentTarget;z.current=le.scrollHeight-le.scrollTop-le.clientHeight<24},children:[A.map(j=>d.jsx(WN,{turn:j,artifact:i},j.id)),R&&d.jsxs("div",{className:"chat-turn chat-turn-user chat-turn-pending",children:[d.jsx("div",{className:"chat-turn-who",children:"You"}),R.refs.length>0&&d.jsx("div",{className:"chat-refs",children:R.refs.map((j,le)=>d.jsx("span",{className:"chat-ref",children:Fd(j,i)},le))}),d.jsx(ai,{className:"chat-turn-body prose",text:R.message}),
|
|
248
|
+
`).length)}),d.jsx(Ps,{className:"comment-body",text:fg(g,i.severity??null)})]}):d.jsx(ai,{className:"comment-body prose",text:fg(i.body,i.severity??null)})]})}function ZN({files:i,chapterId:a,onAdd:r}){const[s,u]=H.useState(!1),[f,h]=H.useState(i[0]??""),[y,g]=H.useState(""),[m,b]=H.useState("");return s?d.jsxs("div",{className:"add-comment",children:[d.jsxs("div",{className:"add-comment-row",children:[d.jsx("select",{value:f,onChange:v=>h(v.target.value),children:i.map(v=>d.jsx("option",{value:v,children:v},v))}),d.jsx("input",{placeholder:"line (optional)",value:y,onChange:v=>g(v.target.value.replace(/\D/g,"")),size:12})]}),d.jsx("textarea",{placeholder:"Your comment…",value:m,onChange:v=>b(v.target.value),rows:3}),d.jsx(Ps,{className:"comment-body",text:m}),d.jsxs("div",{className:"add-comment-row",children:[d.jsx("button",{className:"btn",disabled:!m.trim()||!f,onClick:()=>{r({path:f,line:y?Number(y):null,body:m.trim(),chapterId:a}),b(""),g(""),u(!1)},children:"add"}),d.jsx("button",{className:"btn",onClick:()=>u(!1),children:"cancel"})]})]}):d.jsxs("button",{className:"btn btn-dashed",onClick:()=>u(!0),children:[d.jsx(Xe,{name:"plus"}),"add a comment of your own"]})}const XN=2e3;function VN({chapter:i,n:a,diff:r,comments:s,open:u,heavy:f,onToggle:h,onUpdateComment:y,onDeleteComment:g,onAddComment:m,onDiscuss:b,onAskAboutLine:v,chatBusy:_,readOnly:T,anchorRef:S,flash:C,viewedState:A,sticky:R,stuck:$}){const[U,W]=H.useState(!1);H.useEffect(()=>{$||W(!1)},[$]);const z=R&&$&&u,ae=H.useRef(null),se=H.useRef(null);H.useEffect(()=>{const M=ae.current,Q=se.current;if(!R||!M||!Q)return;const pe=()=>M.style.setProperty("--chapter-head-h",`${Q.offsetHeight}px`);pe();const we=new ResizeObserver(pe);return we.observe(Q),()=>{we.disconnect(),M.style.removeProperty("--chapter-head-h")}},[R]);const x=()=>{h(),z&&requestAnimationFrame(()=>{var M;return(M=ae.current)==null?void 0:M.scrollIntoView({block:"start"})})},G=H.useMemo(()=>z_(r,i.files),[r,i.files]),ee=i.files.filter(M=>A.viewed.has(M)).length,ue=H.useMemo(()=>Ny(G,s),[G,s]),Ee=H.useMemo(()=>new Set(ja(G).map(M=>M.path)),[G]),j=s.filter(M=>!ue.includes(M)&&!Ee.has(M.path)),le=s.filter(M=>ue.includes(M)||Ee.has(M.path)),fe=M=>d.jsx(ky,{comment:M,onUpdate:Q=>y(M.id,Q),onDelete:()=>g(M.id),onDiscuss:b&&(()=>b({target:"comment",id:M.id})),readOnly:T,flash:C===M.id},M.id);return d.jsxs("section",{className:`chapter${R?" chapter-sticky":""}`,ref:M=>{ae.current=M,S(M)},children:[d.jsxs("header",{ref:se,className:`chapter-head${R?" chapter-head-sticky":""}${z?" chapter-head-stuck":""}`,onClick:x,children:[d.jsx("span",{className:"faint",children:u?"▾":"▸"}),d.jsxs("h3",{children:[a," · ",i.title]}),d.jsxs("span",{className:"faint chapter-meta",children:[i.files.length," file",i.files.length===1?"":"s",s.length>0?` · ${s.length} comment${s.length===1?"":"s"}`:" · no comments",ee>0&&` · ${ee}/${i.files.length} viewed`,f!=null&&!u&&d.jsx("span",{title:"Drawing this many lines at once would leave the page too slow to scroll. Open it if you want it — nothing else on the page is affected.",children:` · ${f.toLocaleString()} lines to draw, folded to keep the page quick`})]}),d.jsx("span",{className:"grow"}),R&&u&&d.jsx("button",{className:`btn btn-sm${z?"":" chapter-about-idle"}`,"aria-expanded":U,onClick:M=>{M.stopPropagation(),W(Q=>!Q)},children:U?"hide explanation":"what this chapter is about"}),b&&d.jsxs("button",{className:"btn btn-sm",onClick:M=>{M.stopPropagation(),b({target:"chapter",id:i.id})},children:[d.jsx(Xe,{name:"comment"}),"discuss"]}),z&&U&&d.jsx("div",{className:"chapter-head-about",onClick:M=>M.stopPropagation(),children:d.jsx(ai,{className:"prose",text:i.explanation})})]}),u&&d.jsxs("div",{className:"chapter-body",children:[d.jsx(ai,{className:"prose chapter-explanation",text:i.explanation}),j.map(fe),d.jsx(FN,{patch:G,comments:le,renderComment:fe,readOnly:T,chatBusy:_,onAddLineComment:(M,Q)=>m({path:M.path,line:M.side==="new"?M.line:null,body:Q,chapterId:i.id}),onAskAboutLine:v,viewedState:A}),!T&&i.files.length>0&&d.jsx(ZN,{files:i.files,chapterId:i.id,onAdd:m})]})]})}function QN(i,a){switch(i.kind){case"summary":return"rewrote the summary";case"verdict":return`changed the verdict to ${i.verdict.recommendation.replace("_"," ")}`;case"chapter":{const r=a.chapters.find(s=>s.id===i.chapterId);return`rewrote the "${(r==null?void 0:r.title)??i.chapterId}" chapter`}case"comment-edit":{const r=a.comments.find(s=>s.id===i.commentId);return r?`rewrote the comment on ${r.path}:${r.line??"file"}`:"rewrote a comment"}case"comment-drop":{const r=a.comments.find(s=>s.id===i.commentId);return r?`dropped the comment on ${r.path}:${r.line??"file"}`:"dropped a comment"}case"comment-add":return`added a comment on ${i.path}:${i.line??"file"}`}}function Fd(i,a){var s;if(i.target==="summary")return"the summary";if(i.target==="verdict")return"the verdict";if(i.target==="chapter")return((s=a.chapters.find(u=>u.id===i.id))==null?void 0:s.title)??"a chapter";if(i.target==="line")return i.path==null||i.line==null?"a line of the diff":`${i.path}:${i.line}${i.side==="old"?" (removed)":""}`;const r=a.comments.find(u=>u.id===i.id);return r?`${r.path}:${r.line??"file"}`:"a comment"}function WN({turn:i,artifact:a}){return d.jsxs("div",{className:`chat-turn chat-turn-${i.role}`,children:[d.jsx("div",{className:"chat-turn-who",children:i.role==="user"?i.steer?"You, while it worked":"You":"Reviewer"}),i.refs.length>0&&d.jsx("div",{className:"chat-refs",children:i.refs.map((r,s)=>d.jsx("span",{className:"chat-ref",children:Fd(r,a)},s))}),d.jsx(ai,{className:"chat-turn-body prose",text:i.body}),i.revisions.map((r,s)=>d.jsxs("div",{className:"chat-revision",children:["↳ ",QN(r,a)]},s)),i.refused.map((r,s)=>d.jsxs("div",{className:"chat-refusal",title:r.reason,children:["⃠ left alone — ",r.reason]},s))]})}function JN({artifact:i,reviewKey:a,refs:r,onClearRefs:s,onDropRef:u,onArtifact:f,readOnly:h,inputRef:y,anchorRef:g}){var Ee;const[m,b]=H.useState(""),[v,_]=H.useState(!1),[T,S]=H.useState(null),[C]=Ty(),A=i.chat??[],R=i.pendingChat??null,$=R!=null&&R.error==null,U=v||$,W=H.useRef(null),z=H.useRef(!0),ae=()=>{const j=W.current;j&&(j.scrollTop=j.scrollHeight)},se=R!=null;H.useLayoutEffect(()=>{z.current=!0,ae()},[a,A.length,se,(Ee=R==null?void 0:R.steers)==null?void 0:Ee.length,R==null?void 0:R.error]),H.useLayoutEffect(()=>{z.current&&ae()},[R==null?void 0:R.progress.length]);const x=A.length>0||se;H.useEffect(()=>{const j=W.current;if(!j)return;const le=new ResizeObserver(()=>z.current&&ae());return le.observe(j),()=>le.disconnect()},[x]);const G=(j,le,fe)=>{!j||U||(_(!0),S(null),Dd(a,{message:j,refs:le}).then(M=>{f(M),fe==null||fe()}).catch(M=>S(String(M.message??M))).finally(()=>_(!1)))},ee=j=>{_(!0),S(null),E0(a,j).then(le=>{var fe;f(le),b(""),(fe=y.current)==null||fe.focus()}).catch(le=>S(String(le.message??le))).finally(()=>_(!1))},ue=()=>{const j=m.trim();if(!(!j||v)){if($)return ee(j);G(j,r,()=>{var le;b(""),s(),(le=y.current)==null||le.focus()})}};return d.jsxs("section",{className:"card chat-panel",ref:g,children:[d.jsxs("header",{className:"card-head",children:[d.jsx("h2",{children:"talk to the reviewer"}),d.jsx("span",{className:"faint",children:"it revises the draft as you go · nothing here reaches GitHub — only send does"})]}),d.jsxs("div",{className:"card-body",children:[x&&d.jsxs("div",{className:"chat-log",ref:W,onScroll:j=>{const le=j.currentTarget;z.current=le.scrollHeight-le.scrollTop-le.clientHeight<24},children:[A.map(j=>d.jsx(WN,{turn:j,artifact:i},j.id)),R&&d.jsxs("div",{className:"chat-turn chat-turn-user chat-turn-pending",children:[d.jsx("div",{className:"chat-turn-who",children:"You"}),R.refs.length>0&&d.jsx("div",{className:"chat-refs",children:R.refs.map((j,le)=>d.jsx("span",{className:"chat-ref",children:Fd(j,i)},le))}),d.jsx(ai,{className:"chat-turn-body prose",text:R.message}),(R.steers??[]).map((j,le)=>d.jsxs("div",{className:"chat-steer",children:[d.jsx("div",{className:"chat-turn-who",children:"You, while it worked"}),d.jsx(ai,{className:"chat-turn-body prose",text:j})]},le)),R.error?d.jsxs("div",{className:"chat-failed",children:["✕ this turn didn't finish — ",R.error,!h&&d.jsxs(d.Fragment,{children:[" ",d.jsx("button",{className:"btn btn-sm",onClick:()=>G([R.message,...R.steers??[]].join(`
|
|
249
249
|
|
|
250
250
|
`),R.refs),children:"ask again"})," ",d.jsx("button",{className:"btn btn-sm",onClick:()=>_0(a).then(f).catch(j=>S(String(j.message??j))),children:"dismiss"})]})]}):d.jsx("div",{className:"chat-waiting",children:R.progress.length>0?d.jsx("ol",{className:"chat-progress",children:R.progress.map((j,le)=>d.jsx("li",{className:le===R.progress.length-1?"now":void 0,children:j},le))}):"Thinking… it re-reads the code before answering."})]})]}),h?d.jsx("p",{className:"faint",children:"This review was sent — the conversation is kept as a record, but it can't continue."}):d.jsxs(d.Fragment,{children:[r.length>0&&d.jsxs("div",{className:"chat-refs chat-refs-pending",children:[d.jsx("span",{className:"faint",children:"about:"}),r.map((j,le)=>d.jsxs("button",{className:"chat-ref",onClick:()=>u(le),title:"Remove",children:[Fd(j,i)," ✕"]},le))]}),d.jsx("textarea",{ref:y,className:"chat-input",rows:2,value:m,readOnly:v,placeholder:$?"steer it — it reads this before its next step":A.length===0?"the summary restates the author's claims — say what you actually verified":"say more…",onChange:j=>b(j.target.value),title:C==="enter"?"Enter sends · Shift+Enter for a new line":"⌘↵ sends · Enter for a new line",onKeyDown:j=>{zN(C,{...j,isComposing:j.nativeEvent.isComposing})&&(j.preventDefault(),ue())}}),d.jsx(Ps,{className:"chat-turn-body",text:m}),d.jsxs("div",{className:"chat-actions",children:[d.jsxs("button",{className:"btn btn-dark",onClick:ue,disabled:v||m.trim()==="",title:$?"Add this to the turn it's working on":void 0,children:[d.jsx(Xe,{name:"send"}),v?"sending…":$?"steer":"send message",d.jsx(za,{children:C==="enter"?"↵":"⌘↵"})]}),d.jsx("span",{className:"grow"}),i.preChat&&d.jsx("button",{className:"btn btn-sm",disabled:U,title:"Put the review back the way the AI first wrote it. The conversation stays.",onClick:()=>{_(!0),S0(a).then(f).catch(j=>S(String(j.message??j))).finally(()=>_(!1))},children:"reset the review"})]})]}),T&&d.jsx("div",{className:"error",children:T})]})]})}function Oy(i){const a=H.useRef(null),r=H.useCallback(()=>{const s=a.current;s&&(s.style.height="auto",s.style.height=`${Math.min(s.scrollHeight+2,window.innerHeight*.7)}px`)},[]);return H.useEffect(r,[i,r]),H.useEffect(()=>(window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)),[r]),a}function ex({initial:i,onSave:a,onCancel:r}){const[s,u]=H.useState(i),[f,h]=H.useState(!1),[y,g]=H.useState(null),m=Oy(s),b=()=>{f||(h(!0),g(null),a(s).catch(v=>{g(String((v==null?void 0:v.message)??v)),h(!1)}))};return d.jsxs("div",{className:"body-edit-wrap",children:[d.jsx("textarea",{ref:m,className:"body-edit",autoFocus:!0,value:s,onChange:v=>u(v.target.value),rows:10,onKeyDown:v=>{v.key==="Enter"&&(v.metaKey||v.ctrlKey)&&(v.preventDefault(),b()),v.key==="Escape"&&!f&&r()}}),d.jsx(Ps,{className:"body-md",text:s}),y&&d.jsx("p",{className:"error",children:y}),d.jsxs("div",{className:"card-actions",children:[d.jsxs("button",{className:"btn btn-sm",onClick:b,disabled:f,children:[f?"saving…":"save this body",d.jsx(za,{children:"⌘↵"})]}),d.jsx("button",{className:"btn btn-sm",onClick:r,disabled:f,children:"cancel"}),d.jsx("span",{className:"faint",children:"this is exactly what posts — the review above stays as it reads"})]})]})}const tx=i=>i?`@${i} — handing this review over to you.`:"";function nx({artifact:i,reviewKey:a,onConfirm:r,onCancel:s}){const[u]=H.useState(ly),[f,h]=H.useState(""),[y,g]=H.useState(""),[m,b]=H.useState(!1),[v,_]=H.useState(!1),[T,S]=H.useState(null),[C,A]=H.useState(null),[R,$]=H.useState(null),[U,W]=H.useState(!1),[z,ae]=H.useState(null),[se,x]=H.useState(null),[G,ee]=H.useState(!1),[ue,Ee]=H.useState(-1),j=Oy(y),le=H.useRef(null),fe=Ld(f),M=iy(fe),Q=i.summary!==""||i.comments.length>0,pe=!Ab(i)&&Q,we=Ab(i)&&i.sent==null&&Q,De=U?JSON.stringify([i.bodyOverride,i.summary,i.chapters.map(X=>[X.title,X.explanation]),i.comments.map(X=>{var be,xe;return[X.path,X.line,X.body,X.severity,X.status,X.drifted,(be=X.alreadyRaised)==null?void 0:be.decision,(xe=X.alreadyRaised)==null?void 0:xe.where]})]):"";H.useEffect(()=>{if(!U)return;let X=!1;return x(null),ae(null),ty(a,"COMMENT").then(be=>!X&&ae(be)).catch(be=>{X||(ae(null),x(String((be==null?void 0:be.message)??be)))}),()=>{X=!0}},[U,a,De]);const w=!U||z!=null;H.useEffect(()=>{var X;ue<0||(X=document.getElementById(`handoff-option-${ue}`))==null||X.scrollIntoView({block:"nearest"})},[ue]);const L=H.useMemo(()=>L0(C??[],u),[C,u]),I=H.useMemo(()=>z0(L,f),[L,f]);H.useEffect(()=>{let X=!1;return x0(a).then(be=>!X&&A(be.logins)).catch(be=>!X&&$(String((be==null?void 0:be.message)??be))),()=>{X=!0}},[a]);const oe=X=>{h(X),m||g(tx(Ld(X)))},me=X=>{oe(X),ee(!1),Ee(-1)};H.useLayoutEffect(()=>{var X;(X=le.current)==null||X.showModal()},[]);const ve=()=>{v||!M||!w||(_(!0),S(null),r(fe,y.trim(),U).catch(X=>{S(String((X==null?void 0:X.message)??X)),_(!1)}))};return d.jsx("dialog",{className:"handoff-dialog",ref:le,"aria-label":`Hand off ${i.id}`,onCancel:X=>{X.preventDefault(),v||s()},onClick:X=>{X.target===le.current&&!v&&s()},children:d.jsxs("div",{className:"handoff-body",children:[d.jsxs("div",{className:"send-top",children:[d.jsx("span",{className:"lab",children:"hand off"}),d.jsx("span",{className:"grow"}),d.jsx("span",{className:"faint",children:i.id})]}),d.jsxs("div",{className:"handoff-who",children:[d.jsx("span",{className:"handoff-at",children:"@"}),d.jsxs("div",{className:"handoff-combo",children:[d.jsx("input",{className:"handoff-login",autoFocus:!0,value:f,spellCheck:!1,placeholder:"github login",role:"combobox","aria-expanded":G&&I.length>0,"aria-controls":"handoff-options","aria-autocomplete":"list","aria-activedescendant":ue>=0?`handoff-option-${ue}`:void 0,onFocus:()=>ee(!0),onBlur:()=>ee(!1),onChange:X=>{oe(X.target.value),ee(!0),Ee(0)},onKeyDown:X=>{const be=G&&I.length>0;if(X.key==="ArrowDown"||X.key==="ArrowUp"){if(X.preventDefault(),!be)return ee(!0);const xe=X.key==="ArrowDown"?1:-1;Ee(Ge=>(Ge+xe+I.length)%I.length);return}if(X.key==="Enter"){const xe=be&&ue>=0?I[ue]:void 0;xe&&xe.login.toLowerCase()!==fe.toLowerCase()?me(xe.login):ve();return}X.key==="Escape"&&be&&(X.preventDefault(),ee(!1),Ee(-1))}}),G&&I.length>0&&d.jsx("ul",{className:"handoff-options",id:"handoff-options",role:"listbox",children:I.map((X,be)=>d.jsxs("li",{id:`handoff-option-${be}`,role:"option","aria-selected":be===ue,className:be===ue?"on":void 0,onMouseEnter:()=>Ee(be),onMouseDown:xe=>{xe.preventDefault(),me(X.login)},children:[d.jsxs("span",{className:"handoff-option-login",children:["@",X.login]}),X.recent&&d.jsx("span",{className:"faint",children:"handed to before"})]},X.login))})]})]}),R&&d.jsx("p",{className:"faint handoff-who-note",children:"cerber could not read who this repo takes reviews from — type the login instead."}),d.jsx("textarea",{ref:j,className:"body-edit",rows:2,value:y,onChange:X=>{b(!0),g(X.target.value)},onKeyDown:X=>{X.key==="Enter"&&(X.metaKey||X.ctrlKey)&&(X.preventDefault(),ve())}}),d.jsxs("div",{className:"body-source",children:[d.jsx("span",{className:"faint",children:y.trim()?"goes on the PR as a plain comment, not a review":"nothing will be posted — only the review request moves"}),y.trim()!==""&&d.jsx("button",{className:"link",onClick:()=>{b(!0),g("")},disabled:v,children:"post no note"})]}),we&&d.jsx("p",{className:"faint handoff-says",children:"You already reviewed this PR, so this draft can't ride along — a handoff that carried it would be your second review. Send it yourself if that is what you mean."}),pe&&d.jsxs("div",{className:"handoff-with-review",children:[d.jsxs("label",{children:[d.jsx("input",{type:"checkbox",checked:U,disabled:v,onChange:X=>W(X.target.checked)}),d.jsxs("span",{children:["also post the review — ",d.jsx("span",{className:"faint",children:$d(i)})]})]}),U&&d.jsxs(d.Fragment,{children:[d.jsxs("p",{className:"faint",children:["Posts as a ",d.jsx("strong",{children:"comment"}),", never an approval or a change request: you are handing over the verdict, so it is @",M?fe:"them","'s to make. The findings keep their grades."]}),se?d.jsxs("p",{className:"error",children:["cerber could not build the body this would post, so it will not post one:"," ",se]}):z?d.jsx("pre",{className:"body-preview",children:z.body}):d.jsx("p",{className:"faint",children:"building the body…"})]})]}),T&&d.jsx("p",{className:"error",children:T}),d.jsxs("p",{className:"faint handoff-says",children:[M?d.jsxs(d.Fragment,{children:["@",fe]}):"They"," will be asked for this review and you will be taken off it."," ",U?"This row goes under sent, with the review on the PR.":i.sent?"This row stays under sent.":"This row is filed under settled, and comes back if anybody asks you again."]}),d.jsxs("div",{className:"card-actions",children:[d.jsxs("button",{className:"btn btn-sm",onClick:ve,disabled:v||!M||!w,children:[d.jsx(Xe,{name:"arrowRight"}),v?"handing over…":M?`hand off to @${fe}`:"hand off",d.jsx(za,{children:"⌘↵"})]}),d.jsx("button",{className:"btn btn-sm",onClick:s,disabled:v,children:"cancel"})]})]})})}function ax({artifact:i,reviewKey:a,event:r,own:s,sending:u,checking:f,onSend:h,error:y,footer:g,next:m,onAdvance:b,onBody:v,anchorRef:_}){const[T,S]=H.useState(null),[C,A]=H.useState(null),[R,$]=H.useState(i.bodyOverride!=null),[U,W]=H.useState(!1),z=i.bodyOverride!=null,ae=i.priorSends??[];H.useEffect(()=>{z&&$(!0)},[z]);const se=R&&!U?JSON.stringify([i.bodyOverride,i.summary,i.chapters.map(x=>[x.title,x.explanation]),i.comments.map(x=>{var G,ee;return[x.path,x.line,x.body,x.severity,x.status,x.drifted,(G=x.alreadyRaised)==null?void 0:G.decision,(ee=x.alreadyRaised)==null?void 0:ee.where]})]):"";return H.useEffect(()=>{if(!R||U)return;let x=!1;return S(null),A(null),ty(a,r).then(G=>{x||(S(G),A(null))}).catch(G=>{x||A(String(G))}),()=>{x=!0}},[a,r,se,R,U]),i.sent?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"sent-strip",ref:_,children:[d.jsxs("strong",{children:["✔ sent as ",Gd[i.sent.event]]}),d.jsxs("span",{className:"faint",children:[new Date(i.sent.at).toLocaleString()," · ",$d(i),i.sent.auto?" · auto-sent by the daemon":"",ae.length>0?` · review ${Rb(i)} on this PR`:""]}),d.jsx("span",{className:"grow"}),i.sent.url&&d.jsxs("a",{href:i.sent.url,target:"_blank",rel:"noreferrer",children:["view on GitHub ",d.jsx(Xe,{name:"external"})]}),d.jsxs("button",{className:"btn",onClick:b,children:[m?`next review: ${m.pr.repo}#${m.pr.number}`:"back to the queue",d.jsx(Xe,{name:"arrowRight"})]})]}),d.jsx("div",{className:"post-actions",children:g})]}):d.jsxs("div",{className:"send-panel",ref:_,children:[d.jsxs("div",{className:"send-top",children:[d.jsx("span",{className:"lab",children:"send to github"}),d.jsx("span",{className:"grow"}),d.jsx("span",{className:"faint",children:$d(i)}),d.jsxs("button",{className:"link",onClick:()=>$(!R),disabled:U,title:U?"save or cancel the body you are writing first":void 0,children:[d.jsx(Xe,{name:"eye"}),R?"hide what gets posted":"see what gets posted"]})]}),s&&wy(i.verdict)!=="COMMENT"&&d.jsx("p",{className:"send-note",children:"This is your own PR, and GitHub takes no approve or change request from its author — so it posts as a comment."}),ae.length>0&&d.jsxs("p",{className:"send-note",children:["This posts review ",Rb(i)+1," on this PR. What you sent before stays on GitHub — a new one sits beside it rather than replacing it."]}),d.jsx("div",{className:"send-action",children:d.jsxs("button",{className:`send-btn tone-bg-${AN[r]}`,disabled:u||f,onClick:h,children:[d.jsx(Xe,{name:r==="APPROVE"?"approve":r==="COMMENT"?"comment":"changes",size:15}),u?"sending…":f?"checking what others already raised…":`${Gd[r]} on ${i.id}`," ",d.jsx(za,{children:"s"})]})}),y&&d.jsx("p",{className:"error",children:y}),R&&d.jsxs(d.Fragment,{children:[C&&d.jsx("p",{className:"error",children:C}),T?U?d.jsx(ex,{initial:T.body,onSave:x=>v(x).then(()=>W(!1)),onCancel:()=>W(!1)}):d.jsxs(d.Fragment,{children:[d.jsx("pre",{className:"body-preview",children:T.body}),d.jsxs("div",{className:"body-source",children:[z?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"faint",children:"you wrote this body — it no longer follows the summary or the comments"}),d.jsx("button",{className:"link",onClick:()=>v(null).catch(x=>A(String((x==null?void 0:x.message)??x))),children:"build it from the review again"})]}):d.jsx("span",{className:"faint",children:"built from the summary, the walkthrough and the folded comments"}),d.jsxs("button",{className:"link",onClick:()=>W(!0),children:[d.jsx(Xe,{name:"edit"}),z?"keep editing it":"write it yourself"]})]})]}):!C&&d.jsx("p",{className:"faint",children:"building the body…"})]}),d.jsx("div",{className:"send-footer",children:g})]})}function Mb({sends:i}){const a=i[i.length-1],r=i.length===1,s=f=>new Date(f).toLocaleDateString(),u=Gd[a.event];return d.jsxs("div",{children:[d.jsxs("strong",{children:["You already sent ",r?"a review":`${i.length} reviews`," on this PR",r?"":", the last"," on ",s(a.at),r?` — ${u}`:` as ${u}`,"."]})," ",a.url?d.jsx("a",{href:a.url,target:"_blank",rel:"noreferrer",children:r?"It is still on GitHub":"The last is still on GitHub"}):r?"It is still on GitHub":"The last is still on GitHub",", untouched by the draft below — a re-review replaces what cerber holds, never what was posted. Sending this one would be review ",i.length+1,"."]})}function ix({filed:i}){var s,u,f;const a=((s=i.review)==null?void 0:s.url)??((u=i.reply)==null?void 0:u.url)??null,r=h=>new Date(h).toLocaleDateString();return i.reason==="own-reply"&&i.reply?d.jsxs("div",{children:[d.jsxs("strong",{children:["You answered on this PR on ",r(i.reply.at),", and nobody has replied since."]})," ","So cerber filed this draft under settled: GitHub does not count a"," ",a?d.jsx("a",{href:a,target:"_blank",rel:"noreferrer",children:"comment"}):"comment"," ","as a review, but the PR is with its author either way. Nothing here was changed or sent — the draft is still yours to send."]}):i.reason==="request-withdrawn"?d.jsxs("div",{children:[d.jsx("strong",{children:"Nobody is asking for this review any more."})," The request that put this PR in the inbox was taken back on or before ",r(i.at),", and you had said nothing on the PR, so cerber filed the draft under settled rather than leaving it out for you. Nothing here was changed or sent — the draft is still yours to send."]}):d.jsxs("div",{children:[d.jsxs("strong",{children:["You reviewed this PR on GitHub on ",r(((f=i.review)==null?void 0:f.at)??i.at),"."]})," ","So cerber filed this draft under settled, GitHub having stopped asking you for a review and shown one of your own"," ",a?d.jsx("a",{href:a,target:"_blank",rel:"noreferrer",children:"already on the PR"}):"already on the PR",". Nothing here was changed or sent — the draft is still yours to send."]})}function lx({entries:i,open:a,onToggle:r,anchorRef:s}){const u=f=>{const h=new Date(f);return Number.isNaN(h.getTime())?f:`${h.toLocaleDateString(void 0,{month:"short",day:"2-digit"})} ${h.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}`};return d.jsxs("section",{className:"card",ref:s,children:[d.jsxs("header",{className:"card-head",children:[d.jsx("h2",{children:"history"}),d.jsx("span",{className:"faint",children:i.length>0?`${i.length} entr${i.length===1?"y":"ies"} — what cerber did to this row, and when`:"nothing recorded"}),d.jsx("span",{className:"grow"}),d.jsxs("button",{className:"btn btn-sm","aria-expanded":a,onClick:r,children:[d.jsx(Xe,{name:a?"up":"down",size:12}),a?"hide":"show"]})]}),a&&d.jsx("div",{className:"card-body",children:i.length===0?d.jsx("div",{className:"faint",children:"This review predates cerber keeping a history — it starts at the next thing that happens to it."}):d.jsx("ol",{className:"history",children:i.map((f,h)=>({e:f,i:h})).reverse().map(({e:f,i:h})=>d.jsxs("li",{className:"history-row",title:f.at,children:[d.jsx("span",{className:"history-at",children:u(f.at)}),d.jsx("span",{className:"history-by",children:f.by}),d.jsx("span",{className:"history-what",children:f.what}),f.cause&&d.jsx("span",{className:"history-cause",children:f.cause})]},`${h}-${f.at}`))})})]})}function sx({handoff:i,sent:a,hasDraft:r}){const s=new Date(i.at).toLocaleDateString();return d.jsxs("div",{children:[d.jsxs("strong",{children:["You handed this to @",i.to," on ",s,"."]})," ","GitHub asks them for this review now",i.withdrewYours?" and no longer asks you":" — but cerber could not take your own request off, so it is asking both of you","."," ",i.note?i.note.url?d.jsxs(d.Fragment,{children:["A"," ",d.jsx("a",{href:i.note.url,target:"_blank",rel:"noreferrer",children:"note"})," ","on the PR says so."]}):d.jsx(d.Fragment,{children:"A note on the PR says so."}):d.jsx(d.Fragment,{children:"No note was posted — only the request moved."})," ",a?d.jsx(d.Fragment,{children:"Your review of it is on the PR — the draft below is what went."}):r?d.jsx(d.Fragment,{children:"The draft below was never sent. It is still yours to read, or to send."}):d.jsx(d.Fragment,{children:"Nothing was drafted here, and nothing was sent."})]})}function rx({artifact:i,freshness:a,rerunning:r,onRerun:s}){const u=i.status==="running",f=(a==null?void 0:a.prState)??i.pr.state,h=f==="CLOSED"||f==="MERGED",y=i.refresh,g=a!=null&&a.changed?y:null,m=!h&&RN(i,a)?i.sent:null;if(u)return d.jsxs("div",{className:"freshness",children:[(i.sent?[]:i.priorSends??[]).length>0&&d.jsx(Mb,{sends:i.priorSends??[]}),d.jsxs("div",{className:"freshness-running",children:[d.jsx("strong",{children:"Re-reviewing…"})," Claude is reading the current head. This page updates itself when the run lands — it takes a few minutes."]})]});const b=i.filed,v=i.handoff,_=i.sent?[]:i.priorSends??[];return!h&&!g&&!m&&!b&&!v&&_.length===0?null:d.jsxs("div",{className:"freshness",children:[_.length>0&&d.jsx(Mb,{sends:_}),v&&d.jsx(sx,{handoff:v,sent:i.sent,hasDraft:i.summary!==""||i.comments.length>0}),b&&d.jsx(ix,{filed:b}),h&&d.jsxs("div",{children:[d.jsxs("strong",{children:["This PR is ",f==="MERGED"?"merged":"closed","."]})," A review can still be sent, but nobody is waiting for it."]}),g&&d.jsxs("div",{children:[d.jsx("strong",{children:"The PR moved on since this review."})," Now at"," ",d.jsx("code",{children:g.toSha.slice(0,7)}),", reviewed at"," ",d.jsx("code",{children:g.fromSha.slice(0,7)}),"."," ",g.moved>0&&d.jsxs(d.Fragment,{children:[g.moved," comment(s) followed the code. "]}),g.drifted>0&&d.jsxs(d.Fragment,{children:[g.drifted," could not — the code they point at is gone, so they will post in the review body instead of inline."," "]}),"The summary and verdict still describe the commit that was reviewed.",!i.sent&&d.jsx("button",{className:"btn btn-sm",disabled:r,onClick:()=>s(),children:r?"starting…":"re-review at the new head"})]}),m&&d.jsxs("div",{children:[d.jsx("strong",{children:"The PR moved on since you sent this review."})," ",(a==null?void 0:a.headSha)&&i.pr.headSha&&d.jsxs(d.Fragment,{children:["Now at ",d.jsx("code",{children:a.headSha.slice(0,7)}),", sent at"," ",d.jsx("code",{children:i.pr.headSha.slice(0,7)}),"."," "]}),"What you sent stays exactly as it was posted — cerber never re-anchors a review that is already on GitHub. Answering the new commits means a new draft, which replaces this one here and leaves what was posted alone.",d.jsx("button",{className:"btn btn-sm",disabled:r,onClick:()=>s(),children:r?"starting…":"re-review at the new head"})]})]})}function ox({reviewKey:i}){var Wt,Gn,Xn,Vn,ut;const[a,r]=H.useState(null),[s,u]=H.useState(null),[f,h]=H.useState(null),[y,g]=H.useState(null),[m,b]=H.useState(!1),[v,_]=H.useState([]),[T,S]=H.useState(!1),[C,A]=H.useState(new Set),R=Y=>A(de=>new Set(de).add(Y)),[$,U]=H.useState(!1),[W,z]=H.useState([]),ae=H.useRef(null),[se,x]=H.useState(new Set),[G,ee]=H.useState(new Set),ue=H.useRef(Promise.resolve()),Ee=H.useRef(0),[j,le]=H.useState(0),fe=H.useRef(new Map),[M]=Sy(),[Q,pe]=H.useState(null),we=H.useRef(null),De=H.useRef(null),w=H.useRef(null),L=H.useRef(null),I=H.useRef(null),oe=H.useRef(null),[me,ve]=H.useState(!1),X=H.useRef(null),[be,xe]=H.useState(!1),[Ge,$e]=H.useState(!1),[Ce,St]=H.useState(null),[Ke,In]=H.useState(null);H.useEffect(()=>{if(!Ke)return;const Y=setTimeout(()=>In(null),1800);return()=>clearTimeout(Y)},[Ke]);const Je=Y=>{var de,Ne;z(F=>F.some(ge=>ge.target===Y.target&&ge.id===Y.id)?F:[...F,Y]),(de=ae.current)==null||de.scrollIntoView({behavior:"smooth",block:"center"}),(Ne=ae.current)==null||Ne.focus()};H.useEffect(()=>{let Y=!1;return window.scrollTo({top:0}),r(null),u(null),h(null),g(null),St(null),$e(!1),S(!1),mg(i).then(de=>{if(!Y)return r(de),S(de.own===!0),v0(i).then(Ne=>{Y||(h(Ne),Ne.changed&&r(Ne.artifact))}).catch(Ne=>!Y&&g(String(Ne.message??Ne))).then(()=>{if(!(Y||de.sent||de.status==="running"||de.comments.length===0))return $e(!0),N0(i).then(Ne=>!Y&&r(Ne)).catch(()=>{}).finally(()=>!Y&&$e(!1))})}).catch(de=>!Y&&u(String(de))),()=>{Y=!0}},[i]),H.useEffect(()=>{So().then(_).catch(()=>{})},[]),H.useEffect(()=>{const Y=X.current;if(!Y)return;const de=()=>document.documentElement.style.setProperty("--top-h",`${Y.offsetHeight}px`);de();const Ne=new ResizeObserver(de);return Ne.observe(Y),()=>{Ne.disconnect(),document.documentElement.style.removeProperty("--top-h")}},[a==null?void 0:a.id]);const Ln=(a==null?void 0:a.pendingChat)!=null&&a.pendingChat.error==null,Hn=H.useRef(null),It=((Wt=a==null?void 0:a.raisedCheck)==null?void 0:Wt.checkingSince)!=null||Ge;H.useEffect(()=>{if((a==null?void 0:a.status)!=="running"&&!Ln&&!It)return;const Y=setInterval(()=>{mg(i).then(de=>{var Ne;if(r(de),S(de.own===!0),de.status!=="running"){b(!1);const F=Hn.current;F!=null&&de.sent&&(((Ne=de.run)==null?void 0:Ne.startedAt)??"none")===F&&u("The re-review didn't start, so nothing here changed — the review you sent is untouched. The history below says why."),Hn.current=null}}).catch(()=>{})},3e3);return()=>clearInterval(Y)},[a==null?void 0:a.status,Ln,It,i]);const Rt=(a==null?void 0:a.sent)!=null,on=H.useMemo(()=>$_(v,i,C),[v,i,C]),yn=on.findIndex(Y=>Y.key===i),Ft=(yn>0?on[yn-1]:null)??null,je=(yn>=0&&yn<on.length-1?on[yn+1]:null)??null,Lt=Y=>{window.location.hash=`#/r/${encodeURIComponent(Y)}`},vt=()=>{je?Lt(je.key):window.location.hash="#/"},Ot=H.useMemo(()=>{if(!a)return[];const Y=I_(a.diff,a.chapters);return Y.length>0?[...a.chapters,{id:"__other",title:"other changes",explanation:"Files not assigned to any chapter by the AI.",files:Y}]:a.chapters},[a]);H.useEffect(()=>{let Y=0;const de=()=>{var dt;Y=0;const ge=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--top-h"))||0,Ie=ge+16;let Fe=null;for(const gt of Ot){const Bt=(dt=fe.current.get(gt.id))==null?void 0:dt.getBoundingClientRect();Bt&&Bt.top<=Ie&&Bt.bottom>Ie&&(Fe={id:gt.id,stuck:Bt.top<ge-1})}pe(gt=>(gt==null?void 0:gt.id)===(Fe==null?void 0:Fe.id)&&(gt==null?void 0:gt.stuck)===(Fe==null?void 0:Fe.stuck)?gt:Fe)},Ne=()=>{Y||(Y=requestAnimationFrame(de))};de(),window.addEventListener("scroll",Ne,{passive:!0}),window.addEventListener("resize",Ne);const F=new ResizeObserver(Ne);return F.observe(document.body),()=>{cancelAnimationFrame(Y),window.removeEventListener("scroll",Ne),window.removeEventListener("resize",Ne),F.disconnect()}},[Ot]);const Tn=H.useMemo(()=>{const Y=H_((a==null?void 0:a.diff)??""),de=new Set(ja((a==null?void 0:a.diff)??"").filter(F=>pf(F.path)&&mf(F.patch).isNew).map(F=>F.path)),Ne=F=>{const ge=Y.get(F)??0;return de.has(F)?Math.round(ge/4):ge};return new Map(Ot.map(F=>[F.id,F.files.reduce((ge,Ie)=>ge+Ne(Ie),0)]))},[a==null?void 0:a.diff,Ot]),zn=Y=>{const de=Tn.get(Y)??0;return de>XN?de:null},An=Y=>se.has(Y)?zn(Y)!=null:zn(Y)==null,jn=Y=>x(de=>{const Ne=new Set(de);return Ne.has(Y)?Ne.delete(Y):Ne.add(Y),Ne});H.useEffect(()=>{x(new Set),ee(new Set)},[i]);const Rn=H.useMemo(()=>Object.fromEntries(ja((a==null?void 0:a.diff)??"").map(Y=>[Y.path,q_(Y.patch)])),[a==null?void 0:a.diff]),cn=H.useMemo(()=>new Set(Object.keys(Rn).filter(Y=>{var de;return((de=a==null?void 0:a.viewed)==null?void 0:de[Y])===Rn[Y]})),[Rn,a==null?void 0:a.viewed]),qt={viewed:cn,peeked:G,onToggleViewed:Y=>{const de=cn.has(Y)?null:Rn[Y]??null;ee(F=>{const ge=new Set(F);return ge.delete(Y),ge}),r(F=>{if(!F)return F;const ge={...F.viewed};return de===null?delete ge[Y]:ge[Y]=de,{...F,viewed:ge}});const Ne=++Ee.current;ue.current=ue.current.then(()=>p0(i,Y,de)).then(F=>{Ne===Ee.current&&r(ge=>ge&&ge.id===F.id?{...ge,viewed:F.viewed}:ge)}).catch(F=>u(String(F)))},onTogglePeek:Y=>ee(de=>{const Ne=new Set(de);return Ne.has(Y)?Ne.delete(Y):Ne.add(Y),Ne})},la=Y=>{const de=Ot[Y];return de?(le(Y),An(de.id)||jn(de.id),de):null},un=(...Y)=>{for(const de of Y)if(de.current)return de.current.scrollIntoView({behavior:"smooth",block:"start"})},hn=Y=>{var Ne;const de=la(Y);de&&((Ne=fe.current.get(de.id))==null||Ne.scrollIntoView({behavior:"smooth",block:"start"}))},qe=(Y,de)=>{var F;la(Y);const Ne=(F=a==null?void 0:a.comments.find(ge=>ge.id===de))==null?void 0:F.path;Ne&&cn.has(Ne)&&ee(ge=>new Set(ge).add(Ne)),In(de),Ay(de)},pn=T,Pt=wy(a==null?void 0:a.verdict,pn);H.useEffect(()=>St(null),[Pt]);const Gt=()=>{!a||a.sent||be||It||(xe(!0),St(null),w0(i,Pt).then(({replyError:Y,...de})=>{r(de),Y&&St(`Sent — but ${Y}`),R(i)}).catch(Y=>St(String(Y.message??Y))).finally(()=>xe(!1)))};if(H.useEffect(()=>{const Y=de=>{HN(de.target)||de.metaKey||de.ctrlKey||de.altKey||(de.key==="["&&Ft?Lt(Ft.key):de.key==="]"&&je?Lt(je.key):de.key==="n"?hn(Math.min(Ot.length-1,j+1)):de.key==="N"?hn(Math.max(0,j-1)):de.key==="s"&&!Rt&&Gt())};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[Ft==null?void 0:Ft.key,je==null?void 0:je.key,Ot,j,Rt,Pt,a==null?void 0:a.sent,be,It]),s&&!a)return d.jsx("p",{className:"error pad",children:s});if(!a)return d.jsx("p",{className:"muted pad",children:"Loading…"});const k=Y=>{var de;b(!0),u(null),Hn.current=a.sent?((de=a.run)==null?void 0:de.startedAt)??"none":null,ey(i,Y).then(r).catch(Ne=>{u(String(Ne)),b(!1)})},te=Y=>Y.then(r).catch(de=>u(String(de))),ye=Y=>ro(i,{status:Y}).then(()=>{R(i),vt()}).catch(de=>u(String(de))),ze=(Y,de,Ne)=>T0(i,{to:Y,note:de,postReview:Ne}).then(({artifact:F,noteError:ge,sendError:Ie,replyError:Fe})=>{D0(Y),r(F),U(!1),R(i);const dt=[Ie&&`the review did not post: ${Ie}`,Fe,ge&&`the note did not post: ${ge}`].filter(Boolean);dt.length>0?u(`Handed to @${Y}, but ${dt.join("; and ")}`):vt()}),Qe=(Y,de)=>te(m0(i,Y,de)),et=Y=>te(b0(i,Y)),Ae=Y=>te(g0(i,Y)),Se=a.comments.filter(Y=>!Y.chapterId||!Ot.some(de=>de.id===Y.chapterId)),{inline:Ue,folded:Ct,dropped:mt,held:qn,replies:sa}=xy(a),Na=a.comments.filter(Y=>Y.alreadyRaised&&Y.status!=="dropped").length,dn=a.comments.filter(Y=>Y.status!=="dropped"&&Y.drifted).length,wt=a.verdict?kb[a.verdict.recommendation]:"none",Kt=MN(a),tt=CN(a),vn=a.pendingChat!=null&&a.pendingChat.error==null,Ua=a.status==="running"||vn,ba=()=>te(Dd(i,{message:"Some findings were dropped, edited or re-graded after this review was drafted. Update the summary and verdict to match what still stands — do not re-review the whole PR.",refs:[{target:"verdict",id:null}]})),xa=(Y,de)=>{te(Dd(i,{message:de,refs:[{target:"line",id:null,path:Y.path,line:Y.line,side:Y.side}]}).then(Ne=>{var F;return(F=L.current)==null||F.scrollIntoView({behavior:"smooth",block:"start"}),Ne}))},ra=(Gn=a.run)!=null&&Gn.trusted?"ran the code":(Xn=a.run)!=null&&Xn.withSource?"read the full source":a.run?"read the diff only":"no run yet",Ta=Y=>{var de;return d.jsxs("button",{className:`verdict-pick${((de=a.verdict)==null?void 0:de.recommendation)===Y?` verdict-pick-on tone-${kb[Y]}`:""}`,title:Y==="approve"?"Approve":Y==="comment"?"Comment without blocking":"Request changes",onClick:()=>te(ro(i,{verdictRecommendation:Y})),children:[d.jsx(Xe,{name:BN[Y]}),Y.replace("_"," ")]},Y)};return d.jsxs("div",{className:"review",children:[d.jsxs("div",{className:"review-top",ref:X,children:[d.jsx("div",{className:"crumb",children:d.jsxs("div",{className:"bar-inner",children:[d.jsx("a",{href:"#/",children:"← queue"}),d.jsx("span",{className:"crumb-sep",children:"/"}),d.jsx("span",{className:"crumb-slug",children:a.id}),d.jsxs("span",{className:"walk",children:[d.jsx("button",{className:"walk-btn",disabled:!Ft,title:Ft?`[ — ${Ft.id}: ${Ft.pr.title}`:"no more reviews this way",onClick:()=>Ft&&Lt(Ft.key),children:d.jsx(Xe,{name:"chevronLeft"})}),d.jsx("button",{className:"walk-btn",disabled:!je,title:je?`] — ${je.id}: ${je.pr.title}`:"no more reviews this way",onClick:()=>je&&Lt(je.key),children:d.jsx(Xe,{name:"chevronRight"})})]}),yn>=0&&d.jsxs("span",{className:"faint",children:[yn+1," of ",on.length," awaiting"]}),d.jsx("span",{className:"faint crumb-next",children:je?`next: ${je.pr.title}`:yn>=0?"last in the queue":""}),d.jsx("span",{className:"grow"}),d.jsx("a",{href:"#/settings",className:"topbar-link",title:"settings","aria-label":"settings",children:d.jsx(Xe,{name:"settings",size:15})})]})}),d.jsx("div",{className:"review-head",children:d.jsxs("div",{className:"wrap",children:[d.jsxs("div",{className:"review-head-top",children:[d.jsx("a",{className:"review-title",href:a.pr.url,target:"_blank",rel:"noreferrer",children:a.pr.title}),d.jsx("span",{className:"grow"}),a.verdict&&(Rt?d.jsxs("span",{className:`chip tone-${wt}`,children:[a.verdict.recommendation.replace("_"," "),tt&&` · ${tt}`," · ",a.verdict.confidence,"%"]}):d.jsxs("button",{className:`chip chip-btn tone-${wt}`,title:"change it, or send — both are at the foot of the page",onClick:()=>un(we,I),children:[a.verdict.recommendation.replace("_"," "),tt&&` · ${tt}`," · ",a.verdict.confidence,"%",d.jsx(Xe,{name:"down",size:12})]})),a.status!=="running"&&d.jsxs("button",{className:"btn btn-sm",disabled:m,title:Rt?"Draft a new review at the current head. What you sent stays on GitHub — this replaces the draft here, and sending again posts a second review":a.run?"Review the current head again — this draft is replaced, comments and all":"Draft a review of this PR",onClick:()=>k(!0),children:[d.jsx(Xe,{name:"rerun"}),m?"starting…":a.run?"re-review at head":"review now"]})]}),d.jsxs("div",{className:"review-head-meta",children:[d.jsx("span",{children:a.pr.author}),d.jsx("span",{className:"crumb-sep",children:"·"}),d.jsxs("span",{children:[a.pr.headRefName," → ",a.pr.baseRefName,a.pr.headSha?` · ${a.pr.headSha.slice(0,7)}`:""]}),d.jsx("span",{className:"crumb-sep",children:"·"}),d.jsxs("span",{children:[a.pr.changedFiles,"f ",d.jsxs("span",{className:"add",children:["+",a.pr.additions]})," ",d.jsxs("span",{className:"del",children:["−",a.pr.deletions]})]}),d.jsx("span",{className:"crumb-sep",children:"·"}),d.jsx("span",{title:"Whether the run read a local checkout of the PR head, or the diff alone.",children:ra}),((Vn=a.run)==null?void 0:Vn.costUsd)!=null&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"crumb-sep",children:"·"}),d.jsxs("span",{title:"What this review would cost at API token rates. Riding a Claude subscription, it draws on your usage limits instead.",children:["≈$",a.run.costUsd.toFixed(2)," at API rates"]})]}),d.jsx("span",{className:"crumb-sep",children:"·"}),d.jsx("span",{title:"Where this review has got to: drafted, settled locally, or sent.",children:a.status})]})]})})]}),d.jsxs("div",{className:"wrap review-body",children:[d.jsxs("aside",{className:"rail",children:[d.jsxs("div",{className:"rail-jumps",children:[d.jsx("button",{className:"lab rail-lab-btn",onClick:()=>un(De),children:"summary"}),a.verdict&&d.jsx("button",{className:"lab rail-lab-btn",onClick:()=>un(w),children:"why"}),d.jsx("button",{className:"lab rail-lab-btn",onClick:()=>{var Y;un(L),(Y=ae.current)==null||Y.focus()},children:"chat"}),d.jsx("button",{className:"lab rail-lab-btn",onClick:()=>{ve(!0),un(oe)},children:"history"})]}),Ot.length>0&&d.jsxs(d.Fragment,{children:[d.jsx("button",{className:"lab rail-lab rail-lab-btn",onClick:()=>hn(0),children:"changes"}),Ot.map((Y,de)=>{const Ne=Y.files.length>0&&Y.files.every(F=>cn.has(F));return d.jsxs("div",{className:"rail-group",children:[d.jsxs("button",{className:`rail-item${An(Y.id)?" rail-item-on":""}${Ne?" rail-item-done":""}${(Q==null?void 0:Q.id)===Y.id?" rail-item-here":""}`,onClick:()=>hn(de),children:[d.jsxs("span",{className:"grow",children:[de+1," · ",Y.title]}),d.jsxs("span",{className:"rail-count",title:Ne?"every file viewed":void 0,children:[Ne?"✓ ":"",Y.files.length,"f"]})]}),a.comments.filter(F=>F.chapterId===Y.id).map(F=>d.jsxs("button",{className:`rail-comment${F.status==="dropped"?" rail-comment-dropped":""}`,title:`${F.path}${F.line!=null?`:${F.line}`:""} — ${F.body}`,onClick:()=>qe(de,F.id),children:[d.jsx("span",{className:`rail-dot tone-${IN(F,wt)}`,children:"●"}),d.jsxs("span",{className:"rail-comment-loc",children:[F.path.split("/").pop(),F.line!=null?`:${F.drifted?"~":""}${F.line}`:""]})]},F.id))]},Y.id)})]}),d.jsx("button",{className:`lab rail-lab-btn${Ot.length>0?" rail-lab":""}`,onClick:()=>un(we,I),children:"verdict"}),d.jsxs("div",{className:"rail-facts",children:[d.jsxs("div",{children:[a.comments.length-mt.length," keeping · ",mt.length," dropped"]}),d.jsxs("div",{children:[Ue.length," inline · ",Ct.length," folded into body"]}),dn>0&&d.jsxs("div",{className:"warn",title:"The code these comments pointed at is gone from the diff.",children:[dn," drifted"]}),d.jsx(PN,{check:a.raisedCheck??null,raised:Na,held:qn.length,replies:sa.length})]})]}),d.jsxs("div",{className:"main",children:[d.jsx(rx,{artifact:a,freshness:f,rerunning:m,onRerun:k}),y&&d.jsxs("div",{className:"freshness",title:y,children:[d.jsx("strong",{children:"Couldn't check GitHub for newer commits."})," This is the review as it was drafted — if the PR has moved on since, nothing here knows it yet."]}),s&&d.jsx("div",{className:"error",children:s}),((ut=a.run)==null?void 0:ut.error)&&d.jsxs("div",{className:"error",children:["Run failed: ",a.run.error]}),d.jsx("div",{className:"card card-summary",ref:De,children:d.jsxs("div",{className:"card-body",children:[d.jsx("div",{className:"lab",children:"summary"}),d.jsx(ai,{className:"prose lead",text:a.summary||"(no summary)"}),!Rt&&d.jsxs("button",{className:"btn btn-sm",onClick:()=>Je({target:"summary",id:null}),children:[d.jsx(Xe,{name:"comment"}),"discuss the summary"]})]})}),a.verdict&&d.jsx("div",{className:`card card-why tone-border-${wt}`,ref:w,children:d.jsxs("div",{className:"card-body",children:[d.jsx("div",{className:"lab",children:"why"}),d.jsxs("div",{className:"sev-counts",children:[Rd(a)&&d.jsx("span",{title:"Live findings by grade. Only blockers block.",children:Rd(a)}),Rd(a)&&d.jsx("span",{className:"crumb-sep",children:"·"}),d.jsxs("span",{title:"How sure the review is that its own findings and grades are right — not how good an idea merging is. That is the verdict, and it follows from the blockers.",children:[a.verdict.confidence,"% sure of the findings"]})]}),d.jsx(ai,{className:"prose lead",text:a.verdict.reasoning}),!Rt&&d.jsxs("button",{className:"btn btn-sm",onClick:()=>Je({target:"verdict",id:null}),children:[d.jsx(Xe,{name:"comment"}),"discuss the verdict"]})]})}),Ot.map((Y,de)=>d.jsx(VN,{chapter:Y,n:de+1,diff:a.diff,comments:a.comments.filter(Ne=>Ne.chapterId===Y.id),open:An(Y.id),heavy:zn(Y.id),onToggle:()=>jn(Y.id),onUpdateComment:Qe,onDeleteComment:et,onAddComment:Ae,onDiscuss:Rt?void 0:Je,onAskAboutLine:xa,chatBusy:vn,readOnly:Rt,flash:Ke,viewedState:qt,sticky:M,stuck:(Q==null?void 0:Q.id)===Y.id&&Q.stuck,anchorRef:Ne=>{Ne?fe.current.set(Y.id,Ne):fe.current.delete(Y.id)}},Y.id)),Se.length>0&&d.jsxs("section",{className:"card",children:[d.jsxs("header",{className:"card-head",children:[d.jsx("h2",{children:"unattached comments"}),d.jsx("span",{className:"faint",children:"not part of any chapter — they post in the body"})]}),d.jsx("div",{className:"card-body",children:Se.map(Y=>d.jsx(ky,{comment:Y,onUpdate:de=>Qe(Y.id,de),onDelete:()=>et(Y.id),onDiscuss:Rt?void 0:()=>Je({target:"comment",id:Y.id}),readOnly:Rt},Y.id))})]}),d.jsx(lx,{entries:a.history??[],open:me,onToggle:()=>ve(Y=>!Y),anchorRef:oe})]}),d.jsxs("aside",{className:"cockpit",children:[d.jsx(JN,{artifact:a,reviewKey:i,refs:W,onClearRefs:()=>z([]),onDropRef:Y=>z(de=>de.filter((Ne,F)=>F!==Y)),onArtifact:r,readOnly:Rt,inputRef:ae,anchorRef:L}),d.jsxs("div",{className:"cockpit-decide",children:[!Rt&&Kt&&d.jsxs("div",{className:"verdict-hint",children:[d.jsxs("span",{children:[d.jsx("strong",{children:Kt})," — the verdict was written before those edits."]}),d.jsxs("button",{className:"btn btn-sm",onClick:ba,disabled:vn,children:[d.jsx(Xe,{name:"comment"}),vn?"the reviewer is busy…":"ask the reviewer to re-true it"]})]}),a.verdict&&!Rt&&d.jsxs("div",{className:"verdict-bar",ref:we,children:[d.jsx("span",{className:"lab",children:"verdict"}),["approve","comment","request_changes"].map(Ta)]}),d.jsx(ax,{artifact:a,reviewKey:i,event:Pt,own:pn,sending:be,checking:It,onSend:Gt,error:Ce,next:je,onAdvance:vt,onBody:Y=>ro(i,{bodyOverride:Y}).then(r),anchorRef:I,footer:d.jsxs(d.Fragment,{children:[!Rt&&d.jsx("span",{className:"faint",children:"not sending?"}),!Rt&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:"btn btn-sm",title:je?`Settle it locally and go to ${je.id}`:"Settle it locally and go back to the queue",onClick:()=>ye("reviewed"),children:[d.jsx(Xe,{name:"check"}),"mark reviewed"]}),d.jsxs("button",{className:"btn btn-sm",title:je?`Leave it and go to ${je.id}`:"Leave it and go back to the queue",onClick:()=>ye("skipped"),children:[d.jsx(Xe,{name:"skip"}),"skip"]})]}),d.jsxs("button",{className:"btn btn-sm",title:Ua?"Wait for the run to finish — a handoff settles the row it is rewriting":"Move GitHub's review request to somebody else, and settle this row",onClick:()=>U(!0),disabled:$||Ua,children:[d.jsx(Xe,{name:"arrowRight"}),"hand off"]}),d.jsxs("a",{className:"btn btn-sm",href:A0(i),children:[d.jsx(Xe,{name:"download"}),"export .md"]})]})}),$&&d.jsx(nx,{artifact:a,reviewKey:i,onConfirm:ze,onCancel:()=>U(!1)})]})]})]})]})}const Db="cerber.notify.seen.v2",cx="cerber.notify.seen",Pd="cerber.notify",ux=1e4,qs=i=>i.status==="ready",Kd=i=>{try{return localStorage.getItem(i)}catch{return null}},Zd=(i,a)=>{try{localStorage.setItem(i,a)}catch{}},dx={autoReview:!1,autoReviewRepos:{}};function fx(i,a){return i?!i.enabled||!i.pollEnabled?dx:{autoReview:i.autoReview,autoReviewRepos:i.autoReviewRepos??{}}:a}const Cy=(i,a)=>hx(i,Xb(a,i.pr.owner,i.pr.repo));function hx(i,a){return i.announceable===!1||i.status==="running"?!1:i.status==="awaiting"?!a:!0}const My=":draft",co=i=>`${i.key}${My}`,Dy=i=>qs(i)?co(i):i.key;function px(i,a,r){const s=new Set(a);return $s(i).filter(u=>Cy(u,r)&&!s.has(Dy(u)))}function mx(i,a,r=[]){const s=new Set(r),u=new Set($s(i).map(h=>h.key)),f=[];for(const h of i){if(u.has(h.key)&&!Cy(h,a)){for(const y of[h.key,co(h)])s.has(y)&&f.push(y);continue}f.push(h.key),(qs(h)||!u.has(h.key)||s.has(co(h)))&&f.push(co(h))}return f}const kd=i=>`${i.pr.repo}#${i.pr.number}`,gx={approve:"approves",comment:"comments",request_changes:"requests changes"};function bx(i){const a=i.verdict?gx[i.verdict.recommendation]:"drafted",r=i.blockerCount??0;return r===0?a:`${a} · ${r} blocker${r===1?"":"s"}`}function yx(i){if(i.length===0)return null;const a=`cerber:${i.map(Dy).sort().join("|")}`;if(i.length===1){const u=i[0];return{title:qs(u)?`${kd(u)} draft ready`:`${kd(u)} awaits your review`,body:qs(u)?`${bx(u)} — ${u.pr.title}`:`${u.pr.title} — ${u.pr.author}`,tag:a,key:u.key}}const r=i.slice(0,3).map(kd),s=i.length-r.length;return{title:i.every(qs)?`${i.length} drafts ready`:`${i.length} PRs await your review`,body:s>0?`${r.join(", ")} and ${s} more`:r.join(", "),tag:a,key:null}}const vx=new Set(["127.0.0.1","localhost","::1","[::1]"]);function Ex(i,a=window.location.hostname){return!(i!=null&&i.enabled)||!i.notify?!1:vx.has(a)}function Gl(){return typeof Notification>"u"?"unsupported":Notification.permission==="denied"?"blocked":Kd(Pd)==="off"?"off":Notification.permission==="granted"?"on":"ask"}async function _x(){const i=Gl();if(i==="unsupported"||i==="blocked")return i;if(i==="on")return Zd(Pd,"off"),Gl();if(Zd(Pd,"on"),Notification.permission==="default")try{await Notification.requestPermission()}catch{}return Gl()}function Sx(i){const a=new Notification(i.title,{body:i.body,tag:i.tag,icon:"/favicon.svg"});a.onclick=()=>{window.focus(),window.location.hash=i.key?`#/r/${encodeURIComponent(i.key)}`:"#/",a.close()}}function wx(i,a){const r=i??a;if(!r)return null;let s;try{s=JSON.parse(r)}catch{return null}if(!Array.isArray(s))return null;const u=s.filter(f=>typeof f=="string");return i?u:u.flatMap(f=>[f,`${f}${My}`])}function Nx(){const i=H.useRef(null),a=H.useRef({autoReview:!0,autoReviewRepos:{}}),[r,s]=H.useState(!1);return H.useEffect(()=>{let u=!0;i.current=wx(Kd(Db),Kd(cx));const f=()=>Promise.all([So(),nf().catch(()=>null)]).then(([y,g])=>{if(!u)return;const m=Ex(g);s(m),a.current=fx(g,a.current);const b=i.current;if(i.current=mx(y,a.current,b??[]),Zd(Db,JSON.stringify(i.current)),!b||Gl()!=="on"||m||document.visibilityState==="visible"&&document.hasFocus())return;const v=yx(px(y,b,a.current));v&&Sx(v)}).catch(()=>{});f();const h=setInterval(f,ux);return()=>{u=!1,clearInterval(h)}},[]),r}function Ly(){const[i,a]=H.useState(Gl);return H.useEffect(()=>{const r=()=>a(Gl());return window.addEventListener("focus",r),()=>window.removeEventListener("focus",r)},[]),[i,()=>void _x().then(a)]}const uo=i=>{window.location.hash=`#/r/${encodeURIComponent(i)}`};function xx(i){const a=i,r=a==null?void 0:a.tagName;return r==="INPUT"||r==="TEXTAREA"||r==="SELECT"||(a==null?void 0:a.isContentEditable)===!0}function Tx({daemon:i}){return i!=null&&i.enabled?d.jsx("div",{className:"daemon-bar",children:d.jsxs("div",{className:"bar-inner",children:[i.pollEnabled?d.jsxs("span",{className:"daemon-live",children:[d.jsx("span",{className:"dot"}),i.repos.length>0?i.repos.join(", "):"PRs awaiting you"," · every"," ",Math.round(i.intervalMs/6e4),"m"]}):d.jsxs("span",{className:"daemon-live",children:[d.jsx("span",{className:"dot dot-off"}),"polling off (settings) — local reviews only"]}),d.jsxs("span",{children:["auto-review ",d.jsx("b",{children:i.autoReview?"on":"off"}),r0(i.autoReview,i.autoReviewRepos??{})]}),d.jsxs("span",{children:["auto-send ",d.jsx("b",{children:i.autoSend==="on"?"on":"shadow"})," ≥",i.autoSendThreshold,"%",i.autoSend==="on"?` · ${i.autoSent} sent`:` · ${i.autoSendCandidates} candidate${i.autoSendCandidates===1?"":"s"}`]}),i.trustedRuns&&d.jsxs("span",{className:"warn",title:"Trust rules are set and auto-review is on: reviews of matching PRs run their code unattended. Settings → Trusted PRs, or serve --no-trust.",children:[d.jsx(Xe,{name:"zap",size:12})," trusted PRs run with Bash"]}),d.jsx("span",{className:"grow"}),i.lastPollError?d.jsx("span",{className:"danger",title:i.lastPollError,children:"discovery offline — showing local reviews only"}):d.jsx("span",{className:"faint",children:i.polling?"polling now…":[i.lastSummary?`last: ${i.lastSummary}`:null,i.nextPollAt?`next ${new Date(i.nextPollAt).toLocaleTimeString()}`:null].filter(Boolean).join(" · ")})]})}):null}function Ji({className:i,label:a,tip:r}){return d.jsx("span",{className:i,children:d.jsxs("span",{className:"head-cell",children:[a,d.jsx("span",{className:"head-tip",role:"tooltip",children:r})]})})}function Ax({r:i,selected:a,onSelect:r,onOpen:s,awaiting:u}){const f=i0(i),h=Z_(i),y=u?t0(i,u):null;return d.jsxs("div",{className:`row${a?" row-on":""}`,onClick:s,onMouseEnter:r,role:"button",tabIndex:-1,children:[d.jsx("span",{className:"col-caret",children:"›"}),d.jsxs("span",{className:"col-slug",title:`${i.pr.owner}/${i.pr.repo}#${i.pr.number}`,children:[i.pr.repo,"#",i.pr.number]}),d.jsx("span",{className:"col-author",title:i.pr.author,children:i.pr.author}),d.jsx("span",{className:"col-title",title:i.pr.title,children:i.pr.title}),i.pr.isDraft&&d.jsx("span",{className:"tag tag-draft",title:"Still a draft — its author asked for your review anyway",children:"draft"}),y&&d.jsx("span",{className:"tag tag-awaiting",title:y.title,children:y.label}),h&&d.jsx("span",{className:"tag tag-done",children:h}),d.jsx("span",{className:"col-comments",children:l0(i)}),d.jsx("span",{className:"col-size",children:i.pr.changedFiles>0?d.jsxs(d.Fragment,{children:[i.pr.changedFiles,"f ",d.jsxs("span",{className:"add",children:["+",i.pr.additions]})," ",d.jsxs("span",{className:"del",children:["−",i.pr.deletions]})]}):"—"}),d.jsx("span",{className:`col-verdict tone-${f.tone}`,children:f.label}),d.jsx("span",{className:"col-age",title:i.status==="awaiting"?"When the PR last changed on GitHub":"When this review last changed",children:Jb(Md(i))})]})}function Lb({autoFocus:i}){const[a,r]=H.useState(""),[s,u]=H.useState(!1),[f,h]=H.useState(null),y=g=>{g.preventDefault();const m=a.trim();!m||s||(u(!0),h(null),y0(m).then(b=>uo(b.key)).catch(b=>{h(String(b instanceof Error?b.message:b)),u(!1)}))};return d.jsxs("form",{className:"pull",onSubmit:y,children:[d.jsx(Xe,{name:"plus"}),d.jsx("input",{className:"pull-input",value:a,autoFocus:i,disabled:s,onChange:g=>{r(g.target.value),f&&h(null)},placeholder:"paste a PR URL to review it","aria-label":"Review any PR by URL"}),a.trim()&&d.jsx("button",{className:"btn btn-small",type:"submit",disabled:s,children:s?"starting…":"review"}),f&&d.jsx("span",{className:"pull-error",children:f})]})}function Rx({text:i}){const a=H.useRef(null),[r,s]=H.useState(!1);return H.useLayoutEffect(()=>{const u=a.current;if(!u)return;const f=()=>s(u.scrollHeight-u.clientHeight>4);f();const h=new ResizeObserver(f);return h.observe(u),()=>h.disconnect()},[i]),d.jsx("div",{ref:a,className:`strip-prose${r?" strip-prose-clipped":""}`,children:d.jsx(ai,{className:"prose",text:i})})}function kx(){var Ee;const[i,a]=H.useState(null),[r,s]=H.useState(null),[u,f]=H.useState(null),[h,y]=H.useState(new Set),[g,m]=H.useState("inbox"),[b,v]=H.useState(null),_=H.useRef(!1),T=H.useRef(null),S=H.useRef(!0);H.useEffect(()=>(S.current=!0,()=>{S.current=!1}),[]);const C=()=>{So().then(j=>S.current&&a(j)).catch(j=>S.current&&f(String(j))),nf().then(j=>S.current&&s(j)).catch(()=>{})};H.useEffect(()=>{C();const j=setInterval(C,1e4);return()=>clearInterval(j)},[]);const A=i??[],R=H.useMemo(()=>P_(A,r),[A,r]),$=R.requests,U=K_(g,R),W=R[U];H.useEffect(()=>{U!==g&&m(U)},[U,g]);const z=W.find(j=>j.key===b)??W[0]??null,ae=j=>{y(le=>new Set(le).add(j)),ey(j).then(()=>C()).catch(le=>S.current&&f(String(le))).finally(()=>{S.current&&y(le=>{const fe=new Set(le);return fe.delete(j),fe})})};if(H.useEffect(()=>{const j=le=>{if(xx(le.target)||le.metaKey||le.ctrlKey||le.altKey)return;const fe=W.findIndex(Q=>Q.key===(z==null?void 0:z.key)),M=Q=>{const pe=W[Math.min(W.length-1,Math.max(0,fe+Q))];pe&&(_.current=!0,v(pe.key))};le.key==="j"||le.key==="ArrowDown"?(le.preventDefault(),M(1)):le.key==="k"||le.key==="ArrowUp"?(le.preventDefault(),M(-1)):le.key==="Enter"&&z?uo(z.key):le.key==="r"&&z&&z.status!=="running"&&z.status!=="sent"&&ae(z.key)};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[W,z==null?void 0:z.key]),H.useEffect(()=>{var j;_.current&&(_.current=!1,(j=document.querySelector(".row-on"))==null||j.scrollIntoView({block:"nearest"}))},[z==null?void 0:z.key]),H.useEffect(()=>{const j=T.current;if(!j)return;const le=()=>document.documentElement.style.setProperty("--strip-h",`${j.offsetHeight}px`);le();const fe=new ResizeObserver(le);return fe.observe(j),()=>{fe.disconnect(),document.documentElement.style.removeProperty("--strip-h")}},[z!=null]),u&&!i)return d.jsx("p",{className:"error",children:u});if(!i)return d.jsx("p",{className:"muted pad",children:"Loading…"});const se=W.reduce((j,le)=>j+(le.costUsd??0),0),x=z?o0(z,r):null,G=z?h.has(z.key):!1,ee=Cd.filter(j=>R[j].length>0),ue=j=>d.jsxs("button",{className:`tab${U===j?" tab-on":""}${Cd.includes(j)?" tab-filed":""}${j==="requests"?" tab-requests":""}`,title:zu[j].title,onClick:()=>m(j),children:[zu[j].label," ",d.jsx("span",{className:"tab-count",children:R[j].length})]},j);return d.jsxs(d.Fragment,{children:[d.jsx(Tx,{daemon:r}),u&&d.jsx("div",{className:"wrap",children:d.jsx("p",{className:"error",children:u})}),A.length===0?d.jsx("div",{className:"wrap",children:d.jsxs("div",{className:"empty",children:[r!=null&&r.enabled?d.jsxs("p",{children:["Inbox empty — nothing awaits your review.",r.lastPollError?" (Discovery is offline; check gh auth.)":""]}):d.jsx("p",{children:"No reviews yet."}),d.jsx(Lb,{autoFocus:!0})]})}):d.jsxs("div",{className:"wrap",children:[d.jsxs("div",{className:"tabs",children:[hg.map(ue),ee.length>0&&d.jsx("span",{className:"tab-split","aria-hidden":"true"}),ee.map(ue),d.jsx("span",{className:"grow"}),d.jsx(Lb,{}),se>0&&d.jsxs("span",{className:"faint",title:"What these reviews would cost at API token rates. Riding a Claude subscription, they draw on your usage limits instead.",children:["≈$",se.toFixed(2)," at API rates"]})]}),d.jsxs("div",{className:"table-head",children:[d.jsx("span",{className:"col-caret"}),d.jsx(Ji,{className:"col-slug",label:"repo#pr",tip:"Repository and pull request number"}),d.jsx(Ji,{className:"col-author",label:"author",tip:"Who opened the pull request"}),d.jsx(Ji,{className:"col-title",label:"title",tip:"Pull request title"}),d.jsx(Ji,{className:"col-comments",label:"comments",tip:"Comments in the draft (— before one exists)"}),d.jsx(Ji,{className:"col-size",label:"size",tip:"Files changed, lines added, lines removed"}),d.jsx(Ji,{className:"col-verdict",label:"verdict",tip:"Recommendation, and how sure the review is"}),d.jsx(Ji,{className:"col-age",label:"upd",tip:"When this review last changed — or, on a PR nobody has drafted yet, when the PR itself last changed on GitHub"})]}),W.length===0?d.jsx("div",{className:"empty-tab",children:U==="inbox"&&$.length>0?d.jsxs(d.Fragment,{children:[d.jsx("p",{children:n0($)}),d.jsxs("button",{className:"btn",onClick:()=>m("requests"),children:[d.jsx(Xe,{name:"arrowRight"}),"show ",$.length===1?"it":`all ${$.length}`]})]}):d.jsx("p",{className:"muted",children:U==="inbox"?`Inbox empty — nothing awaits your review.${r!=null&&r.enabled&&r.lastPollError?" (Discovery is offline; check gh auth.)":""}`:`Nothing ${zu[U].label} right now.`})}):W.map((j,le)=>d.jsxs(H.Fragment,{children:[hg.includes(U)&&G_(W,le)&&d.jsx("div",{className:"group-head",role:"heading","aria-level":2,title:"PRs you opened. Never drafted on their own — press r for a self-review. Send posts it as a comment.",children:"your PRs"}),d.jsx(Ax,{r:j,selected:j.key===(z==null?void 0:z.key),onSelect:()=>v(j.key),onOpen:()=>uo(j.key),awaiting:F_(j,$)?X_(j,r):null})]},j.key)),z&&x&&d.jsxs("div",{className:"cursor-strip",ref:T,children:[d.jsxs("div",{className:"cursor-strip-body",children:[d.jsxs("div",{className:"lab",children:[z.pr.owner,"/",z.pr.repo,"#",z.pr.number,z.pr.headRefName&&z.pr.baseRefName?` · ${z.pr.headRefName} → ${z.pr.baseRefName}`:""]}),d.jsx(Rx,{text:x.reasoning}),d.jsxs("div",{className:"cursor-strip-meta",children:[x.meta.join(" · "),((Ee=z.sent)==null?void 0:Ee.url)&&d.jsxs(d.Fragment,{children:[" · ",d.jsx("a",{href:z.sent.url,target:"_blank",rel:"noreferrer",children:"view on GitHub"})]})]})]}),d.jsxs("div",{className:"cursor-strip-actions",children:[d.jsxs("button",{className:"btn-primary",onClick:()=>uo(z.key),children:[d.jsx(Xe,{name:"arrowRight"}),"open review ",d.jsx(za,{children:"↵"})]}),d.jsxs("div",{className:"cursor-strip-row",children:[d.jsxs("button",{className:"btn",disabled:z.status==="sent"||z.status==="skipped",title:"Set the local queue status to skipped. Nothing is sent.",onClick:()=>ro(z.key,{status:"skipped"}).then(C).catch(j=>f(String(j))),children:[d.jsx(Xe,{name:"skip"}),"skip"]}),d.jsxs("button",{className:"btn",disabled:G||z.status==="running",title:z.status==="sent"?"Draft a review of the PR's current head. What you sent stays on GitHub.":"Draft a review of the PR's current head.",onClick:()=>ae(z.key),children:[d.jsx(Xe,{name:"rerun"}),G?"starting…":z.status==="awaiting"||z.status==="failed"?"review now":"re-review"]})]})]})]})]})]})}const vo="cerber.theme";function zy(i){return i==="light"||i==="dark"?i:"system"}function Ox(){try{return zy(localStorage.getItem(vo))}catch{return"system"}}function jy(i,a=document.documentElement){i==="system"?delete a.dataset.theme:a.dataset.theme=i}function Cx(i,a){try{const r=a??localStorage;i==="system"?r.removeItem(vo):r.setItem(vo,i)}catch{}}function Mx(){Uy(jy)}function Uy(i){const a=r=>{(r.key===vo||r.key===null)&&i(zy(r.newValue))};return window.addEventListener("storage",a),()=>window.removeEventListener("storage",a)}function Dx(){const[i,a]=H.useState(Ox);return H.useEffect(()=>Uy(a),[]),[i,s=>{Cx(s),jy(s),a(s)}]}const Lx=[{rule:"@acme/*",meaning:"anyone in the acme org"},{rule:"@acme/devs",meaning:"anyone on that GitHub team"},{rule:"@teammate",meaning:"one person, by login"},{rule:"!@acme/contractors",meaning:"deny — beats every rule above"}],zb=1440,jb=i=>i instanceof Error?i.message:String(i),zx={unsupported:"this browser has no notifications to give",blocked:"this browser has blocked notifications for cerber",off:"tell me when a review is ready for me",ask:"tell me when a review is ready for me (the browser will ask first)",on:"tell me when a review is ready for me"},jx=[{choice:"system",label:"follow this machine"},{choice:"light",label:"light"},{choice:"dark",label:"dark"}],Ux=[{choice:"mod-enter",label:"⌘↵ sends a chat message, Enter starts a new line"},{choice:"enter",label:"Enter sends a chat message, Shift+Enter starts a new line"}],Bx=/^[\w.-]+\/[\w.-]+$/,Od=i=>i?"drafts automatically":"waits for a click";function Ix({daemon:i,busy:a,save:r}){const[s,u]=H.useState(""),[f,h]=H.useState(!i.autoReview),[y,g]=H.useState([]);H.useEffect(()=>{So().then(S=>g([...new Set(S.map(C=>`${C.pr.owner}/${C.pr.repo}`))].sort())).catch(()=>{})},[]),H.useEffect(()=>h(!i.autoReview),[i.autoReview]);const m=Object.entries(i.autoReviewRepos).sort(([S],[C])=>S.localeCompare(C)),b=s.trim(),v=Bx.test(b),_=new Set(m.map(([S])=>S.toLowerCase())),T=()=>{a||!v||(r(b,f),u(""))};return d.jsxs(d.Fragment,{children:[d.jsx("h2",{children:"Per-repo exceptions"}),d.jsx("p",{className:"muted",children:"Every repo not listed here follows the switch above. List a busy repo to keep it to the click, or, with the switch off, one repo you still want drafted."}),d.jsxs("div",{className:"trust-add",children:[d.jsx("input",{value:s,"aria-label":"Repository",placeholder:"owner/repo",list:"auto-review-repos",disabled:a,onChange:S=>u(S.target.value),onKeyDown:S=>{S.key==="Enter"&&T()}}),d.jsx("datalist",{id:"auto-review-repos",children:y.filter(S=>!_.has(S.toLowerCase())).map(S=>d.jsx("option",{value:S},S))}),d.jsxs("select",{"aria-label":"What the poll does for this repo",value:f?"auto":"click",disabled:a,onChange:S=>h(S.target.value==="auto"),children:[d.jsx("option",{value:"click",children:Od(!1)}),d.jsx("option",{value:"auto",children:Od(!0)})]}),d.jsx("button",{className:"btn",disabled:a||!v,onClick:T,children:"add"})]}),m.length===0?d.jsxs("p",{className:"muted",children:["No exceptions — every repo ",i.autoReview?"is drafted automatically":"waits for a click","."]}):d.jsx("table",{className:"trust-table",children:d.jsx("tbody",{children:m.map(([S,C])=>d.jsxs("tr",{children:[d.jsx("td",{children:d.jsx("code",{children:S})}),d.jsxs("td",{className:"muted",children:[Od(C),C===i.autoReview&&" — same as the default, so it changes nothing"]}),d.jsxs("td",{className:"trust-actions",children:[d.jsx("button",{className:"btn",disabled:a,onClick:()=>r(S,!C),children:C?"wait for a click":"draft automatically"})," ",d.jsx("button",{className:"btn",disabled:a,onClick:()=>r(S,null),children:"remove"})]})]},S))})})]})}function Hx({daemonAnnounces:i}){const[a,r]=Ly(),[s,u]=Dx(),[f,h]=Sy(),[y,g]=Ty(),[m,b]=H.useState(null),[v,_]=H.useState(""),[T,S]=H.useState(null),[C,A]=H.useState(!1),[R,$]=H.useState(""),[U,W]=H.useState(!1);H.useEffect(()=>{R0().then(b).catch(x=>S(jb(x))),nf().then(x=>W(x.enabled&&x.intervalFixed)).catch(()=>{})},[]),H.useEffect(()=>{m&&$(String(m.daemon.intervalMinutes))},[m]);const z=x=>{A(!0),S(null),x.then(b).catch(G=>S(jb(G))).finally(()=>A(!1))};if(T&&!m)return d.jsx("p",{className:"error",children:T});if(!m)return d.jsx("p",{className:"muted",children:"Loading…"});const ae=i&&m.daemon.poll&&m.daemon.notify,se=()=>{const x=Number(R);!Number.isInteger(x)||x<1||x>zb?$(String(m.daemon.intervalMinutes)):x!==m.daemon.intervalMinutes&&z(no({intervalMinutes:x}))};return d.jsxs("div",{className:"settings",children:[d.jsx("a",{href:"#/",className:"back",children:"← queue"}),d.jsx("h1",{children:"Inbox"}),d.jsx("p",{children:"By default cerber keeps the queue itself: it polls GitHub for PRs awaiting your review and drafts a review for each, so they're ready when you open the cockpit. Nothing is ever sent without you. Changes apply on the next poll — no restart."}),d.jsxs("label",{className:"inbox-toggle",children:[d.jsx("input",{type:"checkbox",checked:m.daemon.poll,disabled:C,onChange:x=>z(no({poll:x.target.checked}))})," ","poll GitHub for PRs awaiting my review"]}),d.jsxs("label",{className:"inbox-toggle",children:["poll every",d.jsx("input",{type:"number",className:"interval-input",min:1,max:zb,step:1,value:R,disabled:C||!m.daemon.poll||U,onChange:x=>$(x.target.value),onBlur:se,onKeyDown:x=>{x.key==="Enter"&&se()}}),"minutes",U&&d.jsx("span",{className:"muted",children:" (set by --interval for this run)"})]}),d.jsxs("label",{className:"inbox-toggle",children:[d.jsx("input",{type:"checkbox",checked:m.daemon.autoReview,disabled:C||!m.daemon.poll,onChange:x=>z(no({autoReview:x.target.checked}))})," ","draft a review automatically (off: awaiting PRs wait for a click)"]}),m.daemon.poll&&d.jsx(Ix,{daemon:m.daemon,busy:C,save:(x,G)=>z(k0(x,G))}),d.jsxs("p",{className:"muted",children:["Your own open PRs come in too, under ",d.jsx("b",{children:"your PRs"}),", for a self-review when you ask —",m.daemon.ownPrMaxAgeDays?` except ones idle for more than ${m.daemon.ownPrMaxAgeDays} days`:" all of them, however long idle"," ","(",d.jsx("code",{children:"ownPrMaxAgeDays"}),"; 0 turns the cut off)."]}),d.jsxs("p",{className:"muted",children:["Concurrency, a repo filter and that age cut live in ",d.jsx("code",{children:m.path})," ","under ",d.jsx("code",{children:"daemon"})," — hand-editable, like everything here."]}),d.jsx("h1",{children:"Notifications"}),d.jsx("p",{children:'When a PR is worth coming back for, cerber says so: one desktop notification per poll. With auto-review on that moment is the draft landing, not the PR arriving — a tap that leads to "no run yet" costs you the walk back and gives you nothing — and the notification names what the review found. A PR nobody is drafting (auto-review off, or a run that failed) is announced as it lands, since that is all the news there will be — and if a retry then drafts it after all, that is new news and you are told. Several at once fold into one notification, and a PR whose draft has been announced never arrives twice, however its next re-review ends.'}),d.jsxs("label",{className:"inbox-toggle",children:[d.jsx("input",{type:"checkbox",checked:m.daemon.notify,disabled:C||!m.daemon.poll,onChange:x=>z(no({notify:x.target.checked}))})," ","tell this machine when a review is ready for you (no cockpit tab required)"]}),d.jsxs("p",{className:"muted",children:["This is the one that works while you're somewhere else: it rides the poll, so it needs nothing open but ",d.jsx("code",{children:"serve"})," itself. It hands the notification to whatever this machine already has — Notification Centre on macOS,"," ",d.jsx("code",{children:"notify-send"})," on Linux — and stays quiet where there is neither. On macOS it"," ",d.jsx("strong",{children:"opens that review when you click it"}),', through a small app cerber builds for the job (the first one asks you to allow notifications from "Cerber"); a'," ",d.jsx("code",{children:"notify-send"})," tap announces the PR but has no click to give."]}),d.jsxs("label",{className:"inbox-toggle",children:[d.jsx("input",{type:"checkbox",checked:a==="on",disabled:a==="unsupported"||a==="blocked"||ae,onChange:r})," ",ae?"let this browser announce them instead":zx[a]]}),d.jsx("p",{className:"muted",children:ae?d.jsx(d.Fragment,{children:"Standing down while the machine's own notification is on — two popups for one PR is one too many. Untick the machine one above and this browser takes over: it names the PR and opens that review on click just the same, but only while a cockpit tab is open and this browser has granted the permission."}):d.jsxs(d.Fragment,{children:["Per-browser, not per-machine: the permission belongs to this browser, so the switch lives here rather than in ",d.jsx("code",{children:m.path}),". Granting it is the browser's prompt, not cerber's — a browser that has blocked cerber has to be un-blocked from the padlock next to the address bar. Nothing is announced while you're looking straight at the cockpit."]})}),d.jsx("h1",{id:"appearance",children:"Appearance"}),d.jsx("div",{role:"radiogroup","aria-labelledby":"appearance",children:jx.map(({choice:x,label:G})=>d.jsxs("label",{className:"inbox-toggle",children:[d.jsx("input",{type:"radio",name:"theme",checked:s===x,onChange:()=>u(x)})," ",G]},x))}),d.jsxs("p",{className:"muted",children:["Per-browser, like the notification switch: it's about this screen, not your reviews, so it lives here rather than in ",d.jsx("code",{children:m.path}),"."]}),d.jsx("h1",{children:"Review page"}),d.jsxs("label",{className:"inbox-toggle",children:[d.jsx("input",{type:"checkbox",checked:f,onChange:x=>h(x.target.checked)})," ","keep chapter titles and file headers pinned while scrolling"]}),d.jsx("p",{className:"muted",children:"Ten files into a chapter you still see which one you're in, and the pinned title can open the chapter's explanation. Deep in a long file its name and Viewed box stay in reach. Per-browser, like the theme."}),Ux.map(({choice:x,label:G})=>d.jsxs("label",{className:"inbox-toggle",children:[d.jsx("input",{type:"radio",name:"send-key",checked:y===x,onChange:()=>g(x)})," ",G]},x)),d.jsx("p",{className:"muted",children:"In the conversation with the reviewer. ⌘↵ sends under either choice, and the other boxes — comments, the review body, a handoff note — always take ⌘↵, since what goes in them runs to several lines. Per-browser, like the theme."}),d.jsx("h1",{children:"Trusted PRs"}),d.jsxs("p",{children:["Every review reads the PR's code. A ",d.jsx("strong",{children:"trusted"})," review may also run it — the test that covers the change, a typecheck, ",d.jsx("code",{children:"git log"})," — so it can report what happened instead of guessing. That means executing code from the PR on this machine, the same as checking the branch out and running the tests yourself."]}),d.jsxs("p",{className:"muted",children:["Trust the people, not the code: nothing about a PR can earn it. Rules live in"," ",d.jsx("code",{children:m.path}),"."]}),d.jsx("p",{className:"muted",children:'Only people can be trusted — there is no way to trust a repository. Anyone can open a PR against a repo you own, so trusting the repo would trust them too. Membership is checked against GitHub when the review runs, and a check that fails counts as "not a member".'}),d.jsxs("div",{className:"trust-add",children:[d.jsx("input",{value:v,"aria-label":"Trust rule",placeholder:"@org/*, @org/team, @login, !deny",disabled:C,onChange:x=>_(x.target.value),onKeyDown:x=>{x.key==="Enter"&&!C&&v.trim()&&(z(Uu(v.trim())),_(""))}}),d.jsx("button",{className:"btn",disabled:C||!v.trim(),onClick:()=>{z(Uu(v.trim())),_("")},children:"trust"})]}),T&&d.jsx("p",{className:"error",children:T}),m.trust.length===0?d.jsx("p",{className:"muted",children:"Nobody is trusted yet — every review reads the checkout and runs nothing."}):d.jsx("table",{className:"trust-table",children:d.jsx("tbody",{children:m.trust.map(x=>d.jsxs("tr",{className:x.denies?"trust-deny":void 0,children:[d.jsx("td",{children:d.jsx("code",{children:x.rule})}),d.jsx("td",{className:"muted",children:x.explanation}),d.jsx("td",{className:"trust-actions",children:d.jsx("button",{className:"btn",disabled:C,onClick:()=>z(Uu(x.rule,!0)),children:"remove"})})]},x.rule))})}),d.jsx("h2",{children:"Rule syntax"}),d.jsx("table",{className:"trust-table",children:d.jsx("tbody",{children:Lx.map(x=>d.jsxs("tr",{children:[d.jsx("td",{children:d.jsx("code",{children:x.rule})}),d.jsx("td",{className:"muted",children:x.meaning})]},x.rule))})}),d.jsxs("p",{className:"muted",children:["A trusted review is handed no GitHub credentials — no token, no ",d.jsx("code",{children:"gh"})," login, no git or ssh identity — so a push fails to authenticate rather than being merely discouraged. It is not a sandbox though: it has ",d.jsx("code",{children:"Bash"})," and this machine, so trust people you would let run their branch here anyway. The daemon reviews unattended, so with rules set it runs matching PRs' code with nobody watching — start it with ",d.jsx("code",{children:"--no-trust"})," to prevent that."]}),d.jsxs("p",{className:"muted settings-version",children:["cerber ",m.version]})]})}function Ub(){const i=window.location.hash,a=i.match(/^#\/r\/(.+)$/);return a?{view:"detail",key:decodeURIComponent(a[1])}:i==="#/settings"?{view:"settings"}:{view:"queue"}}const Bb={unsupported:"",blocked:"This browser blocked notifications for cerber. Turn them back on in its site settings — the padlock next to the address bar.",off:"Notifications off. Click to be told when a review is ready for you.",ask:"Click to be told when a review is ready for you — the browser will ask you first.",on:"Telling you when a review is ready for you. Click to stop."},Ib="cerber taps this machine itself when a PR is worth coming back for — no tab required. The browser's own bell would be a second popup about one PR, so it stands down. Turn the machine one off in Settings to have this browser announce them instead.";function qx({daemonAnnounces:i}){const[a,r]=Ly();return i?d.jsx("span",{className:"topbar-link bell bell-daemon",role:"img",title:Ib,"aria-label":Ib,children:d.jsx(Xe,{name:"bell",size:15})}):a==="unsupported"?null:d.jsx("button",{className:`topbar-link bell bell-${a}`,title:Bb[a],"aria-label":Bb[a],"aria-pressed":a==="on",onClick:r,children:d.jsx(Xe,{name:a==="on"?"bell":"bellOff",size:15})})}function Gx(){const[i,a]=H.useState(Ub()),r=Nx();return H.useEffect(()=>{const s=()=>a(Ub());return window.addEventListener("hashchange",s),()=>window.removeEventListener("hashchange",s)},[]),i.view==="detail"?d.jsx("div",{className:"app",children:d.jsx(ox,{reviewKey:i.key})}):d.jsxs("div",{className:"app",children:[d.jsx("header",{className:"topbar",children:d.jsxs("div",{className:"bar-inner",children:[d.jsxs("a",{href:"#/",className:"brand",children:[d.jsx(BS,{}),"cerber"]}),d.jsx("span",{className:"tagline",children:"nothing reaches GitHub until you say so"}),d.jsx("span",{className:"grow"}),i.view==="queue"&&d.jsxs(d.Fragment,{children:[d.jsxs("span",{className:"hint",children:[d.jsx(za,{children:"j"}),d.jsx(za,{children:"k"}),"move"]}),d.jsxs("span",{className:"hint",children:[d.jsx(za,{children:"↵"}),"open"]}),d.jsxs("span",{className:"hint",children:[d.jsx(za,{children:"r"}),"review now"]})]}),d.jsx(qx,{daemonAnnounces:r}),d.jsx("a",{href:"#/settings",className:"topbar-link",title:"settings","aria-label":"settings",children:d.jsx(Xe,{name:"settings",size:15})})]})}),i.view==="queue"?d.jsx(kx,{}):d.jsx(Hx,{daemonAnnounces:r})]})}Mx();QE.createRoot(document.getElementById("root")).render(d.jsx(FE.StrictMode,{children:d.jsx(Gx,{})}));export{gN as _,Yx as c,Hb as g,uy as p};
|
package/web/dist/assets/{infoDiagram-MVDRKAX5-Cekh0IW0.js → infoDiagram-MVDRKAX5-D5gtX5ay.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e,l as s,P as o,d as i}from"./mermaid.core-
|
|
1
|
+
import{_ as e,l as s,P as o,d as i}from"./mermaid.core-C6m6PWvg.js";import{p as g}from"./cynefin-EF2NZ3EQ-Dj_GKCLo.js";import"./index-DIVX8aC0.js";var p={parse:e(async r=>{const a=await g("info",r);s.debug(a)},"parse")},d={version:"12.2.0"},v=e(()=>d.version,"getVersion"),m={getVersion:v},c=e((r,a,n)=>{s.debug(`rendering info diagram
|
|
2
2
|
`+r);const t=o(a);i(t,100,400,!0),t.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size",32).style("text-anchor","middle").text(`v${n}`)},"draw"),l={draw:c},b={parser:p,db:m,renderer:l};export{b as diagram};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as o,c as ot,U as ut,P as dt,as as yt,z as ft,m as pt,q as it,a as gt,b as kt,g as mt,s as wt,t as _t,d as bt}from"./mermaid.core-
|
|
1
|
+
import{_ as o,c as ot,U as ut,P as dt,as as yt,z as ft,m as pt,q as it,a as gt,b as kt,g as mt,s as wt,t as _t,d as bt}from"./mermaid.core-C6m6PWvg.js";import"./index-DIVX8aC0.js";var tt=(function(){var e=o(function(M,t,s,i){for(s=s||{},i=M.length;i--;s[M[i]]=t);return s},"o"),h=[1,4],r=[1,14],a=[1,12],l=[1,13],y=[6,7,8],f=[1,20],d=[1,18],m=[1,19],c=[6,7,11],k=[1,6,13,14],g=[1,23],_=[1,24],x=[1,6,7,11,13,14],N={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:o(function(t,s,i,u,p,n,v){var w=n.length-1;switch(p){case 6:case 7:return u;case 15:u.addNode(n[w-1].length,n[w].trim());break;case 16:u.addNode(0,n[w].trim());break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:h},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:h},{6:r,7:[1,10],9:9,12:11,13:a,14:l},e(y,[2,3]),{1:[2,2]},e(y,[2,4]),e(y,[2,5]),{1:[2,6],6:r,12:15,13:a,14:l},{6:r,9:16,12:11,13:a,14:l},{6:f,7:d,10:17,11:m},e(c,[2,18],{14:[1,21]}),e(c,[2,16]),e(c,[2,17]),{6:f,7:d,10:22,11:m},{1:[2,7],6:r,12:15,13:a,14:l},e(k,[2,14],{7:g,11:_}),e(x,[2,8]),e(x,[2,9]),e(x,[2,10]),e(c,[2,15]),e(k,[2,13],{7:g,11:_}),e(x,[2,11]),e(x,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(t,s){if(s.recoverable)this.trace(t);else{var i=new Error(t);throw i.hash=s,i}},"parseError"),parse:o(function(t){var s=this,i=[0],u=[],p=[null],n=[],v=this.table,w="",I=0,S=0,L=2,E=1,R=n.slice.call(arguments,1),b=Object.create(this.lexer),C={yy:{}};for(var z in this.yy)Object.prototype.hasOwnProperty.call(this.yy,z)&&(C.yy[z]=this.yy[z]);b.setInput(t,C.yy),C.yy.lexer=b,C.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var T=b.yylloc;n.push(T);var D=b.options&&b.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function F(P){i.length=i.length-2*P,p.length=p.length-P,n.length=n.length-P}o(F,"popStack");function j(){var P;return P=u.pop()||b.lex()||E,typeof P!="number"&&(P instanceof Array&&(u=P,P=u.pop()),P=s.symbols_[P]||P),P}o(j,"lex");for(var A,W,B,K,H={},X,V,et,Y;;){if(W=i[i.length-1],this.defaultActions[W]?B=this.defaultActions[W]:((A===null||typeof A>"u")&&(A=j()),B=v[W]&&v[W][A]),typeof B>"u"||!B.length||!B[0]){var Q="";Y=[];for(X in v[W])this.terminals_[X]&&X>L&&Y.push("'"+this.terminals_[X]+"'");b.showPosition?Q="Parse error on line "+(I+1)+`:
|
|
2
2
|
`+b.showPosition()+`
|
|
3
3
|
Expecting `+Y.join(", ")+", got '"+(this.terminals_[A]||A)+"'":Q="Parse error on line "+(I+1)+": Unexpected "+(A==E?"end of input":"'"+(this.terminals_[A]||A)+"'"),this.parseError(Q,{text:b.match,token:this.terminals_[A]||A,line:b.yylineno,loc:T,expected:Y})}if(B[0]instanceof Array&&B.length>1)throw new Error("Parse Error: multiple actions possible at state: "+W+", token: "+A);switch(B[0]){case 1:i.push(A),p.push(b.yytext),n.push(b.yylloc),i.push(B[1]),A=null,S=b.yyleng,w=b.yytext,I=b.yylineno,T=b.yylloc;break;case 2:if(V=this.productions_[B[1]][1],H.$=p[p.length-V],H._$={first_line:n[n.length-(V||1)].first_line,last_line:n[n.length-1].last_line,first_column:n[n.length-(V||1)].first_column,last_column:n[n.length-1].last_column},D&&(H._$.range=[n[n.length-(V||1)].range[0],n[n.length-1].range[1]]),K=this.performAction.apply(H,[w,S,I,C.yy,B[1],p,n].concat(R)),typeof K<"u")return K;V&&(i=i.slice(0,-1*V*2),p=p.slice(0,-1*V),n=n.slice(0,-1*V)),i.push(this.productions_[B[1]][0]),p.push(H.$),n.push(H._$),et=v[i[i.length-2]][i[i.length-1]],i.push(et);break;case 3:return!0}}return!0},"parse")},O=(function(){var M={EOF:1,parseError:o(function(s,i){if(this.yy.parser)this.yy.parser.parseError(s,i);else throw new Error(s)},"parseError"),setInput:o(function(t,s){return this.yy=s||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var t=this._input[0];this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t;var s=t.match(/(?:\r\n?|\n).*/g);return s?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:o(function(t){var s=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-s),this.offset-=s;var u=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var p=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===u.length?this.yylloc.first_column:0)+u[u.length-i.length].length-i[0].length:this.yylloc.first_column-s},this.options.ranges&&(this.yylloc.range=[p[0],p[0]+this.yyleng-s]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(t){this.unput(this.match.slice(t))},"less"),pastInput:o(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var t=this.pastInput(),s=new Array(t.length+1).join("-");return t+this.upcomingInput()+`
|
package/web/dist/assets/{journeyDiagram-BOSHW7O7-kDJSSn-6.js → journeyDiagram-BOSHW7O7-BfKDxBMF.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as gt}from"./chunk-5VM5RSS4-
|
|
1
|
+
import{g as gt}from"./chunk-5VM5RSS4-B0DDtSF3.js";import{a as mt,b as lt,h as xt,d as kt}from"./chunk-55XCU76K-DqGA3I0P.js";import{g as _t,s as vt,a as bt,b as wt,t as Tt,q as St,_ as s,c as R,k as X,d as $t,z as Mt}from"./mermaid.core-C6m6PWvg.js";import{d as it}from"./arc-CvrQr7ke.js";import"./index-DIVX8aC0.js";var U=(function(){var t=s(function(h,r,n,l){for(n=n||{},l=h.length;l--;n[h[l]]=r);return n},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],f=[1,10],i=[1,11],u=[1,12],p=[1,13],o=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(r,n,l,y,d,c,v){var k=c.length-1;switch(d){case 1:return c[k-1];case 2:this.$=[];break;case 3:c[k-1].push(c[k]),this.$=c[k-1];break;case 4:case 5:this.$=c[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[k].substr(6)),this.$=c[k].substr(6);break;case 9:this.$=c[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[k].substr(8)),this.$=c[k].substr(8);break;case 13:y.addTask(c[k-1],c[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(r,n){if(n.recoverable)this.trace(r);else{var l=new Error(r);throw l.hash=n,l}},"parseError"),parse:s(function(r){var n=this,l=[0],y=[],d=[null],c=[],v=this.table,k="",C=0,Q=0,yt=2,D=1,dt=c.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(r,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;c.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,d.length=d.length-w,c.length=c.length-w}s(pt,"popStack");function tt(){var w;return w=y.pop()||_.lex()||D,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=n.symbols_[w]||w),w}s(tt,"lex");for(var b,A,T,q,F={},N,M,et,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((b===null||typeof b>"u")&&(b=tt()),T=v[A]&&v[A][b]),typeof T>"u"||!T.length||!T[0]){var H="";z=[];for(N in v[A])this.terminals_[N]&&N>yt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?H="Parse error on line "+(C+1)+`:
|
|
2
2
|
`+_.showPosition()+`
|
|
3
3
|
Expecting `+z.join(", ")+", got '"+(this.terminals_[b]||b)+"'":H="Parse error on line "+(C+1)+": Unexpected "+(b==D?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(H,{text:_.match,token:this.terminals_[b]||b,line:_.yylineno,loc:Y,expected:z})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+A+", token: "+b);switch(T[0]){case 1:l.push(b),d.push(_.yytext),c.push(_.yylloc),l.push(T[1]),b=null,Q=_.yyleng,k=_.yytext,C=_.yylineno,Y=_.yylloc;break;case 2:if(M=this.productions_[T[1]][1],F.$=d[d.length-M],F._$={first_line:c[c.length-(M||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(M||1)].first_column,last_column:c[c.length-1].last_column},ft&&(F._$.range=[c[c.length-(M||1)].range[0],c[c.length-1].range[1]]),q=this.performAction.apply(F,[k,Q,C,I.yy,T[1],d,c].concat(dt)),typeof q<"u")return q;M&&(l=l.slice(0,-1*M*2),d=d.slice(0,-1*M),c=c.slice(0,-1*M)),l.push(this.productions_[T[1]][0]),d.push(F.$),c.push(F._$),et=v[l[l.length-2]][l[l.length-1]],l.push(et);break;case 3:return!0}}return!0},"parse")},m=(function(){var h={EOF:1,parseError:s(function(n,l){if(this.yy.parser)this.yy.parser.parseError(n,l);else throw new Error(n)},"parseError"),setInput:s(function(r,n){return this.yy=n||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:s(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var n=r.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:s(function(r){var n=r.length,l=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var d=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===y.length?this.yylloc.first_column:0)+y[y.length-l.length].length-l[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[d[0],d[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:s(function(){return this._more=!0,this},"more"),reject:s(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:s(function(r){this.unput(this.match.slice(r))},"less"),pastInput:s(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:s(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:s(function(){var r=this.pastInput(),n=new Array(r.length+1).join("-");return r+this.upcomingInput()+`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as c,l as te,c as W,P as fe,ak as ye,al as be,am as me,a3 as ke,N as Y,j as G,v as _e,J as Ee,a0 as Se,a1 as le,a2 as ce}from"./mermaid.core-
|
|
1
|
+
import{_ as c,l as te,c as W,P as fe,ak as ye,al as be,am as me,a3 as ke,N as Y,j as G,v as _e,J as Ee,a0 as Se,a1 as le,a2 as ce}from"./mermaid.core-C6m6PWvg.js";import{g as Ne}from"./chunk-5VM5RSS4-B0DDtSF3.js";import"./index-DIVX8aC0.js";var $=(function(){var t=c(function(k,s,n,a){for(n=n||{},a=k.length;a--;n[k[a]]=s);return n},"o"),g=[1,4],d=[1,13],r=[1,12],p=[1,15],_=[1,16],f=[1,20],h=[1,19],L=[6,7,8],C=[1,26],w=[1,24],N=[1,25],i=[6,7,11],j=[1,31],x=[6,7,11,24],P=[1,6,13,16,17,20,23],M=[1,35],U=[1,36],A=[1,6,7,11,13,16,17,20,23],H=[1,38],V={trace:c(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:c(function(s,n,a,o,u,e,B){var l=e.length-1;switch(u){case 6:case 7:return o;case 8:o.getLogger().trace("Stop NL ");break;case 9:o.getLogger().trace("Stop EOF ");break;case 11:o.getLogger().trace("Stop NL2 ");break;case 12:o.getLogger().trace("Stop EOF2 ");break;case 15:o.getLogger().info("Node: ",e[l-1].id),o.addNode(e[l-2].length,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 16:o.getLogger().info("Node: ",e[l].id),o.addNode(e[l-1].length,e[l].id,e[l].descr,e[l].type);break;case 17:o.getLogger().trace("Icon: ",e[l]),o.decorateNode({icon:e[l]});break;case 18:case 23:o.decorateNode({class:e[l]});break;case 19:o.getLogger().trace("SPACELIST");break;case 20:o.getLogger().trace("Node: ",e[l-1].id),o.addNode(0,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 21:o.getLogger().trace("Node: ",e[l].id),o.addNode(0,e[l].id,e[l].descr,e[l].type);break;case 22:o.decorateNode({icon:e[l]});break;case 27:o.getLogger().trace("node found ..",e[l-2]),this.$={id:e[l-1],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 28:this.$={id:e[l],descr:e[l],type:0};break;case 29:o.getLogger().trace("node found ..",e[l-3]),this.$={id:e[l-3],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 30:this.$=e[l-1]+e[l];break;case 31:this.$=e[l];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:g},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:g},{6:d,7:[1,10],9:9,12:11,13:r,14:14,16:p,17:_,18:17,19:18,20:f,23:h},t(L,[2,3]),{1:[2,2]},t(L,[2,4]),t(L,[2,5]),{1:[2,6],6:d,12:21,13:r,14:14,16:p,17:_,18:17,19:18,20:f,23:h},{6:d,9:22,12:11,13:r,14:14,16:p,17:_,18:17,19:18,20:f,23:h},{6:C,7:w,10:23,11:N},t(i,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:f,23:h}),t(i,[2,19]),t(i,[2,21],{15:30,24:j}),t(i,[2,22]),t(i,[2,23]),t(x,[2,25]),t(x,[2,26]),t(x,[2,28],{20:[1,32]}),{21:[1,33]},{6:C,7:w,10:34,11:N},{1:[2,7],6:d,12:21,13:r,14:14,16:p,17:_,18:17,19:18,20:f,23:h},t(P,[2,14],{7:M,11:U}),t(A,[2,8]),t(A,[2,9]),t(A,[2,10]),t(i,[2,16],{15:37,24:j}),t(i,[2,17]),t(i,[2,18]),t(i,[2,20],{24:H}),t(x,[2,31]),{21:[1,39]},{22:[1,40]},t(P,[2,13],{7:M,11:U}),t(A,[2,11]),t(A,[2,12]),t(i,[2,15],{24:H}),t(x,[2,30]),{22:[1,41]},t(x,[2,27]),t(x,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:c(function(s,n){if(n.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=n,a}},"parseError"),parse:c(function(s){var n=this,a=[0],o=[],u=[null],e=[],B=this.table,l="",z=0,ie=0,ue=2,re=1,ge=e.slice.call(arguments,1),m=Object.create(this.lexer),T={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(T.yy[J]=this.yy[J]);m.setInput(s,T.yy),T.yy.lexer=m,T.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var q=m.yylloc;e.push(q);var de=m.options&&m.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){a.length=a.length-2*S,u.length=u.length-S,e.length=e.length-S}c(pe,"popStack");function ae(){var S;return S=o.pop()||m.lex()||re,typeof S!="number"&&(S instanceof Array&&(o=S,S=o.pop()),S=n.symbols_[S]||S),S}c(ae,"lex");for(var E,R,v,Q,F={},X,I,oe,K;;){if(R=a[a.length-1],this.defaultActions[R]?v=this.defaultActions[R]:((E===null||typeof E>"u")&&(E=ae()),v=B[R]&&B[R][E]),typeof v>"u"||!v.length||!v[0]){var Z="";K=[];for(X in B[R])this.terminals_[X]&&X>ue&&K.push("'"+this.terminals_[X]+"'");m.showPosition?Z="Parse error on line "+(z+1)+`:
|
|
2
2
|
`+m.showPosition()+`
|
|
3
3
|
Expecting `+K.join(", ")+", got '"+(this.terminals_[E]||E)+"'":Z="Parse error on line "+(z+1)+": Unexpected "+(E==re?"end of input":"'"+(this.terminals_[E]||E)+"'"),this.parseError(Z,{text:m.match,token:this.terminals_[E]||E,line:m.yylineno,loc:q,expected:K})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+R+", token: "+E);switch(v[0]){case 1:a.push(E),u.push(m.yytext),e.push(m.yylloc),a.push(v[1]),E=null,ie=m.yyleng,l=m.yytext,z=m.yylineno,q=m.yylloc;break;case 2:if(I=this.productions_[v[1]][1],F.$=u[u.length-I],F._$={first_line:e[e.length-(I||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(I||1)].first_column,last_column:e[e.length-1].last_column},de&&(F._$.range=[e[e.length-(I||1)].range[0],e[e.length-1].range[1]]),Q=this.performAction.apply(F,[l,ie,z,T.yy,v[1],u,e].concat(ge)),typeof Q<"u")return Q;I&&(a=a.slice(0,-1*I*2),u=u.slice(0,-1*I),e=e.slice(0,-1*I)),a.push(this.productions_[v[1]][0]),u.push(F.$),e.push(F._$),oe=B[a[a.length-2]][a[a.length-1]],a.push(oe);break;case 3:return!0}}return!0},"parse")},y=(function(){var k={EOF:1,parseError:c(function(n,a){if(this.yy.parser)this.yy.parser.parseError(n,a);else throw new Error(n)},"parseError"),setInput:c(function(s,n){return this.yy=n||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:c(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var n=s.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:c(function(s){var n=s.length,a=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var o=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),a.length-1&&(this.yylineno-=a.length-1);var u=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:a?(a.length===o.length?this.yylloc.first_column:0)+o[o.length-a.length].length-a[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[u[0],u[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:c(function(){return this._more=!0,this},"more"),reject:c(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:c(function(s){this.unput(this.match.slice(s))},"less"),pastInput:c(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:c(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:c(function(){var s=this.pastInput(),n=new Array(s.length+1).join("-");return s+this.upcomingInput()+`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bi as S,bj as p,bk as w,bl as k,bm as q}from"./mermaid.core-
|
|
1
|
+
import{bi as S,bj as p,bk as w,bl as k,bm as q}from"./mermaid.core-C6m6PWvg.js";import{i as D}from"./init-Gi6I4Gst.js";import{e as g,f as F,a as z,b as B}from"./defaultLocale-DX6XiGOO.js";function M(n,r){return n==null||r==null?NaN:n<r?-1:n>r?1:n>=r?0:NaN}function I(n,r){return n==null||r==null?NaN:r<n?-1:r>n?1:r>=n?0:NaN}function R(n){let r,t,e;n.length!==2?(r=M,t=(o,c)=>M(n(o),c),e=(o,c)=>n(o)-c):(r=n===M||n===I?n:P,t=n,e=n);function u(o,c,i=0,h=o.length){if(i<h){if(r(c,c)!==0)return h;do{const l=i+h>>>1;t(o[l],c)<0?i=l+1:h=l}while(i<h)}return i}function f(o,c,i=0,h=o.length){if(i<h){if(r(c,c)!==0)return h;do{const l=i+h>>>1;t(o[l],c)<=0?i=l+1:h=l}while(i<h)}return i}function a(o,c,i=0,h=o.length){const l=u(o,c,i,h-1);return l>i&&e(o[l-1],c)>-e(o[l],c)?l-1:l}return{left:u,center:a,right:f}}function P(){return 0}function V(n){return n===null?NaN:+n}const $=R(M),x=$.right;R(V).center;const O=Math.sqrt(50),T=Math.sqrt(10),C=Math.sqrt(2);function v(n,r,t){const e=(r-n)/Math.max(0,t),u=Math.floor(Math.log10(e)),f=e/Math.pow(10,u),a=f>=O?10:f>=T?5:f>=C?2:1;let o,c,i;return u<0?(i=Math.pow(10,-u)/a,o=Math.round(n*i),c=Math.round(r*i),o/i<n&&++o,c/i>r&&--c,i=-i):(i=Math.pow(10,u)*a,o=Math.round(n/i),c=Math.round(r/i),o*i<n&&++o,c*i>r&&--c),c<o&&.5<=t&&t<2?v(n,r,t*2):[o,c,i]}function E(n,r,t){if(r=+r,n=+n,t=+t,!(t>0))return[];if(n===r)return[n];const e=r<n,[u,f,a]=e?v(r,n,t):v(n,r,t);if(!(f>=u))return[];const o=f-u+1,c=new Array(o);if(e)if(a<0)for(let i=0;i<o;++i)c[i]=(f-i)/-a;else for(let i=0;i<o;++i)c[i]=(f-i)*a;else if(a<0)for(let i=0;i<o;++i)c[i]=(u+i)/-a;else for(let i=0;i<o;++i)c[i]=(u+i)*a;return c}function y(n,r,t){return r=+r,n=+n,t=+t,v(n,r,t)[2]}function G(n,r,t){r=+r,n=+n,t=+t;const e=r<n,u=e?y(r,n,t):y(n,r,t);return(e?-1:1)*(u<0?1/-u:u)}function H(n,r){r||(r=[]);var t=n?Math.min(r.length,n.length):0,e=r.slice(),u;return function(f){for(u=0;u<t;++u)e[u]=n[u]*(1-f)+r[u]*f;return e}}function J(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function K(n,r){var t=r?r.length:0,e=n?Math.min(t,n.length):0,u=new Array(e),f=new Array(t),a;for(a=0;a<e;++a)u[a]=d(n[a],r[a]);for(;a<t;++a)f[a]=r[a];return function(o){for(a=0;a<e;++a)f[a]=u[a](o);return f}}function L(n,r){var t=new Date;return n=+n,r=+r,function(e){return t.setTime(n*(1-e)+r*e),t}}function Q(n,r){var t={},e={},u;(n===null||typeof n!="object")&&(n={}),(r===null||typeof r!="object")&&(r={});for(u in r)u in n?t[u]=d(n[u],r[u]):e[u]=r[u];return function(f){for(u in t)e[u]=t[u](f);return e}}function d(n,r){var t=typeof r,e;return r==null||t==="boolean"?S(r):(t==="number"?p:t==="string"?(e=w(r))?(r=e,k):q:r instanceof w?k:r instanceof Date?L:J(r)?H:Array.isArray(r)?K:typeof r.valueOf!="function"&&typeof r.toString!="function"||isNaN(r)?Q:p)(n,r)}function U(n,r){return n=+n,r=+r,function(t){return Math.round(n*(1-t)+r*t)}}function W(n){return Math.max(0,-g(Math.abs(n)))}function X(n,r){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(g(r)/3)))*3-g(Math.abs(n)))}function Y(n,r){return n=Math.abs(n),r=Math.abs(r)-n,Math.max(0,g(r)-g(n))+1}function Z(n){return function(){return n}}function _(n){return+n}var A=[0,1];function m(n){return n}function N(n,r){return(r-=n=+n)?function(t){return(t-n)/r}:Z(isNaN(r)?NaN:.5)}function b(n,r){var t;return n>r&&(t=n,n=r,r=t),function(e){return Math.max(n,Math.min(r,e))}}function nn(n,r,t){var e=n[0],u=n[1],f=r[0],a=r[1];return u<e?(e=N(u,e),f=t(a,f)):(e=N(e,u),f=t(f,a)),function(o){return f(e(o))}}function rn(n,r,t){var e=Math.min(n.length,r.length)-1,u=new Array(e),f=new Array(e),a=-1;for(n[e]<n[0]&&(n=n.slice().reverse(),r=r.slice().reverse());++a<e;)u[a]=N(n[a],n[a+1]),f[a]=t(r[a],r[a+1]);return function(o){var c=x(n,o,1,e)-1;return f[c](u[c](o))}}function en(n,r){return r.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown())}function tn(){var n=A,r=A,t=d,e,u,f,a=m,o,c,i;function h(){var s=Math.min(n.length,r.length);return a!==m&&(a=b(n[0],n[s-1])),o=s>2?rn:nn,c=i=null,l}function l(s){return s==null||isNaN(s=+s)?f:(c||(c=o(n.map(e),r,t)))(e(a(s)))}return l.invert=function(s){return a(u((i||(i=o(r,n.map(e),p)))(s)))},l.domain=function(s){return arguments.length?(n=Array.from(s,_),h()):n.slice()},l.range=function(s){return arguments.length?(r=Array.from(s),h()):r.slice()},l.rangeRound=function(s){return r=Array.from(s),t=U,h()},l.clamp=function(s){return arguments.length?(a=s?!0:m,h()):a!==m},l.interpolate=function(s){return arguments.length?(t=s,h()):t},l.unknown=function(s){return arguments.length?(f=s,l):f},function(s,j){return e=s,u=j,h()}}function un(){return tn()(m,m)}function an(n,r,t,e){var u=G(n,r,t),f;switch(e=F(e??",f"),e.type){case"s":{var a=Math.max(Math.abs(n),Math.abs(r));return e.precision==null&&!isNaN(f=X(u,a))&&(e.precision=f),z(e,a)}case"":case"e":case"g":case"p":case"r":{e.precision==null&&!isNaN(f=Y(u,Math.max(Math.abs(n),Math.abs(r))))&&(e.precision=f-(e.type==="e"));break}case"f":case"%":{e.precision==null&&!isNaN(f=W(u))&&(e.precision=f-(e.type==="%")*2);break}}return B(e)}function on(n){var r=n.domain;return n.ticks=function(t){var e=r();return E(e[0],e[e.length-1],t??10)},n.tickFormat=function(t,e){var u=r();return an(u[0],u[u.length-1],t??10,e)},n.nice=function(t){t==null&&(t=10);var e=r(),u=0,f=e.length-1,a=e[u],o=e[f],c,i,h=10;for(o<a&&(i=a,a=o,o=i,i=u,u=f,f=i);h-- >0;){if(i=y(a,o,t),i===c)return e[u]=a,e[f]=o,r(e);if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else if(i<0)a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i;else break;c=i}return n},n}function fn(){var n=un();return n.copy=function(){return en(n,fn())},D.apply(n,arguments),on(n)}export{en as a,R as b,un as c,fn as l,G as t};
|