@a9n-shoji/rvw 0.15.2 → 0.16.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.
- package/CHANGELOG.md +6 -0
- package/dist/cli.mjs +1 -1
- package/dist/cli.mjs.map +1 -1
- package/dist/parser-worker.mjs.map +1 -1
- package/dist/web/assets/{DocumentViewer-CubG6ZXc.js → DocumentViewer-DTcRUXsG.js} +1 -1
- package/dist/web/assets/{StructureViewer-BtxR3wmn.js → StructureViewer-D_s3cx5O.js} +1 -1
- package/dist/web/assets/{WalkthroughPanel-CAD2bvGC.js → WalkthroughPanel-DDZ63kfX.js} +1 -1
- package/dist/web/assets/{WalkthroughViewer-dGZWbDUK.js → WalkthroughViewer-CSWwv7Wb.js} +1 -1
- package/dist/web/assets/{index-oy42bwjB.js → index-DjdjJ2Js.js} +3 -3
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/skills/rvw/SKILL.md +9 -0
- package/skills/rvw-watch-comments/SKILL.md +48 -17
- package/skills/rvw-watch-comments/scripts/watch-state.mjs +15 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,p as n,r,t as i}from"./MermaidSurface-758VCVqh.js";import{C as a,D as o,F as s,H as c,K as l,L as u,P as d,U as f,V as p,Y as m,_ as h,a as g,b as _,ft as v,g as y,h as b,ht as x,i as S,m as C,mt as w,n as T,o as E,p as D,pt as O,s as k,v as A,x as j,y as M,z as ee}from"./WalkthroughPanel-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,p as n,r,t as i}from"./MermaidSurface-758VCVqh.js";import{C as a,D as o,F as s,H as c,K as l,L as u,P as d,U as f,V as p,Y as m,_ as h,a as g,b as _,ft as v,g as y,h as b,ht as x,i as S,m as C,mt as w,n as T,o as E,p as D,pt as O,s as k,v as A,x as j,y as M,z as ee}from"./WalkthroughPanel-DDZ63kfX.js";import{a as te,c as ne,i as re,l as ie,o as ae,s as oe,t as se,u as N}from"./FileIcon-BrcB1D_2.js";import{t as P}from"./lib-BzGM1lY9.js";import{a as ce,i as F,n as I,o as le,r as ue,s as de}from"./dist-CcIeiJzB.js";import{a as fe,c as pe,i as me,n as he,o as ge,r as _e,s as ve,t as ye}from"./MarkdownTable-NA28H-AY.js";var be=`diffs-container`,xe=/(?=^diff --git)/gm,Se=/(?<=\n)/,Ce=/^(---|\+\+\+)\s+([^\t\r\n]+)/,we=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,Te=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,Ee=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,De=`header-prefix`,Oe=`header-filename-suffix`,ke=`header-metadata`,Ae=`header-custom`,L={dark:`pierre-dark`,light:`pierre-light`},je=`data-theme-css`,Me=`data-unsafe-css`,R=`data-diffs-scrollbar-measure`,Ne=`--diffs-scrollbar-gutter-measured`,Pe=1e5,z={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8};({...z});var Fe=Object.freeze({fromStart:0,fromEnd:0}),Ie={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Le={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},Re=new Set,ze=null;function Be(e){Re.add(e),ze??=requestAnimationFrame(Ve)}function B(e){Re.delete(e)&&Re.size===0&&ze!=null&&(cancelAnimationFrame(ze),ze=null)}function Ve(e){let t=new Set(Re);Re.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}ze=Re.size>0?requestAnimationFrame(Ve):null}function He(e,t,n){if(e===t||e==null||t==null)return e===t;let r=new Set(n),i=Object.keys(e),a=new Set(Object.keys(t));for(let n of i)if(a.delete(n),!r.has(n)&&(!(n in t)||e[n]!==t[n]))return!1;for(let e of Array.from(a))if(!r.has(e))return!1;return!0}function Ue(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function We(e,t){let n=e?.theme??L,r=t?.theme??L,i=Ge(e),a=Ge(t);return Ue(n,r)&&He(e,t,[`theme`,`parseDiffOptions`])&&He(i,a)}function Ge(e){if(e!=null&&`parseDiffOptions`in e)return e.parseDiffOptions}function Ke(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function qe(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var Je=new TextEncoder,Ye=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Xe=/[\uD800-\uDFFF]/,Ze=1024,V=new Uint8Array(Ze);function Qe(){V.length!==Ze&&(V=new Uint8Array(Ze))}function H(e){if(e.length===0)return e;if(Xe.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;V.length<t&&(V=new Uint8Array(t));let{written:n}=Je.encodeInto(e,V);return Ye.decode(V.subarray(0,n))}function U(e,t){return e-(t===0?0:1)}function W(e,t){return U(e,t)+t}var G=4096,$e=.5;function et(e){for(let t of e.hunks){for(let n=0;n<t.hunkContent.length;n++){let r=t.hunkContent[n];if(r.type!==`change`)continue;let i=nt(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}tt(t,e)}}function tt(e,t){let{hunkContent:n}=e;for(let e=1;e<n.length;e++){let r=n[e],i=n[e-1];if(r.type!==`change`||r.additions>0&&r.deletions>0||i.type!==`context`)continue;let a=r.additions>0,o=a?t.additionLines:t.deletionLines,s=a?r.additionLineIndex:r.deletionLineIndex,c=a?r.additions:r.deletions,l=o[s]??``;if(l.trim()!==``)continue;let u=!0;for(let e=1;e<c;e++)if(o[s+e]!==l){u=!1;break}if(!u)continue;let d=0;for(;d<i.lines&&t.additionLines[i.additionLineIndex+i.lines-1-d]===l;)d++;if(d===0||e===1&&d===i.lines)continue;r.additionLineIndex-=d,r.deletionLineIndex-=d;let f=r.additionLineIndex+r.additions,p=r.deletionLineIndex+r.deletions,m=n[e+1];m?.type===`context`?(m.lines+=d,m.additionLineIndex=f,m.deletionLineIndex=p):n.splice(e+1,0,{type:`context`,lines:d,additionLineIndex:f,deletionLineIndex:p}),i.lines-=d,i.lines===0&&(n.splice(e-1,1),e--)}}function nt(e,t){let{deletions:n,additions:r,deletionLineIndex:i,additionLineIndex:a}=t,o=Math.min(n,r),s=Math.abs(r-n);if(o===0||s===0||o*(s+1)>G)return null;let c=[];for(let t=0;t<n;t++)c.push(it(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(it(e.additionLines[a+t]??``));let u=r>n,d=0,f=-1;for(let e=0;e<=s;e++){let t=0;for(let n=0;n<o;n++)t+=at(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*$e:t>f&&(f=t,d=e)}if(d===0)return null;let p=[],m=(e,t,n,r)=>{(e>0||t>0)&&p.push({type:`change`,deletions:e,additions:t,deletionLineIndex:n,additionLineIndex:r})};return u?(m(0,d,i,a),m(o,o,i,a+d),m(0,r-o-d,i+o,a+d+o)):(m(d,0,i,a),m(o,o,i+d,a),m(n-o-d,0,i+d+o,a+o)),p}var rt=/\s+/g;function it(e){return e.replace(rt,``)}function at(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),r=Math.min(e.length,t.length);if(r===0)return 0;let i=0;for(;i<r&&e[i]===t[i];)i++;let a=0;for(;a<r-i&&e[e.length-1-a]===t[t.length-1-a];)a++;return(i+a)/n}function ot(e,t){try{return st(e,t)}finally{Qe()}}function st(e,{cacheKey:t,isGitDiff:n=xe.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=pt(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=lt(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=K(f),m=0,h=0;if(p==null||c==null){if(c!=null){if(a)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}c={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:l,additionLines:!l&&r!=null&&i!=null?ct(i.contents):[],deletionLines:!l&&r!=null&&i!=null?ct(r.contents):[],cacheKey:ht(t)},c.additionLines.length===1&&i?.contents===``&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===``&&(c.deletionLines.length=0);for(let e of s){if(e.startsWith(`diff --git`)){let t=e.trim().match(Te),n=t?.[1]??t?.[2],r=t?.[3]??t?.[4];if(n==null||r==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}c.name=H(r.trim()),n!==r&&(c.prevName=H(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?we:Ce):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=H(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=H(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=H(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=H(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=H(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=H(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?c.type=`rename-pure`:c.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(Ee)??[];t!=null&&(c.prevObjectId=H(t)),n!=null&&(c.newObjectId=H(n)),r!=null&&(c.mode=H(r))}e.startsWith(`rename from `)&&(c.prevName=H(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=H(e.slice(10).trim()))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
|
|
2
2
|
`||s[s.length-1]===`\r`||s[s.length-1]===`\r
|
|
3
3
|
`||s[s.length-1]===``);)s.pop();let{additionStart:v,deletionStart:y}=p;u=l?u:y-1,d=l?d:v-1;let b={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:v,additionLines:m,deletionCount:p.deletionCount,deletionStart:y,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:ht(p.hunkContext),hunkSpecs:H(f),noEOFCRAdditions:!1,noEOFCRDeletions:!1},x=0,S=0;for(let e=1;e<s.length;e++){let t=s[e];if(x>=b.additionCount&&S>=b.deletionCount&&!t.startsWith(`\\`)){if(a&&ut(t)&&!dt(t))throw Error(`parsePatchContent: hunk has more lines than expected`);break}let n=t[0];if(n!==`+`&&n!==`-`&&n!==` `&&n!==`\\`){if(a)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${n}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let r=gt(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=_t(t);(g==null||g.type!==`change`)&&(g=vt(`change`,u,d),b.hunkContent.push(g)),d++,x++,l&&c.additionLines.push(e),g.additions++,m++,_=`addition`}else if(r===`deletion`){if(a&&S>=b.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=_t(t);(g==null||g.type!==`change`)&&(g=vt(`change`,u,d),b.hunkContent.push(g)),u++,S++,l&&c.deletionLines.push(e),g.deletions++,h++,_=`deletion`}else if(r===`context`){if(a&&(S>=b.deletionCount||x>=b.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=_t(t);(g==null||g.type!==`context`)&&(g=vt(`context`,u,d),b.hunkContent.push(g)),d++,u++,x++,S++,l&&(c.deletionLines.push(e),c.additionLines.push(e)),g.lines++,_=`context`}else if(r===`metadata`&&g!=null){if(g.type===`context`?(b.noEOFCRAdditions=!0,b.noEOFCRDeletions=!0):_===`deletion`?b.noEOFCRDeletions=!0:_===`addition`&&(b.noEOFCRAdditions=!0),l&&(_===`addition`||_===`context`)){let e=c.additionLines.length-1;e>=0&&(c.additionLines[e]=qe(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=qe(c.deletionLines[e]))}}}if(a&&(x!==b.additionCount||S!==b.deletionCount))throw Error(`parsePatchContent: hunk line count mismatch`);b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(U(b.additionStart,b.additionCount)-o,0),c.hunks.push(b),o=W(b.additionStart,b.additionCount);for(let e of b.hunkContent)e.type===`context`?(b.splitLineCount+=e.lines,b.unifiedLineCount+=e.lines):(b.splitLineCount+=Math.max(e.additions,e.deletions),b.unifiedLineCount+=e.deletions+e.additions);b.splitLineStart=c.splitLineCount+b.collapsedBefore,b.unifiedLineStart=c.unifiedLineCount+b.collapsedBefore,c.splitLineCount+=b.collapsedBefore+b.splitLineCount,c.unifiedLineCount+=b.collapsedBefore+b.unifiedLineCount}if(c!=null){if(a&&l&&!n&&c.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(c.hunks.length>0&&!l&&c.additionLines.length>0&&c.deletionLines.length>0){let e=c.hunks[c.hunks.length-1],t=W(e.additionStart,e.additionCount),n=c.additionLines.length,r=Math.max(n-t,0);c.splitLineCount+=r,c.unifiedLineCount+=r}return n||(c.prevName!=null&&c.name!==c.prevName?c.hunks.length>0?c.type=`rename-changed`:c.type=`rename-pure`:(r==null||r.contents===``)&&i!=null&&i.contents!==``?c.type=`new`:r!=null&&r.contents!==``&&(i==null||i.contents===``)&&(c.type=`deleted`)),c.type!==`rename-pure`&&c.type!==`rename-changed`&&(c.prevName=void 0),et(c),c}}function ct(e){let t=lt(e);for(let e=0;e<t.length;e++)t[e]=H(t[e]);return t}function lt(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
|
|
4
4
|
`,n);if(r===-1)break;t.push(e.slice(n,r+1)),n=r+1}return n<e.length&&t.push(e.slice(n)),t}function ut(e){let t=e[0];return t===`+`||t===`-`||t===` `}function dt(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{a as t,l as n,t as r,u as i}from"./FileIcon-BrcB1D_2.js";import{C as a,D as o,E as s,S as c,T as l,_ as u,a as d,b as f,c as p,d as m,f as h,g,h as _,i as v,l as y,m as b,n as x,o as ee,p as te,r as S,s as ne,t as C,u as re,v as ie,w,x as ae,y as oe}from"./index-oy42bwjB.js";var T=e(i(),1),se=210,ce=136,le=64,ue=11,de=2,fe=300,pe=180,me=26,E=5,D=5,he=[fe,240,180,144],O=[`below-left`,`above-left`,`below-right`,`above-right`],ge=5,k=20,_e=72,A=12,ve=6,ye=36,be=4096,xe=32768,Se=22,j=24,Ce=12,M=8,we=12,Te=3,Ee=32,De=3,Oe=64,ke=128,Ae=[1,2];Ae.length;var je=Array.from({length:22},(e,t)=>.08+t*.04).sort((e,t)=>Math.abs(e-.5)-Math.abs(t-.5)),Me=[0,14,-14,28,-28,44,-44,64,-64,88,-88,116,-116,152,-152,196,-196,248,-248];function N(e,t){return e===t?0:e<t?-1:1}function Ne(e){let t=[...new Set(e)],n=new Map(t.map(e=>[e,e.split(`/`)]));return new Map(t.map(e=>{let r=n.get(e);for(let i=1;i<=r.length;i+=1){let a=r.slice(-i).join(`/`);if(t.every(t=>t===e||n.get(t).slice(-i).join(`/`)!==a))return[e,a]}return[e,e]}))}function Pe(e,t){let n=e.anchors.flatMap(e=>{let n=t.get(e.path);return n?[n]:[]}),r=[...new Set(n)].sort(N);return{anchorCount:e.anchors.length,changeKind:r.length>1?`mixed`:r.length===1?r[0]:null}}var Fe=12,Ie=56,Le=28,P=22;function Re(e){return Array.from({length:49},(t,n)=>{let r=n/48,i=1-r;return{x:i**3*e.start.x+3*i**2*r*e.control1.x+3*i*r**2*e.control2.x+r**3*e.end.x,y:i**3*e.start.y+3*i**2*r*e.control1.y+3*i*r**2*e.control2.y+r**3*e.end.y}})}function F(e){return{left:Math.min(...e.map(({x:e})=>e)),top:Math.min(...e.map(({y:e})=>e)),right:Math.max(...e.map(({x:e})=>e)),bottom:Math.max(...e.map(({y:e})=>e))}}function ze(e){let t=e.at(-1),n=[...e].reverse().slice(1).find(e=>e.x!==t.x||e.y!==t.y),r=t.x-n.x,i=t.y-n.y,a=Math.hypot(r,i),o={x:r/a,y:i/a},s=Math.min(12,a),c={x:t.x-o.x*s,y:t.y-o.y*s};return{base:c,path:`M ${c.x} ${c.y} L ${t.x} ${t.y}`,tangent:o}}function Be(e,t){let n=ze(e.points);return{...e,strokePath:t,arrowPath:n.path,arrowBaseX:n.base.x,arrowBaseY:n.base.y,arrowTangentX:n.tangent.x,arrowTangentY:n.tangent.y}}function Ve(e){let t=Re(e);return{path:`M ${e.start.x} ${e.start.y} C ${e.control1.x} ${e.control1.y}, ${e.control2.x} ${e.control2.y}, ${e.end.x} ${e.end.y}`,points:t,startX:e.start.x,startY:e.start.y,control1X:e.control1.x,control1Y:e.control1.y,control2X:e.control2.x,control2Y:e.control2.y,endX:e.end.x,endY:e.end.y,bounds:F([...t,e.control1,e.control2])}}function He(e){let t=Ve(e),n=Ue([e.boundaryStart,...t.points,e.boundaryEnd]),r={...t,path:`M ${e.boundaryStart.x} ${e.boundaryStart.y} L ${e.start.x} ${e.start.y} C ${e.control1.x} ${e.control1.y}, ${e.control2.x} ${e.control2.y}, ${e.end.x} ${e.end.y} L ${e.boundaryEnd.x} ${e.boundaryEnd.y}`,points:n,startX:e.boundaryStart.x,startY:e.boundaryStart.y,endX:e.boundaryEnd.x,endY:e.boundaryEnd.y,bounds:F([...n,e.control1,e.control2])},i=ze(n);return Be(r,`M ${e.boundaryStart.x} ${e.boundaryStart.y} L ${e.start.x} ${e.start.y} C ${e.control1.x} ${e.control1.y}, ${e.control2.x} ${e.control2.y}, ${e.end.x} ${e.end.y} L ${i.base.x} ${i.base.y}`)}function Ue(e){let t=[];for(let n of e){let e=t.at(-1);if(e&&e.x===n.x&&e.y===n.y)continue;let r=t.at(-2);r&&e&&(r.x===e.x&&e.x===n.x||r.y===e.y&&e.y===n.y)?t[t.length-1]=n:t.push(n)}return t}function We(e){let t=Ue(e),n=t[0],r=t.at(-1);if(!n||!r||t.length<2)return null;let i=e=>{let t=e[0],n=e.slice(1).map((t,n)=>{let r=e[n];return`C ${r.x+(t.x-r.x)/3} ${r.y+(t.y-r.y)/3}, ${r.x+(t.x-r.x)*2/3} ${r.y+(t.y-r.y)*2/3}, ${t.x} ${t.y}`});return`M ${t.x} ${t.y} ${n.join(` `)}`},a=t[1],o=t.at(-2),s={path:i(t),points:t,startX:n.x,startY:n.y,control1X:n.x+(a.x-n.x)/3,control1Y:n.y+(a.y-n.y)/3,control2X:o.x+(r.x-o.x)*2/3,control2Y:o.y+(r.y-o.y)*2/3,endX:r.x,endY:r.y,bounds:F(t)},c=ze(t);return Be(s,i(Ue([...t.slice(0,-1),c.base])))}function I(e,t,n,r,i,a){let o=t[e.from],s=t[e.to];if(!o||!s||e.from===e.to)return null;let c={x:o.x+114,y:o.y+56},l={x:s.x+114,y:s.y+56},u=z(c,l),d=z(l,c),f=Xe(Ke(o,0),i?.from??n,P,a?.get(e.from)).find(({side:e})=>e===u),p=Xe(Ke(s,0),i?.to??n,P,a?.get(e.to)).find(({side:e})=>e===d),m=p.point.x-f.point.x,h=p.point.y-f.point.y,g=Math.max(1,Math.hypot(m,h)),_=m/g,v=-(h/g),y=_,b=f.point,x=p.point,ee=n*(r?5.5:4),te={x:b.x+(x.x-b.x)/3+v*ee,y:b.y+(x.y-b.y)/3+y*ee},S={x:b.x+(x.x-b.x)*2/3+v*ee,y:b.y+(x.y-b.y)*2/3+y*ee};return He({boundaryStart:f.boundaryPoint,start:b,control1:te,control2:S,end:x,boundaryEnd:p.boundaryPoint})}function Ge(e){let t=new Set(e.filter(e=>e.directed&&e.from!==e.to).map(e=>JSON.stringify([e.from,e.to])));return new Set(e.filter(e=>e.directed&&e.from!==e.to&&t.has(JSON.stringify([e.to,e.from]))).map(e=>e.id))}function Ke(e,t=Fe){return{left:e.x-t,top:e.y-t,right:e.x+228+t,bottom:e.y+112+t}}function L(e,t){return e.x>t.left&&e.x<t.right&&e.y>t.top&&e.y<t.bottom}function qe(e,t,n){if(e.y===t.y){let r=Math.min(e.x,t.x),i=Math.max(e.x,t.x);return n.some(t=>e.y>t.top&&e.y<t.bottom&&r<t.right&&i>t.left)}if(e.x===t.x){let r=Math.min(e.y,t.y),i=Math.max(e.y,t.y);return n.some(t=>e.x>t.left&&e.x<t.right&&r<t.bottom&&i>t.top)}return!0}function Je(e,t,n){let r=t.x-e.x,i=t.y-e.y,a=0,o=1;for(let[t,s,c,l]of[[e.x,r,n.left,n.right],[e.y,i,n.top,n.bottom]]){if(Math.abs(s)<1e-6){if(t<c||t>l)return!1;continue}let e=(c-t)/s,n=(l-t)/s;if(a=Math.max(a,Math.min(e,n)),o=Math.min(o,Math.max(e,n)),a>o)return!1}return o>=0&&a<=1}function Ye(e,t){return e.slice(1).some((n,r)=>t.some(t=>Je(e[r],n,t)))}function Xe(e,t,n,r=`plain`){let i=(e.left+e.right)/2,a=(e.top+e.bottom)/2,o=e=>typeof t==`number`?t:t[e],s=t=>Math.max(-(e.right-e.left)/2+16,Math.min((e.right-e.left)/2-16,o(t))),c=t=>Math.max(-(e.bottom-e.top)/2+16,Math.min((e.bottom-e.top)/2-16,o(t)));return[{boundaryPoint:{x:e.left,y:a+c(`left`)},side:`left`},{boundaryPoint:{x:e.right,y:a+c(`right`)},side:`right`},{boundaryPoint:{x:i+s(`top`),y:e.top},side:`top`},{boundaryPoint:{x:i+s(`bottom`),y:e.bottom},side:`bottom`}].map(({boundaryPoint:t,side:i})=>{let a=R(e,i,t,r);return{point:(()=>{switch(i){case`left`:return{x:e.left-n,y:a.y};case`right`:return{x:e.right+n,y:a.y};case`top`:return{x:a.x,y:e.top-n};case`bottom`:return{x:a.x,y:e.bottom+n}}})(),boundaryPoint:a,side:i}})}function Ze(e,t,n,r,i){let a=(e.left+e.right)/2,o=(e.top+e.bottom)/2,s=(e.right-e.left)/2,c=(e.bottom-e.top)/2,l=Math.max(0,s-r),u=Math.max(0,c-i);if(t===`top`||t===`bottom`){let o=n.x-a;if(Math.abs(o)<=l)return n;let s=a+Math.sign(o||1)*l,c=Math.max(-1,Math.min(1,(n.x-s)/r)),u=i*(1-Math.sqrt(Math.max(0,1-c**2)));return{x:n.x,y:t===`top`?e.top+u:e.bottom-u}}let d=n.y-o;if(Math.abs(d)<=u)return n;let f=o+Math.sign(d||1)*u,p=Math.max(-1,Math.min(1,(n.y-f)/i)),m=r*(1-Math.sqrt(Math.max(0,1-p**2)));return{x:t===`left`?e.left+m:e.right-m,y:n.y}}function Qe(e,t,n){let r=e.right-e.left,i=e.bottom-e.top,a=(e.left+e.right)/2,o=(e.top+e.bottom)/2,s=r*.09;if(t===`left`||t===`right`){let r=s*Math.min(1,Math.abs(n.y-o)/(i/2));return{x:t===`left`?e.left+r:e.right-r,y:n.y}}let c=r/2-s,l=n.x-a;if(Math.abs(l)<=c)return n;let u=(Math.abs(l)-c)/s*(i/2);return{x:n.x,y:t===`top`?e.top+u:e.bottom-u}}function R(e,t,n,r){if(r===`external`)return Qe(e,t,n);if(r===`concept`){let r=Math.min((e.right-e.left)/2,(e.bottom-e.top)/2);return Ze(e,t,n,r,r)}return r===`database`?Ze(e,t,n,(e.right-e.left)/2,(e.bottom-e.top)*.14):n}function $e(e,t){if(e<=1)return[0];let n=Math.max(1,t/2-16),r=n*2/(e-1);return Array.from({length:e},(e,t)=>-n+t*r)}function et(e,t){let n=new Map;for(let r of e){if(r.from===r.to)continue;let e=t[r.from],i=t[r.to];if(!e||!i)continue;let a={x:e.x+114,y:e.y+56},o={x:i.x+114,y:i.y+56},s=[{edge:r,end:`from`,nodeId:r.from,otherNodeId:r.to,otherCenter:o},{edge:r,end:`to`,nodeId:r.to,otherNodeId:r.from,otherCenter:a}];for(let e of s){let t=n.get(e.nodeId)??[];t.push(e),n.set(e.nodeId,t)}}let r=new Map,i=()=>({left:0,right:0,top:0,bottom:0}),a=e=>(t,n)=>(e===`left`||e===`right`?t.otherCenter.y:t.otherCenter.x)-(e===`left`||e===`right`?n.otherCenter.y:n.otherCenter.x)||N(t.otherNodeId,n.otherNodeId)||N(t.edge.id,n.edge.id)||N(t.end,n.end);for(let e of n.values())for(let t of[`left`,`right`,`top`,`bottom`]){let n=[...e].sort(a(t)),o=t===`left`||t===`right`?112:228,s=$e(n.length,o);n.forEach((e,n)=>{let a=r.get(e.edge.id)??{from:i(),to:i()};a[e.end][t]=s[n],r.set(e.edge.id,a)})}return r}function z(e,t){let n=t.x-e.x,r=t.y-e.y;return Math.abs(n)>=Math.abs(r)?n>=0?`right`:`left`:r>=0?`bottom`:`top`}function B(e,t){return e===t?0:e===`left`&&t===`right`||e===`right`&&t===`left`||e===`top`&&t===`bottom`||e===`bottom`&&t===`top`?72:24}function V(e){return`${e.x}:${e.y}`}function H(e,t){return e.cost-t.cost||N(e.stateKey,t.stateKey)}function tt(e,t){e.push(t);for(let t=e.length-1;t>0;){let n=Math.floor((t-1)/2);if(H(e[n],e[t])<=0)break;[e[n],e[t]]=[e[t],e[n]],t=n}}function U(e){let t=e[0],n=e.pop();if(!t||!n||e.length===0)return t;e[0]=n;for(let t=0;t<e.length;){let n=t*2+1,r=n+1,i=t;if(n<e.length&&H(e[n],e[i])<0&&(i=n),r<e.length&&H(e[r],e[i])<0&&(i=r),i===t)break;[e[t],e[i]]=[e[i],e[t]],t=i}return t}function W(e){let t=wt([...e.obstacles,...e.sources.map(({point:e})=>({left:e.x,top:e.y,right:e.x,bottom:e.y})),...e.targets.map(({point:e})=>({left:e.x,top:e.y,right:e.x,bottom:e.y}))]);if(!t)return null;let n=null;for(let r of e.sources)for(let i of e.targets){let a=e.channelOffset===0?[[r.point,{x:i.point.x,y:r.point.y},i.point],[r.point,{x:r.point.x,y:i.point.y},i.point]]:[t.left-Ie-e.channelOffset,t.right+Ie+e.channelOffset].map(e=>[r.point,{x:e,y:r.point.y},{x:e,y:i.point.y},i.point]).concat([t.top-Ie-e.channelOffset,t.bottom+Ie+e.channelOffset].map(e=>[r.point,{x:r.point.x,y:e},{x:i.point.x,y:e},i.point]));for(let t of a){let a=Ue(t);if(a.length<2||a.slice(1).some((t,n)=>qe(a[n],t,e.obstacles)))continue;let o=a.slice(1).reduce((e,t,n)=>{let r=a[n];return e+Math.abs(t.x-r.x)+Math.abs(t.y-r.y)},0),s=r.penalty+i.penalty+o+Math.max(0,a.length-2)*Le,c=a.map(V).join(`|`);(n===null||s<n.cost||s===n.cost&&N(c,n.key)<0)&&(n={cost:s,key:c,points:a})}}return n?.points??null}function nt(e){if(e.sources.length===0||e.targets.length===0)return null;if(e.obstacles.length>=64){let t=W({...e,channelOffset:Math.max(0,e.channelOffset??0)});if(t)return t}let t=[...e.sources,...e.targets],n=wt([...e.obstacles,...t.map(({point:e})=>({left:e.x,top:e.y,right:e.x,bottom:e.y}))]);if(!n)return null;let r=Math.max(0,e.channelOffset??0),i=[n.left-Ie-r,n.right+Ie+r,...e.obstacles.flatMap(e=>[e.left-r,e.right+r]),...t.map(({point:e})=>e.x)].sort((e,t)=>e-t),a=[n.top-Ie-r,n.bottom+Ie+r,...e.obstacles.flatMap(e=>[e.top-r,e.bottom+r]),...t.map(({point:e})=>e.y)].sort((e,t)=>e-t),o=[...new Set(i)],s=[...new Set(a)],c=new Map;for(let t of s)for(let n of o){let r={x:n,y:t};e.obstacles.some(e=>L(r,e))||c.set(V(r),r)}let l=new Map([...c.keys()].map(e=>[e,new Set])),u=(t,n)=>{if(qe(t,n,e.obstacles))return;let r=V(t),i=V(n);l.get(r)?.add(i),l.get(i)?.add(r)};for(let e of s){let t=null;for(let n of o){let r=c.get(V({x:n,y:e}));r&&(t&&u(t,r),t=r)}}for(let e of o){let t=null;for(let n of s){let r=c.get(V({x:e,y:n}));r&&(t&&u(t,r),t=r)}}let d=new Map;for(let{point:t,penalty:n}of e.targets){let e=V(t);d.set(e,Math.min(n,d.get(e)??1/0))}let f=[],p=new Map,m=new Map;for(let{point:t,penalty:n}of e.sources){let e=V(t);if(!c.has(e))continue;let r=`${e}|start`,i=n;i>=(p.get(r)??1/0)||(p.set(r,i),m.set(r,null),tt(f,{stateKey:r,vertexKey:e,direction:`start`,cost:i}))}let h=null,g=1/0;for(;f.length>0;){let e=U(f);if(e.cost!==p.get(e.stateKey))continue;if(e.cost>g)break;let t=d.get(e.vertexKey);if(t!==void 0){let n=e.cost+t;(n<g||n===g&&(!h||N(e.stateKey,h.stateKey)<0))&&(h=e,g=n)}let n=c.get(e.vertexKey);for(let t of[...l.get(e.vertexKey)??[]].sort(N)){let r=c.get(t),i=n.x===r.x?`vertical`:`horizontal`,a=Math.abs(n.x-r.x)+Math.abs(n.y-r.y),o=e.direction===`start`||e.direction===i?0:Le,s=e.cost+a+o,l=`${t}|${i}`;s>=(p.get(l)??1/0)||(p.set(l,s),m.set(l,e.stateKey),tt(f,{stateKey:l,vertexKey:t,direction:i,cost:s}))}}if(!h)return null;let _=[];for(let e=h.stateKey;e!==null;){let t=e.lastIndexOf(`|`),n=e.slice(0,t);_.push(c.get(n)),e=m.get(e)??null}return Ue(_.reverse())}function rt(e){let t=z(e.from,e.to),n=z(e.to,e.from),r=Fe,i=P,a=Xe(e.fromBox,e.portOffsets.from,r,e.fromNotation),o=Xe(e.toBox,e.portOffsets.to,i,e.toNotation),s=nt({sources:a.map(({point:e,side:n})=>({point:e,penalty:B(n,t)})),targets:o.map(({point:e,side:t})=>({point:e,penalty:B(t,n)})),obstacles:e.obstacles,...e.channelOffset===void 0?{}:{channelOffset:e.channelOffset}});if(!s)return null;let c=s[0],l=s.at(-1),u=a.find(({point:e})=>V(e)===V(c)),d=o.find(({point:e})=>V(e)===V(l));return!u||!d?null:Ue([u.boundaryPoint,...s,d.boundaryPoint])}function G(e){return e.points.slice(1).flatMap((t,n)=>{let r=e.points[n];return r.y===t.y&&r.x!==t.x?[{orientation:`horizontal`,fixed:t.y,minimum:Math.min(r.x,t.x),maximum:Math.max(r.x,t.x)}]:r.x===t.x&&r.y!==t.y?[{orientation:`vertical`,fixed:t.x,minimum:Math.min(r.y,t.y),maximum:Math.max(r.y,t.y)}]:[]})}function it(e,t){return G(e).some(e=>G(t).some(t=>e.orientation!==t.orientation||Math.abs(e.fixed-t.fixed)>4?!1:Math.min(e.maximum,t.maximum)-Math.max(e.minimum,t.minimum)>=48))}function at(e,t){let n=new Map(e.map(e=>[e,new Set]));for(let r=0;r<e.length;r+=1){let i=e[r],a=t.get(i);if(a)for(let o=r+1;o<e.length;o+=1){let r=e[o],s=t.get(r);s&&it(a,s)&&(n.get(i).add(r),n.get(r).add(i))}}let r=[],i=new Set;for(let t of e){if(i.has(t)||n.get(t)?.size===0)continue;let e=[],a=[t];i.add(t);for(let t=0;t<a.length;t+=1){let r=a[t];e.push(r);for(let e of[...n.get(r)??[]].sort(N))i.has(e)||(i.add(e),a.push(e))}r.push(e.sort(N))}return r}function ot(e){let{point:t,notation:n,laneOffset:r,obstacles:i}=e,a=t.x,o=t.x+228,s=t.y,c=t.y+112,l=r*.55,u=e=>Math.max(a+16,Math.min(o-16,e)),d=e=>Math.max(s+16,Math.min(c-16,e));for(let e=0;e<12;e+=1){let t=88+Math.abs(r)*2+e*72,f={left:a,right:o,top:s,bottom:c},p=R(f,`right`,{x:o,y:d(s+32+l)},n),m=R(f,`right`,{x:o,y:d(c-32+l)},n),h=R(f,`left`,{x:a,y:d(c-32-l)},n),g=R(f,`left`,{x:a,y:d(s+32-l)},n),_=R(f,`top`,{x:u(a+48+l),y:s},n),v=R(f,`top`,{x:u(o-48+l),y:s},n),y=R(f,`bottom`,{x:u(o-48-l),y:c},n),b=R(f,`bottom`,{x:u(a+48-l),y:c},n),x=[He({boundaryStart:p,start:{x:o+P,y:p.y},control1:{x:o+t,y:s-64+l},control2:{x:o+t,y:c+64+l},end:{x:o+P,y:m.y},boundaryEnd:m}),He({boundaryStart:h,start:{x:a-P,y:h.y},control1:{x:a-t,y:c+64-l},control2:{x:a-t,y:s-64-l},end:{x:a-P,y:g.y},boundaryEnd:g}),He({boundaryStart:_,start:{x:_.x,y:s-P},control1:{x:a-72+l,y:s-t},control2:{x:o+72+l,y:s-t},end:{x:v.x,y:s-P},boundaryEnd:v}),He({boundaryStart:y,start:{x:y.x,y:c+P},control1:{x:o+72-l,y:c+t},control2:{x:a-72-l,y:c+t},end:{x:b.x,y:c+P},boundaryEnd:b})].find(e=>!Ye(e.points,i));if(x)return x}return null}function st(e,t,n){let r=a(e),i=et(e,n),o=new Map(t.map(e=>[e.id,e.notation])),s=Ge(e),c=new Map(t.flatMap(e=>{let t=n[e.id];return t?[[e.id,Ke(t,0)]]:[]})),l=new Map(t.flatMap(e=>{let t=n[e.id];return t?[[e.id,Ke(t)]]:[]})),u=new Map,d=[],f=[...e].sort((e,t)=>N(e.id,t.id)),p=(e,t=0)=>{let r=n[e.from],a=n[e.to],s=c.get(e.from),u=c.get(e.to);if(!r||!a||!s||!u)return null;let d=[...l].filter(([t])=>{if(t===e.from||t===e.to)return!0;let n=c.get(t);return!n||!lt(n,s)&&!lt(n,u)}).map(([,e])=>e),f=rt({from:{x:r.x+114,y:r.y+56},to:{x:a.x+114,y:a.y+56},fromBox:s,toBox:u,obstacles:d,portOffsets:i.get(e.id)??{from:{left:0,right:0,top:0,bottom:0},to:{left:0,right:0,top:0,bottom:0}},fromNotation:o.get(e.from)??`plain`,toNotation:o.get(e.to)??`plain`,channelOffset:t});return f?We(f):null};for(let e of f){let t=n[e.from],a=n[e.to];if(!t||!a)continue;let f=[...l].filter(([t])=>{if(t===e.from||t===e.to)return!1;let n=c.get(t),r=c.get(e.from),i=c.get(e.to);return n&&r&&i?!lt(n,r)&&!lt(n,i):!0}).map(([,e])=>e),m=r.get(e.id)??0;if(e.from===e.to){let n=ot({point:t,notation:o.get(e.from)??`plain`,laneOffset:m,obstacles:f});n&&u.set(e.id,n);continue}let h=I(e,n,m,s.has(e.id),i.get(e.id),o);if(h&&!lt(l.get(e.from),l.get(e.to))&&!Ye(h.points,f)){u.set(e.id,h);continue}let g=p(e);g&&u.set(e.id,g),d.push(e.id)}let m=new Map([...d].sort(N).map((e,t)=>[e,t])),h=new Map(f.map(e=>[e.id,e]));for(let e=0;e<Math.min(8,d.length);e+=1){let e=at(d,u);if(e.length===0)break;for(let t of e)t.forEach(e=>{let t=h.get(e),n=m.get(e),r=p(t,(n+1)*8);r&&u.set(e,r)})}return u}function ct(e,t,n){let r=e.points.slice(1).map((t,n)=>{let r=e.points[n];return{previous:r,point:t,length:Math.hypot(t.x-r.x,t.y-r.y)}}),i=r.reduce((e,t)=>e+t.length,0)*t,a=r.find(e=>i<=e.length||(i-=e.length,!1))??r.at(-1);if(!a){let r={x:e.startX,y:e.startY};return{point:r,routePoint:r,tangent:{x:1,y:0},fraction:t,normalOffset:n}}let o=a.length===0?0:Math.min(1,i/a.length),s=a.previous.x+(a.point.x-a.previous.x)*o,c=a.previous.y+(a.point.y-a.previous.y)*o,l=a.point.x-a.previous.x,u=a.point.y-a.previous.y,d=Math.max(1,Math.hypot(l,u)),f={x:l/d,y:u/d},p={x:s,y:c};return{point:{x:s+-f.y*n,y:c+f.x*n},routePoint:p,tangent:f,fraction:t,normalOffset:n}}function lt(e,t){return!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function ut(e,t,n,r,i=0){return{left:e-n/2-i,top:t-r/2-i,right:e+n/2+i,bottom:t+r/2+i}}function K(e,t){return{left:e.left-t,top:e.top-t,right:e.right+t,bottom:e.bottom+t}}function dt(e,t){let n=Math.max(t.left-e.x,0,e.x-t.right),r=Math.max(t.top-e.y,0,e.y-t.bottom);return Math.hypot(n,r)}function ft(e,t,n){let r=n.x-t.x,i=n.y-t.y,a=r*r+i*i;if(a===0)return Math.hypot(e.x-t.x,e.y-t.y);let o=Math.max(0,Math.min(1,((e.x-t.x)*r+(e.y-t.y)*i)/a));return Math.hypot(e.x-(t.x+r*o),e.y-(t.y+i*o))}function pt(e,t,n){if(Je(t,n,e))return 0;let r=[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.right,y:e.bottom},{x:e.left,y:e.bottom}];return Math.min(dt(t,e),dt(n,e),...r.map(e=>ft(e,t,n)))}function mt(e,t){return t.length<2?1/0:Math.min(...t.slice(1).map((n,r)=>pt(e,t[r],n)))}function ht(e,t,n=0){return{left:Math.min(e.x,t.x)-n,top:Math.min(e.y,t.y)-n,right:Math.max(e.x,t.x)+n,bottom:Math.max(e.y,t.y)+n}}function q(e){let t=[],n=Math.floor(e.left/ke),r=Math.floor(e.right/ke),i=Math.floor(e.top/ke),a=Math.floor(e.bottom/ke);for(let e=n;e<=r;e+=1)for(let n=i;n<=a;n+=1)t.push(`${e}:${n}`);return t}function J(){let e=new Map;return{addPolyline(t,n){n.slice(1).forEach((r,i)=>{let a=n[i];if(a.x===r.x&&a.y===r.y)return;let o={ownerId:t,start:a,end:r};for(let t of q(ht(a,r))){let n=e.get(t)??[];n.push(o),e.set(t,n)}})},query(t){let n=new Set;for(let r of q(t))for(let t of e.get(r)??[])n.add(t);return[...n]}}}function gt(e,t,n,r){let i={x:t.x-e.x,y:t.y-e.y},a={x:r.x-n.x,y:r.y-n.y},o=Math.hypot(i.x,i.y),s=Math.hypot(a.x,a.y);if(o===0||s===0||Math.abs(i.x*a.y-i.y*a.x)/(o*s)>.17||Math.min(ft(e,n,r),ft(t,n,r),ft(n,e,t),ft(r,e,t))>ve)return null;let c={x:i.x/o,y:i.y/o},l=t=>(t.x-e.x)*c.x+(t.y-e.y)*c.y,u=l(n),d=l(r),f=Math.max(0,Math.min(u,d)),p=Math.min(o,Math.max(u,d));return p>f?{start:f,end:p}:null}function _t(e){let t=0;for(let n of e.values()){let e=[...n].sort((e,t)=>e.start-t.start||e.end-t.end),r=null,i=null;for(let n of e)r===null||i===null?(r=n.start,i=n.end):n.start<=i+.001?i=Math.max(i,n.end):(t=Math.max(t,i-r),r=n.start,i=n.end);r!==null&&i!==null&&(t=Math.max(t,i-r))}return t}function vt(e,t,n,r){let i=(e,t,n)=>(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),a=i(e,t,n),o=i(e,t,r),s=i(n,r,e),c=i(n,r,t);return a*o<-1e-6&&s*c<-1e-6}function Y(e){return e.slice(1).reduce((t,n,r)=>{let i=e[r];return t+Math.hypot(n.x-i.x,n.y-i.y)},0)}function yt(e,t,n){let r=new Map,i=0,a=0;return e.slice(1).forEach((o,s)=>{let c=e[s],l=ht(c,o,ve),u=(e,t)=>{let n=gt(c,o,e.start,e.end);if(n){let i=`${t}:${e.ownerId}`,o=r.get(i)??[];o.push({start:a+n.start,end:a+n.end}),r.set(i,o)}vt(c,o,e.start,e.end)&&(i+=1)};for(let e of t.query(l))u(e,`route`);for(let e of n.query(l))u(e,`leader`);a+=Math.hypot(o.x-c.x,o.y-c.y)}),{length:a,maxParallelOverlap:_t(r),crossingCount:i}}function bt(e,t){let n={x:(e.left+e.right)/2,y:(e.top+e.bottom)/2},r=t.x-n.x,i=t.y-n.y;if(r===0&&i===0)return{x:n.x,y:e.top};let a=Math.max(1,(e.right-e.left)/2),o=Math.max(1,(e.bottom-e.top)/2),s=1/Math.max(Math.abs(r)/a,Math.abs(i)/o);return{x:n.x+r*s,y:n.y+i*s}}function xt(e){let t=(e.left+e.right)/2,n=(e.top+e.bottom)/2;return[{x:e.left,y:n},{x:e.right,y:n},{x:t,y:e.top},{x:t,y:e.bottom}]}function St(e){let t=new Set([...e.obstacles.flatMap(e=>[e.left,e.right]),...e.sources.map(({point:e})=>e.x),...e.targets.map(({point:e})=>e.x)]),n=new Set([...e.obstacles.flatMap(e=>[e.top,e.bottom]),...e.sources.map(({point:e})=>e.y),...e.targets.map(({point:e})=>e.y)]);return t.size*n.size}function Ct(e){if(e.obstacles.some(t=>L(e.routePoint,t)))return null;let t={x:-e.routeTangent.y,y:e.routeTangent.x},n={x:(e.label.left+e.label.right)/2,y:(e.label.top+e.label.bottom)/2},r=(n.x-e.routePoint.x)*t.x+(n.y-e.routePoint.y)*t.y>=0?1:-1,i=e.targetPorts??xt(e.label),a=e.targetPorts?[...i].sort((t,n)=>Math.hypot(t.x-e.routePoint.x,t.y-e.routePoint.y)-Math.hypot(n.x-e.routePoint.x,n.y-e.routePoint.y)||N(V(t),V(n)))[0]:bt(e.label,e.routePoint),o=Math.hypot(a.x-e.routePoint.x,a.y-e.routePoint.y),s=Math.min(A,Math.max(2,o*.45)),c=[],l=[];for(let n of[r,-r]){let r={x:e.routePoint.x+t.x*s*n,y:e.routePoint.y+t.y*s*n};if(e.obstacles.some(t=>Je(e.routePoint,r,t)))continue;l.push(r);let i=bt(e.label,r);e.obstacles.some(e=>Je(r,i,e))||c.push([e.routePoint,r,i])}let u=t=>[...new Map(t.map(e=>Ue(e)).filter(t=>t.length>=2&&!t.slice(1).some((n,r)=>e.obstacles.some(e=>Je(t[r],n,K(e,-.001))))).map(e=>[e.map(V).join(`|`),e])).values()].map(t=>({points:t,...yt(t,e.routeSegments,e.leaderSegments)})),d=(e,t)=>{let n=e.maxParallelOverlap>=ye,r=t.maxParallelOverlap>=ye;return Number(n)-Number(r)||e.length+e.crossingCount*8-(t.length+t.crossingCount*8)||e.maxParallelOverlap-t.maxParallelOverlap||e.points.length-t.points.length||N(e.points.map(V).join(`|`),t.points.map(V).join(`|`))},f=u(c).sort(d);if(f[0]&&f[0].maxParallelOverlap<ye)return f[0];let p=l.flatMap(t=>{let n={sources:[{point:t,penalty:0}],targets:i.map(e=>({point:e,penalty:0})),obstacles:[...e.obstacles,e.label],channelOffset:0},r=W(n)??(e.allowOuterRoute?W({...n,channelOffset:M}):null)??(St(n)<=(e.fullGridVertexLimit??be)?nt(n):null);return r?[[e.routePoint,...r]]:[]});return[...f,...u(p)].sort(d)[0]??null}function wt(e){return e.length===0?null:{left:Math.min(...e.map(e=>e.left)),top:Math.min(...e.map(e=>e.top)),right:Math.max(...e.map(e=>e.right)),bottom:Math.max(...e.map(e=>e.bottom))}}function Tt(e){return[...e].reduce((e,t)=>e+(/\p{Script=Han}|\p{Script=Hiragana}|\p{Script=Katakana}/u.test(t)?1:.56),0)}function Et(e,t){if(/\s/u.test(e)||/[./_-]/u.test(e)||e===`:`&&t===`:`)return!0;if(!t||!/[\p{L}\p{N}]/u.test(e)||!/[\p{L}\p{N}]/u.test(t))return!1;let n=e=>/\p{Script=Han}|\p{Script=Hiragana}|\p{Script=Katakana}/u.test(e);return n(e)!==n(t)}function Dt(e,t){let n=[...e.trimEnd()];for(;n.length>0&&Tt(n.join(``)+`…`)>t;)n.pop();return`${n.join(``).trimEnd()}…`}function Ot(e,t){let n=e.trim();if(!n)return[``];let r=[];for(;Tt(n)>t;){let e=[...n],i=0,a=0,o=0;for(let n=0;n<e.length;n+=1){let r=e[n],s=i+Tt(r);if(s>t&&a>0)break;if(i=s,a=n+1,Et(r,e[n+1])){if(r===`:`&&e[n+1]===`:`){if(s+Tt(e[n+1])<=t)o=n+2;else if(n>0){o=n;break}}else o=n+1}if(i>t)break}let s=Math.min(e.length,o>0?o:Math.max(1,a));if(r.push(e.slice(0,s).join(``).trimEnd()),n=e.slice(s).join(``).trimStart(),!n)break}return n&&r.push(n),r}function kt(e){let t=Math.max(.56,e.maxUnits),n=e.text.replaceAll(`\r
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{a as t,l as n,t as r,u as i}from"./FileIcon-BrcB1D_2.js";import{C as a,D as o,E as s,S as c,T as l,_ as u,a as d,b as f,c as p,d as m,f as h,g,h as _,i as v,l as y,m as b,n as x,o as ee,p as te,r as S,s as ne,t as C,u as re,v as ie,w,x as ae,y as oe}from"./index-DjdjJ2Js.js";var T=e(i(),1),se=210,ce=136,le=64,ue=11,de=2,fe=300,pe=180,me=26,E=5,D=5,he=[fe,240,180,144],O=[`below-left`,`above-left`,`below-right`,`above-right`],ge=5,k=20,_e=72,A=12,ve=6,ye=36,be=4096,xe=32768,Se=22,j=24,Ce=12,M=8,we=12,Te=3,Ee=32,De=3,Oe=64,ke=128,Ae=[1,2];Ae.length;var je=Array.from({length:22},(e,t)=>.08+t*.04).sort((e,t)=>Math.abs(e-.5)-Math.abs(t-.5)),Me=[0,14,-14,28,-28,44,-44,64,-64,88,-88,116,-116,152,-152,196,-196,248,-248];function N(e,t){return e===t?0:e<t?-1:1}function Ne(e){let t=[...new Set(e)],n=new Map(t.map(e=>[e,e.split(`/`)]));return new Map(t.map(e=>{let r=n.get(e);for(let i=1;i<=r.length;i+=1){let a=r.slice(-i).join(`/`);if(t.every(t=>t===e||n.get(t).slice(-i).join(`/`)!==a))return[e,a]}return[e,e]}))}function Pe(e,t){let n=e.anchors.flatMap(e=>{let n=t.get(e.path);return n?[n]:[]}),r=[...new Set(n)].sort(N);return{anchorCount:e.anchors.length,changeKind:r.length>1?`mixed`:r.length===1?r[0]:null}}var Fe=12,Ie=56,Le=28,P=22;function Re(e){return Array.from({length:49},(t,n)=>{let r=n/48,i=1-r;return{x:i**3*e.start.x+3*i**2*r*e.control1.x+3*i*r**2*e.control2.x+r**3*e.end.x,y:i**3*e.start.y+3*i**2*r*e.control1.y+3*i*r**2*e.control2.y+r**3*e.end.y}})}function F(e){return{left:Math.min(...e.map(({x:e})=>e)),top:Math.min(...e.map(({y:e})=>e)),right:Math.max(...e.map(({x:e})=>e)),bottom:Math.max(...e.map(({y:e})=>e))}}function ze(e){let t=e.at(-1),n=[...e].reverse().slice(1).find(e=>e.x!==t.x||e.y!==t.y),r=t.x-n.x,i=t.y-n.y,a=Math.hypot(r,i),o={x:r/a,y:i/a},s=Math.min(12,a),c={x:t.x-o.x*s,y:t.y-o.y*s};return{base:c,path:`M ${c.x} ${c.y} L ${t.x} ${t.y}`,tangent:o}}function Be(e,t){let n=ze(e.points);return{...e,strokePath:t,arrowPath:n.path,arrowBaseX:n.base.x,arrowBaseY:n.base.y,arrowTangentX:n.tangent.x,arrowTangentY:n.tangent.y}}function Ve(e){let t=Re(e);return{path:`M ${e.start.x} ${e.start.y} C ${e.control1.x} ${e.control1.y}, ${e.control2.x} ${e.control2.y}, ${e.end.x} ${e.end.y}`,points:t,startX:e.start.x,startY:e.start.y,control1X:e.control1.x,control1Y:e.control1.y,control2X:e.control2.x,control2Y:e.control2.y,endX:e.end.x,endY:e.end.y,bounds:F([...t,e.control1,e.control2])}}function He(e){let t=Ve(e),n=Ue([e.boundaryStart,...t.points,e.boundaryEnd]),r={...t,path:`M ${e.boundaryStart.x} ${e.boundaryStart.y} L ${e.start.x} ${e.start.y} C ${e.control1.x} ${e.control1.y}, ${e.control2.x} ${e.control2.y}, ${e.end.x} ${e.end.y} L ${e.boundaryEnd.x} ${e.boundaryEnd.y}`,points:n,startX:e.boundaryStart.x,startY:e.boundaryStart.y,endX:e.boundaryEnd.x,endY:e.boundaryEnd.y,bounds:F([...n,e.control1,e.control2])},i=ze(n);return Be(r,`M ${e.boundaryStart.x} ${e.boundaryStart.y} L ${e.start.x} ${e.start.y} C ${e.control1.x} ${e.control1.y}, ${e.control2.x} ${e.control2.y}, ${e.end.x} ${e.end.y} L ${i.base.x} ${i.base.y}`)}function Ue(e){let t=[];for(let n of e){let e=t.at(-1);if(e&&e.x===n.x&&e.y===n.y)continue;let r=t.at(-2);r&&e&&(r.x===e.x&&e.x===n.x||r.y===e.y&&e.y===n.y)?t[t.length-1]=n:t.push(n)}return t}function We(e){let t=Ue(e),n=t[0],r=t.at(-1);if(!n||!r||t.length<2)return null;let i=e=>{let t=e[0],n=e.slice(1).map((t,n)=>{let r=e[n];return`C ${r.x+(t.x-r.x)/3} ${r.y+(t.y-r.y)/3}, ${r.x+(t.x-r.x)*2/3} ${r.y+(t.y-r.y)*2/3}, ${t.x} ${t.y}`});return`M ${t.x} ${t.y} ${n.join(` `)}`},a=t[1],o=t.at(-2),s={path:i(t),points:t,startX:n.x,startY:n.y,control1X:n.x+(a.x-n.x)/3,control1Y:n.y+(a.y-n.y)/3,control2X:o.x+(r.x-o.x)*2/3,control2Y:o.y+(r.y-o.y)*2/3,endX:r.x,endY:r.y,bounds:F(t)},c=ze(t);return Be(s,i(Ue([...t.slice(0,-1),c.base])))}function I(e,t,n,r,i,a){let o=t[e.from],s=t[e.to];if(!o||!s||e.from===e.to)return null;let c={x:o.x+114,y:o.y+56},l={x:s.x+114,y:s.y+56},u=z(c,l),d=z(l,c),f=Xe(Ke(o,0),i?.from??n,P,a?.get(e.from)).find(({side:e})=>e===u),p=Xe(Ke(s,0),i?.to??n,P,a?.get(e.to)).find(({side:e})=>e===d),m=p.point.x-f.point.x,h=p.point.y-f.point.y,g=Math.max(1,Math.hypot(m,h)),_=m/g,v=-(h/g),y=_,b=f.point,x=p.point,ee=n*(r?5.5:4),te={x:b.x+(x.x-b.x)/3+v*ee,y:b.y+(x.y-b.y)/3+y*ee},S={x:b.x+(x.x-b.x)*2/3+v*ee,y:b.y+(x.y-b.y)*2/3+y*ee};return He({boundaryStart:f.boundaryPoint,start:b,control1:te,control2:S,end:x,boundaryEnd:p.boundaryPoint})}function Ge(e){let t=new Set(e.filter(e=>e.directed&&e.from!==e.to).map(e=>JSON.stringify([e.from,e.to])));return new Set(e.filter(e=>e.directed&&e.from!==e.to&&t.has(JSON.stringify([e.to,e.from]))).map(e=>e.id))}function Ke(e,t=Fe){return{left:e.x-t,top:e.y-t,right:e.x+228+t,bottom:e.y+112+t}}function L(e,t){return e.x>t.left&&e.x<t.right&&e.y>t.top&&e.y<t.bottom}function qe(e,t,n){if(e.y===t.y){let r=Math.min(e.x,t.x),i=Math.max(e.x,t.x);return n.some(t=>e.y>t.top&&e.y<t.bottom&&r<t.right&&i>t.left)}if(e.x===t.x){let r=Math.min(e.y,t.y),i=Math.max(e.y,t.y);return n.some(t=>e.x>t.left&&e.x<t.right&&r<t.bottom&&i>t.top)}return!0}function Je(e,t,n){let r=t.x-e.x,i=t.y-e.y,a=0,o=1;for(let[t,s,c,l]of[[e.x,r,n.left,n.right],[e.y,i,n.top,n.bottom]]){if(Math.abs(s)<1e-6){if(t<c||t>l)return!1;continue}let e=(c-t)/s,n=(l-t)/s;if(a=Math.max(a,Math.min(e,n)),o=Math.min(o,Math.max(e,n)),a>o)return!1}return o>=0&&a<=1}function Ye(e,t){return e.slice(1).some((n,r)=>t.some(t=>Je(e[r],n,t)))}function Xe(e,t,n,r=`plain`){let i=(e.left+e.right)/2,a=(e.top+e.bottom)/2,o=e=>typeof t==`number`?t:t[e],s=t=>Math.max(-(e.right-e.left)/2+16,Math.min((e.right-e.left)/2-16,o(t))),c=t=>Math.max(-(e.bottom-e.top)/2+16,Math.min((e.bottom-e.top)/2-16,o(t)));return[{boundaryPoint:{x:e.left,y:a+c(`left`)},side:`left`},{boundaryPoint:{x:e.right,y:a+c(`right`)},side:`right`},{boundaryPoint:{x:i+s(`top`),y:e.top},side:`top`},{boundaryPoint:{x:i+s(`bottom`),y:e.bottom},side:`bottom`}].map(({boundaryPoint:t,side:i})=>{let a=R(e,i,t,r);return{point:(()=>{switch(i){case`left`:return{x:e.left-n,y:a.y};case`right`:return{x:e.right+n,y:a.y};case`top`:return{x:a.x,y:e.top-n};case`bottom`:return{x:a.x,y:e.bottom+n}}})(),boundaryPoint:a,side:i}})}function Ze(e,t,n,r,i){let a=(e.left+e.right)/2,o=(e.top+e.bottom)/2,s=(e.right-e.left)/2,c=(e.bottom-e.top)/2,l=Math.max(0,s-r),u=Math.max(0,c-i);if(t===`top`||t===`bottom`){let o=n.x-a;if(Math.abs(o)<=l)return n;let s=a+Math.sign(o||1)*l,c=Math.max(-1,Math.min(1,(n.x-s)/r)),u=i*(1-Math.sqrt(Math.max(0,1-c**2)));return{x:n.x,y:t===`top`?e.top+u:e.bottom-u}}let d=n.y-o;if(Math.abs(d)<=u)return n;let f=o+Math.sign(d||1)*u,p=Math.max(-1,Math.min(1,(n.y-f)/i)),m=r*(1-Math.sqrt(Math.max(0,1-p**2)));return{x:t===`left`?e.left+m:e.right-m,y:n.y}}function Qe(e,t,n){let r=e.right-e.left,i=e.bottom-e.top,a=(e.left+e.right)/2,o=(e.top+e.bottom)/2,s=r*.09;if(t===`left`||t===`right`){let r=s*Math.min(1,Math.abs(n.y-o)/(i/2));return{x:t===`left`?e.left+r:e.right-r,y:n.y}}let c=r/2-s,l=n.x-a;if(Math.abs(l)<=c)return n;let u=(Math.abs(l)-c)/s*(i/2);return{x:n.x,y:t===`top`?e.top+u:e.bottom-u}}function R(e,t,n,r){if(r===`external`)return Qe(e,t,n);if(r===`concept`){let r=Math.min((e.right-e.left)/2,(e.bottom-e.top)/2);return Ze(e,t,n,r,r)}return r===`database`?Ze(e,t,n,(e.right-e.left)/2,(e.bottom-e.top)*.14):n}function $e(e,t){if(e<=1)return[0];let n=Math.max(1,t/2-16),r=n*2/(e-1);return Array.from({length:e},(e,t)=>-n+t*r)}function et(e,t){let n=new Map;for(let r of e){if(r.from===r.to)continue;let e=t[r.from],i=t[r.to];if(!e||!i)continue;let a={x:e.x+114,y:e.y+56},o={x:i.x+114,y:i.y+56},s=[{edge:r,end:`from`,nodeId:r.from,otherNodeId:r.to,otherCenter:o},{edge:r,end:`to`,nodeId:r.to,otherNodeId:r.from,otherCenter:a}];for(let e of s){let t=n.get(e.nodeId)??[];t.push(e),n.set(e.nodeId,t)}}let r=new Map,i=()=>({left:0,right:0,top:0,bottom:0}),a=e=>(t,n)=>(e===`left`||e===`right`?t.otherCenter.y:t.otherCenter.x)-(e===`left`||e===`right`?n.otherCenter.y:n.otherCenter.x)||N(t.otherNodeId,n.otherNodeId)||N(t.edge.id,n.edge.id)||N(t.end,n.end);for(let e of n.values())for(let t of[`left`,`right`,`top`,`bottom`]){let n=[...e].sort(a(t)),o=t===`left`||t===`right`?112:228,s=$e(n.length,o);n.forEach((e,n)=>{let a=r.get(e.edge.id)??{from:i(),to:i()};a[e.end][t]=s[n],r.set(e.edge.id,a)})}return r}function z(e,t){let n=t.x-e.x,r=t.y-e.y;return Math.abs(n)>=Math.abs(r)?n>=0?`right`:`left`:r>=0?`bottom`:`top`}function B(e,t){return e===t?0:e===`left`&&t===`right`||e===`right`&&t===`left`||e===`top`&&t===`bottom`||e===`bottom`&&t===`top`?72:24}function V(e){return`${e.x}:${e.y}`}function H(e,t){return e.cost-t.cost||N(e.stateKey,t.stateKey)}function tt(e,t){e.push(t);for(let t=e.length-1;t>0;){let n=Math.floor((t-1)/2);if(H(e[n],e[t])<=0)break;[e[n],e[t]]=[e[t],e[n]],t=n}}function U(e){let t=e[0],n=e.pop();if(!t||!n||e.length===0)return t;e[0]=n;for(let t=0;t<e.length;){let n=t*2+1,r=n+1,i=t;if(n<e.length&&H(e[n],e[i])<0&&(i=n),r<e.length&&H(e[r],e[i])<0&&(i=r),i===t)break;[e[t],e[i]]=[e[i],e[t]],t=i}return t}function W(e){let t=wt([...e.obstacles,...e.sources.map(({point:e})=>({left:e.x,top:e.y,right:e.x,bottom:e.y})),...e.targets.map(({point:e})=>({left:e.x,top:e.y,right:e.x,bottom:e.y}))]);if(!t)return null;let n=null;for(let r of e.sources)for(let i of e.targets){let a=e.channelOffset===0?[[r.point,{x:i.point.x,y:r.point.y},i.point],[r.point,{x:r.point.x,y:i.point.y},i.point]]:[t.left-Ie-e.channelOffset,t.right+Ie+e.channelOffset].map(e=>[r.point,{x:e,y:r.point.y},{x:e,y:i.point.y},i.point]).concat([t.top-Ie-e.channelOffset,t.bottom+Ie+e.channelOffset].map(e=>[r.point,{x:r.point.x,y:e},{x:i.point.x,y:e},i.point]));for(let t of a){let a=Ue(t);if(a.length<2||a.slice(1).some((t,n)=>qe(a[n],t,e.obstacles)))continue;let o=a.slice(1).reduce((e,t,n)=>{let r=a[n];return e+Math.abs(t.x-r.x)+Math.abs(t.y-r.y)},0),s=r.penalty+i.penalty+o+Math.max(0,a.length-2)*Le,c=a.map(V).join(`|`);(n===null||s<n.cost||s===n.cost&&N(c,n.key)<0)&&(n={cost:s,key:c,points:a})}}return n?.points??null}function nt(e){if(e.sources.length===0||e.targets.length===0)return null;if(e.obstacles.length>=64){let t=W({...e,channelOffset:Math.max(0,e.channelOffset??0)});if(t)return t}let t=[...e.sources,...e.targets],n=wt([...e.obstacles,...t.map(({point:e})=>({left:e.x,top:e.y,right:e.x,bottom:e.y}))]);if(!n)return null;let r=Math.max(0,e.channelOffset??0),i=[n.left-Ie-r,n.right+Ie+r,...e.obstacles.flatMap(e=>[e.left-r,e.right+r]),...t.map(({point:e})=>e.x)].sort((e,t)=>e-t),a=[n.top-Ie-r,n.bottom+Ie+r,...e.obstacles.flatMap(e=>[e.top-r,e.bottom+r]),...t.map(({point:e})=>e.y)].sort((e,t)=>e-t),o=[...new Set(i)],s=[...new Set(a)],c=new Map;for(let t of s)for(let n of o){let r={x:n,y:t};e.obstacles.some(e=>L(r,e))||c.set(V(r),r)}let l=new Map([...c.keys()].map(e=>[e,new Set])),u=(t,n)=>{if(qe(t,n,e.obstacles))return;let r=V(t),i=V(n);l.get(r)?.add(i),l.get(i)?.add(r)};for(let e of s){let t=null;for(let n of o){let r=c.get(V({x:n,y:e}));r&&(t&&u(t,r),t=r)}}for(let e of o){let t=null;for(let n of s){let r=c.get(V({x:e,y:n}));r&&(t&&u(t,r),t=r)}}let d=new Map;for(let{point:t,penalty:n}of e.targets){let e=V(t);d.set(e,Math.min(n,d.get(e)??1/0))}let f=[],p=new Map,m=new Map;for(let{point:t,penalty:n}of e.sources){let e=V(t);if(!c.has(e))continue;let r=`${e}|start`,i=n;i>=(p.get(r)??1/0)||(p.set(r,i),m.set(r,null),tt(f,{stateKey:r,vertexKey:e,direction:`start`,cost:i}))}let h=null,g=1/0;for(;f.length>0;){let e=U(f);if(e.cost!==p.get(e.stateKey))continue;if(e.cost>g)break;let t=d.get(e.vertexKey);if(t!==void 0){let n=e.cost+t;(n<g||n===g&&(!h||N(e.stateKey,h.stateKey)<0))&&(h=e,g=n)}let n=c.get(e.vertexKey);for(let t of[...l.get(e.vertexKey)??[]].sort(N)){let r=c.get(t),i=n.x===r.x?`vertical`:`horizontal`,a=Math.abs(n.x-r.x)+Math.abs(n.y-r.y),o=e.direction===`start`||e.direction===i?0:Le,s=e.cost+a+o,l=`${t}|${i}`;s>=(p.get(l)??1/0)||(p.set(l,s),m.set(l,e.stateKey),tt(f,{stateKey:l,vertexKey:t,direction:i,cost:s}))}}if(!h)return null;let _=[];for(let e=h.stateKey;e!==null;){let t=e.lastIndexOf(`|`),n=e.slice(0,t);_.push(c.get(n)),e=m.get(e)??null}return Ue(_.reverse())}function rt(e){let t=z(e.from,e.to),n=z(e.to,e.from),r=Fe,i=P,a=Xe(e.fromBox,e.portOffsets.from,r,e.fromNotation),o=Xe(e.toBox,e.portOffsets.to,i,e.toNotation),s=nt({sources:a.map(({point:e,side:n})=>({point:e,penalty:B(n,t)})),targets:o.map(({point:e,side:t})=>({point:e,penalty:B(t,n)})),obstacles:e.obstacles,...e.channelOffset===void 0?{}:{channelOffset:e.channelOffset}});if(!s)return null;let c=s[0],l=s.at(-1),u=a.find(({point:e})=>V(e)===V(c)),d=o.find(({point:e})=>V(e)===V(l));return!u||!d?null:Ue([u.boundaryPoint,...s,d.boundaryPoint])}function G(e){return e.points.slice(1).flatMap((t,n)=>{let r=e.points[n];return r.y===t.y&&r.x!==t.x?[{orientation:`horizontal`,fixed:t.y,minimum:Math.min(r.x,t.x),maximum:Math.max(r.x,t.x)}]:r.x===t.x&&r.y!==t.y?[{orientation:`vertical`,fixed:t.x,minimum:Math.min(r.y,t.y),maximum:Math.max(r.y,t.y)}]:[]})}function it(e,t){return G(e).some(e=>G(t).some(t=>e.orientation!==t.orientation||Math.abs(e.fixed-t.fixed)>4?!1:Math.min(e.maximum,t.maximum)-Math.max(e.minimum,t.minimum)>=48))}function at(e,t){let n=new Map(e.map(e=>[e,new Set]));for(let r=0;r<e.length;r+=1){let i=e[r],a=t.get(i);if(a)for(let o=r+1;o<e.length;o+=1){let r=e[o],s=t.get(r);s&&it(a,s)&&(n.get(i).add(r),n.get(r).add(i))}}let r=[],i=new Set;for(let t of e){if(i.has(t)||n.get(t)?.size===0)continue;let e=[],a=[t];i.add(t);for(let t=0;t<a.length;t+=1){let r=a[t];e.push(r);for(let e of[...n.get(r)??[]].sort(N))i.has(e)||(i.add(e),a.push(e))}r.push(e.sort(N))}return r}function ot(e){let{point:t,notation:n,laneOffset:r,obstacles:i}=e,a=t.x,o=t.x+228,s=t.y,c=t.y+112,l=r*.55,u=e=>Math.max(a+16,Math.min(o-16,e)),d=e=>Math.max(s+16,Math.min(c-16,e));for(let e=0;e<12;e+=1){let t=88+Math.abs(r)*2+e*72,f={left:a,right:o,top:s,bottom:c},p=R(f,`right`,{x:o,y:d(s+32+l)},n),m=R(f,`right`,{x:o,y:d(c-32+l)},n),h=R(f,`left`,{x:a,y:d(c-32-l)},n),g=R(f,`left`,{x:a,y:d(s+32-l)},n),_=R(f,`top`,{x:u(a+48+l),y:s},n),v=R(f,`top`,{x:u(o-48+l),y:s},n),y=R(f,`bottom`,{x:u(o-48-l),y:c},n),b=R(f,`bottom`,{x:u(a+48-l),y:c},n),x=[He({boundaryStart:p,start:{x:o+P,y:p.y},control1:{x:o+t,y:s-64+l},control2:{x:o+t,y:c+64+l},end:{x:o+P,y:m.y},boundaryEnd:m}),He({boundaryStart:h,start:{x:a-P,y:h.y},control1:{x:a-t,y:c+64-l},control2:{x:a-t,y:s-64-l},end:{x:a-P,y:g.y},boundaryEnd:g}),He({boundaryStart:_,start:{x:_.x,y:s-P},control1:{x:a-72+l,y:s-t},control2:{x:o+72+l,y:s-t},end:{x:v.x,y:s-P},boundaryEnd:v}),He({boundaryStart:y,start:{x:y.x,y:c+P},control1:{x:o+72-l,y:c+t},control2:{x:a-72-l,y:c+t},end:{x:b.x,y:c+P},boundaryEnd:b})].find(e=>!Ye(e.points,i));if(x)return x}return null}function st(e,t,n){let r=a(e),i=et(e,n),o=new Map(t.map(e=>[e.id,e.notation])),s=Ge(e),c=new Map(t.flatMap(e=>{let t=n[e.id];return t?[[e.id,Ke(t,0)]]:[]})),l=new Map(t.flatMap(e=>{let t=n[e.id];return t?[[e.id,Ke(t)]]:[]})),u=new Map,d=[],f=[...e].sort((e,t)=>N(e.id,t.id)),p=(e,t=0)=>{let r=n[e.from],a=n[e.to],s=c.get(e.from),u=c.get(e.to);if(!r||!a||!s||!u)return null;let d=[...l].filter(([t])=>{if(t===e.from||t===e.to)return!0;let n=c.get(t);return!n||!lt(n,s)&&!lt(n,u)}).map(([,e])=>e),f=rt({from:{x:r.x+114,y:r.y+56},to:{x:a.x+114,y:a.y+56},fromBox:s,toBox:u,obstacles:d,portOffsets:i.get(e.id)??{from:{left:0,right:0,top:0,bottom:0},to:{left:0,right:0,top:0,bottom:0}},fromNotation:o.get(e.from)??`plain`,toNotation:o.get(e.to)??`plain`,channelOffset:t});return f?We(f):null};for(let e of f){let t=n[e.from],a=n[e.to];if(!t||!a)continue;let f=[...l].filter(([t])=>{if(t===e.from||t===e.to)return!1;let n=c.get(t),r=c.get(e.from),i=c.get(e.to);return n&&r&&i?!lt(n,r)&&!lt(n,i):!0}).map(([,e])=>e),m=r.get(e.id)??0;if(e.from===e.to){let n=ot({point:t,notation:o.get(e.from)??`plain`,laneOffset:m,obstacles:f});n&&u.set(e.id,n);continue}let h=I(e,n,m,s.has(e.id),i.get(e.id),o);if(h&&!lt(l.get(e.from),l.get(e.to))&&!Ye(h.points,f)){u.set(e.id,h);continue}let g=p(e);g&&u.set(e.id,g),d.push(e.id)}let m=new Map([...d].sort(N).map((e,t)=>[e,t])),h=new Map(f.map(e=>[e.id,e]));for(let e=0;e<Math.min(8,d.length);e+=1){let e=at(d,u);if(e.length===0)break;for(let t of e)t.forEach(e=>{let t=h.get(e),n=m.get(e),r=p(t,(n+1)*8);r&&u.set(e,r)})}return u}function ct(e,t,n){let r=e.points.slice(1).map((t,n)=>{let r=e.points[n];return{previous:r,point:t,length:Math.hypot(t.x-r.x,t.y-r.y)}}),i=r.reduce((e,t)=>e+t.length,0)*t,a=r.find(e=>i<=e.length||(i-=e.length,!1))??r.at(-1);if(!a){let r={x:e.startX,y:e.startY};return{point:r,routePoint:r,tangent:{x:1,y:0},fraction:t,normalOffset:n}}let o=a.length===0?0:Math.min(1,i/a.length),s=a.previous.x+(a.point.x-a.previous.x)*o,c=a.previous.y+(a.point.y-a.previous.y)*o,l=a.point.x-a.previous.x,u=a.point.y-a.previous.y,d=Math.max(1,Math.hypot(l,u)),f={x:l/d,y:u/d},p={x:s,y:c};return{point:{x:s+-f.y*n,y:c+f.x*n},routePoint:p,tangent:f,fraction:t,normalOffset:n}}function lt(e,t){return!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function ut(e,t,n,r,i=0){return{left:e-n/2-i,top:t-r/2-i,right:e+n/2+i,bottom:t+r/2+i}}function K(e,t){return{left:e.left-t,top:e.top-t,right:e.right+t,bottom:e.bottom+t}}function dt(e,t){let n=Math.max(t.left-e.x,0,e.x-t.right),r=Math.max(t.top-e.y,0,e.y-t.bottom);return Math.hypot(n,r)}function ft(e,t,n){let r=n.x-t.x,i=n.y-t.y,a=r*r+i*i;if(a===0)return Math.hypot(e.x-t.x,e.y-t.y);let o=Math.max(0,Math.min(1,((e.x-t.x)*r+(e.y-t.y)*i)/a));return Math.hypot(e.x-(t.x+r*o),e.y-(t.y+i*o))}function pt(e,t,n){if(Je(t,n,e))return 0;let r=[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.right,y:e.bottom},{x:e.left,y:e.bottom}];return Math.min(dt(t,e),dt(n,e),...r.map(e=>ft(e,t,n)))}function mt(e,t){return t.length<2?1/0:Math.min(...t.slice(1).map((n,r)=>pt(e,t[r],n)))}function ht(e,t,n=0){return{left:Math.min(e.x,t.x)-n,top:Math.min(e.y,t.y)-n,right:Math.max(e.x,t.x)+n,bottom:Math.max(e.y,t.y)+n}}function q(e){let t=[],n=Math.floor(e.left/ke),r=Math.floor(e.right/ke),i=Math.floor(e.top/ke),a=Math.floor(e.bottom/ke);for(let e=n;e<=r;e+=1)for(let n=i;n<=a;n+=1)t.push(`${e}:${n}`);return t}function J(){let e=new Map;return{addPolyline(t,n){n.slice(1).forEach((r,i)=>{let a=n[i];if(a.x===r.x&&a.y===r.y)return;let o={ownerId:t,start:a,end:r};for(let t of q(ht(a,r))){let n=e.get(t)??[];n.push(o),e.set(t,n)}})},query(t){let n=new Set;for(let r of q(t))for(let t of e.get(r)??[])n.add(t);return[...n]}}}function gt(e,t,n,r){let i={x:t.x-e.x,y:t.y-e.y},a={x:r.x-n.x,y:r.y-n.y},o=Math.hypot(i.x,i.y),s=Math.hypot(a.x,a.y);if(o===0||s===0||Math.abs(i.x*a.y-i.y*a.x)/(o*s)>.17||Math.min(ft(e,n,r),ft(t,n,r),ft(n,e,t),ft(r,e,t))>ve)return null;let c={x:i.x/o,y:i.y/o},l=t=>(t.x-e.x)*c.x+(t.y-e.y)*c.y,u=l(n),d=l(r),f=Math.max(0,Math.min(u,d)),p=Math.min(o,Math.max(u,d));return p>f?{start:f,end:p}:null}function _t(e){let t=0;for(let n of e.values()){let e=[...n].sort((e,t)=>e.start-t.start||e.end-t.end),r=null,i=null;for(let n of e)r===null||i===null?(r=n.start,i=n.end):n.start<=i+.001?i=Math.max(i,n.end):(t=Math.max(t,i-r),r=n.start,i=n.end);r!==null&&i!==null&&(t=Math.max(t,i-r))}return t}function vt(e,t,n,r){let i=(e,t,n)=>(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),a=i(e,t,n),o=i(e,t,r),s=i(n,r,e),c=i(n,r,t);return a*o<-1e-6&&s*c<-1e-6}function Y(e){return e.slice(1).reduce((t,n,r)=>{let i=e[r];return t+Math.hypot(n.x-i.x,n.y-i.y)},0)}function yt(e,t,n){let r=new Map,i=0,a=0;return e.slice(1).forEach((o,s)=>{let c=e[s],l=ht(c,o,ve),u=(e,t)=>{let n=gt(c,o,e.start,e.end);if(n){let i=`${t}:${e.ownerId}`,o=r.get(i)??[];o.push({start:a+n.start,end:a+n.end}),r.set(i,o)}vt(c,o,e.start,e.end)&&(i+=1)};for(let e of t.query(l))u(e,`route`);for(let e of n.query(l))u(e,`leader`);a+=Math.hypot(o.x-c.x,o.y-c.y)}),{length:a,maxParallelOverlap:_t(r),crossingCount:i}}function bt(e,t){let n={x:(e.left+e.right)/2,y:(e.top+e.bottom)/2},r=t.x-n.x,i=t.y-n.y;if(r===0&&i===0)return{x:n.x,y:e.top};let a=Math.max(1,(e.right-e.left)/2),o=Math.max(1,(e.bottom-e.top)/2),s=1/Math.max(Math.abs(r)/a,Math.abs(i)/o);return{x:n.x+r*s,y:n.y+i*s}}function xt(e){let t=(e.left+e.right)/2,n=(e.top+e.bottom)/2;return[{x:e.left,y:n},{x:e.right,y:n},{x:t,y:e.top},{x:t,y:e.bottom}]}function St(e){let t=new Set([...e.obstacles.flatMap(e=>[e.left,e.right]),...e.sources.map(({point:e})=>e.x),...e.targets.map(({point:e})=>e.x)]),n=new Set([...e.obstacles.flatMap(e=>[e.top,e.bottom]),...e.sources.map(({point:e})=>e.y),...e.targets.map(({point:e})=>e.y)]);return t.size*n.size}function Ct(e){if(e.obstacles.some(t=>L(e.routePoint,t)))return null;let t={x:-e.routeTangent.y,y:e.routeTangent.x},n={x:(e.label.left+e.label.right)/2,y:(e.label.top+e.label.bottom)/2},r=(n.x-e.routePoint.x)*t.x+(n.y-e.routePoint.y)*t.y>=0?1:-1,i=e.targetPorts??xt(e.label),a=e.targetPorts?[...i].sort((t,n)=>Math.hypot(t.x-e.routePoint.x,t.y-e.routePoint.y)-Math.hypot(n.x-e.routePoint.x,n.y-e.routePoint.y)||N(V(t),V(n)))[0]:bt(e.label,e.routePoint),o=Math.hypot(a.x-e.routePoint.x,a.y-e.routePoint.y),s=Math.min(A,Math.max(2,o*.45)),c=[],l=[];for(let n of[r,-r]){let r={x:e.routePoint.x+t.x*s*n,y:e.routePoint.y+t.y*s*n};if(e.obstacles.some(t=>Je(e.routePoint,r,t)))continue;l.push(r);let i=bt(e.label,r);e.obstacles.some(e=>Je(r,i,e))||c.push([e.routePoint,r,i])}let u=t=>[...new Map(t.map(e=>Ue(e)).filter(t=>t.length>=2&&!t.slice(1).some((n,r)=>e.obstacles.some(e=>Je(t[r],n,K(e,-.001))))).map(e=>[e.map(V).join(`|`),e])).values()].map(t=>({points:t,...yt(t,e.routeSegments,e.leaderSegments)})),d=(e,t)=>{let n=e.maxParallelOverlap>=ye,r=t.maxParallelOverlap>=ye;return Number(n)-Number(r)||e.length+e.crossingCount*8-(t.length+t.crossingCount*8)||e.maxParallelOverlap-t.maxParallelOverlap||e.points.length-t.points.length||N(e.points.map(V).join(`|`),t.points.map(V).join(`|`))},f=u(c).sort(d);if(f[0]&&f[0].maxParallelOverlap<ye)return f[0];let p=l.flatMap(t=>{let n={sources:[{point:t,penalty:0}],targets:i.map(e=>({point:e,penalty:0})),obstacles:[...e.obstacles,e.label],channelOffset:0},r=W(n)??(e.allowOuterRoute?W({...n,channelOffset:M}):null)??(St(n)<=(e.fullGridVertexLimit??be)?nt(n):null);return r?[[e.routePoint,...r]]:[]});return[...f,...u(p)].sort(d)[0]??null}function wt(e){return e.length===0?null:{left:Math.min(...e.map(e=>e.left)),top:Math.min(...e.map(e=>e.top)),right:Math.max(...e.map(e=>e.right)),bottom:Math.max(...e.map(e=>e.bottom))}}function Tt(e){return[...e].reduce((e,t)=>e+(/\p{Script=Han}|\p{Script=Hiragana}|\p{Script=Katakana}/u.test(t)?1:.56),0)}function Et(e,t){if(/\s/u.test(e)||/[./_-]/u.test(e)||e===`:`&&t===`:`)return!0;if(!t||!/[\p{L}\p{N}]/u.test(e)||!/[\p{L}\p{N}]/u.test(t))return!1;let n=e=>/\p{Script=Han}|\p{Script=Hiragana}|\p{Script=Katakana}/u.test(e);return n(e)!==n(t)}function Dt(e,t){let n=[...e.trimEnd()];for(;n.length>0&&Tt(n.join(``)+`…`)>t;)n.pop();return`${n.join(``).trimEnd()}…`}function Ot(e,t){let n=e.trim();if(!n)return[``];let r=[];for(;Tt(n)>t;){let e=[...n],i=0,a=0,o=0;for(let n=0;n<e.length;n+=1){let r=e[n],s=i+Tt(r);if(s>t&&a>0)break;if(i=s,a=n+1,Et(r,e[n+1])){if(r===`:`&&e[n+1]===`:`){if(s+Tt(e[n+1])<=t)o=n+2;else if(n>0){o=n;break}}else o=n+1}if(i>t)break}let s=Math.min(e.length,o>0?o:Math.max(1,a));if(r.push(e.slice(0,s).join(``).trimEnd()),n=e.slice(s).join(``).trimStart(),!n)break}return n&&r.push(n),r}function kt(e){let t=Math.max(.56,e.maxUnits),n=e.text.replaceAll(`\r
|
|
2
2
|
`,`
|
|
3
3
|
`).replaceAll(`\r`,`
|
|
4
4
|
`).split(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MermaidExpandedView-DS0IYrAh.js","assets/rolldown-runtime-XKyaHtl9.js","assets/MermaidSurface-758VCVqh.js","assets/FileIcon-BrcB1D_2.js","assets/preload-helper-Czpn1I53.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{n as e,r as t,t as n}from"./rolldown-runtime-XKyaHtl9.js";import{A as r,N as i,T as a,_ as o,g as s,k as c,p as l,t as u,x as d,y as f}from"./MermaidSurface-758VCVqh.js";import{a as p,i as m,l as h,s as g,t as _,u as v}from"./FileIcon-BrcB1D_2.js";import{a as y,c as b,d as x,f as S,i as C,l as ee,n as w,o as T,r as te,s as E,t as D,u as ne}from"./ccount-Cz0CQfQ_.js";import{t as re}from"./preload-helper-Czpn1I53.js";var ie=class extends s{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||O(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=o({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),f.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function O(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var ae=class extends i{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),c(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&d(t.mutationKey)!==d(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??O();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){f.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},k=t(v(),1);function A(e,t){let n=l(t),[i]=k.useState(()=>new ae(n,e));k.useEffect(()=>{i.setOptions(e)},[i,e]);let o=k.useSyncExternalStore(k.useCallback(e=>i.subscribe(f.batchCalls(e)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),s=k.useCallback((e,t)=>{i.mutate(e,t).catch(a)},[i]);if(o.error&&r(i.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:s,mutateAsync:o.mutate}}var j=h(),oe=e=>[`comments`,e];async function se(e,t){await e.cancelQueries({queryKey:oe(t),exact:!0})}function ce(e,t){e.invalidateQueries({queryKey:oe(t),exact:!0})}function le(e,t){return t.updatedAt.localeCompare(e.updatedAt)||t.id.localeCompare(e.id)}function ue(e,t,n){e.setQueryData(oe(t),e=>{let t=[n,...e?.comments.filter(({id:e})=>e!==n.id)??[]];return t.sort(le),{...e??{},comments:t}}),ce(e,t)}function de(e,t,n){e.setQueryData(oe(t),e=>!e||!e.comments.some(({id:e})=>e===n)?e:{...e,comments:e.comments.filter(({id:e})=>e!==n)}),ce(e,t)}var fe={kind:`pull-request-markdown`};function M(e){return e.kind===`pull-request-markdown`?`pull-request-markdown`:e.kind===`walkthrough`?`walkthrough:${e.id}`:e.kind===`structure`?`structure:${e.id}`:`file:${e.path}`}function pe(e,t){return`${e}:${M(t)}`}function me(e){return e.kind===`pull-request-markdown`?`Pull Request.md`:e.kind===`walkthrough`||e.kind===`structure`?e.title:e.path}function he(e){let t=me(e);return t.split(`/`).at(-1)??t}function ge(){return{documents:{left:[fe],right:[]},active:{left:fe,right:null},focusedPane:`left`,navigationRevision:{left:0,right:0}}}function _e(e,t,n=!1){return t===e?e:{...t,navigationRevision:{left:e.navigationRevision.left+Number(n||e.active.left!==t.active.left),right:e.navigationRevision.right+Number(n||e.active.right!==t.active.right)}}}function ve(e){return e===`left`?`right`:`left`}function ye(e,t,n){let r=M(t);return e.documents[n].find(e=>M(e)===r)}function be(e,t){return[`left`,`right`].filter(n=>ye(e,t,n))}function xe(e,t){let n=[];for(let r of[`left`,`right`]){let i=ve(r);for(let a of e.documents[r]){if(ye(t,a,r))continue;let e=ye(t,a,i);e&&n.push({sourceDocument:a,targetDocument:e,sourcePane:r,targetPane:i})}}return n}function Se(e,t){return ye(e,t,e.focusedPane)?e.focusedPane:be(e,t)[0]??e.focusedPane}function Ce(e){return e.documents.left.length>0||e.documents.right.length===0?e:{...e,documents:{left:e.documents.right,right:[]},active:{left:e.active.right??e.documents.right[0]??null,right:null},focusedPane:`left`}}function we(e,t,n){let r=M(t),i=e.documents[n].findIndex(e=>M(e)===r),a=i<0?[...e.documents[n],t]:e.documents[n].map((e,n)=>n===i?t:e);return{...e,documents:{...e.documents,[n]:a},active:{...e.active,[n]:t},focusedPane:n}}function Te(e,t,n,r){if(n===r)return we(e,t,r);let i=M(t),a=e.documents[n].findIndex(e=>M(e)===i);if(a<0)return e;let o=e.documents[n].filter(e=>M(e)!==i),s=e.documents[r].findIndex(e=>M(e)===i),c=s<0?[...e.documents[r],t]:e.documents[r].map((e,n)=>n===s?t:e),l={...e.active,[r]:t};return e.active[n]&&M(e.active[n])===i&&(l[n]=o[Math.min(a,o.length-1)]??o.at(-1)??null),Ce({...e,documents:{...e.documents,[n]:o,[r]:c},active:l,focusedPane:r})}function Ee(e,t,n){let r=M(t),i=n??[`left`,`right`].find(n=>e.documents[n].some(e=>e===t))??(ye(e,t,e.focusedPane)?e.focusedPane:be(e,t)[0]);if(!i)return e;let a=e.documents[i].findIndex(e=>M(e)===r);if(a<0)return e;let o=e.documents[i].filter(e=>M(e)!==r),s={...e.active};s[i]&&M(s[i])===r&&(s[i]=o[Math.min(a,o.length-1)]??o.at(-1)??null);let c=e.focusedPane===i&&!s[i]?ve(i):e.focusedPane;return Ce({...e,documents:{...e.documents,[i]:o},active:s,focusedPane:c})}function De(e){return e.kind===`pull-request-markdown`?{kind:`pull-request-markdown`}:e.kind===`walkthrough`||e.kind===`structure`||e.comparisonPolicy===`reference-target`?e:{kind:`repository-file`,path:e.path}}var Oe=new Map,ke=new Map,Ae=new Map,je=new Set,Me=new Map;function Ne(e){return e.kind===`pull-request-markdown`?[`pull-request-markdown`]:e.kind===`walkthrough`?[`walkthrough`,e.id,e.sourceOid]:e.kind===`structure`?[`structure`,e.id,e.sourceOid]:[`repository-file`,e.path,e.oldPath??null,e.newPath??null,e.sourceOid??null,e.comparisonPolicy??null,e.referenceContext?.latestHeadOid??null,e.referenceContext?.outcome??null]}function Pe(e){return Array.isArray(e)?e[0]===`pull-request-markdown`?`pull-request-markdown`:e[0]===`walkthrough`&&typeof e[1]==`string`?`walkthrough:${e[1]}`:e[0]===`structure`&&typeof e[1]==`string`?`structure:${e[1]}`:e[0]===`repository-file`&&typeof e[1]==`string`?`file:${e[1]}`:null:null}function Fe(e){return JSON.stringify([e.pane,Ne(e.activeDocument),e.selectedOid,e.oldOid,e.displayMode])}function Ie(e){return Me.get(e)??0}function Le(e){let t=Ie(e),n=Ae.get(e);if(n?.revision===t)return n;let r={revision:t,body:``,focused:!1};return Ae.set(e,r),r}function Re(){for(let e of je)e()}function ze(e){return je.add(e),()=>je.delete(e)}function Be(e,t){return pe(e,t)}function Ve(e,t,n,r,i){if(r===i)return[];let a=ke.get(e);if(!a)return[];let o=`inline:${Be(r,t)}:`,s=`inline:${Be(i,n)}:`;return[...a.entries()].filter(([e])=>e.startsWith(o)).map(([e,t])=>({sourceKey:e,targetKey:`${s}${e.slice(o.length)}`,draft:t}))}function He(e,t,n,r){if(n===r)return[];let i=Oe.get(e);if(!i)return[];let a=M(t),o=[];for(let[e,t]of i){let i;try{i=JSON.parse(e)}catch{continue}if(!Array.isArray(i)||i.length!==5||i[0]!==n||Pe(i[1])!==a)continue;let s=i;o.push({sourceKey:e,targetKey:JSON.stringify([r,...s.slice(1)]),draft:t})}return o}function Ue(e,t,n){let r=[],i=[];for(let a of xe(t,n))r.push(...Ve(e,a.sourceDocument,a.targetDocument,a.sourcePane,a.targetPane)),i.push(...He(e,a.sourceDocument,a.sourcePane,a.targetPane));let a=ke.get(e),o=Oe.get(e);if(r.some(({targetKey:e})=>a?.has(e))||i.some(({targetKey:e})=>o?.has(e)))return{status:`conflict`};for(let{sourceKey:e}of r)a?.delete(e);for(let{targetKey:e,draft:t}of r)a?.set(e,t);for(let{sourceKey:e}of i)o?.delete(e);for(let{targetKey:e,draft:t}of i)o?.set(e,t);return r.length>0&&Re(),{status:`applied`,commentDraftsMoved:i.length>0}}function We(e,t){return ke.get(e)?.get(t)??Le(e)}function Ge(e,t,n){if(n.revision!==Ie(e))return;let r=We(e,t);if(r.body===n.body&&r.focused===n.focused&&(r.allowChanges??!1)===(n.allowChanges??!1))return;let i=ke.get(e);i||(i=new Map,ke.set(e,i)),n.body||n.focused||n.allowChanges?i.set(t,n):i.delete(t),i.size===0&&ke.delete(e),Re()}function Ke(e,t){let n=ke.get(e);if(!n)return;let r=!1;for(let e of n.keys())e.endsWith(`:${t}`)&&(n.delete(e),r=!0);r&&(n.size===0&&ke.delete(e),Re())}function qe(e,t){return Oe.get(e)?.get(t)}function Je(e,t,n,r){if(n!==Ie(e))return;let i=Oe.get(e);i||(i=new Map,Oe.set(e,i)),i.set(t,r)}function Ye(e,t,n){if(n!==Ie(e))return;let r=Oe.get(e);r?.delete(t),r?.size===0&&Oe.delete(e)}function Xe(e){Oe.delete(e),ke.delete(e),Me.set(e,Ie(e)+1),Ae.delete(e),Re()}function Ze(){return[...ke.values()].some(e=>[...e.values()].some(e=>e.body.trim().length>0))}function Qe(){return JSON.stringify([...ke].flatMap(([e,t])=>[...t].filter(([,e])=>e.body.trim()).map(([t,n])=>({pullRequestId:e,contextKey:t,body:n.body}))))}function $e(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.code==`string`&&typeof t.message==`string`&&Array.isArray(t.suggestions)&&t.suggestions.every(e=>typeof e==`string`)}function et({error:e}){if(!e)return null;let t=$e(e)?e:null,n=e instanceof Error?e.message:t?.message??`予期しないエラーが発生しました。`,r=e instanceof m?e.code:t?.code??null,i=e instanceof m?e.suggestions:t?.suggestions??[];return(0,j.jsxs)(`div`,{className:`error-notice`,role:`alert`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:`処理に失敗しました。`}),r&&(0,j.jsx)(`code`,{children:r})]}),(0,j.jsx)(`p`,{children:n}),i.length>0&&(0,j.jsx)(`ul`,{children:i.map(e=>(0,j.jsx)(`li`,{children:e},e))})]})}function tt(e,t,n){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.repeat||e.nativeEvent.isComposing||(e.preventDefault(),t&&n()))}function nt(){return(0,j.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 16 16`,width:`16`,height:`16`,children:(0,j.jsx)(`path`,{fill:`currentColor`,d:`M1.75 2.5A1.75 1.75 0 0 1 3.5.75h9A1.75 1.75 0 0 1 14.25 2.5v7A1.75 1.75 0 0 1 12.5 11.25H7.06l-3.88 3.1A.75.75 0 0 1 2 13.77v-2.7A1.75 1.75 0 0 1 1.75 9.5v-7Zm1.75-.25a.25.25 0 0 0-.25.25v7c0 .14.11.25.25.25V12.2l3.03-2.42a.75.75 0 0 1 .47-.17h5.5a.25.25 0 0 0 .25-.25V2.5a.25.25 0 0 0-.25-.25h-9Z`})})}function rt({body:e,label:t,disabled:n=!1,pending:r,error:i,validationError:a,placement:o,onBodyChange:s,onCancel:c,onSubmit:l}){let[u,d]=(0,k.useState)(!1),f=!!e.trim()&&!n&&!r;return(0,j.jsxs)(`div`,{className:`inline-comment-composer inline-comment-composer--${o}`,children:[(0,j.jsx)(`strong`,{children:t}),(0,j.jsx)(`textarea`,{autoFocus:!0,rows:4,value:e,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Escape`&&!e.nativeEvent.isComposing?(e.preventDefault(),c()):tt(e,f,()=>l(u))},placeholder:`コメントを入力(Markdown対応)`,"aria-label":t}),a&&(0,j.jsx)(`p`,{className:`form-error`,children:a}),(0,j.jsx)(et,{error:i}),(0,j.jsxs)(`div`,{className:`inline-comment-actions`,children:[(0,j.jsx)(it,{checked:u,onChange:d,disabled:r}),(0,j.jsx)(`button`,{type:`button`,className:`button--quiet`,disabled:r,onPointerDown:e=>{e.preventDefault(),c()},onClick:c,children:`キャンセル`}),(0,j.jsx)(`button`,{type:`button`,disabled:!f,onClick:()=>l(u),children:`コメント`})]})]})}function it({checked:e,onChange:t,disabled:n=!1}){return(0,j.jsxs)(`label`,{className:`comment-change-permission`,title:`本文の依頼に応じてファイルやArtifactを変更してよい、という許可です。変更を指示するものではありません。`,children:[(0,j.jsx)(`input`,{type:`checkbox`,checked:e,disabled:n,onChange:e=>t(e.target.checked)}),`この依頼に伴う変更を許可`]})}function at(){}var ot=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,st=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ct={};function lt(e,t){return((t||ct).jsx?st:ot).test(e)}var ut={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},dt=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
|
|
2
|
+
import{n as e,r as t,t as n}from"./rolldown-runtime-XKyaHtl9.js";import{A as r,N as i,T as a,_ as o,g as s,k as c,p as l,t as u,x as d,y as f}from"./MermaidSurface-758VCVqh.js";import{a as p,i as m,l as h,s as g,t as _,u as v}from"./FileIcon-BrcB1D_2.js";import{a as y,c as b,d as x,f as S,i as C,l as ee,n as w,o as T,r as te,s as E,t as D,u as ne}from"./ccount-Cz0CQfQ_.js";import{t as re}from"./preload-helper-Czpn1I53.js";var ie=class extends s{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||O(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=o({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),f.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function O(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var ae=class extends i{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),c(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&d(t.mutationKey)!==d(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??O();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){f.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},k=t(v(),1);function A(e,t){let n=l(t),[i]=k.useState(()=>new ae(n,e));k.useEffect(()=>{i.setOptions(e)},[i,e]);let o=k.useSyncExternalStore(k.useCallback(e=>i.subscribe(f.batchCalls(e)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),s=k.useCallback((e,t)=>{i.mutate(e,t).catch(a)},[i]);if(o.error&&r(i.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:s,mutateAsync:o.mutate}}var j=h(),oe=e=>[`comments`,e];async function se(e,t){await e.cancelQueries({queryKey:oe(t),exact:!0})}function ce(e,t){e.invalidateQueries({queryKey:oe(t),exact:!0})}function le(e,t){return t.updatedAt.localeCompare(e.updatedAt)||t.id.localeCompare(e.id)}function ue(e,t,n){e.setQueryData(oe(t),e=>{let t=[n,...e?.comments.filter(({id:e})=>e!==n.id)??[]];return t.sort(le),{...e??{},comments:t}}),ce(e,t)}function de(e,t,n){e.setQueryData(oe(t),e=>!e||!e.comments.some(({id:e})=>e===n)?e:{...e,comments:e.comments.filter(({id:e})=>e!==n)}),ce(e,t)}var fe={kind:`pull-request-markdown`};function M(e){return e.kind===`pull-request-markdown`?`pull-request-markdown`:e.kind===`walkthrough`?`walkthrough:${e.id}`:e.kind===`structure`?`structure:${e.id}`:`file:${e.path}`}function pe(e,t){return`${e}:${M(t)}`}function me(e){return e.kind===`pull-request-markdown`?`Pull Request.md`:e.kind===`walkthrough`||e.kind===`structure`?e.title:e.path}function he(e){let t=me(e);return t.split(`/`).at(-1)??t}function ge(){return{documents:{left:[fe],right:[]},active:{left:fe,right:null},focusedPane:`left`,navigationRevision:{left:0,right:0}}}function _e(e,t,n=!1){return t===e?e:{...t,navigationRevision:{left:e.navigationRevision.left+Number(n||e.active.left!==t.active.left),right:e.navigationRevision.right+Number(n||e.active.right!==t.active.right)}}}function ve(e){return e===`left`?`right`:`left`}function ye(e,t,n){let r=M(t);return e.documents[n].find(e=>M(e)===r)}function be(e,t){return[`left`,`right`].filter(n=>ye(e,t,n))}function xe(e,t){let n=[];for(let r of[`left`,`right`]){let i=ve(r);for(let a of e.documents[r]){if(ye(t,a,r))continue;let e=ye(t,a,i);e&&n.push({sourceDocument:a,targetDocument:e,sourcePane:r,targetPane:i})}}return n}function Se(e,t){return ye(e,t,e.focusedPane)?e.focusedPane:be(e,t)[0]??e.focusedPane}function Ce(e){return e.documents.left.length>0||e.documents.right.length===0?e:{...e,documents:{left:e.documents.right,right:[]},active:{left:e.active.right??e.documents.right[0]??null,right:null},focusedPane:`left`}}function we(e,t,n){let r=M(t),i=e.documents[n].findIndex(e=>M(e)===r),a=i<0?[...e.documents[n],t]:e.documents[n].map((e,n)=>n===i?t:e);return{...e,documents:{...e.documents,[n]:a},active:{...e.active,[n]:t},focusedPane:n}}function Te(e,t,n,r){if(n===r)return we(e,t,r);let i=M(t),a=e.documents[n].findIndex(e=>M(e)===i);if(a<0)return e;let o=e.documents[n].filter(e=>M(e)!==i),s=e.documents[r].findIndex(e=>M(e)===i),c=s<0?[...e.documents[r],t]:e.documents[r].map((e,n)=>n===s?t:e),l={...e.active,[r]:t};return e.active[n]&&M(e.active[n])===i&&(l[n]=o[Math.min(a,o.length-1)]??o.at(-1)??null),Ce({...e,documents:{...e.documents,[n]:o,[r]:c},active:l,focusedPane:r})}function Ee(e,t,n){let r=M(t),i=n??[`left`,`right`].find(n=>e.documents[n].some(e=>e===t))??(ye(e,t,e.focusedPane)?e.focusedPane:be(e,t)[0]);if(!i)return e;let a=e.documents[i].findIndex(e=>M(e)===r);if(a<0)return e;let o=e.documents[i].filter(e=>M(e)!==r),s={...e.active};s[i]&&M(s[i])===r&&(s[i]=o[Math.min(a,o.length-1)]??o.at(-1)??null);let c=e.focusedPane===i&&!s[i]?ve(i):e.focusedPane;return Ce({...e,documents:{...e.documents,[i]:o},active:s,focusedPane:c})}function De(e){return e.kind===`pull-request-markdown`?{kind:`pull-request-markdown`}:e.kind===`walkthrough`||e.kind===`structure`||e.comparisonPolicy===`reference-target`?e:{kind:`repository-file`,path:e.path}}var Oe=new Map,ke=new Map,Ae=new Map,je=new Set,Me=new Map;function Ne(e){return e.kind===`pull-request-markdown`?[`pull-request-markdown`]:e.kind===`walkthrough`?[`walkthrough`,e.id,e.sourceOid]:e.kind===`structure`?[`structure`,e.id,e.sourceOid]:[`repository-file`,e.path,e.oldPath??null,e.newPath??null,e.sourceOid??null,e.comparisonPolicy??null,e.referenceContext?.latestHeadOid??null,e.referenceContext?.outcome??null]}function Pe(e){return Array.isArray(e)?e[0]===`pull-request-markdown`?`pull-request-markdown`:e[0]===`walkthrough`&&typeof e[1]==`string`?`walkthrough:${e[1]}`:e[0]===`structure`&&typeof e[1]==`string`?`structure:${e[1]}`:e[0]===`repository-file`&&typeof e[1]==`string`?`file:${e[1]}`:null:null}function Fe(e){return JSON.stringify([e.pane,Ne(e.activeDocument),e.selectedOid,e.oldOid,e.displayMode])}function Ie(e){return Me.get(e)??0}function Le(e){let t=Ie(e),n=Ae.get(e);if(n?.revision===t)return n;let r={revision:t,body:``,focused:!1};return Ae.set(e,r),r}function Re(){for(let e of je)e()}function ze(e){return je.add(e),()=>je.delete(e)}function Be(e,t){return pe(e,t)}function Ve(e,t,n,r,i){if(r===i)return[];let a=ke.get(e);if(!a)return[];let o=`inline:${Be(r,t)}:`,s=`inline:${Be(i,n)}:`;return[...a.entries()].filter(([e])=>e.startsWith(o)).map(([e,t])=>({sourceKey:e,targetKey:`${s}${e.slice(o.length)}`,draft:t}))}function He(e,t,n,r){if(n===r)return[];let i=Oe.get(e);if(!i)return[];let a=M(t),o=[];for(let[e,t]of i){let i;try{i=JSON.parse(e)}catch{continue}if(!Array.isArray(i)||i.length!==5||i[0]!==n||Pe(i[1])!==a)continue;let s=i;o.push({sourceKey:e,targetKey:JSON.stringify([r,...s.slice(1)]),draft:t})}return o}function Ue(e,t,n){let r=[],i=[];for(let a of xe(t,n))r.push(...Ve(e,a.sourceDocument,a.targetDocument,a.sourcePane,a.targetPane)),i.push(...He(e,a.sourceDocument,a.sourcePane,a.targetPane));let a=ke.get(e),o=Oe.get(e);if(r.some(({targetKey:e})=>a?.has(e))||i.some(({targetKey:e})=>o?.has(e)))return{status:`conflict`};for(let{sourceKey:e}of r)a?.delete(e);for(let{targetKey:e,draft:t}of r)a?.set(e,t);for(let{sourceKey:e}of i)o?.delete(e);for(let{targetKey:e,draft:t}of i)o?.set(e,t);return r.length>0&&Re(),{status:`applied`,commentDraftsMoved:i.length>0}}function We(e,t){return ke.get(e)?.get(t)??Le(e)}function Ge(e,t,n){if(n.revision!==Ie(e))return;let r=We(e,t);if(r.body===n.body&&r.focused===n.focused&&(r.allowChanges??!1)===(n.allowChanges??!1))return;let i=ke.get(e);i||(i=new Map,ke.set(e,i)),n.body||n.focused||n.allowChanges?i.set(t,n):i.delete(t),i.size===0&&ke.delete(e),Re()}function Ke(e,t){let n=ke.get(e);if(!n)return;let r=!1;for(let e of n.keys())e.endsWith(`:${t}`)&&(n.delete(e),r=!0);r&&(n.size===0&&ke.delete(e),Re())}function qe(e,t){return Oe.get(e)?.get(t)}function Je(e,t,n,r){if(n!==Ie(e))return;let i=Oe.get(e);i||(i=new Map,Oe.set(e,i)),i.set(t,r)}function Ye(e,t,n){if(n!==Ie(e))return;let r=Oe.get(e);r?.delete(t),r?.size===0&&Oe.delete(e)}function Xe(e){Oe.delete(e),ke.delete(e),Me.set(e,Ie(e)+1),Ae.delete(e),Re()}function Ze(){return[...ke.values()].some(e=>[...e.values()].some(e=>e.body.trim().length>0))}function Qe(){return JSON.stringify([...ke].flatMap(([e,t])=>[...t].filter(([,e])=>e.body.trim()).map(([t,n])=>({pullRequestId:e,contextKey:t,body:n.body}))))}function $e(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.code==`string`&&typeof t.message==`string`&&Array.isArray(t.suggestions)&&t.suggestions.every(e=>typeof e==`string`)}function et({error:e}){if(!e)return null;let t=$e(e)?e:null,n=e instanceof Error?e.message:t?.message??`予期しないエラーが発生しました。`,r=e instanceof m?e.code:t?.code??null,i=e instanceof m?e.suggestions:t?.suggestions??[];return(0,j.jsxs)(`div`,{className:`error-notice`,role:`alert`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:`処理に失敗しました。`}),r&&(0,j.jsx)(`code`,{children:r})]}),(0,j.jsx)(`p`,{children:n}),i.length>0&&(0,j.jsx)(`ul`,{children:i.map(e=>(0,j.jsx)(`li`,{children:e},e))})]})}function tt(e,t,n){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.repeat||e.nativeEvent.isComposing||(e.preventDefault(),t&&n()))}function nt(){return(0,j.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 16 16`,width:`16`,height:`16`,children:(0,j.jsx)(`path`,{fill:`currentColor`,d:`M1.75 2.5A1.75 1.75 0 0 1 3.5.75h9A1.75 1.75 0 0 1 14.25 2.5v7A1.75 1.75 0 0 1 12.5 11.25H7.06l-3.88 3.1A.75.75 0 0 1 2 13.77v-2.7A1.75 1.75 0 0 1 1.75 9.5v-7Zm1.75-.25a.25.25 0 0 0-.25.25v7c0 .14.11.25.25.25V12.2l3.03-2.42a.75.75 0 0 1 .47-.17h5.5a.25.25 0 0 0 .25-.25V2.5a.25.25 0 0 0-.25-.25h-9Z`})})}function rt({body:e,label:t,disabled:n=!1,pending:r,error:i,validationError:a,placement:o,onBodyChange:s,onCancel:c,onSubmit:l}){let[u,d]=(0,k.useState)(!1),f=!!e.trim()&&!n&&!r;return(0,j.jsxs)(`div`,{className:`inline-comment-composer inline-comment-composer--${o}`,children:[(0,j.jsx)(`strong`,{children:t}),(0,j.jsx)(`textarea`,{autoFocus:!0,rows:4,value:e,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Escape`&&!e.nativeEvent.isComposing?(e.preventDefault(),c()):tt(e,f,()=>l(u))},placeholder:`コメントを入力(Markdown対応)`,"aria-label":t}),a&&(0,j.jsx)(`p`,{className:`form-error`,children:a}),(0,j.jsx)(et,{error:i}),(0,j.jsxs)(`div`,{className:`inline-comment-actions`,children:[(0,j.jsx)(it,{checked:u,onChange:d,disabled:r}),(0,j.jsx)(`button`,{type:`button`,className:`button--quiet`,disabled:r,onPointerDown:e=>{e.preventDefault(),c()},onClick:c,children:`キャンセル`}),(0,j.jsx)(`button`,{type:`button`,disabled:!f,onClick:()=>l(u),children:`コメント`})]})]})}function it({checked:e,onChange:t,disabled:n=!1}){return(0,j.jsxs)(`label`,{className:`comment-change-permission`,title:`本文の依頼に応じてコードやGitHubを変更してよい、という許可です。rvw内のWalkthrough・Structureの作成や更新には不要です。変更を指示するものではありません。`,children:[(0,j.jsx)(`input`,{type:`checkbox`,checked:e,disabled:n,onChange:e=>t(e.target.checked)}),`この依頼に伴う変更を許可`]})}function at(){}var ot=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,st=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ct={};function lt(e,t){return((t||ct).jsx?st:ot).test(e)}var ut={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},dt=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
|
|
3
3
|
`);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),ft=n(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var i=r(dt());function a(e,t){let n=null;if(!e||typeof e!=`string`)return n;let r=(0,i.default)(e),a=typeof t==`function`;return r.forEach(e=>{if(e.type!==`declaration`)return;let{property:r,value:i}=e;a?t(r,i,e):i&&(n||={},n[r]=i)}),n}})),pt=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),mt=n(((e,t,n)=>{var r=(n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(ft()),i=pt();function a(e,t){var n={};return!e||typeof e!=`string`||(0,r.default)(e,function(e,r){e&&r&&(n[(0,i.camelCase)(e,t)]=r)}),n}a.default=a,t.exports=a})),ht=_t(`end`),gt=_t(`start`);function _t(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function vt(e){let t=gt(e),n=ht(e);if(t&&n)return{start:t,end:n}}function yt(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?xt(e.position):`start`in e||`end`in e?xt(e):`line`in e||`column`in e?bt(e):``}function bt(e){return St(e&&e.line)+`:`+St(e&&e.column)}function xt(e){return bt(e&&e.start)+`-`+bt(e&&e.end)}function St(e){return e&&typeof e==`number`?e:1}var N=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=yt(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};N.prototype.file=``,N.prototype.name=``,N.prototype.reason=``,N.prototype.message=``,N.prototype.stack=``,N.prototype.column=void 0,N.prototype.line=void 0,N.prototype.ancestors=void 0,N.prototype.cause=void 0,N.prototype.fatal=void 0,N.prototype.place=void 0,N.prototype.ruleId=void 0,N.prototype.source=void 0;var Ct=t(mt(),1),wt={}.hasOwnProperty,Tt=new Map,Et=/[A-Z]/g,Dt=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Ot=new Set([`td`,`th`]),kt=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function At(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Vt(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Bt(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?E:T,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=jt(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function jt(e,t,n){if(t.type===`element`)return Mt(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Nt(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Ft(e,t,n);if(t.type===`mdxjsEsm`)return Pt(e,t);if(t.type===`root`)return It(e,t,n);if(t.type===`text`)return Lt(e,t)}function Mt(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=E,e.schema=i),e.ancestors.push(t);let a=qt(e,t.tagName,!1),o=Ht(e,t),s=Wt(e,t);return Dt.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!ne(e)})),Rt(e,o,a,t),zt(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Nt(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Jt(e,t.position)}function Pt(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Jt(e,t.position)}function Ft(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=E,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:qt(e,t.name,!0),o=Ut(e,t),s=Wt(e,t);return Rt(e,o,a,t),zt(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function It(e,t,n){let r={};return zt(r,Wt(e,t)),e.create(t,e.Fragment,r,n)}function Lt(e,t){return t.value}function Rt(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function zt(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Bt(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Vt(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=gt(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Ht(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&wt.call(t.properties,i)){let a=Gt(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Ot.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Ut(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Jt(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Jt(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function Wt(e,t){let n=[],r=-1,i=e.passKeys?new Map:Tt;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=jt(e,a,o);s!==void 0&&n.push(s)}return n}function Gt(e,t,n){let r=b(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?S(n):y(n)),r.property===`style`){let t=typeof n==`object`?n:Kt(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Yt(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?ut[r.property]||r.property:r.attribute,n]}}function Kt(e,t){try{return(0,Ct.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new N("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=kt+`#cannot-parse-style-attribute`,r}}function qt(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=lt(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=lt(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return wt.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Jt(e)}function Jt(e,t){let n=new N("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=kt+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function Yt(e){let t={},n;for(n in e)wt.call(e,n)&&(t[Xt(n)]=e[n]);return t}function Xt(e){let t=e.replace(Et,Zt);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Zt(e){return`-`+e.toLowerCase()}var Qt={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},$t={};function en(e,t){let n=t||$t;return tn(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function tn(e,t,n){if(rn(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return nn(e.children,t,n)}return Array.isArray(e)?nn(e,t,n):``}function nn(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=tn(e[i],t,n);return r.join(``)}function rn(e){return!!(e&&typeof e==`object`)}var an=document.createElement(`i`);function on(e){let t=`&`+e+`;`;an.innerHTML=t;let n=an.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function sn(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function cn(e,t){return e.length>0?(sn(e,e.length,0,t),e):t}var ln={}.hasOwnProperty;function un(e){let t={},n=-1;for(;++n<e.length;)dn(t,e[n]);return t}function dn(e,t){let n;for(n in t){let r=(ln.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){ln.call(r,a)||(r[a]=[]);let e=i[a];fn(r[a],Array.isArray(e)?e:e?[e]:[])}}}function fn(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);sn(e,0,0,r)}function pn(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function mn(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var P=Sn(/[A-Za-z]/),F=Sn(/[\dA-Za-z]/),hn=Sn(/[#-'*+\--9=?A-Z^-~]/);function gn(e){return e!==null&&(e<32||e===127)}var _n=Sn(/\d/),vn=Sn(/[\dA-Fa-f]/),yn=Sn(/[!-/:-@[-`{-~]/);function I(e){return e!==null&&e<-2}function L(e){return e!==null&&(e<0||e===32)}function R(e){return e===-2||e===-1||e===32}var bn=Sn(/\p{P}|\p{S}/u),xn=Sn(/\s/);function Sn(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Cn(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&F(e.charCodeAt(n+1))&&F(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function z(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return R(r)?(e.enter(n),s(r)):t(r)}function s(r){return R(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var wn={tokenize:Tn};function Tn(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null)e.consume(n);else return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),z(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null)e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);else return I(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var En={tokenize:On},Dn={tokenize:kn};function On(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return sn(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!(!i.currentConstruct||i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Dn,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Dn,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null)i&&v(),_(0),e.consume(n);else return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null)g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);else return I(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;sn(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function kn(e,t,n){return z(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function An(e){if(e===null||L(e)||xn(e))return 1;if(bn(e))return 2}function jn(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var Mn={name:`attention`,resolveAll:Nn,tokenize:Pn};function Nn(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};Fn(d,-c),Fn(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=cn(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=cn(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=cn(l,jn(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=cn(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=cn(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,sn(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Pn(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=An(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=An(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function Fn(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var In={name:`autolink`,tokenize:Ln};function Ln(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return P(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||F(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||F(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||gn(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):hn(t)?(e.consume(t),l):n(t)}function u(e){return F(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||F(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Rn={partial:!0,tokenize:zn};function zn(e,t,n){return r;function r(t){return R(t)?z(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||I(e)?t(e):n(e)}}var Bn={continuation:{tokenize:Hn},exit:Un,name:`blockQuote`,tokenize:Vn};function Vn(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return R(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Hn(e,t,n){let r=this;return i;function i(t){return R(t)?z(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Bn,t,n)(r)}}function Un(e){e.exit(`blockQuote`)}var Wn={name:`characterEscape`,tokenize:Gn};function Gn(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return yn(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var Kn={name:`characterReference`,tokenize:qn};function qn(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=F,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=vn,u):(e.enter(`characterReferenceValue`),a=7,o=_n,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===F&&!on(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var Jn={partial:!0,tokenize:Zn},Yn={concrete:!0,name:`codeFenced`,tokenize:Xn};function Xn(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),R(t)?z(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||I(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(Jn,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||I(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):R(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),z(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||I(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||I(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&R(t)?z(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||I(t)?e.check(Jn,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||I(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),R(t)?z(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),R(t)?z(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||I(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function Zn(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var Qn={name:`codeIndented`,tokenize:er},$n={partial:!0,tokenize:tr};function er(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),z(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):I(t)?e.attempt($n,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||I(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function tr(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):I(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):z(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):I(e)?i(e):n(e)}}var nr={name:`codeText`,previous:ir,resolve:rr,tokenize:ar};function rr(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function ir(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function ar(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):I(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||I(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var or=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&sr(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),sr(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),sr(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);sr(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);sr(this.left,t.reverse())}}}};function sr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function cr(e){let t={},n=-1,r,i,a,o,s,c,l,u=new or(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,lr(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return sn(e,0,1/0,u.slice(0)),!l}function lr(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var ur={resolve:fr,tokenize:pr},dr={partial:!0,tokenize:mr};function fr(e){return cr(e),e}function pr(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):I(t)?e.check(dr,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function mr(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),z(e,a,`linePrefix`)}function a(i){if(i===null||I(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function hr(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||gn(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||I(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||L(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||gn(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function gr(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):I(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||I(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!R(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function _r(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):I(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),z(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||I(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function vr(e,t){let n;return r;function r(i){return I(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):R(i)?z(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var yr={name:`definition`,tokenize:xr},br={partial:!0,tokenize:Sr};function xr(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return gr.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=mn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return L(t)?vr(e,l)(t):l(t)}function l(t){return hr(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(br,d,d)(t)}function d(t){return R(t)?z(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||I(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Sr(e,t,n){return r;function r(t){return L(t)?vr(e,i)(t):n(t)}function i(t){return _r(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return R(t)?z(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||I(e)?t(e):n(e)}}var Cr={name:`hardBreakEscape`,tokenize:wr};function wr(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return I(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Tr={name:`headingAtx`,resolve:Er,tokenize:Dr};function Er(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},sn(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Dr(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||L(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||I(n)?(e.exit(`atxHeading`),t(n)):R(n)?z(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||L(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Or=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),kr=[`pre`,`script`,`style`,`textarea`],Ar={concrete:!0,name:`htmlFlow`,resolveTo:Nr,tokenize:Pr},jr={partial:!0,tokenize:Ir},Mr={partial:!0,tokenize:Fr};function Nr(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Pr(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:A):P(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):P(a)?(e.consume(a),i=4,r.interrupt?t:A):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:A):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:E:m):n(i)}function h(t){return P(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||L(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&kr.includes(l)?(i=1,r.interrupt?t(s):E(s)):Or.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):E(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||F(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:E):n(i)}function v(t){return R(t)?(e.consume(t),v):T(t)}function y(t){return t===47?(e.consume(t),T):t===58||t===95||P(t)?(e.consume(t),b):R(t)?(e.consume(t),y):T(t)}function b(t){return t===45||t===46||t===58||t===95||F(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):R(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):R(t)?(e.consume(t),S):ee(t)}function C(t){return t===c?(e.consume(t),c=null,w):t===null||I(t)?n(t):(e.consume(t),C)}function ee(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||L(t)?x(t):(e.consume(t),ee)}function w(e){return e===47||e===62||R(e)?y(e):n(e)}function T(t){return t===62?(e.consume(t),te):n(t)}function te(t){return t===null||I(t)?E(t):R(t)?(e.consume(t),te):n(t)}function E(t){return t===45&&i===2?(e.consume(t),ie):t===60&&i===1?(e.consume(t),O):t===62&&i===4?(e.consume(t),j):t===63&&i===3?(e.consume(t),A):t===93&&i===5?(e.consume(t),k):I(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(jr,oe,D)(t)):t===null||I(t)?(e.exit(`htmlFlowData`),D(t)):(e.consume(t),E)}function D(t){return e.check(Mr,ne,oe)(t)}function ne(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),re}function re(t){return t===null||I(t)?D(t):(e.enter(`htmlFlowData`),E(t))}function ie(t){return t===45?(e.consume(t),A):E(t)}function O(t){return t===47?(e.consume(t),o=``,ae):E(t)}function ae(t){if(t===62){let n=o.toLowerCase();return kr.includes(n)?(e.consume(t),j):E(t)}return P(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ae):E(t)}function k(t){return t===93?(e.consume(t),A):E(t)}function A(t){return t===62?(e.consume(t),j):t===45&&i===2?(e.consume(t),A):E(t)}function j(t){return t===null||I(t)?(e.exit(`htmlFlowData`),oe(t)):(e.consume(t),j)}function oe(n){return e.exit(`htmlFlow`),t(n)}}function Fr(e,t,n){let r=this;return i;function i(t){return I(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Ir(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Rn,t,n)}}var Lr={name:`htmlText`,tokenize:Rr};function Rr(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):P(t)?(e.consume(t),ee):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):P(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):I(t)?(o=d,O(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?ie(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):I(t)?(o=h,O(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?ie(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?ie(t):I(t)?(o=v,O(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):I(t)?(o=y,O(t)):(e.consume(t),y)}function b(e){return e===62?ie(e):y(e)}function x(t){return P(t)?(e.consume(t),S):n(t)}function S(t){return t===45||F(t)?(e.consume(t),S):C(t)}function C(t){return I(t)?(o=C,O(t)):R(t)?(e.consume(t),C):ie(t)}function ee(t){return t===45||F(t)?(e.consume(t),ee):t===47||t===62||L(t)?w(t):n(t)}function w(t){return t===47?(e.consume(t),ie):t===58||t===95||P(t)?(e.consume(t),T):I(t)?(o=w,O(t)):R(t)?(e.consume(t),w):ie(t)}function T(t){return t===45||t===46||t===58||t===95||F(t)?(e.consume(t),T):te(t)}function te(t){return t===61?(e.consume(t),E):I(t)?(o=te,O(t)):R(t)?(e.consume(t),te):w(t)}function E(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,D):I(t)?(o=E,O(t)):R(t)?(e.consume(t),E):(e.consume(t),ne)}function D(t){return t===i?(e.consume(t),i=void 0,re):t===null?n(t):I(t)?(o=D,O(t)):(e.consume(t),D)}function ne(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||L(t)?w(t):(e.consume(t),ne)}function re(e){return e===47||e===62||L(e)?w(e):n(e)}function ie(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function O(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ae}function ae(t){return R(t)?z(e,k,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):k(t)}function k(t){return e.enter(`htmlTextData`),o(t)}}var zr={name:`labelEnd`,resolveAll:Ur,resolveTo:Wr,tokenize:Gr},Br={tokenize:Kr},Vr={tokenize:qr},Hr={tokenize:Jr};function Ur(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&sn(e,0,e.length,n),e}function Wr(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=cn(s,e.slice(a+1,a+r+3)),s=cn(s,[[`enter`,u,t]]),s=cn(s,jn(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=cn(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=cn(s,e.slice(o+1)),s=cn(s,[[`exit`,c,t]]),sn(e,a,e.length,s),e}function Gr(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(mn(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Br,u,o?u:d)(t):t===91?e.attempt(Vr,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Hr,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function Kr(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return L(t)?vr(e,a)(t):a(t)}function a(t){return t===41?u(t):hr(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return L(t)?vr(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?_r(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return L(t)?vr(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function qr(e,t,n){let r=this;return i;function i(t){return gr.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(mn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function Jr(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var Yr={name:`labelStartImage`,resolveAll:zr.resolveAll,tokenize:Xr};function Xr(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Zr={name:`labelStartLink`,resolveAll:zr.resolveAll,tokenize:Qr};function Qr(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var $r={name:`lineEnding`,tokenize:ei};function ei(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),z(e,t,`linePrefix`)}}var ti={name:`thematicBreak`,tokenize:ni};function ni(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||I(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),R(t)?z(e,s,`whitespace`)(t):s(t))}}var B={continuation:{tokenize:oi},exit:ci,name:`list`,tokenize:ai},ri={partial:!0,tokenize:li},ii={partial:!0,tokenize:si};function ai(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:_n(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(ti,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return _n(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Rn,r.interrupt?n:u,e.attempt(ri,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return R(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function oi(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Rn,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,z(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!R(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(ii,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,z(e,e.attempt(B,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function si(e,t,n){let r=this;return z(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function ci(e){e.exit(this.containerState.type)}function li(e,t,n){let r=this;return z(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!R(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var ui={name:`setextUnderline`,resolveTo:di,tokenize:fi};function di(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function fi(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),R(t)?z(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||I(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var pi={tokenize:mi};function mi(e){let t=this,n=e.attempt(Rn,r,e.attempt(this.parser.constructs.flowInitial,i,z(e,e.attempt(this.parser.constructs.flow,i,e.attempt(ur,i)),`linePrefix`)));return n;function r(r){if(r===null)e.consume(r);else return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null)e.consume(r);else return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var hi={resolveAll:yi()},gi=vi(`string`),_i=vi(`text`);function vi(e){return{resolveAll:yi(e===`text`?bi:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null)t.consume(e);else return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function yi(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):t[r]&&t[r][1].type===`data`||(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function bi(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var xi=e({attentionMarkers:()=>ki,contentInitial:()=>Ci,disable:()=>Ai,document:()=>Si,flow:()=>Ti,flowInitial:()=>wi,insideSpan:()=>Oi,string:()=>Ei,text:()=>Di}),Si={42:B,43:B,45:B,48:B,49:B,50:B,51:B,52:B,53:B,54:B,55:B,56:B,57:B,62:Bn},Ci={91:yr},wi={[-2]:Qn,[-1]:Qn,32:Qn},Ti={35:Tr,42:ti,45:[ui,ti],60:Ar,61:ui,95:ti,96:Yn,126:Yn},Ei={38:Kn,92:Wn},Di={[-5]:$r,[-4]:$r,[-3]:$r,33:Yr,38:Kn,42:Mn,60:[In,Lr],91:Zr,92:[Cr,Wn],93:zr,95:Mn,96:nr},Oi={null:[Mn,hi]},ki={null:[42,95]},Ai={null:[]};function ji(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=cn(o,e),g(),o[o.length-1]===null?(ee(t,0),l.events=jn(a,l.events,l),l.events):[]}function f(e,t){return Ni(p(e),t)}function p(e){return Mi(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,T()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){I(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,T()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){ee(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=w(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function ee(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&sn(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function w(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,T()}}function T(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Mi(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Ni(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
4
4
|
`;break;case-3:o=`\r
|
|
5
5
|
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function Pi(e){let t={constructs:un([xi,...(e||{}).extensions||[]]),content:n(wn),defined:[],document:n(En),flow:n(pi),lazy:{},string:n(gi),text:n(_i)};return t;function n(e){return n;function n(n){return ji(t,e,n)}}}function Fi(e){for(;!cr(e););return e}var Ii=/[\0\t\n\r]/g;function Li(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(Ii.lastIndex=u,c=Ii.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var Ri=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function zi(e){return e.replace(Ri,Bi)}function Bi(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return pn(n.slice(t?2:1),t?16:10)}return on(n)||e}var Vi={}.hasOwnProperty;function Hi(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),Ui(n)(Fi(Pi(n).document().write(Li()(e,t,!0))))}function Ui(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(Se),autolinkProtocol:w,autolinkEmail:w,atxHeading:a(ve),blockQuote:a(pe),characterEscape:w,characterReference:w,codeFenced:a(me),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(me,o),codeText:a(he,o),codeTextData:w,data:w,codeFlowValue:w,definition:a(ge),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(_e),hardBreakEscape:a(ye),hardBreakTrailing:a(ye),htmlFlow:a(be,o),htmlFlowData:w,htmlText:a(be,o),htmlTextData:w,image:a(xe),label:o,link:a(Se),listItem:a(we),listItemValue:f,listOrdered:a(Ce,d),listUnordered:a(Ce),paragraph:a(Te),reference:se,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(ve),strong:a(Ee),thematicBreak:a(Oe)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:M,autolinkProtocol:fe,blockQuote:c(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:le,characterReferenceMarkerNumeric:le,characterReferenceValue:ue,characterReference:de,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:T,codeIndented:c(_),codeText:c(re),codeTextData:T,data:T,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(E),hardBreakTrailing:c(E),htmlFlow:c(D),htmlFlowData:T,htmlText:c(ne),htmlTextData:T,image:c(O),label:k,labelText:ae,lineEnding:te,link:c(ie),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ce,resourceDestinationString:A,resourceTitleString:j,resource:oe,setextHeading:c(ee),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};Gi(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];Vi.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||qi).call(a,void 0,e[0])}for(r.position={start:Wi(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Wi(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:Wi(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||qi).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+yt({start:e.start,end:e.end})+`): it’s not open`);n.position.end=Wi(e.end)}function u(){return en(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=mn(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function ee(){this.data.setextHeadingSlurpLineEnding=void 0}function w(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];n&&n.type===`text`||(n=De(),n.position={start:Wi(e.start),end:void 0},t.push(n)),this.stack.push(n)}function T(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=Wi(e.end)}function te(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=Wi(e.end),this.data.atHardBreak=void 0}else!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(w.call(this,e),T.call(this,e))}function E(){this.data.atHardBreak=!0}function D(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ne(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function re(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ie(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function O(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function ae(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=zi(t),n.identifier=mn(t).toLowerCase()}function k(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function oe(){this.data.inReference=void 0}function se(){this.data.referenceType=`collapsed`}function ce(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=mn(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function le(e){this.data.characterReferenceType=e.type}function ue(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=pn(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=on(t);let i=this.stack[this.stack.length-1];i.value+=r}function de(e){let t=this.stack.pop();t.position.end=Wi(e.end)}function fe(e){T.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function M(e){T.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function pe(){return{type:`blockquote`,children:[]}}function me(){return{type:`code`,lang:null,meta:null,value:``}}function he(){return{type:`inlineCode`,value:``}}function ge(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function _e(){return{type:`emphasis`,children:[]}}function ve(){return{type:`heading`,depth:0,children:[]}}function ye(){return{type:`break`}}function be(){return{type:`html`,value:``}}function xe(){return{type:`image`,title:null,url:``,alt:null}}function Se(){return{type:`link`,title:null,url:``,children:[]}}function Ce(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function we(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function Te(){return{type:`paragraph`,children:[]}}function Ee(){return{type:`strong`,children:[]}}function De(){return{type:`text`,value:``}}function Oe(){return{type:`thematicBreak`}}}function Wi(e){return{line:e.line,column:e.column,offset:e.offset}}function Gi(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?Gi(e,r):Ki(e,r)}}function Ki(e,t){let n;for(n in t)if(Vi.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function qi(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+yt({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+yt({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+yt({start:t.start,end:t.end})+`) is still open`)}function Ji(e){let t=this;t.parser=n;function n(n){return Hi(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function Yi(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Xi(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|