azdiffs 1.0.0 → 1.1.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 (62) hide show
  1. package/README.md +17 -3
  2. package/dist/cli.js +211 -84
  3. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId-BfEZAJVI.js +1 -0
  4. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.commits._commitId-DvqTmFzX.js +1 -0
  5. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.commits.index-Bd3xdIex.js +1 -0
  6. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.conflicts-DV0pCnK1.js +1 -0
  7. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.files-Mr-AIHvi.js +1 -0
  8. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.index-DoV2Gs7F.js +1 -0
  9. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId-ChLX3uCr.js +1 -0
  10. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.commits._commitId-DXZcIPBR.js +1 -0
  11. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.commits.index-Bd3xdIex.js +1 -0
  12. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.conflicts-DkEZ314x.js +1 -0
  13. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.files-N3xJdxPo.js +1 -0
  14. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.index-Dt7ItZCC.js +1 -0
  15. package/dist/web/assets/_organization.index-DVTzM87W.js +1 -0
  16. package/dist/web/assets/commit-diff-view-BNA-1iz5.js +1 -0
  17. package/dist/web/assets/commits-view-Cq3oHLFX.js +13 -0
  18. package/dist/web/assets/conflicts-view-Bca0Tnmk.js +8 -0
  19. package/dist/web/assets/dev.diff-jb6X8hTd.js +1 -0
  20. package/dist/web/assets/file-header-B2S9b0sl.js +49 -0
  21. package/dist/web/assets/files-view-C2YnVYtG.js +1460 -0
  22. package/dist/web/assets/grammars-B3laSCck.js +2 -0
  23. package/dist/web/assets/{highlights-BJb1-tzP.js → highlights-C-SBVYal.js} +1 -1
  24. package/dist/web/assets/home-page-BUnNaCN6.js +1 -0
  25. package/dist/web/assets/inbox-D8-BBgQT.js +1 -0
  26. package/dist/web/assets/index-DsrXp1aY.js +11 -0
  27. package/dist/web/assets/overview-view-B9qPTEMk.js +2 -0
  28. package/dist/web/assets/pull-request-layout-R9F6zMxd.js +35 -0
  29. package/dist/web/assets/routes-D2t0cGUy.js +1 -0
  30. package/dist/web/assets/shiki-mTy6Inae.js +1 -0
  31. package/dist/web/assets/shortcut-help-D99FihA2.js +1 -0
  32. package/dist/web/assets/{stream-tokenizer-B5Ok5N3S.js → stream-tokenizer-CKeNSKPz.js} +2 -2
  33. package/dist/web/index.html +1 -1
  34. package/package.json +1 -1
  35. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId-D7saE-jO.js +0 -1
  36. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.commits._commitId-DOwGbBTQ.js +0 -1
  37. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.commits.index-DzGjUdAz.js +0 -1
  38. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.conflicts-Cjr34xFt.js +0 -1
  39. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.files-BjjJ4Yb8.js +0 -1
  40. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.index-iY62N_zR.js +0 -1
  41. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId-CrHRklAE.js +0 -1
  42. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.commits._commitId-WC7fEryq.js +0 -1
  43. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.commits.index-DzGjUdAz.js +0 -1
  44. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.conflicts-BhUkafpV.js +0 -1
  45. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.files-_RVmv4sD.js +0 -1
  46. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.index-BJrgfbSD.js +0 -1
  47. package/dist/web/assets/_organization.index-hKcWlBrk.js +0 -1
  48. package/dist/web/assets/commit-diff-view-CQeZylif.js +0 -1
  49. package/dist/web/assets/commits-view-B_TQ6AnD.js +0 -13
  50. package/dist/web/assets/conflicts-view-CnGEkjaP.js +0 -8
  51. package/dist/web/assets/dev.diff-DH1qvnWe.js +0 -1
  52. package/dist/web/assets/file-header-keBlejWu.js +0 -49
  53. package/dist/web/assets/files-view-Bu3bjrNf.js +0 -1460
  54. package/dist/web/assets/grammars-DmFYBwmS.js +0 -2
  55. package/dist/web/assets/home-page-Y5jGxOav.js +0 -1
  56. package/dist/web/assets/inbox-jP8QPtzZ.js +0 -1
  57. package/dist/web/assets/index-B297yCgq.js +0 -11
  58. package/dist/web/assets/overview-view-cEOsI9TY.js +0 -2
  59. package/dist/web/assets/pull-request-layout-DsDKURcq.js +0 -35
  60. package/dist/web/assets/routes-BruvNNp9.js +0 -1
  61. package/dist/web/assets/shiki-DueA5xDi.js +0 -1
  62. package/dist/web/assets/shortcut-help-Cb0be4f3.js +0 -1
