@davmash/bygone 0.8.13 → 0.8.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/releasing.md CHANGED
@@ -23,7 +23,6 @@ Publish everything:
23
23
 
24
24
  ```bash
25
25
  export BYGONE_HOMEBREW_TAP=/path/to/homebrew-tap
26
- npm whoami
27
26
  gh auth status
28
27
  npm run release:publish
29
28
  ```
@@ -34,10 +33,9 @@ aborts unless the worktree is clean and the current branch is `main`, pushes
34
33
  installs the artifacts locally, then publishes npm, GitHub, and Homebrew.
35
34
  The Homebrew tap defaults to the sibling `homebrew-bygone` checkout; set
36
35
  `BYGONE_HOMEBREW_TAP` only when the tap is elsewhere.
37
- If npm authentication is missing, the command launches browser login. For an
38
- unpublished version, it checks authentication again and pauses immediately
39
- before `npm publish`; press Enter only when ready to complete npm's time-limited
40
- passkey prompt.
36
+ Creating the GitHub release pushes the version tag. That tag starts the
37
+ protected Release workflow, which waits for approval and publishes npm through
38
+ OIDC trusted publishing without a long-lived npm token.
41
39
 
42
40
  Upload `bygone-<version>.vsix` from the Visual Studio Marketplace publisher
43
41
  page. GitHub OIDC support has merged into `vsce`, but Marketplace has not yet
@@ -62,12 +60,11 @@ The main scripts are:
62
60
  - requires a clean `main` worktree
63
61
  - pushes `main` and waits for that commit's GitHub Release Check workflow
64
62
  - rebuilds and installs the release locally, including a graceful desktop restart
65
- - logs into npm when needed and pauses immediately before the interactive npm publish challenge
66
- - publishes npm
67
63
  - creates a GitHub release with desktop artifacts
64
+ - triggers the protected GitHub Actions workflow that publishes npm through OIDC
68
65
  - updates and pushes the Homebrew tap
69
66
  - `npm run release:publish:npm`
70
- - publishes only the staged npm package
67
+ - manual fallback that publishes only the staged npm package
71
68
 
72
69
  Related packaging commands:
73
70
 
@@ -91,17 +88,16 @@ You need accounts on three services:
91
88
 
92
89
  ### 1. npm
93
90
 
94
- This is required for publishing the standalone package.
91
+ This is required for publishing the standalone package. Routine releases use
92
+ npm trusted publishing from GitHub Actions, so no npm token is stored in the
93
+ repository.
95
94
 
