isorite 0.13.0 → 0.15.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/main.js +643 -48
- package/docs/setup.md +5 -4
- package/docs/terminal.md +4 -2
- package/guide/your-own-base/starting-a-base.md +4 -4
- package/package.json +1 -1
- package/web/_app/immutable/assets/{0.BEjn1Bfl.css → 0.CtWz9d2A.css} +1 -1
- package/web/_app/immutable/chunks/{BWE_HS0c.js → 0B47b24t.js} +1 -1
- package/web/_app/immutable/chunks/{CzYPMYd4.js → 1j--pDqt.js} +1 -1
- package/web/_app/immutable/chunks/{e2LGvGEb.js → AnnzTlE8.js} +1 -1
- package/web/_app/immutable/chunks/B7Bf3hc7.js +1 -0
- package/web/_app/immutable/chunks/{DRcTlHZP.js → B7LnLClC.js} +1 -1
- package/web/_app/immutable/chunks/B9TKPEJD.js +1 -0
- package/web/_app/immutable/chunks/{ZwM5k8r0.js → BAVnZFPa.js} +1 -1
- package/web/_app/immutable/chunks/{O98JkczU.js → BDJlNL-I.js} +3 -3
- package/web/_app/immutable/chunks/{BiATTH-R.js → BLe29cGh.js} +1 -1
- package/web/_app/immutable/chunks/{C8h1oeAZ.js → BLzZIf7l.js} +1 -1
- package/web/_app/immutable/chunks/{DCZYeMlH.js → BPpUSQ2Y.js} +1 -1
- package/web/_app/immutable/chunks/{kG4HctVa.js → BQeONalw.js} +1 -1
- package/web/_app/immutable/chunks/{CtkUy_15.js → BZX8cNYL.js} +1 -1
- package/web/_app/immutable/chunks/{C8nK3Jvr.js → B_x6_Y3m.js} +1 -1
- package/web/_app/immutable/chunks/{Bb_N98K9.js → BiHyHFlW.js} +1 -1
- package/web/_app/immutable/chunks/{B6uHgLdT.js → BsY4iMci.js} +1 -1
- package/web/_app/immutable/chunks/{DKqMzyyE.js → BtcGx-KQ.js} +1 -1
- package/web/_app/immutable/chunks/{BK31dpt6.js → Bytzbt5l.js} +1 -1
- package/web/_app/immutable/chunks/{DDAG55ce.js → C1FDDux-.js} +1 -1
- package/web/_app/immutable/chunks/C7qBBO-i.js +1 -0
- package/web/_app/immutable/chunks/{CdY1G_wk.js → C9Qdslk3.js} +1 -1
- package/web/_app/immutable/chunks/{CMIt1Ma8.js → CSKABQj2.js} +1 -1
- package/web/_app/immutable/chunks/CSTv2fL0.js +1 -0
- package/web/_app/immutable/chunks/{PsfIQCJ1.js → CUB9vnd0.js} +1 -1
- package/web/_app/immutable/chunks/{DrVtdHUW.js → CUNetmvQ.js} +1 -1
- package/web/_app/immutable/chunks/{Djr0h_v1.js → CVqwkR8N.js} +1 -1
- package/web/_app/immutable/chunks/{CTDYUZPz.js → CWc-mNzo.js} +1 -1
- package/web/_app/immutable/chunks/{CryuQgNh.js → CZSmkKvQ.js} +1 -1
- package/web/_app/immutable/chunks/{BA78_vo5.js → CcE14TDI.js} +1 -1
- package/web/_app/immutable/chunks/{DjUnonHY.js → Ch5Z7cbP.js} +1 -1
- package/web/_app/immutable/chunks/{DFuPQaNa.js → Cpjqsnqr.js} +1 -1
- package/web/_app/immutable/chunks/{Bd-WxALw.js → CwHHpacD.js} +1 -1
- package/web/_app/immutable/chunks/{s_hW4oA1.js → D1MhxXyn.js} +1 -1
- package/web/_app/immutable/chunks/{Bt-fHApV.js → D4EpFhYZ.js} +1 -1
- package/web/_app/immutable/chunks/{UDPiRmKc.js → D7jLdCNu.js} +1 -1
- package/web/_app/immutable/chunks/{CFf_dAzX.js → DAVMwq6b.js} +1 -1
- package/web/_app/immutable/chunks/{C2npZzkn.js → DEQsS4Ez.js} +1 -1
- package/web/_app/immutable/chunks/{B-DzK7Gb.js → DFo4P1vU.js} +1 -1
- package/web/_app/immutable/chunks/{CdmC_l9F.js → DH_19--P.js} +1 -1
- package/web/_app/immutable/chunks/{l1LsK1sB.js → DJQ6favH.js} +1 -1
- package/web/_app/immutable/chunks/{BvPxdlBc.js → DJT73ARj.js} +1 -1
- package/web/_app/immutable/chunks/{BCGaqnao.js → DW5uy3Jw.js} +1 -1
- package/web/_app/immutable/chunks/{BT_btfh0.js → DWwu8a1P.js} +1 -1
- package/web/_app/immutable/chunks/{BhEqJU15.js → DY0M2GMn.js} +1 -1
- package/web/_app/immutable/chunks/{TanDZqdf.js → DbtvzL7r.js} +1 -1
- package/web/_app/immutable/chunks/{D9JwUycj.js → Djo-ijeo.js} +1 -1
- package/web/_app/immutable/chunks/DtEVmiYo.js +1 -0
- package/web/_app/immutable/chunks/{CT4_O9X_.js → DxRGLDbV.js} +1 -1
- package/web/_app/immutable/chunks/{Cd_SqIWq.js → Dx_7xlS4.js} +36 -36
- package/web/_app/immutable/chunks/{D6sVhEz3.js → Ih6r6QR2.js} +1 -1
- package/web/_app/immutable/chunks/{BXBhaEho.js → Kem7IXj7.js} +1 -1
- package/web/_app/immutable/chunks/{WLe0MT1c.js → LbnMg2Kc.js} +1 -1
- package/web/_app/immutable/chunks/{Ct_EK1xu.js → MrW4zd8l.js} +1 -1
- package/web/_app/immutable/chunks/{BqipEJXw.js → Mwr1r9aw.js} +1 -1
- package/web/_app/immutable/chunks/{D1LK3xRu.js → OG9GsKke.js} +1 -1
- package/web/_app/immutable/chunks/{B35sQTcK.js → ZTEErEOd.js} +1 -1
- package/web/_app/immutable/chunks/{Cf-5I5_6.js → e7GRa0yc.js} +1 -1
- package/web/_app/immutable/chunks/{C5Z-Y7Lu.js → f7mFVWQS.js} +1 -1
- package/web/_app/immutable/chunks/{Bj-5n5Pb.js → hjSZ041d.js} +1 -1
- package/web/_app/immutable/chunks/{DHJ8FcFD.js → mhWk5y4o.js} +1 -1
- package/web/_app/immutable/chunks/{3fCuxe18.js → wD7RSG2d.js} +1 -1
- package/web/_app/immutable/chunks/{CMikI1NP.js → zasx25UV.js} +3 -3
- package/web/_app/immutable/entry/app.Av5W3V8v.js +2 -0
- package/web/_app/immutable/entry/start.CbpxCvWi.js +1 -0
- package/web/_app/immutable/nodes/0.BTVYyqUm.js +3 -0
- package/web/_app/immutable/nodes/1.DR-b7PMP.js +1 -0
- package/web/_app/immutable/nodes/2.BePyTqoa.js +1 -0
- package/web/_app/immutable/nodes/3.D2rfIXQP.js +1 -0
- package/web/_app/immutable/nodes/4.7tuUcODS.js +15 -0
- package/web/_app/immutable/nodes/5.Cs9hcGU9.js +1 -0
- package/web/_app/immutable/nodes/6.DzvF0ZPt.js +1 -0
- package/web/_app/version.json +1 -1
- package/web/index.html +15 -15
- package/web/_app/immutable/chunks/BCyLp7pS.js +0 -1
- package/web/_app/immutable/chunks/BOxykeIc.js +0 -1
- package/web/_app/immutable/chunks/CAlIuau0.js +0 -1
- package/web/_app/immutable/chunks/Cl5gQm2e.js +0 -1
- package/web/_app/immutable/chunks/ej_0XxR7.js +0 -1
- package/web/_app/immutable/entry/app.DM_AWBgH.js +0 -2
- package/web/_app/immutable/entry/start.BLhIKDcR.js +0 -1
- package/web/_app/immutable/nodes/0.xSbkmYPn.js +0 -2
- package/web/_app/immutable/nodes/1.BD2wJdoH.js +0 -1
- package/web/_app/immutable/nodes/2.shPqwtS_.js +0 -1
- package/web/_app/immutable/nodes/3.e_5kWaf_.js +0 -1
- package/web/_app/immutable/nodes/4.BEMEU6Jz.js +0 -15
- package/web/_app/immutable/nodes/5.DxaO-e4O.js +0 -1
- package/web/_app/immutable/nodes/6.C9ia8cDm.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e,f as t,i as n,o as r,u as i,x as a}from"./
|
|
1
|
+
import{_ as e,f as t,i as n,o as r,u as i,x as a}from"./DEQsS4Ez.js";import{n as o}from"./BZX8cNYL.js";import{t as s}from"./DciMwFJ1.js";import{a as c,c as l,d as u,f as d,g as f,h as p,i as m,l as h,m as g,n as _,o as v,p as y,r as b,s as x,t as S,u as C}from"./CWc-mNzo.js";import{PeleError as ee,u as te}from"./zasx25UV.js";var w={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4};function T(e){throw new ee(e,`semantic`,{type:`gitGraph`})}function E(e){return e===`REVERSE`?w.REVERSE:e===`HIGHLIGHT`?w.HIGHLIGHT:w.NORMAL}function D(e,t){e.dir&&t.setDirection(e.dir);for(let n of e.statements)O(n,t)}function O(e,t){switch(e.$type){case`Commit`:t.commit({id:e.id,msg:e.message??``,type:e.type===void 0?w.NORMAL:E(e.type),tags:e.tags??void 0});break;case`Branch`:t.branch({name:e.name,order:e.order??0});break;case`Merge`:t.merge({branch:e.branch,id:e.id??``,type:e.type===void 0?void 0:E(e.type),tags:e.tags??void 0});break;case`Checkout`:t.checkout(e.branch);break;case`CherryPicking`:t.cherryPick({id:e.id,targetId:``,tags:e.tags?.length===0?void 0:e.tags,parent:e.parent})}}function k(e,t,n){let r=t.gitGraph,i=typeof r?.mainBranchName==`string`?r.mainBranchName:`main`,a=typeof r?.mainBranchOrder==`number`?r.mainBranchOrder:0,o=new Map,s=new Map([[i,null]]),c=new Map([[i,a]]),l=[],u=null,d=i,f=`LR`,p=0,m=()=>{for(let e=p+1;;e+=2654435761){let t=`${p}-${(Math.imul(e,2654435761)>>>0).toString(16).padStart(8,`0`).slice(0,7)}`;if(!o.has(t))return t}},h=e=>{u=e,o.set(e.id,e),s.set(d,e.id)},g=e=>{s.has(e)||T(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`),d=e;let t=s.get(e);u=t?o.get(t)??null:null};D(e,{setDirection(e){f=e},commit({msg:e,id:t,type:n,tags:r}){let i={id:t||m(),message:e,seq:p++,type:n??w.NORMAL,tags:r?[...r]:[],parents:u===null?[]:[u.id],branch:d};o.has(i.id)&&l.push(`Commit ID ${i.id} already exists`),h(i)},branch({name:e,order:t}){s.has(e)&&T(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${e}")`),s.set(e,u===null?null:u.id),c.set(e,t),g(e)},merge({branch:e,id:t,type:n,tags:r}){let i=s.get(d),a=s.get(e),c=i?o.get(i):void 0,l=a?o.get(a):void 0;c&&l&&c.branch===e&&T(`Cannot merge branch '${e}' into itself.`),d===e&&T(`Incorrect usage of "merge". Cannot merge a branch to itself`),c===void 0&&T(`Incorrect usage of "merge". Current branch (${d})has no commits`),s.has(e)||T(`Incorrect usage of "merge". Branch to be merged (${e}) does not exist`),l===void 0&&T(`Incorrect usage of "merge". Branch to be merged (${e}) has no commits`),c===l&&T(`Incorrect usage of "merge". Both branches have same head`),t&&o.has(t)&&T(`Incorrect usage of "merge". Commit with id:${t} already exists, use different custom id`),h({id:t||m(),message:`merged branch ${e} into ${d}`,seq:p++,parents:u===null?[]:[u.id,a||``],branch:d,type:w.MERGE,customType:n,customId:!!t,tags:r?[...r]:[]})},cherryPick({id:e,targetId:t,tags:n,parent:r}){let i=e?o.get(e):void 0;if(i===void 0&&T(`Incorrect usage of "cherryPick". Source commit id should exist and provided`),r&&!i.parents.includes(r)&&T(`Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.`),i.type===w.MERGE&&!r&&T(`Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.`),t&&o.has(t))return;i.branch===d&&T(`Incorrect usage of "cherryPick". Source commit is already on current branch`);let a=s.get(d);(!a||!o.has(a))&&T(`Incorrect usage of "cherry-pick". Current branch (${d})has no commits`),h({id:m(),message:`cherry-picked ${i.message} into ${d}`,seq:p++,parents:u===null?[]:[u.id,i.id],branch:d,type:w.CHERRY_PICK,tags:n?n.filter(Boolean):[`cherry-pick:${i.id}${i.type===w.MERGE?`|parent:${r}`:``}`]})},checkout:g});let _=[...c].map(([e,t],n)=>({name:e,order:t??parseFloat(`0.${n}`)})).sort((e,t)=>e.order-t.order).map(e=>e.name);return{type:`gitGraph`,title:e.title||n,accTitle:e.accTitle?e.accTitle.replace(/^\s+/g,``):void 0,accDescr:e.accDescr?e.accDescr.replace(/\n\s+/g,`
|
|
2
2
|
`):void 0,direction:f,commits:o,branches:s,lanes:_,currentBranch:d,head:u,warnings:l}}var A={name:`REFERENCE`,pattern:/\w([-\./\w]*[-\w])?/y},j=[A];function M(e){return{name:e,pattern:e,longer:j}}var N=[M(`cherry-pick`),{name:`gitGraph:`,pattern:`gitGraph:`},M(`HIGHLIGHT`),{...m(`gitGraph`),longer:j},M(`checkout`),M(`REVERSE`),{name:`parent:`,pattern:`parent:`},M(`commit`),M(`NORMAL`),M(`branch`),{name:`order:`,pattern:`order:`},M(`switch`),{name:`type:`,pattern:`type:`},M(`merge`),{name:`msg:`,pattern:`msg:`},{name:`tag:`,pattern:`tag:`},{name:`id:`,pattern:`id:`},M(`LR`),M(`TB`),M(`BT`),{name:`:`,pattern:`:`},{...c,opener:/[\t ]*accDescr\s*{/y},S,y,{name:`INT`,pattern:/0|[1-9][0-9]*(?!\.)/y},g,h,C,b,v,x,A];function P(e){let t=new p(_(e,N,`gitGraph`),N,`gitGraph`),n={$type:`GitGraph`,statements:[]},r=()=>{if(t.kind!==-1)for(t.kind!==26&&t.fail(`a line break or the end of input`);t.kind===26;)t.i++},i=()=>t.kind===31?t.take():t.kind===25?d(t.take()):t.fail(`a branch name`),a=()=>d(t.expect(25)),o=()=>(t.kind!==8&&t.kind!==5&&t.kind!==2&&t.fail(`NORMAL, REVERSE, or HIGHLIGHT`),t.take());for(;t.kind===26;)t.i++;if(!t.accept(1)){t.expect(3);let e=t.kinds[t.i+1];(t.kind===17||t.kind===18||t.kind===19)&&e===20?(n.$type=`Direction`,n.dir=t.take(),t.i++):t.accept(20)}for(;t.kind!==-1;)switch(t.kind){case 26:t.i++;break;case 21:n.accDescr=l(t.take()),r();break;case 22:n.accTitle=f(t.take()),r();break;case 23:n.title=u(t.take()),r();break;case 7:{t.i++;let e={$type:`Commit`,tags:[]};for(;;)if(t.accept(16))e.id=a();else if(t.accept(15))e.tags.push(a());else if(t.accept(12))e.type=o();else if(t.accept(14)||t.kinds[t.i]===25)e.message=a();else break;r(),n.statements.push(e);break}case 9:{t.i++;let e={$type:`Branch`,name:i()};t.accept(10)&&(e.order=parseInt(t.expect(24))),r(),n.statements.push(e);break}case 13:{t.i++;let e={$type:`Merge`,branch:i(),tags:[]};for(;;)if(t.accept(16))e.id=a();else if(t.accept(15))e.tags.push(a());else if(t.accept(12))e.type=o();else break;r(),n.statements.push(e);break}case 4:case 11:{t.i++;let e={$type:`Checkout`,branch:i()};r(),n.statements.push(e);break}case 0:{t.i++;let e={$type:`CherryPicking`,tags:[]};for(;;)if(t.accept(16))e.id=a();else if(t.accept(15))e.tags.push(a());else if(t.accept(6))e.parent=a();else break;r(),n.statements.push(e);break}default:t.fail(`a statement, a title, or a line break`)}return n}var F=7,ne=44,re=44,I=36,L=8,R=20,z=20,B=7,ie=6,V=Math.SQRT1_2,ae=[`normal`,`reverse`,`highlight`,`merge`,`cherry-pick`];function H(e,t,n){let r=e.gitGraph?.[t];return typeof r==`boolean`?r:n}function oe(e){return B+4+e.width+6}function se(e,t,n,r){let i=`cx="${a(t)}" cy="${a(n)}"`;if(e===w.HIGHLIGHT)return`<rect x="${a(t-F-1)}" y="${a(n-F-1)}" width="${2*F+2}" height="${2*F+2}" rx="2" fill="${r}"/>`;if(e===w.MERGE)return`<circle ${i} r="${F-1}" fill="var(--_bg)" stroke="${r}" stroke-width="2"/><circle ${i} r="2.5" fill="${r}"/>`;let o=`<circle ${i} r="${F}" fill="${r}"/>`;return e===w.REVERSE?o+`<path d="M${a(t-3)},${a(n-3)}l6,6M${a(t-3)},${a(n+3)}l6,-6" fill="none" stroke="var(--_bg)" stroke-width="1.5" stroke-linecap="round"/>`:e===w.CHERRY_PICK?o+`<path d="M${a(t-2.6)},${a(n+1)}L${a(t+.8)},${a(n-4.2)}L${a(t+2.6)},${a(n+1)}" fill="none" stroke="var(--_bg)" stroke-linejoin="round"/><circle cx="${a(t-2.6)}" cy="${a(n+2.2)}" r="1.8" fill="var(--_bg)"/><circle cx="${a(t+2.6)}" cy="${a(n+2.2)}" r="1.8" fill="var(--_bg)"/>`:o}function U(e,t,n){return e.direction===`LR`?s(n,r=>W(e,t,n,r?`TB`:`LR`)):W(e,t,n,e.direction)}function W(s,c,l,u){let d=l.fontSize??16,f=Math.round(d*.75),p=l.measurer??te(l.fontFamily,l.fontFamilyMono),m=l.padding??8,h=H(c,`showBranches`,!0),g=H(c,`showCommitLabel`,!0),_=H(c,`rotateCommitLabel`,!0),v=H(c,`parallelCommits`,!1),y=u!==`LR`,b=u===`BT`,x=new Map;s.lanes.forEach((e,t)=>x.set(e,t));let S=s.lanes.length,C=Math.round(d*.875),ee=s.lanes.map(e=>o(h?e:``,p,C,4e3)),T=[],E=new Map;for(let e of[...s.commits.values()].sort((e,t)=>e.seq-t.seq)){let t=g&&e.type!==w.CHERRY_PICK&&(e.type!==w.MERGE||e.customId===!0),n=[];for(let t of e.tags){let e=o(t,p,f,4e3);e.lines.length>0&&n.push(e)}let r={commit:e,index:T.length,lane:x.get(e.branch)??0,m:0,label:t?o(e.id,p,f,4e3):void 0,tags:n};T.push(r),E.set(e.id,r)}let D=new Float64Array(T.length),O=new Float64Array(T.length),k=new Float64Array(S).fill(F),A=new Float64Array(S).fill(F);T.forEach((e,t)=>{let{label:n,tags:r}=e,i=0,a=0;for(let e of r){let t=oe(e);y?(i=Math.max(i,e.height),a+=t+4):(i=Math.max(i,t),a+=e.height+3)}let o=0,s=0;n!==void 0&&n.lines.length>0&&(_?s=3+V*(n.width+n.height):(o=y?n.height:n.width,s=6+(y?n.width:n.height))),D[t]=Math.max(F,i/2,o/2),O[t]=i/2;let c=F+(r.length>0?ie+a:0),l=F+s,u=e.lane;k[u]=Math.max(k[u],y?l:c),A[u]=Math.max(A[u],y?c:l)});let j=new Float64Array(T.length);y||T.forEach((e,t)=>{if(O[t]!==0)for(let n of e.commit.parents){let r=E.get(n);r!==void 0&&r.lane<e.lane&&(j[t]=O[t]+4)}});let M=(e,t)=>Math.max(ne,D[e]+D[t]+L,j[t]>0?D[e]+I+j[t]:0);T.forEach((e,t)=>{if(!v){e.m=t===0?0:T[t-1].m+M(t-1,t);return}let n=0;for(let r of e.commit.parents){let e=E.get(r);e===void 0||e.index>=t||(n=Math.max(n,e.m+M(e.index,t)))}e.m=n});let N=0;for(let e of T)N=Math.max(N,e.m);let P=new Float64Array(S);for(let e=0;e<S;e++){let t=ee[e],n=t.lines.length===0?0:y?t.width/2+8:t.height/2+2;k[e]=Math.max(k[e],n),A[e]=Math.max(A[e],n),e>0&&(P[e]=P[e-1]+Math.max(re,A[e-1]+k[e]+L))}let U=(e,t)=>y?t:e,W=(e,t)=>y?b?-e:e:t,G=(e,t)=>`${a(U(e,t))},${a(W(e,t))}`,K=1/0,q=1/0,J=-1/0,Y=-1/0,X=(e,t,n,r)=>{e<K&&(K=e),t<q&&(q=t),n>J&&(J=n),r>Y&&(Y=r)},Z=``;if(h)for(let e=0;e<S;e++){let i=ee[e],o=t(e),c=P[e],l=i.width+16,u=i.height+4,d=i.lines.length===0?-R:-R-(y?u:l),f=U(d+(y?u:l)/2,c),p=W(d+(y?u:l)/2,c);X(U(-R,c),W(-R,c),U(-R,c),W(-R,c)),X(U(N+z,c),W(N+z,c),U(N+z,c),W(N+z,c)),Z+=`<g class="pele-branch" data-id="${n(s.lanes[e])}"><path class="pele-lane" d="M${G(-R,c)}L${G(N+z,c)}" stroke="${o}" stroke-dasharray="2 4"/>`,i.lines.length>0&&(X(f-l/2,p-u/2,f+l/2,p+u/2),Z+=`<rect x="${a(f-l/2)}" y="${a(p-u/2)}" width="${a(l)}" height="${a(u)}" fill="${o}" style="rx:var(--_r)"/>`+r(i,f,p,` class="pele-label" fill="var(--_bg)"`)),Z+=`</g>`}let ce=Array.from({length:S},()=>[]);for(let e of T)ce[e.lane].push(e.m);if(v)for(let e of ce)e.sort((e,t)=>e-t);let le=(e,t,n)=>{let r=ce[e],i=0,a=r.length;for(;i<a;){let e=i+a>>1;r[e]<=t?i=e+1:a=e}return i<r.length&&r[i]<n},ue=``,Q=``;for(let e of T){let{commit:n}=e,r=P[e.lane],i=e.m;for(let a=0;a<n.parents.length;a++){let o=E.get(n.parents[a]);if(o===void 0||o===e)continue;let s=P[o.lane],c=o.m;if(o.lane===e.lane){Q+=`<path class="pele-edge" d="M${G(c,s)}L${G(i,r)}" stroke="${t(e.lane)}"/>`;continue}let l=a>0&&n.type===w.MERGE,u=a>0&&!l,d=`M${G(c,s)}`;if(i<=c){let e=(c+i)/2;d+=`C${G(e,s)} ${G(e,r)} ${G(i,r)}`}else if(!l&&!le(e.lane,c,i)){let e=Math.min(I,i-c);d+=`C${G(c+e/2,s)} ${G(c+e/2,r)} ${G(c+e,r)}L${G(i,r)}`}else{let t=o.lane<e.lane&&i-j[e.index]>c?i-j[e.index]:i,n=Math.min(I,t-c),a=s;(!l||le(o.lane,c,i))&&(a=s>r?r+A[e.lane]+L/2:r-k[e.lane]-L/2,n=Math.min(I,(t-c)/2),d+=`C${G(c+n/2,s)} ${G(c+n/2,a)} ${G(c+n,a)}`),d+=`L${G(t-n,a)}C${G(t-n/2,a)} ${G(t-n/2,r)} ${G(t,r)}`,t<i&&(d+=`L${G(i,r)}`)}ue+=`<path class="pele-edge${l?` pele-edge-merge`:u?` pele-edge-cherry-pick`:``}" d="${d}" stroke="${t(l?o.lane:e.lane)}"${u?` stroke-dasharray="4 3"`:``}/>`}}let de=``;for(let e of T){let{commit:i,label:o,tags:s}=e,c=U(e.m,P[e.lane]),l=W(e.m,P[e.lane]),u=i.customType??i.type;X(c-F-1,l-F-1,c+F+1,l+F+1);let d=i.type<w.MERGE&&i.message!==``?`<title>${n(i.message)}</title>`:``;if(d+=se(u,c,l,t(e.lane)),o!==void 0&&o.lines.length>0){let e=o.width,t=o.height,n=(n,r)=>`<rect x="${a(n-e/2-2)}" y="${a(r-t/2+2)}" width="${a(e+4)}" height="${a(t-4)}" rx="3" fill="var(--_bg)"/>`;if(_){let i=V*t/2,s=y?c-F-3-i:c+3,u=y?l:l+F+3+i,f=V*e+i;X(s-f,b?u-f:u-i,s+i,b?u+i:u+f),d+=`<g class="pele-commit-label" transform="rotate(${b?45:-45} ${a(s)} ${a(u)})">`+n(s-e/2,u)+r(o,s-e/2,u,``)+`</g>`}else{let i=y?c-F-6-e/2:c,a=y?l:l+F+6+t/2;X(i-e/2,a-t/2,i+e/2,a+t/2),d+=`<g class="pele-commit-label">${n(i,a)}${r(o,i,a,``)}</g>`}}let f=F+ie;for(let e=y?0:s.length-1;e>=0&&e<s.length;e+=y?1:-1){let t=s[e],n=oe(t),i=t.height,o=y?c+f:c-n/2,u=y?l:l-f-i/2;f+=y?n+4:i+3,X(o,u-i/2,o+n,u+i/2),d+=`<g class="pele-tag"><path d="M${a(o)},${a(u)}L${a(o+B)},${a(u-i/2)}H${a(o+n)}V${a(u+i/2)}H${a(o+B)}Z" fill="var(--_s)" stroke="var(--_b)" stroke-linejoin="round"/><circle cx="${a(o+B)}" cy="${a(u)}" r="1.5" fill="var(--_b)"/>`+r(t,o+B+4+t.width/2,u,` fill="var(--_fg)"`)+`</g>`}let p=i.type===w.MERGE&&u!==w.MERGE?` pele-commit-merge`:``;de+=`<g class="pele-commit pele-commit-${ae[u]??ae[0]}${p}" data-id="${n(i.id)}">${d}</g>`}K>J&&X(0,0,0,0);let $=i(s.title,!1,p,d,4e3,1),fe=$.height>0?$.height+16:0,pe=Math.max(J-K,$.width),me=Math.ceil(pe+2*m),he=Math.ceil(Y-q+fe+2*m),ge=m-K+(pe-(J-K))/2,_e=m+fe-q,ve=r($,me/2,m+$.height/2,` class="pele-title" font-weight="var(--_tw)"`)+`<g transform="translate(${a(ge)},${a(_e)})">`+(Z?`<g class="pele-branches" fill="none" font-size="${C}">${Z}</g>`:``)+(ue||Q?`<g class="pele-edges" fill="none" stroke-width="2" stroke-linecap="round">${ue}${Q}</g>`:``)+(de?`<g class="pele-commits" font-size="${f}" fill="var(--_m)">${de}</g>`:``)+`</g>`;return{svg:e(`gitGraph`,me,he,d,l,s,ve),width:me,height:he,links:[]}}var G={type:`gitGraph`,parse:(e,t,n)=>k(P(e),t,n),render:U};export{G as gitGraph};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,o as t,x as n}from"./C2npZzkn.js";function r(e,t,n=0){return{w:e,h:t,kind:n,pin:0,hint:NaN,key:NaN,span:0,x:0,y:0,rank:0}}function i(e,t,n=1,r=0,i=0){return{tail:e,head:t,minlen:n,labelW:r,labelH:i,tailDx:0,headDx:0,tailFixed:!1,headFixed:!1,reversed:!1,points:[],labelX:0,labelY:0}}var a=24,o=2e4,s=16,c=8,l=.125,u=3,d=18,f=10,p=14,m=2,h=28,g=12,_=12,v=8,y=4,b=.5,x=.5,S=12,C=40,w=400,T=16,E=new Float64Array(2*T+2),D=new Float64Array(2*T+2);function O(e){return e===1||e===2}function k(e,t,n,r){for(let i=t+1;i<n;i++){let n=e[i],a=r[n],o=i-1;for(;o>=t&&(r[e[o]]>a||r[e[o]]===a&&e[o]>n);)e[o+1]=e[o],o--;e[o+1]=n}}function A(e,t,n,r,i,a){let o=(e,t)=>n[e]<n[t]||n[e]===n[t]&&(i?r[e]>r[t]:r[e]<r[t]);for(let n=0;n<t;n+=8)for(let r=n+1,i=Math.min(t,n+8);r<i;r++){let t=e[r],i=r-1;for(;i>=n&&o(t,e[i]);)e[i+1]=e[i],i--;e[i+1]=t}let s=e,c=a;for(let e=8;e<t;e*=2){for(let n=0;n<t;n+=2*e){let r=Math.min(t,n+e),i=Math.min(t,n+2*e),a=n,l=r,u=n;for(;a<r&&l<i;)c[u++]=o(s[l],s[a])?s[l++]:s[a++];for(;a<r;)c[u++]=s[a++];for(;l<i;)c[u++]=s[l++]}let n=s;s=c,c=n}if(s!==e)for(let n=0;n<t;n++)e[n]=s[n]}function j(e,t,n){let r=e.length;if(r===0)return{width:0,height:0};let i=t.length;if(r===1&&i===0&&e[0].kind===0){let t=e[0];return t.rank=0,t.x=t.w/2,t.y=t.h/2,{width:t.w,height:t.h}}let a=1;if(i>0){let e=new Set;for(let n of t){let t=Math.min(n.tail,n.head),i=Math.max(n.tail,n.head),o=t*r+i;if(n.labelW>0||e.has(o)){a=2;break}e.add(o)}}M(e,t),N(e,t,a);let s=new Int32Array(i),c=0;for(let n=0;n<i;n++){let r=t[n];s[n]=Math.abs(e[r.head].rank-e[r.tail].rank),s[n]>1&&(c+=s[n]-1)}let _=new Uint8Array(i);if(c>o){let e=[];for(let t=0;t<i;t++)s[t]>1&&e.push(t);e.sort((e,t)=>s[t]-s[e]||e-t);for(let t of e){if(c<=o)break;_[t]=1,c-=s[t]-1}}let v=r+c,y=new Float64Array(v),b=new Float64Array(v),x=new Uint8Array(v),S=new Int32Array(v),C=0;for(let t=0;t<r;t++){let n=e[t];y[t]=n.w,b[t]=n.h,x[t]=n.kind,S[t]=n.rank,n.rank>C&&(C=n.rank)}let w=0;for(let e=0;e<i;e++)_[e]||(w+=s[e]);let T=new Int32Array(w),E=new Int32Array(w),D=new Float64Array(w),O=new Float64Array(w),k=new Int32Array(i).fill(-1),A=new Uint8Array(C+1),j=new Int32Array(i).fill(-1),P=!1;for(let t=0;t<r;t++)e[t].span>0&&e[t].kind===0&&(P=!0);let I=P?new Uint8Array(w):void 0,R=P?new Uint8Array(w):void 0,B=new Int32Array(i).fill(-1),ce=new Int32Array(i).fill(-1),V=new Float64Array(v).fill(NaN);for(let t=0;t<r;t++)V[t]=e[t].key;let H=!1;{let e=r,n=0;for(let r=0;r<i;r++){if(_[r])continue;let i=t[r],o=i.reversed?i.head:i.tail,s=i.reversed?i.tail:i.head,c=i.reversed?i.headDx:i.tailDx,l=i.reversed?i.tailDx:i.headDx;(c!==0||l!==0)&&(H=!0);let u=S[o],d=S[s],f=-1;i.labelW>0&&(f=u+(d-u>>1),a===2&&d-u>=4?(f&1)==1&&(f+=i.reversed?1:-1):a===2&&!(f&1)&&(f+=i.reversed?1:-1));let p=o;d-u>1&&(k[r]=e),B[r]=n,I&&!(i.reversed?i.headFixed:i.tailFixed)&&(I[n]=i.reversed?2:1);for(let t=u+1;t<d;t++){let a=e++;S[a]=t,V[a]=V[o]+(V[s]-V[o])*(t-u)/(d-u),t===f?(y[a]=i.labelW,b[a]=i.labelH,x[a]=2,j[r]=a,A[t]|=i.reversed?2:1):x[a]=1,T[n]=p,E[n]=a,D[n]=p===o?c:0,n++,p=a}T[n]=p,E[n]=s,D[n]=p===o?c:0,O[n]=l,R&&!(i.reversed?i.tailFixed:i.headFixed)&&(R[n]=i.reversed?1:2),ce[r]=n,n++}}let le;if(n.groups){let{of:e,parent:a}=n.groups;le=new Int32Array(v);for(let t=0;t<r;t++)le[t]=e[t];let o=e=>{let t=0;for(;e>=0;e=a[e])t++;return t},c=(e,t)=>{let n=o(e),r=o(t);for(;n>r;n--)e=a[e];for(;r>n;r--)t=a[t];for(;e!==t;)e=a[e],t=a[t];return e};for(let n=0;n<i;n++){if(k[n]<0)continue;let r=t[n],i=c(e[r.tail],e[r.head]);for(let e=k[n],t=e+s[n]-1;e<t;e++)le[e]=i}}let U=new Int32Array(v+1),W=new Int32Array(v+1);for(let e=0;e<w;e++)U[T[e]+1]++,W[E[e]+1]++;for(let e=0;e<v;e++)U[e+1]+=U[e],W[e+1]+=W[e];let ue=new Int32Array(w),de=new Int32Array(w);{let e=U.slice(0,v),t=W.slice(0,v);for(let n=0;n<w;n++)ue[e[T[n]]++]=n,de[t[E[n]]++]=n}let G=new Int32Array(C+2);for(let e=0;e<v;e++)G[S[e]+1]++;for(let e=0;e<=C;e++)G[e+1]+=G[e];let K=new Int32Array(v),fe=new Int32Array(v);{let e=new Int32Array(v),t=G.slice(0,C+1);for(let n=0;n<v;n++)e[t[S[n]]++]=n;for(let e=0;e<=C;e++)t[e]=G[e];let n=new Uint8Array(v),r=[];for(let i=0;i<v;i++)if(!n[e[i]])for(r.push(e[i]);r.length>0;){let e=r.pop();if(!n[e]){n[e]=1,K[t[S[e]]++]=e;for(let t=U[e+1]-1;t>=U[e];t--){let e=E[ue[t]];n[e]||r.push(e)}}}}let pe=(e,t)=>{let n=G[e],r=G[e+1];if(r-n<2)return!1;for(let e=n;e<r;e++)if(Number.isNaN(t(K[e])))return!1;let i=Array.from(K.subarray(n,r)),a=new Map;return i.forEach((e,t)=>a.set(e,t)),i.sort((e,n)=>t(e)-t(n)||a.get(e)-a.get(n)),K.set(i,n),!0};for(let e=0;e<=C;e++)pe(e,e=>V[e]);let me=!1;for(let t=0;t<r;t++)e[t].pin!==0&&(me=!0);if(me)for(let t=0;t<=C;t++){let n=Array.from(K.subarray(G[t],G[t+1])),i=new Map;n.forEach((e,t)=>i.set(e,t));let a=t=>t<r?e[t].pin:0;n.sort((e,t)=>a(e)-a(t)||i.get(e)-i.get(t)),K.set(n,G[t])}let he=new Uint8Array(C+1),ge=t=>t<r&&(e[t].kind===3||e[t].kind===4)?e[t].hint:NaN;for(let e of[0,C])pe(e,ge)&&(he[e]=1);let _e=()=>{for(let e=0;e<=C;e++){let t=G[e];for(let n=t,r=G[e+1];n<r;n++)fe[K[n]]=n-t}};_e();let q={n:v,real:r,maxRank:C,W:y,KIND:x,RANK:S,EF:T,ET:E,EFD:D,ETD:O,succStart:U,succE:ue,predStart:W,predE:de,layerStart:G,order:K,pos:fe,offsets:H,fixed:he,GRP:le,groupParent:n.groups?.parent},ve=0,ye=0;if(w>0&&C>0&&([ve,ye]=oe(q,e),_e()),n.orderOnly){let a=se(q,n);for(let t=0;t<r;t++)e[t].x=a[t];for(let e=0;e<i;e++){let n=t[e],r=n.reversed?n.head:n.tail,i=n.reversed?n.tail:n.head,o=[S[r],a[r]];if(!_[e]&&k[e]>=0)for(let t=k[e],n=t+s[e]-1;t<n;t++)o.push(S[t],a[t]);o.push(S[i],a[i]),n.points=o}return{width:0,height:0,crossings:ve,declared:ye}}I&&R&&F(q,e,I,R);let J=se(q,n),Y=re(q);if(I&&R){let r=L(q,I,R);ee(q,e,J,r,n,Y),te(q,e,J,I,R,r,Y),ne(q,J,Y,n);for(let e=0;e<i;e++){if(_[e])continue;let n=t[e],r=D[B[e]],i=O[ce[e]];n.tailDx=n.reversed?i:r,n.headDx=n.reversed?r:i}}let be=new Uint8Array(v);Y&&!n.tracks&&ie(q,J,Y,k,s,n.apart?0:n.edgeSep,be),n.tracks||ae(q,J,k,s,n.edgeSep,be);let xe=new Int32Array(i+1),X=n.tracks||I&&!n.straight?{from:[],to:[],rank:[],lower:[],track:[],levels:[],wide:[]}:void 0,Se=new Int32Array(C+1);if(X){for(let e=0;e<i;e++){if(xe[e]=X.from.length,_[e])continue;let t=k[e],r=!1;for(let i=t,a=t<0?t:t+s[e]-1;i<a;i++){let e=Y!==void 0&&Y[S[i]]===1;!n.tracks&&e!==(be[i]===1)&&(r=!0)}if(r)continue;let i=J[T[B[e]]]+D[B[e]],a=S[T[B[e]]];for(let n=t,r=t<0?t:t+s[e]-1;n<r;n++)Y&&Y[S[n]]||(X.from.push(i),X.to.push(J[n]),X.rank.push(a),X.lower.push(n),i=J[n],a=S[n]);X.from.push(i),X.to.push(J[E[ce[e]]]+O[ce[e]]),X.rank.push(a),X.lower.push(-1)}xe[i]=X.from.length}let Ce=(e,t)=>{let n=!1;for(let r=G[e];r<G[e+1];r++){let e=x[K[r]];if(e===t)n=!0;else if(e!==1)return!1}return n},we=Ce(0,3)?a:0,Te=Ce(C,4)?a:0,Ee=new Float64Array(C+1);for(let e=0;e<w;e++){let t=Math.abs(J[T[e]]+D[e]-J[E[e]]-O[e]);t>Ee[S[T[e]]]&&(Ee[S[T[e]]]=t)}let Z=new Float64Array(C+1),Q=new Float64Array(C+1),De=e=>(e<we||e>=C-Te?n.portSep:n.rankSep)/a,Oe=new Float64Array(C+1);for(let e=0;e<C;e++)Oe[e]=X?De(e):Math.max(De(e),Math.min(u*n.rankSep/a,Ee[e]*l));let ke=new Uint8Array(C+1).fill(1);for(let e=0;e<r;e++)ke[S[e]]=0;for(let e=1;e<C;e++){if(n.tracks||!ke[e]||A[e]!==1&&A[e]!==2)continue;let t=Math.min((n.headRoom??0)/2,Oe[A[e]===1?e-1:e]/2);Oe[e-1]+=A[e]===1?-t:t,Oe[e]+=A[e]===1?t:-t}let Ae=e=>x[e]===1&&ke[S[e]]&&!n.tracks?(Q[S[e]]-Z[S[e]])/4:0,je=n.tracks?d:h,Me=n.tracks?f:g,Ne=n.tracks?p:g,Pe=new Int32Array(C+1);if(X){let e=new Float64Array(C+1);for(let t=0;t<C;t++){if(Y&&Y[t])continue;let n=t+1;for(e[t]=Oe[t];n<C&&Y&&Y[n];)e[t]+=Oe[n++];Pe[t]=n}for(let t=0;t<X.from.length;t++)X.wide.push(+(Math.abs(X.from[t]-X.to[t])>m*e[X.rank[t]]));let t=new Float64Array(C+1);z(X,Se,!n.tracks,e,t);for(let r=0;r<C;r++)Se[r]>0?Oe[r]+=Math.max(0,2*je+(Se[r]-1)*Me-e[r]):t[r]>0&&(Oe[r]+=Math.max(0,Math.min(u*n.rankSep,t[r])-e[r]))}let Fe=0;for(let e=0;e<=C;e++){let t=0;for(let n=G[e];n<G[e+1];n++)b[K[n]]>t&&(t=b[K[n]]);Z[e]=Fe,Q[e]=Fe+t,Fe+=t+Oe[e]}let Ie=Fe,Le=(e,t=X.track[e])=>{let r=X.rank[e],i=Q[r],a=Z[Pe[r]],o=n.tracks?Se[r]:X.levels[e],s=o>1?Math.min(Ne,(a-i-2*je)/(o-1)):0;return(i+a)/2+(t-(o-1)/2)*s},$=1/0,Re=-1/0;for(let e=0;e<v;e++){let t=y[e]/2;J[e]-t<$&&($=J[e]-t),J[e]+t>Re&&(Re=J[e]+t)}let ze=new Uint8Array(C+1),Be=new Uint8Array(C+1);for(let e=0;e<r;e++)x[e]!==0||!I||(W[e+1]>W[e]&&(ze[S[e]]=1),U[e+1]>U[e]&&(Be[S[e]]=1));for(let t=0;t<r;t++){let n=e[t],r=n.rank;n.x=J[t]-$,n.y=x[t]===0&&Be[r]&&!ze[r]?Q[r]-n.h/2:x[t]===0&&ze[r]&&!Be[r]?Z[r]+n.h/2:(Z[r]+Q[r])/2}for(let r=0;r<i;r++){let i=t[r],a=e[i.reversed?i.head:i.tail],o=e[i.reversed?i.tail:i.head],c=[a.x+(i.reversed?i.headDx:i.tailDx),a.y+a.h/2],l=k[r];if(X&&xe[r+1]>xe[r])for(let e=xe[r];e<xe[r+1];e++){if(X.track[e]>=0&&(n.tracks||X.wide[e]===1)){let t=Le(e);c.push(X.from[e]-$,t,X.to[e]-$,t)}else X.track[e]>0&&c.push(X.from[e]-$,Le(e,X.track[e]-1));let t=X.lower[e];t<0||(c.push(J[t]-$,Z[S[t]]+Ae(t)),Q[S[t]]>Z[S[t]]&&c.push(J[t]-$,Q[S[t]]-Ae(t)))}else if(l>=0)for(let e=l,t=l+s[r]-1;e<t;e++){if(be[e])continue;let t=J[e]-$,n=Z[S[e]],r=Q[S[e]];c.push(t,n+Ae(e)),r>n&&c.push(t,r-Ae(e))}if(c.push(o.x+(i.reversed?i.tailDx:i.headDx),o.y-o.h/2),i.reversed)for(let e=0,t=c.length-2;e<t;e+=2,t-=2){let n=c[e],r=c[e+1];c[e]=c[t],c[e+1]=c[t+1],c[t]=n,c[t+1]=r}i.points=c;let u=j[r];u>=0?(i.labelX=J[u]-$,i.labelY=(Z[S[u]]+Q[S[u]])/2):i.labelW>0&&(i.labelX=(c[0]+c[c.length-2])/2,i.labelY=(c[1]+c[c.length-1])/2)}return{width:Re-$,height:Ie}}function M(e,t){let n=e.length,r=t.length,i=new Int32Array(n+1);for(let n=0;n<r;n++){let r=t[n];r.reversed=e[r.head].kind===3||e[r.tail].kind===4,r.reversed||i[r.tail+1]++}for(let e=0;e<n;e++)i[e+1]+=i[e];let a=new Int32Array(i[n]);{let e=i.slice(0,n);for(let n=0;n<r;n++)t[n].reversed||(a[e[t[n].tail]++]=n)}let o=new Uint8Array(n),s=i.slice(0,n),c=[];for(let e=0;e<n;e++)if(o[e]===0)for(c.push(e),o[e]=1;c.length>0;){let e=c[c.length-1];if(s[e]<i[e+1]){let n=t[a[s[e]++]],r=n.head;o[r]===1?n.reversed=!0:o[r]===0&&(o[r]=1,c.push(r))}else o[e]=2,c.pop()}}function N(e,t,n){let r=e.length,i=t.length,a=new Int32Array(i),o=new Int32Array(i),s=new Int32Array(i),c=new Int32Array(r+1),l=new Int32Array(r+1);for(let e=0;e<i;e++){let r=t[e],i=r.reversed?r.head:r.tail,u=r.reversed?r.tail:r.head;a[e]=i,o[e]=u,s[e]=Math.max(1,r.minlen)*n,c[i+1]++,l[u+1]++}for(let e=0;e<r;e++)c[e+1]+=c[e],l[e+1]+=l[e];let u=new Int32Array(i),d=new Int32Array(i);{let e=c.slice(0,r),t=l.slice(0,r);for(let n=0;n<i;n++)u[e[a[n]]++]=n,d[t[o[n]]++]=n}let f=new Int32Array(r),p=new Int32Array(r);for(let e=0;e<r;e++)p[e]=l[e+1]-l[e];let m=new Int32Array(r),h=0;for(let e=0;e<r;e++)p[e]===0&&(m[h++]=e);for(let e=0;e<h;e++){let t=m[e];for(let e=c[t];e<c[t+1];e++){let n=u[e],r=o[n];f[t]+s[n]>f[r]&&(f[r]=f[t]+s[n]),--p[r]===0&&(m[h++]=r)}}for(let e=0;e<8;e++){let e=!1;for(let t=h-1;t>=0;t--){let n=m[t],r=l[n+1]-l[n],i=c[n+1]-c[n];if(r===0&&i===0)continue;let p=-1/0,h=1/0;for(let e=l[n];e<l[n+1];e++){let t=d[e];p=Math.max(p,f[a[t]]+s[t])}for(let e=c[n];e<c[n+1];e++){let t=u[e];h=Math.min(h,f[o[t]]-s[t])}let g=f[n];i>r&&h!==1/0?g=h:r>i&&p!==-1/0&&(g=p),g!==f[n]&&(f[n]=g,e=!0)}if(!e)break}let g=1/0,_=-1/0,v=!1;for(let t=0;t<r;t++){let n=e[t].kind;n===3&&(v=!0),n!==3&&n!==4&&(f[t]<g&&(g=f[t]),f[t]>_&&(_=f[t]))}g===1/0&&(g=0,_=0);for(let t=0;t<r;t++)e[t].kind===3?f[t]=g-n:e[t].kind===4&&(f[t]=_+n);v&&(g-=n);for(let t=0;t<r;t++)e[t].rank=f[t]-g}function P(e,t,n,r,i,a,o){let l=n===0?e.predStart:e.succStart,u=n===0?e.predE:e.succE,d=n===0?e.EF:e.ET,f=e.pos;for(let e=l[t];e<l[t+1];e++)i[u[e]]!==0&&a.push(u[e]);if(a.length<2)return 0;a.sort((e,t)=>f[d[e]]-f[d[t]]||e-t);let p=e=>{let t=0;o[0]=0;for(let n=1;n<a.length;n++){let r=i[a[n]]===i[a[n-1]];o[n]=e(r&&i[a[n]]===1,r),t+=o[n]}return t},m=p(()=>1);if(r/m<c&&(m=p(e=>e?.5:1)),r/m<c&&(m=p((e,t)=>+!t)),m===0)return 0;let h=Math.min(s,r/m);for(let e=1;e<a.length;e++)o[e]*=h;return m*h}function F(e,t,n,r){let{real:i,W:a,EFD:o,ETD:s}=e;for(let c=0;c<i;c++){let i=Math.min(t[c].span,a[c]);if(!(i<=0||t[c].kind!==0))for(let t=0;t<2;t++){let a=[],l=[],u=P(e,c,t,i,t===0?r:n,a,l);if(u===0)continue;let d=t===0?s:o,f=-u/2;for(let e=0;e<a.length;e++)f+=l[e],d[a[e]]=f}}}function I(e,t,n,r){if(!t)return n;let{KIND:i,RANK:a,EF:o,ET:s,succStart:c,succE:l,predStart:u,predE:d}=e;for(let e=0;e<1e5;e++){let e=r===0?o[n]:s[n];if(i[e]!==1||!t[a[e]])break;n=r===0?d[u[e]]:l[c[e]]}return n}function L(e,t,n){let r=[new Int32Array(e.n),new Int32Array(e.n)];for(let i=0;i<e.EF.length;i++)n[i]!==0&&r[0][e.ET[i]]++,t[i]!==0&&r[1][e.EF[i]]++;return r}function R(e,t){return Math.max(.25,Math.min(.5,4*Math.abs(t)/(Math.abs(e)||1)))}function ee(e,t,n,r,i,a){let o=i.edgeSep,{n:s,real:c,maxRank:l,KIND:u,RANK:d,W:f,EF:p,ET:m,EFD:h,ETD:g,succStart:_,succE:v,predStart:y,predE:b,layerStart:x,order:S,pos:C}=e,w=e=>u[e]===2||u[e]===1&&(a===void 0||a[d[e]]!==1),T=(e,i)=>{let a=i===0?p[e]:m[e];return[i===0?n[a]+h[e]:n[a]+g[e],a<c&&t[a].kind===0?r[1-i][a]:0]},E=e=>{let t=x[d[e]],r=t+C[e],a=t=>f[t]/2+f[e]/2+(u[t]===0?i.nodeSep/2+o/2:u[t]===u[e]?o:o/2);return[r>t?n[S[r-1]]+a(S[r-1]):-1/0,r+1<x[d[e]+1]?n[S[r+1]]-a(S[r+1]):1/0]},D=(e,t,n,r,i)=>{let a=(t[1]===n[1]?Math.abs(t[0]-e)<=Math.abs(n[0]-e):t[1]<n[1])?[t[0],n[0]]:[n[0],t[0]];return a.find(e=>e>=r&&e<=i)??Math.max(r,Math.min(i,a[0]))},k=new Uint8Array(s),A=[];for(let t=1;t<l;t++)for(let r=x[t];r<x[t+1];r++){if(!w(S[r])||k[S[r]])continue;let t=S[r];for(;O(u[p[b[y[t]]]]);)t=p[b[y[t]]];let i=t,o=-1/0,s=1/0;A.length=0;for(let e=t;O(u[e]);e=m[v[_[e]]]){if(i=e,!w(e))continue;k[e]=1,A.push(e);let[t,n]=E(e);t>o&&(o=t),n<s&&(s=n)}if(o<=s){let e=D(n[A[0]],T(b[y[t]],0),T(v[_[i]],1),o,s);for(let t of A)n[t]=e}else for(let t of A){let[r,i]=E(t);r>i||(n[t]=D(n[t],T(I(e,a,b[y[t]],0),0),T(I(e,a,v[_[t]],1),1),r,i))}}}function te(e,t,n,r,i,a,o){let{real:c,W:l,EF:u,ET:d,EFD:f,ETD:p,succStart:m,succE:h,predStart:g,predE:_,pos:v}=e,y=(s,m,h,g,_)=>{if(a[m][h]<2)return 0;s=I(e,o,s,m);let v=m===0?u[s]:d[s],y=m===0?n[v]+f[s]:n[v]+p[s];if(_&&Math.abs(y-n[h])<=g/2+x)return Math.max(-g/2,Math.min(g/2,y-n[h]));let b=y,S=0;v<c&&t[v].kind===0&&(m===0?r:i)[s]!==0&&a[1-m][v]>=2&&(S=Math.max(0,Math.min(t[v].span,l[v])),S>0&&(b=n[v]));let w=Math.max(n[h]-g/2,b-S/2),T=Math.min(n[h]+g/2,b+S/2);if(w>T+x){let e=Math.max(0,g/2-C);return Math.max(-e,Math.min(e,y-n[h]))}let E=(n[h]*S+b*g)/(S+g);return Math.max(w,Math.min(T,E))-n[h]},b=[];for(let n=0;n<c;n++){let a=Math.min(t[n].span,l[n]);if(!(a<=0||t[n].kind!==0))for(let t=0;t<2;t++){let o=t===0?u:d,s=t===0?g:m,c=t===0?_:h,l=[],f=[];if(P(e,n,t,a,t===0?i:r,l,f),l.length===0)continue;l.length===1&&(f[0]=0);let p=[];for(let e=s[n];e<s[n+1];e++)p.push(c[e]);p.sort((e,t)=>v[o[e]]-v[o[t]]||e-t),b.push({v:n,side:t,span:a,ids:l,room:f,all:p})}}for(let e=0,t=!0;t&&e<6;e++){t=!1;for(let{v:n,side:a,span:o,ids:c,room:l,all:u}of b){let d=a===0?i:r,m=a===0?p:f,h=0,g=-o/2;for(let r=0;r<=u.length;r++){let i=r<u.length&&d[u[r]]===0;if(r<u.length&&!i)continue;let f=0;for(let e=r-1;e>=0&&d[u[e]]!==0;e--)f++;let p=i?m[u[r]]-s:o/2;if(f>0){let r=[],i=[],s=0;for(let t=0;t<f;t++){t>0&&(s+=l[h+t]),r.push(y(c[h+t],a,n,o,e>0)-s),i.push(1);let u=t>0&&l[h+t]===0;for(;r.length>1&&(u||r[r.length-2]/i[i.length-2]>r[r.length-1]/i[i.length-1]);){u=!1;let e=r.pop(),t=i.pop();r[r.length-1]+=e,i[i.length-1]+=t}}let u=s,d=0;s=0;for(let e=0;e<r.length;e++){let n=p-u<g?(g+p-u)/2:Math.max(g,Math.min(p-u,r[e]/i[e]));for(let r=0;r<i[e];r++,d++)d>0&&(s+=l[h+d]),Math.abs(m[c[h+d]]-n-s)>.01&&(t=!0),m[c[h+d]]=n+s}h+=f}i&&(g=m[u[r]]+s)}}}}function ne(e,t,n,r){let{n:i,KIND:a,RANK:o,EF:s,ET:c,EFD:l,ETD:u,layerStart:d,order:f,pos:p}=e,m=e=>n!==void 0&&a[e]===1&&n[o[e]]===1,h=[],g=[],_=[],v=[];for(let t=0;t<s.length;t++){if(m(s[t]))continue;let r=I(e,n,t,1);h.push(s[t]),g.push(c[r]),_.push(l[t]),v.push(u[r])}let y=e=>t[g[e]]+v[e]-t[h[e]]-_[e],b=new Int32Array(i),x=[];for(let e=0;e<i;e++)b[e]=e,x.push([e]);let C=(e,t)=>{let n=b[e],r=b[t];if(n!==r){x[n].length<x[r].length&&([n,r]=[r,n]);for(let e of x[r])b[e]=n,x[n].push(e);x[r]=[]}},w=[];for(let e=0;e<h.length;e++){let t=Math.abs(y(e));t<.01?C(h[e],g[e]):t<=S&&w.push(e)}if(w.length===0)return;w.sort((e,t)=>Math.abs(y(e))-Math.abs(y(t))||e-t);let T=t=>B(e,r,t),E=(e,n)=>{for(let r of x[e]){let i=d[o[r]],a=d[o[r]+1],s=i+p[r];if(s>i&&b[f[s-1]]!==e&&t[r]+n-t[f[s-1]]<T(r)+T(f[s-1])-.01||s+1<a&&b[f[s+1]]!==e&&t[f[s+1]]-t[r]-n<T(r)+T(f[s+1])-.01)return!1}return!0};for(let e of w){let n=y(e);if(Math.abs(n)<.01){C(h[e],g[e]);continue}if(Math.abs(n)>S||b[h[e]]===b[g[e]])continue;let r=b[h[e]],i=b[g[e]],a=x[r].length<=x[i].length?r:i;for(let o of[a,a===r?i:r]){let i=o===r?n:-n;if(E(o,i)){for(let e of x[o])t[e]+=i;C(h[e],g[e]);break}}}}function re(e){let{maxRank:t,KIND:n,layerStart:r,order:i}=e,a=new Uint8Array(t+1),o=!1;for(let e=1;e<t;e++){let t=r[e+1]>r[e];for(let a=r[e];t&&a<r[e+1];a++)n[i[a]]!==1&&(t=!1);t&&(a[e]=1,o=!0)}return o?a:void 0}function z(e,t,n,r,i){let{from:a,to:o,rank:s,track:c,levels:l,wide:u}=e,d=a.length,f=new Map;for(let e=0;e<d;e++){if(c.push(-1),l.push(0),Math.abs(a[e]-o[e])<x)continue;let t=f.get(s[e]);t?t.push(e):f.set(s[e],[e])}if(f.size===0)return;let p=new Float64Array(d),m=new Float64Array(d);for(let e=0;e<d;e++)p[e]=Math.min(a[e],o[e]),m[e]=Math.max(a[e],o[e]);let h=(e,t)=>+(e>=p[t]-x&&e<=m[t]+x),g=(e,t)=>Math.abs(a[e]-a[t])<x||Math.abs(o[e]-o[t])<x,S=(e,t)=>p[e]<m[t]-x&&p[t]<m[e]-x,C=(e,t)=>S(e,t)&&!g(e,t),O=(e,t)=>S(e,t)||h(o[e],t)+h(a[t],e)+h(o[t],e)+h(a[e],t)>0,k=(e,t)=>h(o[e],t)+h(a[t],e),A=e=>{let t=e.map((e,t)=>t).sort((t,n)=>p[e[t]]-p[e[n]]),n=[];for(let r=0;r<t.length;r++){let i=t[r],a=m[e[i]]+4*x;for(let o=r+1;o<t.length&&p[e[t[o]]]<=a;o++){let e=t[o];n.push(Math.min(i,e),Math.max(i,e))}}return n},j=e=>{e.sort((e,t)=>m[t]-p[t]-(m[e]-p[e])||p[e]-p[t]||e-t);let t=e.length,r=[],i=e.map((e,t)=>t),a=e=>{for(;i[e]!==e;)e=i[e]=i[i[e]];return e},o=t<=w,s=o?A(e):[],u=o?e.map(()=>[]):[];for(let t=0;t<s.length;t+=2){let n=s[t],r=s[t+1];C(e[n],e[r])&&(u[n].push(r),u[r].push(n))}let d=e.map((e,t)=>t);if(o){let n=new Int32Array(t),o=[];for(let e=0;e<t;e++)r.push([]),o.push([]);for(let t=0;t<s.length;t+=2){let c=s[t],l=s[t+1],u=e[c],d=e[l];if(!O(u,d))continue;i[a(c)]=a(l);let f=k(u,d),p=k(d,u);if(f===p)continue;let m=f<p?c:l,h=f<p?l:c;r[h].push(m),o[m].push(h),n[h]++}let c=new Uint8Array(t);d=[];for(let e=0;e<t;e++){let e=-1;for(let r=0;r<t&&!(!c[r]&&((e<0||n[r]<n[e])&&(e=r),n[r]===0));r++);c[e]=1,d.push(e);for(let t of o[e])n[t]--}}let f=new Set,h=[],g=0;for(let t of d){let n=e[t],i=0;for(let n of r[t]??[])c[e[n]]>=i&&(i=c[e[n]]+1);if(o){f.clear();for(let n of u[t])f.add(c[e[n]]);for(;f.has(i);)i++}else{for(;h[i]?.some(e=>C(n,e));)i++;(h[i]??=[]).push(n)}c[n]=i,i>=g&&(g=i+1)}let _=new Int32Array(t).fill(g),v=new Int32Array(t).fill(-1);for(let n=0;n<t;n++){let t=a(n);_[t]=Math.min(_[t],c[e[n]]),v[t]=Math.max(v[t],c[e[n]])}for(let r=0;r<t;r++){let t=a(r);l[e[r]]=v[t]-_[t]+1,n&&(c[e[r]]-=_[t])}return g},M=(e,t,n)=>{let r=R(o[e]-a[e],t);for(let i=0;i<=T;i++){let s=i/T,c=1-s;n[2*i]=a[e]+(o[e]-a[e])*s*s*(3-2*s),n[2*i+1]=t*(3*r*s*c*c+3*(1-r)*s*s*c+s*s*s)}},N=(e,t,n)=>{let r=n*n*1.000000001;for(let i=0;i<=T;i++){let a=e[2*i],o=e[2*i+1];for(let e=0;e<T;e++){let i=t[2*e+2]-t[2*e],s=t[2*e+3]-t[2*e+1],c=Math.max(0,Math.min(1,((a-t[2*e])*i+(o-t[2*e+1])*s)/(i*i+s*s||1))),l=a-t[2*e]-c*i,u=o-t[2*e+1]-c*s;if(l*l+u*u<r&&Math.hypot(l,u)<n)return!0}}return!1},P=(e,t,n,r)=>{let i=Math.max(n/2,n-2*_);return M(e,i,E),M(t,i,D),N(E,D,r)||N(D,E,r)};for(let[e,s]of f){if(!n){t[e]=j(s);continue}if(s.length>w)continue;let d=s.filter(e=>u[e]===1);j(d);let f=new Set(d.filter(e=>l[e]>1)),h=A(s);for(let t=0;t<h.length;t+=2){let n=s[h[t]],i=s[h[t+1]];f.has(n)&&f.has(i)||!C(n,i)||a[n]<o[n]!=a[i]<o[i]||P(n,i,r[e],u[n]===1||u[i]===1?v:y)&&f.add(n).add(i)}for(let e of d)c[e]=-1,l[e]=0;if(f.size===0)continue;let _=0,x=0,T=new Set;for(let e=0;e<h.length;e+=2){let t=s[h[e]],n=s[h[e+1]];if(f.has(t)&&f.has(n)){if(!S(t,n))continue;a[t]<o[t]==a[n]<o[n]?g(t,n)||x++:_++}else(f.has(t)||f.has(n))&&O(t,n)&&T.add(t).add(n)}if(_>x){for(let t of s)(m[t]-p[t])*b>i[e]&&(i[e]=(m[t]-p[t])*b);continue}let E=s.filter(e=>f.has(e)||u[e]!==1&&T.has(e));j(E);let D=0;for(let e of E)l[e]>D&&(D=l[e]);t[e]=D}}function ie(e,t,n,r,i,a,o){let{maxRank:s,EF:c,ET:l,EFD:u,ETD:d,succStart:f,succE:p,predStart:m,predE:h,layerStart:g,order:_}=e,v=new Float64Array(t.length),y=new Float64Array(t.length),b=new Float64Array(t.length);for(let a=0;a<r.length;a++){let o=r[a];if(o<0)continue;let s=o+i[a]-1,g=e.RANK[o];for(let e=o;e<s;e++){if(!n[g+e-o])continue;let r=e;for(;r+1<s&&n[g+r+1-o];)r++;let i=h[m[e]],a=p[f[r]],_=t[c[i]]+u[i],x=t[l[a]]+d[a],S=r-e+2;for(let t=e;t<=r;t++)v[t]=_+(x-_)*(t-e+1)/S,y[t]=_,b[t]=x;e=r}}let x=[];for(let r=1;r<s;r++){if(!n[r])continue;let i=g[r],s=g[r+1],c=Array.from(_.subarray(i,s)).sort((e,t)=>y[e]-y[t]||b[e]-b[t]||e-t);for(let n=0;n<c.length;){x.length=0;let r=n;for(;r<c.length&&Math.abs(y[c[r]]-y[c[n]])<1&&Math.abs(b[c[r]]-b[c[n]])<1;r++)x.push(c[r]);x.sort((t,n)=>e.pos[t]-e.pos[n]);for(let e=0;e<x.length;e++){let n=x[e];t[n]=v[n]+(e-(x.length-1)/2)*a,(x.length===1||a===0)&&(o[n]=1)}n=r}}}function ae(e,t,n,r,i,a){let{maxRank:o,W:s,KIND:c,RANK:l,EF:u,ET:d,EFD:f,ETD:p,succStart:m,succE:h,predStart:g,predE:_,layerStart:v,order:y}=e,b=new Uint8Array(o+1),x=!1;for(let e=1;e<o;e++){let t=!1,n=!1;for(let r=v[e];r<v[e+1];r++){let e=c[y[r]];e===2?t=!0:e!==1&&(n=!0)}t&&!n&&(b[e]=1,x=!0)}if(x)for(let e=0;e<n.length;e++){let o=n[e];if(!(o<0))for(let n=o,x=o+r[e]-1;n<x;n++){if(c[n]!==1||!b[l[n]])continue;let e=n,r=n;for(;e>o&&a[e-1];)e--;for(;r+1<x&&a[r+1];)r++;let S=_[g[e]],C=h[m[r]],w=t[u[S]]+f[S],T=t[d[C]]+p[C],E=Math.min(w,T)-i,D=Math.max(w,T)+i,O=!0,k=l[n];for(let e=v[k];O&&e<v[k+1];e++){let n=y[e];c[n]===2&&t[n]+s[n]/2>E&&t[n]-s[n]/2<D&&(O=!1)}if(!O)continue;a[n]=1;let A=r-e+2;for(let n=e;n<=r;n++)t[n]=w+(T-w)*(n-e+1)/A}}}function oe(e,t){let{n,real:r,maxRank:i,W:o,EF:s,ET:c,EFD:l,ETD:u,succStart:d,succE:f,predStart:p,predE:m,layerStart:h,order:g,pos:_,offsets:v,fixed:y,GRP:b,groupParent:x}=e,S=0;for(let e=0;e<=i;e++)S=Math.max(S,h[e+1]-h[e]);if(S<2)return[0,0];let C=v?new Int32Array(s.length):void 0,w=new Int32Array(C?s.length:0),T=new Int32Array(C?n:0),E=C?f.slice():f,D=new Uint8Array(C?n:0);if(C){let e=m.slice(),t=(e,t,n,r)=>{for(let i=t+1;i<n;i++)if(r[e[i]]!==r[e[t]])return e.subarray(t,n).sort((e,t)=>r[e]-r[t]),!0;return!1};for(let r=0;r<n;r++){if(T[r]=1,t(e,p[r],p[r+1],u))for(let t=p[r]+1;t<p[r+1];t++)u[e[t]]!==u[e[t-1]]&&T[r]++,w[e[t]]=T[r]-1;t(E,d[r],d[r+1],l)&&(D[r]=1)}}let O=1;for(;O<(C?S+s.length:S);)O<<=1;let k=new Int32Array(2*O),j=new Int32Array(s.length),M=()=>{let e=0;for(let t=0;t<i;t++){let n=h[t+2]-h[t+1];if(C){let e=0;for(let n=h[t+1];n<h[t+2];n++){let t=g[n];for(let n=p[t];n<p[t+1];n++)C[m[n]]=e+w[m[n]];e+=T[t]}n=e}if(n<2)continue;let r=0;for(let e=h[t];e<h[t+1];e++){let t=g[e],n=d[t],i=d[t+1],a=r;for(let e=n;e<i;e++)j[r++]=C?C[E[e]]:_[c[f[e]]];let o=r-a;if(!(o<2)){if(C&&D[t])for(let e=a+1;e<r;e++){let t=j[e],r=l[E[n+e-a]],i=e-1;for(;i>=a&&l[E[n+i-a]]===r&&j[i]>t;)j[i+1]=j[i],i--;j[i+1]=t}else if(o<=12)for(let e=a+1;e<r;e++){let t=j[e],n=e-1;for(;n>=a&&j[n]>t;)j[n+1]=j[n],n--;j[n+1]=t}else j.subarray(a,r).sort()}}if(r<2)continue;let i=1;for(;i<n;)i<<=1;k.fill(0,0,2*i);for(let t=0;t<r;t++){let n=j[t]+i;for(k[n]++;n>1;)!(n&1)&&(e+=k[n+1]),n>>=1,k[n]++}}return e},N=M(),P=new Float64Array(n),F=new Int32Array(S),I=new Int32Array(S),L=x?x.length:0,R=new Int32Array(L);for(let e=0;e<L;e++)for(let t=e;t>=0;t=x[t])R[e]++;let ee=new Float64Array(L),te=new Int32Array(L),ne=new Int32Array(L),re=(e,t)=>{let r=h[e],i=h[e+1];for(let e=r;e<i;e++)for(let t=b[g[e]];t>=0;t=x[t])ee[t]=0,te[t]=0;for(let e=r;e<i;e++){let n=g[e];for(let r=b[n];r>=0;r=x[r])te[r]===0&&(ne[r]=e),ee[r]+=t[n],te[r]++}let a=e=>e>=n?ee[e-n]/te[e-n]:t[e],o=e=>e>=n?ne[e-n]:r+_[e],s=Array.from(g.subarray(r,i)).sort((e,t)=>{let r=e,i=t,s=b[e],c=b[t],l=s<0?0:R[s],u=c<0?0:R[c];for(;l>u;l--)r=n+s,s=x[s];for(;u>l;u--)i=n+c,c=x[c];for(;s!==c;)r=n+s,s=x[s],i=n+c,c=x[c];return a(r)-a(i)||o(r)-o(i)});g.set(s,r);for(let e=r;e<i;e++)_[g[e]]=e-r};if(b){let e=new Float64Array(n);for(let t=0;t<=i;t++){for(let n=h[t];n<h[t+1];n++)e[g[n]]=n-h[t];re(t,e)}}let z=b?M():N;if(z===0)return[0,N];let ie=g.slice(),ae=Math.min(z,N),oe=(e,n)=>{let a=e?p:d,x=e?m:f,S=e?s:c,C=e?l:u;for(let s=1;s<=i;s++){let c=e?s:i-s;if(y[c])continue;let l=h[c],u=h[c+1],d=0;for(let n=l;n<u;n++){let i=g[n],s=i<r?t[i].pin:0;if(s!==0){P[i]=s*1e9,F[d++]=i;continue}let f=a[i],p=a[i+1];if(f===p){if(b){let t=e?h[c]-h[c-1]:h[c+2]-h[c+1];P[i]=(n-l)*t/(u-l);continue}P[i]=-1;continue}let m=0;for(let e=f;e<p;e++){let t=S[x[e]];m+=_[t],v&&o[t]>0&&(m+=C[x[e]]/o[t])}P[i]=m/(p-f),F[d++]=i}if(b){re(c,P);continue}if(d<2)continue;A(F,d,P,_,n,I);let f=0;for(let e=l;e<u;e++)P[g[e]]!==-1&&(g[e]=F[f++]);for(let e=l;e<u;e++)_[g[e]]=e-l}},B=()=>{let e=0;for(let t=0;t<=i;t++)for(let n=h[t];n<h[t+1];n++)if(!(g[n]>=r))for(let r=n+1;r<h[t+1];r++)g[r]<g[n]&&e++;return e},se=()=>{for(let e=0;e<=i;e++)for(let t=h[e];t<h[e+1];t++)_[g[t]]=t-h[e]},ce=e=>e<r?t[e].pin:0,V=(e,t)=>{let n=t?s[e]:c[e];return v&&o[n]>0?_[n]+(t?l[e]:u[e])/o[n]:_[n]},H=(e,t)=>{let n=0;for(let r=p[e];r<p[e+1];r++){let e=V(m[r],!0);for(let r=p[t];r<p[t+1];r++)e>V(m[r],!0)&&n++}for(let r=d[e];r<d[e+1];r++){let e=V(f[r],!1);for(let r=d[t];r<d[t+1];r++)e>V(f[r],!1)&&n++}return n},le=()=>{for(let e=0;e<8;e++){let e=!1;for(let t=0;t<=i;t++){if(y[t])continue;let n=h[t];for(let r=n;r+1<h[t+1];r++){let t=g[r],i=g[r+1];ce(t)!==ce(i)||b&&b[t]!==b[i]||H(i,t)>=H(t,i)||(g[r]=i,g[r+1]=t,_[i]=r-n,_[t]=r+1-n,e=!0)}}if(!e)break}},U=g.slice(),W=n<=600,ue=ie,de=1/0;for(let e=0;e<(W?2:1);e++){e>0&&(g.set(U),se());let t=ae,n=U.slice();for(let r=0,i=0;i<4&&r<a;r++,i++){oe((r+e)%2==0,r%4>=2);let a=M();if(a<t&&(t=a,n.set(g),i=0,a===0))break}if(g.set(n),W&&t>0){se(),le();let e=M();e<t&&(t=e,n.set(g))}let r=W?B():0;(e===0||t<z||t===z&&r<de)&&(z=t,ue=n,de=r)}if(g.set(ue),se(),ie.set(ue),b&&(z=M()),!W)return[z,N];for(let e=0;e<r;e++)if(t[e].pin!==0)return[z,N];if(de===0||y[0]||y[i])return[z,N];for(let e=0;e<=i;e++)g.subarray(h[e],h[e+1]).reverse();return se(),(M()>z||B()>=de)&&g.set(ie),[z,N]}function B(e,t,n){return e.W[n]/2+(e.KIND[n]===0?t.nodeSep:t.edgeSep)/2}function se(e,t){let{n,maxRank:r,W:i,KIND:a,EF:o,ET:s,EFD:c,ETD:l,succStart:u,succE:d,predStart:f,predE:p,layerStart:m,order:h,pos:g}=e,_=o.length,v=new Float64Array(n);for(let r=0;r<n;r++)v[r]=B(e,t,r);let y=new Int32Array(_);for(let e=0;e<_;e++)y[e]=g[s[e]];for(let e=0;e<n;e++)u[e+1]-u[e]>1&&k(d,u[e],u[e+1],y);for(let e=0;e<_;e++)y[e]=g[o[e]];for(let e=0;e<n;e++)f[e+1]-f[e]>1&&k(p,f[e],f[e+1],y);let b=new Uint8Array(_);for(let e=1;e<=r;e++){let t=m[e]-m[e-1],n=m[e],r=m[e+1],i=0,s=n;for(let e=n;e<r;e++){let n=h[e],c=-1;if(O(a[n])){let e=o[p[f[n]]];O(a[e])&&(c=e)}let l=c>=0?g[c]:t;if(c>=0||e===r-1){for(let t=s;t<=e;t++){let e=h[t],n=O(a[e]);for(let t=f[e];t<f[e+1];t++){let e=p[t],r=g[o[e]];(r<i||l<r)&&!(n&&O(a[o[e]]))&&(b[e]=1)}}s=e+1,i=l}}}let x=[],S=new Int32Array(n),C=new Int32Array(n),w=new Float64Array(n),T=new Int32Array(n),E=new Int32Array(n),D=new Float64Array(n),A=new Int32Array(n),j=new Int32Array(n+1),M=new Int32Array(n),N=new Int32Array(n),P=new Int32Array(n),F=new Float64Array(n);for(let e=0;e<4;e++){let t=e<2,i=(e&1)==1,a=t?f:u,_=t?p:d,y=t?o:s,O=t?l:c,k=t?c:l;for(let e=0;e<n;e++)S[e]=e,C[e]=e,w[e]=0,A[e]=0,j[e+1]=0,F[e]=0;for(let e=0;e<=r;e++){let n=t?e:r-e,o=m[n],s=m[n+1],c=t?n-1:n+1,l=c>=0&&c<=r?m[c+1]-m[c]-1:0,u=-1;for(let e=i?s-1:o;i?e>=o:e<s;i?e--:e++){let t=h[e],n=a[t],r=a[t+1]-n;if(r===0)continue;let o=n+(r-1>>1),s=n+(r>>1);for(let e=0;e<2&&(e!==1||o!==s);e++){let n=_[e===0===i?s:o],r=y[n],a=i?l-g[r]:g[r];C[t]===t&&u<a&&b[n]===0&&(C[r]=t,C[t]=S[t]=S[r],w[t]=w[r]+k[n]-O[n],u=a)}}}let I=0;for(let e=0;e<=r;e++){let t=m[e],n=m[e+1];for(let e=t+1;e<n;e++){let t=i?h[e]:h[e-1],n=i?h[e-1]:h[e],r=v[t]+v[n];T[I]=S[t],E[I]=S[n],D[I]=i?r-w[t]+w[n]:r+w[t]-w[n],A[S[n]]++,j[S[t]+1]++,I++}}for(let e=0;e<n;e++)j[e+1]+=j[e];for(let e=0;e<n;e++)N[e]=j[e];for(let e=0;e<I;e++)M[N[T[e]]++]=e;let L=0;for(let e=0;e<n;e++)S[e]===e&&A[e]===0&&(P[L++]=e);for(let e=0;e<L;e++){let t=P[e];for(let e=j[t];e<j[t+1];e++){let n=M[e],r=E[n];F[t]+D[n]>F[r]&&(F[r]=F[t]+D[n]),--A[r]===0&&(P[L++]=r)}}for(let e=L-1;e>=0;e--){let t=P[e],n=1/0;for(let e=j[t];e<j[t+1];e++){let t=M[e],r=F[E[t]]-D[t];r<n&&(n=r)}n!==1/0&&n>F[t]&&(F[t]=n)}let R=new Float64Array(n);for(let e=0;e<n;e++)R[e]=(i?-F[S[e]]:F[S[e]])+w[e];x.push(R)}let I=0,L=1/0,R=[],ee=[];for(let e=0;e<4;e++){let t=1/0,r=-1/0,a=x[e];for(let e=0;e<n;e++){let n=i[e]/2;a[e]-n<t&&(t=a[e]-n),a[e]+n>r&&(r=a[e]+n)}R.push(t),ee.push(r),r-t<L&&(L=r-t,I=e)}for(let e=0;e<4;e++){let t=e&1?ee[I]-ee[e]:R[I]-R[e];if(t!==0){let r=x[e];for(let e=0;e<n;e++)r[e]+=t}}let te=new Float64Array(n);for(let e=0;e<n;e++){let t=x[0][e],n=x[1][e],r=x[2][e],i=x[3][e],a;t>n&&(a=t,t=n,n=a),r>i&&(a=r,r=i,i=a),t>r&&(a=t,t=r,r=a),n>i&&(a=n,n=i,i=a),n>r&&(a=n,n=r,r=a),te[e]=(n+r)/2}return te}var ce=12,V=.62,H=6;function le(){let e=new Map;return{add(t,n,r){let i=W(r);n>=0&&i>0&&i+H>(e.get(t*4+n)??0)&&e.set(t*4+n,i+H)},of:(t,n)=>n>=0?e.get(t*4+n)??0:0}}function U(e,t,r,i,a=r>0?r+H:0,o=i>0?i+H:0){let s=t===`linear`,c=t===`step`||t===`stepBefore`||t===`stepAfter`,l=[],u=[],d=[],f=(e,t,n,r)=>Math.abs(e-n)<.01&&Math.abs(t-r)<.01;for(let n=0;n<e.length;n+=3){let r=e[n],i=e[n+1],a=e[n+2],o=l.length-1;if(c&&o>=0&&Math.abs(r-l[o])>=.01&&Math.abs(i-u[o])>=.01){let e=l[o],n=u[o],s=t===`stepBefore`?n:t===`stepAfter`?i:(n+i)/2,c=t===`stepBefore`?e:t===`stepAfter`?r:(e+r)/2,p=a===0?[e,s,r,s]:[c,n,c,i];for(let t=0;t<4;t+=2)f(p[t],p[t+1],e,n)||f(p[t],p[t+1],r,i)||(l.push(p[t]),u.push(p[t+1]),d.push(a))}l.push(r),u.push(i),d.push(a)}let p=l.length-1,m=e=>Math.abs(l[e]-l[e-1])<.01||Math.abs(u[e]-u[e-1])<.01,h=e=>s||m(e),g=(e,t,n)=>{if(!h(Math.max(e,t)))return n===0?[0,Math.sign(u[t]-u[e])||1]:[Math.sign(l[t]-l[e])||1,0];let r=l[t]-l[e],i=u[t]-u[e],a=Math.hypot(r,i)||1;return[r/a,i/a]},[_,v]=g(0,1,d[1]),[y,b]=g(p-1,p,d[p]),x=l[0],S=u[0],C=l[p],w=u[p];l[0]+=_*r,u[0]+=v*r,l[p]-=y*i,u[p]-=b*i;let T=e=>Math.abs(l[e]-l[e-1])+Math.abs(u[e]-u[e-1]),E=e=>!s&&e>0&&e<p&&m(e)&&m(e+1)&&T(e)>=.01&&T(e+1)>=.01&&Math.abs(l[e]-l[e-1])<.01!=Math.abs(l[e+1]-l[e])<.01,D=(e,t,n)=>Math.abs(l[e]-l[e-1])*Math.abs(t)+Math.abs(u[e]-u[e-1])*Math.abs(n),O=(e,t,n)=>{let r=Math.min(Math.max(0,e-H-t),n/4);return r+Math.min(e-t-r,(n-r)/4)},k=o>i&&(!h(p)||E(p-1))?O(o,i,D(p,y,b)):0,A=a>r&&(!h(1)||E(1))?O(a,r,D(1,_,v)):0;k>=1&&(l.splice(p,0,l[p]-y*k),u.splice(p,0,u[p]-b*k),d.splice(p,0,d[p]),p++),A>=1&&(l.splice(1,0,l[0]+_*A),u.splice(1,0,u[0]+v*A),d.splice(1,0,d[1]),p++);let j=`M${n(l[0])},${n(u[0])}`,M=l[0],N=u[0],P=(e,t)=>{f(e,t,M,N)||(j+=`L${n(e)},${n(t)}`,M=e,N=t)};for(let e=1;e<=p;e++){let t=l[e],r=u[e];if(!h(e)){let i=d[e]===0,a=i?r-N:t-M,o=Math.abs(a)*R(i?t-M:r-N,a),s=i?0:Math.sign(a)*o,c=i?Math.sign(a)*o:0;j+=`C${n(M+s)},${n(N+c)} ${n(t-s)},${n(r-c)} ${n(t)},${n(r)}`,M=t,N=r;continue}if(!E(e)){if(e<p&&m(e)&&m(e+1)&&(t-l[e-1])*(l[e+1]-t)+(r-u[e-1])*(u[e+1]-r)>0)continue;P(t,r);continue}let i=E(e-1)?T(e)/2:T(e),a=E(e+1)?T(e+1)/2:T(e+1);c&&(i=a=Math.min(ce,i,a));let[o,s]=g(e-1,e,d[e]),[f,_]=g(e,e+1,d[e+1]);P(t-o*i,r-s*i),M=t+f*a,N=r+_*a,j+=c?`Q${n(t)},${n(r)} ${n(M)},${n(N)}`:`C${n(t-o*i*(1-V))},${n(r-s*i*(1-V))} ${n(t+f*a*(1-V))},${n(r+_*a*(1-V))} ${n(M)},${n(N)}`}return{d:j,sx:x,sy:S,sdx:-_,sdy:-v,ex:C,ey:w,edx:y,edy:b}}function W(e){return e===`arrow_point`?7:e===`arrow_circle`?8:e===`arrow_cross`?4:0}function ue(e,t,r,i,a,o){let s=-a,c=i;if(e===`arrow_point`){let e=t-i*8,l=r-a*8,u=3.36;return`<path class="pele-marker" d="M${n(t)},${n(r)}L${n(e+s*u)},${n(l+c*u)}L${n(e-s*u)},${n(l-c*u)}Z" fill="${o}" stroke="none"/>`}if(e===`arrow_circle`)return`<circle class="pele-marker" cx="${n(t-i*4)}" cy="${n(r-a*4)}" r="3.5" fill="${o}" stroke="none"/>`;if(e===`arrow_cross`){let e=t-i*4,o=r-a*4,l=3.5,u=(i+s)*l,d=(a+c)*l,f=(i-s)*l,p=(a-c)*l;return`<path class="pele-marker" d="M${n(e-u)},${n(o-d)}L${n(e+u)},${n(o+d)}M${n(e-f)},${n(o-p)}L${n(e+f)},${n(o+p)}"/>`}return``}function de(r,i,a,o,s,c){let l=i.width+8,u=i.height;return`<g class="pele-edge-label" data-id="${e(r)}"><rect x="${n(a-l/2)}" y="${n(o-u/2)}" width="${n(l)}" height="${n(u)}" rx="3" fill="var(--_bg)"/>`+t(i,a,o,s,c)+`</g>`}function G(e,t,r,i,a,o,s,c){let l=(a?t:r)/2,u=Math.min(l-4,8+i*6),d=o+i*8,f=Math.hypot(d,u)||1,p=(i,o)=>a?`${n(e.x+o)},${n(e.y+r/2+i)}`:`${n(e.x+t/2+i)},${n(e.y+o)}`,m=d/f*s,h=u/f*s;return a?(c.labelX=e.x,c.labelY=e.y+r/2+d+4+c.labelH/2):(c.labelX=e.x+t/2+d+4+c.labelW/2,c.labelY=e.y),{d:`M${p(0,-u)}C${p(d,-u*2)} ${p(d,u*2)} ${p(m,u+h)}`,sx:a?e.x-u:e.x+t/2,sy:a?e.y+r/2:e.y-u,sdx:a?0:-1,sdy:a?-1:0,ex:a?e.x+u:e.x+t/2,ey:a?e.y+r/2:e.y+u,edx:a?-u/f:-d/f,edy:a?-d/f:-u/f}}export{W as a,j as c,le as d,M as f,de as i,U as l,N as n,r as o,R as r,ue as s,i as t,G as u};
|
|
1
|
+
import{i as e,o as t,x as n}from"./DEQsS4Ez.js";function r(e,t,n=0){return{w:e,h:t,kind:n,pin:0,hint:NaN,key:NaN,span:0,x:0,y:0,rank:0}}function i(e,t,n=1,r=0,i=0){return{tail:e,head:t,minlen:n,labelW:r,labelH:i,tailDx:0,headDx:0,tailFixed:!1,headFixed:!1,reversed:!1,points:[],labelX:0,labelY:0}}var a=24,o=2e4,s=16,c=8,l=.125,u=3,d=18,f=10,p=14,m=2,h=28,g=12,_=12,v=8,y=4,b=.5,x=.5,S=12,C=40,w=400,T=16,E=new Float64Array(2*T+2),D=new Float64Array(2*T+2);function O(e){return e===1||e===2}function k(e,t,n,r){for(let i=t+1;i<n;i++){let n=e[i],a=r[n],o=i-1;for(;o>=t&&(r[e[o]]>a||r[e[o]]===a&&e[o]>n);)e[o+1]=e[o],o--;e[o+1]=n}}function A(e,t,n,r,i,a){let o=(e,t)=>n[e]<n[t]||n[e]===n[t]&&(i?r[e]>r[t]:r[e]<r[t]);for(let n=0;n<t;n+=8)for(let r=n+1,i=Math.min(t,n+8);r<i;r++){let t=e[r],i=r-1;for(;i>=n&&o(t,e[i]);)e[i+1]=e[i],i--;e[i+1]=t}let s=e,c=a;for(let e=8;e<t;e*=2){for(let n=0;n<t;n+=2*e){let r=Math.min(t,n+e),i=Math.min(t,n+2*e),a=n,l=r,u=n;for(;a<r&&l<i;)c[u++]=o(s[l],s[a])?s[l++]:s[a++];for(;a<r;)c[u++]=s[a++];for(;l<i;)c[u++]=s[l++]}let n=s;s=c,c=n}if(s!==e)for(let n=0;n<t;n++)e[n]=s[n]}function j(e,t,n){let r=e.length;if(r===0)return{width:0,height:0};let i=t.length;if(r===1&&i===0&&e[0].kind===0){let t=e[0];return t.rank=0,t.x=t.w/2,t.y=t.h/2,{width:t.w,height:t.h}}let a=1;if(i>0){let e=new Set;for(let n of t){let t=Math.min(n.tail,n.head),i=Math.max(n.tail,n.head),o=t*r+i;if(n.labelW>0||e.has(o)){a=2;break}e.add(o)}}M(e,t),N(e,t,a);let s=new Int32Array(i),c=0;for(let n=0;n<i;n++){let r=t[n];s[n]=Math.abs(e[r.head].rank-e[r.tail].rank),s[n]>1&&(c+=s[n]-1)}let _=new Uint8Array(i);if(c>o){let e=[];for(let t=0;t<i;t++)s[t]>1&&e.push(t);e.sort((e,t)=>s[t]-s[e]||e-t);for(let t of e){if(c<=o)break;_[t]=1,c-=s[t]-1}}let v=r+c,y=new Float64Array(v),b=new Float64Array(v),x=new Uint8Array(v),S=new Int32Array(v),C=0;for(let t=0;t<r;t++){let n=e[t];y[t]=n.w,b[t]=n.h,x[t]=n.kind,S[t]=n.rank,n.rank>C&&(C=n.rank)}let w=0;for(let e=0;e<i;e++)_[e]||(w+=s[e]);let T=new Int32Array(w),E=new Int32Array(w),D=new Float64Array(w),O=new Float64Array(w),k=new Int32Array(i).fill(-1),A=new Uint8Array(C+1),j=new Int32Array(i).fill(-1),P=!1;for(let t=0;t<r;t++)e[t].span>0&&e[t].kind===0&&(P=!0);let I=P?new Uint8Array(w):void 0,R=P?new Uint8Array(w):void 0,B=new Int32Array(i).fill(-1),ce=new Int32Array(i).fill(-1),V=new Float64Array(v).fill(NaN);for(let t=0;t<r;t++)V[t]=e[t].key;let H=!1;{let e=r,n=0;for(let r=0;r<i;r++){if(_[r])continue;let i=t[r],o=i.reversed?i.head:i.tail,s=i.reversed?i.tail:i.head,c=i.reversed?i.headDx:i.tailDx,l=i.reversed?i.tailDx:i.headDx;(c!==0||l!==0)&&(H=!0);let u=S[o],d=S[s],f=-1;i.labelW>0&&(f=u+(d-u>>1),a===2&&d-u>=4?(f&1)==1&&(f+=i.reversed?1:-1):a===2&&!(f&1)&&(f+=i.reversed?1:-1));let p=o;d-u>1&&(k[r]=e),B[r]=n,I&&!(i.reversed?i.headFixed:i.tailFixed)&&(I[n]=i.reversed?2:1);for(let t=u+1;t<d;t++){let a=e++;S[a]=t,V[a]=V[o]+(V[s]-V[o])*(t-u)/(d-u),t===f?(y[a]=i.labelW,b[a]=i.labelH,x[a]=2,j[r]=a,A[t]|=i.reversed?2:1):x[a]=1,T[n]=p,E[n]=a,D[n]=p===o?c:0,n++,p=a}T[n]=p,E[n]=s,D[n]=p===o?c:0,O[n]=l,R&&!(i.reversed?i.tailFixed:i.headFixed)&&(R[n]=i.reversed?1:2),ce[r]=n,n++}}let le;if(n.groups){let{of:e,parent:a}=n.groups;le=new Int32Array(v);for(let t=0;t<r;t++)le[t]=e[t];let o=e=>{let t=0;for(;e>=0;e=a[e])t++;return t},c=(e,t)=>{let n=o(e),r=o(t);for(;n>r;n--)e=a[e];for(;r>n;r--)t=a[t];for(;e!==t;)e=a[e],t=a[t];return e};for(let n=0;n<i;n++){if(k[n]<0)continue;let r=t[n],i=c(e[r.tail],e[r.head]);for(let e=k[n],t=e+s[n]-1;e<t;e++)le[e]=i}}let U=new Int32Array(v+1),W=new Int32Array(v+1);for(let e=0;e<w;e++)U[T[e]+1]++,W[E[e]+1]++;for(let e=0;e<v;e++)U[e+1]+=U[e],W[e+1]+=W[e];let ue=new Int32Array(w),de=new Int32Array(w);{let e=U.slice(0,v),t=W.slice(0,v);for(let n=0;n<w;n++)ue[e[T[n]]++]=n,de[t[E[n]]++]=n}let G=new Int32Array(C+2);for(let e=0;e<v;e++)G[S[e]+1]++;for(let e=0;e<=C;e++)G[e+1]+=G[e];let K=new Int32Array(v),fe=new Int32Array(v);{let e=new Int32Array(v),t=G.slice(0,C+1);for(let n=0;n<v;n++)e[t[S[n]]++]=n;for(let e=0;e<=C;e++)t[e]=G[e];let n=new Uint8Array(v),r=[];for(let i=0;i<v;i++)if(!n[e[i]])for(r.push(e[i]);r.length>0;){let e=r.pop();if(!n[e]){n[e]=1,K[t[S[e]]++]=e;for(let t=U[e+1]-1;t>=U[e];t--){let e=E[ue[t]];n[e]||r.push(e)}}}}let pe=(e,t)=>{let n=G[e],r=G[e+1];if(r-n<2)return!1;for(let e=n;e<r;e++)if(Number.isNaN(t(K[e])))return!1;let i=Array.from(K.subarray(n,r)),a=new Map;return i.forEach((e,t)=>a.set(e,t)),i.sort((e,n)=>t(e)-t(n)||a.get(e)-a.get(n)),K.set(i,n),!0};for(let e=0;e<=C;e++)pe(e,e=>V[e]);let me=!1;for(let t=0;t<r;t++)e[t].pin!==0&&(me=!0);if(me)for(let t=0;t<=C;t++){let n=Array.from(K.subarray(G[t],G[t+1])),i=new Map;n.forEach((e,t)=>i.set(e,t));let a=t=>t<r?e[t].pin:0;n.sort((e,t)=>a(e)-a(t)||i.get(e)-i.get(t)),K.set(n,G[t])}let he=new Uint8Array(C+1),ge=t=>t<r&&(e[t].kind===3||e[t].kind===4)?e[t].hint:NaN;for(let e of[0,C])pe(e,ge)&&(he[e]=1);let _e=()=>{for(let e=0;e<=C;e++){let t=G[e];for(let n=t,r=G[e+1];n<r;n++)fe[K[n]]=n-t}};_e();let q={n:v,real:r,maxRank:C,W:y,KIND:x,RANK:S,EF:T,ET:E,EFD:D,ETD:O,succStart:U,succE:ue,predStart:W,predE:de,layerStart:G,order:K,pos:fe,offsets:H,fixed:he,GRP:le,groupParent:n.groups?.parent},ve=0,ye=0;if(w>0&&C>0&&([ve,ye]=oe(q,e),_e()),n.orderOnly){let a=se(q,n);for(let t=0;t<r;t++)e[t].x=a[t];for(let e=0;e<i;e++){let n=t[e],r=n.reversed?n.head:n.tail,i=n.reversed?n.tail:n.head,o=[S[r],a[r]];if(!_[e]&&k[e]>=0)for(let t=k[e],n=t+s[e]-1;t<n;t++)o.push(S[t],a[t]);o.push(S[i],a[i]),n.points=o}return{width:0,height:0,crossings:ve,declared:ye}}I&&R&&F(q,e,I,R);let J=se(q,n),Y=re(q);if(I&&R){let r=L(q,I,R);ee(q,e,J,r,n,Y),te(q,e,J,I,R,r,Y),ne(q,J,Y,n);for(let e=0;e<i;e++){if(_[e])continue;let n=t[e],r=D[B[e]],i=O[ce[e]];n.tailDx=n.reversed?i:r,n.headDx=n.reversed?r:i}}let be=new Uint8Array(v);Y&&!n.tracks&&ie(q,J,Y,k,s,n.apart?0:n.edgeSep,be),n.tracks||ae(q,J,k,s,n.edgeSep,be);let xe=new Int32Array(i+1),X=n.tracks||I&&!n.straight?{from:[],to:[],rank:[],lower:[],track:[],levels:[],wide:[]}:void 0,Se=new Int32Array(C+1);if(X){for(let e=0;e<i;e++){if(xe[e]=X.from.length,_[e])continue;let t=k[e],r=!1;for(let i=t,a=t<0?t:t+s[e]-1;i<a;i++){let e=Y!==void 0&&Y[S[i]]===1;!n.tracks&&e!==(be[i]===1)&&(r=!0)}if(r)continue;let i=J[T[B[e]]]+D[B[e]],a=S[T[B[e]]];for(let n=t,r=t<0?t:t+s[e]-1;n<r;n++)Y&&Y[S[n]]||(X.from.push(i),X.to.push(J[n]),X.rank.push(a),X.lower.push(n),i=J[n],a=S[n]);X.from.push(i),X.to.push(J[E[ce[e]]]+O[ce[e]]),X.rank.push(a),X.lower.push(-1)}xe[i]=X.from.length}let Ce=(e,t)=>{let n=!1;for(let r=G[e];r<G[e+1];r++){let e=x[K[r]];if(e===t)n=!0;else if(e!==1)return!1}return n},we=Ce(0,3)?a:0,Te=Ce(C,4)?a:0,Ee=new Float64Array(C+1);for(let e=0;e<w;e++){let t=Math.abs(J[T[e]]+D[e]-J[E[e]]-O[e]);t>Ee[S[T[e]]]&&(Ee[S[T[e]]]=t)}let Z=new Float64Array(C+1),Q=new Float64Array(C+1),De=e=>(e<we||e>=C-Te?n.portSep:n.rankSep)/a,Oe=new Float64Array(C+1);for(let e=0;e<C;e++)Oe[e]=X?De(e):Math.max(De(e),Math.min(u*n.rankSep/a,Ee[e]*l));let ke=new Uint8Array(C+1).fill(1);for(let e=0;e<r;e++)ke[S[e]]=0;for(let e=1;e<C;e++){if(n.tracks||!ke[e]||A[e]!==1&&A[e]!==2)continue;let t=Math.min((n.headRoom??0)/2,Oe[A[e]===1?e-1:e]/2);Oe[e-1]+=A[e]===1?-t:t,Oe[e]+=A[e]===1?t:-t}let Ae=e=>x[e]===1&&ke[S[e]]&&!n.tracks?(Q[S[e]]-Z[S[e]])/4:0,je=n.tracks?d:h,Me=n.tracks?f:g,Ne=n.tracks?p:g,Pe=new Int32Array(C+1);if(X){let e=new Float64Array(C+1);for(let t=0;t<C;t++){if(Y&&Y[t])continue;let n=t+1;for(e[t]=Oe[t];n<C&&Y&&Y[n];)e[t]+=Oe[n++];Pe[t]=n}for(let t=0;t<X.from.length;t++)X.wide.push(+(Math.abs(X.from[t]-X.to[t])>m*e[X.rank[t]]));let t=new Float64Array(C+1);z(X,Se,!n.tracks,e,t);for(let r=0;r<C;r++)Se[r]>0?Oe[r]+=Math.max(0,2*je+(Se[r]-1)*Me-e[r]):t[r]>0&&(Oe[r]+=Math.max(0,Math.min(u*n.rankSep,t[r])-e[r]))}let Fe=0;for(let e=0;e<=C;e++){let t=0;for(let n=G[e];n<G[e+1];n++)b[K[n]]>t&&(t=b[K[n]]);Z[e]=Fe,Q[e]=Fe+t,Fe+=t+Oe[e]}let Ie=Fe,Le=(e,t=X.track[e])=>{let r=X.rank[e],i=Q[r],a=Z[Pe[r]],o=n.tracks?Se[r]:X.levels[e],s=o>1?Math.min(Ne,(a-i-2*je)/(o-1)):0;return(i+a)/2+(t-(o-1)/2)*s},$=1/0,Re=-1/0;for(let e=0;e<v;e++){let t=y[e]/2;J[e]-t<$&&($=J[e]-t),J[e]+t>Re&&(Re=J[e]+t)}let ze=new Uint8Array(C+1),Be=new Uint8Array(C+1);for(let e=0;e<r;e++)x[e]!==0||!I||(W[e+1]>W[e]&&(ze[S[e]]=1),U[e+1]>U[e]&&(Be[S[e]]=1));for(let t=0;t<r;t++){let n=e[t],r=n.rank;n.x=J[t]-$,n.y=x[t]===0&&Be[r]&&!ze[r]?Q[r]-n.h/2:x[t]===0&&ze[r]&&!Be[r]?Z[r]+n.h/2:(Z[r]+Q[r])/2}for(let r=0;r<i;r++){let i=t[r],a=e[i.reversed?i.head:i.tail],o=e[i.reversed?i.tail:i.head],c=[a.x+(i.reversed?i.headDx:i.tailDx),a.y+a.h/2],l=k[r];if(X&&xe[r+1]>xe[r])for(let e=xe[r];e<xe[r+1];e++){if(X.track[e]>=0&&(n.tracks||X.wide[e]===1)){let t=Le(e);c.push(X.from[e]-$,t,X.to[e]-$,t)}else X.track[e]>0&&c.push(X.from[e]-$,Le(e,X.track[e]-1));let t=X.lower[e];t<0||(c.push(J[t]-$,Z[S[t]]+Ae(t)),Q[S[t]]>Z[S[t]]&&c.push(J[t]-$,Q[S[t]]-Ae(t)))}else if(l>=0)for(let e=l,t=l+s[r]-1;e<t;e++){if(be[e])continue;let t=J[e]-$,n=Z[S[e]],r=Q[S[e]];c.push(t,n+Ae(e)),r>n&&c.push(t,r-Ae(e))}if(c.push(o.x+(i.reversed?i.tailDx:i.headDx),o.y-o.h/2),i.reversed)for(let e=0,t=c.length-2;e<t;e+=2,t-=2){let n=c[e],r=c[e+1];c[e]=c[t],c[e+1]=c[t+1],c[t]=n,c[t+1]=r}i.points=c;let u=j[r];u>=0?(i.labelX=J[u]-$,i.labelY=(Z[S[u]]+Q[S[u]])/2):i.labelW>0&&(i.labelX=(c[0]+c[c.length-2])/2,i.labelY=(c[1]+c[c.length-1])/2)}return{width:Re-$,height:Ie}}function M(e,t){let n=e.length,r=t.length,i=new Int32Array(n+1);for(let n=0;n<r;n++){let r=t[n];r.reversed=e[r.head].kind===3||e[r.tail].kind===4,r.reversed||i[r.tail+1]++}for(let e=0;e<n;e++)i[e+1]+=i[e];let a=new Int32Array(i[n]);{let e=i.slice(0,n);for(let n=0;n<r;n++)t[n].reversed||(a[e[t[n].tail]++]=n)}let o=new Uint8Array(n),s=i.slice(0,n),c=[];for(let e=0;e<n;e++)if(o[e]===0)for(c.push(e),o[e]=1;c.length>0;){let e=c[c.length-1];if(s[e]<i[e+1]){let n=t[a[s[e]++]],r=n.head;o[r]===1?n.reversed=!0:o[r]===0&&(o[r]=1,c.push(r))}else o[e]=2,c.pop()}}function N(e,t,n){let r=e.length,i=t.length,a=new Int32Array(i),o=new Int32Array(i),s=new Int32Array(i),c=new Int32Array(r+1),l=new Int32Array(r+1);for(let e=0;e<i;e++){let r=t[e],i=r.reversed?r.head:r.tail,u=r.reversed?r.tail:r.head;a[e]=i,o[e]=u,s[e]=Math.max(1,r.minlen)*n,c[i+1]++,l[u+1]++}for(let e=0;e<r;e++)c[e+1]+=c[e],l[e+1]+=l[e];let u=new Int32Array(i),d=new Int32Array(i);{let e=c.slice(0,r),t=l.slice(0,r);for(let n=0;n<i;n++)u[e[a[n]]++]=n,d[t[o[n]]++]=n}let f=new Int32Array(r),p=new Int32Array(r);for(let e=0;e<r;e++)p[e]=l[e+1]-l[e];let m=new Int32Array(r),h=0;for(let e=0;e<r;e++)p[e]===0&&(m[h++]=e);for(let e=0;e<h;e++){let t=m[e];for(let e=c[t];e<c[t+1];e++){let n=u[e],r=o[n];f[t]+s[n]>f[r]&&(f[r]=f[t]+s[n]),--p[r]===0&&(m[h++]=r)}}for(let e=0;e<8;e++){let e=!1;for(let t=h-1;t>=0;t--){let n=m[t],r=l[n+1]-l[n],i=c[n+1]-c[n];if(r===0&&i===0)continue;let p=-1/0,h=1/0;for(let e=l[n];e<l[n+1];e++){let t=d[e];p=Math.max(p,f[a[t]]+s[t])}for(let e=c[n];e<c[n+1];e++){let t=u[e];h=Math.min(h,f[o[t]]-s[t])}let g=f[n];i>r&&h!==1/0?g=h:r>i&&p!==-1/0&&(g=p),g!==f[n]&&(f[n]=g,e=!0)}if(!e)break}let g=1/0,_=-1/0,v=!1;for(let t=0;t<r;t++){let n=e[t].kind;n===3&&(v=!0),n!==3&&n!==4&&(f[t]<g&&(g=f[t]),f[t]>_&&(_=f[t]))}g===1/0&&(g=0,_=0);for(let t=0;t<r;t++)e[t].kind===3?f[t]=g-n:e[t].kind===4&&(f[t]=_+n);v&&(g-=n);for(let t=0;t<r;t++)e[t].rank=f[t]-g}function P(e,t,n,r,i,a,o){let l=n===0?e.predStart:e.succStart,u=n===0?e.predE:e.succE,d=n===0?e.EF:e.ET,f=e.pos;for(let e=l[t];e<l[t+1];e++)i[u[e]]!==0&&a.push(u[e]);if(a.length<2)return 0;a.sort((e,t)=>f[d[e]]-f[d[t]]||e-t);let p=e=>{let t=0;o[0]=0;for(let n=1;n<a.length;n++){let r=i[a[n]]===i[a[n-1]];o[n]=e(r&&i[a[n]]===1,r),t+=o[n]}return t},m=p(()=>1);if(r/m<c&&(m=p(e=>e?.5:1)),r/m<c&&(m=p((e,t)=>+!t)),m===0)return 0;let h=Math.min(s,r/m);for(let e=1;e<a.length;e++)o[e]*=h;return m*h}function F(e,t,n,r){let{real:i,W:a,EFD:o,ETD:s}=e;for(let c=0;c<i;c++){let i=Math.min(t[c].span,a[c]);if(!(i<=0||t[c].kind!==0))for(let t=0;t<2;t++){let a=[],l=[],u=P(e,c,t,i,t===0?r:n,a,l);if(u===0)continue;let d=t===0?s:o,f=-u/2;for(let e=0;e<a.length;e++)f+=l[e],d[a[e]]=f}}}function I(e,t,n,r){if(!t)return n;let{KIND:i,RANK:a,EF:o,ET:s,succStart:c,succE:l,predStart:u,predE:d}=e;for(let e=0;e<1e5;e++){let e=r===0?o[n]:s[n];if(i[e]!==1||!t[a[e]])break;n=r===0?d[u[e]]:l[c[e]]}return n}function L(e,t,n){let r=[new Int32Array(e.n),new Int32Array(e.n)];for(let i=0;i<e.EF.length;i++)n[i]!==0&&r[0][e.ET[i]]++,t[i]!==0&&r[1][e.EF[i]]++;return r}function R(e,t){return Math.max(.25,Math.min(.5,4*Math.abs(t)/(Math.abs(e)||1)))}function ee(e,t,n,r,i,a){let o=i.edgeSep,{n:s,real:c,maxRank:l,KIND:u,RANK:d,W:f,EF:p,ET:m,EFD:h,ETD:g,succStart:_,succE:v,predStart:y,predE:b,layerStart:x,order:S,pos:C}=e,w=e=>u[e]===2||u[e]===1&&(a===void 0||a[d[e]]!==1),T=(e,i)=>{let a=i===0?p[e]:m[e];return[i===0?n[a]+h[e]:n[a]+g[e],a<c&&t[a].kind===0?r[1-i][a]:0]},E=e=>{let t=x[d[e]],r=t+C[e],a=t=>f[t]/2+f[e]/2+(u[t]===0?i.nodeSep/2+o/2:u[t]===u[e]?o:o/2);return[r>t?n[S[r-1]]+a(S[r-1]):-1/0,r+1<x[d[e]+1]?n[S[r+1]]-a(S[r+1]):1/0]},D=(e,t,n,r,i)=>{let a=(t[1]===n[1]?Math.abs(t[0]-e)<=Math.abs(n[0]-e):t[1]<n[1])?[t[0],n[0]]:[n[0],t[0]];return a.find(e=>e>=r&&e<=i)??Math.max(r,Math.min(i,a[0]))},k=new Uint8Array(s),A=[];for(let t=1;t<l;t++)for(let r=x[t];r<x[t+1];r++){if(!w(S[r])||k[S[r]])continue;let t=S[r];for(;O(u[p[b[y[t]]]]);)t=p[b[y[t]]];let i=t,o=-1/0,s=1/0;A.length=0;for(let e=t;O(u[e]);e=m[v[_[e]]]){if(i=e,!w(e))continue;k[e]=1,A.push(e);let[t,n]=E(e);t>o&&(o=t),n<s&&(s=n)}if(o<=s){let e=D(n[A[0]],T(b[y[t]],0),T(v[_[i]],1),o,s);for(let t of A)n[t]=e}else for(let t of A){let[r,i]=E(t);r>i||(n[t]=D(n[t],T(I(e,a,b[y[t]],0),0),T(I(e,a,v[_[t]],1),1),r,i))}}}function te(e,t,n,r,i,a,o){let{real:c,W:l,EF:u,ET:d,EFD:f,ETD:p,succStart:m,succE:h,predStart:g,predE:_,pos:v}=e,y=(s,m,h,g,_)=>{if(a[m][h]<2)return 0;s=I(e,o,s,m);let v=m===0?u[s]:d[s],y=m===0?n[v]+f[s]:n[v]+p[s];if(_&&Math.abs(y-n[h])<=g/2+x)return Math.max(-g/2,Math.min(g/2,y-n[h]));let b=y,S=0;v<c&&t[v].kind===0&&(m===0?r:i)[s]!==0&&a[1-m][v]>=2&&(S=Math.max(0,Math.min(t[v].span,l[v])),S>0&&(b=n[v]));let w=Math.max(n[h]-g/2,b-S/2),T=Math.min(n[h]+g/2,b+S/2);if(w>T+x){let e=Math.max(0,g/2-C);return Math.max(-e,Math.min(e,y-n[h]))}let E=(n[h]*S+b*g)/(S+g);return Math.max(w,Math.min(T,E))-n[h]},b=[];for(let n=0;n<c;n++){let a=Math.min(t[n].span,l[n]);if(!(a<=0||t[n].kind!==0))for(let t=0;t<2;t++){let o=t===0?u:d,s=t===0?g:m,c=t===0?_:h,l=[],f=[];if(P(e,n,t,a,t===0?i:r,l,f),l.length===0)continue;l.length===1&&(f[0]=0);let p=[];for(let e=s[n];e<s[n+1];e++)p.push(c[e]);p.sort((e,t)=>v[o[e]]-v[o[t]]||e-t),b.push({v:n,side:t,span:a,ids:l,room:f,all:p})}}for(let e=0,t=!0;t&&e<6;e++){t=!1;for(let{v:n,side:a,span:o,ids:c,room:l,all:u}of b){let d=a===0?i:r,m=a===0?p:f,h=0,g=-o/2;for(let r=0;r<=u.length;r++){let i=r<u.length&&d[u[r]]===0;if(r<u.length&&!i)continue;let f=0;for(let e=r-1;e>=0&&d[u[e]]!==0;e--)f++;let p=i?m[u[r]]-s:o/2;if(f>0){let r=[],i=[],s=0;for(let t=0;t<f;t++){t>0&&(s+=l[h+t]),r.push(y(c[h+t],a,n,o,e>0)-s),i.push(1);let u=t>0&&l[h+t]===0;for(;r.length>1&&(u||r[r.length-2]/i[i.length-2]>r[r.length-1]/i[i.length-1]);){u=!1;let e=r.pop(),t=i.pop();r[r.length-1]+=e,i[i.length-1]+=t}}let u=s,d=0;s=0;for(let e=0;e<r.length;e++){let n=p-u<g?(g+p-u)/2:Math.max(g,Math.min(p-u,r[e]/i[e]));for(let r=0;r<i[e];r++,d++)d>0&&(s+=l[h+d]),Math.abs(m[c[h+d]]-n-s)>.01&&(t=!0),m[c[h+d]]=n+s}h+=f}i&&(g=m[u[r]]+s)}}}}function ne(e,t,n,r){let{n:i,KIND:a,RANK:o,EF:s,ET:c,EFD:l,ETD:u,layerStart:d,order:f,pos:p}=e,m=e=>n!==void 0&&a[e]===1&&n[o[e]]===1,h=[],g=[],_=[],v=[];for(let t=0;t<s.length;t++){if(m(s[t]))continue;let r=I(e,n,t,1);h.push(s[t]),g.push(c[r]),_.push(l[t]),v.push(u[r])}let y=e=>t[g[e]]+v[e]-t[h[e]]-_[e],b=new Int32Array(i),x=[];for(let e=0;e<i;e++)b[e]=e,x.push([e]);let C=(e,t)=>{let n=b[e],r=b[t];if(n!==r){x[n].length<x[r].length&&([n,r]=[r,n]);for(let e of x[r])b[e]=n,x[n].push(e);x[r]=[]}},w=[];for(let e=0;e<h.length;e++){let t=Math.abs(y(e));t<.01?C(h[e],g[e]):t<=S&&w.push(e)}if(w.length===0)return;w.sort((e,t)=>Math.abs(y(e))-Math.abs(y(t))||e-t);let T=t=>B(e,r,t),E=(e,n)=>{for(let r of x[e]){let i=d[o[r]],a=d[o[r]+1],s=i+p[r];if(s>i&&b[f[s-1]]!==e&&t[r]+n-t[f[s-1]]<T(r)+T(f[s-1])-.01||s+1<a&&b[f[s+1]]!==e&&t[f[s+1]]-t[r]-n<T(r)+T(f[s+1])-.01)return!1}return!0};for(let e of w){let n=y(e);if(Math.abs(n)<.01){C(h[e],g[e]);continue}if(Math.abs(n)>S||b[h[e]]===b[g[e]])continue;let r=b[h[e]],i=b[g[e]],a=x[r].length<=x[i].length?r:i;for(let o of[a,a===r?i:r]){let i=o===r?n:-n;if(E(o,i)){for(let e of x[o])t[e]+=i;C(h[e],g[e]);break}}}}function re(e){let{maxRank:t,KIND:n,layerStart:r,order:i}=e,a=new Uint8Array(t+1),o=!1;for(let e=1;e<t;e++){let t=r[e+1]>r[e];for(let a=r[e];t&&a<r[e+1];a++)n[i[a]]!==1&&(t=!1);t&&(a[e]=1,o=!0)}return o?a:void 0}function z(e,t,n,r,i){let{from:a,to:o,rank:s,track:c,levels:l,wide:u}=e,d=a.length,f=new Map;for(let e=0;e<d;e++){if(c.push(-1),l.push(0),Math.abs(a[e]-o[e])<x)continue;let t=f.get(s[e]);t?t.push(e):f.set(s[e],[e])}if(f.size===0)return;let p=new Float64Array(d),m=new Float64Array(d);for(let e=0;e<d;e++)p[e]=Math.min(a[e],o[e]),m[e]=Math.max(a[e],o[e]);let h=(e,t)=>+(e>=p[t]-x&&e<=m[t]+x),g=(e,t)=>Math.abs(a[e]-a[t])<x||Math.abs(o[e]-o[t])<x,S=(e,t)=>p[e]<m[t]-x&&p[t]<m[e]-x,C=(e,t)=>S(e,t)&&!g(e,t),O=(e,t)=>S(e,t)||h(o[e],t)+h(a[t],e)+h(o[t],e)+h(a[e],t)>0,k=(e,t)=>h(o[e],t)+h(a[t],e),A=e=>{let t=e.map((e,t)=>t).sort((t,n)=>p[e[t]]-p[e[n]]),n=[];for(let r=0;r<t.length;r++){let i=t[r],a=m[e[i]]+4*x;for(let o=r+1;o<t.length&&p[e[t[o]]]<=a;o++){let e=t[o];n.push(Math.min(i,e),Math.max(i,e))}}return n},j=e=>{e.sort((e,t)=>m[t]-p[t]-(m[e]-p[e])||p[e]-p[t]||e-t);let t=e.length,r=[],i=e.map((e,t)=>t),a=e=>{for(;i[e]!==e;)e=i[e]=i[i[e]];return e},o=t<=w,s=o?A(e):[],u=o?e.map(()=>[]):[];for(let t=0;t<s.length;t+=2){let n=s[t],r=s[t+1];C(e[n],e[r])&&(u[n].push(r),u[r].push(n))}let d=e.map((e,t)=>t);if(o){let n=new Int32Array(t),o=[];for(let e=0;e<t;e++)r.push([]),o.push([]);for(let t=0;t<s.length;t+=2){let c=s[t],l=s[t+1],u=e[c],d=e[l];if(!O(u,d))continue;i[a(c)]=a(l);let f=k(u,d),p=k(d,u);if(f===p)continue;let m=f<p?c:l,h=f<p?l:c;r[h].push(m),o[m].push(h),n[h]++}let c=new Uint8Array(t);d=[];for(let e=0;e<t;e++){let e=-1;for(let r=0;r<t&&!(!c[r]&&((e<0||n[r]<n[e])&&(e=r),n[r]===0));r++);c[e]=1,d.push(e);for(let t of o[e])n[t]--}}let f=new Set,h=[],g=0;for(let t of d){let n=e[t],i=0;for(let n of r[t]??[])c[e[n]]>=i&&(i=c[e[n]]+1);if(o){f.clear();for(let n of u[t])f.add(c[e[n]]);for(;f.has(i);)i++}else{for(;h[i]?.some(e=>C(n,e));)i++;(h[i]??=[]).push(n)}c[n]=i,i>=g&&(g=i+1)}let _=new Int32Array(t).fill(g),v=new Int32Array(t).fill(-1);for(let n=0;n<t;n++){let t=a(n);_[t]=Math.min(_[t],c[e[n]]),v[t]=Math.max(v[t],c[e[n]])}for(let r=0;r<t;r++){let t=a(r);l[e[r]]=v[t]-_[t]+1,n&&(c[e[r]]-=_[t])}return g},M=(e,t,n)=>{let r=R(o[e]-a[e],t);for(let i=0;i<=T;i++){let s=i/T,c=1-s;n[2*i]=a[e]+(o[e]-a[e])*s*s*(3-2*s),n[2*i+1]=t*(3*r*s*c*c+3*(1-r)*s*s*c+s*s*s)}},N=(e,t,n)=>{let r=n*n*1.000000001;for(let i=0;i<=T;i++){let a=e[2*i],o=e[2*i+1];for(let e=0;e<T;e++){let i=t[2*e+2]-t[2*e],s=t[2*e+3]-t[2*e+1],c=Math.max(0,Math.min(1,((a-t[2*e])*i+(o-t[2*e+1])*s)/(i*i+s*s||1))),l=a-t[2*e]-c*i,u=o-t[2*e+1]-c*s;if(l*l+u*u<r&&Math.hypot(l,u)<n)return!0}}return!1},P=(e,t,n,r)=>{let i=Math.max(n/2,n-2*_);return M(e,i,E),M(t,i,D),N(E,D,r)||N(D,E,r)};for(let[e,s]of f){if(!n){t[e]=j(s);continue}if(s.length>w)continue;let d=s.filter(e=>u[e]===1);j(d);let f=new Set(d.filter(e=>l[e]>1)),h=A(s);for(let t=0;t<h.length;t+=2){let n=s[h[t]],i=s[h[t+1]];f.has(n)&&f.has(i)||!C(n,i)||a[n]<o[n]!=a[i]<o[i]||P(n,i,r[e],u[n]===1||u[i]===1?v:y)&&f.add(n).add(i)}for(let e of d)c[e]=-1,l[e]=0;if(f.size===0)continue;let _=0,x=0,T=new Set;for(let e=0;e<h.length;e+=2){let t=s[h[e]],n=s[h[e+1]];if(f.has(t)&&f.has(n)){if(!S(t,n))continue;a[t]<o[t]==a[n]<o[n]?g(t,n)||x++:_++}else(f.has(t)||f.has(n))&&O(t,n)&&T.add(t).add(n)}if(_>x){for(let t of s)(m[t]-p[t])*b>i[e]&&(i[e]=(m[t]-p[t])*b);continue}let E=s.filter(e=>f.has(e)||u[e]!==1&&T.has(e));j(E);let D=0;for(let e of E)l[e]>D&&(D=l[e]);t[e]=D}}function ie(e,t,n,r,i,a,o){let{maxRank:s,EF:c,ET:l,EFD:u,ETD:d,succStart:f,succE:p,predStart:m,predE:h,layerStart:g,order:_}=e,v=new Float64Array(t.length),y=new Float64Array(t.length),b=new Float64Array(t.length);for(let a=0;a<r.length;a++){let o=r[a];if(o<0)continue;let s=o+i[a]-1,g=e.RANK[o];for(let e=o;e<s;e++){if(!n[g+e-o])continue;let r=e;for(;r+1<s&&n[g+r+1-o];)r++;let i=h[m[e]],a=p[f[r]],_=t[c[i]]+u[i],x=t[l[a]]+d[a],S=r-e+2;for(let t=e;t<=r;t++)v[t]=_+(x-_)*(t-e+1)/S,y[t]=_,b[t]=x;e=r}}let x=[];for(let r=1;r<s;r++){if(!n[r])continue;let i=g[r],s=g[r+1],c=Array.from(_.subarray(i,s)).sort((e,t)=>y[e]-y[t]||b[e]-b[t]||e-t);for(let n=0;n<c.length;){x.length=0;let r=n;for(;r<c.length&&Math.abs(y[c[r]]-y[c[n]])<1&&Math.abs(b[c[r]]-b[c[n]])<1;r++)x.push(c[r]);x.sort((t,n)=>e.pos[t]-e.pos[n]);for(let e=0;e<x.length;e++){let n=x[e];t[n]=v[n]+(e-(x.length-1)/2)*a,(x.length===1||a===0)&&(o[n]=1)}n=r}}}function ae(e,t,n,r,i,a){let{maxRank:o,W:s,KIND:c,RANK:l,EF:u,ET:d,EFD:f,ETD:p,succStart:m,succE:h,predStart:g,predE:_,layerStart:v,order:y}=e,b=new Uint8Array(o+1),x=!1;for(let e=1;e<o;e++){let t=!1,n=!1;for(let r=v[e];r<v[e+1];r++){let e=c[y[r]];e===2?t=!0:e!==1&&(n=!0)}t&&!n&&(b[e]=1,x=!0)}if(x)for(let e=0;e<n.length;e++){let o=n[e];if(!(o<0))for(let n=o,x=o+r[e]-1;n<x;n++){if(c[n]!==1||!b[l[n]])continue;let e=n,r=n;for(;e>o&&a[e-1];)e--;for(;r+1<x&&a[r+1];)r++;let S=_[g[e]],C=h[m[r]],w=t[u[S]]+f[S],T=t[d[C]]+p[C],E=Math.min(w,T)-i,D=Math.max(w,T)+i,O=!0,k=l[n];for(let e=v[k];O&&e<v[k+1];e++){let n=y[e];c[n]===2&&t[n]+s[n]/2>E&&t[n]-s[n]/2<D&&(O=!1)}if(!O)continue;a[n]=1;let A=r-e+2;for(let n=e;n<=r;n++)t[n]=w+(T-w)*(n-e+1)/A}}}function oe(e,t){let{n,real:r,maxRank:i,W:o,EF:s,ET:c,EFD:l,ETD:u,succStart:d,succE:f,predStart:p,predE:m,layerStart:h,order:g,pos:_,offsets:v,fixed:y,GRP:b,groupParent:x}=e,S=0;for(let e=0;e<=i;e++)S=Math.max(S,h[e+1]-h[e]);if(S<2)return[0,0];let C=v?new Int32Array(s.length):void 0,w=new Int32Array(C?s.length:0),T=new Int32Array(C?n:0),E=C?f.slice():f,D=new Uint8Array(C?n:0);if(C){let e=m.slice(),t=(e,t,n,r)=>{for(let i=t+1;i<n;i++)if(r[e[i]]!==r[e[t]])return e.subarray(t,n).sort((e,t)=>r[e]-r[t]),!0;return!1};for(let r=0;r<n;r++){if(T[r]=1,t(e,p[r],p[r+1],u))for(let t=p[r]+1;t<p[r+1];t++)u[e[t]]!==u[e[t-1]]&&T[r]++,w[e[t]]=T[r]-1;t(E,d[r],d[r+1],l)&&(D[r]=1)}}let O=1;for(;O<(C?S+s.length:S);)O<<=1;let k=new Int32Array(2*O),j=new Int32Array(s.length),M=()=>{let e=0;for(let t=0;t<i;t++){let n=h[t+2]-h[t+1];if(C){let e=0;for(let n=h[t+1];n<h[t+2];n++){let t=g[n];for(let n=p[t];n<p[t+1];n++)C[m[n]]=e+w[m[n]];e+=T[t]}n=e}if(n<2)continue;let r=0;for(let e=h[t];e<h[t+1];e++){let t=g[e],n=d[t],i=d[t+1],a=r;for(let e=n;e<i;e++)j[r++]=C?C[E[e]]:_[c[f[e]]];let o=r-a;if(!(o<2)){if(C&&D[t])for(let e=a+1;e<r;e++){let t=j[e],r=l[E[n+e-a]],i=e-1;for(;i>=a&&l[E[n+i-a]]===r&&j[i]>t;)j[i+1]=j[i],i--;j[i+1]=t}else if(o<=12)for(let e=a+1;e<r;e++){let t=j[e],n=e-1;for(;n>=a&&j[n]>t;)j[n+1]=j[n],n--;j[n+1]=t}else j.subarray(a,r).sort()}}if(r<2)continue;let i=1;for(;i<n;)i<<=1;k.fill(0,0,2*i);for(let t=0;t<r;t++){let n=j[t]+i;for(k[n]++;n>1;)!(n&1)&&(e+=k[n+1]),n>>=1,k[n]++}}return e},N=M(),P=new Float64Array(n),F=new Int32Array(S),I=new Int32Array(S),L=x?x.length:0,R=new Int32Array(L);for(let e=0;e<L;e++)for(let t=e;t>=0;t=x[t])R[e]++;let ee=new Float64Array(L),te=new Int32Array(L),ne=new Int32Array(L),re=(e,t)=>{let r=h[e],i=h[e+1];for(let e=r;e<i;e++)for(let t=b[g[e]];t>=0;t=x[t])ee[t]=0,te[t]=0;for(let e=r;e<i;e++){let n=g[e];for(let r=b[n];r>=0;r=x[r])te[r]===0&&(ne[r]=e),ee[r]+=t[n],te[r]++}let a=e=>e>=n?ee[e-n]/te[e-n]:t[e],o=e=>e>=n?ne[e-n]:r+_[e],s=Array.from(g.subarray(r,i)).sort((e,t)=>{let r=e,i=t,s=b[e],c=b[t],l=s<0?0:R[s],u=c<0?0:R[c];for(;l>u;l--)r=n+s,s=x[s];for(;u>l;u--)i=n+c,c=x[c];for(;s!==c;)r=n+s,s=x[s],i=n+c,c=x[c];return a(r)-a(i)||o(r)-o(i)});g.set(s,r);for(let e=r;e<i;e++)_[g[e]]=e-r};if(b){let e=new Float64Array(n);for(let t=0;t<=i;t++){for(let n=h[t];n<h[t+1];n++)e[g[n]]=n-h[t];re(t,e)}}let z=b?M():N;if(z===0)return[0,N];let ie=g.slice(),ae=Math.min(z,N),oe=(e,n)=>{let a=e?p:d,x=e?m:f,S=e?s:c,C=e?l:u;for(let s=1;s<=i;s++){let c=e?s:i-s;if(y[c])continue;let l=h[c],u=h[c+1],d=0;for(let n=l;n<u;n++){let i=g[n],s=i<r?t[i].pin:0;if(s!==0){P[i]=s*1e9,F[d++]=i;continue}let f=a[i],p=a[i+1];if(f===p){if(b){let t=e?h[c]-h[c-1]:h[c+2]-h[c+1];P[i]=(n-l)*t/(u-l);continue}P[i]=-1;continue}let m=0;for(let e=f;e<p;e++){let t=S[x[e]];m+=_[t],v&&o[t]>0&&(m+=C[x[e]]/o[t])}P[i]=m/(p-f),F[d++]=i}if(b){re(c,P);continue}if(d<2)continue;A(F,d,P,_,n,I);let f=0;for(let e=l;e<u;e++)P[g[e]]!==-1&&(g[e]=F[f++]);for(let e=l;e<u;e++)_[g[e]]=e-l}},B=()=>{let e=0;for(let t=0;t<=i;t++)for(let n=h[t];n<h[t+1];n++)if(!(g[n]>=r))for(let r=n+1;r<h[t+1];r++)g[r]<g[n]&&e++;return e},se=()=>{for(let e=0;e<=i;e++)for(let t=h[e];t<h[e+1];t++)_[g[t]]=t-h[e]},ce=e=>e<r?t[e].pin:0,V=(e,t)=>{let n=t?s[e]:c[e];return v&&o[n]>0?_[n]+(t?l[e]:u[e])/o[n]:_[n]},H=(e,t)=>{let n=0;for(let r=p[e];r<p[e+1];r++){let e=V(m[r],!0);for(let r=p[t];r<p[t+1];r++)e>V(m[r],!0)&&n++}for(let r=d[e];r<d[e+1];r++){let e=V(f[r],!1);for(let r=d[t];r<d[t+1];r++)e>V(f[r],!1)&&n++}return n},le=()=>{for(let e=0;e<8;e++){let e=!1;for(let t=0;t<=i;t++){if(y[t])continue;let n=h[t];for(let r=n;r+1<h[t+1];r++){let t=g[r],i=g[r+1];ce(t)!==ce(i)||b&&b[t]!==b[i]||H(i,t)>=H(t,i)||(g[r]=i,g[r+1]=t,_[i]=r-n,_[t]=r+1-n,e=!0)}}if(!e)break}},U=g.slice(),W=n<=600,ue=ie,de=1/0;for(let e=0;e<(W?2:1);e++){e>0&&(g.set(U),se());let t=ae,n=U.slice();for(let r=0,i=0;i<4&&r<a;r++,i++){oe((r+e)%2==0,r%4>=2);let a=M();if(a<t&&(t=a,n.set(g),i=0,a===0))break}if(g.set(n),W&&t>0){se(),le();let e=M();e<t&&(t=e,n.set(g))}let r=W?B():0;(e===0||t<z||t===z&&r<de)&&(z=t,ue=n,de=r)}if(g.set(ue),se(),ie.set(ue),b&&(z=M()),!W)return[z,N];for(let e=0;e<r;e++)if(t[e].pin!==0)return[z,N];if(de===0||y[0]||y[i])return[z,N];for(let e=0;e<=i;e++)g.subarray(h[e],h[e+1]).reverse();return se(),(M()>z||B()>=de)&&g.set(ie),[z,N]}function B(e,t,n){return e.W[n]/2+(e.KIND[n]===0?t.nodeSep:t.edgeSep)/2}function se(e,t){let{n,maxRank:r,W:i,KIND:a,EF:o,ET:s,EFD:c,ETD:l,succStart:u,succE:d,predStart:f,predE:p,layerStart:m,order:h,pos:g}=e,_=o.length,v=new Float64Array(n);for(let r=0;r<n;r++)v[r]=B(e,t,r);let y=new Int32Array(_);for(let e=0;e<_;e++)y[e]=g[s[e]];for(let e=0;e<n;e++)u[e+1]-u[e]>1&&k(d,u[e],u[e+1],y);for(let e=0;e<_;e++)y[e]=g[o[e]];for(let e=0;e<n;e++)f[e+1]-f[e]>1&&k(p,f[e],f[e+1],y);let b=new Uint8Array(_);for(let e=1;e<=r;e++){let t=m[e]-m[e-1],n=m[e],r=m[e+1],i=0,s=n;for(let e=n;e<r;e++){let n=h[e],c=-1;if(O(a[n])){let e=o[p[f[n]]];O(a[e])&&(c=e)}let l=c>=0?g[c]:t;if(c>=0||e===r-1){for(let t=s;t<=e;t++){let e=h[t],n=O(a[e]);for(let t=f[e];t<f[e+1];t++){let e=p[t],r=g[o[e]];(r<i||l<r)&&!(n&&O(a[o[e]]))&&(b[e]=1)}}s=e+1,i=l}}}let x=[],S=new Int32Array(n),C=new Int32Array(n),w=new Float64Array(n),T=new Int32Array(n),E=new Int32Array(n),D=new Float64Array(n),A=new Int32Array(n),j=new Int32Array(n+1),M=new Int32Array(n),N=new Int32Array(n),P=new Int32Array(n),F=new Float64Array(n);for(let e=0;e<4;e++){let t=e<2,i=(e&1)==1,a=t?f:u,_=t?p:d,y=t?o:s,O=t?l:c,k=t?c:l;for(let e=0;e<n;e++)S[e]=e,C[e]=e,w[e]=0,A[e]=0,j[e+1]=0,F[e]=0;for(let e=0;e<=r;e++){let n=t?e:r-e,o=m[n],s=m[n+1],c=t?n-1:n+1,l=c>=0&&c<=r?m[c+1]-m[c]-1:0,u=-1;for(let e=i?s-1:o;i?e>=o:e<s;i?e--:e++){let t=h[e],n=a[t],r=a[t+1]-n;if(r===0)continue;let o=n+(r-1>>1),s=n+(r>>1);for(let e=0;e<2&&(e!==1||o!==s);e++){let n=_[e===0===i?s:o],r=y[n],a=i?l-g[r]:g[r];C[t]===t&&u<a&&b[n]===0&&(C[r]=t,C[t]=S[t]=S[r],w[t]=w[r]+k[n]-O[n],u=a)}}}let I=0;for(let e=0;e<=r;e++){let t=m[e],n=m[e+1];for(let e=t+1;e<n;e++){let t=i?h[e]:h[e-1],n=i?h[e-1]:h[e],r=v[t]+v[n];T[I]=S[t],E[I]=S[n],D[I]=i?r-w[t]+w[n]:r+w[t]-w[n],A[S[n]]++,j[S[t]+1]++,I++}}for(let e=0;e<n;e++)j[e+1]+=j[e];for(let e=0;e<n;e++)N[e]=j[e];for(let e=0;e<I;e++)M[N[T[e]]++]=e;let L=0;for(let e=0;e<n;e++)S[e]===e&&A[e]===0&&(P[L++]=e);for(let e=0;e<L;e++){let t=P[e];for(let e=j[t];e<j[t+1];e++){let n=M[e],r=E[n];F[t]+D[n]>F[r]&&(F[r]=F[t]+D[n]),--A[r]===0&&(P[L++]=r)}}for(let e=L-1;e>=0;e--){let t=P[e],n=1/0;for(let e=j[t];e<j[t+1];e++){let t=M[e],r=F[E[t]]-D[t];r<n&&(n=r)}n!==1/0&&n>F[t]&&(F[t]=n)}let R=new Float64Array(n);for(let e=0;e<n;e++)R[e]=(i?-F[S[e]]:F[S[e]])+w[e];x.push(R)}let I=0,L=1/0,R=[],ee=[];for(let e=0;e<4;e++){let t=1/0,r=-1/0,a=x[e];for(let e=0;e<n;e++){let n=i[e]/2;a[e]-n<t&&(t=a[e]-n),a[e]+n>r&&(r=a[e]+n)}R.push(t),ee.push(r),r-t<L&&(L=r-t,I=e)}for(let e=0;e<4;e++){let t=e&1?ee[I]-ee[e]:R[I]-R[e];if(t!==0){let r=x[e];for(let e=0;e<n;e++)r[e]+=t}}let te=new Float64Array(n);for(let e=0;e<n;e++){let t=x[0][e],n=x[1][e],r=x[2][e],i=x[3][e],a;t>n&&(a=t,t=n,n=a),r>i&&(a=r,r=i,i=a),t>r&&(a=t,t=r,r=a),n>i&&(a=n,n=i,i=a),n>r&&(a=n,n=r,r=a),te[e]=(n+r)/2}return te}var ce=12,V=.62,H=6;function le(){let e=new Map;return{add(t,n,r){let i=W(r);n>=0&&i>0&&i+H>(e.get(t*4+n)??0)&&e.set(t*4+n,i+H)},of:(t,n)=>n>=0?e.get(t*4+n)??0:0}}function U(e,t,r,i,a=r>0?r+H:0,o=i>0?i+H:0){let s=t===`linear`,c=t===`step`||t===`stepBefore`||t===`stepAfter`,l=[],u=[],d=[],f=(e,t,n,r)=>Math.abs(e-n)<.01&&Math.abs(t-r)<.01;for(let n=0;n<e.length;n+=3){let r=e[n],i=e[n+1],a=e[n+2],o=l.length-1;if(c&&o>=0&&Math.abs(r-l[o])>=.01&&Math.abs(i-u[o])>=.01){let e=l[o],n=u[o],s=t===`stepBefore`?n:t===`stepAfter`?i:(n+i)/2,c=t===`stepBefore`?e:t===`stepAfter`?r:(e+r)/2,p=a===0?[e,s,r,s]:[c,n,c,i];for(let t=0;t<4;t+=2)f(p[t],p[t+1],e,n)||f(p[t],p[t+1],r,i)||(l.push(p[t]),u.push(p[t+1]),d.push(a))}l.push(r),u.push(i),d.push(a)}let p=l.length-1,m=e=>Math.abs(l[e]-l[e-1])<.01||Math.abs(u[e]-u[e-1])<.01,h=e=>s||m(e),g=(e,t,n)=>{if(!h(Math.max(e,t)))return n===0?[0,Math.sign(u[t]-u[e])||1]:[Math.sign(l[t]-l[e])||1,0];let r=l[t]-l[e],i=u[t]-u[e],a=Math.hypot(r,i)||1;return[r/a,i/a]},[_,v]=g(0,1,d[1]),[y,b]=g(p-1,p,d[p]),x=l[0],S=u[0],C=l[p],w=u[p];l[0]+=_*r,u[0]+=v*r,l[p]-=y*i,u[p]-=b*i;let T=e=>Math.abs(l[e]-l[e-1])+Math.abs(u[e]-u[e-1]),E=e=>!s&&e>0&&e<p&&m(e)&&m(e+1)&&T(e)>=.01&&T(e+1)>=.01&&Math.abs(l[e]-l[e-1])<.01!=Math.abs(l[e+1]-l[e])<.01,D=(e,t,n)=>Math.abs(l[e]-l[e-1])*Math.abs(t)+Math.abs(u[e]-u[e-1])*Math.abs(n),O=(e,t,n)=>{let r=Math.min(Math.max(0,e-H-t),n/4);return r+Math.min(e-t-r,(n-r)/4)},k=o>i&&(!h(p)||E(p-1))?O(o,i,D(p,y,b)):0,A=a>r&&(!h(1)||E(1))?O(a,r,D(1,_,v)):0;k>=1&&(l.splice(p,0,l[p]-y*k),u.splice(p,0,u[p]-b*k),d.splice(p,0,d[p]),p++),A>=1&&(l.splice(1,0,l[0]+_*A),u.splice(1,0,u[0]+v*A),d.splice(1,0,d[1]),p++);let j=`M${n(l[0])},${n(u[0])}`,M=l[0],N=u[0],P=(e,t)=>{f(e,t,M,N)||(j+=`L${n(e)},${n(t)}`,M=e,N=t)};for(let e=1;e<=p;e++){let t=l[e],r=u[e];if(!h(e)){let i=d[e]===0,a=i?r-N:t-M,o=Math.abs(a)*R(i?t-M:r-N,a),s=i?0:Math.sign(a)*o,c=i?Math.sign(a)*o:0;j+=`C${n(M+s)},${n(N+c)} ${n(t-s)},${n(r-c)} ${n(t)},${n(r)}`,M=t,N=r;continue}if(!E(e)){if(e<p&&m(e)&&m(e+1)&&(t-l[e-1])*(l[e+1]-t)+(r-u[e-1])*(u[e+1]-r)>0)continue;P(t,r);continue}let i=E(e-1)?T(e)/2:T(e),a=E(e+1)?T(e+1)/2:T(e+1);c&&(i=a=Math.min(ce,i,a));let[o,s]=g(e-1,e,d[e]),[f,_]=g(e,e+1,d[e+1]);P(t-o*i,r-s*i),M=t+f*a,N=r+_*a,j+=c?`Q${n(t)},${n(r)} ${n(M)},${n(N)}`:`C${n(t-o*i*(1-V))},${n(r-s*i*(1-V))} ${n(t+f*a*(1-V))},${n(r+_*a*(1-V))} ${n(M)},${n(N)}`}return{d:j,sx:x,sy:S,sdx:-_,sdy:-v,ex:C,ey:w,edx:y,edy:b}}function W(e){return e===`arrow_point`?7:e===`arrow_circle`?8:e===`arrow_cross`?4:0}function ue(e,t,r,i,a,o){let s=-a,c=i;if(e===`arrow_point`){let e=t-i*8,l=r-a*8,u=3.36;return`<path class="pele-marker" d="M${n(t)},${n(r)}L${n(e+s*u)},${n(l+c*u)}L${n(e-s*u)},${n(l-c*u)}Z" fill="${o}" stroke="none"/>`}if(e===`arrow_circle`)return`<circle class="pele-marker" cx="${n(t-i*4)}" cy="${n(r-a*4)}" r="3.5" fill="${o}" stroke="none"/>`;if(e===`arrow_cross`){let e=t-i*4,o=r-a*4,l=3.5,u=(i+s)*l,d=(a+c)*l,f=(i-s)*l,p=(a-c)*l;return`<path class="pele-marker" d="M${n(e-u)},${n(o-d)}L${n(e+u)},${n(o+d)}M${n(e-f)},${n(o-p)}L${n(e+f)},${n(o+p)}"/>`}return``}function de(r,i,a,o,s,c){let l=i.width+8,u=i.height;return`<g class="pele-edge-label" data-id="${e(r)}"><rect x="${n(a-l/2)}" y="${n(o-u/2)}" width="${n(l)}" height="${n(u)}" rx="3" fill="var(--_bg)"/>`+t(i,a,o,s,c)+`</g>`}function G(e,t,r,i,a,o,s,c){let l=(a?t:r)/2,u=Math.min(l-4,8+i*6),d=o+i*8,f=Math.hypot(d,u)||1,p=(i,o)=>a?`${n(e.x+o)},${n(e.y+r/2+i)}`:`${n(e.x+t/2+i)},${n(e.y+o)}`,m=d/f*s,h=u/f*s;return a?(c.labelX=e.x,c.labelY=e.y+r/2+d+4+c.labelH/2):(c.labelX=e.x+t/2+d+4+c.labelW/2,c.labelY=e.y),{d:`M${p(0,-u)}C${p(d,-u*2)} ${p(d,u*2)} ${p(m,u+h)}`,sx:a?e.x-u:e.x+t/2,sy:a?e.y+r/2:e.y-u,sdx:a?0:-1,sdy:a?-1:0,ex:a?e.x+u:e.x+t/2,ey:a?e.y+r/2:e.y+u,edx:a?-u/f:-d/f,edy:a?-d/f:-u/f}}export{W as a,j as c,le as d,M as f,de as i,U as l,N as n,r as o,R as r,ue as s,i as t,G as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as e,V as t,et as n,n as r,o as i,t as a,tt as o,z as s}from"./e2LGvGEb.js";var c=class{constructor(e,t){this.status=e,this.body=typeof t==`string`?{message:t}:t||{message:`Error: ${e}`}}toString(){return JSON.stringify(this.body)}},l=class{constructor(e,t){try{new Headers({location:t})}catch{throw Error(`Invalid redirect location ${JSON.stringify(t)}: this string contains characters that cannot be used in HTTP headers`)}this.status=e,this.location=t}},u=class extends Error{constructor(e,t,n){super(n),this.status=e,this.text=t}};new URL(`sveltekit-internal://`);function d(e,t){return e===`/`||t===`ignore`?e:t===`never`?e.endsWith(`/`)?e.slice(0,-1):e:t===`always`&&!e.endsWith(`/`)?e+`/`:e}function f(e){return e.split(`%25`).map(decodeURI).join(`%25`)}function p(e){for(let t in e)e[t]=decodeURIComponent(e[t]);return e}function m({href:e}){return e.split(`#`)[0]}function ee(e,t,n,r=!1){let i=new URL(e);Object.defineProperty(i,"searchParams",{value:new Proxy(i.searchParams,{get(e,r){if(r===`get`||r===`getAll`||r===`has`)return(t,...i)=>(n(t),e[r](t,...i));t();let i=Reflect.get(e,r);return typeof i==`function`?i.bind(e):i}}),enumerable:!0,configurable:!0});let a=[`href`,`pathname`,`search`,`toString`,`toJSON`];r&&a.push(`hash`);for(let n of a)Object.defineProperty(i,n,{get(){return t(),e[n]},enumerable:!0,configurable:!0});return i}function h(){}function g(...e){let t=5381;for(let n of e)if(typeof n==`string`){let e=n.length;for(;e;)t=t*33^n.charCodeAt(--e)}else if(ArrayBuffer.isView(n)){let e=new Uint8Array(n.buffer,n.byteOffset,n.byteLength),r=e.length;for(;r;)t=t*33^e[--r]}else throw TypeError(`value must be a string or TypedArray`);return(t>>>0).toString(36)}new TextEncoder;function _(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var te=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:t?.method||`GET`)!==`GET`&&v.delete(x(e)),te(e,t));var v=new Map;function y(e,t){let n=x(e,t),r=document.querySelector(n);if(r?.textContent){r.remove();let{body:e,...t}=JSON.parse(r.textContent);r.getAttribute(`data-b64`)!==null&&(e=_(e));let i=r.getAttribute(`data-ttl`);return i&&v.set(n,{body:e,init:t,ttl:1e3*Number(i)}),Promise.resolve(new Response(e,t))}return window.fetch(e,t)}function b(e,t,n){if(v.size>0){let t=x(e,n),r=v.get(t);if(r){if(performance.now()<r.ttl&&[`default`,`force-cache`,`only-if-cached`,void 0].includes(n?.cache))return new Response(r.body,r.init);v.delete(t)}}return window.fetch(t,n)}function x(e,t){let n=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(t?.headers||t?.body){let e=[];t.headers&&e.push([...new Headers(t.headers)].join(`,`)),t.body&&(typeof t.body==`string`||ArrayBuffer.isView(t.body))&&e.push(t.body),n+=`[data-hash="${g(...e)}"]`}return n}var ne=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/,S=/^\/\((?:[^)]+)\)$/;function re(e){let t=[];return{pattern:e===`/`||S.test(e)?/^\/$/:RegExp(`^${ae(e).map(e=>{let n=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(e);if(n)return t.push({name:n[1],matcher:n[2],optional:!1,rest:!0,chained:!0}),`(?:/([^]*))?`;let r=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(e);if(r)return t.push({name:r[1],matcher:r[2],optional:!0,rest:!1,chained:!0}),`(?:/([^/]+))?`;if(!e)return;let i=e.split(/\[(.+?)\](?!\])/);return`/`+i.map((e,n)=>{if(n%2){if(e.startsWith(`x+`))return se(String.fromCharCode(parseInt(e.slice(2),16)));if(e.startsWith(`u+`))return se(String.fromCharCode(...e.slice(2).split(`-`).map(e=>parseInt(e,16))));let[,r,a,o,s]=ne.exec(e);return t.push({name:o,matcher:s,optional:!!r,rest:!!a,chained:a?n===1&&i[0]===``:!1}),a?`([^]*?)`:r?`([^/]*)?`:`([^/]+?)`}return se(e)}).join(``)}).join(``)}/?$`),params:t}}function ie(e){return e!==``&&!/^\([^)]+\)$/.test(e)}function ae(e){return e.slice(1).split(`/`).filter(ie)}function oe(e,t,n){let r={},i=e.slice(1),a=i.filter(e=>e!==void 0),o=0;for(let e=0;e<t.length;e+=1){let s=t[e],c=i[e-o];if(s.chained&&s.rest&&o&&(c=i.slice(e-o,e+1).filter(e=>e).join(`/`),o=0),c===void 0){if(s.rest)c=``;else continue}if(!s.matcher||n[s.matcher](c)){r[s.name]=c;let n=t[e+1],l=i[e+1];n&&!n.rest&&n.optional&&l&&s.chained&&(o=0),!n&&!l&&Object.keys(r).length===a.length&&(o=0)}else if(s.optional&&s.chained)o++;else return}if(!o)return r}function se(e){return e.normalize().replace(/[[\]]/g,`\\$&`).replace(/%/g,`%25`).replace(/\//g,`%2[Ff]`).replace(/\?/g,`%3[Ff]`).replace(/#/g,`%23`).replace(/[.*+?^${}()|\\]/g,`\\$&`)}var ce=/\[(\[)?(\.\.\.)?(\w+?)(?:=(\w+))?\]\]?/g;function le(e,t){let n=ae(e),r=e!=`/`&&e.endsWith(`/`);return`/`+n.map(n=>n.replace(ce,(n,r,i,a)=>{let o=t[a];if(!o){if(r||i&&o!==void 0)return``;throw Error(`Missing parameter '${a}' in route ${e}`)}if(o.startsWith(`/`)||o.endsWith(`/`))throw Error(`Parameter '${a}' in route ${e} cannot start or end with a slash -- this would cause an invalid route like foo//bar`);return o})).filter(Boolean).join(`/`)+(r?`/`:``)}function ue({nodes:e,server_loads:t,dictionary:n,matchers:r}){let i=new Set(t);return Object.entries(n).map(([t,[n,i,s]])=>{let{pattern:c,params:l}=re(t),u={id:t,exec:e=>{let t=c.exec(e);if(t)return oe(t,l,r)},errors:[1,...s||[]].map(t=>e[t]),layouts:[0,...i||[]].map(o),leaf:a(n)};return u.errors.length=u.layouts.length=Math.max(u.errors.length,u.layouts.length),u});function a(t){let n=t<0;return n&&(t=~t),[n,e[t]]}function o(t){return t===void 0?t:[i.has(t),e[t]]}}function de(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function fe(e,t,n=JSON.stringify){let r=n(t);try{sessionStorage[e]=r}catch{}}var C=globalThis.__sveltekit_1k0cxxa?.base??``,pe=globalThis.__sveltekit_1k0cxxa?.assets??C??``;function me(e){return(pe||C)+e}var he=`#`;function ge(...e){if(!e[0].startsWith(`/`))throw Error(`Cannot use \`resolve(...)\` with a non-absolute pathname or route ID (got "${e[0]}"). \`resolve\` is only for internal pathnames and route IDs; external URLs should be used directly.`);return C+he+le(e[0],e[1])}var _e=`1793495447495`,ve=`sveltekit:snapshot`,ye=`sveltekit:scroll`,be=`sveltekit:states`,w=`sveltekit:history`,T=`sveltekit:navigation`,E={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},xe=location.origin;function Se(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){let e=document.getElementsByTagName(`base`);t=e.length?e[0].href:document.URL}return new URL(e,t)}function D(){return{x:pageXOffset,y:pageYOffset}}function O(e,t){return e.getAttribute(`data-sveltekit-${t}`)}var Ce={...E,"":E.hover};function we(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function Te(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()===`A`&&e.hasAttribute(`href`))return e;e=we(e)}}function Ee(e,t,n){let r;try{if(r=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){let e=location.hash.split(`#`)[1]||`/`;r.hash=`#${e}${r.hash}`}}catch{}let i=e instanceof SVGAElement?e.target.baseVal:e.target,a=!r||!!i||je(r,t,n)||(e.getAttribute(`rel`)||``).split(/\s+/).includes(`external`),o=r?.origin===xe&&e.hasAttribute(`download`);return{url:r,external:a,target:i,download:o}}function De(e){let t=null,n=null,r=null,i=null,a=null,o=null,s=e;for(;s&&s!==document.documentElement;)r===null&&(r=O(s,`preload-code`)),i===null&&(i=O(s,`preload-data`)),t===null&&(t=O(s,`keepfocus`)),n===null&&(n=O(s,`noscroll`)),a===null&&(a=O(s,`reload`)),o===null&&(o=O(s,`replacestate`)),s=we(s);function c(e){switch(e){case``:case`true`:return!0;case`off`:case`false`:return!1;default:return}}return{preload_code:Ce[r??`off`],preload_data:Ce[i??`off`],keepfocus:c(t),noscroll:c(n),reload:c(a),replace_state:c(o)}}function Oe(e){let t=i(e),n=!0;function r(){n=!0,t.update(e=>e)}function a(e){n=!1,t.set(e)}function o(e){let r;return t.subscribe(t=>{(r===void 0||n&&t!==r)&&e(r=t)})}return{notify:r,set:a,subscribe:o}}var ke={v:h};function Ae(){let{set:e,subscribe:t}=i(!1),n;async function r(){clearTimeout(n);try{let t=await fetch(`${pe}/_app/version.json`,{headers:{pragma:`no-cache`,"cache-control":`no-cache`}});if(!t.ok)return!1;let r=(await t.json()).version!==_e;return r&&(e(!0),ke.v(),clearTimeout(n)),r}catch{return!1}}return{subscribe:t,check:r}}function je(e,t,n){return e.origin!==xe||!e.pathname.startsWith(t)?!0:n?e.pathname!==location.pathname:!1}function Me(e){}var Ne=new Set([`load`,`prerender`,`csr`,`ssr`,`trailingSlash`,`config`]);[...Ne],[...new Set([...Ne])];function Pe(e){return e.filter(e=>e!=null)}function k(e,t){return e+`/`+t}function Fe(e){return e instanceof c||e instanceof u?e.status:500}function Ie(e){return e instanceof u?e.text:`Internal Error`}var A,j,Le,Re=r.toString().includes(`$$`)||/function \w+\(\) \{\}/.test(r.toString()),ze=`a:`;Re?(A={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL(ze)},j={current:null},Le={current:!1}):(A=new class{#e=o({});get data(){return s(this.#e)}set data(e){n(this.#e,e)}#t=o(null);get form(){return s(this.#t)}set form(e){n(this.#t,e)}#n=o(null);get error(){return s(this.#n)}set error(e){n(this.#n,e)}#r=o({});get params(){return s(this.#r)}set params(e){n(this.#r,e)}#i=o({id:null});get route(){return s(this.#i)}set route(e){n(this.#i,e)}#a=o({});get state(){return s(this.#a)}set state(e){n(this.#a,e)}#o=o(-1);get status(){return s(this.#o)}set status(e){n(this.#o,e)}#s=o(new URL(ze));get url(){return s(this.#s)}set url(e){n(this.#s,e)}},j=new class{#e=o(null);get current(){return s(this.#e)}set current(e){n(this.#e,e)}},Le=new class{#e=o(!1);get current(){return s(this.#e)}set current(e){n(this.#e,e)}},ke.v=()=>Le.current=!0);function Be(e){Object.assign(A,e)}var Ve={spanContext(){return He},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return!1},recordException(){return this},addLink(){return this},addLinks(){return this}},He={traceId:``,spanId:``,traceFlags:0},{onMount:Ue,tick:We}=a,Ge=new Set([`icon`,`shortcut icon`,`apple-touch-icon`]),M=null,N=de(`sveltekit:scroll`)??{},P=de(`sveltekit:snapshot`)??{},F={url:Oe({}),page:Oe({}),navigating:i(null),updated:Ae()};function Ke(e){N[e]=D()}function qe(e,t){let n=e+1;for(;N[n];)delete N[n],n+=1;for(n=t+1;P[n];)delete P[n],n+=1}function I(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(h)}async function Je(){if(`serviceWorker`in navigator){let e=await navigator.serviceWorker.getRegistration(C||`/`);e&&await e.update()}}var Ye,Xe,L,R,Ze,z,Qe={},$e={},B=[],V=[],H=null;function U(){H?.fork?.then(e=>e?.discard()),H=null,Q={element:void 0,href:void 0}}var et=new Map,tt=new Set,nt=new Set,W=new Set,G={branch:[],error:null,url:null,nav:null},rt=!1,it=!1,at=!0,K=!1,q=!1,ot=!1,st=!1,ct,J,Y,X,lt=new Set,ut=new Map,dt=new Map;async function ft(e,t,n){if(globalThis.__sveltekit_1k0cxxa.data){let{q:e={},p:t={},l:n={},f:r={}}=globalThis.__sveltekit_1k0cxxa.data;for(let t in e)Qe[t]=e[t];for(let e in n)Qe[e]=n[e];for(let e in r)Qe[e]=r[e];for(let e in t)$e[e]=t[e]}document.URL!==location.href&&(location.href=location.href),z=e,await e.hooks.init?.(),Ye=ue(e),R=document.documentElement,Ze=t,Xe=e.nodes[0],L=e.nodes[1],Xe(),L(),J=history.state?.[w],Y=history.state?.[T],J||(J=Y=Date.now(),history.replaceState({...history.state,[w]:J,[T]:Y},``));let r=N[J];function i(){r&&(history.scrollRestoration=`manual`,scrollTo(r.x,r.y))}n?(i(),await Vt(Ze,n)):(await Z({type:`enter`,url:Se(z.hash?qt(new URL(location.href)):location.href),replace_state:!0}),i()),Bt()}function pt(){B.length=0,st=!1}function mt(e){V.some(e=>e?.snapshot)&&(P[e]=V.map(e=>e?.snapshot?.capture()))}function ht(e){P[e]?.forEach((e,t)=>{V[t]?.snapshot?.restore(e)})}function gt(){Ke(J),fe(ye,N),mt(Y),fe(ve,P)}async function _t(e,n,r,i){let a,o;n.invalidateAll&&U(),await Z({type:`goto`,url:Se(e),keepfocus:n.keepFocus,noscroll:n.noScroll,replace_state:n.replaceState,state:n.state,redirect_count:r,nav_token:i,accept:()=>{if(n.invalidateAll){st=!0,a=new Set;for(let[e,t]of ut)for(let[n,r]of t)r.resource?.reset(),a.add(k(e,n));o=new Set;for(let[e,t]of dt)for(let n of t.keys())o.add(k(e,n))}n.invalidate&&n.invalidate.forEach(zt)}}),n.invalidateAll&&t().then(t).then(()=>{for(let[e,t]of ut)for(let[n,{resource:r}]of t)a?.has(k(e,n))&&r.start();for(let[e,t]of dt)for(let[n,{resource:r}]of t)o?.has(k(e,n))&&r.reconnect()})}async function vt(e){if(e.id!==H?.id){U();let t={};lt.add(t),H={id:e.id,token:t,promise:Ot({...e,preload:t}).then(e=>(lt.delete(t),e.type===`loaded`&&e.state.error&&U(),e)),fork:null}}return H.promise}async function yt(e){let t=(await Mt(e,!1))?.route;t&&await Promise.all([...t.layouts,t.leaf].filter(Boolean).map(e=>e[1]()))}async function bt(e,t,n){let r={params:G.params,route:{id:G.route?.id??null},url:new URL(location.href)};if(G={...e.state,nav:r},Be(e.props.page),ct=new z.root({target:t,props:{...e.props,stores:F,components:V},hydrate:n,sync:!1,transformError:void 0}),await Promise.resolve(),n){let e={from:null,to:{...r,scroll:N[J]??D()},willUnload:!1,type:`enter`,complete:Promise.resolve()};W.forEach(t=>t(e))}ht(Y),it=!0}async function xt({url:e,params:t,branch:n,errors:r,status:i,error:a,route:o,form:s}){let c=`never`;if(C&&(e.pathname===C||e.pathname===C+`/`))c=`always`;else for(let e of n)e?.slash!==void 0&&(c=e.slash);e.pathname=d(e.pathname,c),e.search=e.search;let l={type:`loaded`,state:{url:e,params:t,branch:n,error:a,route:o},props:{constructors:Pe(n).map(e=>e.node.component),page:Kt(A)}};s!==void 0&&(l.props.form=s);let u={},f=!A,p=0;for(let e=0;e<Math.max(n.length,G.branch.length);e+=1){let t=n[e],r=G.branch[e];t?.data!==r?.data&&(f=!0),t&&(u={...u,...t.data},f&&(l.props[`data_${p}`]=u),p+=1)}return(!G.url||e.href!==G.url.href||G.error!==a||s!==void 0&&s!==A.form||f)&&(l.props.page={error:a,params:t,route:{id:o?.id??null},state:{},status:i,url:new URL(e),form:s??null,data:f?u:A.data}),l}async function St({loader:e,parent:t,url:n,params:r,route:i,server_data_node:a}){let o=null,s=!0,c={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},l=await e();if(l.universal?.load){function e(...e){for(let t of e){let{href:e}=new URL(t,n);c.dependencies.add(e)}}let u={tracing:{enabled:!1,root:Ve,current:Ve},route:new Proxy(i,{get:(e,t)=>(s&&(c.route=!0),e[t])}),params:new Proxy(r,{get:(e,t)=>(s&&c.params.add(t),e[t])}),data:a?.data??null,url:ee(n,()=>{s&&(c.url=!0)},e=>{s&&c.search_params.add(e)},z.hash),async fetch(t,r){t instanceof Request&&(r={body:t.method===`GET`||t.method===`HEAD`?void 0:await t.blob(),cache:t.cache,credentials:t.credentials,headers:[...t.headers].length>0?t?.headers:void 0,integrity:t.integrity,keepalive:t.keepalive,method:t.method,mode:t.mode,redirect:t.redirect,referrer:t.referrer,referrerPolicy:t.referrerPolicy,signal:t.signal,...r});let{resolved:i,promise:a}=Ct(t,r,n);return s&&e(i.href),a},setHeaders:h,depends:e,parent(){return s&&(c.parent=!0),t()},untrack(e){s=!1;try{return e()}finally{s=!0}}};o=await l.universal.load.call(null,u)??null}return{node:l,loader:e,server:a,universal:l.universal?.load?{type:`data`,data:o,uses:c}:null,data:o??a?.data??null,slash:l.universal?.trailingSlash??a?.slash}}function Ct(e,t,n){let r=e instanceof Request?e.url:e,i=new URL(r,n);return i.origin===n.origin&&(r=i.href.slice(n.origin.length)),{resolved:i,promise:it?b(r,i.href,t):y(r,t)}}function wt(e,t,n,r,i,a){if(st)return!0;if(!i)return!1;if(i.parent&&e||i.route&&t||i.url&&n)return!0;for(let e of i.search_params)if(r.has(e))return!0;for(let e of i.params)if(a[e]!==G.params[e])return!0;for(let e of i.dependencies)if(B.some(t=>t(new URL(e))))return!0;return!1}function Tt(e,t){return e?.type===`data`?e:e?.type===`skip`?t??null:null}function Et(e,t){if(!e)return new Set(t.searchParams.keys());let n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(let r of n){let i=e.searchParams.getAll(r),a=t.searchParams.getAll(r);i.every(e=>a.includes(e))&&a.every(e=>i.includes(e))&&n.delete(r)}return n}function Dt({error:e,url:t,route:n,params:r}){return{type:`loaded`,state:{error:e,url:t,route:n,params:r,branch:[]},props:{page:Kt(A),constructors:[]}}}async function Ot({id:e,invalidating:t,url:n,params:r,route:i,preload:a}){if(H?.id===e)return lt.delete(H.token),H.promise;let{errors:o,layouts:s,leaf:u}=i,d=[...s,u];o.forEach(e=>e?.().catch(h)),d.forEach(e=>e?.[1]().catch(h));let f=G.url?e!==Pt(G.url):!1,p=G.route?i.id!==G.route.id:!1,m=Et(G.url,n),ee=!1,g=d.map(async(e,t)=>{if(!e)return;let a=G.branch[t];return e[1]===a?.loader&&!wt(ee,p,f,m,a.universal?.uses,r)?a:(ee=!0,St({loader:e[1],url:n,params:r,route:i,parent:async()=>{let e={};for(let n=0;n<t;n+=1)Object.assign(e,(await g[n])?.data);return e},server_data_node:Tt(e[0]?{type:`skip`}:null,e[0]?a?.server:void 0)}))});for(let e of g)e.catch(h);let _=[];for(let e=0;e<d.length;e+=1)if(d[e])try{_.push(await g[e])}catch(t){if(t instanceof l)return{type:`redirect`,location:t.location};if(a&<.has(a))return Dt({error:await $(t,{params:r,url:n,route:{id:i.id}}),url:n,params:r,route:i});let s=Fe(t),u;if(t instanceof c)u=t.body;else{if(await F.updated.check())return await Je(),await I(n);u=await $(t,{params:r,url:n,route:{id:i.id}})}let d=await kt(e,_,o);return d?xt({url:n,params:r,branch:_.slice(0,d.idx).concat(d.node),errors:o,status:s,error:u,route:i}):await It(n,{id:i.id},u,s)}else _.push(void 0);return xt({url:n,params:r,branch:_,errors:o,status:200,error:null,route:i,form:t?void 0:null})}async function kt(e,t,n){for(;e--;)if(n[e]){let r=e;for(;!t[r];)--r;try{return{idx:r+1,node:{node:await n[e](),loader:n[e],data:{},server:null,universal:null}}}catch{continue}}}async function At({status:e,error:t,url:n,route:r}){let i={};try{return xt({url:n,params:i,branch:[await St({loader:Xe,url:n,params:i,route:r,parent:()=>Promise.resolve({}),server_data_node:Tt(null)}),{node:await L(),loader:L,universal:null,server:null,data:null}],status:e,error:t,errors:[],route:null})}catch(t){if(t instanceof l){await _t(new URL(t.location,location.href),{},0);return}let a=await z.get_error_template(),o=await $(t,{url:n,params:i,route:r}),s=a({status:e,message:String(o?.message??``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}),c=new DOMParser().parseFromString(s,`text/html`);throw document.documentElement.replaceChild(document.adoptNode(c.head),document.head),document.documentElement.replaceChild(document.adoptNode(c.body),document.body),t}}async function jt(e){let t=e.href;if(et.has(t))return et.get(t);let n;try{let r=(async()=>{let t=await z.hooks.reroute({url:new URL(e),fetch:async(t,n)=>Ct(t,n,e).promise})??e;if(typeof t==`string`){let n=new URL(e);z.hash?n.hash=t:n.pathname=t,t=n}return t})();et.set(t,r),n=await r}catch{et.delete(t);return}return n}async function Mt(e,t){if(e&&!je(e,C,z.hash)){let n=await jt(e);if(!n)return;let r=Nt(n);for(let n of Ye){let i=n.exec(r);if(i)return{id:Pt(e),invalidating:t,route:n,params:p(i),url:e}}}}function Nt(e){return f(z.hash?e.hash.replace(/^#/,``).replace(/[?#].+/,``):e.pathname.slice(C.length))||`/`}function Pt(e){return(z.hash?e.hash.replace(/^#/,``):e.pathname)+e.search}function Ft({url:e,type:t,intent:n,delta:r,event:i,scroll:a}){let o=!1,s=Gt(G,n,e,t,a??null);r!==void 0&&(s.navigation.delta=r),i!==void 0&&(s.navigation.event=i);let c={...s.navigation,cancel:()=>{o=!0,s.reject(Error(`navigation cancelled`))}};return K||tt.forEach(e=>e(c)),o?null:s}async function Z({type:n,url:r,popped:i,keepfocus:a,noscroll:o,replace_state:s,state:c={},redirect_count:l=0,nav_token:d={},accept:f=h,block:p=h,event:m}){let ee=X;X=d;let g=await Mt(r,!1),_=n===`enter`?Gt(G,g,r,n):Ft({url:r,type:n,delta:i?.delta,intent:g,scroll:i?.scroll,event:m});if(!_){p(),X===d&&(X=ee);return}let te=J,v=Y;f(),K=!0,it&&_.navigation.type!==`enter`&&F.navigating.set(j.current=_.navigation);let y=g&&await Ot(g);if(!y){if(je(r,C,z.hash))return await I(r,s);y=await It(r,{id:null},await $(new u(404,`Not Found`,`Not found: ${r.pathname}`),{url:r,params:{},route:{id:null}}),404,s)}if(r=g?.url||r,X!==d){_.reject(Error(`navigation aborted`));return}if(!y)return;if(y.type===`redirect`){if(l<20){await Z({type:n,url:new URL(y.location,r),popped:i,keepfocus:a,noscroll:o,replace_state:s,state:c,redirect_count:l+1,nav_token:d}),_.fulfil(void 0);return}if(y=await At({status:500,error:await $(Error(`Redirect loop`),{url:r,params:{},route:{id:null}}),url:r,route:{id:null}}),!y)return}else if(y.props.page.status>=400&&await F.updated.check())return await Je(),await I(r,s);if(pt(),Ke(te),mt(v),y.props.page.url.pathname!==r.pathname&&(r.pathname=y.props.page.url.pathname),c=i?i.state:c,!i){let e=+!s,t={[w]:J+=e,[T]:Y+=e,[be]:c};(s?history.replaceState:history.pushState).call(history,t,``,r),s||qe(J,Y)}let b=g&&H?.id===g.id?H.fork:null;H?.fork&&!b?U():(H=null,Q={element:void 0,href:void 0}),y.props.page.state=c;let x;if(it){let t=(await Promise.all(Array.from(nt,e=>e(_.navigation)))).filter(e=>typeof e==`function`);if(t.length>0){function e(){t.forEach(e=>{W.delete(e)})}t.push(e),t.forEach(e=>{W.add(e)})}let n=_.navigation.to;G={...y.state,nav:{params:n.params,route:n.route,url:n.url}},y.props.page&&(y.props.page.url=r),!a&&document.activeElement instanceof HTMLElement&&document.activeElement!==document.body&&document.activeElement.blur();let i=b&&await b;i?x=i.commit():(M=null,ct.$set(y.props),M&&Object.assign(y.props.page,M),Be(y.props.page),x=e?.()),ot=!0}else await bt(y,Ze,!1);let{activeElement:ne}=document;if(await x,await t(),await t(),X!==d){_.reject(Error(`navigation aborted`));return}y.props.page&&M&&Object.assign(y.props.page,M);let S=null;if(at){let e=i?i.scroll:o?D():null;e?scrollTo(e.x,e.y):(S=r.hash&&document.getElementById(Jt(r)))?S.scrollIntoView():scrollTo(0,0)}let re=document.activeElement!==ne&&document.activeElement!==document.body;!a&&!re&&Wt(r,!S),at=!0,K=!1,_.fulfil(void 0),_.navigation.to&&(_.navigation.to.scroll=D()),W.forEach(e=>e(_.navigation)),n===`popstate`&&ht(Y),F.navigating.set(j.current=null)}async function It(e,t,n,r,i){return e.origin===xe&&e.pathname===location.pathname&&!rt?await At({status:r,error:n,url:e,route:t}):await I(e,i)}var Q={element:void 0,href:void 0};function Lt(){let e,t;R.addEventListener(`mousemove`,t=>{let n=t.target;clearTimeout(e),e=setTimeout(()=>{i(n,E.hover)},20)});function n(e){e.defaultPrevented||i(e.composedPath()[0],E.tap)}R.addEventListener(`mousedown`,n),R.addEventListener(`touchstart`,n,{passive:!0});let r=new IntersectionObserver(e=>{for(let t of e)t.isIntersecting&&(yt(new URL(t.target.href)),r.unobserve(t.target))},{threshold:0});async function i(e,n){let r=Te(e,R),i=r===Q.element&&r?.href===Q.href&&n>=t;if(!r||i)return;let{url:a,external:o,download:s}=Ee(r,C,z.hash);if(o||s)return;let c=De(r),l=a&&Pt(G.url)===Pt(a);if(!(c.reload||l)){if(n<=c.preload_data){Q={element:r,href:r.href},t=E.tap;let e=await Mt(a,!1);if(!e)return;vt(e)}else n<=c.preload_code&&(Q={element:r,href:r.href},t=n,yt(a))}}function a(){r.disconnect();for(let e of R.querySelectorAll(`a`)){let{url:t,external:n,download:i}=Ee(e,C,z.hash);if(n||i)continue;let a=De(e);a.reload||(a.preload_code===E.viewport&&r.observe(e),a.preload_code===E.eager&&yt(t))}}W.add(a),a()}function $(e,t){if(e instanceof c)return e.body;let n=Fe(e),r=Ie(e);return z.hooks.handleError({error:e,event:t,status:n,message:r})??{message:r}}function Rt(e,t={}){return e=new URL(Se(e)),e.origin===xe?_t(e,t,0):Promise.reject(Error(`goto: invalid URL`))}function zt(e){if(typeof e==`function`)B.push(e);else{let{href:t}=new URL(e,location.href);B.push(e=>e.href===t)}}function Bt(){history.scrollRestoration=`manual`,addEventListener(`beforeunload`,e=>{let t=!1;if(gt(),!K){let e=Gt(G,void 0,null,`leave`),n={...e.navigation,cancel:()=>{t=!0,e.reject(Error(`navigation cancelled`))}};tt.forEach(e=>e(n))}t?(e.preventDefault(),e.returnValue=``):history.scrollRestoration=`auto`}),addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&>()}),navigator.connection?.saveData||Lt(),R.addEventListener(`click`,async t=>{if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;let n=Te(t.composedPath()[0],R);if(!n)return;let{url:r,external:i,target:a,download:o}=Ee(n,C,z.hash);if(!r)return;if(a===`_parent`||a===`_top`){if(window.parent!==window)return}else if(a&&a!==`_self`)return;let s=De(n);if(!(n instanceof SVGAElement)&&r.protocol!==location.protocol&&r.protocol!==`https:`&&r.protocol!==`http:`||o)return;let[c,l]=(z.hash?r.hash.replace(/^#/,``):r.href).split(`#`),u=c===m(location);if(i||s.reload&&(!u||!l))Ft({url:r,type:`link`,event:t})?K=!0:t.preventDefault();else{if(l!==void 0&&u){let[,i]=G.url.href.split(`#`);if(i===l){if(t.preventDefault(),l===``||l===`top`&&n.ownerDocument.getElementById(`top`)===null)scrollTo({top:0});else{let e=n.ownerDocument.getElementById(decodeURIComponent(l));e&&(e.scrollIntoView(),e.focus())}return}if(q=!0,Ke(J),e(r),!s.replace_state)return;q=!1}t.preventDefault(),await new Promise(e=>{requestAnimationFrame(()=>{setTimeout(e,0)}),setTimeout(e,100)}),await Z({type:`link`,url:r,keepfocus:s.keepfocus,noscroll:s.noscroll,replace_state:s.replace_state??r.href===location.href,event:t})}}),R.addEventListener(`submit`,e=>{if(e.defaultPrevented)return;let t=HTMLFormElement.prototype.cloneNode.call(e.target),n=e.submitter;if((n?.formTarget||t.target)===`_blank`||(n?.formMethod||t.method)!==`get`)return;let r=new URL(n?.hasAttribute(`formaction`)&&n?.formAction||t.action);if(je(r,C,!1))return;let i=e.target,a=De(i);if(a.reload)return;e.preventDefault(),e.stopPropagation();let o=new FormData(i,n);r.search=new URLSearchParams(o).toString(),Z({type:`form`,url:r,keepfocus:a.keepfocus,noscroll:a.noscroll,replace_state:a.replace_state??r.href===location.href,event:e})}),addEventListener(`popstate`,async t=>{if(!Ut){if(t.state?.[`sveltekit:history`]){let n=t.state[w];if(X={},n===J)return;let r=N[n],i=t.state[`sveltekit:states`]??{},a=new URL(t.state[`sveltekit:pageurl`]??location.href),o=t.state[T],s=G.url?m(location)===m(G.url):!1;if(o===Y&&(ot||s)){i!==A.state&&(A.state=i),e(a),N[J]=D(),r&&scrollTo(r.x,r.y),J=n;return}let c=n-J;await Z({type:`popstate`,url:a,popped:{state:i,scroll:r,delta:c},accept:()=>{J=n,Y=o},block:()=>{history.go(-c)},nav_token:X,event:t})}else q||(e(new URL(location.href)),z.hash&&location.reload())}}),addEventListener(`hashchange`,()=>{q&&(q=!1,history.replaceState({...history.state,[w]:++J,[T]:Y},``,location.href))});for(let e of document.querySelectorAll(`link`))Ge.has(e.rel)&&(e.href=e.href);addEventListener(`pageshow`,e=>{e.persisted&&F.navigating.set(j.current=null)});function e(e){G.url=A.url=e,F.page.set(Kt(A)),F.page.notify()}}async function Vt(e,{status:t=200,error:n,node_ids:r,params:i,route:a,server_route:o,data:s,form:c}){rt=!0;let u=new URL(location.href),d;({params:i={},route:a={id:null}}=await Mt(u,!1)||{}),d=Ye.find(({id:e})=>e===a.id);let f,p=!0;try{let e=r.map(async(t,n)=>{let r=s[n];return r?.uses&&(r.uses=Ht(r.uses)),St({loader:z.nodes[t],url:u,params:i,route:a,parent:async()=>{let t={};for(let r=0;r<n;r+=1)Object.assign(t,(await e[r]).data);return t},server_data_node:Tt(r)})}),o=await Promise.all(e);if(d){let e=d.layouts;for(let t=0;t<e.length;t++)e[t]||o.splice(t,0,void 0)}f=await xt({url:u,params:i,branch:o,status:t,error:n,errors:d?.errors,form:c,route:d??null})}catch(t){if(t instanceof l)return await I(new URL(t.location,location.href));f=await At({status:Fe(t),error:await $(t,{url:u,params:i,route:a}),url:u,route:a}),e.textContent=``,p=!1}f&&(f.props.page&&(f.props.page.state={}),await bt(f,e,p))}function Ht(e){return{dependencies:new Set(e?.dependencies??[]),params:new Set(e?.params??[]),parent:!!e?.parent,route:!!e?.route,url:!!e?.url,search_params:new Set(e?.search_params??[])}}var Ut=!1;function Wt(e,t=!0){let n=document.querySelector(`[autofocus]`);if(n)n.focus();else{let n=Jt(e);if(n&&document.getElementById(n)){let{x:r,y:i}=D();setTimeout(()=>{let a=history.state;Ut=!0,location.replace(new URL(`#${n}`,location.href)),history.replaceState(a,``,e),t&&scrollTo(r,i),Ut=!1})}else{let e=document.body,t=e.getAttribute(`tabindex`);e.tabIndex=-1,e.focus({preventScroll:!0,focusVisible:!1}),t===null?e.removeAttribute(`tabindex`):e.setAttribute(`tabindex`,t)}let r=getSelection();if(r&&r.type!==`None`){let e=[];for(let t=0;t<r.rangeCount;t+=1)e.push(r.getRangeAt(t));setTimeout(()=>{if(r.rangeCount===e.length){for(let t=0;t<r.rangeCount;t+=1){let n=e[t],i=r.getRangeAt(t);if(n.commonAncestorContainer!==i.commonAncestorContainer||n.startContainer!==i.startContainer||n.endContainer!==i.endContainer||n.startOffset!==i.startOffset||n.endOffset!==i.endOffset)return}r.removeAllRanges()}})}}}function Gt(e,t,n,r,i=null){let a,o,s=new Promise((e,t)=>{a=e,o=t});return s.catch(h),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url,scroll:D()},to:n&&{params:t?.params??null,route:{id:t?.route?.id??null},url:n,scroll:i},willUnload:!t,type:r,complete:s},fulfil:a,reject:o}}function Kt(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function qt(e){let t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function Jt(e){let t;if(z.hash){let[,,n]=e.hash.split(`#`,3);t=n??``}else t=e.hash.slice(1);return decodeURIComponent(t)}export{Me as a,A as i,ft as n,me as o,j as r,ge as s,Rt as t};
|
|
1
|
+
import{H as e,U as t,V as n,n as r,nt as i,o as a,rt as o,t as s}from"./AnnzTlE8.js";var c=class{constructor(e,t){this.status=e,this.body=typeof t==`string`?{message:t}:t||{message:`Error: ${e}`}}toString(){return JSON.stringify(this.body)}},l=class{constructor(e,t){try{new Headers({location:t})}catch{throw Error(`Invalid redirect location ${JSON.stringify(t)}: this string contains characters that cannot be used in HTTP headers`)}this.status=e,this.location=t}},u=class extends Error{constructor(e,t,n){super(n),this.status=e,this.text=t}};new URL(`sveltekit-internal://`);function d(e,t){return e===`/`||t===`ignore`?e:t===`never`?e.endsWith(`/`)?e.slice(0,-1):e:t===`always`&&!e.endsWith(`/`)?e+`/`:e}function f(e){return e.split(`%25`).map(decodeURI).join(`%25`)}function p(e){for(let t in e)e[t]=decodeURIComponent(e[t]);return e}function m({href:e}){return e.split(`#`)[0]}function ee(e,t,n,r=!1){let i=new URL(e);Object.defineProperty(i,"searchParams",{value:new Proxy(i.searchParams,{get(e,r){if(r===`get`||r===`getAll`||r===`has`)return(t,...i)=>(n(t),e[r](t,...i));t();let i=Reflect.get(e,r);return typeof i==`function`?i.bind(e):i}}),enumerable:!0,configurable:!0});let a=[`href`,`pathname`,`search`,`toString`,`toJSON`];r&&a.push(`hash`);for(let n of a)Object.defineProperty(i,n,{get(){return t(),e[n]},enumerable:!0,configurable:!0});return i}function h(){}function g(...e){let t=5381;for(let n of e)if(typeof n==`string`){let e=n.length;for(;e;)t=t*33^n.charCodeAt(--e)}else if(ArrayBuffer.isView(n)){let e=new Uint8Array(n.buffer,n.byteOffset,n.byteLength),r=e.length;for(;r;)t=t*33^e[--r]}else throw TypeError(`value must be a string or TypedArray`);return(t>>>0).toString(36)}new TextEncoder;function _(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var te=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:t?.method||`GET`)!==`GET`&&v.delete(x(e)),te(e,t));var v=new Map;function y(e,t){let n=x(e,t),r=document.querySelector(n);if(r?.textContent){r.remove();let{body:e,...t}=JSON.parse(r.textContent);r.getAttribute(`data-b64`)!==null&&(e=_(e));let i=r.getAttribute(`data-ttl`);return i&&v.set(n,{body:e,init:t,ttl:1e3*Number(i)}),Promise.resolve(new Response(e,t))}return window.fetch(e,t)}function b(e,t,n){if(v.size>0){let t=x(e,n),r=v.get(t);if(r){if(performance.now()<r.ttl&&[`default`,`force-cache`,`only-if-cached`,void 0].includes(n?.cache))return new Response(r.body,r.init);v.delete(t)}}return window.fetch(t,n)}function x(e,t){let n=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(t?.headers||t?.body){let e=[];t.headers&&e.push([...new Headers(t.headers)].join(`,`)),t.body&&(typeof t.body==`string`||ArrayBuffer.isView(t.body))&&e.push(t.body),n+=`[data-hash="${g(...e)}"]`}return n}var ne=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/,S=/^\/\((?:[^)]+)\)$/;function re(e){let t=[];return{pattern:e===`/`||S.test(e)?/^\/$/:RegExp(`^${ae(e).map(e=>{let n=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(e);if(n)return t.push({name:n[1],matcher:n[2],optional:!1,rest:!0,chained:!0}),`(?:/([^]*))?`;let r=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(e);if(r)return t.push({name:r[1],matcher:r[2],optional:!0,rest:!1,chained:!0}),`(?:/([^/]+))?`;if(!e)return;let i=e.split(/\[(.+?)\](?!\])/);return`/`+i.map((e,n)=>{if(n%2){if(e.startsWith(`x+`))return se(String.fromCharCode(parseInt(e.slice(2),16)));if(e.startsWith(`u+`))return se(String.fromCharCode(...e.slice(2).split(`-`).map(e=>parseInt(e,16))));let[,r,a,o,s]=ne.exec(e);return t.push({name:o,matcher:s,optional:!!r,rest:!!a,chained:a?n===1&&i[0]===``:!1}),a?`([^]*?)`:r?`([^/]*)?`:`([^/]+?)`}return se(e)}).join(``)}).join(``)}/?$`),params:t}}function ie(e){return e!==``&&!/^\([^)]+\)$/.test(e)}function ae(e){return e.slice(1).split(`/`).filter(ie)}function oe(e,t,n){let r={},i=e.slice(1),a=i.filter(e=>e!==void 0),o=0;for(let e=0;e<t.length;e+=1){let s=t[e],c=i[e-o];if(s.chained&&s.rest&&o&&(c=i.slice(e-o,e+1).filter(e=>e).join(`/`),o=0),c===void 0){if(s.rest)c=``;else continue}if(!s.matcher||n[s.matcher](c)){r[s.name]=c;let n=t[e+1],l=i[e+1];n&&!n.rest&&n.optional&&l&&s.chained&&(o=0),!n&&!l&&Object.keys(r).length===a.length&&(o=0)}else if(s.optional&&s.chained)o++;else return}if(!o)return r}function se(e){return e.normalize().replace(/[[\]]/g,`\\$&`).replace(/%/g,`%25`).replace(/\//g,`%2[Ff]`).replace(/\?/g,`%3[Ff]`).replace(/#/g,`%23`).replace(/[.*+?^${}()|\\]/g,`\\$&`)}var ce=/\[(\[)?(\.\.\.)?(\w+?)(?:=(\w+))?\]\]?/g;function le(e,t){let n=ae(e),r=e!=`/`&&e.endsWith(`/`);return`/`+n.map(n=>n.replace(ce,(n,r,i,a)=>{let o=t[a];if(!o){if(r||i&&o!==void 0)return``;throw Error(`Missing parameter '${a}' in route ${e}`)}if(o.startsWith(`/`)||o.endsWith(`/`))throw Error(`Parameter '${a}' in route ${e} cannot start or end with a slash -- this would cause an invalid route like foo//bar`);return o})).filter(Boolean).join(`/`)+(r?`/`:``)}function ue({nodes:e,server_loads:t,dictionary:n,matchers:r}){let i=new Set(t);return Object.entries(n).map(([t,[n,i,s]])=>{let{pattern:c,params:l}=re(t),u={id:t,exec:e=>{let t=c.exec(e);if(t)return oe(t,l,r)},errors:[1,...s||[]].map(t=>e[t]),layouts:[0,...i||[]].map(o),leaf:a(n)};return u.errors.length=u.layouts.length=Math.max(u.errors.length,u.layouts.length),u});function a(t){let n=t<0;return n&&(t=~t),[n,e[t]]}function o(t){return t===void 0?t:[i.has(t),e[t]]}}function de(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function fe(e,t,n=JSON.stringify){let r=n(t);try{sessionStorage[e]=r}catch{}}var C=globalThis.__sveltekit_1gufo37?.base??``,pe=globalThis.__sveltekit_1gufo37?.assets??C??``;function me(e){return(pe||C)+e}var he=`#`;function ge(...e){if(!e[0].startsWith(`/`))throw Error(`Cannot use \`resolve(...)\` with a non-absolute pathname or route ID (got "${e[0]}"). \`resolve\` is only for internal pathnames and route IDs; external URLs should be used directly.`);return C+he+le(e[0],e[1])}var _e=`1793591549429`,ve=`sveltekit:snapshot`,ye=`sveltekit:scroll`,be=`sveltekit:states`,w=`sveltekit:history`,T=`sveltekit:navigation`,E={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},xe=location.origin;function Se(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){let e=document.getElementsByTagName(`base`);t=e.length?e[0].href:document.URL}return new URL(e,t)}function D(){return{x:pageXOffset,y:pageYOffset}}function O(e,t){return e.getAttribute(`data-sveltekit-${t}`)}var Ce={...E,"":E.hover};function we(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function Te(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()===`A`&&e.hasAttribute(`href`))return e;e=we(e)}}function Ee(e,t,n){let r;try{if(r=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){let e=location.hash.split(`#`)[1]||`/`;r.hash=`#${e}${r.hash}`}}catch{}let i=e instanceof SVGAElement?e.target.baseVal:e.target,a=!r||!!i||je(r,t,n)||(e.getAttribute(`rel`)||``).split(/\s+/).includes(`external`),o=r?.origin===xe&&e.hasAttribute(`download`);return{url:r,external:a,target:i,download:o}}function De(e){let t=null,n=null,r=null,i=null,a=null,o=null,s=e;for(;s&&s!==document.documentElement;)r===null&&(r=O(s,`preload-code`)),i===null&&(i=O(s,`preload-data`)),t===null&&(t=O(s,`keepfocus`)),n===null&&(n=O(s,`noscroll`)),a===null&&(a=O(s,`reload`)),o===null&&(o=O(s,`replacestate`)),s=we(s);function c(e){switch(e){case``:case`true`:return!0;case`off`:case`false`:return!1;default:return}}return{preload_code:Ce[r??`off`],preload_data:Ce[i??`off`],keepfocus:c(t),noscroll:c(n),reload:c(a),replace_state:c(o)}}function Oe(e){let t=a(e),n=!0;function r(){n=!0,t.update(e=>e)}function i(e){n=!1,t.set(e)}function o(e){let r;return t.subscribe(t=>{(r===void 0||n&&t!==r)&&e(r=t)})}return{notify:r,set:i,subscribe:o}}var ke={v:h};function Ae(){let{set:e,subscribe:t}=a(!1),n;async function r(){clearTimeout(n);try{let t=await fetch(`${pe}/_app/version.json`,{headers:{pragma:`no-cache`,"cache-control":`no-cache`}});if(!t.ok)return!1;let r=(await t.json()).version!==_e;return r&&(e(!0),ke.v(),clearTimeout(n)),r}catch{return!1}}return{subscribe:t,check:r}}function je(e,t,n){return e.origin!==xe||!e.pathname.startsWith(t)?!0:n?e.pathname!==location.pathname:!1}function Me(e){}var Ne=new Set([`load`,`prerender`,`csr`,`ssr`,`trailingSlash`,`config`]);[...Ne],[...new Set([...Ne])];function Pe(e){return e.filter(e=>e!=null)}function k(e,t){return e+`/`+t}function Fe(e){return e instanceof c||e instanceof u?e.status:500}function Ie(e){return e instanceof u?e.text:`Internal Error`}var A,j,Le,Re=r.toString().includes(`$$`)||/function \w+\(\) \{\}/.test(r.toString()),ze=`a:`;Re?(A={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL(ze)},j={current:null},Le={current:!1}):(A=new class{#e=o({});get data(){return n(this.#e)}set data(e){i(this.#e,e)}#t=o(null);get form(){return n(this.#t)}set form(e){i(this.#t,e)}#n=o(null);get error(){return n(this.#n)}set error(e){i(this.#n,e)}#r=o({});get params(){return n(this.#r)}set params(e){i(this.#r,e)}#i=o({id:null});get route(){return n(this.#i)}set route(e){i(this.#i,e)}#a=o({});get state(){return n(this.#a)}set state(e){i(this.#a,e)}#o=o(-1);get status(){return n(this.#o)}set status(e){i(this.#o,e)}#s=o(new URL(ze));get url(){return n(this.#s)}set url(e){i(this.#s,e)}},j=new class{#e=o(null);get current(){return n(this.#e)}set current(e){i(this.#e,e)}},Le=new class{#e=o(!1);get current(){return n(this.#e)}set current(e){i(this.#e,e)}},ke.v=()=>Le.current=!0);function Be(e){Object.assign(A,e)}var Ve={spanContext(){return He},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return!1},recordException(){return this},addLink(){return this},addLinks(){return this}},He={traceId:``,spanId:``,traceFlags:0},{onMount:Ue,tick:We}=s,Ge=new Set([`icon`,`shortcut icon`,`apple-touch-icon`]),M=null,N=de(`sveltekit:scroll`)??{},P=de(`sveltekit:snapshot`)??{},F={url:Oe({}),page:Oe({}),navigating:a(null),updated:Ae()};function Ke(e){N[e]=D()}function qe(e,t){let n=e+1;for(;N[n];)delete N[n],n+=1;for(n=t+1;P[n];)delete P[n],n+=1}function I(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(h)}async function Je(){if(`serviceWorker`in navigator){let e=await navigator.serviceWorker.getRegistration(C||`/`);e&&await e.update()}}var Ye,Xe,L,R,Ze,z,Qe={},$e={},B=[],V=[],H=null;function U(){H?.fork?.then(e=>e?.discard()),H=null,Q={element:void 0,href:void 0}}var et=new Map,tt=new Set,nt=new Set,W=new Set,G={branch:[],error:null,url:null,nav:null},rt=!1,it=!1,at=!0,K=!1,q=!1,ot=!1,st=!1,ct,J,Y,X,lt=new Set,ut=new Map,dt=new Map;async function ft(e,t,n){if(globalThis.__sveltekit_1gufo37.data){let{q:e={},p:t={},l:n={},f:r={}}=globalThis.__sveltekit_1gufo37.data;for(let t in e)Qe[t]=e[t];for(let e in n)Qe[e]=n[e];for(let e in r)Qe[e]=r[e];for(let e in t)$e[e]=t[e]}document.URL!==location.href&&(location.href=location.href),z=e,await e.hooks.init?.(),Ye=ue(e),R=document.documentElement,Ze=t,Xe=e.nodes[0],L=e.nodes[1],Xe(),L(),J=history.state?.[w],Y=history.state?.[T],J||(J=Y=Date.now(),history.replaceState({...history.state,[w]:J,[T]:Y},``));let r=N[J];function i(){r&&(history.scrollRestoration=`manual`,scrollTo(r.x,r.y))}n?(i(),await Vt(Ze,n)):(await Z({type:`enter`,url:Se(z.hash?qt(new URL(location.href)):location.href),replace_state:!0}),i()),Bt()}function pt(){B.length=0,st=!1}function mt(e){V.some(e=>e?.snapshot)&&(P[e]=V.map(e=>e?.snapshot?.capture()))}function ht(e){P[e]?.forEach((e,t)=>{V[t]?.snapshot?.restore(e)})}function gt(){Ke(J),fe(ye,N),mt(Y),fe(ve,P)}async function _t(e,n,r,i){let a,o;n.invalidateAll&&U(),await Z({type:`goto`,url:Se(e),keepfocus:n.keepFocus,noscroll:n.noScroll,replace_state:n.replaceState,state:n.state,redirect_count:r,nav_token:i,accept:()=>{if(n.invalidateAll){st=!0,a=new Set;for(let[e,t]of ut)for(let[n,r]of t)r.resource?.reset(),a.add(k(e,n));o=new Set;for(let[e,t]of dt)for(let n of t.keys())o.add(k(e,n))}n.invalidate&&n.invalidate.forEach(zt)}}),n.invalidateAll&&t().then(t).then(()=>{for(let[e,t]of ut)for(let[n,{resource:r}]of t)a?.has(k(e,n))&&r.start();for(let[e,t]of dt)for(let[n,{resource:r}]of t)o?.has(k(e,n))&&r.reconnect()})}async function vt(e){if(e.id!==H?.id){U();let t={};lt.add(t),H={id:e.id,token:t,promise:Ot({...e,preload:t}).then(e=>(lt.delete(t),e.type===`loaded`&&e.state.error&&U(),e)),fork:null}}return H.promise}async function yt(e){let t=(await Mt(e,!1))?.route;t&&await Promise.all([...t.layouts,t.leaf].filter(Boolean).map(e=>e[1]()))}async function bt(e,t,n){let r={params:G.params,route:{id:G.route?.id??null},url:new URL(location.href)};if(G={...e.state,nav:r},Be(e.props.page),ct=new z.root({target:t,props:{...e.props,stores:F,components:V},hydrate:n,sync:!1,transformError:void 0}),await Promise.resolve(),n){let e={from:null,to:{...r,scroll:N[J]??D()},willUnload:!1,type:`enter`,complete:Promise.resolve()};W.forEach(t=>t(e))}ht(Y),it=!0}async function xt({url:e,params:t,branch:n,errors:r,status:i,error:a,route:o,form:s}){let c=`never`;if(C&&(e.pathname===C||e.pathname===C+`/`))c=`always`;else for(let e of n)e?.slash!==void 0&&(c=e.slash);e.pathname=d(e.pathname,c),e.search=e.search;let l={type:`loaded`,state:{url:e,params:t,branch:n,error:a,route:o},props:{constructors:Pe(n).map(e=>e.node.component),page:Kt(A)}};s!==void 0&&(l.props.form=s);let u={},f=!A,p=0;for(let e=0;e<Math.max(n.length,G.branch.length);e+=1){let t=n[e],r=G.branch[e];t?.data!==r?.data&&(f=!0),t&&(u={...u,...t.data},f&&(l.props[`data_${p}`]=u),p+=1)}return(!G.url||e.href!==G.url.href||G.error!==a||s!==void 0&&s!==A.form||f)&&(l.props.page={error:a,params:t,route:{id:o?.id??null},state:{},status:i,url:new URL(e),form:s??null,data:f?u:A.data}),l}async function St({loader:e,parent:t,url:n,params:r,route:i,server_data_node:a}){let o=null,s=!0,c={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},l=await e();if(l.universal?.load){function e(...e){for(let t of e){let{href:e}=new URL(t,n);c.dependencies.add(e)}}let u={tracing:{enabled:!1,root:Ve,current:Ve},route:new Proxy(i,{get:(e,t)=>(s&&(c.route=!0),e[t])}),params:new Proxy(r,{get:(e,t)=>(s&&c.params.add(t),e[t])}),data:a?.data??null,url:ee(n,()=>{s&&(c.url=!0)},e=>{s&&c.search_params.add(e)},z.hash),async fetch(t,r){t instanceof Request&&(r={body:t.method===`GET`||t.method===`HEAD`?void 0:await t.blob(),cache:t.cache,credentials:t.credentials,headers:[...t.headers].length>0?t?.headers:void 0,integrity:t.integrity,keepalive:t.keepalive,method:t.method,mode:t.mode,redirect:t.redirect,referrer:t.referrer,referrerPolicy:t.referrerPolicy,signal:t.signal,...r});let{resolved:i,promise:a}=Ct(t,r,n);return s&&e(i.href),a},setHeaders:h,depends:e,parent(){return s&&(c.parent=!0),t()},untrack(e){s=!1;try{return e()}finally{s=!0}}};o=await l.universal.load.call(null,u)??null}return{node:l,loader:e,server:a,universal:l.universal?.load?{type:`data`,data:o,uses:c}:null,data:o??a?.data??null,slash:l.universal?.trailingSlash??a?.slash}}function Ct(e,t,n){let r=e instanceof Request?e.url:e,i=new URL(r,n);return i.origin===n.origin&&(r=i.href.slice(n.origin.length)),{resolved:i,promise:it?b(r,i.href,t):y(r,t)}}function wt(e,t,n,r,i,a){if(st)return!0;if(!i)return!1;if(i.parent&&e||i.route&&t||i.url&&n)return!0;for(let e of i.search_params)if(r.has(e))return!0;for(let e of i.params)if(a[e]!==G.params[e])return!0;for(let e of i.dependencies)if(B.some(t=>t(new URL(e))))return!0;return!1}function Tt(e,t){return e?.type===`data`?e:e?.type===`skip`?t??null:null}function Et(e,t){if(!e)return new Set(t.searchParams.keys());let n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(let r of n){let i=e.searchParams.getAll(r),a=t.searchParams.getAll(r);i.every(e=>a.includes(e))&&a.every(e=>i.includes(e))&&n.delete(r)}return n}function Dt({error:e,url:t,route:n,params:r}){return{type:`loaded`,state:{error:e,url:t,route:n,params:r,branch:[]},props:{page:Kt(A),constructors:[]}}}async function Ot({id:e,invalidating:t,url:n,params:r,route:i,preload:a}){if(H?.id===e)return lt.delete(H.token),H.promise;let{errors:o,layouts:s,leaf:u}=i,d=[...s,u];o.forEach(e=>e?.().catch(h)),d.forEach(e=>e?.[1]().catch(h));let f=G.url?e!==Pt(G.url):!1,p=G.route?i.id!==G.route.id:!1,m=Et(G.url,n),ee=!1,g=d.map(async(e,t)=>{if(!e)return;let a=G.branch[t];return e[1]===a?.loader&&!wt(ee,p,f,m,a.universal?.uses,r)?a:(ee=!0,St({loader:e[1],url:n,params:r,route:i,parent:async()=>{let e={};for(let n=0;n<t;n+=1)Object.assign(e,(await g[n])?.data);return e},server_data_node:Tt(e[0]?{type:`skip`}:null,e[0]?a?.server:void 0)}))});for(let e of g)e.catch(h);let _=[];for(let e=0;e<d.length;e+=1)if(d[e])try{_.push(await g[e])}catch(t){if(t instanceof l)return{type:`redirect`,location:t.location};if(a&<.has(a))return Dt({error:await $(t,{params:r,url:n,route:{id:i.id}}),url:n,params:r,route:i});let s=Fe(t),u;if(t instanceof c)u=t.body;else{if(await F.updated.check())return await Je(),await I(n);u=await $(t,{params:r,url:n,route:{id:i.id}})}let d=await kt(e,_,o);return d?xt({url:n,params:r,branch:_.slice(0,d.idx).concat(d.node),errors:o,status:s,error:u,route:i}):await It(n,{id:i.id},u,s)}else _.push(void 0);return xt({url:n,params:r,branch:_,errors:o,status:200,error:null,route:i,form:t?void 0:null})}async function kt(e,t,n){for(;e--;)if(n[e]){let r=e;for(;!t[r];)--r;try{return{idx:r+1,node:{node:await n[e](),loader:n[e],data:{},server:null,universal:null}}}catch{continue}}}async function At({status:e,error:t,url:n,route:r}){let i={};try{return xt({url:n,params:i,branch:[await St({loader:Xe,url:n,params:i,route:r,parent:()=>Promise.resolve({}),server_data_node:Tt(null)}),{node:await L(),loader:L,universal:null,server:null,data:null}],status:e,error:t,errors:[],route:null})}catch(t){if(t instanceof l){await _t(new URL(t.location,location.href),{},0);return}let a=await z.get_error_template(),o=await $(t,{url:n,params:i,route:r}),s=a({status:e,message:String(o?.message??``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}),c=new DOMParser().parseFromString(s,`text/html`);throw document.documentElement.replaceChild(document.adoptNode(c.head),document.head),document.documentElement.replaceChild(document.adoptNode(c.body),document.body),t}}async function jt(e){let t=e.href;if(et.has(t))return et.get(t);let n;try{let r=(async()=>{let t=await z.hooks.reroute({url:new URL(e),fetch:async(t,n)=>Ct(t,n,e).promise})??e;if(typeof t==`string`){let n=new URL(e);z.hash?n.hash=t:n.pathname=t,t=n}return t})();et.set(t,r),n=await r}catch{et.delete(t);return}return n}async function Mt(e,t){if(e&&!je(e,C,z.hash)){let n=await jt(e);if(!n)return;let r=Nt(n);for(let n of Ye){let i=n.exec(r);if(i)return{id:Pt(e),invalidating:t,route:n,params:p(i),url:e}}}}function Nt(e){return f(z.hash?e.hash.replace(/^#/,``).replace(/[?#].+/,``):e.pathname.slice(C.length))||`/`}function Pt(e){return(z.hash?e.hash.replace(/^#/,``):e.pathname)+e.search}function Ft({url:e,type:t,intent:n,delta:r,event:i,scroll:a}){let o=!1,s=Gt(G,n,e,t,a??null);r!==void 0&&(s.navigation.delta=r),i!==void 0&&(s.navigation.event=i);let c={...s.navigation,cancel:()=>{o=!0,s.reject(Error(`navigation cancelled`))}};return K||tt.forEach(e=>e(c)),o?null:s}async function Z({type:n,url:r,popped:i,keepfocus:a,noscroll:o,replace_state:s,state:c={},redirect_count:l=0,nav_token:d={},accept:f=h,block:p=h,event:m}){let ee=X;X=d;let g=await Mt(r,!1),_=n===`enter`?Gt(G,g,r,n):Ft({url:r,type:n,delta:i?.delta,intent:g,scroll:i?.scroll,event:m});if(!_){p(),X===d&&(X=ee);return}let te=J,v=Y;f(),K=!0,it&&_.navigation.type!==`enter`&&F.navigating.set(j.current=_.navigation);let y=g&&await Ot(g);if(!y){if(je(r,C,z.hash))return await I(r,s);y=await It(r,{id:null},await $(new u(404,`Not Found`,`Not found: ${r.pathname}`),{url:r,params:{},route:{id:null}}),404,s)}if(r=g?.url||r,X!==d){_.reject(Error(`navigation aborted`));return}if(!y)return;if(y.type===`redirect`){if(l<20){await Z({type:n,url:new URL(y.location,r),popped:i,keepfocus:a,noscroll:o,replace_state:s,state:c,redirect_count:l+1,nav_token:d}),_.fulfil(void 0);return}if(y=await At({status:500,error:await $(Error(`Redirect loop`),{url:r,params:{},route:{id:null}}),url:r,route:{id:null}}),!y)return}else if(y.props.page.status>=400&&await F.updated.check())return await Je(),await I(r,s);if(pt(),Ke(te),mt(v),y.props.page.url.pathname!==r.pathname&&(r.pathname=y.props.page.url.pathname),c=i?i.state:c,!i){let e=+!s,t={[w]:J+=e,[T]:Y+=e,[be]:c};(s?history.replaceState:history.pushState).call(history,t,``,r),s||qe(J,Y)}let b=g&&H?.id===g.id?H.fork:null;H?.fork&&!b?U():(H=null,Q={element:void 0,href:void 0}),y.props.page.state=c;let x;if(it){let t=(await Promise.all(Array.from(nt,e=>e(_.navigation)))).filter(e=>typeof e==`function`);if(t.length>0){function e(){t.forEach(e=>{W.delete(e)})}t.push(e),t.forEach(e=>{W.add(e)})}let n=_.navigation.to;G={...y.state,nav:{params:n.params,route:n.route,url:n.url}},y.props.page&&(y.props.page.url=r),!a&&document.activeElement instanceof HTMLElement&&document.activeElement!==document.body&&document.activeElement.blur();let i=b&&await b;i?x=i.commit():(M=null,ct.$set(y.props),M&&Object.assign(y.props.page,M),Be(y.props.page),x=e?.()),ot=!0}else await bt(y,Ze,!1);let{activeElement:ne}=document;if(await x,await t(),await t(),X!==d){_.reject(Error(`navigation aborted`));return}y.props.page&&M&&Object.assign(y.props.page,M);let S=null;if(at){let e=i?i.scroll:o?D():null;e?scrollTo(e.x,e.y):(S=r.hash&&document.getElementById(Jt(r)))?S.scrollIntoView():scrollTo(0,0)}let re=document.activeElement!==ne&&document.activeElement!==document.body;!a&&!re&&Wt(r,!S),at=!0,K=!1,_.fulfil(void 0),_.navigation.to&&(_.navigation.to.scroll=D()),W.forEach(e=>e(_.navigation)),n===`popstate`&&ht(Y),F.navigating.set(j.current=null)}async function It(e,t,n,r,i){return e.origin===xe&&e.pathname===location.pathname&&!rt?await At({status:r,error:n,url:e,route:t}):await I(e,i)}var Q={element:void 0,href:void 0};function Lt(){let e,t;R.addEventListener(`mousemove`,t=>{let n=t.target;clearTimeout(e),e=setTimeout(()=>{i(n,E.hover)},20)});function n(e){e.defaultPrevented||i(e.composedPath()[0],E.tap)}R.addEventListener(`mousedown`,n),R.addEventListener(`touchstart`,n,{passive:!0});let r=new IntersectionObserver(e=>{for(let t of e)t.isIntersecting&&(yt(new URL(t.target.href)),r.unobserve(t.target))},{threshold:0});async function i(e,n){let r=Te(e,R),i=r===Q.element&&r?.href===Q.href&&n>=t;if(!r||i)return;let{url:a,external:o,download:s}=Ee(r,C,z.hash);if(o||s)return;let c=De(r),l=a&&Pt(G.url)===Pt(a);if(!(c.reload||l)){if(n<=c.preload_data){Q={element:r,href:r.href},t=E.tap;let e=await Mt(a,!1);if(!e)return;vt(e)}else n<=c.preload_code&&(Q={element:r,href:r.href},t=n,yt(a))}}function a(){r.disconnect();for(let e of R.querySelectorAll(`a`)){let{url:t,external:n,download:i}=Ee(e,C,z.hash);if(n||i)continue;let a=De(e);a.reload||(a.preload_code===E.viewport&&r.observe(e),a.preload_code===E.eager&&yt(t))}}W.add(a),a()}function $(e,t){if(e instanceof c)return e.body;let n=Fe(e),r=Ie(e);return z.hooks.handleError({error:e,event:t,status:n,message:r})??{message:r}}function Rt(e,t={}){return e=new URL(Se(e)),e.origin===xe?_t(e,t,0):Promise.reject(Error(`goto: invalid URL`))}function zt(e){if(typeof e==`function`)B.push(e);else{let{href:t}=new URL(e,location.href);B.push(e=>e.href===t)}}function Bt(){history.scrollRestoration=`manual`,addEventListener(`beforeunload`,e=>{let t=!1;if(gt(),!K){let e=Gt(G,void 0,null,`leave`),n={...e.navigation,cancel:()=>{t=!0,e.reject(Error(`navigation cancelled`))}};tt.forEach(e=>e(n))}t?(e.preventDefault(),e.returnValue=``):history.scrollRestoration=`auto`}),addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&>()}),navigator.connection?.saveData||Lt(),R.addEventListener(`click`,async t=>{if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;let n=Te(t.composedPath()[0],R);if(!n)return;let{url:r,external:i,target:a,download:o}=Ee(n,C,z.hash);if(!r)return;if(a===`_parent`||a===`_top`){if(window.parent!==window)return}else if(a&&a!==`_self`)return;let s=De(n);if(!(n instanceof SVGAElement)&&r.protocol!==location.protocol&&r.protocol!==`https:`&&r.protocol!==`http:`||o)return;let[c,l]=(z.hash?r.hash.replace(/^#/,``):r.href).split(`#`),u=c===m(location);if(i||s.reload&&(!u||!l))Ft({url:r,type:`link`,event:t})?K=!0:t.preventDefault();else{if(l!==void 0&&u){let[,i]=G.url.href.split(`#`);if(i===l){if(t.preventDefault(),l===``||l===`top`&&n.ownerDocument.getElementById(`top`)===null)scrollTo({top:0});else{let e=n.ownerDocument.getElementById(decodeURIComponent(l));e&&(e.scrollIntoView(),e.focus())}return}if(q=!0,Ke(J),e(r),!s.replace_state)return;q=!1}t.preventDefault(),await new Promise(e=>{requestAnimationFrame(()=>{setTimeout(e,0)}),setTimeout(e,100)}),await Z({type:`link`,url:r,keepfocus:s.keepfocus,noscroll:s.noscroll,replace_state:s.replace_state??r.href===location.href,event:t})}}),R.addEventListener(`submit`,e=>{if(e.defaultPrevented)return;let t=HTMLFormElement.prototype.cloneNode.call(e.target),n=e.submitter;if((n?.formTarget||t.target)===`_blank`||(n?.formMethod||t.method)!==`get`)return;let r=new URL(n?.hasAttribute(`formaction`)&&n?.formAction||t.action);if(je(r,C,!1))return;let i=e.target,a=De(i);if(a.reload)return;e.preventDefault(),e.stopPropagation();let o=new FormData(i,n);r.search=new URLSearchParams(o).toString(),Z({type:`form`,url:r,keepfocus:a.keepfocus,noscroll:a.noscroll,replace_state:a.replace_state??r.href===location.href,event:e})}),addEventListener(`popstate`,async t=>{if(!Ut){if(t.state?.[`sveltekit:history`]){let n=t.state[w];if(X={},n===J)return;let r=N[n],i=t.state[`sveltekit:states`]??{},a=new URL(t.state[`sveltekit:pageurl`]??location.href),o=t.state[T],s=G.url?m(location)===m(G.url):!1;if(o===Y&&(ot||s)){i!==A.state&&(A.state=i),e(a),N[J]=D(),r&&scrollTo(r.x,r.y),J=n;return}let c=n-J;await Z({type:`popstate`,url:a,popped:{state:i,scroll:r,delta:c},accept:()=>{J=n,Y=o},block:()=>{history.go(-c)},nav_token:X,event:t})}else q||(e(new URL(location.href)),z.hash&&location.reload())}}),addEventListener(`hashchange`,()=>{q&&(q=!1,history.replaceState({...history.state,[w]:++J,[T]:Y},``,location.href))});for(let e of document.querySelectorAll(`link`))Ge.has(e.rel)&&(e.href=e.href);addEventListener(`pageshow`,e=>{e.persisted&&F.navigating.set(j.current=null)});function e(e){G.url=A.url=e,F.page.set(Kt(A)),F.page.notify()}}async function Vt(e,{status:t=200,error:n,node_ids:r,params:i,route:a,server_route:o,data:s,form:c}){rt=!0;let u=new URL(location.href),d;({params:i={},route:a={id:null}}=await Mt(u,!1)||{}),d=Ye.find(({id:e})=>e===a.id);let f,p=!0;try{let e=r.map(async(t,n)=>{let r=s[n];return r?.uses&&(r.uses=Ht(r.uses)),St({loader:z.nodes[t],url:u,params:i,route:a,parent:async()=>{let t={};for(let r=0;r<n;r+=1)Object.assign(t,(await e[r]).data);return t},server_data_node:Tt(r)})}),o=await Promise.all(e);if(d){let e=d.layouts;for(let t=0;t<e.length;t++)e[t]||o.splice(t,0,void 0)}f=await xt({url:u,params:i,branch:o,status:t,error:n,errors:d?.errors,form:c,route:d??null})}catch(t){if(t instanceof l)return await I(new URL(t.location,location.href));f=await At({status:Fe(t),error:await $(t,{url:u,params:i,route:a}),url:u,route:a}),e.textContent=``,p=!1}f&&(f.props.page&&(f.props.page.state={}),await bt(f,e,p))}function Ht(e){return{dependencies:new Set(e?.dependencies??[]),params:new Set(e?.params??[]),parent:!!e?.parent,route:!!e?.route,url:!!e?.url,search_params:new Set(e?.search_params??[])}}var Ut=!1;function Wt(e,t=!0){let n=document.querySelector(`[autofocus]`);if(n)n.focus();else{let n=Jt(e);if(n&&document.getElementById(n)){let{x:r,y:i}=D();setTimeout(()=>{let a=history.state;Ut=!0,location.replace(new URL(`#${n}`,location.href)),history.replaceState(a,``,e),t&&scrollTo(r,i),Ut=!1})}else{let e=document.body,t=e.getAttribute(`tabindex`);e.tabIndex=-1,e.focus({preventScroll:!0,focusVisible:!1}),t===null?e.removeAttribute(`tabindex`):e.setAttribute(`tabindex`,t)}let r=getSelection();if(r&&r.type!==`None`){let e=[];for(let t=0;t<r.rangeCount;t+=1)e.push(r.getRangeAt(t));setTimeout(()=>{if(r.rangeCount===e.length){for(let t=0;t<r.rangeCount;t+=1){let n=e[t],i=r.getRangeAt(t);if(n.commonAncestorContainer!==i.commonAncestorContainer||n.startContainer!==i.startContainer||n.endContainer!==i.endContainer||n.startOffset!==i.startOffset||n.endOffset!==i.endOffset)return}r.removeAllRanges()}})}}}function Gt(e,t,n,r,i=null){let a,o,s=new Promise((e,t)=>{a=e,o=t});return s.catch(h),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url,scroll:D()},to:n&&{params:t?.params??null,route:{id:t?.route?.id??null},url:n,scroll:i},willUnload:!t,type:r,complete:s},fulfil:a,reject:o}}function Kt(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function qt(e){let t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function Jt(e){let t;if(z.hash){let[,,n]=e.hash.split(`#`,3);t=n??``}else t=e.hash.slice(1);return decodeURIComponent(t)}export{Me as a,A as i,ft as n,me as o,j as r,ge as s,Rt as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e,i as t,o as n,r,u as i,x as a}from"./
|
|
1
|
+
import{_ as e,i as t,o as n,r,u as i,x as a}from"./DEQsS4Ez.js";import{o,r as s}from"./DciMwFJ1.js";import{a as c,i as l,s as u}from"./Kem7IXj7.js";import{a as d,c as f,d as p,f as m,g as h,h as g,l as _,m as v,n as y,o as b,p as x,r as S,s as C,t as w,u as T}from"./CWc-mNzo.js";import{PeleError as E,u as ee}from"./zasx25UV.js";function D(e){throw new E(e,`semantic`,{type:`architecture`})}var O=class{type=`architecture`;title;accTitle;accDescr;nodes=new Map;groups=new Map;edges=[];layoutHints=[];registered=new Map;register(e,t,n){this.registered.has(t)&&D(`The ${e} id [${t}] is already in use by another ${this.registered.get(t)}`),n!==void 0&&(t===n&&D(`The ${e} [${t}] cannot be placed within itself`),this.registered.has(n)||D(`The ${e} [${t}]'s parent does not exist. Please make sure the parent is created before this ${e}`),this.registered.get(n)===`node`&&D(`The ${e} [${t}]'s parent is not a group`)),this.registered.set(t,e===`group`?`group`:`node`)}addService({id:e,icon:t,iconText:n,title:r,in:i}){this.register(`service`,e,i),this.nodes.set(e,{id:e,type:`service`,icon:t,iconText:n,title:r,in:i})}addJunction({id:e,in:t}){this.register(`junction`,e,t),this.nodes.set(e,{id:e,type:`junction`,in:t})}addGroup({id:e,icon:t,title:n,in:r}){this.register(`group`,e,r),this.groups.set(e,{id:e,icon:t,title:n,in:r})}addEdge({lhsId:e,rhsId:t,lhsDir:n,rhsDir:r,lhsInto:i,rhsInto:a,lhsGroup:o,rhsGroup:s,title:c}){let l=[[`left`,e,o],[`right`,t,s]];for(let[e,t]of l)this.registered.has(t)||D(`The ${e}-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`);for(let[e,t]of l)this.nodes.has(t)||D(`The ${e}-hand id [${t}] is a group. Add {group} to a service inside it instead.`);let u=this.nodes.get(e).in;if(u!==void 0&&u===this.nodes.get(t).in)for(let[e,t,n]of l)n&&D(`The ${e}-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);this.edges.push({lhsId:e,lhsDir:n,lhsInto:i,lhsGroup:o,rhsId:t,rhsDir:r,rhsInto:a,rhsGroup:s,title:c})}addLayoutHint(e){e.members.length<2&&D(`An align directive requires at least two members; got ${e.members.length}`);let t=new Set;for(let n of e.members)this.registered.get(n)!==`node`&&D(`align ${e.direction} references [${n}], which is not a service or junction`),t.has(n)&&D(`align ${e.direction} lists [${n}] more than once`),t.add(n);this.layoutHints.push(e)}};function k(e,t){e.accDescr&&(t.accDescr=e.accDescr.replace(/\n\s+/g,`
|
|
2
2
|
`)),e.accTitle&&(t.accTitle=e.accTitle.replace(/^\s+/g,``)),e.title&&(t.title=e.title);for(let n of e.groups)t.addGroup(n);for(let n of e.services)t.addService(n);for(let n of e.junctions)t.addJunction(n);for(let n of e.edges)t.addEdge(n);for(let n of e.alignments)t.addLayoutHint({direction:n.direction,members:[...n.members]})}var A={name:`ID`,pattern:/[\w]([-\w]*\w)?/y};function j(e){return{name:e,pattern:e,longer:[A]}}var M=[j(`architecture-beta`),j(`junction`),j(`service`),j(`column`),j(`group`),j(`align`),j(`row`),{name:`--`,pattern:`--`,longer:[S]},j(`in`),{name:`:`,pattern:`:`},{name:`-`,pattern:`-`,longer:[S]},{name:`ARROW_DIRECTION`,pattern:/L|R|T|B/y},{name:`ARROW_GROUP`,pattern:/\{group\}/y},{name:`ARROW_INTO`,pattern:/<|>/y},d,w,x,v,A,_,T,S,b,C,{name:`ARCH_ICON`,pattern:/\([\w-:]+\)/y},{name:`ARCH_TITLE`,pattern:/\[(?:"([^"\\]|\\.)*"|'([^'\\]|\\.)*'|[^\[\]\r\n]+)\]/y}];function N(e){let t=e.slice(1,-1).trim();return(t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`))&&(t=t.slice(1,-1).replace(/\\"/g,`"`).replace(/\\'/g,`'`)),t.trim()}function P(e){let t=new g(y(e,M,`architecture`),M,`architecture`),n={$type:`Architecture`,groups:[],services:[],junctions:[],edges:[],alignments:[]},r=e=>t.kinds[t.i]===e,i=()=>{if(t.kind!==-1)for(t.kind!==19&&t.fail(`a line break or the end of input`);t.kind===19;)t.i++};for(;t.kind===19;)t.i++;for(t.expect(0);t.kind!==-1;){switch(t.kind){case 19:t.i++;continue;case 14:n.accDescr=f(t.take());break;case 15:n.accTitle=h(t.take());break;case 16:n.title=p(t.take());break;case 4:{t.i++;let e={$type:`Group`,id:t.expect(18)};r(24)&&(e.icon=t.take().slice(1,-1)),r(25)&&(e.title=N(t.take())),t.accept(8)&&(e.in=t.expect(18)),n.groups.push(e);break}case 2:{t.i++;let e={$type:`Service`,id:t.expect(18)};r(17)?e.iconText=m(t.take()):r(24)&&(e.icon=t.take().slice(1,-1)),r(25)&&(e.title=N(t.take())),t.accept(8)&&(e.in=t.expect(18)),n.services.push(e);break}case 1:{t.i++;let e={$type:`Junction`,id:t.expect(18)};t.accept(8)&&(e.in=t.expect(18)),n.junctions.push(e);break}case 18:{let e=t.take(),i=t.accept(12);t.expect(9);let a=t.expect(11),o=t.accept(13),s;t.accept(7)||(r(10)||t.fail(`'--' or '-'`),t.i++,s=N(t.expect(25)),t.expect(10));let c=t.accept(13),l=t.expect(11);t.expect(9);let u=t.expect(18),d=t.accept(12);n.edges.push({$type:`Edge`,lhsId:e,lhsGroup:i,lhsDir:a,lhsInto:o,title:s,rhsInto:c,rhsDir:l,rhsId:u,rhsGroup:d});break}case 5:{t.i++,!r(6)&&!r(3)&&t.fail(`'row' or 'column'`);let e=t.take(),i=[t.expect(18),t.expect(18)];for(;r(18);)i.push(t.take());n.alignments.push({$type:`Alignment`,direction:e,members:i});break}default:t.fail(`a group, a service, a junction, an edge, an alignment, a title, or a line break`)}i()}return n}var F=new Map([[`database`,`M4 6a8 3 0 1 0 16 0a8 3 0 1 0-16 0M4 6v12a8 3 0 0 0 16 0V6M4 12a8 3 0 0 0 16 0`],[`server`,`M3 4h18v7H3zM3 13h18v7H3zM7 7.5h.01M7 16.5h.01M11 7.5h6M11 16.5h6`],[`disk`,`M5 3h14v18H5zM12 6.5a4 4 0 1 0 0 8a4 4 0 1 0 0-8M12 10.5h.01M8 18h3`],[`internet`,`M3 12a9 9 0 1 0 18 0a9 9 0 1 0-18 0M3 12h18M12 3a13 13 0 0 0 0 18M12 3a13 13 0 0 1 0 18`],[`cloud`,`M7 18a4 4 0 0 1-.5-7.97A6 6 0 0 1 18 9.5a4.25 4.25 0 0 1-.5 8.5z`]]);function I(e){let t=F.get(e);return t===void 0?``:`<path d="${t}" stroke="var(--_fg)" stroke-width="1.5"/>`}var L=[-1,1,0,0],R=[0,0,-1,1];function te(e){return e===`L`?0:e===`R`?1:e===`T`?2:3}var z=64,B=2**25,V=2**26;function ne(e,t,n,r){let i=e.length,a=t.length,o=a,s=new Map,c=new Map,l=new Int32Array(i+a).fill(o),u=new Int32Array(a+1),d=[];for(let e=0;e<=a;e++)d.push([]);t.forEach((e,t)=>{c.set(e.id,t);let n=e.in===void 0?void 0:c.get(e.in);n!==void 0&&n!==t?(l[i+t]=n,u[t]=u[n]+1):u[t]=1}),e.forEach((e,t)=>{s.set(e.id,t);let n=e.in===void 0?void 0:c.get(e.in);n!==void 0&&(l[t]=n),d[l[t]].push(t)});for(let e=0;e<a;e++)d[l[i+e]].push(i+e);let f=[],p=[],m=[],h=[],g=[],_=[],v=Array(i+a),y=Array(i+a),b=(e,t,n,r,a)=>{if(e===t)return;let o=e,s=t,c=l[e],d=l[t];for(;c!==d;)u[c]>=u[d]?(o=i+c,c=l[o]):(s=i+d,d=l[s]);let v=f.length;f.push(e),p.push(t),m.push(n),h.push(r),g.push(o),_.push(s),(a[o]??=[]).push(v),(a[s]??=[]).push(v)};for(let e of r){let t=e.direction===`row`;for(let n=1;n<e.members.length;n++){let r=s.get(e.members[n-1]),i=s.get(e.members[n]);r!==void 0&&i!==void 0&&b(r,i,t?1:3,t?0:2,v)}}for(let e of[!1,!0])for(let t of n){if(t.lhsDir===t.rhsDir!==e)continue;let n=s.get(t.lhsId),r=s.get(t.rhsId);n!==void 0&&r!==void 0&&b(n,r,te(t.lhsDir),te(t.rhsDir),y)}let x=new Int32Array(i+a),S=new Int32Array(i+a),C=new Int32Array(i+a).fill(1),w=new Int32Array(i+a).fill(1),T=new Uint8Array(i+a),E=[],ee=new Map,D=[],O=new Map,k=0,A=0,j=0,M=(e,t)=>{A=0,j=0;for(let n=e;n!==t;n=i+l[n])A+=x[n],j+=S[n]},N=(e,t,n)=>{if(x[e]=t,S[e]=n,T[e]=1,E.push(e),C[e]*w[e]>z)D.push(e);else for(let r=n;r<n+w[e];r++)for(let n=t;n<t+C[e];n++)ee.set((n+B)*V+r+B,e)},P=(e,t,n,r,i)=>x[e]<t+r&&t<x[e]+C[e]&&S[e]<n+i&&n<S[e]+w[e],F=(e,t,n,r)=>{if(n*r>z){for(let i=k;i<E.length;i++)if(P(E[i],e,t,n,r))return E[i];return-1}for(let i=t;i<t+r;i++)for(let t=e;t<e+n;t++){let e=ee.get((t+B)*V+i+B);if(e!==void 0)return e}for(let i of D)if(P(i,e,t,n,r))return i;return-1},I=(e,t,n,r,i,a)=>{let o=`${e},${t},${n},${r},${i},${a}`,s=O.get(o)??0;for(;;){let o=F(e+s*i,t+s*a,n,r);if(o<0)break;s=i>0?x[o]+C[o]-e:i<0?e+n-x[o]:a>0?S[o]+w[o]-t:t+r-S[o]}return O.set(o,s),s},ne=(e,t)=>{let n=g[t]===e,r=n?_[t]:g[t];if(T[r])return;let i=n?m[t]:h[t],a=n?h[t]:m[t];M(n?f[t]:p[t],e);let o=A,s=j;M(n?p[t]:f[t],r);let c=L[i],l=R[i],u=0,d=0,v=L[i]+L[a]===0&&R[i]+R[a]===0;i===a?(c=+(L[i]===0),l=1-c):v||(u=-L[a],d=-R[a]);let b,E;if(c===0?(E=l>0?S[e]+w[e]:S[e]-w[r],b=x[e]+o+u-A):(b=c>0?x[e]+C[e]:x[e]-C[r],E=S[e]+s+d-j),v){let e=y[r];if(e!==void 0&&e.length>1){let t=[];for(let n of e){let e=_[n]===r,o=e?g[n]:_[n];if(!T[o]||(e?m[n]:h[n])!==i||(e?h[n]:m[n])!==a)continue;M(e?f[n]:p[n],o);let s=c===0?x[o]+A:S[o]+j;M(e?p[n]:f[n],r),t.push(s-(c===0?A:j))}t.length>1&&(t.sort((e,t)=>e-t),c===0?b=t[t.length-1>>1]:E=t[t.length-1>>1])}let t=+(c===0),n=1-t,o=I(b,E,C[r],w[r],t,n),s=o===0?0:I(b,E,C[r],w[r],-t,-n),l=o<=s?o:-s;b+=t*l,E+=n*l}else{let e=I(b,E,C[r],w[r],c,l);b+=c*e,E+=l*e}N(r,b,E)},H=e=>{let t=d[e];if(t.length===0)return;E.length=0;let n=[];for(let e of t){if(T[e])continue;k=E.length,n.push(k),ee.clear(),D.length=0,O.clear(),N(e,0,0);let t=k,r=k,i=0;for(;;){if(t<E.length){let e=E[t++],n=v[e];if(n!==void 0)for(let t of n)ne(e,t);continue}if(r>=E.length)break;let e=y[E[r]];e===void 0||i>=e.length?(r++,i=0):ne(E[r],e[i++])}}n.push(E.length);let r=n.length-1,o=Array(r),s=Array(r),c=Array(r),l=Array(r),u=0,f=0;for(let e=0;e<r;e++){let t=1/0,r=1/0,i=-1/0,a=-1/0;for(let o=n[e];o<n[e+1];o++){let e=E[o];t=Math.min(t,x[e]),r=Math.min(r,S[e]),i=Math.max(i,x[e]+C[e]),a=Math.max(a,S[e]+w[e])}o[e]=t,s[e]=r,c[e]=i-t,l[e]=a-r,u+=c[e]*l[e],f=Math.max(f,c[e])}let p=Math.max(f,Math.ceil(Math.sqrt(u*2))),m=0,h=0,g=0,_=0;for(let e=0;e<r;e++){m>0&&m+c[e]>p&&(h+=g,m=0,g=0);for(let t=n[e];t<n[e+1];t++)x[E[t]]+=m-o[e],S[E[t]]+=h-s[e];m+=c[e],g=Math.max(g,l[e]),_=Math.max(_,m)}e<a&&(C[i+e]=_,w[i+e]=h+g)};for(let e=a-1;e>=0;e--)H(e);H(o);let U=new Int32Array(a),W=new Int32Array(a),re=new Int32Array(a),ie=new Uint8Array(a);for(let e=0;e<a;e++){let t=l[i+e];re[e]=t===o?-1:t,U[e]=x[i+e]+(t===o?0:U[t]),W[e]=S[i+e]+(t===o?0:W[t]),d[e].length===0&&(ie[e]=1)}let ae=new Int32Array(i),oe=new Int32Array(i),se=new Int32Array(i);for(let e=0;e<i;e++){let t=l[e];se[e]=t===o?-1:t,ae[e]=x[e]+(t===o?0:U[t]),oe[e]=S[e]+(t===o?0:W[t])}return{col:ae,row:oe,groupCol:U,groupRow:W,groupCols:C.slice(i),groupRows:w.slice(i),groupParent:re,groupEmpty:ie,nodeParent:se}}var H=12,U=6,W=4,re=3,ie=[-1,1,0,0],ae=[0,0,-1,1];function oe(e,t,n,r,i){let a=e.architecture,o=typeof a==`object`&&a&&!Array.isArray(a)?a[t]:void 0;return typeof o==`number`&&Number.isFinite(o)?Math.min(i,Math.max(r,o)):n}function se(e){let t=new Map;for(let n of e.sort((e,t)=>e-t))t.has(n)||t.set(n,t.size);return t}function ce(e,n,r,i,o){return`<svg class="pele-icon" data-icon="${t(e)}" x="${a(n)}" y="${a(r)}" width="${a(i)}" height="${a(i)}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${o?.(e)??I(e)}</svg>`}function le(e,t,n,r){let i=e.lines.length>n;if(!i&&e.width<=t)return e;let a=r.width(`…`,e.size,0),o=[],s=[],c=0;for(let l=0;l<Math.min(n,e.lines.length);l++){let u=e.lines[l].map(e=>({...e})),d=e.widths[l];if(d>t||i&&l===n-1)for(;;){let n=u[u.length-1];if(n===void 0){u.push({text:`…`,style:0,width:a}),d=a;break}let i=d-n.width;if(n.icon===void 0&&i+a<t){let o=0,s=n.text.length;for(;o<s;){let c=o+s+1>>1;i+r.width(n.text.slice(0,c),e.size,n.style)+a<=t?o=c:s=c-1}let c=o>0?n.text.charCodeAt(o-1):0;c>=55296&&c<=56319&&o--,n.text=n.text.slice(0,o).trimEnd()+`…`,n.width=r.width(n.text,e.size,n.style),d=i+n.width;break}u.pop(),d=i}o.push(u),s.push(d),c=Math.max(c,d)}return{...e,lines:o,widths:s,width:c,height:o.length*e.lineHeight}}function ue(e,t){let{x:n,y:r,dx:i,dy:a}=e,{x:o,y:s,dx:c,dy:l}=t,u=n+i*H,d=r+a*H,f=o+c*H,p=s+l*H;if(i*c+a*l===0){let e=i===0?n:o,t=i===0?s:r;return(e-n)*i+(t-r)*a>0&&(e-o)*c+(t-s)*l>0?[n,r,e,t,o,s]:i===0?[n,r,u,d,f,d,f,p,o,s]:[n,r,u,d,u,p,f,p,o,s]}let m=i!==0,h=m?s-r:o-n;if(i===-c&&a===-l){if((o-n)*i+(s-r)*a>0){if(Math.abs(h)<.5)return[n,r,o,s];if(m){let a=i>0?e.x1:t.x1,c=i>0?t.x0:e.x0,l=a<c?(a+c)/2:(n+o)/2;return[n,r,l,r,l,s,o,s]}let c=a>0?e.y1:t.y1,l=a>0?t.y0:e.y0,u=c<l?(c+l)/2:(r+s)/2;return[n,r,n,u,o,u,o,s]}}else if(Math.abs(h)>=1){if(m){let e=i>0?Math.max(n,o)+H:Math.min(n,o)-H;return[n,r,e,r,e,s,o,s]}let e=a>0?Math.max(r,s)+H:Math.min(r,s)-H;return[n,r,n,e,o,e,o,s]}if(m){let i=e.y1+H<=t.y0?(e.y1+t.y0)/2:t.y1+H<=e.y0?(t.y1+e.y0)/2:Math.max(e.y1,t.y1)+H;return[n,r,u,r,u,i,f,i,f,s,o,s]}let g=e.x1+H<=t.x0?(e.x1+t.x0)/2:t.x1+H<=e.x0?(t.x1+e.x0)/2:Math.max(e.x1,t.x1)+H;return[n,r,n,d,g,d,g,p,o,p,o,s]}function de(e){let t=[e[0],e[1]];for(let n=2;n<e.length;n+=2){let r=e[n],i=e[n+1],a=t.length,o=Math.abs(r-t[a-2])<.01,s=Math.abs(i-t[a-1])<.01;o&&s||(a>=4&&(o&&Math.abs(t[a-4]-t[a-2])<.01||s&&Math.abs(t[a-3]-t[a-1])<.01)?(t[a-2]=r,t[a-1]=i):t.push(r,i))}return t}function fe(e,t,n){let r=e.length/2,i=Array(r),o=Array(r);for(let t=0;t<r;t++)i[t]=e[t*2],o[t]=e[t*2+1];let s=(e,t,n)=>{let r=Math.hypot(i[t]-i[e],o[t]-o[e]),a=Math.min(n,Math.max(0,r-1));r>0&&a>0&&(i[e]+=(i[t]-i[e])/r*a,o[e]+=(o[t]-o[e])/r*a)};s(0,1,t),s(r-1,r-2,n);let c=`M${a(i[0])},${a(o[0])}`;for(let e=1;e<r-1;e++){let t=Math.hypot(i[e]-i[e-1],o[e]-o[e-1]),n=Math.hypot(i[e+1]-i[e],o[e+1]-o[e]),r=Math.min(U,t/2,n/2);if(r<.5){c+=`L${a(i[e])},${a(o[e])}`;continue}let s=i[e]-(i[e]-i[e-1])/t*r,l=o[e]-(o[e]-o[e-1])/t*r,u=i[e]+(i[e+1]-i[e])/n*r,d=o[e]+(o[e+1]-o[e])/n*r;c+=`L${a(s)},${a(l)}Q${a(i[e])},${a(o[e])} ${a(u)},${a(d)}`}return c+`L${a(i[r-1])},${a(o[r-1])}`}function G(e,t,n){return o(n,r=>K(e,t,n,r))}function K(o,d,f,p){let m=oe(d,`iconSize`,48,8,512),h=oe(d,`fontSize`,f.fontSize??16,4,128),g=Math.min(oe(d,`padding`,20,0,256),p?12:1/0),_=Math.round(h*.875),v=f.measurer??ee(f.fontFamily,f.fontFamilyMono),y=f.padding??8,b=f.icons,x=m/2,S=[...o.nodes.values()],C=[...o.groups.values()],w=S.length,T=C.length,E=ne(S,C,o.edges,o.layoutHints),D=new Map;S.forEach((e,t)=>D.set(e.id,t));let O=Array(w),k=new Float64Array(w),A=new Float64Array(w),j=p?Math.max(m,64):Math.max(m*2.25,96);for(let e=0;e<w;e++){let t=S[e],n=i(t.type===`service`?t.title:void 0,!0,v,h,j);O[e]=n,k[e]=Math.max(m,2*Math.ceil(n.width/2)),A[e]=m+(n.height>0?W+n.height:0)}let M=[],N=[];for(let e=0;e<w;e++)M.push(E.col[e]),N.push(E.row[e]);for(let e=0;e<T;e++)E.groupEmpty[e]&&(M.push(E.groupCol[e]),N.push(E.groupRow[e]));let P=se(M),F=se(N),I=P.size,L=F.size,R=new Float64Array(I),z=new Float64Array(L),B=p?Math.max(24,2*H):Math.max(40,Math.round(m*.75)),V=new Float64Array(I).fill(B),U=new Float64Array(L).fill(B),G=new Int32Array(w),K=new Int32Array(w);for(let e=0;e<w;e++){let t=G[e]=P.get(E.col[e]),n=K[e]=F.get(E.row[e]);R[t]=Math.max(R[t],k[e]),z[n]=Math.max(z[n],A[e])}for(let e=0;e<T;e++){if(!E.groupEmpty[e])continue;let t=P.get(E.groupCol[e]),n=F.get(E.groupRow[e]);R[t]=Math.max(R[t],m),z[n]=Math.max(z[n],x)}let pe=o.edges.length,me=Array(pe),he=new Int32Array(pe*2);for(let e=0;e<pe;e++){let t=o.edges[e],n=he[e*2]=D.get(t.lhsId)??-1,r=he[e*2+1]=D.get(t.rhsId)??-1,a=i(t.title,!0,v,_,160);if(me[e]=a,!(a.width===0||n<0||r<0)){if(G[n]!==G[r]){let e=Math.min(G[n],G[r]);V[e]=Math.max(V[e],Math.ceil(a.width)+28)}else if(R[G[n]]=Math.max(R[G[n]],2*Math.ceil(a.width/2)+8),K[n]!==K[r]){let e=Math.min(K[n],K[r]);U[e]=Math.max(U[e],Math.ceil(a.height)+24)}}}let ge=Array(T),q=new Int32Array(T),J=new Int32Array(T),_e=new Int32Array(T),Y=new Int32Array(T),ve=new Float64Array(T),ye=new Float64Array(T),be=new Float64Array(T),xe=new Float64Array(T),X=new Float64Array(T),Se=new Float64Array(T),Ce=new Float64Array(I),we=new Float64Array(I),Te=new Float64Array(L),Ee=new Float64Array(L),De=Math.round(h*1.25);for(let e=0;e<T;e++){q[e]=P.get(E.groupCol[e]),J[e]=P.get(E.groupCol[e]+E.groupCols[e]-1),_e[e]=F.get(E.groupRow[e]),Y[e]=F.get(E.groupRow[e]+E.groupRows[e]-1);let t=i(C[e].title,!0,v,h,p?Math.max(80,s(f)/2):320);ge[e]=t;let n=C[e].icon?De:0;X[e]=t.width+n+(t.width>0&&n>0?6:0),Se[e]=Math.max(t.height,n)}for(let e=T-1;e>=0;e--){let t=g+ve[e],n=g+ye[e],r=(Se[e]>0?Math.max(g,Se[e]+12):g)+be[e],i=g+xe[e];if(X[e]>0){let r=t+n;for(let t=q[e];t<=J[e];t++)r+=R[t]+(t<J[e]?we[t]+V[t]+Ce[t+1]:0);X[e]+20>r&&(n+=Math.ceil(X[e]+20-r))}ve[e]=t,ye[e]=n,be[e]=r,xe[e]=i,Ce[q[e]]=Math.max(Ce[q[e]],t),we[J[e]]=Math.max(we[J[e]],n),Te[_e[e]]=Math.max(Te[_e[e]],r),Ee[Y[e]]=Math.max(Ee[Y[e]],i);let a=E.groupParent[e];a<0||(q[a]===q[e]&&(ve[a]=Math.max(ve[a],t)),J[a]===J[e]&&(ye[a]=Math.max(ye[a],n)),_e[a]===_e[e]&&(be[a]=Math.max(be[a],r)),Y[a]===Y[e]&&(xe[a]=Math.max(xe[a],i)))}let Oe=new Float64Array(I),Z=new Float64Array(L),ke=0;for(let e=0;e<I;e++)Oe[e]=ke+Ce[e],ke=Oe[e]+R[e]+we[e]+(e<I-1?V[e]:0);let Ae=0;for(let e=0;e<L;e++)Z[e]=Ae+Te[e],Ae=Z[e]+z[e]+Ee[e]+(e<L-1?U[e]:0);let Q=0,je=0,Me=ke,Ne=Ae,Pe=e=>Oe[q[e]]-ve[e],Fe=e=>Oe[J[e]]+R[J[e]]+ye[e],Ie=e=>Z[_e[e]]-be[e],Le=e=>Z[Y[e]]+z[Y[e]]+xe[e],Re=e=>Oe[G[e]]+R[G[e]]/2,ze=(e,t,n)=>{let r=ie[t],i=ae[t],a=Re(e),o=Z[K[e]],s={x:a,y:o+x,dx:r,dy:i,x0:a-k[e]/2,y0:o,x1:a+k[e]/2,y1:o+A[e],gap:0,wire:!1};S[e].type===`junction`?(s.x0=s.x1=a,s.y0=s.y1=s.y,s.gap=re):r===0?s.y=i<0?o:o+A[e]+(O[e].height>0?2:0):s.x=a+r*x;let c=n?E.nodeParent[e]:-1;return c>=0&&(s.x0=Pe(c),s.x1=Fe(c),s.y0=Ie(c),s.y1=Le(c),s.gap=0,s.wire=S[e].type===`junction`,r===0?s.y=i<0?s.y0:s.y1:s.x=r<0?s.x0:s.x1),s},Be=``,Ve=``,$=[],He=c(`arrow_point`);for(let e=0;e<pe;e++){let n=o.edges[e],r=he[e*2],i=he[e*2+1];if(r<0||i<0)continue;let a=ze(r,te(n.lhsDir),n.lhsGroup),s=ze(i,te(n.rhsDir),n.rhsGroup);a.x===s.x&&a.y===s.y&&a.dx===s.dx&&(a.x-=8*Math.abs(a.dy),a.y-=8*Math.abs(a.dx),s.x+=8*Math.abs(a.dy),s.y+=8*Math.abs(a.dx));let c=ue(a,s);a.wire&&c.unshift(Re(r),Z[K[r]]+x),s.wire&&c.push(Re(i),Z[K[i]]+x);let d=de(c);if(d.length<4)continue;let f=t(`${n.lhsId}-${n.rhsId}`);Be+=`<g class="pele-edge" data-id="${f}"><path d="${fe(d,n.lhsInto&&!a.wire?He+a.gap:0,n.rhsInto&&!s.wire?He+s.gap:0)}"/>`+(n.lhsInto?u(`arrow_point`,a.x+a.dx*a.gap,a.y+a.dy*a.gap,-a.dx,-a.dy,`var(--_l)`):``)+(n.rhsInto?u(`arrow_point`,s.x+s.dx*s.gap,s.y+s.dy*s.gap,-s.dx,-s.dy,`var(--_l)`):``)+`</g>`;let p=-1,m=-1,h=-1,g=-1,_=me[e];for(let e=0;e<d.length;e+=2)Q=Math.min(Q,d[e]-4),Me=Math.max(Me,d[e]+4),je=Math.min(je,d[e+1]-4),Ne=Math.max(Ne,d[e+1]+4);for(let e=0;e+3<d.length;e+=2){let t=Math.abs(d[e+1]-d[e+3])<.01,n=Math.abs(d[e]-d[e+2])+Math.abs(d[e+1]-d[e+3]);t||$.push(d[e],Math.min(d[e+1],d[e+3]),Math.max(d[e+1],d[e+3])),n>m&&(p=e,m=n),t&&n>g&&(h=e,g=n)}if(_.width>0){let e=g>=_.width+8?h:p,t=(d[e]+d[e+2])/2,r=(d[e+1]+d[e+3])/2,i=_.width+8,o=Math.abs(d[e]-d[e+2])<.01;for(let e of[a,s])t+i/2<=e.x0||t-i/2>=e.x1||r+_.height/2<=e.y0||r-_.height/2>=e.y1||(o?t=t>=(e.x0+e.x1)/2?e.x1+i/2+4:e.x0-i/2-4:r=r>=(e.y0+e.y1)/2?e.y1+_.height/2+4:e.y0-_.height/2-4);Q=Math.min(Q,t-i/2),Me=Math.max(Me,t+i/2),je=Math.min(je,r-_.height/2),Ne=Math.max(Ne,r+_.height/2),Ve+=l(`${n.lhsId}-${n.rhsId}`,_,t,r,``,b)}}let Ue=``;for(let e=0;e<T;e++){let i=C[e],o=Pe(e),s=Ie(e),c=Fe(e)-o,l=ge[e],u=``;if(X[e]>0){let t=s+Se[e]+12,r=[];for(let e=0;e<$.length;e+=3)$[e+1]<t&&$[e+2]>s&&$[e]>o&&$[e]<o+c&&r.push($[e]);r.sort((e,t)=>e-t),r.push(o+c-4);let a=o+10;for(let t of r){if(t-6-a>=X[e])break;a=Math.max(a,t+6)}a+X[e]>o+c-4&&(a=o+10);let d=s+6+Se[e]/2,f=a;i.icon&&(u+=ce(i.icon,a,d-De/2,De,b),f+=De+6),u+=n(l,f+l.width/2,d,` class="pele-cluster-label" fill="var(--_m)"`,b)}Ue+=`<g class="pele-cluster" data-id="${t(i.id)}"><rect x="${a(o)}" y="${a(s)}" width="${a(c)}" height="${a(Le(e)-s)}" fill="var(--_a)" fill-opacity="0.5" stroke="var(--_b)"${r}/>`+u+`</g>`}let We=``,Ge=m*.5,Ke=Math.max(6,Math.round(h*.75));for(let e=0;e<w;e++){let o=S[e],s=`data-id="${t(o.id)}" transform="translate(${a(Re(e))},${a(Z[K[e]])})"`;if(o.type===`junction`){We+=`<g class="pele-node pele-junction" ${s}><circle cy="${a(x)}" r="${re}" fill="var(--_l)"/></g>`;continue}let c=``;if(o.icon)c=ce(o.icon,-Ge/2,(m-Ge)/2,Ge,b);else if(o.iconText){let e=i(o.iconText,!1,v,Ke,m-8),t=Math.max(1,Math.floor((m-4)/(e.lineHeight||1)));c=n(le(e,m-8,t,v),0,x,` class="pele-icon-text" font-size="${Ke}"`,b)}We+=`<g class="pele-node pele-service" ${s}><rect x="${a(-x)}" width="${a(m)}" height="${a(m)}" fill="var(--_s)" stroke="var(--_b)"${r}/>`+c+n(O[e],0,m+W+O[e].height/2,` class="pele-label"`,b)+`</g>`}let qe=i(o.title,!1,v,h,p?s(f):4e3,1),Je=qe.height>0?qe.height+12:0,Ye=Math.ceil(Math.max(Me-Q,qe.width)+2*y),Xe=Math.ceil(Ne-je+Je+2*y),Ze=Math.round((Ye-(Me-Q))/2-Q),Qe=Math.round(y+Je-je),$e=(Ue?`<g class="pele-clusters">${Ue}</g>`:``)+(Be?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round" stroke-linejoin="round">${Be}</g>`:``)+(Ve?`<g class="pele-edge-labels" font-size="${_}">${Ve}</g>`:``)+(We?`<g class="pele-nodes">${We}</g>`:``);return{svg:e(`architecture`,Ye,Xe,h,f,o,n(qe,Ye/2,y+qe.height/2,` class="pele-title" font-weight="var(--_tw)"`)+($e?`<g transform="translate(${Ze},${Qe})">${$e}</g>`:``)),width:Ye,height:Xe,links:[]}}var pe={type:`architecture`,parse(e,t,n){let r=new O;return n&&(r.title=n),k(P(e),r),r},render:G};export{pe as architecture};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as e,a as t,b as n,i as r,o as i,r as a,u as o,x as s}from"./
|
|
1
|
+
import{_ as e,a as t,b as n,i as r,o as i,r as a,u as o,x as s}from"./DEQsS4Ez.js";import{o as c,r as l}from"./DciMwFJ1.js";import{c as u,d,g as f,h as p,i as m,n as h,p as g,t as _}from"./CWc-mNzo.js";import{n as v,t as y}from"./BLzZIf7l.js";import{t as b}from"./DJQ6favH.js";import{PeleError as x,d as S,o as C,u as ee,v as w}from"./zasx25UV.js";var T=/[─━│┃└┗├┣]/,E=/[└┗├┣]/,D=/[─━]/,O=/^[\s│┃]+$/,k=/^[\s─━│┃└┗├┣]+$/,A=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,j=/^\s*%%/,M=` `;function N(e){return e.some(e=>T.test(e))}function P(e){for(let t of e){let e=E.exec(t);if(e?.index&&e.index>0)return e.index}return 4}function F(e,t){return e.replace(/\bline\s+(\d+)\b/gi,(e,n)=>{let r=t.get(parseInt(n,10));return r?`line ${r}`:e})}function I(e,t){let n=0;for(let r=1;r<t;r++)n=e.indexOf(`
|
|
2
2
|
`,n)+1;return n}function L(e,t,n){let{line:r}=C(e,I(e,t+1));throw new x(`Line ${r}: ${n}`,`syntax`,{type:`treeView`,line:r})}function R(e,t){let n=0;for(let r=0;n<e.length&&r<t;n++)r+=e[n]===` `?4:1;return n}function z(e){let t=new Map,n=new Map;if(!T.test(e))return{text:e,lineMap:t,columns:n};let r=e.split(`
|
|
3
3
|
`),i=-1;for(let e=0;e<r.length;e++)if(r[e].trim()===`treeView-beta`){i=e;break}if(i===-1)return{text:e,lineMap:t,columns:n};let a=e=>e.trim()===``||j.test(e)||A.test(e),o=[];for(let e=i+1;e<r.length;e++){let t=r[e];a(t)||O.test(t)||o.push(t.replace(/\t/g,` `))}if(!N(o))return{text:e,lineMap:t,columns:n};let s=P(o),c=[],l=(e,r,i)=>{c.push(e),t.set(c.length,r+1),i&&n.set(c.length,i)};for(let e=0;e<=i;e++)l(r[e],e);for(let t=i+1;t<r.length;t++){let n=r[t];if(a(n)){l(n,t);continue}if(O.test(n))continue;let i=n.replace(/\t/g,` `),o=E.exec(i);if(o){let r=Math.round(o.index/s)+1,a=o.index+1;for(;a<i.length&&D.test(i[a]);)a++;for(;a<i.length&&i[a]===` `;)a++;let c=i.slice(a).trimEnd();c||L(e,t,`Empty node — expected a filename or directory name after the box-drawing prefix`);let u=M.repeat(r);l(u+c,t,e=>R(n,a+Math.max(e-u.length,0)))}else{if(k.test(i))continue;T.test(i)?l(n,t):/^\s+/.test(i)?L(e,t,`Unexpected indentation without box-drawing characters. In box-drawing format, use ├── or └── prefixes for indented nodes.`):l(n,t)}}return{text:c.join(`
|
|
4
4
|
`),lineMap:t,columns:n}}function B(e,t){if(e.startsWith(`##`,t)||e.startsWith(`icon(`,t))return!0;if(!e.startsWith(`:::`,t))return!1;let n=t+3;for(;w(e.charCodeAt(n));)n++;let r=e.charCodeAt(n);return r>=65&&r<=90||r>=97&&r<=122||r===95}function V(e,t){let n=e.charCodeAt(t);if(w(n)||n===10||n===13||n===34||n===39||e.startsWith(`:::`,t)||e.startsWith(`icon(`,t)||e.startsWith(`##`,t))return-1;let r=e.length,i=t+1;for(;i<r;){let t=e.charCodeAt(i);if(t===10||t===13)break;if(w(t)){let t=i+1;for(;w(e.charCodeAt(t));)t++;if(B(e,t))break;i=t}else i++}return i}var H={name:`BARE_NAME`,pattern:/(?!:::|icon\(|##)[^ \t\n\r"'](?:(?![ \t]+:::[ \t]*[A-Za-z_]|[ \t]+icon\(|[ \t]+##)[^\n\r])*/y,match:V},U=[{...m(`treeView-beta`),longer:[H]},b(),_,g,{name:`CLASS_ANNOTATION`,pattern:/[ \t]+:::[ \t]*[A-Za-z_][\w-]*/y},{name:`ICON_ANNOTATION`,pattern:/[ \t]+icon\([\w-]*(?::[\w-]+)?\)/y},{name:`DESC_ANNOTATION`,pattern:/[ \t]+##[^\n\r]*/y},{name:`INDENTATION`,pattern:/[ \t]{1,}/y},{name:`QUOTED_NAME`,pattern:/"[^"]*"|'[^']*'/y},{name:`WS`,pattern:/[ \t]+/y,hidden:!0},{name:`ML_COMMENT`,pattern:/\%\%[^\n]*/y,hidden:!0},{name:`NL`,pattern:/\r?\n/y,hidden:!0},H];function W(e){let t=e.length;for(;t>0&&w(e.charCodeAt(t-1));)t--;return t===e.length?e:e.slice(0,t)}function G(e,t){switch(e){case`INDENTATION`:return t?.length||0;case`QUOTED_NAME`:return t.substring(1,t.length-1);case`BARE_NAME`:return W(t);case`CLASS_ANNOTATION`:return t.trim().substring(3).trim();case`ICON_ANNOTATION`:{let e=t.trim();return e.substring(5,e.length-1)}case`DESC_ANNOTATION`:return t.trim().substring(2).trim();default:return}}function K(e){let t=new p(h(e,U,`treeView`),U,`treeView`),n={$type:`TreeView`,nodes:[]};for(t.expect(0);;)if(t.kind===1)n.accDescr=u(t.take());else if(t.kind===2)n.accTitle=f(t.take());else if(t.kind===3)n.title=d(t.take());else break;for(;t.kind!==-1;){let e={$type:`TreeNode`,name:``};if(t.kind===7&&(e.indent=t.take().length),t.kind===8){let n=t.take();e.name=n.substring(1,n.length-1)}else t.kind===12?e.name=W(t.take()):t.fail(`a name`);for(;;)if(t.kind===4)e.classAnnotation=G(`CLASS_ANNOTATION`,t.take());else if(t.kind===5)e.iconAnnotation=G(`ICON_ANNOTATION`,t.take());else if(t.kind===6)e.descAnnotation=G(`DESC_ANNOTATION`,t.take());else break;n.nodes.push(e)}return n}var q=class{count=1;root={id:0,level:-1,name:`/`,nodeType:`directory`,children:[]};stack=[this.root];addNode(e,t,n,r,i,a){let o=this.stack;for(;e<=o[o.length-1].level;)o.pop();let s={id:this.count++,level:e,name:t,nodeType:n,icon:i,cssClass:r,description:a,children:[]};o[o.length-1].children.push(s),o.push(s)}};function J(e,t){for(let n of e.nodes){let e=typeof n.indent==`number`?n.indent:0,r=n.name,i=r.endsWith(`/`);i&&(r=r.slice(0,-1));let a=n.iconAnnotation;t.addNode(e,r,i?`directory`:`file`,n.classAnnotation||void 0,a===void 0?void 0:a||`none`,n.descAnnotation||void 0)}}function te(e){let{text:t,lineMap:n,columns:r}=z(e);try{return K(t)}catch(i){if(!(i instanceof x)||t===e)throw i;let a=n.get(i.line);if(a===void 0)throw i;let o=i.column>0?r.get(i.line)?.(i.column-1)??i.column-1:0,s=C(e,I(e,a)+o),c=i.message.includes(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,f as t,n,o as r,r as i,t as a}from"./BXBhaEho.js";function o(e){return e===`BT`||e===`LR`||e===`RL`?e:`TB`}var s=4e4,c=400,l=500,u=1.5,d=4;function f(e,t,n,r){let i=[];for(let t of e)i.push(t.x,t.y,t.w,t.h);let a=[];for(let e of t)a.push(e.labelX,e.labelY);let o=[];for(let e of n){o.push(e.x,e.y);for(let t of e.ports)o.push(t.px,t.py)}return{nodes:i,routes:t.map(e=>e.route),labels:a,levels:o,total:r}}function p(e,t,n,r){t.forEach((t,n)=>{t.x=e.nodes[4*n],t.y=e.nodes[4*n+1],t.w=e.nodes[4*n+2],t.h=e.nodes[4*n+3]}),n.forEach((t,n)=>{t.route=e.routes[n],t.labelX=e.labels[2*n],t.labelY=e.labels[2*n+1]});let i=0;for(let t of r){t.x=e.levels[i++],t.y=e.levels[i++];for(let n of t.ports)n.px=e.levels[i++],n.py=e.levels[i++]}return e.total}var m=24,h=.5,g=3,_=2,v=Math.max(3,g,_+1),y=.62,b=128;function x(e){return e.tracks?1:e.straight?2:0}function S(e,t,n=0){let r=0;for(let e of t)e.src!==e.dst&&e.route.length>3&&(r+=(e.route.length/3-1)*v);let a=new Float64Array(r),o=new Float64Array(r),s=new Float64Array(r),c=new Float64Array(r),l=new Float64Array(r),u=new Float64Array(r),d=new Int32Array(r),f=new Uint8Array(r),p=0,x=1/0,S=-1/0,C=NaN,w=NaN,T=NaN,E=NaN,D=(e,t,n,r,i,m)=>{let h=p-1;n===T&&r===E&&(m===r&&w===r||i===n&&C===n)&&d[h]===e&&f[h]===t&&(n-C)*(i-n)+(r-w)*(m-r)>0&&(p--,n=C,r=w),C=n,w=r,T=i,E=m,f[p]=t,a[p]=Math.min(n,i),s[p]=Math.max(n,i),o[p]=n<=i?r:m,c[p]=n<=i?m:r,l[p]=Math.min(r,m),u[p]=Math.max(r,m),l[p]<x&&(x=l[p]),u[p]>S&&(S=u[p]),d[p++]=e};for(let e=0;e<t.length;e++){let r=t[e];if(r.src===r.dst)continue;let a=r.route,o=e=>Math.abs(a[e]-a[e-3])<.01||Math.abs(a[e+1]-a[e-2])<.01,s=e=>Math.abs(a[e]-a[e-3])+Math.abs(a[e+1]-a[e-2]),c=e=>n===0&&e>0&&e<a.length-3&&o(e)&&o(e+3)&&s(e)>=.01&&s(e+3)>=.01&&Math.abs(a[e]-a[e-3])<.01!=Math.abs(a[e+3]-a[e])<.01,l=a[0],u=a[1];for(let t=3;t<a.length;t+=3){let r=+(t===3)|(t===a.length-3?2:0),d=l,f=u,p=a[t],m=a[t+1];if(l=p,u=m,o(t)||n===2){if(!c(t)){D(e,r,d,f,p,m);continue}let n=c(t-3)?s(t)/2:s(t),i=c(t+3)?s(t+3)/2:s(t+3),o=(p-a[t-3])/s(t),h=(m-a[t-2])/s(t),g=(a[t+3]-p)/s(t+3),v=(a[t+4]-m)/s(t+3),b=p-o*n,x=m-h*n;D(e,r,d,f,b,x);let S=p-o*n*(1-y),C=m-h*n*(1-y),w=p+g*i*(1-y),T=m+v*i*(1-y);l=p+g*i,u=m+v*i;let E=r|(t+3===a.length-3?2:0),O=b,k=x;for(let t=1;t<=_;t++){let n=t/_,r=1-n,i=r*r*r*b+3*r*r*n*S+3*r*n*n*w+n*n*n*l,a=r*r*r*x+3*r*r*n*C+3*r*n*n*T+n*n*n*u;D(e,E,O,k,i,a),O=i,k=a}continue}if(n===1){let n=a[t+2]===0,i=n?d:(d+p)/2,o=n?(f+m)/2:f;D(e,r,d,f,i,o),D(e,r,i,o,n?p:i,n?o:m),D(e,r,n?p:i,n?o:m,p,m);continue}let h=a[t+2]===0,v=h?i(p-d,m-f):i(m-f,p-d),b=d,x=f;for(let t=1;t<=g;t++){let n=t/g,i=1-n,a=n*n*(3-2*n),o=3*v*n*i*i+3*(1-v)*n*n*i+n*n*n,s=d+(p-d)*(h?a:o),c=f+(m-f)*(h?o:a);D(e,r,b,x,s,c),b=s,x=c}}}let O=S>x?Math.round(Math.sqrt(p)):1,k=S>x?O/(S-x):0,A=e=>Math.min(O-1,Math.floor((e-x)*k)),j=new Int32Array(p),M=new Int32Array(O+1);for(let e=0;e<p;e++){j[e]=A(l[e]);for(let t=j[e],n=A(u[e]);t<=n;t++)M[t+1]++}for(let e=0;e<O;e++)M[e+1]+=M[e];let N=M.slice(0,O),P=new Int32Array(M[O]);for(let e=0;e<p;e++)for(let t=j[e],n=A(u[e]);t<=n;t++)P[N[t]++]=e;let F=new Float64Array(t.length*8),I=(e,t,n,r)=>Math.abs(e[t]-e[n])<h&&Math.abs(e[t]-e[r])<h||Math.abs(e[t+1]-e[n+1])<h&&Math.abs(e[t+1]-e[r+1])<h;for(let e=0;e<t.length;e++){let n=t[e].route;if(n.length<6)continue;let r=3;for(;r+3<n.length&&I(n,0,r,r+3);)r+=3;let i=n.length-3,a=i-3;for(;a>=3&&I(n,i,a,a-3);)a-=3;F.set([n[0],n[1],n[r],n[r+1],n[a],n[a+1],n[i],n[i+1]],e*8)}let L=(e,t,n,r)=>{let i=e*8+(t===1?0:4),a=F[i],o=F[i+1],s=F[i+2]-a,c=F[i+3]-o,l=s*s+c*c,u=l>0?Math.max(0,Math.min(1,((n-a)*s+(r-o)*c)/l)):0;return Math.hypot(n-a-u*s,r-o-u*c)<h},R=0;for(let n=0;n<O;n++){let r=M[n+1];if(r-M[n]>b)P.subarray(M[n],r).sort((e,t)=>a[e]-a[t]||e-t);else for(let e=M[n]+1;e<r;e++){let t=P[e],r=e;for(;r>M[n]&&a[P[r-1]]>a[t];r--)P[r]=P[r-1];P[r]=t}for(let i=M[n];i<r;i++){let p=P[i],h=s[p]-a[p],g=c[p]-o[p],_=j[p]===n;for(let v=i+1;v<r;v++){let r=P[v];if(a[r]>s[p])break;if(u[r]<l[p]||l[r]>u[p]||d[p]===d[r]||!_&&j[r]!==n)continue;let i=h*(o[r]-o[p])-g*(a[r]-a[p]),y=h*(c[r]-o[p])-g*(s[r]-a[p]);if(i>0==y>0)continue;let b=s[r]-a[r],x=c[r]-o[r],S=b*(o[p]-o[r])-x*(a[p]-a[r]),C=b*(c[p]-o[r])-x*(s[p]-a[r]);if(S>0==C>0)continue;let w=t[d[p]],T=t[d[r]],E=S/(S-C),D=a[p]+E*h,O=o[p]+E*g,k=(t,n,i)=>(f[p]&n)!==0&&(f[r]&i)!==0||Math.abs(D-e[t].x)<e[t].w/2+m&&Math.abs(O-e[t].y)<e[t].h/2+m||L(d[p],n,D,O)&&L(d[r],i,D,O);w.src===T.src&&k(w.src,1,1)||w.src===T.dst&&k(w.src,1,2)||w.dst===T.src&&k(w.dst,2,1)||w.dst===T.dst&&k(w.dst,2,2)||R++}}}return R}function C(e,t,n,r){for(let t of e)t.x+=n,t.y+=r;for(let e of t){for(let t=0;t<e.route.length;t+=3)e.route[t]+=n,e.route[t+1]+=r;e.labelX+=n,e.labelY+=r}}function w(e,t,n=-1){return{w:e,h:t,parent:n,isGroup:!1,dir:void 0,padX:0,padTop:0,padBottom:0,minW:0,seq:0,span:0,x:0,y:0}}function T(e){return e===`TB`?0:e===`BT`?2:e===`LR`?3:1}function E(e){return e+2&3}function D(i,o,m,g){let _=i.length,v=new Map,y=[],b=(e,t)=>{let n={id:e,dir:t,items:[],edges:[],ports:[],portOf:new Map,routes:new Map,x:0,y:0};return v.set(e,n),n},C=b(-1,m),w=[];for(let e=0;e<_;e++)w.push([]);let D=[];for(let e=0;e<_;e++){let t=i[e].parent;t>=0&&t<_&&t!==e&&i[t].isGroup?w[t].push(e):(i[e].parent=-1,D.push(e))}C.items=D,y.push(C);let O=new Int32Array(_),k=new Uint8Array(_),A=e=>{for(let t=e;t<y.length;t++){let e=y[t];for(let t of e.items)if(k[t]=1,O[t]=e.id<0?0:O[e.id]+1,i[t].isGroup){let n=b(t,i[t].dir??e.dir);n.items=w[t],y.push(n)}}};A(0);for(let e=0;e<_;e++){if(k[e])continue;let t=i[e].parent;if(w[t]=w[t].filter(t=>t!==e),i[e].parent=-1,C.items.push(e),k[e]=1,O[e]=0,i[e].isGroup){let t=y.length,n=b(e,i[e].dir??m);n.items=w[e],y.push(n),A(t)}}for(let e=y.length-1;e>0;e--){let t=y[e],n=1/0;for(let e of t.items)i[e].seq<n&&(n=i[e].seq);n!==1/0&&(i[t.id].seq=n)}for(let e of y)e.items.sort((e,t)=>i[e].seq-i[t].seq||e-t);let j=0;for(let e of o){let t=e.src,n=e.dst,r=0;for(;O[t]>O[n];r++)t=i[t].parent;for(;O[n]>O[t];r++)n=i[n].parent;for(;t!==n&&i[t].parent!==i[n].parent;r+=2)t=i[t].parent,n=i[n].parent;t!==n&&(j+r>s?(e.src=t,e.dst=n):j+=r)}let M=[],N=[];for(let e=0;e<o.length;e++){let t=o[e];if(t.route=[],t.src===t.dst){M.push(e);continue}let n=t.src,r=t.dst,a=[],s=[];for(;O[n]>O[r];)a.push(n),n=i[n].parent;for(;O[r]>O[n];)s.push(r),r=i[r].parent;if(n===r)N.push(e);else{for(;i[n].parent!==i[r].parent;)a.push(n),s.push(r),n=i[n].parent,r=i[r].parent;v.get(i[n].parent).edges.push({e,a:n,b:r});for(let[t,n]of[[a,!0],[s,!1]])for(let r of t){let t=v.get(i[r].parent),a={e,inner:r,out:n,side:0,hint:NaN,px:0,py:0,route:[]};t.ports.push(a),t.portOf.set(e*2+ +!n,a)}}}let P=new Int32Array(_),F=(e,t,n)=>(n?t.src:t.dst)!==e,I=(e,t)=>{let n=e.dir===`TB`||e.dir===`BT`,s=T(e.dir),c=[],l=[];e.items.forEach((e,a)=>{P[e]=a;let o=i[e],s=t?r(n?o.w:o.h,n?o.h:o.w):r(0,0);s.span=o.isGroup?Math.min(o.span,s.w-2*o.padX):o.span,s.key=z?R[e]:NaN,c.push(s)});let u=(e,t,n)=>i[e].isGroup&&F(e,o[t],n),d=(e,r,a)=>{if(!t||!i[e].isGroup||!F(e,o[r],a))return 0;let s=v.get(e).portOf.get(r*2+ +!a);return n?s.px-i[e].w/2:s.py-i[e].h/2};for(let r of e.edges){let e=o[r.e],i=a(P[r.a],P[r.b],e.minlen);t&&(i.labelW=n?e.labelW:e.labelH,i.labelH=n?e.labelH:e.labelW,i.tailDx=d(r.a,r.e,!0),i.headDx=d(r.b,r.e,!1),i.tailFixed=u(r.a,r.e,!0),i.headFixed=u(r.b,r.e,!1)),l.push(i)}let f=new Int32Array(e.ports.length).fill(-1);return e.ports.forEach((t,n)=>{if(t.side===s||t.side===E(s)){let i=c.length,p=r(0,0,t.side===s?3:4);p.key=z?R[t.out?o[t.e].dst:o[t.e].src]:NaN,p.hint=Number.isNaN(t.hint)&&z&&V?V(e,t):t.hint,c.push(p),f[n]=i;let m=t.out?a(P[t.inner],i):a(i,P[t.inner]);t.out?(m.tailDx=d(t.inner,t.e,!0),m.tailFixed=u(t.inner,t.e,!0)):(m.headDx=d(t.inner,t.e,!1),m.headFixed=u(t.inner,t.e,!1)),l.push(m)}else c[P[t.inner]].pin=t.side===0||t.side===3?-1:1}),{lnodes:c,ledges:l,dummies:f}},L=j>1&&j<=c&&o.length<=l,R=new Float64Array(_).fill(NaN),z=!1,B=0,V,H=y.length>1&&L;for(let e of y)e.dir!==m&&(H=!1);if(H){let t=m===`TB`||m===`BT`,n=new Int32Array(_).fill(-1),s=new Int32Array(_).fill(-1),c=[],l=[],u=[];for(let e=0;e<_;e++)i[e].isGroup&&(s[e]=u.length,u.push(-1));for(let e=0;e<_;e++){let a=i[e].parent;i[e].isGroup?u[s[e]]=a>=0?s[a]:-1:(n[e]=c.length,c.push(r(t?i[e].w:i[e].h,t?i[e].h:i[e].w)),l.push(a>=0?s[a]:-1))}let d=[],f=new Int32Array(o.length).fill(-1);o.forEach((e,r)=>{e.src===e.dst||n[e.src]<0||n[e.dst]<0||(f[r]=d.length,d.push(a(n[e.src],n[e.dst],e.minlen,t?e.labelW:e.labelH,t?e.labelH:e.labelW)))});let p=e(c,d,{...g,groups:{of:Int32Array.from(l),parent:Int32Array.from(u)},orderOnly:!0});B=Math.min(p.crossings??0,p.declared??0);let h=new Float64Array(_),v=new Int32Array(_),y=new Int32Array(_).fill(-1);for(let e=0;e<_;e++)if(!(n[e]<0)){R[e]=c[n[e]].x;for(let t=i[e].parent;t>=0;t=i[t].parent)h[t]+=R[e],v[t]++,y[t]=Math.max(y[t],c[n[e]].rank)}for(let e=0;e<_;e++)v[e]>0&&(R[e]=h[e]/v[e]);V=(e,t)=>{let n=f[t.e];if(n<0||e.id<0||!t.out||t.side!==E(T(e.dir)))return NaN;let r=d[n].points,i=R[o[t.e].src],a=0;for(let t=0;t<r.length;t+=2)r[t]===y[e.id]&&(i=r[t+1]),r[t]===y[e.id]+1&&(a=r[t+1]);return i+a*1e-6}}let U=new Map,W=(t,n,r)=>{if(!L)return{lnodes:n,ledges:r,size:e(n,r,g)};let i=[];for(let e of n)i.push(e.w,e.h,e.kind,e.pin,e.hint,e.key,e.span);for(let e of r)i.push(e.tail,e.head,e.minlen,e.labelW,e.labelH,e.tailDx,e.headDx,+e.tailFixed,+e.headFixed);let a=U.get(t.id);a||U.set(t.id,a=[]);for(let e of a){let t=e.given.length===i.length;for(let n=0;t&&n<i.length;n++)t=Object.is(e.given[n],i[n]);if(t)return e}let o={given:i,lnodes:n,ledges:r,size:e(n,r,g)};return a.push(o),o},G={width:0,height:0},K=()=>{for(let e of y){for(let t of e.ports)i[t.inner].isGroup&&F(t.inner,o[t.e],t.out)&&(v.get(t.inner).portOf.get(t.e*2+ +!t.out).side=t.side);if(e.edges.length===0)continue;let r=!1;for(let t of e.edges){let e=o[t.e];(i[t.a].isGroup&&e.src!==t.a||i[t.b].isGroup&&e.dst!==t.b)&&(r=!0)}if(!r)continue;let{lnodes:a,ledges:s}=I(e,!1);t(a,s),n(a,s,1);let c=T(e.dir);e.edges.forEach((e,t)=>{let n=o[e.e],r=!s[t].reversed;i[e.a].isGroup&&n.src!==e.a&&(v.get(e.a).portOf.get(e.e*2).side=r?E(c):c),i[e.b].isGroup&&n.dst!==e.b&&(v.get(e.b).portOf.get(e.e*2+1).side=r?c:E(c))})}for(let e=y.length-1;e>=0;e--){let t=y[e],n=t.id>=0?i[t.id]:void 0,r=t.dir===`TB`||t.dir===`BT`,a=t.dir===`BT`||t.dir===`RL`,s=I(t,!0),{lnodes:c,ledges:l,size:u}=W(t,s.lnodes,s.ledges),d=s.dummies,f=r?u.width:u.height,p=r?u.height:u.width,m=n?n.padX:0,h=n?n.padTop:0,g=Math.max(f+2*m,n?n.minW:0),_=p+h+(n?n.padBottom:0),b=(g-f)/2,x=h,S=(e,t)=>b+(r?e:a?u.height-t:t),C=(e,t)=>x+(r?a?u.height-t:t:e),w=+!r,T=e=>{let t=[];for(let n=0;n<e.length;n+=2)t.push(S(e[n],e[n+1]),C(e[n],e[n+1]),w);return t};t.items.forEach((e,t)=>{i[e].x=S(c[t].x,c[t].y),i[e].y=C(c[t].x,c[t].y)}),t.edges.forEach((e,n)=>{let r=l[n];t.routes.set(e.e,T(r.points));let i=o[e.e];i.labelW>0&&(i.labelX=S(r.labelX,r.labelY),i.labelY=C(r.labelX,r.labelY))});let E=t.edges.length;t.ports.forEach((e,t)=>{let n=i[e.inner];if(d[t]>=0){let t=T(l[E++].points),n=e.out?t.length-3:0,r=t[n],i=t[n+1];e.side===0?i=0:e.side===2?i=_:r=e.side===3?0:g,e.out?t.push(r,i,w):t.unshift(r,i,w),e.px=r,e.py=i,e.route=t;return}let r=n.x,a=n.y;if(n.isGroup&&F(e.inner,o[e.e],e.out)){let t=v.get(e.inner).portOf.get(e.e*2+ +!e.out);r+=t.px-n.w/2,a+=t.py-n.h/2}else e.side===0?a-=n.h/2:e.side===2?a+=n.h/2:e.side===3?r-=n.w/2:r+=n.w/2;let s=r,c=a;e.side===0?c=0:e.side===2?c=_:s=e.side===3?0:g;let u=e.side===0||e.side===2?0:1;e.px=s,e.py=c,e.route=e.out?[r,a,u,s,c,u]:[s,c,u,r,a,u]}),n?(n.w=g,n.h=_):G={width:g,height:_}}for(let e of y){let t=e.x,n=e.y;for(let r of e.items){let e=i[r];if(e.x+=t,e.y+=n,e.isGroup){let t=v.get(r);t.x=e.x-e.w/2,t.y=e.y-e.h/2}}}let e=(e,t,n,r)=>{for(let i=0;i<t.length;i+=3){let a=t[i]+n,o=t[i+1]+r,s=e.length;s>=3&&Math.abs(e[s-3]-a)<.01&&Math.abs(e[s-2]-o)<.01||e.push(a,o,t[i+2])}};for(let t of y)for(let n of t.edges){let r=o[n.e],a=[],s=[];for(let e=r.src;i[e].parent!==t.id;e=i[e].parent)s.push(v.get(i[e].parent));for(let t of s)e(a,t.portOf.get(n.e*2).route,t.x,t.y);e(a,t.routes.get(n.e),t.x,t.y);let c=[];for(let e=r.dst;i[e].parent!==t.id;e=i[e].parent)c.push(v.get(i[e].parent));for(let t=c.length-1;t>=0;t--)e(a,c[t].portOf.get(n.e*2+1).route,c[t].x,c[t].y);r.route=a,r.labelW>0&&(r.labelX+=t.x,r.labelY+=t.y)}},q=x(g);z=H,K();let J=-1;if(H&&(J=S(i,o,q),J>B*u+d)){let e=f(i,o,y,G);z=!1,K();let t=S(i,o,q);t>=J?(z=!0,G=p(e,i,o,y)):J=t}if(z===H&&L){let e=!1;for(let t of y){if(t.id<0)continue;let n=i[t.id],r=t.dir===`TB`||t.dir===`BT`,a=E(T(t.dir)),s=[];for(let e of t.ports){if(e.side!==a)continue;let i=o[e.e].route,c=t.x+e.px,l=t.y+e.py,u=-1;for(let t=0;t<i.length&&(u<0||e.out);t+=3)Math.abs(i[t]-c)<.01&&Math.abs(i[t+1]-l)<.01&&(u=t);if(u<0)continue;let d=+!r,f=e.out?u+3:u-3;for(;f>=0&&f<i.length&&Math.abs(i[f+d]-i[u+d])<h;)f+=e.out?3:-3;f<0||f>=i.length||(e.hint=i[f+d]-(r?n.x-n.w/2:n.y-n.h/2),s.push([r?e.px:e.py,e.hint]))}s.sort((e,t)=>e[0]-t[0]);for(let t=1;t<s.length;t++)s[t-1][1]>s[t][1]&&(e=!0)}if(e){let e=J>=0?J:S(i,o,q),t=e>0?f(i,o,y,G):void 0;t&&(K(),S(i,o,q)>=e&&(G=p(t,i,o,y)))}}for(let e of N){let t=o[e],n=i[t.src],r=i[t.dst];t.route=[n.x,n.y,0,r.x,r.y,0],t.labelX=(n.x+r.x)/2,t.labelY=(n.y+r.y)/2}for(let e of M){let t=o[e],n=i[t.src];t.labelX=n.x+n.w/2+28+t.labelW/2,t.labelY=n.y}return G}export{D as i,C as n,o as r,w as t};
|
|
1
|
+
import{c as e,f as t,n,o as r,r as i,t as a}from"./Kem7IXj7.js";function o(e){return e===`BT`||e===`LR`||e===`RL`?e:`TB`}var s=4e4,c=400,l=500,u=1.5,d=4;function f(e,t,n,r){let i=[];for(let t of e)i.push(t.x,t.y,t.w,t.h);let a=[];for(let e of t)a.push(e.labelX,e.labelY);let o=[];for(let e of n){o.push(e.x,e.y);for(let t of e.ports)o.push(t.px,t.py)}return{nodes:i,routes:t.map(e=>e.route),labels:a,levels:o,total:r}}function p(e,t,n,r){t.forEach((t,n)=>{t.x=e.nodes[4*n],t.y=e.nodes[4*n+1],t.w=e.nodes[4*n+2],t.h=e.nodes[4*n+3]}),n.forEach((t,n)=>{t.route=e.routes[n],t.labelX=e.labels[2*n],t.labelY=e.labels[2*n+1]});let i=0;for(let t of r){t.x=e.levels[i++],t.y=e.levels[i++];for(let n of t.ports)n.px=e.levels[i++],n.py=e.levels[i++]}return e.total}var m=24,h=.5,g=3,_=2,v=Math.max(3,g,_+1),y=.62,b=128;function x(e){return e.tracks?1:e.straight?2:0}function S(e,t,n=0){let r=0;for(let e of t)e.src!==e.dst&&e.route.length>3&&(r+=(e.route.length/3-1)*v);let a=new Float64Array(r),o=new Float64Array(r),s=new Float64Array(r),c=new Float64Array(r),l=new Float64Array(r),u=new Float64Array(r),d=new Int32Array(r),f=new Uint8Array(r),p=0,x=1/0,S=-1/0,C=NaN,w=NaN,T=NaN,E=NaN,D=(e,t,n,r,i,m)=>{let h=p-1;n===T&&r===E&&(m===r&&w===r||i===n&&C===n)&&d[h]===e&&f[h]===t&&(n-C)*(i-n)+(r-w)*(m-r)>0&&(p--,n=C,r=w),C=n,w=r,T=i,E=m,f[p]=t,a[p]=Math.min(n,i),s[p]=Math.max(n,i),o[p]=n<=i?r:m,c[p]=n<=i?m:r,l[p]=Math.min(r,m),u[p]=Math.max(r,m),l[p]<x&&(x=l[p]),u[p]>S&&(S=u[p]),d[p++]=e};for(let e=0;e<t.length;e++){let r=t[e];if(r.src===r.dst)continue;let a=r.route,o=e=>Math.abs(a[e]-a[e-3])<.01||Math.abs(a[e+1]-a[e-2])<.01,s=e=>Math.abs(a[e]-a[e-3])+Math.abs(a[e+1]-a[e-2]),c=e=>n===0&&e>0&&e<a.length-3&&o(e)&&o(e+3)&&s(e)>=.01&&s(e+3)>=.01&&Math.abs(a[e]-a[e-3])<.01!=Math.abs(a[e+3]-a[e])<.01,l=a[0],u=a[1];for(let t=3;t<a.length;t+=3){let r=+(t===3)|(t===a.length-3?2:0),d=l,f=u,p=a[t],m=a[t+1];if(l=p,u=m,o(t)||n===2){if(!c(t)){D(e,r,d,f,p,m);continue}let n=c(t-3)?s(t)/2:s(t),i=c(t+3)?s(t+3)/2:s(t+3),o=(p-a[t-3])/s(t),h=(m-a[t-2])/s(t),g=(a[t+3]-p)/s(t+3),v=(a[t+4]-m)/s(t+3),b=p-o*n,x=m-h*n;D(e,r,d,f,b,x);let S=p-o*n*(1-y),C=m-h*n*(1-y),w=p+g*i*(1-y),T=m+v*i*(1-y);l=p+g*i,u=m+v*i;let E=r|(t+3===a.length-3?2:0),O=b,k=x;for(let t=1;t<=_;t++){let n=t/_,r=1-n,i=r*r*r*b+3*r*r*n*S+3*r*n*n*w+n*n*n*l,a=r*r*r*x+3*r*r*n*C+3*r*n*n*T+n*n*n*u;D(e,E,O,k,i,a),O=i,k=a}continue}if(n===1){let n=a[t+2]===0,i=n?d:(d+p)/2,o=n?(f+m)/2:f;D(e,r,d,f,i,o),D(e,r,i,o,n?p:i,n?o:m),D(e,r,n?p:i,n?o:m,p,m);continue}let h=a[t+2]===0,v=h?i(p-d,m-f):i(m-f,p-d),b=d,x=f;for(let t=1;t<=g;t++){let n=t/g,i=1-n,a=n*n*(3-2*n),o=3*v*n*i*i+3*(1-v)*n*n*i+n*n*n,s=d+(p-d)*(h?a:o),c=f+(m-f)*(h?o:a);D(e,r,b,x,s,c),b=s,x=c}}}let O=S>x?Math.round(Math.sqrt(p)):1,k=S>x?O/(S-x):0,A=e=>Math.min(O-1,Math.floor((e-x)*k)),j=new Int32Array(p),M=new Int32Array(O+1);for(let e=0;e<p;e++){j[e]=A(l[e]);for(let t=j[e],n=A(u[e]);t<=n;t++)M[t+1]++}for(let e=0;e<O;e++)M[e+1]+=M[e];let N=M.slice(0,O),P=new Int32Array(M[O]);for(let e=0;e<p;e++)for(let t=j[e],n=A(u[e]);t<=n;t++)P[N[t]++]=e;let F=new Float64Array(t.length*8),I=(e,t,n,r)=>Math.abs(e[t]-e[n])<h&&Math.abs(e[t]-e[r])<h||Math.abs(e[t+1]-e[n+1])<h&&Math.abs(e[t+1]-e[r+1])<h;for(let e=0;e<t.length;e++){let n=t[e].route;if(n.length<6)continue;let r=3;for(;r+3<n.length&&I(n,0,r,r+3);)r+=3;let i=n.length-3,a=i-3;for(;a>=3&&I(n,i,a,a-3);)a-=3;F.set([n[0],n[1],n[r],n[r+1],n[a],n[a+1],n[i],n[i+1]],e*8)}let L=(e,t,n,r)=>{let i=e*8+(t===1?0:4),a=F[i],o=F[i+1],s=F[i+2]-a,c=F[i+3]-o,l=s*s+c*c,u=l>0?Math.max(0,Math.min(1,((n-a)*s+(r-o)*c)/l)):0;return Math.hypot(n-a-u*s,r-o-u*c)<h},R=0;for(let n=0;n<O;n++){let r=M[n+1];if(r-M[n]>b)P.subarray(M[n],r).sort((e,t)=>a[e]-a[t]||e-t);else for(let e=M[n]+1;e<r;e++){let t=P[e],r=e;for(;r>M[n]&&a[P[r-1]]>a[t];r--)P[r]=P[r-1];P[r]=t}for(let i=M[n];i<r;i++){let p=P[i],h=s[p]-a[p],g=c[p]-o[p],_=j[p]===n;for(let v=i+1;v<r;v++){let r=P[v];if(a[r]>s[p])break;if(u[r]<l[p]||l[r]>u[p]||d[p]===d[r]||!_&&j[r]!==n)continue;let i=h*(o[r]-o[p])-g*(a[r]-a[p]),y=h*(c[r]-o[p])-g*(s[r]-a[p]);if(i>0==y>0)continue;let b=s[r]-a[r],x=c[r]-o[r],S=b*(o[p]-o[r])-x*(a[p]-a[r]),C=b*(c[p]-o[r])-x*(s[p]-a[r]);if(S>0==C>0)continue;let w=t[d[p]],T=t[d[r]],E=S/(S-C),D=a[p]+E*h,O=o[p]+E*g,k=(t,n,i)=>(f[p]&n)!==0&&(f[r]&i)!==0||Math.abs(D-e[t].x)<e[t].w/2+m&&Math.abs(O-e[t].y)<e[t].h/2+m||L(d[p],n,D,O)&&L(d[r],i,D,O);w.src===T.src&&k(w.src,1,1)||w.src===T.dst&&k(w.src,1,2)||w.dst===T.src&&k(w.dst,2,1)||w.dst===T.dst&&k(w.dst,2,2)||R++}}}return R}function C(e,t,n,r){for(let t of e)t.x+=n,t.y+=r;for(let e of t){for(let t=0;t<e.route.length;t+=3)e.route[t]+=n,e.route[t+1]+=r;e.labelX+=n,e.labelY+=r}}function w(e,t,n=-1){return{w:e,h:t,parent:n,isGroup:!1,dir:void 0,padX:0,padTop:0,padBottom:0,minW:0,seq:0,span:0,x:0,y:0}}function T(e){return e===`TB`?0:e===`BT`?2:e===`LR`?3:1}function E(e){return e+2&3}function D(i,o,m,g){let _=i.length,v=new Map,y=[],b=(e,t)=>{let n={id:e,dir:t,items:[],edges:[],ports:[],portOf:new Map,routes:new Map,x:0,y:0};return v.set(e,n),n},C=b(-1,m),w=[];for(let e=0;e<_;e++)w.push([]);let D=[];for(let e=0;e<_;e++){let t=i[e].parent;t>=0&&t<_&&t!==e&&i[t].isGroup?w[t].push(e):(i[e].parent=-1,D.push(e))}C.items=D,y.push(C);let O=new Int32Array(_),k=new Uint8Array(_),A=e=>{for(let t=e;t<y.length;t++){let e=y[t];for(let t of e.items)if(k[t]=1,O[t]=e.id<0?0:O[e.id]+1,i[t].isGroup){let n=b(t,i[t].dir??e.dir);n.items=w[t],y.push(n)}}};A(0);for(let e=0;e<_;e++){if(k[e])continue;let t=i[e].parent;if(w[t]=w[t].filter(t=>t!==e),i[e].parent=-1,C.items.push(e),k[e]=1,O[e]=0,i[e].isGroup){let t=y.length,n=b(e,i[e].dir??m);n.items=w[e],y.push(n),A(t)}}for(let e=y.length-1;e>0;e--){let t=y[e],n=1/0;for(let e of t.items)i[e].seq<n&&(n=i[e].seq);n!==1/0&&(i[t.id].seq=n)}for(let e of y)e.items.sort((e,t)=>i[e].seq-i[t].seq||e-t);let j=0;for(let e of o){let t=e.src,n=e.dst,r=0;for(;O[t]>O[n];r++)t=i[t].parent;for(;O[n]>O[t];r++)n=i[n].parent;for(;t!==n&&i[t].parent!==i[n].parent;r+=2)t=i[t].parent,n=i[n].parent;t!==n&&(j+r>s?(e.src=t,e.dst=n):j+=r)}let M=[],N=[];for(let e=0;e<o.length;e++){let t=o[e];if(t.route=[],t.src===t.dst){M.push(e);continue}let n=t.src,r=t.dst,a=[],s=[];for(;O[n]>O[r];)a.push(n),n=i[n].parent;for(;O[r]>O[n];)s.push(r),r=i[r].parent;if(n===r)N.push(e);else{for(;i[n].parent!==i[r].parent;)a.push(n),s.push(r),n=i[n].parent,r=i[r].parent;v.get(i[n].parent).edges.push({e,a:n,b:r});for(let[t,n]of[[a,!0],[s,!1]])for(let r of t){let t=v.get(i[r].parent),a={e,inner:r,out:n,side:0,hint:NaN,px:0,py:0,route:[]};t.ports.push(a),t.portOf.set(e*2+ +!n,a)}}}let P=new Int32Array(_),F=(e,t,n)=>(n?t.src:t.dst)!==e,I=(e,t)=>{let n=e.dir===`TB`||e.dir===`BT`,s=T(e.dir),c=[],l=[];e.items.forEach((e,a)=>{P[e]=a;let o=i[e],s=t?r(n?o.w:o.h,n?o.h:o.w):r(0,0);s.span=o.isGroup?Math.min(o.span,s.w-2*o.padX):o.span,s.key=z?R[e]:NaN,c.push(s)});let u=(e,t,n)=>i[e].isGroup&&F(e,o[t],n),d=(e,r,a)=>{if(!t||!i[e].isGroup||!F(e,o[r],a))return 0;let s=v.get(e).portOf.get(r*2+ +!a);return n?s.px-i[e].w/2:s.py-i[e].h/2};for(let r of e.edges){let e=o[r.e],i=a(P[r.a],P[r.b],e.minlen);t&&(i.labelW=n?e.labelW:e.labelH,i.labelH=n?e.labelH:e.labelW,i.tailDx=d(r.a,r.e,!0),i.headDx=d(r.b,r.e,!1),i.tailFixed=u(r.a,r.e,!0),i.headFixed=u(r.b,r.e,!1)),l.push(i)}let f=new Int32Array(e.ports.length).fill(-1);return e.ports.forEach((t,n)=>{if(t.side===s||t.side===E(s)){let i=c.length,p=r(0,0,t.side===s?3:4);p.key=z?R[t.out?o[t.e].dst:o[t.e].src]:NaN,p.hint=Number.isNaN(t.hint)&&z&&V?V(e,t):t.hint,c.push(p),f[n]=i;let m=t.out?a(P[t.inner],i):a(i,P[t.inner]);t.out?(m.tailDx=d(t.inner,t.e,!0),m.tailFixed=u(t.inner,t.e,!0)):(m.headDx=d(t.inner,t.e,!1),m.headFixed=u(t.inner,t.e,!1)),l.push(m)}else c[P[t.inner]].pin=t.side===0||t.side===3?-1:1}),{lnodes:c,ledges:l,dummies:f}},L=j>1&&j<=c&&o.length<=l,R=new Float64Array(_).fill(NaN),z=!1,B=0,V,H=y.length>1&&L;for(let e of y)e.dir!==m&&(H=!1);if(H){let t=m===`TB`||m===`BT`,n=new Int32Array(_).fill(-1),s=new Int32Array(_).fill(-1),c=[],l=[],u=[];for(let e=0;e<_;e++)i[e].isGroup&&(s[e]=u.length,u.push(-1));for(let e=0;e<_;e++){let a=i[e].parent;i[e].isGroup?u[s[e]]=a>=0?s[a]:-1:(n[e]=c.length,c.push(r(t?i[e].w:i[e].h,t?i[e].h:i[e].w)),l.push(a>=0?s[a]:-1))}let d=[],f=new Int32Array(o.length).fill(-1);o.forEach((e,r)=>{e.src===e.dst||n[e.src]<0||n[e.dst]<0||(f[r]=d.length,d.push(a(n[e.src],n[e.dst],e.minlen,t?e.labelW:e.labelH,t?e.labelH:e.labelW)))});let p=e(c,d,{...g,groups:{of:Int32Array.from(l),parent:Int32Array.from(u)},orderOnly:!0});B=Math.min(p.crossings??0,p.declared??0);let h=new Float64Array(_),v=new Int32Array(_),y=new Int32Array(_).fill(-1);for(let e=0;e<_;e++)if(!(n[e]<0)){R[e]=c[n[e]].x;for(let t=i[e].parent;t>=0;t=i[t].parent)h[t]+=R[e],v[t]++,y[t]=Math.max(y[t],c[n[e]].rank)}for(let e=0;e<_;e++)v[e]>0&&(R[e]=h[e]/v[e]);V=(e,t)=>{let n=f[t.e];if(n<0||e.id<0||!t.out||t.side!==E(T(e.dir)))return NaN;let r=d[n].points,i=R[o[t.e].src],a=0;for(let t=0;t<r.length;t+=2)r[t]===y[e.id]&&(i=r[t+1]),r[t]===y[e.id]+1&&(a=r[t+1]);return i+a*1e-6}}let U=new Map,W=(t,n,r)=>{if(!L)return{lnodes:n,ledges:r,size:e(n,r,g)};let i=[];for(let e of n)i.push(e.w,e.h,e.kind,e.pin,e.hint,e.key,e.span);for(let e of r)i.push(e.tail,e.head,e.minlen,e.labelW,e.labelH,e.tailDx,e.headDx,+e.tailFixed,+e.headFixed);let a=U.get(t.id);a||U.set(t.id,a=[]);for(let e of a){let t=e.given.length===i.length;for(let n=0;t&&n<i.length;n++)t=Object.is(e.given[n],i[n]);if(t)return e}let o={given:i,lnodes:n,ledges:r,size:e(n,r,g)};return a.push(o),o},G={width:0,height:0},K=()=>{for(let e of y){for(let t of e.ports)i[t.inner].isGroup&&F(t.inner,o[t.e],t.out)&&(v.get(t.inner).portOf.get(t.e*2+ +!t.out).side=t.side);if(e.edges.length===0)continue;let r=!1;for(let t of e.edges){let e=o[t.e];(i[t.a].isGroup&&e.src!==t.a||i[t.b].isGroup&&e.dst!==t.b)&&(r=!0)}if(!r)continue;let{lnodes:a,ledges:s}=I(e,!1);t(a,s),n(a,s,1);let c=T(e.dir);e.edges.forEach((e,t)=>{let n=o[e.e],r=!s[t].reversed;i[e.a].isGroup&&n.src!==e.a&&(v.get(e.a).portOf.get(e.e*2).side=r?E(c):c),i[e.b].isGroup&&n.dst!==e.b&&(v.get(e.b).portOf.get(e.e*2+1).side=r?c:E(c))})}for(let e=y.length-1;e>=0;e--){let t=y[e],n=t.id>=0?i[t.id]:void 0,r=t.dir===`TB`||t.dir===`BT`,a=t.dir===`BT`||t.dir===`RL`,s=I(t,!0),{lnodes:c,ledges:l,size:u}=W(t,s.lnodes,s.ledges),d=s.dummies,f=r?u.width:u.height,p=r?u.height:u.width,m=n?n.padX:0,h=n?n.padTop:0,g=Math.max(f+2*m,n?n.minW:0),_=p+h+(n?n.padBottom:0),b=(g-f)/2,x=h,S=(e,t)=>b+(r?e:a?u.height-t:t),C=(e,t)=>x+(r?a?u.height-t:t:e),w=+!r,T=e=>{let t=[];for(let n=0;n<e.length;n+=2)t.push(S(e[n],e[n+1]),C(e[n],e[n+1]),w);return t};t.items.forEach((e,t)=>{i[e].x=S(c[t].x,c[t].y),i[e].y=C(c[t].x,c[t].y)}),t.edges.forEach((e,n)=>{let r=l[n];t.routes.set(e.e,T(r.points));let i=o[e.e];i.labelW>0&&(i.labelX=S(r.labelX,r.labelY),i.labelY=C(r.labelX,r.labelY))});let E=t.edges.length;t.ports.forEach((e,t)=>{let n=i[e.inner];if(d[t]>=0){let t=T(l[E++].points),n=e.out?t.length-3:0,r=t[n],i=t[n+1];e.side===0?i=0:e.side===2?i=_:r=e.side===3?0:g,e.out?t.push(r,i,w):t.unshift(r,i,w),e.px=r,e.py=i,e.route=t;return}let r=n.x,a=n.y;if(n.isGroup&&F(e.inner,o[e.e],e.out)){let t=v.get(e.inner).portOf.get(e.e*2+ +!e.out);r+=t.px-n.w/2,a+=t.py-n.h/2}else e.side===0?a-=n.h/2:e.side===2?a+=n.h/2:e.side===3?r-=n.w/2:r+=n.w/2;let s=r,c=a;e.side===0?c=0:e.side===2?c=_:s=e.side===3?0:g;let u=e.side===0||e.side===2?0:1;e.px=s,e.py=c,e.route=e.out?[r,a,u,s,c,u]:[s,c,u,r,a,u]}),n?(n.w=g,n.h=_):G={width:g,height:_}}for(let e of y){let t=e.x,n=e.y;for(let r of e.items){let e=i[r];if(e.x+=t,e.y+=n,e.isGroup){let t=v.get(r);t.x=e.x-e.w/2,t.y=e.y-e.h/2}}}let e=(e,t,n,r)=>{for(let i=0;i<t.length;i+=3){let a=t[i]+n,o=t[i+1]+r,s=e.length;s>=3&&Math.abs(e[s-3]-a)<.01&&Math.abs(e[s-2]-o)<.01||e.push(a,o,t[i+2])}};for(let t of y)for(let n of t.edges){let r=o[n.e],a=[],s=[];for(let e=r.src;i[e].parent!==t.id;e=i[e].parent)s.push(v.get(i[e].parent));for(let t of s)e(a,t.portOf.get(n.e*2).route,t.x,t.y);e(a,t.routes.get(n.e),t.x,t.y);let c=[];for(let e=r.dst;i[e].parent!==t.id;e=i[e].parent)c.push(v.get(i[e].parent));for(let t=c.length-1;t>=0;t--)e(a,c[t].portOf.get(n.e*2+1).route,c[t].x,c[t].y);r.route=a,r.labelW>0&&(r.labelX+=t.x,r.labelY+=t.y)}},q=x(g);z=H,K();let J=-1;if(H&&(J=S(i,o,q),J>B*u+d)){let e=f(i,o,y,G);z=!1,K();let t=S(i,o,q);t>=J?(z=!0,G=p(e,i,o,y)):J=t}if(z===H&&L){let e=!1;for(let t of y){if(t.id<0)continue;let n=i[t.id],r=t.dir===`TB`||t.dir===`BT`,a=E(T(t.dir)),s=[];for(let e of t.ports){if(e.side!==a)continue;let i=o[e.e].route,c=t.x+e.px,l=t.y+e.py,u=-1;for(let t=0;t<i.length&&(u<0||e.out);t+=3)Math.abs(i[t]-c)<.01&&Math.abs(i[t+1]-l)<.01&&(u=t);if(u<0)continue;let d=+!r,f=e.out?u+3:u-3;for(;f>=0&&f<i.length&&Math.abs(i[f+d]-i[u+d])<h;)f+=e.out?3:-3;f<0||f>=i.length||(e.hint=i[f+d]-(r?n.x-n.w/2:n.y-n.h/2),s.push([r?e.px:e.py,e.hint]))}s.sort((e,t)=>e[0]-t[0]);for(let t=1;t<s.length;t++)s[t-1][1]>s[t][1]&&(e=!0)}if(e){let e=J>=0?J:S(i,o,q),t=e>0?f(i,o,y,G):void 0;t&&(K(),S(i,o,q)>=e&&(G=p(t,i,o,y)))}}for(let e of N){let t=o[e],n=i[t.src],r=i[t.dst];t.route=[n.x,n.y,0,r.x,r.y,0],t.labelX=(n.x+r.x)/2,t.labelY=(n.y+r.y)/2}for(let e of M){let t=o[e],n=i[t.src];t.labelX=n.x+n.w/2+28+t.labelW/2,t.labelY=n.y}return G}export{D as i,C as n,o as r,w as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e,a as t,f as n,i as r,o as i,s as a,u as o,x as s}from"./
|
|
1
|
+
import{_ as e,a as t,f as n,i as r,o as i,s as a,u as o,x as s}from"./DEQsS4Ez.js";import{n as c,r as l}from"./DciMwFJ1.js";import{PeleError as u,c as d,d as f,g as p,i as m,s as h,u as g}from"./zasx25UV.js";var _=class{type=`sankey`;nodes=[];links=[];title;accTitle;accDescr;lookup=new Map;findOrCreateNode(e){let t=this.lookup.get(e);return t===void 0&&(t={id:e,index:this.nodes.length},this.lookup.set(e,t),this.nodes.push(t)),t}addLink(e,t,n){this.links.push({source:e,target:t,value:n})}},v=[`$end`,`STUCK`,`SANKEY`,`NEWLINE`,`COMMA`,`DQUOTE`,`NON_ESCAPED_TEXT`,`ESCAPED_TEXT`,`EOF`];function y(e){return e>=32&&e<=126&&e!==34&&e!==44||e>=160&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}function b(e){let t=e.length,n=[],r=[],i=[],a=[],o=0,s=0,c=(t,a,o)=>{n.push(t),r.push(e.slice(a,o)),i.push(a),s=o},l=t=>e.slice(s,s+t.length).toLowerCase()===t&&!p(e.charCodeAt(s+t.length));for(;s<t;){let u=e.charCodeAt(s),d=s,f=s;if(o===2){if(u===34&&e.charCodeAt(s+1)!==34){a.length>0&&(o=a.pop()),c(5,s,s+1);continue}for(;f<t;){let t=e.codePointAt(f);if(y(t)||t===44||t===13||t===10)f+=t>65535?2:1;else if(t===34&&e.charCodeAt(f+1)===34)f+=2;else break}c(7,s,f)}else{if(o===0&&(u|32)==115){let e=l(`sankey-beta`)?11:l(`sankey`)?6:0;if(e>0){a.push(o),o=1,c(2,s,s+e);continue}}if(u===10||u===13&&e.charCodeAt(s+1)===10){c(3,s,u===10?s+1:s+2);continue}if(u===44){c(4,s,s+1);continue}if(u===34){a.push(o),o=2,c(5,s,s+1);continue}for(;f<t;){let t=e.codePointAt(f);if(!y(t))break;f+=t>65535?2:1}c(6,s,f)}if(f===d)return c(1,s,s),{types:n,texts:r,starts:i}}return c(o===2?7:8,t,t),c(0,t,t),{types:n,texts:r,starts:i}}var x=/[\n\r]+/g,S=/[\x00-\x08\x0b\x0c\x0e-\x1f\ud800-\udfff\ufffe\uffff]/u;function C(e){return e===10||e===13?!1:e<128?e===32||e===9||e===11||e===12:e===160||e===5760||e>=8192&&e<=8202||e===8232||e===8233||e===8239||e===8287||e===12288||e===65279}function w(e,t){let n=0,r=e.length;for(;n<r&&C(e.charCodeAt(n));)n++;for(;r>n&&C(e.charCodeAt(r-1));)r--;let i=e.slice(n,r),a=i.replace(x,`
|
|
2
2
|
`),o=a.trim();if(t!==void 0){let s=a.length-a.trimStart().length;t.push([[0,n,0],[r,e.length,0]],d(i,x,1),[[0,s,0],[s+o.length,a.length,0]])}return o}function T(e,t,n=e){let{types:r,texts:i,starts:a}=b(e),o=0,s=(t,r)=>{let i=[];n!==e&&w(n,i);let a=t>0&&t>=e.length?m(i,e.length-1)+1:m(i,t);return h(`sankey`,n,a,r)},c=e=>{let t=r[o],n=t===1?v[r[o-1]]:v[t];throw s(a[o],`Expecting ${e}, got '${n}'`)},l=(e,t=``)=>{r[o]!==e&&c(`'${v[e]}'${t}`),o++},u=()=>{if(r[o]===6)return i[o++];r[o]!==5&&c(`'DQUOTE', 'NON_ESCAPED_TEXT'`),o++,r[o]!==7&&c(`'ESCAPED_TEXT'`);let e=i[o++];return l(5),e},d=()=>{let e=a[o],t=u().trim().replaceAll(`""`,`"`);if(S.test(f(t)))throw s(e,`Invalid XML character in node name`);return t};for(l(2),l(3);;){let e=d();l(4,`, 'NEWLINE', 'EOF'`);let n=d();l(4,`, 'NEWLINE', 'EOF'`);let i=a[o],c=parseFloat(u());if(!Number.isFinite(c))throw s(i,`Expecting a number`);let f=t.findOrCreateNode(e),p=t.findOrCreateNode(n);if(t.addLink(f,p,c),r[o]!==3)break;o++}r[o]===8&&o++,r[o]!==0&&c(`'NEWLINE', 'EOF'`)}var ee=6;function E(e,t){if(e.length>8)e.sort(t);else for(let n=1;n<e.length;n++){let r=e[n],i=n-1;for(;i>=0&&t(e[i],r)>0;)e[i+1]=e[i],i--;e[i+1]=r}}function D(e,t){let n=e.nodes.length,r=e.links.map(e=>({source:e.source.index,target:e.target.index,value:Number.isFinite(e.value)&&e.value>0?e.value:0,thickness:0,sourceY:0,targetY:0})),i=[],a=[];for(let e=0;e<n;e++)i.push([]),a.push([]);r.forEach((e,t)=>{i[e.source].push(t),a[e.target].push(t)});let o=new Int32Array(n),s=new Int32Array(n),c=[];for(let e=0;e<n;e++)s[e]=a[e].length,s[e]===0&&c.push(e);for(let e=0;e<c.length;e++){let t=c[e];for(let e of i[t]){let n=r[e].target;o[n]<o[t]+1&&(o[n]=o[t]+1),--s[n]===0&&c.push(n)}}if(c.length<n){let t=0;for(;s[t]===0;)t++;let i=new Uint8Array(n);for(;i[t]===0;){i[t]=1;for(let e of a[t])if(s[r[e].source]>0){t=r[e].source;break}}throw new u(`Sankey diagrams cannot have circular links, and "${e.nodes[t].id}" is part of one.`,`semantic`,{type:`sankey`})}let l=1;for(let e=0;e<n;e++)o[e]+1>l&&(l=o[e]+1);let d=new Int32Array(n);for(let e=n-1;e>=0;e--){let t=c[e];for(let e of i[t])d[t]<d[r[e].target]+1&&(d[t]=d[r[e].target]+1)}let f=0;for(let e of r)e.value>f&&(f=e.value);let p=f>0?1/f:0,m=[],h=new Float64Array(n),g=[];for(let e=0;e<l;e++)g.push([]);let _=l>1?(t.width-t.nodeWidth)/(l-1):0;for(let e=0;e<n;e++){let n;if(t.alignment===`left`)n=o[e];else if(t.alignment===`right`)n=l-1-d[e];else if(t.alignment===`center`){if(n=o[e],a[e].length===0&&i[e].length>0){n=l;for(let t of i[e])o[r[t].target]-1<n&&(n=o[r[t].target]-1)}}else n=i[e].length>0?o[e]:l-1;let s=0,c=0,u=0,f=0;for(let t of a[e])s+=r[t].value*p,u+=r[t].value;for(let t of i[e])c+=r[t].value*p,f+=r[t].value;h[e]=Math.max(s,c),m.push({layer:n,value:Math.max(u,f),x:n*_,y:0,height:0}),g[n].push(e)}let v=1;for(let e of g)e.length>v&&(v=e.length);let y=v>1?Math.min(t.nodePadding,t.height/(v-1)):t.nodePadding,b=1/0;for(let e of g){let n=0;for(let t of e)n+=h[t];n>0&&(b=Math.min(b,(t.height-(e.length-1)*y)/n))}(!Number.isFinite(b)||b<0)&&(b=0);let x=Math.max(0,t.labelHeight-y),S=e=>{for(let n of g){let r=(n.length-1)*y;for(let t of n)r+=Math.max(h[t]*e,x);if(r>t.height+1e-6)return!1}return!0};if(x>0&&!S(b)){if(S(0)){let e=0;for(let t=0;t<40;t++){let t=(e+b)/2;S(t)?e=t:b=t}b=e}else x=0}let C=new Float64Array(n);for(let e of r)e.thickness=e.value*p*b;for(let e of g){let n=0;for(let t of e)m[t].height=h[t]*b,C[t]=Math.max(0,x-m[t].height)/2,m[t].y=n+C[t],n+=m[t].height+2*C[t]+y;let r=(t.height-n+y)/(e.length+1);e.forEach((e,t)=>m[e].y+=r*(t+1))}let w=e=>m[e].y+m[e].height/2,T=new Float64Array(r.length),D=new Float64Array(r.length),O=(e,t)=>w(r[e].target)-w(r[t].target)||e-t,k=(e,t)=>w(r[e].source)-w(r[t].source)||e-t,te=(e,t)=>w(e)-w(t)||e-t,A=e=>{let t=0;E(i[e],O);for(let n of i[e])T[n]=t+r[n].thickness/2,t+=r[n].thickness},j=e=>{let t=0;E(a[e],k);for(let n of a[e])D[n]=t+r[n].thickness/2,t+=r[n].thickness},M=()=>{for(let e=0;e<n;e++)A(e),j(e)},N=(e,n,o)=>{for(let t of e){let e=o?a[t]:i[t];if(e.length===0)continue;o?j(t):A(t);let s=0,c=0,l=0;for(let n of e){let e=o?m[r[n].source].y+T[n]-D[n]:m[r[n].target].y+D[n]-T[n];s+=e*r[n].thickness,c+=r[n].thickness,l+=w(o?r[n].source:r[n].target)-m[t].height/2}let u=c>0?s/c:l/e.length;m[t].y+=(u-m[t].y)*n}E(e,te);let s=0;for(let t of e)m[t].y-C[t]<s&&(m[t].y=s+C[t]),s=m[t].y+m[t].height+C[t]+y;s=t.height;for(let t=e.length-1;t>=0;t--){let n=e[t];m[n].y+m[n].height+C[n]>s&&(m[n].y=s-m[n].height-C[n]),s=m[n].y-C[n]-y}};M();for(let e=0;e<ee;e++){let t=.99**e;for(let e=l-2;e>=0;e--)N(g[e],t,!1);M();for(let e=1;e<l;e++)N(g[e],t,!0);M()}for(let e=0;e<r.length;e++)r[e].sourceY=m[r[e].source].y+T[e],r[e].targetY=m[r[e].target].y+D[e];return{nodes:m,links:r}}var O=6,k=15,te=1.8,A=300;function j(e){let t=2166136261,n=5381;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);t=Math.imul(t^i,16777619),n=Math.imul(n,33)+i|0}return(t>>>0).toString(36)+(n>>>0).toString(36)}function M(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function N(e,t,n,r,i){let a=e[t];return typeof a==`number`&&a>=r?Math.min(a,i):n}function ne(e,t){let n=e[t];return typeof n==`string`||typeof n==`number`&&Number.isFinite(n)?String(n):``}function re(e){return Math.abs(e)<0x38d7ea4c68000?Math.round(e*100)/100:e}function ie(e){return typeof e==`string`?a([`fill:${e}`]).shape:``}function P(e,t,n){let r=M(t.sankey)?t.sankey:{},i=N(r,`width`,600,1,1e4);return c(n,i,160,t=>F(e,r,n,t,i))}function F(a,c,u,d,p){let m=u.fontSize??16,h=Math.round(m*.625),_=Math.max(h,Math.round(m*.875*Math.min(1,d/p))),v=u.measurer??g(u.fontFamily,u.fontFamilyMono),y=u.padding??8,b=N(c,`height`,400,1,1e4),x=Math.min(N(c,`nodeWidth`,10,1,200),d),S=c.showValues!==!1,C=f(ne(c,`prefix`)),w=f(ne(c,`suffix`)),T=c.labelStyle===`outlined`,ee=c.nodeAlignment===`left`||c.nodeAlignment===`right`||c.nodeAlignment===`center`?c.nodeAlignment:`justify`,E=typeof c.linkColor==`string`?c.linkColor:`gradient`,P=e=>D(a,{width:d,height:b,nodeWidth:x,nodePadding:N(c,`nodePadding`,12,0,200)+(S?k:0),labelHeight:e*1.15,alignment:ee}),F=P(_),I=new Map,L=1;for(let e of F.nodes){let t=(I.get(e.layer)??0)+1;I.set(e.layer,t),t>L&&(L=t)}let R=Math.max(h,Math.round(b/L/te));R<_&&(_=R,F=P(_));let{nodes:z,links:ae}=F,B=_*1.5,V=new Map;if(M(c.nodeColors))for(let[e,t]of Object.entries(c.nodeColors)){let n=ie(t);n&&V.set(e,n)}let H=e=>V.get(a.nodes[e].id)??``,U=e=>/^ style="fill:(.*);"$/.exec(H(e))?.[1]??n(e),W=0,G=0;z.forEach(e=>{e.value>G&&(G=e.value,W=e.layer)});let K=0,q=d,J=0,Y=b,oe=z.map((e,t)=>{let n=f(a.nodes[t].id),r=S?`${C}${re(e.value)}${w}`:``,i=v.width(r?`${n} ${r}`:n,_,0),o=T?e.layer>=W:e.x<d/2,s=o?e.x+x+O:e.x-O,c=e.y+e.height/2;return K=Math.min(K,o?s:s-i),q=Math.max(q,o?s+i:s),J=Math.min(J,c-_*.75),Y=Math.max(Y,c+_*.75),{value:r,width:i,after:o,left:o?s:s-i,y:c}}),X=new Map;if(z.length<=A)for(let e of oe){let t=Math.floor(e.y/B);for(let n of[t-2,t-1,t,t+1,t+2]){let t=X.get(n);t?t.push(e):X.set(n,[e])}}let se=``,ce=``;z.forEach((e,i)=>{let o=a.nodes[i].id,c=f(o),l=Math.max(e.height,1);ce+=`<rect class="pele-sankey-node" data-id="${r(o)}" x="${s(e.x)}" y="${s(e.y)}" width="${s(x)}" height="${s(l)}" rx="${s(Math.min(2,l/2))}" fill="${n(i)}"${H(i)}/>`;let u=oe[i],d=(e,t)=>(X.get(Math.floor(t/B))??[]).some(n=>n!==u&&Math.abs(n.y-t)<B&&e<n.left+n.width+O&&e+u.width>n.left-O);if(z.length<=A&&d(u.left,u.y))e:for(let t of[0,-B,B])for(let n of[u.after,!u.after]){let r=n?e.x+x+O:e.x-O-u.width,a=u.y+t;if(d(r,a)||r<K||r+u.width>q||a-_*.75<J||a+_*.75>Y||z.some((e,t)=>t!==i&&r<e.x+x+O&&r+u.width>e.x-O&&a-_*.75<e.y+e.height&&a+_*.75>e.y))continue;let o=Math.max(0,e.y-a,a-e.y-e.height);if(!z.some((t,n)=>n!==i&&t.x===e.x&&Math.max(0,t.y-a,a-t.y-t.height)<=o)){u.left=r,u.y=a,u.after=n;break e}}let{value:p,after:m,y:h}=u,g=m?e.x+x+O:e.x-O,v=` x="${s(g)}" y="${s(h+_*.35)}" text-anchor="${m?`start`:`end`}"`,y=t(c)+(p?` <tspan class="pele-sankey-value" fill="var(--_m)">${t(p)}</tspan>`:``);se+=`<g class="pele-label" data-id="${r(o)}">`+(T?`<text${v} fill="none" stroke="var(--_bg)" stroke-width="3" stroke-linejoin="round">${t(c)}${p?` `+t(p):``}</text>`:``)+`<text${v}>${y}</text></g>`});let le=E===`gradient`||E===`source`||E===`target`?``:ie(E),ue=u.idPrefix??``,de=E===`gradient`&&/^[\w-]+$/.test(ue),Z=new Map,fe=``;for(let e of ae){let i=E===`target`?e.target:e.source,o=Math.max(e.thickness,1)/2,c=z[e.source].x+x,l=z[e.target].x,u=`fill="${n(i)}"${le||H(i)}`;if(de){let t=`x1="${s(c)}" x2="${s(l)}"><stop offset="0" stop-color="${U(e.source)}"/><stop offset="1" stop-color="${U(e.target)}"/>`,n=`${ue}-sankey-${j(t)}`;Z.set(n,`<linearGradient id="${n}" gradientUnits="userSpaceOnUse" ${t}</linearGradient>`),u=`fill="url(#${n}) ${U(e.source)}"`}let d=s((c+l)/2),f=r(a.nodes[e.source].id),p=r(a.nodes[e.target].id);fe+=`<path class="pele-sankey-link" data-id="${f}->${p}" d="M${s(c)},${s(e.sourceY-o)}C${d},${s(e.sourceY-o)} ${d},${s(e.targetY-o)} ${s(l)},${s(e.targetY-o)}L${s(l)},${s(e.targetY+o)}C${d},${s(e.targetY+o)} ${d},${s(e.sourceY+o)} ${s(c)},${s(e.sourceY+o)}Z" ${u}><title>${f} → ${p}: ${t(C)}${re(e.value)}${t(w)}</title></path>`}let Q=o(a.title,!1,v,m,l(u),1),pe=Q.height>0?Q.height+12:0,me=Math.max(q-K,Q.width),he=y-K+(me-(q-K))/2,ge=y+pe-J,$=Math.ceil(me+2*y),_e=Math.ceil(Y-J+pe+2*y);return{svg:e(`sankey`,$,_e,m,u,a,i(Q,$/2,y+Q.height/2,` class="pele-title" font-weight="var(--_tw)"`)+`<g transform="translate(${s(he)},${s(ge)})">`+(Z.size>0?`<defs>${[...Z.values()].join(``)}</defs>`:``)+`<g class="pele-sankey-links" fill-opacity="0.4">${fe}</g><g class="pele-sankey-nodes">${ce}</g><g class="pele-labels" font-size="${_}">${se}</g></g>`),width:$,height:_e,links:[]}}var I={type:`sankey`,parse(e,t,n){let r=new _;return n&&(r.title=n),T(w(e),r,e),r},render:P};export{I as sankey};
|