@knpkv/codecommit-web 0.16.0 → 0.17.0

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.
Files changed (79) hide show
  1. package/README.md +13 -0
  2. package/dist/client/assets/index-BQbzvlT7.js +90 -0
  3. package/dist/client/assets/index-Rg2HVfx7.css +1 -0
  4. package/dist/client/assets/pr-review-workspace-B7GX-PRi.js +23 -0
  5. package/dist/client/index.html +2 -2
  6. package/dist/pull-request-coordinates.d.ts.map +1 -1
  7. package/dist/pull-request-coordinates.js +5 -4
  8. package/dist/pull-request-coordinates.js.map +1 -1
  9. package/dist/server/Api.d.ts +243 -243
  10. package/dist/server/Api.d.ts.map +1 -1
  11. package/dist/server/Api.js +1 -1
  12. package/dist/server/Api.js.map +1 -1
  13. package/dist/server/Server.d.ts +3 -3
  14. package/dist/server/Server.d.ts.map +1 -1
  15. package/dist/server/Server.js +13 -11
  16. package/dist/server/Server.js.map +1 -1
  17. package/dist/server/handlers/accounts-live.d.ts +1 -1
  18. package/dist/server/handlers/accounts-live.d.ts.map +1 -1
  19. package/dist/server/handlers/accounts-live.js +1 -1
  20. package/dist/server/handlers/accounts-live.js.map +1 -1
  21. package/dist/server/handlers/audit-live.d.ts +1 -1
  22. package/dist/server/handlers/audit-live.d.ts.map +1 -1
  23. package/dist/server/handlers/audit-live.js +1 -1
  24. package/dist/server/handlers/audit-live.js.map +1 -1
  25. package/dist/server/handlers/config-live.d.ts +1 -1
  26. package/dist/server/handlers/config-live.d.ts.map +1 -1
  27. package/dist/server/handlers/config-live.js +2 -2
  28. package/dist/server/handlers/config-live.js.map +1 -1
  29. package/dist/server/handlers/events-live.d.ts +1 -1
  30. package/dist/server/handlers/events-live.d.ts.map +1 -1
  31. package/dist/server/handlers/events-live.js +26 -8
  32. package/dist/server/handlers/events-live.js.map +1 -1
  33. package/dist/server/handlers/notifications-live.d.ts +2 -2
  34. package/dist/server/handlers/notifications-live.d.ts.map +1 -1
  35. package/dist/server/handlers/notifications-live.js +2 -2
  36. package/dist/server/handlers/notifications-live.js.map +1 -1
  37. package/dist/server/handlers/permissions-live.d.ts +1 -1
  38. package/dist/server/handlers/permissions-live.d.ts.map +1 -1
  39. package/dist/server/handlers/permissions-live.js +1 -1
  40. package/dist/server/handlers/permissions-live.js.map +1 -1
  41. package/dist/server/handlers/prs-live.d.ts +3 -3
  42. package/dist/server/handlers/prs-live.d.ts.map +1 -1
  43. package/dist/server/handlers/prs-live.js +3 -3
  44. package/dist/server/handlers/prs-live.js.map +1 -1
  45. package/dist/server/handlers/sandbox-live.d.ts +1 -1
  46. package/dist/server/handlers/sandbox-live.d.ts.map +1 -1
  47. package/dist/server/handlers/sandbox-live.js +2 -2
  48. package/dist/server/handlers/sandbox-live.js.map +1 -1
  49. package/dist/server/handlers/stats-live.d.ts +1 -1
  50. package/dist/server/handlers/stats-live.d.ts.map +1 -1
  51. package/dist/server/handlers/stats-live.js +1 -1
  52. package/dist/server/handlers/stats-live.js.map +1 -1
  53. package/dist/server/handlers/subscriptions-live.d.ts +1 -1
  54. package/dist/server/handlers/subscriptions-live.d.ts.map +1 -1
  55. package/dist/server/handlers/subscriptions-live.js +1 -1
  56. package/dist/server/handlers/subscriptions-live.js.map +1 -1
  57. package/dist/server/internal/OwnerSessionSecurity.d.ts +19 -8
  58. package/dist/server/internal/OwnerSessionSecurity.d.ts.map +1 -1
  59. package/dist/server/internal/OwnerSessionSecurity.js +109 -32
  60. package/dist/server/internal/OwnerSessionSecurity.js.map +1 -1
  61. package/dist/server/internal/PublicOrigin.d.ts +9 -0
  62. package/dist/server/internal/PublicOrigin.d.ts.map +1 -0
  63. package/dist/server/internal/PublicOrigin.js +17 -0
  64. package/dist/server/internal/PublicOrigin.js.map +1 -0
  65. package/dist/server/review/PullRequestReview.d.ts +1 -1
  66. package/dist/server/review/PullRequestReview.d.ts.map +1 -1
  67. package/dist/server/review/PullRequestReview.js +1 -1
  68. package/dist/server/review/PullRequestReview.js.map +1 -1
  69. package/dist/server/review/ReviewSkillCatalog.js +2 -2
  70. package/dist/tooling/authenticated-dev-proxy.d.ts +20 -5
  71. package/dist/tooling/authenticated-dev-proxy.d.ts.map +1 -1
  72. package/dist/tooling/authenticated-dev-proxy.js +25 -9
  73. package/dist/tooling/authenticated-dev-proxy.js.map +1 -1
  74. package/dist/tooling/authenticated-dev-proxy.test.js +96 -5
  75. package/dist/tooling/authenticated-dev-proxy.test.js.map +1 -1
  76. package/package.json +32 -26
  77. package/dist/client/assets/index-DqzI_8bH.js +0 -90
  78. package/dist/client/assets/index-Ds8Muxxv.css +0 -1
  79. package/dist/client/assets/pr-review-workspace-Ca3Vmiye.js +0 -22