@@ -0,0 +1,13 @@
1
+ import{r as e}from"./rolldown-runtime-BLXQ4ufn.js";import{Cr as t,Sr as n,kn as r}from"./index-DsrXp1aY.js";import{E as i,S as a,w as o,x as s}from"./pull-request-layout-R9F6zMxd.js";import{_ as c,g as l,p as u,u as d,v as f}from"./inbox-D8-BBgQT.js";var p=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);else 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;else{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}},m=new class extends p{};function h(e,t,n){return m.diff(e,t,n)}function g(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 _(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 v(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 y(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 b(e,t){return v(e,t,``)}function x(e,t){return y(e,t,``)}function S(e,t){return t.slice(0,C(e,t))}function C(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 w(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 T(e,t){if(t)return D(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function E(e,t){if(t)return D(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function D(e,t){if(!t)return[E(e),T(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=w(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var O=`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}`,k=RegExp(`[${O}]+|\\s+|[^${O}]`,`ug`);new class extends p{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=w(e,r)}else n=e.match(k)||[];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)&&A(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&A(n,i,r,null,t.intlSegmenter),e}};function A(e,t,n,r,i){if(t&&n){let[a,o]=D(t.value,i),[s,c]=D(n.value,i);if(e){let r=g(a,s);e.value=y(e.value,s,r),t.value=b(t.value,r),n.value=b(n.value,r)}if(r){let e=_(o,c);r.value=v(r.value,c,e),t.value=x(t.value,e),n.value=x(n.value,e)}}else if(n){if(e){let e=E(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=E(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=E(r.value,i),[a,o]=D(t.value,i),s=g(n,a);t.value=b(t.value,s);let c=_(b(n,s),o);t.value=x(t.value,c),r.value=v(r.value,n,c),e.value=y(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=E(r.value,i),n=S(T(t.value,i),e);t.value=x(t.value,n)}else if(e){let n=S(T(e.value,i),E(t.value,i));t.value=b(t.value,n)}}var j=new class extends p{tokenize(e){let t=RegExp(`(\\r?\\n)|[${O}]+|[^\\S\\n\\r]+|[^${O}]`,`ug`);return e.match(t)||[]}};function M(e,t,n){return j.diff(e,t,n)}var N=new class extends p{constructor(){super(...arguments),this.tokenize=F}equals(e,t,n){return n.ignoreWhitespace?(n.newlineIsToken&&e.includes(`
2
+ `)||(e=e.trim()),n.newlineIsToken&&t.includes(`
3
+ `)||(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
4
+ `)&&(e=e.slice(0,-1)),t.endsWith(`
5
+ `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function P(e,t,n){return N.diff(e,t,n)}function F(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
6
+ `));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 I(e){return e==`.`||e==`!`||e==`?`}new class extends p{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(I(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 p{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends p{constructor(){super(...arguments),this.tokenize=F}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(L(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 L(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]=L(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]=L(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}var R=new class extends p{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function z(e,t,n){return R.diff(e,t,n)}function B(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function V(e){if(!B(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 H={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0},U={includeIndex:!1,includeUnderline:!1,includeFileHeaders:!0};function W(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;P(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(P(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||q(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(`
7
+ `)?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 G(e,t){if(t||=H,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=>G(e,t)).join(`
8
+ `)}let n=[];if(e.isGit){if(t=H,!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 `+V(r)+` `+V(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 `+V((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+V((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+V((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+V((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(`--- `+V(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+V(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(`
9
+ `)+`
10
+ `}function K(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;W(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?G(e,o.headerOptions):void 0)}}))}else{let s=W(e,t,n,r,i,a,o);return s?G(s,o?.headerOptions):void 0}}function q(e){let t=e.endsWith(`
11
+ `),n=e.split(`
12
+ `).map(e=>e+`
13
+ `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}var J=e(t(),1),Y=n();function X({location:e,shortForm:t,scope:n,variant:i=`page`,currentCommit:a=null}){let s=r().commits.list,c=o(n),l=(0,J.useMemo)(()=>c.data?.pages.flatMap(e=>e.commits)??[],[c.data]),f=i===`sidebar`,p;return p=c.isPending?(0,Y.jsx)(d,{label:s.loading,lines:4}):c.data===void 0?(0,Y.jsx)(u,{what:s.loadError,error:c.error,onRetry:()=>void c.refetch()}):l.length===0?(0,Y.jsx)(`p`,{className:`text-[13px] text-muted`,children:s.empty}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`ol`,{"aria-label":s.label,className:f?`space-y-px`:`overflow-hidden rounded-[10px] border border-border bg-surface`,"data-testid":`commit-list`,children:l.map(n=>f?(0,Y.jsx)(Q,{commit:n,location:e,shortForm:t,current:n.commitId===a},n.commitId):(0,Y.jsx)(Z,{commit:n,location:e,shortForm:t},n.commitId))}),c.isFetchNextPageError&&(0,Y.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:s.nextPageError(c.error?.message??``)}),c.hasNextPage&&(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void c.fetchNextPage(),disabled:c.isFetchingNextPage,className:`inline-flex shrink-0 items-center justify-center gap-1.5 rounded-[7px] text-[13px] font-medium whitespace-nowrap transition-colors disabled:cursor-not-allowed disabled:opacity-50 h-8 px-3 border border-border bg-raised text-fg hover:border-border-strong hover:bg-hover mt-3 ${f?`mx-2 h-7 text-xs`:``}`,"data-testid":`load-more-commits`,children:c.isFetchingNextPage?s.loadingMore:s.loadMore})]}),(0,Y.jsx)(`section`,{"aria-label":s.label,"data-testid":`commits`,className:f?`px-2`:``,children:p})}function Z({commit:e,location:t,shortForm:n}){let a=r().commits.list,o=s(e.comment),u=e.author??e.committer,d=u?.date??null;return(0,Y.jsxs)(`li`,{className:`flex min-w-0 items-center gap-3 border-t border-border px-3.5 py-2.5 first:border-t-0`,"data-testid":`commit`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(i,{location:t,shortForm:n,page:{tab:`commit`,commitId:e.commitId},className:`block truncate text-[14px] font-medium text-fg hover:underline`,children:o.length>0?o:a.noMessage}),(0,Y.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-muted`,children:[u?.name??a.unknownAuthor,d!==null&&(0,Y.jsxs)(Y.Fragment,{children:[` · `,(0,Y.jsx)(`time`,{dateTime:d,title:l(d),children:c(d)})]})]})]}),(0,Y.jsx)($,{commitId:e.commitId})]})}function Q({commit:e,location:t,shortForm:n,current:o}){let c=r().commits.list,u=s(e.comment),d=e.author??e.committer,p=d?.date??null;return(0,Y.jsx)(`li`,{"data-testid":`commit`,children:(0,Y.jsxs)(i,{location:t,shortForm:n,page:{tab:`commit`,commitId:e.commitId},current:o,title:u,className:`block rounded-[7px] px-2 py-1.5 hover:bg-hover aria-[current=page]:bg-[var(--azd-selected)]`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-[13px] text-fg`,children:u.length>0?u:c.noMessage}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-muted`,children:[(0,Y.jsx)(`span`,{className:`font-mono`,children:a(e.commitId)}),(0,Y.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`· `,d?.name??c.unknownAuthor]}),p!==null&&(0,Y.jsx)(`time`,{className:`ml-auto shrink-0`,dateTime:p,title:l(p),children:f(p)})]})]})})}function $({commitId:e}){let t=r().commits.copyHash,[n,i]=(0,J.useState)(!1);return(0,Y.jsx)(`button`,{type:`button`,title:t.title,"aria-label":t.label(a(e)),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{i(!0),window.setTimeout(()=>i(!1),1200)},()=>i(!1))},className:`inline-flex h-6 shrink-0 items-center rounded-md border border-border bg-raised px-1.5 font-mono text-xs text-fg hover:border-border-strong`,"data-testid":`commit-hash`,children:n?t.copied:a(e)})}export{z as a,K as i,$ as n,M as o,U as r,h as s,X as t};
@@ -0,0 +1,8 @@
1
+ import{r as e}from"./rolldown-runtime-BLXQ4ufn.js";import{Bt as t,C as n,Cr as r,D as i,Dn as a,E as o,F as s,Gt as c,Hn as l,N as u,On as d,P as f,Q as p,Sr as m,Tn as h,Wt as g,at as _,bn as v,dt as y,fn as b,gt as x,hn as S,it as C,j as w,k as T,kn as E,mt as D,q as O,rt as ee,xn as k,yn as A,zt as j}from"./index-DsrXp1aY.js";import{r as te,t as ne}from"./shortcut-help-D99FihA2.js";import{$ as re,A as M,B as N,D as P,E as F,L as I,O as L,R,T as z,V as ie,_ as B,b as ae,g as oe,h as V,r as se,s as H,y as ce,z as U}from"./pull-request-layout-R9F6zMxd.js";import{n as le}from"./inbox-D8-BBgQT.js";import{a as W,o as ue}from"./commits-view-Cq3oHLFX.js";var G=e(r(),1);function de(e){let t=[e.base,e.source,e.target].map(e=>e.join(`
2
+ `)).join(`\0`),n=0x811c9dc5;for(let e=0;e<t.length;e++)n^=t.charCodeAt(e),n=Math.imul(n,16777619)>>>0;return`${n.toString(16)}:${t.length}`}function fe(e,t,n){let r={},i={};for(let e of t){let t=n.decisions[e.index];if(t===void 0)continue;let a=de(e);r[a]=t;let o=n.auto?.[e.index];o!==void 0&&(i[a]=o)}return Object.keys(r).length===0&&n.wholeFile===null&&n.fileEdit===null?null:{fileKey:e,regions:r,...Object.keys(i).length===0?{}:{auto:i},wholeFile:n.wholeFile,fileEdit:n.fileEdit}}function pe(e,t,n){let r={},i={},a=new Set;for(let t of n){let n=de(t),o=e.regions[n];if(o!==void 0){r[t.index]=o,a.add(n);let s=e.auto?.[n];s!==void 0&&(i[t.index]=s)}}let o=e.fileKey===t,s=Object.keys(e.regions).filter(e=>!a.has(e)).length+ +(!o&&(e.wholeFile!==null||e.fileEdit!==null));return{choices:{decisions:r,wholeFile:o?e.wholeFile:null,fileEdit:o?e.fileEdit:null,...Object.keys(i).length===0?{}:{auto:i}},dropped:s}}function me(e){return`azdiffs:conflicts:${e.organization.toLowerCase()}:${e.repositoryId.toLowerCase()}:${e.pullRequestId}`}function he(e,t){let n=me(t),r=null,i=()=>{if(r!==null)return r;r={};try{let t=e?.getItem(n)??null,i=t===null?null:JSON.parse(t);if(K(i))for(let[e,t]of Object.entries(i)){let n=Se(t);n!==null&&(r[e]=n)}}catch{}return r},a=()=>{let t=i();try{Object.keys(t).length===0?e?.removeItem(n):e?.setItem(n,JSON.stringify(t))}catch{}};return{read:e=>i()[e]??null,write(e,t){let n=i();if(t===null){if(!(e in n))return;delete n[e]}else n[e]=t;a()}}}function ge(){try{return globalThis.localStorage??null}catch{return null}}var _e=new Set([`different-lines`,`same-change`,`formatting-only`]);function K(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ve=e=>e===`source`||e===`target`,ye=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),be=e=>Array.isArray(e)&&e.every(e=>Number.isSafeInteger(e)&&e>=0);function xe(e){if(!K(e))return null;switch(e.kind){case`combine`:case`source`:case`target`:return{kind:e.kind};case`both`:return ve(e.first)?{kind:`both`,first:e.first}:null;case`lines`:return be(e.source)&&be(e.target)?{kind:`lines`,source:e.source,target:e.target}:null;case`edited`:return ye(e.lines)?{kind:`edited`,lines:e.lines}:null;default:return null}}function Se(e){if(!K(e)||typeof e.fileKey!=`string`||!K(e.regions))return null;let t={};for(let[n,r]of Object.entries(e.regions)){let e=xe(r);e!==null&&(t[n]=e)}let n={};if(K(e.auto))for(let[t,r]of Object.entries(e.auto))K(r)&&_e.has(String(r.reason))&&(n[t]={reason:r.reason,dropped:ve(r.dropped)?r.dropped:null});return{fileKey:e.fileKey,regions:t,...Object.keys(n).length===0?{}:{auto:n},wholeFile:ve(e.wholeFile)?e.wholeFile:null,fileEdit:ye(e.fileEdit)?e.fileEdit:null}}function Ce(e,t){let n=Array(e.length).fill(-1),r=0,i=0;for(let a of W(e,t)){let e=a.count??a.value.length;if(a.added)i+=e;else if(a.removed)r+=e;else{for(let t=0;t<e;t++)n[r+t]=i+t;r+=e,i+=e}}return n}function we(e,t){let n=[],r=0,i=null;for(let a of W(e,t)){let e=a.count??a.value.length;!a.added&&!a.removed?(i!==null&&n.push(i),i=null,r+=e):(i??={start:r,end:r,lines:[]},a.removed?(r+=e,i.end=r):i.lines.push(...a.value))}return i!==null&&n.push(i),n}function Te(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Ee(e,t,n){let r=Ce(e,t),i=Ce(e,n),a=[],o=0,s=[],c=1,l=()=>{s.length>0&&a.push({kind:`clean`,origin:`unchanged`,lines:s,baseLine:c}),s=[]},u=0,d=0,f=0;for(;u<=e.length;){let p=u;for(;p<e.length&&((r[p]??-1)<0||(i[p]??-1)<0);)p++;let m=p<e.length?r[p]??t.length:t.length,h=p<e.length?i[p]??n.length:n.length,g=e.slice(u,p),_=t.slice(d,m),v=n.slice(f,h);if(g.length>0||_.length>0||v.length>0){let e=Te(_,g),t=Te(v,g);if(e&&t)s.length===0&&(c=u+1),s.push(...g);else if(e||t||Te(_,v)){l();let n=e?`target`:t?`source`:`both`;a.push({kind:`clean`,origin:n,lines:e?v:_,baseLine:u+1})}else l(),a.push({kind:`conflict`,index:o++,base:g,source:_,target:v,baseLine:u+1,sourceHunks:we(g,_),targetHunks:we(g,v),hasBase:!0})}if(p>=e.length)break;s.length===0&&(c=p+1),s.push(e[p]??``),u=p+1,d=m+1,f=h+1}return l(),a}function De(e,t){let n=[],r=0,i=[],a=[],o=1,s=1,c=()=>{(i.length!==0||a.length!==0)&&(n.push({kind:`conflict`,index:r++,base:[],source:i,target:a,baseLine:s,sourceHunks:i.length>0?[{start:0,end:0,lines:i}]:[],targetHunks:a.length>0?[{start:0,end:0,lines:a}]:[],hasBase:!1}),i=[],a=[])};for(let r of W(e,t)){let e=r.value;r.removed||r.added?(i.length===0&&a.length===0&&(s=o),r.removed?i.push(...e):(a.push(...e),o+=e.length)):(c(),n.push({kind:`clean`,origin:`both`,lines:e,baseLine:0}),o+=e.length)}return c(),n}function Oe(e,t,n){return e===null?De(t,n):Ee(e,t,n)}function ke(e){return e.filter(e=>e.kind===`conflict`)}function Ae(e,t){let n=t===`source`?e.source:e.target,r=t===`source`?e.sourceHunks:e.targetHunks,i=[],a=0,o=0,s=e=>{for(;a<e;)i.push({index:o,text:n[o]??``,changed:!1,baseText:null}),a++,o++};for(let t of r)s(t.start),t.lines.forEach((n,r)=>{let a=t.start+r<t.end?e.base[t.start+r]??null:null;i.push({index:o,text:n,changed:!0,baseText:a}),o++}),a=t.end;return s(e.base.length),i}function je(e,t){return e.start===e.end||t.start===t.end?e.start<=t.end&&t.start<=e.end:e.start<t.end&&t.start<e.end}function Me(e){if(!e.hasBase)return{ok:!1,reason:a().conflicts.combine.noBase};for(let t of e.sourceHunks)for(let n of e.targetHunks)if(je(t,n)){let r=e.baseLine+Math.max(t.start,n.start);return{ok:!1,reason:a().conflicts.combine.sameLine(r)}}let t=[...e.sourceHunks.map(e=>({hunk:e,origin:`source`})),...e.targetHunks.map(e=>({hunk:e,origin:`target`}))].sort((e,t)=>e.hunk.start-t.hunk.start||(e.origin===`source`?-1:1)),n=[],r=0;for(let{hunk:i,origin:a}of t){for(;r<i.start;)n.push({text:e.base[r++]??``,origin:`base`});for(let e of i.lines)n.push({text:e,origin:a});r=Math.max(r,i.end)}for(;r<e.base.length;)n.push({text:e.base[r++]??``,origin:`base`});return{ok:!0,lines:n}}function Ne(e,t){let n=[],r=r=>{let i=r===`source`?e.sourceHunks:e.targetHunks,a=new Set(r===`source`?t.source:t.target),o=0,s=0;for(let e of i)o+=e.start-s,e.lines.forEach((t,i)=>{if(a.has(o)){let a=e.start===e.end?e.start-.5:e.start+Math.min(i,e.end-e.start-1);n.push({position:a,order:(r===`source`?0:1)*1e6+o,line:{text:t,origin:r}})}o++}),s=e.end};if(r(`source`),r(`target`),!e.hasBase)return n.sort((e,t)=>e.order-t.order).map(e=>e.line);n.sort((e,t)=>e.position-t.position||e.order-t.order);let i=[],a=0,o=e=>{let t=[];for(;a<n.length;){let r=n[a];if(r===void 0||!e(r.position))break;t.push(r.line),a++}return t};for(let t=0;t<=e.base.length&&(i.push(...o(e=>e<t)),t!==e.base.length);t++){let n=o(e=>e===t);n.length>0?i.push(...n):i.push({text:e.base[t]??``,origin:`base`})}return i}function Pe(e,t){if(e===null)return[{text:t,changed:!0}];let n=[];for(let r of ue(e,t)){if(r.removed)continue;let e=n.at(-1),t=r.added===!0;e!==void 0&&e.changed===t?e.text+=r.value:n.push({text:r.value,changed:t})}return n}var Fe=/^\s*["']?([A-Za-z_][\w.-]*)["']?\s*[:=]/,Ie=/\b(?:function|def|class|const|let|var|fn|func|type|interface)\s+([A-Za-z_$][\w$]*)/;function Le(e){return Fe.exec(e)?.[1]??Ie.exec(e)?.[1]??null}function Re(e){let t=t=>Ae(e,t).find(e=>e.changed)?.text??null,n=t(`source`),r=t(`target`);if(n===null||r===null)return null;let i=Le(n);return i!==null&&i===Le(r)?i:null}var ze={decisions:{},wholeFile:null,fileEdit:null};function Be(e=ze){return{current:e,history:[]}}function q(e,t){let{auto:n,...r}=t;return{current:n!==void 0&&Object.keys(n).length>0?t:r,history:[...e.history,e.current].slice(-100)}}function Ve(e,t){let{current:n}=e;switch(t.type){case`decide`:return q(e,{decisions:{...n.decisions,[t.region]:t.decision},wholeFile:null,fileEdit:null,auto:He(n.auto,t.region)});case`fill`:{if(t.fills.length===0)return e;let r={...n.decisions},i={...n.auto};for(let e of t.fills)r[e.region]=e.decision,i[e.region]={reason:e.reason,dropped:e.dropped};return q(e,{decisions:r,wholeFile:null,fileEdit:null,auto:i})}case`toggle-line`:{let r=n.decisions[t.region],i=r?.kind===`lines`?{source:r.source,target:r.target}:{source:[],target:[]},a=i[t.side],o=a.includes(t.index)?a.filter(e=>e!==t.index):[...a,t.index].sort((e,t)=>e-t),s={...i,[t.side]:o},c={...n.decisions};return s.source.length===0&&s.target.length===0?delete c[t.region]:c[t.region]={kind:`lines`,...s},q(e,{decisions:c,wholeFile:null,fileEdit:null,auto:He(n.auto,t.region)})}case`whole-file`:return q(e,{...n,wholeFile:t.side,fileEdit:null,auto:{}});case`edit-file`:return q(e,{...n,wholeFile:null,fileEdit:t.lines,auto:{}});case`reset`:return q(e,ze);case`undo`:{let t=e.history.at(-1);return t===void 0?e:{current:t,history:e.history.slice(0,-1)}}}}function He(e,t){let n={...e};return delete n[t],n}function Ue(e,t){let n=new Set([...Object.keys(e.decisions).map(Number),...Object.keys(t.decisions).map(Number)]);for(let r of[...n].sort((e,t)=>e-t))if(JSON.stringify(e.decisions[r])!==JSON.stringify(t.decisions[r]))return r;return null}function J(e,t){switch(t.kind){case`combine`:{let t=Me(e);return t.ok?t.lines:null}case`source`:return e.source.map(e=>({text:e,origin:`source`}));case`target`:return e.target.map(e=>({text:e,origin:`target`}));case`both`:{let n=e.source.map(e=>({text:e,origin:`source`})),r=e.target.map(e=>({text:e,origin:`target`}));return t.first===`source`?[...n,...r]:[...r,...n]}case`lines`:return Ne(e,t);case`edited`:return t.lines.map(e=>({text:e,origin:`edited`}))}}function We(e,t,n){if(t.wholeFile!==null){let e=t.wholeFile;return{lines:n[e].map(t=>({text:t,origin:e})),undecided:[]}}if(t.fileEdit!==null)return{lines:t.fileEdit.map(e=>({text:e,origin:`edited`})),undecided:[]};let r=[],i=[];for(let a of e){if(a.kind===`clean`){let e=a.origin===`source`||a.origin===`target`?a.origin:`base`;r.push(...a.lines.map(t=>({text:t,origin:e})));continue}let e=t.decisions[a.index],o=e===void 0?null:J(a,e);o===null?(i.push(a.index),r.push(...Ge(a,n.labels))):r.push(...o)}return{lines:r,undecided:i}}function Ge(e,t){return[{text:`<<<<<<< ${t.source}`,origin:`edited`},...e.source.map(e=>({text:e,origin:`source`})),{text:`=======`,origin:`edited`},...e.target.map(e=>({text:e,origin:`target`})),{text:`>>>>>>> ${t.target}`,origin:`edited`}]}var Ke=/^(<{7} |={7}$|>{7} )/;function qe(e){let t=e.findIndex(e=>Ke.test(e));return t<0?null:t+1}function Je(e,t,n){if(t.wholeFile!==null||t.fileEdit!==null)return null;let r=e.filter(e=>{let n=t.decisions[e.index];return n===void 0||J(e,n)===null}).map(e=>e.index);return r.find(e=>e>n)??r[0]??null}function Ye(e,t){return Je(e,t,-1)===null}function Xe(e,t){let n=a().conflicts.decision;switch(e.kind){case`combine`:return n.combine;case`source`:return n.used(t.source);case`target`:return n.used(t.target);case`both`:return n.both(t[e.first]);case`lines`:return n.lines(e.source.length+e.target.length);case`edited`:return n.edited}}var Ze=e=>e.map(e=>e.replace(/\s+/g,``)),Qe=(e,t)=>{let n=Ze(e),r=Ze(t);return n.length===r.length&&n.every((e,t)=>e===r[t])};function $e(e){if(Me(e).ok)return{decision:{kind:`combine`},reason:`different-lines`,dropped:null};if(Qe(e.source,e.target))return{decision:{kind:`target`},reason:`same-change`,dropped:null};if(!e.hasBase)return null;let t=Qe(e.source,e.base),n=Qe(e.target,e.base);return t&&!n?{decision:{kind:`target`},reason:`formatting-only`,dropped:`source`}:n&&!t?{decision:{kind:`source`},reason:`formatting-only`,dropped:`target`}:null}function et(e,t){if(t.wholeFile!==null||t.fileEdit!==null)return[];let n=[];for(let r of e){let e=t.decisions[r.index];if(e!==void 0&&J(r,e)!==null)continue;let i=$e(r);i!==null&&n.push({...i,region:r.index})}return n}function tt(e){return`${e.baseBlob??``}:${e.sourceBlob}:${e.targetBlob}`}async function nt(e,t,n){let r={filled:0,files:0,left:0};for(let i of e){if(i.kind!==`content`||i.resolutionStatus===`resolved`)continue;let[e,a,o]=await Promise.all([i.baseBlob===null?null:t(i.baseBlob),t(i.sourceBlob),t(i.targetBlob)]);if(a.kind!==`text`||o.kind!==`text`||e!==null&&e.kind!==`text`)continue;let s=ke(Oe(e?.file.lines??null,a.file.lines,o.file.lines)),c=tt(i),l=n.read(i.path),u=l===null?ze:pe(l,c,s).choices,d=et(s,u),f=Ve(Be(u),{type:`fill`,fills:d}).current,p=s.filter(e=>f.decisions[e.index]===void 0);r.left+=f.wholeFile===null&&f.fileEdit===null?p.length:0,d.length!==0&&(n.write(i.path,fe(c,s,f)),r.filled+=d.length,r.files+=1)}return r}var rt=(e,t)=>e!==null&&t!==null&&e.toLowerCase()===t.toLowerCase();async function it(e,t){let{conflict:n}=t,r,i;try{[r,i]=await Promise.all([e.pullRequest(),e.conflicts()])}catch(e){return{kind:`failed`,error:e,sent:!1,saved:!1}}if(!rt(r.lastMergeSourceCommit,n.mergeSourceCommit))return{kind:`stale`,pullRequest:r,branch:r.sourceBranch};if(!rt(r.lastMergeTargetCommit,n.mergeTargetCommit))return{kind:`stale`,pullRequest:r,branch:r.targetBranch};let a=i.find(e=>e.conflictId===n.conflictId);if(a===void 0)return{kind:`gone`};let o=a.resolvedBy;if(a.resolutionStatus===`resolved`&&n.resolutionStatus!==`resolved`&&o!==null&&!rt(o.id,t.currentUserId)&&!t.replaceConfirmed)return{kind:`confirm-replace`,by:o,date:a.resolvedDate};try{return{kind:`saved`,conflict:await e.resolve(t.resolution)}}catch(t){try{let r=(await e.conflicts()).find(e=>e.conflictId===n.conflictId);return r===void 0?{kind:`failed`,error:t,sent:!0,saved:null}:a.resolutionStatus!==`resolved`&&r.resolutionStatus===`resolved`?{kind:`saved`,conflict:r}:{kind:`failed`,error:t,sent:!0,saved:r.resolutionStatus!==a.resolutionStatus&&null}}catch{return{kind:`failed`,error:t,sent:!0,saved:null}}}}function at(e,t){let n=a().conflicts.save,r=b(e.error,`unauthorized`);return r||b(e.error,`network`)?e.sent?e.saved===!1||r?t.method===`pat`?n.refusedPat:n.refused:n.maybeSaved:n.unreachable:b(e.error,`rate-limited`)?n.throttled:t.describe(e.error).replace(n.textKept,n.choicesKept)}function ot(e){return e.split(`/`).filter(e=>e.length>0).at(-1)??e}function st(e){return(Array.from(e).find(e=>/\p{L}|\p{N}/u.test(e))??`?`).toUpperCase()}function ct(e,t){let n=ot(e),r=ot(t);r===n&&(r=t);let i=st(n),a=st(ot(t)),o=i===a;return{source:e,target:t,letters:{source:o?`S`:i,target:o?`T`:a},short:{source:n,target:r}}}function lt(e,t){let{source:n,target:r}=t.short,i=a().conflicts.type;switch(e.type){case`editEdit`:return i.editEdit;case`addAdd`:return i.addAdd;case`editDelete`:return i.editDelete(n,r);case`deleteEdit`:return i.deleteEdit(n,r);case`rename1to2`:return i.rename1to2;case`rename2to1`:return i.rename2to1;case`renameRename`:return i.renameRename;case`renameAdd`:return i.renameAdd(n,r);case`addRename`:return i.addRename(n,r);case`renameDelete`:return i.renameDelete(n,r);case`deleteRename`:return i.deleteRename(n,r);case`directoryFile`:case`fileDirectory`:case`directoryChild`:return i.fileAndFolder;case`none`:return i.unreadable}}function ut(e,t){if(e.kind!==`unsupported`)return``;let n=e=>e===null?null:e.split(`/`).at(-1)??e,r=n(e.sourceNewPath),i=n(e.targetNewPath);return e.type===`rename1to2`&&r!==null&&i!==null?a().conflicts.type.renamedApart(t.short.source,r,t.short.target,i):lt(e,t)}function dt(e,t){let{source:n,target:r}=t.short,i=a().conflicts.resolution;if(e.kind===`content`)switch(e.mergeType){case`takeSourceContent`:return i.usedFile(n);case`takeTargetContent`:return i.usedFile(r);case`userMerged`:case`autoMerged`:return i.merged;case`undecided`:return null}if(e.kind===`pickOne`){if(e.action===`undecided`)return null;if(e.type===`editDelete`==(e.action===`pickSourceAction`)){let t=e.type===`editDelete`?n:r;return i.keptFile(t)}return i.deletedFile}return null}function ft(e,t){let n=a().conflicts.auto;switch(e.reason){case`different-lines`:return n.differentLines;case`same-change`:return n.sameChange(t.short.target);case`formatting-only`:{let r=e.dropped??`source`,i=r===`source`?`target`:`source`;return n.formattingOnly(t.short[r],t.short[i])}}}function pt(e,t=Date.now()){if(e===null)return``;let n=Date.parse(e);if(Number.isNaN(n))return``;let r=a().conflicts.ago,i=Math.max(0,Math.round((t-n)/6e4));if(i<1)return r.justNow;if(i<60)return r.minutes(i);let o=Math.round(i/60);return o<24?r.hours(o):h(n)}var Y=m(),mt={source:`azd-chip-source`,target:`azd-chip-target`},ht={source:`bg-side-source`,target:`bg-side-target`},gt={source:`azd-row-source`,target:`azd-row-target`},_t={source:`azd-mark-source`,target:`azd-mark-target`};function vt({side:e,names:t,short:n=!1}){let r=n?t.short[e]:t[e];return(0,Y.jsxs)(`span`,{className:`inline-flex max-w-full min-w-0 items-center gap-1.5 rounded-full py-px pr-2 pl-1 font-mono text-xs ${mt[e]}`,title:t[e],children:[(0,Y.jsx)(yt,{side:e,names:t}),(0,Y.jsx)(`span`,{className:`truncate`,children:r})]})}function yt({side:e,names:t}){return(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`inline-grid size-4 shrink-0 place-items-center rounded-full font-sans text-[10px] leading-none font-semibold text-[var(--azd-canvas)] ${ht[e]}`,children:t.letters[e]})}function bt({origin:e,names:t}){let n=E().conflicts.origin;return e===`source`||e===`target`?(0,Y.jsxs)(`span`,{className:`inline-flex w-4 justify-center font-sans text-[11px] font-semibold ${e===`source`?`text-side-source`:`text-side-target`}`,title:n.from(t[e]),children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:t.letters[e]}),(0,Y.jsx)(`span`,{className:`sr-only`,children:n.fromSpoken(t[e])})]}):e===`edited`?(0,Y.jsxs)(`span`,{className:`inline-flex text-muted`,title:n.edited,children:[(0,Y.jsx)(p,{className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:n.editedSpoken})]}):(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block size-4`})}function X({children:e}){return(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`rounded border border-border-strong px-1 font-mono text-[10px] leading-4 font-normal text-muted`,children:e})}function Z({number:e,tag:t,tone:n,children:r,dim:i=!1,struck:a=!1,tagless:o=!1}){return(0,Y.jsxs)(`div`,{className:`grid min-h-6 ${o?`grid-cols-[2.75rem_minmax(0,1fr)]`:`grid-cols-[2.75rem_1.5rem_minmax(0,1fr)]`} items-start font-mono text-xs leading-6 ${n??``} ${i?`text-muted`:`text-fg`}`,children:[(0,Y.jsx)(`span`,{className:`pr-2.5 text-right text-[11px] text-muted tabular-nums select-none`,children:e}),!o&&(0,Y.jsx)(`span`,{className:`flex h-6 items-center`,children:t}),(0,Y.jsx)(`span`,{className:`pr-3 break-words whitespace-pre-wrap ${a?`line-through decoration-[var(--azd-muted)] opacity-70`:``}`,children:r})]})}function xt({segments:e,side:t}){let n=E().conflicts.origin.changedSpoken;return(0,Y.jsx)(Y.Fragment,{children:e.map((e,r)=>e.changed&&e.text.trim().length>0?(0,Y.jsxs)(`mark`,{className:`text-inherit ${_t[t]}`,children:[(0,Y.jsx)(`span`,{className:`sr-only`,children:n}),e.text]},r):(0,Y.jsx)(`span`,{children:e.text},r))})}function Q(e){return e.length===0?` `:e}function St(e){let t=e.lastIndexOf(`/`);return{name:e.slice(t+1),folder:t>0?e.slice(1,t+1):``}}function $({conflict:e,names:t,progress:n,tools:r,save:i,markRef:a,blockedReason:o,onMarkResolved:s,showMark:c=!0,footer:l,children:u}){let d=E(),{name:f,folder:p}=St(e.path);return(0,Y.jsxs)(`article`,{"aria-label":e.path,className:`overflow-hidden rounded-[10px] bg-surface shadow-[0_0_0_1px_var(--azd-border)]`,"data-testid":`conflict-file`,"data-path":e.path,children:[(0,Y.jsxs)(`header`,{className:`flex min-h-11 flex-wrap items-center gap-x-2.5 gap-y-1 border-b border-border bg-header py-1.5 pr-2.5 pl-3.5`,children:[(0,Y.jsxs)(`h2`,{className:`flex min-w-0 items-baseline gap-1.5 text-[13px]`,title:e.path,children:[p.length>0&&(0,Y.jsx)(`span`,{className:`truncate text-muted`,children:p}),(0,Y.jsx)(`span`,{className:`font-semibold text-fg-strong`,children:f})]}),(0,Y.jsx)(`span`,{className:`rounded-full border border-border bg-raised px-2 py-px text-xs text-warning`,children:lt(e,t)}),n!==void 0&&(0,Y.jsx)(`span`,{className:`text-xs text-muted tabular-nums`,"data-testid":`conflict-file-progress`,children:n}),(0,Y.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center justify-end gap-1`,children:[r,c&&o!==null&&(0,Y.jsx)(`span`,{className:`px-1.5 text-xs text-muted`,"data-testid":`mark-resolved-reason`,children:o}),c&&(0,Y.jsxs)(`button`,{ref:a,type:`button`,onClick:s,disabled:o!==null||i.busy,"aria-describedby":o===null?void 0:`azd-mark-reason`,className:`inline-flex shrink-0 items-center justify-center gap-1.5 rounded-[7px] text-[13px] font-medium whitespace-nowrap transition-colors disabled:cursor-not-allowed disabled:opacity-50 h-8 px-3 bg-primary text-primary-fg hover:opacity-90 h-7 px-2.5`,"data-testid":`mark-resolved`,children:[i.busy?d.conflicts.file.saving:d.conflicts.file.mark,!i.busy&&(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`rounded border border-[color-mix(in_srgb,var(--azd-primary-fg)_30%,transparent)] px-1 font-mono text-[10px] leading-4 font-normal opacity-70`,children:`⌘↵`})]}),c&&o!==null&&(0,Y.jsx)(`span`,{id:`azd-mark-reason`,className:`sr-only`,children:o})]})]}),i.problem!==null&&(0,Y.jsx)(`p`,{role:`alert`,className:`border-b border-border px-3.5 py-2 text-[13px] text-danger`,"data-testid":`save-problem`,children:i.problem}),u,(0,Y.jsx)(Ct,{...l})]})}function Ct({next:e,regionKeys:t}){let n=E(),r=n.conflicts.file.keys;return(0,Y.jsxs)(`footer`,{className:`flex flex-wrap items-center gap-x-3.5 gap-y-1 bg-header px-3.5 py-2 text-xs text-muted`,children:[(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-3.5 gap-y-1`,children:[t&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(X,{children:`n`}),` `,(0,Y.jsx)(X,{children:`p`}),` `,r.regions]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(X,{children:`1`}),` `,(0,Y.jsx)(X,{children:`2`}),` `,(0,Y.jsx)(X,{children:`3`}),` `,r.sides]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(X,{children:`space`}),` `,r.line]})]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(X,{children:`j`}),` `,(0,Y.jsx)(X,{children:`k`}),` `,r.files]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(X,{children:`?`}),` `,r.all]})]}),e!==null&&(0,Y.jsxs)(`button`,{type:`button`,onClick:e.onSelect,className:`inline-flex shrink-0 items-center justify-center gap-1.5 rounded-[7px] text-[13px] font-medium whitespace-nowrap transition-colors disabled:cursor-not-allowed disabled:opacity-50 h-7 px-2 text-muted hover:bg-hover hover:text-fg ml-auto h-6`,"data-testid":`next-file`,children:[n.conflicts.file.next(St(e.path).name),(0,Y.jsx)(s,{className:`size-3.5`})]})]})}function wt(e){return e===void 0||e.kind===`edited`?null:e.kind}function Tt({region:e,count:t,decision:n,names:r,active:i,expanded:a,showOriginal:o,editing:s,canUndo:c,headerRef:l,intents:d,onToggleOriginal:f,onExpand:p,onEdit:m,onEditDone:h,auto:g}){let v=E(),y=v.conflicts.region,b=(0,G.useId)(),x=n===void 0?null:J(e,n),C=x!==null,w=Me(e),T=Re(e),D=Dt(v,e),O=C?Xe(n,r.short):null;return C&&!a&&!s?(0,Y.jsxs)(`fieldset`,{"aria-labelledby":b,className:`min-w-0 border-b border-border`,"data-testid":`conflict-region-${e.index}`,"data-state":`decided`,children:[(0,Y.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1 px-3.5 py-2`,children:[(0,Y.jsx)(u,{className:`size-3.5 text-added`}),(0,Y.jsxs)(`h3`,{id:b,ref:l,tabIndex:-1,className:`text-[13px] font-medium text-fg outline-none`,children:[D,(0,Y.jsx)(`span`,{className:`sr-only`,children:y.position(e.index+1,t,!0)})]}),(0,Y.jsx)(`span`,{className:`text-xs text-muted`,children:O}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{p(),d.focus()},className:`${S} ml-auto`,children:y.change})]}),(0,Y.jsx)(jt,{lines:x,names:r,startLine:e.baseLine})]}):(0,Y.jsxs)(`fieldset`,{"aria-labelledby":b,className:`min-w-0 border-b border-border ${i&&t>1?`outline-2 -outline-offset-2 outline-[var(--azd-accent)]`:``}`,"data-testid":`conflict-region-${e.index}`,"data-state":C?`decided`:`open`,onFocusCapture:d.focus,children:[(0,Y.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1 px-3.5 py-2`,children:[C?(0,Y.jsx)(u,{className:`size-3.5 text-added`}):(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 rounded-full bg-warning`}),(0,Y.jsxs)(`h3`,{id:b,ref:l,tabIndex:-1,className:`text-[13px] font-medium text-fg outline-none`,children:[D,(0,Y.jsx)(`span`,{className:`sr-only`,children:y.position(e.index+1,t,C)})]}),g!==void 0&&(0,Y.jsxs)(`span`,{className:`rounded-full border border-border bg-raised px-2 py-px text-xs text-fg`,"data-testid":`auto-filled`,children:[v.conflicts.auto.label,(0,Y.jsxs)(`span`,{className:`text-muted`,children:[` · `,g]})]}),(0,Y.jsx)(`span`,{className:`text-xs text-muted ${g===void 0?``:`sr-only`}`,children:e.hasBase?T===null?y.bothChanged:y.bothChangedTopic((0,Y.jsx)(`span`,{className:`font-mono text-fg`,children:T})):y.differ}),e.hasBase&&(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":o,onClick:f,className:`inline-flex shrink-0 items-center justify-center gap-1.5 rounded-[7px] text-[13px] font-medium whitespace-nowrap transition-colors disabled:cursor-not-allowed disabled:opacity-50 h-7 px-2 text-muted hover:bg-hover hover:text-fg ml-auto aria-pressed:text-fg`,children:[o?y.hideOriginal:y.showOriginal,` `,(0,Y.jsx)(X,{children:`o`})]})]}),o&&e.hasBase&&(0,Y.jsxs)(`div`,{className:`border-t border-border bg-canvas`,"data-testid":`conflict-original`,children:[(0,Y.jsx)(`p`,{className:`px-3.5 pt-1.5 text-xs text-muted`,children:y.original}),(0,Y.jsx)(`div`,{className:`pb-1`,children:e.base.length===0?(0,Y.jsx)(`p`,{className:`px-3.5 pb-1 text-xs text-muted`,children:y.originalEmpty}):e.base.map((t,n)=>(0,Y.jsx)(Z,{number:e.baseLine+n,dim:!0,struck:!0,children:Q(t)},n))})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 border-t border-border @3xl:grid-cols-2`,children:[(0,Y.jsx)(kt,{side:`source`,caption:y.sourceCaption,region:e,decision:n,names:r,onToggle:e=>d.toggleLine(`source`,e)}),(0,Y.jsx)(kt,{side:`target`,caption:y.targetCaption,region:e,decision:n,names:r,onToggle:e=>d.toggleLine(`target`,e)})]}),(0,Y.jsx)(At,{region:e,decision:n,names:r,combineReason:w.ok?null:e.hasBase?w.reason:null,canCombine:w.ok,onDecide:d.decide,onEdit:m}),(0,Y.jsxs)(`div`,{className:`mx-3.5 mb-3.5 overflow-hidden rounded-[8px] shadow-[0_0_0_1px_var(--azd-border-strong)]`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 bg-header px-3 py-1.5 text-xs text-muted`,children:[(0,Y.jsx)(`span`,{className:`font-semibold text-fg`,children:y.result}),(0,Y.jsx)(`span`,{children:y.resultFor((0,Y.jsx)(`span`,{className:`font-mono`,children:r.target}))}),(0,Y.jsxs)(`button`,{type:`button`,onClick:d.undo,disabled:!c,className:`${S} ml-auto h-6`,children:[(0,Y.jsx)(_,{className:`size-3.5`}),y.undo,` `,(0,Y.jsx)(X,{children:`⌘Z`})]})]}),s?(0,Y.jsx)(Mt,{initial:(x??Ot(e)).map(e=>e.text),onSave:e=>{d.decide({kind:`edited`,lines:e}),h()},onCancel:h}):x===null?(0,Y.jsx)(`p`,{className:`bg-code px-3 py-2.5 text-xs text-muted`,"data-testid":`conflict-result-empty`,children:y.resultEmpty}):(0,Y.jsx)(jt,{lines:x,names:r,startLine:e.baseLine})]})]})}function Et(e){let t=e.hasBase?e.base.length:e.target.length,n=e.baseLine;return t<=1?{first:Math.max(n,1),count:t}:{first:n,count:t}}function Dt(e,t){let{first:n,count:r}=Et(t);return e.conflicts.region.lines(n,r)}function Ot(e){return[...e.source.map(e=>({text:e,origin:`source`})),...e.target.map(e=>({text:e,origin:`target`}))]}function kt({side:e,caption:t,region:n,decision:r,names:i,onToggle:a}){let o=E().conflicts.region,s=Ae(n,e),c=r?.kind===`lines`?new Set(e===`source`?r.source:r.target):r?.kind===e||r?.kind===`both`||r?.kind===`combine`?new Set(s.filter(e=>e.changed).map(e=>e.index)):new Set;return(0,Y.jsxs)(`div`,{className:`min-w-0 border-border @3xl:[&+&]:border-l [&+&]:border-t @3xl:[&+&]:border-t-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border bg-surface px-3 py-1.5 text-xs text-muted`,children:[(0,Y.jsx)(vt,{side:e,names:i}),(0,Y.jsx)(`span`,{children:t})]}),(0,Y.jsx)(`div`,{className:`bg-code py-0.5`,children:s.length===0?(0,Y.jsx)(`p`,{className:`px-3 py-1.5 text-xs text-muted`,children:o.removedLines}):s.map(t=>t.changed?(0,Y.jsxs)(`label`,{className:`grid min-h-6 cursor-pointer grid-cols-[2.75rem_minmax(0,1fr)] items-start font-mono text-xs leading-6 text-fg ${gt[e]}`,children:[(0,Y.jsx)(`span`,{className:`flex h-6 items-center justify-end pr-2.5`,children:(0,Y.jsx)(`input`,{type:`checkbox`,checked:c.has(t.index),onChange:()=>a(t.index),"aria-label":o.pick(i[e],t.text.trim()||o.emptyLineName),className:`size-3.5 ${e===`source`?`accent-[var(--azd-side-source)]`:`accent-[var(--azd-side-target)]`}`})}),(0,Y.jsx)(`span`,{className:`pr-3 break-words whitespace-pre-wrap`,children:t.text.length===0?(0,Y.jsx)(`span`,{className:`text-muted`,children:o.emptyLine}):(0,Y.jsx)(xt,{segments:Pe(t.baseText,t.text),side:e})})]},t.index):(0,Y.jsxs)(Z,{dim:!0,tagless:!0,children:[Q(t.text),(0,Y.jsx)(`span`,{className:`ml-2 font-sans text-[11px]`,children:o.unchanged})]},t.index))})]})}function At({region:e,decision:t,names:n,canCombine:r,combineReason:i,onDecide:a,onEdit:o}){let s=E(),c=s.conflicts.region,l=wt(t),d=Et(e),f=t?.kind===`both`?t.first:`source`,m=t?.kind===`lines`?t.source.length+t.target.length:0,h=[...r?[{key:`combine`,label:(0,Y.jsxs)(Y.Fragment,{children:[c.combine,(0,Y.jsx)(`span`,{className:`rounded-full bg-[var(--azd-selected)] px-1.5 text-[11px] font-normal text-muted`,children:c.recommended})]}),name:c.combineName,hint:`c`,decision:{kind:`combine`}}]:[],{key:`source`,label:c.side(n.short.source),name:c.sideName(n.short.source,n.source),hint:`1`,decision:{kind:`source`}},{key:`target`,label:c.side(n.short.target),name:c.sideName(n.short.target,n.target),hint:`2`,decision:{kind:`target`}},{key:`both`,label:c.both,name:c.bothName(n[f]),hint:`3`,decision:{kind:`both`,first:f}},...l===`lines`&&t!==void 0?[{key:`lines`,label:c.picked(m),name:c.picked(m),decision:t}]:[]],g=(0,G.useRef)([]),_=Math.max(0,h.findIndex(e=>e.key===l));return(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-3.5 py-2.5`,children:[(0,Y.jsx)(`div`,{role:`radiogroup`,"aria-label":c.resolve(d.first,d.count),onKeyDown:e=>{let t=g.current.indexOf(document.activeElement);if(t<0)return;let n=null;e.key===`ArrowRight`||e.key===`ArrowDown`?n=(t+1)%h.length:(e.key===`ArrowLeft`||e.key===`ArrowUp`)&&(n=(t-1+h.length)%h.length),n!==null&&(e.preventDefault(),g.current[n]?.focus())},className:`flex flex-wrap items-center gap-2`,children:h.map((e,t)=>(0,Y.jsxs)(`button`,{ref:e=>{g.current[t]=e},type:`button`,role:`radio`,"aria-checked":l===e.key,"aria-label":e.name,tabIndex:t===_?0:-1,onClick:()=>{e.key!==`lines`&&a(e.decision)},className:`${k} h-7 gap-1.5 bg-surface px-2.5 text-[12.5px] aria-checked:border-border-strong aria-checked:bg-[var(--azd-selected)] aria-checked:text-fg-strong`,"data-testid":`choice-${e.key}`,children:[l===e.key&&(0,Y.jsx)(u,{className:`size-3`}),e.label,e.hint!==void 0&&(0,Y.jsx)(X,{children:e.hint})]},e.key))}),t?.kind===`both`&&(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>a({kind:`both`,first:t.first===`source`?`target`:`source`}),className:`inline-flex shrink-0 items-center justify-center gap-1.5 rounded-[7px] text-[13px] font-medium whitespace-nowrap transition-colors disabled:cursor-not-allowed disabled:opacity-50 h-7 px-2 text-muted hover:bg-hover hover:text-fg h-7`,"data-testid":`swap-order`,children:[(0,Y.jsx)(C,{className:`size-3.5`}),c.first(n.short[t.first===`source`?`target`:`source`])]}),(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1 h-5 w-px bg-border`}),(0,Y.jsxs)(`button`,{type:`button`,onClick:o,className:`${S} h-7`,children:[(0,Y.jsx)(p,{className:`size-3.5`}),c.editResult,` `,(0,Y.jsx)(X,{children:`e`})]}),i!==null&&(0,Y.jsx)(`span`,{className:`ml-auto text-xs text-muted`,"data-testid":`combine-reason`,children:s.conflicts.combine.cannot(i)})]})}function jt({lines:e,names:t,startLine:n}){let r=E();return e.length===0?(0,Y.jsx)(`p`,{className:`bg-code px-3 py-2 text-xs text-muted`,"data-testid":`conflict-result`,children:r.conflicts.region.noLines}):(0,Y.jsx)(`div`,{className:`bg-code py-0.5`,"data-testid":`conflict-result`,children:e.map((e,r)=>(0,Y.jsx)(Z,{number:n>0?n+r:void 0,tone:e.origin===`source`||e.origin===`target`?gt[e.origin]:``,tag:(0,Y.jsx)(bt,{origin:e.origin,names:t}),children:Q(e.text)},r))})}function Mt({initial:e,onSave:t,onCancel:n}){let r=E().conflicts.region,[i,a]=(0,G.useState)(()=>e.join(`
3
+ `)),[o,s]=(0,G.useState)(null),c=(0,G.useId)(),l=()=>{let e=i.length===0?[]:i.replace(/\r\n/g,`
4
+ `).split(`
5
+ `),n=qe(e);n===null?t(e):s(n)};return(0,Y.jsxs)(`div`,{className:`space-y-2 bg-code p-2.5`,children:[(0,Y.jsx)(`label`,{htmlFor:c,className:`sr-only`,children:r.editorLabel}),(0,Y.jsx)(`textarea`,{id:c,value:i,onChange:e=>{a(e.target.value),s(null)},onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)?(e.preventDefault(),l()):e.key===`Escape`&&(e.preventDefault(),n())},autoFocus:!0,spellCheck:!1,rows:Math.min(16,Math.max(3,e.length+1)),"aria-describedby":o===null?void 0:`${c}-problem`,className:`w-full resize-y rounded-[7px] border border-border bg-canvas px-2.5 py-2 font-mono text-xs leading-6 text-fg focus:border-[var(--azd-focus)] focus:outline-none`,"data-testid":`region-editor`}),o!==null&&(0,Y.jsx)(`p`,{id:`${c}-problem`,role:`alert`,className:`text-xs text-danger`,children:r.editorMarker(o)}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,Y.jsx)(`span`,{className:`mr-auto text-xs text-muted`,children:r.editorKeys((0,Y.jsx)(X,{children:`⌘↵`}),(0,Y.jsx)(X,{children:`esc`}))}),(0,Y.jsx)(`button`,{type:`button`,onClick:n,className:S,children:r.cancel}),(0,Y.jsx)(`button`,{type:`button`,onClick:l,className:k,children:r.applyResult})]})]})}function Nt(e,t,n,r){if(n===void 0||r===void 0||e.baseBlob!==null&&t===void 0)return`loading`;for(let e of[t,n,r]){if(e===void 0||e.kind===`text`)continue;let t=a().conflicts.file;return{reason:e.kind===`too-large`?t.tooLarge:t.notText}}return n.kind!==`text`||r.kind!==`text`?`loading`:{base:t?.kind===`text`?t.file:null,source:n.file,target:r.file}}function Pt({conflict:e,sides:t,names:n,store:r,save:i,footer:a}){let o=E(),s=o.conflicts.content,c=(0,G.useMemo)(()=>Oe(t.base?.lines??null,t.source.lines,t.target.lines),[t]),l=(0,G.useMemo)(()=>ke(c),[c]),u=`${e.baseBlob??``}:${e.sourceBlob}:${e.targetBlob}`,[d]=(0,G.useState)(()=>{let t=r.read(e.path);return t===null?null:pe(t,u,l)}),[m,h]=(0,G.useReducer)(Ve,d?.choices,e=>Be(e)),g=m.current;(0,G.useEffect)(()=>{r.write(e.path,fe(u,l,g))},[r,e.path,u,l,g]);let[_,v]=(0,G.useState)(()=>Je(l,g,-1)??0),[y,b]=(0,G.useState)(new Set),[x,C]=(0,G.useState)(new Set),[w,D]=(0,G.useState)(null),[O,k]=(0,G.useState)(!1),[A,j]=(0,G.useState)(!1),te=(0,G.useRef)(new Map),ne=e=>{let t=te.current.get(e);return t===void 0&&(t=(0,G.createRef)(),te.current.set(e,t)),t},M=(0,G.useRef)(null),N=e=>{v(e),window.setTimeout(()=>{let t=te.current.get(e)?.current;t?.focus({preventScroll:!0}),t?.scrollIntoView({block:`nearest`,behavior:`auto`})},0)},P=We(c,g,{source:t.source.lines,target:t.target.lines,labels:{source:n.source,target:n.target}}),F=Ye(l,g),I=g.fileEdit===null?null:qe(g.fileEdit),L=F?0:P.undecided.length,R=l.length-P.undecided.length,z=et(l,g),ie=()=>{if(z.length===0)return;let e=Ve(m,{type:`fill`,fills:z});h({type:`fill`,fills:z});let t=Je(l,e.current,-1);t===null?window.setTimeout(()=>M.current?.focus(),0):N(t)},B=(e,t)=>{let n=l.find(t=>t.index===e);if(n===void 0||J(n,t)===null)return;let r=Ve(m,{type:`decide`,region:e,decision:t});h({type:`decide`,region:e,decision:t}),b(t=>{let n=new Set(t);return n.delete(e),n});let i=Je(l,r.current,e);i===null?window.setTimeout(()=>M.current?.focus(),0):N(i)},oe=()=>g.wholeFile===`source`?{kind:`takeSource`}:g.wholeFile===`target`?{kind:`takeTarget`}:!F||I!==null?null:{kind:`userMerged`,content:re({...t.target,lines:P.lines.map(e=>e.text)})},V=()=>{let e=oe();e===null||i.busy||i.run(e)},se=F?I===null?null:s.marker(I):s.left(L);ae({n:()=>{l.length>0&&N((_+1)%l.length)},p:()=>{l.length>0&&N((_-1+l.length)%l.length)},c:()=>B(_,{kind:`combine`}),1:()=>B(_,{kind:`source`}),2:()=>B(_,{kind:`target`}),3:()=>B(_,{kind:`both`,first:`source`}),e:()=>D(_),o:()=>C(e=>{let t=new Set(e);return t.has(_)?t.delete(_):t.add(_),t})},w===null&&!O&&g.wholeFile===null&&g.fileEdit===null);let H=()=>{let e=m.history.at(-1);if(e===void 0)return;let t=Ue(e,g);h({type:`undo`}),t!==null&&(b(e=>new Set(e).add(t)),N(t))},U=(0,G.useRef)({markResolved:V,undo:H,canUndo:m.history.length>0});U.current={markResolved:V,undo:H,canUndo:m.history.length>0},(0,G.useEffect)(()=>{let e=e=>{if(!(!(e.metaKey||e.ctrlKey)||e.altKey||e.defaultPrevented)){if(e.key===`Enter`&&!ce(e))e.preventDefault(),U.current.markResolved();else if(e.key.toLowerCase()===`z`&&!e.shiftKey&&!ce(e)){if(!U.current.canUndo)return;e.preventDefault(),U.current.undo()}}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let le=(0,Y.jsx)(T,{label:s.wholeFile,entries:[{kind:`heading`,label:s.wholeFileHeading},...[`source`,`target`].map(e=>({kind:`radio`,label:o.conflicts.file.takeFile(n.short[e]),checked:g.wholeFile===e,onSelect:()=>h({type:`whole-file`,side:e}),testId:`whole-file-${e}`}))],trigger:e=>(0,Y.jsxs)(`button`,{type:`button`,...e,ref:e.ref,className:S,children:[s.wholeFile,(0,Y.jsx)(f,{className:`size-3.5`})]})}),W=l.length===0?s.clean:s.progress(l.length,R);return(0,Y.jsxs)($,{conflict:e,names:n,progress:W,tools:(0,Y.jsxs)(Y.Fragment,{children:[z.length>0&&(0,Y.jsxs)(`button`,{type:`button`,onClick:ie,className:`inline-flex shrink-0 items-center justify-center gap-1.5 rounded-[7px] text-[13px] font-medium whitespace-nowrap transition-colors disabled:cursor-not-allowed disabled:opacity-50 h-7 px-2 text-muted hover:bg-hover hover:text-fg`,title:o.conflicts.fill.oneTitle,"data-testid":`fill-safe`,children:[(0,Y.jsx)(ee,{className:`size-3.5`}),o.conflicts.fill.one(z.length)]}),le,(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>k(!0),className:S,disabled:O,children:[(0,Y.jsx)(p,{className:`size-3.5`}),s.editFile]}),(0,Y.jsx)(`button`,{type:`button`,"aria-pressed":A,onClick:()=>j(!A),className:`${S} aria-pressed:text-fg`,disabled:!F||I!==null,title:F?void 0:s.decideFirst,children:s.review(n.short.target)})]}),save:i,markRef:M,blockedReason:se,onMarkResolved:V,footer:a,children:[d!==null&&d.dropped>0&&(0,Y.jsx)(`p`,{className:`border-b border-border px-3.5 py-2 text-xs text-muted`,role:`status`,children:s.setAside(d.dropped)}),A&&F&&I===null?(0,Y.jsx)(Vt,{target:t.target.lines,result:P.lines.map(e=>e.text),names:n}):g.wholeFile===null?O?(0,Y.jsx)(zt,{initial:P.lines.map(e=>e.text),onSave:e=>{h({type:`edit-file`,lines:e}),k(!1)},onCancel:()=>k(!1)}):g.fileEdit===null?(0,Y.jsx)(Ft,{regions:c,conflicts:l,choices:m,names:n,active:_,expanded:y,original:x,editing:w,headerRef:ne,onFocus:v,onDecide:B,onToggleLine:(e,t,n)=>h({type:`toggle-line`,region:e,side:t,index:n}),onUndo:H,onToggleOriginal:e=>C(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onExpand:e=>b(t=>new Set(t).add(e)),onEdit:e=>D(e),onEditDone:()=>D(null),autoMark:e=>{let t=g.auto?.[e];return t===void 0?void 0:ft(t,n)}}):(0,Y.jsx)(Bt,{lines:g.fileEdit,names:n,markerLine:I,onEdit:()=>k(!0),onDiscard:()=>h({type:`edit-file`,lines:null})}):(0,Y.jsx)(Rt,{side:g.wholeFile,names:n,onUndo:()=>h({type:`whole-file`,side:null})})]})}function Ft({regions:e,conflicts:t,choices:n,names:r,active:i,expanded:a,original:o,editing:s,headerRef:c,onFocus:l,onDecide:u,onToggleLine:d,onUndo:f,onToggleOriginal:p,onExpand:m,onEdit:h,onEditDone:g,autoMark:_}){return(0,Y.jsx)(`div`,{className:`@container`,children:e.map((e,v)=>e.kind===`clean`?(0,Y.jsx)(Lt,{region:e,names:r},`clean-${v}`):(0,Y.jsx)(Tt,{region:e,count:t.length,decision:n.current.decisions[e.index],names:r,active:i===e.index,expanded:a.has(e.index)||i===e.index||n.current.auto?.[e.index]!==void 0,auto:_(e.index),showOriginal:o.has(e.index),editing:s===e.index,canUndo:n.history.length>0,headerRef:c(e.index),intents:{decide:t=>u(e.index,t),toggleLine:(t,n)=>d(e.index,t,n),focus:()=>l(e.index),undo:f},onToggleOriginal:()=>p(e.index),onExpand:()=>m(e.index),onEdit:()=>h(e.index),onEditDone:g},`conflict-${e.index}`))})}var It=3;function Lt({region:e,names:t}){let n=E().conflicts.content,[r,i]=(0,G.useState)(!1);if(e.origin===`source`||e.origin===`target`){let r=e.origin,i=e.baseLine,a=e.lines.length;return(0,Y.jsxs)(`div`,{className:`border-b border-border`,"data-testid":`clean-change`,children:[(0,Y.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 px-3.5 pt-1.5 pb-1 text-xs text-muted`,children:[(0,Y.jsx)(`span`,{className:`text-added`,"aria-hidden":`true`,children:`✓`}),a===0?n.removedCleanly(i,a,t.short[r]):n.mergedCleanly(i,a,t.short[r])]}),(0,Y.jsx)(`div`,{className:`bg-code pb-0.5`,children:e.lines.map((e,t)=>(0,Y.jsx)(Z,{tone:gt[r],children:Q(e)},t))})]})}let a=e.lines;return a.length<=It||r?(0,Y.jsx)(`div`,{className:`border-b border-border bg-code py-0.5`,children:a.map((t,n)=>(0,Y.jsx)(Z,{number:e.baseLine>0?e.baseLine+n:void 0,dim:!0,children:Q(t)},n))}):(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>i(!0),className:`flex w-full items-center gap-2 border-b border-border bg-canvas px-3.5 py-1.5 text-left text-xs text-muted hover:text-fg`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:`⋯`}),e.origin===`both`?n.identical(a.length):n.unchanged(a.length),(0,Y.jsx)(`span`,{className:`sr-only`,children:n.showThem})]})}function Rt({side:e,names:t,onUndo:n}){let r=E().conflicts.content,i=e===`source`?`target`:`source`;return(0,Y.jsxs)(`div`,{className:`space-y-2 px-3.5 py-3 text-[13px]`,"data-testid":`whole-file-note`,children:[(0,Y.jsx)(`p`,{className:`text-fg`,children:r.usingWhole((0,Y.jsx)(`span`,{className:`font-mono`,children:t[e]}))}),(0,Y.jsx)(`p`,{className:`text-muted`,children:r.dropsOther(t.short[i])}),(0,Y.jsx)(`button`,{type:`button`,onClick:n,className:k,children:r.perConflict})]})}function zt({initial:e,onSave:t,onCancel:n}){let r=E().conflicts.content,[i,a]=(0,G.useState)(()=>e.join(`
6
+ `)),[o,s]=(0,G.useState)(null),c=(0,G.useId)(),l=()=>{let e=i.length===0?[]:i.replace(/\r\n/g,`
7
+ `).split(`
8
+ `),n=qe(e);n===null?t(e):s(n)};return(0,Y.jsxs)(`div`,{className:`space-y-2 p-3.5`,children:[(0,Y.jsx)(`label`,{htmlFor:c,className:`block text-xs text-muted`,children:r.editorLabel((0,Y.jsx)(`span`,{className:`font-mono`,children:`<<<<<<<`}))}),(0,Y.jsx)(`textarea`,{id:c,value:i,onChange:e=>{a(e.target.value),s(null)},onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)?(e.preventDefault(),l()):e.key===`Escape`&&(e.preventDefault(),n())},autoFocus:!0,spellCheck:!1,rows:Math.min(28,Math.max(8,e.length+1)),className:`w-full resize-y rounded-[7px] border border-border bg-canvas px-2.5 py-2 font-mono text-xs leading-6 text-fg focus:border-[var(--azd-focus)] focus:outline-none`,"data-testid":`file-editor`}),o!==null&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:r.editorMarker(o)}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,Y.jsx)(`span`,{className:`mr-auto text-xs text-muted`,children:r.editorKeys((0,Y.jsx)(X,{children:`⌘↵`}),(0,Y.jsx)(X,{children:`esc`}))}),(0,Y.jsx)(`button`,{type:`button`,onClick:n,className:S,children:r.cancel}),(0,Y.jsx)(`button`,{type:`button`,onClick:l,className:k,children:r.keepThisFile})]})]})}function Bt({lines:e,names:t,markerLine:n,onEdit:r,onDiscard:i}){let a=E().conflicts.content;return(0,Y.jsxs)(`div`,{"data-testid":`edited-file`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-3.5 py-2 text-xs text-muted`,children:[(0,Y.jsx)(p,{className:`size-3.5`}),a.editedByHand,n!==null&&(0,Y.jsx)(`span`,{className:`text-danger`,children:a.editedMarker(n)}),(0,Y.jsx)(`button`,{type:`button`,onClick:r,className:`${S} ml-auto`,children:a.edit}),(0,Y.jsx)(`button`,{type:`button`,onClick:i,className:S,children:a.discardEdit})]}),(0,Y.jsx)(jt,{lines:e.map(e=>({text:e,origin:`edited`})),names:t,startLine:1})]})}function Vt({target:e,result:t,names:n}){let r=E().conflicts.content,i=[];for(let n of W(e,t)){let e=n.added?`added`:n.removed?`removed`:`same`;for(let t of n.value)i.push({kind:e,text:t})}let a=i.some(e=>e.kind!==`same`);return(0,Y.jsxs)(`div`,{"data-testid":`review-diff`,children:[(0,Y.jsx)(`p`,{className:`px-3.5 py-2 text-xs text-muted`,children:r.reviewIntro((0,Y.jsx)(`span`,{className:`font-mono`,children:n.target}))}),a?(0,Y.jsx)(`div`,{className:`bg-code py-0.5`,children:i.map((e,t)=>(0,Y.jsx)(Z,{tone:e.kind===`added`?`bg-[color-mix(in_srgb,var(--azd-added)_12%,transparent)]`:e.kind===`removed`?`bg-[color-mix(in_srgb,var(--azd-deleted)_12%,transparent)]`:``,tag:(0,Y.jsxs)(`span`,{className:e.kind===`added`?`text-added`:e.kind===`removed`?`text-deleted`:``,children:[e.kind===`added`?`+`:e.kind===`removed`?`−`:``,(0,Y.jsx)(`span`,{className:`sr-only`,children:e.kind===`added`?r.added:e.kind===`removed`?r.removed:``})]}),dim:e.kind===`same`,children:Q(e.text)},t))}):(0,Y.jsx)(`p`,{className:`px-3.5 pb-3 text-[13px] text-fg`,children:r.unchangedFile(n.short.target)})]})}function Ht({conflict:e,scope:n,location:r,names:i,store:a,save:o,footer:s}){let c=E(),[l,u]=(0,G.useState)(!1);if(e.resolutionStatus===`resolved`&&!l&&e.kind!==`unsupported`)return(0,Y.jsx)($t,{conflict:e,names:i,footer:s,onChange:()=>u(!0)});switch(e.kind){case`content`:return(0,Y.jsx)(Wt,{conflict:e,scope:n,names:i,store:a,save:o,footer:s});case`pickOne`:return(0,Y.jsx)(Xt,{conflict:e,scope:n,names:i,save:o,footer:s});case`unsupported`:return(0,Y.jsx)($,{conflict:e,names:i,save:{...o,problem:null},blockedReason:null,onMarkResolved:()=>{},showMark:!1,footer:s,children:(0,Y.jsxs)(`div`,{className:`space-y-2 px-3.5 py-3 text-[13px]`,"data-testid":`unsupported-conflict`,children:[(0,Y.jsx)(`p`,{className:`text-fg`,children:ut(e,i)}),(0,Y.jsx)(`p`,{className:`text-muted`,children:c.conflicts.file.unsupported}),(0,Y.jsx)(z,{href:t(r),children:c.conflicts.file.openInAzureDevOps})]})})}}function Ut(e,t){return[N(e,t[0]??null),N(e,t[1]??null),N(e,t[2]??null)]}function Wt({conflict:e,scope:t,names:n,store:r,save:i,footer:a}){let o=E(),[s,c,l]=Ut(t,[e.baseBlob,e.sourceBlob,e.targetBlob]),u=[s,c,l].find(e=>e.isError),d=Nt(e,s.data,c.data,l.data);return u===void 0?d===`loading`?(0,Y.jsx)($,{conflict:e,names:n,save:i,blockedReason:o.conflicts.file.loading,onMarkResolved:()=>{},footer:{...a,regionKeys:!1},children:(0,Y.jsxs)(`div`,{className:`space-y-2 px-3.5 py-4`,"aria-busy":`true`,children:[(0,Y.jsx)(`span`,{className:`sr-only`,children:o.conflicts.file.loadingDetail}),[70,52,64].map(e=>(0,Y.jsx)(`div`,{className:`azd-pulse h-3 rounded bg-raised`,style:{width:`${e}%`}},e))]})}):`reason`in d?(0,Y.jsx)(Zt,{conflict:e,names:n,save:i,footer:a,reason:d.reason,sizes:{source:Gt(c.data),target:Gt(l.data)}}):(0,Y.jsx)(Pt,{conflict:e,sides:d,names:n,store:r,save:i,footer:{...a,regionKeys:!0}}):(0,Y.jsx)($,{conflict:e,names:n,save:i,blockedReason:o.conflicts.file.notLoaded,onMarkResolved:()=>{},footer:{...a,regionKeys:!1},children:(0,Y.jsxs)(`p`,{role:`alert`,className:`flex items-center gap-2 px-3.5 py-3 text-[13px] text-muted`,children:[o.conflicts.file.notLoadedDetail,(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{for(let e of[s,c,l])e.isError&&e.refetch()},className:`font-medium text-fg hover:underline`,children:o.conflicts.file.tryAgain})]})})}function Gt(e){return e===void 0?null:e.kind===`text`?e.bytes.byteLength:e.size}function Kt(e,t){if(e===null)return``;if(e<1024)return`${e} B`;let n=new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1,useGrouping:!1});return e<1048576?`${n.format(e/1024)} KB`:`${n.format(e/1024/1024)} MB`}function qt({label:e,cards:t,value:n,onChange:r}){let i=(0,G.useId)();return(0,Y.jsxs)(`fieldset`,{className:`space-y-2 p-3.5`,children:[(0,Y.jsx)(`legend`,{className:`sr-only`,children:e}),t.map(e=>(0,Y.jsxs)(`label`,{className:`grid cursor-pointer grid-cols-[1.125rem_minmax(0,1fr)] gap-x-2.5 rounded-[8px] border border-border bg-canvas p-3 hover:border-border-strong has-[:checked]:border-border-strong has-[:checked]:bg-[var(--azd-selected)] has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-[var(--azd-focus)]`,"data-testid":`choice-card-${e.value}`,children:[(0,Y.jsx)(`input`,{type:`radio`,name:i,checked:n===e.value,onChange:()=>r(e.value),className:`mt-1 size-3.5 focus-visible:outline-none`}),(0,Y.jsxs)(`span`,{className:`min-w-0 space-y-0.5`,children:[(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[13px] font-medium text-fg`,children:[e.title,e.chip]}),(0,Y.jsx)(`span`,{className:`block text-xs text-muted`,children:e.detail}),e.preview]})]},e.value))]})}function Jt({lines:e}){let t=E(),[n,r]=(0,G.useState)(!1);return e===null?null:(0,Y.jsxs)(`span`,{className:`block pt-1.5`,children:[(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:e=>{e.preventDefault(),r(!n)},className:`${S} -ml-2 h-6`,children:[n?(0,Y.jsx)(f,{className:`size-3.5`}):(0,Y.jsx)(s,{className:`size-3.5`}),n?t.conflicts.file.hideFile:t.conflicts.file.showFile]}),n&&(0,Y.jsx)(`span`,{className:`mt-1 block max-h-72 overflow-auto rounded-[6px] bg-code py-0.5`,children:e.map((e,t)=>(0,Y.jsx)(Z,{number:t+1,children:Q(e)},t))})]})}function Yt(e){return e?.kind===`text`?e.file.lines:null}function Xt({conflict:e,scope:t,names:n,save:r,footer:i}){let a=E().conflicts.file,[o,s]=(0,G.useState)(null),c=e.type===`editDelete`?`source`:`target`,l=c===`source`?`target`:`source`,[u]=Ut(t,[c===`source`?e.sourceBlob:e.targetBlob]),d=Yt(u.data),f=[{value:c,title:a.keepFile,chip:(0,Y.jsx)(vt,{side:c,names:n,short:!0}),detail:a.keepFileDetail((0,Y.jsx)(`span`,{className:`font-mono`,children:n.target}),n.short[c]),preview:(0,Y.jsx)(Jt,{lines:d})},{value:l,title:a.deleteFile,chip:(0,Y.jsx)(vt,{side:l,names:n,short:!0}),detail:a.deleteFileDetail(n.short[l],n.short[c])}],p=()=>{o!==null&&r.run({kind:o===`source`?`pickSource`:`pickTarget`})};return Qt(p),(0,Y.jsx)($,{conflict:e,names:n,save:r,blockedReason:o===null?a.chooseOne:null,onMarkResolved:p,footer:{...i,regionKeys:!1},children:(0,Y.jsx)(qt,{label:a.keepOrDelete,cards:f,value:o,onChange:s})})}function Zt({conflict:e,names:t,save:n,footer:r,reason:i,sizes:a}){let o=E().conflicts.file,s=d(),[c,l]=(0,G.useState)(null),u=[`source`,`target`].map(e=>({value:e,title:o.takeFile(t.short[e]),chip:(0,Y.jsx)(vt,{side:e,names:t,short:!0}),detail:Kt(a[e],s)})),f=()=>{if(c===null)return;let e=c===`source`?{kind:`takeSource`}:{kind:`takeTarget`};n.run(e)};return Qt(f),(0,Y.jsxs)($,{conflict:e,names:t,save:n,blockedReason:c===null?o.chooseOne:null,onMarkResolved:f,footer:{...r,regionKeys:!1},children:[(0,Y.jsx)(`p`,{className:`px-3.5 pt-3 text-xs text-muted`,children:i}),(0,Y.jsx)(qt,{label:o.whichVersion,cards:u,value:c,onChange:l})]})}function Qt(e){let[t]=(0,G.useState)(()=>({current:e}));t.current=e,(0,G.useEffect)(()=>{let e=e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!e.altKey&&(e.preventDefault(),t.current())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t])}function $t({conflict:e,names:t,footer:n,onChange:r}){let i=E(),a=dt(e,t),o=e.resolvedBy?.displayName,s=pt(e.resolvedDate);return(0,Y.jsx)($,{conflict:e,names:t,save:{busy:!1,problem:null,run:()=>{}},blockedReason:null,onMarkResolved:()=>{},showMark:!1,footer:{...n,regionKeys:!1},tools:(0,Y.jsx)(`button`,{type:`button`,onClick:r,className:`${v} h-7 px-2.5`,children:i.conflicts.file.change}),children:(0,Y.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2 px-3.5 py-3 text-[13px]`,"data-testid":`resolved-file`,children:[(0,Y.jsx)(u,{className:`size-4 text-added`}),(0,Y.jsx)(`span`,{className:`font-medium text-fg`,children:a??i.conflicts.resolution.resolved}),(o!==void 0||s.length>0)&&(0,Y.jsxs)(`span`,{className:`text-muted`,children:[o===void 0?``:i.conflicts.resolution.by(o),o!==void 0&&s.length>0?` · `:``,s]})]})})}var en=2e3,tn=12e4;function nn(e){return e.resolutionStatus===`resolved`?`resolved`:e.kind===`unsupported`?`elsewhere`:`open`}function rn(e){let t={open:0,resolved:1,elsewhere:2};return[...e].sort((e,n)=>t[nn(e)]-t[nn(n)]||e.path.localeCompare(n.path))}function an({file:e,onFileChange:t}){let{location:r,shortForm:a,pullRequest:s,scope:c}=H(),u=(0,G.useMemo)(()=>({organization:c.organization,project:c.project,repositoryId:c.repositoryId,pullRequestId:c.pullRequestId}),[c]),d=(0,G.useMemo)(()=>ct(s.sourceBranch,s.targetBranch),[s.sourceBranch,s.targetBranch]),f=ie(u,s),p=(0,G.useMemo)(()=>rn(f.data??[]),[f.data]),m=p.find(t=>t.path===e)??p.find(e=>nn(e)===`open`)??p[0]??null,h=U(p),g=P(r,a),_=E(),[y,b]=(0,G.useState)(!1),[x,S]=(0,G.useState)(null),[C,T]=(0,G.useState)(null),D=m===null?-1:p.indexOf(m),k=e=>{e!==void 0&&t(e.path)};ae({j:()=>k(p[D+1]),k:()=>k(p[D-1]),"?":()=>b(!0)});let A=l(),[j,re]=(0,G.useState)(!1),[M,N]=(0,G.useState)(null),[L,R]=(0,G.useState)(0),z=p.filter(e=>e.kind===`content`&&e.resolutionStatus!==`resolved`).length,oe=async()=>{if(!j){re(!0);try{let e=await nt(p,e=>A.fetchQuery(I(u,e)),V.store);N(e),R(e=>e+1)}catch{N(`failed`)}finally{re(!1)}}},V=mn(u,s,d,{onSaved:e=>{let n=(f.data??[]).filter(t=>t.conflictId!==e.conflictId&&t.resolutionStatus!==`resolved`);T(n.length);let r=rn(n).find(e=>e.kind!==`unsupported`);r!==void 0&&t(r.path)},onStale:S}),ce=(0,Y.jsxs)(i,{top:(0,Y.jsxs)(F,{location:r,shortForm:a,page:{tab:`overview`},className:`flex h-8 items-center gap-1.5 rounded-[7px] px-2 text-[13px] text-muted hover:bg-hover hover:text-fg`,testId:`back-to-overview`,children:[(0,Y.jsx)(w,{className:`size-3.5`}),_.conflicts.page.back]}),children:[(0,Y.jsx)(`div`,{className:`shrink-0 px-3 pb-2`,children:(0,Y.jsx)(te,{value:`conflicts`,filesCount:null,onChange:e=>g(e===`files`?{tab:`files`}:{tab:`files-commits`})})}),(0,Y.jsx)(`nav`,{"aria-label":_.conflicts.page.files,className:`azd-scrollbar min-h-0 flex-1 overflow-y-auto pb-3`,children:(0,Y.jsx)(cn,{conflicts:p,current:m,names:d,onSelect:k})})]}),W;return W=s.status===`active`?f.isPending?(0,Y.jsx)(fn,{}):f.data===void 0?(0,Y.jsx)(le,{error:f.error,organization:r.organization,onRetry:()=>void f.refetch()}):p.length===0?s.mergeStatus===`conflicts`?(0,Y.jsxs)(o,{title:_.conflicts.page.notListedTitle,children:[(0,Y.jsx)(`p`,{children:_.conflicts.page.notListed(s.targetBranch)}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void f.refetch(),className:v,children:_.conflicts.page.checkAgain})]}):(0,Y.jsx)(o,{title:_.conflicts.page.noneTitle,children:(0,Y.jsx)(`p`,{children:_.conflicts.page.none(s.sourceBranch,s.targetBranch)})}):(0,Y.jsxs)(`div`,{className:`mx-auto w-full max-w-[1100px] space-y-3 px-5 pt-4 pb-10`,children:[(0,Y.jsxs)(`p`,{className:`flex items-start gap-2.5 rounded-[10px] border border-border bg-surface px-3 py-2.5 text-[13px] leading-snug text-fg`,"data-testid":`conflicts-banner`,children:[(0,Y.jsx)(O,{className:`mt-0.5 size-4 text-accent`}),(0,Y.jsx)(`span`,{children:_.conflicts.page.banner((0,Y.jsx)(`span`,{className:`font-mono font-medium`,children:s.targetBranch}),(0,Y.jsx)(`span`,{className:`font-mono`,children:s.sourceBranch}))})]}),!h.done&&z>0&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-[13px]`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>void oe(),disabled:j,className:`inline-flex shrink-0 items-center justify-center gap-1.5 rounded-[7px] text-[13px] font-medium whitespace-nowrap transition-colors disabled:cursor-not-allowed disabled:opacity-50 h-8 px-3 border border-border bg-raised text-fg hover:border-border-strong hover:bg-hover`,"data-testid":`fill-safe-all`,children:[(0,Y.jsx)(ee,{className:`size-3.5`}),j?_.conflicts.fill.filling:_.conflicts.fill.all]}),(0,Y.jsx)(`span`,{className:`text-xs text-muted`,"data-testid":`fill-safe-all-result`,role:`status`,children:on(_,M)})]}),x!==null&&(0,Y.jsx)(`p`,{role:`status`,className:`rounded-[10px] border border-border bg-raised px-3 py-2 text-[13px] text-fg`,"data-testid":`conflicts-notice`,children:_.conflicts.page.stale(x)}),h.done?(0,Y.jsx)(pn,{pullRequest:s,total:p.length,names:d}):m!==null&&(0,Y.jsx)(Ht,{conflict:m,scope:u,location:r,names:d,store:V.store,save:V.control(m),footer:{regionKeys:!1,next:sn(p,m,k)}},`${m.conflictId}:${m.mergeSourceCommit}:${m.mergeTargetCommit}:${L}`)]}):(0,Y.jsx)(o,{title:_.conflicts.page.notActiveTitle,children:(0,Y.jsx)(`p`,{children:_.conflicts.page.notActive(s.status)})}),(0,Y.jsxs)(n,{sidebar:ce,sidebarLabel:_.conflicts.page.sidebar,sidebarWidth:280,topBar:(0,Y.jsx)(se,{mode:`review`,merge:!1,tools:p.length>0?(0,Y.jsx)(dn,{resolved:h.resolved,total:p.length}):void 0}),children:[(0,Y.jsx)(`div`,{className:`azd-scrollbar min-h-0 flex-1 overflow-y-auto`,children:W}),(0,Y.jsx)(`p`,{"aria-live":`polite`,className:`sr-only`,"data-testid":`conflicts-announcer`,children:C===null?``:C===0?_.conflicts.page.announceDone:_.conflicts.page.announceLeft(C)}),(0,Y.jsx)(ne,{open:y,onClose:()=>b(!1),shortcuts:B}),V.dialog]})}function on(e,t){return t===null?e.conflicts.fill.hint:t===`failed`?e.conflicts.fill.failed:t.filled===0?e.conflicts.fill.nothing:e.conflicts.fill.filled(t.filled,t.files,t.left)}function sn(e,t,n){let r=e.indexOf(t),i=[...e.slice(r+1),...e.slice(0,r)].find(e=>nn(e)===`open`);return i===void 0?null:{path:i.path,onSelect:()=>n(i)}}function cn({conflicts:e,current:t,names:n,onSelect:r}){let i=E(),a=[`open`,`resolved`,`elsewhere`].map(t=>({group:t,items:e.filter(e=>nn(e)===t)})).filter(e=>e.items.length>0);return(0,Y.jsx)(`div`,{className:`space-y-1`,children:a.map(({group:e,items:a})=>(0,Y.jsxs)(`section`,{"aria-label":i.conflicts.groups[e],"data-testid":`conflict-group-${e}`,children:[(0,Y.jsxs)(`h2`,{className:`flex items-center justify-between px-4 pt-2.5 pb-1 text-xs text-muted`,children:[i.conflicts.groups[e],(0,Y.jsx)(`span`,{className:`tabular-nums`,children:a.length})]}),(0,Y.jsx)(`ul`,{children:a.map(a=>{let{name:o,folder:s}=St(a.path);return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>r(a),"aria-current":a===t?`true`:void 0,className:`grid w-full grid-cols-[1rem_minmax(0,1fr)] items-start gap-2.5 px-4 py-1.5 text-left hover:bg-hover aria-[current]:bg-[var(--azd-selected)]`,"data-testid":`conflict-row`,"data-path":a.path,children:[(0,Y.jsx)(un,{group:e}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1.5 text-[13px]`,children:[(0,Y.jsx)(`span`,{className:`truncate font-medium text-fg`,children:o}),s.length>0&&(0,Y.jsx)(`span`,{className:`truncate text-xs text-muted`,children:s})]}),(0,Y.jsx)(`span`,{className:`line-clamp-2 text-xs text-muted`,children:e===`resolved`?ln(i,a):lt(a,n)})]})]})},a.conflictId)})})]},e))})}function ln(e,t){let n=t.resolvedBy?.displayName,r=pt(t.resolvedDate),i=e.conflicts.resolution;return[i.resolved,n===void 0?null:i.by(n),r.length>0?r:null].filter(e=>e!==null).join(` · `)}function un({group:e}){let t=E().conflicts.groups[e];return e===`resolved`?(0,Y.jsxs)(`span`,{className:`mt-0.5 grid size-3.5 place-items-center rounded-full bg-added`,title:t,children:[(0,Y.jsx)(u,{className:`size-2.5 text-[var(--azd-canvas)]`}),(0,Y.jsxs)(`span`,{className:`sr-only`,children:[t,`: `]})]}):e===`elsewhere`?(0,Y.jsx)(`span`,{className:`mt-0.5 size-3.5 rounded-full border-[1.5px] border-dashed border-muted`,title:t,children:(0,Y.jsxs)(`span`,{className:`sr-only`,children:[t,`: `]})}):(0,Y.jsx)(`span`,{className:`mt-0.5 size-3.5 rounded-full border-[1.5px] border-warning`,title:t,children:(0,Y.jsxs)(`span`,{className:`sr-only`,children:[t,`: `]})})}function dn({resolved:e,total:t}){let n=E(),r=2*Math.PI*6,i=t===0?0:e/t,a=t>0&&e===t;return(0,Y.jsxs)(`span`,{className:`ml-1 flex h-8 shrink-0 items-center gap-2 rounded-[7px] px-2 text-[13px] text-muted`,"data-testid":`resolved-count`,title:n.conflicts.page.resolvedTitle(e,t),children:[(0,Y.jsxs)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 16 16`,className:`size-4 -rotate-90`,children:[(0,Y.jsx)(`circle`,{cx:`8`,cy:`8`,r:6,fill:`none`,stroke:`var(--azd-border-strong)`,strokeWidth:`2`}),e>0&&(0,Y.jsx)(`circle`,{cx:`8`,cy:`8`,r:6,fill:`none`,stroke:a?`var(--azd-added)`:`var(--azd-fg)`,strokeWidth:`2`,strokeLinecap:a?`butt`:`round`,...a?{}:{strokeDasharray:`${i*r} ${r}`},className:`transition-[stroke-dasharray] duration-300 motion-reduce:transition-none`})]}),(0,Y.jsxs)(`span`,{className:`tabular-nums`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg`,children:e}),` / `,t,(0,Y.jsx)(`span`,{className:`ml-1`,children:n.conflicts.page.resolvedCount})]})]})}function fn(){let e=E();return(0,Y.jsxs)(`div`,{className:`mx-auto w-full max-w-[1100px] space-y-3 px-5 pt-4`,"aria-busy":`true`,children:[(0,Y.jsx)(`span`,{className:`sr-only`,children:e.conflicts.page.loading}),(0,Y.jsx)(`div`,{className:`azd-pulse h-11 rounded-[10px] bg-raised`}),(0,Y.jsx)(`div`,{className:`azd-pulse h-64 rounded-[10px] bg-raised`})]})}function pn({pullRequest:e,total:t,names:n}){let{location:r,shortForm:i}=H(),a=E(),o=a.conflicts.finish,s=l(),c=V(),d=(0,G.useRef)(Date.now()),[f,p]=(0,G.useState)(!1),m=e.mergeStatus,h=m===`succeeded`?`ready`:m===`failure`||m===`rejectedByPolicy`?`failed`:f?`timed-out`:`waiting`;(0,G.useEffect)(()=>{if(h!==`waiting`)return;let e=window.setInterval(()=>{Date.now()-d.current>tn?p(!0):s.invalidateQueries({queryKey:L.detail(r),exact:!0})},en);return()=>window.clearInterval(e)},[h,s,r]);let g=(0,G.useRef)(null);return(0,Y.jsxs)(`section`,{"aria-labelledby":`azd-finish-title`,className:`flex flex-col items-start gap-2.5 rounded-[10px] bg-surface p-5 shadow-[0_0_0_1px_var(--azd-border)]`,"data-testid":`conflicts-finish`,"data-state":h,children:[h===`ready`?(0,Y.jsx)(`span`,{className:`grid size-7 place-items-center rounded-full border-2 border-added`,children:(0,Y.jsx)(u,{className:`size-4 text-added`})}):(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 rounded-full ${h===`waiting`?`azd-pulse bg-accent`:`bg-warning`}`}),(0,Y.jsx)(`h2`,{id:`azd-finish-title`,className:`text-[16px] font-semibold text-fg-strong`,children:t===1?o.one:o.all(t)}),(0,Y.jsxs)(`p`,{role:`status`,className:`text-[13px] text-muted`,children:[h===`ready`&&o.ready((0,Y.jsx)(`span`,{className:`font-mono`,children:n.target})),h===`waiting`&&o.waiting,h===`timed-out`&&o.timedOut,h===`failed`&&(e.mergeFailureMessage??o.failed)]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[h===`ready`&&c?.actions?.primary===`complete`&&(0,Y.jsx)(`button`,{ref:g,type:`button`,onClick:e=>c.run(`complete`,e.currentTarget),className:`inline-flex shrink-0 items-center justify-center gap-1.5 rounded-[7px] text-[13px] font-medium whitespace-nowrap transition-colors disabled:cursor-not-allowed disabled:opacity-50 h-8 px-3 bg-primary text-primary-fg hover:opacity-90`,"data-testid":`finish-complete`,children:o.complete}),h===`ready`&&c?.actions?.primary===`set-auto-complete`&&(0,Y.jsx)(`button`,{type:`button`,onClick:e=>c.run(`set-auto-complete`,e.currentTarget),className:`inline-flex shrink-0 items-center justify-center gap-1.5 rounded-[7px] text-[13px] font-medium whitespace-nowrap transition-colors disabled:cursor-not-allowed disabled:opacity-50 h-8 px-3 bg-primary text-primary-fg hover:opacity-90`,children:o.autoComplete}),(h===`timed-out`||h===`failed`)&&(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{d.current=Date.now(),p(!1),s.invalidateQueries({queryKey:L.detail(r),exact:!0})},className:`inline-flex shrink-0 items-center justify-center gap-1.5 rounded-[7px] text-[13px] font-medium whitespace-nowrap transition-colors disabled:cursor-not-allowed disabled:opacity-50 h-8 px-3 border border-border bg-raised text-fg hover:border-border-strong hover:bg-hover`,children:a.conflicts.page.checkAgain}),(0,Y.jsx)(F,{location:r,shortForm:i,page:{tab:`overview`},className:v,children:o.overview})]}),h===`ready`&&(0,Y.jsx)(`p`,{className:`text-xs text-muted`,children:o.mergeTypes})]})}function mn(e,t,n,r){let i=l(),{location:o}=H(),s=y(e.organization),u=E(),d=(0,G.useRef)(!1),[f,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(null),[_,b]=(0,G.useState)(null),S=(0,G.useMemo)(()=>he(ge(),{organization:e.organization,repositoryId:e.repositoryId,pullRequestId:e.pullRequestId}),[e.organization,e.repositoryId,e.pullRequestId]),C=R.list(e,t.lastMergeSourceCommit,t.lastMergeTargetCommit),w=n=>{let r=M(n,{repository:t.repository.name,method:x(e.organization)});return r.kind===`sign-in`?a().conflicts.save.signIn:r.message},T=async(t,n,l)=>{if(d.current)return;d.current=!0,p(!0),h(null);let u=D(e.organization),f;try{f=await it({pullRequest:()=>j(u,{project:e.project,pullRequestId:e.pullRequestId}),conflicts:()=>g(u,{project:e.project,repositoryId:e.repositoryId,pullRequestId:e.pullRequestId}),resolve:n=>c(D(e.organization,{keepSessionOnUnauthorized:!0}),{project:e.project,repositoryId:e.repositoryId,pullRequestId:e.pullRequestId,conflictId:t.conflictId,conflictType:t.type,resolution:n})},{conflict:t,resolution:n,currentUserId:s.data?.id??null,replaceConfirmed:l})}finally{d.current=!1,p(!1)}switch(f.kind){case`saved`:S.write(t.path,null),i.setQueryData(C,e=>e?.map(e=>e.conflictId===t.conflictId?f.conflict:e)),i.invalidateQueries({queryKey:L.detail(o),exact:!0}),r.onSaved(f.conflict);return;case`stale`:i.setQueryData(L.detail(o),f.pullRequest),r.onStale(f.branch);return;case`confirm-replace`:b({conflict:t,resolution:n,by:f.by.displayName,date:f.date});return;case`gone`:h({conflictId:t.conflictId,text:()=>a().conflicts.save.gone}),i.invalidateQueries({queryKey:R.all(e)});return;case`failed`:h({conflictId:t.conflictId,text:()=>at(f,{method:x(e.organization),describe:w})}),f.sent&&i.invalidateQueries({queryKey:R.all(e)});return}},O=(0,G.useId)();return{store:S,dialog:_===null?null:(0,Y.jsx)(oe,{titleId:O,busy:f,onClose:()=>b(null),testId:`replace-dialog`,children:(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(`h2`,{id:O,className:`text-[16px] font-semibold text-fg-strong`,children:u.conflicts.save.replaceTitle(_.by)}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted`,children:u.conflicts.save.replaceBody(_.by,St(_.conflict.path).name,_.date===null?null:pt(_.date),(0,Y.jsx)(`span`,{className:`font-mono`,children:n.target}))}),(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>b(null),className:v,children:u.conflicts.save.keepTheirs}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{let e=_;b(null),T(e.conflict,e.resolution,!0)},className:A,"data-testid":`replace-confirm`,children:u.conflicts.save.replace})]})]})}),control:e=>({busy:f,problem:m?.conflictId===e.conflictId?m.text():null,run:t=>void T(e,t,!1)})}}export{an as t};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-BLXQ4ufn.js";import{Cr as e,Sr as t}from"./index-DsrXp1aY.js";e(),t();function n(){return null}export{n as component};