@pi-outpost/embed 0.35.2 → 0.36.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/dist/CodeEditor-2Vx8PHAy.js +2790 -0
- package/dist/CodeEditor-Cb6i9oIs.cjs +6 -0
- package/dist/clike-8rZWBES0.cjs +1 -0
- package/dist/clike-D-dOQnrm.js +587 -0
- package/dist/{conversationExport-DU5Xp2g-.js → conversationExport-D8C7qzeU.js} +2 -2
- package/dist/{conversationExport-DwLc0HDC.cjs → conversationExport-DhGnf-eW.cjs} +1 -1
- package/dist/{conversationHistory-DTP8xNqg.cjs → conversationHistory-BtFE4dMu.cjs} +1 -1
- package/dist/{conversationHistory-DHEPfViO.js → conversationHistory-CwYAL6o8.js} +1 -1
- package/dist/dist-B0lO3k1f.js +410 -0
- package/dist/dist-B7I27gkN.cjs +1 -0
- package/dist/dist-B8gmxwh-.cjs +23 -0
- package/dist/dist-BBUKMRrs.js +69 -0
- package/dist/dist-BWlGU9XM.js +395 -0
- package/dist/dist-BZcglaBe.cjs +1 -0
- package/dist/dist-BZjcsPqi.cjs +13 -0
- package/dist/dist-BfQGuM1r.js +1340 -0
- package/dist/dist-BhNvvg0I.js +471 -0
- package/dist/dist-BhXQJ0x3.js +10805 -0
- package/dist/dist-BlD6NhiG.js +296 -0
- package/dist/dist-Bppoi_v9.js +357 -0
- package/dist/dist-BvsCdwbL.cjs +1 -0
- package/dist/dist-C0_uLrCb.cjs +6 -0
- package/dist/dist-C8jjSrIs.cjs +11 -0
- package/dist/dist-C9dtxVRR.cjs +1 -0
- package/dist/dist-CA6ERWRG.js +380 -0
- package/dist/dist-CHKg1Qb9.js +1583 -0
- package/dist/dist-CyFPTQ2l.cjs +1 -0
- package/dist/dist-D8I4FQ-Q.cjs +1 -0
- package/dist/dist-DEl2Ze0j.cjs +2 -0
- package/dist/dist-DJbgM591.cjs +1 -0
- package/dist/dist-DPXHxuWb.js +855 -0
- package/dist/dist-DZrtSp8H.js +607 -0
- package/dist/dist-Dja2VlN5.cjs +1 -0
- package/dist/dist-DqbI0un6.cjs +1 -0
- package/dist/dist-Dr4zY56l.js +440 -0
- package/dist/dist-Dvqp7T4I.cjs +1 -0
- package/dist/dist-FSzij9Rn.js +271 -0
- package/dist/dist-Xjm88mbq.js +756 -0
- package/dist/dist-qNFo_ASR.cjs +9 -0
- package/dist/dist-qq9a_ch2.js +431 -0
- package/dist/dockerfile-4x0UkDoN.js +291 -0
- package/dist/dockerfile-C67wRfne.cjs +1 -0
- package/dist/docxExport-BKC_hi5D.js +67 -0
- package/dist/docxExport-V7joLrkm.cjs +3 -0
- package/dist/{docxExport-BWwEuboU.js → loadReferencedImage-FGse7G4p.js} +538 -306
- package/dist/{docxExport-PjDC4XKL.cjs → loadReferencedImage-QespeGh9.cjs} +7 -9
- package/dist/pi-outpost-embed.cjs +51 -24
- package/dist/pi-outpost-embed.js +3769 -3519
- package/dist/properties-C85NeSsH.js +20 -0
- package/dist/properties-XjDvZYDm.cjs +1 -0
- package/dist/ruby-Bx72aP7E.cjs +1 -0
- package/dist/ruby-CjYBP7RB.js +166 -0
- package/dist/shell-CD1ADQh5.cjs +1 -0
- package/dist/shell-CevoiH_y.js +109 -0
- package/dist/toml-CPJF62TK.js +28 -0
- package/dist/toml-OuUxin0A.cjs +1 -0
- package/package.json +1 -1
- package/dist/loadReferencedImage-C8Hn2ejN.js +0 -268
- package/dist/loadReferencedImage-q-G47ESL.cjs +0 -1
|
@@ -5,7 +5,7 @@ const e=require("./rolldown-runtime-DF3sbh8G.cjs"),t=require("./lib-DVuUFI8o.cjs
|
|
|
5
5
|
`)}}var ee=null;async function te(e){let t=await(ee??=Promise.resolve().then(()=>require("./mermaid.core-4MZ-Iwu7.cjs")).then(e=>e.t));return t.default.initialize({startOnLoad:!1,theme:e,look:`classic`,securityLevel:`strict`,suppressErrorRendering:!0}),t}function x(e){let t=/viewBox="\s*[\d.-]+[\s,]+[\d.-]+[\s,]+([\d.]+)[\s,]+([\d.]+)/.exec(e),n=t?Number(t[1]):NaN;return Number.isFinite(n)&&n>0?n:void 0}function ne(e,t){if(typeof e!=`object`||!e||!(`props`in e))return null;let n=e.props;if(t!==void 0&&!RegExp(`\\blanguage-${t}\\b`).test(n.className??``))return null;let r=n.children;return typeof r==`string`?r:Array.isArray(r)&&r.every(e=>typeof e==`string`)?r.join(``):null}function re(e){let t=ne(e,`mermaid`);return t===null?null:t.trim()}function ie(e){let{children:t,...n}=e,r=re(t);if(r!==null)return(0,i.jsx)(ae,{code:r});let a=ne(t);return a===null?(0,i.jsx)(`pre`,{...n,children:t}):(0,i.jsxs)(`div`,{className:`code-block relative`,"data-testid":`code-block`,children:[(0,i.jsx)(`pre`,{...n,children:t}),(0,i.jsx)(c,{iconOnly:!0,text:a.replace(/\n$/,``),className:`absolute right-1.5 top-1.5 rounded border border-zinc-300 bg-white/80 px-1.5 py-0.5 text-xs text-zinc-500 hover:text-zinc-800 dark:border-zinc-700 dark:bg-zinc-900/80 dark:text-zinc-400 dark:hover:text-zinc-100`})]})}function ae({code:e}){let n=(0,r.useId)().replace(/[^a-zA-Z0-9]/g,``),a=s()===`light`?`default`:`dark`,[o,l]=(0,r.useState)(null),[d,m]=(0,r.useState)(null),[g,_]=(0,r.useState)(!1),[v,b]=(0,r.useState)(!1),ee=(0,r.useMemo)(()=>y(e),[e]),ne=ee===void 0?`landscape`:h(ee.direction),[re,ie]=(0,r.useState)(void 0),ae=o?.svg??null,oe=o!==null&&o.orientation!==ne,se=(0,r.useRef)(null),ce=(0,r.useRef)(e);return ce.current=e,(0,r.useEffect)(()=>{let e=!1,r=setTimeout(()=>void t.g(async()=>{try{let t=(await te(a)).default,r=ce.current,i=y(r),o=i===void 0?`landscape`:h(i.direction);if(re!==void 0&&i!==void 0){let a=re===o?r:i.turned,{svg:s}=await t.render(`mermaid-${n}`,a);e||(l({svg:s,orientation:re}),m(null));return}let s=await t.render(`mermaid-${n}`,r),c={svg:s.svg,orientation:o},u=x(s.svg);if(i!==void 0&&u!==void 0&&u>710){let e=await t.render(`mermaid-${n}-turned`,i.turned),r=x(e.svg);if(r!==void 0){let t=o===`landscape`?p(u,r):p(r,u);t!==o&&(c={svg:e.svg,orientation:t})}}e||(l(c),m(null))}catch(t){e||m(t instanceof Error?t.message:String(t))}}),300);return()=>{e=!0,clearTimeout(r)}},[e,n,a,re]),ae?(0,i.jsxs)(`div`,{ref:se,className:`group relative my-2 rounded-lg border border-zinc-200 bg-zinc-50 p-3 dark:border-zinc-800 dark:bg-zinc-900`,children:[(0,i.jsx)(`div`,{className:`absolute left-2 top-2 z-10 opacity-0 transition-opacity group-hover:opacity-100`,children:(0,i.jsx)(`button`,{type:`button`,onClick:()=>_(!g),title:g?`Show diagram`:`Show code`,className:`rounded px-1.5 py-0.5 text-xs text-zinc-400 hover:bg-zinc-100 hover:text-zinc-700 dark:text-zinc-600 dark:hover:bg-zinc-800 dark:hover:text-zinc-300`,children:g?`⚏ diagram`:`⌗ code`})}),(0,i.jsxs)(`div`,{className:`absolute right-2 top-2 z-10 flex items-center gap-2 opacity-0 transition-opacity group-hover:opacity-100`,children:[!g&&ee!==void 0&&o!==null&&(0,i.jsx)(`button`,{type:`button`,"data-testid":`mermaid-orientation`,onClick:()=>ie(e=>f(e??o.orientation)),title:o.orientation===`portrait`?`Turn it across the page — it is drawn down`:`Turn it down the page — it is drawn across`,"aria-label":`Turn the diagram ${f(o.orientation)}`,className:`rounded px-1.5 py-0.5 text-xs text-zinc-400 hover:bg-zinc-100 hover:text-zinc-700 dark:text-zinc-600 dark:hover:bg-zinc-800 dark:hover:text-zinc-300`,children:o.orientation===`portrait`?`↔ landscape`:`↕ portrait`}),!g&&(0,i.jsx)(`button`,{type:`button`,onClick:()=>b(!0),"aria-label":`Show diagram at full size`,className:`rounded px-1.5 py-0.5 text-xs text-zinc-400 hover:bg-zinc-100 hover:text-zinc-700 dark:text-zinc-600 dark:hover:bg-zinc-800 dark:hover:text-zinc-300`,children:`⤢ enlarge`}),(0,i.jsx)(c,{text:e})]}),g?(0,i.jsx)(`pre`,{className:`overflow-x-auto font-mono text-xs text-zinc-500 dark:text-zinc-400`,children:e}):(0,i.jsx)(`div`,{className:`flex justify-center overflow-x-auto [&_svg]:max-w-full`,dangerouslySetInnerHTML:{__html:ae}}),oe&&!g&&(0,i.jsxs)(`div`,{className:`mt-1 text-center text-xs text-zinc-400 dark:text-zinc-600`,"data-testid":`mermaid-turned`,children:[`drawn `,o?.orientation,` to fit — the source asks for `,ne]}),(0,i.jsx)(u,{label:`diagram`,testId:`mermaid-enlarged`,open:v,onClose:()=>b(!1),anchorRef:se,children:(0,i.jsx)(`div`,{style:{width:x(ae)},className:`[&_svg]:!h-auto [&_svg]:!max-w-none [&_svg]:!w-full`,dangerouslySetInnerHTML:{__html:ae}})})]}):(0,i.jsxs)(`pre`,{className:`my-2 overflow-x-auto rounded-lg border border-zinc-200 bg-zinc-50 p-3 font-mono text-xs text-zinc-500 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-400`,children:[e,d&&(0,i.jsx)(`div`,{className:`mt-2 text-red-600 dark:text-red-400`,children:d})]})}var oe=`urn:structured-exchange:1`,se=[`graph`,`sequence`];function ce(e){return le(e)?[`graph`,`sequence`,`table`]:se}function le(e){return e===`urn:structured-exchange:2`||e===`urn:structured-exchange:3`}function ue(e){if(Array.isArray(e))return{cells:e};let t=e.heading;return typeof t==`string`?{cells:[],role:e.role,heading:t}:{cells:e.cells,role:e.role}}var de={nodes:500,edges:2e3,participants:100,messages:1e3,columns:50,rows:5e3,removals:500,ref:200,localId:200,label:500,kind:100,kindsPerVocabulary:64,columnName:200,cell:1e3},fe=`urn:structured-exchange:2`,pe={profile:200,attributesPerItem:50,removeAttributesPerItem:50,attributeName:200,attributeString:1e3,attributeListItems:50,revision:200,locationsPerItem:10,uri:2e3,position:1e6,artifactsPerItem:20,artifactsPerDocument:50,artifactRel:100,artifactMediaType:100,artifactLabel:500,artifactDigest:71,relations:2e3,heading:500,headingDepth:6,viewpoints:20,viewpointConcern:500},me=8e6,he=`urn:structured-exchange:3`,ge=[oe,fe,he];function _e(e){return ge.find(t=>t===e)}var ve=4e6,ye=Math.max(ve,me);function be(e){return le(e)?me:ve}var xe=e=>new TextEncoder().encode(e).length;function Se(e){return e===`bytes`?ye:e===`relations`?pe.relations:de[e]}function Ce(e,t){let n=Se(e),r=t?.[e];return r===void 0||r>=n?{limit:n,level:`ceiling`}:{limit:r,level:`deployment`}}function we(e,t,n){let r=xe(e),i=Ce(`bytes`,t),a=n===void 0?1/0:be(n),o=Math.min(i.limit,a),s=o===a&&a<i.limit?`ceiling`:i.level;if(!(r<=o))return{rule:`document-too-large`,path:``,message:`document is ${r} bytes, past the ${o}-byte ${s===`ceiling`?`contract ceiling`:`limit this deployment applies`}`,limit:o,observed:r,level:s}}var Te={graph:[`nodes`,`edges`],sequence:[`participants`,`messages`],table:[`columns`,`rows`,`relations`]};function Ee(e,t){if(t===void 0)return[];let n=[];for(let r of Te[e.kind]??[]){let i=e.data[r];if(!Array.isArray(i))continue;let{limit:a,level:o}=Ce(r,t);o===`deployment`&&i.length>a&&n.push({rule:`collection-past-deployment-limit`,path:`/data/${r}`,message:`${r} has ${i.length} entries, past the ${a} this deployment allows`,limit:a,observed:i.length,level:o})}return n}function De(e,t){let n={};for(let t of Te[e.kind]??[]){let r=e.data[t];Array.isArray(r)&&(n[t]=r.length)}return{kind:e.kind,bytes:xe(t),counts:n}}var Oe=6.6,ke=5.4;function Ae(e,t,n){let r=e.flatMap(e=>e.split(/\r?\n/)).reduce((e,t)=>Math.max(e,t.length),0);return Math.min(Math.max(r*Oe+22,t),n)}function je(e,t,n,r){let i=t.map(e=>Fe(e).length).reduce((e,t)=>Math.max(e,t),0);return Math.max(Ae(e,n,r),Math.min(i*ke+22,r))}function Me(e,t,n=Oe){let r=Math.max(Math.floor((t-22)/n+1e-6),4),i=[],a=e.split(/\r?\n/);if(a.length>1)return a.flatMap(e=>Me(e,t,n)).slice(0,3);let o=``;for(let t of e.split(/\s+/)){let e=o===``?t:`${o} ${t}`;if(e.length<=r){o=e;continue}for(o!==``&&i.push(o),o=t;o.length>r&&i.length<3;)i.push(o.slice(0,r)),o=o.slice(r)}if(o!==``&&i.push(o),i.length===0)return[``];if(i.length<=3)return i;let s=i.slice(0,3);return s[2]=`${s[2].slice(0,Math.max(r-1,1))}…`,s}function Ne(e,t){return e*15+t*15+14}function Pe(e,t){return e.flatMap(e=>Me(Fe(e),t,ke))}function Fe(e){return`${e.field}: ${e.from===void 0?``:`${e.from} → `}${e.to}`}function Ie(e,t){return`${e}: ${Le(t)}`}function Le(e){return Array.isArray(e)?e.map(e=>Le(e)).join(`, `):e===null?`null`:typeof e==`object`&&e&&typeof e.ref==`string`?`<${e.ref}>`:String(e)}function Re(e){let t=e.range===void 0?``:` lines ${e.range.startLine}–${e.range.endLine}`,n=e.revision===void 0?``:` at ${e.revision}`;return`${e.uri}${t}${n}`}function ze(e){let t=e.label===void 0?e.uri:`${e.label} (${e.uri})`,n=e.mediaType===void 0?``:`, ${e.mediaType}`;return`${e.rel}: ${t}${n} — ${e.sha256.slice(0,14)}…`}var Be=864e5,Ve=/^(\d{4})-(\d{2})-(\d{2})$/;function He(e){let t=Ve.exec(e);if(t===null)return;let[n,r,i]=[Number(t[1]),Number(t[2]),Number(t[3])],a=new Date(Date.UTC(n,r-1,i));if(a.setUTCFullYear(n,r-1,i),a.getUTCFullYear()===n&&a.getUTCMonth()===r-1&&a.getUTCDate()===i)return Math.round(a.getTime()/Be)}function Ue(e){let t=new Date(e*Be);return`${String(t.getUTCFullYear()).padStart(4,`0`)}-${String(t.getUTCMonth()+1).padStart(2,`0`)}-${String(t.getUTCDate()).padStart(2,`0`)}`}function We(e=new Date){return Math.round(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())/Be)}function Ge(e){let t=He(e.type===`activity`?e.start:e.date),n=He(e.type===`activity`?e.end:e.date);return t===void 0||n===void 0?void 0:{start:t,end:n}}function Ke(e){let t=new Map;return e.rows.forEach((e,n)=>{e.type===`task`&&(t.has(e.id)||t.set(e.id,{id:e.id,type:`task`,row:n,days:qe(e)}),e.items.forEach((e,r)=>{e.id===void 0||t.has(e.id)||t.set(e.id,{id:e.id,type:e.type,row:n,item:r,days:Ge(e)})}))}),t}function qe(e){let t;for(let n of e.items){let e=Ge(n);e!==void 0&&(t=t===void 0?{...e}:{start:Math.min(t.start,e.start),end:Math.max(t.end,e.end)})}return t}function Je(e){return e.type??`finish-to-start`}function Ye(e){return{from:e.startsWith(`finish`)?`end`:`start`,to:e.endsWith(`finish`)?`end`:`start`}}function Xe(e,t){let n=t.get(e.from)?.days,r=t.get(e.to)?.days;if(n===void 0||r===void 0)return;let i=Ye(Je(e));return r[i.to]>=n[i.from]}function Ze(e){if(`date`in e){let t=He(e.date)??0;return{start:t,end:t}}return{start:He(e.start)??0,end:He(e.end)??0}}function Qe(e){if(e.previous===void 0)return;let t=Ze(e.type===`activity`?{start:e.start,end:e.end}:{date:e.date}),n=Ze(e.previous);return{start:t.start-n.start,end:t.end-n.end}}function $e(e){if(e===0)return``;let t=e>0?`+`:`−`,n=Math.abs(e);return n<14?`${t}${n}d`:n<70?`${t}${Math.round(n/7)}w`:`${t}${Math.round(n/30.44)}mo`}function et(e){let t=Qe(e);return t===void 0?``:t.start===t.end?$e(t.start):t.start===0?`end${$e(t.end)}`:t.end===0?`start${$e(t.start)}`:`${$e(t.start)}, end${$e(t.end)}`}function tt(e,t){if(e.role!==void 0||t?.role!==void 0)return!0;let n=Qe(e);return n!==void 0&&(n.start!==0||n.end!==0)}function nt(e){return e.role!==void 0||e.items.some(t=>tt(t,e))}var rt={week:12,month:4,quarter:.75};function it(e,t){let n=e>=8?`week`:e>=1?`month`:`quarter`;if(t===void 0)return n;let r=[`week`,`month`,`quarter`];return r[Math.max(r.indexOf(n),r.indexOf(t))]}var at=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function ot(e){return e.width>=24?e.label:e.width>=9?e.label.charAt(0):``}function st(e,t){return t===`month`?ot(e):e.width>=e.label.length*6+4?e.label:``}function ct(e){return((e+3)%7+7)%7}function lt(e){let t=e-ct(e)+3,n=new Date(t*Be).getUTCFullYear();return Math.floor((t-pt(n,0))/7)+1}function ut(e){if(e.label!==void 0&&e.label!==``)return e.label;if(e.type===`milestone`&&e.kind!==void 0&&e.kind!==``)return e.kind}function dt(e){return e.length*Oe}function ft(e,t){let n=new Date(e*Be),r=n.getUTCFullYear(),i=n.getUTCMonth(),a=[];for(;;){i+=1,i===12&&(i=0,r+=1);let e=pt(r,i);if(e>t)return a;a.push({day:e,year:r,month:i})}}function pt(e,t){let n=new Date(0);return n.setUTCFullYear(e,t,1),Math.round(n.getTime()/Be)}function mt(e,t){let n=e=>e===`bar`||e===`ghost`;return n(e)&&t===`star`||e===`star`&&n(t)}function ht(e,t){return e.x0<t.x1&&t.x0<e.x1}function gt(e,t){if(t<=0||e.width<=t)return;let n=e.items.filter(e=>e.change!==void 0);if(n.length>0){let e=Math.min(...n.flatMap(e=>e.ghost===void 0?[e.glyph.x]:[e.glyph.x,e.ghost.x]));return e<t*.9?void 0:Math.max(0,e-t/6)}if(`x`in e.today&&e.today.x>t*.8)return Math.max(0,e.today.x-t/3)}function _t(e,t,n={}){let r=He(e.time.start)??0,i=He(e.time.end)??r,a=n.pxPerDay??rt[e.time.scale]??4,o=(i-r+1)*a,s=e=>(e-r)*a,c=ft(r,i),l=new Date(r*Be),u=[{day:r,year:l.getUTCFullYear(),month:l.getUTCMonth()},...c],d=u.map((e,t)=>{let n=t+1<u.length?u[t+1].day:i+1;return{label:at[e.month],x:s(e.day),width:(n-e.day)*a,year:e.year,month:e.month}}),f=[];u.forEach((e,t)=>{let n=d[t],r=f[f.length-1];r!==void 0&&r.label===String(e.year)?r.width+=n.width:f.push({label:String(e.year),x:n.x,width:n.width})});let p=it(a,n.unit),m=(e,t)=>e.map((n,r)=>{let o=r+1<e.length?e[r+1]:i+1;return{label:t(n),x:s(n),width:(o-n)*a}}),h=f,g;if(p===`week`){let e=[];for(let t=r-ct(r)+7;t<=i;t+=7)e.push(t);g=m([r,...e],e=>`W${lt(e)}`),h=d.map(e=>({label:`${e.label} ${e.year}`,x:e.x,width:e.width}))}else if(p===`quarter`){let e=u.filter((e,t)=>t===0||e.month%3==0);g=e.map((t,n)=>{let r=n+1<e.length?e[n+1].day:i+1;return{label:`Q${Math.floor(t.month/3)+1}`,x:s(t.day),width:(r-t.day)*a}})}else g=d;let _=g.slice(1).map(e=>e.x),v=[],y=[],b=0,ee=e.comparedTo!==void 0,te=(e,t)=>{if(!ee)return;if(e.role===`added`||t.role===`added`)return`(new)`;let n=et(e);return n===``?void 0:`(${n})`},x=(e,t,n)=>{let r=te(e,t);return r===void 0?n:n===void 0?r:`${n} ${r}`},ne=(e,t)=>{if(ee)return e.role===`removed`||t.role===`removed`?`removed`:e.role===`added`||t.role===`added`?`added`:et(e)===``?void 0:`moved`},re=(e,t)=>{let n=[],r=[],i=[],c=e.map(e=>({...e,days:Ge(e.item)})).filter(e=>e.days!==void 0).sort((e,t)=>Number(e.item.type===`milestone`)-Number(t.item.type===`milestone`)||e.days.start-t.days.start||e.row-t.row||e.index-t.index);for(let{item:e,index:t,row:l,days:u,text:d,note:f,change:p}of c){let c=[],m;if(p===`moved`&&e.previous!==void 0){let t=Ze(e.previous);if(e.type===`activity`)m={x0:s(t.start),x1:s(t.end+1)};else{let e=s(t.start)+a/2;m={x0:e-7,x1:e+7,cx:e}}c.push({kind:`ghost`,x0:m.x0,x1:m.x1})}let h,g,_,v;if(e.type===`activity`){if(g=s(u.start),_=s(u.end+1),c.push({kind:`bar`,x0:g,x1:_}),d!==void 0){let e=dt(d);h=e+12<=_-g?{text:d,inside:!0,x:g+6,width:e}:vt(d,g,_,o),f!==void 0&&(h.note=f),c.push({kind:`label`,x0:h.x,x1:h.x+h.width})}}else v=s(u.start)+a/2,g=v-7,_=v+7,c.push({kind:`star`,x0:g,x1:_}),d!==void 0&&(h=vt(d,g,_,o),f!==void 0&&(h.note=f),c.push({kind:`label`,x0:h.x,x1:h.x+h.width}));let y=n.findIndex(e=>c.every(t=>e.every(e=>mt(t.kind,e.kind)||!ht(t,e))));y===-1&&(y=n.length,n.push([])),n[y].push(...c),r.push({row:l,item:t,type:e.type,lane:y,days:u,...e.kind?{kind:e.kind}:{},...p===void 0?{}:{change:p}}),i.push({label:h===void 0?void 0:{...h,...p===`removed`?{struck:!0}:{}},x0:g,x1:_,cx:v,ghost:m})}return r.forEach((e,n)=>{let r=i[n],a=t+4+e.lane*24+12,o=e.type===`activity`?{x:r.x0,y:a-6,width:r.x1-r.x0,height:12}:{x:r.x0,y:a-7,width:14,height:14},s=r.ghost;y.push({...e,glyph:o,...r.cx===void 0?{}:{center:{x:r.cx,y:a}},...r.label===void 0?{}:{label:{...r.label,y:a-8,height:16}},...s===void 0?{}:e.type===`activity`?{ghost:{x:s.x0,y:a-6,width:s.x1-s.x0,height:12}}:{ghost:{x:s.x0,y:a-7,width:14,height:14},ghostCenter:{x:s.cx,y:a}}})}),Math.max(1,n.length)},ie=e=>e*24+8,ae=(e,t)=>{let n=re(e.items.map((n,r)=>({row:t,index:r,item:n,text:x(n,e,ut(n)),note:te(n,e),change:ne(n,e)})),b),r=ie(n);v.push({type:`task`,row:t,y:b,height:r,lanes:n,label:e.label,id:e.id}),b+=r},oe,se=()=>{if(oe!==void 0){if(oe.tasks.length===0){let e=oe.label?26:10;v.push({type:`separator`,row:oe.row,y:b,height:e,...oe.label?{label:oe.label}:{}}),b+=e}else{let e=re(oe.tasks.flatMap(({task:e,row:t})=>e.items.map((n,r)=>({row:t,index:r,item:n,text:x(n,e,ut(n)??(n.type===`activity`?e.label:void 0)),note:te(n,e),change:ne(n,e)}))),b),t=ie(e);v.push({type:`section`,row:oe.row,y:b,height:t,lanes:e,...oe.label?{label:oe.label}:{},tasks:oe.tasks.map(({task:e})=>e.id)}),b+=t}oe=void 0}},ce=(()=>{let t=new Set;if(!(n.onlyChanged&&ee))return;let r;return e.rows.forEach((e,n)=>{e.type===`separator`?r=n:nt(e)&&(t.add(n),r!==void 0&&t.add(r))}),t})(),le=ce===void 0?0:e.rows.filter((e,t)=>e.type===`task`&&!ce.has(t)).length;e.rows.forEach((e,t)=>{if(!(ce!==void 0&&!ce.has(t))){if(e.type===`separator`){if(n.compact){se(),oe={row:t,...e.label?{label:e.label}:{},tasks:[]};return}let r=e.label?26:10;v.push({type:`separator`,row:t,y:b,height:r,...e.label?{label:e.label}:{}}),b+=r;return}oe===void 0?ae(e,t):oe.tasks.push({task:e,row:t})}}),se();let ue=[];for(let t of e.rows)if(t.type===`task`)for(let e of t.items)e.kind&&!ue.includes(e.kind)&&ue.push(e.kind);for(let t of[...e.periods??[],...e.references??[]])t.kind&&!ue.includes(t.kind)&&ue.push(t.kind);let de=[];(e.periods??[]).forEach((e,t)=>{let n=Math.max(He(e.start)??r,r),o=Math.min(He(e.end)??i,i);n>o||de.push({index:t,x:s(n),width:(o-n+1)*a,start:e.start,end:e.end,...e.label?{label:e.label}:{},...e.kind?{kind:e.kind}:{}})});let fe=(e.references??[]).flatMap((e,t)=>{let n=He(e.date);return n===void 0||n<r||n>i?[]:[{index:t,x:s(n)+a/2,label:e.label,date:e.date,...e.kind?{kind:e.kind}:{}}]}),pe=[];if(t>=r&&t<=i){let e=s(t)+a/2;pe.push({x0:e-26,x1:e+26})}let me=[],he=[...de.filter(e=>e.label).map(e=>({of:`period`,index:e.index,text:e.label,x:e.x+3,room:e.width-6})),...fe.map(e=>{let t=dt(e.label)*(10/11);return{of:`reference`,index:e.index,text:e.label,x:Math.min(Math.max(2,e.x-t/2),o-t-2),room:o-4}})].sort((e,t)=>e.x-t.x);for(let e of he){let t=dt(e.text)*(10/11);if(t>e.room)continue;let n={x0:e.x-2,x1:e.x+t+2};pe.some(e=>n.x0<e.x1&&e.x0<n.x1)||(pe.push(n),me.push({of:e.of,index:e.index,text:e.text,x:e.x,width:t}))}return{width:o,height:b,start:r,end:i,years:f,months:d,monthLines:c.map(e=>s(e.day)),unit:p,upper:h,lower:g,unitLines:_,rows:v,items:y,dependencies:yt(e,v,y,s),today:t<r?{outside:`before`,day:t}:t>i?{outside:`after`,day:t}:{x:s(t)+a/2,day:t},kinds:ue,hiddenTasks:le,periods:de,references:fe,headerLabels:me}}function vt(e,t,n,r){let i=dt(e),a=n+4;if(a+i<=r)return{text:e,inside:!1,x:a,width:i};let o=t-4-i;return o>=0?{text:e,inside:!1,x:o,width:i}:{text:e,inside:!1,x:Math.max(0,r-i),width:i}}function yt(e,t,n,r){let i=Ke(e),a=new Map(n.map(e=>[`${e.row}:${e.item}`,e])),o=new Map(t.map(e=>[e.row,e])),s=(e,t)=>{let s=i.get(e);if(s?.days===void 0)return;if(s.item!==void 0){let e=a.get(`${s.row}:${s.item}`);if(e===void 0)return;let n=e.glyph.y+e.glyph.height/2;return e.center===void 0?{x:t===`start`?e.glyph.x:e.glyph.x+e.glyph.width,y:n}:{x:e.center.x+(t===`start`?-7:7),y:n}}let c=r(t===`start`?s.days.start:s.days.end+1),l=o.get(s.row);if(l!==void 0&&l.type===`task`)return{x:c,y:l.y+4+12};let u=n.filter(e=>e.row===s.row).sort((e,n)=>t===`start`?e.glyph.x-n.glyph.x:n.glyph.x+n.glyph.width-(e.glyph.x+e.glyph.width));if(u.length!==0)return{x:c,y:u[0].glyph.y+u[0].glyph.height/2}},c=[];return(e.dependencies??[]).forEach((e,t)=>{let n=Je(e),r=Ye(n),a=s(e.from,r.from),o=s(e.to,r.to),l=Xe(e,i);if(a===void 0||o===void 0||l===void 0)return;let u={x:a.x+(r.from===`end`?8:-8),y:a.y},d={x:o.x+(r.to===`start`?-8:8),y:o.y};if(a.y===o.y&&r.from===`end`&&r.to===`start`&&o.x>=a.x-14){c.push({index:t,from:e.from,to:e.to,type:n,satisfied:l,points:[a,o]});return}let f=o.y>a.y?o.y-12:(o.y,a.y,o.y+12);c.push({index:t,from:e.from,to:e.to,type:n,satisfied:l,points:[a,u,{x:u.x,y:f},{x:d.x,y:f},d,o]})}),c}function bt(e){let t=e.rows.reduce((e,t)=>Math.max(e,(t.label??``).length),0);return Math.min(Math.max(t*Oe+24,120),280)}function xt(e,t){for(let n of e.rows){if(n.type!==`task`)continue;if(n.id===t)return`"${n.label}" (${t})`;let e=n.items.find(e=>e.id===t);if(e!==void 0){let n=ut(e);return n===void 0?t:`"${n}" (${t})`}}return t}function St(e,t,n){let r=n===!1?` — not satisfied by the dates`:``;return`${xt(e,t.to)} waits on ${xt(e,t.from)} (${Je(t)})${r}`}function Ct(e){let t=[];e.title!==void 0&&e.title!==``&&t.push(e.title),e.comparedTo!==void 0&&t.push(`Compared with ${e.comparedTo.label}${e.comparedTo.date===void 0?``:` (${e.comparedTo.date})`}`),t.push(`From ${e.time.start} to ${e.time.end}, by ${e.time.scale}`);for(let n of e.rows){if(t.push(``),n.type===`separator`){t.push(n.label?`— ${n.label} —`:`———`);continue}let e=n.role===void 0?``:n.role===`added`?` — new`:` — removed`;t.push(`${n.label} [${n.id}]${n.items.length===0?` — no items`:``}${e}`);for(let e of n.items){let n=e.type===`activity`?`${e.start} to ${e.end}`:e.date,r=e.label===void 0?``:`: ${e.label}`,i=e.kind===void 0?``:` [${e.kind}]`,a=e.id===void 0?``:` (${e.id})`,o=(()=>{if(e.role===`added`)return` — new`;if(e.role===`removed`)return` — removed`;let t=et(e);return t===``||e.previous===void 0?``:` — moved ${t}, was ${`date`in e.previous?e.previous.date:`${e.previous.start} to ${e.previous.end}`}`})();t.push(` ${e.type} ${n}${r}${i}${a}${o}`)}}let n=[...(e.periods??[]).map(e=>` period ${e.start} to ${e.end}${e.label?`: ${e.label}`:``}${e.kind?` [${e.kind}]`:``}`),...(e.references??[]).map(e=>` reference ${e.date}: ${e.label}${e.kind?` [${e.kind}]`:``}`)];n.length>0&&t.push(``,`Calendar`,...n);let r=e.dependencies??[];if(r.length>0){let n=Ke(e);t.push(``,`Dependencies`);for(let i of r)t.push(` ${St(e,i,Xe(i,n))}`)}return t}function wt(e){let t=[],n=(e,n)=>{let r=He(e);return r===void 0&&t.push({rule:`invalid-date`,path:n,message:`"${e}" is not a day of the calendar`}),r},r=n(e.time.start,`/data/time/start`),i=n(e.time.end,`/data/time/end`),a=r!==void 0&&i!==void 0&&r<=i?{start:r,end:i}:void 0;r!==void 0&&i!==void 0&&r>i&&t.push({rule:`inverted-range`,path:`/data/time`,message:`the timeline starts on ${e.time.start}, after it ends on ${e.time.end}`});let o=`${e.time.start} to ${e.time.end}`,s=new Map,c=(e,n)=>{if(e===void 0)return;let r=s.get(e);r===void 0?s.set(e,n):t.push({rule:`duplicate-identifier`,path:`${n}/id`,message:`identifier "${e}" is already declared at ${r}`})},l=e.comparedTo!==void 0;e.comparedTo?.date!==void 0&&n(e.comparedTo.date,`/data/comparedTo/date`);let u=e=>t.push({rule:`comparison-without-reference`,path:e,message:"previous dates and change roles describe a comparison; declare `comparedTo` naming the plan they compare with"}),d=new Set;return e.rows.forEach((e,r)=>{if(e.type!==`task`)return;let i=`/data/rows/${r}`;c(e.id,i),e.role!==void 0&&!l&&u(`${i}/role`),e.items.forEach((r,s)=>{let f=`${i}/items/${s}`;if(c(r.id,f),r.kind!==void 0&&d.add(r.kind),r.role!==void 0&&!l&&u(`${f}/role`),r.previous!==void 0){l||u(`${f}/previous`),(r.role!==void 0||e.role!==void 0)&&t.push({rule:`contradictory-change`,path:`${f}/previous`,message:`an item that is ${r.role??`in a task that is ${e.role}`} has no previous dates; it is new or dropped, not moved`});let i=r.previous,s=r.type===`activity`?{first:n(i.start,`${f}/previous/start`),last:n(i.end,`${f}/previous/end`)}:(()=>{let e=n(i.date,`${f}/previous/date`);return{first:e,last:e}})();s.first!==void 0&&s.last!==void 0&&(s.first>s.last?t.push({rule:`inverted-range`,path:`${f}/previous`,message:`the previous dates start on ${i.start}, after they end on ${i.end}`}):a!==void 0&&(s.first<a.start||s.last>a.end)&&t.push({rule:`item-outside-range`,path:`${f}/previous`,message:`the previous dates fall outside the timeline's range ${o}; the range covers both plans, so widen \`time\``}))}r.role!==void 0&&e.role!==void 0&&r.role!==e.role&&t.push({rule:`contradictory-change`,path:`${f}/role`,message:`an item ${r.role} in a task that is ${e.role}`});let p,m;if(r.type===`activity`){if(p=n(r.start,`${f}/start`),m=n(r.end,`${f}/end`),p!==void 0&&m!==void 0&&p>m){t.push({rule:`inverted-range`,path:f,message:`the activity starts on ${r.start}, after it ends on ${r.end}`});return}}else p=m=n(r.date,`${f}/date`);a!==void 0&&p!==void 0&&m!==void 0&&(p<a.start||m>a.end)&&t.push({rule:`item-outside-range`,path:f,message:r.type===`activity`?`the activity runs ${r.start} to ${r.end}, outside the timeline's range ${o}; widen \`time\` or move the activity`:`the milestone falls on ${r.date}, outside the timeline's range ${o}; widen \`time\` or move the milestone`})})}),(e.periods??[]).forEach((e,r)=>{let i=`/data/periods/${r}`;e.kind!==void 0&&d.add(e.kind);let s=n(e.start,`${i}/start`),c=n(e.end,`${i}/end`);s!==void 0&&c!==void 0&&(s>c?t.push({rule:`inverted-range`,path:i,message:`the period starts on ${e.start}, after it ends on ${e.end}`}):a!==void 0&&(c<a.start||s>a.end)&&t.push({rule:`period-outside-range`,path:i,message:`the period ${e.start} to ${e.end} lies wholly outside the timeline's range ${o}, so nothing of it could be drawn`}))}),(e.references??[]).forEach((e,r)=>{let i=`/data/references/${r}`;e.kind!==void 0&&d.add(e.kind);let s=n(e.date,`${i}/date`);s!==void 0&&a!==void 0&&(s<a.start||s>a.end)&&t.push({rule:`item-outside-range`,path:i,message:`the reference date ${e.date} is outside the timeline's range ${o}; widen \`time\` or move it`})}),d.size>de.kindsPerVocabulary&&t.push({rule:`too-many-kinds`,path:`/data/rows`,message:`${d.size} distinct item types, and no more than ${de.kindsPerVocabulary} can be told apart in a rendering`,observed:d.size,limit:de.kindsPerVocabulary}),t.push(...Et(e,Ke(e))),t.push(...Tt(e)),t}function Tt(e){let t=new Set;for(let n of e.rows)if(n.type===`task`){n.role===`removed`&&t.add(n.id);for(let e of n.items)e.id!==void 0&&(e.role===`removed`||n.role===`removed`)&&t.add(e.id)}let n=[];return(e.dependencies??[]).forEach((e,r)=>{for(let i of[`from`,`to`])t.has(e[i])&&n.push({rule:`dependency-on-removed`,path:`/data/dependencies/${r}/${i}`,message:`"${e[i]}" was dropped from the plan, so nothing can depend on it any more; remove the dependency`})}),n}function Et(e,t){let n=[],r=e.dependencies??[],i=[],a=new Map;r.forEach((r,o)=>{let s=`/data/dependencies/${o}`,c=!0;for(let i of[`from`,`to`]){let a=r[i],o=t.get(a);if(o===void 0)c=!1,n.push({rule:`unresolved-endpoint`,path:`${s}/${i}`,message:`"${a}" is not the identifier of any task or item this timeline declares`});else if(o.type===`task`&&o.days===void 0){c=!1;let t=e.rows[o.row];if(t.type===`task`&&t.items.length>0)continue;n.push({rule:`empty-task-endpoint`,path:`${s}/${i}`,message:`task "${a}" holds no item, so it has no start or finish for a dependency to link`})}}if(!c)return;let l=t.get(r.from),u=t.get(r.to),d=(e,t)=>e.type===`task`&&t.type!==`task`&&t.row===e.row;if(l.id===u.id||d(l,u)||d(u,l)){n.push({rule:`self-dependency`,path:s,message:l.id===u.id?`"${l.id}" cannot depend on itself`:`a task and one of its own items cannot depend on each other: the task's span is made of its items`});return}let f=JSON.stringify([r.from,r.to,Je(r)]),p=a.get(f);if(p!==void 0){n.push({rule:`duplicate-dependency`,path:s,message:`the same dependency is already declared at /data/dependencies/${p}`});return}a.set(f,o),i.push({from:r.from,to:r.to,index:o})});let o=Dt(i);return o!==void 0&&n.push({rule:`dependency-cycle`,path:`/data/dependencies/${o.index}`,message:`dependencies form a cycle, which no dates can honour: ${o.ids.join(` → `)}`}),n}function Dt(e){let t=new Map;for(let n of e){let e=t.get(n.from)??[];e.push({to:n.to,index:n.index}),t.set(n.from,e)}let n=new Map,r=[];for(let e of t.keys()){if(n.has(e))continue;let i=[{id:e,next:0}];for(n.set(e,`open`),r.push({id:e,index:-1});i.length>0;){let e=i[i.length-1],a=t.get(e.id)??[];if(e.next>=a.length){n.set(e.id,`done`),i.pop(),r.pop();continue}let o=a[e.next++],s=n.get(o.to);if(s===`open`){let e=r.findIndex(e=>e.id===o.to);return{ids:[...r.slice(e).map(e=>e.id),o.to],index:o.index}}s===void 0&&(n.set(o.to,`open`),i.push({id:o.to,next:0}),r.push({id:o.to,index:o.index}))}}}function Ot(e){let t=e.data;return e.kind===`graph`?Array.isArray(t.nodes)&&Array.isArray(t.edges):e.kind===`sequence`?Array.isArray(t.participants)&&Array.isArray(t.messages):e.kind===`timeline`?typeof t.time==`object`&&t.time!==null&&Array.isArray(t.rows):Array.isArray(t.columns)&&Array.isArray(t.rows)}function kt(e){return e.kind===`graph`?e.data.nodes:e.kind===`sequence`?e.data.participants:[]}function At(e){return e.kind===`graph`?e.data.edges:e.kind===`sequence`?e.data.messages:[]}function jt(e){return e.kind===`graph`||e.kind===`sequence`?e.data.containers??[]:[]}function Mt(e){return e.kind===`graph`?`/data/nodes`:`/data/participants`}function Nt(e){return e.kind===`graph`?`/data/edges`:`/data/messages`}function Pt(e){if(e.kind===`timeline`)return[];let t=e.data,n=[];for(let e of[`nodes`,`edges`,`participants`,`messages`,`rows`,`relations`]){let r=t[e];Array.isArray(r)&&r.forEach((t,r)=>{if(typeof t!=`object`||!t||Array.isArray(t))return;let i=t;n.push({at:`/data/${e}/${r}`,ref:typeof i.ref==`string`?i.ref:void 0,set:i.set,expect:i.expect,locations:i.locations})})}return n}function Ft(e){if(e.kind!==`table`)return[];let t=e.data.rows,n=[];return t.forEach((e,t)=>{if(typeof e!=`object`||!e||Array.isArray(e))return;let r=e;(r.ref!==void 0||r.set!==void 0)&&n.push({at:`/data/rows/${t}`,...typeof r.ref==`string`?{ref:r.ref}:{},...r.set===void 0?{}:{set:r.set}})}),n}function It(e){if(e.kind!==`table`)return[];let t=e.data.rows,n=[];return t.forEach((e,t)=>{if(typeof e!=`object`||!e||Array.isArray(e))return;let r=e.id;typeof r==`string`&&n.push({id:r,at:`/data/rows/${t}`})}),n}function Lt(e){if(e.kind!==`table`)return[];let t=e.data.relations;return Array.isArray(t)?t:[]}function Rt(e,t){return e===`timeline`?`a timeline is maintained by presenting the revised timeline again, not proposed as a change, ${t}`:`a ${e} is a projection and cannot be proposed, ${t}`}function zt(e){let t=[];if(!Ot(e))return t.push({rule:`kind-data-mismatch`,path:`/data`,message:`data does not carry what kind "${e.kind}" declares`}),t;let n=ce(e.schema).includes(e.kind);e.target!==void 0&&!n&&t.push({rule:`kind-not-proposable`,path:`/target`,message:Rt(e.kind,`so it carries no target`)}),e.removals!==void 0&&(n?e.target===void 0&&t.push({rule:`removal-without-target`,path:`/removals`,message:`removals need a target: an artifact that does not exist yet has nothing to remove`}):t.push({rule:`kind-not-proposable`,path:`/removals`,message:Rt(e.kind,`so it declares no removals`)}));let r=kt(e),i=Mt(e),a=new Map;r.forEach((e,n)=>{let r=a.get(e.id);r===void 0?a.set(e.id,n):t.push({rule:`duplicate-identifier`,path:`${i}/${n}/id`,message:`identifier "${e.id}" is already declared at ${i}/${r}`})});let o=new Map;jt(e).forEach((e,n)=>{let r=o.get(e.id);r===void 0?o.set(e.id,n):t.push({rule:`duplicate-container-identifier`,path:`/data/containers/${n}/id`,message:`container "${e.id}" is already declared at /data/containers/${r}`})}),r.forEach((e,n)=>{for(let[r,a]of[[`container`,e.container],[`set/container`,e.set?.container]])a!==void 0&&!o.has(a)&&t.push({rule:`unresolved-container`,path:`${i}/${n}/${r}`,message:`"${a}" is not a container declared in /data/containers`})});let s=Nt(e);At(e).forEach((e,n)=>{for(let r of[`from`,`to`]){let o=e[r];a.has(o)||t.push({rule:`unresolved-endpoint`,path:`${s}/${n}/${r}`,message:`"${o}" is not an identifier declared in ${i}`})}});let c=new Map,l=(e,n,r)=>{if(n===void 0)return;let i=`${e}:${n}`,a=c.get(i);a===void 0?c.set(i,r):t.push({rule:`duplicate-reference`,path:r,message:`${e} "${n}" is already addressed at ${a}; a proposal states one intention per thing`})};r.forEach((e,t)=>l(`element`,e.ref,`${i}/${t}`)),At(e).forEach((e,t)=>l(`relationship`,e.ref,`${s}/${t}`)),Ft(e).forEach(e=>l(`row`,e.ref,e.at)),(e.removals??[]).forEach((e,t)=>l(e.type,e.ref,`/removals/${t}`));let u=[...r.map((e,t)=>({at:`${i}/${t}`,ref:e.ref,set:e.set})),...At(e).map((t,n)=>({at:`${Nt(e)}/${n}`,ref:t.ref,set:t.set})),...Ft(e)];for(let r of u)r.set!==void 0&&(r.ref===void 0?t.push({rule:`change-without-reference`,path:`${r.at}/set`,message:`a change names a reference to change; without one this is a new thing, and its fields are its values`}):n?e.target===void 0&&t.push({rule:`change-without-target`,path:`${r.at}/set`,message:`a change needs a target: naming what is being changed is what makes this a proposal rather than a new artifact`}):t.push({rule:`kind-not-proposable`,path:`${r.at}/set`,message:Rt(e.kind,`so nothing in it declares a change`)}));let d=e=>{let t=new Set;for(let n of e)n.kind!==void 0&&n.kind!==``&&t.add(n.kind);return t},f=[[e.kind===`sequence`?`participant`:`element`,i,d(r)],[e.kind===`sequence`?`message`:`relationship`,Nt(e),d(At(e))]];for(let[e,n,r]of f)r.size>de.kindsPerVocabulary&&t.push({rule:`too-many-kinds`,path:n,message:`${r.size} distinct ${e} types, and no more than ${de.kindsPerVocabulary} can be told apart in a rendering`,observed:r.size,limit:de.kindsPerVocabulary});let p=e.viewpoints;if(Array.isArray(p)){if(e.kind!==`graph`)t.push({rule:`viewpoints-without-graph`,path:`/viewpoints`,message:`only a graph declares viewpoints; a ${e.kind} has no element and relationship kinds for one to retain`});else{let n=new Set(r.map(e=>e.kind).filter(e=>!!e)),i=new Set(At(e).map(e=>e.kind).filter(e=>!!e)),a=new Map;p.forEach((e,r)=>{let o=`/viewpoints/${r}`,{id:s,elementKinds:c,relationshipKinds:l}=e,u=a.get(s);u===void 0?a.set(s,r):t.push({rule:`duplicate-viewpoint-identifier`,path:`${o}/id`,message:`viewpoint "${s}" is already declared at /viewpoints/${u}`}),c===void 0&&l===void 0&&t.push({rule:`empty-viewpoint`,path:o,message:`viewpoint "${s}" retains no kind, so it would show nothing it was not already showing; name elementKinds, relationshipKinds, or both`});let d=[[c,n,i,`elementKinds`,`element`,`relationship`],[l,i,n,`relationshipKinds`,`relationship`,`element`]];for(let[e,n,r,i,a,c]of d)e?.forEach((e,l)=>{n.has(e)||t.push({rule:`unresolved-viewpoint-kind`,path:`${o}/${i}/${l}`,message:`viewpoint "${s}" retains ${a} kind "${e}", and no ${a} of this document has it`+(r.has(e)?` (it is a ${c} kind here, which is a different vocabulary)`:``)})})})}}if(e.kind===`table`){let{columns:n,rows:r}=e.data;r.forEach((e,r)=>{let{cells:i,heading:a}=ue(e);a===void 0&&i.length!==n.length&&t.push({rule:`row-column-mismatch`,path:`/data/rows/${r}`,message:`row has ${i.length} values but ${n.length} columns are declared`,observed:i.length,limit:n.length})})}e.kind===`timeline`&&t.push(...wt(e.data));for(let n of Pt(e)){n.expect!==void 0&&(e.target===void 0?t.push({rule:`expectation-without-target`,path:`${n.at}/expect`,message:`an expectation is checked by the authority a proposal targets; a document that targets nothing has nobody to check it`}):n.ref===void 0&&t.push({rule:`expectation-without-reference`,path:`${n.at}/expect`,message:`an expectation describes something that already exists, and this item carries no reference to one`}));let r=n.set?.removeAttributes;if(Array.isArray(r)){let e=n.set?.attributes??{},i=new Map;r.forEach((r,a)=>{if(typeof r!=`string`)return;let o=i.get(r);o===void 0?i.set(r,a):t.push({rule:`duplicate-attribute-removal`,path:`${n.at}/set/removeAttributes/${a}`,message:`"${r}" is already removed at ${n.at}/set/removeAttributes/${o}`}),Object.prototype.hasOwnProperty.call(e,r)&&t.push({rule:`attribute-set-and-removed`,path:`${n.at}/set/removeAttributes/${a}`,message:`"${r}" is both assigned and removed; a proposal states one intention per property`})})}Array.isArray(n.locations)&&n.locations.forEach((e,r)=>{if(typeof e!=`object`||!e)return;let i=e.range;i!==void 0&&(i.endLine<i.startLine||i.endLine===i.startLine&&i.endCharacter!==void 0&&i.startCharacter!==void 0&&i.endCharacter<i.startCharacter)&&t.push({rule:`location-range-reversed`,path:`${n.at}/locations/${r}/range`,message:`a range ends before it begins, so it selects nothing a reader could be taken to`})})}e.kind===`table`&&e.data.rows.forEach((e,n)=>{if(typeof e!=`object`||!e||Array.isArray(e))return;let r=e;r.role!==void 0&&r.set!==void 0&&t.push({rule:`role-with-change`,path:`/data/rows/${n}/role`,message:`a row states what it observed or what it asks for, not both: a declared role beside a change is a report and an instruction at once`})});let m=new Map;for(let n of It(e)){let e=m.get(n.id);e===void 0?m.set(n.id,n.at):t.push({rule:`duplicate-identifier`,path:`${n.at}/id`,message:`identifier "${n.id}" is already declared at ${e}`})}return Lt(e).forEach((e,n)=>{for(let r of[`from`,`to`]){let i=e[r];if(typeof i!=`object`||!i)continue;let a=i.id;typeof a==`string`&&(m.has(a)||t.push({rule:`unresolved-endpoint`,path:`/data/relations/${n}/${r}`,message:`"${a}" is not the identifier of any row this document declares`}))}}),t}function Bt(e,t){let n=t(e);if(n.length>0)return{valid:!1,issues:n};let r=e,i=zt(r);return i.length>0?{valid:!1,issues:i}:{valid:!0,envelope:r,issues:[]}}function Vt(e,t,n){let r=we(e,n);if(r!==void 0)return{valid:!1,issues:[r]};let i;try{i=JSON.parse(e)}catch{return{valid:!1,issues:[{rule:`not-json`,path:``,message:`document is not parseable JSON`}]}}let a=Bt(i,t);if(!a.valid)return a;let o=we(e,n,a.envelope.schema);if(o!==void 0)return{valid:!1,issues:[o]};let s=Ee(a.envelope,n);return s.length>0?{valid:!1,issues:s}:{valid:!0,envelope:a.envelope,measurement:De(a.envelope,e),issues:[]}}function Ht(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e.schema;if(!(typeof t!=`string`||!t.startsWith(`urn:structured-exchange:`)))return t}function Ut(e,t,n){let r=we(e,n);if(r!==void 0)return{status:`too-large`,issue:r};let i;try{i=JSON.parse(e)}catch{return{status:`not-a-document`,why:`unparseable`}}let a=Ht(i);if(a===void 0)return{status:`not-a-document`,why:`undeclared`};if(_e(a)===void 0)return{status:`unsupported-version`,schema:a};let o=Bt(i,t);if(!o.valid)return{status:`invalid`,issues:o.issues};let s=we(e,n,o.envelope.schema);return s===void 0?{status:`valid`,envelope:o.envelope}:{status:`too-large`,issue:s}}function Wt(e){let t=e.replace(/\r\n/g,`
|
|
6
6
|
`).replace(/\s+$/,``),n=2166136261;for(let e=0;e<t.length;e++)n^=t.charCodeAt(e),n=Math.imul(n,16777619);return`sx-${(n>>>0).toString(16).padStart(8,`0`)}-${t.length.toString(36)}`}async function Gt(e){try{return await navigator.clipboard.writeText(e),!0}catch{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.cssText=`position:fixed;top:0;left:0;opacity:0;pointer-events:none`,document.body.append(t);try{return t.select(),document.execCommand(`copy`)}catch{return!1}finally{t.remove()}}}function Kt(e,t,n){return e>=t&&e<=n}function qt(e){return e===8205}function Jt(e){return Kt(e,55296,56319)}function Yt(e){return Kt(e,127462,127487)}function Xt(e){return Kt(e,65024,65039)}function Zt(e){return Kt(e,768,879)||Kt(e,6832,6911)||Kt(e,7616,7679)||Kt(e,65056,65071)}function Qt(e){return e>65535?2:1}function $t(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(Zt(n)||Xt(n))t+=Qt(n);else break}return t}function en(e,t){let n=e.codePointAt(t),r=t+Qt(n);for(r=$t(e,r);r<e.length-1&&qt(e.codePointAt(r));){let t=e.codePointAt(r+1);r+=1+Qt(t),r=$t(e,r)}return Yt(n)&&r<e.length&&Yt(e.codePointAt(r))&&(r+=Qt(e.codePointAt(r))),r}function tn(e){return Jt(e)||Zt(e)||Xt(e)||qt(e)}function nn(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=en(e,r),n++,n>=t)return!0;return!1}function rn(e,t){let n=0,r=0;for(;r<e.length;)if(r=en(e,r),n++,n>t)return!1;return!0}function an(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(tn(e.charCodeAt(n)))return nn(e,t);if(n++,n>=t)return!0}return!1}function on(e,t){let n=0;for(;n<e.length;){if(tn(e.charCodeAt(n)))return rn(e,t);if(n++,n>t)return!1}return!0}function sn(e){return Array.isArray(e)}function cn(e){return _n(typeof e,`bigint`)}function ln(e){return _n(typeof e,`boolean`)}function un(e){if(gn(e)||!dn(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function dn(e){return _n(typeof e,`function`)}function fn(e){return _n(e,null)}function pn(e){return _n(typeof e,`object`)&&!fn(e)}function mn(e){return _n(typeof e,`string`)}function hn(e){return _n(typeof e,`symbol`)}function gn(e){return _n(e,void 0)}function _n(e,t){return e===t}function vn(e,t){return on(e,t)}function yn(e,t){return an(e,t)}function bn(e){return e instanceof Boolean}function xn(e){return e instanceof Number}function Sn(e){return e instanceof String}function Cn(e){return globalThis.ArrayBuffer.isView(e)}function wn(e){return e instanceof globalThis.RegExp}function Tn(e){return e instanceof globalThis.Date}var En=[];function Dn(e){En=e.variables}var On=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`schema`in e&&`kind`in e&&`data`in e&&Object.getOwnPropertyNames(e).every((e,t)=>En[0].test(e)||!1)&&e.schema===`urn:structured-exchange:1`&&(e.kind===`graph`||e.kind===`sequence`||e.kind===`table`)&&(e.target===void 0||!(`target`in e)||kn(e.target))&&(e.removals===void 0||!(`removals`in e)||Array.isArray(e.removals)&&e.removals.every((e,t)=>An(e))&&e.removals.length<=500)&&[typeof e.data==`object`&&e.data!==null&&!Array.isArray(e.data)&&`nodes`in e.data&&`edges`in e.data&&Object.getOwnPropertyNames(e.data).every((e,t)=>En[2].test(e)||!1)&&Array.isArray(e.data.nodes)&&e.data.nodes.every((e,t)=>Pn(e))&&e.data.nodes.length<=500&&e.data.nodes.length>=1&&Array.isArray(e.data.edges)&&e.data.edges.every((e,t)=>In(e))&&e.data.edges.length<=2e3&&(e.data.containers===void 0||!(`containers`in e.data)||Array.isArray(e.data.containers)&&e.data.containers.every((e,t)=>Rn(e))&&e.data.containers.length<=50),typeof e.data==`object`&&e.data!==null&&!Array.isArray(e.data)&&`participants`in e.data&&`messages`in e.data&&Object.getOwnPropertyNames(e.data).every((e,t)=>En[8].test(e)||!1)&&Array.isArray(e.data.participants)&&e.data.participants.every((e,t)=>Pn(e))&&e.data.participants.length<=100&&e.data.participants.length>=1&&Array.isArray(e.data.messages)&&e.data.messages.every((e,t)=>zn(e))&&e.data.messages.length<=1e3&&(e.data.containers===void 0||!(`containers`in e.data)||Array.isArray(e.data.containers)&&e.data.containers.every((e,t)=>Rn(e))&&e.data.containers.length<=50),typeof e.data==`object`&&e.data!==null&&!Array.isArray(e.data)&&`columns`in e.data&&`rows`in e.data&&Object.getOwnPropertyNames(e.data).length===2&&Array.isArray(e.data.columns)&&e.data.columns.every((e,t)=>typeof e==`string`&&vn(e,200)&&yn(e,1))&&e.data.columns.length<=50&&e.data.columns.length>=1&&Array.isArray(e.data.rows)&&e.data.rows.every((e,t)=>[Vn(e),typeof e==`object`&&!!e&&!Array.isArray(e)&&`cells`in e&&Object.getOwnPropertyNames(e).every((e,t)=>En[11].test(e)||!1)&&Vn(e.cells)&&(e.role===void 0||!(`role`in e)||e.role===`added`||e.role===`changed`||e.role===`context`||e.role===`removed`)].reduce((e,t,n)=>t===!0?++e:e,0)===1)&&e.data.rows.length<=5e3].reduce((e,t,n)=>t===!0?++e:e,0)===1),kn=(e=>typeof e==`string`&&vn(e,200)&&yn(e,1)),An=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`type`in e&&`ref`in e&&Object.getOwnPropertyNames(e).every((e,t)=>En[1].test(e)||!1)&&(e.type===`element`||e.type===`relationship`)&&kn(e.ref)&&(e.label===void 0||!(`label`in e)||jn(e.label))&&(e.kind===void 0||!(`kind`in e)||Mn(e.kind))&&(e.from===void 0||!(`from`in e)||Nn(e.from))&&(e.to===void 0||!(`to`in e)||Nn(e.to))),jn=(e=>typeof e==`string`&&vn(e,500)),Mn=(e=>typeof e==`string`&&vn(e,100)&&yn(e,1)),Nn=(e=>typeof e==`string`&&vn(e,200)&&yn(e,1)),Pn=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`id`in e&&Object.getOwnPropertyNames(e).every((e,t)=>En[3].test(e)||!1)&&Nn(e.id)&&(e.ref===void 0||!(`ref`in e)||kn(e.ref))&&(e.label===void 0||!(`label`in e)||jn(e.label))&&(e.kind===void 0||!(`kind`in e)||Mn(e.kind))&&(e.set===void 0||!(`set`in e)||Fn(e.set))&&(e.container===void 0||!(`container`in e)||Nn(e.container))&&(!(typeof e==`object`&&e&&!Array.isArray(e))||`ref`in e||!(typeof e==`object`&&e&&!Array.isArray(e))||`label`in e)),Fn=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.getOwnPropertyNames(e).every((e,t)=>En[4].test(e)||!1)&&(e.label===void 0||!(`label`in e)||jn(e.label))&&(e.kind===void 0||!(`kind`in e)||Mn(e.kind))&&(e.container===void 0||!(`container`in e)||Nn(e.container))&&Object.getOwnPropertyNames(e).length>=1),In=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`from`in e&&`to`in e&&Object.getOwnPropertyNames(e).every((e,t)=>En[5].test(e)||!1)&&Nn(e.from)&&Nn(e.to)&&(e.kind===void 0||!(`kind`in e)||Mn(e.kind))&&(e.ref===void 0||!(`ref`in e)||kn(e.ref))&&(e.label===void 0||!(`label`in e)||jn(e.label))&&(e.set===void 0||!(`set`in e)||Ln(e.set))&&(!(typeof e==`object`&&e&&!Array.isArray(e))||`ref`in e||!(typeof e==`object`&&e&&!Array.isArray(e))||`kind`in e)),Ln=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.getOwnPropertyNames(e).every((e,t)=>En[6].test(e)||!1)&&(e.kind===void 0||!(`kind`in e)||Mn(e.kind))&&(e.label===void 0||!(`label`in e)||jn(e.label))&&Object.getOwnPropertyNames(e).length>=1),Rn=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`id`in e&&`label`in e&&Object.getOwnPropertyNames(e).every((e,t)=>En[7].test(e)||!1)&&Nn(e.id)&&jn(e.label)&&(e.kind===void 0||!(`kind`in e)||Mn(e.kind))),zn=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`from`in e&&`to`in e&&Object.getOwnPropertyNames(e).every((e,t)=>En[9].test(e)||!1)&&Nn(e.from)&&Nn(e.to)&&(e.ref===void 0||!(`ref`in e)||kn(e.ref))&&(e.label===void 0||!(`label`in e)||jn(e.label))&&(e.set===void 0||!(`set`in e)||Bn(e.set))&&(!(typeof e==`object`&&e&&!Array.isArray(e))||`ref`in e||!(typeof e==`object`&&e&&!Array.isArray(e))||`label`in e)),Bn=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.getOwnPropertyNames(e).every((e,t)=>En[10].test(e)||!1)&&(e.label===void 0||!(`label`in e)||jn(e.label))&&Object.getOwnPropertyNames(e).length>=1),Vn=(e=>Array.isArray(e)&&e.every((e,t)=>(typeof e==`string`||Number.isFinite(e)||typeof e==`boolean`||e===null)&&(typeof e!=`string`||vn(e,1e3)))&&e.length<=50);function Hn(e){return On(e)}Dn({variables:[RegExp(`(^schema$|^kind$|^target$|^removals$|^data$)`,`u`),RegExp(`(^type$|^ref$|^label$|^kind$|^from$|^to$)`,`u`),RegExp(`(^nodes$|^edges$|^containers$)`,`u`),RegExp(`(^id$|^ref$|^label$|^kind$|^set$|^container$)`,`u`),RegExp(`(^label$|^kind$|^container$)`,`u`),RegExp(`(^from$|^to$|^kind$|^ref$|^label$|^set$)`,`u`),RegExp(`(^kind$|^label$)`,`u`),RegExp(`(^id$|^label$|^kind$)`,`u`),RegExp(`(^participants$|^messages$|^containers$)`,`u`),RegExp(`(^from$|^to$|^ref$|^label$|^set$)`,`u`),RegExp(`(^label$)`,`u`),RegExp(`(^cells$|^role$)`,`u`)]});function Un(){throw Error(`Unreachable`)}function Wn(e){let t=new Set,n=e;for(;n&&n!==Object.prototype;){for(let e of Reflect.ownKeys(n))e!==`constructor`&&typeof e!=`symbol`&&t.add(e);n=Object.getPrototypeOf(n)}return[...t]}function Gn(e){return typeof e==`number`}var Kn;(function(e){e[e.Array=0]=`Array`,e[e.BigInt=1]=`BigInt`,e[e.Boolean=2]=`Boolean`,e[e.Date=3]=`Date`,e[e.Constructor=4]=`Constructor`,e[e.Function=5]=`Function`,e[e.Null=6]=`Null`,e[e.Number=7]=`Number`,e[e.Object=8]=`Object`,e[e.RegExp=9]=`RegExp`,e[e.String=10]=`String`,e[e.Symbol=11]=`Symbol`,e[e.TypeArray=12]=`TypeArray`,e[e.Undefined=13]=`Undefined`})(Kn||={});var qn=BigInt(`14695981039346656037`),[Jn,Yn]=[BigInt(`1099511628211`),BigInt(`18446744073709551616`)],Xn=Array.from({length:256}).map((e,t)=>BigInt(t)),Zn=new Float64Array(1),Qn=new DataView(Zn.buffer),$n=new Uint8Array(Zn.buffer);function er(e){qn^=Xn[e],qn=qn*Jn%Yn}function tr(e){er(Kn.Array);for(let t of e)gr(t)}function nr(e){er(Kn.BigInt),Qn.setBigInt64(0,e);for(let e of $n)er(e)}function rr(e){er(Kn.Boolean),er(+!!e)}function ir(e){er(Kn.Constructor),gr(e.toString())}function ar(e){er(Kn.Date),gr(e.getTime())}function or(e){er(Kn.Function),gr(e.toString())}function sr(e){er(Kn.Null)}function cr(e){er(Kn.Number),Qn.setFloat64(0,e,!0);for(let e of $n)er(e)}function lr(e){er(Kn.Object);for(let t of Wn(e).sort())gr(t),gr(e[t])}function ur(e){er(Kn.RegExp),fr(e.toString())}var dr=new TextEncoder;function fr(e){er(Kn.String);for(let t of dr.encode(e))er(t)}function pr(e){er(Kn.Symbol),gr(e.toString())}function mr(e){er(Kn.TypeArray);let t=new Uint8Array(e.buffer);for(let e=0;e<t.length;e++)er(t[e])}function hr(e){return er(Kn.Undefined)}function gr(e){return Cn(e)?mr(e):Tn(e)?ar(e):wn(e)?ur(e):bn(e)?rr(e.valueOf()):Sn(e)?fr(e.valueOf()):xn(e)?cr(e.valueOf()):Gn(e)?cr(e):sn(e)?tr(e):ln(e)?rr(e):cn(e)?nr(e):un(e)?ir(e):fn(e)?sr(e):pn(e)?lr(e):mn(e)?fr(e):hn(e)?pr(e):gn(e)?hr(e):dn(e)?or(e):Un()}function _r(e){return qn=BigInt(`14695981039346656037`),gr(e),qn}function vr(e){return _r(e).toString(16).padStart(16,`0`)}var yr=[];function br(e){yr=e.variables}var xr=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`schema`in e&&`kind`in e&&`data`in e&&Object.getOwnPropertyNames(e).every((e,t)=>yr[0].test(e)||!1)&&e.schema===`urn:structured-exchange:2`&&(e.kind===`graph`||e.kind===`sequence`||e.kind===`table`)&&(e.profile===void 0||!(`profile`in e)||typeof e.profile==`string`&&vn(e.profile,200)&&yn(e.profile,1))&&(e.target===void 0||!(`target`in e)||typeof e.target==`object`&&e.target!==null&&!Array.isArray(e.target)&&`ref`in e.target&&Object.getOwnPropertyNames(e.target).every((e,t)=>yr[1].test(e)||!1)&&Sr(e.target.ref)&&(e.target.revision===void 0||!(`revision`in e.target)||Cr(e.target.revision)))&&(e.removals===void 0||!(`removals`in e)||Array.isArray(e.removals)&&e.removals.every((e,t)=>wr(e))&&e.removals.length<=500)&&(e.artifacts===void 0||!(`artifacts`in e)||Array.isArray(e.artifacts)&&e.artifacts.every((e,t)=>Or(e))&&e.artifacts.length<=50)&&(e.viewpoints===void 0||!(`viewpoints`in e)||Array.isArray(e.viewpoints)&&e.viewpoints.every((e,t)=>kr(e))&&e.viewpoints.length<=20)&&[typeof e.data==`object`&&e.data!==null&&!Array.isArray(e.data)&&`nodes`in e.data&&`edges`in e.data&&Object.getOwnPropertyNames(e.data).every((e,t)=>yr[6].test(e)||!1)&&Array.isArray(e.data.nodes)&&e.data.nodes.every((e,t)=>Ar(e))&&e.data.nodes.length<=500&&e.data.nodes.length>=1&&Array.isArray(e.data.edges)&&e.data.edges.every((e,t)=>Hr(e))&&e.data.edges.length<=2e3&&(e.data.containers===void 0||!(`containers`in e.data)||Array.isArray(e.data.containers)&&e.data.containers.every((e,t)=>Wr(e))&&e.data.containers.length<=50),typeof e.data==`object`&&e.data!==null&&!Array.isArray(e.data)&&`participants`in e.data&&`messages`in e.data&&Object.getOwnPropertyNames(e.data).every((e,t)=>yr[16].test(e)||!1)&&Array.isArray(e.data.participants)&&e.data.participants.every((e,t)=>Ar(e))&&e.data.participants.length<=100&&e.data.participants.length>=1&&Array.isArray(e.data.messages)&&e.data.messages.every((e,t)=>Gr(e))&&e.data.messages.length<=1e3&&(e.data.containers===void 0||!(`containers`in e.data)||Array.isArray(e.data.containers)&&e.data.containers.every((e,t)=>Wr(e))&&e.data.containers.length<=50),typeof e.data==`object`&&e.data!==null&&!Array.isArray(e.data)&&`columns`in e.data&&`rows`in e.data&&Object.getOwnPropertyNames(e.data).every((e,t)=>yr[19].test(e)||!1)&&Array.isArray(e.data.columns)&&e.data.columns.every((e,t)=>typeof e==`string`&&vn(e,200)&&yn(e,1))&&e.data.columns.length<=50&&e.data.columns.length>=1&&Array.isArray(e.data.rows)&&e.data.rows.every((e,t)=>[qr(e),Jr(e),Zr(e)].reduce((e,t,n)=>t===!0?++e:e,0)===1)&&e.data.rows.length<=5e3&&(e.data.relations===void 0||!(`relations`in e.data)||Array.isArray(e.data.relations)&&e.data.relations.every((e,t)=>Qr(e))&&e.data.relations.length<=2e3)].reduce((e,t,n)=>t===!0?++e:e,0)===1),Sr=(e=>typeof e==`string`&&vn(e,200)&&yn(e,1)),Cr=(e=>typeof e==`string`&&vn(e,200)&&yn(e,1)),wr=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`type`in e&&`ref`in e&&Object.getOwnPropertyNames(e).every((e,t)=>yr[2].test(e)||!1)&&(e.type===`element`||e.type===`relationship`||e.type===`row`)&&Sr(e.ref)&&(e.label===void 0||!(`label`in e)||Tr(e.label))&&(e.kind===void 0||!(`kind`in e)||Er(e.kind))&&(e.from===void 0||!(`from`in e)||Dr(e.from))&&(e.to===void 0||!(`to`in e)||Dr(e.to))),Tr=(e=>typeof e==`string`&&vn(e,500)),Er=(e=>typeof e==`string`&&vn(e,100)&&yn(e,1)),Dr=(e=>typeof e==`string`&&vn(e,200)&&yn(e,1)),Or=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`rel`in e&&`uri`in e&&`sha256`in e&&Object.getOwnPropertyNames(e).every((e,t)=>yr[3].test(e)||!1)&&typeof e.rel==`string`&&vn(e.rel,100)&&yn(e.rel,1)&&typeof e.uri==`string`&&vn(e.uri,2e3)&&yn(e.uri,1)&&typeof e.sha256==`string`&&yr[4].test(e.sha256)&&(e.mediaType===void 0||!(`mediaType`in e)||typeof e.mediaType==`string`&&vn(e.mediaType,100)&&yn(e.mediaType,1))&&(e.label===void 0||!(`label`in e)||Tr(e.label))),kr=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`id`in e&&`label`in e&&`concern`in e&&Object.getOwnPropertyNames(e).every((e,t)=>yr[5].test(e)||!1)&&Dr(e.id)&&typeof e.label==`string`&&vn(e.label,500)&&yn(e.label,1)&&typeof e.concern==`string`&&vn(e.concern,500)&&yn(e.concern,1)&&(e.elementKinds===void 0||!(`elementKinds`in e)||Array.isArray(e.elementKinds)&&e.elementKinds.every((e,t)=>Er(e))&&e.elementKinds.length<=64&&e.elementKinds.length>=1&&new Set(e.elementKinds.map(vr)).size===e.elementKinds.length)&&(e.relationshipKinds===void 0||!(`relationshipKinds`in e)||Array.isArray(e.relationshipKinds)&&e.relationshipKinds.every((e,t)=>Er(e))&&e.relationshipKinds.length<=64&&e.relationshipKinds.length>=1&&new Set(e.relationshipKinds.map(vr)).size===e.relationshipKinds.length)),Ar=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`id`in e&&Object.getOwnPropertyNames(e).every((e,t)=>yr[7].test(e)||!1)&&Dr(e.id)&&(e.ref===void 0||!(`ref`in e)||Sr(e.ref))&&(e.label===void 0||!(`label`in e)||Tr(e.label))&&(e.kind===void 0||!(`kind`in e)||Er(e.kind))&&(e.set===void 0||!(`set`in e)||jr(e.set))&&(e.container===void 0||!(`container`in e)||Dr(e.container))&&(e.attributes===void 0||!(`attributes`in e)||Mr(e.attributes))&&(e.expect===void 0||!(`expect`in e)||Lr(e.expect))&&(e.locations===void 0||!(`locations`in e)||Rr(e.locations))&&(e.artifacts===void 0||!(`artifacts`in e)||Vr(e.artifacts))&&(!(typeof e==`object`&&e&&!Array.isArray(e))||`ref`in e||!(typeof e==`object`&&e&&!Array.isArray(e))||`label`in e)),jr=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.getOwnPropertyNames(e).every((e,t)=>yr[8].test(e)||!1)&&(e.label===void 0||!(`label`in e)||Tr(e.label))&&(e.kind===void 0||!(`kind`in e)||Er(e.kind))&&(e.container===void 0||!(`container`in e)||Dr(e.container))&&(e.attributes===void 0||!(`attributes`in e)||Mr(e.attributes))&&(e.removeAttributes===void 0||!(`removeAttributes`in e)||Ir(e.removeAttributes))&&Object.getOwnPropertyNames(e).length>=1),Mr=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.getOwnPropertyNames(e).every((t,n)=>yr[9].test(t)||Nr(e[t]))&&Object.getOwnPropertyNames(e).every((e,t)=>typeof e!=`string`||vn(e,200)&&yn(e,1))&&Object.getOwnPropertyNames(e).length<=50),Nr=(e=>[Pr(e),Fr(e),Array.isArray(e)&&e.every((e,t)=>[Pr(e),Fr(e)].reduce((e,t,n)=>t===!0?++e:e,0)===1)&&e.length<=50].reduce((e,t,n)=>t===!0?++e:e,0)===1),Pr=(e=>(typeof e==`string`||Number.isFinite(e)||typeof e==`boolean`||e===null)&&(typeof e!=`string`||vn(e,1e3))),Fr=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`ref`in e&&Object.getOwnPropertyNames(e).length===1&&Sr(e.ref)),Ir=(e=>Array.isArray(e)&&e.every((e,t)=>Dr(e))&&e.length<=50),Lr=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.getOwnPropertyNames(e).every((e,t)=>yr[10].test(e)||!1)&&(e.label===void 0||!(`label`in e)||Tr(e.label))&&(e.kind===void 0||!(`kind`in e)||Er(e.kind))&&(e.container===void 0||!(`container`in e)||Dr(e.container))&&(e.revision===void 0||!(`revision`in e)||Cr(e.revision))&&(e.attributes===void 0||!(`attributes`in e)||Mr(e.attributes))&&Object.getOwnPropertyNames(e).length>=1),Rr=(e=>Array.isArray(e)&&e.every((e,t)=>zr(e))&&e.length<=10),zr=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`uri`in e&&Object.getOwnPropertyNames(e).every((e,t)=>yr[11].test(e)||!1)&&typeof e.uri==`string`&&vn(e.uri,2e3)&&yn(e.uri,1)&&(e.revision===void 0||!(`revision`in e)||Cr(e.revision))&&(e.range===void 0||!(`range`in e)||typeof e.range==`object`&&e.range!==null&&!Array.isArray(e.range)&&`startLine`in e.range&&`endLine`in e.range&&Object.getOwnPropertyNames(e.range).every((e,t)=>yr[12].test(e)||!1)&&Br(e.range.startLine)&&(e.range.startCharacter===void 0||!(`startCharacter`in e.range)||Br(e.range.startCharacter))&&Br(e.range.endLine)&&(e.range.endCharacter===void 0||!(`endCharacter`in e.range)||Br(e.range.endCharacter)))),Br=(e=>Number.isInteger(e)&&(!(Number.isFinite(e)||typeof e==`bigint`)||e<=1e6&&e>=0)),Vr=(e=>Array.isArray(e)&&e.every((e,t)=>Or(e))&&e.length<=20),Hr=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`from`in e&&`to`in e&&Object.getOwnPropertyNames(e).every((e,t)=>yr[13].test(e)||!1)&&Dr(e.from)&&Dr(e.to)&&(e.kind===void 0||!(`kind`in e)||Er(e.kind))&&(e.ref===void 0||!(`ref`in e)||Sr(e.ref))&&(e.label===void 0||!(`label`in e)||Tr(e.label))&&(e.set===void 0||!(`set`in e)||Ur(e.set))&&(e.attributes===void 0||!(`attributes`in e)||Mr(e.attributes))&&(e.expect===void 0||!(`expect`in e)||Lr(e.expect))&&(e.locations===void 0||!(`locations`in e)||Rr(e.locations))&&(e.artifacts===void 0||!(`artifacts`in e)||Vr(e.artifacts))&&(!(typeof e==`object`&&e&&!Array.isArray(e))||`ref`in e||!(typeof e==`object`&&e&&!Array.isArray(e))||`kind`in e)),Ur=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.getOwnPropertyNames(e).every((e,t)=>yr[14].test(e)||!1)&&(e.kind===void 0||!(`kind`in e)||Er(e.kind))&&(e.label===void 0||!(`label`in e)||Tr(e.label))&&(e.attributes===void 0||!(`attributes`in e)||Mr(e.attributes))&&(e.removeAttributes===void 0||!(`removeAttributes`in e)||Ir(e.removeAttributes))&&Object.getOwnPropertyNames(e).length>=1),Wr=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`id`in e&&`label`in e&&Object.getOwnPropertyNames(e).every((e,t)=>yr[15].test(e)||!1)&&Dr(e.id)&&Tr(e.label)&&(e.kind===void 0||!(`kind`in e)||Er(e.kind))),Gr=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`from`in e&&`to`in e&&Object.getOwnPropertyNames(e).every((e,t)=>yr[17].test(e)||!1)&&Dr(e.from)&&Dr(e.to)&&(e.ref===void 0||!(`ref`in e)||Sr(e.ref))&&(e.label===void 0||!(`label`in e)||Tr(e.label))&&(e.set===void 0||!(`set`in e)||Kr(e.set))&&(e.attributes===void 0||!(`attributes`in e)||Mr(e.attributes))&&(e.expect===void 0||!(`expect`in e)||Lr(e.expect))&&(e.locations===void 0||!(`locations`in e)||Rr(e.locations))&&(e.artifacts===void 0||!(`artifacts`in e)||Vr(e.artifacts))&&(!(typeof e==`object`&&e&&!Array.isArray(e))||`ref`in e||!(typeof e==`object`&&e&&!Array.isArray(e))||`label`in e)),Kr=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.getOwnPropertyNames(e).every((e,t)=>yr[18].test(e)||!1)&&(e.label===void 0||!(`label`in e)||Tr(e.label))&&(e.attributes===void 0||!(`attributes`in e)||Mr(e.attributes))&&(e.removeAttributes===void 0||!(`removeAttributes`in e)||Ir(e.removeAttributes))&&Object.getOwnPropertyNames(e).length>=1),qr=(e=>Array.isArray(e)&&e.every((e,t)=>(typeof e==`string`||Number.isFinite(e)||typeof e==`boolean`||e===null)&&(typeof e!=`string`||vn(e,1e3)))&&e.length<=50),Jr=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`cells`in e&&Object.getOwnPropertyNames(e).every((e,t)=>yr[20].test(e)||!1)&&qr(e.cells)&&(e.role===void 0||!(`role`in e)||Yr(e.role))&&(e.id===void 0||!(`id`in e)||Dr(e.id))&&(e.ref===void 0||!(`ref`in e)||Sr(e.ref))&&(e.kind===void 0||!(`kind`in e)||Er(e.kind))&&(e.label===void 0||!(`label`in e)||Tr(e.label))&&(e.set===void 0||!(`set`in e)||Xr(e.set))&&(e.attributes===void 0||!(`attributes`in e)||Mr(e.attributes))&&(e.expect===void 0||!(`expect`in e)||Lr(e.expect))&&(e.locations===void 0||!(`locations`in e)||Rr(e.locations))&&(e.artifacts===void 0||!(`artifacts`in e)||Vr(e.artifacts))),Yr=(e=>e===`added`||e===`changed`||e===`context`||e===`removed`),Xr=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.getOwnPropertyNames(e).every((e,t)=>yr[21].test(e)||!1)&&(e.label===void 0||!(`label`in e)||Tr(e.label))&&(e.kind===void 0||!(`kind`in e)||Er(e.kind))&&(e.cells===void 0||!(`cells`in e)||qr(e.cells))&&(e.attributes===void 0||!(`attributes`in e)||Mr(e.attributes))&&(e.removeAttributes===void 0||!(`removeAttributes`in e)||Ir(e.removeAttributes))&&Object.getOwnPropertyNames(e).length>=1),Zr=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`heading`in e&&Object.getOwnPropertyNames(e).every((e,t)=>yr[22].test(e)||!1)&&typeof e.heading==`string`&&vn(e.heading,500)&&yn(e.heading,1)&&(e.depth===void 0||!(`depth`in e)||Number.isInteger(e.depth)&&(!(Number.isFinite(e.depth)||typeof e.depth==`bigint`)||e.depth<=6&&e.depth>=1))&&(e.role===void 0||!(`role`in e)||Yr(e.role))&&(e.id===void 0||!(`id`in e)||Dr(e.id))&&(e.ref===void 0||!(`ref`in e)||Sr(e.ref))),Qr=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`from`in e&&`to`in e&&`kind`in e&&Object.getOwnPropertyNames(e).every((e,t)=>yr[23].test(e)||!1)&&$r(e.from)&&$r(e.to)&&Er(e.kind)&&(e.ref===void 0||!(`ref`in e)||Sr(e.ref))&&(e.label===void 0||!(`label`in e)||Tr(e.label))&&(e.attributes===void 0||!(`attributes`in e)||Mr(e.attributes))),$r=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.getOwnPropertyNames(e).every((e,t)=>yr[24].test(e)||!1)&&(e.id===void 0||!(`id`in e)||Dr(e.id))&&(e.ref===void 0||!(`ref`in e)||Sr(e.ref))&&Object.getOwnPropertyNames(e).length>=1&&Object.getOwnPropertyNames(e).length<=1&&[!(typeof e==`object`&&e&&!Array.isArray(e))||`id`in e,!(typeof e==`object`&&e&&!Array.isArray(e))||`ref`in e].reduce((e,t,n)=>t===!0?++e:e,0)===1);function ei(e){return xr(e)}br({variables:[RegExp(`(^schema$|^kind$|^profile$|^target$|^removals$|^artifacts$|^viewpoints$|^data$)`,`u`),RegExp(`(^ref$|^revision$)`,`u`),RegExp(`(^type$|^ref$|^label$|^kind$|^from$|^to$)`,`u`),RegExp(`(^rel$|^uri$|^sha256$|^mediaType$|^label$)`,`u`),RegExp(`^sha256:[0-9a-f]{64}$`,`u`),RegExp(`(^id$|^label$|^concern$|^elementKinds$|^relationshipKinds$)`,`u`),RegExp(`(^nodes$|^edges$|^containers$)`,`u`),RegExp(`(^id$|^ref$|^label$|^kind$|^set$|^container$|^attributes$|^expect$|^locations$|^artifacts$)`,`u`),RegExp(`(^label$|^kind$|^container$|^attributes$|^removeAttributes$)`,`u`),RegExp(`(?!)`,`u`),RegExp(`(^label$|^kind$|^container$|^revision$|^attributes$)`,`u`),RegExp(`(^uri$|^revision$|^range$)`,`u`),RegExp(`(^startLine$|^startCharacter$|^endLine$|^endCharacter$)`,`u`),RegExp(`(^from$|^to$|^kind$|^ref$|^label$|^set$|^attributes$|^expect$|^locations$|^artifacts$)`,`u`),RegExp(`(^kind$|^label$|^attributes$|^removeAttributes$)`,`u`),RegExp(`(^id$|^label$|^kind$)`,`u`),RegExp(`(^participants$|^messages$|^containers$)`,`u`),RegExp(`(^from$|^to$|^ref$|^label$|^set$|^attributes$|^expect$|^locations$|^artifacts$)`,`u`),RegExp(`(^label$|^attributes$|^removeAttributes$)`,`u`),RegExp(`(^columns$|^rows$|^relations$)`,`u`),RegExp(`(^cells$|^role$|^id$|^ref$|^kind$|^label$|^set$|^attributes$|^expect$|^locations$|^artifacts$)`,`u`),RegExp(`(^label$|^kind$|^cells$|^attributes$|^removeAttributes$)`,`u`),RegExp(`(^heading$|^depth$|^role$|^id$|^ref$)`,`u`),RegExp(`(^from$|^to$|^kind$|^ref$|^label$|^attributes$)`,`u`),RegExp(`(^id$|^ref$)`,`u`)]});var ti=[];function ni(e){ti=e.variables}var ri=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`schema`in e&&`kind`in e&&`data`in e&&Object.getOwnPropertyNames(e).every((e,t)=>ti[0].test(e)||!1)&&e.schema===`urn:structured-exchange:3`&&(e.kind===`graph`||e.kind===`sequence`||e.kind===`table`||e.kind===`timeline`)&&(e.profile===void 0||!(`profile`in e)||typeof e.profile==`string`&&vn(e.profile,200)&&yn(e.profile,1))&&(e.target===void 0||!(`target`in e)||typeof e.target==`object`&&e.target!==null&&!Array.isArray(e.target)&&`ref`in e.target&&Object.getOwnPropertyNames(e.target).every((e,t)=>ti[1].test(e)||!1)&&ii(e.target.ref)&&(e.target.revision===void 0||!(`revision`in e.target)||ai(e.target.revision)))&&(e.removals===void 0||!(`removals`in e)||Array.isArray(e.removals)&&e.removals.every((e,t)=>oi(e))&&e.removals.length<=500)&&(e.artifacts===void 0||!(`artifacts`in e)||Array.isArray(e.artifacts)&&e.artifacts.every((e,t)=>ui(e))&&e.artifacts.length<=50)&&(e.viewpoints===void 0||!(`viewpoints`in e)||Array.isArray(e.viewpoints)&&e.viewpoints.every((e,t)=>di(e))&&e.viewpoints.length<=20)&&[typeof e.data==`object`&&e.data!==null&&!Array.isArray(e.data)&&`nodes`in e.data&&`edges`in e.data&&Object.getOwnPropertyNames(e.data).every((e,t)=>ti[6].test(e)||!1)&&Array.isArray(e.data.nodes)&&e.data.nodes.every((e,t)=>fi(e))&&e.data.nodes.length<=500&&e.data.nodes.length>=1&&Array.isArray(e.data.edges)&&e.data.edges.every((e,t)=>wi(e))&&e.data.edges.length<=2e3&&(e.data.containers===void 0||!(`containers`in e.data)||Array.isArray(e.data.containers)&&e.data.containers.every((e,t)=>Ei(e))&&e.data.containers.length<=50),typeof e.data==`object`&&e.data!==null&&!Array.isArray(e.data)&&`participants`in e.data&&`messages`in e.data&&Object.getOwnPropertyNames(e.data).every((e,t)=>ti[16].test(e)||!1)&&Array.isArray(e.data.participants)&&e.data.participants.every((e,t)=>fi(e))&&e.data.participants.length<=100&&e.data.participants.length>=1&&Array.isArray(e.data.messages)&&e.data.messages.every((e,t)=>Di(e))&&e.data.messages.length<=1e3&&(e.data.containers===void 0||!(`containers`in e.data)||Array.isArray(e.data.containers)&&e.data.containers.every((e,t)=>Ei(e))&&e.data.containers.length<=50),typeof e.data==`object`&&e.data!==null&&!Array.isArray(e.data)&&`columns`in e.data&&`rows`in e.data&&Object.getOwnPropertyNames(e.data).every((e,t)=>ti[19].test(e)||!1)&&Array.isArray(e.data.columns)&&e.data.columns.every((e,t)=>typeof e==`string`&&vn(e,200)&&yn(e,1))&&e.data.columns.length<=50&&e.data.columns.length>=1&&Array.isArray(e.data.rows)&&e.data.rows.every((e,t)=>[ki(e),Ai(e),Ni(e)].reduce((e,t,n)=>t===!0?++e:e,0)===1)&&e.data.rows.length<=5e3&&(e.data.relations===void 0||!(`relations`in e.data)||Array.isArray(e.data.relations)&&e.data.relations.every((e,t)=>Pi(e))&&e.data.relations.length<=2e3),typeof e.data==`object`&&e.data!==null&&!Array.isArray(e.data)&&`time`in e.data&&`rows`in e.data&&Object.getOwnPropertyNames(e.data).every((e,t)=>ti[25].test(e)||!1)&&(e.data.title===void 0||!(`title`in e.data)||si(e.data.title))&&typeof e.data.time==`object`&&e.data.time!==null&&!Array.isArray(e.data.time)&&`start`in e.data.time&&`end`in e.data.time&&`scale`in e.data.time&&Object.getOwnPropertyNames(e.data.time).length===3&&Ii(e.data.time.start)&&Ii(e.data.time.end)&&(e.data.time.scale===`week`||e.data.time.scale===`month`||e.data.time.scale===`quarter`)&&Array.isArray(e.data.rows)&&e.data.rows.every((e,t)=>Li(e))&&e.data.rows.length<=500&&(e.data.dependencies===void 0||!(`dependencies`in e.data)||Array.isArray(e.data.dependencies)&&e.data.dependencies.every((e,t)=>Wi(e))&&e.data.dependencies.length<=2e3)&&(e.data.comparedTo===void 0||!(`comparedTo`in e.data)||typeof e.data.comparedTo==`object`&&e.data.comparedTo!==null&&!Array.isArray(e.data.comparedTo)&&`label`in e.data.comparedTo&&Object.getOwnPropertyNames(e.data.comparedTo).every((e,t)=>ti[32].test(e)||!1)&&typeof e.data.comparedTo.label==`string`&&vn(e.data.comparedTo.label,500)&&yn(e.data.comparedTo.label,1)&&(e.data.comparedTo.date===void 0||!(`date`in e.data.comparedTo)||Ii(e.data.comparedTo.date)))&&(e.data.periods===void 0||!(`periods`in e.data)||Array.isArray(e.data.periods)&&e.data.periods.every((e,t)=>Gi(e))&&e.data.periods.length<=100)&&(e.data.references===void 0||!(`references`in e.data)||Array.isArray(e.data.references)&&e.data.references.every((e,t)=>Ki(e))&&e.data.references.length<=50)].reduce((e,t,n)=>t===!0?++e:e,0)===1),ii=(e=>typeof e==`string`&&vn(e,200)&&yn(e,1)),ai=(e=>typeof e==`string`&&vn(e,200)&&yn(e,1)),oi=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`type`in e&&`ref`in e&&Object.getOwnPropertyNames(e).every((e,t)=>ti[2].test(e)||!1)&&(e.type===`element`||e.type===`relationship`||e.type===`row`)&&ii(e.ref)&&(e.label===void 0||!(`label`in e)||si(e.label))&&(e.kind===void 0||!(`kind`in e)||ci(e.kind))&&(e.from===void 0||!(`from`in e)||li(e.from))&&(e.to===void 0||!(`to`in e)||li(e.to))),si=(e=>typeof e==`string`&&vn(e,500)),ci=(e=>typeof e==`string`&&vn(e,100)&&yn(e,1)),li=(e=>typeof e==`string`&&vn(e,200)&&yn(e,1)),ui=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`rel`in e&&`uri`in e&&`sha256`in e&&Object.getOwnPropertyNames(e).every((e,t)=>ti[3].test(e)||!1)&&typeof e.rel==`string`&&vn(e.rel,100)&&yn(e.rel,1)&&typeof e.uri==`string`&&vn(e.uri,2e3)&&yn(e.uri,1)&&typeof e.sha256==`string`&&ti[4].test(e.sha256)&&(e.mediaType===void 0||!(`mediaType`in e)||typeof e.mediaType==`string`&&vn(e.mediaType,100)&&yn(e.mediaType,1))&&(e.label===void 0||!(`label`in e)||si(e.label))),di=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`id`in e&&`label`in e&&`concern`in e&&Object.getOwnPropertyNames(e).every((e,t)=>ti[5].test(e)||!1)&&li(e.id)&&typeof e.label==`string`&&vn(e.label,500)&&yn(e.label,1)&&typeof e.concern==`string`&&vn(e.concern,500)&&yn(e.concern,1)&&(e.elementKinds===void 0||!(`elementKinds`in e)||Array.isArray(e.elementKinds)&&e.elementKinds.every((e,t)=>ci(e))&&e.elementKinds.length<=64&&e.elementKinds.length>=1&&new Set(e.elementKinds.map(vr)).size===e.elementKinds.length)&&(e.relationshipKinds===void 0||!(`relationshipKinds`in e)||Array.isArray(e.relationshipKinds)&&e.relationshipKinds.every((e,t)=>ci(e))&&e.relationshipKinds.length<=64&&e.relationshipKinds.length>=1&&new Set(e.relationshipKinds.map(vr)).size===e.relationshipKinds.length)),fi=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`id`in e&&Object.getOwnPropertyNames(e).every((e,t)=>ti[7].test(e)||!1)&&li(e.id)&&(e.ref===void 0||!(`ref`in e)||ii(e.ref))&&(e.label===void 0||!(`label`in e)||si(e.label))&&(e.kind===void 0||!(`kind`in e)||ci(e.kind))&&(e.set===void 0||!(`set`in e)||pi(e.set))&&(e.container===void 0||!(`container`in e)||li(e.container))&&(e.attributes===void 0||!(`attributes`in e)||mi(e.attributes))&&(e.expect===void 0||!(`expect`in e)||yi(e.expect))&&(e.locations===void 0||!(`locations`in e)||bi(e.locations))&&(e.artifacts===void 0||!(`artifacts`in e)||Ci(e.artifacts))&&(!(typeof e==`object`&&e&&!Array.isArray(e))||`ref`in e||!(typeof e==`object`&&e&&!Array.isArray(e))||`label`in e)),pi=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.getOwnPropertyNames(e).every((e,t)=>ti[8].test(e)||!1)&&(e.label===void 0||!(`label`in e)||si(e.label))&&(e.kind===void 0||!(`kind`in e)||ci(e.kind))&&(e.container===void 0||!(`container`in e)||li(e.container))&&(e.attributes===void 0||!(`attributes`in e)||mi(e.attributes))&&(e.removeAttributes===void 0||!(`removeAttributes`in e)||vi(e.removeAttributes))&&Object.getOwnPropertyNames(e).length>=1),mi=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.getOwnPropertyNames(e).every((t,n)=>ti[9].test(t)||hi(e[t]))&&Object.getOwnPropertyNames(e).every((e,t)=>typeof e!=`string`||vn(e,200)&&yn(e,1))&&Object.getOwnPropertyNames(e).length<=50),hi=(e=>[gi(e),_i(e),Array.isArray(e)&&e.every((e,t)=>[gi(e),_i(e)].reduce((e,t,n)=>t===!0?++e:e,0)===1)&&e.length<=50].reduce((e,t,n)=>t===!0?++e:e,0)===1),gi=(e=>(typeof e==`string`||Number.isFinite(e)||typeof e==`boolean`||e===null)&&(typeof e!=`string`||vn(e,1e3))),_i=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`ref`in e&&Object.getOwnPropertyNames(e).length===1&&ii(e.ref)),vi=(e=>Array.isArray(e)&&e.every((e,t)=>li(e))&&e.length<=50),yi=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.getOwnPropertyNames(e).every((e,t)=>ti[10].test(e)||!1)&&(e.label===void 0||!(`label`in e)||si(e.label))&&(e.kind===void 0||!(`kind`in e)||ci(e.kind))&&(e.container===void 0||!(`container`in e)||li(e.container))&&(e.revision===void 0||!(`revision`in e)||ai(e.revision))&&(e.attributes===void 0||!(`attributes`in e)||mi(e.attributes))&&Object.getOwnPropertyNames(e).length>=1),bi=(e=>Array.isArray(e)&&e.every((e,t)=>xi(e))&&e.length<=10),xi=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`uri`in e&&Object.getOwnPropertyNames(e).every((e,t)=>ti[11].test(e)||!1)&&typeof e.uri==`string`&&vn(e.uri,2e3)&&yn(e.uri,1)&&(e.revision===void 0||!(`revision`in e)||ai(e.revision))&&(e.range===void 0||!(`range`in e)||typeof e.range==`object`&&e.range!==null&&!Array.isArray(e.range)&&`startLine`in e.range&&`endLine`in e.range&&Object.getOwnPropertyNames(e.range).every((e,t)=>ti[12].test(e)||!1)&&Si(e.range.startLine)&&(e.range.startCharacter===void 0||!(`startCharacter`in e.range)||Si(e.range.startCharacter))&&Si(e.range.endLine)&&(e.range.endCharacter===void 0||!(`endCharacter`in e.range)||Si(e.range.endCharacter)))),Si=(e=>Number.isInteger(e)&&(!(Number.isFinite(e)||typeof e==`bigint`)||e<=1e6&&e>=0)),Ci=(e=>Array.isArray(e)&&e.every((e,t)=>ui(e))&&e.length<=20),wi=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`from`in e&&`to`in e&&Object.getOwnPropertyNames(e).every((e,t)=>ti[13].test(e)||!1)&&li(e.from)&&li(e.to)&&(e.kind===void 0||!(`kind`in e)||ci(e.kind))&&(e.ref===void 0||!(`ref`in e)||ii(e.ref))&&(e.label===void 0||!(`label`in e)||si(e.label))&&(e.set===void 0||!(`set`in e)||Ti(e.set))&&(e.attributes===void 0||!(`attributes`in e)||mi(e.attributes))&&(e.expect===void 0||!(`expect`in e)||yi(e.expect))&&(e.locations===void 0||!(`locations`in e)||bi(e.locations))&&(e.artifacts===void 0||!(`artifacts`in e)||Ci(e.artifacts))&&(!(typeof e==`object`&&e&&!Array.isArray(e))||`ref`in e||!(typeof e==`object`&&e&&!Array.isArray(e))||`kind`in e)),Ti=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.getOwnPropertyNames(e).every((e,t)=>ti[14].test(e)||!1)&&(e.kind===void 0||!(`kind`in e)||ci(e.kind))&&(e.label===void 0||!(`label`in e)||si(e.label))&&(e.attributes===void 0||!(`attributes`in e)||mi(e.attributes))&&(e.removeAttributes===void 0||!(`removeAttributes`in e)||vi(e.removeAttributes))&&Object.getOwnPropertyNames(e).length>=1),Ei=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`id`in e&&`label`in e&&Object.getOwnPropertyNames(e).every((e,t)=>ti[15].test(e)||!1)&&li(e.id)&&si(e.label)&&(e.kind===void 0||!(`kind`in e)||ci(e.kind))),Di=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`from`in e&&`to`in e&&Object.getOwnPropertyNames(e).every((e,t)=>ti[17].test(e)||!1)&&li(e.from)&&li(e.to)&&(e.ref===void 0||!(`ref`in e)||ii(e.ref))&&(e.label===void 0||!(`label`in e)||si(e.label))&&(e.set===void 0||!(`set`in e)||Oi(e.set))&&(e.attributes===void 0||!(`attributes`in e)||mi(e.attributes))&&(e.expect===void 0||!(`expect`in e)||yi(e.expect))&&(e.locations===void 0||!(`locations`in e)||bi(e.locations))&&(e.artifacts===void 0||!(`artifacts`in e)||Ci(e.artifacts))&&(!(typeof e==`object`&&e&&!Array.isArray(e))||`ref`in e||!(typeof e==`object`&&e&&!Array.isArray(e))||`label`in e)),Oi=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.getOwnPropertyNames(e).every((e,t)=>ti[18].test(e)||!1)&&(e.label===void 0||!(`label`in e)||si(e.label))&&(e.attributes===void 0||!(`attributes`in e)||mi(e.attributes))&&(e.removeAttributes===void 0||!(`removeAttributes`in e)||vi(e.removeAttributes))&&Object.getOwnPropertyNames(e).length>=1),ki=(e=>Array.isArray(e)&&e.every((e,t)=>(typeof e==`string`||Number.isFinite(e)||typeof e==`boolean`||e===null)&&(typeof e!=`string`||vn(e,1e3)))&&e.length<=50),Ai=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`cells`in e&&Object.getOwnPropertyNames(e).every((e,t)=>ti[20].test(e)||!1)&&ki(e.cells)&&(e.role===void 0||!(`role`in e)||ji(e.role))&&(e.id===void 0||!(`id`in e)||li(e.id))&&(e.ref===void 0||!(`ref`in e)||ii(e.ref))&&(e.kind===void 0||!(`kind`in e)||ci(e.kind))&&(e.label===void 0||!(`label`in e)||si(e.label))&&(e.set===void 0||!(`set`in e)||Mi(e.set))&&(e.attributes===void 0||!(`attributes`in e)||mi(e.attributes))&&(e.expect===void 0||!(`expect`in e)||yi(e.expect))&&(e.locations===void 0||!(`locations`in e)||bi(e.locations))&&(e.artifacts===void 0||!(`artifacts`in e)||Ci(e.artifacts))),ji=(e=>e===`added`||e===`changed`||e===`context`||e===`removed`),Mi=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.getOwnPropertyNames(e).every((e,t)=>ti[21].test(e)||!1)&&(e.label===void 0||!(`label`in e)||si(e.label))&&(e.kind===void 0||!(`kind`in e)||ci(e.kind))&&(e.cells===void 0||!(`cells`in e)||ki(e.cells))&&(e.attributes===void 0||!(`attributes`in e)||mi(e.attributes))&&(e.removeAttributes===void 0||!(`removeAttributes`in e)||vi(e.removeAttributes))&&Object.getOwnPropertyNames(e).length>=1),Ni=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`heading`in e&&Object.getOwnPropertyNames(e).every((e,t)=>ti[22].test(e)||!1)&&typeof e.heading==`string`&&vn(e.heading,500)&&yn(e.heading,1)&&(e.depth===void 0||!(`depth`in e)||Number.isInteger(e.depth)&&(!(Number.isFinite(e.depth)||typeof e.depth==`bigint`)||e.depth<=6&&e.depth>=1))&&(e.role===void 0||!(`role`in e)||ji(e.role))&&(e.id===void 0||!(`id`in e)||li(e.id))&&(e.ref===void 0||!(`ref`in e)||ii(e.ref))),Pi=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`from`in e&&`to`in e&&`kind`in e&&Object.getOwnPropertyNames(e).every((e,t)=>ti[23].test(e)||!1)&&Fi(e.from)&&Fi(e.to)&&ci(e.kind)&&(e.ref===void 0||!(`ref`in e)||ii(e.ref))&&(e.label===void 0||!(`label`in e)||si(e.label))&&(e.attributes===void 0||!(`attributes`in e)||mi(e.attributes))),Fi=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.getOwnPropertyNames(e).every((e,t)=>ti[24].test(e)||!1)&&(e.id===void 0||!(`id`in e)||li(e.id))&&(e.ref===void 0||!(`ref`in e)||ii(e.ref))&&Object.getOwnPropertyNames(e).length>=1&&Object.getOwnPropertyNames(e).length<=1&&[!(typeof e==`object`&&e&&!Array.isArray(e))||`id`in e,!(typeof e==`object`&&e&&!Array.isArray(e))||`ref`in e].reduce((e,t,n)=>t===!0?++e:e,0)===1),Ii=(e=>typeof e==`string`&&ti[26].test(e)),Li=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`type`in e&&(e.type===`task`||e.type===`separator`)&&(!(typeof e==`object`&&e&&!Array.isArray(e))||e.type===void 0||!(`type`in e)||e.type===`task`?Ri(e):!0)&&(!(typeof e==`object`&&e&&!Array.isArray(e))||e.type===void 0||!(`type`in e)||e.type===`separator`?Ui(e):!0)),Ri=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`type`in e&&`id`in e&&`label`in e&&`items`in e&&Object.getOwnPropertyNames(e).every((e,t)=>ti[27].test(e)||!1)&&e.type===`task`&&li(e.id)&&si(e.label)&&Array.isArray(e.items)&&e.items.every((e,t)=>zi(e))&&e.items.length<=100&&(e.role===void 0||!(`role`in e)||Vi(e.role))),zi=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`type`in e&&(e.type===`activity`||e.type===`milestone`)&&(!(typeof e==`object`&&e&&!Array.isArray(e))||e.type===void 0||!(`type`in e)||e.type===`activity`?Bi(e):!0)&&(!(typeof e==`object`&&e&&!Array.isArray(e))||e.type===void 0||!(`type`in e)||e.type===`milestone`?Hi(e):!0)),Bi=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`type`in e&&`start`in e&&`end`in e&&Object.getOwnPropertyNames(e).every((e,t)=>ti[28].test(e)||!1)&&e.type===`activity`&&Ii(e.start)&&Ii(e.end)&&(e.id===void 0||!(`id`in e)||li(e.id))&&(e.label===void 0||!(`label`in e)||si(e.label))&&(e.kind===void 0||!(`kind`in e)||ci(e.kind))&&(e.previous===void 0||!(`previous`in e)||typeof e.previous==`object`&&e.previous!==null&&!Array.isArray(e.previous)&&`start`in e.previous&&`end`in e.previous&&Object.getOwnPropertyNames(e.previous).length===2&&Ii(e.previous.start)&&Ii(e.previous.end))&&(e.role===void 0||!(`role`in e)||Vi(e.role))),Vi=(e=>e===`added`||e===`removed`),Hi=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`type`in e&&`date`in e&&Object.getOwnPropertyNames(e).every((e,t)=>ti[29].test(e)||!1)&&e.type===`milestone`&&Ii(e.date)&&(e.id===void 0||!(`id`in e)||li(e.id))&&(e.label===void 0||!(`label`in e)||si(e.label))&&(e.kind===void 0||!(`kind`in e)||ci(e.kind))&&(e.previous===void 0||!(`previous`in e)||typeof e.previous==`object`&&e.previous!==null&&!Array.isArray(e.previous)&&`date`in e.previous&&Object.getOwnPropertyNames(e.previous).length===1&&Ii(e.previous.date))&&(e.role===void 0||!(`role`in e)||Vi(e.role))),Ui=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`type`in e&&Object.getOwnPropertyNames(e).every((e,t)=>ti[30].test(e)||!1)&&e.type===`separator`&&(e.label===void 0||!(`label`in e)||si(e.label))),Wi=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`from`in e&&`to`in e&&Object.getOwnPropertyNames(e).every((e,t)=>ti[31].test(e)||!1)&&li(e.from)&&li(e.to)&&(e.type===void 0||!(`type`in e)||e.type===`finish-to-start`||e.type===`start-to-start`||e.type===`finish-to-finish`||e.type===`start-to-finish`)),Gi=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`start`in e&&`end`in e&&Object.getOwnPropertyNames(e).every((e,t)=>ti[33].test(e)||!1)&&Ii(e.start)&&Ii(e.end)&&(e.label===void 0||!(`label`in e)||si(e.label))&&(e.kind===void 0||!(`kind`in e)||ci(e.kind))),Ki=(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`date`in e&&`label`in e&&Object.getOwnPropertyNames(e).every((e,t)=>ti[34].test(e)||!1)&&Ii(e.date)&&typeof e.label==`string`&&vn(e.label,500)&&yn(e.label,1)&&(e.kind===void 0||!(`kind`in e)||ci(e.kind)));function qi(e){return ri(e)}ni({variables:[RegExp(`(^schema$|^kind$|^profile$|^target$|^removals$|^artifacts$|^viewpoints$|^data$)`,`u`),RegExp(`(^ref$|^revision$)`,`u`),RegExp(`(^type$|^ref$|^label$|^kind$|^from$|^to$)`,`u`),RegExp(`(^rel$|^uri$|^sha256$|^mediaType$|^label$)`,`u`),RegExp(`^sha256:[0-9a-f]{64}$`,`u`),RegExp(`(^id$|^label$|^concern$|^elementKinds$|^relationshipKinds$)`,`u`),RegExp(`(^nodes$|^edges$|^containers$)`,`u`),RegExp(`(^id$|^ref$|^label$|^kind$|^set$|^container$|^attributes$|^expect$|^locations$|^artifacts$)`,`u`),RegExp(`(^label$|^kind$|^container$|^attributes$|^removeAttributes$)`,`u`),RegExp(`(?!)`,`u`),RegExp(`(^label$|^kind$|^container$|^revision$|^attributes$)`,`u`),RegExp(`(^uri$|^revision$|^range$)`,`u`),RegExp(`(^startLine$|^startCharacter$|^endLine$|^endCharacter$)`,`u`),RegExp(`(^from$|^to$|^kind$|^ref$|^label$|^set$|^attributes$|^expect$|^locations$|^artifacts$)`,`u`),RegExp(`(^kind$|^label$|^attributes$|^removeAttributes$)`,`u`),RegExp(`(^id$|^label$|^kind$)`,`u`),RegExp(`(^participants$|^messages$|^containers$)`,`u`),RegExp(`(^from$|^to$|^ref$|^label$|^set$|^attributes$|^expect$|^locations$|^artifacts$)`,`u`),RegExp(`(^label$|^attributes$|^removeAttributes$)`,`u`),RegExp(`(^columns$|^rows$|^relations$)`,`u`),RegExp(`(^cells$|^role$|^id$|^ref$|^kind$|^label$|^set$|^attributes$|^expect$|^locations$|^artifacts$)`,`u`),RegExp(`(^label$|^kind$|^cells$|^attributes$|^removeAttributes$)`,`u`),RegExp(`(^heading$|^depth$|^role$|^id$|^ref$)`,`u`),RegExp(`(^from$|^to$|^kind$|^ref$|^label$|^attributes$)`,`u`),RegExp(`(^id$|^ref$)`,`u`),RegExp(`(^title$|^time$|^rows$|^dependencies$|^comparedTo$|^periods$|^references$)`,`u`),RegExp(`^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$`,`u`),RegExp(`(^type$|^id$|^label$|^items$|^role$)`,`u`),RegExp(`(^type$|^start$|^end$|^id$|^label$|^kind$|^previous$|^role$)`,`u`),RegExp(`(^type$|^date$|^id$|^label$|^kind$|^previous$|^role$)`,`u`),RegExp(`(^type$|^label$)`,`u`),RegExp(`(^from$|^to$|^type$)`,`u`),RegExp(`(^label$|^date$)`,`u`),RegExp(`(^start$|^end$|^label$|^kind$)`,`u`),RegExp(`(^date$|^label$|^kind$)`,`u`)]});var Ji={[oe]:Hn,[fe]:ei,[he]:qi},Yi=e=>{let t=Ht(e),n=_e(t);return n===void 0&&t!==void 0?[{rule:`unsupported-version`,path:`/schema`,message:`this build validates ${ge.join(` and `)}`}]:Ji[n??`urn:structured-exchange:1`](e)?[]:[{rule:`schema/invalid`,path:``,message:`does not conform to the published structured-exchange schema`}]},Xi=Object.defineProperty,Zi=(e,t,n)=>t in e?Xi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qi=(e,t)=>{for(var n in t)Xi(e,n,{get:t[n],enumerable:!0})},$i=(e,t,n)=>Zi(e,typeof t==`symbol`?t:t+``,n),ea={};Qi(ea,{Graph:()=>za,alg:()=>pa});var ta=Object.defineProperty,na=(e,t)=>{for(var n in t)ta(e,n,{get:t[n],enumerable:!0})},ra=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected=`directed`in e?e.directed:!0,this._isMultigraph=`multigraph`in e&&e.multigraph,this._isCompound=`compound`in e&&e.compound),this._isCompound&&(this._parent={},this._children={},this._children[`\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=typeof e==`function`?e:()=>e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(e=>{t===void 0?this.setNode(e):this.setNode(e,t)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\0`,this._children[e]={},this._children[`\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(e=>{this.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\0`;else{t+=``;for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!==`\0`)return t}}children(e=`\0`){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e===`\0`)return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t),r=this.successors(e);if(r)for(let e of r)n.add(e);return Array.from(n.values())}}isLeaf(e){let t;return t=this.isDirected()?this.successors(e):this.neighbors(e),(t?.length??0)===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([n,r])=>{e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(e=>{t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,this.edge(e))});let n={},r=e=>{let i=this.parent(e);return!i||t.hasNode(i)?(n[e]=i,i):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,r(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=typeof e==`function`?e:()=>e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((e,n)=>(t===void 0?this.setEdge(e,n):this.setEdge(e,n,t),n)),this}setEdge(e,t,n,r){let i,a,o,s,c=!1;typeof e==`object`&&e&&`v`in e?(i=e.v,a=e.w,o=e.name,arguments.length===2&&(s=t,c=!0)):(i=e,a=t,o=r,arguments.length>2&&(s=n,c=!0)),i=``+i,a=``+a,o!==void 0&&(o=``+o);let l=oa(this._isDirected,i,a,o);if(l in this._edgeLabels)return c&&(this._edgeLabels[l]=s),this;if(o!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(i),this.setNode(a),this._edgeLabels[l]=c?s:this._defaultEdgeLabelFn(i,a,o);let u=sa(this._isDirected,i,a,o);return i=u.v,a=u.w,Object.freeze(u),this._edgeObjs[l]=u,ia(this._preds[a],i),ia(this._sucs[i],a),this._in[a][l]=u,this._out[i][l]=u,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?ca(this._isDirected,e):oa(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r!=`object`||!r?{label:r}:r}hasEdge(e,t,n){return(arguments.length===1?ca(this._isDirected,e):oa(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?ca(this._isDirected,e):oa(this._isDirected,e,t,n),i=this._edgeObjs[r];if(i){let e=i.v,t=i.w;delete this._edgeLabels[r],delete this._edgeObjs[r],aa(this._preds[t],e),aa(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(e=>e.v===t&&e.w===n||e.v===n&&e.w===t):r}};function ia(e,t){e[t]?e[t]++:e[t]=1}function aa(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function oa(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}return i+``+a+``+(r===void 0?`\0`:r)}function sa(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}let o={v:i,w:a};return r&&(o.name=r),o}function ca(e,t){return oa(e,t.v,t.w,t.name)}na({},{read:()=>fa,write:()=>la});function la(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:ua(e),edges:da(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function ua(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function da(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function fa(e){let t=new ra(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(e=>{t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(e=>{t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}var pa={};na(pa,{CycleException:()=>Oa,bellmanFord:()=>ha,components:()=>_a,dijkstra:()=>ba,dijkstraAll:()=>Sa,findCycles:()=>wa,floydWarshall:()=>Ea,isAcyclic:()=>Aa,postorder:()=>Pa,preorder:()=>Fa,prim:()=>Ia,shortestPaths:()=>La,tarjan:()=>Ca,topsort:()=>ka});var ma=()=>1;function ha(e,t,n,r){return ga(e,String(t),n||ma,r||function(t){return e.outEdges(t)??[]})}function ga(e,t,n,r){let i={},a,o=0,s=e.nodes(),c=function(e){let t=i[e.v],r=i[e.w];if(!t||!r)return;let o=n(e);t.distance+o<r.distance&&(i[e.w]={distance:t.distance+o,predecessor:e.v},a=!0)},l=function(){s.forEach(function(e){r(e).forEach(function(t){let n=t.v===e?t.v:t.w,r=n===t.v?t.w:t.v;c({v:n,w:r})})})};s.forEach(function(e){i[e]={distance:e===t?0:1/0,predecessor:``}});let u=s.length;for(let e=1;e<u&&(a=!1,o++,l(),a);e++);if(o===u-1&&(a=!1,l(),a))throw Error(`The graph contains a negative weight cycle`);return i}function _a(e){let t={},n=[],r;function i(n){var a,o;n in t||(t[n]=!0,r.push(n),(a=e.successors(n))==null||a.forEach(i),(o=e.predecessors(n))==null||o.forEach(i))}return e.nodes().forEach(function(e){r=[],i(e),r.length&&n.push(r)}),n}var va=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let e=this._arr,i=e.length;return n[r]=i,e.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){if(this.size()===0)throw Error(`Queue underflow`);this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){let t=this._arr,n=t[e].priority,r;for(;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){let n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}},ya=()=>1;function ba(e,t,n,r){return xa(e,String(t),n||ya,r||function(t){return e.outEdges(t)??[]})}function xa(e,t,n,r){let i={},a=new va,o,s,c=function(e){let t=e.v===o?e.w:e.v,r=i[t];if(!r)return;let c=n(e),l=s.distance+c;if(c<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+c);l<r.distance&&(r.distance=l,r.predecessor=o,a.decrease(t,l))};for(e.nodes().forEach(function(e){let n=e===t?0:1/0;i[e]={distance:n,predecessor:``},a.add(e,n)});a.size()>0;){o=a.removeMin();let e=i[o];if(!e||e.distance===1/0)break;s=e,r(o).forEach(c)}return i}function Sa(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=ba(e,i,t,n),r},{})}function Ca(e){let t=0,n=[],r={},i=[];function a(o){var s;let c=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),(s=e.successors(o))==null||s.forEach(function(e){if(e in r){let t=r[e];t!=null&&t.onStack&&(c.lowlink=Math.min(c.lowlink,t.index))}else{a(e);let t=r[e];t&&(c.lowlink=Math.min(c.lowlink,t.lowlink))}}),c.lowlink===c.index){let e=[],t;do{t=n.pop();let i=r[t];i&&(i.onStack=!1),e.push(t)}while(o!==t);i.push(e)}}return e.nodes().forEach(function(e){e in r||a(e)}),i}function wa(e){return Ca(e).filter(function(t){let n=t[0];return n?t.length>1||t.length===1&&(e.outEdges(n,n)??[]).length>0:!1})}var Ta=()=>1;function Ea(e,t,n){return Da(e,t||Ta,n||function(t){return e.outEdges(t)??[]})}function Da(e,t,n){let r={},i=e.nodes();return i.forEach(function(e){let a={};r[e]=a,a[e]={distance:0,predecessor:``},i.forEach(function(t){e!==t&&(a[t]={distance:1/0,predecessor:``})}),n(e).forEach(function(n){let r=n.v===e?n.w:n.v,i=t(n);a[r]={distance:i,predecessor:e}})}),i.forEach(function(e){let t=r[e];t&&i.forEach(function(n){let a=r[n];a&&i.forEach(function(n){let r=a[e],i=t[n],o=a[n];if(r&&i&&o){let e=r.distance+i.distance;e<o.distance&&(o.distance=e,o.predecessor=i.predecessor)}})})}),r}var Oa=class extends Error{constructor(e){super(e),this.name=`CycleException`}};function ka(e){let t={},n={},r=[];function i(a){var o;if(a in n)throw new Oa;a in t||(n[a]=!0,t[a]=!0,(o=e.predecessors(a))==null||o.forEach(i),delete n[a],r.push(a))}if(e.sinks().forEach(i),Object.keys(t).length!==e.nodeCount())throw new Oa;return r}function Aa(e){try{ka(e)}catch(e){if(e instanceof Oa)return!1;throw e}return!0}function ja(e,t,n,r,i){Array.isArray(t)||(t=[t]);let a=(t=>(e.isDirected()?e.successors(t):e.neighbors(t))??[]),o={};return t.forEach(function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);i=Ma(e,t,n===`post`,o,a,r,i)}),i}function Ma(e,t,n,r,i,a,o){return t in r||(r[t]=!0,n||(o=a(o,t)),i(t).forEach(function(t){o=Ma(e,t,n,r,i,a,o)}),n&&(o=a(o,t))),o}function Na(e,t,n){return ja(e,t,n,function(e,t){return e.push(t),e},[])}function Pa(e,t){return Na(e,t,`post`)}function Fa(e,t){return Na(e,t,`pre`)}function Ia(e,t){var n;let r=new ra,i={},a=new va,o;function s(e){let n=e.v===o?e.w:e.v,r=a.priority(n);if(r!==void 0){let s=t(e);s<r&&(i[n]=o,a.decrease(n,s))}}if(e.nodeCount()===0)return r;e.nodes().forEach(function(e){a.add(e,1/0),r.setNode(e)});let c=e.nodes()[0];c!==void 0&&a.decrease(c,0);let l=!1;for(;a.size()>0;){if(o=a.removeMin(),o in i)r.setEdge(o,i[o]);else{if(l)throw Error(`Input graph is not connected: `+e);l=!0}(n=e.nodeEdges(o))==null||n.forEach(s)}return r}function La(e,t,n,r){return Ra(e,t,n,r??(t=>e.outEdges(t)??[]))}function Ra(e,t,n,r){if(n===void 0)return ba(e,t,n,r);let i=!1,a=e.nodes();for(let o=0;o<a.length;o++){let s=a[o];if(s===void 0)continue;let c=r(s);for(let e=0;e<c.length;e++){let t=c[e];if(!t)continue;let r=t.v===s?t.v:t.w;n({v:r,w:r===t.v?t.w:t.v})<0&&(i=!0)}if(i)return ha(e,t,n,r)}return ba(e,t,n,r)}var za=ra;function Ba(e,t,n,r){let i=r;for(;e.hasNode(i);)i=no(r);return n.dummy=t,e.setNode(i,n),i}function Va(e){let t=new za().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function Ha(e){let t=new za({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function Ua(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function Wa(e){let t=ro(Za(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i]||(t[i]=[]),t[i][r.order]=n)}),t}function Ga(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=Xa(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function Ka(e){let t=e.nodes().map(t=>e.node(t).rank).filter(e=>e!==void 0),n=Xa(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function qa(e,t,n,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),Ba(e,`border`,i,t)}function Ja(e,t=Ya){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}var Ya=65535;function Xa(e,t){return t.length>Ya?e(...Ja(t).map(t=>e(...t))):e(...t)}function Za(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return Xa(Math.max,t)}function Qa(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function $a(e,t){let n=Date.now();try{return t()}finally{console.log(e+` time: `+(Date.now()-n)+`ms`)}}function eo(e,t){return t()}var to=0;function no(e){return e+(``+ ++to)}function ro(e,t,n=1){t??(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let i=[];for(let t=e;r(t);t+=n)i.push(t);return i}function io(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function ao(e,t){let n;return n=typeof t==`string`?e=>e[t]:t,Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function oo(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}var so=`\0`;function co(e,t,n){if(!(e&&t&&n&&t.dummy===`edge`&&n.dummy===`edge`&&t.edgeObj&&n.edgeObj&&e[t.edgeObj.v]&&e[n.edgeObj.v]&&e[t.edgeObj.w]&&e[n.edgeObj.w]))return 0;let r=!0;t.edgeObj.w===n.edgeObj.w&&(r=!1);let i=r?e[t.edgeObj.v]?.rank??NaN:e[t.edgeObj.w]?.rank??NaN,a=Object.entries(e).find(e=>e[1].edgeObj?.v===t.edgeObj.v&&e[1].edgeObj?.w===t.edgeObj.w&&e[1].rank===i),o=Object.entries(e).find(e=>e[1].edgeObj?.v===n.edgeObj.v&&e[1].edgeObj?.w===n.edgeObj.w&&e[1].rank===i);if(!a||!o)return 0;let s=a[1].order??NaN,c=o[1].order??NaN;return isNaN(s-c)?0:s-c}var lo=`3.1.1`,uo=class{constructor(){$i(this,`_sentinel`);let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return fo(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&fo(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,po)),n=n._prev;return`[`+e.join(`, `)+`]`}};function fo(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function po(e,t){if(e!==`_next`&&e!==`_prev`)return t}var mo=uo,ho=()=>1;function go(e,t){if(e.nodeCount()<=1)return[];let n=yo(e,t||ho);return _o(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w)||[])}function _o(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)vo(e,t,n,o);for(;o=i.dequeue();)vo(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i]?.dequeue(),o){r=r.concat(vo(e,t,n,o,!0)||[]);break}}}return r}function vo(e,t,n,r,i){let a=[],o=i?a:void 0;return(e.inEdges(r.v)||[]).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,bo(t,n,s)}),(e.outEdges(r.v)||[]).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,bo(t,n,o)}),e.removeNode(r.v),o}function yo(e,t){let n=new za,r=0,i=0;e.nodes().forEach(e=>{n.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s);let c=n.node(e.v),l=n.node(e.w);i=Math.max(i,c.out+=o),r=Math.max(r,l.in+=o)});let a=xo(i+r+3).map(()=>new mo),o=r+1;return n.nodes().forEach(e=>{bo(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function bo(e,t,n){var r,i,a;n.out?n.in?(a=e[n.out-n.in+t])==null||a.enqueue(n):(i=e[e.length-1])==null||i.enqueue(n):(r=e[0])==null||r.enqueue(n)}function xo(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}function So(e,t){(e.graph().acyclicer===`greedy`?go(e,n(e)):Co(e,t??null)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,no(`rev`))});function n(e){return t=>e.edge(t).weight}}function Co(e,t){let n=[],r={},i={};function a(t){Object.hasOwn(i,t)||(i[t]=!0,r[t]=!0,e.outEdges(t).forEach(e=>{Object.hasOwn(r,e.w)?n.push(e):a(e.w)}),delete r[t])}function o(a){var s;Object.hasOwn(i,a)||(i[a]=!0,r[a]=!0,(s=e.outEdges(a))==null||s.forEach(i=>{Object.hasOwn(r,i.w)||t.node(a)?.rank>t.node(i.w)?.rank&&To(e,i.w,i)?n.push(i):o(i.w)}),delete r[a])}let s=a;return t&&typeof t.node==`function`&&(s=o),e.sources().forEach(s),e.nodes().forEach(s),n}function wo(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function To(e,t,n){let r=new Set;function i(t){if(e.sources().includes(t))return!0;r.add(t);for(let a of e.inEdges(t)??[])if((a.v!==n.v||a.w!==n.w)&&!r.has(a.v)&&i(a.v))return!0;return!1}return i(t)}function Eo(e){e.graph().dummyChains=[],e.edges().forEach(t=>Do(e,t))}function Do(e,t){let n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a===r+1)return;e.removeEdge(t);let l,u,d;for(d=0,++r;r<a;++d,++r)s.points=[],u={width:0,height:0,edgeLabel:s,edgeObj:t,rank:r},l=Ba(e,`edge`,u,`_d`),r===c&&(u.width=s.width,u.height=s.height,u.dummy=`edge-label`,u.labelpos=s.labelpos),e.setEdge(n,l,{weight:s.weight},o),d===0&&e.graph().dummyChains.push(l),n=l;e.setEdge(n,i,{weight:s.weight},o)}function Oo(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}function ko(e){let t={};function n(r){let i=e.node(r);if(Object.hasOwn(t,r))return i.rank;t[r]=!0;let a=e.outEdges(r),o=a?a.map(t=>t==null?1/0:n(t.w)-e.edge(t).minlen):[],s=Xa(Math.min,o);return s===1/0&&(s=0),i.rank=s}e.sources().forEach(n)}function Ao(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var jo=Mo;function Mo(e){let t=new za({directed:!1}),n=e.nodes();if(n.length===0)throw Error(`Graph must have at least one node`);let r=n[0],i=e.nodeCount();t.setNode(r,{});let a,o;for(;No(t,e)<i&&(a=Po(t,e),a);)o=t.hasNode(a.v)?Ao(e,a):-Ao(e,a),Fo(t,e,o);return t}function No(e,t){function n(r){let i=t.nodeEdges(r);i&&i.forEach(i=>{let a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!Ao(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return e.nodes().forEach(n),e.nodeCount()}function Po(e,t){return t.edges().reduce((n,r)=>{let i=1/0;return e.hasNode(r.v)!==e.hasNode(r.w)&&(i=Ao(t,r)),i<n[0]?[i,r]:n},[1/0,null])[1]}function Fo(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}var{preorder:Io,postorder:Lo}=pa,Ro=zo;zo.initLowLimValues=Uo,zo.initCutValues=Bo,zo.calcCutValue=Ho,zo.leaveEdge=Go,zo.enterEdge=Ko,zo.exchangeEdges=qo;function zo(e){e=Va(e),ko(e);let t=jo(e);Uo(t),Bo(t,e);let n,r;for(;n=Go(t);)r=Ko(t,e,n),qo(t,e,n,r)}function Bo(e,t){let n=Lo(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>Vo(e,t,n))}function Vo(e,t,n){let r=e.node(n).parent,i=e.edge(n,r);i.cutvalue=Ho(e,t,n)}function Ho(e,t,n){let r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;a||=(i=!1,t.edge(r,n)),o=a.weight;let s=t.nodeEdges(n);return s&&s.forEach(a=>{let s=a.v===n,c=s?a.w:a.v;if(c!==r){let r=s===i,l=t.edge(a).weight;if(o+=r?l:-l,Yo(e,n,c)){let t=e.edge(n,c).cutvalue;o+=r?-t:t}}}),o}function Uo(e,t){arguments.length<2&&(t=e.nodes()[0]),Wo(e,{},1,t)}function Wo(e,t,n,r,i){let a=n,o=e.node(r);t[r]=!0;let s=e.neighbors(r);return s&&s.forEach(i=>{Object.hasOwn(t,i)||(n=Wo(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function Go(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function Ko(e,t,n){let r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);let a=e.node(r),o=e.node(i),s=a,c=!1;return a.lim>o.lim&&(s=o,c=!0),t.edges().filter(t=>c===Xo(e,e.node(t.v),s)&&c!==Xo(e,e.node(t.w),s)).reduce((e,n)=>Ao(t,n)<Ao(t,e)?n:e)}function qo(e,t,n,r){let i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),Uo(e),Bo(e,t),Jo(e,t)}function Jo(e,t){let n=e.nodes().find(t=>!e.node(t).parent);if(!n)return;let r=Io(e,[n]);r=r.slice(1),r.forEach(n=>{let r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function Yo(e,t,n){return e.hasEdge(t,n)}function Xo(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var Zo=Qo;function Qo(e){let t=e.graph().ranker;if(typeof t==`function`)return t(e);switch(t){case`network-simplex`:ts(e);break;case`tight-tree`:es(e);break;case`longest-path`:$o(e);break;case`none`:break;default:ts(e)}}var $o=ko;function es(e){ko(e),jo(e)}function ts(e){Ro(e)}var ns=rs;function rs(e){let t=as(e),n=e.graph();Array.isArray(n.dummyChains)&&n.dummyChains.forEach(n=>{let r=e.node(n),i=r.edgeObj,a=is(e,t,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;for(;n!==i.w;){if(r=e.node(n),u){for(;(l=o[c])!==s&&e.node(l).maxRank<r.rank;)c++;l===s&&(u=!1)}if(!u){for(;c<o.length-1&&e.node(o[c+1]).minRank<=r.rank;)c++;l=o[c]}l!==void 0&&e.setParent(n,l),n=e.successors(n)[0]}})}function is(e,t,n,r){let i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c;c=n;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));let l=c,u=r;for(;(u=e.parent(u))!==l;)a.push(u);return{path:i.concat(a.reverse()),lca:l}}function as(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children(so).forEach(r),t}function os(e){let t=Ba(e,`root`,{},`_root`),n=cs(e),r=Object.values(n),i=Xa(Math.max,r)-1,a=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=a);let o=ls(e)+1;e.children(so).forEach(r=>{ss(e,t,a,o,i,n,r)}),e.graph().nodeRankFactor=a}function ss(e,t,n,r,i,a,o){let s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}let c=qa(e,`_bt`),l=qa(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,s.forEach(s=>{ss(e,t,n,r,i,a,s);let u=e.node(s),d=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,p=u.borderTop?r:2*r,m=d===f?i-(a[o]??0)+1:1;e.setEdge(c,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,l,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+(a[o]??0)})}function cs(e){let t={};function n(r,i){let a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children(so).forEach(e=>n(e,1)),t}function ls(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function us(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}var ds=fs;function fs(e){function t(n){let r=e.children(n),i=e.node(n);if(r.length&&r.forEach(t),i&&Object.hasOwn(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(let t=i.minRank,r=i.maxRank+1;t<r;++t)ps(e,`borderLeft`,`_bl`,n,i,t),ps(e,`borderRight`,`_br`,n,i,t)}}e.children(so).forEach(t)}function ps(e,t,n,r,i,a){let o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],c=Ba(e,`border`,o,n);i[t][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}function ms(e){let t=e.graph().rankdir?.toLowerCase();(t===`lr`||t===`rl`)&&gs(e)}function hs(e){let t=e.graph().rankdir?.toLowerCase();(t===`bt`||t===`rl`)&&vs(e),(t===`lr`||t===`rl`)&&(bs(e),gs(e))}function gs(e){e.nodes().forEach(t=>_s(e.node(t))),e.edges().forEach(t=>_s(e.edge(t)))}function _s(e){let t=e.width;e.width=e.height,e.height=t}function vs(e){e.nodes().forEach(t=>ys(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(ys),Object.hasOwn(r,`y`)&&ys(r)})}function ys(e){e.y=-e.y}function bs(e){e.nodes().forEach(t=>xs(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(xs),Object.hasOwn(r,`x`)&&xs(r)})}function xs(e){let t=e.x;e.x=e.y,e.y=t}function Ss(e,t=null){let n={},r=e.nodes().filter(t=>!e.children(t).length),i=r.map(t=>e.node(t).rank),a=ro(Xa(Math.max,i)+1).map(()=>[]);function o(t){if(n[t])return;n[t]=!0;let r=e.node(t);a[r.rank].push(t);let i=e.successors(t);i&&[...i].sort((e,t)=>s(e,t)).forEach(o)}r.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(o);function s(n,r){return co(t,e.node(n),e.node(r))}return a}function Cs(e,t){let n=0;for(let r=1;r<t.length;++r)n+=ws(e,t[r-1],t[r]);return n}function ws(e,t,n){let r=oo(n,n.map((e,t)=>t)),i=t.flatMap(t=>{let n=e.outEdges(t);return n?n.map(t=>({pos:r[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos):[]}),a=1;for(;a<n.length;)a<<=1;let o=2*a-1;--a;let s=Array(o).fill(0),c=0;return i.forEach(e=>{let t=e.pos+a;s[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*n}),c}function Ts(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(!n||!n.length)return{v:t};{let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}})}function Es(e,t){let n={};return e.forEach((e,t)=>{let r={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight),n[e.v]=r}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(r))}),Ds(Object.values(n).filter(e=>!e.indegree))}function Ds(e){let t=[];function n(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&Os(e,t)}}function r(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(r(i))}return t.filter(e=>!e.merged).map(e=>io(e,[`vs`,`i`,`barycenter`,`weight`]))}function Os(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function ks(e,t,n,r,i){let a={},o=null,s=null,c=i;typeof t==`boolean`?(c=t,a={}):t&&(a=t,o=n??null,s=r??null);let l=Qa(e,e=>Object.hasOwn(e,`barycenter`)),u=l.lhs,d=l.rhs.sort((e,t)=>t.i-e.i),f=[],p=0,m=0,h=0;u.sort(js(s,o,!!c));for(let[e,t]of Object.entries(a)){let n=u.findIndex(t=>t.vs[0]===e);u.splice(n+1,0,t)}h=As(f,d,h),u.forEach(e=>{h+=e.vs.length,f.push(e.vs),p+=e.barycenter*e.weight,m+=e.weight,h=As(f,d,h)});let g={vs:f.flat(1)};return m&&(g.barycenter=p/m,g.weight=m),g}function As(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function js(e,t,n){return(r,i)=>{if(r.barycenter<i.barycenter)return-1;if(r.barycenter>i.barycenter)return 1;if(e&&(typeof r.vs[0]==`string`||typeof i.vs[0]==`string`)){let n=co(t,e.node(r.vs[0]),e.node(i.vs[0]));if(n!==0)return n}return n?i.i-r.i:r.i-i.i}}function Ms(e,t,n,r,i){var a,o;let s=null,c=i;typeof r==`boolean`?(c=r,s=null):r!==void 0&&(s=r);let l=e.children(t),u=e.node(t),d=u?u.borderLeft:void 0,f=u?u.borderRight:void 0,p={};d&&(l=l.filter(e=>e!==d&&e!==f));let m=Ts(e,l);m.forEach(t=>{if(e.children(t.v).length){let{result:r}=Ms(e,t.v,n,s,c);p[t.v]=r,Object.hasOwn(r,`barycenter`)&&Ps(t,r)}});let h=Es(m,n);Ns(h,p);let g={},_=!1;for(let t=0;t<h.length;t++)for(let n=t+1;n<h.length;n++)if(!(!h[t]||!h[n]||!((a=h[t])!=null&&a.barycenter)||!((o=h[n])!=null&&o.barycenter))&&h[t]?.barycenter===h[n].barycenter){let r=h[t]?.vs[0]??``,i=h[n]?.vs[0]??``,a=e.node(r),o=e.node(i);if(a.dummy===`edge`&&o.dummy===`edge`&&a.edgeObj?.v===o.edgeObj?.v&&a.edgeObj?.w===o.edgeObj?.w){if(a.edgeLabel.reversed){g[i]=h[t],h.splice(t,1),t--;break}g[r]=h[n],h.splice(n,1),n--}else _=!0}let v=ks(h,g,s,e,c);if(d&&f){v.vs=[d,v.vs,f].flat(1);let t=e.predecessors(d);if(t&&t.length){let n=e.node(t[0]),r=e.predecessors(f),i=e.node(r[0]);Object.hasOwn(v,`barycenter`)||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+n.order+i.order)/(v.weight+2),v.weight+=2}}return Object.defineProperty(v,"result",{value:v,enumerable:!1,configurable:!0,writable:!0}),Object.defineProperty(v,"usedBias",{value:_,enumerable:!1,configurable:!0,writable:!0}),v}function Ns(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function Ps(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function Fs(e,t,n,r){r||=e.nodes();let i=Is(e),a=new za({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t));return r.forEach(r=>{let o=e.node(r),s=e.parent(r);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){a.setNode(r),a.setParent(r,s||i);let c=e[n](r);c&&c.forEach(t=>{let n=t.v===r?t.w:t.v,i=a.edge(n,r),o=i===void 0?0:i.weight;a.setEdge(n,r,{weight:e.edge(t).weight+o})}),Object.hasOwn(o,`minRank`)&&a.setNode(r,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),a}function Is(e){let t;for(;e.hasNode(t=no(`_root`)););return t}function Ls(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}function Rs(e,t={},n=null){if(typeof t.customOrder==`function`){t.customOrder(e,Rs);return}let r=Za(e),i=zs(e,ro(1,r+1),`inEdges`),a=zs(e,ro(r-1,-1,-1),`outEdges`),o=Ss(e,n);if(Vs(e,o),t.disableOptimalOrderHeuristic)return;let s=1/0,c,l=t.constraints||[];for(let t=0,r=0;r<4;++t,++r){Bs(t%2?i:a,t%4>=2,l,n),o=Wa(e);let u=Cs(e,o);u<s?(r=0,c=Object.assign({},o),s=u):u===s&&(c=structuredClone(o))}Vs(e,c)}function zs(e,t,n){let r=new Map,i=(e,t)=>{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if(typeof n.rank==`number`&&i(n.rank,t),typeof n.minRank==`number`&&typeof n.maxRank==`number`)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&i(e,t)}return t.map(function(t){return Fs(e,t,n,r.get(t)||[])})}function Bs(e,t,n,r){let i=!0,a=new za;e.forEach(function(e){n.forEach(e=>a.setEdge(e.left,e.right));let o=e.graph().root,{result:s,usedBias:c}=Ms(e,o,a,r,i);t&&c&&(i=!i),s.vs.forEach((t,n)=>e.node(t).order=n),Ls(e,a,s.vs)})}function Vs(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}function Hs(e,t){let n={};function r(t,r){let i=0,a=0,o=t.length,s=r[r.length-1];return r.forEach((t,c)=>{let l=Ws(e,t),u=l?e.node(l).order:o;(l||t===s)&&(r.slice(a,c+1).forEach(t=>{let r=e.predecessors(t);r&&r.forEach(r=>{let a=e.node(r),o=a.order;(o<i||u<o)&&!(a.dummy&&e.node(t).dummy)&&Gs(n,r,t)})}),a=c+1,i=u)}),r}return t.length&&t.reduce(r),n}function Us(e,t){let n={};function r(t,r,i,a,o){ro(r,i).forEach(r=>{let i=t[r];if(i!==void 0&&e.node(i).dummy){let t=e.predecessors(i);t&&t.forEach(t=>{if(t===void 0)return;let r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&Gs(n,t,i)})}})}function i(t,n){let i=-1,a=-1,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);if(t&&t.length){let s=t[0];if(s===void 0)return;a=e.node(s).order,r(n,o,c,i,a),o=c,i=a}}r(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(i),n}function Ws(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(t=>e.node(t).dummy)}}function Gs(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function Ks(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function qs(e,t,n,r,i){let a={},o={},s={};return t.forEach(e=>{e.forEach((e,t)=>{a[e]=e,o[e]=e,s[e]=t})}),t.forEach(t=>{let c=-1,l=-1,u=!1,d=t,f=t.findIndex(t=>i?.includes(t)||nc(t,e,i));f>0&&(d=[t[f],...t.slice(0,f),...t.slice(f+1)],u=!0),d.forEach(t=>{let d=r(t);if(d&&d.length){i!=null&&i.includes(t)&&(d=d.filter(t=>nc(t,e,i)));let r=d.sort((e,t)=>{let n=s[e],r=s[t];return(n===void 0?0:n)-(r===void 0?0:r)}),f=(r.length-1)/2;for(let e=Math.floor(f),i=Math.ceil(f);e<=i;++e){let i=r[e];if(i===void 0)continue;let d=s[i];if(d!==void 0&&o[t]===t&&c<d&&s[i]!==l&&!Ks(n,t,i)){let e=a[i];e!==void 0&&(o[i]=t,o[t]=a[t]=e,c=d,u&&=(c=-1,l=s[i]??-1,!1))}}}})}),{root:a,align:o}}function Js(e,t,n,r,i=!1){let a={},o=Ys(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){let n=o.nodes().slice(),r={},i=n.pop();for(;i;){if(r[i])e(i);else{r[i]=!0,n.push(i);for(let e of t(i))n.push(e)}i=n.pop()}}function l(e){let t=o.inEdges(e);t?a[e]=t.reduce((e,t)=>{let n=a[t.v]??0,r=o.edge(t);return Math.max(e,n+(r===void 0?0:r))},0):a[e]=0}function u(t){let n=o.outEdges(t),r=1/0;n&&(r=n.reduce((e,t)=>{let n=a[t.w],r=o.edge(t);return Math.min(e,(n===void 0?0:n)-(r===void 0?0:r))},1/0));let i=e.node(t);r!==1/0&&i.borderType!==s&&(a[t]=Math.max(a[t]===void 0?0:a[t],r))}function d(e){return o.predecessors(e)||[]}function f(e){return o.successors(e)||[]}return c(l,d),c(u,f),Object.keys(r).forEach(e=>{let t=n[e];t!==void 0&&(a[e]=a[t]??0)}),a}function Ys(e,t,n,r){let i=new za,a=e.graph(),o=ec(a.nodesep,a.edgesep,r);return t.forEach(t=>{let r;t.forEach(t=>{let a=n[t];if(a!==void 0){if(i.setNode(a),r!==void 0){let s=n[r];if(s!==void 0){let n=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),n||0))}}r=t}})}),i}function Xs(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=tc(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[1/0,null])[1]}function Zs(e,t){let n=Object.values(t),r=Xa(Math.min,n),i=Xa(Math.max,n);[`u`,`d`].forEach(n=>{[`l`,`r`].forEach(a=>{let o=n+a,s=e[o];if(!s||s===t)return;let c=Object.values(s),l=r-Xa(Math.min,c);a!==`l`&&(l=i-Xa(Math.max,c)),l&&(e[o]=ao(s,e=>e+l))})})}function Qs(e,t=void 0){let n=e.ul;return n?ao(n,(n,r)=>{if(t){let n=e[t.toLowerCase()];if(n&&n[r]!==void 0)return n[r]}let i=Object.values(e).map(e=>{let t=e[r];return t===void 0?0:t}).sort((e,t)=>e-t);return((i[1]??0)+(i[2]??0))/2}):{}}function $s(e,t){let n=Wa(e),r=Object.assign(Hs(e,n),Us(e,n)),i={},a;return[`u`,`d`].forEach(o=>{a=o===`u`?n:Object.values(n).reverse(),[`l`,`r`].forEach(n=>{n===`r`&&(a=a.map(e=>Object.values(e).reverse()));let s=qs(e,a,r,t=>(o===`u`?e.predecessors(t):e.successors(t))||[],t),c=Js(e,a,s.root,s.align,n===`r`);n===`r`&&(c=ao(c,e=>-e)),i[o+n]=c})}),Zs(i,Xs(e,i)),Qs(i,e.graph().align)}function ec(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2;break}if(l&&(c+=n?l:-l),l=void 0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2;break}return l&&(c+=n?l:-l),c}}function tc(e,t){return e.node(t).width}function nc(e,t,n){if(!n)return!1;let r=t.node(e)?.edgeObj;if(!r||t.node(e).edgeLabel.reversed)return!1;let i=n.indexOf(r?.v),a=n.indexOf(r?.w);return i!==-1&&a!==-1&&i===(a+1)%n.length||i===(a-1)%n.length}function rc(e,t){e=Ha(e),ic(e),Object.entries($s(e,t)).forEach(([t,n])=>e.node(t).x=n)}function ic(e){let t=Wa(e),n=e.graph(),r=n.ranksep,i=n.rankalign,a=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height??0;return t>r?t:r},0);t.forEach(t=>{let r=e.node(t);r.y=i===`top`?a+r.height/2:i===`bottom`?a+n-r.height/2:a+n/2}),a+=n+r})}var ac=new WeakMap;function oc(e,t={}){return cc(e,eo,t),e}function sc(e,t,n){let r=t;for(;r!==void 0;){let t=e.parent(r);if(t===n)return r;r=t}}function cc(e,t,n){let r=e.nodes().filter(t=>e.children(t).length),i={};r.forEach(r=>{let a=e.node(r);if(a&&a.rankdir){let o=new za({multigraph:!0,compound:!0});o.setGraph({rankdir:a.rankdir});let s=e.children(r);s.forEach(t=>{let n={...e.node(t)};o.setNode(t,n);let i=e.parent(t);i&&i!==r&&s.includes(i)&&o.setParent(t,i)});let c=new Set;e.edges().forEach(t=>{let n=sc(e,t.v,r),i=sc(e,t.w,r);if(n&&i&&n!==i){let r=`${n}\0${i}`;c.has(r)||(c.add(r),o.setEdge(n,i,{...e.edge(t)}))}}),cc(o,t,n);let l=yc(o);lc(l,t,n,null),uc(o,l);let u=1/0,d=1/0,f=-1/0,p=-1/0;o.nodes().forEach(e=>{if(e===r)return;let t=o.node(e);t&&typeof t.x==`number`&&typeof t.y==`number`&&typeof t.width==`number`&&typeof t.height==`number`&&(u=Math.min(u,t.x-t.width/2),f=Math.max(f,t.x+t.width/2),d=Math.min(d,t.y-t.height/2),p=Math.max(p,t.y+t.height/2))}),(!isFinite(u)||!isFinite(d)||!isFinite(f)||!isFinite(p))&&(u=d=0,f=p=0);let m=f-u,h=p-d;i[r]={minX:u,minY:d,maxX:f,maxY:p,width:m,height:h,offsetX:u,offsetY:d},a._dagreClusterSubgraph=o}});let a=[],o=t=>{let n=[],r=(e.children(t)||[]).filter(e=>e!==t);for(;r.length>0;){let t=r.shift();n.push(t),(e.children(t)||[]).filter(e=>e!==t).forEach(e=>r.push(e))}return n},s=new Map;r.forEach(t=>{let n=e.node(t);n&&n.rankdir&&i[t]&&s.set(t,(e.children(t)||[]).filter(e=>e!==t))});let c=new Set([...s.values()].flat()),l=new Map;s.forEach((e,t)=>{c.has(t)||l.set(t,o(t))});let u=new Set([...l.values()].flat()),d=e=>{for(let[t,n]of l)if(n.includes(e))return t;return e},f=[];e.edges().forEach(t=>{(u.has(t.v)||u.has(t.w))&&f.push({edge:t,label:e.edge(t)})});let p=new Map;u.forEach(t=>{let n=e.parent(t);p.set(t,typeof n==`string`?n:void 0)}),l.forEach((t,n)=>{let r=e.node(n),o=[];t.forEach(t=>{let n=e.node(t);n&&(o.push({id:t,node:n,parent:p.get(t)}),e.removeNode(t))});let s=f.filter(({edge:e})=>t.includes(e.v)||t.includes(e.w)),c=i[n];r&&(a.push({clusterId:n,subgraph:r._dagreClusterSubgraph,bounds:c,children:t,removedNodes:o,removedEdges:s}),r.width=c.width,r.height=c.height)});let m=new Set;f.forEach(({edge:t,label:n})=>{let r=d(t.v),i=d(t.w);if(r!==i&&e.hasNode(r)&&e.hasNode(i)){let t=`${r}\0${i}`;m.has(t)||(m.add(t),e.setEdge(r,i,{...n,width:0,height:0}))}});let h=yc(e),g=lc(h,t,n,ac.get(e)??null);ac.set(e,g),uc(e,h),m.forEach(t=>{let n=t.indexOf(`\0`),r=t.slice(0,n),i=t.slice(n+1);e.hasEdge(r,i)&&e.removeEdge(r,i)}),a.forEach(({clusterId:t,subgraph:n,bounds:r,removedNodes:i,removedEdges:a})=>{let o=e.node(t),s=o?.x??0,c=o?.y??0,l=(r.minX+r.maxX)/2,u=(r.minY+r.maxY)/2;i.forEach(({id:t,node:n,parent:r})=>{e.setNode(t,n),r!==void 0&&e.setParent(t,r)}),a.forEach(({edge:t,label:n})=>{e.setEdge(t,n)}),n.nodes().forEach(r=>{if(r===t)return;let i=n.node(r),a=e.node(r);a&&i&&typeof i.x==`number`&&typeof i.y==`number`&&(a.x=s+(i.x-l),a.y=c+(i.y-u))}),delete o._dagreClusterSubgraph}),r.forEach(t=>{let n=e.node(t),r=i[t];if(n&&n.rankdir&&n._dagreClusterSubgraph&&r){let i=n._dagreClusterSubgraph,a=n.x??0,o=n.y??0,s=(r.minX+r.maxX)/2,c=(r.minY+r.maxY)/2;i.nodes().forEach(n=>{if(n===t)return;let r=i.node(n),l=e.node(n);if(l&&r&&typeof r.x==`number`&&typeof r.y==`number`){let e=r.x-s,t=r.y-c;l.x=a+e,l.y=o+t}}),delete n._dagreClusterSubgraph}})}function lc(e,t,n,r=null){var i,a;let o=n?.useDynamic!==!1,s=o&&(i=r?.graph)!=null?i:null,c=o&&(a=r?.rawNodes)!=null?a:null;t(` makeSpaceForEdgeLabels`,()=>bc(e)),t(` removeSelfEdges`,()=>kc(e)),t(` acyclic`,()=>So(e,s)),t(` nestingGraph.run`,()=>os(e)),t(` rank`,()=>Zo(Ha(e))),t(` injectEdgeLabelProxies`,()=>xc(e)),t(` removeEmptyRanks`,()=>Ka(e)),t(` nestingGraph.cleanup`,()=>us(e)),t(` normalizeRanks`,()=>Ga(e)),t(` assignRankMinMax`,()=>Sc(e)),t(` removeEdgeLabelProxies`,()=>Cc(e)),t(` normalize.run`,()=>Eo(e)),t(` parentDummyChains`,()=>ns(e)),t(` addBorderSegments`,()=>ds(e)),t(` order`,()=>Rs(e,n,c)),t(` insertSelfEdges`,()=>Ac(e)),t(` adjustCoordinateSystem`,()=>ms(e)),t(` position`,()=>rc(e,n.corePath)),t(` positionSelfEdges`,()=>jc(e));let l=JSON.parse(JSON.stringify(e._nodes));return t(` removeBorderNodes`,()=>Oc(e)),t(` normalize.undo`,()=>Oo(e)),t(` fixupEdgeLabelCoords`,()=>Ec(e)),t(` undoCoordinateSystem`,()=>hs(e)),t(` translateGraph`,()=>wc(e)),t(` assignNodeIntersects`,()=>Tc(e)),t(` reversePoints`,()=>Dc(e)),t(` acyclic.undo`,()=>wo(e)),{graph:e,rawNodes:l}}function uc(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.order=i.order,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var dc=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],fc={ranksep:50,edgesep:20,nodesep:50,rankdir:`TB`,rankalign:`center`},pc=[`acyclicer`,`ranker`,`rankdir`,`align`,`rankalign`],mc=[`width`,`height`,`rank`],hc={width:0,height:0},gc=[`minlen`,`weight`,`width`,`height`,`labeloffset`],_c={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},vc=[`labelpos`];function yc(e){let t=new za({multigraph:!0,compound:!0}),n=Nc(e.graph());return t.setGraph(Object.assign({},fc,Mc(n,dc),io(n,pc))),e.nodes().forEach(n=>{let r=Mc(Nc(e.node(n)),mc);Object.keys(hc).forEach(e=>{r[e]===void 0&&(r[e]=hc[e])}),t.setNode(n,r);let i=e.parent(n);i!==void 0&&t.setParent(n,i)}),e.edges().forEach(n=>{let r=Nc(e.edge(n));t.setEdge(n,Object.assign({},_c,Mc(r,gc),io(r,vc)))}),t}function bc(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,(r.labelpos??`r`).toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function xc(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v);Ba(e,`edge-proxy`,{rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t},`_ep`)}})}function Sc(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function Cc(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy===`edge-proxy`){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function wc(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function Tc(e){e.edges().forEach(t=>{if(t.v===t.w)return;let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(Ua(r,a)),n.points.push(Ua(i,o))})}function Ec(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset;break}})}function Dc(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function Oc(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function kc(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function Ac(e){Wa(e).forEach(t=>{let n=0;t.forEach((t,r)=>{let i=e.node(t);typeof i.rank!=`number`&&(i.rank=0),i.order=r+n,(i.selfEdges||[]).forEach(t=>{Ba(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,edgeLabel:t.label},`_se`),(!Array.isArray(t.label.points)||t.label.points.length!==7)&&(t.label.points=[{x:0,y:-10},{x:0,y:-10},{x:0,y:0},{x:0,y:10},{x:0,y:10},{x:0,y:0},{x:0,y:0}])}),delete i.selfEdges})})}function jc(e){e.nodes().forEach(t=>{let n=e.node(t),r=e=>typeof e==`number`&&isFinite(e);if(n.dummy===`selfedge`){let i=n,a=e.node(i.e.v),o=r(a?.x)?a.x:0,s=r(a?.y)?a.y:0,c=r(a?.width)?a.width:0,l=r(a?.height)?a.height:0,u=r(n.x)?n.x:o,d=r(n.y)?n.y:s,f=c/2,p=l/2;i.edgeLabel.points=[{x:u+f,y:d-p},{x:u+f,y:d-p},{x:u,y:d},{x:u-f,y:d+p},{x:u-f,y:d+p},{x:u,y:d},{x:u,y:d}],i.edgeLabel.x=u,i.edgeLabel.y=d,e.setEdge(i.e,i.edgeLabel),e.removeNode(t)}else n&&Array.isArray(n.selfEdges)&&n.selfEdges.forEach(e=>{if(!Array.isArray(e.label.points)||e.label.points.length!==7){let t=r(n.x)?n.x:0,i=r(n.y)?n.y:0,a=r(n.width)?n.width:0,o=r(n.height)?n.height:0,s=a/2,c=o/2;e.label.points=[{x:t+s,y:i-c},{x:t+s,y:i-c},{x:t,y:i},{x:t-s,y:i+c},{x:t-s,y:i+c},{x:t,y:i},{x:t,y:i}]}})})}function Mc(e,t){return ao(io(e,t),Number)}function Nc(e){let t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}function Pc(e){let t=Wa(e),n=new za({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{n.setNode(t,{label:t}),n.setParent(t,`layer`+e.node(t).rank)}),e.edges().forEach(e=>n.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{let r=`layer`+t;n.setNode(r,{rank:`same`}),e.reduce((e,t)=>(n.setEdge(e,t,{style:`invis`}),t))}),n}var Fc={graphlib:ea,version:lo,layout:oc,debug:Pc,util:{time:$a,notime:eo}};function Ic(e,t){return t?e.ref===void 0?`added`:e.set===void 0?`context`:`changed`:`unchanged`}function Lc(e,t){if(t&&e.heading===void 0)return e.ref===void 0?`added`:e.set===void 0?`context`:`changed`}function Rc(e,t){return t?e.ref===void 0?`added`:e.set===void 0?`context`:`changed`:`unchanged`}function zc(e){let t=e.set;if(t===void 0)return[];let n=e;return Object.entries(t).filter(([e])=>e!==`attributes`&&e!==`removeAttributes`).map(([e,t])=>{let r=n[e];return{field:e,...typeof r==`string`?{from:r}:{},to:String(t)}})}var Bc={added:`added`,changed:`changed`,context:`existing`,unchanged:``},Vc={added:`added`,changed:`changed`,context:`existing`,removed:`removed`},Hc=[`added`,`changed`,`context`,`removed`];function Uc(e){return e.rows.some(e=>ue(e).role!==void 0)}function Wc(e,t){if(t)return ue(e).role??`context`}function Gc(e){if(e.length===0)return;let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y)),r=Math.max(...e.map(e=>e.x+e.width)),i=Math.max(...e.map(e=>e.y+e.height));return{x:t-Yc,y:n-Yc-Xc,width:r-t+Yc*2,height:i-n+Yc*2+Xc}}var Kc=64,qc=24,Jc=12,Yc=10,Xc=16,Zc=16,Qc=160,$c=52;function el(e,t,n=`landscape`){let r=new Fc.graphlib.Graph({compound:!0,multigraph:!0});r.setGraph({rankdir:n===`portrait`?`TB`:`LR`,ranksep:Kc,nodesep:qc,marginx:Jc,marginy:Jc}),r.setDefaultEdgeLabel(()=>({}));for(let n of e.nodes)r.setNode(n.id,t(n));let i=e.containers??[],a=new Map;for(let t of e.nodes)t.container!==void 0&&i.some(e=>e.id===t.container)&&(r.setNode(t.container,{label:t.container}),r.setParent(t.id,t.container),a.set(t.container,[...a.get(t.container)??[],t.id]));e.edges.forEach((e,t)=>{e.from!==e.to&&r.hasNode(e.from)&&r.hasNode(e.to)&&r.setEdge(e.from,e.to,{},String(t))}),Fc.layout(r);let o=e.nodes.map(e=>{let n=r.node(e.id),{width:i,height:a}=t(e);return{id:e.id,x:(n?.x??Jc+i/2)-i/2,y:(n?.y??Jc+a/2)-a/2,width:i,height:a}}),s=[];e.edges.forEach((e,t)=>{if(e.from===e.to)return;let n=r.edge(e.from,e.to,String(t));n?.points!==void 0&&n.points.length>0&&s.push({index:t,points:n.points.map(e=>({x:e.x,y:e.y}))})});let c=[],l=o.reduce((e,t)=>Math.max(e,t.y+t.height),Jc)+Zc,u=new Map(o.map(e=>[e.id,e]));for(let e of i){let t=Gc((a.get(e.id)??[]).flatMap(e=>{let t=u.get(e);return t===void 0?[]:[t]}));t===void 0?(c.push({id:e.id,label:e.label,x:Jc,y:l,width:Qc,height:$c}),l+=68):c.push({id:e.id,label:e.label,...t})}let d=[...o.map(e=>({x:e.x,y:e.y,width:e.width,height:e.height})),...c],f=Math.min(0,...d.map(e=>e.x))-Jc,p=Math.min(0,...d.map(e=>e.y))-Jc;if(f<0||p<0){for(let e of o)e.x-=f,e.y-=p;for(let e of c)e.x-=f,e.y-=p;for(let e of s)for(let t of e.points)t.x-=f,t.y-=p}let m=[...o.map(e=>({x:e.x,y:e.y,width:e.width,height:e.height})),...c].reduce((e,t)=>({width:Math.max(e.width,t.x+t.width),height:Math.max(e.height,t.y+t.height)}),{width:0,height:0});return{nodes:o,edges:s,containers:c,width:m.width+Jc,height:m.height+Jc}}var tl={attributes:[],expectations:[],assignments:[],removedAttributes:[],locations:[],artifacts:[]};function nl(e){if(typeof e!=`object`||!e)return tl;let t=e,n=e=>typeof e==`object`&&e&&!Array.isArray(e)?Object.entries(e):[],r=t.set,i=r?.removeAttributes;return{attributes:n(t.attributes),expectations:n(t.expect?.attributes),assignments:n(r?.attributes),removedAttributes:Array.isArray(i)?i.filter(e=>typeof e==`string`):[],locations:Array.isArray(t.locations)?t.locations:[],artifacts:Array.isArray(t.artifacts)?t.artifacts:[]}}function rl(e){let t=e.target;if(typeof t==`string`)return{ref:t};if(typeof t!=`object`||!t)return;let n=t;if(typeof n.ref==`string`)return{ref:n.ref,...typeof n.revision==`string`?{revision:n.revision}:{}}}function il(e,t){let n=(e.removals??[]).map(e=>({type:e.type,ref:e.ref})),r=e.profile,i=e.artifacts,a={...typeof r==`string`?{profile:r}:{},...(()=>{let t=rl(e);return t===void 0?{}:{target:t}})(),artifacts:Array.isArray(i)?i:[]};if(e.kind===`table`){let r=e.data,i=Uc(r),o=r.rows.map(e=>{let n=Array.isArray(e)?{}:e,r=(Array.isArray(e)?void 0:e.role)??Lc({ref:typeof n.ref==`string`?n.ref:void 0,set:n.set,heading:typeof n.heading==`string`?n.heading:void 0},t)??Wc(e,i),{cells:a,heading:o}=ue(e),s=Array.isArray(e)?{}:e;return{cells:a,...r===void 0?{}:{role:r},...o===void 0?{}:{heading:o},...typeof s.depth==`number`?{depth:s.depth}:{},...typeof s.id==`string`?{id:s.id}:{},...typeof s.ref==`string`?{ref:s.ref}:{},...typeof s.kind==`string`?{kind:s.kind}:{},changes:zc(s),...nl(e)}}),s=new Map;for(let e of o){if(e.id===void 0)continue;let t=e.cells.find(e=>typeof e==`string`&&e!==``);s.set(e.id,(typeof t==`string`?t:void 0)??e.ref??e.id)}let c=r.relations,l=(Array.isArray(c)?c:[]).map(e=>{let t=e,n=e=>{let t=typeof e?.id==`string`?e.id:void 0,n=typeof e?.ref==`string`?e.ref:void 0;return{id:t,ref:n,label:(t===void 0?void 0:s.get(t))??n??t??``}},r=n(t.from),i=n(t.to);return{kind:t.kind??``,...typeof t.label==`string`?{label:t.label}:{},...r.id===void 0?{}:{fromRow:r.id},...i.id===void 0?{}:{toRow:i.id},...r.ref===void 0?{}:{fromRef:r.ref},...i.ref===void 0?{}:{toRef:i.ref},fromLabel:r.label,toLabel:i.label}});return{thingNoun:`column`,linkNoun:`row`,things:[],links:[],columns:r.columns,rows:o,containers:[],removals:n,traces:l,...a}}if(e.kind===`timeline`)return{thingNoun:`task`,linkNoun:`dependency`,things:[],links:[],containers:[],removals:n,traces:[],...a};let o=e.kind===`graph`,s=o?e.data.nodes:e.data.participants,c=o?e.data.edges:e.data.messages,l=new Map(s.map(e=>[e.id,al(e)]));return{thingNoun:o?`element`:`participant`,linkNoun:o?`relationship`:`message`,things:s.map(e=>({id:e.id,label:al(e),kind:e.kind,role:Ic(e,t),changes:zc(e),container:e.container,...nl(e)})),links:c.map(e=>({from:e.from,to:e.to,fromLabel:l.get(e.from)??e.from,toLabel:l.get(e.to)??e.to,label:e.label,kind:`kind`in e?e.kind:void 0,role:Rc(e,t),changes:zc(e),isLoop:e.from===e.to,...nl(e)})),containers:e.data.containers??[],removals:n,traces:[],...a}}function al(e){return e.label??e.ref??e.id}function ol(e){if(e.kind===`graph`){let t=e.data,n=[`flowchart TD`],r=t.containers??[],i=new Set(r.map(e=>e.id)),a=e=>t.nodes.filter(t=>t.container===e);for(let e of r){n.push(` subgraph ${sl(e.id)}["${ll(e.label)}"]`);for(let t of a(e.id))n.push(` ${sl(t.id)}["${ll(al(t))}"]`);n.push(` end`)}for(let e of t.nodes)e.container!==void 0&&i.has(e.container)||n.push(` ${sl(e.id)}["${ll(al(e))}"]`);for(let e of t.edges){let t=e.label??e.kind,r=t===void 0?`-->`:`-- "${ll(t)}" -->`;n.push(` ${sl(e.from)} ${r} ${sl(e.to)}`)}return n.join(`
|
|
7
7
|
`)}if(e.kind===`sequence`){let t=e.data,n=[`sequenceDiagram`],r=t.containers??[],i=new Set(r.map(e=>e.id)),a=(e,t)=>`${t}participant ${sl(e.id)} as "${ll(al(e))}"`;for(let e of r){n.push(` box ${ll(e.label)}`);for(let r of t.participants.filter(t=>t.container===e.id))n.push(a(r,` `));n.push(` end`)}for(let e of t.participants)e.container!==void 0&&i.has(e.container)||n.push(a(e,` `));for(let e of t.messages)n.push(` ${sl(e.from)}->>${sl(e.to)}: ${ll(e.label??``)}`);return n.join(`
|
|
8
|
-
`)}}function sl(e){return`n${[...e].map(e=>e.charCodeAt(0).toString(36)).join(``)}`}var cl={"#":`#35;`,'"':`#quot;`,";":`#59;`,"<":`#60;`,">":`#62;`};function ll(e){return e.replace(/[#";<>]/g,e=>cl[e]).replace(/[\r\n\t\f\v\u0000-\u001f\u2028\u2029]+/g,` `)}function ul(e,t){return`${e}:${t}`}var dl=new Set;function fl(e,t,n){return n===void 0||n===``?!1:e.has(ul(t,n))}function pl(e){let t=e?.viewpoints;return Array.isArray(t)?t:[]}function ml(e,t){let n=new Set,r=(e,t,r)=>{if(t===void 0)return;let i=new Set(t);for(let t of e)t.kind!==void 0&&t.kind!==``&&!i.has(t.kind)&&n.add(ul(r,t.kind))};return r(e.nodes,t.elementKinds,`element`),r(e.edges,t.relationshipKinds,`relationship`),n}function hl(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}var gl=40,_l=22;function vl(e){let t=e.containers??[],n;if(t.length===0)n=e.participants;else{let r=new Set(t.map(e=>e.id)),i=new Set;n=[];for(let t of e.participants){if(i.has(t.id))continue;let a=t.container;if(a===void 0||!r.has(a)){n.push(t),i.add(t.id);continue}for(let t of e.participants)t.container!==a||i.has(t.id)||(n.push(t),i.add(t.id))}}let r=[];n.forEach((e,n)=>{let i=t.find(t=>t.id===e.container);if(i===void 0)return;let a=r.at(-1);a!==void 0&&a.container.id===i.id&&a.to===n-1?a.to=n:r.push({container:i,from:n,to:n})});let i=t.length>0?_l:0,a=new Map(n.map((e,t)=>[e.id,t])),o=Math.max(...e.participants.map(e=>je([al(e)],zc(e),110,240)),Ae(e.messages.map(e=>e.label??``),110,240)*.8),s=o-14,c=e.participants.reduce((e,t)=>Math.max(e,Ne(Me(al(t),s).length,Pe(zc(t),s).length)),Ne(1,0))+8;return{columns:n,bands:r,bandHeight:i,lifelineX:o,boxW:s,headerHeight:c,messageGap:gl,width:Math.max(e.participants.length*o,240),height:i+c+(e.messages.length+1)*gl,xOf:e=>(a.get(e)??0)*o+o/2}}function yl(e,t){let n=[al(e)];t!==`unchanged`&&n.push(`(${Bc[t]})`),e.ref!==void 0&&n.push(`[${e.ref}]`);for(let t of zc(e))n.push(Fe(t));return n.join(` `)}function bl(e,t){let n=t.cx-e.cx,r=t.cy-e.cy;if(n===0&&r===0)return{x:e.cx,y:e.cy};let i=Math.min(n===0?1/0:e.w/2/Math.abs(n),r===0?1/0:e.h/2/Math.abs(r));return{x:e.cx+n*i,y:e.cy+r*i}}function xl(e,t){if(e.length<3)return e.map((e,t)=>`${t===0?`M`:`L`} ${e.x} ${e.y}`).join(` `);let n=[`M ${e[0].x} ${e[0].y}`];for(let r=1;r<e.length-1;r++){let i=e[r-1],a=e[r],o=e[r+1],s=Math.hypot(a.x-i.x,a.y-i.y),c=Math.hypot(o.x-a.x,o.y-a.y);if(s===0||c===0)continue;let l=((a.x-i.x)*(o.y-a.y)-(a.y-i.y)*(o.x-a.x))/(s*c);if(Math.abs(l)<.02)continue;let u=Math.min(t,s/2,c/2),d={x:a.x-(a.x-i.x)/s*u,y:a.y-(a.y-i.y)/s*u},f={x:a.x+(o.x-a.x)/c*u,y:a.y+(o.y-a.y)/c*u};n.push(`L ${d.x} ${d.y}`,`Q ${a.x} ${a.y} ${f.x} ${f.y}`)}let r=e[e.length-1];return n.push(`L ${r.x} ${r.y}`),n.join(` `)}function Sl(e,t,n,r,i){if(e===t){let t=26+r*12,n=e.cx-e.w/4,i=e.cx+e.w/4,a=e.y;return{d:`M ${n} ${a} C ${n} ${a-t}, ${i} ${a-t}, ${i} ${a}`,labelAt:{x:e.cx,y:a-t*.75},span:t*2}}let a=bl(e,t),o=bl(t,e),s=Math.hypot(o.x-a.x,o.y-a.y),c=(n??[]).slice(1,-1),l=i===void 0?c:c.map((e,t)=>{let n=c.length===1?.5:t/(c.length-1);return{x:e.x+i.from.dx*(1-n)+i.to.dx*n,y:e.y+i.from.dy*(1-n)+i.to.dy*n}});if(l.length>0&&r===0){let e=l[Math.floor((l.length-1)/2)];return{d:xl([a,...l,o],12),labelAt:e,span:s}}let u=r===0?0:Math.ceil(r/2)*22*(r%2==1?1:-1),d=(a.x+o.x)/2,f=(a.y+o.y)/2;if(u===0)return{d:`M ${a.x} ${a.y} L ${o.x} ${o.y}`,labelAt:{x:d,y:f},span:s};let p=s===0?0:-(o.y-a.y)/s,m=s===0?0:(o.x-a.x)/s,h=d+p*u*2,g=f+m*u*2;return{d:`M ${a.x} ${a.y} Q ${h} ${g} ${o.x} ${o.y}`,labelAt:{x:d+p*u,y:f+m*u},span:s}}function Cl(e){let t=(e.match(/-?\d+(?:\.\d+)?/g)??[]).map(Number);if(t.length<2)return;let n=1/0,r=1/0,i=-1/0,a=-1/0;for(let e=0;e+1<t.length;e+=2)n=Math.min(n,t[e]),i=Math.max(i,t[e]),r=Math.min(r,t[e+1]),a=Math.max(a,t[e+1]);return{minX:n,minY:r,maxX:i,maxY:a}}function wl(e,t,n,r){let i=t=>{let n=e.participants.find(e=>e.id===t);return n===void 0?t:al(n)},a=t.label===void 0||t.label===``?``:`: ${t.label}`;return[`${n+1}.`,`${i(t.from)} → ${i(t.to)}${a}`,t.from===t.to?`(to itself)`:``,r===`unchanged`?``:`[${Bc[r]}]`,zc(t).map(Fe).join(`, `)].filter(e=>e!==``).join(` `)}function Tl(e,t,n){let r=t=>{let n=e.nodes.find(e=>e.id===t);return n===void 0?t:al(n)},i=t.label??t.kind;return[`${r(t.from)} → ${r(t.to)}`,i===void 0?``:`(${i})`,n===`unchanged`?``:`[${Bc[n]}]`,zc(t).map(Fe).join(`, `)].filter(e=>e!==``).join(` `)}function El(e){if(e===void 0||e===``)return;let t=Vt(e,Yi);return t.valid?{valid:!0,envelope:t.envelope,issues:[]}:t}function Dl(e){let t=El(e);return t?.valid===!0?t.envelope:void 0}function Ol(e){return Ut(e,Yi)}var kl=`#ffffff`,Al=`#27272a`,jl=`#71717a`,Ml={added:{fill:`#ecfdf5`,stroke:`#059669`,text:`#065f46`},changed:{fill:`#fffbeb`,stroke:`#d97706`,text:`#92400e`},context:{fill:`#fafafa`,stroke:`#d4d4d8`,text:`#71717a`},unchanged:{fill:`#ffffff`,stroke:`#a1a1aa`,text:Al}},Nl={added:`#059669`,changed:`#d97706`,context:`#d4d4d8`,unchanged:`#a1a1aa`},Pl=[`added`,`changed`,`context`,`unchanged`],Fl=[{fill:`#eff6ff`,stroke:`#2563eb`},{fill:`#f5f3ff`,stroke:`#7c3aed`},{fill:`#ecfeff`,stroke:`#0891b2`},{fill:`#fff1f2`,stroke:`#e11d48`},{fill:`#f7fee7`,stroke:`#65a30d`},{fill:`#fff7ed`,stroke:`#ea580c`},{fill:`#f0fdfa`,stroke:`#0d9488`},{fill:`#fdf4ff`,stroke:`#c026d3`},{fill:`#fefce8`,stroke:`#ca8a04`},{fill:`#f8fafc`,stroke:`#475569`},{fill:`#eef2ff`,stroke:`#4f46e5`},{fill:`#fef2f2`,stroke:`#b91c1c`},{fill:`#f0fdf4`,stroke:`#16a34a`},{fill:`#fdf2f8`,stroke:`#db2777`},{fill:`#f5f5f4`,stroke:`#78716c`},{fill:`#f0f9ff`,stroke:`#0369a1`}],Il=[void 0,`7 3`,`2 3`,`9 3 2 3`],Ll=Fl.length*Il.length;function Rl(e,t=.88){let n=n=>{let r=Number.parseInt(e.slice(1+n*2,3+n*2),16);return Math.round(r+(255-r)*t).toString(16).padStart(2,`0`)};return`#${n(0)}${n(1)}${n(2)}`}function zl(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t}Fl.length;function Bl(e,t,n={}){let r=n.dashes===!1,i=Ll,a=new Map,o=new Set,s=e=>t!==void 0&&Object.hasOwn(t,e)?t[e].color:void 0,c=new Set;for(let t of e){let e=s(t);e!==void 0&&(a.set(t,{fill:Rl(e),stroke:e,declared:!0}),c.add(e.toLowerCase()))}for(let e=0;e<i;e++)c.has(Fl[e%Fl.length].stroke.toLowerCase())&&o.add(e);for(let t of e){if(a.has(t))continue;let e;if(r){e=-1;let n=zl(t)%Fl.length;for(let t=0;t<Fl.length&&e===-1;t++){let r=(n+t)%Fl.length;o.has(r)||(e=r)}for(let t=Fl.length;t<Ll&&e===-1;t++){let r=Fl.length+(n+t)%(Ll-Fl.length);o.has(r)||(e=r)}e===-1&&(e=n)}else{e=zl(t)%i;for(let t=0;t<i&&o.has(e);t++)e=(e+1)%i}o.add(e);let n=Fl[e%Fl.length],s=Math.floor(e/Fl.length)%Il.length;if(r)a.set(t,{...n,...s===0?{}:{hatch:s}});else{let e=Il[s];a.set(t,{...n,...e===void 0?{}:{dash:e}})}}return a}function Vl(e,t){let n=new Map;for(let r of e){let e=t.get(r);if(e?.declared!==!0)continue;let i=e.stroke.toLowerCase();n.set(i,[...n.get(i)??[],r])}let r=new Map;for(let e of n.values())if(!(e.length<2))for(let t of e)r.set(t,e.filter(e=>e!==t));return r}function Hl(e){let t=[];for(let n of e)n.kind!==void 0&&n.kind!==``&&!t.includes(n.kind)&&t.push(n.kind);return t}var Ul=`system-ui, sans-serif`;function Wl(e){let t=Ml[e.role],n={fill:e.tint?.fill??t.fill,stroke:e.role===`unchanged`?e.tint?.stroke??t.stroke:t.stroke,text:t.text===`#71717a`?jl:Al},r=e.role===`added`||e.role===`changed`?2:1.2,i=e.role===`context`?.62:1,a=e.anchor??`start`,o=Me(e.label,e.width),s=Pe(e.changes,e.width),c=o.length+s.length,l=e.y+e.height/2-(c-1)*15/2+4,u=a===`middle`?e.x+e.width/2:e.x+8,d=[{shape:`rect`,x:e.x,y:e.y,width:e.width,height:e.height,rx:5,fill:n.fill,stroke:n.stroke,strokeWidth:r,...e.tint?.dash===void 0?{}:{strokeDasharray:e.tint.dash},opacity:i}];return o.forEach((e,t)=>{d.push({shape:`text`,x:u,y:l+t*15,text:e,fontSize:11,fill:n.text,fontFamily:Ul,textAnchor:a,opacity:i})}),s.forEach((e,t)=>{d.push({shape:`text`,x:u,y:l+(o.length+t)*15,text:e,fontSize:9,fontWeight:600,fill:n.text,fontFamily:Ul,textAnchor:a,opacity:i,testId:`field-changes`})}),d}function Gl(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function Kl(e){return Gl(e).replace(/"/g,`"`)}function ql(e){return e.filter(([,e])=>e!==void 0).map(([e,t])=>` ${e}="${Kl(String(t))}"`).join(``)}function Jl(e){let t=Object.entries(e.data??{}).map(([e,t])=>[`data-${e}`,t]);switch(e.shape){case`rect`:return`<rect${ql([[`x`,e.x],[`y`,e.y],[`width`,e.width],[`height`,e.height],[`rx`,e.rx],[`fill`,e.fill],[`fill-opacity`,e.fillOpacity],[`stroke`,e.stroke],[`stroke-width`,e.strokeWidth],[`stroke-dasharray`,e.strokeDasharray],[`opacity`,e.opacity],...t])} />`;case`text`:{let n=`${Gl(e.text)}${e.note===void 0?``:` <tspan font-style="italic">${Gl(e.note)}</tspan>`}`,r=[[`x`,e.x],[`y`,e.y],[`font-size`,e.fontSize],[`font-family`,e.fontFamily],[`font-weight`,e.fontWeight],[`font-style`,e.fontStyle],[`text-anchor`,e.textAnchor]],i=`<text${ql([...r,[`fill`,e.fill],...e.paintOrder===`stroke`?[]:[[`stroke`,e.stroke],[`stroke-width`,e.strokeWidth]],[`text-decoration`,e.textDecoration],[`opacity`,e.opacity],[`data-testid`,e.testId],...t])}>${n}</text>`;return e.paintOrder===`stroke`?`<text${ql([...r,[`fill`,e.stroke],[`stroke`,e.stroke],[`stroke-width`,e.strokeWidth],[`opacity`,e.opacity],[`aria-hidden`,`true`]])}>${n}</text>${i}`:i}case`line`:return`<line${ql([[`x1`,e.x1],[`y1`,e.y1],[`x2`,e.x2],[`y2`,e.y2],[`stroke`,e.stroke],[`stroke-width`,e.strokeWidth],[`stroke-dasharray`,e.strokeDasharray],[`opacity`,e.opacity],[`marker-end`,e.markerEnd===void 0?void 0:`url(#${e.markerEnd})`],...t])} />`;case`path`:return`<path${ql([[`d`,e.d],[`stroke`,e.stroke],[`fill`,e.fill??`none`],[`stroke-width`,e.strokeWidth],[`stroke-dasharray`,e.strokeDasharray],[`stroke-linecap`,e.strokeLinecap],[`opacity`,e.opacity],[`marker-end`,e.markerEnd===void 0?void 0:`url(#${e.markerEnd})`],...t])} />`}}function Yl(e){return`<marker id="${Kl(e.id)}" markerWidth="7" markerHeight="7" refX="9" refY="5" viewBox="0 0 10 10" markerUnits="userSpaceOnUse" orient="auto"><path d="M0,0 L10,5 L0,10 z" fill="${Kl(e.paint)}" /></marker>`}function Xl(e){let t=e=>{let n=Object.entries(e.data??{}).map(([e,t])=>[`data-${e}`,t]),r=e.title===void 0?``:`<title>${Gl(e.title)}</title>`,i=[[`opacity`,e.opacity],[`data-testid`,e.testId]];return`<g${ql([...n,...i])}>${r}`+e.primitives.map(Jl).join(``)+(e.groups??[]).map(t).join(``)+`</g>`},n=e.groups.map(t).join(``),r=e.markers.length===0?``:`<defs>${e.markers.map(Yl).join(``)}</defs>`;return`<svg xmlns="http://www.w3.org/2000/svg" role="img"`+ql([[`aria-label`,e.ariaLabel],[`viewBox`,e.viewBox],[`width`,e.width],[`height`,e.height]])+`><rect${ql([[`x`,e.viewBox.split(` `)[0]],[`y`,e.viewBox.split(` `)[1]],[`width`,e.width],[`height`,e.height],[`fill`,e.background]])} />`+r+n+`</svg>`}var Zl=17,Ql=18,$l=92,eu=860;function tu(e){return Math.min(e,eu)}function nu(e){return 21+(e.length+9)*5.6+Ql}function ru(e,t){let n=tu(t),r=1,i=0;for(let t of e.entries){let e=nu(t.label);i>0&&$l+i+e>n-20&&(r+=1,i=0),i+=e}return r}function iu(e){let t=e.flatMap(e=>e.entries).reduce((e,t)=>Math.max(e,nu(t.label)),0);return t===0?0:Math.min($l+t+32,eu)}function au(e,t){let n=e.filter(e=>e.entries.length>0);return n.length===0?0:n.reduce((e,n)=>e+ru(n,t),0)*Zl+12}function ou(e,t,n,r){let i=e.filter(e=>e.entries.length>0);if(i.length===0)return[];let a=tu(r),o=[],s=0;for(let e of i){let r=s,i=0,c=[];for(let r of e.entries){let o=nu(r.label);i>0&&$l+i+o>a-20&&(s+=1,i=0);let l=t+$l+i,u=n+s*Zl;i+=o;let d=e.sample===`line`?{shape:`line`,x1:l,y1:u+5,x2:l+16,y2:u+5,stroke:r.stroke,strokeWidth:1.6,...r.dashed===void 0?{}:{strokeDasharray:r.dashed}}:{shape:`rect`,x:l,y:u,width:16,height:10,rx:2,fill:r.fill,stroke:r.stroke,strokeWidth:1.2,...r.dashed===void 0?{}:{strokeDasharray:r.dashed}};c.push({id:`legend-${r.key??r.label}`,...r.projectColour===!0?{title:`${r.label} — project colour`}:{},data:{"legend-entry":r.key??r.label,...r.projectColour===!0?{"colour-source":`project`}:{},...r.toggles===!0&&r.key!==void 0?{toggles:`true`}:{},...r.faded===!0?{faded:`true`}:{},...r.hidden===!0?{hidden:`true`}:{}},opacity:r.hidden===!0?.45:r.faded===!0?.62:1,primitives:[d,{shape:`text`,x:l+21,y:u+9,text:r.hidden===!0?`${r.label} (hidden)`:r.label,fontSize:9,fill:jl,fontFamily:Ul}]})}o.push({id:`legend-title-${e.title}`,primitives:[{shape:`text`,x:t,y:n+r*Zl+9,text:e.title,fontSize:9,fontWeight:600,fill:jl,fontFamily:Ul,testId:`legend-group`}]}),o.push(...c),s+=1}return[{id:`diagram-legend`,testId:`diagram-legend`,primitives:[],groups:o}]}var su=12,cu=5.2;function lu(e,t){let n=Math.max(Math.floor((t-24)/cu),20),r=[],i=``;for(let t of e.split(/\s+/).filter(e=>e!==``))for(i===``?i=t:i.length+1+t.length<=n?i=`${i} ${t}`:(r.push(i),i=t);i.length>n;)r.push(i.slice(0,n)),i=i.slice(n);return i!==``&&r.push(i),r}function uu(e){let t=e.length;for(;t>0&&(e[t-1]===`.`||/\s/.test(e[t-1]));)--t;return e.slice(0,t)}function du(e,t,n,r,i){let a=`${t.nodes.length} of ${e.nodes.length} elements and ${t.edges.length} of ${e.edges.length} relationships shown.`+(r?` Hidden types are still part of the proposal.`:``);if(i===void 0)return n.size===0?void 0:`Filtered view: ${a}`;let o=!hl(n,ml(e,i));return`Viewpoint: ${i.label} — ${uu(i.concern)}`+(o?` (adjusted).`:`.`)+(n.size===0?``:` ${a}`)}function fu(e,t){return`${e}-${t.replace(`#`,``)}`}function pu(e){let t=je([al(e)],zc(e),120,260);return{width:t,height:Ne(Me(al(e),t).length,Pe(zc(e),t).length)}}function mu(e,t){let n=e.nodes.filter(e=>!fl(t,`element`,e.kind)),r=new Set(n.map(e=>e.id));return{nodes:n,edges:e.edges.filter(e=>!fl(t,`relationship`,e.kind)&&r.has(e.from)&&r.has(e.to)),containers:e.containers}}function hu(e,t,n){return{label:n===void 0?e:`${e} (same colour as ${n.join(`, `)})`,fill:t.fill,stroke:t.stroke,...t.dash===void 0?{}:{dashed:t.dash},...t.declared===!0?{projectColour:!0}:{}}}function gu(e,t){if(t!==void 0)return{layout:el(e,pu,t),orientation:t};let n=el(e,pu,`landscape`);if(n.width<=710)return{layout:n,orientation:`landscape`};let r=el(e,pu,`portrait`);return p(n.width,r.width)===`portrait`?{layout:r,orientation:`portrait`}:{layout:n,orientation:`landscape`}}function _u(e,t=dl){return gu(mu(e,t),void 0).orientation}function vu(e,t){let n=t.hidden??dl,r=t.nudges??new Map,i=t.isProposal,a=mu(e,n),{layout:o,orientation:s}=gu(a,t.orientation),c=new Map(o.nodes.map(e=>[e.id,e])),l=e=>{let t=c.get(e);if(t===void 0)return;let n=r.get(e),i=t.x+(n?.dx??0),a=t.y+(n?.dy??0);return{x:i,y:a,cx:i+t.width/2,cy:a+t.height/2,w:t.width,h:t.height}},u=o.containers.map(e=>{let t=Gc(a.nodes.filter(t=>t.container===e.id).flatMap(e=>{let t=l(e.id);return t===void 0?[]:[{x:t.x,y:t.y,width:t.w,height:t.h}]}));return t===void 0?e:{...e,...t}}),d=Bl(Hl(e.nodes),t.appearance?.kinds),f=Bl(Hl(e.edges),t.appearance?.relationshipKinds),p=Vl(Hl(e.nodes),d),m=Vl(Hl(e.edges),f),h=e=>t=>({...hu(t,(e===`element`?d:f).get(t),(e===`element`?p:m).get(t)),toggles:!0,key:ul(e,t),hidden:n.has(ul(e,t))}),g=[{title:`elements`,sample:`box`,entries:Hl(e.nodes).map(h(`element`))},{title:`relationships`,sample:`line`,entries:Hl(e.edges).map(h(`relationship`))}];if(i){let e=new Set([...a.nodes.map(e=>Ic(e,!0)),...a.edges.map(e=>Rc(e,!0))]);g.push({title:`changes`,sample:`box`,entries:Pl.filter(t=>t!==`unchanged`&&e.has(t)).map(e=>({label:Bc[e],fill:kl,stroke:Ml[e].stroke,faded:e===`context`}))})}let _=new Map,v=new Map;for(let e of a.edges){let t=JSON.stringify([e.from,e.to]),n=v.get(t)??0;_.set(e,n),v.set(t,n+1)}let y=new Map(o.edges.map(e=>[e.index,e.points])),b=new Map;a.edges.forEach((e,t)=>{let n=y.get(t);n!==void 0&&b.set(e,n)});let ee={dx:0,dy:0},te=a.edges.map(e=>{let t=l(e.from),n=l(e.to);if(t===void 0||n===void 0)return;let i=r.has(e.from)||r.has(e.to);return Sl(t,e.from===e.to?t:n,b.get(e),_.get(e)??0,i?{from:r.get(e.from)??ee,to:r.get(e.to)??ee}:void 0)}),x=o.nodes.map(e=>l(e.id)),ne=te.flatMap(e=>{let t=e===void 0?void 0:Cl(e.d);return t===void 0?[]:[t]}),re=Math.min(0,...x.map(e=>e.x-12),...ne.map(e=>e.minX-12)),ie=Math.min(0,...x.map(e=>e.y-12),...ne.map(e=>e.minY-14)),ae=Math.max(o.width,...x.map(e=>e.x+e.w+12),...ne.map(e=>e.maxX+12)),oe=Math.max(o.height,...x.map(e=>e.y+e.h+12),...ne.map(e=>e.maxY+12)),se=e=>{let t=Rc(e,i),n=e.kind===void 0?void 0:f.get(e.kind);return{role:t,stroke:n?.stroke??Nl.unchanged,dash:n?.dash,halo:t===`added`||t===`changed`?Nl[t]:void 0,width:t===`context`?1:t===`unchanged`?1.5:1.8,opacity:t===`context`?.6:1}},ce=[...new Set(a.edges.map(e=>se(e).stroke))],le=oe+4,ue=Math.max(ae-re,iu(g)),de=du(e,a,n,i,t.viewpoint),fe=t.viewpoint===void 0||de===void 0?0:lu(de,ue).length*su+4,pe=oe-ie+au(g,ue)+fe,me=[];for(let e of u)me.push({id:`container-${e.id}`,data:{container:e.id},primitives:[{shape:`rect`,x:e.x,y:e.y,width:e.width,height:e.height,rx:8,fill:`none`,stroke:jl,strokeDasharray:`5 3`,opacity:.55},{shape:`text`,x:e.x+8,y:e.y+12,text:e.label,fontSize:10,fill:jl}]});a.edges.forEach((t,n)=>{let r=l(t.from),i=l(t.to),a=te[n];if(r===void 0||i===void 0||a===void 0)return;let o=se(t),s=o.stroke,c=zc(t),u=t.label??t.kind,d=e=>e.length*5.2+8<=a.span,f=[];o.halo!==void 0&&f.push({shape:`path`,data:{edge:`role`},d:a.d,fill:`none`,stroke:o.halo,strokeWidth:o.width+4,strokeLinecap:`round`,opacity:.3}),f.push({shape:`path`,data:{edge:`line`},d:a.d,fill:`none`,stroke:s,strokeWidth:o.width,...o.dash===void 0?{}:{strokeDasharray:o.dash},opacity:o.opacity,markerEnd:fu(`se-arrow`,s)}),u!==void 0&&d(u)&&f.push({shape:`text`,x:a.labelAt.x,y:a.labelAt.y-5,text:u,textAnchor:`middle`,fontSize:9,fill:s,fontFamily:Ul,stroke:kl,strokeWidth:3,paintOrder:`stroke`});let p=c.map(Fe).join(`, `);c.length>0&&d(p)&&f.push({shape:`text`,x:a.labelAt.x,y:a.labelAt.y+10,text:p,textAnchor:`middle`,fontSize:9,fontWeight:600,fill:s,fontFamily:Ul,stroke:kl,strokeWidth:3,paintOrder:`stroke`,testId:`relationship-change`}),me.push({id:`edge-${n}`,data:{"relationship-role":o.role,"relationship-shape":t.from===t.to?`loop`:`open`},title:Tl(e,t,o.role),primitives:f})});for(let e of a.nodes){let t=l(e.id);if(t===void 0)continue;let n=Ic(e,i);me.push({id:e.id,data:{"element-role":n,"element-id":e.id,draggable:`node`},title:yl(e,n),primitives:Wl({x:t.x,y:t.y,width:t.w,height:t.h,role:n,label:al(e),...e.kind===void 0?{}:{tint:d.get(e.kind)},changes:zc(e)})})}let he=t.viewpoint,ge=de;if(ge!==void 0&&he!==void 0){let e=lu(ge,ue);me.push({id:`filter-note`,testId:`diagram-filter-note`,data:{viewpoint:he.id},primitives:e.map((t,n)=>({shape:`text`,x:re+12,y:le+au(g,ue)+su*n+su-4,text:n<e.length-1?`${t} `:t,fontSize:9,fontWeight:600,fill:`#92400e`,fontFamily:Ul}))})}else ge!==void 0&&me.push({id:`filter-note`,primitives:[{shape:`text`,x:re+12,y:le+au(g,ue)-4,text:ge,fontSize:9,fontWeight:600,fill:`#92400e`,fontFamily:Ul,testId:`diagram-filter-note`}]});return me.push(...ou(g,re+12,le,ue)),{width:ue,height:pe,viewBox:`${re} ${ie} ${ue} ${pe}`,ariaLabel:a.nodes.length===e.nodes.length&&a.edges.length===e.edges.length?`Graph of ${e.nodes.length} elements and ${e.edges.length} relationships`:`Graph of ${e.nodes.length} elements and ${e.edges.length} relationships, filtered to ${a.nodes.length} elements and ${a.edges.length} relationships`,background:kl,markers:ce.map(e=>({id:fu(`se-arrow`,e),paint:e})),groups:me,...ge===void 0?{}:{narrowing:ge},orientation:s}}function yu(e,t){let n=t.isProposal,r=vl(e),{columns:i,bands:a,bandHeight:o,lifelineX:s,boxW:c,headerHeight:l,messageGap:u}=r,d=o,f=r.xOf,p=Bl(Hl(e.participants),t.appearance?.kinds),m=Vl(Hl(e.participants),p),h=[{title:`participants`,sample:`box`,entries:Hl(e.participants).map(e=>({...hu(e,p.get(e),m.get(e)),key:ul(`element`,e)}))}];if(n){let t=new Set([...e.participants.map(e=>Ic(e,!0)),...e.messages.map(e=>Rc(e,!0))]);h.push({title:`changes`,sample:`box`,entries:Pl.filter(e=>e!==`unchanged`&&t.has(e)).map(e=>({label:Bc[e],fill:kl,stroke:Ml[e].stroke,faded:e===`context`}))})}let g=r.height+4,_=Math.max(r.width,iu(h)),v=r.height+au(h,_),y=[];for(let e of a){let t=e.from*s+(s-c)/2,n=e.to*s+(s+c)/2;y.push({id:`band-${e.container.id}-${e.from}`,data:{container:e.container.id},primitives:[{shape:`rect`,x:t,y:2,width:n-t,height:d-6,rx:5,fill:`none`,stroke:jl,strokeDasharray:`5 3`,opacity:.55},{shape:`text`,x:(t+n)/2,y:d-9,text:e.container.label,fontSize:10,textAnchor:`middle`,fill:jl}]})}for(let e of i)y.push({id:`life-${e.id}`,primitives:[{shape:`line`,x1:f(e.id),y1:o+l,x2:f(e.id),y2:r.height-6,stroke:`#d4d4d8`,strokeDasharray:`3 3`,strokeWidth:1}]});for(let e of i){let t=Ic(e,n);y.push({id:e.id,data:{"element-role":t,"element-id":e.id},title:yl(e,t),primitives:Wl({x:f(e.id)-c/2,y:o+4,width:c,height:l-8,role:t,label:al(e),...e.kind===void 0?{}:{tint:p.get(e.kind)},changes:zc(e),anchor:`middle`})})}return e.messages.forEach((t,r)=>{let i=Rc(t,n),a=Nl[i],s=o+l+(r+1)*u,c=f(t.from),d=f(t.to),p=t.from===t.to,m=zc(t),h=p?c+26+6:(c+d)/2,g=p?`start`:`middle`,_=[];p?_.push({shape:`path`,d:`M ${c} ${s} h 26 v ${u/2} h -26`,fill:`none`,stroke:a,strokeWidth:1.4,markerEnd:fu(`se-msg`,a)}):_.push({shape:`line`,x1:c,y1:s,x2:d,y2:s,stroke:a,strokeWidth:1.4,markerEnd:fu(`se-msg`,a)}),t.label!==void 0&&_.push({shape:`text`,x:h,y:s-5,text:t.label,textAnchor:g,fontSize:10,fill:Al,fontFamily:Ul,stroke:kl,strokeWidth:3,paintOrder:`stroke`}),m.length>0&&_.push({shape:`text`,x:h,y:s+11,text:m.map(Fe).join(`, `),textAnchor:g,fontSize:9,fontWeight:600,fill:a,fontFamily:Ul,stroke:kl,strokeWidth:3,paintOrder:`stroke`,testId:`relationship-change`}),_.push({shape:`text`,x:4,y:s+3,text:String(r+1),fontSize:9,fill:jl,fontFamily:Ul}),y.push({id:`message-${r}`,data:{"relationship-role":i,"message-index":String(r),"message-from":t.from,"message-to":t.to},title:wl(e,t,r,i),primitives:_})}),y.push(...ou(h,12,g,_)),{width:_,height:v,viewBox:`0 0 ${_} ${v}`,ariaLabel:`Sequence of ${e.participants.length} participants and ${e.messages.length} messages`,background:kl,markers:Pl.map(e=>({id:fu(`se-msg`,Nl[e]),paint:Nl[e]})),groups:y}}var bu=`change`,xu=`section`,Su=`level`;function Cu(e,t,n){let r=Uc(e),i=(e,t)=>n?.[t]?.role??Wc(e,r),a=e.rows.some((e,t)=>i(e,t)!==void 0),o=e.rows.map((e,t)=>({row:e,role:i(e,t)})).filter(({role:e})=>e===void 0||!t.has(ul(`role`,e)));return{shown:o,anyRole:a,withheld:e.rows.length-o.length}}function wu(e,t,n){let{shown:r,anyRole:i,withheld:a}=Cu(e,t,n),o=e.rows.some(e=>ue(e).heading!==void 0);return{columns:[...o?[xu,Su]:[],...e.columns,...i?[bu]:[]],rows:r.map(({row:t,role:n})=>{let{cells:r,heading:a}=ue(t),s=Array.isArray(t)?void 0:t.depth,c=o?a===void 0?[null,null]:[a,s??1]:[],l=a===void 0?r:e.columns.map(()=>null);return[...c,...l,...i?[n===void 0?null:Vc[n]]:[]]}),withheld:a}}function Tu(e){if(e===null)return``;let t=String(e);return/[",\n\r]/.test(t)?`"${t.replaceAll(`"`,`""`)}"`:t}function Eu(e){return[e.columns,...e.rows].map(e=>e.map(Tu).join(`,`)).join(`\r
|
|
8
|
+
`)}}function sl(e){return`n${[...e].map(e=>e.charCodeAt(0).toString(36)).join(``)}`}var cl={"#":`#35;`,'"':`#quot;`,";":`#59;`,"<":`#60;`,">":`#62;`};function ll(e){return e.replace(/[#";<>]/g,e=>cl[e]).replace(/[\r\n\t\f\v\u0000-\u001f\u2028\u2029]+/g,` `)}function ul(e,t){return`${e}:${t}`}var dl=new Set;function fl(e,t,n){return n===void 0||n===``?!1:e.has(ul(t,n))}function pl(e){let t=e?.viewpoints;return Array.isArray(t)?t:[]}function ml(e,t){let n=new Set,r=(e,t,r)=>{if(t===void 0)return;let i=new Set(t);for(let t of e)t.kind!==void 0&&t.kind!==``&&!i.has(t.kind)&&n.add(ul(r,t.kind))};return r(e.nodes,t.elementKinds,`element`),r(e.edges,t.relationshipKinds,`relationship`),n}function hl(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}var gl=40,_l=22;function vl(e){let t=e.containers??[],n;if(t.length===0)n=e.participants;else{let r=new Set(t.map(e=>e.id)),i=new Set;n=[];for(let t of e.participants){if(i.has(t.id))continue;let a=t.container;if(a===void 0||!r.has(a)){n.push(t),i.add(t.id);continue}for(let t of e.participants)t.container!==a||i.has(t.id)||(n.push(t),i.add(t.id))}}let r=[];n.forEach((e,n)=>{let i=t.find(t=>t.id===e.container);if(i===void 0)return;let a=r.at(-1);a!==void 0&&a.container.id===i.id&&a.to===n-1?a.to=n:r.push({container:i,from:n,to:n})});let i=t.length>0?_l:0,a=new Map(n.map((e,t)=>[e.id,t])),o=Math.max(...e.participants.map(e=>je([al(e)],zc(e),110,240)),Ae(e.messages.map(e=>e.label??``),110,240)*.8),s=o-14,c=e.participants.reduce((e,t)=>Math.max(e,Ne(Me(al(t),s).length,Pe(zc(t),s).length)),Ne(1,0))+8;return{columns:n,bands:r,bandHeight:i,lifelineX:o,boxW:s,headerHeight:c,messageGap:gl,width:Math.max(e.participants.length*o,240),height:i+c+(e.messages.length+1)*gl,xOf:e=>(a.get(e)??0)*o+o/2}}function yl(e,t){let n=[al(e)];t!==`unchanged`&&n.push(`(${Bc[t]})`),e.ref!==void 0&&n.push(`[${e.ref}]`);for(let t of zc(e))n.push(Fe(t));return n.join(` `)}function bl(e,t){let n=t.cx-e.cx,r=t.cy-e.cy;if(n===0&&r===0)return{x:e.cx,y:e.cy};let i=Math.min(n===0?1/0:e.w/2/Math.abs(n),r===0?1/0:e.h/2/Math.abs(r));return{x:e.cx+n*i,y:e.cy+r*i}}function xl(e,t){if(e.length<3)return e.map((e,t)=>`${t===0?`M`:`L`} ${e.x} ${e.y}`).join(` `);let n=[`M ${e[0].x} ${e[0].y}`];for(let r=1;r<e.length-1;r++){let i=e[r-1],a=e[r],o=e[r+1],s=Math.hypot(a.x-i.x,a.y-i.y),c=Math.hypot(o.x-a.x,o.y-a.y);if(s===0||c===0)continue;let l=((a.x-i.x)*(o.y-a.y)-(a.y-i.y)*(o.x-a.x))/(s*c);if(Math.abs(l)<.02)continue;let u=Math.min(t,s/2,c/2),d={x:a.x-(a.x-i.x)/s*u,y:a.y-(a.y-i.y)/s*u},f={x:a.x+(o.x-a.x)/c*u,y:a.y+(o.y-a.y)/c*u};n.push(`L ${d.x} ${d.y}`,`Q ${a.x} ${a.y} ${f.x} ${f.y}`)}let r=e[e.length-1];return n.push(`L ${r.x} ${r.y}`),n.join(` `)}function Sl(e,t,n,r,i){if(e===t){let t=26+r*12,n=e.cx-e.w/4,i=e.cx+e.w/4,a=e.y;return{d:`M ${n} ${a} C ${n} ${a-t}, ${i} ${a-t}, ${i} ${a}`,labelAt:{x:e.cx,y:a-t*.75},span:t*2}}let a=bl(e,t),o=bl(t,e),s=Math.hypot(o.x-a.x,o.y-a.y),c=(n??[]).slice(1,-1),l=i===void 0?c:c.map((e,t)=>{let n=c.length===1?.5:t/(c.length-1);return{x:e.x+i.from.dx*(1-n)+i.to.dx*n,y:e.y+i.from.dy*(1-n)+i.to.dy*n}});if(l.length>0&&r===0){let e=l[Math.floor((l.length-1)/2)];return{d:xl([a,...l,o],12),labelAt:e,span:s}}let u=r===0?0:Math.ceil(r/2)*22*(r%2==1?1:-1),d=(a.x+o.x)/2,f=(a.y+o.y)/2;if(u===0)return{d:`M ${a.x} ${a.y} L ${o.x} ${o.y}`,labelAt:{x:d,y:f},span:s};let p=s===0?0:-(o.y-a.y)/s,m=s===0?0:(o.x-a.x)/s,h=d+p*u*2,g=f+m*u*2;return{d:`M ${a.x} ${a.y} Q ${h} ${g} ${o.x} ${o.y}`,labelAt:{x:d+p*u,y:f+m*u},span:s}}function Cl(e){let t=(e.match(/-?\d+(?:\.\d+)?/g)??[]).map(Number);if(t.length<2)return;let n=1/0,r=1/0,i=-1/0,a=-1/0;for(let e=0;e+1<t.length;e+=2)n=Math.min(n,t[e]),i=Math.max(i,t[e]),r=Math.min(r,t[e+1]),a=Math.max(a,t[e+1]);return{minX:n,minY:r,maxX:i,maxY:a}}function wl(e,t,n,r){let i=t=>{let n=e.participants.find(e=>e.id===t);return n===void 0?t:al(n)},a=t.label===void 0||t.label===``?``:`: ${t.label}`;return[`${n+1}.`,`${i(t.from)} → ${i(t.to)}${a}`,t.from===t.to?`(to itself)`:``,r===`unchanged`?``:`[${Bc[r]}]`,zc(t).map(Fe).join(`, `)].filter(e=>e!==``).join(` `)}function Tl(e,t,n){let r=t=>{let n=e.nodes.find(e=>e.id===t);return n===void 0?t:al(n)},i=t.label??t.kind;return[`${r(t.from)} → ${r(t.to)}`,i===void 0?``:`(${i})`,n===`unchanged`?``:`[${Bc[n]}]`,zc(t).map(Fe).join(`, `)].filter(e=>e!==``).join(` `)}function El(e){if(e===void 0||e===``)return;let t=Vt(e,Yi);return t.valid?{valid:!0,envelope:t.envelope,issues:[]}:t}function Dl(e){let t=El(e);return t?.valid===!0?t.envelope:void 0}function Ol(e){return Ut(e,Yi)}var kl=`#ffffff`,Al=`#27272a`,jl=`#71717a`,Ml={added:{fill:`#ecfdf5`,stroke:`#059669`,text:`#065f46`},changed:{fill:`#fffbeb`,stroke:`#d97706`,text:`#92400e`},context:{fill:`#fafafa`,stroke:`#d4d4d8`,text:`#71717a`},unchanged:{fill:`#ffffff`,stroke:`#a1a1aa`,text:Al}},Nl={added:`#059669`,changed:`#d97706`,context:`#d4d4d8`,unchanged:`#a1a1aa`},Pl=[`added`,`changed`,`context`,`unchanged`],Fl=[{fill:`#eff6ff`,stroke:`#2563eb`},{fill:`#f5f3ff`,stroke:`#7c3aed`},{fill:`#ecfeff`,stroke:`#0891b2`},{fill:`#fff1f2`,stroke:`#e11d48`},{fill:`#f7fee7`,stroke:`#65a30d`},{fill:`#fff7ed`,stroke:`#ea580c`},{fill:`#f0fdfa`,stroke:`#0d9488`},{fill:`#fdf4ff`,stroke:`#c026d3`},{fill:`#fefce8`,stroke:`#ca8a04`},{fill:`#f8fafc`,stroke:`#475569`},{fill:`#eef2ff`,stroke:`#4f46e5`},{fill:`#fef2f2`,stroke:`#b91c1c`},{fill:`#f0fdf4`,stroke:`#16a34a`},{fill:`#fdf2f8`,stroke:`#db2777`},{fill:`#f5f5f4`,stroke:`#78716c`},{fill:`#f0f9ff`,stroke:`#0369a1`}],Il=[void 0,`7 3`,`2 3`,`9 3 2 3`],Ll=Fl.length*Il.length;function Rl(e,t=.88){let n=n=>{let r=Number.parseInt(e.slice(1+n*2,3+n*2),16);return Math.round(r+(255-r)*t).toString(16).padStart(2,`0`)};return`#${n(0)}${n(1)}${n(2)}`}function zl(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t}Fl.length;function Bl(e,t,n={}){let r=n.dashes===!1,i=Ll,a=new Map,o=new Set,s=e=>t!==void 0&&Object.hasOwn(t,e)?t[e].color:void 0,c=new Set;for(let t of e){let e=s(t);e!==void 0&&(a.set(t,{fill:Rl(e),stroke:e,declared:!0}),c.add(e.toLowerCase()))}for(let e=0;e<i;e++)c.has(Fl[e%Fl.length].stroke.toLowerCase())&&o.add(e);for(let t of e){if(a.has(t))continue;let e;if(r){e=-1;let n=zl(t)%Fl.length;for(let t=0;t<Fl.length&&e===-1;t++){let r=(n+t)%Fl.length;o.has(r)||(e=r)}for(let t=Fl.length;t<Ll&&e===-1;t++){let r=Fl.length+(n+t)%(Ll-Fl.length);o.has(r)||(e=r)}e===-1&&(e=n)}else{e=zl(t)%i;for(let t=0;t<i&&o.has(e);t++)e=(e+1)%i}o.add(e);let n=Fl[e%Fl.length],s=Math.floor(e/Fl.length)%Il.length;if(r)a.set(t,{...n,...s===0?{}:{hatch:s}});else{let e=Il[s];a.set(t,{...n,...e===void 0?{}:{dash:e}})}}return a}function Vl(e,t){let n=new Map;for(let r of e){let e=t.get(r);if(e?.declared!==!0)continue;let i=e.stroke.toLowerCase();n.set(i,[...n.get(i)??[],r])}let r=new Map;for(let e of n.values())if(!(e.length<2))for(let t of e)r.set(t,e.filter(e=>e!==t));return r}function Hl(e){let t=[];for(let n of e)n.kind!==void 0&&n.kind!==``&&!t.includes(n.kind)&&t.push(n.kind);return t}var Ul=`system-ui, Segoe UI, Arial, Helvetica, sans-serif`;function Wl(e){let t=Ml[e.role],n={fill:e.tint?.fill??t.fill,stroke:e.role===`unchanged`?e.tint?.stroke??t.stroke:t.stroke,text:t.text===`#71717a`?jl:Al},r=e.role===`added`||e.role===`changed`?2:1.2,i=e.role===`context`?.62:1,a=e.anchor??`start`,o=Me(e.label,e.width),s=Pe(e.changes,e.width),c=o.length+s.length,l=e.y+e.height/2-(c-1)*15/2+4,u=a===`middle`?e.x+e.width/2:e.x+8,d=[{shape:`rect`,x:e.x,y:e.y,width:e.width,height:e.height,rx:5,fill:n.fill,stroke:n.stroke,strokeWidth:r,...e.tint?.dash===void 0?{}:{strokeDasharray:e.tint.dash},opacity:i}];return o.forEach((e,t)=>{d.push({shape:`text`,x:u,y:l+t*15,text:e,fontSize:11,fill:n.text,fontFamily:Ul,textAnchor:a,opacity:i})}),s.forEach((e,t)=>{d.push({shape:`text`,x:u,y:l+(o.length+t)*15,text:e,fontSize:9,fontWeight:600,fill:n.text,fontFamily:Ul,textAnchor:a,opacity:i,testId:`field-changes`})}),d}function Gl(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function Kl(e){return Gl(e).replace(/"/g,`"`)}function ql(e){return e.filter(([,e])=>e!==void 0).map(([e,t])=>` ${e}="${Kl(String(t))}"`).join(``)}function Jl(e){let t=Object.entries(e.data??{}).map(([e,t])=>[`data-${e}`,t]);switch(e.shape){case`rect`:return`<rect${ql([[`x`,e.x],[`y`,e.y],[`width`,e.width],[`height`,e.height],[`rx`,e.rx],[`fill`,e.fill],[`fill-opacity`,e.fillOpacity],[`stroke`,e.stroke],[`stroke-width`,e.strokeWidth],[`stroke-dasharray`,e.strokeDasharray],[`opacity`,e.opacity],...t])} />`;case`text`:{let n=`${Gl(e.text)}${e.note===void 0?``:` <tspan font-style="italic">${Gl(e.note)}</tspan>`}`,r=[[`x`,e.x],[`y`,e.y],[`font-size`,e.fontSize],[`font-family`,e.fontFamily],[`font-weight`,e.fontWeight],[`font-style`,e.fontStyle],[`text-anchor`,e.textAnchor]],i=`<text${ql([...r,[`fill`,e.fill],...e.paintOrder===`stroke`?[]:[[`stroke`,e.stroke],[`stroke-width`,e.strokeWidth]],[`text-decoration`,e.textDecoration],[`opacity`,e.opacity],[`data-testid`,e.testId],...t])}>${n}</text>`;return e.paintOrder===`stroke`?`<text${ql([...r,[`fill`,e.stroke],[`stroke`,e.stroke],[`stroke-width`,e.strokeWidth],[`opacity`,e.opacity],[`aria-hidden`,`true`]])}>${n}</text>${i}`:i}case`line`:return`<line${ql([[`x1`,e.x1],[`y1`,e.y1],[`x2`,e.x2],[`y2`,e.y2],[`stroke`,e.stroke],[`stroke-width`,e.strokeWidth],[`stroke-dasharray`,e.strokeDasharray],[`opacity`,e.opacity],[`marker-end`,e.markerEnd===void 0?void 0:`url(#${e.markerEnd})`],...t])} />`;case`path`:return`<path${ql([[`d`,e.d],[`stroke`,e.stroke],[`fill`,e.fill??`none`],[`stroke-width`,e.strokeWidth],[`stroke-dasharray`,e.strokeDasharray],[`stroke-linecap`,e.strokeLinecap],[`opacity`,e.opacity],[`marker-end`,e.markerEnd===void 0?void 0:`url(#${e.markerEnd})`],...t])} />`}}function Yl(e){return`<marker id="${Kl(e.id)}" markerWidth="7" markerHeight="7" refX="9" refY="5" viewBox="0 0 10 10" markerUnits="userSpaceOnUse" orient="auto"><path d="M0,0 L10,5 L0,10 z" fill="${Kl(e.paint)}" /></marker>`}function Xl(e){let t=e=>{let n=Object.entries(e.data??{}).map(([e,t])=>[`data-${e}`,t]),r=e.title===void 0?``:`<title>${Gl(e.title)}</title>`,i=[[`opacity`,e.opacity],[`data-testid`,e.testId]];return`<g${ql([...n,...i])}>${r}`+e.primitives.map(Jl).join(``)+(e.groups??[]).map(t).join(``)+`</g>`},n=e.groups.map(t).join(``),r=e.markers.length===0?``:`<defs>${e.markers.map(Yl).join(``)}</defs>`;return`<svg xmlns="http://www.w3.org/2000/svg" role="img"`+ql([[`aria-label`,e.ariaLabel],[`viewBox`,e.viewBox],[`width`,e.width],[`height`,e.height]])+`><rect${ql([[`x`,e.viewBox.split(` `)[0]],[`y`,e.viewBox.split(` `)[1]],[`width`,e.width],[`height`,e.height],[`fill`,e.background]])} />`+r+n+`</svg>`}var Zl=17,Ql=18,$l=92,eu=860;function tu(e){return Math.min(e,eu)}function nu(e){return 21+(e.length+9)*5.6+Ql}function ru(e,t){let n=tu(t),r=1,i=0;for(let t of e.entries){let e=nu(t.label);i>0&&$l+i+e>n-20&&(r+=1,i=0),i+=e}return r}function iu(e){let t=e.flatMap(e=>e.entries).reduce((e,t)=>Math.max(e,nu(t.label)),0);return t===0?0:Math.min($l+t+32,eu)}function au(e,t){let n=e.filter(e=>e.entries.length>0);return n.length===0?0:n.reduce((e,n)=>e+ru(n,t),0)*Zl+12}function ou(e,t,n,r){let i=e.filter(e=>e.entries.length>0);if(i.length===0)return[];let a=tu(r),o=[],s=0;for(let e of i){let r=s,i=0,c=[];for(let r of e.entries){let o=nu(r.label);i>0&&$l+i+o>a-20&&(s+=1,i=0);let l=t+$l+i,u=n+s*Zl;i+=o;let d=e.sample===`line`?{shape:`line`,x1:l,y1:u+5,x2:l+16,y2:u+5,stroke:r.stroke,strokeWidth:1.6,...r.dashed===void 0?{}:{strokeDasharray:r.dashed}}:{shape:`rect`,x:l,y:u,width:16,height:10,rx:2,fill:r.fill,stroke:r.stroke,strokeWidth:1.2,...r.dashed===void 0?{}:{strokeDasharray:r.dashed}};c.push({id:`legend-${r.key??r.label}`,...r.projectColour===!0?{title:`${r.label} — project colour`}:{},data:{"legend-entry":r.key??r.label,...r.projectColour===!0?{"colour-source":`project`}:{},...r.toggles===!0&&r.key!==void 0?{toggles:`true`}:{},...r.faded===!0?{faded:`true`}:{},...r.hidden===!0?{hidden:`true`}:{}},opacity:r.hidden===!0?.45:r.faded===!0?.62:1,primitives:[d,{shape:`text`,x:l+21,y:u+9,text:r.hidden===!0?`${r.label} (hidden)`:r.label,fontSize:9,fill:jl,fontFamily:Ul}]})}o.push({id:`legend-title-${e.title}`,primitives:[{shape:`text`,x:t,y:n+r*Zl+9,text:e.title,fontSize:9,fontWeight:600,fill:jl,fontFamily:Ul,testId:`legend-group`}]}),o.push(...c),s+=1}return[{id:`diagram-legend`,testId:`diagram-legend`,primitives:[],groups:o}]}var su=12,cu=5.2;function lu(e,t){let n=Math.max(Math.floor((t-24)/cu),20),r=[],i=``;for(let t of e.split(/\s+/).filter(e=>e!==``))for(i===``?i=t:i.length+1+t.length<=n?i=`${i} ${t}`:(r.push(i),i=t);i.length>n;)r.push(i.slice(0,n)),i=i.slice(n);return i!==``&&r.push(i),r}function uu(e){let t=e.length;for(;t>0&&(e[t-1]===`.`||/\s/.test(e[t-1]));)--t;return e.slice(0,t)}function du(e,t,n,r,i){let a=`${t.nodes.length} of ${e.nodes.length} elements and ${t.edges.length} of ${e.edges.length} relationships shown.`+(r?` Hidden types are still part of the proposal.`:``);if(i===void 0)return n.size===0?void 0:`Filtered view: ${a}`;let o=!hl(n,ml(e,i));return`Viewpoint: ${i.label} — ${uu(i.concern)}`+(o?` (adjusted).`:`.`)+(n.size===0?``:` ${a}`)}function fu(e,t){return`${e}-${t.replace(`#`,``)}`}function pu(e){let t=je([al(e)],zc(e),120,260);return{width:t,height:Ne(Me(al(e),t).length,Pe(zc(e),t).length)}}function mu(e,t){let n=e.nodes.filter(e=>!fl(t,`element`,e.kind)),r=new Set(n.map(e=>e.id));return{nodes:n,edges:e.edges.filter(e=>!fl(t,`relationship`,e.kind)&&r.has(e.from)&&r.has(e.to)),containers:e.containers}}function hu(e,t,n){return{label:n===void 0?e:`${e} (same colour as ${n.join(`, `)})`,fill:t.fill,stroke:t.stroke,...t.dash===void 0?{}:{dashed:t.dash},...t.declared===!0?{projectColour:!0}:{}}}function gu(e,t){if(t!==void 0)return{layout:el(e,pu,t),orientation:t};let n=el(e,pu,`landscape`);if(n.width<=710)return{layout:n,orientation:`landscape`};let r=el(e,pu,`portrait`);return p(n.width,r.width)===`portrait`?{layout:r,orientation:`portrait`}:{layout:n,orientation:`landscape`}}function _u(e,t=dl){return gu(mu(e,t),void 0).orientation}function vu(e,t){let n=t.hidden??dl,r=t.nudges??new Map,i=t.isProposal,a=mu(e,n),{layout:o,orientation:s}=gu(a,t.orientation),c=new Map(o.nodes.map(e=>[e.id,e])),l=e=>{let t=c.get(e);if(t===void 0)return;let n=r.get(e),i=t.x+(n?.dx??0),a=t.y+(n?.dy??0);return{x:i,y:a,cx:i+t.width/2,cy:a+t.height/2,w:t.width,h:t.height}},u=o.containers.map(e=>{let t=Gc(a.nodes.filter(t=>t.container===e.id).flatMap(e=>{let t=l(e.id);return t===void 0?[]:[{x:t.x,y:t.y,width:t.w,height:t.h}]}));return t===void 0?e:{...e,...t}}),d=Bl(Hl(e.nodes),t.appearance?.kinds),f=Bl(Hl(e.edges),t.appearance?.relationshipKinds),p=Vl(Hl(e.nodes),d),m=Vl(Hl(e.edges),f),h=e=>t=>({...hu(t,(e===`element`?d:f).get(t),(e===`element`?p:m).get(t)),toggles:!0,key:ul(e,t),hidden:n.has(ul(e,t))}),g=[{title:`elements`,sample:`box`,entries:Hl(e.nodes).map(h(`element`))},{title:`relationships`,sample:`line`,entries:Hl(e.edges).map(h(`relationship`))}];if(i){let e=new Set([...a.nodes.map(e=>Ic(e,!0)),...a.edges.map(e=>Rc(e,!0))]);g.push({title:`changes`,sample:`box`,entries:Pl.filter(t=>t!==`unchanged`&&e.has(t)).map(e=>({label:Bc[e],fill:kl,stroke:Ml[e].stroke,faded:e===`context`}))})}let _=new Map,v=new Map;for(let e of a.edges){let t=JSON.stringify([e.from,e.to]),n=v.get(t)??0;_.set(e,n),v.set(t,n+1)}let y=new Map(o.edges.map(e=>[e.index,e.points])),b=new Map;a.edges.forEach((e,t)=>{let n=y.get(t);n!==void 0&&b.set(e,n)});let ee={dx:0,dy:0},te=a.edges.map(e=>{let t=l(e.from),n=l(e.to);if(t===void 0||n===void 0)return;let i=r.has(e.from)||r.has(e.to);return Sl(t,e.from===e.to?t:n,b.get(e),_.get(e)??0,i?{from:r.get(e.from)??ee,to:r.get(e.to)??ee}:void 0)}),x=o.nodes.map(e=>l(e.id)),ne=te.flatMap(e=>{let t=e===void 0?void 0:Cl(e.d);return t===void 0?[]:[t]}),re=Math.min(0,...x.map(e=>e.x-12),...ne.map(e=>e.minX-12)),ie=Math.min(0,...x.map(e=>e.y-12),...ne.map(e=>e.minY-14)),ae=Math.max(o.width,...x.map(e=>e.x+e.w+12),...ne.map(e=>e.maxX+12)),oe=Math.max(o.height,...x.map(e=>e.y+e.h+12),...ne.map(e=>e.maxY+12)),se=e=>{let t=Rc(e,i),n=e.kind===void 0?void 0:f.get(e.kind);return{role:t,stroke:n?.stroke??Nl.unchanged,dash:n?.dash,halo:t===`added`||t===`changed`?Nl[t]:void 0,width:t===`context`?1:t===`unchanged`?1.5:1.8,opacity:t===`context`?.6:1}},ce=[...new Set(a.edges.map(e=>se(e).stroke))],le=oe+4,ue=Math.max(ae-re,iu(g)),de=du(e,a,n,i,t.viewpoint),fe=t.viewpoint===void 0||de===void 0?0:lu(de,ue).length*su+4,pe=oe-ie+au(g,ue)+fe,me=[];for(let e of u)me.push({id:`container-${e.id}`,data:{container:e.id},primitives:[{shape:`rect`,x:e.x,y:e.y,width:e.width,height:e.height,rx:8,fill:`none`,stroke:jl,strokeDasharray:`5 3`,opacity:.55},{shape:`text`,x:e.x+8,y:e.y+12,text:e.label,fontSize:10,fill:jl}]});a.edges.forEach((t,n)=>{let r=l(t.from),i=l(t.to),a=te[n];if(r===void 0||i===void 0||a===void 0)return;let o=se(t),s=o.stroke,c=zc(t),u=t.label??t.kind,d=e=>e.length*5.2+8<=a.span,f=[];o.halo!==void 0&&f.push({shape:`path`,data:{edge:`role`},d:a.d,fill:`none`,stroke:o.halo,strokeWidth:o.width+4,strokeLinecap:`round`,opacity:.3}),f.push({shape:`path`,data:{edge:`line`},d:a.d,fill:`none`,stroke:s,strokeWidth:o.width,...o.dash===void 0?{}:{strokeDasharray:o.dash},opacity:o.opacity,markerEnd:fu(`se-arrow`,s)}),u!==void 0&&d(u)&&f.push({shape:`text`,x:a.labelAt.x,y:a.labelAt.y-5,text:u,textAnchor:`middle`,fontSize:9,fill:s,fontFamily:Ul,stroke:kl,strokeWidth:3,paintOrder:`stroke`});let p=c.map(Fe).join(`, `);c.length>0&&d(p)&&f.push({shape:`text`,x:a.labelAt.x,y:a.labelAt.y+10,text:p,textAnchor:`middle`,fontSize:9,fontWeight:600,fill:s,fontFamily:Ul,stroke:kl,strokeWidth:3,paintOrder:`stroke`,testId:`relationship-change`}),me.push({id:`edge-${n}`,data:{"relationship-role":o.role,"relationship-shape":t.from===t.to?`loop`:`open`},title:Tl(e,t,o.role),primitives:f})});for(let e of a.nodes){let t=l(e.id);if(t===void 0)continue;let n=Ic(e,i);me.push({id:e.id,data:{"element-role":n,"element-id":e.id,draggable:`node`},title:yl(e,n),primitives:Wl({x:t.x,y:t.y,width:t.w,height:t.h,role:n,label:al(e),...e.kind===void 0?{}:{tint:d.get(e.kind)},changes:zc(e)})})}let he=t.viewpoint,ge=de;if(ge!==void 0&&he!==void 0){let e=lu(ge,ue);me.push({id:`filter-note`,testId:`diagram-filter-note`,data:{viewpoint:he.id},primitives:e.map((t,n)=>({shape:`text`,x:re+12,y:le+au(g,ue)+su*n+su-4,text:n<e.length-1?`${t} `:t,fontSize:9,fontWeight:600,fill:`#92400e`,fontFamily:Ul}))})}else ge!==void 0&&me.push({id:`filter-note`,primitives:[{shape:`text`,x:re+12,y:le+au(g,ue)-4,text:ge,fontSize:9,fontWeight:600,fill:`#92400e`,fontFamily:Ul,testId:`diagram-filter-note`}]});return me.push(...ou(g,re+12,le,ue)),{width:ue,height:pe,viewBox:`${re} ${ie} ${ue} ${pe}`,ariaLabel:a.nodes.length===e.nodes.length&&a.edges.length===e.edges.length?`Graph of ${e.nodes.length} elements and ${e.edges.length} relationships`:`Graph of ${e.nodes.length} elements and ${e.edges.length} relationships, filtered to ${a.nodes.length} elements and ${a.edges.length} relationships`,background:kl,markers:ce.map(e=>({id:fu(`se-arrow`,e),paint:e})),groups:me,...ge===void 0?{}:{narrowing:ge},orientation:s}}function yu(e,t){let n=t.isProposal,r=vl(e),{columns:i,bands:a,bandHeight:o,lifelineX:s,boxW:c,headerHeight:l,messageGap:u}=r,d=o,f=r.xOf,p=Bl(Hl(e.participants),t.appearance?.kinds),m=Vl(Hl(e.participants),p),h=[{title:`participants`,sample:`box`,entries:Hl(e.participants).map(e=>({...hu(e,p.get(e),m.get(e)),key:ul(`element`,e)}))}];if(n){let t=new Set([...e.participants.map(e=>Ic(e,!0)),...e.messages.map(e=>Rc(e,!0))]);h.push({title:`changes`,sample:`box`,entries:Pl.filter(e=>e!==`unchanged`&&t.has(e)).map(e=>({label:Bc[e],fill:kl,stroke:Ml[e].stroke,faded:e===`context`}))})}let g=r.height+4,_=Math.max(r.width,iu(h)),v=r.height+au(h,_),y=[];for(let e of a){let t=e.from*s+(s-c)/2,n=e.to*s+(s+c)/2;y.push({id:`band-${e.container.id}-${e.from}`,data:{container:e.container.id},primitives:[{shape:`rect`,x:t,y:2,width:n-t,height:d-6,rx:5,fill:`none`,stroke:jl,strokeDasharray:`5 3`,opacity:.55},{shape:`text`,x:(t+n)/2,y:d-9,text:e.container.label,fontSize:10,textAnchor:`middle`,fill:jl}]})}for(let e of i)y.push({id:`life-${e.id}`,primitives:[{shape:`line`,x1:f(e.id),y1:o+l,x2:f(e.id),y2:r.height-6,stroke:`#d4d4d8`,strokeDasharray:`3 3`,strokeWidth:1}]});for(let e of i){let t=Ic(e,n);y.push({id:e.id,data:{"element-role":t,"element-id":e.id},title:yl(e,t),primitives:Wl({x:f(e.id)-c/2,y:o+4,width:c,height:l-8,role:t,label:al(e),...e.kind===void 0?{}:{tint:p.get(e.kind)},changes:zc(e),anchor:`middle`})})}return e.messages.forEach((t,r)=>{let i=Rc(t,n),a=Nl[i],s=o+l+(r+1)*u,c=f(t.from),d=f(t.to),p=t.from===t.to,m=zc(t),h=p?c+26+6:(c+d)/2,g=p?`start`:`middle`,_=[];p?_.push({shape:`path`,d:`M ${c} ${s} h 26 v ${u/2} h -26`,fill:`none`,stroke:a,strokeWidth:1.4,markerEnd:fu(`se-msg`,a)}):_.push({shape:`line`,x1:c,y1:s,x2:d,y2:s,stroke:a,strokeWidth:1.4,markerEnd:fu(`se-msg`,a)}),t.label!==void 0&&_.push({shape:`text`,x:h,y:s-5,text:t.label,textAnchor:g,fontSize:10,fill:Al,fontFamily:Ul,stroke:kl,strokeWidth:3,paintOrder:`stroke`}),m.length>0&&_.push({shape:`text`,x:h,y:s+11,text:m.map(Fe).join(`, `),textAnchor:g,fontSize:9,fontWeight:600,fill:a,fontFamily:Ul,stroke:kl,strokeWidth:3,paintOrder:`stroke`,testId:`relationship-change`}),_.push({shape:`text`,x:4,y:s+3,text:String(r+1),fontSize:9,fill:jl,fontFamily:Ul}),y.push({id:`message-${r}`,data:{"relationship-role":i,"message-index":String(r),"message-from":t.from,"message-to":t.to},title:wl(e,t,r,i),primitives:_})}),y.push(...ou(h,12,g,_)),{width:_,height:v,viewBox:`0 0 ${_} ${v}`,ariaLabel:`Sequence of ${e.participants.length} participants and ${e.messages.length} messages`,background:kl,markers:Pl.map(e=>({id:fu(`se-msg`,Nl[e]),paint:Nl[e]})),groups:y}}var bu=`change`,xu=`section`,Su=`level`;function Cu(e,t,n){let r=Uc(e),i=(e,t)=>n?.[t]?.role??Wc(e,r),a=e.rows.some((e,t)=>i(e,t)!==void 0),o=e.rows.map((e,t)=>({row:e,role:i(e,t)})).filter(({role:e})=>e===void 0||!t.has(ul(`role`,e)));return{shown:o,anyRole:a,withheld:e.rows.length-o.length}}function wu(e,t,n){let{shown:r,anyRole:i,withheld:a}=Cu(e,t,n),o=e.rows.some(e=>ue(e).heading!==void 0);return{columns:[...o?[xu,Su]:[],...e.columns,...i?[bu]:[]],rows:r.map(({row:t,role:n})=>{let{cells:r,heading:a}=ue(t),s=Array.isArray(t)?void 0:t.depth,c=o?a===void 0?[null,null]:[a,s??1]:[],l=a===void 0?r:e.columns.map(()=>null);return[...c,...l,...i?[n===void 0?null:Vc[n]]:[]]}),withheld:a}}function Tu(e){if(e===null)return``;let t=String(e);return/[",\n\r]/.test(t)?`"${t.replaceAll(`"`,`""`)}"`:t}function Eu(e){return[e.columns,...e.rows].map(e=>e.map(Tu).join(`,`)).join(`\r
|
|
9
9
|
`)}function Du(e){return e===null?``:String(e).replaceAll(`\\`,`\\\\`).replaceAll(`|`,`\\|`).replace(/\r\n|\r|\n/g,`<br>`)}function Ou(e){return e.replaceAll(`\\`,`\\\\`).replace(/\r\n|\r|\n/g,` `)}function ku(e,t=new Set,n){let{shown:r,anyRole:i}=Cu(e,t,n),a=[...e.columns,...i?[bu]:[]],o=`| ${a.map(e=>Du(e)).join(` | `)} |`,s=`| ${a.map(()=>`---`).join(` | `)} |`,c=[],l=[],u=!1,d=()=>{l.length!==0&&(c.push([o,s,...l].join(`
|
|
10
10
|
`)),l=[],u=!0)};for(let{row:e,role:t}of r){let{cells:n,heading:r}=ue(e);if(r!==void 0){d();let t=Array.isArray(e)?1:e.depth??1;c.push(`${`#`.repeat(Math.min(t+1,6))} ${Ou(r)}`);continue}let a=[...n,...i?[t===void 0?null:Vc[t]]:[]];l.push(`| ${a.map(Du).join(` | `)} |`)}return d(),!u&&c.length===0&&c.push([o,s].join(`
|
|
11
11
|
`)),`${c.join(`
|
|
@@ -5167,7 +5167,7 @@ function gu(e) {
|
|
|
5167
5167
|
}
|
|
5168
5168
|
//#endregion
|
|
5169
5169
|
//#region ../shared/src/structuredExchangeFigure.ts
|
|
5170
|
-
var _u = "system-ui, sans-serif";
|
|
5170
|
+
var _u = "system-ui, Segoe UI, Arial, Helvetica, sans-serif";
|
|
5171
5171
|
function vu(e) {
|
|
5172
5172
|
let t = ou[e.role], n = {
|
|
5173
5173
|
fill: e.tint?.fill ?? t.fill,
|