@@ -0,0 +1,23 @@
1
+ import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as _,R as ee,S as v,U as y,V as b,W as x,X as te,Y as ne,Z as S,_ as re,a as C,at as ie,b as ae,c as oe,ct as se,d as w,et as ce,f as le,g as ue,h as de,i as T,it as fe,j as E,k as pe,l as me,lt as he,m as ge,n as _e,nt as ve,o as ye,ot as D,p as be,q as O,r as xe,rt as k,s as A,st as j,t as Se,tt as M,u as N,ut as Ce,v as we,w as P,x as Te,y as Ee,z as F}from"./index-BQbzvlT7.js";var De={name:`bot`,size:24,node:[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]};De.node;var Oe=D(De),I={name:`file-pen-line`,size:24,node:[[`path`,{d:`M14.364 13.634a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506l4.013-4.009a1 1 0 0 0-3.004-3.004z`,key:`ukzhwg`}],[`path`,{d:`M14.487 7.858A1 1 0 0 1 14 7V2`,key:`1klhew`}],[`path`,{d:`M20 19.645V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l2.516 2.516`,key:`rxaxab`}],[`path`,{d:`M8 18h1`,key:`13wk12`}]],aliases:[`file-signature`]};I.node;var ke=D(I),Ae={name:`file-plus-corner`,size:24,node:[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]],aliases:[`file-plus-2`]};Ae.node;var je=D(Ae),Me={name:`file-search`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`11.5`,cy:`14.5`,r:`2.5`,key:`1bq0ko`}],[`path`,{d:`M13.3 16.3 15 18`,key:`2quom7`}]]};Me.node;var L=D(Me),Ne={name:`file-symlink`,size:24,node:[[`path`,{d:`M4 11V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7`,key:`huwfnr`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m10 18 3-3-3-3`,key:`18f6ys`}]]};Ne.node;var Pe=D(Ne),Fe={name:`file-x-corner`,size:24,node:[[`path`,{d:`M11 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5`,key:`1jo35a`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m15 17 5 5`,key:`36xl1x`}],[`path`,{d:`m20 17-5 5`,key:`vdz27y`}]],aliases:[`file-x-2`]};Fe.node;var Ie=D(Fe),Le={name:`message-square-more`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 11h.01`,key:`z322tv`}],[`path`,{d:`M16 11h.01`,key:`xkw8gn`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}]]};Le.node;var Re=D(Le),R={name:`test-tube-diagonal`,size:24,node:[[`path`,{d:`M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3`,key:`1ub6xw`}],[`path`,{d:`m16 2 6 6`,key:`1gw87d`}],[`path`,{d:`M12 16H4`,key:`1cjfip`}]],aliases:[`test-tube-2`]};R.node;var ze=D(R),z=Ce(he(),1),B=j(),Be=/(?=^diff --git)/gm,Ve=/^(---|\+\+\+)\s+([^\t\r\n]+)/,V=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i;Object.freeze({fromStart:0,fromEnd:0});function H(e,t){return e-(t===0?0:1)}function He(e,t){return H(e,t)+t}var U=1;function Ue(e,...t){return`ck${U}:${JSON.stringify([e,...t])}`}function W(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var G=new TextEncoder,We=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Ge=/[\uD800-\uDFFF]/,K=1024,q=new Uint8Array(K);function J(){q.length!==K&&(q=new Uint8Array(K))}function Y(e){if(e.length===0)return e;if(Ge.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;q.length<t&&(q=new Uint8Array(t));let{written:n}=G.encodeInto(e,q);return We.decode(q.subarray(0,n))}var Ke=new TextDecoder(`utf-8`,{ignoreBOM:!0}),qe={'"':`"`,"\\":`\\`,a:`\x07`,b:`\b`,t:` `,n:`
2
+ `,v:`\v`,f:`\f`,r:`\r`};function Je(e){if(e[0]!==`"`)return;let t=``,n=1;for(;n<e.length;){let r=e[n];if(r===`"`)return{fileName:t,rawLength:n+1};if(r!==`\\`){t+=r,n++;continue}let i=qe[e[n+1]];if(i!=null){t+=i,n+=2;continue}let a=[];do{let t=Ye(e,n+1);if(t==null)return;a.push(t),n+=4}while(e[n]===`\\`&&e[n+1]>=`0`&&e[n+1]<=`7`);t+=Ke.decode(new Uint8Array(a))}}function Ye(e,t){let n=e.charCodeAt(t)-48,r=e.charCodeAt(t+1)-48,i=e.charCodeAt(t+2)-48;if(n>=0&&n<=3&&r>=0&&r<=7&&i>=0&&i<=7)return n*64+r*8+i}var Xe=4096,Ze=.5;function Qe(e){for(let t of e.hunks)for(let n=0;n<t.hunkContent.length;n++){let r=t.hunkContent[n];if(r.type!==`change`)continue;let i=$e(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}}function $e(e,t){let{deletions:n,additions:r,deletionLineIndex:i,additionLineIndex:a}=t,o=Math.min(n,r),s=Math.abs(r-n);if(o===0||s===0||o*(s+1)>Xe)return null;let c=[];for(let t=0;t<n;t++)c.push(tt(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(tt(e.additionLines[a+t]??``));let u=r>n,d=0,f=-1;for(let e=0;e<=s;e++){let t=0;for(let n=0;n<o;n++)t+=nt(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*Ze:t>f&&(f=t,d=e)}if(d===0)return null;let p=[],m=(e,t,n,r)=>{(e>0||t>0)&&p.push({type:`change`,deletions:e,additions:t,deletionLineIndex:n,additionLineIndex:r})};return u?(m(0,d,i,a),m(o,o,i,a+d),m(0,r-o-d,i+o,a+d+o)):(m(d,0,i,a),m(o,o,i+d,a),m(n-o-d,0,i+d+o,a+o)),p}var et=/\s+/g;function tt(e){return e.replace(et,``)}function nt(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),r=Math.min(e.length,t.length);if(r===0)return 0;let i=0;for(;i<r&&e[i]===t[i];)i++;let a=0;for(;a<r-i&&e[e.length-1-a]===t[t.length-1-a];)a++;return(i+a)/n}var X=/^diff --git ("a\/(?:[^"\\]|\\.)*"|a\/.+?) ("b\/(?:[^"\\]|\\.)*"|b\/.+?)$/;function rt(e,t){try{return it(e,t)}finally{J()}}function it(e,{cacheKey:t,isGitDiff:n=Be.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=pt(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=st(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=ut(f),m=0,h=0;if(p==null||c==null){if(c!=null){if(a)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}c={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:l,additionLines:!l&&r!=null&&i!=null?ot(i.contents):[],deletionLines:!l&&r!=null&&i!=null?ot(r.contents):[],cacheKey:ht(t)},c.additionLines.length===1&&i?.contents===``&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===``&&(c.deletionLines.length=0);for(let e of s){if(e.startsWith(`diff --git`)){let t=e.trim().match(X);if(t==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}let n=at(t[1],!0),r=at(t[2],!0);c.name=Y(r),n!==r&&(c.prevName=Y(n));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(Ve):null;if(t!=null){let[,e,r]=t,i=at(r,n);if(e===`---`&&i!==`/dev/null`){let e=Y(i);c.prevName=e,c.name=e}else e===`+++`&&i!==`/dev/null`&&(c.name=Y(i))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=Y(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=Y(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=Y(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=Y(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?c.type=`rename-pure`:c.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(V)??[];t!=null&&(c.prevObjectId=Y(t)),n!=null&&(c.newObjectId=Y(n)),r!=null&&(c.mode=Y(r))}(e.startsWith(`rename from `)||e.startsWith(`copy from `))&&(c.prevName=Y(at(e.slice(e.startsWith(`rename`)?12:10)))),(e.startsWith(`rename to `)||e.startsWith(`copy to `))&&(c.name=Y(at(e.slice(e.startsWith(`rename`)?10:8))))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
3
+ `||s[s.length-1]===`\r`||s[s.length-1]===`\r
4
+ `||s[s.length-1]===``);)s.pop();let{additionStart:ee,deletionStart:v}=p;u=l?u:v-1,d=l?d:ee-1;let y={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:ee,additionLines:m,deletionCount:p.deletionCount,deletionStart:v,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:ht(p.hunkContext),hunkSpecs:Y(f),noEOFCRAdditions:!1,noEOFCRDeletions:!1},b=0,x=0;for(let e=1;e<s.length;e++){let t=s[e];if(b>=y.additionCount&&x>=y.deletionCount&&!t.startsWith(`\\`)){if(!ct(t)||lt(t))break;if(a)throw Error(`parsePatchContent: hunk has more lines than expected`)}let n=t[0];if(n!==`+`&&n!==`-`&&n!==` `&&n!==`\\`){if(a)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${n}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let r=gt(n);if(r===`addition`){if(a&&b>=y.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=_t(t);(g==null||g.type!==`change`)&&(g=vt(`change`,u,d),y.hunkContent.push(g)),d++,b++,l&&c.additionLines.push(e),g.additions++,m++,_=`addition`}else if(r===`deletion`){if(a&&x>=y.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=_t(t);(g==null||g.type!==`change`)&&(g=vt(`change`,u,d),y.hunkContent.push(g)),u++,x++,l&&c.deletionLines.push(e),g.deletions++,h++,_=`deletion`}else if(r===`context`){if(a&&(x>=y.deletionCount||b>=y.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=_t(t);(g==null||g.type!==`context`)&&(g=vt(`context`,u,d),y.hunkContent.push(g)),d++,u++,b++,x++,l&&(c.deletionLines.push(e),c.additionLines.push(e)),g.lines++,_=`context`}else if(r===`metadata`&&g!=null){if(g.type===`context`?(y.noEOFCRAdditions=!0,y.noEOFCRDeletions=!0):_===`deletion`?y.noEOFCRDeletions=!0:_===`addition`&&(y.noEOFCRAdditions=!0),l&&(_===`addition`||_===`context`)){let e=c.additionLines.length-1;e>=0&&(c.additionLines[e]=W(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=W(c.deletionLines[e]))}}}if(b!==y.additionCount||x!==y.deletionCount){if(a)throw Error(`parsePatchContent: hunk line count mismatch`);console.error(`parsePatchContent: hunk line count mismatch: "${f.trimEnd()}", declared old/new ${y.deletionCount}/${y.additionCount}, parsed old/new ${x}/${b}`);let e=H(y.additionStart,y.additionCount)+(b===0?0:1),t=H(y.deletionStart,y.deletionCount)+(x===0?0:1);if(!l){let n=e-y.additionStart,r=t-y.deletionStart;y.additionLineIndex+=n,y.deletionLineIndex+=r;for(let e of y.hunkContent)e.additionLineIndex+=n,e.deletionLineIndex+=r}y.additionStart=e,y.deletionStart=t,y.additionCount=b,y.deletionCount=x}y.additionLines=m,y.deletionLines=h,y.collapsedBefore=Math.max(H(y.additionStart,y.additionCount)-o,0),c.hunks.push(y),o=He(y.additionStart,y.additionCount);for(let e of y.hunkContent)e.type===`context`?(y.splitLineCount+=e.lines,y.unifiedLineCount+=e.lines):(y.splitLineCount+=Math.max(e.additions,e.deletions),y.unifiedLineCount+=e.deletions+e.additions);y.splitLineStart=c.splitLineCount+y.collapsedBefore,y.unifiedLineStart=c.unifiedLineCount+y.collapsedBefore,c.splitLineCount+=y.collapsedBefore+y.splitLineCount,c.unifiedLineCount+=y.collapsedBefore+y.unifiedLineCount}if(c!=null){if(a&&l&&!n&&c.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(c.hunks.length>0&&!l&&c.additionLines.length>0&&c.deletionLines.length>0){let e=c.hunks[c.hunks.length-1],t=He(e.additionStart,e.additionCount),n=c.additionLines.length,r=Math.max(n-t,0);c.splitLineCount+=r,c.unifiedLineCount+=r}return n||(c.prevName!=null&&c.name!==c.prevName?c.hunks.length>0?c.type=`rename-changed`:c.type=`rename-pure`:(r==null||r.contents===``)&&i!=null&&i.contents!==``?c.type=`new`:r!=null&&r.contents!==``&&(i==null||i.contents===``)&&(c.type=`deleted`)),c.type!==`rename-pure`&&c.type!==`rename-changed`&&(c.prevName=void 0),Qe(c),c}}function at(e,t=!1){let n=e.trim(),r=n.startsWith(`"`)?Je(n)?.fileName??n:n;return t&&(r.startsWith(`a/`)||r.startsWith(`b/`))?r.slice(2):r}function ot(e){let t=st(e);for(let e=0;e<t.length;e++)t[e]=Y(t[e]);return t}function st(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
5
+ `,n);if(r===-1)break;t.push(e.slice(n,r+1)),n=r+1}return n<e.length&&t.push(e.slice(n)),t}function ct(e){let t=e[0];return t===`+`||t===`-`||t===` `}function lt(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
6
+ `&&n!==`\r`)return!1}return!0}function ut(e){if(!e.startsWith(`@@ -`))return;let t=4,n=dt(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=dt(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=dt(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=dt(e,t+1);if(n==null)return;s=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`@`||e[t+2]!==`@`)return;let c,l=t+3;return e[l]===` `&&(c=ft(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function dt(e,t){let n=t,r=0;for(;n<e.length;n++){let t=e.charCodeAt(n)-48;if(t<0||t>9)break;r=r*10+t}if(n!==t)return{value:r,endIndex:n}}function ft(e){return e.endsWith(`\r
7
+ `)?e.slice(0,-2):e.endsWith(`
8
+ `)?e.slice(0,-1):e}function pt(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:mt(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=mt(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function mt(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function ht(e){return e==null?e:Y(e)}function gt(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function _t(e){let t=e.slice(1);return Y(t===``?`
9
+ `:t)}function vt(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}var yt=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends yt{};function bt(e,t){let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function xt(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function St(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function Ct(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function wt(e,t){return St(e,t,``)}function Tt(e,t){return Ct(e,t,``)}function Et(e,t){return t.slice(0,Dt(e,t))}function Dt(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function Ot(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function kt(e,t){if(t)return jt(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function At(e,t){if(t)return jt(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function jt(e,t){if(!t)return[At(e),kt(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=Ot(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var Mt=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,Nt=RegExp(`[${Mt}]+|\\s+|[^${Mt}]`,`ug`);new class extends yt{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=Ot(e,r)}else n=e.match(Nt)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&Pt(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&Pt(n,i,r,null,t.intlSegmenter),e}};function Pt(e,t,n,r,i){if(t&&n){let[a,o]=jt(t.value,i),[s,c]=jt(n.value,i);if(e){let r=bt(a,s);e.value=Ct(e.value,s,r),t.value=wt(t.value,r),n.value=wt(n.value,r)}if(r){let e=xt(o,c);r.value=St(r.value,c,e),t.value=Tt(t.value,e),n.value=Tt(n.value,e)}}else if(n){if(e){let e=At(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=At(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=At(r.value,i),[a,o]=jt(t.value,i),s=bt(n,a);t.value=wt(t.value,s);let c=xt(wt(n,s),o);t.value=Tt(t.value,c),r.value=St(r.value,n,c),e.value=Ct(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=At(r.value,i),n=Et(kt(t.value,i),e);t.value=Tt(t.value,n)}else if(e){let n=Et(kt(e.value,i),At(t.value,i));t.value=wt(t.value,n)}}new class extends yt{tokenize(e){let t=RegExp(`(\\r?\\n)|[${Mt}]+|[^\\S\\n\\r]+|[^${Mt}]`,`ug`);return e.match(t)||[]}};var Ft=new class extends yt{constructor(){super(...arguments),this.tokenize=Lt}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
10
+ `))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
11
+ `))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
12
+ `)&&(e=e.slice(0,-1)),t.endsWith(`
13
+ `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function It(e,t,n){return Ft.diff(e,t,n)}function Lt(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
14
+ `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function Rt(e){return e==`.`||e==`!`||e==`?`}new class extends yt{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(Rt(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends yt{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends yt{constructor(){super(...arguments),this.tokenize=Lt}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(zt(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function zt(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a=0;for(;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=zt(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=zt(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends yt{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function Bt(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function Vt(e){if(!Bt(e))return e;let t=`"`,n=new TextEncoder().encode(e),r=0;for(;r<n.length;){let e=n[r];t+=e===7?`\\a`:e===8?`\\b`:e===9?`\\t`:e===10?`\\n`:e===11?`\\v`:e===12?`\\f`:e===13?`\\r`:e===34?`\\"`:e===92?`\\\\`:e>=32&&e<=126?String.fromCharCode(e):`\\`+e.toString(8).padStart(3,`0`),r++}return t+=`"`,t}var Ht={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Ut(e,t,n,r,i,a,o){let s;s=o?typeof o==`function`?{callback:o}:o:{},s.context===void 0&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);if(s.callback){let{callback:e}=s;It(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(It(n,r,s));function l(n){if(!n)return;n.push({value:``,lines:[]});function r(e){return e.map(function(e){return` `+e})}let o=[],s=0,l=0,u=[],d=1,f=1;for(let e=0;e<n.length;e++){let t=n[e],i=t.lines||Kt(t.value);if(t.lines=i,t.added||t.removed){if(!s){let t=n[e-1];s=d,l=f,t&&(u=c>0?r(t.lines.slice(-c)):[],s-=u.length,l-=u.length)}for(let e of i)u.push((t.added?`+`:`-`)+e);t.added?f+=i.length:d+=i.length}else{if(s){if(i.length<=c*2&&e<n.length-2)for(let e of r(i))u.push(e);else{let e=Math.min(i.length,c);for(let t of r(i.slice(0,e)))u.push(t);let t={oldStart:s,oldLines:d-s+e,newStart:l,newLines:f-l+e,lines:u};o.push(t),s=0,l=0,u=[]}}d+=i.length,f+=i.length}}for(let e of o)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith(`
15
+ `)?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,`\`),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:o}}}function Wt(e,t){if(t||=Ht,Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(e=>e.isGit))throw Error(`Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)`);return e.map(e=>Wt(e,t)).join(`
16
+ `)}let n=[];if(e.isGit){if(t=Ht,!e.oldFileName)throw Error(`oldFileName must be specified for Git patches`);if(!e.newFileName)throw Error(`newFileName must be specified for Git patches`);let r=e.oldFileName,i=e.newFileName;e.isCreate&&r===`/dev/null`?r=i.replace(/^b\//,`a/`):e.isDelete&&i===`/dev/null`&&(i=r.replace(/^a\//,`b/`)),n.push(`diff --git `+Vt(r)+` `+Vt(i)),e.isDelete&&n.push(`deleted file mode `+(e.oldMode??`100644`)),e.isCreate&&n.push(`new file mode `+(e.newMode??`100644`)),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(n.push(`old mode `+e.oldMode),n.push(`new mode `+e.newMode)),e.isRename&&(n.push(`rename from `+Vt((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+Vt((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+Vt((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+Vt((e.newFileName??``).replace(/^b\//,``))))}else t.includeIndex&&e.oldFileName==e.newFileName&&e.oldFileName!==void 0&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`);let r=e.hunks.length>0;t.includeFileHeaders&&e.oldFileName!==void 0&&e.newFileName!==void 0&&(!e.isGit||r)&&(n.push(`--- `+Vt(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+Vt(e.newFileName)+(e.newHeader?` `+e.newHeader:``)));for(let t=0;t<e.hunks.length;t++){let r=e.hunks[t],i=r.oldLines===0?r.oldStart-1:r.oldStart,a=r.newLines===0?r.newStart-1:r.newStart;n.push(`@@ -`+i+`,`+r.oldLines+` +`+a+`,`+r.newLines+` @@`);for(let e of r.lines)n.push(e)}return n.join(`
17
+ `)+`
18
+ `}function Gt(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;Ut(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?Wt(e,o.headerOptions):void 0)}}))}else{let s=Ut(e,t,n,r,i,a,o);return s?Wt(s,o?.headerOptions):void 0}}function Kt(e){let t=e.endsWith(`
19
+ `),n=e.split(`
20
+ `).map(e=>e+`
21
+ `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}var qt=`/dev/null`;function Jt(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??Yt(),a=t??Yt(),o=rt(Gt(i.name,a.name,i.contents,a.contents,i.header,a.header,n),{cacheKey:(()=>{let n=e?.cacheKey,r=t?.cacheKey;return n!=null&&r!=null?Ue(`diff`,n,r):void 0})(),oldFile:i,newFile:a,throwOnError:r});if(o==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);e===null?(o.type=`new`,o.prevName=void 0):t===null&&(o.type=`deleted`,o.prevName=void 0);let s=t?.lang??(t===null?e?.lang:void 0);return s!=null&&(o.lang=s),o}function Yt(){return{name:qt,contents:``}}var Xt=(e,t)=>{let n=e[t];if(n===void 0)throw Error(`Missing CSS Module class: ${t}`);return n},Zt=(e,t)=>{let n=e.shadowRoot;if(n===null)return null;let r=t.side===`additions`?`data-additions`:`data-deletions`,i=t.side===`additions`?`change-addition`:`change-deletion`,a=t.side===`additions`?`data-line`:`data-alt-line`;return n.querySelector(`[${r}] [data-line="${t.lineNumber}"]`)??n.querySelector(`[data-line="${t.lineNumber}"][data-line-type="${i}"]`)??n.querySelector(`[${a}="${t.lineNumber}"][data-line-type="context"]`)??n.querySelector(`[${a}="${t.lineNumber}"][data-line-type="context-expanded"]`)??n.querySelector(`[${r}] [data-alt-line="${t.lineNumber}"]`)??n.querySelector(`[${r}][data-line="${t.lineNumber}"]`)??n.querySelector(`[${r}][data-alt-line="${t.lineNumber}"]`)},Qt=(e,t)=>{let n=e.closest(`diffs-container`);return n===null?null:Zt(n,t)},$t=(e,t)=>{let n=Qt(e,t);n!==null&&(n.tabIndex=-1,n.focus({preventScroll:!0}))},en=({annotation:e,className:t,returnFocus:n})=>{let r=(0,z.useRef)(null),i=()=>{if(n!==void 0){n();return}r.current!==null&&$t(r.current,e.location)};return(0,z.createElement)(`div`,{ref:r,"aria-label":e.accessibilityLabel,className:t,"data-rly-diff-annotation":e.id,"data-rly-diff-annotation-item":e.location.itemId,"data-rly-diff-annotation-line":e.location.lineNumber,"data-rly-diff-annotation-side":e.location.side,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),i())},role:`group`,tabIndex:0},e.render({annotationId:e.id,location:e.location,returnFocus:i}))},tn=e=>{let t=new Set;for(let n of e){if(n.id.trim().length===0||n.accessibilityLabel.trim().length===0)throw Error(`Diff annotation id and accessibility label must not be blank`);if(n.location.itemId.trim().length===0)throw Error(`Diff annotation ${n.id} location item id must not be blank`);if(!Number.isInteger(n.location.lineNumber)||n.location.lineNumber<1)throw Error(`Diff annotation ${n.id} line number must be a positive integer`);if(t.has(n.id))throw Error(`Diff annotation id ${n.id} must be unique`);t.add(n.id)}},Z={root:`rly_BoundedDiffCodeView-module__root`,file:`rly_BoundedDiffCodeView-module__file`,noChanges:`rly_BoundedDiffCodeView-module__noChanges`,fileName:`rly_BoundedDiffCodeView-module__fileName`,scroller:`rly_BoundedDiffCodeView-module__scroller`,table:`rly_BoundedDiffCodeView-module__table`,hunk:`rly_BoundedDiffCodeView-module__hunk`,lineNumber:`rly_BoundedDiffCodeView-module__lineNumber`,marker:`rly_BoundedDiffCodeView-module__marker`,code:`rly_BoundedDiffCodeView-module__code`,wrappedCode:`rly_BoundedDiffCodeView-module__wrappedCode`,deletion:`rly_BoundedDiffCodeView-module__deletion`,change:`rly_BoundedDiffCodeView-module__change`,deletionCode:`rly_BoundedDiffCodeView-module__deletionCode`,addition:`rly_BoundedDiffCodeView-module__addition`,additionCode:`rly_BoundedDiffCodeView-module__additionCode`,context:`rly_BoundedDiffCodeView-module__context`,annotationRow:`rly_BoundedDiffCodeView-module__annotationRow`,annotationCell:`rly_BoundedDiffCodeView-module__annotationCell`,annotation:`rly_BoundedDiffCodeView-module__annotation`},nn=(e,t)=>({lineNumber:e,side:t}),rn=(e,t)=>e[t]?.replace(/\r?\n$/,``)??``,an=e=>e.hunkSpecs?.trim()??`@@ -${e.deletionStart},${e.deletionCount} +${e.additionStart},${e.additionCount} @@`,on=e=>{if(e.before.contents!==e.after.contents)return Jt({...e.before.cacheKey!==void 0&&{cacheKey:e.before.cacheKey},contents:e.before.contents,name:e.before.name},{...e.after.cacheKey!==void 0&&{cacheKey:e.after.cacheKey},contents:e.after.contents,name:e.after.name},void 0,!0)},sn=(e,t)=>Array.from({length:t.lines},(n,r)=>({addition:{content:rn(e.additionLines,t.additionLineIndex+r),number:t.additionLineIndex+r+1},deletion:{content:rn(e.deletionLines,t.deletionLineIndex+r),number:t.deletionLineIndex+r+1},kind:`context`})),cn=(e,t)=>Array.from({length:Math.max(t.deletions,t.additions)},(n,r)=>({...r<t.additions&&{addition:{content:rn(e.additionLines,t.additionLineIndex+r),number:t.additionLineIndex+r+1}},...r<t.deletions&&{deletion:{content:rn(e.deletionLines,t.deletionLineIndex+r),number:t.deletionLineIndex+r+1}},kind:`change`})),ln=e=>e.hunks.flatMap(t=>[{kind:`hunk`,label:an(t)},...t.hunkContent.flatMap(t=>t.type===`context`?sn(e,t):cn(e,t))]),un=e=>e.hunks.flatMap(t=>[{kind:`hunk`,label:an(t)},...t.hunkContent.flatMap(t=>t.type===`context`?Array.from({length:t.lines},(n,r)=>({additionNumber:t.additionLineIndex+r+1,content:rn(e.additionLines,t.additionLineIndex+r),deletionNumber:t.deletionLineIndex+r+1,kind:`context`})):[...Array.from({length:t.deletions},(n,r)=>({content:rn(e.deletionLines,t.deletionLineIndex+r),deletionNumber:t.deletionLineIndex+r+1,kind:`deletion`})),...Array.from({length:t.additions},(n,r)=>({additionNumber:t.additionLineIndex+r+1,content:rn(e.additionLines,t.additionLineIndex+r),kind:`addition`}))])]),dn=(e,t,n,r,i,a)=>(0,B.jsx)(`code`,{className:i?Z.wrappedCode:Z.code,"data-rly-diff-item":t,...a===void 0?{}:{"data-rly-diff-line-alternate":a.lineNumber,"data-rly-diff-line-side-alternate":a.side},"data-rly-diff-line":n,"data-rly-diff-line-side":r,tabIndex:-1,children:e.length===0?` `:e}),fn=(e,t,n,r)=>{let i=`[data-rly-diff-item="${CSS.escape(t)}"]`;(e?.querySelector(`${i}[data-rly-diff-line="${n}"][data-rly-diff-line-side="${r}"]`)??e?.querySelector(`${i}[data-rly-diff-line-alternate="${n}"][data-rly-diff-line-side-alternate="${r}"]`))?.focus({preventScroll:!0})},pn=(e,t,n,r)=>n===void 0?[]:e.filter(e=>e.location.itemId===t&&e.location.lineNumber===n&&e.location.side===r),mn=(e,t,n,r)=>[...pn(e,t,n.deletion?.number,`deletions`).map(e=>(0,B.jsxs)(`tr`,{className:Z.annotationRow,children:[(0,B.jsx)(`td`,{className:Z.annotationCell,colSpan:2,children:(0,B.jsx)(en,{annotation:e,className:Xt(Z,`annotation`),returnFocus:()=>fn(r(),t,e.location.lineNumber,e.location.side)})}),(0,B.jsx)(`td`,{colSpan:2})]},e.id)),...pn(e,t,n.addition?.number,`additions`).map(e=>(0,B.jsxs)(`tr`,{className:Z.annotationRow,children:[(0,B.jsx)(`td`,{colSpan:2}),(0,B.jsx)(`td`,{className:Z.annotationCell,colSpan:2,children:(0,B.jsx)(en,{annotation:e,className:Xt(Z,`annotation`),returnFocus:()=>fn(r(),t,e.location.lineNumber,e.location.side)})})]},e.id))],hn=(e,t,n,r,i)=>(0,B.jsx)(`table`,{"aria-label":`Changes in ${e.name}`,className:Z.table,children:(0,B.jsx)(`tbody`,{children:ln(e).map((e,a)=>e.kind===`hunk`?(0,B.jsx)(`tr`,{className:Z.hunk,children:(0,B.jsx)(`td`,{colSpan:4,children:e.label})},`${a}:${e.label}`):(0,B.jsxs)(z.Fragment,{children:[(0,B.jsxs)(`tr`,{className:Z[e.kind],children:[(0,B.jsx)(`td`,{className:Z.lineNumber,children:e.deletion?.number}),(0,B.jsx)(`td`,{className:Z.deletionCode,children:e.deletion===void 0?null:dn(e.deletion.content,t,e.deletion.number,`deletions`,i)}),(0,B.jsx)(`td`,{className:Z.lineNumber,children:e.addition?.number}),(0,B.jsx)(`td`,{className:Z.additionCode,children:e.addition===void 0?null:dn(e.addition.content,t,e.addition.number,`additions`,i)})]}),mn(n,t,e,r)]},`${a}:${e.deletion?.number??``}:${e.addition?.number??``}`))})}),gn=(e,t,n,r)=>[...n.deletionNumber===void 0?[]:[nn(n.deletionNumber,`deletions`)],...n.additionNumber===void 0?[]:[nn(n.additionNumber,`additions`)]].flatMap(({lineNumber:n,side:i})=>pn(e,t,n,i).map(e=>(0,B.jsx)(`tr`,{className:Z.annotationRow,children:(0,B.jsx)(`td`,{className:Z.annotationCell,colSpan:4,children:(0,B.jsx)(en,{annotation:e,className:Xt(Z,`annotation`),returnFocus:()=>fn(r(),t,n,i)})})},e.id))),_n=(e,t,n,r,i)=>(0,B.jsx)(`table`,{"aria-label":`Changes in ${e.name}`,className:Z.table,children:(0,B.jsx)(`tbody`,{children:un(e).map((e,a)=>e.kind===`hunk`?(0,B.jsx)(`tr`,{className:Z.hunk,children:(0,B.jsx)(`td`,{colSpan:4,children:e.label})},`${a}:${e.label}`):(0,B.jsxs)(z.Fragment,{children:[(0,B.jsxs)(`tr`,{className:Z[e.kind],children:[(0,B.jsx)(`td`,{className:Z.lineNumber,children:e.deletionNumber}),(0,B.jsx)(`td`,{className:Z.lineNumber,children:e.additionNumber}),(0,B.jsx)(`td`,{className:Z.marker,children:e.kind===`addition`?`+`:e.kind===`deletion`?`−`:` `}),(0,B.jsx)(`td`,{children:dn(e.content,t,e.kind===`deletion`?e.deletionNumber??0:e.additionNumber??0,e.kind===`deletion`?`deletions`:`additions`,i,e.kind===`context`&&e.deletionNumber!==void 0?{lineNumber:e.deletionNumber,side:`deletions`}:void 0)})]}),gn(n,t,e,r)]},`${a}:${e.deletionNumber??``}:${e.additionNumber??``}`))})}),vn=({annotations:e=[],className:t,empty:n=`No renderable source changes.`,initialItems:r,mode:i=`split`,wrap:a=!1})=>{tn(e);let o=(0,z.useRef)(null);return r.length===0?(0,B.jsx)(`p`,{className:t,children:n}):(0,B.jsx)(`div`,{ref:o,className:t===void 0?Xt(Z,`root`):`${Xt(Z,`root`)} ${t}`,"data-rly-diff-code-view":``,"data-rly-diff-mode":i,children:r.map(t=>{let n=on(t);return n===void 0?(0,B.jsx)(`p`,{className:Z.noChanges,children:`No textual changes in this file.`},t.id):(0,B.jsxs)(`section`,{className:Z.file,children:[r.length>1?(0,B.jsx)(`h3`,{className:Z.fileName,children:n.name}):null,(0,B.jsx)(`div`,{className:Z.scroller,children:i===`split`?hn(n,t.id,e,()=>o.current,a):_n(n,t.id,e,()=>o.current,a)})]},t.id)})})},yn={root:`rly_DiffFileTree-module__root`,header:`rly_DiffFileTree-module__header`,eyebrow:`rly_DiffFileTree-module__eyebrow`,notice:`rly_DiffFileTree-module__notice`,empty:`rly_DiffFileTree-module__empty`,error:`rly_DiffFileTree-module__error`,previousPath:`rly_DiffFileTree-module__previousPath`,count:`rly_DiffFileTree-module__count`,list:`rly_DiffFileTree-module__list`,directory:`rly_DiffFileTree-module__directory`,group:`rly_DiffFileTree-module__group`,directoryButton:`rly_DiffFileTree-module__directoryButton`,chevron:`rly_DiffFileTree-module__chevron`,directoryName:`rly_DiffFileTree-module__directoryName`,directoryCount:`rly_DiffFileTree-module__directoryCount`,file:`rly_DiffFileTree-module__file`,pathBlock:`rly_DiffFileTree-module__pathBlock`,path:`rly_DiffFileTree-module__path`,statusIcons:`rly_DiffFileTree-module__statusIcons`,statusIcon:`rly_DiffFileTree-module__statusIcon`,loadingIcon:`rly_DiffFileTree-module__loadingIcon`,"rly-diff-file-tree-spin":`rly_DiffFileTree-module__rly-diff-file-tree-spin`},Q=e=>le(yn,e),bn=e=>e.state===`ready`?`Ready`:e.state===`loading`?w(e.label,`DiffFileTree loading label`):`${e.state}: ${w(e.reason,`DiffFileTree ${e.state} reason`)}`,xn=e=>e.split(`/`).map(e=>e!==e.trim()||/[\t\n\v\f\r]/u.test(e)?JSON.stringify(e):e).join(`/`),Sn=(e,t)=>{if(e.length===0)throw Error(`${t} must not be empty`);return e},Cn={added:je,deleted:Ie,modified:ke,renamed:Pe},wn=e=>{let t=new Set;for(let n of e.files){let e=w(n.id,`DiffFileTree file id`);if(t.has(e))throw Error(`DiffFileTree file ids must be unique: ${e}`);t.add(e);let r=Sn(n.path,`DiffFileTree path for ${e}`);if(n.change===`renamed`&&Sn(n.previousPath,`DiffFileTree previousPath for ${e}`)===r)throw Error(`DiffFileTree renamed paths must differ: ${e}`);bn(n.content)}if(e.state===`loading`||e.state===`error`){if(!Number.isInteger(e.indexedCount)||!Number.isInteger(e.totalCount))throw Error(`DiffFileTree counts must be integers`);if(e.indexedCount!==e.files.length||e.totalCount<e.indexedCount)throw Error(`DiffFileTree indexedCount must match visible files and cannot exceed totalCount`);e.state===`loading`&&w(e.label,`DiffFileTree loading label`),e.state===`error`&&(w(e.title,`DiffFileTree error title`),w(e.description,`DiffFileTree error description`))}},Tn=e=>{if(e.children.length!==1||e.children[0]?.kind!==`directory`)return e;let t=e.children[0];return Tn({...t,name:`${e.name}/${t.name}`})},En=(e,t=0)=>{let n=[],r=new Map;for(let i of e){let e=i.segments[t];if(e===void 0)continue;if(t===i.segments.length-1){n.push({file:i.file,kind:`file`,name:e});continue}let a=r.get(e)??[];a.push(i),r.set(e,a)}return[...Array.from(r,([e,n])=>Tn({children:En(n,t+1),fileCount:n.length,kind:`directory`,name:e,path:n[0].segments.slice(0,t+1).join(`/`)})),...n]},Dn=e=>{let t=e.split(`/`);return new Set(t.slice(0,-1).map((e,n)=>t.slice(0,n+1).join(`/`)))},On=({className:e,data:t,heading:n,onSelectedFileChange:r,selectedFileId:i,...a})=>{let o=w(n,`DiffFileTree heading`);if(wn(t),i!==void 0&&!t.files.some(e=>e.id===i))throw Error(`DiffFileTree selectedFileId is not in the visible inventory: ${i}`);let s=`rly-diff-file-tree-${(0,z.useId)()}`,c=t.state===`ready`?t.files.length:t.indexedCount,l=t.state===`ready`?t.files.length:t.totalCount,u=(0,z.useMemo)(()=>En(t.files.map(e=>({file:e,segments:e.path.split(`/`)}))),[t.files]),[d,f]=(0,z.useState)(()=>new Set),p=t.files.find(({id:e})=>e===i)?.path;(0,z.useEffect)(()=>{if(p===void 0)return;let e=Dn(p);f(t=>[...t].some(t=>e.has(t))?new Set([...t].filter(t=>!e.has(t))):t)},[p]);let m=e=>e.map(e=>{if(e.kind===`file`){let t=i===e.file.id,n=Cn[e.file.change],a=e.file.content.state===`ready`?null:bn(e.file.content);return(0,B.jsx)(`li`,{"data-rly-diff-file-id":e.file.id,children:(0,B.jsxs)(`button`,{"aria-current":t?`true`:void 0,"aria-label":`${xn(e.file.path)}, ${e.file.change}, ${bn(e.file.content)}`,className:Q(`file`),"data-rly-diff-content-state":e.file.content.state,"data-rly-diff-file-change":e.file.change,onClick:()=>r(e.file.id),type:`button`,children:[(0,B.jsxs)(`span`,{className:Q(`pathBlock`),style:{paddingInlineStart:`var(--rly-space-20)`},children:[e.file.change===`renamed`?(0,B.jsx)(`span`,{className:Q(`previousPath`),children:xn(e.file.previousPath)}):null,(0,B.jsx)(`code`,{className:Q(`path`),children:xn(e.name)})]}),(0,B.jsxs)(`span`,{className:Q(`statusIcons`),children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,className:Q(`statusIcon`),title:e.file.change,children:(0,B.jsx)(n,{})}),a===null?null:(0,B.jsx)(`span`,{"aria-hidden":`true`,className:Q(`statusIcon`),title:a,children:e.file.content.state===`loading`?(0,B.jsx)(ce,{className:Q(`loadingIcon`)}):(0,B.jsx)(k,{})})]})]})},e.file.id)}let t=!d.has(e.path);return(0,B.jsxs)(`li`,{className:Q(`directory`),"data-rly-diff-directory":e.path,children:[(0,B.jsxs)(`button`,{"aria-expanded":t,"aria-label":`${xn(e.name)}, directory, ${e.fileCount} changed ${e.fileCount===1?`file`:`files`}`,className:Q(`directoryButton`),onClick:()=>f(n=>{let r=new Set(n);return t?r.add(e.path):r.delete(e.path),r}),type:`button`,children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,className:Q(`chevron`)}),(0,B.jsx)(`code`,{className:Q(`directoryName`),children:xn(e.name)}),(0,B.jsx)(`span`,{className:Q(`directoryCount`),children:e.fileCount})]}),t?(0,B.jsx)(`ol`,{className:Q(`group`),style:{marginInlineStart:`var(--rly-space-16)`},children:m(e.children)}):null]},`directory:${e.path}`)});return(0,B.jsxs)(`nav`,{...a,"aria-busy":t.state===`loading`?`true`:void 0,"aria-labelledby":s,className:N(Q(`root`),e),"data-rly-diff-inventory-state":t.state,children:[(0,B.jsxs)(`header`,{className:Q(`header`),children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:Q(`eyebrow`),children:`Changed files`}),(0,B.jsx)(`h2`,{id:s,children:o})]}),(0,B.jsxs)(`strong`,{"aria-label":`${c} of ${l} files indexed`,className:Q(`count`),children:[c,`/`,l]})]}),t.state===`loading`?(0,B.jsx)(`p`,{className:Q(`notice`),role:`status`,children:t.label}):null,t.state===`error`?(0,B.jsxs)(`section`,{className:Q(`error`),role:`alert`,children:[(0,B.jsx)(`strong`,{children:t.title}),(0,B.jsx)(`span`,{children:t.description})]}):null,t.files.length===0?(0,B.jsx)(`p`,{className:Q(`empty`),children:`No changed files.`}):(0,B.jsx)(`ol`,{className:Q(`list`),children:m(u)})]})},kn=m([`pending`,`posting`,`posted`,`posted-stale`,`acknowledged`,`rejected`,`failed`]),An=(e,t)=>({...t,turns:e}),jn=(e,t,n)=>{if(e===null)return n;let r=new Map(t.result.findings.map(e=>[e.id,Pn(e)])),i=new Map(e.result.findings.map(e=>[e.id,Pn(e)]));return n.filter(({findingId:e})=>{if(e===`PR`)return!0;let t=i.get(e);return t!==void 0&&t===r.get(e)})},Mn=(e,t,n)=>{let r=e[t];return r===`posting`||r===`posted`||r===`posted-stale`?e:{...e,[t]:n}},Nn=e=>Object.fromEntries(e.map(e=>[e.id,`pending`])),Pn=e=>JSON.stringify(e),Fn=(e,t,n,r)=>{let i=e.find(({id:e})=>e===t.id),a=i===void 0||Pn(i)!==Pn(t);return a&&r===`failed`&&i===void 0?{dispositions:n,stale:!1}:{dispositions:{...n,[t.id]:a&&r===`posted`?`posted-stale`:r},stale:a}},In=(e,t)=>{let n=[...e,t],r=[],i=new TextEncoder,a=2,o=0;for(let e=n.length-1;e>=0;){let t=n[e];if(t===void 0){--e;continue}let s;if(t.role===`assistant`){let r=n[e-1];if(r?.role!==`user`||r.findingId!==t.findingId){--e;continue}s=[r,t],e-=2}else s=[t],--e;let c=s.reduce((e,t,n)=>e+i.encode(JSON.stringify(t)).byteLength+(o===0&&n===0?0:1),0);if(o+s.length>40||a+c>32768)break;r.push(s),o+=s.length,a+=c}return r.reverse().flat()},Ln=(e,t,n)=>{let r=new Map(e.map(e=>[e.id,e]));return Object.fromEntries(t.map(e=>{let t=r.get(e.id),i=n[e.id]??`pending`;return t===void 0||Pn(t)!==Pn(e)?i===`posting`?[e.id,i]:[e.id,i===`posted`||i===`posted-stale`?`posted-stale`:`pending`]:[e.id,i]}))},Rn=class extends d(`RelayReviewTransportError`){},zn=ee(n(P)),Bn=async(e,t,n,r)=>{let i=await we;if(i._tag===`Failed`)throw new Rn({message:i.message});let a=Ee(),o={method:`POST`,credentials:`same-origin`,headers:a===null?{"content-type":`application/json`}:{"content-type":`application/json`,"x-csrf-token":a},body:JSON.stringify(t)};r!==void 0&&(o.signal=r);let s=await window.fetch(e,o);if(!s.ok){let e=(await s.text()).slice(0,2e3).trim();throw new Rn({message:e.length===0?`Relay request failed with status ${s.status}`:e})}if(s.body===null)throw new Rn({message:`Relay returned no progress stream`});let c=s.body.getReader(),l=new TextDecoder,u=``,d=!1,f=async e=>{if(e.trim().length!==0)try{let t=await zn(e);if(d)throw new Rn({message:`Relay returned frames after the terminal event`});d=t.type===`complete`||t.type===`error`,n(t)}catch(e){throw _(e,`RelayReviewTransportError`)?e:new Rn({message:S(e)?e.message:`Relay returned malformed progress`})}};try{for(;;){let e=await c.read();u+=l.decode(e.value,{stream:!e.done});let t=u.split(`
22
+ `);u=t.pop()??``;for(let e of t)await f(e);if(e.done)break}if(await f(u),!d)throw new Rn({message:`Relay progress stream ended before a terminal event`})}finally{await c.cancel().catch(()=>void 0),c.releaseLock()}},Vn=l({accountKind:s(m([`credential`,`repository`])),accountId:o.check(x(),y()),pullRequestId:o.check(x(),y()),region:o.check(x(),y()),repositoryName:o.check(x(),y())}),Hn=l({identity:o,resource:Vn,review:ae,skillIds:r,turns:v,dispositions:g(o,kn),version:p.check(c(0))}),Un=F(n(Hn)),Wn=class extends d(`RelayReviewSessionStorageUnavailable`){},Gn=class extends d(`RelayReviewSessionInvalid`){},Kn=class extends d(`RelayReviewSessionResourceMismatch`){},qn=class extends d(`RelayReviewSessionMigrationAmbiguous`){},Jn=e=>Object.entries(e).reduce((e,[t,n])=>({...e,[t]:n===`posting`?`failed`:n}),{}),Yn=e=>Object.values(e.dispositions).some(e=>e===`posting`),Xn=(e,t)=>e.accountId===t.accountId&&e.pullRequestId===t.pullRequestId&&e.region===t.region&&e.repositoryName===t.repositoryName,Zn=e=>{switch(e){case`pending`:return 0;case`acknowledged`:case`failed`:case`rejected`:return 1;case`posting`:return 2;case`posted-stale`:return 3;case`posted`:return 4}},Qn=(e,t)=>Object.entries(t).reduce((e,[t,n])=>{let r=e[t];return r!==void 0&&Zn(r)>Zn(n)?e:{...e,[t]:n}},e),$n=(e,t)=>{let n=new Set(e.map(er));return t.reduce((e,t)=>{let r=er(t);return n.has(r)?e:(n.add(r),In(e,t))},e)},er=e=>e.id??JSON.stringify(e),tr=(e,t)=>$n(jn(e.review,t.review,e.turns),jn(t.review,e.review,t.turns)),nr=(e,t)=>{let n=jn(t.review,e.review,t.turns),r=new Set(e.turns.map(er)),i=new Set(t.turns.map(er)),a=e.turns.at(-1),o=t.turns.at(-1),s=t.turns.some(e=>r.has(er(e))),c=o!==void 0&&r.has(er(o)),l=a!==void 0&&i.has(er(a)),u=s&&c&&!l;if(!s&&e.turns.length>0&&t.turns.length>0){let r=new Set(t.appendedTurnIds??[]);return n.filter(e=>r.has(er(e))).reduce((e,t)=>In(e,t),e.turns)}return u?[]:n},rr=(e,t)=>{let n=new Map(e.review.result.findings.map(e=>[e.id,JSON.stringify(e)])),r=new Map(t.review.result.findings.map(e=>[e.id,JSON.stringify(e)]));return Object.entries(t.dispositions).reduce((e,[t,i])=>{let a=n.get(t),o=r.get(t);return a!==void 0&&a===o?{...e,[t]:i}:e},{})},ir=(e,t,n)=>({dispositions:e.dispositions,identity:e.identity,resource:e.resource,review:e.review,skillIds:e.skillIds,turns:t,version:n}),ar=`codecommit:relay-review-session`,or=f(`RelayReviewSessionRedirect`,{targetIdentity:o,targetKey:o,targetResource:Vn}),sr=e=>`${e}:redirect`,cr=(e,t)=>{let r=te({try:()=>e.getItem(sr(t)),catch:()=>new Wn({operation:`read`})});if(u(r))return O(r.failure);if(r.success===null)return ne(null);let i=F(n(or))(r.success);return u(i)?O(new Gn):ne(i.success)},lr=(e,t,n)=>{let r=pr(e,t,n.resource);if(u(r))return O(r.failure);let i=r.success===null?{_tag:`stored`,session:ir(n,n.turns,1)}:ur(r.success,n),a=JSON.stringify(i.session),o=te({try:()=>{e.setItem(t,a)},catch:()=>new Wn({operation:`write`})});if(u(o))return O(o.failure);let s=te({try:()=>e.getItem(t),catch:()=>new Wn({operation:`write`})});return u(s)?O(s.failure):s.success===a?ne(i):O(new Wn({operation:`write`}))},ur=(e,t)=>{if(t.expectedVersion!==e.version){let n=Qn(e.dispositions,rr(e,t));return{_tag:`stale-review-preserved`,session:{...e,dispositions:n,turns:$n(e.turns,nr(e,t)),version:e.version+1}}}let n=e.identity===t.identity,r=e.identity===t.expectedIdentity;if(n||r)return{_tag:`stored`,session:ir(t,tr(e,t),e.version+1)};let i=Qn(e.dispositions,rr(e,t));return{_tag:`stale-review-preserved`,session:{...e,dispositions:i,turns:$n(e.turns,nr(e,t)),version:e.version+1}}},dr=e=>`codecommit:relay-review-session:${encodeURIComponent(e.accountId)}:${encodeURIComponent(e.repositoryName)}:${encodeURIComponent(e.region)}:${encodeURIComponent(e.pullRequestId)}`,fr=(e,t)=>`${e.accountId}:${e.repositoryName}:${e.region}:${e.pullRequestId}:${t.revisionId}:${t.baseCommit}:${t.headCommit}`,pr=(e,t,n)=>{let r=te({try:()=>e.getItem(t),catch:()=>new Wn({operation:`read`})});if(u(r))return O(r.failure);if(r.success===null)return ne(null);let i=Un(r.success);return u(i)?O(new Gn):Xn(i.success.resource,n)?ne({...i.success,dispositions:i.success.dispositions}):O(new Kn)},mr=(e,t)=>`${ar}:publication:${encodeURIComponent(e)}:${encodeURIComponent(t)}`,hr=async(e,t,n,r)=>{let i=pr(e,t,n);if(u(i)||i.success===null||!Yn(i.success))return i;let a=Object.entries(i.success.dispositions).filter(([,e])=>e===`posting`).map(([e])=>e).sort().reduceRight((e,n)=>()=>r.request(mr(t,n),e),()=>r.request(ar,async()=>{let r=pr(e,t,n);if(u(r)||r.success===null||!Yn(r.success))return r;let i=lr(e,t,{dispositions:Jn(r.success.dispositions),expectedIdentity:r.success.identity,expectedVersion:r.success.version,identity:r.success.identity,resource:n,review:r.success.review,skillIds:r.success.skillIds,turns:r.success.turns});return u(i)?O(i.failure):ne(i.success.session)}));try{return await a()}catch{return O(new Wn({operation:`write`}))}},gr=async(e,t,n,r)=>{try{return await r.request(ar,async()=>{let r=cr(e,t);return u(r)?O(r.failure):r.success===null?lr(e,t,n):lr(e,r.success.targetKey,{...n,resource:r.success.targetResource})})}catch{return O(new Wn({operation:`write`}))}},_r=async(e,t,n,r,i,a)=>{try{return await a.request(ar,async()=>{let a=pr(e,t,n);if(u(a)||a.success===null)return a;if(a.success.resource.accountKind!==`credential`||i.accountKind!==`repository`)return O(new qn);let o=pr(e,r,i);if(u(o))return O(o.failure);let s=fr(i,a.success.review),c=lr(e,r,{dispositions:a.success.dispositions,expectedIdentity:s,expectedVersion:o.success===null?0:Math.max(0,o.success.version-1),identity:s,resource:i,review:a.success.review,skillIds:a.success.skillIds,turns:a.success.turns});if(u(c))return O(c.failure);let l={_tag:`RelayReviewSessionRedirect`,targetIdentity:s,targetKey:r,targetResource:i},d=te({try:()=>e.setItem(sr(t),JSON.stringify(l)),catch:()=>new Wn({operation:`write`})});return u(d)?O(d.failure):ne(c.success.session)})}catch{return O(new Wn({operation:`write`}))}},$={workspace:`_workspace_1j5hk_1`,workspaceHeader:`_workspaceHeader_1j5hk_8`,focusChoices:`_focusChoices_1j5hk_9`,diffToolbar:`_diffToolbar_1j5hk_10`,agentPane:`_agentPane_1j5hk_12`,findingMeta:`_findingMeta_1j5hk_14`,relayControls:`_relayControls_1j5hk_33`,findingBody:`_findingBody_1j5hk_88`,findingActions:`_findingActions_1j5hk_89`,conversation:`_conversation_1j5hk_90`,reviewFailure:`_reviewFailure_1j5hk_95`,workbench:`_workbench_1j5hk_100`,fileTree:`_fileTree_1j5hk_108`,diffPane:`_diffPane_1j5hk_124`,diffViewport:`_diffViewport_1j5hk_168`,codeView:`_codeView_1j5hk_174`,lineFinding:`_lineFinding_1j5hk_179`,lineComment:`_lineComment_1j5hk_194`,lineCommentMeta:`_lineCommentMeta_1j5hk_210`,agentTitle:`_agentTitle_1j5hk_261`,agentEmpty:`_agentEmpty_1j5hk_285`,agentSpinner:`_agentSpinner_1j5hk_299`,"agent-spin":`_agent-spin_1j5hk_1`,findingDeck:`_findingDeck_1j5hk_315`,verdictCopy:`_verdictCopy_1j5hk_324`,findingCard:`_findingCard_1j5hk_343`,findingDetails:`_findingDetails_1j5hk_385`,profileChoice:`_profileChoice_1j5hk_422`,progressRail:`_progressRail_1j5hk_442`,staleReview:`_staleReview_1j5hk_486`,conversationTitle:`_conversationTitle_1j5hk_567`,conversationHistory:`_conversationHistory_1j5hk_604`,workspaceFooter:`_workspaceFooter_1j5hk_670`},vr=[{kind:`review`,label:`Full review`,description:`Correctness, security, and maintainability`,icon:Oe},{kind:`security`,label:`Security`,description:`Trust boundaries and unsafe inputs`,icon:e},{kind:`tests`,label:`Tests`,description:`Missing behavioral guardrails`,icon:ze},{kind:`explain`,label:`Explain`,description:`Architecture and merge risks`,icon:L}],yr=5e3,br=4e6,xr=524288,Sr=new TextEncoder,Cr=e=>`?repositoryName=${encodeURIComponent(String(e.repositoryName))}&region=${encodeURIComponent(String(e.account.region))}`,wr=()=>`locks`in window.navigator?{request:(e,t)=>window.navigator.locks.request(e,()=>t())}:null,Tr=(e,t,n)=>JSON.stringify({completedReview:e,dispositions:n,turns:t}),Er=e=>Object.values(e).some(e=>e===`posting`),Dr=e=>{if(e.length===0)return 0;let t=1;for(let n of e)n===`
23
+ `&&t++;return t},Or=(e,t)=>{if(Sr.encode(e).byteLength+Sr.encode(t).byteLength>xr)return!0;let n=Dr(e),r=Dr(t);return n+r>yr||n*r>br},kr=e=>e.beforeMode===null&&e.afterMode!==null?`new file mode ${e.afterMode}`:e.beforeMode!==null&&e.afterMode===null?`deleted file mode ${e.beforeMode}`:e.beforeMode!==null&&e.afterMode!==null&&e.beforeMode!==e.afterMode?`mode ${e.beforeMode} → ${e.afterMode}`:null,Ar=e=>e===`P1`||e===`P2`?`critical`:e===`P3`?`caution`:`neutral`,jr=e=>{switch(e.location.scope){case`general`:return`Whole pull request`;case`file`:return e.location.filePath;case`line`:return`${e.location.filePath}:${e.location.line} · ${e.location.side}`}},Mr=l({message:o}),Nr=b(Mr);function Pr(e,t){return Nr(e)?e.message:t}var Fr=(e,t)=>t?`Previous result retained. The latest rerun failed. ${e}`:e,Ir=(e,t,n)=>t===null?n:e.find(({id:e})=>e===t),Lr=(e,t,n,r,i)=>`${e}:${n}:${r}:${t}:${i.revisionId}:${i.baseCommit}:${i.headCommit}`,Rr=e=>e.repoAccountId!==void 0&&e.repoAccountId.length>0?e.repoAccountId:e.awsAccountId!==void 0&&e.awsAccountId.length>0?e.awsAccountId:e.profile,zr=(e,t)=>{let n=t.location;if(n.scope!==`general`)return e.find(e=>n.scope===`file`?e.path===n.filePath||e.previousPath===n.filePath:n.side===`after`?e.status!==`deleted`&&e.path===n.filePath:e.status!==`added`&&(e.previousPath??e.path)===n.filePath)?.index},Br=(e,t)=>e.status===`renamed`&&e.previousPath!==null?{id:String(e.index),path:e.path,previousPath:e.previousPath,change:`renamed`,content:t}:{id:String(e.index),path:e.path,change:e.status===`renamed`?`modified`:e.status,content:t},Vr=(e,t)=>e.flatMap(e=>{if(e.location.scope!==`line`)return[];let n=e.location.side===`before`?t.previousPath??t.path:t.path;return e.location.filePath===n?[{id:e.id,accessibilityLabel:`${e.priority} finding: ${e.title}`,location:{itemId:String(t.index),lineNumber:e.location.line,side:e.location.side===`after`?`additions`:`deletions`},render:()=>(0,B.jsxs)(`aside`,{className:$.lineFinding,children:[(0,B.jsxs)(`strong`,{children:[e.priority,` · `,e.title]}),(0,B.jsx)(`span`,{children:e.summary})]})}]:[]}),Hr=e=>{let t=e.replace(/\[([^\]]+)\]\([^)]*\)/gu,`$1`).replace(/(^|\s)#{1,6}\s+/gu,`$1`).replace(/[*`]/gu,``).replace(/\s+/gu,` `).trim();return t.length<=180?t:`${t.slice(0,177)}…`},Ur=({active:e,onNavigateToComment:t,target:n})=>{let r=(0,z.useRef)(null);return(0,z.useEffect)(()=>{e&&r.current!==null&&(r.current.scrollIntoView({behavior:`smooth`,block:`center`}),r.current.focus({preventScroll:!0}))},[e]),(0,B.jsxs)(`aside`,{className:$.lineComment,"data-active":e?`true`:void 0,ref:r,tabIndex:-1,children:[(0,B.jsxs)(`span`,{className:$.lineCommentMeta,children:[(0,B.jsx)(Re,{"aria-hidden":`true`}),(0,B.jsx)(`strong`,{children:n.author}),(0,B.jsx)(`span`,{children:`CodeCommit comment`})]}),(0,B.jsx)(`span`,{children:Hr(n.content)}),(0,B.jsx)(`button`,{onClick:()=>t(n),type:`button`,children:`View in comments`})]})},Wr=(e,t,n,r)=>e.flatMap(e=>{let i=e.side===`before`?t.previousPath??t.path:t.path;return e.filePath===i?[{id:`comment:${e.commentId}`,accessibilityLabel:`CodeCommit comment by ${e.author}`,location:{itemId:String(t.index),lineNumber:e.lineNumber,side:e.side===`after`?`additions`:`deletions`},render:()=>(0,B.jsx)(Ur,{active:n===e.commentId,onNavigateToComment:r,target:e})}]:[]}),Gr=({accountId:e,activeCommentId:n,baseCommit:r,comments:a,file:o,findings:s,headCommit:c,layout:l,onContentStateChange:u,onNavigateToComment:d,pullRequestId:f,region:p,repositoryName:m,revisionId:g,wrap:_})=>{let ee=(0,z.useMemo)(()=>re.query(`prs`,`diffContent`,{params:{awsAccountId:e,prId:f,fileIndex:o.index},query:{baseCommit:r,headCommit:c,region:p,repositoryName:m,revisionId:g},timeToLive:`10 seconds`}),[e,r,o.index,c,f,p,m,g]),v=i(ee),y=h(v)?`error`:t(v)?v.value.state===`text`?v.value.before!==null&&v.value.after!==null&&Or(v.value.before,v.value.after)?`complexity`:`ready`:v.value.state:null;if((0,z.useEffect)(()=>{switch(y){case`ready`:u(o.index,{state:`ready`});break;case`binary`:u(o.index,{state:`binary`,reason:`CodeCommit reports binary or non-UTF-8 content.`});break;case`oversized`:u(o.index,{state:`oversized`,reason:`Content exceeds the bounded CodeCommit blob limit.`});break;case`complexity`:u(o.index,{state:`oversized`,reason:`Browser diff complexity safety limit exceeded.`});break;case`error`:u(o.index,{state:`error`,reason:`The exact file content request failed.`})}},[o.index,y,u]),pe(v)||E(v))return(0,B.jsx)(A,{announce:`polite`,description:`Reading both immutable sides of ${o.path}.`,title:`Loading file diff`,tone:`progress`});if(h(v))return(0,B.jsx)(A,{announce:`polite`,description:Pr(v.cause,`Reload the pull request to retry this exact file.`),title:`File diff unavailable`,tone:`critical`});if(!t(v))return(0,B.jsx)(A,{description:`Reload the pull request to retry.`,title:`File diff unavailable`,tone:`critical`});if(v.value.state!==`text`||v.value.before===null||v.value.after===null)return(0,B.jsx)(A,{description:v.value.state===`binary`?`CodeCommit reports binary or non-UTF-8 content. The file remains in the complete inventory.`:`One side exceeds the bounded CodeCommit blob limit and cannot be rendered safely.`,title:v.value.state===`binary`?`Binary change`:`File too large`,tone:`neutral`});if(Or(v.value.before,v.value.after))return(0,B.jsx)(A,{description:`This file exceeds the browser diff-complexity safety limit.`,title:`Diff too large to render`,tone:`neutral`});let b={id:String(o.index),before:{cacheKey:`${g}:${String(o.index)}:before`,contents:v.value.before,name:o.previousPath??o.path},after:{cacheKey:`${g}:${String(o.index)}:after`,contents:v.value.after,name:o.path}};return(0,B.jsx)(vn,{annotations:[...Vr(s,o),...Wr(a,o,n,d)],className:$.codeView??``,initialItems:[b],mode:l,wrap:_})},Kr=({canPost:e,dispositions:t,isReviewing:n,onAcknowledge:r,onPost:i,onReject:a,onSelect:o,review:s,selectedFindingId:c})=>n?(0,B.jsxs)(`div`,{"aria-live":`polite`,className:$.agentEmpty,children:[(0,B.jsx)(ce,{"aria-hidden":`true`,className:$.agentSpinner}),(0,B.jsx)(C,{as:`h3`,variant:`card-title`,children:`Relay is reviewing`}),(0,B.jsx)(C,{tone:`secondary`,children:`Live stages are updating above. Findings will appear here when the run completes.`})]}):s===null?(0,B.jsxs)(`div`,{className:$.agentEmpty,children:[(0,B.jsx)(Oe,{"aria-hidden":`true`}),(0,B.jsx)(C,{as:`h3`,variant:`card-title`,children:`Relay is ready`}),(0,B.jsx)(C,{tone:`secondary`,children:`Choose a focus, then run a prompt-only review over this exact CodeCommit revision.`})]}):s.kind===`explain`&&s.result.explanation!==void 0?(0,B.jsxs)(`div`,{className:$.agentEmpty,children:[(0,B.jsx)(L,{"aria-hidden":`true`}),(0,B.jsx)(C,{as:`h3`,variant:`card-title`,children:`Change explanation`}),(0,B.jsx)(C,{children:s.result.explanation}),(0,B.jsx)(C,{tone:`secondary`,children:s.result.verdict})]}):s.result.findings.length===0?(0,B.jsxs)(`div`,{className:$.agentEmpty,children:[(0,B.jsx)(ve,{"aria-hidden":`true`}),(0,B.jsx)(C,{as:`h3`,variant:`card-title`,children:`No actionable findings`}),(0,B.jsx)(C,{tone:`secondary`,children:s.result.verdict})]}):(0,B.jsxs)(`section`,{"aria-label":`Findings`,className:$.findingDeck,children:[(0,B.jsx)(C,{as:`p`,className:$.verdictCopy,children:s.result.verdict}),(0,B.jsx)(`ol`,{children:s.result.findings.map(n=>(0,B.jsx)(`li`,{children:(0,B.jsxs)(`article`,{className:$.findingCard,"data-selected":c===n.id?`true`:void 0,children:[(0,B.jsxs)(`button`,{className:$.findingBody,onClick:()=>o(n),type:`button`,children:[(0,B.jsxs)(`span`,{className:$.findingMeta,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(me,{label:n.priority,size:`compact`,tone:Ar(n.priority)}),(0,B.jsx)(`code`,{children:jr(n)})]}),(0,B.jsx)(me,{label:t[n.id]??`pending`,size:`compact`,tone:t[n.id]===`failed`||t[n.id]===`posted-stale`?`caution`:`neutral`})]}),(0,B.jsx)(`strong`,{children:n.title}),(0,B.jsx)(`span`,{children:n.summary})]}),(0,B.jsxs)(`details`,{className:$.findingDetails,children:[(0,B.jsx)(`summary`,{children:`Evidence & recommendation`}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{children:`Evidence`}),n.details]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{children:`Recommendation`}),n.recommendation]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{children:`Verification`}),n.verification]})]})]}),(0,B.jsxs)(`div`,{className:$.findingActions,children:[(0,B.jsx)(oe,{disabled:!e||t[n.id]===`posting`||t[n.id]===`posted`,loading:t[n.id]===`posting`,onClick:()=>i(n),size:`compact`,variant:`primary`,children:`Accept · post`}),(0,B.jsxs)(`button`,{disabled:t[n.id]===`posting`||t[n.id]===`posted`||t[n.id]===`posted-stale`,onClick:()=>r(n),type:`button`,children:[(0,B.jsx)(ve,{}),` Ack`]}),(0,B.jsxs)(`button`,{disabled:t[n.id]===`posting`||t[n.id]===`posted`||t[n.id]===`posted-stale`,onClick:()=>a(n),type:`button`,children:[(0,B.jsx)(M,{}),` Reject`]})]})]})},n.id))})]}),qr=({accountId:e,commentNavigation:n,comments:r,diff:o,diffFailure:s,onFindingPosted:c,onNavigateToComment:l,pullRequest:d})=>{let f=se(),[p,m]=(0,z.useState)(o.files[0]?.index??null),[g,_]=(0,z.useState)(null),[ee,v]=(0,z.useState)(null),[y,x]=(0,z.useState)(`split`),[te,ne]=(0,z.useState)(!1),S=i(ue),[ae,w]=(0,z.useState)(null),ce=(0,z.useMemo)(()=>re.mutation(`prs`,`postRelayFinding`),[]),le=a(ce,{mode:`promise`}),T=Lr(Rr(d.account),d.id,String(d.repositoryName),String(d.account.region),o),E=(0,z.useMemo)(()=>{let e=(d.account.repoAccountId!==void 0&&d.account.repoAccountId.length>0?d.account.repoAccountId:void 0)??(d.account.awsAccountId!==void 0&&d.account.awsAccountId.length>0?d.account.awsAccountId:void 0);return e===void 0?null:{accountKind:ge(d.account),accountId:e,pullRequestId:String(d.id),region:String(d.account.region),repositoryName:String(d.repositoryName)}},[d.account.awsAccountId,d.account.region,d.account.repoAccountId,d.id,d.repositoryName]),pe=(0,z.useMemo)(()=>{let e=d.account.awsAccountId,t=d.account.repoAccountId;return e===void 0||t===void 0||e===t?null:{accountKind:`credential`,accountId:e,pullRequestId:String(d.id),region:String(d.account.region),repositoryName:String(d.repositoryName)}},[d.account.awsAccountId,d.account.repoAccountId,d.account.region,d.id,d.repositoryName]),[he,ve]=(0,z.useState)(()=>({identity:T,values:new Map})),D=E===null?null:dr(E),O=pe===null?null:dr(pe),xe=(0,z.useRef)(D);xe.current=D;let k=(0,z.useRef)(`idle`),j=(0,z.useRef)(0),M=(0,z.useRef)(null),N=(0,z.useRef)(null),Ce=(0,z.useRef)(null),we=(0,z.useRef)(void 0),[P,Ee]=(0,z.useState)(null),F=(0,z.useRef)(P);F.current=P;let[De,I]=(0,z.useState)(null),[ke,Ae]=(0,z.useState)(null),[je,Me]=(0,z.useState)(null),[L,Ne]=(0,z.useState)(!1),[Pe,Fe]=(0,z.useState)([]),[Ie,Le]=(0,z.useState)([]),R=(0,z.useRef)([]);R.current=Ie;let[ze,Be]=(0,z.useState)(``),[Ve,V]=(0,z.useState)({}),[H,He]=(0,z.useState)(!0),U=(0,z.useRef)(Ve);U.current=Ve;let Ue=(0,z.useRef)(null),W=P?.value??null,G=P!==null&&P.identity!==T,We=t(S)?S.value.review.profiles:[],Ge=!t(S)&&!h(S),K=Ir(We,ae,t(S)?We.find(e=>e.id===S.value.review.defaultProfileId)??We[0]:void 0),q=ee??K?.kind??`review`,J=o.files.find(({index:e})=>e===p)??o.files[0],Y=J===void 0?null:kr(J),Ke=he.identity===T?he.values:new Map,qe={files:o.files.map(e=>Br(e,Ke.get(e.index)??{state:`ready`})),state:`ready`},Je=(0,z.useCallback)(async e=>{let t=F.current;if(t===null||E===null||D===null)return!0;let n=wr();if(n===null)return!0;let r=await gr(window.localStorage,D,{dispositions:e,expectedIdentity:t.expectedIdentity,expectedVersion:j.current,identity:t.identity,resource:E,review:t.value,skillIds:t.skillIds,turns:R.current},n);return u(r)?(I({description:`Local storage is unavailable. Relay could not durably retain this PR conversation.`,title:`PR conversation not saved`}),!1):(j.current=r.success.session.version,!0)},[E,D]),Ye=(0,z.useCallback)(async()=>{let e=F.current;if(e===null||E===null||D===null)return!0;let t=wr();if(t===null)return I({description:`This browser cannot coordinate Relay writes across tabs. Relay did not save this PR conversation.`,title:`PR conversation not saved`}),!1;let n=await gr(window.localStorage,D,{dispositions:U.current,expectedIdentity:e.expectedIdentity,expectedVersion:j.current,identity:e.identity,resource:E,review:e.value,skillIds:e.skillIds,turns:R.current},t);return u(n)?(I({description:`Local storage is unavailable. Relay could not durably retain this PR conversation.`,title:`PR conversation not saved`}),!1):(j.current=n.success.session.version,N.current={fingerprint:Tr(e,R.current,U.current),key:D,pendingInitialPass:!1},n.success._tag===`stale-review-preserved`&&n.success.session.identity!==e.identity?(I({description:`A newer exact-head review remains current. This tab's conversation turn was retained there.`,title:`Newer PR review preserved`}),!1):!0)},[E,D]);(0,z.useEffect)(()=>{if(D!==null&&Ce.current===D){Ce.current=null;return}if(!t(S)||ae!==null)return;let e=S.value.review.profiles.find(({id:e})=>e===S.value.review.defaultProfileId)??S.value.review.profiles[0];e!==void 0&&w(e.id)},[S,D,ae]),(0,z.useEffect)(()=>()=>Ue.current?.abort(),[]),(0,z.useEffect)(()=>{if(n?.destination!==`diff`)return;if(!_e(n.target,o)){Me(`This comment belongs to an older CodeCommit revision and cannot be placed on the current diff.`);return}let e=Se(o.files,n.target);if(e===void 0){Me(`The comment's file is not present in the current changed-file inventory.`);return}Me(null),m(e),_(null)},[n,o]),(0,z.useEffect)(()=>{if(k.current=`idle`,Ae(null),E===null||D===null){Ce.current=null,M.current=null,N.current=null,j.current=0,I({description:`CodeCommit has not resolved a stable AWS account identity for this pull request.`,title:`PR conversation unavailable`});return}Ce.current=null;let e=pr(window.localStorage,D,E);if(u(e)){M.current=null,N.current=null,j.current=0,I({description:e.failure._tag===`RelayReviewSessionInvalid`?`The saved PR conversation is invalid. Clear this site's local data before starting a new review.`:`Local storage is unavailable. Relay cannot durably retain this PR conversation.`,title:`PR conversation unavailable`});return}let t=e.success,n=!1;if(t===null&&pe!==null&&O!==null){let e=pr(window.localStorage,O,pe);if(u(e)){I({description:e.failure._tag===`RelayReviewSessionInvalid`?`The saved PR conversation is invalid. Clear this site's local data before starting a new review.`:`Local storage is unavailable. Relay cannot durably retain this PR conversation.`,title:`PR conversation unavailable`});return}if(t=e.success,n=t!==null,t!==null){if(t.resource.accountKind!==`credential`){k.current=`failed`,Ae({key:D,status:`failed`}),I({description:`Relay cannot safely migrate this legacy PR conversation because its account provenance is ambiguous.`,title:`PR conversation migration unavailable`});return}let e=wr();if(e===null)k.current=`failed`,Ae({key:D,status:`failed`}),I({description:`This browser cannot coordinate Relay writes across tabs. Relay did not migrate this PR conversation.`,title:`PR conversation not saved`});else{k.current=`pending`,Ae({key:D,status:`pending`});let n=fr(E,t.review);_r(window.localStorage,O,pe,D,E,e).then(e=>{if(u(e))xe.current===D&&(k.current=`failed`,Ae({key:D,status:`failed`}),I({description:`Local storage is unavailable. Relay could not migrate this PR conversation.`,title:`PR conversation not saved`}));else if(e.success!==null){if(xe.current===D){if(e.success.identity!==n){let t=An(e.success.turns,{expectedIdentity:e.success.identity,identity:e.success.identity,skillIds:e.success.skillIds,value:e.success.review});F.current=t,Ee(t),U.current=e.success.dispositions,V(e.success.dispositions),w(e.success.review.profile.id),Le(e.success.turns),_(e.success.turns.at(-1)?.findingId??e.success.review.result.findings[0]?.id??null),N.current={fingerprint:Tr(t,e.success.turns,e.success.dispositions),key:D,pendingInitialPass:!1}}k.current=`idle`,j.current=e.success.version,Ae(e=>e?.key===D?null:e)}}else xe.current===D&&(k.current=`idle`,Ae(e=>e?.key===D?null:e))})}}}if(t===null){if(M.current=D,N.current={fingerprint:Tr(null,[],{}),key:D,pendingInitialPass:!0},j.current=0,F.current!==null)return;Ee(null),w(null),Le([]),V({}),_(null);return}Ce.current=D,M.current=D,j.current=t.version;let r=n&&E!==null?fr(E,t.review):t.identity,i=An(t.turns,{expectedIdentity:r,identity:r,skillIds:t.skillIds,value:t.review});F.current=i,U.current=t.dispositions,Ee(i),w(t.review.profile.id),Le(t.turns),V(t.dispositions),_(t.turns.at(-1)?.findingId??t.review.result.findings[0]?.id??null),N.current={fingerprint:Tr(i,t.turns,t.dispositions),key:D,pendingInitialPass:!0};let a=wr();a!==null&&Er(t.dispositions)&&hr(window.localStorage,D,E??t.resource,a).then(e=>{xe.current!==D||u(e)||e.success===null||(j.current=e.success.version,U.current=e.success.dispositions,V(e.success.dispositions),N.current={fingerprint:Tr(i,t.turns,e.success.dispositions),key:D,pendingInitialPass:!1})})},[pe,O,T,E,D]),(0,z.useEffect)(()=>{let e=N.current;if(e?.key===D){if(e.pendingInitialPass){e.pendingInitialPass=!1;return}if(e.fingerprint===Tr(P,Ie,Ve)){N.current=null,M.current===D&&(M.current=null);return}N.current=null}if(D!==null&&M.current===D){M.current=null;return}if(k.current!==`idle`||ke!==null)return;let t=F.current,n=R.current;if(t===null||t.identity!==T||E===null||D===null)return;let r=wr();if(r===null){I({description:`This browser cannot coordinate Relay writes across tabs. Relay did not save this PR conversation.`,title:`PR conversation not saved`});return}let i=!0,a=we.current,o={expectedIdentity:t.expectedIdentity,expectedVersion:j.current,identity:t.identity,resource:E,review:t.value,skillIds:t.skillIds,turns:n,dispositions:Ve},s=a===void 0?o:{...o,appendedTurnIds:a};return gr(window.localStorage,D,s,r).then(e=>{if(i){if(we.current===a&&(we.current=void 0),u(e)){I({description:`Local storage is unavailable. Relay could not durably retain this PR conversation.`,title:`PR conversation not saved`});return}if(j.current=e.success.session.version,e.success._tag===`stale-review-preserved`){let n=e.success.session.identity!==t.identity;M.current=D;let r=An(e.success.session.turns,{expectedIdentity:e.success.session.identity,identity:e.success.session.identity,skillIds:e.success.session.skillIds,value:e.success.session.review});F.current=r,Ee(r),U.current=e.success.session.dispositions,Le(e.success.session.turns),V(e.success.session.dispositions),n&&I({description:`A newer exact-head review remains current. This tab's conversation turn was retained there.`,title:`Newer PR review preserved`})}}}),()=>{i=!1}},[P,Ve,T,E,D,ke,Ie]),(0,z.useEffect)(()=>{p!==null&&o.files.some(({index:e})=>e===p)||m(o.files[0]?.index??null)},[o.files,p]);let Xe=(0,z.useCallback)((e,t)=>{ve(n=>{let r=n.identity===T?n.values:new Map,i=r.get(e);return n.identity===T&&i?.state===t.state?n:{identity:T,values:new Map(r).set(e,t)}})},[T]),Ze=(0,z.useCallback)(async(e,t)=>{Ue.current?.abort();let n=new AbortController;Ue.current=n,Ne(!0),I(null),Fe([]);let r=R.current,i=null,a={};try{if(await Bn(e,t,e=>{if(e.type===`progress`){Fe(t=>[...t,e].slice(-12));return}if(e.type===`error`){i=e.message,I({description:Fr(e.message,F.current!==null),title:`Relay review failed`});return}a.event=e},n.signal),i!==null)return I({description:Fr(i,F.current!==null),title:`Relay review failed`}),{completed:!1};let o=a.event;if(o===void 0)return{completed:!1};let s=F.current?.value.result.findings??[],c=s.length===0?Nn(o.review.result.findings):Ln(s,o.review.result.findings,U.current);U.current=c,V(c);let l=An(jn(F.current?.value??null,o.review,r),{expectedIdentity:F.current?.identity??T,identity:T,skillIds:t.profile.skillIds,value:o.review});return F.current=l,Ee(l),_(e=>e??o.review.result.findings[0]?.id??null),o.reply===void 0?{completed:!0}:{completed:!0,reply:o.reply}}catch(e){return n.signal.aborted||I({description:Fr(Pr(e,`Relay could not complete this review.`),F.current!==null),title:`Relay review failed`}),{completed:!1}}finally{Ue.current===n&&(Ue.current=null,Ne(!1))}},[T]),Qe=(0,z.useCallback)(async()=>{K!==void 0&&(await Ze(`/api/prs/${encodeURIComponent(e)}/${encodeURIComponent(d.id)}/relay-review/stream${Cr(d)}`,{revisionId:o.revisionId,baseCommit:o.baseCommit,headCommit:o.headCommit,profile:{...K,kind:q}})).completed&&await Ye()&&Be(``)},[e,o.baseCommit,o.headCommit,o.revisionId,d,Ye,Ze,q,K]),$e=(0,z.useCallback)(async(t,n)=>{if(W===null||G)return G&&I({description:`Re-run Relay against the current exact revision before continuing this conversation.`,title:`Stale PR review`}),{_tag:`failed`};let r=window.crypto.randomUUID(),i={id:r,findingId:t,role:`user`,message:n};if(!b(Te)(i))return I({description:`Shorten the message so it can be retained in this review conversation.`,title:`Message is too large`}),{_tag:`failed`};let a=R.current,s=await Ze(`/api/prs/${encodeURIComponent(e)}/${encodeURIComponent(d.id)}/relay-review/continue${Cr(d)}`,{revisionId:o.revisionId,baseCommit:o.baseCommit,headCommit:o.headCommit,profile:W.profile,currentReview:W.result,turns:a,findingId:t,message:n});if(!s.completed)return{_tag:`failed`};let c=F.current?.turns??a,l=s.reply===void 0?void 0:window.crypto.randomUUID(),u=In(c,i);if(l===void 0||s.reply===void 0)we.current=[r],Le(u);else{let e={id:l,findingId:t,role:`assistant`,message:s.reply};we.current=[r,l],Le(In(u,e))}return Be(``),{_tag:`completed`}},[e,o.baseCommit,o.headCommit,o.revisionId,d,W,G,Ze]),et=(0,z.useCallback)(async t=>{if(W===null||G)return;let n=async()=>{I(null);let n={...U.current,[t.id]:`posting`};if(U.current=n,V(n),await Je(n))try{c((await le({params:{awsAccountId:e,findingId:t.id,prId:d.id},query:{region:d.account.region,repositoryName:d.repositoryName},payload:{revisionId:W.revisionId,baseCommit:W.baseCommit,headCommit:W.headCommit,finding:t}})).operationId);let n=Fn(F.current?.value.result.findings??[],t,U.current,`posted`);U.current=n.dispositions,V(n.dispositions),n.stale&&I({description:`CodeCommit received an older finding snapshot. Re-review before relying on it.`,title:`Finding post needs review`}),await Je(n.dispositions)}catch(e){let n=Fn(F.current?.value.result.findings??[],t,U.current,`failed`);U.current=n.dispositions,V(n.dispositions),I({description:Pr(e,`CodeCommit did not accept this finding.`),title:`Finding post failed`}),await Je(n.dispositions)}},r=wr();if(r===null||D===null){await n();return}await r.request(mr(D,t.id),n)},[e,c,Je,le,d,W,G,D]),tt=(0,z.useCallback)(e=>{_(e.id),He(!1);let t=zr(o.files,e);t!==void 0&&m(t)},[o.files]),nt=W?.result.findings.find(({id:e})=>e===g)??null,X=nt?.id??(g!==null&&Ie.some(({findingId:e})=>e===g)?g:null),rt=X===null?[]:Ie.filter(({findingId:e})=>e===X),it=Pe.slice(-4);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(be,{accountId:e,continueReview:$e,diff:o,isReviewing:L,profile:de(W,K),pullRequest:d,review:W,reviewIsStale:G,selectedFindingId:X,turns:Ie}),(0,B.jsxs)(ye,{as:`section`,className:$.workspace,padding:`none`,form:`grouped`,children:[(0,B.jsx)(`header`,{className:$.workspaceHeader,children:(0,B.jsxs)(`div`,{children:[(0,B.jsx)(C,{tone:`secondary`,variant:`label`,children:`Exact-revision review`}),(0,B.jsx)(C,{as:`h2`,variant:`section-title`,children:`Diff`}),(0,B.jsxs)(C,{tone:`secondary`,variant:`meta`,children:[o.files.length,` changed `,o.files.length===1?`file`:`files`,` · head`,` `,o.headCommit.slice(0,12)]})]})}),s===null?null:(0,B.jsx)(`div`,{className:$.reviewFailure,children:(0,B.jsx)(A,{announce:`polite`,description:`${s} Showing the last successfully loaded exact revision.`,title:`Latest diff unavailable`,tone:`caution`})}),(0,B.jsxs)(`div`,{className:$.workbench,children:[(0,B.jsx)(On,{className:$.fileTree,data:qe,heading:`PR ${d.id}`,onSelectedFileChange:e=>{m(Number(e)),_(null)},...J===void 0?{}:{selectedFileId:String(J.index)}}),(0,B.jsxs)(`section`,{"aria-label":`Selected file diff`,className:$.diffPane,children:[(0,B.jsxs)(`header`,{className:$.diffToolbar,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`code`,{children:J?.path??`No changed file`}),Y===null?null:(0,B.jsx)(`small`,{children:Y})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`button`,{"aria-pressed":y===`split`,onClick:()=>x(`split`),type:`button`,children:`Split`}),(0,B.jsx)(`button`,{"aria-pressed":y===`stacked`,onClick:()=>x(`stacked`),type:`button`,children:`Stacked`}),(0,B.jsx)(`button`,{"aria-pressed":te,onClick:()=>ne(e=>!e),type:`button`,children:`Wrap`})]})]}),(0,B.jsx)(`div`,{className:$.diffViewport,children:J===void 0?(0,B.jsx)(A,{description:`CodeCommit reports no changed files for this revision.`,title:`Empty diff`,tone:`neutral`}):(0,B.jsx)(Gr,{activeCommentId:n?.destination===`diff`?n.target.commentId:null,accountId:e,baseCommit:o.baseCommit,comments:r,file:J,findings:G?[]:W?.result.findings??[],headCommit:o.headCommit,layout:y,onContentStateChange:Xe,onNavigateToComment:l,pullRequestId:d.id,region:d.account.region,repositoryName:d.repositoryName,revisionId:o.revisionId,wrap:te},`${o.revisionId}:${o.baseCommit}:${o.headCommit}:${String(J.index)}:${y}:${String(te)}`)})]}),(0,B.jsxs)(`aside`,{"aria-label":`Relay findings`,className:$.agentPane,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`div`,{className:$.agentTitle,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(Oe,{"aria-hidden":`true`}),(0,B.jsx)(C,{as:`h2`,variant:`section-title`,children:`Relay`})]}),(0,B.jsx)(`small`,{children:L?`Reviewing the exact revision`:W===null?`Review findings and discuss evidence`:`${String(W.result.findings.length)} actionable ${W.result.findings.length===1?`finding`:`findings`}`})]}),L?(0,B.jsx)(me,{label:`running`,size:`compact`,tone:`progress`}):W===null?null:(0,B.jsx)(me,{label:W.kind,size:`compact`,tone:`progress`})]}),(0,B.jsxs)(`section`,{"aria-label":`Relay controls`,className:$.relayControls,children:[(0,B.jsxs)(`label`,{className:$.profileChoice,children:[(0,B.jsx)(`span`,{children:`Profile`}),(0,B.jsxs)(`select`,{disabled:L||!t(S),onChange:e=>{let t=We.find(({id:t})=>t===e.target.value);w(e.target.value),t!==void 0&&v(t.kind)},value:K?.id??``,children:[t(S)&&K===void 0&&ae!==null?(0,B.jsx)(`option`,{value:``,children:`Selected profile unavailable`}):t(S)?null:(0,B.jsx)(`option`,{value:``,children:h(S)?`Profiles unavailable`:`Loading profiles…`}),We.map(e=>(0,B.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,B.jsx)(oe,{disabled:L||o.files.length===0||K===void 0,loading:L,onClick:()=>void Qe(),size:`compact`,variant:`primary`,children:L?`Relay reviewing…`:W===null?`Run Relay`:`Run again`}),L?null:(0,B.jsx)(`div`,{"aria-label":`Relay review focus`,className:$.focusChoices,role:`group`,children:vr.map(e=>{let t=e.icon;return(0,B.jsxs)(`button`,{"aria-pressed":q===e.kind,onClick:()=>v(e.kind),title:e.description,type:`button`,children:[(0,B.jsx)(t,{"aria-hidden":`true`}),e.label]},e.kind)})})]}),h(S)?(0,B.jsx)(`div`,{className:$.reviewFailure,children:(0,B.jsx)(A,{action:(0,B.jsx)(oe,{onClick:()=>void f(0),size:`compact`,variant:`secondary`,children:`Reload`}),announce:`assertive`,description:Pr(S.cause,`Check the server connection, then reload this page to retry.`),title:`Relay profiles unavailable`,tone:`critical`})}):Ge?(0,B.jsx)(`div`,{className:$.reviewFailure,children:(0,B.jsx)(A,{announce:`polite`,description:`Loading the configured review methodology before Relay can run.`,title:`Loading Relay profiles`,tone:`progress`})}):null,it.length===0?null:(0,B.jsx)(`ol`,{"aria-label":`Relay progress`,"aria-live":`polite`,className:$.progressRail,children:it.map((e,t)=>(0,B.jsxs)(`li`,{"aria-current":t===it.length-1?`step`:void 0,children:[(0,B.jsx)(`span`,{"aria-hidden":`true`}),(0,B.jsx)(`small`,{children:e.phase}),(0,B.jsx)(`strong`,{children:e.message}),e.detail===void 0?null:(0,B.jsx)(`em`,{children:e.detail})]},`${e.phase}:${String(t)}`))}),G?(0,B.jsxs)(`div`,{className:$.staleReview,children:[(0,B.jsxs)(`span`,{children:[`This finding deck reviewed `,P?.value.headCommit.slice(0,12),`; current head is`,` `,o.headCommit.slice(0,12),`.`]}),(0,B.jsx)(oe,{disabled:L||K===void 0,onClick:()=>void Qe(),size:`compact`,variant:`secondary`,children:`Re-review latest`})]}):null,De===null?null:(0,B.jsxs)(`div`,{className:$.reviewFailure,children:[De.description.startsWith(`Previous result retained.`)?(0,B.jsx)(C,{tone:`secondary`,variant:`label`,children:`Previous result`}):null,(0,B.jsx)(A,{announce:`polite`,description:De.description,title:De.title,tone:`critical`})]}),je===null?null:(0,B.jsx)(`div`,{className:$.reviewFailure,children:(0,B.jsx)(A,{announce:`polite`,description:je,title:`Comment link unavailable`,tone:`caution`})}),(0,B.jsx)(Kr,{canPost:!G,dispositions:Ve,isReviewing:L,onAcknowledge:e=>V(t=>Mn(t,e.id,`acknowledged`)),onPost:e=>void et(e),onReject:e=>V(t=>Mn(t,e.id,`rejected`)),onSelect:tt,review:W,selectedFindingId:g}),X===null?null:(0,B.jsxs)(`section`,{"aria-label":`Conversation about ${X}`,className:$.conversation,"data-collapsed":H?`true`:void 0,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(Re,{"aria-hidden":`true`}),(0,B.jsxs)(`span`,{className:$.conversationTitle,children:[(0,B.jsx)(`strong`,{children:nt===null?`Discuss withdrawn finding`:`Discuss finding`}),(0,B.jsx)(`small`,{children:nt===null?`${X} is no longer in the current deck`:nt.title})]})]}),(0,B.jsxs)(`button`,{"aria-expanded":!H,onClick:()=>He(e=>!e),type:`button`,children:[H?(0,B.jsx)(fe,{"aria-hidden":`true`}):(0,B.jsx)(ie,{"aria-hidden":`true`}),H?`Open`:`Collapse`]})]}),H?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{"aria-label":`Conversation history about ${X}`,"aria-live":`polite`,className:$.conversationHistory,role:`log`,children:rt.length===0?(0,B.jsx)(`small`,{children:`Ask Relay to verify, refine, or withdraw this finding.`}):(0,B.jsx)(`ol`,{children:rt.map((e,t)=>(0,B.jsxs)(`li`,{"data-role":e.role,children:[(0,B.jsx)(`b`,{children:e.role===`user`?`You`:`Relay`}),e.message]},`${e.role}:${String(t)}`))})}),(0,B.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=ze.trim();t.length>0&&!L&&!G&&$e(X,t)},children:[(0,B.jsx)(`textarea`,{"aria-label":`Message Relay`,disabled:L||G,maxLength:8e3,onChange:e=>Be(e.target.value),placeholder:`Ask Relay about this finding…`,rows:2,value:ze}),(0,B.jsx)(oe,{disabled:L||G||ze.trim().length===0,size:`compact`,type:`submit`,variant:`secondary`,children:`Send`})]})]})]})]})]}),(0,B.jsx)(`footer`,{className:$.workspaceFooter,children:`Relay is advisory. Accept posts immediately; acknowledge and reject stay local to this review session.`})]})]})},Jr=({accountId:e,commentNavigation:n,commentsRefreshGeneration:r,onFindingPosted:a,onNavigateToComment:o,pullRequest:s,refreshGeneration:c})=>{let l=T({pullRequestId:s.id,repositoryName:s.repositoryName,profile:s.account.profile,region:s.account.region,refreshGeneration:r}),u=t(l)?l.value.flatMap(e=>e.comments.flatMap(t=>{if(t.root.deleted)return[];let n=xe(e,t.root);return n===null?[]:[n]})):[],d=(0,z.useMemo)(()=>re.query(`prs`,`diff`,{params:{awsAccountId:e,prId:s.id},query:{region:s.account.region,repositoryName:s.repositoryName},serializationKey:`${e}:${s.account.region}:${s.repositoryName}:${s.id}:${s.lastModifiedDate.toISOString()}:${String(c)}`,timeToLive:`30 seconds`}),[e,s.account.region,s.id,s.lastModifiedDate,s.repositoryName,c]),f=i(d),p=`${Rr(s.account)}:${String(s.repositoryName)}:${String(s.account.region)}:${String(s.id)}`,m=(0,z.useRef)(null);t(f)&&(m.current={identity:p,value:f.value});let g=m.current?.identity===p?m.current.value:null,_=t(f)?f.value:g;if((pe(f)||E(f))&&_===null)return(0,B.jsx)(A,{announce:`polite`,description:`Indexing every changed file.`,title:`Loading exact diff`,tone:`progress`});let ee=h(f)?Pr(f.cause,`Refresh this pull request to retry the CodeCommit diff read.`):null;return h(f)&&_===null?(0,B.jsx)(A,{announce:`polite`,description:Pr(f.cause,`Refresh this pull request to retry the CodeCommit diff read.`),title:`Exact diff unavailable`,tone:`critical`}):_===null?(0,B.jsx)(A,{description:`Refresh this pull request to retry.`,title:`Exact diff unavailable`,tone:`critical`}):(0,B.jsx)(qr,{accountId:e,commentNavigation:n,comments:u.filter(e=>_e(e,_)),diff:_,diffFailure:ee,onFindingPosted:a,onNavigateToComment:o,pullRequest:s},p)};export{Jr as PullRequestReviewWorkspace};
@@ -4,8 +4,8 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>codecommit</title>
7
- <script type="module" crossorigin src="/assets/index-DqzI_8bH.js"></script>
8
- <link rel="stylesheet" crossorigin href="/assets/index-Ds8Muxxv.css">
7
+ <script type="module" crossorigin src="/assets/index-BQbzvlT7.js"></script>
8
+ <link rel="stylesheet" crossorigin href="/assets/index-Rg2HVfx7.css">
9
9
  </head>
10
10
  <body>
11
11
  <div id="root"></div>
@@ -1 +1 @@
1
- {"version":3,"file":"pull-request-coordinates.d.ts","sourceRoot":"","sources":["../src/pull-request-coordinates.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,MAAM,EAAY,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAM/D,eAAO,MAAM,8BAA8B,OAAO,CAAA;AAElD,eAAO,MAAM,sBAAsB;;;;;EAiBlC,CAAA;AACD,MAAM,MAAM,sBAAsB,GAAG,OAAO,sBAAsB,CAAC,IAAI,CAAA;;;;AA4BvE,qBAAa,gCAAiC,SAAQ,sCAEpD;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;CAAG;AAElC,yFAAyF;AACzF,eAAO,MAAM,4BAA4B,gBAAiB,sBAAsB,KAAG,MAUlF,CAAA;AAED,qFAAqF;AACrF,eAAO,MAAM,4BAA4B,UAChC,MAAM,KACZ,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,EAAE,gCAAgC,CA8CvF,CAAA"}
1
+ {"version":3,"file":"pull-request-coordinates.d.ts","sourceRoot":"","sources":["../src/pull-request-coordinates.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAOrD,eAAO,MAAM,8BAA8B,OAAO,CAAA;AAElD,eAAO,MAAM,sBAAsB;;;;;EAiBlC,CAAA;AACD,MAAM,MAAM,sBAAsB,GAAG,OAAO,sBAAsB,CAAC,IAAI,CAAA;;;;AA4BvE,qBAAa,gCAAiC,SAAQ,sCAEpD;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;CAAG;AAElC,yFAAyF;AACzF,eAAO,MAAM,4BAA4B,gBAAiB,sBAAsB,KAAG,MAUlF,CAAA;AAED,qFAAqF;AACrF,eAAO,MAAM,4BAA4B,UAChC,MAAM,KACZ,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,EAAE,gCAAgC,CA8CvF,CAAA"}
@@ -1,6 +1,7 @@
1
1
  /** Exact CodeCommit PR coordinates carried through browser review requests. @module */
2
2
  import { AwsRegion, PullRequestId, RepositoryName } from "@knpkv/codecommit-core/Domain.js";
3
- import { Data, Effect, Encoding, Option, Schema } from "effect";
3
+ import { Data, Effect, Option, Schema } from "effect";
4
+ import { Base64Url } from "effect/encoding";
4
5
  const coordinateTokenPrefix = "cc1_";
5
6
  const legacyCoordinateTokenPrefix = "ccpr:";
6
7
  const coordinatePart = Schema.Trim.check(Schema.isNonEmpty(), Schema.isMaxLength(180));
@@ -12,7 +13,7 @@ export const PullRequestCoordinates = Schema.Struct({
12
13
  repositoryName: RepositoryName,
13
14
  region: AwsRegion
14
15
  }).check(Schema.makeFilter((coordinates) => {
15
- const encoded = Encoding.encodeBase64Url(JSON.stringify([
16
+ const encoded = Base64Url.encode(JSON.stringify([
16
17
  coordinates.accountId,
17
18
  coordinates.pullRequestId,
18
19
  coordinates.repositoryName,
@@ -45,7 +46,7 @@ export class PullRequestCoordinateDecodeError extends Data.TaggedError("PullRequ
45
46
  /** Encode coordinates into a compact URL-safe token for the existing review API path. */
46
47
  export const encodePullRequestCoordinates = (coordinates) => {
47
48
  const validated = Schema.decodeUnknownSync(PullRequestCoordinates)(coordinates);
48
- return `${coordinateTokenPrefix}${Encoding.encodeBase64Url(JSON.stringify([
49
+ return `${coordinateTokenPrefix}${Base64Url.encode(JSON.stringify([
49
50
  validated.accountId,
50
51
  validated.pullRequestId,
51
52
  validated.repositoryName,
@@ -69,7 +70,7 @@ export const decodePullRequestCoordinates = (value) => {
69
70
  if (!value.startsWith(coordinateTokenPrefix))
70
71
  return Effect.succeed(Option.none());
71
72
  const encoded = value.slice(coordinateTokenPrefix.length);
72
- return Effect.fromResult(Encoding.decodeBase64UrlString(encoded)).pipe(Effect.matchEffect({
73
+ return Effect.fromResult(Base64Url.decodeString(encoded)).pipe(Effect.matchEffect({
73
74
  // Profile aliases may legitimately begin with the token prefix. A value
74
75
  // that is not even base64 is therefore still an ordinary account route.
75
76
  onFailure: () => Effect.succeed(Option.none()),
@@ -1 +1 @@
1
- {"version":3,"file":"pull-request-coordinates.js","sourceRoot":"","sources":["../src/pull-request-coordinates.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