96
95
  - Sign up: [npm signup](https://www.npmjs.com/signup)
97
96
  - Docs: [npm getting started](https://docs.npmjs.com/getting-started)
98
97
 
99
- After creating the account:
100
-
101
- ```bash
102
- npm login
103
- npm whoami
104
- ```
98
+ Configure `@davmash/bygone` with a trusted publisher for the
99
+ `davidmashburn/bygone` repository, the `release.yml` workflow, and the
100
+ `npm-publish` environment.
105
101
 
106
102
  ### 2. GitHub
107
103
 
@@ -165,17 +161,12 @@ This repository should contain the tap structure used by the release script:
165
161
  - `Formula/`
166
162
  - `Casks/`
167
163
 
168
- ### 1. npm authentication
169
-
170
- ```bash
171
- npm whoami
172
- ```
173
-
174
- If that fails:
164
+ ### 1. npm trusted publishing
175
165
 
176
- ```bash
177
- npm login
178
- ```
166
+ The npm package must trust `.github/workflows/release.yml` in
167
+ `davidmashburn/bygone`, scoped to the `npm-publish` environment. The GitHub
168
+ environment should require a reviewer so pushing a tag does not publish by
169
+ itself.
179
170
 
180
171
  ### 2. GitHub authentication
181
172
 
@@ -305,9 +296,11 @@ npm run release:publish
305
296
 
306
297
  This runs the full publish path:
307
298
 
308
- 1. `npm publish dist/npm-package --access public`
309
- 2. `gh release create v<version> ... --notes-file CHANGELOG.md`
310
- 3. update, commit, and push the Homebrew tap
299
+ 1. `gh release create v<version> ... --notes-file CHANGELOG.md`
300
+ 2. the pushed tag starts `.github/workflows/release.yml`
301
+ 3. after environment approval, Actions validates the tag and package metadata,
302
+ runs `npm run release:check`, and publishes `dist/npm-package` through OIDC
303
+ 4. update, commit, and push the Homebrew tap
311
304
 
312
305
  Publish the VS Code extension separately by uploading the already-built
313
306
  `bygone-<version>.vsix` through the Marketplace publisher page.
@@ -344,10 +337,13 @@ The repository-local packaging notes are also in:
344
337
 
345
338
  Check:
346
339
 
347
- - `npm whoami`
348
340
  - `gh auth status`
349
341
  - `echo $BYGONE_HOMEBREW_TAP`
350
342
 
343
+ If the GitHub release succeeds but npm publishing does not, inspect the Release
344
+ workflow and confirm that both the GitHub `npm-publish` environment and npm
345
+ trusted-publisher configuration match `.github/workflows/release.yml`.
346
+
351
347
  ### VS Code publishing is not automated
352
348
 
353
349
  This is currently intentional. `vsce` has merged GitHub OIDC support, but the
@@ -1,5 +1,5 @@
1
- "use strict";(()=>{function S(){}S.prototype={diff:function(e,t){var r,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=o.callback;typeof o=="function"&&(i=o,o={}),this.options=o;var l=this;function a(L){return i?(setTimeout(function(){i(void 0,L)},0),!0):L}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e)),t=this.removeEmpty(this.tokenize(t));var s=t.length,f=e.length,c=1,u=s+f;o.maxEditLength&&(u=Math.min(u,o.maxEditLength));var v=(r=o.timeout)!==null&&r!==void 0?r:1/0,b=Date.now()+v,m=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(m[0],t,e,0);if(m[0].oldPos+1>=f&&p+1>=s)return a([{value:this.join(t),count:t.length}]);var g=-1/0,d=1/0;function h(){for(var L=Math.max(g,-c);L<=Math.min(d,c);L+=2){var x=void 0,y=m[L-1],I=m[L+1];y&&(m[L-1]=void 0);var N=!1;if(I){var V=I.oldPos-L;N=I&&0<=V&&V<s}var K=y&&y.oldPos+1<f;if(!N&&!K){m[L]=void 0;continue}if(!K||N&&y.oldPos+1<I.oldPos?x=l.addToPath(I,!0,void 0,0):x=l.addToPath(y,void 0,!0,1),p=l.extractCommon(x,t,e,L),x.oldPos+1>=f&&p+1>=s)return a(Le(l,x.lastComponent,t,e,l.useLongestToken));m[L]=x,x.oldPos+1>=f&&(d=Math.min(d,L-1)),p+1>=s&&(g=Math.max(g,L+1))}c++}if(i)(function L(){setTimeout(function(){if(c>u||Date.now()>b)return i();h()||L()},0)})();else for(;c<=u&&Date.now()<=b;){var w=h();if(w)return w}},addToPath:function(e,t,r,o){var i=e.lastComponent;return i&&i.added===t&&i.removed===r?{oldPos:e.oldPos+o,lastComponent:{count:i.count+1,added:t,removed:r,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+o,lastComponent:{count:1,added:t,removed:r,previousComponent:i}}},extractCommon:function(e,t,r,o){for(var i=t.length,l=r.length,a=e.oldPos,s=a-o,f=0;s+1<i&&a+1<l&&this.equals(t[s+1],r[a+1]);)s++,a++,f++;return f&&(e.lastComponent={count:f,previousComponent:e.lastComponent}),e.oldPos=a,s},equals:function(e,t){return this.options.comparator?this.options.comparator(e,t):e===t||this.options.ignoreCase&&e.toLowerCase()===t.toLowerCase()},removeEmpty:function(e){for(var t=[],r=0;r<e.length;r++)e[r]&&t.push(e[r]);return t},castInput:function(e){return e},tokenize:function(e){return e.split("")},join:function(e){return e.join("")}};function Le(n,e,t,r,o){for(var i=[],l;e;)i.push(e),l=e.previousComponent,delete e.previousComponent,e=l;i.reverse();for(var a=0,s=i.length,f=0,c=0;a<s;a++){var u=i[a];if(u.removed){if(u.value=n.join(r.slice(c,c+u.count)),c+=u.count,a&&i[a-1].added){var b=i[a-1];i[a-1]=i[a],i[a]=b}}else{if(!u.added&&o){var v=t.slice(f,f+u.count);v=v.map(function(p,g){var d=r[c+g];return d.length>p.length?d:p}),u.value=n.join(v)}else u.value=n.join(t.slice(f,f+u.count));f+=u.count,u.added||(c+=u.count)}}var m=i[s-1];return s>1&&typeof m.value=="string"&&(m.added||m.removed)&&n.equals("",m.value)&&(i[s-2].value+=m.value,i.pop()),i}var xe=new S;function Z(n,e,t){return xe.diff(n,e,t)}var J=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,j=/\S/,U=new S;U.equals=function(n,e){return this.options.ignoreCase&&(n=n.toLowerCase(),e=e.toLowerCase()),n===e||this.options.ignoreWhitespace&&!j.test(n)&&!j.test(e)};U.tokenize=function(n){for(var e=n.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),t=0;t<e.length-1;t++)!e[t+1]&&e[t+2]&&J.test(e[t])&&J.test(e[t+2])&&(e[t]+=e[t+2],e.splice(t+1,2),t--);return e};function Q(n,e,t){return U.diff(n,e,t)}var ee=new S;ee.tokenize=function(n){this.options.stripTrailingCr&&(n=n.replace(/\r\n/g,`
2
- `));var e=[],t=n.split(/(\n|\r\n)/);t[t.length-1]||t.pop();for(var r=0;r<t.length;r++){var o=t[r];r%2&&!this.options.newlineIsToken?e[e.length-1]+=o:(this.options.ignoreWhitespace&&(o=o.trim()),e.push(o))}return e};var ye=new S;ye.tokenize=function(n){return n.split(/(\S.+?[.!?])(?=\s+|$)/)};var Ie=new S;Ie.tokenize=function(n){return n.split(/([{}:;,]|\s+)/)};function _(n){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_=function(e){return typeof e}:_=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_(n)}var Ne=Object.prototype.toString,D=new S;D.useLongestToken=!0;D.tokenize=ee.tokenize;D.castInput=function(n){var e=this.options,t=e.undefinedReplacement,r=e.stringifyReplacer,o=r===void 0?function(i,l){return typeof l>"u"?t:l}:r;return typeof n=="string"?n:JSON.stringify($(n,null,null,o),o," ")};D.equals=function(n,e){return S.prototype.equals.call(D,n.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};function $(n,e,t,r,o){e=e||[],t=t||[],r&&(n=r(o,n));var i;for(i=0;i<e.length;i+=1)if(e[i]===n)return t[i];var l;if(Ne.call(n)==="[object Array]"){for(e.push(n),l=new Array(n.length),t.push(l),i=0;i<n.length;i+=1)l[i]=$(n[i],e,t,r,o);return e.pop(),t.pop(),l}if(n&&n.toJSON&&(n=n.toJSON()),_(n)==="object"&&n!==null){e.push(n),l={},t.push(l);var a=[],s;for(s in n)n.hasOwnProperty(s)&&a.push(s);for(a.sort(),i=0;i<a.length;i+=1)s=a[i],l[s]=$(n[s],e,t,r,s);e.pop(),t.pop()}else l=n;return l}var F=new S;F.tokenize=function(n){return n.slice()};F.join=F.removeEmpty=function(n){return n};function ne(n,e,t){return F.diff(n,e,t)}var Ee=500,Ae=100,te=we("BYGONE_MAX_INLINE_HIGHLIGHT_LINE_LENGTH",Ee),Me=we("BYGONE_DIFF_TIMEOUT_MS",Ae);function ge(n,e,t={}){let r=re(n),o=re(e),i=ne(r,o,{timeout:t.timeoutMs??Me});if(!i)return Re(r,o);let l=[],a=[],s=[],f=[],c=1,u=1;for(let b=0;b<i.length;b++){let m=i[b],p=m.removed?m.value:[],g=m.added?m.value:[];if(!m.added&&!m.removed){for(let d of m.value)a.push(A("context",d,c)),s.push(A("context",d,u)),l.push(T(E("context",d,c++),E("context",d,u++)));continue}if(m.removed&&b+1<i.length&&i[b+1].added){let d=i[b+1],h=a.length,w=s.length,L=ve(p,d.value);for(let{left:x,right:y}of L){let I,N;x!==void 0&&(I=A("removed",x,c),a.push(I)),y!==void 0&&(N=A("added",y,u),s.push(N)),I&&N&&Ve(I,N),l.push(T(x===void 0?R():E("removed",x,c++),y===void 0?R():E("added",y,u++)))}f.push(k("replace",h,a.length,w,s.length)),b++;continue}if(m.removed){let d=a.length,h=s.length;for(let w of p)a.push(A("removed",w,c)),l.push(T(E("removed",w,c++),R()));f.push(k("delete",d,a.length,h,s.length));continue}if(m.added){let d=a.length,h=s.length;for(let w of g)s.push(A("added",w,u)),l.push(T(R(),E("added",w,u++)));f.push(k("insert",d,a.length,h,s.length))}}let v=l.some(b=>b.left.kind!=="context"||b.right.kind!=="context");return{rows:l,leftLines:a,rightLines:s,blocks:f,hasChanges:v}}function Re(n,e){let t=n.map((l,a)=>A("removed",l,a+1)),r=e.map((l,a)=>A("added",l,a+1)),o=[...n.map((l,a)=>T(E("removed",l,a+1),R())),...e.map((l,a)=>T(R(),E("added",l,a+1)))],i="replace";return n.length===0?i="insert":e.length===0&&(i="delete"),{rows:o,leftLines:t,rightLines:r,blocks:o.length===0?[]:[k(i,0,n.length,0,e.length)],hasChanges:o.length>0}}function re(n){if(n.length===0)return[];let e=n.replace(/\r\n/g,`
1
+ "use strict";(()=>{function E(){}E.prototype={diff:function(e,t){var r,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=o.callback;typeof o=="function"&&(i=o,o={}),this.options=o;var l=this;function a(v){return i?(setTimeout(function(){i(void 0,v)},0),!0):v}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e)),t=this.removeEmpty(this.tokenize(t));var c=t.length,f=e.length,s=1,u=c+f;o.maxEditLength&&(u=Math.min(u,o.maxEditLength));var m=(r=o.timeout)!==null&&r!==void 0?r:1/0,L=Date.now()+m,w=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(w[0],t,e,0);if(w[0].oldPos+1>=f&&g+1>=c)return a([{value:this.join(t),count:t.length}]);var d=-1/0,p=1/0;function h(){for(var v=Math.max(d,-s);v<=Math.min(p,s);v+=2){var x=void 0,y=w[v-1],A=w[v+1];y&&(w[v-1]=void 0);var R=!1;if(A){var V=A.oldPos-v;R=A&&0<=V&&V<c}var J=y&&y.oldPos+1<f;if(!R&&!J){w[v]=void 0;continue}if(!J||R&&y.oldPos+1<A.oldPos?x=l.addToPath(A,!0,void 0,0):x=l.addToPath(y,void 0,!0,1),g=l.extractCommon(x,t,e,v),x.oldPos+1>=f&&g+1>=c)return a(Ne(l,x.lastComponent,t,e,l.useLongestToken));w[v]=x,x.oldPos+1>=f&&(p=Math.min(p,v-1)),g+1>=c&&(d=Math.max(d,v+1))}s++}if(i)(function v(){setTimeout(function(){if(s>u||Date.now()>L)return i();h()||v()},0)})();else for(;s<=u&&Date.now()<=L;){var b=h();if(b)return b}},addToPath:function(e,t,r,o){var i=e.lastComponent;return i&&i.added===t&&i.removed===r?{oldPos:e.oldPos+o,lastComponent:{count:i.count+1,added:t,removed:r,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+o,lastComponent:{count:1,added:t,removed:r,previousComponent:i}}},extractCommon:function(e,t,r,o){for(var i=t.length,l=r.length,a=e.oldPos,c=a-o,f=0;c+1<i&&a+1<l&&this.equals(t[c+1],r[a+1]);)c++,a++,f++;return f&&(e.lastComponent={count:f,previousComponent:e.lastComponent}),e.oldPos=a,c},equals:function(e,t){return this.options.comparator?this.options.comparator(e,t):e===t||this.options.ignoreCase&&e.toLowerCase()===t.toLowerCase()},removeEmpty:function(e){for(var t=[],r=0;r<e.length;r++)e[r]&&t.push(e[r]);return t},castInput:function(e){return e},tokenize:function(e){return e.split("")},join:function(e){return e.join("")}};function Ne(n,e,t,r,o){for(var i=[],l;e;)i.push(e),l=e.previousComponent,delete e.previousComponent,e=l;i.reverse();for(var a=0,c=i.length,f=0,s=0;a<c;a++){var u=i[a];if(u.removed){if(u.value=n.join(r.slice(s,s+u.count)),s+=u.count,a&&i[a-1].added){var L=i[a-1];i[a-1]=i[a],i[a]=L}}else{if(!u.added&&o){var m=t.slice(f,f+u.count);m=m.map(function(g,d){var p=r[s+d];return p.length>g.length?p:g}),u.value=n.join(m)}else u.value=n.join(t.slice(f,f+u.count));f+=u.count,u.added||(s+=u.count)}}var w=i[c-1];return c>1&&typeof w.value=="string"&&(w.added||w.removed)&&n.equals("",w.value)&&(i[c-2].value+=w.value,i.pop()),i}var Ie=new E;function Q(n,e,t){return Ie.diff(n,e,t)}var j=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,Z=/\S/,P=new E;P.equals=function(n,e){return this.options.ignoreCase&&(n=n.toLowerCase(),e=e.toLowerCase()),n===e||this.options.ignoreWhitespace&&!Z.test(n)&&!Z.test(e)};P.tokenize=function(n){for(var e=n.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),t=0;t<e.length-1;t++)!e[t+1]&&e[t+2]&&j.test(e[t])&&j.test(e[t+2])&&(e[t]+=e[t+2],e.splice(t+1,2),t--);return e};function ee(n,e,t){return P.diff(n,e,t)}var ne=new E;ne.tokenize=function(n){this.options.stripTrailingCr&&(n=n.replace(/\r\n/g,`
2
+ `));var e=[],t=n.split(/(\n|\r\n)/);t[t.length-1]||t.pop();for(var r=0;r<t.length;r++){var o=t[r];r%2&&!this.options.newlineIsToken?e[e.length-1]+=o:(this.options.ignoreWhitespace&&(o=o.trim()),e.push(o))}return e};var Se=new E;Se.tokenize=function(n){return n.split(/(\S.+?[.!?])(?=\s+|$)/)};var Ee=new E;Ee.tokenize=function(n){return n.split(/([{}:;,]|\s+)/)};function F(n){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?F=function(e){return typeof e}:F=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},F(n)}var Ae=Object.prototype.toString,D=new E;D.useLongestToken=!0;D.tokenize=ne.tokenize;D.castInput=function(n){var e=this.options,t=e.undefinedReplacement,r=e.stringifyReplacer,o=r===void 0?function(i,l){return typeof l>"u"?t:l}:r;return typeof n=="string"?n:JSON.stringify(B(n,null,null,o),o," ")};D.equals=function(n,e){return E.prototype.equals.call(D,n.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};function B(n,e,t,r,o){e=e||[],t=t||[],r&&(n=r(o,n));var i;for(i=0;i<e.length;i+=1)if(e[i]===n)return t[i];var l;if(Ae.call(n)==="[object Array]"){for(e.push(n),l=new Array(n.length),t.push(l),i=0;i<n.length;i+=1)l[i]=B(n[i],e,t,r,o);return e.pop(),t.pop(),l}if(n&&n.toJSON&&(n=n.toJSON()),F(n)==="object"&&n!==null){e.push(n),l={},t.push(l);var a=[],c;for(c in n)n.hasOwnProperty(c)&&a.push(c);for(a.sort(),i=0;i<a.length;i+=1)c=a[i],l[c]=B(n[c],e,t,r,c);e.pop(),t.pop()}else l=n;return l}var H=new E;H.tokenize=function(n){return n.slice()};H.join=H.removeEmpty=function(n){return n};function te(n,e,t){return H.diff(n,e,t)}var Te=500,Re=100,re=ye("BYGONE_MAX_INLINE_HIGHLIGHT_LINE_LENGTH",Te),De=ye("BYGONE_DIFF_TIMEOUT_MS",Re);function me(n,e,t={}){let r=ie(n),o=ie(e);if(n===e)return _e(r);let i=Ce(r,o),l=te(i.left,i.right,{timeout:t.timeoutMs??De});if(!l)return Oe(r,o);let a=l.map(g=>({...g,value:g.value.map(d=>i.lines[d])})),c=[],f=[],s=[],u=[],m=1,L=1;for(let g=0;g<a.length;g++){let d=a[g],p=d.removed?d.value:[],h=d.added?d.value:[];if(!d.added&&!d.removed){for(let b of d.value)f.push(I("context",b,m)),s.push(I("context",b,L)),c.push(M(N("context",b,m++),N("context",b,L++)));continue}if(d.removed&&g+1<a.length&&a[g+1].added){let b=a[g+1],v=Fe(p,b.value,m,L,c,f,s,u);m=v.left,L=v.right,g++;continue}if(d.removed){let b=f.length,v=s.length;for(let x of p)f.push(I("removed",x,m)),c.push(M(N("removed",x,m++),T()));u.push(z("delete",b,f.length,v,s.length));continue}if(d.added){let b=f.length,v=s.length;for(let x of h)s.push(I("added",x,L)),c.push(M(T(),N("added",x,L++)));u.push(z("insert",b,f.length,v,s.length))}}let w=c.some(g=>g.left.kind!=="context"||g.right.kind!=="context");return{rows:c,leftLines:f,rightLines:s,blocks:u,hasChanges:w,quality:"exact"}}function Ce(n,e){let t=new Map,r=[],o=i=>{let l=t.get(i);if(l!==void 0)return l;let a=r.length;return t.set(i,a),r.push(i),a};return{left:n.map(o),right:e.map(o),lines:r}}function _e(n){return{rows:n.map((e,t)=>M(N("context",e,t+1),N("context",e,t+1))),leftLines:n.map((e,t)=>I("context",e,t+1)),rightLines:n.map((e,t)=>I("context",e,t+1)),blocks:[],hasChanges:!1,quality:"exact"}}function Oe(n,e){let t=n.map((l,a)=>I("removed",l,a+1)),r=e.map((l,a)=>I("added",l,a+1)),o=[...n.map((l,a)=>M(N("removed",l,a+1),T())),...e.map((l,a)=>M(T(),N("added",l,a+1)))],i="replace";return n.length===0?i="insert":e.length===0&&(i="delete"),{rows:o,leftLines:t,rightLines:r,blocks:o.length===0?[]:[z(i,0,n.length,0,e.length)],hasChanges:o.length>0,quality:"fallback"}}function ie(n){if(n.length===0)return[];let e=n.replace(/\r\n/g,`
3
3
  `).split(`
4
- `);return e[e.length-1]===""&&e.pop(),e}var pe=1e4,ie=2e3,Te=.52,De=.35,he=.38,Ce=.33,me=.86,G=.08,O=.05,H=-.12,oe=5e3,_e=2e3,se=4,Fe=8,z=4;function ve(n,e){if(n.length===0)return e.map(s=>({right:s}));if(e.length===0)return n.map(s=>({left:s}));if(n.length===1&&e.length===1){let s=Y(n[0],e[0]);return(s.eligible||s.score>=De)&&B(n[0],e[0])&&C(M(n[0]))&&C(M(e[0]))?[{left:n[0],right:e[0]}]:[{left:n[0]},{right:e[0]}]}if(n.length*e.length>pe)return Ge(n,e);let t=Oe(n,e),r=Array.from({length:n.length+1},()=>new Array(e.length+1).fill(Number.NEGATIVE_INFINITY)),o=Array.from({length:n.length+1},()=>new Array(e.length+1).fill(null));r[0][0]=0;for(let s=1;s<=n.length;s++)r[s][0]=r[s-1][0]+H,o[s][0]="left";for(let s=1;s<=e.length;s++)r[0][s]=r[0][s-1]+H,o[0][s]="right";for(let s=1;s<=n.length;s++)for(let f=1;f<=e.length;f++){let c=t[s-1][f-1],v=[{move:"left",score:r[s-1][f]+H},{move:"right",score:r[s][f-1]+H},{move:"match",score:c===null?Number.NEGATIVE_INFINITY:r[s-1][f-1]+c}].reduce((b,m)=>m.score>b.score?m:b);r[s][f]=v.score,o[s][f]=v.move}let i=[],l=n.length,a=e.length;for(;l>0||a>0;){let s=o[l][a];s==="match"?i.push({left:n[--l],right:e[--a]}):s==="left"?i.push({left:n[--l]}):i.push({right:e[--a]})}return i.reverse()}function Y(n,e){let t=M(n),r=M(e),o=C(t),i=C(r);if(!o||!i||t.length>ie||r.length>ie)return{score:0,eligible:!1,characterSimilarity:0,tokenSimilarity:0,lengthSimilarity:0};if(t===r)return{score:1,eligible:!0,characterSimilarity:1,tokenSimilarity:1,lengthSimilarity:1};let l=q(t),a=q(r),s=Ye(t,r),f=Xe(l,a),c=Math.min(t.length,r.length)/Math.max(t.length,r.length),u=qe(l,a),v=s*.52+f*.32+c*.1+u*.06,b=s>=.52||f>=.45||s>=.48&&f>=.28;return{score:v,eligible:b&&v>=Te,characterSimilarity:s,tokenSimilarity:f,lengthSimilarity:c}}function Oe(n,e){let t=n.map(p=>e.map(g=>Y(p,g))),r=be(n,e),o=t.map(p=>P(p)),i=e.map((p,g)=>P(t.map(d=>d[g]))),l=t.map((p,g)=>p.map((d,h)=>{if(r.has(`${g}:${h}`))return Math.max(d.score,1);if(!d.eligible)return null;let w=o[g],L=i[h],x=d.score===w.best&&d.score===L.best,y=d.score>=me?G/2:G,I=w.best-w.second>=y,N=L.best-L.second>=y;return x&&I&&N?d.score:null}));if(Math.max(n.length,e.length)>Fe||Math.abs(n.length-e.length)>z)return l;let a=(p,g,d)=>p.score>=he&&B(n[g],e[d])&&Math.abs(g-d)<=z,s=t.map((p,g)=>W(p,(d,h)=>a(d,g,h))),f=e.map((p,g)=>W(t.map(d=>d[g]),(d,h)=>a(d,h,g))),c=(p,g,d)=>p.score>=Ce&&B(n[g],e[d])&&Math.abs(g-d)<=z,u=t.map((p,g)=>W(p,(d,h)=>c(d,g,h))),v=e.map((p,g)=>W(t.map(d=>d[g]),(d,h)=>c(d,h,g))),b=(p,g)=>{let d=t[p][g];if(!a(d,p,g))return!1;let h=s[p],w=f[g];return d.score===h.best&&d.score===w.best&&h.best-h.second>=O&&w.best-w.second>=O},m=(p,g)=>{let d=t[p][g];if(!c(d,p,g))return!1;let h=u[p],w=v[g];return d.score===h.best&&d.score===w.best&&h.best-h.second>=O&&w.best-w.second>=O};return l.map((p,g)=>p.map((d,h)=>{if(d!==null)return d;let w=b(g,h)&&(He(l,g,h)||We(t,g,h,b)),L=ke(t,g,h,(x,y)=>c(t[x][y],x,y),m);return!w&&!L?null:t[g][h].score}))}function He(n,e,t){return e>0&&t>0&&n[e-1][t-1]!==null||e+1<n.length&&t+1<n[e+1].length&&n[e+1][t+1]!==null}function We(n,e,t,r){return e>0&&t>0&&r(e-1,t-1)||e+1<n.length&&t+1<n[e+1].length&&r(e+1,t+1)}function ke(n,e,t,r,o){let i=e,l=t;for(;i>0&&l>0&&r(i-1,l-1);)i--,l--;let a=e,s=t,f=n[e][t].score,c=1;for(;a+1<n.length&&s+1<n[a+1].length&&r(a+1,s+1);)a++,s++,f+=n[a][s].score,c++;for(let u=e-1,v=t-1;u>=i&&v>=l;u--,v--)f+=n[u][v].score,c++;return c>=3&&f/c>=he&&o(i,l)&&o(a,s)}function W(n,e){let t=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY;return n.forEach((o,i)=>{e(o,i)&&(o.score>t?(r=t,t=o.score):o.score>r&&(r=o.score))}),{best:t,second:r}}function P(n){let e=Number.NEGATIVE_INFINITY,t=Number.NEGATIVE_INFINITY;for(let r of n)r.eligible&&(r.score>e?(t=e,e=r.score):r.score>t&&(t=r.score));return{best:e,second:t}}function Ge(n,e){let t=$e(n,e),r=[],o=0,i=0;for(let l of t)ce(r,n.slice(o,l.leftIndex),e.slice(i,l.rightIndex)),r.push({left:n[l.leftIndex],right:e[l.rightIndex]}),o=l.leftIndex+1,i=l.rightIndex+1;return ce(r,n.slice(o),e.slice(i)),r}function $e(n,e){let t=Ue(n,e);if(t===null)return[];let r=be(n,e),o=t.map(({leftIndex:f,rightIndex:c,exact:u})=>({leftIndex:f,rightIndex:c,exact:u,structural:r.has(`${f}:${c}`),match:Y(n[f],e[c])})).filter(f=>f.exact||f.structural||f.match.eligible),i=ae(o,"leftIndex"),l=ae(o,"rightIndex"),a=o.filter(f=>{if(f.exact||f.structural)return!0;let c=i.get(f.leftIndex),u=l.get(f.rightIndex);if(!c||!u||f.match.score!==c.best||f.match.score!==u.best)return!1;let v=f.match.score>=me?G/2:G;return c.best-c.second>=v&&u.best-u.second>=v}),s=Pe(a,e.length);return s.length<=_e?s:[]}function Ue(n,e){let t=le(n,M),r=le(e,M),o=new Map;for(let[a,s]of t){let f=r.get(a);if(!C(a)||s.length!==1||f?.length!==1)continue;let c=s[0],u=f[0];if(o.set(`${c}:${u}`,{leftIndex:c,rightIndex:u,exact:!0}),o.size>oe)return null}let i=fe(n),l=fe(e);for(let[a,s]of i){let f=l.get(a);if(!(!f||s.length>se||f.length>se))for(let c of s)for(let u of f){let v=`${c}:${u}`;if(!o.has(v)&&(o.set(v,{leftIndex:c,rightIndex:u,exact:!1}),o.size>oe))return null}}return[...o.values()]}function le(n,e){let t=new Map;return n.forEach((r,o)=>{let i=e(r),l=t.get(i)??[];l.push(o),t.set(i,l)}),t}function fe(n){let e=new Map;return n.forEach((t,r)=>{let o=new Set(q(M(t)).filter(ze));for(let i of o){let l=e.get(i)??[];l.push(r),e.set(i,l)}}),e}function ze(n){return n.length>=2&&/[\p{L}\p{N}_$]/u.test(n)}function ae(n,e){let t=new Map;for(let r of n){let o=t.get(r[e])??[];o.push(r.match),t.set(r[e],o)}return new Map([...t].map(([r,o])=>[r,P(o)]))}function Pe(n,e){let t=[...n].sort((f,c)=>f.leftIndex-c.leftIndex||f.rightIndex-c.rightIndex),r=new Array(e+2).fill(0),o=new Array(e+2).fill(-1),i=new Array(t.length).fill(0),l=new Array(t.length).fill(-1);for(let f=0;f<t.length;){let c=f+1;for(;c<t.length&&t[c].leftIndex===t[f].leftIndex;)c++;for(let u=f;u<c;u++){let v=ue(r,o,t[u].rightIndex),b=t[u].exact||t[u].structural?.5:0;i[u]=v.score+t[u].match.score+b,l[u]=v.candidateIndex}for(let u=f;u<c;u++)Be(r,o,t[u].rightIndex+1,i[u],u);f=c}let a=ue(r,o,e+1),s=[];for(let f=a.candidateIndex;f>=0;f=l[f])s.push({leftIndex:t[f].leftIndex,rightIndex:t[f].rightIndex});return s.reverse()}function ue(n,e,t){let r=0,o=-1;for(let i=t;i>0;i-=i&-i)n[i]>r&&(r=n[i],o=e[i]);return{score:r,candidateIndex:o}}function Be(n,e,t,r,o){for(let i=t;i<n.length;i+=i&-i)r>n[i]&&(n[i]=r,e[i]=o)}function ce(n,e,t){if(e.length*t.length<=pe){n.push(...ve(e,t));return}n.push(...e.map(r=>({left:r}))),n.push(...t.map(r=>({right:r})))}function M(n){return n.trim().replace(/\s+/g," ")}function be(n,e){let t=de(n),r=de(e),o=new Set;for(let[i,l]of t){let a=r.get(i);l.length===1&&a?.length===1&&o.add(`${l[0]}:${a[0]}`)}return o}function de(n){let e=new Map;return n.forEach((t,r)=>{let o=X(t);if(!o)return;let i=e.get(o)??[];i.push(r),e.set(o,i)}),e}function B(n,e){let t=X(n),r=X(e);return!t||!r?t===r:t.split(":",1)[0]===r.split(":",1)[0]}function X(n){let e=M(n),t=[["function",/^(?:(?:export|default)\s+)*(?:async\s+)?function\s*\*?\s*([\p{L}_$][\p{L}\p{N}_$]*)\s*\(/u],["function",/^(?:async\s+)?def\s+([\p{L}_][\p{L}\p{N}_]*)\s*\(/u],["function",/^(?:pub(?:\([^)]*\))?\s+)?(?:async\s+)?fn\s+([\p{L}_][\p{L}\p{N}_]*)\s*(?:<[^>]*>)?\s*\(/u],["function",/^func\s+(?:\([^)]*\)\s*)?([\p{L}_][\p{L}\p{N}_]*)\s*\(/u],["class",/^(?:(?:export|default|abstract|public)\s+)*class\s+([\p{L}_$][\p{L}\p{N}_$]*)\b/u]];for(let[r,o]of t){let i=e.match(o);if(i)return`${r}:${i[1]}`}return null}function C(n){return n.length<3?!1:/[\p{L}\p{N}_$]/u.test(n)&&!/^[\s()[\]{};,.:+\-*/=>|&!?'"`]+$/.test(n)}function q(n){return n.toLowerCase().match(/[\p{L}_$][\p{L}\p{N}_$]*|\p{N}+(?:\.\p{N}+)?|[^\s\p{L}\p{N}_$]/gu)??[]}function Xe(n,e){if(n.length+e.length===0)return 1;let t=new Map;n.forEach(o=>t.set(o,(t.get(o)??0)+1));let r=0;for(let o of e){let i=t.get(o)??0;i>0&&(r++,t.set(o,i-1))}return 2*r/(n.length+e.length)}function qe(n,e){if(n.length===0||e.length===0)return 0;let t=n[0]===e[0]?.5:0,r=n[n.length-1]===e[e.length-1]?.5:0;return t+r}function Ye(n,e){let t=n.length+e.length;return t===0?1:2*Z(n,e).filter(o=>!o.added&&!o.removed).reduce((o,i)=>o+i.value.length,0)/t}function Ve(n,e){if(n.content.length>te||e.content.length>te)return;let{leftSegments:t,rightSegments:r,hasInlineChanges:o}=Ke(n.content,e.content);o&&(n.segments=t,e.segments=r)}function Ke(n,e){let t=Q(n,e),r=[],o=[],i=!1;for(let l of t){let a=l.value;if(!l.added&&!l.removed){let f={kind:"context",text:a,emphasis:!1};r.push(f),o.push(f);continue}let s=/[^\s]/.test(a);i=i||s,l.removed&&r.push({kind:"removed",text:a,emphasis:s}),l.added&&o.push({kind:"added",text:a,emphasis:s})}return{leftSegments:r,rightSegments:o,hasInlineChanges:i}}function R(){return{kind:"placeholder",content:"",lineNumber:null}}function E(n,e,t){return{kind:n,content:e,lineNumber:t}}function A(n,e,t){return{kind:n,content:e,lineNumber:t}}function T(n,e){return{left:n,right:e}}function k(n,e,t,r,o){return{kind:n,leftStart:e,leftEnd:t,rightStart:r,rightEnd:o}}function we(n,e){let t=typeof process<"u"?process.env?.[n]:void 0,r=Number.parseInt(t??"",10);return Number.isFinite(r)&&r>0?r:e}self.addEventListener("message",n=>{let{id:e,leftContent:t,rightContent:r}=n.data||{};if(!(typeof e!="number"||typeof t!="string"||typeof r!="string"))try{let o=ge(t,r);self.postMessage({id:e,model:o})}catch(o){self.postMessage({id:e,error:o&&o.message||String(o)})}});})();
4
+ `);return e[e.length-1]===""&&e.pop(),e}function Fe(n,e,t,r,o,i,l,a){let c=xe(n,e),f=c.filter(h=>h.left!==void 0&&h.right!==void 0&&X(h.left,h.right)).length,s=ke(n,e,f),u=c.flatMap(h=>h.left===void 0||h.right===void 0||X(h.left,h.right)?[h]:[{left:h.left},{right:h.right}]),m=t,L=r,w,g=i.length,d=l.length,p=()=>{w&&a.push(z(w,g,i.length,d,l.length))};for(let{left:h,right:b}of u){let v=s||h!==void 0&&b!==void 0?"replace":h!==void 0?"delete":"insert";w!==v&&(p(),w=v,g=i.length,d=l.length);let x,y;h!==void 0&&(x=I("removed",h,m),i.push(x)),b!==void 0&&(y=I("added",b,L),l.push(y)),x&&y?on(x,y):s&&(x&&he(x),y&&he(y)),o.push(M(h===void 0?T():N("removed",h,m++),b===void 0?T():N("added",b,L++)))}return p(),{left:m,right:L}}function X(n,e){if(U(n,e).eligible)return!0;let r=C(n);if(r&&r===C(e))return!0;let o=new Set(O(S(n)).filter(oe));return O(S(e)).some(i=>o.has(i)&&oe(i))}var He=new Set(["and","are","for","from","into","that","the","this","to","with"]);function oe(n){return n.length>=3&&/^[\p{L}\p{N}_$]+$/u.test(n)&&!He.has(n)}function ke(n,e,t){if(t===0)return!1;let r=Math.max(n.length,e.length);if(r<=2||t*2>=r)return!0;let o=[...n,...e].map(We);return o[0]!==null&&o.every(i=>i===o[0])}function We(n){let e=n.trimStart();return/^[-*+]\s+/.test(e)?"bullet":/^\d+[.)]\s+/.test(e)?"ordered":/^>\s+/.test(e)?"quote":null}var be=1e4,se=2e3,Ge=.52,$e=.35,ve=.38,ze=.33,we=.86,$=.08,k=.05,W=-.12,le=5e3,Ue=2e3,Be=5e7,fe=4,Pe=8,q=4;function xe(n,e){if(n.length===0)return e.map(s=>({right:s}));if(e.length===0)return n.map(s=>({left:s}));let t=n.reduce((s,u)=>s+u.length,0),r=e.reduce((s,u)=>s+u.length,0);if(t*r>Be)return[...n.map(s=>({left:s})),...e.map(s=>({right:s}))];if(n.length===1&&e.length===1){let s=U(n[0],e[0]);return(s.eligible||s.score>=$e)&&X(n[0],e[0])&&K(n[0],e[0])&&_(S(n[0]))&&_(S(e[0]))?[{left:n[0],right:e[0]}]:[{left:n[0]},{right:e[0]}]}if(n.length*e.length>be)return Ve(n,e);let o=qe(n,e),i=Array.from({length:n.length+1},()=>new Array(e.length+1).fill(Number.NEGATIVE_INFINITY)),l=Array.from({length:n.length+1},()=>new Array(e.length+1).fill(null));i[0][0]=0;for(let s=1;s<=n.length;s++)i[s][0]=i[s-1][0]+W,l[s][0]="left";for(let s=1;s<=e.length;s++)i[0][s]=i[0][s-1]+W,l[0][s]="right";for(let s=1;s<=n.length;s++)for(let u=1;u<=e.length;u++){let m=o[s-1][u-1],w=[{move:"left",score:i[s-1][u]+W},{move:"right",score:i[s][u-1]+W},{move:"match",score:m===null?Number.NEGATIVE_INFINITY:i[s-1][u-1]+m}].reduce((g,d)=>d.score>g.score?d:g);i[s][u]=w.score,l[s][u]=w.move}let a=[],c=n.length,f=e.length;for(;c>0||f>0;){let s=l[c][f];s==="match"?a.push({left:n[--c],right:e[--f]}):s==="left"?a.push({left:n[--c]}):a.push({right:e[--f]})}return a.reverse()}function U(n,e){let t=S(n),r=S(e),o=_(t),i=_(r);if(!o||!i||t.length>se||r.length>se)return{score:0,eligible:!1,characterSimilarity:0,tokenSimilarity:0,lengthSimilarity:0};if(t===r)return{score:1,eligible:!0,characterSimilarity:1,tokenSimilarity:1,lengthSimilarity:1};let l=O(t),a=O(r),c=rn(t,r),f=nn(l,a),s=Math.min(t.length,r.length)/Math.max(t.length,r.length),u=tn(l,a),m=c*.52+f*.32+s*.1+u*.06,L=c>=.52||f>=.45||c>=.48&&f>=.28;return{score:m,eligible:L&&m>=Ge,characterSimilarity:c,tokenSimilarity:f,lengthSimilarity:s}}function qe(n,e){let t=n.map(g=>e.map(d=>U(g,d))),r=Le(n,e),o=t.map(g=>Y(g)),i=e.map((g,d)=>Y(t.map(p=>p[d]))),l=t.map((g,d)=>g.map((p,h)=>{if(r.has(`${d}:${h}`))return Math.max(p.score,1);if(!p.eligible)return null;let b=o[d],v=i[h],x=p.score===b.best&&p.score===v.best,y=p.score>=we?$/2:$,A=b.best-b.second>=y,R=v.best-v.second>=y;return x&&A&&R?p.score:null}));if(Math.max(n.length,e.length)>Pe||Math.abs(n.length-e.length)>q)return l;let a=(g,d,p)=>g.score>=ve&&K(n[d],e[p])&&Math.abs(d-p)<=q,c=t.map((g,d)=>G(g,(p,h)=>a(p,d,h))),f=e.map((g,d)=>G(t.map(p=>p[d]),(p,h)=>a(p,h,d))),s=(g,d,p)=>g.score>=ze&&K(n[d],e[p])&&Math.abs(d-p)<=q,u=t.map((g,d)=>G(g,(p,h)=>s(p,d,h))),m=e.map((g,d)=>G(t.map(p=>p[d]),(p,h)=>s(p,h,d))),L=(g,d)=>{let p=t[g][d];if(!a(p,g,d))return!1;let h=c[g],b=f[d];return p.score===h.best&&p.score===b.best&&h.best-h.second>=k&&b.best-b.second>=k},w=(g,d)=>{let p=t[g][d];if(!s(p,g,d))return!1;let h=u[g],b=m[d];return p.score===h.best&&p.score===b.best&&h.best-h.second>=k&&b.best-b.second>=k};return l.map((g,d)=>g.map((p,h)=>{if(p!==null)return p;let b=L(d,h)&&(Xe(l,d,h)||Ye(t,d,h,L)),v=Ke(t,d,h,(x,y)=>s(t[x][y],x,y),w);return!b&&!v?null:t[d][h].score}))}function Xe(n,e,t){return e>0&&t>0&&n[e-1][t-1]!==null||e+1<n.length&&t+1<n[e+1].length&&n[e+1][t+1]!==null}function Ye(n,e,t,r){return e>0&&t>0&&r(e-1,t-1)||e+1<n.length&&t+1<n[e+1].length&&r(e+1,t+1)}function Ke(n,e,t,r,o){let i=e,l=t;for(;i>0&&l>0&&r(i-1,l-1);)i--,l--;let a=e,c=t,f=n[e][t].score,s=1;for(;a+1<n.length&&c+1<n[a+1].length&&r(a+1,c+1);)a++,c++,f+=n[a][c].score,s++;for(let u=e-1,m=t-1;u>=i&&m>=l;u--,m--)f+=n[u][m].score,s++;return s>=3&&f/s>=ve&&o(i,l)&&o(a,c)}function G(n,e){let t=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY;return n.forEach((o,i)=>{e(o,i)&&(o.score>t?(r=t,t=o.score):o.score>r&&(r=o.score))}),{best:t,second:r}}function Y(n){let e=Number.NEGATIVE_INFINITY,t=Number.NEGATIVE_INFINITY;for(let r of n)r.eligible&&(r.score>e?(t=e,e=r.score):r.score>t&&(t=r.score));return{best:e,second:t}}function Ve(n,e){let t=Je(n,e),r=[],o=0,i=0;for(let l of t)ge(r,n.slice(o,l.leftIndex),e.slice(i,l.rightIndex)),r.push({left:n[l.leftIndex],right:e[l.rightIndex]}),o=l.leftIndex+1,i=l.rightIndex+1;return ge(r,n.slice(o),e.slice(i)),r}function Je(n,e){let t=je(n,e);if(t===null)return[];let r=Le(n,e),o=t.map(({leftIndex:f,rightIndex:s,exact:u})=>({leftIndex:f,rightIndex:s,exact:u,structural:r.has(`${f}:${s}`),match:U(n[f],e[s])})).filter(f=>f.exact||f.structural||f.match.eligible),i=ce(o,"leftIndex"),l=ce(o,"rightIndex"),a=o.filter(f=>{if(f.exact||f.structural)return!0;let s=i.get(f.leftIndex),u=l.get(f.rightIndex);if(!s||!u||f.match.score!==s.best||f.match.score!==u.best)return!1;let m=f.match.score>=we?$/2:$;return s.best-s.second>=m&&u.best-u.second>=m}),c=Qe(a,e.length);return c.length<=Ue?c:[]}function je(n,e){let t=ae(n,S),r=ae(e,S),o=new Map;for(let[a,c]of t){let f=r.get(a);if(!_(a)||c.length!==1||f?.length!==1)continue;let s=c[0],u=f[0];if(o.set(`${s}:${u}`,{leftIndex:s,rightIndex:u,exact:!0}),o.size>le)return null}let i=ue(n),l=ue(e);for(let[a,c]of i){let f=l.get(a);if(!(!f||c.length>fe||f.length>fe))for(let s of c)for(let u of f){let m=`${s}:${u}`;if(!o.has(m)&&(o.set(m,{leftIndex:s,rightIndex:u,exact:!1}),o.size>le))return null}}return[...o.values()]}function ae(n,e){let t=new Map;return n.forEach((r,o)=>{let i=e(r),l=t.get(i)??[];l.push(o),t.set(i,l)}),t}function ue(n){let e=new Map;return n.forEach((t,r)=>{let o=new Set(O(S(t)).filter(Ze));for(let i of o){let l=e.get(i)??[];l.push(r),e.set(i,l)}}),e}function Ze(n){return n.length>=2&&/[\p{L}\p{N}_$]/u.test(n)}function ce(n,e){let t=new Map;for(let r of n){let o=t.get(r[e])??[];o.push(r.match),t.set(r[e],o)}return new Map([...t].map(([r,o])=>[r,Y(o)]))}function Qe(n,e){let t=[...n].sort((f,s)=>f.leftIndex-s.leftIndex||f.rightIndex-s.rightIndex),r=new Array(e+2).fill(0),o=new Array(e+2).fill(-1),i=new Array(t.length).fill(0),l=new Array(t.length).fill(-1);for(let f=0;f<t.length;){let s=f+1;for(;s<t.length&&t[s].leftIndex===t[f].leftIndex;)s++;for(let u=f;u<s;u++){let m=de(r,o,t[u].rightIndex),L=t[u].exact||t[u].structural?.5:0;i[u]=m.score+t[u].match.score+L,l[u]=m.candidateIndex}for(let u=f;u<s;u++)en(r,o,t[u].rightIndex+1,i[u],u);f=s}let a=de(r,o,e+1),c=[];for(let f=a.candidateIndex;f>=0;f=l[f])c.push({leftIndex:t[f].leftIndex,rightIndex:t[f].rightIndex});return c.reverse()}function de(n,e,t){let r=0,o=-1;for(let i=t;i>0;i-=i&-i)n[i]>r&&(r=n[i],o=e[i]);return{score:r,candidateIndex:o}}function en(n,e,t,r,o){for(let i=t;i<n.length;i+=i&-i)r>n[i]&&(n[i]=r,e[i]=o)}function ge(n,e,t){if(e.length*t.length<=be){n.push(...xe(e,t));return}n.push(...e.map(r=>({left:r}))),n.push(...t.map(r=>({right:r})))}function S(n){return n.trim().replace(/\s+/g," ")}function Le(n,e){let t=pe(n),r=pe(e),o=new Set;for(let[i,l]of t){let a=r.get(i);l.length===1&&a?.length===1&&o.add(`${l[0]}:${a[0]}`)}return o}function pe(n){let e=new Map;return n.forEach((t,r)=>{let o=C(t);if(!o)return;let i=e.get(o)??[];i.push(r),e.set(o,i)}),e}function K(n,e){let t=C(n),r=C(e);return!t||!r?t===r:t.split(":",1)[0]===r.split(":",1)[0]}function C(n){let e=S(n),t=[["function",/^(?:(?:export|default)\s+)*(?:async\s+)?function\s*\*?\s*([\p{L}_$][\p{L}\p{N}_$]*)\s*\(/u],["function",/^(?:async\s+)?def\s+([\p{L}_][\p{L}\p{N}_]*)\s*\(/u],["function",/^(?:pub(?:\([^)]*\))?\s+)?(?:async\s+)?fn\s+([\p{L}_][\p{L}\p{N}_]*)\s*(?:<[^>]*>)?\s*\(/u],["function",/^func\s+(?:\([^)]*\)\s*)?([\p{L}_][\p{L}\p{N}_]*)\s*\(/u],["class",/^(?:(?:export|default|abstract|public)\s+)*class\s+([\p{L}_$][\p{L}\p{N}_$]*)\b/u]];for(let[r,o]of t){let i=e.match(o);if(i)return`${r}:${i[1]}`}return null}function _(n){return n.length<3?!1:/[\p{L}\p{N}_$]/u.test(n)&&!/^[\s()[\]{};,.:+\-*/=>|&!?'"`]+$/.test(n)}function O(n){return n.toLowerCase().match(/[\p{L}_$][\p{L}\p{N}_$]*|\p{N}+(?:\.\p{N}+)?|[^\s\p{L}\p{N}_$]/gu)??[]}function nn(n,e){if(n.length+e.length===0)return 1;let t=new Map;n.forEach(o=>t.set(o,(t.get(o)??0)+1));let r=0;for(let o of e){let i=t.get(o)??0;i>0&&(r++,t.set(o,i-1))}return 2*r/(n.length+e.length)}function tn(n,e){if(n.length===0||e.length===0)return 0;let t=n[0]===e[0]?.5:0,r=n[n.length-1]===e[e.length-1]?.5:0;return t+r}function rn(n,e){let t=n.length+e.length;return t===0?1:2*Q(n,e).filter(o=>!o.added&&!o.removed).reduce((o,i)=>o+i.value.length,0)/t}function on(n,e){if(n.content.length>re||e.content.length>re)return;let{leftSegments:t,rightSegments:r,hasInlineChanges:o}=sn(n.content,e.content);o&&(n.segments=t,e.segments=r)}function he(n){/[^\s]/.test(n.content)&&(n.segments=[{kind:n.kind,text:n.content,emphasis:!0}])}function sn(n,e){let t=ee(n,e),r=[],o=[],i=!1;for(let l of t){let a=l.value;if(!l.added&&!l.removed){let f={kind:"context",text:a,emphasis:!1};r.push(f),o.push(f);continue}let c=/[^\s]/.test(a);i=i||c,l.removed&&r.push({kind:"removed",text:a,emphasis:c}),l.added&&o.push({kind:"added",text:a,emphasis:c})}return{leftSegments:r,rightSegments:o,hasInlineChanges:i}}function T(){return{kind:"placeholder",content:"",lineNumber:null}}function N(n,e,t){return{kind:n,content:e,lineNumber:t}}function I(n,e,t){return{kind:n,content:e,lineNumber:t}}function M(n,e){return{left:n,right:e}}function z(n,e,t,r,o){return{kind:n,leftStart:e,leftEnd:t,rightStart:r,rightEnd:o}}function ye(n,e){let t=typeof process<"u"?process.env?.[n]:void 0,r=Number.parseInt(t??"",10);return Number.isFinite(r)&&r>0?r:e}self.addEventListener("message",n=>{let{id:e,leftContent:t,rightContent:r}=n.data||{};if(!(typeof e!="number"||typeof t!="string"||typeof r!="string"))try{let o=me(t,r);self.postMessage({id:e,model:o})}catch(o){self.postMessage({id:e,error:o&&o.message||String(o)})}});})();
5
5
  //# sourceMappingURL=diff.worker.js.map